using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using Empress.REPO.PropHunt; using ExitGames.Client.Photon; using HarmonyLib; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PropHuntHUD")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PropHuntHUD")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("edb4e688-84f8-47ad-8640-e6571290f8d7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace PropHuntCustomHUD; [BepInPlugin("com.alpakatitikaka.prophunt.hud", "PropHunt Better HUD", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PropHuntGUIPlagin : BaseUnityPlugin { [HarmonyPatch(typeof(PropHuntManager), "ApplyRoomState")] public static class PropHuntApplyRoomStatePatch { [HarmonyPostfix] public static void Postfix() { if ((Object)(object)Instance == (Object)null || Instance.roleShownThisRound || PhotonNetwork.CurrentRoom == null || !((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).ContainsKey((object)"PH_Hunter")) { return; } int num = (int)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties[(object)"PH_Hunter"]; if (num <= 0) { return; } bool flag = false; Player[] playerList = PhotonNetwork.PlayerList; for (int i = 0; i < playerList.Length; i++) { if (playerList[i].ActorNumber == num) { flag = true; break; } } if (flag) { Instance.roleShownThisRound = true; ((MonoBehaviour)Instance).StartCoroutine(Instance.ShowRoleAnnouncement()); } } } [HarmonyPatch(typeof(PropHuntManager), "DeactivateManager")] public static class PropHuntStartPatch { [HarmonyPostfix] public static void Postfix() { if (!((Object)(object)Instance == (Object)null)) { Instance.roleShownThisRound = false; } } } [HarmonyPatch(typeof(ValuableObject), "Start")] public static class RepoValuableDiscoverPatch { [HarmonyPostfix] public static void Postfix(ValuableObject __instance) { if (!((Object)(object)Instance == (Object)null) && ValuableDiscover.Value) { FieldInfo fieldInfo = AccessTools.Field(((object)__instance).GetType(), "discovered"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, true); } } } } [HarmonyPatch(typeof(ValuableObject), "DiscoverReminderLogic")] public static class RepoValuableDiscoverReminderPatch { [HarmonyPostfix] public static void Postfix(ValuableObject __instance) { if (!((Object)(object)Instance == (Object)null) && ValuableDiscover.Value) { FieldInfo fieldInfo = AccessTools.Field(((object)__instance).GetType(), "discoveredReminder"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, false); } } } } [HarmonyPatch(typeof(ValuableDiscoverCustom), "Awake")] public static class RepoValuableDiscoverCustomPatch { [HarmonyPostfix] public static void Postfix(ValuableDiscoverCustom __instance) { if (!((Object)(object)Instance == (Object)null) && ValuableDiscover.Value) { FieldInfo fieldInfo = AccessTools.Field(((object)__instance).GetType(), "discovered"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, true); } } } } [HarmonyPatch(typeof(MapModule), "Update")] public static class RepoRoomExploredPatch { [HarmonyPostfix] public static void Postfix(MapModule __instance) { if (!((Object)(object)Instance == (Object)null) && ExploredMap.Value) { __instance.Hide(); } } } [HarmonyPatch(typeof(PhysGrabObject), "Awake")] public static class RepoCartDestroyPatch { [HarmonyPostfix] public static void Postfix(PhysGrabObject __instance) { if ((Object)(object)Instance == (Object)null || !CartDestroy.Value) { return; } FieldInfo fieldInfo = AccessTools.Field(((object)__instance).GetType(), "isCart"); if (fieldInfo != null && (bool)fieldInfo.GetValue(__instance)) { FieldInfo fieldInfo2 = AccessTools.Field(((object)__instance).GetType(), "dead"); if (fieldInfo2 != null) { fieldInfo2.SetValue(__instance, true); } } } } [HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "Start")] public static class RepoValuableDestroyPatch { [HarmonyPostfix] public static void Postfix(PhysGrabObjectImpactDetector __instance) { if ((Object)(object)Instance == (Object)null || !ValuablesGodMod.Value) { return; } FieldInfo fieldInfo = AccessTools.Field(((object)__instance).GetType(), "isValuable"); if (fieldInfo != null && (bool)fieldInfo.GetValue(__instance)) { FieldInfo fieldInfo2 = AccessTools.Field(((object)__instance).GetType(), "destroyDisable"); if (fieldInfo2 != null) { fieldInfo2.SetValue(__instance, true); } } } } [CompilerGenerated] private sealed class <>c__DisplayClass68_0 { public int hunterActor; internal bool b__0(Player p) { return p.ActorNumber == hunterActor; } } [CompilerGenerated] private sealed class d__69 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string message; private GameObject 5__2; private TextMeshProUGUI 5__3; private float 5__4; private float 5__5; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__69(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__2 = null; 5__3 = null; <>1__state = -2; } private bool MoveNext() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) switch (<>1__state) { default: return false; case 0: { <>1__state = -1; 5__2 = new GameObject("PropHuntRoleHUD"); Object.DontDestroyOnLoad((Object)(object)5__2); Canvas obj = 5__2.AddComponent(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 1000; GameObject val = new GameObject("RoleText"); val.transform.SetParent(5__2.transform); 5__3 = val.AddComponent(); ((TMP_Text)5__3).text = message; ((TMP_Text)5__3).alignment = (TextAlignmentOptions)514; ((TMP_Text)5__3).fontSizeMax = 999f; RectTransform component = ((Component)5__3).GetComponent(); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); component.anchorMax = val2; component.anchorMin = val2; component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(1200f, 400f); 5__4 = DisplayDuration.Value; 5__5 = Time.time; break; } case 1: <>1__state = -1; break; } if (Time.time - 5__5 < 5__4) { float alpha = Mathf.Sin((Time.time - 5__5) / 5__4 * (float)Math.PI) * 0.7f + 0.3f; ((TMP_Text)5__3).alpha = alpha; <>2__current = null; <>1__state = 1; return true; } Object.Destroy((Object)(object)5__2); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__68 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public PropHuntGUIPlagin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__68(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; PropHuntGUIPlagin propHuntGUIPlagin = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; if (Time.time - propHuntGUIPlagin.lastAnnouncementTime < 2f) { return false; } propHuntGUIPlagin.lastAnnouncementTime = Time.time; if (PhotonNetwork.CurrentRoom == null) { return false; } string text = null; try { <>c__DisplayClass68_0 CS$<>8__locals0 = new <>c__DisplayClass68_0(); Player localPlayer = PhotonNetwork.LocalPlayer; if (localPlayer == null) { return false; } Room currentRoom = PhotonNetwork.CurrentRoom; Hashtable val = ((currentRoom != null) ? ((RoomInfo)currentRoom).CustomProperties : null); CS$<>8__locals0.hunterActor = ((val != null && ((Dictionary)(object)val).ContainsKey((object)"PH_Hunter")) ? ((int)val[(object)"PH_Hunter"]) : (-1)); bool num2 = localPlayer.ActorNumber == CS$<>8__locals0.hunterActor; string arg = "???"; if (!num2 && CS$<>8__locals0.hunterActor > 0) { Player val2 = ((IEnumerable)PhotonNetwork.PlayerList).FirstOrDefault((Func)((Player p) => p.ActorNumber == CS$<>8__locals0.hunterActor)); if (val2 != null) { arg = val2.NickName; } } if (num2) { text = $"{HunterText.Value}"; } else { string text2 = $"{PropText.Value}"; string text3 = $"Hunter: {arg}"; text = text2 + "\n" + text3; } } catch (Exception ex) { ((BaseUnityPlugin)propHuntGUIPlagin).Logger.LogError((object)("Error in ShowRoleAnnouncement: " + ex.Message)); return false; } if (text != null) { <>2__current = ((MonoBehaviour)propHuntGUIPlagin).StartCoroutine(propHuntGUIPlagin.ShowCenterText(text)); <>1__state = 1; return true; } break; } case 1: <>1__state = -1; break; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private float lastAnnouncementTime; internal bool roleShownThisRound; private Harmony harmony; private AudioSource menuMusicSource; public static PropHuntGUIPlagin Instance { get; private set; } public static ConfigEntry EnableMod { get; private set; } public static ConfigEntry DisplayDuration { get; private set; } public static ConfigEntry HunterText { get; private set; } public static ConfigEntry PropText { get; private set; } public static ConfigEntry HunterColor { get; private set; } public static ConfigEntry PropColor { get; private set; } public static ConfigEntry HunterNameColor { get; private set; } public static ConfigEntry MainFontSize { get; private set; } public static ConfigEntry HunterNameFontSize { get; private set; } public static ConfigEntry MenuMusicVolume { get; private set; } public static ConfigEntry ValuableDiscover { get; private set; } public static ConfigEntry ExploredMap { get; private set; } public static ConfigEntry CartDestroy { get; private set; } public static ConfigEntry ValuablesGodMod { get; private set; } private void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Instance = this; harmony = new Harmony("com.alpakatitikaka.prophunt.hud"); harmony.PatchAll(); SetupConfig(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"PropHuntBetterHUD loaded"); } private void Update() { if (Time.frameCount % 60 == 0) { ApplyMenuMusicVolume(); } } private void SetupConfig() { //IL_011c: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown EnableMod = ((BaseUnityPlugin)this).Config.Bind("General", "Enabled", true, "Включить мод"); DisplayDuration = ((BaseUnityPlugin)this).Config.Bind("General", "DisplayDuration", 6f, "Сколько секунд показывать надпись"); ValuableDiscover = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "ValuableDiscover", true, "Убрать подстветку предметов"); ValuablesGodMod = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "ValuablesGodMod", true, "Убрать у предметов возможность ломаться"); ExploredMap = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "ExploredMap", true, "Раскрыть карту"); CartDestroy = ((BaseUnityPlugin)this).Config.Bind("Gameplay", "CartDestroy", true, "Удалить тележку"); HunterText = ((BaseUnityPlugin)this).Config.Bind("Text", "HunterText", "YOU'RE HUNTER", "Текст для охотника"); PropText = ((BaseUnityPlugin)this).Config.Bind("Text", "PropText", "YOU'RE PROP", "Текст для пропа"); HunterColor = ((BaseUnityPlugin)this).Config.Bind("Colors", "HunterColor", Color.red, "Цвет текста охотника"); PropColor = ((BaseUnityPlugin)this).Config.Bind("Colors", "PropColor", Color.blue, "Цвет текста пропа"); HunterNameColor = ((BaseUnityPlugin)this).Config.Bind("Colors", "HunterNameColor", new Color(1f, 0.5f, 0f), "Цвет имени охотника (оранжевый)"); MainFontSize = ((BaseUnityPlugin)this).Config.Bind("Text", "MainFontSize", 70, "Размер основного текста"); HunterNameFontSize = ((BaseUnityPlugin)this).Config.Bind("Text", "HunterNameFontSize", 50, "Размер текста 'Hunter: Имя'"); MenuMusicVolume = ((BaseUnityPlugin)this).Config.Bind("Music", "MenuMusicVolume", 0.2f, new ConfigDescription("Громкость музыки в главном меню (0.0 - 1.0)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); } private void ApplyMenuMusicVolume() { try { float num = Mathf.Clamp01(MenuMusicVolume.Value); if ((Object)(object)menuMusicSource != (Object)null) { if (Mathf.Abs(menuMusicSource.volume - num) > 0.01f) { menuMusicSource.volume = num; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[Cached] Menu music volume set to {num:F2}"); } return; } AudioSource[] array = Object.FindObjectsOfType(true); foreach (AudioSource val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)val.clip == (Object)null) && (((Object)val.clip).name == "OmniLala" || ((Object)((Component)val).gameObject).name == "MainMenuMusic_Swap")) { menuMusicSource = val; val.volume = num; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Main Menu Music found! Volume set to {num:F2}"); break; } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Music sync error: " + ex.Message)); } } [IteratorStateMachine(typeof(d__68))] internal IEnumerator ShowRoleAnnouncement() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__68(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__69))] private IEnumerator ShowCenterText(string message) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__69(0) { message = message }; } }