using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.Evanovah.PeakPocalypse")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1")] [assembly: AssemblyProduct("com.github.Evanovah.PeakPocalypse")] [assembly: AssemblyTitle("PeakPocalypse")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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] [Microsoft.CodeAnalysis.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PeakPocalypse { [BepInPlugin("com.github.Evanovah.PeakPocalypse", "PeakPocalypse", "0.1.1")] public class Plugin : BaseUnityPlugin { private class ZombieLabel : MonoBehaviour { private Rigidbody? _rb; private Vector3 _offset; private void Start() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Component)this).transform.parent; if ((Object)(object)parent != (Object)null) { _rb = ((Component)parent).GetComponentInChildren(); _offset = ((Component)this).transform.localPosition; ((Component)this).transform.SetParent((Transform)null, true); } } private void LateUpdate() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rb != (Object)null) { ((Component)this).transform.position = _rb.position + _offset; } else { Object.Destroy((Object)(object)((Component)this).gameObject); } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { ((Component)this).transform.rotation = ((Component)main).transform.rotation; } } } private const int DesiredMaxActiveZombies = 100000; private static readonly string[] ZombieNames = new string[7] { "Nikki", "Leet", "Noah", "Martin", "Take", "Kien", "Amelia" }; private static readonly Random _nameRng = new Random(); private static readonly Color PeakTextColor = new Color(0.8745f, 0.8549f, 0.7608f, 1f); private string _statusMessage = ""; private float _statusTimer; private float _zombieSpawnTimer = 60f; private static TMP_FontAsset? _fontAsset; private static int _shadowMaterialId; private bool _fontSearched; private Canvas? _canvas; private TextMeshProUGUI? _titleText; private TextMeshProUGUI? _timerText; private TextMeshProUGUI? _statusText; public const string Id = "com.github.Evanovah.PeakPocalypse"; internal static ManualLogSource Log { get; private set; } = null; public static string Name => "PeakPocalypse"; public static string Version => "0.1.1"; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Harmony val = new Harmony("com.github.Evanovah.PeakPocalypse"); val.PatchAll(); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void FindFont() { if (_fontSearched) { return; } _fontSearched = true; TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); foreach (TMP_FontAsset val in array) { if (((Object)val).name == "DarumaDropOne-Regular SDF") { _fontAsset = val; Log.LogInfo((object)"Found Peak font: DarumaDropOne-Regular SDF"); break; } } Material[] array2 = Resources.FindObjectsOfTypeAll(); foreach (Material val2 in array2) { if (((Object)val2).name == "DarumaDropOne-Regular SDF Shadow") { _shadowMaterialId = ((Object)val2).GetInstanceID(); Log.LogInfo((object)"Found Peak shadow material"); break; } } } private void InitUI() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_canvas != (Object)null)) { FindFont(); if ((Object)(object)_fontAsset == (Object)null) { Log.LogWarning((object)"Peak font not found, UI will not be created yet"); _fontSearched = false; return; } GameObject val = new GameObject("PeakPocalypseCanvas"); Object.DontDestroyOnLoad((Object)(object)val); _canvas = val.AddComponent(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 999; val.AddComponent(); Material shadowMat = (Material)((_shadowMaterialId != 0) ? /*isinst with value type is only supported in some contexts*/: null); _titleText = CreateText(val.transform, "TitleText", 20f, PeakTextColor, shadowMat); SetupTextAnchor(_titleText, new Vector2(1f, 1f), new Vector2(-10f, -10f)); ((TMP_Text)_titleText).alignment = (TextAlignmentOptions)260; ((TMP_Text)_titleText).text = "Peak Pocalypse v3"; _timerText = CreateText(val.transform, "TimerText", 18f, PeakTextColor, shadowMat); SetupTextAnchor(_timerText, new Vector2(1f, 1f), new Vector2(-10f, -40f)); ((TMP_Text)_timerText).alignment = (TextAlignmentOptions)260; _statusText = CreateText(val.transform, "StatusText", 16f, Color.yellow, shadowMat); SetupTextAnchor(_statusText, new Vector2(1f, 1f), new Vector2(-10f, -65f)); ((TMP_Text)_statusText).alignment = (TextAlignmentOptions)260; ((Component)_statusText).gameObject.SetActive(false); } } private TextMeshProUGUI CreateText(Transform parent, string name, float fontSize, Color color, Material? shadowMat) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); TextMeshProUGUI val2 = val.AddComponent(); ((TMP_Text)val2).font = _fontAsset; if ((Object)(object)shadowMat != (Object)null) { ((TMP_Text)val2).fontMaterial = shadowMat; } ((Graphic)val2).color = color; ((TMP_Text)val2).fontSize = fontSize; ((Graphic)val2).raycastTarget = false; return val2; } private static void SetupTextAnchor(TextMeshProUGUI text, Vector2 anchor, Vector2 pos) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_002e: Unknown result type (might be due to invalid IL or missing references) RectTransform rectTransform = ((TMP_Text)text).rectTransform; rectTransform.anchorMin = anchor; rectTransform.anchorMax = anchor; rectTransform.pivot = anchor; rectTransform.anchoredPosition = pos; rectTransform.sizeDelta = new Vector2(500f, 50f); } private void ShowStatus(string message) { _statusMessage = message; _statusTimer = 3f; if ((Object)(object)_statusText != (Object)null) { ((TMP_Text)_statusText).text = message; ((Component)_statusText).gameObject.SetActive(true); } Log.LogInfo((object)message); } private void AddZombieLabel(GameObject zombie) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ZombieLabel"); val.transform.SetParent(zombie.transform, false); val.transform.localPosition = new Vector3(0f, 2f, 0f); val.AddComponent(); Canvas val2 = val.AddComponent(); val2.renderMode = (RenderMode)2; val2.sortingOrder = 999; RectTransform component = val.GetComponent(); component.sizeDelta = new Vector2(200f, 50f); ((Transform)component).localScale = new Vector3(0.01f, 0.01f, 0.01f); GameObject val3 = new GameObject("Text"); val3.transform.SetParent(val.transform, false); TextMeshProUGUI val4 = val3.AddComponent(); ((TMP_Text)val4).font = _fontAsset; string text = ZombieNames[_nameRng.Next(ZombieNames.Length)]; ((TMP_Text)val4).text = text; ((TMP_Text)val4).fontSize = 36f; ((Graphic)val4).color = Color.white; ((TMP_Text)val4).fontStyle = (FontStyles)0; ((TMP_Text)val4).alignment = (TextAlignmentOptions)514; ((Graphic)val4).raycastTarget = false; RectTransform rectTransform = ((TMP_Text)val4).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; } private void Update() { InitUI(); if (_statusTimer > 0f) { _statusTimer -= Time.deltaTime; if (_statusTimer <= 0f && (Object)(object)_statusText != (Object)null) { ((Component)_statusText).gameObject.SetActive(false); } } if ((Object)(object)_timerText != (Object)null) { int value = Mathf.CeilToInt(_zombieSpawnTimer); ((TMP_Text)_timerText).text = $"Next Zombie spawn in: {value}s"; } ApplyZombieCapOverride(); _zombieSpawnTimer -= Time.deltaTime; if (_zombieSpawnTimer <= 0f) { _zombieSpawnTimer = 60f; SpawnZombieNearPlayer(); } } private void ApplyZombieCapOverride() { if (!PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient) { ZombieManager instance = ZombieManager.Instance; if (!((Object)(object)instance == (Object)null) && instance.maxActiveZombies < 100000) { instance.maxActiveZombies = 100000; Log.LogInfo((object)$"Set game zombie cap to {100000}."); } } } private void SpawnZombieNearPlayer() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { ShowStatus("No local character found!"); return; } Rigidbody componentInChildren = ((Component)localCharacter).GetComponentInChildren(); Vector3 position; Vector3 val; if ((Object)(object)componentInChildren != (Object)null) { position = componentInChildren.position; val = (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform.forward : ((Component)localCharacter).transform.forward); } else if ((Object)(object)Camera.main != (Object)null) { position = ((Component)Camera.main).transform.position; val = ((Component)Camera.main).transform.forward; } else { position = ((Component)localCharacter).transform.position; val = ((Component)localCharacter).transform.forward; } Vector3 val2 = position + val * 5f; GameObject zombie; if (PhotonNetwork.InRoom) { zombie = PhotonNetwork.Instantiate("MushroomZombie", val2, Quaternion.identity, (byte)0, (object[])null); } else { GameObject val3 = Resources.Load("MushroomZombie"); if ((Object)(object)val3 == (Object)null) { ShowStatus("MushroomZombie prefab not found!"); return; } zombie = Object.Instantiate(val3, val2, Quaternion.identity); } AddZombieLabel(zombie); ShowStatus("Zombie spawned near player!"); } } [HarmonyPatch(typeof(MushroomZombieBiteCollider), "OnTriggerEnter")] internal static class ZombieBiteNoSporesPatch { private static bool Prefix(MushroomZombieBiteCollider __instance, Collider other) { if (Time.time - __instance.lastBitLocalCharacter < 5f) { return false; } Character val = default(Character); if (!CharacterRagdoll.TryGetCharacterFromCollider(other, ref val) || !val.IsLocal) { return false; } __instance.lastBitLocalCharacter = Time.time; float num = (val.data.isSkeleton ? (__instance.parentZombie.biteInitialInjury / 8f * 2f) : __instance.parentZombie.biteInitialInjury); val.refs.afflictions.AddStatus((STATUSTYPE)0, num, false, true, true); val.Fall(__instance.parentZombie.biteStunTime, 0f); __instance.parentZombie.OnBitCharacter(val); return false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }