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 FortecaClanWarfare v420.0.5
FortecaClanWarfare.dll
Decompiled 2 days 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("forteca")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Clan-based territory warfare mod for Valheim")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("FortecaClanWarfare")] [assembly: AssemblyTitle("FortecaClanWarfare")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FortecaClanWarfare { [BepInPlugin("com.forteca.clanwarfare", "Forteca Clan Warfare", "0.1.0")] [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.1.0"; private Harmony _harmony; private GameObject _managerObj; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_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_001c: 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_001f: 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_000c: 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_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_0087: 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_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_00d3: 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_00dc: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected I4, but got Unknown //IL_00e4: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_010e: 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) { Biome biomeAt = GetBiomeAt(val); int key = (int)biomeAt; 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 biomeAt2 = GetBiomeAt(regionCenter); dictionary[(int)biomeAt2] = 100f; } return dictionary; } public static bool CellHasMerchant(Vector2i gridPos) { //IL_004b: 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_008b: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_016b: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0122: 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_0131: 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) { //IL_0015: 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_0073: Unknown result type (might be due to invalid IL or missing references) if (composition == null || composition.Count == 0) { return (Biome)1; } 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; } public static bool HasPointOfInterest(Vector2i gridPos) { //IL_0038: 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_003f: 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_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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) 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) { continue; } string prefabName = value.m_location.m_prefabName ?? ""; if (IsPOILocation(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_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_000a: 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_0022: Expected I4, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Invalid comparison between Unknown and I4 //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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0026: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0158: 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_002d: Invalid comparison between Unknown and I4 //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) if (1 == 0) { } Color result; if ((int)biome <= 16) { switch (biome - 1) { case 0: goto IL_0070; case 1: goto IL_00a4; case 3: goto IL_00be; case 2: goto IL_0148; } if ((int)biome != 8) { if ((int)biome != 16) { goto IL_0148; } result = new Color(0.9f, 0.85f, 0.4f); } else { result = new Color(0.2f, 0.4f, 0.2f); } } else if ((int)biome <= 64) { if ((int)biome != 32) { if ((int)biome != 64) { goto IL_0148; } result = new Color(0.7f, 0.9f, 1f); } else { result = new Color(0.8f, 0.3f, 0.2f); } } else if ((int)biome != 256) { if ((int)biome != 512) { goto IL_0148; } result = new Color(0.5f, 0.3f, 0.6f); } else { result = new Color(0.2f, 0.4f, 0.8f); } goto IL_0150; IL_0148: result = Color.gray; goto IL_0150; IL_00be: result = new Color(0.8f, 0.8f, 0.9f); goto IL_0150; IL_0070: result = new Color(0.4f, 0.8f, 0.3f); goto IL_0150; IL_00a4: result = new Color(0.4f, 0.35f, 0.2f); goto IL_0150; IL_0150: if (1 == 0) { } return result; } public static string GetBiomeName(Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_000a: 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_0022: Expected I4, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_00be: 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_00c3: Invalid comparison between Unknown and I4 //IL_00d4: 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_00d9: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_00ec: 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_00f4: Invalid comparison between Unknown and I4 //IL_0107: 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_010c: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Invalid comparison between Unknown and I4 //IL_0144: 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_0148: Invalid comparison between Unknown and I4 //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Invalid comparison between Unknown and I4 //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Invalid comparison between Unknown and I4 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_0001: Unknown result type (might be due to invalid IL or missing references) //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected I4, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 Biome val = ResolveBiome(biome); if (1 == 0) { } float result; if ((int)val <= 16) { switch (val - 1) { case 0: goto IL_005f; case 1: goto IL_006f; case 3: goto IL_0077; case 2: goto IL_00a7; } if ((int)val != 8) { if ((int)val != 16) { goto IL_00a7; } result = 3f; } else { result = 1.5f; } } else if ((int)val <= 64) { if ((int)val != 32) { if ((int)val != 64) { goto IL_00a7; } result = 3f; } else { result = 5f; } } else if ((int)val != 256) { if ((int)val != 512) { goto IL_00a7; } result = 4f; } else { result = 0.5f; } goto IL_00af; IL_00a7: result = 1f; goto IL_00af; IL_0077: result = 2.5f; goto IL_00af; IL_005f: result = 1f; goto IL_00af; IL_006f: result = 2f; goto IL_00af; IL_00af: if (1 == 0) { } return result; } public static Biome ResolveBiome(Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_000e: 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) //IL_0012: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0057: 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_005c: Invalid comparison between Unknown and I4 //IL_006a: 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: Invalid comparison between Unknown and I4 //IL_0064: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00ad: Invalid comparison between Unknown and I4 //IL_00a6: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Invalid comparison between Unknown and I4 //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Invalid comparison between Unknown and I4 //IL_00d6: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Invalid comparison between Unknown and I4 //IL_00e6: 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_00fe: 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_0050; } } else if ((int)biome == 8 || (int)biome == 16) { goto IL_0050; } } else if ((int)biome <= 64) { if ((int)biome == 32 || (int)biome == 64) { goto IL_0050; } } else if ((int)biome == 256 || (int)biome == 512) { goto IL_0050; } 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)1; IL_0050: 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_003d: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0067: 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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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})"; } int seed = gridPos.x * 10000 + gridPos.y; Random random = new Random(seed); 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_001d: 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_0039: 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_003f: Unknown result type (might be due to invalid IL or missing references) if (biomeComposition == null || biomeComposition.Count == 0) { return "Unknown"; } int seed = gridPos.x * 10000 + gridPos.y; Random rng = new Random(seed); Biome dominantBiome = GetDominantBiome(biomeComposition); return GetBiomeName(dominantBiome, rng); } private static string GetDirectionalPrefix(Vector2i gridPos, Random rng) { //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_000c: 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_0014: 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; float num = Mathf.Sqrt(x * x + z * z); if (num < 2000f) { return CenterPrefixes[rng.Next(CenterPrefixes.Length)]; } float num2 = Mathf.Atan2(z, x) * 57.29578f; if (num2 >= 45f && num2 < 135f) { return NorthPrefixes[rng.Next(NorthPrefixes.Length)]; } if (num2 >= -45f && num2 < 45f) { return EastPrefixes[rng.Next(EastPrefixes.Length)]; } if (num2 >= -135f && num2 < -45f) { return SouthPrefixes[rng.Next(SouthPrefixes.Length)]; } return WestPrefixes[rng.Next(WestPrefixes.Length)]; } private static string GetBiomeName(Biome biome, Random rng) { //IL_0006: 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_0028: 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_002a: 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) 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0014: 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_0019: Invalid comparison between Unknown and I4 //IL_000e: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0021: 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_003d: 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_0042: Invalid comparison between Unknown and I4 //IL_003a: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_004c: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_005c: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_006c: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 //IL_007c: 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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00a4: 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0017: 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) //IL_001c: Invalid comparison between Unknown and I4 //IL_002d: 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: Invalid comparison between Unknown and I4 //IL_0046: 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: Invalid comparison between Unknown and I4 //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Invalid comparison between Unknown and I4 //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Invalid comparison between Unknown and I4 //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Invalid comparison between Unknown and I4 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) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) 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_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Expected I4, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between I4 and Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) 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_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected I4, but got Unknown float value; return composition.TryGetValue((int)biome, out value) ? value : 0f; } 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_0278: 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) //IL_02ed: 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); float num9 = num8 / MapRadius; float num10 = 0.3f + num9 * 1.5f; float num11 = 0.7f + (float)random.NextDouble() * 0.6f; float num12 = num10 * num11; float num13 = num * num12; bool flag = false; for (int i = 0; i < _seeds.Count; i++) { float num14 = _seeds[i].x - num6; float num15 = _seeds[i].y - num7; if (num14 * num14 + num15 * num15 < num13 * num13) { flag = true; break; } } if (!flag) { _seeds.Add(new Vector2(num6, num7)); } } float num16 = num * 0.4f; float[] array = new float[3] { MapRadius * 0.7f, MapRadius * 0.82f, MapRadius * 0.93f }; int num17 = 45; for (int j = 0; j < array.Length; j++) { float num18 = array[j]; float num19 = (float)j * 0.5f; for (int k = 0; k < num17; k++) { float num20 = ((float)k + num19) / (float)num17 * (float)Math.PI * 2f; float num21 = num18 * Mathf.Cos(num20); float num22 = num18 * Mathf.Sin(num20); bool flag2 = false; for (int l = 0; l < _seeds.Count; l++) { float num23 = _seeds[l].x - num21; float num24 = _seeds[l].y - num22; if (num23 * num23 + num24 * num24 < num16 * num16) { flag2 = true; break; } } if (!flag2) { _seeds.Add(new Vector2(num21, num22)); } } } 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_01ae: 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; num = (num ^ (num >> 13)) * 1103515245; num ^= num >> 16; return (float)(num & 0x7FFFFFFF) / 2.1474836E+09f; } private float PerturbedDistanceSq(float x, float z, int seedIndex) { //IL_0008: 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) 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_001a: 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) _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_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_001a: 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) _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_0008: 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_000e: 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_0034: 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_003c: 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_0009: 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_0035: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_0030: 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_0081: 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_0086: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_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_0031: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0077: 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_0002: Unknown result type (might be due to invalid IL or missing references) int num = RegionIdToIndex(regionId); return num == SpawnZoneSeedIndex; } public string GetRegionKey(Vector2i regionId) { //IL_0006: 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) return $"{regionId.x}_{regionId.y}"; } public bool IsOnBorder(Vector3 worldPos, float threshold = 80f) { //IL_0008: 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_009e: 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) 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); float num12 = Mathf.Sqrt(num4); return num12 - num11 < threshold; } public float GetApproximateRegionRadius(Vector2i regionId) { //IL_0009: 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) //IL_0030: 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) //IL_006d: 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) 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_0001: 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) 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0031: 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_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_002d: 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_003d: 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_0052: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0091: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0172: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_01e5: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_035f: 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_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037c: 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 == 0) { continue; } PlayerClanInfo player = warfareData.GetPlayer(playerID); if (player == null || player.ClanId == 0) { continue; } Clan 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 enum Mode { Browse, Create, Role } private Mode _mode = Mode.Browse; private string _createName = ""; private string _createTag = ""; private int _colorIndex; private int _iconIndex; private Vector2 _browseScroll; private Vector2 _roleScroll; private bool _stylesInit; private GUIStyle _titleStyle; private GUIStyle _subtitleStyle; private GUIStyle _bodyStyle; private GUIStyle _cardStyle; private GUIStyle _cardHoverStyle; private GUIStyle _btnStyle; private GUIStyle _fieldStyle; private GUIStyle _roleNameStyle; private Texture2D _backdropTex; private Texture2D _panelTex; private Texture2D _cardTex; private Texture2D _cardHoverTex; private Texture2D _pixelTex; private Texture2D _fieldTex; private static readonly (ClanRole role, string title, string norse, string lore, string perks)[] RoleEntries = new(ClanRole, string, string, string, string)[5] { (ClanRole.Explorer, "EXPLORER", "Útsýn — \"Far-Seer\"", "Raven-followers who roam past the last hearth-fire to claim untamed land for their jarl.", "Only role that can claim unclaimed territory. +stats in the wild."), (ClanRole.Invader, "INVADER", "Berserkr — \"Bear-Shirt\"", "Mead-drunk frenzy-warriors who break enemy halls and crack their vaults.", "2x loot from enemy land. Cracks enemy vaults."), (ClanRole.Gatherer, "GATHERER", "Vegfarandi — \"Wayfarer\"", "Silent road-walkers who reap from rival fields and return heavy of pack.", "2x resources from enemy land. +500 carry weight."), (ClanRole.Guardian, "GUARDIAN", "Hirðmaðr — \"Hearth-Guard\"", "Oath-sworn shield-wall whose roots drink deep of clan soil.", "+stats & -50% build cost at home. Holds the line."), (ClanRole.Parasite, "PARASITE", "Draugr — \"The Restless\"", "Undead leeches who raise rot totems to wither a rival's land.", "Raises rot totems on enemy land. -50% enemy crafting cost.") }; 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) { IsOpen = false; _mode = Mode.Browse; return; } WarfareData warfareData = WarfareManager.Instance?.Data; if (warfareData == null) { IsOpen = false; return; } PlayerClanInfo player = warfareData.GetPlayer(Player.m_localPlayer.GetPlayerID()); if (player == null || player.ClanId == 0) { IsOpen = true; if (_mode == Mode.Role) { _mode = Mode.Browse; } } else if (player.Role == ClanRole.None) { IsOpen = true; _mode = Mode.Role; } else { IsOpen = false; } if (IsOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private Texture2D MakeTex(Color c) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) 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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001a: Expected O, but got Unknown //IL_001f: 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_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_0034: 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); for (int j = 0; j < w; j++) { val.SetPixel(j, i, val2); } } val.Apply(); return val; } private void InitStyles() { //IL_0019: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01db: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Expected O, but got Unknown //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Expected O, but got Unknown //IL_02a5: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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_02e1: 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_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Expected O, but got Unknown //IL_0300: Expected O, but got Unknown //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Expected O, but got Unknown //IL_039b: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //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_03e1: 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_03f6: Expected O, but got Unknown //IL_0401: Unknown result type (might be due to invalid IL or missing references) if (!_stylesInit) { _stylesInit = true; _pixelTex = MakeTex(Color.white); _backdropTex = MakeTex(new Color(0f, 0f, 0f, 0.8f)); _panelTex = MakeGradientTex(48, 48, new Color(0.09f, 0.07f, 0.045f, 0.98f), new Color(0.05f, 0.04f, 0.025f, 0.99f)); _cardTex = MakeGradientTex(32, 32, new Color(0.16f, 0.12f, 0.07f, 0.96f), new Color(0.1f, 0.08f, 0.04f, 0.97f)); _cardHoverTex = MakeGradientTex(32, 32, new Color(0.26f, 0.19f, 0.09f, 0.97f), new Color(0.16f, 0.12f, 0.05f, 0.98f)); _fieldTex = MakeTex(new Color(0.03f, 0.025f, 0.018f, 1f)); 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); _titleStyle = new GUIStyle(GUI.skin.label) { fontSize = 26, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, richText = true }; _titleStyle.normal.textColor = textColor; _subtitleStyle = new GUIStyle(GUI.skin.label) { fontSize = 13, fontStyle = (FontStyle)2, alignment = (TextAnchor)4, richText = true }; _subtitleStyle.normal.textColor = textColor3; _bodyStyle = new GUIStyle(GUI.skin.label) { fontSize = 13, richText = true, wordWrap = true }; _bodyStyle.normal.textColor = textColor2; GUIStyle val = new GUIStyle(GUI.skin.box); val.normal.background = _cardTex; val.border = new RectOffset(6, 6, 6, 6); val.padding = new RectOffset(12, 12, 10, 10); val.margin = new RectOffset(4, 4, 4, 4); _cardStyle = val; GUIStyle val2 = new GUIStyle(_cardStyle); val2.normal.background = _cardHoverTex; _cardHoverStyle = val2; _btnStyle = new GUIStyle(GUI.skin.button) { fontSize = 14, fontStyle = (FontStyle)1, padding = new RectOffset(14, 14, 8, 8) }; _btnStyle.normal.background = _cardTex; _btnStyle.hover.background = _cardHoverTex; _btnStyle.active.background = _cardHoverTex; _btnStyle.normal.textColor = textColor; _btnStyle.hover.textColor = Color.white; _fieldStyle = new GUIStyle(GUI.skin.textField) { fontSize = 16, padding = new RectOffset(8, 8, 6, 6) }; _fieldStyle.normal.background = _fieldTex; _fieldStyle.normal.textColor = Color.white; _roleNameStyle = new GUIStyle(GUI.skin.label) { fontSize = 16, fontStyle = (FontStyle)1, richText = true }; _roleNameStyle.normal.textColor = textColor; } } private void OnGUI() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0038: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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.color = Color.white; GUI.DrawTexture(new Rect(0f, 0f, num, num2), (Texture)(object)_backdropTex); switch (_mode) { case Mode.Browse: DrawBrowse(num, num2); break; case Mode.Create: DrawCreate(num, num2); break; case Mode.Role: DrawRole(num, num2); break; } GUI.matrix = matrix; } } private void DrawPanel(Rect r) { //IL_0001: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(r, (Texture)(object)_panelTex); GUI.color = new Color(0.65f, 0.5f, 0.2f, 0.85f); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 2f), (Texture)(object)_pixelTex); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width, 2f), (Texture)(object)_pixelTex); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 2f, ((Rect)(ref r)).height), (Texture)(object)_pixelTex); GUI.DrawTexture(new Rect(((Rect)(ref r)).xMax - 2f, ((Rect)(ref r)).y, 2f, ((Rect)(ref r)).height), (Texture)(object)_pixelTex); GUI.color = Color.white; } private void DrawBrowse(float refW, float refH) { //IL_0035: 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) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) float num = 720f; float num2 = Mathf.Min(refH - 60f, 640f); Rect r = default(Rect); ((Rect)(ref r))..ctor((refW - num) / 2f, (refH - num2) / 2f, num, num2); DrawPanel(r); GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 18f, ((Rect)(ref r)).width, 36f), "CHOOSE YOUR CLAN", _titleStyle); GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 56f, ((Rect)(ref r)).width, 20f), "Join a clan that already stands, or found your own.", _subtitleStyle); WarfareData warfareData = WarfareManager.Instance?.Data; List<Clan> list = ((warfareData != null) ? new List<Clan>(warfareData.Clans.Values) : new List<Clan>()); Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 90f, ((Rect)(ref r)).width - 48f, ((Rect)(ref r)).height - 170f); float num3 = 64f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, ((Rect)(ref val)).width - 20f, Mathf.Max(((Rect)(ref val)).height, (float)list.Count * (num3 + 6f))); _browseScroll = GUI.BeginScrollView(val, _browseScroll, val2); if (list.Count == 0) { GUI.Label(new Rect(0f, 10f, ((Rect)(ref val2)).width, 30f), "No clans exist yet — be the first to found one!", _subtitleStyle); } Rect val3 = default(Rect); Rect val6 = default(Rect); for (int i = 0; i < list.Count; i++) { Clan clan = list[i]; ((Rect)(ref val3))..ctor(0f, (float)i * (num3 + 6f), ((Rect)(ref val2)).width, num3); bool flag = ((Rect)(ref val3)).Contains(Event.current.mousePosition); GUI.DrawTexture(val3, (Texture)(object)(flag ? _cardHoverTex : _cardTex)); GUI.color = clan.Color; GUI.DrawTexture(new Rect(((Rect)(ref val3)).x, ((Rect)(ref val3)).y, 5f, ((Rect)(ref val3)).height), (Texture)(object)_pixelTex); GUI.color = Color.white; GUIStyle val4 = new GUIStyle(_titleStyle) { fontSize = 30 }; val4.normal.textColor = clan.Color; GUI.Label(new Rect(((Rect)(ref val3)).x + 14f, ((Rect)(ref val3)).y + 14f, 44f, 40f), ClanConfig.GetIcon(clan.IconIndex), val4); GUIStyle val5 = new GUIStyle(_roleNameStyle) { fontSize = 17 }; val5.normal.textColor = clan.Color; GUI.Label(new Rect(((Rect)(ref val3)).x + 66f, ((Rect)(ref val3)).y + 8f, ((Rect)(ref val3)).width - 200f, 24f), clan.Name + " [" + clan.Tag + "]", val5); int clanMemberCount = warfareData.GetClanMemberCount(clan.ClanId); int clanTerritoryCount = warfareData.GetClanTerritoryCount(clan.ClanId); GUI.Label(new Rect(((Rect)(ref val3)).x + 66f, ((Rect)(ref val3)).y + 32f, ((Rect)(ref val3)).width - 200f, 22f), $"{clanMemberCount} members {clanTerritoryCount} territories {clan.Treasury} coins", _bodyStyle); ((Rect)(ref val6))..ctor(((Rect)(ref val3)).xMax - 110f, ((Rect)(ref val3)).y + 16f, 96f, 32f); if (GUI.Button(val6, "Join", _btnStyle)) { WarfareRPC.Instance?.RequestJoinClan(clan.ClanId); } } GUI.EndScrollView(); if (GUI.Button(new Rect(((Rect)(ref r)).x + ((Rect)(ref r)).width / 2f - 140f, ((Rect)(ref r)).yMax - 64f, 280f, 40f), "⚒ Found a New Clan", _btnStyle)) { _mode = Mode.Create; _createName = ""; _createTag = ""; } } private void DrawCreate(float refW, float refH) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Expected O, but got Unknown //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0362: 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_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Expected O, but got Unknown //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) float num = 660f; float num2 = 560f; Rect r = default(Rect); ((Rect)(ref r))..ctor((refW - num) / 2f, (refH - num2) / 2f, num, num2); DrawPanel(r); GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 18f, ((Rect)(ref r)).width, 36f), "FOUND A CLAN", _titleStyle); float num3 = ((Rect)(ref r)).x + 40f; float num4 = ((Rect)(ref r)).width - 80f; float num5 = ((Rect)(ref r)).y + 70f; GUI.Label(new Rect(num3, num5, num4, 20f), "Clan name (3-24 characters)", _bodyStyle); _createName = GUI.TextField(new Rect(num3, num5 + 22f, num4, 32f), _createName ?? "", 24, _fieldStyle); num5 += 66f; GUI.Label(new Rect(num3, num5, num4, 20f), "Clan tag (1-6 characters)", _bodyStyle); _createTag = GUI.TextField(new Rect(num3, num5 + 22f, 160f, 32f), _createTag ?? "", 6, _fieldStyle); num5 += 66f; GUI.Label(new Rect(num3, num5, num4, 20f), "Banner colour", _bodyStyle); num5 += 24f; int num6 = 12; float num7 = (num4 - (float)((num6 - 1) * 6)) / (float)num6; Rect val = default(Rect); for (int i = 0; i < ClanConfig.ClanColors.Length; i++) { ((Rect)(ref val))..ctor(num3 + (float)i * (num7 + 6f), num5, num7, 28f); GUI.color = ClanConfig.ClanColors[i]; GUI.DrawTexture(val, (Texture)(object)_pixelTex); GUI.color = Color.white; if (i == _colorIndex) { GUI.color = Color.white; GUI.DrawTexture(new Rect(((Rect)(ref val)).x - 2f, ((Rect)(ref val)).y - 2f, ((Rect)(ref val)).width + 4f, 2f), (Texture)(object)_pixelTex); GUI.DrawTexture(new Rect(((Rect)(ref val)).x - 2f, ((Rect)(ref val)).yMax, ((Rect)(ref val)).width + 4f, 2f), (Texture)(object)_pixelTex); GUI.color = Color.white; } if ((int)Event.current.type == 0 && ((Rect)(ref val)).Contains(Event.current.mousePosition)) { _colorIndex = i; Event.current.Use(); } } num5 += 48f; GUI.Label(new Rect(num3, num5, num4, 20f), "Clan emblem", _bodyStyle); num5 += 24f; Rect val2 = default(Rect); for (int j = 0; j < ClanConfig.ClanIcons.Length; j++) { ((Rect)(ref val2))..ctor(num3 + (float)j * (num7 + 6f), num5, num7, 34f); bool flag = j == _iconIndex; GUI.DrawTexture(val2, (Texture)(object)(flag ? _cardHoverTex : _cardTex)); GUIStyle val3 = new GUIStyle(_roleNameStyle) { alignment = (TextAnchor)4, fontSize = 20 }; val3.normal.textColor = (Color)(flag ? ClanConfig.GetColor(_colorIndex) : new Color(0.8f, 0.75f, 0.6f)); GUI.Label(val2, ClanConfig.ClanIcons[j], val3); if ((int)Event.current.type == 0 && ((Rect)(ref val2)).Contains(Event.current.mousePosition)) { _iconIndex = j; Event.current.Use(); } } num5 += 56f; GUIStyle val4 = new GUIStyle(_roleNameStyle) { alignment = (TextAnchor)4, fontSize = 22 }; val4.normal.textColor = ClanConfig.GetColor(_colorIndex); string text = (string.IsNullOrEmpty(_createName) ? "Your Clan" : _createName); string text2 = (string.IsNullOrEmpty(_createTag) ? "TAG" : _createTag); GUI.Label(new Rect(num3, num5, num4, 30f), ClanConfig.GetIcon(_iconIndex) + " " + text + " [" + text2 + "]", val4);