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 AdrenalineMode v1.0.0
AdrenalineMode.dll
Decompiled 3 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("AdrenalineMode")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AdrenalineMode")] [assembly: AssemblyTitle("AdrenalineMode")] [assembly: AssemblyVersion("1.0.0.0")] [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 AdrenalineMode { public static class AdrenalineFirstPersonLock { public static bool IsEnabled { get; private set; } = true; public static void Init() { Debug.Log((object)"[AdrenalineMode] Permanent First-Person Lock initialized"); } } [HarmonyPatch(typeof(GameCamera), "LateUpdate")] public static class FPLateUpdatePatch { [HarmonyPrefix] private static bool Prefix(GameCamera __instance) { //IL_0049: 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) if (!AdrenalineFirstPersonLock.IsEnabled || (Object)(object)Player.m_localPlayer == (Object)null) { return true; } if (RoguePerkUI.IsOpen || InventoryGui.IsVisible() || Menu.IsVisible()) { ((Component)__instance).transform.position = ((Character)Player.m_localPlayer).m_eye.position; return false; } if (AdrenalineLerpManager.IsLerping) { ((Component)__instance).transform.position = ((Character)Player.m_localPlayer).m_eye.position; return false; } return false; } [HarmonyPostfix] private static void Postfix(GameCamera __instance) { //IL_007d: 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) if (AdrenalineFirstPersonLock.IsEnabled && !((Object)(object)Player.m_localPlayer == (Object)null) && !AdrenalineLerpManager.IsLerping && !RoguePerkUI.IsOpen && !InventoryGui.IsVisible() && !Menu.IsVisible()) { Player localPlayer = Player.m_localPlayer; AccessTools.Field(typeof(GameCamera), "m_distance").SetValue(__instance, 0f); ((Component)__instance).transform.position = ((Character)localPlayer).m_eye.position; ((Component)__instance).transform.rotation = ((Character)localPlayer).m_eye.rotation; } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] public static class FPMouseCapturePatch { [HarmonyPrefix] private static bool Prefix() { if (!AdrenalineFirstPersonLock.IsEnabled) { return true; } if (RoguePerkUI.IsOpen || InventoryGui.IsVisible() || Menu.IsVisible()) { return true; } return false; } } public class AdrenalineLerpManager { private enum LerpPhase { Idle, LerpTo, LerpBack } public static float MaxTriggerDistance = 13.71f; public static float LerpToDuration = 0.75f; public static float LerpBackDuration = 0.5f; public static float LerpChance = 0.3f; public static float CooldownSeconds = 30f; public static float GlobalCooldownSeconds = 5f; private LerpPhase _phase; public GameCamera? _gameCamera; public Transform? _playerTransform; private Vector3 _currentTarget; private Quaternion _startRot; private Quaternion _peekRot; private float _lerpTimer; private float _globalCooldownUntil; private readonly Dictionary<string, float> _enemyCooldowns = new Dictionary<string, float>(); public static AdrenalineLerpManager? Instance { get; private set; } public static bool IsLerping { get; private set; } public static void Init() { Instance = new AdrenalineLerpManager(); Debug.Log((object)"[AdrenalineMode] Lerp system initialized!"); } public void CheckForThreatsAndLerp() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) if (IsLerping || (Object)(object)_playerTransform == (Object)null || Time.time < _globalCooldownUntil) { return; } Collider[] array = Physics.OverlapSphere(_playerTransform.position, MaxTriggerDistance, LayerMask.GetMask(new string[1] { "character" })); float num = float.MaxValue; string key = ""; Vector3 val = Vector3.zero; Collider[] array2 = array; foreach (Collider val2 in array2) { if ((Object)(object)((Component)val2).transform == (Object)(object)_playerTransform || (!((Object)(object)((Component)val2).GetComponent<MonsterAI>() != (Object)null) && !((Object)(object)((Component)val2).GetComponent<AnimalAI>() != (Object)null))) { continue; } string text = ((Object)((Component)val2).transform).GetInstanceID().ToString(); if (!_enemyCooldowns.ContainsKey(text) || !(Time.time < _enemyCooldowns[text])) { float num2 = Vector3.Distance(((Component)val2).transform.position, _playerTransform.position); if (num2 < num) { num = num2; key = text; val = ((Component)val2).transform.position + Vector3.up * 1.5f; } } } if (num < MaxTriggerDistance && val != Vector3.zero && Random.Range(0f, 1f) < LerpChance) { _enemyCooldowns[key] = Time.time + CooldownSeconds; _globalCooldownUntil = Time.time + GlobalCooldownSeconds; TriggerLerp(val); } } private void TriggerLerp(Vector3 targetPos) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) _currentTarget = targetPos; IsLerping = true; _phase = LerpPhase.LerpTo; _lerpTimer = 0f; if ((Object)(object)_gameCamera != (Object)null) { _startRot = ((Component)_gameCamera).transform.rotation; } LerpXPManager.TryAddXP(); } public void UpdateLerp() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_00d5: Unknown result type (might be due to invalid IL or missing references) if (_phase == LerpPhase.Idle || (Object)(object)_gameCamera == (Object)null) { return; } _lerpTimer += Time.deltaTime; if (_phase == LerpPhase.LerpTo) { float num = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(_lerpTimer / LerpToDuration)); Vector3 val = _currentTarget - ((Component)_gameCamera).transform.position; Vector3 normalized = ((Vector3)(ref val)).normalized; ((Component)_gameCamera).transform.rotation = Quaternion.Slerp(_startRot, Quaternion.LookRotation(normalized), num); if (_lerpTimer >= LerpToDuration) { _peekRot = ((Component)_gameCamera).transform.rotation; _phase = LerpPhase.LerpBack; _lerpTimer = 0f; } } else if (_phase == LerpPhase.LerpBack) { float num2 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01(_lerpTimer / LerpBackDuration)); ((Component)_gameCamera).transform.rotation = Quaternion.Slerp(_peekRot, _startRot, num2); if (_lerpTimer >= LerpBackDuration) { _phase = LerpPhase.Idle; IsLerping = false; } } } } [HarmonyPatch(typeof(Player), "Update")] public static class LerpPlayerUpdatePatch { [HarmonyPostfix] private static void Postfix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && AdrenalineLerpManager.Instance != null) { AdrenalineLerpManager instance = AdrenalineLerpManager.Instance; if ((Object)(object)instance._gameCamera == (Object)null) { instance._gameCamera = GameCamera.instance; } instance._playerTransform = ((Component)__instance).transform; instance.CheckForThreatsAndLerp(); instance.UpdateLerp(); } } } [HarmonyPatch(typeof(Player), "PlayerAttackInput")] public static class PerkUIBlockInputPatch { [HarmonyPrefix] private static bool Prefix() { return !RoguePerkUI.IsOpen; } } [BepInPlugin("com.amos.adrenalinemode", "Adrenaline Mode", "1.0.0")] [BepInProcess("valheim.exe")] public class AdrenalineModePlugin : BaseUnityPlugin { public static AdrenalineModePlugin? Instance { get; private set; } public static ManualLogSource? Logger { get; private set; } private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"[AdrenalineMode] Mod loading..."); AdrenalineLerpManager.Init(); AdrenalineFirstPersonLock.Init(); PressureSpawn.Init(Logger); LerpXPManager.Init(); RoguePerkManager.Init(); Harmony.CreateAndPatchAll(typeof(LerpPlayerUpdatePatch), "com.amos.lerp"); Harmony.CreateAndPatchAll(typeof(PerkUIBlockInputPatch), "com.amos.perkblock"); Harmony.CreateAndPatchAll(typeof(FPLateUpdatePatch), "com.amos.fp"); Harmony.CreateAndPatchAll(typeof(FPMouseCapturePatch), "com.amos.fp2"); Harmony.CreateAndPatchAll(typeof(PressureSpawnPlayerPatch), "com.amos.spawn"); Harmony.CreateAndPatchAll(typeof(PressureSpawnDamagePatch), "com.amos.damage"); Harmony.CreateAndPatchAll(typeof(RoguePerkUI), "com.amos.perkui"); Harmony.CreateAndPatchAll(typeof(PickableInteractPatch), "com.amos.harvest"); Logger.LogInfo((object)"[AdrenalineMode] v1.0.0 initialized successfully!"); } private void Update() { PressureSpawn.Update(); RoguePerkManager.Update(); } private void OnDestroy() { ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"[AdrenalineMode] Mod shutting down."); } } } public static class LerpXPManager { private const int XpPerRoguePoint = 25; private const float XpCooldown = 5f; private const float XpChance = 1f; private const string KeyXP = "AdrenalineMode_XP"; private const string KeyRP = "AdrenalineMode_RP"; private const string KeyRPSpent = "AdrenalineMode_RPSpent"; private static int _currentXP; private static int _roguePoints; private static int _totalRpSpent; private static float _lastXPTimestamp; public static int CurrentXP => _currentXP; public static int RoguePoints => _roguePoints; public static int TotalRpSpent => _totalRpSpent; public static event Action<int, int>? OnXPGained; public static void Init() { } public static void OnPlayerSpawned() { Load(); LerpXPUI.Create(); RoguePerkUI.Create(); } public static void TryAddXP() { if (!(Time.time - _lastXPTimestamp < 5f) && !(Random.value > 1f)) { _lastXPTimestamp = Time.time; _currentXP++; if (_currentXP >= 25) { _roguePoints++; _currentXP = 0; } Save(); LerpXPManager.OnXPGained?.Invoke(_currentXP, _roguePoints); } } private static void Save() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { localPlayer.m_customData["AdrenalineMode_XP"] = _currentXP.ToString(); localPlayer.m_customData["AdrenalineMode_RP"] = _roguePoints.ToString(); localPlayer.m_customData["AdrenalineMode_RPSpent"] = _totalRpSpent.ToString(); } } public static void SpendRoguePoints(int amount) { _roguePoints = Mathf.Max(0, _roguePoints - amount); _totalRpSpent += amount; Save(); LerpXPManager.OnXPGained?.Invoke(_currentXP, _roguePoints); } private static void Load() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { if (localPlayer.m_customData.TryGetValue("AdrenalineMode_XP", out var value) && int.TryParse(value, out var result)) { _currentXP = result; } if (localPlayer.m_customData.TryGetValue("AdrenalineMode_RP", out var value2) && int.TryParse(value2, out var result2)) { _roguePoints = result2; } if (localPlayer.m_customData.TryGetValue("AdrenalineMode_RPSpent", out var value3) && int.TryParse(value3, out var result3)) { _totalRpSpent = result3; } } } } public class LerpXPUI : MonoBehaviour { private static LerpXPUI? _instance; private static readonly Color SegmentEmpty = new Color(0.15f, 0.15f, 0.15f, 0.75f); private static readonly Color SegmentFilled = new Color(1f, 0.75f, 0f, 0.9f); private static readonly Color PipEmpty = new Color(0.2f, 0.2f, 0.2f, 0.7f); private static readonly Color PipFilled = new Color(0.9f, 0.4f, 1f, 0.9f); private const int Segments = 4; private const int XpPerSeg = 5; private const int MaxPips = 10; private Image[]? _segments; private Image[]? _pips; public static void Create() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!((Object)(object)_instance != (Object)null)) { GameObject val = new GameObject("LerpXPUI"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<LerpXPUI>(); } } 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; BuildUI(); LerpXPManager.OnXPGained += Refresh; } private void OnDestroy() { LerpXPManager.OnXPGained -= Refresh; if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } private void BuildUI() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0050: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("LerpXPCanvas"); val.transform.SetParent(((Component)this).transform); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 100; CanvasScaler val3 = val.AddComponent<CanvasScaler>(); val3.uiScaleMode = (ScaleMode)1; val3.referenceResolution = new Vector2(1920f, 1080f); val.AddComponent<GraphicRaycaster>(); Vector2 anchorMin = default(Vector2); ((Vector2)(ref anchorMin))..ctor(1f, 1f); Vector2 anchorMax = default(Vector2); ((Vector2)(ref anchorMax))..ctor(1f, 1f); GameObject val4 = MakeRect(val, "XPPanel", new Vector2(-10f, -332f), new Vector2(200f, 36f), anchorMin, anchorMax); Image val5 = val4.AddComponent<Image>(); ((Graphic)val5).color = new Color(0f, 0f, 0f, 0.45f); ((Graphic)val5).raycastTarget = false; _segments = (Image[]?)(object)new Image[4]; float num = 36f; float num2 = 20f; float num3 = 4f; float num4 = 4f * num + 3f * num3; float num5 = (0f - (200f - num4)) / 2f - num4 + 200f - 8f; for (int i = 0; i < 4; i++) { float num6 = num5 + (float)i * (num + num3); GameObject val6 = MakeRect(val4.gameObject, $"Seg{i}", new Vector2(8f + (float)i * (num + num3), -8f), new Vector2(num, num2), Vector2.zero, Vector2.zero); _segments[i] = val6.AddComponent<Image>(); ((Graphic)_segments[i]).color = SegmentEmpty; ((Graphic)_segments[i]).raycastTarget = false; } _pips = (Image[]?)(object)new Image[10]; float num7 = 8f; float num8 = 3f; for (int j = 0; j < 10; j++) { GameObject val7 = MakeRect(val4.gameObject, $"Pip{j}", new Vector2(8f + (float)j * (num7 + num8), -32f), new Vector2(num7, num7), Vector2.zero, Vector2.zero); _pips[j] = val7.AddComponent<Image>(); ((Graphic)_pips[j]).color = PipEmpty; ((Graphic)_pips[j]).raycastTarget = false; } Refresh(LerpXPManager.CurrentXP, LerpXPManager.RoguePoints); } private void Refresh(int currentXP, int roguePoints) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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) if (_segments != null && _pips != null) { for (int i = 0; i < 4; i++) { ((Graphic)_segments[i]).color = ((currentXP > i * 5) ? SegmentFilled : SegmentEmpty); } for (int j = 0; j < 10; j++) { ((Graphic)_pips[j]).color = ((j < roguePoints) ? PipFilled : PipEmpty); } } } private static GameObject MakeRect(GameObject parent, string name, Vector2 anchoredPos, Vector2 size, Vector2 anchorMin, Vector2 anchorMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0023: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) GameObject val = new GameObject(name); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = anchorMin; val2.anchorMax = anchorMax; val2.pivot = anchorMin; val2.anchoredPosition = anchoredPos; val2.sizeDelta = size; return val; } } public static class PressureSpawn { private const float CheckInterval = 15f; private static float _nextCheckTime; private static bool _initialized; private static bool _debugMode = true; private static float _debugStartTime = float.MaxValue; private static ManualLogSource? _log; private static readonly Dictionary<Biome, string> BiomeEvents = new Dictionary<Biome, string> { { (Biome)1, "army_eikthyr" }, { (Biome)8, "army_theelder" }, { (Biome)2, "army_bonemass" }, { (Biome)4, "army_moder" }, { (Biome)16, "army_goblin" }, { (Biome)512, "army_queen" }, { (Biome)32, "army_asksvin" } }; private static readonly Dictionary<Biome, float> BiomeDamageCap = new Dictionary<Biome, float> { { (Biome)1, 1f }, { (Biome)8, 3f }, { (Biome)2, 6f }, { (Biome)4, 10f }, { (Biome)16, 15f }, { (Biome)512, 20f }, { (Biome)32, 25f } }; private static Biome _lastKnownBiome = (Biome)0; public static bool IsPressureEventActive { get; private set; } public static Biome ActiveEventBiome { get; private set; } public static void Init(ManualLogSource logger) { _log = logger; _initialized = true; _log.LogInfo((object)"PressureSpawn system initialized."); } public static void OnPlayerSpawned() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RandEventSystem.instance != (Object)null) { RandEventSystem.instance.ResetRandomEvent(); } IsPressureEventActive = false; _lastKnownBiome = (Biome)0; _nextCheckTime = Time.time + 15f; _debugStartTime = Time.time + 60f; if (_debugMode) { ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)"PressureSpawn: player spawned, event cleared, timer started."); } } } public static void Update() { //IL_0070: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Invalid comparison between Unknown and I4 //IL_010f: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) if (!_initialized || !Object.op_Implicit((Object)(object)ZNet.instance) || (!ZNet.instance.IsServer() && ZNet.instance.IsDedicated())) { return; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return; } Biome currentBiome = GetCurrentBiome(((Component)localPlayer).transform.position); if ((int)currentBiome != 0 && currentBiome != _lastKnownBiome) { if ((int)_lastKnownBiome > 0) { if ((Object)(object)RandEventSystem.instance != (Object)null) { RandEventSystem.instance.ResetRandomEvent(); } IsPressureEventActive = false; _nextCheckTime = Time.time + 5f; if (_debugMode && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString($"<color=cyan>[PressureSpawn] Biome changed to {currentBiome}, resetting event.</color>"); } } _lastKnownBiome = currentBiome; } if (_debugMode) { if (Time.time < _debugStartTime) { return; } } else if (!IsPressureSystemActive()) { return; } if (IsPressureEventActive && !RandEventSystem.HaveActiveEvent()) { IsPressureEventActive = false; _nextCheckTime = Time.time + 15f; if (_debugMode && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString("<color=cyan>[PressureSpawn] Event ended, next in 15s.</color>"); } } if (Time.time < _nextCheckTime) { return; } _nextCheckTime = Time.time + 15f; if ((Object)(object)ZNetScene.instance == (Object)null || (Object)(object)ZoneSystem.instance == (Object)null) { if (_debugMode && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString("<color=red>[PressureSpawn] Scene not ready</color>"); } return; } if ((Object)(object)RandEventSystem.instance == (Object)null) { if (_debugMode && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString("<color=red>[PressureSpawn] RandEventSystem null</color>"); } return; } if (RandEventSystem.HaveActiveEvent()) { if (_debugMode && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString("<color=red>[PressureSpawn] Event already active</color>"); } return; } Biome currentBiome2 = GetCurrentBiome(((Component)localPlayer).transform.position); if (!BiomeEvents.TryGetValue(currentBiome2, out string value)) { if (_debugMode && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString($"<color=red>[PressureSpawn] No event for biome: {currentBiome2}</color>"); } return; } RandEventSystem.instance.SetRandomEventByName(value, ((Component)localPlayer).transform.position); IsPressureEventActive = true; ActiveEventBiome = currentBiome2; ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)$"PressureSpawn: triggered {value} in {currentBiome2}."); } if (_debugMode && (Object)(object)Chat.instance != (Object)null) { ((Terminal)Chat.instance).AddString($"<color=yellow>[PressureSpawn] {currentBiome2} raid triggered!</color>"); } } private static bool IsPressureSystemActive() { if (!Object.op_Implicit((Object)(object)EnvMan.instance)) { return false; } double num = (((Object)(object)ZNet.instance != (Object)null) ? (ZNet.instance.GetTime() - DateTime.MinValue).TotalSeconds : 0.0); int num2 = (int)(num / (double)EnvMan.instance.m_dayLengthSec) + 1; double num3 = num % (double)EnvMan.instance.m_dayLengthSec; double num4 = num3 / 3600.0; if (num2 < 1) { return false; } if (num2 == 1 && num4 < 4.0) { return false; } return true; } private static Biome GetCurrentBiome(Vector3 position) { //IL_0016: 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_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) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (WorldGenerator.instance == null) { return (Biome)0; } return WorldGenerator.instance.GetBiome(position.x, position.z, 0.02f, false); } public static float? GetDamageCap() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!IsPressureEventActive) { return null; } if (BiomeDamageCap.TryGetValue(ActiveEventBiome, out var value)) { return value; } return null; } public static float GetPressureDamageBonus() { int totalRpSpent = LerpXPManager.TotalRpSpent; if (totalRpSpent >= 800) { return 20f; } if (totalRpSpent >= 600) { return 18f; } if (totalRpSpent >= 450) { return 16f; } if (totalRpSpent >= 350) { return 14f; } if (totalRpSpent >= 275) { return 12f; } if (totalRpSpent >= 200) { return 10f; } if (totalRpSpent >= 150) { return 8f; } if (totalRpSpent >= 100) { return 6f; } if (totalRpSpent >= 75) { return 5f; } if (totalRpSpent >= 50) { return 4f; } if (totalRpSpent >= 25) { return 3f; } if (totalRpSpent >= 10) { return 2f; } return 0f; } } [HarmonyPatch(typeof(Player), "OnSpawned")] public static class PressureSpawnPlayerPatch { [HarmonyPostfix] private static void Postfix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { PressureSpawn.OnPlayerSpawned(); LerpXPManager.OnPlayerSpawned(); RoguePerkManager.OnPlayerSpawned(); RoguePerkUI.ShowOnRespawn(); } } } [HarmonyPatch(typeof(Character), "Damage")] public static class PressureSpawnDamagePatch { public static void Prefix(Character __instance, HitData hit) { //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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) if (hit == null || !__instance.IsPlayer()) { return; } float? damageCap = PressureSpawn.GetDamageCap(); if (!damageCap.HasValue) { return; } Character attacker = hit.GetAttacker(); if (!Object.op_Implicit((Object)(object)attacker) || (Object)(object)((Component)attacker).GetComponent<Player>() != (Object)null) { return; } DamageTypes damage = hit.m_damage; float num = damage.m_damage + damage.m_blunt + damage.m_slash + damage.m_pierce + damage.m_fire + damage.m_frost + damage.m_lightning + damage.m_poison + damage.m_spirit; if (num <= 0.001f || num <= damageCap.Value) { return; } float num2 = damageCap.Value / num; damage.m_damage *= num2; damage.m_blunt *= num2; damage.m_slash *= num2; damage.m_pierce *= num2; damage.m_fire *= num2; damage.m_frost *= num2; damage.m_lightning *= num2; damage.m_poison *= num2; damage.m_spirit *= num2; float pressureDamageBonus = PressureSpawn.GetPressureDamageBonus(); if (pressureDamageBonus > 0f) { int num3 = 0; if (damage.m_blunt > 0f) { num3++; } if (damage.m_slash > 0f) { num3++; } if (damage.m_pierce > 0f) { num3++; } if (damage.m_fire > 0f) { num3++; } if (damage.m_frost > 0f) { num3++; } if (damage.m_lightning > 0f) { num3++; } if (damage.m_poison > 0f) { num3++; } if (damage.m_spirit > 0f) { num3++; } if (damage.m_damage > 0f) { num3++; } float num4 = ((num3 > 0) ? (pressureDamageBonus / (float)num3) : pressureDamageBonus); if (damage.m_blunt > 0f) { damage.m_blunt += num4; } if (damage.m_slash > 0f) { damage.m_slash += num4; } if (damage.m_pierce > 0f) { damage.m_pierce += num4; } if (damage.m_fire > 0f) { damage.m_fire += num4; } if (damage.m_frost > 0f) { damage.m_frost += num4; } if (damage.m_lightning > 0f) { damage.m_lightning += num4; } if (damage.m_poison > 0f) { damage.m_poison += num4; } if (damage.m_spirit > 0f) { damage.m_spirit += num4; } if (damage.m_damage > 0f) { damage.m_damage += num4; } } hit.m_damage = damage; } } [Serializable] public class RoguePerk { public string Id; public string Name; public string Description; public int CurrentRank = 0; public int MaxRank = 20; public Func<int, int> CostFunction; public Action<int> ApplyEffect; public RoguePerk(string id, string name, string desc, Func<int, int> costFunc, Action<int> apply) { Id = id; Name = name; Description = desc; CostFunction = costFunc; ApplyEffect = apply; } public int GetCostForNextRank() { int arg = CurrentRank + 1; return CostFunction(arg); } public bool CanRankUp() { return CurrentRank < MaxRank; } } public static class RoguePerkManager { public static readonly Dictionary<string, RoguePerk> Perks = new Dictionary<string, RoguePerk>(); public static readonly List<RoguePerk> PerkList = new List<RoguePerk>(); private const string KeyPrefix = "AdrenalineMode_Perk_"; private const string KeySkillBase = "AdrenalineMode_SkillBase_"; private static float _baseHP; private static float _baseStamina; private static float _baseWalkSpeed; private static float _baseRunSpeed; private static bool _baseCaptured; private static readonly Dictionary<SkillType, float> _baseSkillLevels = new Dictionary<SkillType, float>(); private static float _regenTimer; private static float _fireRingTimer; private static float _wildStrikeTimer; public static void Init() { RegisterPerks(); } public static void OnPlayerSpawned() { _baseSkillLevels.Clear(); CaptureBaseValues(); Load(); foreach (KeyValuePair<string, RoguePerk> perk in Perks) { if (perk.Value.CurrentRank > perk.Value.MaxRank) { perk.Value.CurrentRank = perk.Value.MaxRank; } } ReapplyAll(); } private static void CaptureBaseValues() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !_baseCaptured) { _baseHP = localPlayer.m_baseHP; _baseStamina = localPlayer.m_baseStamina; _baseWalkSpeed = ((Character)localPlayer).m_walkSpeed; _baseRunSpeed = ((Character)localPlayer).m_runSpeed; _baseCaptured = true; } } private static void ReapplyAll() { foreach (KeyValuePair<string, RoguePerk> perk in Perks) { if (perk.Value.CurrentRank > 0) { perk.Value.ApplyEffect(perk.Value.CurrentRank); } } } private static void RegisterPerks() { Func<int, int> costFunc = delegate(int rank) { if (rank <= 5) { return 1; } return (rank <= 14) ? 2 : 3; }; Perks["maxhp"] = new RoguePerk("maxhp", "Max Health", "+10 Max HP per rank (max rank 20)", costFunc, delegate(int rank) { ApplyMaxHP(rank); }); PerkList.Add(Perks["maxhp"]); Perks["maxstamina"] = new RoguePerk("maxstamina", "Max Stamina", "+10 Max Stamina per rank (max rank 20)", costFunc, delegate(int rank) { ApplyMaxStamina(rank); }); PerkList.Add(Perks["maxstamina"]); Perks["movespeed"] = new RoguePerk("movespeed", "Move Speed", "+0.5% Move Speed per rank (max rank 20)", costFunc, delegate(int rank) { ApplyMoveSpeed(rank); }); PerkList.Add(Perks["movespeed"]); Func<int, int> costFunc2 = (int _) => 4; Perks["liferegen"] = new RoguePerk("liferegen", "Life Regeneration", "+1 HP per 5s per rank (max 10 HP/5s)", costFunc2, delegate { }); Perks["liferegen"].MaxRank = 10; PerkList.Add(Perks["liferegen"]); Func<int, int> costFunc3 = (int _) => 5; Perks["greengreedy"] = new RoguePerk("greengreedy", "Green and Greedy", "+1 harvest from plants per rank", costFunc3, delegate { }); Perks["greengreedy"].MaxRank = 5; PerkList.Add(Perks["greengreedy"]); Func<int, int> costFunc4 = (int _) => 1; Perks["clublugger"] = new RoguePerk("clublugger", "Club Lugger", "+5 Clubs skill per rank", costFunc4, delegate(int rank) { ApplyWeaponSkill((SkillType)3, rank); }); Perks["clublugger"].MaxRank = 20; PerkList.Add(Perks["clublugger"]); Perks["bowmastery"] = new RoguePerk("bowmastery", "Bow Mastery", "+5 Bows skill per rank", costFunc4, delegate(int rank) { ApplyWeaponSkill((SkillType)8, rank); }); Perks["bowmastery"].MaxRank = 20; PerkList.Add(Perks["bowmastery"]); Func<int, int> costFunc5 = (int _) => 20; Perks["firenova"] = new RoguePerk("firenova", "Fire Nova", "+10% fire damage per rank, fires 20 fireballs in a ring every 15s", costFunc5, delegate { }); Perks["firenova"].MaxRank = 10; PerkList.Add(Perks["firenova"]); Func<int, int> costFunc6 = delegate(int rank) { if (rank == 1) { return 25; } return (rank <= 9) ? 30 : 50; }; Perks["wildstrike"] = new RoguePerk("wildstrike", "Wild Strike", "Fires a wild root every 10s. Rank 2-9: +10%/rank. Rank 10: +20% bonus", costFunc6, delegate { }); Perks["wildstrike"].MaxRank = 10; PerkList.Add(Perks["wildstrike"]); Func<int, int> costFunc7 = delegate(int rank) { if (rank <= 5) { return 1; } if (rank <= 10) { return 2; } return (rank <= 15) ? 3 : 4; }; Perks["stout"] = new RoguePerk("stout", "Stout", "+5 carry weight per rank", costFunc7, delegate(int rank) { ApplyCarryWeight(rank); }); Perks["stout"].MaxRank = 20; PerkList.Add(Perks["stout"]); } public static void Update() { Player localPlayer = Player.m_localPlayer; if (Perks.TryGetValue("liferegen", out RoguePerk value) && value.CurrentRank > 0 && (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead()) { _regenTimer += Time.deltaTime; if (_regenTimer >= 5f) { _regenTimer = 0f; ((Character)localPlayer).Heal((float)value.CurrentRank, true); } } if (Perks.TryGetValue("firenova", out RoguePerk value2) && value2.CurrentRank > 0 && (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead()) { _fireRingTimer += Time.deltaTime; if (_fireRingTimer >= 15f) { _fireRingTimer = 0f; FireNovaBurst(localPlayer, value2.CurrentRank); } } if (Perks.TryGetValue("wildstrike", out RoguePerk value3) && value3.CurrentRank > 0 && (Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead()) { _wildStrikeTimer += Time.deltaTime; if (_wildStrikeTimer >= 10f) { _wildStrikeTimer = 0f; WildStrikeFire(localPlayer, value3.CurrentRank); } } } private static void FireNovaBurst(Player player, int rank) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[4] { "GoblinShaman_projectile_fireball", "Imp_fireball_projectile", "charred_fireball_projectile", "DvergerStaffFire_fireball_projectile" }; GameObject val = null; string[] array2 = array; foreach (string text in array2) { ZNetScene instance = ZNetScene.instance; val = ((instance != null) ? instance.GetPrefab(text) : null); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"[AdrenalineMode] FireNova: no fireball prefab found. Check assembly for correct name."); return; } float fire = 20f * (1f + (float)rank * 0.1f); Vector3 position = ((Character)player).m_eye.position; for (int j = 0; j < 20; j++) { float num = (float)j * 18f; Vector3 val2 = Quaternion.Euler(0f, num, 0f) * Vector3.forward; GameObject val3 = Object.Instantiate<GameObject>(val, position, Quaternion.LookRotation(val2)); Projectile component = val3.GetComponent<Projectile>(); if ((Object)(object)component != (Object)null) { HitData val4 = new HitData(); val4.m_skill = (SkillType)9; val4.m_damage.m_fire = fire; val4.m_pushForce = 5f; val4.m_point = position; val4.m_dir = val2; val4.m_attacker = ((Character)player).GetZDOID(); component.Setup((Character)(object)player, val2 * 15f, -1f, val4, (ItemData)null, (ItemData)null); } ZNetView component2 = val3.GetComponent<ZNetView>(); if ((Object)(object)component2 != (Object)null && component2.GetZDO() != null && (Object)(object)ZNetScene.instance != (Object)null) { ZNetScene.instance.AddInstance(component2.GetZDO(), component2); } } } private static void WildStrikeFire(Player player, int rank) { //IL_0095: 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_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_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_00b4: 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_00b8: 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_00e3: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_012e: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.GetPrefab("staff_greenroots_projectile") : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"[AdrenalineMode] WildStrike: staff_greenroots_projectile not found."); return; } float num = ((rank <= 1) ? 1f : ((rank > 9) ? 2f : (1f + (float)(rank - 1) * 0.1f))); float spirit = 30f * num; float num2 = Random.Range(0f, 360f); Vector3 val2 = Quaternion.Euler(0f, num2, 0f) * Vector3.forward; Vector3 position = ((Character)player).m_eye.position; GameObject val3 = Object.Instantiate<GameObject>(val, position, Quaternion.LookRotation(val2)); Projectile component = val3.GetComponent<Projectile>(); if ((Object)(object)component != (Object)null) { HitData val4 = new HitData(); val4.m_skill = (SkillType)13; val4.m_damage.m_spirit = spirit; val4.m_pushForce = 10f; val4.m_point = position; val4.m_dir = val2; val4.m_attacker = ((Character)player).GetZDOID(); component.Setup((Character)(object)player, val2 * 20f, -1f, val4, (ItemData)null, (ItemData)null); } ZNetView component2 = val3.GetComponent<ZNetView>(); if ((Object)(object)component2 != (Object)null && component2.GetZDO() != null && (Object)(object)ZNetScene.instance != (Object)null) { ZNetScene.instance.AddInstance(component2.GetZDO(), component2); } } private static void ApplyMaxHP(int rank) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { localPlayer.m_baseHP = _baseHP + (float)rank * 10f; } } private static void ApplyMaxStamina(int rank) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { localPlayer.m_baseStamina = _baseStamina + (float)rank * 10f; } } private static void ApplyMoveSpeed(int rank) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { float num = 1f + (float)rank * 0.005f; ((Character)localPlayer).m_walkSpeed = _baseWalkSpeed * num; ((Character)localPlayer).m_runSpeed = _baseRunSpeed * num; } } private static void ApplyWeaponSkill(SkillType skillType, int rank) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_0238: 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_00ea: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Skills skills = ((Character)localPlayer).GetSkills(); if (!_baseSkillLevels.ContainsKey(skillType)) { string key = "AdrenalineMode_SkillBase_" + ((object)(SkillType)(ref skillType)).ToString(); if (localPlayer.m_customData.TryGetValue(key, out var value) && float.TryParse(value, out var result)) { _baseSkillLevels[skillType] = result; } else { float value2 = 0f; foreach (Skill skill in skills.GetSkillList()) { if (skill.m_info.m_skill == skillType) { value2 = skill.m_level; break; } } _baseSkillLevels[skillType] = value2; localPlayer.m_customData[key] = value2.ToString(); } } float num = Mathf.Clamp(_baseSkillLevels[skillType] + (float)rank * 5f, 0f, 100f); foreach (Skill skill2 in skills.GetSkillList()) { if (skill2.m_info.m_skill == skillType) { skill2.m_level = num; return; } } if (AccessTools.Field(typeof(Skills), "m_skillData").GetValue(skills) is Dictionary<SkillType, Skill> dictionary) { object? obj = AccessTools.Method(typeof(Skills), "GetSkillDef", (Type[])null, (Type[])null).Invoke(skills, new object[1] { skillType }); SkillDef val = (SkillDef)((obj is SkillDef) ? obj : null); if (val != null) { Skill val2 = (Skill)Activator.CreateInstance(typeof(Skill), val); AccessTools.Field(typeof(Skill), "m_level").SetValue(val2, num); dictionary[skillType] = val2; } } } private static void ApplyCarryWeight(int rank) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { FieldInfo fieldInfo = AccessTools.Field(typeof(Player), "m_addMaxCarryWeight"); if (fieldInfo != null) { fieldInfo.SetValue(localPlayer, (float)rank * 5f); } else { AccessTools.Field(typeof(Player), "m_maxCarryWeight").SetValue(localPlayer, 300f + (float)rank * 5f); } } } public static int GetHarvestBonus() { if (!Perks.TryGetValue("greengreedy", out RoguePerk value)) { return 0; } return value.CurrentRank; } public static bool TryBuyRank(string perkId) { if (!Perks.TryGetValue(perkId, out RoguePerk value)) { Debug.Log((object)("[Perk] " + perkId + " not found")); return false; } if (!value.CanRankUp()) { Debug.Log((object)$"[Perk] {perkId} maxed at {value.CurrentRank}/{value.MaxRank}"); return false; } int costForNextRank = value.GetCostForNextRank(); if (LerpXPManager.RoguePoints < costForNextRank) { Debug.Log((object)$"[Perk] {perkId} need {costForNextRank} RP have {LerpXPManager.RoguePoints}"); return false; } LerpXPManager.SpendRoguePoints(costForNextRank); value.CurrentRank++; value.ApplyEffect(value.CurrentRank); Debug.Log((object)$"[Perk] {perkId} now rank {value.CurrentRank}"); Save(); return true; } public static void Save() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } foreach (KeyValuePair<string, RoguePerk> perk in Perks) { localPlayer.m_customData["AdrenalineMode_Perk_" + perk.Key] = perk.Value.CurrentRank.ToString(); } } private static void Load() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } foreach (KeyValuePair<string, RoguePerk> perk in Perks) { if (localPlayer.m_customData.TryGetValue("AdrenalineMode_Perk_" + perk.Key, out var value) && int.TryParse(value, out var result)) { perk.Value.CurrentRank = result; } } } } [HarmonyPatch(typeof(Pickable), "Interact")] public static class PickableInteractPatch { [HarmonyPrefix] private static void Prefix(Pickable __instance) { int harvestBonus = RoguePerkManager.GetHarvestBonus(); if (harvestBonus > 0) { __instance.m_bonusYieldAmount = harvestBonus; } } [HarmonyPostfix] private static void Postfix(Pickable __instance) { __instance.m_bonusYieldAmount = 0; } } public class RoguePerkUI : MonoBehaviour { private class PerkRow { public string PerkId = ""; public Image[] Pips = null; public Image BuyBtn = null; public TextMeshProUGUI? RankText; public TextMeshProUGUI? CostText; } private static RoguePerkUI? _instance; private GameObject? _window; private bool _visible; private static readonly Color WinBg = new Color(0.05f, 0.05f, 0.08f, 0.97f); private static readonly Color TitleBg = new Color(0.12f, 0.05f, 0.2f, 1f); private static readonly Color RowBg = new Color(0.1f, 0.1f, 0.15f, 1f); private static readonly Color RankEmpty = new Color(0.2f, 0.2f, 0.28f, 1f); private static readonly Color BtnAfford = new Color(0.15f, 0.65f, 0.15f, 1f); private static readonly Color BtnCantAfford = new Color(0.45f, 0.1f, 0.1f, 1f); private static readonly Color CloseColor = new Color(0.65f, 0.1f, 0.1f, 1f); private static readonly Color RpFillColor = new Color(0.9f, 0.4f, 1f, 0.9f); private static readonly Color RpBgColor = new Color(0.15f, 0.15f, 0.2f, 0.8f); private static readonly Color ScrollBg = new Color(0.08f, 0.08f, 0.12f, 1f); private static readonly Color ScrollHandle = new Color(0.55f, 0.2f, 0.75f, 1f); public static readonly Color[] PerkColors = (Color[])(object)new Color[10] { new Color(1f, 0.3f, 0.3f, 1f), new Color(0.3f, 0.6f, 1f, 1f), new Color(0.3f, 0.9f, 0.4f, 1f), new Color(1f, 0.75f, 0.1f, 1f), new Color(0.2f, 0.85f, 0.2f, 1f), new Color(0.7f, 0.5f, 0.2f, 1f), new Color(0.9f, 0.9f, 0.3f, 1f), new Color(0.6f, 0.3f, 0.9f, 1f), new Color(0.9f, 0.5f, 0.2f, 1f), new Color(0.2f, 0.8f, 0.9f, 1f) }; private readonly List<PerkRow> _rows = new List<PerkRow>(); private Image? _rpFill; private TextMeshProUGUI? _rpLabel; private TMP_FontAsset? _font; private const float W = 500f; private const float H = 340f; private const float HeaderH = 66f; private const float SbW = 16f; private const float RowH = 62f; public static bool IsOpen => (Object)(object)_instance != (Object)null && _instance._visible; public static void Create() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if (!((Object)(object)_instance != (Object)null)) { GameObject val = new GameObject("RoguePerkUI"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<RoguePerkUI>(); } } private TMP_FontAsset? GetTMPFont() { if ((Object)(object)_font != (Object)null) { return _font; } if ((Object)(object)Hud.instance == (Object)null) { return null; } object? value = AccessTools.Field(typeof(Hud), "m_hoverName").GetValue(Hud.instance); TextMeshProUGUI val = (TextMeshProUGUI)((value is TextMeshProUGUI) ? value : null); if ((Object)(object)val != (Object)null) { _font = ((TMP_Text)val).font; } return _font; } 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; BuildWindow(); LerpXPManager.OnXPGained += delegate { RefreshIfVisible(); }; } private void OnDestroy() { LerpXPManager.OnXPGained -= delegate { RefreshIfVisible(); }; if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } private void Update() { } public static void ShowOnRespawn() { if (!((Object)(object)_instance == (Object)null)) { _instance._visible = true; _instance._window.SetActive(true); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; _instance.Refresh(); } } public void CloseWindow() { _visible = false; _window.SetActive(false); } private void Toggle() { _visible = !_visible; _window.SetActive(_visible); if (_visible) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; Refresh(); } } private void RefreshIfVisible() { if (_visible) { Refresh(); } } private void BuildWindow() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_00ab: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Expected O, but got Unknown //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Expected O, but got Unknown //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Expected O, but got Unknown //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Expected O, but got Unknown //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("RoguePerkCanvas"); val.transform.SetParent(((Component)this).transform); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 200; CanvasScaler val3 = val.AddComponent<CanvasScaler>(); val3.uiScaleMode = (ScaleMode)1; val3.referenceResolution = new Vector2(1920f, 1080f); val.AddComponent<GraphicRaycaster>(); GameObject val4 = new GameObject("RoguePerkEventSystem"); val4.transform.SetParent(((Component)this).transform); val4.AddComponent<EventSystem>(); val4.AddComponent<StandaloneInputModule>(); _window = MakePanel(val, "PerkWindow", 500f, 340f, new Vector2(0.5f, 0.5f), new Vector2(0f, 180f)); ((Graphic)_window.AddComponent<Image>()).color = WinBg; _window.SetActive(false); GameObject val5 = MakePanel(_window, "TitleBar", 500f, 36f, new Vector2(0f, 1f), new Vector2(0f, 0f)); ((Graphic)val5.AddComponent<Image>()).color = TitleBg; TextMeshProUGUI val6 = MakeTMP(val5, "Title", 450f, 36f); ((TMP_Text)val6).text = "ROGUE PERKS"; ((TMP_Text)val6).fontSize = 18f; ((Graphic)val6).color = new Color(0.9f, 0.5f, 1f); ((TMP_Text)val6).alignment = (TextAlignmentOptions)4097; OffsetTMP(val6, 10f, 0f); GameObject val7 = MakePanel(_window, "CloseBtn", 34f, 30f, new Vector2(1f, 1f), new Vector2(-4f, -3f)); ((Graphic)val7.AddComponent<Image>()).color = CloseColor; TextMeshProUGUI val8 = MakeTMP(val7, "X", 34f, 30f); ((TMP_Text)val8).text = "X"; ((TMP_Text)val8).fontSize = 18f; ((Graphic)val8).color = Color.white; ((TMP_Text)val8).alignment = (TextAlignmentOptions)514; ((UnityEvent)val7.AddComponent<Button>().onClick).AddListener(new UnityAction(CloseWindow)); GameObject val9 = MakePanel(_window, "RPBg", 484f, 20f, new Vector2(0f, 1f), new Vector2(8f, -40f)); Image val10 = val9.AddComponent<Image>(); ((Graphic)val10).color = RpBgColor; ((Graphic)val10).raycastTarget = false; GameObject val11 = MakePanel(val9, "RPFill", 0f, 20f, new Vector2(0f, 0f), Vector2.zero); _rpFill = val11.AddComponent<Image>(); ((Graphic)_rpFill).color = RpFillColor; ((Graphic)_rpFill).raycastTarget = false; RectTransform component = val11.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 0.5f); component.anchoredPosition = Vector2.zero; component.sizeDelta = new Vector2(0f, 0f); _rpLabel = MakeTMP(val9, "RPLabel", 476f, 20f); ((TMP_Text)_rpLabel).text = "Rogue Points: 0"; ((TMP_Text)_rpLabel).fontSize = 12f; ((Graphic)_rpLabel).color = Color.white; ((TMP_Text)_rpLabel).alignment = (TextAlignmentOptions)4097; OffsetTMP(_rpLabel, 4f, 0f); float h = 274f; GameObject val12 = MakePanel(_window, "Scrollbar", 16f, h, new Vector2(1f, 1f), new Vector2(-2f, -66f)); ((Graphic)val12.AddComponent<Image>()).color = ScrollBg; GameObject val13 = new GameObject("SlidingArea"); val13.transform.SetParent(val12.transform, false); RectTransform val14 = val13.AddComponent<RectTransform>(); val14.anchorMin = Vector2.zero; val14.anchorMax = Vector2.one; val14.sizeDelta = Vector2.zero; val14.anchoredPosition = Vector2.zero; GameObject val15 = new GameObject("Handle"); val15.transform.SetParent(val13.transform, false); RectTransform val16 = val15.AddComponent<RectTransform>(); val16.anchorMin = Vector2.zero; val16.anchorMax = Vector2.one; val16.sizeDelta = Vector2.zero; val16.anchoredPosition = Vector2.zero; Image val17 = val15.AddComponent<Image>(); ((Graphic)val17).color = ScrollHandle; Scrollbar val18 = val12.AddComponent<Scrollbar>(); val18.handleRect = val16; val18.direction = (Direction)2; ((Selectable)val18).targetGraphic = (Graphic)(object)val17; val18.value = 1f; float w = 480f; GameObject val19 = MakePanel(_window, "Viewport", w, h, new Vector2(0f, 1f), new Vector2(2f, -66f)); Image val20 = val19.AddComponent<Image>(); ((Graphic)val20).color = new Color(0f, 0f, 0f, 0.01f); val19.AddComponent<Mask>().showMaskGraphic = false; float num = (float)RoguePerkManager.PerkList.Count * 62f + 4f; GameObject val21 = new GameObject("Content"); val21.transform.SetParent(val19.transform, false); RectTransform val22 = val21.AddComponent<RectTransform>(); val22.anchorMin = new Vector2(0f, 1f); val22.anchorMax = new Vector2(1f, 1f); val22.pivot = new Vector2(0f, 1f); val22.anchoredPosition = Vector2.zero; val22.sizeDelta = new Vector2(0f, num); float num2 = 2f; for (int i = 0; i < RoguePerkManager.PerkList.Count; i++) { BuildRow(val21, RoguePerkManager.PerkList[i], i, num2); num2 += 62f; } GameObject val23 = new GameObject("ScrollRect"); val23.transform.SetParent(_window.transform, false); RectTransform val24 = val23.AddComponent<RectTransform>(); val24.anchorMin = new Vector2(0f, 0f); val24.anchorMax = new Vector2(1f, 1f); val24.offsetMin = new Vector2(0f, 0f); val24.offsetMax = new Vector2(0f, -66f); ScrollRect val25 = val23.AddComponent<ScrollRect>(); val25.content = val22; val25.viewport = val19.GetComponent<RectTransform>(); val25.verticalScrollbar = val18; val25.horizontal = false; val25.vertical = true; val25.scrollSensitivity = 40f; val25.movementType = (MovementType)2; val25.verticalScrollbarVisibility = (ScrollbarVisibility)0; } private void BuildRow(GameObject content, RoguePerk perk, int idx, float y) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00ce: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Expected O, but got Unknown //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) Color val = PerkColors[idx % PerkColors.Length]; Rect rect = content.GetComponent<RectTransform>().rect; float width = ((Rect)(ref rect)).width; GameObject val2 = new GameObject("Row_" + perk.Id); val2.transform.SetParent(content.transform, false); RectTransform val3 = val2.AddComponent<RectTransform>(); val3.anchorMin = new Vector2(0f, 1f); val3.anchorMax = new Vector2(1f, 1f); val3.pivot = new Vector2(0f, 1f); val3.anchoredPosition = new Vector2(0f, 0f - y); val3.sizeDelta = new Vector2(0f, 56f); Image val4 = val2.AddComponent<Image>(); ((Graphic)val4).color = RowBg; ((Graphic)val4).raycastTarget = false; GameObject val5 = MakePanel(val2, "Strip", 5f, 56f, new Vector2(0f, 0.5f), Vector2.zero); ((Graphic)val5.AddComponent<Image>()).color = val; Image component = val5.GetComponent<Image>(); ((Graphic)component).raycastTarget = false; TextMeshProUGUI val6 = MakeTMP(val2, "Name", 190f, 22f); ((TMP_Text)val6).text = perk.Name; ((TMP_Text)val6).fontSize = 13f; ((Graphic)val6).color = Color.white; ((TMP_Text)val6).alignment = (TextAlignmentOptions)257; ((TMP_Text)val6).fontStyle = (FontStyles)1; OffsetTMP(val6, 10f, -4f); TextMeshProUGUI val7 = MakeTMP(val2, "Rank", 190f, 18f); ((TMP_Text)val7).text = $"Rank {perk.CurrentRank} / {perk.MaxRank}"; ((TMP_Text)val7).fontSize = 11f; ((Graphic)val7).color = new Color(0.75f, 0.75f, 0.75f); ((TMP_Text)val7).alignment = (TextAlignmentOptions)257; OffsetTMP(val7, 10f, -28f); TextMeshProUGUI val8 = MakeTMP(val2, "Cost", 110f, 22f); ((TMP_Text)val8).text = $"Cost: {perk.GetCostForNextRank()} RP"; ((TMP_Text)val8).fontSize = 11f; ((Graphic)val8).color = new Color(1f, 0.85f, 0.2f); ((TMP_Text)val8).alignment = (TextAlignmentOptions)257; OffsetTMP(val8, 205f, -4f); int num = Mathf.Min(perk.MaxRank, 20); Image[] array = (Image[])(object)new Image[num]; for (int i = 0; i < num; i++) { float num2 = 205f + (float)(i % 10) * 13f; float num3 = -24f - (float)(i / 10) * 12f; GameObject val9 = new GameObject($"Pip{i}"); val9.transform.SetParent(val2.transform, false); RectTransform val10 = val9.AddComponent<RectTransform>(); val10.anchorMin = new Vector2(0f, 1f); val10.anchorMax = new Vector2(0f, 1f); val10.pivot = new Vector2(0f, 1f); val10.anchoredPosition = new Vector2(num2, num3); val10.sizeDelta = new Vector2(10f, 8f); array[i] = val9.AddComponent<Image>(); ((Graphic)array[i]).color = ((i < perk.CurrentRank) ? val : RankEmpty); ((Graphic)array[i]).raycastTarget = false; } GameObject val11 = MakePanel(val2, "BuyBtn", 44f, 30f, new Vector2(1f, 0.5f), new Vector2(-6f, 0f)); Image val12 = val11.AddComponent<Image>(); ((Graphic)val12).color = BtnAfford; TextMeshProUGUI val13 = MakeTMP(val11, "BtnLabel", 44f, 30f); ((TMP_Text)val13).text = "+"; ((TMP_Text)val13).fontSize = 22f; ((Graphic)val13).color = Color.white; ((TMP_Text)val13).alignment = (TextAlignmentOptions)514; ((Graphic)val13).raycastTarget = false; Button val14 = val11.AddComponent<Button>(); ((Selectable)val14).targetGraphic = (Graphic)(object)val12; string capturedId = perk.Id; ((UnityEvent)val14.onClick).AddListener((UnityAction)delegate { Debug.Log((object)("[RoguePerkUI] Buy clicked: " + capturedId)); RoguePerkManager.TryBuyRank(capturedId); Refresh(); }); _rows.Add(new PerkRow { PerkId = perk.Id, Pips = array, BuyBtn = val12, RankText = val7, CostText = val8 }); } private void Refresh() { //IL_003a: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) int roguePoints = LerpXPManager.RoguePoints; if ((Object)(object)_rpFill != (Object)null) { ((Graphic)_rpFill).rectTransform.sizeDelta = new Vector2(484f * Mathf.Clamp01((float)roguePoints / 10f), 0f); } if ((Object)(object)_rpLabel != (Object)null) { ((TMP_Text)_rpLabel).text = $"Rogue Points: {roguePoints}"; } for (int i = 0; i < _rows.Count; i++) { PerkRow perkRow = _rows[i]; if (RoguePerkManager.Perks.TryGetValue(perkRow.PerkId, out RoguePerk value)) { Color val = PerkColors[i % PerkColors.Length]; if ((Object)(object)perkRow.RankText != (Object)null) { ((TMP_Text)perkRow.RankText).text = $"Rank {value.CurrentRank} / {value.MaxRank}"; } if ((Object)(object)perkRow.CostText != (Object)null) { ((TMP_Text)perkRow.CostText).text = $"Cost: {value.GetCostForNextRank()} RP"; } for (int j = 0; j < perkRow.Pips.Length; j++) { ((Graphic)perkRow.Pips[j]).color = ((j < value.CurrentRank) ? val : RankEmpty); } bool flag = value.CanRankUp() && roguePoints >= value.GetCostForNextRank(); ((Graphic)perkRow.BuyBtn).color = (flag ? BtnAfford : BtnCantAfford); } } } private static GameObject MakePanel(GameObject parent, string name, float w, float h, Vector2 anchor, Vector2 offset) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0023: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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) GameObject val = new GameObject(name); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = anchor; val2.anchorMax = anchor; val2.pivot = anchor; val2.anchoredPosition = offset; val2.sizeDelta = new Vector2(w, h); return val; } private TextMeshProUGUI MakeTMP(GameObject parent, string name, float w, float h) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(0f, 1f); val2.pivot = new Vector2(0f, 1f); val2.anchoredPosition = Vector2.zero; val2.sizeDelta = new Vector2(w, h); TextMeshProUGUI val3 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val3).font = GetTMPFont(); ((TMP_Text)val3).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)val3).overflowMode = (TextOverflowModes)1; ((Graphic)val3).raycastTarget = false; return val3; } private static void OffsetTMP(TextMeshProUGUI tmp, float x, float y) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)tmp).rectTransform.anchoredPosition = new Vector2(x, y); } } }