using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using Eremite.Controller;
using Eremite.Services;
using HarmonyLib;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("MoreTownNames")]
[assembly: AssemblyConfiguration("release")]
[assembly: AssemblyDescription("Adds custom town names to Against the Storm's random town name pool during embarkation")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+eb2359a25fd83ff7bf7502d532cb59299b54f000")]
[assembly: AssemblyProduct("MoreTownNames")]
[assembly: AssemblyTitle("MoreTownNames")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MoreTownNames
{
public static class NameProvider
{
public static List<string> GetCustomNames()
{
return (from n in TownNamesPlugin.CustomNames.Value.Split(new char[1] { ',' })
select n.Trim() into n
where !string.IsNullOrEmpty(n)
select n).ToList();
}
}
[BepInPlugin("MoreTownNames", "MoreTownNames", "1.0.0")]
public class TownNamesPlugin : BaseUnityPlugin
{
public static TownNamesPlugin Instance;
internal static ConfigEntry<string> CustomNames;
private Harmony harmony;
private void Awake()
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogInfo((object)"### MORE TOWN NAMES LOADED ###");
Instance = this;
string text = "Emberwatch,Stonehaven,Dunhold,Ashenvale,Ironholm,Mistwood,Northmark,Shadowpeak,Goldleaf,Ravenfort,Silvermere,Eversong,Ashenford,Bramblewatch,Cinderhollow,Duskmire,Ebonreach,Fallowrest,Gloomharbor,Hearthveil,Ironwood,Jadefen,Kestrelmoor,Lanternfall,Murkshade,Nightbarrow,Oakenspire,Pinehollow,Quarrydeep,Ravenmoor,Stonewake,Thornfield,Umbraforge,Valeguard,Windscar,Yewreach,Amberglade,Briarfall,Coalridge,Driftwood,Elderfen,Fogrest,Grimwillow,Hallowmere,Ivorybrook,Juniperwatch,Kindlewood,Lowmarsh,Mossgrove,Nettleford,Obsidian Vale,Pebblecross,Quickwater,Rusthollow,Silverfen,Tallowmere,Umberfield,Vinewatch,Wildbarrow,Yarrowfen,Zephyrmoor,Arborfall,Blackroot,Cragspire,Dewhollow,Emberfall,Fernreach,Gravelmere,Honeybrook,Ironscar,Knollrest,Larchveil,Moonfen,Narrowbrook,Oldenwatch,Portshade,Quiet Hollow,Ridgewake,Sableford,Twinbarrow,Umbral Cross,Valebrook,Westermire,Yonderfall,Ashen Hollow,Bleakwatch,Crowfen,Darkmere,Eastreach,Fallowbrook,Grimhollow,Hillshade,Jasper Hollow,Keelmoor,Lonewatch,Mirefall,Nightreach,Oakshade,Pale Hollow,Quillfen,Rustmere,Shadewatch,Timberfall,Umber Hollow,Veilmoor,Whitefen,Amber Hollow,Bramblemere,Cinderbrook,Duskwatch,Ebon Hollow,Fernmere,Gloombrook,Hearthfall,Ironmere,Jade Hollow,Kestrelbrook,Lanternmere,Murkbrook,Nightfall,Oakmere,Pinebrook,Quarrymere,Ravenbrook,Stonefall,Thornmere,Umbra Brook,Valehollow,Windmere,Yewbrook,Arborwatch,Blackmere,Cragbrook,Dewmere,Emberbrook,Fernfall,Gravelbrook,Honeymere,Ironbrook,Jaggedmere,Knollbrook,Larchmere,Moonbrook,Narrowmere,Oldenbrook,Portmere,Quietbrook,Ridgemere,Sablebrook,Twinmere,Valemere,Westermere,Yondermere,Ashenmere,Bleakbrook,Crowmere,Darkbrook,Eastmere,Fallowmere,Grimbrook,Hillmere,Jaspermere,Keelbrook,Lonebrook,Mirebrook,Nightmere,Oakbrook,Palemere,Quillbrook,Rustbrook,Shadebrook,Timberbrook,Umberbrook,Veilbrook,Whitebrook,Amberbrook,Bramblebrook,Duskbrook,Ebonbrook,Fernbrook,Gloombrook,Hearthbrook,Ironfall,Jadebrook,Kestrelmere,Lanternbrook,Murkfall,Nightbrook,Oakfall,Pinefall,Quarryfall,Ravenfall,Stonebrook,Thornbrook,Umbrafall,Valefall,Windbrook,Yewfall,Arborbrook,Blackbrook,Cragfall,Dewbrook,Embermere,Fernshade,Gravelshade,Honeyshade,Ironshade,Jaggedshade,Knollshade,Larchshade,Moonshade,Narrowshade,Oldenshade,Portshade,Quietshade,Ridgeshade,Sableshade,Twinshade,Valeshade,Westershade,Yondershade";
CustomNames = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomTownNames", text, "Comma-separated list of town names to add to the pool.");
((BaseUnityPlugin)this).Logger.LogInfo((object)("Loaded config names: " + CustomNames.Value));
harmony = new Harmony("MoreTownNames");
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoreTownNames patching complete.");
}
[HarmonyPatch(typeof(MainController), "OnServicesReady")]
[HarmonyPostfix]
private static void HookMainControllerSetup()
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)"Performing game initialization on behalf of MoreTownNames.");
((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"The game has loaded {MainController.Instance.Settings.effects.Length} effects.");
}
[HarmonyPatch(typeof(GameController), "StartGame")]
[HarmonyPostfix]
private static void HookEveryGameStart()
{
object arg = AccessTools.Method(typeof(GameService), "IsNewGame", (Type[])null, (Type[])null).Invoke(null, null);
((BaseUnityPlugin)Instance).Logger.LogInfo((object)$"Entered a game. Is this a new game: {arg}.");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "MoreTownNames";
public const string PLUGIN_NAME = "MoreTownNames";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace MoreTownNames.Patches
{
[HarmonyPatch(typeof(WorldStateService), "GetCitiesNamesKeys")]
public class WorldStateServicePatch
{
[HarmonyPostfix]
public static void GetCitiesNamesKeysPostfix(ref string[] __result)
{
List<string> customNames = NameProvider.GetCustomNames();
if (customNames != null && customNames.Count != 0)
{
List<string> list = __result?.ToList() ?? new List<string>();
list.AddRange(customNames);
list = list.Distinct().ToList();
ListShuffler.Shuffle<string>(list, (Random)null);
__result = list.ToArray();
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}