using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Cryptography; using System.Text; using HarmonyLib; using Il2Cpp; using Il2CppFishNet; using Il2CppFishNet.Connection; using Il2CppFishNet.Managing; using Il2CppFishNet.Object; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.Building; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.Interaction; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.Networking; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.Persistence.Datas; using Il2CppScheduleOne.Persistence.Loaders; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.Tiles; using Il2CppScheduleOne.Tools; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Compass; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using Microsoft.CodeAnalysis; using Ndrangheta.Compat; using Ndrangheta.Framework; using Ndrangheta.Helper; using S1API.Input; using S1API.Internal.Abstraction; using S1API.PhoneApp; using S1API.Saveables; using S1API.UI; using S1API.Utils; using S1MAPI.Core; using S1MAPI.S1; using UnityEngine; using UnityEngine.AI; using UnityEngine.EventSystems; using UnityEngine.Events; 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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: MelonInfo(typeof(TheMobFrameworkMod), "TheMob Connector", "1.0.7", "Virtunerd", null)] [assembly: MelonGame(null, "Schedule I")] [assembly: AssemblyFileVersion("1.0.7")] [assembly: AssemblyInformationalVersion("1.0.7")] [assembly: AssemblyVersion("1.0.7.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 Ndrangheta.UI { public class FamigliaApp : PhoneApp { private static readonly Color MainBg = new Color(0.03f, 0.07f, 0.14f); private static readonly Color TopBarBg = new Color(0.05f, 0.1f, 0.19f); private static readonly Color NavBg = new Color(0.06f, 0.13f, 0.24f); private static readonly Color ContentBg = new Color(0.04f, 0.09f, 0.17f); private static readonly Color CardBg = new Color(0.02f, 0.05f, 0.1f); private static readonly Color SellBtn = new Color(0.42f, 0.12f, 0.12f); private static readonly Color LockedBg = new Color(0.05f, 0.1f, 0.18f); private static readonly Color LockedTxt = new Color(0.4f, 0.4f, 0.4f); private static readonly Color ErrorTxt = new Color(1f, 0.4f, 0.4f); private static readonly Color LoadPctColor = new Color(0.8f, 0.85f, 0.95f); private Color _accent = new Color(0.1f, 0.22f, 0.4f); private Color _gold = new Color(0.83f, 0.69f, 0.22f); private const int MinSelectSlots = 4; private const float APP_TOP = 0.89f; private const float APP_BOTTOM = 0.03f; private GameObject _selectPanel; private GameObject _loadingPanel; private GameObject _mainRoot; private RectTransform _loadFill; private Image _loadFillImg; private Text _loadPctText; private Text _loadFamilyText; private bool _loading; private Text _loadErrorText; private GameObject _loadBackBtn; private GameObject _homePage; private GameObject _realEstatePage; private GameObject _listaPage; private GameObject _cassaPage; private GameObject _furnishPage; private GameObject[] _pages; private RectTransform _reContent; private Text _statusText; private Text _homeTitleText; private Text _homeText; private Text _hqLabel; private Text _homeStatus; private Text _moralLadderText; private RectTransform _hqContent; private RectTransform _incomeHost; private GameObject _shopPage; private RectTransform _shopList; private Text _shopStatus; private GameObject _operationsPage; private RectTransform _operationsList; private Text _operationsStatus; private readonly List _gifCoroutines = new List(); private Text _moralTitleText; private GameObject _faidaPage; private RectTransform _faidaList; private Text _faidaIntro; private Text _faidaTitleText; private Text _faidaNavText; private RectTransform _furnishContent; private GameObject _furnishTabsHost; private Text _furnishTitle; private int _furnishSurface; private IMobFurnishTarget _furnishTarget; private GameObject _furnishChooser; private GameObject _furnishEditor; private GameObject _furnishChooseHost; private GameObject _furnishReturnPage; internal static FamigliaApp Instance { get; private set; } private static MobFamily Active => MobFamilyRegistry.Active; protected override string AppName => "FamigliaApp"; protected override string AppTitle => "TheMob"; protected override string IconLabel => "TheMob"; protected override string IconFileName => string.Empty; protected override void OnCreated() { ((PhoneApp)this).OnCreated(); Instance = this; } protected override void OnDestroyed() { Instance = null; ((PhoneApp)this).OnDestroyed(); } protected override void OnCreatedUI(GameObject container) { try { try { Sprite val = AssetLoader.LoadSprite("Ndrangheta.assets.appicon.png"); if ((Object)(object)val != (Object)null) { ((PhoneApp)this).SetIconSprite(val); } } catch (Exception ex) { NDLog.DebugWarn("[APP] icon: " + ex.Message); } BuildSelectPanel(container.transform); BuildLoadingPanel(container.transform); ShowSelect(); NDLog.Debug($"[APP] TheMob app UI built (families={MobFamilyRegistry.All.Count}, intro flow active)."); } catch (Exception ex2) { NDLog.Warn("[APP] OnCreatedUI: " + ex2.Message); } } protected override void OnPhoneClosed() { try { NDLog.Debug("[APP] OnPhoneClosed -> DestroyMain + ShowSelect."); _loading = false; DestroyMain(); ShowSelect(); Controls.IsTyping = false; try { EventSystem current = EventSystem.current; if (current != null) { current.SetSelectedGameObject((GameObject)null); } } catch { } } catch { } ((PhoneApp)this).OnPhoneClosed(); } private void BuildSelectPanel(Transform container) { //IL_0008: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00db: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_014f: Expected O, but got Unknown //IL_0183: 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_024d: 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_026a: Unknown result type (might be due to invalid IL or missing references) _selectPanel = MakePanel("SelectPanel", container, MainBg, null, null, fullAnchor: true); Text val = UIFactory.Text("SelTitle", "SELECT YOUR MOB", _selectPanel.transform, 24, (TextAnchor)1, (FontStyle)3); ((Graphic)val).color = _gold; Rect(((Graphic)val).rectTransform, new Vector2(0.05f, 0.8f), new Vector2(0.95f, 0.95f)); Text val2 = UIFactory.Text("SelSub", "Choose the family you run. Omerta above all.", _selectPanel.transform, 13, (TextAnchor)1, (FontStyle)2); ((Graphic)val2).color = new Color(0.7f, 0.75f, 0.85f); Rect(((Graphic)val2).rectTransform, new Vector2(0.05f, 0.72f), new Vector2(0.95f, 0.8f)); GameObject val3 = UIFactory.Panel("SelList", _selectPanel.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.2f, 0.1f), (Vector2?)new Vector2(0.8f, 0.7f), false); UIFactory.VerticalLayoutOnGO(val3, 10, new RectOffset(8, 8, 8, 8)); IReadOnlyList all = MobFamilyRegistry.All; if (all.Count == 0) { Text val4 = UIFactory.Text("SelNone", "TheMob Connector loaded, but no clans found.\n\nInstall a clan mod (e.g. Ndrangheta) to play.", val3.transform, 15, (TextAnchor)1, (FontStyle)2); ((Graphic)val4).color = LockedTxt; LayoutElement val5 = ((Component)val4).gameObject.AddComponent(); val5.minHeight = 140f; val5.preferredHeight = 140f; val5.flexibleWidth = 1f; return; } int num = Mathf.Max(4, all.Count); for (int i = 0; i < num; i++) { MobFamily mobFamily = ((i < all.Count) ? all[i] : null); bool flag = mobFamily?.Available ?? false; string text = ((mobFamily != null) ? mobFamily.DisplayName : "Coming Soon"); ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel($"Fam_{i}", text, val3.transform, flag ? _accent : LockedBg, 0f, 44f, 16, flag ? Color.white : LockedTxt); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; LayoutElement val6 = item.GetComponent(); if ((Object)(object)val6 == (Object)null) { val6 = item.AddComponent(); } val6.minHeight = 44f; val6.preferredHeight = 44f; val6.flexibleWidth = 1f; if (flag) { MobFamily picked = mobFamily; ButtonUtils.AddListener(item2, (Action)delegate { OnFamilyChosen(picked); }); } else { try { ((Selectable)item2).interactable = false; } catch { } } } } private void BuildLoadingPanel(Transform container) { //IL_0008: 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_0075: 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_00b9: 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_00e8: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_029f: 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_0300: 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_031a: Unknown result type (might be due to invalid IL or missing references) _loadingPanel = MakePanel("LoadingPanel", container, MainBg, null, null, fullAnchor: true); _loadingPanel.SetActive(false); Text val = UIFactory.Text("LoadBrand", "THE MOB", _loadingPanel.transform, 30, (TextAnchor)7, (FontStyle)3); ((Graphic)val).color = _gold; Rect(((Graphic)val).rectTransform, new Vector2(0.1f, 0.6f), new Vector2(0.9f, 0.74f)); _loadFamilyText = UIFactory.Text("LoadFamily", "", _loadingPanel.transform, 15, (TextAnchor)1, (FontStyle)2); ((Graphic)_loadFamilyText).color = Color.white; Rect(((Graphic)_loadFamilyText).rectTransform, new Vector2(0.1f, 0.52f), new Vector2(0.9f, 0.6f)); GameObject val2 = UIFactory.Panel("LoadTrack", _loadingPanel.transform, new Color(0.02f, 0.05f, 0.1f), (Vector2?)new Vector2(0.2f, 0.4f), (Vector2?)new Vector2(0.8f, 0.46f), false); GameObject val3 = UIFactory.Panel("LoadFill", val2.transform, _gold, (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(0f, 1f), false); _loadFill = val3.GetComponent(); _loadFillImg = val3.GetComponent(); _loadPctText = UIFactory.Text("LoadPct", "LOADING 0%", _loadingPanel.transform, 14, (TextAnchor)1, (FontStyle)0); ((Graphic)_loadPctText).color = LoadPctColor; Rect(((Graphic)_loadPctText).rectTransform, new Vector2(0.1f, 0.31f), new Vector2(0.9f, 0.39f)); _loadErrorText = UIFactory.Text("LoadError", "", _loadingPanel.transform, 13, (TextAnchor)1, (FontStyle)2); ((Graphic)_loadErrorText).color = ErrorTxt; Rect(((Graphic)_loadErrorText).rectTransform, new Vector2(0.12f, 0.13f), new Vector2(0.88f, 0.29f)); ((Component)_loadErrorText).gameObject.SetActive(false); ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel("LoadBack", "< BACK", _loadingPanel.transform, _accent, 0f, 32f, 13, Color.white); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; _loadBackBtn = item; RectTransform component = item.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.35f, 0.04f); component.anchorMax = new Vector2(0.65f, 0.11f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } ButtonUtils.AddListener(item2, (Action)BackToSelectFromLoad); _loadBackBtn.SetActive(false); } private void ShowSelect() { try { if ((Object)(object)_loadingPanel != (Object)null) { _loadingPanel.SetActive(false); } if ((Object)(object)_selectPanel != (Object)null) { _selectPanel.SetActive(true); } } catch { } } private void OnFamilyChosen(MobFamily family) { //IL_009f: 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_00cb: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) try { MobFamilyRegistry.SetActive(family); if ((Object)(object)_selectPanel != (Object)null) { _selectPanel.SetActive(false); } if ((Object)(object)_loadingPanel != (Object)null) { _loadingPanel.SetActive(true); } if ((Object)(object)_loadFamilyText != (Object)null) { _loadFamilyText.text = ((family != null) ? ("Connecting to " + family.DisplayName + "...") : ""); } if ((Object)(object)_loadFill != (Object)null) { _loadFill.anchorMin = new Vector2(0f, 0f); _loadFill.anchorMax = new Vector2(0f, 1f); _loadFill.offsetMin = Vector2.zero; _loadFill.offsetMax = Vector2.zero; } if ((Object)(object)_loadFillImg != (Object)null) { ((Graphic)_loadFillImg).color = _gold; } if ((Object)(object)_loadPctText != (Object)null) { _loadPctText.text = "LOADING 0%"; ((Graphic)_loadPctText).color = LoadPctColor; } if ((Object)(object)_loadErrorText != (Object)null) { ((Component)_loadErrorText).gameObject.SetActive(false); } if ((Object)(object)_loadBackBtn != (Object)null) { _loadBackBtn.SetActive(false); } _loading = true; MelonCoroutines.Start(LoadingRoutine()); } catch (Exception ex) { NDLog.DebugWarn("[APP] OnFamilyChosen: " + ex.Message); RevealMain(); } } private IEnumerator LoadingRoutine() { bool unlocked; try { unlocked = Active?.AppUnlocked ?? true; } catch { unlocked = true; } if (unlocked) { yield return null; try { if (Active != null) { _ = Active.Operations; } } catch (Exception ex) { Exception px = ex; NDLog.DebugWarn("[APP] GIF preload: " + px.Message); } float t = 0f; while (t < 2.2f) { if (!_loading || Instance != this) { yield break; } t += Time.deltaTime; float frac = Mathf.Clamp01(t / 2.2f); try { if ((Object)(object)_loadFill != (Object)null) { _loadFill.anchorMax = new Vector2(frac, 1f); } if ((Object)(object)_loadPctText != (Object)null) { _loadPctText.text = $"LOADING {Mathf.RoundToInt(frac * 100f)}%"; } } catch { } yield return null; } RevealMain(); yield break; } float et = 0f; bool hung = false; while (et < 1.6f) { if (!_loading || Instance != this) { yield break; } et += Time.deltaTime; float frac2 = Mathf.Clamp01(et / 1.6f) * 0.7f; try { if ((Object)(object)_loadFill != (Object)null) { _loadFill.anchorMax = new Vector2(frac2, 1f); } if ((Object)(object)_loadPctText != (Object)null) { _loadPctText.text = $"CONNECTING {Mathf.RoundToInt(frac2 * 100f)}%"; } } catch { } yield return null; if (!hung && et >= 0.88000005f) { hung = true; if (!_loading || Instance != this) { yield break; } yield return (object)new WaitForSeconds(0.45f); } } ShowLoadError(); } private void ShowLoadError() { //IL_0059: 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_00c1: Unknown result type (might be due to invalid IL or missing references) try { _loading = false; MobFamily active = Active; string text = ((active != null) ? (active.AppLockedTitle ?? "ACCESS DENIED") : "ACCESS DENIED"); string text2 = ((active != null) ? (active.AppLockedText ?? "") : ""); if ((Object)(object)_loadFillImg != (Object)null) { ((Graphic)_loadFillImg).color = ErrorTxt; } if ((Object)(object)_loadFill != (Object)null) { _loadFill.anchorMax = new Vector2(0.7f, 1f); } if ((Object)(object)_loadPctText != (Object)null) { _loadPctText.text = "ERROR — " + text; ((Graphic)_loadPctText).color = ErrorTxt; } if ((Object)(object)_loadFamilyText != (Object)null) { _loadFamilyText.text = "CONNECTION REFUSED"; } if ((Object)(object)_loadErrorText != (Object)null) { _loadErrorText.text = text2; ((Component)_loadErrorText).gameObject.SetActive(true); } if ((Object)(object)_loadBackBtn != (Object)null) { _loadBackBtn.SetActive(true); } NDLog.Debug("[APP] loading gate -> locked (player is not boss yet)."); } catch (Exception ex) { NDLog.DebugWarn("[APP] ShowLoadError: " + ex.Message); } } private void BackToSelectFromLoad() { //IL_005f: 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) try { _loading = false; if ((Object)(object)_loadErrorText != (Object)null) { ((Component)_loadErrorText).gameObject.SetActive(false); } if ((Object)(object)_loadBackBtn != (Object)null) { _loadBackBtn.SetActive(false); } if ((Object)(object)_loadFillImg != (Object)null) { ((Graphic)_loadFillImg).color = _gold; } if ((Object)(object)_loadPctText != (Object)null) { ((Graphic)_loadPctText).color = LoadPctColor; } ShowSelect(); } catch (Exception ex) { NDLog.DebugWarn("[APP] BackToSelectFromLoad: " + ex.Message); } } private void RevealMain() { try { bool flag = true; try { flag = Active?.AppUnlocked ?? true; } catch { flag = true; } if (!flag) { ShowLoadError(); return; } _loading = false; if ((Object)(object)_loadingPanel != (Object)null) { _loadingPanel.SetActive(false); } if ((Object)(object)_selectPanel != (Object)null) { _selectPanel.SetActive(false); } BuildMain(Active); if ((Object)(object)_mainRoot != (Object)null) { _mainRoot.SetActive(true); } SetActivePage(_homePage, refreshHome: true); } catch (Exception ex) { NDLog.DebugWarn("[APP] RevealMain: " + ex.Message); } } private void DestroyMain() { try { if ((Object)(object)_mainRoot != (Object)null) { Object.Destroy((Object)(object)_mainRoot); } } catch { } _mainRoot = null; _homePage = (_realEstatePage = (_listaPage = (_cassaPage = (_furnishPage = null)))); _pages = null; _reContent = null; _statusText = null; _homeTitleText = null; _homeText = null; _hqLabel = null; _homeStatus = null; _hqContent = null; _incomeHost = null; _shopPage = null; _shopList = null; _shopStatus = null; StopGifs(); _operationsPage = null; _operationsList = null; _operationsStatus = null; _furnishContent = null; _furnishTabsHost = null; _furnishTitle = null; _furnishChooser = (_furnishEditor = (_furnishChooseHost = null)); _furnishTarget = null; _furnishReturnPage = null; _moralTitleText = null; _moralLadderText = null; _faidaPage = null; _faidaList = null; _faidaIntro = null; _faidaTitleText = null; _faidaNavText = null; } private void BuildMain(MobFamily fam) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Expected O, but got Unknown //IL_0142: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) DestroyMain(); NDLog.Debug("[APP] BuildMain — Haupt-UI (neu) gebaut."); if (fam != null) { _accent = fam.Accent; _gold = fam.Highlight; } Transform val = (((Object)(object)_selectPanel != (Object)null) ? _selectPanel.transform.parent : (((Object)(object)_loadingPanel != (Object)null) ? _loadingPanel.transform.parent : null)); if ((Object)(object)val == (Object)null) { NDLog.Warn("[APP] BuildMain: no container."); return; } GameObject val2 = (_mainRoot = UIFactory.Panel("FamigliaMainBG", val, MainBg, (Vector2?)new Vector2(0f, 0.03f), (Vector2?)new Vector2(1f, 0.89f), false)); GameObject val3 = MakePanel("TopBar", val2.transform, TopBarBg, (Vector2?)new Vector2(0.039f, 0.934f), (Vector2?)new Vector2(0.962f, 1.036f), fullAnchor: false); string text = ((fam != null) ? fam.BrandTitle : "THE MOB"); Text val4 = UIFactory.Text("Brand", text, val3.transform, 21, (TextAnchor)6, (FontStyle)3); ((Graphic)val4).color = _gold; Rect(((Graphic)val4).rectTransform, new Vector2(0.02f, 0.35f), new Vector2(0.4f, 0.99f)); string text2 = ((fam != null) ? fam.BrandSubtitle : ""); Text val5 = UIFactory.Text("BrandSub", text2 ?? "", val3.transform, 12, (TextAnchor)0, (FontStyle)2); ((Graphic)val5).color = new Color(0.6f, 0.65f, 0.75f); Rect(((Graphic)val5).rectTransform, new Vector2(0.02f, 0.03f), new Vector2(0.4f, 0.35f)); _moralTitleText = UIFactory.Text("MoralTitle", (fam != null) ? (fam.MoralTitle ?? "") : "", val3.transform, 17, (TextAnchor)4, (FontStyle)3); ((Graphic)_moralTitleText).color = _gold; _moralTitleText.horizontalOverflow = (HorizontalWrapMode)1; _moralTitleText.verticalOverflow = (VerticalWrapMode)1; Rect(((Graphic)_moralTitleText).rectTransform, new Vector2(0.4f, 0.05f), new Vector2(0.66f, 1.01f)); Text val6 = UIFactory.Text("LoginAs", "LOGGED IN AS: BOSS", val3.transform, 12, (TextAnchor)5, (FontStyle)1); ((Graphic)val6).color = _gold; Rect(((Graphic)val6).rectTransform, new Vector2(0.66f, 0.01f), new Vector2(0.975f, 1.01f)); GameObject val7 = MakePanel("NavPanel", val2.transform, NavBg, (Vector2?)new Vector2(0.041f, 0.028f), (Vector2?)new Vector2(0.248f, 0.932f), fullAnchor: false); GameObject val8 = MakePanel("NavPhoto", val7.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.005f, 0.508f), (Vector2?)new Vector2(0.715f, 1.036f), fullAnchor: false); try { Sprite val9 = null; try { val9 = Active?.HomeImage; } catch { } if ((Object)(object)val9 == (Object)null) { val9 = AssetLoader.LoadSprite("Ndrangheta.assets.icon_hometab.png"); } if ((Object)(object)val9 != (Object)null) { GameObject val10 = new GameObject("NavPhotoImg"); val10.transform.SetParent(val8.transform, false); Image val11 = val10.AddComponent(); val11.sprite = val9; val11.preserveAspect = true; ((Graphic)val11).raycastTarget = false; RectTransform component = val10.GetComponent(); if ((Object)(object)component != (Object)null) { Rect(component, new Vector2(0.017f, 0.024f), new Vector2(1.3f, 1.3f)); } } } catch (Exception ex) { NDLog.DebugWarn("[APP] NavPhoto: " + ex.Message); } GameObject val12 = MakePanel("NavTabsHost", val7.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.016f, 0.064f), (Vector2?)new Vector2(0.925f, 0.725f), fullAnchor: false); ScrollRect val14 = default(ScrollRect); RectTransform val13 = UIFactory.ScrollableVerticalList("NavList", val12.transform, ref val14); try { if ((Object)(object)val14 != (Object)null) { val14.horizontal = false; val14.vertical = true; val14.scrollSensitivity = 18f; } VerticalLayoutGroup component2 = ((Component)val13).GetComponent(); if ((Object)(object)component2 != (Object)null) { ((HorizontalOrVerticalLayoutGroup)component2).spacing = 8f; ((LayoutGroup)component2).padding = new RectOffset(8, 8, 12, 10); ((HorizontalOrVerticalLayoutGroup)component2).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)component2).childControlHeight = true; ((LayoutGroup)component2).childAlignment = (TextAnchor)1; } } catch { } UIFactory.FitContentHeight(val13); HardenScrollClip(val14); GameObject val15 = MakePanel("ContentArea", val2.transform, ContentBg, (Vector2?)new Vector2(0.245f, 0.055f), (Vector2?)new Vector2(0.959f, 0.934f), fullAnchor: false); _homePage = BuildHomePage(val15.transform); _realEstatePage = BuildRealEstatePage(val15.transform); _listaPage = null; _cassaPage = null; _furnishPage = BuildFurnishPage(val15.transform); _shopPage = BuildShopPage(val15.transform); _faidaPage = BuildFaidaPage(val15.transform); _operationsPage = BuildOperationsPage(val15.transform); _pages = (GameObject[])(object)new GameObject[6] { _homePage, _realEstatePage, _furnishPage, _shopPage, _faidaPage, _operationsPage }; AddNavButton((Transform)(object)val13, "Home", locked: false, delegate { SetActivePage(_homePage, refreshHome: true); }); AddNavButton((Transform)(object)val13, "Real Estate", locked: false, delegate { SetActivePage(_realEstatePage); RefreshRealEstate(); }); AddNavButton((Transform)(object)val13, "Little Helper", locked: false, delegate { SetActivePage(_shopPage); RefreshShop(); }); _faidaNavText = AddNavButton((Transform)(object)val13, "Faida", locked: false, delegate { SetActivePage(_faidaPage); RefreshFaida(); }); AddNavButton((Transform)(object)val13, "Operations", locked: false, delegate { SetActivePage(_operationsPage); RefreshOperations(); }); SetActivePage(_homePage, refreshHome: true); DisableContainerRaycasts(_mainRoot); } private GameObject BuildHomePage(Transform parent) { //IL_001b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_027b: 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_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0311: 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_034a: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) GameObject val = MakePanel("HomePage", parent, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); _homeTitleText = UIFactory.Text("HomeTitle", "", val.transform, 20, (TextAnchor)0, (FontStyle)1); ((Graphic)_homeTitleText).color = _gold; Rect(((Graphic)_homeTitleText).rectTransform, new Vector2(0.045f, 0.875f), new Vector2(0.959f, 0.965f)); _moralLadderText = UIFactory.Text("HomeMoralLadder", "", val.transform, 11, (TextAnchor)2, (FontStyle)0); ((Graphic)_moralLadderText).color = Color.white; _moralLadderText.horizontalOverflow = (HorizontalWrapMode)0; _moralLadderText.verticalOverflow = (VerticalWrapMode)1; Rect(((Graphic)_moralLadderText).rectTransform, new Vector2(0.49f, 0.7f), new Vector2(0.965f, 0.965f)); _homeText = UIFactory.Text("HomeBody", "", val.transform, 14, (TextAnchor)0, (FontStyle)0); ((Graphic)_homeText).color = Color.white; Rect(((Graphic)_homeText).rectTransform, new Vector2(0.046f, 0.639f), new Vector2(0.474f, 0.904f)); _hqLabel = UIFactory.Text("HomeHqLabel", "", val.transform, 14, (TextAnchor)6, (FontStyle)1); ((Graphic)_hqLabel).color = _gold; Rect(((Graphic)_hqLabel).rectTransform, new Vector2(0.719f, 0.65f), new Vector2(1.115f, 0.71f)); _homeStatus = UIFactory.Text("HomeStatus", "", val.transform, 12, (TextAnchor)6, (FontStyle)2); ((Graphic)_homeStatus).color = _gold; _homeStatus.horizontalOverflow = (HorizontalWrapMode)0; _homeStatus.verticalOverflow = (VerticalWrapMode)1; Rect(((Graphic)_homeStatus).rectTransform, new Vector2(0.715f, 0.72f), new Vector2(0.98f, 0.865f)); GameObject val2 = MakePanel("HomeHqHost", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.715f, 0.005f), (Vector2?)new Vector2(0.98f, 0.636f), fullAnchor: false); ScrollRect sr = default(ScrollRect); _hqContent = UIFactory.ScrollableVerticalList("HomeHqList", val2.transform, ref sr); UIFactory.FitContentHeight(_hqContent); HardenScrollClip(sr); Text val3 = UIFactory.Text("HomeIncomeLabel", "INCOME", val.transform, 14, (TextAnchor)6, (FontStyle)1); ((Graphic)val3).color = _gold; Rect(((Graphic)val3).rectTransform, new Vector2(0.053f, 0.487f), new Vector2(0.164f, 0.628f)); GameObject val4 = MakePanel("HomeIncomeHost", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.047f, 0.361f), (Vector2?)new Vector2(0.322f, 0.478f), fullAnchor: false); _incomeHost = val4.GetComponent(); return val; } private void RefreshHome() { try { MobFamily active = Active; if ((Object)(object)_faidaNavText != (Object)null) { _faidaNavText.text = ((active != null) ? (active.FaidaTitle ?? "FAIDA") : "FAIDA"); } if ((Object)(object)_homeTitleText != (Object)null) { _homeTitleText.text = ((active != null) ? active.HomeTitle : ""); } if ((Object)(object)_moralTitleText != (Object)null) { _moralTitleText.text = ((active != null) ? (active.MoralTitle ?? "") : ""); } if ((Object)(object)_moralLadderText != (Object)null) { _moralLadderText.text = ((active != null) ? (active.MoralLadder ?? "") : ""); } if ((Object)(object)_homeText != (Object)null) { _homeText.text = ((active != null) ? active.GetHomeText() : ""); } RefreshIncomeBars(); BuildHeadquarter(active); } catch { } } private void RefreshIncomeBars() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)_incomeHost == (Object)null)) { UIFactory.ClearChildren(((Component)_incomeHost).transform); Color color = default(Color); ((Color)(ref color))..ctor(0.82f, 0.86f, 0.94f); IncomeStatRow("TOTAL EARNED", IncomeTracker.TotalIncome, 0.67f, 1f, _gold, emphasize: true); IncomeStatRow("Quests", IncomeTracker.QuestIncome, 0.345f, 0.655f, color, emphasize: false); IncomeStatRow("Other", IncomeTracker.OtherIncome, 0f, 0.33f, color, emphasize: false); } } catch (Exception ex) { NDLog.DebugWarn("[APP] RefreshIncomeBars: " + ex.Message); } } private void IncomeStatRow(string name, long amount, float yBot, float yTop, Color color, bool emphasize) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0096: 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) Text val = UIFactory.Text("IncR_" + name, name, (Transform)(object)_incomeHost, 12, (TextAnchor)3, (FontStyle)(emphasize ? 1 : 0)); ((Graphic)val).color = color; val.horizontalOverflow = (HorizontalWrapMode)1; Rect(((Graphic)val).rectTransform, new Vector2(0.02f, yBot), new Vector2(0.62f, yTop)); Text val2 = UIFactory.Text("IncRV_" + name, CompactMoney(amount), (Transform)(object)_incomeHost, 12, (TextAnchor)5, (FontStyle)1); ((Graphic)val2).color = color; val2.horizontalOverflow = (HorizontalWrapMode)1; Rect(((Graphic)val2).rectTransform, new Vector2(0.4f, yBot), new Vector2(0.98f, yTop)); } private static string CompactMoney(long v) { if (v < 1000000) { if (v < 1000) { return $"${v}"; } return $"${(float)v / 1000f:0.0}K"; } return $"${(float)v / 1000000f:0.0}M"; } private void BuildHeadquarter(MobFamily fam) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_hqContent == (Object)null) { return; } UIFactory.ClearChildren(((Component)_hqContent).transform); IReadOnlyList readOnlyList = fam?.HeadquarterActions; bool flag = readOnlyList != null && readOnlyList.Count > 0; if ((Object)(object)_hqLabel != (Object)null) { _hqLabel.text = (flag ? (fam.HeadquarterTitle ?? "HEADQUARTER") : ""); } if (!flag) { return; } if (!fam.HeadquarterUnlocked) { Text val = UIFactory.Text("HqLocked", fam.HeadquarterLockedText ?? "Locked.", (Transform)(object)_hqContent, 13, (TextAnchor)0, (FontStyle)0); ((Graphic)val).color = LockedTxt; AddLayout(((Component)val).gameObject, 90f); Rect(((Graphic)val).rectTransform, Vector2.zero, Vector2.one); return; } for (int i = 0; i < readOnlyList.Count; i++) { IMobAction mobAction = readOnlyList[i]; if (mobAction != null) { bool enabled = false; try { enabled = mobAction.Available; } catch { } string label = ""; try { label = mobAction.Label ?? ""; } catch { } IMobAction picked = mobAction; AddHqButton("Hq_" + (mobAction.Key ?? i.ToString()), label, enabled, delegate { InvokeHqAction(picked); }); } } UIFactory.FitContentHeight(_hqContent); } catch (Exception ex) { NDLog.Warn("[APP] BuildHeadquarter: " + ex.Message); } } private void AddHqButton(string key, string label, bool enabled, Action onClick) { //IL_0015: 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_0030: 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) try { ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel(key, label, (Transform)(object)_hqContent, enabled ? _accent : LockedBg, 0f, 40f, 14, enabled ? Color.white : LockedTxt); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; LayoutElement val = item.GetComponent(); if ((Object)(object)val == (Object)null) { val = item.AddComponent(); } val.minHeight = 40f; val.preferredHeight = 40f; val.flexibleWidth = 1f; if (enabled && onClick != null) { ButtonUtils.AddListener(item2, onClick); return; } try { ((Selectable)item2).interactable = false; } catch { } } catch (Exception ex) { NDLog.DebugWarn("[APP] HqButton " + key + ": " + ex.Message); } } private void InvokeHqAction(IMobAction action) { if (action == null) { return; } try { MobAppTab mobAppTab = MobAppTab.None; try { mobAppTab = action.NavigateTo; } catch { } if (mobAppTab != MobAppTab.None) { NavigateToTab(mobAppTab); return; } string message; bool ok = action.Invoke(out message); RefreshHome(); SetHomeStatus(message, ok); } catch (Exception ex) { NDLog.Warn("[APP] InvokeHqAction: " + ex.Message); SetHomeStatus("Couldn't reach the famiglia right now.", ok: false); } } private void SetHomeStatus(string msg, bool ok) { //IL_003b: 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) try { if (!((Object)(object)_homeStatus == (Object)null)) { _homeStatus.text = msg ?? ""; ((Graphic)_homeStatus).color = (ok ? _gold : ErrorTxt); } } catch { } } private void NavigateToTab(MobAppTab tab) { switch (tab) { case MobAppTab.RealEstate: SetActivePage(_realEstatePage); RefreshRealEstate(); break; case MobAppTab.Furnish: OpenFurnishFromRealEstate(); break; case MobAppTab.ListaNera: SetActivePage(_listaPage); break; case MobAppTab.Cassa: SetActivePage(_cassaPage); break; case MobAppTab.Faida: SetActivePage(_faidaPage); RefreshFaida(); break; default: SetActivePage(_homePage, refreshHome: true); break; } } private GameObject BuildRealEstatePage(Transform parent) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) GameObject val = MakePanel("RealEstatePage", parent, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); Text val2 = UIFactory.Text("RETitle", "REAL ESTATE", val.transform, 20, (TextAnchor)0, (FontStyle)1); ((Graphic)val2).color = _gold; Rect(((Graphic)val2).rectTransform, new Vector2(0.055f, 0.885f), new Vector2(0.315f, 0.975f)); ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel("REFurnishBtn", "FURNISH", val.transform, _gold, 0f, 28f, 13, MainBg); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; RectTransform component = item.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.055f, 0.877f); component.anchorMax = new Vector2(0.204f, 0.919f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } WireClick(item2, OpenFurnishFromRealEstate); _statusText = UIFactory.Text("REStatus", "", val.transform, 13, (TextAnchor)2, (FontStyle)2); ((Graphic)_statusText).color = _gold; Rect(((Graphic)_statusText).rectTransform, new Vector2(0.55f, 0.9f), new Vector2(0.92f, 0.99f)); GameObject val3 = MakePanel("REListHost", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.05f, -0.009f), (Vector2?)new Vector2(0.984f, 0.815f), fullAnchor: false); ScrollRect sr = default(ScrollRect); _reContent = UIFactory.ScrollableVerticalList("REList", val3.transform, ref sr); UIFactory.FitContentHeight(_reContent); HardenScrollClip(sr); return val; } internal void RefreshRealEstate() { //IL_0069: 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_0092: Unknown result type (might be due to invalid IL or missing references) try { MobFamily active = Active; if ((Object)(object)_reContent == (Object)null) { return; } UIFactory.ClearChildren(((Component)_reContent).transform); if (active == null) { return; } if (!active.RealEstateUnlocked) { Text val = UIFactory.Text("RELocked", active.RealEstateLockedText, (Transform)(object)_reContent, 15, (TextAnchor)0, (FontStyle)0); ((Graphic)val).color = LockedTxt; AddLayout(((Component)val).gameObject, 120f); Rect(((Graphic)val).rectTransform, Vector2.zero, Vector2.one); return; } IReadOnlyList properties = active.Properties; if (properties == null) { return; } for (int i = 0; i < properties.Count; i++) { if (properties[i] != null) { AddPropertyCard(properties[i]); } } } catch (Exception ex) { NDLog.Warn("[APP] RefreshRealEstate: " + ex.Message); } } private void AddPropertyCard(IMobProperty p) { //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) try { string text = p.Key ?? "prop"; GameObject val = MakePanel("Card_" + text, (Transform)(object)_reContent, CardBg); AddLayout(val, 100f); Sprite val2 = null; try { val2 = p.Image; } catch { } if ((Object)(object)val2 != (Object)null) { GameObject val3 = new GameObject(text + "_Img"); val3.transform.SetParent(val.transform, false); Image val4 = val3.AddComponent(); val4.sprite = val2; val4.preserveAspect = true; ((Graphic)val4).raycastTarget = false; RectTransform component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { Rect(component, new Vector2(0.04f, 0.14f), new Vector2(0.22f, 0.86f)); } } bool flag = false; try { flag = p.Owned; } catch { } string text2 = ""; try { text2 = p.Name ?? ""; } catch { } string text3 = ""; try { text3 = p.Description ?? ""; } catch { } string text4 = ""; try { text4 = p.StatusText ?? ""; } catch { } Text val5 = UIFactory.Text(text + "_Name", text2, val.transform, 15, (TextAnchor)0, (FontStyle)1); ((Graphic)val5).color = Color.white; val5.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val5).rectTransform, new Vector2(0.24f, 0.55f), new Vector2(0.69f, 0.93f)); Text val6 = UIFactory.Text(text + "_Desc", text3, val.transform, 12, (TextAnchor)0, (FontStyle)0); ((Graphic)val6).color = new Color(0.75f, 0.78f, 0.85f); val6.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val6).rectTransform, new Vector2(0.24f, 0.08f), new Vector2(0.69f, 0.5f)); Text val7 = UIFactory.Text(text + "_Status", text4, val.transform, 15, (TextAnchor)4, (FontStyle)1); ((Graphic)val7).color = (flag ? _gold : Color.white); Rect(((Graphic)val7).rectTransform, new Vector2(0.71f, 0.55f), new Vector2(0.95f, 0.93f)); if (flag) { AddCardButton(val, text + "_Sell", "SELL", SellBtn, delegate { string message; bool ok = p.Sell(out message); SetStatus(message, ok); RefreshRealEstate(); }); } else { AddCardButton(val, text + "_Buy", "BUY", _accent, delegate { string message; bool ok = p.Buy(out message); SetStatus(message, ok); RefreshRealEstate(); }); } } catch (Exception ex) { NDLog.DebugWarn("[APP] Card " + p?.Key + ": " + ex.Message); } } private void AddCardButton(GameObject card, string name, string label, Color color, Action onClick) { //IL_0009: 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_0055: 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) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel(name, label, card.transform, color, 0f, 30f, 14, Color.white); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; RectTransform component = item.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.71f, 0.12f); component.anchorMax = new Vector2(0.95f, 0.46f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } if (onClick != null) { ButtonUtils.AddListener(item2, onClick); } } private GameObject BuildLockedPage(Transform parent, string name, string title, string body) { //IL_0017: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) GameObject val = MakePanel(name, parent, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); Text val2 = UIFactory.Text(name + "_Title", title, val.transform, 20, (TextAnchor)1, (FontStyle)1); ((Graphic)val2).color = LockedTxt; Rect(((Graphic)val2).rectTransform, new Vector2(0.05f, 0.85f), new Vector2(0.95f, 0.97f)); Text val3 = UIFactory.Text(name + "_Body", body, val.transform, 14, (TextAnchor)1, (FontStyle)0); ((Graphic)val3).color = LockedTxt; Rect(((Graphic)val3).rectTransform, new Vector2(0.05f, 0.2f), new Vector2(0.95f, 0.82f)); return val; } private GameObject BuildShopPage(Transform parent) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_00b2: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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) GameObject val = MakePanel("ShopPage", parent, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); Text val2 = UIFactory.Text("ShopTitle", "LITTLE HELPER", val.transform, 20, (TextAnchor)0, (FontStyle)1); ((Graphic)val2).color = _gold; Rect(((Graphic)val2).rectTransform, new Vector2(0.04f, 0.895f), new Vector2(0.545f, 0.961f)); _shopStatus = UIFactory.Text("ShopStatus", "", val.transform, 13, (TextAnchor)2, (FontStyle)2); ((Graphic)_shopStatus).color = _gold; Rect(((Graphic)_shopStatus).rectTransform, new Vector2(0.56f, 0.9f), new Vector2(0.97f, 0.99f)); GameObject val3 = MakePanel("ShopListHost", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.021f, 0.005f), (Vector2?)new Vector2(0.983f, 0.865f), fullAnchor: false); ScrollRect sr = default(ScrollRect); _shopList = UIFactory.ScrollableVerticalList("ShopList", val3.transform, ref sr); UIFactory.FitContentHeight(_shopList); HardenScrollClip(sr); return val; } private void RefreshShop() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_shopList == (Object)null) { return; } UIFactory.ClearChildren(((Component)_shopList).transform); IReadOnlyList readOnlyList = Active?.ShopItems; if (readOnlyList == null || readOnlyList.Count == 0) { Text val = UIFactory.Text("ShopNone", "Nothing in stock right now.", (Transform)(object)_shopList, 14, (TextAnchor)0, (FontStyle)0); ((Graphic)val).color = LockedTxt; AddLayout(((Component)val).gameObject, 60f); Rect(((Graphic)val).rectTransform, Vector2.zero, Vector2.one); UIFactory.FitContentHeight(_shopList); return; } for (int i = 0; i < readOnlyList.Count; i++) { MobShopItem mobShopItem = readOnlyList[i]; if (mobShopItem != null) { MobShopItem picked = mobShopItem; AddShopCard(picked.Key ?? i.ToString(), picked.Name ?? "", picked.Description ?? "", picked.Price, () => picked.Buy != null && picked.Buy(), picked.IconFunc); } } UIFactory.FitContentHeight(_shopList); } catch (Exception ex) { NDLog.Warn("[APP] RefreshShop: " + ex.Message); } } private void AddShopCard(string key, string name, string desc, int price, Func give, Func icon) { //IL_0020: 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_014b: 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_0193: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: 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) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = MakePanel("Shop_" + key, (Transform)(object)_shopList, CardBg); AddLayout(val, 96f); Sprite val2 = null; try { val2 = icon?.Invoke(); } catch { } float num = 0.09f; if ((Object)(object)val2 != (Object)null) { GameObject val3 = new GameObject(key + "_Icon"); val3.transform.SetParent(val.transform, false); Image val4 = val3.AddComponent(); val4.sprite = val2; val4.preserveAspect = true; ((Graphic)val4).raycastTarget = false; RectTransform component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { Rect(component, new Vector2(0.035f, 0.12f), new Vector2(0.235f, 0.88f)); } num = 0.27f; } Text val5 = UIFactory.Text(key + "_Name", name, val.transform, 15, (TextAnchor)0, (FontStyle)1); ((Graphic)val5).color = Color.white; val5.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val5).rectTransform, new Vector2(num, 0.55f), new Vector2(0.64f, 0.92f)); Text val6 = UIFactory.Text(key + "_Desc", desc, val.transform, 12, (TextAnchor)0, (FontStyle)0); ((Graphic)val6).color = new Color(0.75f, 0.78f, 0.85f); val6.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val6).rectTransform, new Vector2(num, 0.08f), new Vector2(0.64f, 0.52f)); Text val7 = UIFactory.Text(key + "_Price", $"${price:N0}", val.transform, 16, (TextAnchor)4, (FontStyle)1); ((Graphic)val7).color = _gold; Rect(((Graphic)val7).rectTransform, new Vector2(0.66f, 0.55f), new Vector2(0.95f, 0.92f)); ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel(key + "_Buy", "BUY", val.transform, _accent, 0f, 30f, 14, Color.white); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; RectTransform component2 = item.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.anchorMin = new Vector2(0.66f, 0.12f); component2.anchorMax = new Vector2(0.95f, 0.48f); component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; } int p = price; Func g = give; string n = name; WireClick(item2, delegate { OnShopBuy(p, g, n); }); } catch (Exception ex) { NDLog.DebugWarn("[APP] ShopCard " + key + ": " + ex.Message); } } private GameObject BuildOperationsPage(Transform parent) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) GameObject val = MakePanel("OperationsPage", parent, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); string text = ((Active != null) ? (Active.OperationsTitle ?? "OPERATIONS") : "OPERATIONS"); Text val2 = UIFactory.Text("OpTitle", text, val.transform, 20, (TextAnchor)0, (FontStyle)1); ((Graphic)val2).color = _gold; Rect(((Graphic)val2).rectTransform, new Vector2(0.04f, 0.895f), new Vector2(0.545f, 0.961f)); _operationsStatus = UIFactory.Text("OpStatus", "", val.transform, 13, (TextAnchor)2, (FontStyle)2); ((Graphic)_operationsStatus).color = _gold; Rect(((Graphic)_operationsStatus).rectTransform, new Vector2(0.56f, 0.9f), new Vector2(0.97f, 0.99f)); GameObject val3 = MakePanel("OpListHost", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.021f, 0.005f), (Vector2?)new Vector2(0.983f, 0.865f), fullAnchor: false); ScrollRect sr = default(ScrollRect); _operationsList = UIFactory.ScrollableVerticalList("OpList", val3.transform, ref sr); UIFactory.FitContentHeight(_operationsList); HardenScrollClip(sr); return val; } private void RefreshOperations() { //IL_0067: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) try { StopGifs(); if ((Object)(object)_operationsList == (Object)null) { return; } UIFactory.ClearChildren(((Component)_operationsList).transform); MobFamily active = Active; if (active != null && !active.OperationsUnlocked) { Text val = UIFactory.Text("OpLocked", active.OperationsLockedText, (Transform)(object)_operationsList, 14, (TextAnchor)0, (FontStyle)0); ((Graphic)val).color = LockedTxt; AddLayout(((Component)val).gameObject, 60f); Rect(((Graphic)val).rectTransform, Vector2.zero, Vector2.one); UIFactory.FitContentHeight(_operationsList); return; } IReadOnlyList readOnlyList = active?.Operations; if (readOnlyList == null || readOnlyList.Count == 0) { Text val2 = UIFactory.Text("OpNone", (active != null) ? active.OperationsEmptyText : "No operations right now.", (Transform)(object)_operationsList, 14, (TextAnchor)0, (FontStyle)0); ((Graphic)val2).color = LockedTxt; AddLayout(((Component)val2).gameObject, 60f); Rect(((Graphic)val2).rectTransform, Vector2.zero, Vector2.one); UIFactory.FitContentHeight(_operationsList); return; } for (int i = 0; i < readOnlyList.Count; i++) { MobOperation mobOperation = readOnlyList[i]; if (mobOperation != null) { AddOperationCard(mobOperation); } } UIFactory.FitContentHeight(_operationsList); } catch (Exception ex) { NDLog.Warn("[APP] RefreshOperations: " + ex.Message); } } private void AddOperationCard(MobOperation op) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_0198: 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_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: 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_02bf: Unknown result type (might be due to invalid IL or missing references) try { string text = op.Key ?? "op"; GameObject val = MakePanel("Op_" + text, (Transform)(object)_operationsList, CardBg); AddLayout(val, 100f); if (op.IconFrames != null && op.IconFrames.Length != 0) { GameObject val2 = new GameObject(text + "_Gif"); val2.transform.SetParent(val.transform, false); Image val3 = val2.AddComponent(); val3.preserveAspect = true; ((Graphic)val3).raycastTarget = false; val3.sprite = op.IconFrames[0]; RectTransform component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { Rect(component, new Vector2(0.035f, 0.12f), new Vector2(0.235f, 0.88f)); } PlayGif(val3, op.IconFrames, op.IconDelays); } bool flag = false; try { flag = op.Available; } catch { } string text2 = op.QuestName ?? ""; string text3 = op.Description ?? ""; Text val4 = UIFactory.Text(text + "_Name", text2, val.transform, 15, (TextAnchor)0, (FontStyle)1); ((Graphic)val4).color = Color.white; val4.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val4).rectTransform, new Vector2(0.27f, 0.58f), new Vector2(0.64f, 0.92f)); Text val5 = UIFactory.Text(text + "_Desc", text3, val.transform, 12, (TextAnchor)0, (FontStyle)0); ((Graphic)val5).color = new Color(0.75f, 0.78f, 0.85f); val5.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val5).rectTransform, new Vector2(0.27f, 0.08f), new Vector2(0.64f, 0.55f)); ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel(text + "_Go", text2, val.transform, flag ? _accent : LockedBg, 0f, 34f, 13, flag ? Color.white : LockedTxt); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; RectTransform component2 = item.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.anchorMin = new Vector2(0.66f, 0.3f); component2.anchorMax = new Vector2(0.96f, 0.7f); component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; } if (flag) { MobOperation picked = op; WireClick(item2, delegate { OnOperationTrigger(picked); }); return; } try { ((Selectable)item2).interactable = false; } catch { } } catch (Exception ex) { NDLog.DebugWarn("[APP] OperationCard " + op?.Key + ": " + ex.Message); } } private void OnOperationTrigger(MobOperation op) { //IL_00c4: 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_0049: Unknown result type (might be due to invalid IL or missing references) if (op == null) { return; } try { string message; bool flag = op.Invoke(out message); if ((Object)(object)_operationsStatus != (Object)null) { _operationsStatus.text = message ?? ""; ((Graphic)_operationsStatus).color = (flag ? _gold : ErrorTxt); } if (flag && !op.LeadsToChat) { MelonCoroutines.Start(ClosePhoneNextFrame()); } } catch (Exception ex) { NDLog.Warn("[APP] OnOperationTrigger: " + ex.Message); if ((Object)(object)_operationsStatus != (Object)null) { _operationsStatus.text = "Couldn't reach the famiglia right now."; ((Graphic)_operationsStatus).color = ErrorTxt; } } } private static IEnumerator ClosePhoneNextFrame() { yield return null; try { GameplayMenu instance = Singleton.Instance; if (instance != null) { instance.Close(); } } catch { } } private void PlayGif(Image img, Sprite[] frames, float[] delays) { if ((Object)(object)img == (Object)null || frames == null || frames.Length == 0) { return; } if (frames.Length == 1) { img.sprite = frames[0]; return; } try { object obj = MelonCoroutines.Start(AnimateGif(img, frames, delays)); if (obj != null) { _gifCoroutines.Add(obj); } } catch (Exception ex) { NDLog.DebugWarn("[APP] PlayGif: " + ex.Message); } } private static IEnumerator AnimateGif(Image img, Sprite[] frames, float[] delays) { int i = 0; while (!((Object)(object)img == (Object)null)) { try { img.sprite = frames[i]; } catch { break; } float d = ((delays != null && i < delays.Length && delays[i] > 0f) ? delays[i] : 0.1f); i = (i + 1) % frames.Length; yield return (object)new WaitForSeconds(d); } } private void StopGifs() { try { for (int i = 0; i < _gifCoroutines.Count; i++) { try { MelonCoroutines.Stop(_gifCoroutines[i]); } catch { } } } catch { } _gifCoroutines.Clear(); } private GameObject BuildFaidaPage(Transform parent) { //IL_001b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_014b: 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_0184: 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_01a7: Unknown result type (might be due to invalid IL or missing references) GameObject val = MakePanel("FaidaPage", parent, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); _faidaTitleText = UIFactory.Text("FaidaTitle", "FAIDA", val.transform, 20, (TextAnchor)0, (FontStyle)1); ((Graphic)_faidaTitleText).color = _gold; Rect(((Graphic)_faidaTitleText).rectTransform, new Vector2(0.04f, 0.895f), new Vector2(0.545f, 0.961f)); _faidaIntro = UIFactory.Text("FaidaIntro", "", val.transform, 13, (TextAnchor)0, (FontStyle)0); ((Graphic)_faidaIntro).color = Color.white; _faidaIntro.horizontalOverflow = (HorizontalWrapMode)0; _faidaIntro.verticalOverflow = (VerticalWrapMode)1; Rect(((Graphic)_faidaIntro).rectTransform, new Vector2(0.042f, 0.76f), new Vector2(0.965f, 0.88f)); Text val2 = UIFactory.Text("FaidaRivalLabel", "RIVAL POINTS", val.transform, 13, (TextAnchor)6, (FontStyle)1); ((Graphic)val2).color = _gold; Rect(((Graphic)val2).rectTransform, new Vector2(0.042f, 0.7f), new Vector2(0.545f, 0.758f)); GameObject val3 = MakePanel("FaidaListHost", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.021f, 0.005f), (Vector2?)new Vector2(0.983f, 0.69f), fullAnchor: false); ScrollRect sr = default(ScrollRect); _faidaList = UIFactory.ScrollableVerticalList("FaidaList", val3.transform, ref sr); UIFactory.FitContentHeight(_faidaList); HardenScrollClip(sr); return val; } private void RefreshFaida() { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) try { MobFamily active = Active; string text = ((active != null) ? (active.FaidaTitle ?? "FAIDA") : "FAIDA"); if ((Object)(object)_faidaTitleText != (Object)null) { _faidaTitleText.text = text; } if ((Object)(object)_faidaNavText != (Object)null) { _faidaNavText.text = text; } if ((Object)(object)_faidaIntro != (Object)null) { _faidaIntro.text = ((active != null) ? (active.FaidaIntro ?? "") : ""); } if ((Object)(object)_faidaList == (Object)null) { return; } UIFactory.ClearChildren(((Component)_faidaList).transform); if (active != null && !active.FaidaUnlocked) { Text val = UIFactory.Text("FaidaLocked", active.FaidaLockedText ?? "Locked.", (Transform)(object)_faidaList, 14, (TextAnchor)0, (FontStyle)0); ((Graphic)val).color = LockedTxt; val.horizontalOverflow = (HorizontalWrapMode)0; val.verticalOverflow = (VerticalWrapMode)1; AddLayout(((Component)val).gameObject, 90f); Rect(((Graphic)val).rectTransform, Vector2.zero, Vector2.one); UIFactory.FitContentHeight(_faidaList); return; } try { MobOperation mobOperation = active?.FaidaAction; if (mobOperation != null) { AddFaidaActionCard(mobOperation); } } catch { } IReadOnlyList readOnlyList = active?.FaidaTargets; if (readOnlyList == null || readOnlyList.Count == 0) { Text val2 = UIFactory.Text("FaidaNone", (active != null) ? (active.FaidaEmptyText ?? "No rivals yet.") : "", (Transform)(object)_faidaList, 14, (TextAnchor)0, (FontStyle)0); ((Graphic)val2).color = LockedTxt; val2.horizontalOverflow = (HorizontalWrapMode)0; val2.verticalOverflow = (VerticalWrapMode)1; AddLayout(((Component)val2).gameObject, 70f); Rect(((Graphic)val2).rectTransform, Vector2.zero, Vector2.one); UIFactory.FitContentHeight(_faidaList); return; } for (int i = 0; i < readOnlyList.Count; i++) { MobFaidaTarget mobFaidaTarget = readOnlyList[i]; if (mobFaidaTarget != null) { AddFaidaRow(mobFaidaTarget.Name ?? $"Rival {i}", mobFaidaTarget.Points, mobFaidaTarget.Detail ?? ""); } } UIFactory.FitContentHeight(_faidaList); } catch (Exception ex) { NDLog.Warn("[APP] RefreshFaida: " + ex.Message); } } private void AddFaidaRow(string name, int points, string detail) { //IL_0027: 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_0093: 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_00d9: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0167: Unknown result type (might be due to invalid IL or missing references) try { string text = (name ?? "").Replace(' ', '_'); GameObject val = MakePanel("Faida_" + text, (Transform)(object)_faidaList, CardBg); AddLayout(val, 64f); Text val2 = UIFactory.Text(text + "_Name", name, val.transform, 16, (TextAnchor)3, (FontStyle)1); ((Graphic)val2).color = Color.white; val2.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val2).rectTransform, new Vector2(0.09f, 0.46f), new Vector2(0.7f, 0.94f)); Text val3 = UIFactory.Text(text + "_Detail", detail, val.transform, 12, (TextAnchor)0, (FontStyle)0); ((Graphic)val3).color = new Color(0.75f, 0.78f, 0.85f); val3.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val3).rectTransform, new Vector2(0.09f, 0.08f), new Vector2(0.7f, 0.44f)); Text val4 = UIFactory.Text(text + "_Pts", points.ToString(), val.transform, 22, (TextAnchor)5, (FontStyle)1); ((Graphic)val4).color = _gold; Rect(((Graphic)val4).rectTransform, new Vector2(0.72f, 0.2f), new Vector2(0.95f, 0.8f)); } catch (Exception ex) { NDLog.DebugWarn("[APP] FaidaRow " + name + ": " + ex.Message); } } private void AddFaidaActionCard(MobOperation op) { //IL_0044: 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_00bf: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) try { if (op == null) { return; } bool flag = false; try { flag = op.Available; } catch { } string text = op.Key ?? "faidaaction"; GameObject val = MakePanel("FaidaAct_" + text, (Transform)(object)_faidaList, CardBg); AddLayout(val, 96f); Text val2 = UIFactory.Text(text + "_Name", op.QuestName ?? "DECLARE WAR", val.transform, 16, (TextAnchor)0, (FontStyle)1); ((Graphic)val2).color = _gold; val2.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val2).rectTransform, new Vector2(0.06f, 0.62f), new Vector2(0.7f, 0.93f)); Text val3 = UIFactory.Text(text + "_Desc", op.Description ?? "", val.transform, 12, (TextAnchor)0, (FontStyle)0); ((Graphic)val3).color = new Color(0.8f, 0.82f, 0.88f); val3.horizontalOverflow = (HorizontalWrapMode)0; val3.verticalOverflow = (VerticalWrapMode)0; Rect(((Graphic)val3).rectTransform, new Vector2(0.06f, 0.07f), new Vector2(0.7f, 0.58f)); ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel(text + "_Go", op.QuestName ?? "WAR", val.transform, flag ? _accent : LockedBg, 0f, 34f, 13, flag ? Color.white : LockedTxt); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; RectTransform component = item.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.72f, 0.3f); component.anchorMax = new Vector2(0.96f, 0.7f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } if (flag) { MobOperation picked = op; WireClick(item2, delegate { OnOperationTrigger(picked); }); return; } try { ((Selectable)item2).interactable = false; } catch { } } catch (Exception ex) { NDLog.DebugWarn("[APP] FaidaActionCard: " + ex.Message); } } private void OnShopBuy(int price, Func give, string name) { try { if (!MobEconomy.TryChargeLocal(price, "Little Helper: " + name, out var message)) { SetShopStatus(message, ok: false); return; } bool flag = false; try { flag = give?.Invoke() ?? false; } catch { flag = false; } if (!flag) { MobEconomy.RefundLocal(price, "Little Helper refund: " + name, out var _); SetShopStatus("Couldn't deliver — inventory full or item unavailable.", ok: false); } else { SetShopStatus("Delivered: " + name + ".", ok: true); } } catch (Exception ex) { NDLog.Warn("[APP] OnShopBuy: " + ex.Message); SetShopStatus("Shop error.", ok: false); } } private void SetShopStatus(string msg, bool ok) { //IL_003b: 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) try { if (!((Object)(object)_shopStatus == (Object)null)) { _shopStatus.text = msg ?? ""; ((Graphic)_shopStatus).color = (ok ? _gold : ErrorTxt); } } catch { } } private GameObject BuildFurnishPage(Transform parent) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00ca: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01ea: 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_0229: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0289: 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_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_030c: 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_033c: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: 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) GameObject val = MakePanel("FurnishPage", parent, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); _furnishChooser = MakePanel("FurnChooser", val.transform, new Color(0f, 0f, 0f, 0f), null, null, fullAnchor: true); Text val2 = UIFactory.Text("FurnChooseTitle", "FURNISH", _furnishChooser.transform, 20, (TextAnchor)0, (FontStyle)1); ((Graphic)val2).color = _gold; Rect(((Graphic)val2).rectTransform, new Vector2(0.05f, 0.898f), new Vector2(0.482f, 0.97f)); ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel("FurnChooseBack", "< REAL ESTATE", _furnishChooser.transform, _accent, 0f, 26f, 12, Color.white); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; RectTransform component = item.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0.85f, 0.92f); component.anchorMax = new Vector2(0.985f, 0.975f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } WireClick(item2, delegate { SetActivePage(_realEstatePage); RefreshRealEstate(); }); Text val3 = UIFactory.Text("FurnChooseSub", "Choose what to furnish.", _furnishChooser.transform, 14, (TextAnchor)0, (FontStyle)2); ((Graphic)val3).color = new Color(0.7f, 0.75f, 0.85f); Rect(((Graphic)val3).rectTransform, new Vector2(0.0531f, 0.5491f), new Vector2(0.4685f, 0.9247f)); _furnishChooseHost = MakePanel("FurnChooseList", _furnishChooser.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.024f, 0.6f), (Vector2?)new Vector2(0.381f, 0.715f), fullAnchor: false); UIFactory.VerticalLayoutOnGO(_furnishChooseHost, 12, new RectOffset(8, 8, 8, 8)); _furnishEditor = MakePanel("FurnEditor", val.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(-0.015f, -0.032f), (Vector2?)new Vector2(1.018f, 0.982f), fullAnchor: false); _furnishTitle = UIFactory.Text("FurnTitle", "FURNISH", _furnishEditor.transform, 18, (TextAnchor)0, (FontStyle)1); ((Graphic)_furnishTitle).color = _gold; Rect(((Graphic)_furnishTitle).rectTransform, new Vector2(0.04f, 0.876f), new Vector2(0.678f, 0.975f)); ValueTuple valueTuple2 = UIFactory.RoundedButtonWithLabel("FurnBack", "< BACK", _furnishEditor.transform, _accent, 0f, 26f, 13, Color.white); GameObject item4 = valueTuple2.Item1; Button item5 = valueTuple2.Item2; Text item6 = valueTuple2.Item3; RectTransform component2 = item4.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.anchorMin = new Vector2(0.871f, 0.939f); component2.anchorMax = new Vector2(0.965f, 0.992f); component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; } WireClick(item5, ReturnFromFurnish); _furnishTabsHost = MakePanel("FurnTabs", _furnishEditor.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.04f, 0.76f), (Vector2?)new Vector2(0.52f, 0.86f), fullAnchor: false); UIFactory.HorizontalLayoutOnGO(_furnishTabsHost, 8, 0, 0, 0, 0, (TextAnchor)4); GameObject val4 = MakePanel("FurnListHost", _furnishEditor.transform, new Color(0f, 0f, 0f, 0f), (Vector2?)new Vector2(0.045f, 0.04f), (Vector2?)new Vector2(0.96f, 0.745f), fullAnchor: false); ScrollRect sr = default(ScrollRect); _furnishContent = UIFactory.ScrollableVerticalList("FurnList", val4.transform, ref sr); UIFactory.FitContentHeight(_furnishContent); HardenScrollClip(sr); _furnishEditor.SetActive(false); return val; } private void OpenFurnishFromRealEstate() { NDLog.Debug("[APP] FURNISH-Button geklickt -> Furnish-Seite."); GameObject activePage = GetActivePage(); _furnishReturnPage = (((Object)(object)activePage != (Object)null && (Object)(object)activePage != (Object)(object)_furnishPage) ? activePage : _realEstatePage); SetActivePage(_furnishPage); ShowFurnishChooser(); } private GameObject GetActivePage() { if (_pages == null) { return null; } for (int i = 0; i < _pages.Length; i++) { if ((Object)(object)_pages[i] != (Object)null && _pages[i].activeSelf) { return _pages[i]; } } return null; } private void ReturnFromFurnish() { GameObject val = _furnishReturnPage; if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)_furnishPage) { val = _realEstatePage; } if ((Object)(object)val == (Object)(object)_realEstatePage) { SetActivePage(_realEstatePage); RefreshRealEstate(); } else if ((Object)(object)val == (Object)(object)_homePage) { SetActivePage(_homePage, refreshHome: true); } else { SetActivePage(val); } } private void ShowFurnishChooser() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_furnishEditor != (Object)null) { _furnishEditor.SetActive(false); } if ((Object)(object)_furnishChooser != (Object)null) { _furnishChooser.SetActive(true); } if ((Object)(object)_furnishChooseHost == (Object)null) { return; } UIFactory.ClearChildren(_furnishChooseHost.transform); MobFamily active = Active; IReadOnlyList readOnlyList = active?.FurnishTargets; bool flag = false; if (readOnlyList != null) { for (int i = 0; i < readOnlyList.Count; i++) { IMobFurnishTarget mobFurnishTarget = readOnlyList[i]; if (mobFurnishTarget != null) { bool flag2 = false; try { flag2 = mobFurnishTarget.Available; } catch { } if (flag2) { flag = true; break; } } } } if (!flag) { Text val = UIFactory.Text("FurnNone", (active != null) ? active.FurnishEmptyText : "Nothing to furnish.", _furnishChooseHost.transform, 14, (TextAnchor)0, (FontStyle)0); ((Graphic)val).color = LockedTxt; AddLayout(((Component)val).gameObject, 60f); Rect(((Graphic)val).rectTransform, Vector2.zero, Vector2.one); return; } for (int j = 0; j < readOnlyList.Count; j++) { IMobFurnishTarget mobFurnishTarget2 = readOnlyList[j]; if (mobFurnishTarget2 != null) { bool enabled = false; try { enabled = mobFurnishTarget2.Available; } catch { } IMobFurnishTarget picked = mobFurnishTarget2; AddChooserButton($"FurnCh_{j}", mobFurnishTarget2.Name, enabled, delegate { OpenFurnish(picked); }); } } } catch (Exception ex) { NDLog.DebugWarn("[APP] ShowFurnishChooser: " + ex.Message); } } private void AddChooserButton(string key, string label, bool enabled, Action onClick) { //IL_001a: 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_0035: 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) try { ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel(key, label, _furnishChooseHost.transform, enabled ? _accent : LockedBg, 0f, 50f, 16, enabled ? Color.white : LockedTxt); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; LayoutElement val = item.GetComponent(); if ((Object)(object)val == (Object)null) { val = item.AddComponent(); } val.minHeight = 50f; val.preferredHeight = 50f; val.flexibleWidth = 1f; if (enabled && onClick != null) { ButtonUtils.AddListener(item2, onClick); return; } try { ((Selectable)item2).interactable = false; } catch { } } catch (Exception ex) { NDLog.DebugWarn("[APP] ChooserButton " + key + ": " + ex.Message); } } private void OpenFurnish(IMobFurnishTarget target) { bool flag = false; try { flag = target?.Available ?? false; } catch { } if (!flag) { ShowFurnishChooser(); return; } _furnishTarget = target; _furnishSurface = 0; if ((Object)(object)_furnishChooser != (Object)null) { _furnishChooser.SetActive(false); } if ((Object)(object)_furnishEditor != (Object)null) { _furnishEditor.SetActive(true); } RefreshFurnish(); } private void RefreshFurnish() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_furnishContent == (Object)null || (Object)(object)_furnishTabsHost == (Object)null) { return; } IMobFurnishTarget t = _furnishTarget; bool flag = false; try { flag = t != null && t.Available; } catch { } if (!flag) { ShowFurnishChooser(); return; } if ((Object)(object)_furnishTitle != (Object)null) { _furnishTitle.text = "FURNISH — " + t.Name; } UIFactory.ClearChildren(_furnishTabsHost.transform); string[] array = new string[3] { "Floor", "Wall", "Ceiling" }; for (int i = 0; i < array.Length; i++) { int sel = i; bool flag2 = _furnishSurface == i; AddChip(_furnishTabsHost, $"Tab_{i}", array[i], flag2 ? _gold : _accent, flag2 ? MainBg : Color.white, 30f, delegate { _furnishSurface = sel; RefreshFurnish(); }); } UIFactory.ClearChildren(((Component)_furnishContent).transform); int curMat = t.GetMat(_furnishSurface); int curCol = t.GetCol(_furnishSurface); AddSectionLabel(_furnishContent, "MATERIAL"); BuildChipGrid(_furnishContent, "mat", FurnishCatalog.Materials.Length, 3, delegate(int num) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) bool flag3 = num == curMat; return ((string label, Color bg, Color txt, Action onClick))(label: FurnishCatalog.Materials[num].Name, bg: flag3 ? _gold : CardBg, txt: flag3 ? MainBg : Color.white, onClick: delegate { t.SetMat(_furnishSurface, num); RefreshFurnish(); }); }); AddSectionLabel(_furnishContent, "COLOR"); BuildChipGrid(_furnishContent, "col", FurnishCatalog.Colors.Length, 3, delegate(int num) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) bool flag3 = num == curCol; return ((string label, Color bg, Color txt, Action onClick))(label: FurnishCatalog.Colors[num].Name, bg: flag3 ? _gold : CardBg, txt: flag3 ? MainBg : Color.white, onClick: delegate { t.SetCol(_furnishSurface, num); RefreshFurnish(); }); }); UIFactory.FitContentHeight(_furnishContent); } catch (Exception ex) { NDLog.Warn("[APP] RefreshFurnish: " + ex.Message); } } private GameObject AddFurnishRow(Transform content, float height) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameObject val = MakePanel("FurnRow", content, new Color(0f, 0f, 0f, 0f)); AddLayout(val, height); UIFactory.HorizontalLayoutOnGO(val, 6, 0, 0, 0, 0, (TextAnchor)4); return val; } private void AddChip(GameObject row, string key, string label, Color bg, Color txt, float height, Action onClick) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) try { ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel(key, label, row.transform, bg, 0f, height, 12, txt); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; LayoutElement val = item.GetComponent(); if ((Object)(object)val == (Object)null) { val = item.AddComponent(); } val.minHeight = height; val.preferredHeight = height; val.flexibleWidth = 1f; if (onClick != null) { ButtonUtils.AddListener(item2, onClick); } } catch (Exception ex) { NDLog.DebugWarn("[APP] Chip " + key + ": " + ex.Message); } } private void AddSectionLabel(RectTransform content, string text) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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) GameObject val = MakePanel("SecHost_" + text, (Transform)(object)content, new Color(0f, 0f, 0f, 0f)); AddLayout(val, 24f); Text val2 = UIFactory.Text("Sec_" + text, text, val.transform, 13, (TextAnchor)4, (FontStyle)1); ((Graphic)val2).color = _gold; Rect(((Graphic)val2).rectTransform, Vector2.zero, Vector2.one); } private void BuildChipGrid(RectTransform content, string keyPrefix, int count, int perRow, Func def) { //IL_0069: 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) GameObject row = null; for (int i = 0; i < count; i++) { if (i % perRow == 0) { row = AddFurnishRow(((Component)content).transform, 34f); } (string, Color, Color, Action) tuple = def(i); AddChip(row, $"{keyPrefix}_{i}", tuple.Item1, tuple.Item2, tuple.Item3, 30f, tuple.Item4); } } private Text AddNavButton(Transform nav, string label, bool locked, Action onClick, string iconResource = null, float height = 42f) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) try { ValueTuple valueTuple = UIFactory.RoundedButtonWithLabel("Nav_" + label, locked ? (label + " (Soon)") : label, nav, locked ? LockedBg : _accent, 0f, height, 14, locked ? LockedTxt : Color.white); GameObject item = valueTuple.Item1; Button item2 = valueTuple.Item2; Text item3 = valueTuple.Item3; LayoutElement val = item.GetComponent(); if ((Object)(object)val == (Object)null) { val = item.AddComponent(); } val.minHeight = height; val.preferredHeight = height; val.flexibleWidth = 1f; if (!string.IsNullOrEmpty(iconResource)) { Sprite val2 = null; try { val2 = AssetLoader.LoadSprite(iconResource); } catch { } if ((Object)(object)val2 != (Object)null) { try { if ((Object)(object)item3 != (Object)null) { item3.text = ""; } } catch { } GameObject val3 = new GameObject("Nav_" + label + "_Icon"); val3.transform.SetParent(item.transform, false); Image val4 = val3.AddComponent(); val4.sprite = val2; val4.preserveAspect = true; ((Graphic)val4).raycastTarget = false; RectTransform component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 1f); component.offsetMin = new Vector2(5f, 4f); component.offsetMax = new Vector2(-5f, -4f); } } else { NDLog.DebugWarn($"[APP] NavButton {label}: Icon '{iconResource}' nicht ladbar."); } } if (!locked) { ButtonUtils.AddListener(item2, (Action)delegate { NDLog.Debug("[APP] nav '" + label + "' geklickt"); if (onClick != null) { onClick(); } }); } else { try { ((Selectable)item2).interactable = false; } catch { } } return item3; } catch (Exception ex) { NDLog.DebugWarn("[APP] NavButton " + label + ": " + ex.Message); return null; } } private void SetActivePage(GameObject page, bool refreshHome = false) { try { if (_pages == null) { return; } for (int i = 0; i < _pages.Length; i++) { GameObject val = _pages[i]; if ((Object)(object)val != (Object)null) { val.SetActive((Object)(object)val == (Object)(object)page); } } if (refreshHome) { RefreshHome(); } } catch { } } private void SetStatus(string msg, bool ok) { //IL_003b: 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) try { if (!((Object)(object)_statusText == (Object)null)) { _statusText.text = msg ?? ""; ((Graphic)_statusText).color = (ok ? _gold : ErrorTxt); } } catch { } } private static void WireClick(Button btn, Action cb) { if (!((Object)(object)btn == (Object)null) && cb != null) { ButtonUtils.AddListener(btn, (Action)delegate { cb(); }); } } private static void HardenScrollClip(ScrollRect sr) { try { if (!((Object)(object)sr == (Object)null) && !((Object)(object)sr.viewport == (Object)null)) { GameObject gameObject = ((Component)sr.viewport).gameObject; if ((Object)(object)gameObject.GetComponent() == (Object)null) { gameObject.AddComponent(); } } } catch (Exception ex) { NDLog.DebugWarn("[APP] HardenScrollClip: " + ex.Message); } } private static GameObject MakePanel(string name, Transform parent, Color color, Vector2? min = null, Vector2? max = null, bool fullAnchor = false) { //IL_0003: 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_0054: Unknown result type (might be due to invalid IL or missing references) GameObject val = UIFactory.Panel(name, parent, color, min, max, fullAnchor); if (!fullAnchor && (min.HasValue || max.HasValue) && (Object)(object)val != (Object)null) { RectTransform component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } } return val; } private static void Rect(RectTransform rt, Vector2 min, Vector2 max) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) try { rt.anchorMin = min; rt.anchorMax = max; rt.offsetMin = Vector2.zero; rt.offsetMax = Vector2.zero; } catch { } } private static void AddLayout(GameObject go, float height) { try { LayoutElement val = go.GetComponent(); if ((Object)(object)val == (Object)null) { val = go.AddComponent(); } val.minHeight = height; val.preferredHeight = height; val.flexibleWidth = 1f; } catch { } } private static void DisableContainerRaycasts(GameObject root) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)root == (Object)null) { return; } Il2CppArrayBase componentsInChildren = root.GetComponentsInChildren(true); if (componentsInChildren == null) { return; } for (int i = 0; i < componentsInChildren.Length; i++) { Image val = componentsInChildren[i]; if ((Object)(object)val != (Object)null && ((Graphic)val).color.a <= 0.02f) { ((Graphic)val).raycastTarget = false; } } } catch (Exception ex) { NDLog.DebugWarn("[APP] DisableContainerRaycasts: " + ex.Message); } } } } namespace Ndrangheta.Framework { public enum MobAppTab { None, Home, RealEstate, Furnish, ListaNera, Cassa, Faida } public interface IMobAction { string Key { get; } string Label { get; } bool Available { get; } MobAppTab NavigateTo { get; } bool Invoke(out string message); } public sealed class MobAction : IMobAction { private string _label = ""; public string Key { get; set; } public string Label { get { try { return (LabelFunc != null) ? (LabelFunc() ?? "") : _label; } catch { return _label; } } set { _label = value ?? ""; } } public Func LabelFunc { get; set; } public Func AvailableFunc { get; set; } public bool Available { get { try { return AvailableFunc == null || AvailableFunc(); } catch { return false; } } } public MobAppTab NavigateTo { get; set; } = MobAppTab.None; public MobTransaction InvokeFunc { get; set; } public bool Invoke(out string message) { message = ""; try { return InvokeFunc != null && InvokeFunc(out message); } catch { message = "Something went wrong."; return false; } } } public interface IMobFurnishTarget { string Name { get; } bool Available { get; } int GetMat(int surface); int GetCol(int surface); bool GetObj(int objIndex); void SetMat(int surface, int matIndex); void SetCol(int surface, int colIndex); void ToggleObj(int objIndex); } public interface IMobProperty { string Key { get; } string Name { get; } string Description { get; } Sprite Image { get; } bool Owned { get; } string StatusText { get; } bool Buy(out string message); bool Sell(out string message); } public delegate bool MobTransaction(out string message); public sealed class MobProperty : IMobProperty { private string _name = ""; private string _desc = ""; public string Key { get; set; } public string Name { get { try { return (NameFunc != null) ? (NameFunc() ?? "") : _name; } catch { return _name; } } set { _name = value ?? ""; } } public string Description { get { try { return (DescFunc != null) ? (DescFunc() ?? "") : _desc; } catch { return _desc; } } set { _desc = value ?? ""; } } public Func NameFunc { get; set; } public Func DescFunc { get; set; } public Func ImageFunc { get; set; } public Func OwnedFunc { get; set; } public Func StatusFunc { get; set; } public MobTransaction BuyFunc { get; set; } public MobTransaction SellFunc { get; set; } public Sprite Image { get { try { return (ImageFunc != null) ? ImageFunc() : null; } catch { return null; } } } public bool Owned { get { try { return OwnedFunc != null && OwnedFunc(); } catch { return false; } } } public string StatusText { get { try { if (StatusFunc != null) { return StatusFunc() ?? ""; } return Owned ? "OWNED" : ""; } catch { return ""; } } } public bool Buy(out string message) { message = ""; try { return BuyFunc != null && BuyFunc(out message); } catch { message = "Something went wrong."; return false; } } public bool Sell(out string message) { message = ""; try { return SellFunc != null && SellFunc(out message); } catch { message = "Something went wrong."; return false; } } } public static class MobEconomy { public static bool IsAuthority => SessionGate.IsAuthority; public static bool CanAfford(int amount) { return PayoutHelper.HasCashAtLeast(amount); } public static bool TryCharge(int amount, string label, out string message) { message = ""; if (!SessionGate.IsAuthority) { message = "In co-op only the host can buy or sell."; return false; } if (!PayoutHelper.DeductCash(amount, label ?? "purchase")) { message = $"You need ${amount:N0} cash for that."; return false; } return true; } public static bool TryChargeLocal(int amount, string label, out string message) { message = ""; if (!PayoutHelper.DeductCash(amount, label ?? "purchase")) { message = $"You need ${amount:N0} cash for that."; return false; } return true; } public static bool RefundLocal(int amount, string label, out string message) { message = ""; if (!PayoutHelper.AddCash(amount, label ?? "refund")) { message = "Couldn't process that right now — try again in a moment."; return false; } return true; } public static bool Refund(int amount, string label, out string message) { message = ""; if (!SessionGate.IsAuthority) { message = "In co-op only the host can buy or sell."; return false; } if (!PayoutHelper.AddCash(amount, label ?? "sale")) { message = "Couldn't process that right now — try again in a moment."; return false; } return true; } } public sealed class MobEstate : IMobProperty, IMobFurnishTarget { private readonly string _key; private readonly string _name; private readonly string _desc; private readonly int _price; private readonly int _refund; private readonly Vector3 _doorPos; private readonly Func _image; private readonly MobFurnishRoom _room; private bool _owned; public string Key => _key; public string Name => _name; public string Description => _desc; public Sprite Image { get { try { return (_image != null) ? _image() : null; } catch { return null; } } } public bool Owned => _owned; public string StatusText => _owned ? "OWNED" : $"${_price:N0}"; public bool Available => _owned; public MobEstate(string key, string name, string desc, int price, Vector3 doorWorldPos, Func image = null, int refund = -1, float roomHalf = 5.5f) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) _key = (string.IsNullOrEmpty(key) ? "estate" : key); _name = name ?? "Property"; _desc = desc ?? ""; _price = Mathf.Max(0, price); _refund = ((refund >= 0) ? refund : Mathf.RoundToInt((float)price * 0.8f)); _doorPos = doorWorldPos; _image = image; _room = new MobFurnishRoom(_key, doorWorldPos, () => _owned, null, -1, -1, roomHalf); } public bool Buy(out string message) { if (_owned) { message = "You already own that."; return false; } if (!MobEconomy.TryCharge(_price, _name + " (bought)", out message)) { return false; } _owned = true; message = _name + " is yours."; NDLog.Info($"[MOBESTATE] {_key} bought (${_price})."); return true; } public bool Sell(out string message) { if (!_owned) { message = "You don't own that."; return false; } if (!MobEconomy.Refund(_refund, _name + " (sold)", out message)) { return false; } _owned = false; _room.Teardown(); message = $"Sold {_name} for ${_refund:N0}."; NDLog.Info($"[MOBESTATE] {_key} sold (+${_refund})."); return true; } public int GetMat(int surface) { return _room.GetMat(surface); } public int GetCol(int surface) { return _room.GetCol(surface); } public bool GetObj(int objIndex) { return _room.GetObj(objIndex); } public void SetMat(int surface, int matIndex) { _room.SetMat(surface, matIndex); } public void SetCol(int surface, int colIndex) { _room.SetCol(surface, colIndex); } public void ToggleObj(int objIndex) { _room.ToggleObj(objIndex); } public void Tick() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) try { if (_owned) { _room.AddEntrance(0, _doorPos); } else { _room.Teardown(); } } catch (Exception ex) { NDLog.DebugWarn("[MOBESTATE] " + _key + " Tick: " + ex.Message); } } public void Teardown() { try { _room.Teardown(); } catch { } } public string Save() { return $"{(_owned ? 1 : 0)}:{_room.State.A}:{_room.State.B}"; } public void Load(string s) { try { if (!string.IsNullOrEmpty(s)) { string[] array = s.Split(':'); _owned = array.Length != 0 && array[0] == "1"; int result; int a = ((array.Length > 1 && int.TryParse(array[1], out result)) ? result : 0); int result2; int b = ((array.Length > 2 && int.TryParse(array[2], out result2)) ? result2 : 0); _room.State.Load(a, b); } } catch (Exception ex) { NDLog.DebugWarn($"[MOBESTATE] {_key} Load('{s}'): {ex.Message}"); } } } public abstract class MobFamily { private MobEstate[] _estates; private IReadOnlyList _propsView; private IReadOnlyList _furnishView; public abstract string Id { get; } public abstract string DisplayName { get; } public virtual bool Available => true; public virtual bool AppUnlocked => true; public virtual string AppLockedTitle => "ACCESS DENIED"; public virtual string AppLockedText => "You don't have access to this network yet."; public virtual string BrandTitle => "THE MOB"; public virtual string BrandSubtitle => ""; public virtual string Motto => ""; public virtual string HomeTitle => DisplayName; public virtual string MoralTitle => ""; public virtual string MoralLadder => null; public virtual Color Accent => new Color(0.1f, 0.22f, 0.4f); public virtual Color Highlight => new Color(0.83f, 0.69f, 0.22f); public virtual Sprite HomeImage => null; public virtual bool RealEstateUnlocked => true; public virtual string RealEstateLockedText => "Locked."; protected MobEstate[] EstatesCached { get { if (_estates == null) { _estates = BuildEstates() ?? new MobEstate[0]; } return _estates; } } public virtual IReadOnlyList Properties { get { if (_propsView == null) { MobEstate[] estatesCached = EstatesCached; List list = new List(estatesCached.Length); for (int i = 0; i < estatesCached.Length; i++) { list.Add(estatesCached[i]); } _propsView = list; } return _propsView; } } public virtual IReadOnlyList FurnishTargets { get { if (_furnishView == null) { MobEstate[] estatesCached = EstatesCached; List list = new List(estatesCached.Length); for (int i = 0; i < estatesCached.Length; i++) { list.Add(estatesCached[i]); } _furnishView = list; } return _furnishView; } } public virtual string FurnishEmptyText => "Buy a property first, then come back to furnish it."; public virtual string HeadquarterTitle => "HEADQUARTER"; public virtual bool HeadquarterUnlocked => true; public virtual string HeadquarterLockedText => "Locked."; public virtual IReadOnlyList HeadquarterActions => Array.Empty(); public virtual string FaidaTitle => "FAIDA"; public virtual bool FaidaUnlocked => true; public virtual string FaidaLockedText => "Locked."; public virtual string FaidaIntro => ""; public virtual string FaidaEmptyText => "No bad blood on the books yet."; public virtual IReadOnlyList FaidaTargets => Array.Empty(); public virtual MobOperation FaidaAction => null; public virtual IReadOnlyList ShopItems => Array.Empty(); public virtual string OperationsTitle => "OPERATIONS"; public virtual bool OperationsUnlocked => true; public virtual string OperationsLockedText => "Locked."; public virtual string OperationsEmptyText => "No operations available right now."; public virtual IReadOnlyList Operations => Array.Empty(); public virtual MobLockedPage ListaNera => new MobLockedPage("LISTA NERA", "Bounty board — coming soon."); public virtual MobLockedPage Cassa => new MobLockedPage("CASSA", "The family vault — coming soon."); public virtual string GetHomeText() { return ""; } protected virtual MobEstate[] BuildEstates() { return null; } public virtual void OnSelected() { } public virtual void Tick(float dt) { MobEstate[] estatesCached = EstatesCached; for (int i = 0; i < estatesCached.Length; i++) { try { estatesCached[i].Tick(); } catch { } } } public virtual void ResetForSceneReload() { MobEstate[] estatesCached = EstatesCached; for (int i = 0; i < estatesCached.Length; i++) { try { estatesCached[i].Teardown(); } catch { } } } public virtual string OnSaveString() { MobEstate[] estatesCached = EstatesCached; if (estatesCached.Length == 0) { return ""; } string[] array = new string[estatesCached.Length]; for (int i = 0; i < estatesCached.Length; i++) { try { array[i] = estatesCached[i].Save(); } catch { array[i] = ""; } } return string.Join("|", array); } public virtual void OnLoadString(string s) { if (string.IsNullOrEmpty(s)) { return; } MobEstate[] estatesCached = EstatesCached; string[] array = s.Split('|'); for (int i = 0; i < estatesCached.Length && i < array.Length; i++) { try { estatesCached[i].Load(array[i]); } catch { } } } } public struct MobLockedPage { public string Title; public string Body; public MobLockedPage(string title, string body) { Title = title; Body = body; } } public sealed class MobShopItem { public string Key; public string Name; public string Description; public int Price; public Func Buy; public Func IconFunc; public MobShopItem(string key, string name, string description, int price, Func buy) { Key = key; Name = name; Description = description; Price = price; Buy = buy; } } public sealed class MobOperation { public string Key; public string QuestName; public string Description; public Sprite[] IconFrames; public float[] IconDelays; public Func AvailableFunc; public MobTransaction InvokeFunc; public bool LeadsToChat; public bool Available { get { try { return AvailableFunc == null || AvailableFunc(); } catch { return false; } } } public bool Invoke(out string message) { message = ""; try { return InvokeFunc != null && InvokeFunc(out message); } catch { message = "Something went wrong."; return false; } } public MobOperation(string key, string questName, string description, Sprite[] iconFrames, float[] iconDelays, Func availableFunc, MobTransaction invokeFunc) { Key = key; QuestName = questName ?? ""; Description = description ?? ""; IconFrames = iconFrames; IconDelays = iconDelays; AvailableFunc = availableFunc; InvokeFunc = invokeFunc; } } public sealed class MobFaidaTarget { public string Name; public int Points; public string Detail; public MobFaidaTarget(string name, int points, string detail = "") { Name = name ?? ""; Points = points; Detail = detail ?? ""; } } public static class MobFamilyRegistry { private static readonly List _families = new List(); private static MobFamily _active; public static IReadOnlyList All => _families; public static MobFamily Active => _active; public static int AvailableCount { get { int num = 0; for (int i = 0; i < _families.Count; i++) { if (_families[i] != null && IsAvailable(_families[i])) { num++; } } return num; } } public static void Register(MobFamily family) { if (family == null) { return; } string text = family.Id ?? ""; for (int i = 0; i < _families.Count; i++) { if ((_families[i].Id ?? "") == text) { bool flag = false; bool flag2 = false; try { flag = _families[i].Available; } catch { } try { flag2 = family.Available; } catch { } if (flag && !flag2) { NDLog.Debug("[MOB] keep real family '" + text + "' (Platzhalter ignoriert)."); return; } _families[i] = family; NDLog.Info($"[MOB] family re-registered: {text} ({family.DisplayName}) available={family.Available}."); return; } } _families.Add(family); NDLog.Debug($"[MOB] family registered: {text} ({family.DisplayName}) available={family.Available} (total={_families.Count})."); } public static MobFamily Get(string id) { if (string.IsNullOrEmpty(id)) { return null; } for (int i = 0; i < _families.Count; i++) { if ((_families[i].Id ?? "") == id) { return _families[i]; } } return null; } public static void SetActive(MobFamily family) { _active = family; if (family != null) { try { family.OnSelected(); } catch (Exception ex) { NDLog.DebugWarn("[MOB] OnSelected(" + family.Id + "): " + ex.Message); } } } private static bool IsAvailable(MobFamily f) { try { return f.Available; } catch { return false; } } public static void EnsureDefaultActive() { if (_active != null) { return; } MobFamily mobFamily = null; int num = 0; for (int i = 0; i < _families.Count; i++) { MobFamily mobFamily2 = _families[i]; if (mobFamily2 != null && IsAvailable(mobFamily2)) { num++; mobFamily = mobFamily2; } } if (num == 1 && mobFamily != null) { SetActive(mobFamily); } } public static void TickAll(float dt) { for (int i = 0; i < _families.Count; i++) { try { _families[i]?.Tick(dt); } catch (Exception ex) { NDLog.DebugWarn("[MOB] Tick(" + _families[i]?.Id + "): " + ex.Message); } } } public static void ResetAllForSceneReload() { for (int i = 0; i < _families.Count; i++) { try { _families[i]?.ResetForSceneReload(); } catch (Exception ex) { NDLog.DebugWarn("[MOB] Reset(" + _families[i]?.Id + "): " + ex.Message); } } } public static string CaptureAllString() { StringBuilder stringBuilder = new StringBuilder(); for (int i = 0; i < _families.Count; i++) { MobFamily mobFamily = _families[i]; if (mobFamily == null) { continue; } string value = ""; try { value = mobFamily.OnSaveString() ?? ""; } catch { } if (!string.IsNullOrEmpty(value)) { if (stringBuilder.Length > 0) { stringBuilder.Append('\n'); } stringBuilder.Append(mobFamily.Id ?? "").Append('\t').Append(value); } } return stringBuilder.ToString(); } public static void RestoreAllString(string s) { if (string.IsNullOrEmpty(s)) { return; } string[] array = s.Split('\n'); for (int i = 0; i < array.Length; i++) { int num = array[i].IndexOf('\t'); if (num <= 0) { continue; } string text = array[i].Substring(0, num); string s2 = array[i].Substring(num + 1); MobFamily mobFamily = Get(text); if (mobFamily != null) { try { mobFamily.OnLoadString(s2); } catch (Exception ex) { NDLog.DebugWarn("[MOB] Load(" + text + "): " + ex.Message); } } } } } public sealed class MobFurnishRoom : IMobFurnishTarget { private sealed class Entry { public int Idx; public Vector3 Surface; public GameObject Prop; } private const float ROOM_Y = -12f; private readonly string _name; private readonly Func _availableFunc; private readonly Action _persist; private readonly float _half; private readonly float _height; private readonly List _entries = new List(); private GameObject _room; private Vector3 _anchor; private Vector3 _roomCenter; private bool _sited; private GameObject _floor; private GameObject _ceiling; private GameObject _wallN; private GameObject _wallS; private GameObject _wallE; private GameObject _wallW; private GameObject[] _furniture; private int _lastEntryIdx = -1; private float _addEntranceWarnMuteUntil = -999f; public MobFurnishState State { get; } public string Name => _name; public bool Available { get { try { return _availableFunc == null || _availableFunc(); } catch { return false; } } } public MobFurnishRoom(string name, Vector3 anchor, Func availableFunc, Action persist = null, int defaultA = -1, int defaultB = -1, float halfSize = 5.5f, float height = 3.2f) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) _name = (string.IsNullOrEmpty(name) ? "MobRoom" : name); _availableFunc = availableFunc; _persist = persist; _half = halfSize; _height = height; anchor.y = -12f; _anchor = anchor; _roomCenter = anchor; State = new MobFurnishState((defaultA >= 0) ? defaultA : FurnishCatalog.DefaultSurfaces, (defaultB < 0) ? 1 : defaultB, OnFurnishChanged); } public int GetMat(int surface) { return State.GetMat(surface); } public int GetCol(int surface) { return State.GetCol(surface); } public bool GetObj(int objIndex) { return State.GetObj(objIndex); } public void SetMat(int surface, int matIndex) { State.SetMat(surface, matIndex); } public void SetCol(int surface, int colIndex) { State.SetCol(surface, colIndex); } public void ToggleObj(int objIndex) { State.ToggleObj(objIndex); } public void AddEntrance(int idx, Vector3 worldDoorPos) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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) try { EnsureBuilt(); for (int i = 0; i < _entries.Count; i++) { if (_entries[i].Idx == idx) { if ((Object)(object)_entries[i].Prop != (Object)null) { return; } _entries.RemoveAt(i); break; } } Vector3 val = GroundSnap(worldDoorPos); _entries.Add(new Entry { Idx = idx, Surface = val, Prop = BuildEntry(idx, val) }); NDLog.Debug($"[MOBROOM] {_name}: entrance #{idx} ready (@ {val}); room @ {_roomCenter}."); } catch (Exception ex) { if (Time.time >= _addEntranceWarnMuteUntil) { _addEntranceWarnMuteUntil = Time.time + 30f; NDLog.Warn($"[MOBROOM] {_name} AddEntrance({idx}): {ex.Message}"); } else { NDLog.DebugWarn($"[MOBROOM] {_name} AddEntrance({idx}): {ex.Message}"); } } } public void RemoveEntrance(int idx) { for (int num = _entries.Count - 1; num >= 0; num--) { if (_entries[num].Idx == idx) { try { if ((Object)(object)_entries[num].Prop != (Object)null) { Object.Destroy((Object)(object)_entries[num].Prop); } } catch { } _entries.RemoveAt(num); } } if (_entries.Count == 0) { DestroyRoom(); } } public void EnsureBuilt() { //IL_0045: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_room != (Object)null)) { _roomCenter = (_sited ? _roomCenter : RoomSiting.FindFreeCenter(_name, _anchor, _half, _half, _height)); _sited = true; BuildRoom(_roomCenter); NDLog.Debug($"[MOBROOM] {_name}: room built @ {_roomCenter}."); } } public void Teardown() { DestroyRoom(); for (int i = 0; i < _entries.Count; i++) { try { if ((Object)(object)_entries[i].Prop != (Object)null) { Object.Destroy((Object)(object)_entries[i].Prop); } } catch { } } _entries.Clear(); _lastEntryIdx = -1; } private void DestroyRoom() { //IL_0071: 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) try { if ((Object)(object)_room != (Object)null) { Object.Destroy((Object)(object)_room); } } catch { } _room = null; _floor = (_ceiling = (_wallN = (_wallS = (_wallE = (_wallW = null))))); _furniture = null; _sited = false; _roomCenter = _anchor; } private void BuildRoom(Vector3 floorCenter) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0027: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_029a: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) _room = new GameObject("MobRoom_" + _name); _room.transform.position = floorCenter; float num = _half * 2f + 0.4f; _floor = AddSlab("Floor", floorCenter + Vector3.down * 0.1f, new Vector3(_half * 2f, 0.2f, _half * 2f)); _ceiling = AddSlab("Ceiling", floorCenter + Vector3.up * _height, new Vector3(num, 0.2f, num)); _wallN = AddSlab("WallN", floorCenter + new Vector3(0f, _height / 2f, _half), new Vector3(num, _height, 0.3f)); _wallS = AddSlab("WallS", floorCenter + new Vector3(0f, _height / 2f, 0f - _half), new Vector3(num, _height, 0.3f)); _wallE = AddSlab("WallE", floorCenter + new Vector3(_half, _height / 2f, 0f), new Vector3(0.3f, _height, num)); _wallW = AddSlab("WallW", floorCenter + new Vector3(0f - _half, _height / 2f, 0f), new Vector3(0.3f, _height, num)); GameObject val = GameCompat.SpawnVanillaPrefab("fluorescent", floorCenter + new Vector3(0f, _height - 0.15f, 0f), Quaternion.identity); if ((Object)(object)val != (Object)null) { try { val.transform.SetParent(_room.transform, true); } catch { } RoomFurnish.MakeStatic(val); } AddLight(floorCenter + new Vector3(0f, _height - 0.5f, 0f), new Color(1f, 0.97f, 0.92f), 1.1f, 18f); _furniture = (GameObject[])(object)new GameObject[FurnishCatalog.Objects.Length]; ApplyFurnish(); GameObject val2 = GameCompat.SpawnVanillaPrefab("steeldoor", floorCenter + new Vector3(0f, -0.1f, 0f - _half + 0.28f), Quaternion.Euler(0f, 180f, 0f)); if ((Object)(object)val2 != (Object)null) { try { val2.transform.SetParent(_room.transform, true); } catch { } RoomFurnish.MakeStatic(val2); } else { val2 = RoomFurnish.BuildDoor(_room.transform, floorCenter + new Vector3(0f, 0f, 0f - _half + 0.22f), 0f); } ((Object)val2).name = "MobRoom_" + _name + "_Exit"; InteractableObject val3 = val2.AddComponent(); val3.SetMessage("Leave"); val3.SetInteractionType((EInteractionType)0); val3.MaxInteractionRange = 3.5f; val3.RequiresUniqueClick = true; val3.onInteractStart.AddListener(GameCompat.ToUnityAction(TeleportOut)); } private GameObject BuildEntry(int idx, Vector3 surface) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //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_0094: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = $"MobRoom_{_name}_Entry_{idx}"; val.transform.position = surface + Vector3.up * 1.1f; val.transform.localScale = new Vector3(1.4f, 2.2f, 1f); try { Renderer component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.enabled = false; } } catch { } try { Collider component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.isTrigger = true; } } catch { } InteractableObject val2 = val.AddComponent(); val2.SetMessage("Enter"); val2.SetInteractionType((EInteractionType)0); val2.MaxInteractionRange = 3.5f; val2.RequiresUniqueClick = true; val2.Priority = 2; int entryIdx = idx; val2.onInteractStart.AddListener(GameCompat.ToUnityAction(delegate { TeleportIn(entryIdx); })); return val; } private GameObject AddSlab(string name, Vector3 pos, Vector3 scale) { //IL_0043: 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) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "MobRoom_" + _name + "_" + name; val.transform.SetParent(_room.transform, true); val.transform.position = pos; val.transform.localScale = scale; return val; } private void AddLight(Vector3 pos, Color color, float intensity, float range) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_003b: 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) try { GameObject val = new GameObject("MobRoom_" + _name + "_Light"); val.transform.SetParent(_room.transform, true); val.transform.position = pos; Light val2 = val.AddComponent(); val2.type = (LightType)2; val2.color = color; val2.intensity = intensity; val2.range = range; val2.shadows = (LightShadows)0; } catch (Exception ex) { NDLog.DebugWarn("[MOBROOM] " + _name + " AddLight: " + ex.Message); } } private void OnFurnishChanged() { ApplyFurnish(); try { _persist?.Invoke(); } catch (Exception ex) { NDLog.DebugWarn("[MOBROOM] " + _name + " persist: " + ex.Message); } } public void ApplyFurnish() { try { if ((Object)(object)_room == (Object)null) { return; } int a = State.A; ApplySurface(_floor, FurnishCatalog.Mat(a, 0), FurnishCatalog.Col(a, 0)); int matIdx = FurnishCatalog.Mat(a, 1); int colIdx = FurnishCatalog.Col(a, 1); ApplySurface(_wallN, matIdx, colIdx); ApplySurface(_wallS, matIdx, colIdx); ApplySurface(_wallE, matIdx, colIdx); ApplySurface(_wallW, matIdx, colIdx); ApplySurface(_ceiling, FurnishCatalog.Mat(a, 2), FurnishCatalog.Col(a, 2)); int b = State.B; if (_furniture == null) { _furniture = (GameObject[])(object)new GameObject[FurnishCatalog.Objects.Length]; } for (int i = 0; i < FurnishCatalog.Objects.Length && i < _furniture.Length; i++) { bool flag = (b & (1 << i)) != 0; bool flag2 = (Object)(object)_furniture[i] != (Object)null; if (flag && !flag2) { _furniture[i] = SpawnObject(i); } else if (!flag && flag2) { try { Object.Destroy((Object)(object)_furniture[i]); } catch { } _furniture[i] = null; } } } catch (Exception ex) { NDLog.DebugWarn("[MOBROOM] " + _name + " ApplyFurnish: " + ex.Message); } } private void ApplySurface(GameObject go, int matIdx, int colIdx) { //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_006c: 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_0043: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)go == (Object)null)) { matIdx = FurnishCatalog.ClampMat(matIdx); colIdx = FurnishCatalog.ClampCol(colIdx); FurnishCatalog.MatDef matDef = FurnishCatalog.Materials[matIdx]; Color val = FurnishCatalog.ColorOf(colIdx); if (matDef.Textured) { PropVisuals.ApplyVanilla(go, matDef.Kind, matDef.Base, (Color)((val.a > 0f) ? val : default(Color))); } else { PropVisuals.ApplyPreset(go, matDef.Base, matDef.Metallic, matDef.Smoothness, val); } } } private GameObject SpawnObject(int objIdx) { //IL_0015: 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_0020: 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) try { FurnishCatalog.ObjDef objDef = FurnishCatalog.Objects[objIdx]; GameObject val = GameCompat.SpawnVanillaPrefab(objDef.Kind, _roomCenter + objDef.Local, Quaternion.Euler(0f, objDef.Yaw, 0f)); if ((Object)(object)val == (Object)null) { NDLog.DebugWarn($"[MOBROOM] {_name}: furniture '{objDef.Name}' (Kind '{objDef.Kind}') not spawnable."); return null; } try { val.transform.SetParent(_room.transform, true); } catch { } RoomFurnish.MakeStatic(val); return val; } catch (Exception ex) { NDLog.DebugWarn($"[MOBROOM] {_name} SpawnObject {objIdx}: {ex.Message}"); return null; } } private void TeleportIn(int idx) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_0052: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); if ((Object)(object)_room == (Object)null) { NDLog.Warn("[MOBROOM] " + _name + ": room not buildable — teleport aborted."); return; } _lastEntryIdx = idx; MobTeleport.Fade(_roomCenter + Vector3.up * 0.15f, snapToNavMesh: false); } private void TeleportOut() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) Entry entry = null; for (int i = 0; i < _entries.Count; i++) { if (_entries[i].Idx == _lastEntryIdx) { entry = _entries[i]; break; } } if (entry == null && _entries.Count > 0) { entry = _entries[0]; } if (entry != null) { MobTeleport.Fade(entry.Surface, snapToNavMesh: true); } } private static Vector3 GroundSnap(Vector3 pos) { //IL_0002: 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_0016: 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_002a: Unknown result type (might be due to invalid IL or missing references) try { NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(pos, ref val, 3f, -1)) { return ((NavMeshHit)(ref val)).position; } } catch { } return pos; } } public sealed class MobFurnishState { private int _a; private int _b; private readonly int _defaultA; private readonly int _defaultB; private readonly Action _onChanged; public int A => _a; public int B => _b; public MobFurnishState(int defaultA, int defaultB, Action onChanged = null) { _defaultA = defaultA; _defaultB = defaultB; _a = defaultA; _b = defaultB; _onChanged = onChanged; } public void Load(int a, int b) { if (a == 0) { _a = _defaultA; _b = ((b == 0) ? _defaultB : b); } else { _a = a; _b = b; } } public void Reset() { _a = _defaultA; _b = _defaultB; } public int GetMat(int surface) { return FurnishCatalog.Mat(_a, surface); } public int GetCol(int surface) { return FurnishCatalog.Col(_a, surface); } public bool GetObj(int objIndex) { return objIndex >= 0 && objIndex < 32 && (_b & (1 << objIndex)) != 0; } public void SetMat(int surface, int matIndex) { _a = FurnishCatalog.SetMat(_a, surface, FurnishCatalog.ClampMat(matIndex)); _a = FurnishCatalog.SetTouched(_a, surface); Fire(); } public void SetCol(int surface, int colIndex) { _a = FurnishCatalog.SetCol(_a, surface, FurnishCatalog.ClampCol(colIndex)); _a = FurnishCatalog.SetTouched(_a, surface); Fire(); } public void ToggleObj(int objIndex) { if (objIndex >= 0 && objIndex < FurnishCatalog.Objects.Length) { _b ^= 1 << objIndex; Fire(); } } private void Fire() { try { _onChanged?.Invoke(); } catch (Exception ex) { NDLog.DebugWarn("[MOBFURNISH] onChanged: " + ex.Message); } } } public sealed class MobPlaceholderFamily : MobFamily { private readonly string _id; private readonly string _name; public override string Id => _id; public override string DisplayName => _name; public override bool Available => false; public MobPlaceholderFamily(string id, string displayName) { _id = id; _name = displayName; } } public static class MobTeleport { private static bool _busy; private static float _busyAt; private const float BUSY_MAX_AGE = 5f; public static void Fade(Vector3 target, bool snapToNavMesh) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Fade(target, snapToNavMesh, float.NaN); } public static void Fade(Vector3 target, bool snapToNavMesh, float faceYaw) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (_busy && Time.time - _busyAt < 5f) { NDLog.DebugWarn("[MOBTP] Fade ignoriert — es laeuft bereits ein Teleport."); return; } _busy = true; _busyAt = Time.time; try { MelonCoroutines.Start(Routine(target, snapToNavMesh, faceYaw)); } catch (Exception ex) { _busy = false; NDLog.Warn("[MOBTP] Fade: " + ex.Message); } } public static void ResetForSceneReload() { _busy = false; _busyAt = 0f; } private static IEnumerator Routine(Vector3 target, bool snapToNavMesh, float faceYaw) { //IL_0007: 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) PlayerMovement mv; try { mv = PlayerSingleton.Instance; if ((Object)(object)mv == (Object)null) { _busy = false; yield break; } if (snapToNavMesh) { try { NavMeshHit hit = default(NavMeshHit); if (NavMesh.SamplePosition(target, ref hit, 8f, -1)) { target = ((NavMeshHit)(ref hit)).position + Vector3.up * 0.2f; } } catch { } } try { Singleton.Instance.Open(0.05f); } catch { } try { mv.CanMove = false; } catch { } } catch (Exception ex) { Exception ex2 = ex; _busy = false; NDLog.Warn("[MOBTP] setup: " + ex2.Message); yield break; } yield return (object)new WaitForSeconds(0.12f); try { mv.Teleport(target, true); } catch (Exception ex) { Exception ex3 = ex; NDLog.Warn("[MOBTP] Teleport call: " + ex3.Message); } if (!float.IsNaN(faceYaw)) { try { mv.SetPlayerRotation(Quaternion.Euler(0f, faceYaw, 0f)); } catch (Exception ex) { Exception ex4 = ex; NDLog.DebugWarn("[MOBTP] SetPlayerRotation: " + ex4.Message); } } yield return (object)new WaitForSeconds(0.2f); try { Singleton.Instance.Close(0.3f); } catch { } yield return (object)new WaitForSeconds(0.2f); try { mv.CanMove = true; } catch { } _busy = false; } } public sealed class TheMobFrameworkMod : MelonMod { private const float SAVE_INTERVAL = 1f; private float _saveTimer; public override void OnInitializeMelon() { NDLog.Info("[MOBFW] TheMob framework host initialising."); MobFamilyRegistry.Register(new MobPlaceholderFamily("ndrangheta", "Ndrangheta")); MobFamilyRegistry.Register(new MobPlaceholderFamily("outlaws", "The Squad")); MobFamilyRegistry.Register(new MobPlaceholderFamily("triads", "Triads")); MobFamilyRegistry.Register(new MobPlaceholderFamily("cartel", "Columbian Connection")); MobFamilyRegistry.Register(new MobPlaceholderFamily("bratva", "Bratva")); } public override void OnUpdate() { try { MobFamilyRegistry.EnsureDefaultActive(); } catch { } try { MobFamilyRegistry.TickAll(Time.deltaTime); } catch { } _saveTimer -= Time.deltaTime; if (_saveTimer <= 0f) { _saveTimer = 1f; try { TheMobFrameworkSaveData.Instance?.PushNow(); } catch { } } } public override void OnSceneWasLoaded(int buildIndex, string sceneName) { try { MobFamilyRegistry.ResetAllForSceneReload(); } catch { } } } public sealed class TheMobFrameworkSaveData : Saveable { [SaveableField("TheMobFramework_state")] private FrameworkSnapshot _data = new FrameworkSnapshot(); public static TheMobFrameworkSaveData Instance { get; private set; } public TheMobFrameworkSaveData() { try { _data = Capture(); } catch { } Instance = this; } public void PushNow() { try { _data = Capture(); } catch (Exception ex) { NDLog.DebugWarn("[MOBFW] PushNow: " + ex.Message); } } private static FrameworkSnapshot Capture() { return new FrameworkSnapshot { ActiveFamilyId = (MobFamilyRegistry.Active?.Id ?? ""), MobFamilyData = MobFamilyRegistry.CaptureAllString() }; } protected override void OnLoaded() { try { FrameworkSnapshot frameworkSnapshot = _data ?? new FrameworkSnapshot(); try { MobFamilyRegistry.RestoreAllString(frameworkSnapshot.MobFamilyData); } catch { } try { MobFamily mobFamily = MobFamilyRegistry.Get(frameworkSnapshot.ActiveFamilyId); if (mobFamily != null) { MobFamilyRegistry.SetActive(mobFamily); } } catch { } NDLog.Debug("[MOBFW] save loaded: active='" + frameworkSnapshot.ActiveFamilyId + "'."); } catch (Exception ex) { NDLog.Warn("[MOBFW] OnLoaded: " + ex.Message); } } } [Serializable] public sealed class FrameworkSnapshot { public string ActiveFamilyId = ""; public string MobFamilyData = ""; } } namespace Ndrangheta.Helper { internal static class CompassNREGuardPatch { } internal static class CompassCamNreGuard { private static int _logBudget = 4; internal static bool IsCamNre(Exception ex) { return ex != null && QuestNreGuard.IsNreLike(ex); } internal static void LogOnce(string where) { if (_logBudget > 0) { _logBudget--; NDLog.DebugWarn("CompassManager." + where + " NRE suppressed (client PlayerCamera not ready during early load) — element list-managed + self-heals once cam spawns."); } } } [HarmonyPatch(typeof(CompassManager), "AddElement", new Type[] { typeof(Transform), typeof(RectTransform), typeof(bool) })] internal static class CompassAddElementGuard { private static int _logBudget = 5; [HarmonyPrefix] private static bool Prefix(Transform transform, ref Element __result) { bool flag = false; try { if ((Object)(object)transform == (Object)null) { flag = true; } } catch { flag = true; } if (!flag) { return true; } __result = null; if (_logBudget > 0) { _logBudget--; NDLog.DebugWarn("Compass.AddElement called with null transform (vanilla QuestEntry.Start without POI) — skipped to prevent NRE storm."); } return false; } [HarmonyFinalizer] private static Exception Finalizer(Transform transform, ref Element __result, CompassManager __instance, Exception __exception) { if (!CompassCamNreGuard.IsCamNre(__exception)) { return __exception; } try { if (__result == null && (Object)(object)__instance != (Object)null && (Object)(object)transform != (Object)null) { List elements = __instance.elements; if (elements != null) { for (int num = elements.Count - 1; num >= 0; num--) { Element val = elements[num]; try { if (val != null && (Object)(object)val.TargetTransform == (Object)(object)transform) { __result = val; break; } } catch { } } } } } catch { } CompassCamNreGuard.LogOnce("AddElement"); return null; } } [HarmonyPatch(typeof(CompassManager), "UpdateElements")] internal static class CompassUpdateElementsPrune { private static int _logBudget = 5; [HarmonyPrefix] private static void Prefix(CompassManager __instance) { try { if ((Object)(object)__instance == (Object)null) { return; } List elements = __instance.elements; if (elements == null || elements.Count == 0) { return; } int num = 0; for (int num2 = elements.Count - 1; num2 >= 0; num2--) { Element val = elements[num2]; bool flag = false; if (val == null) { flag = true; } else { try { if ((Object)(object)val.TargetTransform == (Object)null) { flag = true; } } catch { flag = true; } try { if (!flag && (Object)(object)val.Rect == (Object)null) { flag = true; } } catch { flag = true; } } if (flag) { try { elements.RemoveAt(num2); } catch { } num++; } } if (num > 0 && _logBudget > 0) { _logBudget--; NDLog.DebugWarn($"Compass: pruned {num} dead element(s) before UpdateElements (budget {_logBudget})."); } } catch { } } [HarmonyFinalizer] private static Exception Finalizer(Exception __exception) { if (!CompassCamNreGuard.IsCamNre(__exception)) { return __exception; } CompassCamNreGuard.LogOnce("UpdateElements"); return null; } } [HarmonyPatch(typeof(QuestsLoader), "Load")] internal static class Patch_QuestsLoader_Load_Safety { private static bool _logged; [HarmonyFinalizer] private static Exception Finalizer(string mainPath, Exception __exception) { if (__exception == null) { return null; } if (!_logged) { _logged = true; NDLog.Warn("QuestsLoader.Load threw (suppressed, once-logged) — path='" + (mainPath ?? "") + "' " + __exception.GetType().Name + ": " + __exception.Message); } return null; } } internal static class QuestNreGuard { private static bool _logged; internal static bool IsNreLike(Exception ex) { if (ex == null) { return false; } if (ex is NullReferenceException) { return true; } try { if (ex.GetType().Name.IndexOf("NullReference", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } string message = ex.Message; return !string.IsNullOrEmpty(message) && message.IndexOf("NullReference", StringComparison.OrdinalIgnoreCase) >= 0; } catch { return false; } } internal static void LogOnce(string where, Exception ex) { if (!_logged) { _logged = true; NDLog.Warn($"Client quest-start NRE suppressed (once-logged, {where}) — journal/HUD UI not ready during early client quest create; quest + POI/compass continue. {ex.Message}"); } } } [HarmonyPatch(typeof(Quest), "SetupHUDUI")] internal static class Patch_Quest_SetupHUDUI_Safety { private static bool Prepare() { try { return AccessTools.Method(typeof(Quest), "SetupHUDUI", (Type[])null, (Type[])null) != null; } catch { return false; } } [HarmonyFinalizer] private static Exception Finalizer(Exception __exception) { if (__exception == null) { return null; } if (!QuestNreGuard.IsNreLike(__exception)) { return __exception; } QuestNreGuard.LogOnce("SetupHUDUI", __exception); return null; } } [HarmonyPatch(typeof(Quest), "SetupJournalEntry")] internal static class Patch_Quest_SetupJournalEntry_Safety { private static bool Prepare() { try { return AccessTools.Method(typeof(Quest), "SetupJournalEntry", (Type[])null, (Type[])null) != null; } catch { return false; } } [HarmonyFinalizer] private static Exception Finalizer(Exception __exception) { if (__exception == null) { return null; } if (!QuestNreGuard.IsNreLike(__exception)) { return __exception; } QuestNreGuard.LogOnce("SetupJournalEntry", __exception); return null; } } public static class NDLog { private const string DebugTag = "[DBG] "; public static bool DebugLogging; public static void Info(string msg) { MelonLogger.Msg(msg); } public static void Warn(string msg) { MelonLogger.Warning(msg); } public static void Error(string msg) { MelonLogger.Error(msg); } public static void Debug(string msg) { if (DebugLogging) { MelonLogger.Msg("[DBG] " + msg); } } public static void DebugWarn(string msg) { if (DebugLogging) { MelonLogger.Warning("[DBG] " + msg); } } } public static class AssetLoader { private static readonly Dictionary _cache = new Dictionary(); public static Sprite LoadSprite(string resourceName) { return LoadSprite(resourceName, Assembly.GetExecutingAssembly()); } public static Sprite LoadSprite(string resourceName, Assembly assembly) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_010b: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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) if (assembly == null) { assembly = Assembly.GetExecutingAssembly(); } string key = assembly.GetName().Name + "::" + resourceName; if (_cache.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } byte[] array = LoadResourceBytes(resourceName, assembly); if (array == null || array.Length == 0) { NDLog.Error($"Resource '{resourceName}' not found in assembly '{assembly.GetName().Name}'."); return null; } try { Texture2D val = new Texture2D(2, 2); if (!GameCompat.LoadImage(val, array)) { NDLog.Error("ImageConversion.LoadImage failed for " + resourceName + "."); return null; } ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x20); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); ((Object)val2).hideFlags = (HideFlags)(((Object)val2).hideFlags | 0x20); _cache[key] = val2; NDLog.Debug($"Loaded sprite '{resourceName}' ({((Texture)val).width}x{((Texture)val).height})."); return val2; } catch (Exception ex) { NDLog.Error("Sprite load exception for " + resourceName + ": " + ex.Message); return null; } } private static byte[] LoadResourceBytes(string resourceName, Assembly assembly) { if (assembly == null) { assembly = Assembly.GetExecutingAssembly(); } byte[] array = TryReadResource(assembly, resourceName); if (array != null) { return array; } try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { if (!(assemblies[i] == assembly)) { byte[] array2 = TryReadResource(assemblies[i], resourceName); if (array2 != null) { return array2; } } } } catch { } NDLog.DebugWarn($"Resource '{resourceName}' in keiner geladenen Assembly gefunden (zuerst gesucht: '{assembly.GetName().Name}')."); return null; } private static byte[] TryReadResource(Assembly assembly, string resourceName) { try { using Stream stream = assembly.GetManifestResourceStream(resourceName); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); return array; } catch { return null; } } } public static class PayoutHelper { public static bool HasCashAtLeast(int amount) { try { MoneyManager instance = NetworkSingleton.Instance; if ((Object)(object)instance == (Object)null) { return false; } return instance.cashBalance >= (float)amount; } catch (Exception ex) { NDLog.DebugWarn("HasCashAtLeast: " + ex.Message); return false; } } public static bool AddCash(int amount, string sourceLabel) { if (amount <= 0) { return false; } try { MoneyManager instance = NetworkSingleton.Instance; if ((Object)(object)instance == (Object)null) { return false; } instance.ChangeCashBalance((float)amount, true, true); IncomeTracker.RecordCash(amount, sourceLabel); NDLog.Info($"+${amount} cash ({sourceLabel})"); return true; } catch (Exception ex) { NDLog.Warn("AddCash failed: " + ex.Message); return false; } } public static bool AddOnlineBalance(int amount, string label) { if (amount <= 0) { return false; } try { MoneyManager instance = NetworkSingleton.Instance; if ((Object)(object)instance == (Object)null) { return false; } instance.CreateOnlineTransaction(label, (float)amount, 1f, label); NDLog.Info($"+${amount} online balance ({label})"); return true; } catch (Exception ex) { NDLog.Warn("AddOnlineBalance failed: " + ex.Message); return false; } } public static bool DeductCash(int amount, string sinkLabel) { if (amount <= 0) { return false; } try { MoneyManager instance = NetworkSingleton.Instance; if ((Object)(object)instance == (Object)null) { return false; } if (instance.cashBalance < (float)amount) { NDLog.Debug($"DeductCash insufficient: have {instance.cashBalance}, need {amount} ({sinkLabel})"); return false; } instance.ChangeCashBalance(0f - (float)amount, true, false); NDLog.Info($"-${amount} cash ({sinkLabel})"); return true; } catch (Exception ex) { NDLog.Warn("DeductCash failed: " + ex.Message); return false; } } } public static class SessionGate { private static int _pvpLoaded = -1; private static bool _diagLogged; public static bool IsAuthority { get { try { NetworkManager networkManager = InstanceFinder.NetworkManager; if ((Object)(object)networkManager == (Object)null) { return true; } return networkManager.IsServer; } catch { return true; } } } public static bool IsHost => IsAuthority; public static bool IsInLobby => PlayerCount > 1; public static int PlayerCount { get { try { return Player.PlayerList?.Count ?? 0; } catch { return 0; } } } public static bool IsMultiplayerPvpLoaded { get { if (_pvpLoaded >= 0) { return _pvpLoaded == 1; } bool flag = ScanForPvp(); _pvpLoaded = (flag ? 1 : 0); if (flag) { NDLog.Info("SessionGate: MultiplayerPVP detected — Lucky player-targets disabled."); } return flag; } } public static bool AllowPlayerTargets => IsInLobby && PlayerCount > 1 && !IsMultiplayerPvpLoaded; private static bool ScanForPvp() { try { ReadOnlyCollection registeredMelons = MelonTypeBase.RegisteredMelons; if (registeredMelons != null) { foreach (MelonMod item in registeredMelons) { string text = null; try { object obj; if (item == null) { obj = null; } else { MelonInfoAttribute info = ((MelonBase)item).Info; obj = ((info != null) ? info.Name : null); } text = (string)obj; } catch { } if (string.IsNullOrEmpty(text)) { try { object obj3; if (item == null) { obj3 = null; } else { MelonAssembly melonAssembly = ((MelonBase)item).MelonAssembly; obj3 = ((melonAssembly == null) ? null : melonAssembly.Assembly?.GetName()?.Name); } text = (string)obj3; } catch { } } if (!string.IsNullOrEmpty(text) && text.IndexOf("MultiplayerPVP", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } } catch { } try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { string text2 = null; try { text2 = assemblies[i]?.GetName()?.Name; } catch { } if (!string.IsNullOrEmpty(text2) && text2.IndexOf("MultiplayerPVP", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } return false; } public static string Describe() { string value; try { NetworkManager networkManager = InstanceFinder.NetworkManager; value = (((Object)(object)networkManager == (Object)null) ? "NULL" : $"IsServer={networkManager.IsServer},IsClient={networkManager.IsClient}"); } catch (Exception ex) { value = "EX:" + ex.Message; } string value2; try { value2 = $"IsServer={InstanceFinder.IsServer},IsClient={InstanceFinder.IsClient}"; } catch (Exception ex2) { value2 = "EX:" + ex2.Message; } string value3; try { Lobby instance = Singleton.Instance; value3 = (((Object)(object)instance == (Object)null) ? "NULL" : $"InLobby={instance.IsInLobby},IsHost={instance.IsHost},Players={instance.PlayerCount}"); } catch (Exception ex3) { value3 = "EX:" + ex3.Message; } int value4; try { value4 = PlayerCount; } catch { value4 = -1; } string value5; try { Player local = Player.Local; if ((Object)(object)local == (Object)null) { value5 = "Local=NULL"; } else { NetworkConnection owner = ((NetworkBehaviour)local).Owner; value5 = ((owner == (NetworkConnection)null) ? "Owner=NULL" : $"Owner.IsHost={owner.IsHost},IsLocalClient={owner.IsLocalClient}"); } } catch (Exception ex4) { value5 = "EX:" + ex4.Message; } return $"NM[{value}] InstanceFinder[{value2}] Lobby[{value3}] Player[{value5}] PlayerList={value4} => IsAuthority={IsAuthority}"; } public static void LogDiagnostics() { if (_diagLogged) { return; } _diagLogged = true; try { NDLog.Debug("[NETDIAG] " + Describe()); } catch (Exception ex) { NDLog.Warn("NETDIAG: " + ex.Message); } } } public static class FurnishCatalog { public struct MatDef { public string Name; public bool Textured; public string Kind; public Color Base; public float Metallic; public float Smoothness; } public struct ColorDef { public string Name; public Color C; } public struct ObjDef { public string Name; public string Kind; public Vector3 Local; public float Yaw; } public const int Floor = 0; public const int Wall = 1; public const int Ceiling = 2; public static readonly MatDef[] Materials = new MatDef[22] { P("Default", 1f, 1f, 1f, 0f, 0.3f), P("Wood", 0.55f, 0.35f, 0.18f, 0f, 0.25f), P("Dark Wood", 0.3f, 0.18f, 0.1f, 0f, 0.3f), P("Light Wood", 0.75f, 0.6f, 0.4f, 0f, 0.2f), P("Metal", 0.7f, 0.72f, 0.75f, 0.8f, 0.7f), P("Dark Metal", 0.25f, 0.25f, 0.28f, 0.7f, 0.6f), P("Rusty Metal", 0.55f, 0.3f, 0.15f, 0.4f, 0.2f), P("Stone", 0.55f, 0.53f, 0.5f, 0f, 0.15f), P("Concrete", 0.65f, 0.63f, 0.6f, 0f, 0.1f), P("Dark Concrete", 0.35f, 0.34f, 0.33f, 0f, 0.1f), P("Brick", 0.6f, 0.28f, 0.18f, 0f, 0.15f), P("Tile", 0.9f, 0.9f, 0.88f, 0f, 0.65f), P("Dark Tile", 0.25f, 0.25f, 0.27f, 0f, 0.6f), P("Plaster", 0.92f, 0.9f, 0.85f, 0f, 0.05f), P("Marble", 0.95f, 0.93f, 0.9f, 0f, 0.8f), P("Black Marble", 0.1f, 0.1f, 0.12f, 0f, 0.85f), T("Wood Planks", "wood", 0.55f, 0.35f, 0.18f), T("Raw Concrete", "concrete", 0.64f, 0.62f, 0.6f), T("Industrial Tile", "tile", 0.25f, 0.25f, 0.27f), T("Brushed Steel", "metal", 0.45f, 0.46f, 0.49f), T("Granite", "granite", 0.62f, 0.55f, 0.52f), T("Docks Floor", "docks", 0.5f, 0.5f, 0.5f) }; public static readonly ColorDef[] Colors = new ColorDef[11] { C("Original", 1f, 1f, 1f), C("White", 1f, 1f, 1f), C("Cream", 0.98f, 0.96f, 0.88f), C("Light Grey", 0.78f, 0.78f, 0.78f), C("Dark Grey", 0.35f, 0.35f, 0.35f), C("Charcoal", 0.18f, 0.18f, 0.2f), C("Warm Brown", 0.55f, 0.35f, 0.2f), C("Cool Blue", 0.55f, 0.7f, 0.82f), C("Sage Green", 0.6f, 0.72f, 0.58f), C("Dusty Rose", 0.78f, 0.56f, 0.58f), C("Terracotta", 0.8f, 0.45f, 0.3f) }; public static readonly ObjDef[] Objects = new ObjDef[8] { O("Storage Rack", "floorrack", -4f, 4.2f, 0f), O("Filing Cabinet", "cabinet", -4.2f, 1.5f, 90f), O("Display Case", "displaycabinet", 4.2f, 4.2f, -90f), O("Work Table", "table", -1.6f, 1.5f, 0f), O("Metal Table", "metaltable", 1.6f, 1.5f, 0f), O("Safe", "safe", -4.2f, -2.5f, 90f), O("Coffee Table", "coffeetable", 0f, -1.5f, 0f), O("Trash Can", "trashcan", 4.4f, -3.5f, 0f) }; public const int DefaultObjects = 1; public static readonly int DefaultSurfaces = PackSurfaces(16, 6, 9, 0, 9, 0); private static MatDef P(string n, float r, float g, float b, float m, float s) { //IL_0022: 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) return new MatDef { Name = n, Textured = false, Base = new Color(r, g, b, 1f), Metallic = m, Smoothness = s }; } private static MatDef T(string n, string kind, float r, float g, float b) { //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) return new MatDef { Name = n, Textured = true, Kind = kind, Base = new Color(r, g, b, 1f), Metallic = 0f, Smoothness = 0.2f }; } private static ColorDef C(string n, float r, float g, float b) { //IL_001a: 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) return new ColorDef { Name = n, C = new Color(r, g, b, 1f) }; } public static Color ColorOf(int colIdx) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0062: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (colIdx <= 0 || colIdx >= Colors.Length) { return new Color(0f, 0f, 0f, 0f); } Color c = Colors[colIdx].C; return new Color(c.r, c.g, c.b, 1f); } private static ObjDef O(string n, string kind, float x, float z, float yaw) { //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) return new ObjDef { Name = n, Kind = kind, Local = new Vector3(x, 0f, z), Yaw = yaw }; } public static int PackSurfaces(int fM, int fC, int wM, int wC, int cM, int cC) { return (fM & 0x1F) | ((fC & 0xF) << 5) | ((wM & 0x1F) << 9) | ((wC & 0xF) << 14) | ((cM & 0x1F) << 18) | ((cC & 0xF) << 23); } public static int Mat(int code, int surface) { return surface switch { 0 => code & 0x1F, 1 => (code >> 9) & 0x1F, _ => (code >> 18) & 0x1F, }; } public static int Col(int code, int surface) { return surface switch { 0 => (code >> 5) & 0xF, 1 => (code >> 14) & 0xF, _ => (code >> 23) & 0xF, }; } public static int SetMat(int code, int surface, int v) { v &= 0x1F; return surface switch { 0 => (code & -32) | v, 1 => (code & -15873) | (v << 9), _ => (code & -8126465) | (v << 18), }; } public static int SetCol(int code, int surface, int v) { v &= 0xF; return surface switch { 0 => (code & -481) | (v << 5), 1 => (code & -245761) | (v << 14), _ => (code & -125829121) | (v << 23), }; } public static int ClampMat(int v) { return (v >= 0) ? ((v >= Materials.Length) ? (Materials.Length - 1) : v) : 0; } public static int ClampCol(int v) { return (v >= 0) ? ((v >= Colors.Length) ? (Colors.Length - 1) : v) : 0; } private static int TouchBit(int surface) { return 1 << 27 + ((surface >= 0) ? ((surface > 2) ? 2 : surface) : 0); } public static bool SurfaceTouched(int code, int surface) { return (code & TouchBit(surface)) != 0; } public static int SetTouched(int code, int surface) { return code | TouchBit(surface); } } public static class IncomeTracker { private static long _quest; private static long _other; private static long _dispQuest; private static long _dispOther; private static bool _displayOverride; public static long QuestIncome => _displayOverride ? _dispQuest : _quest; public static long OtherIncome => _displayOverride ? _dispOther : _other; public static long TotalIncome => QuestIncome + OtherIncome; public static void SetDisplayOverride(long quest, long other) { _dispQuest = quest; _dispOther = other; _displayOverride = true; } public static void ClearDisplayOverride() { _displayOverride = false; } public static void RecordCash(int amount, string label) { if (amount <= 0) { return; } try { if (IsQuestLabel(label)) { _quest += amount; } else { _other += amount; } } catch { } } private static bool IsQuestLabel(string label) { if (string.IsNullOrEmpty(label)) { return false; } return Contains(label, "reward") || Contains(label, "coop") || Contains(label, "co-op") || Contains(label, "Pizzo") || Contains(label, "Trasporto") || Contains(label, "Carico") || Contains(label, "Contratto") || Contains(label, "Kidnapping") || Contains(label, "Interrogation") || Contains(label, "Execution"); } private static bool Contains(string s, string sub) { return s.IndexOf(sub, StringComparison.OrdinalIgnoreCase) >= 0; } public static void GetSnapshot(out long quest, out long other) { quest = _quest; other = _other; } public static void LoadSnapshot(long quest, long other) { _quest = Math.Max(0L, quest); _other = Math.Max(0L, other); } } public static class PropVisuals { private static Material _safeBase; private static bool _probed; private static Material _flatBase; private static bool _flatProbed; private static Material _glassBase; private static bool _glassProbed; public static void ApplyFlat(GameObject go, Color color) { //IL_0024: 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_0069: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } Material val = ResolveFlatBase(); if ((Object)(object)val == (Object)null) { Apply(go, color); return; } try { Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val2 = componentsInChildren[i]; if (!((Object)(object)val2 == (Object)null)) { try { val2.material = new Material(val); val2.material.color = color; } catch { } } } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ApplyFlat: " + ex.Message); } } public static void ApplyPreset(GameObject go, Color baseColor, float metallic, float smoothness, Color overrideColor) { //IL_0011: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0025: 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_0036: 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_005c: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } Color val = ((overrideColor.a > 0f) ? new Color(overrideColor.r, overrideColor.g, overrideColor.b, 1f) : new Color(baseColor.r, baseColor.g, baseColor.b, 1f)); Material val2 = ResolveFlatBase(); if ((Object)(object)val2 == (Object)null) { Apply(go, val); return; } try { Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val3 = componentsInChildren[i]; if ((Object)(object)val3 == (Object)null) { continue; } try { Material val4 = new Material(val2); try { val4.SetColor("_BaseColor", val); } catch { } try { val4.color = val; } catch { } try { val4.SetFloat("_Metallic", metallic); } catch { } try { val4.SetFloat("_Smoothness", smoothness); } catch { } try { val4.SetFloat("_Glossiness", smoothness); } catch { } val3.material = val4; } catch { } } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ApplyPreset: " + ex.Message); } } public static Material ApplyPresetToRenderer(Renderer r, Color baseColor, float metallic, float smoothness, Color overrideColor) { //IL_0026: 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_0059: 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_006c: 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_003a: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)r == (Object)null) { return null; } Material val = null; try { val = r.sharedMaterial; } catch { } Color val2 = ((overrideColor.a > 0f) ? new Color(overrideColor.r, overrideColor.g, overrideColor.b, 1f) : new Color(baseColor.r, baseColor.g, baseColor.b, 1f)); Material val3 = ResolveFlatBase(); try { Material val4 = ((!((Object)(object)val3 != (Object)null)) ? ((!((Object)(object)val != (Object)null)) ? ((Material)null) : new Material(val)) : new Material(val3)); if ((Object)(object)val4 != (Object)null) { try { val4.SetColor("_BaseColor", val2); } catch { } try { val4.color = val2; } catch { } try { val4.SetFloat("_Metallic", metallic); } catch { } try { val4.SetFloat("_Smoothness", smoothness); } catch { } try { val4.SetFloat("_Glossiness", smoothness); } catch { } r.material = val4; } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ApplyPresetToRenderer: " + ex.Message); } return val; } public static Material ApplyVanillaToRenderer(Renderer r, string kind, Color fallback, Color tint) { //IL_00d4: 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_00a5: Expected O, but got Unknown //IL_00a5: 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_0052: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_006f: 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) if ((Object)(object)r == (Object)null) { return null; } Material result = null; try { result = r.sharedMaterial; } catch { } Material val = GameCompat.VanillaMaterial(kind); try { if ((Object)(object)val == (Object)null) { Material val2 = ResolveFlatBase(); Color val3 = ((tint.a > 0f) ? tint : fallback); if ((Object)(object)val2 != (Object)null) { Material val4 = new Material(val2); val4.color = val3; try { val4.SetColor("_BaseColor", val3); } catch { } r.material = val4; } } else { Material val5 = new Material(val); if (tint.a > 0f) { try { val5.SetColor("_BaseColor", tint); } catch { } try { val5.color = tint; } catch { } } r.material = val5; } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ApplyVanillaToRenderer: " + ex.Message); } return result; } public static void ApplyVanilla(GameObject go, string kind, Color fallback, Color tint = default(Color)) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_007e: 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) if ((Object)(object)go == (Object)null) { return; } Material val = GameCompat.VanillaMaterial(kind); if ((Object)(object)val == (Object)null) { ApplyFlat(go, (tint.a > 0f) ? tint : fallback); return; } try { Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val2 = componentsInChildren[i]; if ((Object)(object)val2 == (Object)null) { continue; } try { val2.material = new Material(val); if (tint.a > 0f) { try { val2.material.SetColor("_BaseColor", tint); } catch { } try { val2.material.color = tint; } catch { } } } catch { } } NDLog.Debug("[ROOM] Vanilla material '" + kind + "' applied (S1MAPI)."); } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ApplyVanilla: " + ex.Message); } } public static void ApplyGlass(GameObject go, Color color, float alpha = 0.45f) { //IL_0024: 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_006c: Expected O, but got Unknown //IL_0079: 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_008c: 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_00a5: 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) if ((Object)(object)go == (Object)null) { return; } Material val = ResolveGlassBase(); if ((Object)(object)val == (Object)null) { ApplyFlat(go, color); return; } try { Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val2 = componentsInChildren[i]; if ((Object)(object)val2 == (Object)null) { continue; } try { val2.material = new Material(val); val2.material.SetColor("_BaseColor", new Color(color.r, color.g, color.b, alpha)); try { val2.material.color = new Color(color.r, color.g, color.b, alpha); } catch { } } catch { } } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ApplyGlass: " + ex.Message); } } private static Material ResolveGlassBase() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if (_glassProbed) { return _glassBase; } _glassProbed = true; try { Shader val = Shader.Find("Universal Render Pipeline/Lit"); if ((Object)(object)val == (Object)null) { NDLog.Warn("PropVisuals: URP/Lit not found — glass falls back to Flat."); return null; } Material val2 = new Material(val); try { val2.SetFloat("_Surface", 1f); } catch { } try { val2.SetOverrideTag("RenderType", "Transparent"); } catch { } try { val2.SetInt("_SrcBlend", 5); } catch { } try { val2.SetInt("_DstBlend", 10); } catch { } try { val2.SetInt("_ZWrite", 0); } catch { } val2.renderQueue = 3000; try { val2.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); } catch { } try { val2.DisableKeyword("_ALPHATEST_ON"); } catch { } try { val2.SetFloat("_Cull", 0f); } catch { } try { val2.SetFloat("_Smoothness", 0.5f); } catch { } _glassBase = val2; NDLog.Debug("PropVisuals: glass material (URP/Lit transparent) created."); } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ResolveGlassBase: " + ex.Message); } return _glassBase; } private static Material ResolveFlatBase() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (_flatProbed) { return _flatBase; } _flatProbed = true; try { Shader val = Shader.Find("Universal Render Pipeline/Lit"); if ((Object)(object)val != (Object)null) { _flatBase = new Material(val); } else { NDLog.Warn("PropVisuals: URP/Lit not found — ApplyFlat falls back to Apply."); } } catch { } return _flatBase; } public static void Apply(GameObject go, Color color) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go == (Object)null) { return; } Material val = ResolveSafeBase(); try { Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val2 = componentsInChildren[i]; if ((Object)(object)val2 == (Object)null) { continue; } try { if ((Object)(object)val != (Object)null) { val2.material = new Material(val); } Material material = val2.material; if ((Object)(object)material != (Object)null) { material.color = color; } } catch { } } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.Apply: " + ex.Message); } } private static Material ResolveSafeBase() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown if (_probed) { return _safeBase; } _probed = true; try { BombPlantLocation val = Object.FindObjectOfType(true); Renderer val2 = (((Object)(object)val != (Object)null && (Object)(object)val.BombModel != (Object)null) ? val.BombModel.GetComponentInChildren(true) : null); Material val3 = (((Object)(object)val2 != (Object)null) ? val2.sharedMaterial : null); if ((Object)(object)val3 != (Object)null) { _safeBase = val3; DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(47, 2); defaultInterpolatedStringHandler.AppendLiteral("PropVisuals: safe base material '"); defaultInterpolatedStringHandler.AppendFormatted(((Object)val3).name); defaultInterpolatedStringHandler.AppendLiteral("' (shader '"); Shader shader = val3.shader; defaultInterpolatedStringHandler.AppendFormatted((shader != null) ? ((Object)shader).name : null); defaultInterpolatedStringHandler.AppendLiteral("')."); NDLog.Debug(defaultInterpolatedStringHandler.ToStringAndClear()); } else { try { Shader val4 = Shader.Find("Universal Render Pipeline/Lit"); if ((Object)(object)val4 != (Object)null) { _safeBase = new Material(val4); NDLog.Debug("PropVisuals: URP/Lit fallback material created."); } } catch { } if ((Object)(object)_safeBase == (Object)null) { NDLog.Warn("PropVisuals: no material source found — primitives keep default material."); } } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.ResolveSafeBase: " + ex.Message); } return _safeBase; } public static void SeatOnGround(GameObject go, float groundY) { //IL_0037: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) if ((Object)(object)go == (Object)null) { return; } try { Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } Bounds val = default(Bounds); bool flag = false; for (int i = 0; i < componentsInChildren.Length; i++) { Renderer val2 = componentsInChildren[i]; if (!((Object)(object)val2 == (Object)null) && val2.enabled) { if (!flag) { val = val2.bounds; flag = true; } else { ((Bounds)(ref val)).Encapsulate(val2.bounds); } } } if (flag) { float num = groundY - ((Bounds)(ref val)).min.y; Transform transform = go.transform; transform.position += new Vector3(0f, num, 0f); } } catch (Exception ex) { NDLog.DebugWarn("PropVisuals.SeatOnGround: " + ex.Message); } } public static void ResetForSceneReload() { _safeBase = null; _probed = false; _flatBase = null; _flatProbed = false; _glassBase = null; _glassProbed = false; } } public static class RoomSiting { private static readonly Vector3[] Offsets = (Vector3[])(object)new Vector3[17] { Vector3.zero, new Vector3(30f, 0f, 0f), new Vector3(-30f, 0f, 0f), new Vector3(0f, 0f, 30f), new Vector3(0f, 0f, -30f), new Vector3(30f, 0f, 30f), new Vector3(-30f, 0f, 30f), new Vector3(30f, 0f, -30f), new Vector3(-30f, 0f, -30f), new Vector3(60f, 0f, 0f), new Vector3(-60f, 0f, 0f), new Vector3(0f, 0f, 60f), new Vector3(0f, 0f, -60f), new Vector3(90f, 0f, 0f), new Vector3(-90f, 0f, 0f), new Vector3(0f, 0f, 90f), new Vector3(0f, 0f, -90f) }; public static Vector3 FindFreeCenter(string tag, Vector3 desired, float halfX, float halfZ, float height) { //IL_0009: 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_0015: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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) for (int i = 0; i < Offsets.Length; i++) { Vector3 val = desired + Offsets[i]; string text = FindBlocker(val, halfX, halfZ, height); if (text == null) { if (i > 0) { NDLog.Debug($"[ROOM] {tag}: volume at {desired} occupied — room shifted by {Offsets[i]} -> {val}."); } return val; } if (i == 0) { NDLog.Warn($"[ROOM] {tag}: foreign collider in room volume at {val}: '{text}' — looking for an alternate spot."); } } NDLog.Warn($"[ROOM] {tag}: NO free volume found nearby — building at {desired} anyway."); return desired; } private static string FindBlocker(Vector3 floorCenter, float halfX, float halfZ, float height) { //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_000f: 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) //IL_0019: 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_002b: 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) try { Vector3 val = floorCenter + Vector3.up * (height * 0.5f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(halfX, height * 0.5f, halfZ); Il2CppReferenceArray val3 = Physics.OverlapBox(val, val2, Quaternion.identity, -1, (QueryTriggerInteraction)2); if (val3 == null) { return null; } for (int i = 0; i < ((Il2CppArrayBase)(object)val3).Length; i++) { try { Collider val4 = ((Il2CppArrayBase)(object)val3)[i]; if ((Object)(object)val4 == (Object)null || (Object)(object)((Component)val4).gameObject == (Object)null) { continue; } bool flag = false; Transform val5 = ((Component)val4).transform; while ((Object)(object)val5 != (Object)null) { string name = ((Object)val5).name; if (name != null && (name.StartsWith("Ndrangheta_") || name.StartsWith("MobRoom_") || name.StartsWith("TriadsRoom_"))) { flag = true; break; } val5 = val5.parent; } if (flag) { continue; } bool flag2 = false; try { flag2 = (Object)(object)((Component)val4).GetComponentInParent() != (Object)null; } catch { } return (flag2 ? "WATER: " : "") + ((Object)((Component)val4).gameObject).name; } catch { } } } catch (Exception ex) { NDLog.DebugWarn("[ROOM] Probe: " + ex.Message); } return null; } } public static class RoomFurnish { private static readonly Color PanelWood = new Color(0.24f, 0.17f, 0.11f); private static readonly Color FrameTrim = new Color(0.5f, 0.41f, 0.18f); private static readonly Color KnobGold = new Color(0.83f, 0.69f, 0.22f); public static bool TrySpawnDeco(string itemId, Vector3 pos, float yaw, Transform parent) { //IL_0064: 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) try { ItemDefinition item = Registry.GetItem(itemId); if ((Object)(object)item == (Object)null) { return false; } StorableItemDefinition val = GameCompat.Cast((Object)(object)item); StoredItem val2 = (((Object)(object)val != (Object)null) ? val.StoredItem : null); if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).gameObject == (Object)null) { return false; } GameObject val3 = Object.Instantiate(((Component)val2).gameObject, pos, Quaternion.Euler(0f, yaw, 0f)); ((Object)val3).name = "Ndrangheta_Deco_" + itemId; if ((Object)(object)parent != (Object)null) { val3.transform.SetParent(parent, true); } val3.SetActive(true); MakeStatic(val3); NDLog.Debug("[ROOM] Decor '" + itemId + "' placed."); return true; } catch (Exception ex) { NDLog.DebugWarn("[ROOM] decor " + itemId + ": " + ex.Message); return false; } } public static void MakeStatic(GameObject go) { try { Il2CppArrayBase componentsInChildren = go.GetComponentsInChildren(true); if (componentsInChildren != null) { for (int i = 0; i < componentsInChildren.Length; i++) { try { MonoBehaviour val = GameCompat.Cast((Object)(object)componentsInChildren[i]); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } } catch { } } } } catch { } try { Il2CppArrayBase componentsInChildren2 = go.GetComponentsInChildren(true); if (componentsInChildren2 == null) { return; } for (int j = 0; j < componentsInChildren2.Length; j++) { try { Object.Destroy((Object)(object)componentsInChildren2[j]); } catch { try { componentsInChildren2[j].isKinematic = true; } catch { } } } } catch { } } public static GameObject BuildDoor(Transform parent, Vector3 baseCenter, float yawDeg) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0029: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_009b: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_014a: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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_01c8: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) Quaternion val = Quaternion.Euler(0f, yawDeg, 0f); Vector3 val2 = val * Vector3.right; Vector3 val3 = val * Vector3.forward; GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val4).name = "Ndrangheta_DoorPanel"; if ((Object)(object)parent != (Object)null) { val4.transform.SetParent(parent, true); } val4.transform.position = baseCenter + Vector3.up * 1.05f; val4.transform.rotation = val; val4.transform.localScale = new Vector3(1f, 2.1f, 0.12f); PropVisuals.ApplyFlat(val4, PanelWood); Trim(parent, baseCenter + val2 * 0.6f + Vector3.up * 1.15f, val, new Vector3(0.14f, 2.3f, 0.18f)); Trim(parent, baseCenter - val2 * 0.6f + Vector3.up * 1.15f, val, new Vector3(0.14f, 2.3f, 0.18f)); Trim(parent, baseCenter + Vector3.up * 2.3f, val, new Vector3(1.34f, 0.14f, 0.18f)); GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val5).name = "Ndrangheta_DoorKnob"; if ((Object)(object)parent != (Object)null) { val5.transform.SetParent(parent, true); } val5.transform.position = baseCenter + val2 * 0.35f + Vector3.up * 1f + val3 * 0.09f; val5.transform.rotation = val; val5.transform.localScale = new Vector3(0.08f, 0.08f, 0.08f); PropVisuals.ApplyFlat(val5, KnobGold); try { Collider component = val5.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } catch { } return val4; } private static void Trim(Transform parent, Vector3 pos, Quaternion rot, Vector3 scale) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "Ndrangheta_DoorTrim"; if ((Object)(object)parent != (Object)null) { val.transform.SetParent(parent, true); } val.transform.position = pos; val.transform.rotation = rot; val.transform.localScale = scale; PropVisuals.ApplyFlat(val, FrameTrim); Collider component = val.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } catch { } } } } namespace Ndrangheta.Compat { public static class GameCompat { public const string BackendName = "Il2Cpp"; public static bool IsLoadingScreenOpen() { try { LoadingScreen instance = Singleton.Instance; return (Object)(object)instance != (Object)null && instance.IsOpen; } catch { return false; } } public static bool IsGameLoading() { try { LoadManager instance = Singleton.Instance; return (Object)(object)instance != (Object)null && instance.IsLoading; } catch { return false; } } private static void SetReflectedBool(Type t, object inst, string propName, bool value) { if (t == null || inst == null) { return; } try { t.GetProperty(propName, BindingFlags.Instance | BindingFlags.Public)?.GetSetMethod(nonPublic: true)?.Invoke(inst, new object[1] { value }); } catch { } try { PropertyInfo[] properties = t.GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanWrite && propertyInfo.PropertyType == typeof(bool) && propertyInfo.Name.IndexOf(propName, StringComparison.Ordinal) >= 0 && propertyInfo.Name.IndexOf("BackingField", StringComparison.Ordinal) >= 0) { propertyInfo.SetValue(inst, value); break; } } } catch { } try { FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(bool) && fieldInfo.Name.IndexOf(propName, StringComparison.Ordinal) >= 0) { fieldInfo.SetValue(inst, value); break; } } } catch { } } public static bool TryMarkReplicationDone() { try { ReplicationQueue instance = NetworkSingleton.Instance; if ((Object)(object)instance == (Object)null) { return false; } if (instance.ReplicationDoneForLocalPlayer) { return true; } SetReflectedBool(typeof(ReplicationQueue), instance, "ReplicationDoneForLocalPlayer", value: true); return instance.ReplicationDoneForLocalPlayer; } catch { return false; } } public static bool ForceCloseLoadingScreen() { try { TryMarkReplicationDone(); } catch { } try { Player local = Player.Local; if ((Object)(object)local != (Object)null) { SetReflectedBool(typeof(Player), local, "playerDataRetrieveReturned", value: true); } } catch { } try { LoadingScreen instance = Singleton.Instance; if ((Object)(object)instance != (Object)null) { try { instance.Close(); } catch { } try { if ((Object)(object)instance.Group != (Object)null) { instance.Group.alpha = 0f; } } catch { } try { if ((Object)(object)instance.Canvas != (Object)null) { ((Behaviour)instance.Canvas).enabled = false; } } catch { } } } catch { } try { LoadManager instance2 = Singleton.Instance; if ((Object)(object)instance2 != (Object)null) { SetReflectedBool(typeof(LoadManager), instance2, "IsLoading", value: false); SetReflectedBool(typeof(LoadManager), instance2, "IsGameLoaded", value: true); } } catch { } return !IsLoadingScreenOpen(); } public static void LogClientLoadGateState(float heldSeconds) { //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) string value = "?"; string value2 = "?"; string value3 = "?"; string text = "?"; string value4 = "?"; string value5 = "?"; string value6 = "?"; try { LoadManager instance = Singleton.Instance; if ((Object)(object)instance != (Object)null) { try { value = ((object)instance.LoadStatus/*cast due to .constrained prefix*/).ToString(); } catch { } try { value2 = instance.IsLoading.ToString(); } catch { } } } catch { } try { value3 = IsLoadingScreenOpen().ToString(); } catch { } try { Player local = Player.Local; text = (((Object)(object)local != (Object)null) ? local.playerDataRetrieveReturned.ToString() : "no-localplayer"); } catch (Exception ex) { text = "err:" + ex.Message; } try { ReplicationQueue instance2 = NetworkSingleton.Instance; if ((Object)(object)instance2 == (Object)null) { value4 = "QUEUE-NULL"; value5 = "QUEUE-NULL"; } else { try { value4 = instance2.ReplicationDoneForLocalPlayer.ToString(); } catch { } try { value5 = instance2.LocalPlayerReplicationTimedOut.ToString(); } catch { } try { value6 = instance2.CurrentReplicationTask ?? ""; } catch { } } } catch (Exception ex2) { value4 = "err:" + ex2.Message; } NDLog.Debug($"[CLIENTLOAD][DIAG] held={heldSeconds:0}s LoadStatus={value} IsLoading={value2} ScreenOpen={value3} playerDataRetrieved={text} ReplicationDone={value4} ReplTimedOut={value5} ReplTask='{value6}'"); } public static bool TryReRequestPlayerData() { try { Player local = Player.Local; if ((Object)(object)local == (Object)null) { return false; } string text = null; try { text = local.PlayerCode; } catch { } local.RequestPlayerData(text); return true; } catch { return false; } } public static bool ClientLoadGatesSatisfied() { try { Player local = Player.Local; bool flag = false; try { flag = (Object)(object)local != (Object)null && local.playerDataRetrieveReturned; } catch { } if (!flag) { return false; } ReplicationQueue instance = NetworkSingleton.Instance; if ((Object)(object)instance == (Object)null) { return true; } bool flag2 = false; bool flag3 = false; try { flag2 = instance.ReplicationDoneForLocalPlayer; } catch { } try { flag3 = instance.LocalPlayerReplicationTimedOut; } catch { } return flag2 || flag3; } catch { return false; } } public static Material VanillaMaterial(string kind) { try { return (Material)(kind switch { "wood" => Materials.WoodMediumBrown, "concrete" => Materials.ConcreteLightGrey, "granite" => Materials.GraniteDullSalmonLighter, "tile" => Materials.TilesDarkGrey, "metal" => Materials.MetalDarkGrey, "docks" => Materials.DocksGround, _ => null, }); } catch { return null; } } public static GameObject SpawnVanillaPrefab(string kind, Vector3 pos, Quaternion rot) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) try { string[] array = PrefabCandidates(kind); if (array == null) { return null; } for (int i = 0; i < array.Length; i++) { GameObject val = null; try { val = new PrefabRef(array[i]).Find(); } catch { } if (!((Object)(object)val == (Object)null)) { GameObject val2 = Object.Instantiate(val); if ((Object)(object)val2 != (Object)null) { val2.transform.position = pos; val2.transform.rotation = rot; } return val2; } } return null; } catch { return null; } } public static GameObject SpawnVanillaPrefabNetworked(string kind, Vector3 pos, Quaternion rot) { //IL_004e: 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_0021: Unknown result type (might be due to invalid IL or missing references) try { string[] array = PrefabCandidates(kind); if (array == null) { return null; } for (int i = 0; i < array.Length; i++) { GameObject val = null; try { val = new PrefabRef(array[i]).InstantiateNetworked(); } catch { } if (!((Object)(object)val == (Object)null)) { try { val.transform.position = pos; val.transform.rotation = rot; } catch { } return val; } } return null; } catch { return null; } } private static string[] PrefabCandidates(string kind) { return kind switch { "steeldoor" => new string[2] { "IndustrialMetalDoor", "Industrial Metal Door" }, "steeldoorph" => new string[2] { "IndustrialMetalDoorPeephole", "Industrial Metal Door Peephole" }, "fluorescent" => new string[2] { "FluorescentLight", "Fluorescent Light" }, "halogen" => new string[2] { "HalogenLight", "Halogen Light" }, "floorrack" => new string[1] { "FloorRack" }, "metalshelf" => new string[3] { "MetalShelf", "Metal Shelf", "FloorRack" }, "crate" => new string[4] { "WoodenCrate", "Wooden Crate", "WoodCrate", "Crate_Built" }, "table" => new string[1] { "WoodSquareTable" }, "metaltable" => new string[1] { "MetalSquareTable" }, "coffeetable" => new string[1] { "CoffeeTable_Built" }, "singlebed" => new string[1] { "SingleBed" }, "tv" => new string[2] { "TV_Built", "tv" }, "grandfatherclock" => new string[1] { "GrandfatherClock_Built" }, "safe" => new string[2] { "Safe", "Safe_Built" }, "smallsafe" => new string[3] { "SmallSafe", "Small Safe", "Safe" }, "cabinet" => new string[1] { "FilingCabinet_Built" }, "displaycabinet" => new string[1] { "DisplayCabinet_Built" }, "floorlamp" => new string[1] { "FloorLamp" }, "walllamp" => new string[2] { "ModernWallLamp_Built", "AntiqueWallLamp_Built" }, "wallshelf" => new string[1] { "WallMountedShelf_Built" }, "trashcan" => new string[1] { "TrashCan_Built" }, _ => null, }; } public static T Cast(Object o) where T : Object { return (o == (Object)null) ? default(T) : ((Il2CppObjectBase)o).TryCast(); } public static T CastObj(Object o) where T : Object { return (o == null) ? default(T) : ((Il2CppObjectBase)o).TryCast(); } public static bool IsNullBoxed(T o) where T : ValueType { return o == null; } public static bool SameInstance(Il2CppObjectBase a, Il2CppObjectBase b) { return a != null && b != null && a.Pointer == b.Pointer; } public static T CastTargetable(Il2CppObjectBase o) where T : Il2CppObjectBase { return (o == null) ? default(T) : o.TryCast(); } public static bool LoadImage(Texture2D tex, byte[] data) { Il2CppStructArray val = new Il2CppStructArray((long)data.Length); for (int i = 0; i < data.Length; i++) { ((Il2CppArrayBase)(object)val)[i] = data[i]; } return ImageConversion.LoadImage(tex, val); } public static Action ToGameAction(Action a) { return Action.op_Implicit(a); } public static UnityAction ToUnityAction(Action a) { return DelegateSupport.ConvertDelegate((Delegate)a); } public static List NewList() { return new List(); } public static void SetGridParentProperty(Grid grid, Property prop) { if (!((Object)(object)grid == (Object)null)) { grid._parentProperty = prop; } } public static void SetGridGuidString(Grid grid, string guid) { if (!((Object)(object)grid == (Object)null)) { grid._guid = guid; } } public static Property ResolvePropertyAnchor(bool ownedPerSyncedView) { Property val = null; try { Il2CppArrayBase val2 = Object.FindObjectsOfType(true); if (val2 != null) { for (int i = 0; i < val2.Length; i++) { Property val3 = val2[i]; if (!((Object)(object)val3 == (Object)null)) { if ((Object)(object)val == (Object)null) { val = val3; } bool flag = false; try { flag = val3.IsOwned; } catch { } if (flag) { return val3; } } } } } catch { } return ownedPerSyncedView ? val : null; } public static bool IsGuidRegistered(string guidStr) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(guidStr)) { return false; } try { return GUIDManager.IsGUIDAlreadyRegistered(new Guid(guidStr)); } catch { return false; } } public static GridItemData GetGridItemData(GridItem gi) { if ((Object)(object)gi == (Object)null) { return null; } try { BuildableItemData baseData = ((BuildableItem)gi).GetBaseData(); return GameCompat.CastObj((Object)(object)baseData); } catch (Exception ex) { NDLog.DebugWarn("[GRIDPERSIST] GetGridItemData: " + ex.Message); return null; } } public static bool LoadGridItem(string itemString, Grid grid, Vector2 originCoordinate, int rotation, string guid) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)grid == (Object)null) { return false; } ItemInstance val = ItemDeserializer.LoadItem(itemString); if (val == null) { NDLog.DebugWarn("[GRIDPERSIST] LoadItem null — skip."); return false; } BuildManager instance = NetworkSingleton.Instance; if ((Object)(object)instance == (Object)null) { NDLog.DebugWarn("[GRIDPERSIST] BuildManager null — skip."); return false; } instance.CreateGridItem(val, grid, originCoordinate, rotation, guid, (Action)null); return true; } catch (Exception ex) { NDLog.Warn("[GRIDPERSIST] LoadGridItem: " + ex.Message); return false; } } public static bool MakePictureWall(GameObject go, Property ownedProp, string guidStr) { if ((Object)(object)go == (Object)null || (Object)(object)ownedProp == (Object)null) { return false; } try { Surface val = go.AddComponent(); if ((Object)(object)val == (Object)null) { return false; } val.SurfaceType = (ESurfaceType)0; List val2 = new List(); val2.Add((EFace)0); val2.Add((EFace)1); val.ValidFaces = val2; val.ParentProperty = ownedProp; val.BakedGUID = guidStr; return true; } catch (Exception ex) { NDLog.DebugWarn("MakePictureWall: " + ex.Message); return false; } } public static bool MakeBuildableSurface(GameObject go, Property ownedProp, string guidStr, bool roof) { if ((Object)(object)go == (Object)null || (Object)(object)ownedProp == (Object)null) { return false; } try { Surface val = go.AddComponent(); if ((Object)(object)val == (Object)null) { return false; } val.SurfaceType = (ESurfaceType)(roof ? 1 : 0); List val2 = new List(); if (roof) { val2.Add((EFace)2); val2.Add((EFace)3); } else { val2.Add((EFace)0); val2.Add((EFace)1); } val.ValidFaces = val2; val.ParentProperty = ownedProp; val.BakedGUID = guidStr; return true; } catch (Exception ex) { NDLog.DebugWarn("MakeBuildableSurface: " + ex.Message); return false; } } public static List MakeBuildingWallsBuildable(GameObject buildingRoot, Property ownedProp) { //IL_01e7: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0277: 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_0296: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0228: 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_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: 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_03dc: 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_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) List list = new List(); if ((Object)(object)buildingRoot == (Object)null || (Object)(object)ownedProp == (Object)null) { return list; } try { Il2CppArrayBase componentsInChildren = buildingRoot.GetComponentsInChildren(true); if (componentsInChildren == null) { return list; } HashSet hashSet = new HashSet(); string[] array = new string[24] { "door", "frame", "rail", "leg", "stair", "step", "prop", "lamp", "light", "window", "fridge", "shelf", "table", "chair", "sofa", "bed", "toilet", "sink", "counter", "cabinet", "rug", "carpet", "pipe", "vent" }; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; for (int i = 0; i < componentsInChildren.Length; i++) { Collider val = componentsInChildren[i]; if ((Object)(object)val == (Object)null) { continue; } bool flag = false; try { flag = val.isTrigger; } catch { } if (flag) { continue; } num++; BoxCollider val2 = (BoxCollider)(object)((val is BoxCollider) ? val : null); MeshCollider val3 = (MeshCollider)(object)((val is MeshCollider) ? val : null); if ((Object)(object)val2 != (Object)null) { num2++; } else if ((Object)(object)val3 != (Object)null) { num3++; } try { if ((Object)(object)((Component)val).GetComponentInParent() != (Object)null) { continue; } } catch { } Vector3 val4; Bounds bounds; if ((Object)(object)val2 != (Object)null) { val4 = Vector3.Scale(val2.size, ((Component)val).transform.lossyScale); } else if ((Object)(object)val3 != (Object)null && (Object)(object)val3.sharedMesh != (Object)null) { bounds = val3.sharedMesh.bounds; val4 = Vector3.Scale(((Bounds)(ref bounds)).size, ((Component)val).transform.lossyScale); } else { bounds = val.bounds; val4 = ((Bounds)(ref bounds)).size; } ((Vector3)(ref val4))..ctor(Mathf.Abs(val4.x), Mathf.Abs(val4.y), Mathf.Abs(val4.z)); bool flag2 = val4.y > 1.4f && val4.y < 6f; bool flag3 = val4.x < 0.6f || val4.z < 0.6f; bool flag4 = val4.x > 0.8f || val4.z > 0.8f; if (!(flag2 && flag3 && flag4)) { continue; } string text = (((Object)val).name ?? "").ToLowerInvariant(); bool flag5 = false; for (int j = 0; j < array.Length; j++) { if (text.Contains(array[j])) { flag5 = true; break; } } if (flag5) { continue; } GameObject gameObject = ((Component)val).gameObject; Surface val5 = gameObject.GetComponent(); if ((Object)(object)val5 == (Object)null) { val5 = gameObject.AddComponent(); } val5.SurfaceType = (ESurfaceType)0; List val6 = new List(); val6.Add((EFace)0); val6.Add((EFace)1); val6.Add((EFace)4); val6.Add((EFace)5); val5.ValidFaces = val6; val5.ParentProperty = ownedProp; string text2 = GoPath(gameObject); bounds = val.bounds; string text3 = Md5Guid("Triads_Wall_" + text2 + "_" + RoundV(((Bounds)(ref bounds)).center)); int num5 = 0; while (hashSet.Contains(text3)) { num5++; text3 = Md5Guid("Triads_Wall_" + GoPath(gameObject) + "#" + num5); } hashSet.Add(text3); try { if (!IsGuidRegistered(text3)) { val5.SetGUID(new Guid(text3)); } } catch { } list.Add(val5); num4++; } NDLog.Warn($"[WALLS] '{((Object)buildingRoot).name}': tagged {num4} walls (of {num} solid colliders; {num2} box, {num3} mesh). " + ((num4 <= 2 && num3 > 0) ? "LOW — building likely uses one combined mesh collider; proxy-wall fallback needed." : "ok.")); } catch (Exception ex) { NDLog.DebugWarn("MakeBuildingWallsBuildable: " + ex.Message); } return list; } private static string Md5Guid(string seed) { using MD5 mD = MD5.Create(); return new Guid(mD.ComputeHash(Encoding.UTF8.GetBytes(seed))).ToString(); } private static string GoPath(GameObject go) { StringBuilder stringBuilder = new StringBuilder(((Object)go).name); Transform parent = go.transform.parent; int num = 0; while ((Object)(object)parent != (Object)null && num++ < 12) { stringBuilder.Insert(0, ((Object)parent).name + "/"); parent = parent.parent; } return stringBuilder.ToString(); } private static string RoundV(Vector3 v) { //IL_0008: 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_0050: Unknown result type (might be due to invalid IL or missing references) return Mathf.Round(v.x * 10f) + "_" + Mathf.Round(v.y * 10f) + "_" + Mathf.Round(v.z * 10f); } public static Mesh BuildMesh(Vector3[] verts, int[] tris, Vector3[] normals) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0019: 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) Mesh val = new Mesh(); Il2CppStructArray val2 = new Il2CppStructArray((long)verts.Length); for (int i = 0; i < verts.Length; i++) { ((Il2CppArrayBase)(object)val2)[i] = verts[i]; } val.vertices = val2; Il2CppStructArray val3 = new Il2CppStructArray((long)tris.Length); for (int j = 0; j < tris.Length; j++) { ((Il2CppArrayBase)(object)val3)[j] = tris[j]; } val.triangles = val3; if (normals != null) { Il2CppStructArray val4 = new Il2CppStructArray((long)normals.Length); for (int k = 0; k < normals.Length; k++) { ((Il2CppArrayBase)(object)val4)[k] = normals[k]; } val.normals = val4; } val.RecalculateBounds(); return val; } } }