Decompiled source of TrollPack PalmStudio v1.0.0

Trollpack.dll

Decompiled 9 hours ago
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
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.0")]
	public class MainPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(PlayerAvatar), "Jump")]
		private class PlayerJumpPatch
		{
			[HarmonyPostfix]
			private static void Postfix(PlayerController __instance)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				if (ModConfigManager.IsEnabled("scream_machine") && !((Object)(object)FartSound == (Object)null))
				{
					AudioSource.PlayClipAtPoint(FartSound, ((Component)__instance).transform.position);
				}
			}
		}

		[HarmonyPatch(typeof(PlayerAvatar), "Land")]
		private class PlayerLandPatch
		{
			[HarmonyPostfix]
			private static void Postfix(PlayerController __instance)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				if (ModConfigManager.IsEnabled("scream_machine") && !((Object)(object)SadTromboneSound == (Object)null))
				{
					AudioSource.PlayClipAtPoint(SadTromboneSound, ((Component)__instance).transform.position);
				}
			}
		}

		[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 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.");
			}
		}

		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.DontDestroyOnLoad((Object)(object)ControlPanelInstance);
				SetupCanvas();
				SetupManagers();
				SetupEventSystem();
			}
		}

		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))
			{
				component.renderMode = (RenderMode)0;
				component.sortingOrder = 32000;
			}
		}

		private void SetupManagers()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			TrollPanelManager orAddComponent = GetOrAddComponent<TrollPanelManager>();
			GetOrAddComponent<TaxManWhispers>();
			GetOrAddComponent<InvisibleFloorManager>();
			GetOrAddComponent<EntitySpawner>();
			orAddComponent.toggleHotkey = (KeyCode)289;
			if ((Object)(object)SfxBundle != (Object)null)
			{
				orAddComponent.modCardPrefab = SfxBundle.LoadAsset<GameObject>("ModCard");
			}
			Transform val = ControlPanelInstance.transform.Find("MainPanel");
			if ((Object)(object)val != (Object)null)
			{
				orAddComponent.mainPanelObject = ((Component)val).gameObject;
			}
			else
			{
				Debug.LogError((object)"[TrollPack] MainPanel tidak ditemukan.");
			}
		}

		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
	{
		public TMP_Text modNameText;

		public TMP_Text modTaglineText;

		public Toggle modToggle;

		private string modId;

		public void SetupCard(string id, string name, string tagline, bool isEnabled)
		{
			modId = id;
			FindUIComponents();
			if ((Object)(object)modNameText != (Object)null)
			{
				modNameText.text = name;
			}
			if ((Object)(object)modTaglineText != (Object)null)
			{
				modTaglineText.text = tagline;
			}
			if ((Object)(object)modToggle != (Object)null)
			{
				((UnityEventBase)modToggle.onValueChanged).RemoveAllListeners();
				modToggle.isOn = isEnabled;
				((UnityEvent<bool>)(object)modToggle.onValueChanged).AddListener((UnityAction<bool>)OnToggleChanged);
			}
		}

		private void FindUIComponents()
		{
			if ((Object)(object)modNameText == (Object)null)
			{
				Transform val = ((Component)this).transform.Find("ModName");
				if ((Object)(object)val != (Object)null)
				{
					modNameText = ((Component)val).GetComponent<TMP_Text>();
				}
			}
			if ((Object)(object)modTaglineText == (Object)null)
			{
				Transform val2 = ((Component)this).transform.Find("ModTagline");
				if ((Object)(object)val2 != (Object)null)
				{
					modTaglineText = ((Component)val2).GetComponent<TMP_Text>();
				}
			}
			if ((Object)(object)modToggle == (Object)null)
			{
				Transform val3 = ((Component)this).transform.Find("Toggle");
				if ((Object)(object)val3 != (Object)null)
				{
					modToggle = ((Component)val3).GetComponent<Toggle>();
				}
			}
		}

		private void OnToggleChanged(bool value)
		{
			ModConfigManager.SetEnabled(modId, value);
			Debug.Log((object)("[TrollPack] Mod '" + modId + "' -> " + (value ? "ON" : "OFF")));
		}
	}
	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")]
		public GameObject mainPanelObject;

		public GameObject modCardPrefab;

		[Header("Settings")]
		public KeyCode toggleHotkey = (KeyCode)289;

		private bool isModListGenerated;

		private bool previousCursorVisible;

		private CursorLockMode previousCursorLockMode;

		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.")
		};

		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()
		{
			if ((Object)(object)mainPanelObject == (Object)null)
			{
				Transform val = ((Component)this).transform.Find("MainPanel");
				if ((Object)(object)val != (Object)null)
				{
					mainPanelObject = ((Component)val).gameObject;
				}
			}
			if ((Object)(object)mainPanelObject != (Object)null)
			{
				mainPanelObject.SetActive(false);
			}
			else
			{
				Debug.LogError((object)"[TrollPack] MainPanel tidak ditemukan!");
			}
		}

		private void Update()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(toggleHotkey))
			{
				ToggleControlPanel();
			}
		}

		public void ToggleControlPanel()
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)mainPanelObject == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] MainPanel tidak ditemukan!");
				return;
			}
			isPanelOpen = !isPanelOpen;
			mainPanelObject.SetActive(isPanelOpen);
			if (isPanelOpen)
			{
				previousCursorVisible = Cursor.visible;
				previousCursorLockMode = Cursor.lockState;
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
				if (!isModListGenerated)
				{
					GenerateAllModsTab();
				}
			}
			else
			{
				Cursor.visible = previousCursorVisible;
				Cursor.lockState = previousCursorLockMode;
			}
		}

		private void GenerateAllModsTab()
		{
			Transform val = ((Component)this).transform.Find("MainPanel/ContentArea/Tab1_AllMods/Viewport/Content");
			if ((Object)(object)val == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] Content UI tidak ditemukan!");
				return;
			}
			if ((Object)(object)modCardPrefab == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] ModCard prefab tidak ditemukan!");
				return;
			}
			foreach (ModData mod in modList)
			{
				GameObject val2 = Object.Instantiate<GameObject>(modCardPrefab, val);
				ModCard modCard = val2.GetComponent<ModCard>();
				if ((Object)(object)modCard == (Object)null)
				{
					modCard = val2.AddComponent<ModCard>();
				}
				modCard.SetupCard(mod.id, mod.name, mod.tagline, ModConfigManager.IsEnabled(mod.id));
			}
			isModListGenerated = true;
		}
	}
}
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()
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Expected O, but got Unknown
			if (!ModConfigManager.IsEnabled("invisible_floor") || (Object)(object)LevelGenerator.Instance == (Object)null)
			{
				return;
			}
			GameObject levelParent = LevelGenerator.Instance.LevelParent;
			if ((Object)(object)levelParent == (Object)null)
			{
				Debug.LogError((object)"[InvisibleFloor] LevelParent tidak ditemukan!");
				return;
			}
			List<Transform> list = new List<Transform>();
			foreach (Transform item in levelParent.transform)
			{
				Transform val = item;
				if (((Object)val).name.Contains("Module") || ((Object)val).name.Contains("Start Room"))
				{
					list.Add(val);
				}
			}
			if (list.Count == 0)
			{
				Debug.LogWarning((object)"[InvisibleFloor] Tidak ada module yang ditemukan.");
				return;
			}
			Transform val2 = list[Random.Range(0, list.Count)];
			Debug.Log((object)("[InvisibleFloor] Module terpilih: " + ((Object)val2).name));
			InvisibleFloorManager.ApplyTrollFloor(((Component)val2).gameObject);
		}
	}
	[HarmonyPatch(typeof(PlayerAvatar), "Jump")]
	public class ScreamMachinePatch
	{
		[HarmonyPostfix]
		private static void Postfix(PlayerController __instance)
		{
			ScreamMachine.ForceScream(__instance);
		}
	}
}
namespace TrollPack.Mods
{
	public class EntitySpawner : MonoBehaviourPunCallbacks
	{
		private PhotonView photonView;

