Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ThePack v420.0.513
plugins/FortecaClanWarfare.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FortecaClanWarfare.Core; using FortecaClanWarfare.Data; using FortecaClanWarfare.Network; using FortecaClanWarfare.Patches; using FortecaClanWarfare.UI; using FortecaClanWarfare.Utils; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("forteca")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Clan-based territory warfare mod for Valheim")] [assembly: AssemblyFileVersion("0.0.2.0")] [assembly: AssemblyInformationalVersion("0.0.2")] [assembly: AssemblyProduct("FortecaClanWarfare")] [assembly: AssemblyTitle("FortecaClanWarfare")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.2.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 FortecaClanWarfare { [BepInPlugin("com.forteca.clanwarfare", "Forteca Clan Warfare", "0.0.2")] [BepInProcess("valheim.exe")] [BepInProcess("valheim_server.exe")] public class Plugin : BaseUnityPlugin { public const string PluginGUID = "com.forteca.clanwarfare"; public const string PluginName = "Forteca Clan Warfare"; public const string PluginVersion = "0.0.2"; private Harmony _harmony; private GameObject _managerObj; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } private void Awake() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Invalid comparison between Unknown and I4 Instance = this; Log = ((BaseUnityPlugin)this).Logger; ClanConfig.Initialize(((BaseUnityPlugin)this).Config); _harmony = new Harmony("com.forteca.clanwarfare"); _harmony.PatchAll(typeof(Plugin).Assembly); _managerObj = new GameObject("FortecaClanWarfare"); Object.DontDestroyOnLoad((Object)(object)_managerObj); _managerObj.AddComponent<WarfareManager>(); _managerObj.AddComponent<WarfareRPC>(); if ((int)SystemInfo.graphicsDeviceType != 4) { _managerObj.AddComponent<GridManager>(); _managerObj.AddComponent<WarfareHUD>(); _managerObj.AddComponent<ClanSelectionUI>(); _managerObj.AddComponent<ClanNameTagRenderer>(); _managerObj.AddComponent<MapGridOverlay>(); _managerObj.AddComponent<TabMenuButtonRenderer>(); } Log.LogMessage((object)""); Log.LogMessage((object)" ============================================"); Log.LogMessage((object)" FORTECA CLAN WARFARE"); Log.LogMessage((object)" Developed by Freyja"); Log.LogMessage((object)" https://tinyurl.com/DiscordFreyja"); Log.LogMessage((object)" ============================================"); Log.LogMessage((object)""); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } if ((Object)(object)_managerObj != (Object)null) { Object.Destroy((Object)(object)_managerObj); } } } } namespace FortecaClanWarfare.Utils { public static class BiomeUtils { private static Dictionary<Vector2i, bool> _merchantCache = new Dictionary<Vector2i, bool>(); private static float _merchantCacheTime = 0f; private const float MerchantCacheLifetime = 60f; public static Biome GetBiomeAt(Vector3 position) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (WorldGenerator.instance == null) { return (Biome)1; } return WorldGenerator.instance.GetBiome(position); } public static Dictionary<int, float> SampleBiomeComposition(Vector2i gridPos, int sampleCount = 100) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected I4, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected I4, but got Unknown Dictionary<int, float> dictionary = new Dictionary<int, float>(); Vector3 regionCenter = VoronoiGrid.Instance.GetRegionCenter(gridPos); float num = VoronoiGrid.Instance.GetApproximateRegionRadius(gridPos); if (num < 200f) { num = 200f; } if (num > 2000f) { num = 2000f; } int num2 = (int)Mathf.Sqrt((float)sampleCount); if (num2 < 5) { num2 = 5; } float num3 = num * 2f; float num4 = num3 * 2f / (float)num2; int num5 = 0; Vector3 val = default(Vector3); for (int i = 0; i < num2; i++) { for (int j = 0; j < num2; j++) { float num6 = regionCenter.x - num3 + ((float)i + 0.5f) * num4; float num7 = regionCenter.z - num3 + ((float)j + 0.5f) * num4; ((Vector3)(ref val))..ctor(num6, 0f, num7); Vector2i region = VoronoiGrid.Instance.GetRegion(val); if (region.x == gridPos.x && region.y == gridPos.y) { int key = (int)GetBiomeAt(val); if (!dictionary.ContainsKey(key)) { dictionary[key] = 0f; } dictionary[key]++; num5++; } } } if (num5 > 0) { foreach (int item in new List<int>(dictionary.Keys)) { dictionary[item] = dictionary[item] / (float)num5 * 100f; } } if (num5 == 0) { Biome biomeAt = GetBiomeAt(regionCenter); dictionary[(int)biomeAt] = 100f; } return dictionary; } public static bool CellHasMerchant(Vector2i gridPos) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZoneSystem.instance == (Object)null) { return false; } if (Time.time - _merchantCacheTime > 60f) { _merchantCache.Clear(); _merchantCacheTime = Time.time; } if (_merchantCache.TryGetValue(gridPos, out var value)) { return value; } bool flag = false; Vector3 worldPos = default(Vector3); foreach (KeyValuePair<Vector2i, LocationInstance> locationInstance in ZoneSystem.instance.m_locationInstances) { LocationInstance value2 = locationInstance.Value; if (value2.m_location == null) { continue; } string text = value2.m_location.m_prefabName?.ToLower() ?? ""; if (text.Contains("haldor") || text.Contains("hildir")) { ((Vector3)(ref worldPos))..ctor(value2.m_position.x, 0f, value2.m_position.z); Vector2i region = VoronoiGrid.Instance.GetRegion(worldPos); if (region.x == gridPos.x && region.y == gridPos.y) { flag = true; break; } } } _merchantCache[gridPos] = flag; return flag; } public static Biome GetDominantBiome(Dictionary<int, float> composition) { if (composition != null && composition.Count != 0) { int num = 1; float num2 = 0f; foreach (KeyValuePair<int, float> item in composition) { if (item.Value > num2) { num2 = item.Value; num = item.Key; } } return (Biome)num; } return (Biome)1; } public static bool HasPointOfInterest(Vector2i gridPos) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZoneSystem.instance == (Object)null) { return false; } Vector3 worldPos = default(Vector3); foreach (KeyValuePair<Vector2i, LocationInstance> locationInstance in ZoneSystem.instance.m_locationInstances) { LocationInstance value = locationInstance.Value; if (value.m_location != null && IsPOILocation(value.m_location.m_prefabName ?? "")) { ((Vector3)(ref worldPos))..ctor(value.m_position.x, 0f, value.m_position.z); Vector2i region = VoronoiGrid.Instance.GetRegion(worldPos); if (region.x == gridPos.x && region.y == gridPos.y) { return true; } } } return false; } private static bool IsPOILocation(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return false; } string text = prefabName.ToLower(); if (text.Contains("altar") || text.Contains("boss")) { return true; } if (text.Contains("haldor") || text.Contains("hildir")) { return true; } if (text.Contains("infectedmine") || text.Contains("sunkencrypt") || text.Contains("mountaincave") || text.Contains("goblinking")) { return true; } return false; } public static Color GetBiomeColor(Biome biome) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((int)biome <= 16) { switch (biome - 1) { default: if ((int)biome != 8) { if ((int)biome != 16) { break; } return new Color(0.9f, 0.85f, 0.4f); } return new Color(0.2f, 0.4f, 0.2f); case 0: return new Color(0.4f, 0.8f, 0.3f); case 1: return new Color(0.4f, 0.35f, 0.2f); case 3: return new Color(0.8f, 0.8f, 0.9f); case 2: break; } } else if ((int)biome <= 64) { if ((int)biome == 32) { return new Color(0.8f, 0.3f, 0.2f); } if ((int)biome == 64) { return new Color(0.7f, 0.9f, 1f); } } else { if ((int)biome == 256) { return new Color(0.2f, 0.4f, 0.8f); } if ((int)biome == 512) { return new Color(0.5f, 0.3f, 0.6f); } } return Color.gray; } public static string GetBiomeName(Biome biome) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if ((int)biome <= 16) { switch (biome - 1) { default: if ((int)biome != 8) { if ((int)biome != 16) { break; } return "Plains"; } return "Black Forest"; case 0: return "Meadows"; case 1: return "Swamp"; case 3: return "Mountain"; case 2: break; } } else if ((int)biome <= 64) { if ((int)biome == 32) { return "Ashlands"; } if ((int)biome == 64) { return "Deep North"; } } else { if ((int)biome == 256) { return "Ocean"; } if ((int)biome == 512) { return "Mistlands"; } } if ((biome & 0x20) != 0) { return "Ashlands"; } if ((biome & 0x40) != 0) { return "Deep North"; } if ((biome & 0x200) != 0) { return "Mistlands"; } if ((biome & 0x10) != 0) { return "Plains"; } if ((biome & 4) != 0) { return "Mountain"; } if ((biome & 2) != 0) { return "Swamp"; } if ((biome & 8) != 0) { return "Black Forest"; } if ((biome & 1) != 0) { return "Meadows"; } if ((biome & 0x100) != 0) { return "Ocean"; } return "Wilds"; } public static float GetBiomeTollMultiplier(Biome biome) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 Biome val = ResolveBiome(biome); if ((int)val <= 16) { switch (val - 1) { default: if ((int)val != 8) { if ((int)val != 16) { break; } return 3f; } return 1.5f; case 0: return 1f; case 1: return 2f; case 3: return 2.5f; case 2: break; } } else if ((int)val <= 64) { if ((int)val == 32) { return 5f; } if ((int)val == 64) { return 3f; } } else { if ((int)val == 256) { return 0.5f; } if ((int)val == 512) { return 4f; } } return 1f; } public static Biome ResolveBiome(Biome biome) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if ((int)biome <= 16) { if ((int)biome <= 4) { if (biome - 1 <= 1 || (int)biome == 4) { goto IL_0041; } } else if ((int)biome == 8 || (int)biome == 16) { goto IL_0041; } } else if ((int)biome <= 64) { if ((int)biome == 32 || (int)biome == 64) { goto IL_0041; } } else if ((int)biome == 256 || (int)biome == 512) { goto IL_0041; } if ((biome & 0x20) == 0) { if ((biome & 0x40) == 0) { if ((biome & 0x200) == 0) { if ((biome & 0x10) == 0) { if ((biome & 4) == 0) { if ((biome & 2) == 0) { if ((biome & 8) == 0) { if ((biome & 1) == 0) { if ((biome & 0x100) == 0) { return (Biome)1; } return (Biome)256; } return (Biome)1; } return (Biome)8; } return (Biome)2; } return (Biome)4; } return (Biome)16; } return (Biome)512; } return (Biome)64; } return (Biome)32; IL_0041: return biome; } } public static class TerritoryNaming { private static readonly string[] NorthPrefixes = new string[5] { "Norðri", "Northern", "Frost", "Winter's", "Boreal" }; private static readonly string[] SouthPrefixes = new string[5] { "Suðri", "Southern", "Sun's", "Warm", "Golden" }; private static readonly string[] EastPrefixes = new string[5] { "Austri", "Eastern", "Dawn", "Rising", "Morning" }; private static readonly string[] WestPrefixes = new string[5] { "Vestri", "Western", "Twilight", "Setting", "Dusk" }; private static readonly string[] CenterPrefixes = new string[5] { "Miðgarð", "Central", "Heart of", "Ancient", "Old" }; private static readonly Dictionary<Biome, string[]> BiomeNames = new Dictionary<Biome, string[]> { { (Biome)1, new string[8] { "Meadow", "Grassland", "Green Vale", "Peaceful Fields", "Idavoll", "Folkvangr", "Verdant Lea", "Shepherd's Rest" } }, { (Biome)8, new string[8] { "Dark Woods", "Eerie Forest", "Shadow Grove", "Myrkviðr", "Ironwood", "Troll's Domain", "Whispering Pines", "Draugr's Reach" } }, { (Biome)2, new string[8] { "Murky Fen", "Poison Marsh", "Dead Man's Bog", "Hel's Mire", "Rotting Wetlands", "Drowned Vale", "Festering Swamp", "Corpse Marsh" } }, { (Biome)4, new string[8] { "Frost Peak", "Stone Heights", "Jötunheimr", "Eagle's Nest", "Ice Crown", "Thunder Summit", "Goat's Path", "Windswept Ridge" } }, { (Biome)16, new string[8] { "Golden Plains", "Fuling Lands", "Scorched Fields", "Barren Reach", "Vigriðr", "Blood Prairie", "Deathstalker's Domain", "Sun-bleached Expanse" } }, { (Biome)512, new string[8] { "Shrouded Vale", "Spider's Web", "Mist Hollow", "Gjöll", "Veiled Ruins", "Ancient's Rest", "Forgotten Realm", "Skuld's Domain" } }, { (Biome)32, new string[8] { "Scorched Waste", "Múspellheim", "Ember Fields", "Burning Reach", "Cinder Vale", "Charred Domain", "Flame's Edge", "Surt's Realm" } }, { (Biome)64, new string[8] { "Frozen Waste", "Niflheim", "Eternal Ice", "Frost Giant's Land", "Glacial Expanse", "Winter's End", "Permafrost Domain", "Hrimfaxi's Path" } }, { (Biome)256, new string[8] { "Ægir's Domain", "Depths", "Serpent's Sea", "Njord's Waters", "Kraken's Reach", "Wayward Waves", "Storm Channel", "Ran's Grasp" } } }; private static readonly string[] MixedSuffixes = new string[6] { "Borderlands", "Frontier", "Crossroads", "Threshold", "Edge", "Marches" }; private static readonly string[] MerchantModifiers = new string[4] { "Market", "Trade Post", "Merchant's Haven", "Trader's Rest" }; private static readonly string[] BossModifiers = new string[4] { "Altar", "Sacred Ground", "Ritual Site", "Offering Place" }; public static string GenerateTerritoryName(Vector2i gridPos, Dictionary<int, float> biomeComposition, bool hasMerchant = false, bool hasBossAltar = false) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (biomeComposition == null || biomeComposition.Count == 0) { return $"Unknown Land ({gridPos.x}, {gridPos.y})"; } Random random = new Random(gridPos.x * 10000 + gridPos.y); Biome dominantBiome = GetDominantBiome(biomeComposition); float biomePercent = GetBiomePercent(biomeComposition, dominantBiome); string directionalPrefix = GetDirectionalPrefix(gridPos, random); string text = GetBiomeName(dominantBiome, random); if (biomePercent < 70f && biomeComposition.Count > 1) { Biome secondaryBiome = GetSecondaryBiome(biomeComposition, dominantBiome); if (secondaryBiome != dominantBiome) { string text2 = MixedSuffixes[random.Next(MixedSuffixes.Length)]; text = GetShortBiomeName(dominantBiome) + "-" + GetShortBiomeName(secondaryBiome) + " " + text2; } } if (hasMerchant) { string text3 = MerchantModifiers[random.Next(MerchantModifiers.Length)]; return directionalPrefix + " " + text3; } if (hasBossAltar) { string text4 = BossModifiers[random.Next(BossModifiers.Length)]; return text + " " + text4; } return directionalPrefix + " " + text; } public static string GetSimpleName(Vector2i gridPos, Dictionary<int, float> biomeComposition) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (biomeComposition == null || biomeComposition.Count == 0) { return "Unknown"; } Random rng = new Random(gridPos.x * 10000 + gridPos.y); return GetBiomeName(GetDominantBiome(biomeComposition), rng); } private static string GetDirectionalPrefix(Vector2i gridPos, Random rng) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Vector3 regionCenter = VoronoiGrid.Instance.GetRegionCenter(gridPos); float x = regionCenter.x; float z = regionCenter.z; if (Mathf.Sqrt(x * x + z * z) < 2000f) { return CenterPrefixes[rng.Next(CenterPrefixes.Length)]; } float num = Mathf.Atan2(z, x) * 57.29578f; if (num >= 45f && num < 135f) { return NorthPrefixes[rng.Next(NorthPrefixes.Length)]; } if (num >= -45f && num < 45f) { return EastPrefixes[rng.Next(EastPrefixes.Length)]; } if (num >= -135f && num < -45f) { return SouthPrefixes[rng.Next(SouthPrefixes.Length)]; } return WestPrefixes[rng.Next(WestPrefixes.Length)]; } private static string GetBiomeName(Biome biome, Random rng) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (BiomeNames.TryGetValue(biome, out var value)) { return value[rng.Next(value.Length)]; } Biome val = ResolveBiomeFlag(biome); if (val != biome && BiomeNames.TryGetValue(val, out var value2)) { return value2[rng.Next(value2.Length)]; } return "Wilderness"; } private static Biome ResolveBiomeFlag(Biome biome) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if ((biome & 0x20) != 0) { return (Biome)32; } if ((biome & 0x40) != 0) { return (Biome)64; } if ((biome & 0x200) != 0) { return (Biome)512; } if ((biome & 0x10) != 0) { return (Biome)16; } if ((biome & 4) != 0) { return (Biome)4; } if ((biome & 2) != 0) { return (Biome)2; } if ((biome & 8) != 0) { return (Biome)8; } if ((biome & 1) != 0) { return (Biome)1; } if ((biome & 0x100) != 0) { return (Biome)256; } return biome; } private static string GetShortBiomeName(Biome biome) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((biome & 0x20) != 0) { return "Ash"; } if ((biome & 0x40) != 0) { return "Frost"; } if ((biome & 0x200) != 0) { return "Mist"; } if ((biome & 0x10) != 0) { return "Plains"; } if ((biome & 4) != 0) { return "Mountain"; } if ((biome & 2) != 0) { return "Swamp"; } if ((biome & 8) != 0) { return "Forest"; } if ((biome & 1) != 0) { return "Meadow"; } if ((biome & 0x100) != 0) { return "Sea"; } return "Wilds"; } private static Biome GetDominantBiome(Dictionary<int, float> composition) { int num = 1; float num2 = 0f; foreach (KeyValuePair<int, float> item in composition) { if (item.Value > num2) { num2 = item.Value; num = item.Key; } } return (Biome)num; } private static Biome GetSecondaryBiome(Dictionary<int, float> composition, Biome exclude) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between I4 and Unknown int num = (int)exclude; float num2 = 0f; foreach (KeyValuePair<int, float> item in composition) { if (item.Key != (int)exclude && item.Value > num2) { num2 = item.Value; num = item.Key; } } return (Biome)num; } private static float GetBiomePercent(Dictionary<int, float> composition, Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected I4, but got Unknown if (!composition.TryGetValue((int)biome, out var value)) { return 0f; } return value; } public static string GetBiomeCompositionDescription(Dictionary<int, float> composition) { if (composition == null || composition.Count == 0) { return "Unknown terrain"; } List<string> list = new List<string>(); List<KeyValuePair<int, float>> list2 = new List<KeyValuePair<int, float>>(composition); list2.Sort((KeyValuePair<int, float> a, KeyValuePair<int, float> b) => b.Value.CompareTo(a.Value)); foreach (KeyValuePair<int, float> item in list2) { if (item.Value >= 5f) { string biomeName = BiomeUtils.GetBiomeName((Biome)item.Key); list.Add($"{biomeName} {item.Value:F0}%"); } } return string.Join(", ", list); } } public class VoronoiGrid { private static VoronoiGrid _instance; private static readonly object _lock = new object(); private List<Vector2> _seeds; private Dictionary<long, int> _quantizedToIndex; private Dictionary<long, List<int>> _spatialGrid; private const float SpatialCellSize = 2000f; private Dictionary<long, Vector2i> _regionCache; private const float CacheQuantize = 8f; private float MapRadius = 10500f; private float _spawnProtectionRadius; public static VoronoiGrid Instance { get { if (_instance == null) { lock (_lock) { if (_instance == null) { _instance = new VoronoiGrid(); } } } return _instance; } } public bool IsInitialized { get; private set; } public int SpawnZoneSeedIndex => 0; public int RegionCount { get { EnsureInitialized(); return _seeds.Count; } } public static void Reset() { lock (_lock) { _instance = null; } } private VoronoiGrid() { _seeds = new List<Vector2>(); _quantizedToIndex = new Dictionary<long, int>(); _spatialGrid = new Dictionary<long, List<int>>(); _regionCache = new Dictionary<long, Vector2i>(); IsInitialized = false; } public void Initialize(string worldName) { if (!IsInitialized) { _spawnProtectionRadius = ClanConfig.SpawnProtectionRadius?.Value ?? 2500; MapRadius = 10500f; int num = 180; int num2 = worldName?.GetHashCode() ?? 0; Plugin.Log.LogWarning((object)$"VoronoiGrid: MapRadius={MapRadius}, TerritoryCount={num}, SpawnProtection={_spawnProtectionRadius}, WorldSeed={num2}"); GenerateSeeds(num2, num); BuildSpatialGrid(); BuildQuantizedIndex(); IsInitialized = true; Plugin.Log.LogWarning((object)$"VoronoiGrid initialized with {_seeds.Count} regions for world '{worldName}' (radius={MapRadius})"); } } public void EnsureInitialized() { if (!IsInitialized) { string text = null; if ((Object)(object)ZNet.instance != (Object)null) { text = ZNet.instance.GetWorldName(); } if (string.IsNullOrEmpty(text)) { text = "default_world"; } Initialize(text); } } private void GenerateSeeds(int worldSeed, int targetCount) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) _seeds.Clear(); Random random = new Random(worldSeed); _seeds.Add(new Vector2(0f, 0f)); float num = MapRadius * 2f / Mathf.Sqrt((float)targetCount) * 0.6f; int num2 = targetCount * 80; int num3 = 0; while (_seeds.Count < targetCount && num3 < num2) { num3++; float num4 = (float)(random.NextDouble() * 2.0 * Math.PI); float num5 = (float)Math.Sqrt(random.NextDouble()) * (MapRadius - 200f); float num6 = num5 * Mathf.Cos(num4); float num7 = num5 * Mathf.Sin(num4); if (num6 * num6 + num7 * num7 < _spawnProtectionRadius * _spawnProtectionRadius) { continue; } float num8 = Mathf.Sqrt(num6 * num6 + num7 * num7) / MapRadius; float num9 = 0.3f + num8 * 1.5f; float num10 = 0.7f + (float)random.NextDouble() * 0.6f; float num11 = num9 * num10; float num12 = num * num11; bool flag = false; for (int i = 0; i < _seeds.Count; i++) { float num13 = _seeds[i].x - num6; float num14 = _seeds[i].y - num7; if (num13 * num13 + num14 * num14 < num12 * num12) { flag = true; break; } } if (!flag) { _seeds.Add(new Vector2(num6, num7)); } } float num15 = num * 0.4f; float[] array = new float[3] { MapRadius * 0.7f, MapRadius * 0.82f, MapRadius * 0.93f }; int num16 = 45; for (int j = 0; j < array.Length; j++) { float num17 = array[j]; float num18 = (float)j * 0.5f; for (int k = 0; k < num16; k++) { float num19 = ((float)k + num18) / (float)num16 * (float)Math.PI * 2f; float num20 = num17 * Mathf.Cos(num19); float num21 = num17 * Mathf.Sin(num19); bool flag2 = false; for (int l = 0; l < _seeds.Count; l++) { float num22 = _seeds[l].x - num20; float num23 = _seeds[l].y - num21; if (num22 * num22 + num23 * num23 < num15 * num15) { flag2 = true; break; } } if (!flag2) { _seeds.Add(new Vector2(num20, num21)); } } } for (int m = 0; m < 3; m++) { LloydRelaxation(); } Plugin.Log.LogInfo((object)$"Generated {_seeds.Count} Voronoi seeds (target: {targetCount}, attempts: {num3})"); } private void LloydRelaxation() { //IL_0163: Unknown result type (might be due to invalid IL or missing references) int num = 80; float num2 = MapRadius * 2f / (float)num; float[] array = new float[_seeds.Count]; float[] array2 = new float[_seeds.Count]; int[] array3 = new int[_seeds.Count]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = 0f - MapRadius + ((float)i + 0.5f) * num2; float num4 = 0f - MapRadius + ((float)j + 0.5f) * num2; if (!(num3 * num3 + num4 * num4 > MapRadius * MapRadius)) { int num5 = FindNearestSeedBruteForce(num3, num4); if (num5 >= 0) { array[num5] += num3; array2[num5] += num4; array3[num5]++; } } } } for (int k = 0; k < _seeds.Count; k++) { if (k != SpawnZoneSeedIndex && array3[k] > 0) { float num6 = array[k] / (float)array3[k]; float num7 = array2[k] / (float)array3[k]; if (num6 * num6 + num7 * num7 >= _spawnProtectionRadius * _spawnProtectionRadius && num6 * num6 + num7 * num7 < MapRadius * MapRadius) { _seeds[k] = new Vector2(num6, num7); } } } } private float SmoothNoise(float x, float z, int seed) { int num = Mathf.FloorToInt(x); int num2 = Mathf.FloorToInt(z); float num3 = x - (float)num; float num4 = z - (float)num2; num3 = num3 * num3 * (3f - 2f * num3); num4 = num4 * num4 * (3f - 2f * num4); float num5 = HashFloat(num, num2, seed); float num6 = HashFloat(num + 1, num2, seed); float num7 = HashFloat(num, num2 + 1, seed); float num8 = HashFloat(num + 1, num2 + 1, seed); float num9 = num5 + (num6 - num5) * num3; float num10 = num7 + (num8 - num7) * num3; return num9 + (num10 - num9) * num4; } private float HashFloat(int x, int z, int seed) { int num = x * 374761393 + z * 668265263 + seed * 1274126177; int num2 = (num ^ (num >> 13)) * 1103515245; return (float)((num2 ^ (num2 >> 16)) & 0x7FFFFFFF) / 2.1474836E+09f; } private float PerturbedDistanceSq(float x, float z, int seedIndex) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) float num = _seeds[seedIndex].x - x; float num2 = _seeds[seedIndex].y - z; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = (float)seedIndex * 73.7f; float num5 = (float)seedIndex * 91.3f; float num6 = 0f; num6 += (Mathf.PerlinNoise((x + num4) * 0.006f, (z + num5) * 0.006f) - 0.5f) * 2f; num6 += (Mathf.PerlinNoise((x + num4) * 0.015f, (z + num5) * 0.015f) - 0.5f) * 1f; num6 += (Mathf.PerlinNoise((x + num4) * 0.03f, (z + num5) * 0.03f) - 0.5f) * 0.5f; num6 += (Mathf.PerlinNoise((x + num4) * 0.06f, (z + num5) * 0.06f) - 0.5f) * 0.25f; float num7 = num3 + num6 * 80f; return num7 * num7; } private int FindNearestSeedBruteForce(float x, float z) { int result = -1; float num = float.MaxValue; for (int i = 0; i < _seeds.Count; i++) { float num2 = PerturbedDistanceSq(x, z, i); if (num2 < num) { num = num2; result = i; } } return result; } private void BuildSpatialGrid() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) _spatialGrid.Clear(); for (int i = 0; i < _seeds.Count; i++) { long key = SpatialKey(_seeds[i].x, _seeds[i].y); if (!_spatialGrid.TryGetValue(key, out var value)) { value = new List<int>(); _spatialGrid[key] = value; } value.Add(i); } } private long SpatialKey(float x, float z) { int num = Mathf.FloorToInt(x / 2000f); int num2 = Mathf.FloorToInt(z / 2000f); return ((long)num << 32) | (uint)num2; } private void BuildQuantizedIndex() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) _quantizedToIndex.Clear(); for (int i = 0; i < _seeds.Count; i++) { Vector2i val = QuantizeSeed(i); long key = ((long)val.x << 32) | (uint)val.y; _quantizedToIndex[key] = i; } } private Vector2i QuantizeSeed(int index) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) Vector2 val = _seeds[index]; int num = Mathf.RoundToInt(val.x / 10f); int num2 = Mathf.RoundToInt(val.y / 10f); return new Vector2i(num, num2); } public Vector2i GetRegion(Vector3 worldPos) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) EnsureInitialized(); long key = CacheKey(worldPos.x, worldPos.z); if (_regionCache.TryGetValue(key, out var value)) { return value; } int index = FindNearestSeed(worldPos.x, worldPos.z); Vector2i val = QuantizeSeed(index); if (_regionCache.Count > 500000) { _regionCache.Clear(); } _regionCache[key] = val; return val; } public Vector3 GetRegionCenter(Vector2i regionId) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) EnsureInitialized(); int num = RegionIdToIndex(regionId); if (num >= 0 && num < _seeds.Count) { Vector2 val = _seeds[num]; return new Vector3(val.x, 0f, val.y); } return new Vector3((float)regionId.x * 10f, 0f, (float)regionId.y * 10f); } public bool IsSpawnZone(Vector2i regionId) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return RegionIdToIndex(regionId) == SpawnZoneSeedIndex; } public string GetRegionKey(Vector2i regionId) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return $"{regionId.x}_{regionId.y}"; } public bool IsOnBorder(Vector3 worldPos, float threshold = 80f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) EnsureInitialized(); float x = worldPos.x; float z = worldPos.z; int num = -1; int num2 = -1; float num3 = float.MaxValue; float num4 = float.MaxValue; int num5 = Mathf.FloorToInt(x / 2000f); int num6 = Mathf.FloorToInt(z / 2000f); for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { long key = ((long)(num5 + i) << 32) | (uint)(num6 + j); if (!_spatialGrid.TryGetValue(key, out var value)) { continue; } for (int k = 0; k < value.Count; k++) { int num7 = value[k]; float num8 = _seeds[num7].x - x; float num9 = _seeds[num7].y - z; float num10 = num8 * num8 + num9 * num9; if (num10 < num3) { num4 = num3; num2 = num; num3 = num10; num = num7; } else if (num10 < num4) { num4 = num10; num2 = num7; } } } } if (num < 0 || num2 < 0) { return false; } float num11 = Mathf.Sqrt(num3); return Mathf.Sqrt(num4) - num11 < threshold; } public float GetApproximateRegionRadius(Vector2i regionId) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) EnsureInitialized(); int num = RegionIdToIndex(regionId); if (num < 0) { return 500f; } Vector2 val = _seeds[num]; float num2 = float.MaxValue; for (int i = 0; i < _seeds.Count; i++) { if (i != num) { float num3 = _seeds[i].x - val.x; float num4 = _seeds[i].y - val.y; float num5 = num3 * num3 + num4 * num4; if (num5 < num2) { num2 = num5; } } } return Mathf.Sqrt(num2) * 0.5f; } public IReadOnlyList<Vector2> GetAllSeeds() { EnsureInitialized(); return _seeds; } public int RegionIdToIndex(Vector2i regionId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) long key = ((long)regionId.x << 32) | (uint)regionId.y; if (_quantizedToIndex.TryGetValue(key, out var value)) { return value; } return -1; } public Vector2i IndexToRegionId(int index) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (index < 0 || index >= _seeds.Count) { return new Vector2i(0, 0); } return QuantizeSeed(index); } private int FindNearestSeed(float x, float z) { int num = -1; float num2 = float.MaxValue; int num3 = Mathf.FloorToInt(x / 2000f); int num4 = Mathf.FloorToInt(z / 2000f); for (int i = -2; i <= 2; i++) { for (int j = -2; j <= 2; j++) { long key = ((long)(num3 + i) << 32) | (uint)(num4 + j); if (!_spatialGrid.TryGetValue(key, out var value)) { continue; } for (int k = 0; k < value.Count; k++) { int num5 = value[k]; float num6 = PerturbedDistanceSq(x, z, num5); if (num6 < num2) { num2 = num6; num = num5; } } } } if (num < 0) { num = FindNearestSeedBruteForce(x, z); } return num; } private long CacheKey(float x, float z) { int num = Mathf.FloorToInt(x / 8f); int num2 = Mathf.FloorToInt(z / 8f); return ((long)num << 32) | (uint)num2; } } } namespace FortecaClanWarfare.UI { public class ClanNameTagRenderer : MonoBehaviour { private GUIStyle _tagStyle; private GUIStyle _shadowStyle; private bool _styleInit; private const float MaxRenderDistance = 80f; private const float HeadOffsetY = 2.05f; public static ClanNameTagRenderer Instance { get; private set; } private void Awake() { Instance = this; } private void InitStyle() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown if (!_styleInit) { _styleInit = true; _tagStyle = new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = true, wordWrap = false }; GUIStyle val = new GUIStyle(_tagStyle); val.normal.textColor = new Color(0f, 0f, 0f, 0.85f); _shadowStyle = val; } } private void OnGUI() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7 || (Object)(object)Player.m_localPlayer == (Object)null) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } WarfareData warfareData = WarfareManager.Instance?.Data; if (warfareData == null) { return; } InitStyle(); List<Player> allPlayers = Player.GetAllPlayers(); if (allPlayers == null) { return; } Vector3 position = ((Component)Player.m_localPlayer).transform.position; for (int i = 0; i < allPlayers.Count; i++) { Player val = allPlayers[i]; if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)Player.m_localPlayer || ((Character)val).IsDead()) { continue; } float num = Vector3.Distance(((Component)val).transform.position, position); if (num > 80f) { continue; } long playerID = val.GetPlayerID(); if (playerID == 0L) { continue; } PlayerClanInfo player = warfareData.GetPlayer(playerID); if (player == null || player.ClanId == 0) { continue; } ClanDefinition clan = ClanConfig.GetClan(player.ClanId); if (clan != null) { Vector3 val2 = ((Component)val).transform.position + Vector3.up * 2.05f; Vector3 val3 = main.WorldToScreenPoint(val2); if (!(val3.z <= 0f)) { float num2 = (float)Screen.height - val3.y; string text = clan.Symbol + " " + clan.Name; Vector2 val4 = _tagStyle.CalcSize(new GUIContent(text)); float num3 = val3.x - val4.x / 2f; float num4 = num2 - val4.y - 4f; float num5 = Mathf.Clamp01(1f - num / 80f); num5 = Mathf.Lerp(0.35f, 1f, num5); _shadowStyle.normal.textColor = new Color(0f, 0f, 0f, num5 * 0.85f); GUI.Label(new Rect(num3 + 1f, num4 + 1f, val4.x, val4.y), text, _shadowStyle); GUI.Label(new Rect(num3 - 1f, num4 + 1f, val4.x, val4.y), text, _shadowStyle); GUI.Label(new Rect(num3 + 1f, num4 - 1f, val4.x, val4.y), text, _shadowStyle); GUI.Label(new Rect(num3 - 1f, num4 - 1f, val4.x, val4.y), text, _shadowStyle); _tagStyle.normal.textColor = new Color(clan.Color.r, clan.Color.g, clan.Color.b, num5); GUI.Label(new Rect(num3, num4, val4.x, val4.y), text, _tagStyle); } } } } } public class ClanSelectionUI : MonoBehaviour { private bool _showClanSelect; private bool _showRoleSelect; private int _hoveredClanId; private ClanRole _hoveredRole; private bool _stylesInit; private GUIStyle _backdropStyle; private GUIStyle _panelStyle; private GUIStyle _titleStyle; private GUIStyle _subtitleStyle; private GUIStyle _bodyStyle; private GUIStyle _cardStyle; private GUIStyle _cardHoverStyle; private GUIStyle _clanNameStyle; private GUIStyle _clanDescStyle; private GUIStyle _roleBtnStyle; private GUIStyle _roleBtnHoverStyle; private GUIStyle _roleNameStyle; private GUIStyle _roleDescStyle; private Texture2D _backdropTex; private Texture2D _panelTex; private Texture2D _panelBorderTex; private Texture2D _cardTex; private Texture2D _cardHoverTex; private Texture2D _accentTex; private Texture2D _pixelTex; private static readonly (ClanRole role, string title, string oldNorse, string lore, string perks)[] RoleEntries = new(ClanRole, string, string, string, string)[5] { (ClanRole.Explorer, "EXPLORER", "Útsýn — \"Far-Seer\"", "The Útsýn answer the call of Hugin and Munin, Óðinn's ravens. They are ranger-skalds who follow the rivers past the last hearth-fire and read the wind for new lands to claim. Standing still in tamed soil dulls their gift; to roam the untamed wild is to renew it.", "Only role that can claim territory. +20% stats in unclaimed land, -20% in claimed land."), (ClanRole.Invader, "INVADER", "Berserkr — \"Bear-Shirt\"", "Berserkers wear no mail. Mead in their veins and the fury of Óðinn in their eye, they fall upon the foe's hall and laugh at the spear. The gods of the slain reward them twofold within enemy walls — and over slow, wrathful hours they have learned to break the locks of foreign vaults.", "2x monster loot in enemy land (extra to clan vault). Can crack enemy vaults during 30-min raids."), (ClanRole.Gatherer, "GATHERER", "Vegfarandi — \"Wayfarer\"", "Wayfarers walk the long roads beyond the mead-hall — half-trader, half-thief, all silence. The norns wove them broad shoulders and longer wind, and Frey turns a blind eye when they reap from rival fields. They return home heavy of pack and lighter of conscience.", "2x resource loot in enemy land (extra to clan vault). +500 carry weight bonus."), (ClanRole.Guardian, "GUARDIAN", "Hirðmaðr — \"Hearth-Guard\"", "The Hirðmenn are oath-sworn to jarl and kin — first into the shield-wall and last to fall. Their roots drink deep of clan soil; the longer they hold the ground, the harder they are to fell. Beyond the threshold of home their oath weakens. Kin shall not raise blade against kin while a Hirðmaðr keeps watch.", "+20% stats in clan land, -20% elsewhere. -50% build cost at home. Suspends PvP between clan-mates on owned land."), (ClanRole.Parasite, "PARASITE", "Draugr — \"The Restless\"", "Some souls linger between worlds — neither raider nor farmer, neither living nor truly slain. The Draugr fasten upon a foe and bleed the life from their land. They raise foul Organic Pumps — part rune-stone, part wound — that drain a rival's harvest into nothing. Hated by all and welcome nowhere, they thrive on what others toil to grow.", "-50% craft cost at enemy workstations. Build Organic Pumps that slowly drain enemy territory loot.") }; private Vector2 _roleScroll; public static ClanSelectionUI Instance { get; private set; } public static bool IsOpen { get; private set; } private static float UIScale => (float)Screen.height / 1080f; public static bool ShouldBlockInput() { return IsOpen; } private void Awake() { Instance = this; } private void Update() { if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)Game.instance == (Object)null || (Object)(object)ZNet.instance == (Object)null) { _showClanSelect = false; _showRoleSelect = false; IsOpen = false; return; } WarfareData warfareData = WarfareManager.Instance?.Data; if (warfareData == null) { _showClanSelect = false; _showRoleSelect = false; IsOpen = false; return; } PlayerClanInfo player = warfareData.GetPlayer(Player.m_localPlayer.GetPlayerID()); if (player == null || player.ClanId == 0) { _showClanSelect = true; _showRoleSelect = false; } else if (player.Role == ClanRole.None) { _showClanSelect = false; _showRoleSelect = true; } else { _showClanSelect = false; _showRoleSelect = false; } IsOpen = _showClanSelect || _showRoleSelect; if (IsOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private Texture2D MakeTex(Color c) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1) { hideFlags = (HideFlags)61 }; val.SetPixel(0, 0, c); val.Apply(); return val; } private Texture2D MakeGradientTex(int w, int h, Color top, Color bottom) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(w, h) { hideFlags = (HideFlags)61, wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < h; i++) { Color val2 = Color.Lerp(bottom, top, (float)i / (float)h); float num = Random.Range(-0.012f, 0.012f); val2.r = Mathf.Clamp01(val2.r + num); val2.g = Mathf.Clamp01(val2.g + num); val2.b = Mathf.Clamp01(val2.b + num); for (int j = 0; j < w; j++) { val.SetPixel(j, i, val2); } } val.Apply(); return val; } private void InitStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //IL_018b: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Expected O, but got Unknown //IL_01d3: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Expected O, but got Unknown //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Expected O, but got Unknown //IL_031f: Expected O, but got Unknown //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Expected O, but got Unknown //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Expected O, but got Unknown //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Expected O, but got Unknown //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Expected O, but got Unknown //IL_041f: Expected O, but got Unknown //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Expected O, but got Unknown //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown if (!_stylesInit) { _stylesInit = true; _pixelTex = MakeTex(Color.white); _backdropTex = MakeTex(new Color(0f, 0f, 0f, 0.78f)); _panelTex = MakeGradientTex(48, 48, new Color(0.09f, 0.07f, 0.045f, 0.97f), new Color(0.05f, 0.04f, 0.025f, 0.98f)); _panelBorderTex = MakeTex(new Color(0.55f, 0.42f, 0.18f, 0.85f)); _cardTex = MakeGradientTex(32, 32, new Color(0.16f, 0.12f, 0.07f, 0.95f), new Color(0.1f, 0.08f, 0.04f, 0.96f)); _cardHoverTex = MakeGradientTex(32, 32, new Color(0.26f, 0.19f, 0.09f, 0.96f), new Color(0.16f, 0.12f, 0.05f, 0.97f)); _accentTex = MakeTex(new Color(0.78f, 0.62f, 0.25f, 0.85f)); GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = _backdropTex; val.border = new RectOffset(0, 0, 0, 0); _backdropStyle = val; GUIStyle val2 = new GUIStyle(GUI.skin.box); val2.normal.background = _panelTex; val2.border = new RectOffset(8, 8, 8, 8); val2.padding = new RectOffset(28, 28, 26, 26); _panelStyle = val2; Color textColor = default(Color); ((Color)(ref textColor))..ctor(0.96f, 0.83f, 0.38f); Color textColor2 = default(Color); ((Color)(ref textColor2))..ctor(0.86f, 0.8f, 0.66f); Color textColor3 = default(Color); ((Color)(ref textColor3))..ctor(0.74f, 0.68f, 0.55f); GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 26, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = true }; val3.normal.textColor = textColor; _titleStyle = val3; GUIStyle val4 = new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = (FontStyle)2, alignment = (TextAnchor)4, richText = true }; val4.normal.textColor = textColor3; _subtitleStyle = val4; GUIStyle val5 = new GUIStyle(GUI.skin.label) { fontSize = 13, richText = true, wordWrap = true }; val5.normal.textColor = textColor2; _bodyStyle = val5; GUIStyle val6 = new GUIStyle(GUI.skin.box); val6.normal.background = _cardTex; val6.border = new RectOffset(6, 6, 6, 6); val6.padding = new RectOffset(14, 14, 14, 14); val6.margin = new RectOffset(6, 6, 6, 6); _cardStyle = val6; GUIStyle val7 = new GUIStyle(_cardStyle); val7.normal.background = _cardHoverTex; _cardHoverStyle = val7; GUIStyle val8 = new GUIStyle(GUI.skin.label) { fontSize = 19, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = true }; val8.normal.textColor = Color.white; _clanNameStyle = val8; GUIStyle val9 = new GUIStyle(GUI.skin.label) { fontSize = 12, fontStyle = (FontStyle)2, alignment = (TextAnchor)4, richText = true, wordWrap = true }; val9.normal.textColor = textColor3; _clanDescStyle = val9; GUIStyle val10 = new GUIStyle(GUI.skin.box); val10.normal.background = _cardTex; val10.border = new RectOffset(6, 6, 6, 6); val10.padding = new RectOffset(14, 14, 10, 10); val10.margin = new RectOffset(0, 0, 4, 4); _roleBtnStyle = val10; GUIStyle val11 = new GUIStyle(_roleBtnStyle); val11.normal.background = _cardHoverTex; _roleBtnHoverStyle = val11; GUIStyle val12 = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, richText = true }; val12.normal.textColor = textColor; _roleNameStyle = val12; GUIStyle val13 = new GUIStyle(GUI.skin.label) { fontSize = 12, richText = true, wordWrap = true }; val13.normal.textColor = textColor2; _roleDescStyle = val13; } } private void OnGUI() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (IsOpen) { InitStyles(); float uIScale = UIScale; Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(uIScale, uIScale, 1f)); float num = (float)Screen.width / uIScale; float num2 = (float)Screen.height / uIScale; GUI.Box(new Rect(0f, 0f, num, num2), GUIContent.none, _backdropStyle); if (_showClanSelect) { DrawClanWindow(num, num2); } else if (_showRoleSelect) { DrawRoleWindow(num, num2); } GUI.matrix = matrix; } } private void DrawClanWindow(float refW, float refH) { //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Invalid comparison between Unknown and I4 //IL_01fe: Unknown result type (might be due to invalid IL or missing references) int activeClanCount = ClanConfig.ActiveClanCount; int num = ((activeClanCount <= 4) ? 2 : ((activeClanCount <= 6) ? 3 : 4)); int num2 = (activeClanCount + num - 1) / num; float num3 = ((activeClanCount <= 4) ? 195 : 160); float num4 = ((activeClanCount <= 4) ? 820f : Mathf.Min(refW - 40f, 1100f)); float num5 = Mathf.Min(refH - 40f, 160f + (float)num2 * (num3 + 16f) + 50f); float num6 = (refW - num4) / 2f; float num7 = (refH - num5) / 2f; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num6, num7, num4, num5); DrawPanel(rect); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 22f, ((Rect)(ref rect)).width, 38f), "CHOOSE YOUR CLAN", _titleStyle); DrawAccentLine(((Rect)(ref rect)).x + 120f, ((Rect)(ref rect)).y + 64f, ((Rect)(ref rect)).width - 240f, 2f); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 72f, ((Rect)(ref rect)).width, 22f), "<i>Your clan is your faction for the season — this choice is permanent.</i>", _subtitleStyle); List<ClanDefinition> clanDefinitions = ClanConfig.GetClanDefinitions(); float num8 = ((Rect)(ref rect)).y + 110f; float num9 = ((Rect)(ref rect)).x + 32f; float num10 = (((Rect)(ref rect)).width - 32f - (float)((num + 1) * 16)) / (float)num; float num11 = 16f; int hoveredClanId = 0; Rect rect2 = default(Rect); for (int i = 0; i < clanDefinitions.Count; i++) { int num12 = i / num; int num13 = i % num; ((Rect)(ref rect2))..ctor(num9 + (float)num13 * (num10 + num11), num8 + (float)num12 * (num3 + num11), num10, num3); if (DrawClanCard(rect2, clanDefinitions[i])) { hoveredClanId = clanDefinitions[i].ClanId; } if ((int)Event.current.type == 1 && Event.current.button == 0 && ((Rect)(ref rect2)).Contains(Event.current.mousePosition)) { WarfareRPC.Instance?.RequestJoinClan(clanDefinitions[i].ClanId); _showClanSelect = false; _showRoleSelect = true; Event.current.Use(); } } _hoveredClanId = hoveredClanId; GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 38f, ((Rect)(ref rect)).width, 22f), "<i>Click a clan banner to swear your oath</i>", _subtitleStyle); } private bool DrawClanCard(Rect rect, ClanDefinition clan) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) bool flag = ((Rect)(ref rect)).Contains(Event.current.mousePosition); GUI.Box(rect, GUIContent.none, flag ? _cardHoverStyle : _cardStyle); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(((Rect)(ref rect)).x + 6f, ((Rect)(ref rect)).y + 6f, ((Rect)(ref rect)).width - 12f, 6f); DrawColorRect(rect2, new Color(clan.Color.r, clan.Color.g, clan.Color.b, flag ? 1f : 0.85f)); GUIStyle val = new GUIStyle(_clanNameStyle) { fontSize = 36 }; val.normal.textColor = clan.Color; GUIStyle val2 = val; GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 22f, ((Rect)(ref rect)).width, 50f), clan.Symbol ?? "", val2); GUIStyle val3 = new GUIStyle(_clanNameStyle); val3.normal.textColor = clan.Color; GUIStyle val4 = val3; GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 78f, ((Rect)(ref rect)).width, 30f), clan.Name, val4); DrawColorRect(new Rect(((Rect)(ref rect)).x + 30f, ((Rect)(ref rect)).y + 112f, ((Rect)(ref rect)).width - 60f, 1f), new Color(0.55f, 0.42f, 0.18f, 0.55f)); string text = (flag ? "<color=#f0d77a>► Click to join ◄</color>" : "Sworn warriors of this banner"); GUI.Label(new Rect(((Rect)(ref rect)).x + 12f, ((Rect)(ref rect)).y + 122f, ((Rect)(ref rect)).width - 24f, 60f), text, _clanDescStyle); return flag; } private void DrawRoleWindow(float refW, float refH) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) float num = 860f; float num2 = Mathf.Min(refH - 80f, 820f); float num3 = (refW - num) / 2f; float num4 = (refH - num2) / 2f; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num3, num4, num, num2); DrawPanel(rect); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 22f, ((Rect)(ref rect)).width, 38f), "CHOOSE YOUR ROLE", _titleStyle); DrawAccentLine(((Rect)(ref rect)).x + 120f, ((Rect)(ref rect)).y + 64f, ((Rect)(ref rect)).width - 240f, 2f); PlayerClanInfo playerClanInfo = (WarfareManager.Instance?.Data)?.GetPlayer(Player.m_localPlayer.GetPlayerID()); if (playerClanInfo != null && playerClanInfo.ClanId > 0) { ClanDefinition clan = ClanConfig.GetClan(playerClanInfo.ClanId); if (clan != null) { string text = ColorUtility.ToHtmlStringRGB(clan.Color); GUIStyle val = new GUIStyle(_subtitleStyle) { fontSize = 14 }; GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + 72f, ((Rect)(ref rect)).width, 22f), "<color=#" + text + ">" + clan.Symbol + " " + clan.Name + "</color> — <i>You may change your role once every 24 hours</i>", val); } } float num5 = ((Rect)(ref rect)).y + 108f; float num6 = ((Rect)(ref rect)).x + 28f; float num7 = ((Rect)(ref rect)).width - 56f; float num8 = ((Rect)(ref rect)).height - 108f - 46f; float num9 = 138f; float num10 = 8f; float num11 = (float)RoleEntries.Length * (num9 + num10); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num6, num5, num7, num8); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(0f, 0f, num7 - 20f, num11); _roleScroll = GUI.BeginScrollView(val2, _roleScroll, val3, false, num11 > num8); ClanRole clanRole = ClanRole.None; Rect rect2 = default(Rect); for (int i = 0; i < RoleEntries.Length; i++) { (ClanRole, string, string, string, string) tuple = RoleEntries[i]; ((Rect)(ref rect2))..ctor(0f, (float)i * (num9 + num10), num7 - 22f, num9); clanRole = DrawRoleRow(rect2, tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4, tuple.Item5, clanRole); } _hoveredRole = clanRole; GUI.EndScrollView(); GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 38f, ((Rect)(ref rect)).width, 22f), "<i>Click a role to commit your fate</i>", _subtitleStyle); } private ClanRole DrawRoleRow(Rect rect, ClanRole role, string name, string oldNorse, string lore, string perks, ClanRole hoveredSoFar) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Expected O, but got Unknown //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Invalid comparison between Unknown and I4 //IL_024a: Unknown result type (might be due to invalid IL or missing references) bool flag = ((Rect)(ref rect)).Contains(Event.current.mousePosition); GUI.Box(rect, GUIContent.none, flag ? _roleBtnHoverStyle : _roleBtnStyle); PlayerClanInfo playerClanInfo = (WarfareManager.Instance?.Data)?.GetPlayer(Player.m_localPlayer.GetPlayerID()); Color c = default(Color); ((Color)(ref c))..ctor(0.78f, 0.62f, 0.25f, 0.9f); if (playerClanInfo != null && playerClanInfo.ClanId > 0) { ClanDefinition clan = ClanConfig.GetClan(playerClanInfo.ClanId); if (clan != null) { ((Color)(ref c))..ctor(clan.Color.r, clan.Color.g, clan.Color.b, flag ? 1f : 0.75f); } } DrawColorRect(new Rect(((Rect)(ref rect)).x + 6f, ((Rect)(ref rect)).y + 8f, 4f, ((Rect)(ref rect)).height - 16f), c); float num = ((Rect)(ref rect)).x + 22f; float num2 = ((Rect)(ref rect)).width - 36f; GUI.Label(new Rect(num, ((Rect)(ref rect)).y + 8f, num2, 24f), name, _roleNameStyle); GUIStyle val = new GUIStyle(_clanDescStyle) { alignment = (TextAnchor)3, fontSize = 12 }; GUI.Label(new Rect(num, ((Rect)(ref rect)).y + 30f, num2, 18f), "<i>" + oldNorse + "</i>", val); GUIStyle val2 = new GUIStyle(_roleDescStyle) { fontStyle = (FontStyle)2 }; GUI.Label(new Rect(num, ((Rect)(ref rect)).y + 50f, num2, 60f), lore, val2); GUIStyle val3 = new GUIStyle(_roleDescStyle) { fontSize = 11 }; val3.normal.textColor = new Color(0.85f, 0.72f, 0.35f); GUIStyle val4 = val3; GUI.Label(new Rect(num, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 26f, num2, 22f), "⚔ " + perks, val4); if ((int)Event.current.type == 1 && Event.current.button == 0 && ((Rect)(ref rect)).Contains(Event.current.mousePosition)) { WarfareRPC.Instance?.RequestSetRole(role); _showRoleSelect = false; Event.current.Use(); } if (!flag) { return hoveredSoFar; } return role; } private void DrawPanel(Rect rect) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) GUI.Box(rect, GUIContent.none, _panelStyle); DrawColorRect(new Rect(((Rect)(ref rect)).x + 4f, ((Rect)(ref rect)).y + 4f, ((Rect)(ref rect)).width - 8f, 1f), new Color(0.65f, 0.5f, 0.2f, 0.85f)); DrawColorRect(new Rect(((Rect)(ref rect)).x + 4f, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 5f, ((Rect)(ref rect)).width - 8f, 1f), new Color(0.65f, 0.5f, 0.2f, 0.85f)); DrawColorRect(new Rect(((Rect)(ref rect)).x + 4f, ((Rect)(ref rect)).y + 4f, 1f, ((Rect)(ref rect)).height - 8f), new Color(0.65f, 0.5f, 0.2f, 0.85f)); DrawColorRect(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - 5f, ((Rect)(ref rect)).y + 4f, 1f, ((Rect)(ref rect)).height - 8f), new Color(0.65f, 0.5f, 0.2f, 0.85f)); } private void DrawAccentLine(float x, float y, float w, float h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) DrawColorRect(new Rect(x, y, w, h), new Color(0.78f, 0.62f, 0.25f, 0.9f)); DrawColorRect(new Rect(x + w / 2f - 5f, y - 2f, 10f, h + 4f), new Color