Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TrollPack v1.0.4
Trollpack.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using TrollPack.Mods; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; 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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Trollpack")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Trollpack")] [assembly: AssemblyTitle("Trollpack")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace TrollPack { [BepInPlugin("com.palmstudio.trollpack", "Mod TrollPack REPO", "1.0.4")] public class MainPlugin : BaseUnityPlugin { [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class CursorVisiblePatch { [HarmonyPrefix] private static bool Prefix(bool value) { if ((Object)(object)TrollPanelManager.Instance != (Object)null && TrollPanelManager.Instance.isPanelOpen && !value) { return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] private class CursorLockPatch { [HarmonyPrefix] private static bool Prefix(CursorLockMode value) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 if ((Object)(object)TrollPanelManager.Instance != (Object)null && TrollPanelManager.Instance.isPanelOpen && (int)value == 1) { return false; } return true; } } public static AssetBundle SfxBundle; public static AudioClip FartSound; public static AudioClip SadTromboneSound; public static AudioClip BuzzerSound; public static AudioClip MimicCallsSound; public static GameObject ControlPanelPrefab; public static GameObject ControlPanelInstance; public static GameObject ModCardEntitySpawnerPrefab; public static ConfigEntry<bool> FakeEnabled; public static ConfigEntry<float> FakePercent; private Harmony harmony; private void Awake() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown InitializeConfig(); LoadAssetBundle(); SceneManager.sceneLoaded += OnSceneLoaded; harmony = new Harmony("com.palmstudio.trollpack"); harmony.PatchAll(); Debug.Log((object)"[TrollPack] Plugin berhasil diinisialisasi."); } private void InitializeConfig() { FakeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Fake Valuable", "Enabled", true, "Mengaktifkan atau menonaktifkan Fake Valuable."); FakePercent = ((BaseUnityPlugin)this).Config.Bind<float>("Fake Valuable", "FakePercent", 0.3f, "Peluang item menjadi palsu (0 - 1)."); } private void LoadAssetBundle() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "trollpacksfx"); if (!File.Exists(text)) { Debug.LogWarning((object)("[TrollPack] Asset Bundle tidak ditemukan: " + text)); return; } SfxBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)SfxBundle == (Object)null) { Debug.LogError((object)"[TrollPack] Gagal memuat Asset Bundle."); return; } Debug.Log((object)"[TrollPack] Asset Bundle berhasil dimuat."); FartSound = SfxBundle.LoadAsset<AudioClip>("sfx_fart.mp3"); SadTromboneSound = SfxBundle.LoadAsset<AudioClip>("sfx_sad_trombone.mp3"); BuzzerSound = SfxBundle.LoadAsset<AudioClip>("sfx_klakson"); MimicCallsSound = SfxBundle.LoadAsset<AudioClip>("sfx_mimic_calls.mp3"); ControlPanelPrefab = SfxBundle.LoadAsset<GameObject>("TrollPackControlPanel"); if ((Object)(object)BuzzerSound == (Object)null) { Debug.LogWarning((object)"[TrollPack] BuzzerSound tidak ditemukan."); } if ((Object)(object)ControlPanelPrefab == (Object)null) { Debug.LogError((object)"[TrollPack] TrollPackControlPanel tidak ditemukan."); } else { Debug.Log((object)"[TrollPack] TrollPackControlPanel berhasil ditemukan."); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if ((Object)(object)ControlPanelInstance == (Object)null && (Object)(object)ControlPanelPrefab != (Object)null) { SpawnControlPanel(); } } private void SpawnControlPanel() { if (!((Object)(object)ControlPanelPrefab == (Object)null) && !((Object)(object)ControlPanelInstance != (Object)null)) { ControlPanelInstance = Object.Instantiate<GameObject>(ControlPanelPrefab); ((Object)ControlPanelInstance).name = "TrollPackControlPanel"; Object.DontDestroyOnLoad((Object)(object)ControlPanelInstance); SetupCanvas(); SetupManagers(); SetupEventSystem(); Debug.Log((object)"[TrollPack] Control Panel berhasil di-spawn."); } } private void SetupCanvas() { if ((Object)(object)ControlPanelInstance.GetComponent<GraphicRaycaster>() == (Object)null) { ControlPanelInstance.AddComponent<GraphicRaycaster>(); } Canvas component = ControlPanelInstance.GetComponent<Canvas>(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)"[TrollPack] Canvas tidak ditemukan pada Control Panel!"); return; } component.renderMode = (RenderMode)0; component.sortingOrder = 32000; } private void SetupManagers() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) TrollPanelManager orAddComponent = GetOrAddComponent<TrollPanelManager>(); GetOrAddComponent<TaxManWhispers>(); GetOrAddComponent<InvisibleFloorManager>(); GetOrAddComponent<EntitySpawner>(); GetOrAddComponent<ScreamMachine>(); orAddComponent.toggleHotkey = (KeyCode)289; if ((Object)(object)SfxBundle != (Object)null) { orAddComponent.modCardPrefab = SfxBundle.LoadAsset<GameObject>("ModCard"); if ((Object)(object)orAddComponent.modCardPrefab == (Object)null) { Debug.LogError((object)"[TrollPack] ModCard prefab tidak ditemukan!"); } else { Debug.Log((object)"[TrollPack] ModCard berhasil dimuat."); } } orAddComponent.modCardEntitySpawnerPrefab = SfxBundle.LoadAsset<GameObject>("ModCardEntitySpawner"); if ((Object)(object)orAddComponent.modCardEntitySpawnerPrefab == (Object)null) { Debug.LogError((object)"[TrollPack] ModCardEntitySpawner prefab tidak ditemukan!"); } else { Debug.Log((object)"[TrollPack] ModCardEntitySpawner berhasil dimuat."); } Transform val = ControlPanelInstance.transform.Find("PanelBackground"); if ((Object)(object)val != (Object)null) { orAddComponent.mainPanelObject = ((Component)val).gameObject; Debug.Log((object)"[TrollPack] Main Panel ditetapkan: PanelBackground"); } else { Debug.LogError((object)"[TrollPack] PanelBackground tidak ditemukan pada TrollPackControlPanel!"); } } private T GetOrAddComponent<T>() where T : Component { T val = ControlPanelInstance.GetComponent<T>(); if ((Object)(object)val == (Object)null) { val = ControlPanelInstance.AddComponent<T>(); } return val; } private void SetupEventSystem() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!((Object)(object)Object.FindObjectOfType<EventSystem>() != (Object)null)) { GameObject val = new GameObject("TrollPackEventSystem"); val.AddComponent<EventSystem>(); val.AddComponent<StandaloneInputModule>(); Object.DontDestroyOnLoad((Object)(object)val); } } } public static class ModConfigManager { private static readonly Dictionary<string, bool> modStates = new Dictionary<string, bool>(); public static bool IsEnabled(string modId) { if (!modStates.TryGetValue(modId, out var value)) { value = true; modStates[modId] = value; } return value; } public static void SetEnabled(string modId, bool enabled) { modStates[modId] = enabled; } } public class ModCard : MonoBehaviour { private class TogglePointerTest : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerClickHandler { public void OnPointerDown(PointerEventData eventData) { Debug.Log((object)"[TrollPack] TOGGLE POINTER DOWN"); } public void OnPointerClick(PointerEventData eventData) { Debug.Log((object)"[TrollPack] TOGGLE POINTER CLICK"); } } public TMP_Text modNameText; public TMP_Text modTaglineText; public Toggle modToggle; private Image toggleBackground; private Image toggleHandleImage; private RectTransform toggleHandle; private string modId; private readonly Color offBackgroundColor = Color32.op_Implicit(new Color32((byte)110, (byte)110, (byte)110, byte.MaxValue)); private readonly Color onBackgroundColor = Color32.op_Implicit(new Color32((byte)0, (byte)102, byte.MaxValue, byte.MaxValue)); private readonly Color offHandleColor = Color32.op_Implicit(new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue)); private readonly Color onHandleColor = Color32.op_Implicit(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue)); public void SetupCard(string id, string name, string tagline, bool isEnabled) { modId = id; FindUIComponents(); if ((Object)(object)modNameText != (Object)null) { modNameText.text = name; } else { Debug.LogWarning((object)("[TrollPack] ModName NULL: " + id)); } if ((Object)(object)modTaglineText != (Object)null) { modTaglineText.text = tagline; } else { Debug.LogWarning((object)("[TrollPack] ModTagline NULL: " + id)); } if ((Object)(object)modToggle == (Object)null) { Debug.LogError((object)("[TrollPack] Toggle NULL: " + id)); } else { SetupToggle(isEnabled); } } protected void FindUIComponents() { Debug.Log((object)("[TrollPack] Mencari UI ModCard: " + ((Object)((Component)this).gameObject).name)); Transform val = ((Component)this).transform.Find("MODCard"); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("[TrollPack] MODCard tidak ditemukan pada " + ((Object)((Component)this).gameObject).name)); return; } Transform val2 = val.Find("ModName"); if ((Object)(object)val2 != (Object)null) { modNameText = ((Component)val2).GetComponent<TMP_Text>(); } else { Debug.LogWarning((object)"[TrollPack] ModName tidak ditemukan."); } Transform val3 = val.Find("ModTagline"); if ((Object)(object)val3 != (Object)null) { modTaglineText = ((Component)val3).GetComponent<TMP_Text>(); } else { Debug.LogWarning((object)"[TrollPack] ModTagline tidak ditemukan."); } Transform val4 = val.Find("Toggle"); if ((Object)(object)val4 == (Object)null) { Debug.LogError((object)"[TrollPack] Toggle tidak ditemukan."); return; } modToggle = ((Component)val4).GetComponent<Toggle>(); if ((Object)(object)modToggle == (Object)null) { Debug.LogError((object)"[TrollPack] GameObject Toggle tidak memiliki komponen Toggle."); return; } Transform val5 = val4.Find("Background"); if ((Object)(object)val5 == (Object)null) { Debug.LogError((object)"[TrollPack] Background Toggle tidak ditemukan."); return; } toggleBackground = ((Component)val5).GetComponent<Image>(); if ((Object)(object)toggleBackground == (Object)null) { Debug.LogError((object)"[TrollPack] Background tidak memiliki Image."); } Transform val6 = val5.Find("Handle"); if ((Object)(object)val6 != (Object)null) { toggleHandle = ((Component)val6).GetComponent<RectTransform>(); toggleHandleImage = ((Component)val6).GetComponent<Image>(); } else { Debug.LogWarning((object)"[TrollPack] Handle tidak ditemukan."); } Debug.Log((object)("[TrollPack] UI ModCard berhasil ditemukan: Toggle=" + ((Object)modToggle).name + ", Background=" + ((Object)val5).name + ", Handle=" + (((Object)(object)val6 != (Object)null) ? ((Object)val6).name : "NULL"))); } protected void SetupToggle(bool isEnabled) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)("[TrollPack] Setup Toggle: " + modId)); ((Selectable)modToggle).interactable = true; ((Component)modToggle).gameObject.SetActive(true); Image val = ((Component)modToggle).GetComponent<Image>(); if ((Object)(object)val == (Object)null) { val = ((Component)modToggle).gameObject.AddComponent<Image>(); Debug.Log((object)("[TrollPack] Image raycast dibuat pada Toggle: " + modId)); } ((Graphic)val).color = new Color(1f, 1f, 1f, 0f); ((Graphic)val).raycastTarget = true; ((Selectable)modToggle).targetGraphic = (Graphic)(object)val; if ((Object)(object)toggleBackground != (Object)null) { ((Graphic)toggleBackground).raycastTarget = false; } if ((Object)(object)toggleHandleImage != (Object)null) { ((Graphic)toggleHandleImage).raycastTarget = false; } TogglePointerTest component = ((Component)modToggle).GetComponent<TogglePointerTest>(); if ((Object)(object)component == (Object)null) { ((Component)modToggle).gameObject.AddComponent<TogglePointerTest>(); } ((UnityEventBase)modToggle.onValueChanged).RemoveAllListeners(); modToggle.isOn = isEnabled; ((UnityEvent<bool>)(object)modToggle.onValueChanged).AddListener((UnityAction<bool>)OnToggleChanged); UpdateSwitchVisual(isEnabled); Debug.Log((object)("[TrollPack] Toggle siap: " + modId + " | " + $"IsOn={modToggle.isOn} | " + $"Interactable={((Selectable)modToggle).interactable} | " + $"Raycast={((Graphic)val).raycastTarget}")); } private void OnToggleChanged(bool value) { Debug.Log((object)("[TrollPack] TOGGLE EVENT -> " + modId + " = " + (value ? "ON" : "OFF"))); ModConfigManager.SetEnabled(modId, value); UpdateSwitchVisual(value); } private void UpdateSwitchVisual(bool isOn) { //IL_0034: 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_008f: 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) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0062: 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_0100: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)toggleBackground == (Object)null) { Debug.LogWarning((object)"[TrollPack] Toggle Background tidak ditemukan."); return; } ((Graphic)toggleBackground).color = (isOn ? onBackgroundColor : offBackgroundColor); if ((Object)(object)toggleHandleImage != (Object)null) { ((Graphic)toggleHandleImage).color = (isOn ? onHandleColor : offHandleColor); } if ((Object)(object)toggleHandle != (Object)null) { RectTransform rectTransform = ((Graphic)toggleBackground).rectTransform; Rect rect = rectTransform.rect; float width = ((Rect)(ref rect)).width; rect = toggleHandle.rect; float width2 = ((Rect)(ref rect)).width; float num = 2f; float num2 = (0f - (width - width2)) / 2f + num; float num3 = (width - width2) / 2f - num; Vector2 anchoredPosition = toggleHandle.anchoredPosition; anchoredPosition.x = (isOn ? num3 : num2); toggleHandle.anchoredPosition = anchoredPosition; } } } public class ModCardEntitySpawner : ModCard { private Button duckButton; private Button thinManButton; private Button elsaButton; private Button slowMouthButton; private Button tickButton; public void SetupEntitySpawnerCard(string id, string name, string tagline, bool isEnabled) { SetupCard(id, name, tagline, isEnabled); FindMonsterButtons(); SetupMonsterButtons(); } private void FindMonsterButtons() { duckButton = FindButton("DuckButton"); thinManButton = FindButton("ThinManButton"); elsaButton = FindButton("ElsaButton"); slowMouthButton = FindButton("SlowMouthButton"); tickButton = FindButton("TickButton"); } private Button FindButton(string buttonName) { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); Transform[] array = componentsInChildren; foreach (Transform val in array) { if (!(((Object)val).name != buttonName)) { Button component = ((Component)val).GetComponent<Button>(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)("[TrollPack] " + buttonName + " ditemukan, tetapi tidak memiliki Button component.")); return null; } return component; } } Debug.LogError((object)("[TrollPack] " + buttonName + " tidak ditemukan pada ModCardEntitySpawner.")); return null; } private void SetupMonsterButtons() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown if ((Object)(object)duckButton != (Object)null) { ((UnityEventBase)duckButton.onClick).RemoveAllListeners(); ((UnityEvent)duckButton.onClick).AddListener(new UnityAction(SpawnDuck)); } if ((Object)(object)thinManButton != (Object)null) { ((UnityEventBase)thinManButton.onClick).RemoveAllListeners(); ((UnityEvent)thinManButton.onClick).AddListener(new UnityAction(SpawnThinMan)); } if ((Object)(object)elsaButton != (Object)null) { ((UnityEventBase)elsaButton.onClick).RemoveAllListeners(); ((UnityEvent)elsaButton.onClick).AddListener(new UnityAction(SpawnElsa)); } if ((Object)(object)slowMouthButton != (Object)null) { ((UnityEventBase)slowMouthButton.onClick).RemoveAllListeners(); ((UnityEvent)slowMouthButton.onClick).AddListener(new UnityAction(SpawnSlowMouth)); } if ((Object)(object)tickButton != (Object)null) { ((UnityEventBase)tickButton.onClick).RemoveAllListeners(); ((UnityEvent)tickButton.onClick).AddListener(new UnityAction(SpawnTick)); } } private EntitySpawner GetSpawner() { EntitySpawner entitySpawner = Object.FindObjectOfType<EntitySpawner>(); if ((Object)(object)entitySpawner == (Object)null) { Debug.LogError((object)"[TrollPack] EntitySpawner tidak ditemukan."); } return entitySpawner; } private void SpawnMonster(string enemyName) { if (!ModConfigManager.IsEnabled("entity_spawner")) { Debug.LogWarning((object)"[TrollPack] EntitySpawner sedang OFF."); return; } EntitySpawner spawner = GetSpawner(); if (!((Object)(object)spawner == (Object)null)) { spawner.SpawnFromUI(enemyName); } } private void SpawnDuck() { SpawnMonster("Enemy - Duck"); } private void SpawnThinMan() { SpawnMonster("Enemy - Thin Man"); } private void SpawnElsa() { SpawnMonster("Enemy - Elsa"); } private void SpawnSlowMouth() { SpawnMonster("Enemy - Slow Mouth"); } private void SpawnTick() { SpawnMonster("Enemy - Tick"); } } public class TrollPanelManager : MonoBehaviour { private struct ModData { public string id; public string name; public string tagline; public ModData(string id, string name, string tagline) { this.id = id; this.name = name; this.tagline = tagline; } } [Header("UI References")] public GameObject mainPanelObject; public GameObject modCardPrefab; public GameObject modCardEntitySpawnerPrefab; [Header("Settings")] public KeyCode toggleHotkey = (KeyCode)289; private int currentPage = 0; private const int totalPages = 2; private GameObject page01; private GameObject page02; private Button previousButton; private Button nextButton; private Button resetButton; private Button confirmButton; private Button closeButton; private TMP_Text pageText; private readonly List<ModData> modList = new List<ModData> { new ModData("fake_valuable", "FakeValuable", "Kerja keras. Hasil nol."), new ModData("taxman_whispers", "TaxManWhispers", "Perintah rahasia hanya untukmu."), new ModData("invisible_floor", "InvisibleFloor", "Lantai itu opsional."), new ModData("scream_machine", "ScreamMachine", "Diam itu emas. Kamu tidak punya emas."), new ModData("entity_spawner", "EntitySpawner", "Kamu kira hanya ada satu? Surprise.\nKlik F1/F2/F3/F4/F5 untuk spawn monster\nAtau klik gambar yang ada pada panel ini.") }; public static TrollPanelManager Instance { get; private set; } public bool isPanelOpen { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void Start() { FindUI(); if ((Object)(object)mainPanelObject != (Object)null) { mainPanelObject.SetActive(false); isPanelOpen = false; } else { Debug.LogError((object)"[TrollPack] PanelBackground tidak ditemukan sebagai MainPanel!"); } } private void Update() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(toggleHotkey)) { ToggleControlPanel(); } } private void FindUI() { //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Expected O, but got Unknown //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Expected O, but got Unknown //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Expected O, but got Unknown //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Expected O, but got Unknown //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Expected O, but got Unknown Debug.Log((object)"[TrollPack] Mencari komponen UI..."); Transform val = ((Component)this).transform.Find("PanelBackground"); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"[TrollPack] PanelBackground tidak ditemukan!"); return; } mainPanelObject = ((Component)val).gameObject; Debug.Log((object)("[TrollPack] Main Panel ditemukan: " + ((Object)mainPanelObject).name)); Transform val2 = val.Find("PageContainer"); if ((Object)(object)val2 != (Object)null) { Debug.Log((object)"[TrollPack] PageContainer ditemukan."); Transform val3 = val2.Find("Page_01"); if ((Object)(object)val3 != (Object)null) { page01 = ((Component)val3).gameObject; Debug.Log((object)"[TrollPack] Page_01 ditemukan."); } else { Debug.LogError((object)"[TrollPack] Page_01 tidak ditemukan!"); } Transform val4 = val2.Find("Page_02"); if ((Object)(object)val4 != (Object)null) { page02 = ((Component)val4).gameObject; Debug.Log((object)"[TrollPack] Page_02 ditemukan."); } else { Debug.LogError((object)"[TrollPack] Page_02 tidak ditemukan!"); } } else { Debug.LogError((object)"[TrollPack] PageContainer tidak ditemukan!"); } Transform val5 = val.Find("PageNavigation"); if ((Object)(object)val5 != (Object)null) { Debug.Log((object)"[TrollPack] PageNavigation ditemukan."); Transform val6 = val5.Find("PreviousButton"); if ((Object)(object)val6 != (Object)null) { previousButton = ((Component)val6).GetComponent<Button>(); if ((Object)(object)previousButton != (Object)null) { Debug.Log((object)"[TrollPack] PreviousButton ditemukan."); } else { Debug.LogError((object)"[TrollPack] PreviousButton tidak memiliki Button component!"); } } else { Debug.LogError((object)"[TrollPack] PreviousButton tidak ditemukan!"); } Transform val7 = val5.Find("NextButton"); if ((Object)(object)val7 != (Object)null) { nextButton = ((Component)val7).GetComponent<Button>(); if ((Object)(object)nextButton != (Object)null) { Debug.Log((object)"[TrollPack] NextButton ditemukan."); } else { Debug.LogError((object)"[TrollPack] NextButton tidak memiliki Button component!"); } } else { Debug.LogError((object)"[TrollPack] NextButton tidak ditemukan!"); } pageText = ((Component)val5).GetComponentInChildren<TMP_Text>(true); if ((Object)(object)pageText != (Object)null) { Debug.Log((object)"[TrollPack] PageIndicator / TMP_Text ditemukan."); } else { Debug.LogError((object)"[TrollPack] TMP_Text PageIndicator tidak ditemukan!"); } } else { Debug.LogError((object)"[TrollPack] PageNavigation tidak ditemukan!"); } Transform val8 = val.Find("Header"); if ((Object)(object)val8 != (Object)null) { Debug.Log((object)"[TrollPack] Header ditemukan."); Transform val9 = val8.Find("CloseButton"); if ((Object)(object)val9 != (Object)null) { closeButton = ((Component)val9).GetComponent<Button>(); if ((Object)(object)closeButton != (Object)null) { Debug.Log((object)"[TrollPack] CloseButton ditemukan."); } else { Debug.LogError((object)"[TrollPack] CloseButton tidak memiliki Button component!"); } } else { Debug.LogError((object)"[TrollPack] CloseButton tidak ditemukan di dalam Header!"); } } else { Debug.LogError((object)"[TrollPack] Header tidak ditemukan!"); } Transform val10 = val.Find("ResetButton"); if ((Object)(object)val10 != (Object)null) { resetButton = ((Component)val10).GetComponent<Button>(); if ((Object)(object)resetButton != (Object)null) { Debug.Log((object)"[TrollPack] ResetButton ditemukan."); } else { Debug.LogError((object)"[TrollPack] ResetButton tidak memiliki Button component!"); } } else { Debug.LogError((object)"[TrollPack] ResetButton tidak ditemukan!"); } Transform val11 = val.Find("ConfirmButton"); if ((Object)(object)val11 != (Object)null) { confirmButton = ((Component)val11).GetComponent<Button>(); if ((Object)(object)confirmButton != (Object)null) { Debug.Log((object)"[TrollPack] ConfirmButton ditemukan."); } else { Debug.LogError((object)"[TrollPack] ConfirmButton tidak memiliki Button component!"); } } else { Debug.LogError((object)"[TrollPack] ConfirmButton tidak ditemukan!"); } if ((Object)(object)previousButton != (Object)null) { ((UnityEventBase)previousButton.onClick).RemoveAllListeners(); ((UnityEvent)previousButton.onClick).AddListener(new UnityAction(PreviousPage)); } if ((Object)(object)nextButton != (Object)null) { ((UnityEventBase)nextButton.onClick).RemoveAllListeners(); ((UnityEvent)nextButton.onClick).AddListener(new UnityAction(NextPage)); } if ((Object)(object)resetButton != (Object)null) { ((UnityEventBase)resetButton.onClick).RemoveAllListeners(); ((UnityEvent)resetButton.onClick).AddListener(new UnityAction(ResetMods)); } if ((Object)(object)confirmButton != (Object)null) { ((UnityEventBase)confirmButton.onClick).RemoveAllListeners(); ((UnityEvent)confirmButton.onClick).AddListener(new UnityAction(ConfirmChanges)); } if ((Object)(object)closeButton != (Object)null) { ((UnityEventBase)closeButton.onClick).RemoveAllListeners(); ((UnityEvent)closeButton.onClick).AddListener(new UnityAction(ClosePanel)); Debug.Log((object)"[TrollPack] CloseButton listener berhasil dipasang."); } Debug.Log((object)"[TrollPack] FindUI selesai."); } public void ToggleControlPanel() { if ((Object)(object)mainPanelObject == (Object)null) { Debug.LogError((object)"[TrollPack] PanelBackground tidak tersedia!"); return; } isPanelOpen = !isPanelOpen; mainPanelObject.SetActive(isPanelOpen); if (isPanelOpen) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; currentPage = 0; GeneratePages(); UpdatePage(); Debug.Log((object)"[TrollPack] Control Panel dibuka."); } else { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; Debug.Log((object)"[TrollPack] Control Panel ditutup."); } } private void ClosePanel() { if ((Object)(object)mainPanelObject == (Object)null) { Debug.LogError((object)"[TrollPack] PanelBackground tidak tersedia!"); return; } isPanelOpen = false; mainPanelObject.SetActive(false); Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; Debug.Log((object)"[TrollPack] Control Panel ditutup melalui CloseButton."); } private void GeneratePages() { if ((Object)(object)modCardPrefab == (Object)null) { Debug.LogError((object)"[TrollPack] ModCard prefab tidak ditemukan!"); return; } if ((Object)(object)page01 != (Object)null) { ClearPage(page01); CreateModCard(modList[0], page01); CreateModCard(modList[1], page01); CreateModCard(modList[2], page01); } else { Debug.LogError((object)"[TrollPack] Page_01 tidak ditemukan!"); } if ((Object)(object)page02 != (Object)null) { ClearPage(page02); CreateModCard(modList[3], page02); CreateModCard(modList[4], page02); } else { Debug.LogError((object)"[TrollPack] Page_02 tidak ditemukan!"); } } private void CreateModCard(ModData mod, GameObject page) { if ((Object)(object)page == (Object)null) { return; } if (mod.id == "entity_spawner") { if ((Object)(object)modCardEntitySpawnerPrefab == (Object)null) { Debug.LogError((object)"[TrollPack] ModCardEntitySpawner prefab tidak ditemukan."); return; } GameObject val = Object.Instantiate<GameObject>(modCardEntitySpawnerPrefab, page.transform); ModCardEntitySpawner modCardEntitySpawner = val.GetComponent<ModCardEntitySpawner>(); if ((Object)(object)modCardEntitySpawner == (Object)null) { modCardEntitySpawner = val.AddComponent<ModCardEntitySpawner>(); Debug.Log((object)"[TrollPack] ModCardEntitySpawner component berhasil ditambahkan otomatis."); } bool isEnabled = ModConfigManager.IsEnabled(mod.id); modCardEntitySpawner.SetupEntitySpawnerCard(mod.id, mod.name, mod.tagline, isEnabled); Debug.Log((object)"[TrollPack] ModCardEntitySpawner berhasil dibuat."); } else if ((Object)(object)modCardPrefab == (Object)null) { Debug.LogError((object)"[TrollPack] ModCard prefab tidak ditemukan."); } else { GameObject val2 = Object.Instantiate<GameObject>(modCardPrefab, page.transform); ModCard modCard = val2.GetComponent<ModCard>(); if ((Object)(object)modCard == (Object)null) { modCard = val2.AddComponent<ModCard>(); } bool isEnabled2 = ModConfigManager.IsEnabled(mod.id); modCard.SetupCard(mod.id, mod.name, mod.tagline, isEnabled2); Debug.Log((object)("[TrollPack] ModCard dibuat: " + mod.name)); } } private void ClearPage(GameObject page) { if (!((Object)(object)page == (Object)null)) { for (int num = page.transform.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)page.transform.GetChild(num)).gameObject); } } } private void PreviousPage() { if (currentPage > 0) { currentPage--; UpdatePage(); } } private void NextPage() { if (currentPage < 1) { currentPage++; UpdatePage(); } } private void UpdatePage() { if ((Object)(object)page01 != (Object)null) { page01.SetActive(currentPage == 0); } if ((Object)(object)page02 != (Object)null) { page02.SetActive(currentPage == 1); } if ((Object)(object)pageText != (Object)null) { pageText.text = $"{currentPage + 1}/{2}"; } if ((Object)(object)previousButton != (Object)null) { ((Selectable)previousButton).interactable = currentPage > 0; } if ((Object)(object)nextButton != (Object)null) { ((Selectable)nextButton).interactable = currentPage < 1; } } private void ResetMods() { Debug.Log((object)"[TrollPack] Reset semua mod."); foreach (ModData mod in modList) { ModConfigManager.SetEnabled(mod.id, enabled: true); } GeneratePages(); UpdatePage(); Debug.Log((object)"[TrollPack] Semua mod dikembalikan ke ON."); } private void ConfirmChanges() { Debug.Log((object)"[TrollPack] Perubahan mod dikonfirmasi."); ToggleControlPanel(); } } } namespace TrollPack.Patches { [HarmonyPatch(typeof(RoundDirector), "HaulCheck")] public class FakeValuableSoundPatch { [HarmonyPostfix] private static void Postfix(RoundDirector __instance) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!ModConfigManager.IsEnabled("fake_valuable") || __instance.dollarHaulList == null) { return; } foreach (GameObject dollarHaul in __instance.dollarHaulList) { if ((Object)(object)dollarHaul == (Object)null || !((Object)dollarHaul).name.Contains("_Fake")) { continue; } if ((Object)(object)MainPlugin.BuzzerSound != (Object)null) { AudioSource.PlayClipAtPoint(MainPlugin.BuzzerSound, dollarHaul.transform.position); } break; } } } [HarmonyPatch(typeof(LevelGenerator), "GenerateDone")] public class InvisibleFloorPatch { [HarmonyPostfix] private static void Postfix() { if (ModConfigManager.IsEnabled("invisible_floor")) { InvisibleFloorManager invisibleFloorManager = Object.FindObjectOfType<InvisibleFloorManager>(); if ((Object)(object)invisibleFloorManager == (Object)null) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Manager tidak ditemukan."); return; } Debug.Log((object)"[TrollPack] InvisibleFloor: GenerateDone terdeteksi."); invisibleFloorManager.OnLevelGenerated(); } } } [HarmonyPatch(typeof(PlayerTumble), "BreakImpact")] public class InvisibleFloorFallDamagePatch { [HarmonyPrefix] private static bool Prefix() { if (!ModConfigManager.IsEnabled("invisible_floor")) { return true; } if (InvisibleFloorManager.ShouldBlockNativeFallDamage()) { return false; } return true; } } [HarmonyPatch] public static class ThinManEnemyOnScreenPatch { private static readonly FieldInfo EnemyField = AccessTools.Field(typeof(EnemyThinMan), "enemy"); private static readonly FieldInfo OnScreenField = AccessTools.Field(typeof(Enemy), "OnScreen"); private static readonly FieldInfo OnScreenPlayerField = AccessTools.Field(typeof(EnemyOnScreen), "OnScreenPlayer"); private static readonly FieldInfo CulledPlayerField = AccessTools.Field(typeof(EnemyOnScreen), "CulledPlayer"); [HarmonyPatch(typeof(EnemyThinMan), "StateStand")] [HarmonyPrefix] private static void StateStandPrefix(EnemyThinMan __instance) { EnsurePlayerKeys(__instance); } [HarmonyPatch(typeof(EnemyThinMan), "StateOnScreen")] [HarmonyPrefix] private static void StateOnScreenPrefix(EnemyThinMan __instance) { EnsurePlayerKeys(__instance); } [HarmonyPatch(typeof(EnemyThinMan), "Awake")] [HarmonyPostfix] private static void AwakePostfix(EnemyThinMan __instance) { EnsurePlayerKeys(__instance); } private static void EnsurePlayerKeys(EnemyThinMan thinMan) { if ((Object)(object)thinMan == (Object)null) { return; } try { if ((Object)(object)GameDirector.instance == (Object)null || GameDirector.instance.PlayerList == null) { return; } Enemy val = (Enemy)((EnemyField != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val == (Object)null) { return; } EnemyOnScreen val2 = (EnemyOnScreen)((OnScreenField != null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val2 == (Object)null) { return; } Dictionary<int, bool> dictionary = GetDictionary(OnScreenPlayerField, val2); Dictionary<int, bool> dictionary2 = GetDictionary(CulledPlayerField, val2); if (dictionary == null && dictionary2 == null) { return; } foreach (PlayerAvatar player in GameDirector.instance.PlayerList) { if ((Object)(object)player == (Object)null) { continue; } PhotonView component = ((Component)player).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { continue; } int viewID = component.ViewID; if (viewID > 0) { if (dictionary != null && !dictionary.ContainsKey(viewID)) { dictionary.Add(viewID, value: false); Debug.Log((object)("[TrollPack] Thin Man EnemyOnScreen registered player " + $"ViewID={viewID}.")); } if (dictionary2 != null && !dictionary2.ContainsKey(viewID)) { dictionary2.Add(viewID, value: false); } } } } catch (Exception ex) { Debug.LogError((object)("[TrollPack] Gagal memperbaiki Thin Man EnemyOnScreen: " + ex)); } } private static Dictionary<int, bool> GetDictionary(FieldInfo field, EnemyOnScreen onScreen) { if (field == null || (Object)(object)onScreen == (Object)null) { return null; } try { return field.GetValue(onScreen) as Dictionary<int, bool>; } catch { return null; } } } } namespace TrollPack.Mods { public class EntitySpawner : MonoBehaviourPunCallbacks { private const float SpawnDistance = 3f; private void Awake() { } private void OnEnable() { EntitySpawnerPlayerRPC.EnsurePlayerHandlers(); } public override void OnJoinedRoom() { EntitySpawnerPlayerRPC.EnsurePlayerHandlers(); } public override void OnPlayerEnteredRoom(Player newPlayer) { EntitySpawnerPlayerRPC.EnsurePlayerHandlers(); } private void Update() { if (ModConfigManager.IsEnabled("entity_spawner") && IsGameplayActive()) { EntitySpawnerPlayerRPC.EnsurePlayerHandlers(); if (Input.GetKeyDown((KeyCode)282)) { SpawnEnemy("Enemy - Duck"); } if (Input.GetKeyDown((KeyCode)283)) { SpawnEnemy("Enemy - Thin Man"); } if (Input.GetKeyDown((KeyCode)284)) { SpawnEnemy("Enemy - Elsa"); } if (Input.GetKeyDown((KeyCode)285)) { SpawnEnemy("Enemy - Slow Mouth"); } if (Input.GetKeyDown((KeyCode)286)) { SpawnEnemy("Enemy - Tick"); } } } public void SpawnFromUI(string enemyName) { SpawnEnemy(enemyName); } private void SpawnEnemy(string enemyName) { //IL_006c: 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_0072: 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_00ce: 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) if (!ModConfigManager.IsEnabled("entity_spawner") || !IsGameplayActive()) { return; } if (string.IsNullOrEmpty(enemyName)) { Debug.LogError((object)"[TrollPack] Nama enemy kosong."); return; } Transform localPlayer = GetLocalPlayer(); if ((Object)(object)localPlayer == (Object)null) { Debug.LogError((object)"[TrollPack] Player lokal tidak ditemukan."); return; } Vector3 spawnPosition = GetSpawnPosition(localPlayer); if (spawnPosition == Vector3.zero) { return; } if (!PhotonNetwork.InRoom) { EnemySetup enemySetup = GetEnemySetup(enemyName); if ((Object)(object)enemySetup == (Object)null) { Debug.LogError((object)("[TrollPack] Enemy tidak ditemukan: " + enemyName)); } else { SpawnSinglePlayer(enemySetup, spawnPosition); } } else { SpawnMultiplayer(enemyName, spawnPosition, localPlayer); } } private Transform GetLocalPlayer() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if (!((Object)(object)val == (Object)null)) { PhotonView component = ((Component)val).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && component.IsMine) { return ((Component)val).transform; } } } if (!PhotonNetwork.InRoom && array.Length != 0) { PlayerAvatar[] array3 = array; foreach (PlayerAvatar val2 in array3) { if ((Object)(object)val2 != (Object)null) { return ((Component)val2).transform; } } } return null; } private Vector3 GetSpawnPosition(Transform player) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_0077: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return Vector3.zero; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { Debug.LogError((object)"[TrollPack] Main Camera tidak ditemukan."); return Vector3.zero; } Vector3 forward = ((Component)main).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = player.forward; forward.y = 0f; } if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { Debug.LogError((object)"[TrollPack] Arah spawn player tidak valid."); return Vector3.zero; } ((Vector3)(ref forward)).Normalize(); Vector3 result = player.position + forward * 3f; result.y = player.position.y; return result; } private void SpawnMultiplayer(string enemyName, Vector3 position, Transform localPlayer) { //IL_001c: 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) if (!PhotonNetwork.InRoom) { return; } if (PhotonNetwork.IsMasterClient) { SpawnEnemyOnHost(enemyName, position); return; } PhotonView component = ((Component)localPlayer).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)"[TrollPack] PhotonView PlayerAvatar lokal tidak ditemukan. Client tidak dapat mengirim spawn request."); return; } EntitySpawnerPlayerRPC entitySpawnerPlayerRPC = ((Component)localPlayer).GetComponent<EntitySpawnerPlayerRPC>(); if ((Object)(object)entitySpawnerPlayerRPC == (Object)null) { entitySpawnerPlayerRPC = ((Component)localPlayer).gameObject.AddComponent<EntitySpawnerPlayerRPC>(); } entitySpawnerPlayerRPC.SendSpawnRequest(enemyName, position); } private void SpawnSinglePlayer(EnemySetup setup, Vector3 position) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)setup == (Object)null)) { if ((Object)(object)LevelGenerator.Instance == (Object)null) { Debug.LogError((object)"[TrollPack] LevelGenerator NULL."); return; } DirectSpawnPatch.RegisterSpawnPosition(position); LevelGenerator.Instance.EnemySpawn(setup, position); Debug.Log((object)("[TrollPack] Single-player spawn: " + ((Object)setup).name)); } } public void SpawnEnemyOnHost(string enemyName, Vector3 position) { //IL_006c: 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_0090: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient && IsGameplayActive()) { EnemySetup enemySetup = GetEnemySetup(enemyName); if ((Object)(object)enemySetup == (Object)null) { Debug.LogError((object)("[TrollPack] Enemy tidak ditemukan: " + enemyName)); return; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { Debug.LogError((object)"[TrollPack] LevelGenerator NULL."); return; } DirectSpawnPatch.RegisterSpawnPosition(position); LevelGenerator.Instance.EnemySpawn(enemySetup, position); Debug.Log((object)("[TrollPack] Host spawn: " + enemyName + " " + $"at {position}")); } } private EnemySetup GetEnemySetup(string enemyName) { EnemyDirector instance = EnemyDirector.instance; if ((Object)(object)instance == (Object)null) { Debug.LogError((object)"[TrollPack] EnemyDirector NULL."); return null; } if (instance.enemiesDifficulty1 == null) { Debug.LogError((object)"[TrollPack] enemiesDifficulty1 NULL."); return null; } return instance.enemiesDifficulty1.Find((EnemySetup x) => (Object)(object)x != (Object)null && ((Object)x).name == enemyName); } private bool IsGameplayActive() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 if ((Object)(object)GameDirector.instance == (Object)null) { return false; } if ((int)GameDirector.instance.currentState != 2) { return false; } if (SemiFunc.RunIsLobbyMenu()) { return false; } PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null) { return false; } if ((Object)(object)EnemyDirector.instance == (Object)null) { return false; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { return false; } return true; } } public class EntitySpawnerPlayerRPC : MonoBehaviourPun { private static EntitySpawner GetEntitySpawner() { EntitySpawner entitySpawner = Object.FindObjectOfType<EntitySpawner>(); if ((Object)(object)entitySpawner == (Object)null) { Debug.LogError((object)"[TrollPack] EntitySpawner tidak ditemukan."); return null; } return entitySpawner; } public static void EnsurePlayerHandlers() { PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val == (Object)null) { continue; } PhotonView component = ((Component)val).GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null)) { EntitySpawnerPlayerRPC component2 = ((Component)val).GetComponent<EntitySpawnerPlayerRPC>(); if ((Object)(object)component2 == (Object)null) { ((Component)val).gameObject.AddComponent<EntitySpawnerPlayerRPC>(); Debug.Log((object)("[TrollPack] EntitySpawner RPC handler dipasang pada PlayerAvatar " + $"Actor {component.OwnerActorNr}.")); } } } } public void SendSpawnRequest(string enemyName, Vector3 spawnPosition) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.InRoom) { PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)"[TrollPack] PhotonView PlayerAvatar tidak ditemukan."); return; } if (!component.IsMine) { Debug.LogWarning((object)"[TrollPack] Mencoba mengirim spawn request menggunakan PlayerAvatar yang bukan milik client."); return; } if (string.IsNullOrEmpty(enemyName)) { Debug.LogError((object)"[TrollPack] Spawn request memiliki nama enemy kosong."); return; } Debug.Log((object)("[TrollPack] Mengirim spawn request '" + enemyName + "' ke MasterClient...")); component.RPC("RequestSpawnMonster", (RpcTarget)2, new object[2] { enemyName, spawnPosition }); } } [PunRPC] public void RequestSpawnMonster(string enemyName, Vector3 spawnPosition, PhotonMessageInfo info) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_00a5: 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_00b5: 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_00fb: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient) { return; } if (string.IsNullOrEmpty(enemyName)) { Debug.LogWarning((object)"[TrollPack] Request spawn menerima enemyName kosong."); } else if (float.IsNaN(spawnPosition.x) || float.IsNaN(spawnPosition.y) || float.IsNaN(spawnPosition.z) || float.IsInfinity(spawnPosition.x) || float.IsInfinity(spawnPosition.y) || float.IsInfinity(spawnPosition.z)) { Debug.LogWarning((object)"[TrollPack] Spawn request memiliki posisi tidak valid."); } else if (IsGameplayActive()) { int num = -1; if (info.Sender != null) { num = info.Sender.ActorNumber; } Debug.Log((object)("[TrollPack] Host menerima spawn request " + $"dari actor {num}: {enemyName}")); EntitySpawner entitySpawner = GetEntitySpawner(); if (!((Object)(object)entitySpawner == (Object)null)) { entitySpawner.SpawnEnemyOnHost(enemyName, spawnPosition); } } } private bool IsGameplayActive() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 if (!PhotonNetwork.InRoom) { return false; } if ((Object)(object)GameDirector.instance == (Object)null) { return false; } if ((int)GameDirector.instance.currentState != 2) { return false; } if (SemiFunc.RunIsLobbyMenu()) { return false; } if ((Object)(object)PlayerController.instance == (Object)null) { return false; } if ((Object)(object)EnemyDirector.instance == (Object)null) { return false; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { return false; } return true; } } [HarmonyPatch(typeof(ValuableObject))] public class FakeValuablePatch { public static bool Enabled => MainPlugin.FakeEnabled.Value; public static float FakePercent => MainPlugin.FakePercent.Value; [HarmonyPatch("Start")] [HarmonyPostfix] private static void Postfix(ValuableObject __instance) { if (ModConfigManager.IsEnabled("fake_valuable") && Enabled && !(Random.value >= FakePercent)) { FieldInfo field = typeof(ValuableObject).GetField("dollarValueCurrent", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { Debug.LogError((object)"[TrollPack] FakeValuable: field dollarValueCurrent tidak ditemukan!"); return; } float num = (float)field.GetValue(__instance); field.SetValue(__instance, 0f); GameObject gameObject = ((Component)__instance).gameObject; ((Object)gameObject).name = ((Object)gameObject).name + "_Fake"; Debug.Log((object)("[TrollPack] FakeValuable: '" + ((Object)((Component)__instance).gameObject).name + "' " + $"diubah menjadi Rp 0 (nilai awal: Rp {num}).")); } } } public class InvisibleFloorManager : MonoBehaviourPunCallbacks, IOnEventCallback { private const byte EventCodeRequestFloor = 50; private const byte EventCodeSetFloor = 51; public static float FallDamage = 20f; private const float FallDetectionY = -15f; private const float SafeY = -5f; private const float RescueCooldownDuration = 1.5f; private static readonly string[] FloorKeywords = new string[19] { "floor", "tile", "ground", "platform", "walkable", "walkway", "deck", "terrain", "base", "bridge", "road", "path", "plank", "woodfloor", "wood_floor", "metalfloor", "metal_floor", "concrete", "flooring" }; private static readonly string[] ExcludedFloorKeywords = new string[26] { "wall", "ceiling", "roof", "door", "window", "pillar", "column", "beam", "frame", "stairs", "stair", "ladder", "railing", "rail", "fence", "prop", "crate", "box", "table", "chair", "enemy", "player", "item", "loot", "trigger", "volume" }; private bool isRescuing = false; private bool spawnPositionSaved = false; private Vector3 safeSpawnPosition; private Quaternion safeSpawnRotation; private float rescueCooldown = 0f; private bool isGameplayScene = false; private Collider activeInvisibleFloor; private bool previousEnabledState = false; private int synchronizedModuleIndex = -1; private int synchronizedFloorIndex = -1; private bool synchronizedFloorReceived = false; private int currentLevelId = 0; private bool floorRequestSent = false; public static bool IsFallDamageSuppressed { get; private set; } public static bool ShouldBlockNativeFallDamage() { if (!ModConfigManager.IsEnabled("invisible_floor")) { return false; } return IsFallDamageSuppressed; } private void Awake() { PhotonNetwork.AddCallbackTarget((object)this); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.activeSceneChanged += OnActiveSceneChanged; CheckCurrentScene(); previousEnabledState = ModConfigManager.IsEnabled("invisible_floor"); } private void OnDestroy() { PhotonNetwork.RemoveCallbackTarget((object)this); SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.activeSceneChanged -= OnActiveSceneChanged; RestoreInvisibleFloor(); ResetInvisibleFloorState(); activeInvisibleFloor = null; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { CheckCurrentScene(); ResetLevelFloorSelection(); } private void OnActiveSceneChanged(Scene oldScene, Scene newScene) { CheckCurrentScene(); if (!isGameplayScene) { ResetLevelFloorSelection(); } } private void CheckCurrentScene() { bool flag = SemiFunc.RunIsLevel(); if (flag != isGameplayScene) { isGameplayScene = flag; if (!isGameplayScene) { RestoreInvisibleFloor(); ResetInvisibleFloorState(); previousEnabledState = false; activeInvisibleFloor = null; ResetLevelFloorSelection(); } } } private void ResetLevelFloorSelection() { synchronizedModuleIndex = -1; synchronizedFloorIndex = -1; synchronizedFloorReceived = false; floorRequestSent = false; activeInvisibleFloor = null; currentLevelId++; } private void ResetInvisibleFloorState() { isRescuing = false; spawnPositionSaved = false; rescueCooldown = 0f; IsFallDamageSuppressed = false; } private void RestoreInvisibleFloor() { if (!((Object)(object)activeInvisibleFloor == (Object)null) && !((Object)(object)((Component)activeInvisibleFloor).gameObject == (Object)null)) { activeInvisibleFloor.enabled = true; } } private void Update() { //IL_0128: 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_019c: Unknown result type (might be due to invalid IL or missing references) CheckCurrentScene(); CheckToggleState(); if (!ModConfigManager.IsEnabled("invisible_floor") || !isGameplayScene) { return; } if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode && !PhotonNetwork.IsMasterClient && !synchronizedFloorReceived) { RequestFloorFromMaster(); return; } PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.playerAvatarScript == (Object)null) { return; } if (rescueCooldown > 0f) { rescueCooldown -= Time.deltaTime; IsFallDamageSuppressed = true; if (rescueCooldown <= 0f) { rescueCooldown = 0f; instance.playerAvatarScript.FallDamageResetSet(1f); IsFallDamageSuppressed = false; } } else if (!spawnPositionSaved) { if (((Component)instance).transform.position.y > -5f) { SaveSafePosition(instance); } } else if (isRescuing && ((Component)instance).transform.position.y > -5f) { isRescuing = false; rescueCooldown = 1.5f; } else if (!isRescuing && ((Component)instance).transform.position.y < -15f) { isRescuing = true; TriggerFallRescue(instance); } } private void CheckToggleState() { bool flag = ModConfigManager.IsEnabled("invisible_floor"); if (previousEnabledState && !flag) { RestoreInvisibleFloor(); IsFallDamageSuppressed = false; isRescuing = false; rescueCooldown = 0f; Debug.Log((object)"[TrollPack] InvisibleFloor: OFF"); LogSelectedFloor("FLOOR DIKEMBALIKAN NORMAL"); } if (!previousEnabledState && flag) { Debug.Log((object)"[TrollPack] InvisibleFloor: ON"); if (isGameplayScene) { if ((Object)(object)activeInvisibleFloor != (Object)null && (Object)(object)((Component)activeInvisibleFloor).gameObject != (Object)null) { activeInvisibleFloor.enabled = false; LogSelectedFloor("FLOOR YANG SAMA DIAKTIFKAN KEMBALI"); } else if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode) { if (PhotonNetwork.IsMasterClient) { SelectAndBroadcastFloor(); } else { RequestFloorFromMaster(); } } else { ApplyTrollFloorToCurrentLevel(); } } } previousEnabledState = flag; } public void OnLevelGenerated() { if (!isGameplayScene) { return; } activeInvisibleFloor = null; synchronizedModuleIndex = -1; synchronizedFloorIndex = -1; synchronizedFloorReceived = false; floorRequestSent = false; currentLevelId++; if (!ModConfigManager.IsEnabled("invisible_floor")) { return; } if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode) { if (PhotonNetwork.IsMasterClient) { SelectAndBroadcastFloor(); } else { RequestFloorFromMaster(); } } else { ApplyTrollFloorToCurrentLevel(); } } private void SelectAndBroadcastFloor() { if (!PhotonNetwork.IsMasterClient || !isGameplayScene || !ModConfigManager.IsEnabled("invisible_floor")) { return; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: LevelGenerator belum tersedia."); return; } if ((Object)(object)LevelGenerator.Instance.LevelParent == (Object)null) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: LevelParent belum tersedia."); return; } List<Transform> modules = GetModules(LevelGenerator.Instance.LevelParent); if (modules.Count == 0) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Tidak ada Module/Room."); return; } List<int> list = new List<int>(); for (int i = 0; i < modules.Count; i++) { List<Collider> floorColliders = GetFloorColliders(((Component)modules[i]).gameObject); if (floorColliders.Count > 0) { list.Add(i); } } if (list.Count == 0) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Tidak ada Room/Module yang memiliki collider floor yang valid."); return; } int index = Random.Range(0, list.Count); int num = list[index]; Transform val = modules[num]; List<Collider> floorColliders2 = GetFloorColliders(((Component)val).gameObject); if (floorColliders2.Count == 0) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Floor valid tidak ditemukan."); return; } int num2 = Random.Range(0, floorColliders2.Count); synchronizedModuleIndex = num; synchronizedFloorIndex = num2; synchronizedFloorReceived = true; ApplySynchronizedFloor(num, num2); LogFloorSelection("MASTER MEMILIH FLOOR", val, floorColliders2[num2], num, num2); SendSetFloorEvent(num, num2, currentLevelId, 0); Debug.Log((object)"[TrollPack] InvisibleFloor: Pilihan floor dikirim ke Client."); } private void RequestFloorFromMaster() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.InRoom && !PhotonNetwork.OfflineMode && !floorRequestSent) { floorRequestSent = true; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)2 }; PhotonNetwork.RaiseEvent((byte)50, (object)null, val, SendOptions.SendReliable); } } private void MasterReceivedFloorRequest(int requesterActorNumber) { if (PhotonNetwork.IsMasterClient && PhotonNetwork.CurrentRoom != null && PhotonNetwork.CurrentRoom.Players.ContainsKey(requesterActorNumber)) { if (!synchronizedFloorReceived || synchronizedModuleIndex < 0 || synchronizedFloorIndex < 0) { SelectAndBroadcastFloor(); } else { SendSetFloorEvent(synchronizedModuleIndex, synchronizedFloorIndex, currentLevelId, requesterActorNumber); } } } private void SendSetFloorEvent(int moduleIndex, int floorIndex, int levelId, int targetActorNumber) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) object[] array = new object[3] { moduleIndex, floorIndex, levelId }; object obj; if (targetActorNumber == 0) { obj = (object)new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; } else { RaiseEventOptions val = new RaiseEventOptions(); val.TargetActors = new int[1] { targetActorNumber }; obj = val; } RaiseEventOptions val2 = (RaiseEventOptions)obj; PhotonNetwork.RaiseEvent((byte)51, (object)array, val2, SendOptions.SendReliable); } public void OnEvent(EventData photonEvent) { switch (photonEvent.Code) { case 50: if (PhotonNetwork.IsMasterClient) { MasterReceivedFloorRequest(photonEvent.Sender); } break; case 51: { object[] array = (object[])photonEvent.CustomData; if (array == null || array.Length < 3) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Data event SetFloor tidak lengkap."); break; } int moduleIndex = (int)array[0]; int floorIndex = (int)array[1]; ApplySynchronizedFloor(moduleIndex, floorIndex); break; } } } public void ApplySynchronizedFloor(int moduleIndex, int floorIndex) { if (!isGameplayScene || !ModConfigManager.IsEnabled("invisible_floor") || (Object)(object)LevelGenerator.Instance == (Object)null || (Object)(object)LevelGenerator.Instance.LevelParent == (Object)null) { return; } List<Transform> modules = GetModules(LevelGenerator.Instance.LevelParent); if (moduleIndex < 0 || moduleIndex >= modules.Count) { Debug.LogError((object)("[TrollPack] InvisibleFloor: Module index tidak valid = " + moduleIndex)); return; } Transform val = modules[moduleIndex]; List<Collider> floorColliders = GetFloorColliders(((Component)val).gameObject); if (floorIndex < 0 || floorIndex >= floorColliders.Count) { Debug.LogError((object)("[TrollPack] InvisibleFloor: Floor index tidak valid = " + floorIndex)); return; } Collider val2 = floorColliders[floorIndex]; if ((Object)(object)activeInvisibleFloor != (Object)null && (Object)(object)activeInvisibleFloor != (Object)(object)val2) { activeInvisibleFloor.enabled = true; } activeInvisibleFloor = val2; synchronizedModuleIndex = moduleIndex; synchronizedFloorIndex = floorIndex; synchronizedFloorReceived = true; if (ModConfigManager.IsEnabled("invisible_floor")) { val2.enabled = false; } LogFloorSelection("FLOOR SYNC DITERIMA / DITERAPKAN", val, val2, moduleIndex, floorIndex); } private void ApplyTrollFloorToCurrentLevel() { if (!isGameplayScene || !ModConfigManager.IsEnabled("invisible_floor") || (Object)(object)LevelGenerator.Instance == (Object)null || (Object)(object)LevelGenerator.Instance.LevelParent == (Object)null) { return; } GameObject levelParent = LevelGenerator.Instance.LevelParent; List<Transform> modules = GetModules(levelParent); if (modules.Count == 0) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Tidak menemukan Module/Room."); return; } List<int> list = new List<int>(); for (int i = 0; i < modules.Count; i++) { List<Collider> floorColliders = GetFloorColliders(((Component)modules[i]).gameObject); if (floorColliders.Count > 0) { list.Add(i); } } if (list.Count == 0) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Tidak ada Room/Module yang memiliki floor."); return; } int index = Random.Range(0, list.Count); int num = list[index]; Transform val = modules[num]; List<Collider> floorColliders2 = GetFloorColliders(((Component)val).gameObject); if (floorColliders2.Count == 0) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Room valid tidak memiliki floor."); return; } int num2 = Random.Range(0, floorColliders2.Count); Collider val2 = (activeInvisibleFloor = floorColliders2[num2]); synchronizedModuleIndex = num; synchronizedFloorIndex = num2; synchronizedFloorReceived = true; val2.enabled = false; LogFloorSelection("SINGLE PLAYER - FLOOR TERPILIH", val, val2, num, num2); } private List<Transform> GetModules(GameObject levelParent) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown List<Transform> list = new List<Transform>(); if ((Object)(object)levelParent == (Object)null) { return list; } foreach (Transform item in levelParent.transform) { Transform val = item; if (!((Object)(object)val == (Object)null)) { string text = ((Object)val).name.ToLower(); if (!text.Contains("enemy") && !text.Contains("player") && !text.Contains("item") && !text.Contains("prop") && (text.Contains("module") || text.Contains("start room") || text.Contains("room") || text.Contains("level"))) { list.Add(val); } } } return list; } private List<Collider> GetFloorColliders(GameObject roomParent) { List<Collider> list = new List<Collider>(); if ((Object)(object)roomParent == (Object)null) { return list; } Collider[] componentsInChildren = roomParent.GetComponentsInChildren<Collider>(true); Collider[] array = componentsInChildren; foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && val.enabled && !IsExcludedCollider(val)) { string objectName = ((Object)((Component)val).gameObject).name.ToLower(); if (ContainsFloorKeyword(objectName) && !list.Contains(val)) { list.Add(val); } } } if (list.Count > 0) { return list; } List<Collider> list2 = new List<Collider>(); Collider[] array2 = componentsInChildren; foreach (Collider val2 in array2) { if (!((Object)(object)val2 == (Object)null) && val2.enabled && !IsExcludedCollider(val2) && IsLikelyFloorCollider(val2, roomParent)) { list2.Add(val2); } } list2.Sort(delegate(Collider a, Collider b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) Bounds bounds = a.bounds; Vector3 center = ((Bounds)(ref bounds)).center; ref float y = ref center.y; bounds = b.bounds; return y.CompareTo(((Bounds)(ref bounds)).center.y); }); foreach (Collider item in list2) { if (!list.Contains(item)) { list.Add(item); } } return list; } private bool ContainsFloorKeyword(string objectName) { if (string.IsNullOrEmpty(objectName)) { return false; } string[] floorKeywords = FloorKeywords; foreach (string value in floorKeywords) { if (objectName.Contains(value)) { return true; } } return false; } private bool IsExcludedCollider(Collider collider) { if ((Object)(object)collider == (Object)null) { return true; } string text = ((Object)((Component)collider).gameObject).name.ToLower(); string[] excludedFloorKeywords = ExcludedFloorKeywords; foreach (string value in excludedFloorKeywords) { if (text.Contains(value)) { return true; } } return false; } private bool IsLikelyFloorCollider(Collider collider, GameObject roomParent) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_0049: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00c8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)collider == (Object)null) { return false; } Bounds bounds = collider.bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num = size.x * size.z; if (num < 0.25f) { return false; } float num2 = Mathf.Max(size.x, size.z); if (num2 <= 0f) { return false; } float num3 = size.y / num2; if (num3 > 0.35f) { return false; } if (size.x < 0.5f && size.z < 0.5f) { return false; } if (size.x < 0.5f || size.z < 0.5f) { return false; } if (collider.isTrigger) { return false; } return true; } private string GetHierarchyPath(Transform target) { if ((Object)(object)target == (Object)null) { return "NULL"; } string text = ((Object)target).name; Transform parent = target.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + " -> " + text; parent = parent.parent; } return text; } private void LogFloorSelection(string title, Transform room, Collider floor, int moduleIndex, int floorIndex) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0104: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)room == (Object)null || (Object)(object)floor == (Object)null) { Debug.LogWarning((object)"[TrollPack] InvisibleFloor: Data floor tidak lengkap."); return; } Bounds bounds = floor.bounds; string[] obj = new string[25] { "\n====================================================\n[TrollPack] InvisibleFloor: ", title, "\n====================================================\nScene : ", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null }; Scene activeScene = SceneManager.GetActiveScene(); obj[3] = ((Scene)(ref activeScene)).name; obj[4] = "\nRoom / Module : "; obj[5] = ((Object)room).name; obj[6] = "\nFloor Object : "; obj[7] = ((Object)floor).name; obj[8] = "\nModule Index : "; obj[9] = moduleIndex.ToString(); obj[10] = "\nFloor Index : "; obj[11] = floorIndex.ToString(); obj[12] = "\nCollider Type : "; obj[13] = ((object)floor).GetType().Name; obj[14] = "\nIs Trigger : "; obj[15] = floor.isTrigger.ToString(); obj[16] = "\nEnabled : "; obj[17] = floor.enabled.ToString(); obj[18] = "\nPosition : "; obj[19] = ((object)((Component)floor).transform.position/*cast due to .constrained prefix*/).ToString(); obj[20] = "\nBounds Size : "; obj[21] = ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString(); obj[22] = "\nHierarchy : "; obj[23] = GetHierarchyPath(((Component)floor).transform); obj[24] = "\n===================================================="; Debug.Log((object)string.Concat(obj)); } private void LogSelectedFloor(string title) { //IL_003f: 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_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_00dc: 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) if ((Object)(object)activeInvisibleFloor == (Object)null) { Debug.Log((object)("[TrollPack] InvisibleFloor: " + title + " | Tidak ada floor tersimpan.")); return; } Transform transform = ((Component)activeInvisibleFloor).transform; Bounds bounds = activeInvisibleFloor.bounds; Debug.Log((object)("\n----------------------------------------------------\n[TrollPack] InvisibleFloor: " + title + "\nRoom / Module : " + GetRoomName(transform) + "\nFloor Object : " + ((Object)activeInvisibleFloor).name + "\nModule Index : " + synchronizedModuleIndex + "\nFloor Index : " + synchronizedFloorIndex + "\nPosition : " + ((object)transform.position/*cast due to .constrained prefix*/).ToString() + "\nBounds Size : " + ((object)((Bounds)(ref bounds)).size/*cast due to .constrained prefix*/).ToString() + "\nHierarchy : " + GetHierarchyPath(transform) + "\n----------------------------------------------------")); } private string GetRoomName(Transform floor) { if ((Object)(object)floor == (Object)null) { return "NULL"; } Transform parent = floor.parent; while ((Object)(object)parent != (Object)null) { string name = ((Object)parent).name; string text = name.ToLower(); if (text.Contains("module") || text.Contains("start room") || text.Contains("room") || text.Contains("level")) { return name; } parent = parent.parent; } return "Room tidak teridentifikasi"; } private void SaveSafePosition(PlayerController player) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) safeSpawnPosition = ((Component)player).transform.position; safeSpawnRotation = ((Component)player).transform.rotation; spawnPositionSaved = true; Debug.Log((object)"[TrollPack] InvisibleFloor: Posisi aman disimpan."); } private void TriggerFallRescue(PlayerController player) { //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"[TrollPack] InvisibleFloor: FALL RESCUE"); IsFallDamageSuppressed = true; if ((Object)(object)player.playerAvatarScript != (Object)null) { player.playerAvatarScript.FallDamageResetSet(1f); } PlayerHealth val = ((Component)player).GetComponent<PlayerHealth>(); if ((Object)(object)val == (Object)null && (Object)(object)player.playerAvatarScript != (Object)null) { val = ((Component)player.playerAvatarScript).GetComponent<PlayerHealth>(); } if ((Object)(object)val == (Object)null && (Object)(object)player.playerAvatarScript != (Object)null) { val = ((Component)player.playerAvatarScript).GetComponentInChildren<PlayerHealth>(); } if ((Object)(object)val != (Object)null) { val.Hurt((int)FallDamage, false, -1, false); Debug.Log((object)"[TrollPack] InvisibleFloor: Damage rescue = 20 HP."); } else { Debug.LogError((object)"[TrollPack] InvisibleFloor: PlayerHealth tidak ditemukan!"); } if ((Object)(object)player.playerAvatarScript != (Object)null) { PhysGrabber component = ((Component)player.playerAvatarScript).GetComponent<PhysGrabber>(); if ((Object)(object)component != (Object)null) { component.ReleaseObject(-1, 0.1f); Debug.Log((object)"[TrollPack] InvisibleFloor: Item dilepas."); } } if (!spawnPositionSaved) { Debug.LogError((object)"[TrollPack] InvisibleFloor: Posisi aman belum tersedia!"); isRescuing = false; IsFallDamageSuppressed = false; return; } CharacterController component2 = ((Component)player).GetComponent<CharacterController>(); if ((Object)(object)component2 != (Object)null) { ((Collider)component2).enabled = false; } ((Component)player).transform.position = safeSpawnPosition; ((Component)player).transform.rotation = safeSpawnRotation; if ((Object)(object)component2 != (Object)null) { ((Collider)component2).enabled = true; } Debug.Log((object)"[TrollPack] InvisibleFloor: Player dikembalikan ke posisi aman."); if ((Object)(object)player.playerAvatarScript != (Object)null) { player.playerAvatarScript.FallDamageResetSet(1f); } rescueCooldown = 1.5f; } } internal static class RunManagerReflection { private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary<string, MemberInfo> Cache = new Dictionary<string, MemberInfo>(); public static bool GetBool(object target, params string[] candidateNames) { if (GetMember(target, candidateNames) is bool result) { return result; } return false; } public static object GetMember(object target, params string[] candidateNames) { if (target == null) { return null; } Type type = target.GetType(); foreach (string text in candidateNames) { string key = type.FullName + "::" + text; if (!Cache.TryGetValue(key, out MemberInfo value)) { value = (MemberInfo)(((object)type.GetProperty(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) ?? ((object)type.GetField(text, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))); Cache[key] = value; } if (!(value == null)) { if (value is PropertyInfo propertyInfo) { return propertyInfo.GetValue(target); } if (value is FieldInfo fieldInfo) { return fieldInfo.GetValue(target); } } } return null; } } public class ScreamMachine : MonoBehaviourPunCallbacks, IOnEventCallback { private const float MinScreamInterval = 90f; private const float MaxScreamInterval = 240f; private const float GameplayReadyDelay = 3f; private const float ScreamInvestigateRadius = 50f; private const float AudioMinDistance = 2f; private const float AudioMaxDistance = 35f; private const byte ScreamEventCode = 99; private float screamTimer; private float nextScreamInterval; private float gameplayReadyTimer; private bool gameplayReady; private PhotonView photonView; private void Awake() { photonView = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)photonView == (Object)null) { Debug.Log((object)"[TrollPack] ScreamMachine: PhotonView tidak ditemukan di object ini. Menggunakan PhotonNetwork.RaiseEvent sebagai gantinya."); } } private void Update() { if (!ModConfigManager.IsEnabled("scream_machine")) { ResetState(); } else if (!IsGameplayActive()) { ResetState(); } else if (!PhotonNetwork.InRoom) { UpdateSinglePlayer(); } else if (PhotonNetwork.IsMasterClient) { UpdateMasterTimer(); } } private void UpdateSinglePlayer() { if (!gameplayReady) { gameplayReadyTimer += Time.deltaTime; if (gameplayReadyTimer < 3f) { return; } gameplayReady = true; screamTimer = 0f; SetNextScreamInterval(); Debug.Log((object)("[TrollPack] ScreamMachine: Single-player auto-timer aktif. Scream berikutnya dalam " + Mathf.RoundToInt(nextScreamInterval) + " detik.")); } PlayerController instance = PlayerController.instance; if (!((Object)(object)instance == (Object)null)) { screamTimer += Time.deltaTime; if (screamTimer >= nextScreamInterval) { screamTimer = 0f; ForceScream(instance); SetNextScreamInterval(); Debug.Log((object)("[TrollPack] ScreamMachine: Single-player scream selesai. Scream berikutnya dalam " + Mathf.RoundToInt(nextScreamInterval) + " detik.")); } } } private void UpdateMasterTimer() { if (!gameplayReady) { gameplayReadyTimer += Time.deltaTime; if (gameplayReadyTimer < 3f) { return; } gameplayReady = true; screamTimer = 0f; SetNextScreamInterval(); Debug.Log((object)("[TrollPack] ScreamMachine: Multiplayer Master timer aktif. Scream berikutnya dalam " + Mathf.RoundToInt(nextScreamInterval) + " detik.")); } screamTimer += Time.deltaTime; if (screamTimer >= nextScreamInterval) { screamTimer = 0f; TriggerMultiplayerScream(); SetNextScreamInterval(); Debug.Log((object)("[TrollPack] ScreamMachine: Master memicu multiplayer scream. Scream berikutnya dalam " + Mathf.RoundToInt(nextScreamInterval) + " detik.")); } } private void SetNextScreamInterval() { nextScreamInterval = Random.Range(90f, 240f); } private void TriggerMultiplayerScream() { //IL_009d: 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_00bd: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f7: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient) { return; } PlayerController instance = PlayerController.instance; if ((Object)(object)instance == (Object)null) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: Player target tidak ditemukan."); return; } PlayerAvatar playerAvatarScript = instance.playerAvatarScript; if ((Object)(object)playerAvatarScript == (Object)null) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: PlayerAvatar target tidak ditemukan (playerAvatarScript null)."); return; } PhotonView component = ((Component)playerAvatarScript).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: PhotonView PlayerAvatar target tidak ditemukan."); return; } Vector3 position = ((Component)playerAvatarScript).transform.position; int viewID = component.ViewID; object[] array = new object[4] { viewID, position.x, position.y, position.z }; RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; SendOptions val2 = default(SendOptions); ((SendOptions)(ref val2)).Reliability = true; SendOptions val3 = val2; PhotonNetwork.RaiseEvent((byte)99, (object)array, val, val3); Debug.Log((object)("[TrollPack] ScreamMachine: Scream event dikirim ke semua client. Target ViewID: " + viewID)); } public void OnEvent(EventData photonEvent) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (photonEvent.Code == 99 && ModConfigManager.IsEnabled("scream_machine") && IsGameplayActiveStatic()) { object[] array = (object[])photonEvent.CustomData; int targetViewID = (int)array[0]; Vector3 screamPosition = default(Vector3); ((Vector3)(ref screamPosition))..ctor((float)array[1], (float)array[2], (float)array[3]); PlayScreamLocally(targetViewID, screamPosition); } } private unsafe void PlayScreamLocally(int targetViewID, Vector3 screamPosition) { //IL_0040: 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_003b: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)MainPlugin.BuzzerSound == (Object)null) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: BuzzerSound tidak tersedia."); return; } Transform val = FindTargetTransform(targetViewID); if ((Object)(object)val != (Object)null) { screamPosition = val.position; } AudioSource val2 = FindOrCreateAudioSource(val, screamPosition); if (!((Object)(object)val2 == (Object)null)) { ((Behaviour)val2).enabled = true; val2.mute = false; val2.volume = 1f; val2.spatialBlend = 1f; val2.minDistance = 2f; val2.maxDistance = 35f; val2.rolloffMode = (AudioRolloffMode)0; val2.loop = false; val2.playOnAwake = false; val2.PlayOneShot(MainPlugin.BuzzerSound); Vector3 val3 = screamPosition; Debug.Log((object)("[TrollPack] ScreamMachine: Multiplayer scream dimainkan dari posisi " + ((object)(*(Vector3*)(&val3))/*cast due to .constrained prefix*/).ToString())); TriggerMonsterInvestigation(screamPosition); } } private unsafe static void TriggerMonsterInvestigation(Vector3 screamPosition) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)EnemyDirector.instance == (Object)null) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: EnemyDirector tidak tersedia."); return; } if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { Debug.Log((object)"[TrollPack] ScreamMachine: Client tidak menjalankan EnemyDirector.SetInvestigate(). Menunggu MasterClient."); return; } EnemyDirector.instance.SetInvestigate(screamPosition, 50f, false); string[] obj = new string[5] { "[TrollPack] ScreamMachine: Monster investigation dipicu. Posisi: ", null, null, null, null }; Vector3 val = screamPosition; obj[1] = ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString(); obj[2] = " | Radius: "; obj[3] = 50f.ToString(); obj[4] = " | PathfindOnly: false"; Debug.Log((object)string.Concat(obj)); } private Transform FindTargetTransform(int targetViewID) { if (targetViewID <= 0) { return null; } PhotonView val = PhotonView.Find(targetViewID); if ((Object)(object)val == (Object)null) { return null; } if ((Object)(object)((Component)val).transform != (Object)null) { return ((Component)val).transform; } return null; } private AudioSource FindOrCreateAudioSource(Transform targetTransform, Vector3 worldPosition) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_008f: 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_004e: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetTransform != (Object)null) { Transform val = targetTransform.Find("ScreamMachineAudio"); AudioSource val2 = null; if ((Object)(object)val != (Object)null) { val2 = ((Component)val).GetComponent<AudioSource>(); } if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("ScreamMachineAudio"); val3.transform.SetParent(targetTransform); val3.transform.localPosition = Vector3.zero; val2 = val3.AddComponent<AudioSource>(); } return val2; } GameObject val4 = new GameObject("ScreamMachineAudio"); val4.transform.position = worldPosition; AudioSource result = val4.AddComponent<AudioSource>(); Object.Destroy((Object)(object)val4, 10f); return result; } public static void ForceScream(PlayerController targetPlayer) { if (!ModConfigManager.IsEnabled("scream_machine") || !IsGameplayActiveStatic() || (Object)(object)targetPlayer == (Object)null) { return; } if (PhotonNetwork.InRoom) { ScreamMachine screamMachine = Object.FindObjectOfType<ScreamMachine>(); if ((Object)(object)screamMachine == (Object)null) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: instance tidak ditemukan."); } else if (!PhotonNetwork.IsMasterClient) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: ForceScream di client diabaikan. Multiplayer scream harus dipicu oleh MasterClient."); } else { screamMachine.TriggerMultiplayerScream(); } } else { PlaySinglePlayerScream(targetPlayer); } } private static void PlaySinglePlayerScream(PlayerController targetPlayer) { //IL_0112: 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_0079: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)targetPlayer == (Object)null) { return; } if ((Object)(object)MainPlugin.BuzzerSound == (Object)null) { Debug.LogWarning((object)"[TrollPack] ScreamMachine: BuzzerSound tidak tersedia."); return; } Transform transform = ((Component)targetPlayer).transform; Transform val = transform.Find("ScreamMachineAudio"); AudioSource val2 = null; if ((Object)(object)val != (Object)null) { val2 = ((Component)val).GetComponent<AudioSource>(); } if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("ScreamMachineAudio"); val3.transform.SetParent(transform); val3.transform.localPosition = Vector3.zero; val2 = val3.AddComponent<AudioSource>(); } ((Behaviour)val2).enabled = true; val2.mute = false; val2.volume = 1f; val2.spatialBlend = 1f; val2.minDistance = 2f; val2.maxDistance = 35f; val2.rolloffMode = (AudioRolloffMode)0; val2.loop = false; val2.playOnAwake = false; val2.PlayOneShot(MainPlugin.BuzzerSound); Debug.Log((object)"[TrollPack] ScreamMachine: Single-player scream dimainkan."); TriggerMonsterInvestigation(transform.position); } private void ResetState() { screamTimer = 0f; nextScreamInterval = 0f; gameplayReadyTimer = 0f; gameplayReady = false; } private bool IsGameplayActive() { return IsGameplayActiveStatic(); } private static bool IsGameplayActiveStatic() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).IsValid()) { return false; } string text = ((Scene)(ref activeScene)).name.ToLowerInvariant(); if (text.Contains("menu") || text.Contains("loading") || text.Contains("lobby")) { return false; } if ((Object)(object)RunManager.instance == (Object)null) { return false; } if (!RunManagerReflection.GetBool(RunManager.instance, "runStarted", "RunStarted")) { return false; } if (RunManagerReflection.GetBool(RunManager.instance, "restarting", "Restarting")) { return false; } if (RunManagerReflection.GetBool(RunManager.instance, "gameOver", "GameOver")) { return false; } object member = RunManagerReflection.GetMember(RunManager.instance, "levelCurrent", "LevelCurrent"); if (member != null) { object member2 = RunManagerReflection.GetMember(RunManager.instance, "levelLobby", "LevelLobby"); object member3 = RunManagerReflection.GetMember(RunManager.instance, "levelLobbyMenu", "LevelLobbyMenu"); object member4 = RunManagerReflection.GetMember(RunManager.instance, "levelMainMenu", "LevelMainMenu"); if (member == member2 || member == member3 || member == member4) { return false; } } if ((Object)(object)PlayerController.instance == (Object)null) { return false; } if ((Object)(object)EnemyDirector.instance == (Object)null) { return false; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { return false; } return true; } } public class TaxManWhispers : MonoBehaviour { private const string ModId = "taxman_whispers"; private const float WhisperInterval = 60f; private readonly List<string> cachedMessages = new List<string>(); private float whisperTimer; private bool IsGameplayScene() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RunManager.instance == (Object)null) { return false; } if ((Object)(object)RunManager.instance.levelCurrent == (Object)null) { return false; } if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelMainMenu) { return false; } if ((Object)(object)RunManager.instance.levelLobbyMenu != (Object)null && (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobbyMenu) { return false; } Scene activeScene = SceneManager.GetActiveScene(); if (!((Scene)(ref activeScene)).IsValid()) { return false; } string text = ((Scene)(ref activeScene)).name.ToLowerInvariant(); if (text.Contains("loading")) { return false; } if ((Object)(object)PlayerController.instance == (Object)null) { return false; } if ((Object)(object)EnemyDirector.instance == (Object)null) { return false; } if ((Object)(object)LevelGenerator.Instance == (Object)null) { return false; } return true; } private void Awake() { LoadMessages(); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } private void Start() { ((MonoBehaviour)this).StartCoroutine(WhisperRoutine()); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { whisperTimer = 0f; Debug.Log((object)("[TaxMan] Scene berubah ke: " + ((Scene)(ref scene)).name)); } private void LoadMessages() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "Data", "taxman_me