		private void Awake()
		{
			photonView = ((Component)this).GetComponent<PhotonView>();
			if ((Object)(object)photonView == (Object)null)
			{
				Debug.LogWarning((object)"[TrollPack] PhotonView tidak ditemukan pada EntitySpawner.");
			}
		}

		private EnemySetup GetEnemySetup(string enemyName)
		{
			EnemyDirector instance = EnemyDirector.instance;
			if ((Object)(object)instance == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] EnemyDirector NULL.");
				return null;
			}
			return instance.enemiesDifficulty1.Find((EnemySetup x) => ((Object)x).name == enemyName);
		}

		private void SpawnSinglePlayer(EnemySetup setup, Vector3 position)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)LevelGenerator.Instance == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] LevelGenerator NULL.");
			}
			else
			{
				LevelGenerator.Instance.EnemySpawn(setup, position);
			}
		}

		private void SpawnMultiplayer(EnemySetup setup, Vector3 position)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)LevelGenerator.Instance == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] LevelGenerator NULL.");
			}
			else if (PhotonNetwork.IsMasterClient)
			{
				LevelGenerator.Instance.EnemySpawn(setup, position);
			}
			else
			{
				SendSpawnRequest(((Object)setup).name, position);
			}
		}

		private void SpawnEnemy(string enemyName)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!ModConfigManager.IsEnabled("entity_spawner"))
			{
				return;
			}
			EnemySetup enemySetup = GetEnemySetup(enemyName);
			if ((Object)(object)enemySetup == (Object)null)
			{
				Debug.LogError((object)("[TrollPack] Enemy tidak ditemukan: " + enemyName));
				return;
			}
			Camera main = Camera.main;
			if ((Object)(object)main == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] Main Camera tidak ditemukan.");
				return;
			}
			Vector3 position = ((Component)main).transform.position + ((Component)main).transform.forward * 3f;
			if (!PhotonNetwork.InRoom)
			{
				SpawnSinglePlayer(enemySetup, position);
			}
			else
			{
				SpawnMultiplayer(enemySetup, position);
			}
		}

		private void Update()
		{
			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");
			}
		}

		[PunRPC]
		private void RequestSpawnMonster(string enemyName, Vector3 spawnPosition)
		{
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			if (PhotonNetwork.IsMasterClient)
			{
				EnemySetup enemySetup = GetEnemySetup(enemyName);
				if ((Object)(object)enemySetup == (Object)null)
				{
					Debug.LogError((object)("[TrollPack] Enemy tidak ditemukan: " + enemyName));
				}
				else if ((Object)(object)LevelGenerator.Instance == (Object)null)
				{
					Debug.LogError((object)"[TrollPack] LevelGenerator NULL.");
				}
				else
				{
					LevelGenerator.Instance.EnemySpawn(enemySetup, spawnPosition);
				}
			}
		}

		private void SendSpawnRequest(string enemyName, Vector3 spawnPosition)
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)photonView == (Object)null)
			{
				Debug.LogError((object)"[TrollPack] PhotonView belum tersedia.");
				return;
			}
			photonView.RPC("RequestSpawnMonster", (RpcTarget)2, new object[2] { enemyName, spawnPosition });
		}
	}
	[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 : MonoBehaviour
	{
		public static float FallDamage = 20f;

		private bool isRescuing = false;

		private bool spawnPositionSaved = false;

		private Vector3 safeSpawnPosition;

		private Quaternion safeSpawnRotation;

		public static void ApplyTrollFloor(GameObject roomParent)
		{
			if (!ModConfigManager.IsEnabled("invisible_floor"))
			{
				return;
			}
			List<Collider> list = new List<Collider>();
			Transform[] componentsInChildren = roomParent.GetComponentsInChildren<Transform>(true);
			foreach (Transform val in componentsInChildren)
			{
				string text = ((Object)val).name.ToLower();
				if (text.Contains("floor") || text.Contains("tile"))
				{
					Collider component = ((Component)val).GetComponent<Collider>();
					if ((Object)(object)component != (Object)null)
					{
						list.Add(component);
					}
				}
			}
			if (list.Count == 0)
			{
				Debug.LogError((object)"[TrollPack] InvisibleFloor: Tidak ada floor di room!");
				return;
			}
			int index = Random.Range(0, list.Count);
			Collider val2 = list[index];
			val2.enabled = false;
			Debug.Log((object)("[TrollPack] InvisibleFloor aktif pada: " + ((Object)val2).name));
		}

		private void Update()
		{
			//IL_0050: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			if (!ModConfigManager.IsEnabled("invisible_floor"))
			{
				return;
			}
			PlayerController instance = PlayerController.instance;
			if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.playerAvatarScript == (Object)null))
			{
				if (!spawnPositionSaved && ((Component)instance).transform.position.y > -5f)
				{
					safeSpawnPosition = ((Component)instance).transform.position;
					safeSpawnRotation = ((Component)instance).transform.rotation;
					spawnPositionSaved = true;
					Debug.Log((object)$"[TrollPack] InvisibleFloor: Posisi aman disimpan = {safeSpawnPosition}");
				}
				if (isRescuing && ((Component)instance).transform.position.y > -5f)
				{
					isRescuing = false;
					Debug.Log((object)"[TrollPack] InvisibleFloor: Player sudah aman, siap mendeteksi jatuh berikutnya.");
				}
				if (!isRescuing && ((Component)instance).transform.position.y < -15f)
				{
					isRescuing = true;
					TriggerFallRescue(instance);
				}
			}
		}

		private void TriggerFallRescue(PlayerController player)
		{
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"[TrollPack] ===== FALL RESCUE TERPICU =====");
			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)
			{
				Debug.LogError((object)"[TrollPack] PlayerHealth tidak ditemukan!");
			}
			else
			{
				Debug.Log((object)"[TrollPack] PlayerHealth ditemukan.");
				val.Hurt((int)FallDamage, false, -1, false);
				Debug.Log((object)"[TrollPack] Fall damage 20 diberikan.");
			}
			if ((Object)(object)player.playerAvatarScript != (Object)null)
			{
				player.playerAvatarScript.FallDamageResetSet(1f);
				PhysGrabber component = ((Component)player.playerAvatarScript).GetComponent<PhysGrabber>();
				if ((Object)(object)component != (Object)null)
				{
					component.ReleaseObject(-1, 0.1f);
				}
			}
			if (spawnPositionSaved)
			{
				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] Player dikembalikan ke posisi aman: {safeSpawnPosition}");
			}
		}
	}
	public class ScreamMachine : MonoBehaviour
	{
		public static void ForceScream(PlayerController targetPlayer)
		{
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			if (!ModConfigManager.IsEnabled("scream_machine") || (Object)(object)targetPlayer == (Object)null)
			{
				return;
			}
			if ((Object)(object)MainPlugin.BuzzerSound == (Object)null)
			{
				Debug.LogWarning((object)"[TrollPack] ScreamMachine: BuzzerSound tidak tersedia.");
				return;
			}
			AudioSource val = ((Component)targetPlayer).gameObject.GetComponent<AudioSource>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)targetPlayer).gameObject.AddComponent<AudioSource>();
			}
			val.spatialBlend = 1f;
			val.minDistance = 2f;
			val.maxDistance = 35f;
			val.rolloffMode = (AudioRolloffMode)0;
			val.PlayOneShot(MainPlugin.BuzzerSound);
			if ((Object)(object)EnemyDirector.instance != (Object)null)
			{
				EnemyDirector.instance.SetInvestigate(((Component)targetPlayer).transform.position, 25f, false);
			}
		}
	}
	public class TaxManWhispers : MonoBehaviour
	{
		private const string ModId = "taxman_whispers";

		private readonly List<string> cachedMessages = new List<string>();

		private void Awake()
		{
			LoadMessages();
		}

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(WhisperRoutine());
		}

		private void LoadMessages()
		{
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "Data", "taxman_messages.json");
			if (!File.Exists(text))
			{
				Debug.LogWarning((object)("[TaxMan] File tidak ditemukan: " + text));
				cachedMessages.Add("Pesan darurat default: Selalu waspada!");
				return;
			}
			string[] array = File.ReadAllLines(text);
			foreach (string text2 in array)
			{
				if (text2.Contains("\"text\""))
				{
					int num = text2.IndexOf(":");
					if (num >= 0)
					{
						string item = text2.Substring(num + 1).Trim().Trim(',', ' ', '"');
						cachedMessages.Add(item);
					}
				}
			}
		}

		private IEnumerator WhisperRoutine()
		{
			while (true)
			{
				yield return (object)new WaitForSeconds(60f);
				if (ModConfigManager.IsEnabled("taxman_whispers") && cachedMessages.Count != 0)
				{
					string message = cachedMessages[Random.Range(0, cachedMessages.Count)];
					DisplayFakeTaxmanMessage(message);
				}
			}
		}

		private void DisplayFakeTaxmanMessage(string message)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			if (ModConfigManager.IsEnabled("taxman_whispers") && !((Object)(object)BigMessageUI.instance == (Object)null))
			{
				((SemiUI)BigMessageUI.instance).Show();
				BigMessageUI.instance.BigMessage(message, "", 20f, Color.red, Color.white);
				FieldInfo field = typeof(BigMessageUI).GetField("bigMessageTimer", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field != null)
				{
					field.SetValue(BigMessageUI.instance, 5f);
				}
			}
		}
	}
}