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 Pilgrim v0.2.0
plugins/Pilgrim.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Pilgrim")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+83a082a7ef58ce93e55f263031e1978d96c09961")] [assembly: AssemblyProduct("Pilgrim")] [assembly: AssemblyTitle("Pilgrim")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace EnvReporter { [BepInPlugin("com.ctogle.pilgrim", "Pilgrim", "0.2.0")] public class Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static FileSystemEventHandler <>9__82_0; public static ConsoleEvent <>9__84_0; public static Func<StatusEffect, string> <>9__84_15; public static ConsoleEvent <>9__84_1; public static ConsoleEvent <>9__84_2; public static ConsoleEvent <>9__84_3; public static Func<string, string> <>9__84_16; public static Func<string, string> <>9__84_17; public static ConsoleEvent <>9__84_4; public static ConsoleEvent <>9__84_5; public static ConsoleEvent <>9__84_6; public static ConsoleEvent <>9__84_7; public static ConsoleEvent <>9__84_8; public static ConsoleEvent <>9__84_9; public static Func<GameObject, bool> <>9__84_18; public static Func<GameObject, string> <>9__84_19; public static Func<string, bool> <>9__84_20; public static Func<string, string> <>9__84_21; public static ConsoleEvent <>9__84_10; public static ConsoleEvent <>9__84_11; public static ConsoleEvent <>9__84_12; public static ConsoleEvent <>9__84_13; public static ConsoleEvent <>9__84_14; public static Predicate<StatusEffect> <>9__85_0; public static Predicate<StatusEffect> <>9__92_0; public static Predicate<StatusEffect> <>9__96_0; public static Predicate<StatusEffect> <>9__99_0; public static Predicate<StatusEffect> <>9__100_0; public static Predicate<StatusEffect> <>9__104_0; internal void <Awake>b__82_0(object _, FileSystemEventArgs __) { _cfgDirty = true; } internal void <RegisterCommands>b__84_0(ConsoleEventArgs args) { //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) EnvMan instance = EnvMan.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("EnvMan not ready."); return; } float tod = GetTod(); string todLabel = GetTodLabel(tod); string text = GetEnvSetupName(instance, "m_currentEnv") ?? "unknown"; string text2 = GetEnvSetupName(instance, "m_nextEnv") ?? "unknown"; string text3 = instance.m_debugEnv ?? ""; string text4 = (((Object)(object)Scheduler != (Object)null && Scheduler.Active) ? $"ON (prob {Scheduler.Probability:P0})" : "OFF"); double num = (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetTimeSeconds() : 0.0); args.Context.AddString("=== World State ==="); args.Context.AddString($"TOD : {tod:F2} ({todLabel}) [ZNet raw: {num:F0}s mod1800={num % 1800.0:F0}]"); args.Context.AddString("Current env : " + text + ((text3.Length > 0) ? (" [forced: " + text3 + "]") : "")); args.Context.AddString("Next env : " + text2); args.Context.AddString($"Is wet : {EnvMan.IsWet()}"); args.Context.AddString($"Is cold : {EnvMan.IsCold()}"); args.Context.AddString($"Is freezing : {EnvMan.IsFreezing()}"); args.Context.AddString($"Wind : {instance.GetWindIntensity():F2} dir {instance.GetWindDir()}"); args.Context.AddString("Scheduler : " + text4); RandEventSystem instance2 = RandEventSystem.instance; if ((Object)(object)instance2 != (Object)null) { object obj = AnyField(instance2, "m_activeEvent", "m_currentEvent"); if (obj != null && (!(AnyField(instance2, "m_haveActiveEvent") is bool flag) || flag) && obj != null) { string arg = (AnyField(obj, "m_name") as string) ?? "?"; float num2 = ((AnyField(instance2, "m_eventTimer", "m_timer") is float num3) ? num3 : 0f); string arg2 = ((AnyField(instance2, "m_eventPos", "m_pos") is Vector3 val) ? $"({val.x:F0},{val.z:F0})" : "?"); args.Context.AddString($"Active raid : {arg} | {num2:F0}s | @ {arg2}"); } else { args.Context.AddString("Active raid : none"); } } } internal void <RegisterCommands>b__84_1(ConsoleEventArgs args) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) List<Player> allPlayers = Player.GetAllPlayers(); if (allPlayers == null || allPlayers.Count == 0) { args.Context.AddString("No players found."); return; } args.Context.AddString($"=== Players ({allPlayers.Count}) ==="); List<Vector3> list = new List<Vector3>(); foreach (Player item in allPlayers) { string playerName = item.GetPlayerName(); float health = ((Character)item).GetHealth(); float maxHealth = ((Character)item).GetMaxHealth(); float stamina = item.GetStamina(); float maxStamina = ((Character)item).GetMaxStamina(); float eitr = item.GetEitr(); float maxEitr = ((Character)item).GetMaxEitr(); Vector3 position = ((Component)item).transform.position; list.Add(position); string arg = ((object)item.GetCurrentBiome()/*cast due to .constrained prefix*/).ToString(); SEMan sEMan = ((Character)item).GetSEMan(); List<StatusEffect> list2 = ((sEMan != null) ? sEMan.GetStatusEffects() : null); string text = ((list2 != null && list2.Count > 0) ? string.Join(", ", list2.Select((StatusEffect e) => (!string.IsNullOrEmpty(e.m_name)) ? e.m_name : ((Object)e).name)) : "none"); args.Context.AddString("--- " + playerName + " ---"); args.Context.AddString($" HP {health:F0}/{maxHealth:F0} | Stamina {stamina:F0}/{maxStamina:F0} | Eitr {eitr:F0}/{maxEitr:F0}"); args.Context.AddString($" Biome: {arg} | Pos: ({position.x:F0},{position.z:F0})"); args.Context.AddString(" Effects: " + text); } if (list.Count <= 1) { return; } float num = 0f; for (int num2 = 0; num2 < list.Count; num2++) { for (int num3 = num2 + 1; num3 < list.Count; num3++) { float num4 = Vector3.Distance(list[num2], list[num3]); if (num4 > num) { num = num4; } } } args.Context.AddString($"Party spread: {num:F0}m"); } internal string <RegisterCommands>b__84_15(StatusEffect e) { if (!string.IsNullOrEmpty(e.m_name)) { return e.m_name; } return ((Object)e).name; } internal void <RegisterCommands>b__84_2(ConsoleEventArgs args) { ClearSkiesExpiry = 0f; RainExpiry = 0f; GiantRainExpiry = 0f; WaterWalkExpiry = 0f; SeekEnvExpiry = 0f; DungeonEnvExpiry = 0f; HomeEnvExpiry = 0f; if (GiantExpiry > 0f) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { DeactivateGiant(localPlayer); } else { GiantExpiry = 0f; } } if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = ""; } EnvMan instance = EnvMan.instance; if (instance != null) { instance.ResetDebugWind(); } args.Context.AddString("Weather overrides cleared."); } internal void <RegisterCommands>b__84_3(ConsoleEventArgs args) { ActivateSeek(args.Context); } internal void <RegisterCommands>b__84_4(ConsoleEventArgs args) { EnvScheduler scheduler = Scheduler; if ((Object)(object)scheduler == (Object)null) { args.Context.AddString("Scheduler not ready."); return; } if (args.Length < 2) { PrintSchedule(args, scheduler); return; } switch (args[1].ToLower()) { case "on": scheduler.Active = true; args.Context.AddString("Scheduler ON"); break; case "off": scheduler.Active = false; args.Context.AddString("Scheduler OFF"); break; case "prob": { if (args.Length >= 3 && float.TryParse(args[2], out var result)) { scheduler.Probability = Mathf.Clamp01(result); args.Context.AddString($"Probability → {scheduler.Probability:P0}"); } break; } case "night": if (args.Length >= 3) { scheduler.NightPool = (from x in args[2].Split(',') select x.Trim()).ToList(); args.Context.AddString("Night pool → " + string.Join(", ", scheduler.NightPool)); } break; case "noon": if (args.Length >= 3) { scheduler.NoonPool = (from x in args[2].Split(',') select x.Trim()).ToList(); args.Context.AddString("Noon pool → " + string.Join(", ", scheduler.NoonPool)); } break; default: PrintSchedule(args, scheduler); break; } } internal string <RegisterCommands>b__84_16(string x) { return x.Trim(); } internal string <RegisterCommands>b__84_17(string x) { return x.Trim(); } internal void <RegisterCommands>b__84_5(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("No local player."); return; } ActivateWaterWalk(localPlayer); args.Context.AddString("Water walk active."); } internal void <RegisterCommands>b__84_6(ConsoleEventArgs args) { //IL_0073: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_008f: 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_00a6: 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_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Scheduler == (Object)null) { args.Context.AddString("Scheduler not ready."); return; } string text = ((args.Length > 1) ? args[1].ToLower() : "n"); Vector3 direction = (Vector3)(text switch { "s" => new Vector3(0f, 0f, -1f), "e" => new Vector3(1f, 0f, 0f), "w" => new Vector3(-1f, 0f, 0f), _ => new Vector3(0f, 0f, 1f), }); Scheduler.SendBird(direction); args.Context.AddString("Bird away (" + text + ")."); } internal void <RegisterCommands>b__84_7(ConsoleEventArgs args) { args.Context.AddString("=== Campfire Rituals ==="); args.Context.AddString(" " + SeekFood + " (Boar Meat) → Guiding Wind — seek next boss altar"); args.Context.AddString(" Mushroom* (Yellow Mushroom) → Reset forsaken power cooldown"); args.Context.AddString(" " + HomeFood + " (Dandelion) → Guiding Wind — find your bed"); args.Context.AddString(" " + FeatherFood + " (Feathers) → Feather Fall — no fall damage 60s"); args.Context.AddString(" Any Trophy → Dungeon Seeker — find nearest dungeon"); args.Context.AddString($"Global cooldown: {RitualCooldownDuration}s. Hold item in slot 1, look at burning campfire, press 1."); } internal void <RegisterCommands>b__84_8(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } string text = ((args.Args.Length > 1) ? args.Args[1].ToLower() : "all"); (string, bool, string, string)[] ritualItemMap = RitualItemMap; for (int i = 0; i < ritualItemMap.Length; i++) { (string, bool, string, string) tuple = ritualItemMap[i]; string item = tuple.Item3; string item2 = tuple.Item4; if (!(text != "all") || !(item != text)) { LearnRitual(localPlayer, item, item2); } } args.Context.AddString((text == "all") ? "All rituals learned." : ("Learned: " + text)); } internal void <RegisterCommands>b__84_9(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } string text = ((args.Args.Length > 1) ? args.Args[1].ToLower() : "all"); (string, bool, string, string)[] ritualItemMap = RitualItemMap; for (int i = 0; i < ritualItemMap.Length; i++) { string item = ritualItemMap[i].Item3; if (!(text != "all") || !(item != text)) { localPlayer.m_customData.Remove("ath_known_" + item); } } args.Context.AddString((text == "all") ? "All rituals forgotten." : ("Forgotten: " + text)); } internal void <RegisterCommands>b__84_10(ConsoleEventArgs args) { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("ZNetScene not ready."); return; } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Dictionary<int, GameObject> dictionary = typeof(ZNetScene).GetField("m_namedPrefabs", bindingAttr)?.GetValue(instance) as Dictionary<int, GameObject>; if (args.Length < 2 || args[1] == "list") { if (dictionary == null) { args.Context.AddString("Could not read prefab list."); return; } List<string> list = (from g in dictionary.Values where (Object)(object)g != (Object)null select ((Object)g).name into n where n.StartsWith("vfx_") || n.StartsWith("fx_") || n.StartsWith("sfx_") orderby n select n).ToList(); args.Context.AddString($"=== {list.Count} VFX prefabs ==="); { foreach (string item in list) { args.Context.AddString(" " + item); } return; } } Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { GameObject prefab = instance.GetPrefab(args[1]); if ((Object)(object)prefab == (Object)null) { args.Context.AddString("Prefab '" + args[1] + "' not found."); return; } Object.Instantiate<GameObject>(prefab, ((Component)localPlayer).transform.position, Quaternion.identity); args.Context.AddString("Spawned " + args[1]); } } internal bool <RegisterCommands>b__84_18(GameObject g) { return (Object)(object)g != (Object)null; } internal string <RegisterCommands>b__84_19(GameObject g) { return ((Object)g).name; } internal bool <RegisterCommands>b__84_20(string n) { if (!n.StartsWith("vfx_") && !n.StartsWith("fx_")) { return n.StartsWith("sfx_"); } return true; } internal string <RegisterCommands>b__84_21(string n) { return n; } internal void <RegisterCommands>b__84_11(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { Vagon val = CartUpgrade.FindNearest(localPlayer, 10f); if ((Object)(object)val == (Object)null) { args.Context.AddString("No cart within 10m."); } else { CartUpgrade.Upgrade(localPlayer, val, args); } } } internal void <RegisterCommands>b__84_12(ConsoleEventArgs args) { EnvMan instance = EnvMan.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("EnvMan not ready."); return; } args.Context.AddString($"=== Environments ({instance.m_environments.Count}) ==="); foreach (EnvSetup environment in instance.m_environments) { args.Context.AddString(" " + environment.m_name); } } internal void <RegisterCommands>b__84_13(ConsoleEventArgs args) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } int num = 0; MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(); foreach (MonoBehaviour val in array) { if ((Object)(object)val == (Object)null || ((object)val).GetType().Name != "RandomFlyingBird" || Vector3.Distance(((Component)val).transform.position, ((Component)localPlayer).transform.position) > 60f) { continue; } num++; args.Context.AddString($"--- Bird {num} ({((Object)((Component)val).gameObject).name}) ---"); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo[] fields = ((object)val).GetType().GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { try { args.Context.AddString($" {fieldInfo.FieldType.Name} {fieldInfo.Name} = {fieldInfo.GetValue(val)}"); } catch { } } Component[] componentsInChildren = ((Component)val).GetComponentsInChildren<Component>(); foreach (Component val2 in componentsInChildren) { PropertyInfo propertyInfo = ((object)val2)?.GetType().GetProperty("parameters"); if (propertyInfo == null || !(propertyInfo.GetValue(val2) is Array array2)) { continue; } foreach (object item in array2) { PropertyInfo property = item.GetType().GetProperty("name"); PropertyInfo property2 = item.GetType().GetProperty("type"); args.Context.AddString($" Anim param: {property?.GetValue(item)} ({property2?.GetValue(item)})"); } } } if (num == 0) { args.Context.AddString("No birds within 60m."); } } internal void <RegisterCommands>b__84_14(ConsoleEventArgs args) { EnvMan instance = EnvMan.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("EnvMan not ready."); return; } FieldInfo[] fields = typeof(EnvMan).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { string name = fieldInfo.Name; if (name.ToLower().Contains("env") || name.ToLower().Contains("current") || name.ToLower().Contains("debug") || name.ToLower().Contains("time")) { object value = fieldInfo.GetValue(instance); string text = ((value == null) ? "null" : value.ToString()); EnvSetup val = (EnvSetup)((value is EnvSetup) ? value : null); if (val != null) { text = "EnvSetup(" + val.m_name + ")"; } args.Context.AddString(fieldInfo.FieldType.Name + " " + name + " = " + text); } } } internal bool <ActivateSeek>b__85_0(StatusEffect s) { return ((Object)s).name == "SE_GuidingWind"; } internal bool <ActivateDungeonSeek>b__92_0(StatusEffect s) { return ((Object)s).name == "SE_GuidingWind"; } internal bool <ActivateHomeSeek>b__96_0(StatusEffect s) { return ((Object)s).name == "SE_GuidingWind"; } internal bool <ActivateWaterWalk>b__99_0(StatusEffect s) { return ((Object)s).name == "SE_WaterWalk"; } internal bool <ActivateGiant>b__100_0(StatusEffect s) { return ((Object)s).name == "SE_Giant"; } internal bool <ActivateFlamingSword>b__104_0(StatusEffect s) { return ((Object)s).name == "SE_FlamingSword"; } } internal static ManualLogSource Log = null; internal static EnvScheduler? Scheduler; internal static SE_GuidingWind? GuidingWindSE; internal static SE_WaterWalk? WaterWalkSE; internal static SE_Giant? GiantSE; internal static SE_FlamingSword? FlamingSwordSE; internal static PilgrimConfig Cfg = PilgrimConfig.Default(); private static bool _cfgDirty = false; private static FileSystemWatcher? _cfgWatcher; internal static Vector3? SeekOverrideTarget = null; internal static readonly (string Match, bool Prefix, string Key, string Display)[] RitualItemMap = new(string, bool, string, string)[14] { ("RawMeat", false, "seek_altar", "Boar Meat"), ("Mushroom", true, "restore_power", "Mushroom"), ("Dandelion", false, "seek_bed", "Dandelion"), ("Feathers", false, "feather_fall", "Feathers"), ("Coins", false, "seek_trader", "Coins"), ("Trophy", true, "seek_dungeon", "a Trophy"), ("GreydwarfEye", false, "clear_skies", "Greydwarf Eye"), ("Stone", false, "water_walk", "Stone"), ("AncientSeed", false, "growth", "Ancient Seed"), ("BoneFragments", false, "tame_flock", "Bone Fragments"), ("Flint", false, "seek_player", "Flint"), ("Resin", false, "kindle", "Resin"), ("YmirRemains", false, "giant", "Ymir Flesh"), ("SurtlingCore", false, "flaming_sword", "Surtling Core") }; internal static float RitualCooldownRemaining = 0f; internal static float FeatherRitualExpiry = 0f; internal static float ClearSkiesExpiry = 0f; internal static float RainExpiry = 0f; internal static float GiantRainExpiry = 0f; internal static float WaterWalkExpiry = 0f; internal static float SeekEnvExpiry = 0f; internal static float DungeonEnvExpiry = 0f; internal static float HomeEnvExpiry = 0f; internal static bool GrowthBlessingActive = false; internal static bool TameBlessingActive = false; internal static float FlamingSwordExpiry = 0f; private static ItemData? _flamingSwordItem = null; private static ItemData? _origRightItem = null; internal const string FlamingSwordPrefab = "SwordIronFire"; internal static float GiantExpiry = 0f; internal static float GiantTargetScale = 1f; internal const float GiantCarryBonus = 300f; internal const float GiantScale = 3f; internal const float GiantWalkMult = 1.5f; internal const float GiantRunMult = 2.5f; internal const float GiantJumpMult = 1.2f; internal static bool GiantSpeedApplied = false; private static DamageTypes _origUnarmedDmg; private static short _origUnarmedTier; private static float _origAttackRange; private static float _origAttackHeight; private static float _origAttackOffset; private static float _origAutoPickupRange; private static float _origSwimDepth; internal static readonly Dictionary<string, string> TrophyToPower = new Dictionary<string, string> { { "TrophyEikthyr", "GP_Eikthyr" }, { "TrophyTheElder", "GP_TheElder" }, { "TrophyBonemass", "GP_Bonemass" }, { "TrophyDragonQueen", "GP_Moder" }, { "TrophyGoblinKing", "GP_Yagluth" }, { "TrophySeekerQueen", "GP_Queen" }, { "TrophyFader", "GP_Fader" } }; private static readonly Random Rng = new Random(); private static readonly string[] DungeonLocations = new string[7] { "Crypt2", "Crypt3", "Crypt4", "SunkenCrypt", "MountainCave", "MountainCave02", "InfectedMine" }; private static readonly string[] TraderLocations = new string[2] { "Vendor_BlackForest", "Hildir_camp" }; private static MethodInfo? _isExploredMethod; private static readonly (string boss, string prefab)[] BossChain = new(string, string)[7] { ("Eikthyr", "Eikthyrpower"), ("The Elder", "GDKing"), ("Bonemass", "Bonemass"), ("Moder", "Dragonqueen"), ("Yagluth", "GoblinKing"), ("The Queen", "SeekerQueen"), ("Fader", "Fader") }; private static readonly string[] BossKeys = new string[7] { "defeated_eikthyr", "defeated_gdking", "defeated_bonemass", "defeated_dragon", "defeated_goblinking", "defeated_queen", "defeated_fader" }; internal static string ConfigPath => Path.Combine(Paths.ConfigPath, "Pilgrim.yaml"); internal static string SeekFood => Cfg.Rituals.Items.GetValueOrDefault("seek_altar")?.Item ?? "RawMeat"; internal static string HomeFood => Cfg.Rituals.Items.GetValueOrDefault("seek_bed")?.Item ?? "Dandelion"; internal static string FeatherFood => Cfg.Rituals.Items.GetValueOrDefault("feather_fall")?.Item ?? "Feathers"; internal static string TraderFood => Cfg.Rituals.Items.GetValueOrDefault("seek_trader")?.Item ?? "Coins"; internal static string GrowthFood => Cfg.Rituals.Items.GetValueOrDefault("growth")?.Item ?? "AncientSeed"; internal static string PlayerSeekFood => Cfg.Rituals.Items.GetValueOrDefault("seek_player")?.Item ?? "Flint"; internal static string KindleFood => Cfg.Rituals.Items.GetValueOrDefault("kindle")?.Item ?? "Resin"; internal static string TameFood => Cfg.Rituals.Items.GetValueOrDefault("tame_flock")?.Item ?? "BoneFragments"; internal static string GiantFood => Cfg.Rituals.Items.GetValueOrDefault("giant")?.Item ?? "YmirRemains"; internal static string FlamingSwordFood => Cfg.Rituals.Items.GetValueOrDefault("flaming_sword")?.Item ?? "SurtlingCore"; internal static float RitualCooldownDuration => Cfg.Rituals.Cooldown; internal static float ClearSkiesDuration => Cfg.Rituals.Items.GetValueOrDefault("clear_skies")?.Duration ?? 900f; internal static float RainDuration => Cfg.Rituals.Items.GetValueOrDefault("restore_power")?.Duration ?? 600f; internal static float WaterWalkDuration => Cfg.Rituals.Items.GetValueOrDefault("water_walk")?.Duration ?? 60f; internal static float SeekEnvDuration => 60f; internal static float DungeonEnvDuration => 60f; internal static float HomeEnvDuration => 60f; internal static void LoadConfig() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown try { if (!File.Exists(ConfigPath)) { string contents = ((BuilderSkeleton<SerializerBuilder>)new SerializerBuilder()).WithNamingConvention(UnderscoredNamingConvention.Instance).Build().Serialize((object)PilgrimConfig.Default()); File.WriteAllText(ConfigPath, contents); Log.LogInfo((object)("[Pilgrim] Wrote default config to " + ConfigPath)); } Cfg = ((BuilderSkeleton<DeserializerBuilder>)new DeserializerBuilder()).WithNamingConvention(UnderscoredNamingConvention.Instance).IgnoreUnmatchedProperties().Build() .Deserialize<PilgrimConfig>(File.ReadAllText(ConfigPath)); PilgrimConfig pilgrimConfig = PilgrimConfig.Default(); bool flag = false; foreach (var (key, value) in pilgrimConfig.Rituals.Items) { if (!Cfg.Rituals.Items.ContainsKey(key)) { Cfg.Rituals.Items[key] = value; flag = true; } } if (flag) { string contents2 = ((BuilderSkeleton<SerializerBuilder>)new SerializerBuilder()).WithNamingConvention(UnderscoredNamingConvention.Instance).Build().Serialize((object)Cfg); File.WriteAllText(ConfigPath, contents2); Log.LogInfo((object)"[Pilgrim] Backfilled missing ritual config keys."); } Log.LogInfo((object)"[Pilgrim] Config loaded."); } catch (Exception ex) { Log.LogError((object)("[Pilgrim] Config load failed: " + ex.Message + " — using defaults.")); Cfg = PilgrimConfig.Default(); } } internal static bool IsRitualKnown(Player player, string key) { return player.m_customData.ContainsKey("ath_known_" + key); } internal static void LearnRitual(Player player, string key, string itemDisplayName) { if (!IsRitualKnown(player, key)) { player.m_customData["ath_known_" + key] = "1"; if (Cfg.Rituals.Items.TryGetValue(key, out RitualItemConfig value)) { ((Character)player).Message((MessageType)1, "<color=orange>Ritual discovered:</color> " + value.HoverText, 0, (Sprite)null); ((Character)player).Message((MessageType)2, "<color=orange>Ritual discovered</color>\n" + value.HoverText + "\nOffer <color=yellow>" + itemDisplayName + "</color> at a burning campfire.", 0, (Sprite)null); } } } private void Awake() { //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_00a0: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; LoadConfig(); _cfgWatcher = new FileSystemWatcher(Paths.ConfigPath, "Pilgrim.yaml") { NotifyFilter = NotifyFilters.LastWrite, EnableRaisingEvents = true }; _cfgWatcher.Changed += delegate { _cfgDirty = true; }; try { new Harmony("com.ctogle.pilgrim").PatchAll(); } catch (Exception ex) { Log.LogError((object)("[Pilgrim] Harmony patch failed: " + ex.Message)); } RegisterCommands(); GameObject val = new GameObject("AthScheduler"); Object.DontDestroyOnLoad((Object)val); Scheduler = val.AddComponent<EnvScheduler>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Pilgrim loaded."); } private void Update() { if (_cfgDirty) { _cfgDirty = false; LoadConfig(); } } private void RegisterCommands() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_006a: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0099: Expected O, but got Unknown //IL_00da: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0141: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_0286: 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_0291: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown object obj = <>c.<>9__84_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) EnvMan instance = EnvMan.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("EnvMan not ready."); } else { float tod = GetTod(); string todLabel = GetTodLabel(tod); string text = GetEnvSetupName(instance, "m_currentEnv") ?? "unknown"; string text2 = GetEnvSetupName(instance, "m_nextEnv") ?? "unknown"; string text3 = instance.m_debugEnv ?? ""; string text4 = (((Object)(object)Scheduler != (Object)null && Scheduler.Active) ? $"ON (prob {Scheduler.Probability:P0})" : "OFF"); double num = (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetTimeSeconds() : 0.0); args.Context.AddString("=== World State ==="); args.Context.AddString($"TOD : {tod:F2} ({todLabel}) [ZNet raw: {num:F0}s mod1800={num % 1800.0:F0}]"); args.Context.AddString("Current env : " + text + ((text3.Length > 0) ? (" [forced: " + text3 + "]") : "")); args.Context.AddString("Next env : " + text2); args.Context.AddString($"Is wet : {EnvMan.IsWet()}"); args.Context.AddString($"Is cold : {EnvMan.IsCold()}"); args.Context.AddString($"Is freezing : {EnvMan.IsFreezing()}"); args.Context.AddString($"Wind : {instance.GetWindIntensity():F2} dir {instance.GetWindDir()}"); args.Context.AddString("Scheduler : " + text4); RandEventSystem instance2 = RandEventSystem.instance; if ((Object)(object)instance2 != (Object)null) { object obj16 = AnyField(instance2, "m_activeEvent", "m_currentEvent"); if (obj16 != null && (!(AnyField(instance2, "m_haveActiveEvent") is bool flag) || flag) && obj16 != null) { string arg = (AnyField(obj16, "m_name") as string) ?? "?"; float num2 = ((AnyField(instance2, "m_eventTimer", "m_timer") is float num3) ? num3 : 0f); string arg2 = ((AnyField(instance2, "m_eventPos", "m_pos") is Vector3 val16) ? $"({val16.x:F0},{val16.z:F0})" : "?"); args.Context.AddString($"Active raid : {arg} | {num2:F0}s | @ {arg2}"); } else { args.Context.AddString("Active raid : none"); } } } }; <>c.<>9__84_0 = val; obj = (object)val; } new ConsoleCommand("ath_envstate", "world env, TOD, raid, wind", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__84_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) List<Player> allPlayers = Player.GetAllPlayers(); if (allPlayers == null || allPlayers.Count == 0) { args.Context.AddString("No players found."); } else { args.Context.AddString($"=== Players ({allPlayers.Count}) ==="); List<Vector3> list = new List<Vector3>(); foreach (Player item3 in allPlayers) { string playerName = item3.GetPlayerName(); float health = ((Character)item3).GetHealth(); float maxHealth = ((Character)item3).GetMaxHealth(); float stamina = item3.GetStamina(); float maxStamina = ((Character)item3).GetMaxStamina(); float eitr = item3.GetEitr(); float maxEitr = ((Character)item3).GetMaxEitr(); Vector3 position = ((Component)item3).transform.position; list.Add(position); string arg = ((object)item3.GetCurrentBiome()/*cast due to .constrained prefix*/).ToString(); SEMan sEMan = ((Character)item3).GetSEMan(); List<StatusEffect> list2 = ((sEMan != null) ? sEMan.GetStatusEffects() : null); string text = ((list2 != null && list2.Count > 0) ? string.Join(", ", list2.Select((StatusEffect e) => (!string.IsNullOrEmpty(e.m_name)) ? e.m_name : ((Object)e).name)) : "none"); args.Context.AddString("--- " + playerName + " ---"); args.Context.AddString($" HP {health:F0}/{maxHealth:F0} | Stamina {stamina:F0}/{maxStamina:F0} | Eitr {eitr:F0}/{maxEitr:F0}"); args.Context.AddString($" Biome: {arg} | Pos: ({position.x:F0},{position.z:F0})"); args.Context.AddString(" Effects: " + text); } if (list.Count > 1) { float num = 0f; for (int num2 = 0; num2 < list.Count; num2++) { for (int num3 = num2 + 1; num3 < list.Count; num3++) { float num4 = Vector3.Distance(list[num2], list[num3]); if (num4 > num) { num = num4; } } } args.Context.AddString($"Party spread: {num:F0}m"); } } }; <>c.<>9__84_1 = val2; obj2 = (object)val2; } new ConsoleCommand("ath_playerstats", "all players stats + party spread", (ConsoleEvent)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj3 = <>c.<>9__84_2; if (obj3 == null) { ConsoleEvent val3 = delegate(ConsoleEventArgs args) { ClearSkiesExpiry = 0f; RainExpiry = 0f; GiantRainExpiry = 0f; WaterWalkExpiry = 0f; SeekEnvExpiry = 0f; DungeonEnvExpiry = 0f; HomeEnvExpiry = 0f; if (GiantExpiry > 0f) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { DeactivateGiant(localPlayer); } else { GiantExpiry = 0f; } } if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = ""; } EnvMan instance = EnvMan.instance; if (instance != null) { instance.ResetDebugWind(); } args.Context.AddString("Weather overrides cleared."); }; <>c.<>9__84_2 = val3; obj3 = (object)val3; } new ConsoleCommand("ath_clearenv", "cancel all Pilgrim weather overrides", (ConsoleEvent)obj3, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj4 = <>c.<>9__84_3; if (obj4 == null) { ConsoleEvent val4 = delegate(ConsoleEventArgs args) { ActivateSeek(args.Context); }; <>c.<>9__84_3 = val4; obj4 = (object)val4; } new ConsoleCommand("ath_seek", "point wind toward next boss altar", (ConsoleEvent)obj4, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj5 = <>c.<>9__84_4; if (obj5 == null) { ConsoleEvent val5 = delegate(ConsoleEventArgs args) { EnvScheduler scheduler = Scheduler; if ((Object)(object)scheduler == (Object)null) { args.Context.AddString("Scheduler not ready."); } else if (args.Length < 2) { PrintSchedule(args, scheduler); } else { switch (args[1].ToLower()) { case "on": scheduler.Active = true; args.Context.AddString("Scheduler ON"); break; case "off": scheduler.Active = false; args.Context.AddString("Scheduler OFF"); break; case "prob": { if (args.Length >= 3 && float.TryParse(args[2], out var result)) { scheduler.Probability = Mathf.Clamp01(result); args.Context.AddString($"Probability → {scheduler.Probability:P0}"); } break; } case "night": if (args.Length >= 3) { scheduler.NightPool = (from x in args[2].Split(',') select x.Trim()).ToList(); args.Context.AddString("Night pool → " + string.Join(", ", scheduler.NightPool)); } break; case "noon": if (args.Length >= 3) { scheduler.NoonPool = (from x in args[2].Split(',') select x.Trim()).ToList(); args.Context.AddString("Noon pool → " + string.Join(", ", scheduler.NoonPool)); } break; default: PrintSchedule(args, scheduler); break; } } }; <>c.<>9__84_4 = val5; obj5 = (object)val5; } new ConsoleCommand("ath_schedule", "ath_schedule [on|off|prob <0-1>|night <e1,e2>|noon <e1,e2>]", (ConsoleEvent)obj5, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj6 = <>c.<>9__84_5; if (obj6 == null) { ConsoleEvent val6 = delegate(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("No local player."); } else { ActivateWaterWalk(localPlayer); args.Context.AddString("Water walk active."); } }; <>c.<>9__84_5 = val6; obj6 = (object)val6; } new ConsoleCommand("ath_waterwalk", "walk on water for 2 minutes", (ConsoleEvent)obj6, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj7 = <>c.<>9__84_6; if (obj7 == null) { ConsoleEvent val7 = delegate(ConsoleEventArgs args) { //IL_0073: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_008f: 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_00a6: 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_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Scheduler == (Object)null) { args.Context.AddString("Scheduler not ready."); } else { string text = ((args.Length > 1) ? args[1].ToLower() : "n"); Vector3 direction = (Vector3)(text switch { "s" => new Vector3(0f, 0f, -1f), "e" => new Vector3(1f, 0f, 0f), "w" => new Vector3(-1f, 0f, 0f), _ => new Vector3(0f, 0f, 1f), }); Scheduler.SendBird(direction); args.Context.AddString("Bird away (" + text + ")."); } }; <>c.<>9__84_6 = val7; obj7 = (object)val7; } new ConsoleCommand("ath_bird", "ath_bird [n|s|e|w] — send a crow flying in a direction (default: north)", (ConsoleEvent)obj7, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj8 = <>c.<>9__84_7; if (obj8 == null) { ConsoleEvent val8 = delegate(ConsoleEventArgs args) { args.Context.AddString("=== Campfire Rituals ==="); args.Context.AddString(" " + SeekFood + " (Boar Meat) → Guiding Wind — seek next boss altar"); args.Context.AddString(" Mushroom* (Yellow Mushroom) → Reset forsaken power cooldown"); args.Context.AddString(" " + HomeFood + " (Dandelion) → Guiding Wind — find your bed"); args.Context.AddString(" " + FeatherFood + " (Feathers) → Feather Fall — no fall damage 60s"); args.Context.AddString(" Any Trophy → Dungeon Seeker — find nearest dungeon"); args.Context.AddString($"Global cooldown: {RitualCooldownDuration}s. Hold item in slot 1, look at burning campfire, press 1."); }; <>c.<>9__84_7 = val8; obj8 = (object)val8; } new ConsoleCommand("ath_rituals", "list available campfire rituals", (ConsoleEvent)obj8, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj9 = <>c.<>9__84_8; if (obj9 == null) { ConsoleEvent val9 = delegate(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { string text = ((args.Args.Length > 1) ? args.Args[1].ToLower() : "all"); (string, bool, string, string)[] ritualItemMap = RitualItemMap; for (int i = 0; i < ritualItemMap.Length; i++) { (string, bool, string, string) tuple = ritualItemMap[i]; string item = tuple.Item3; string item2 = tuple.Item4; if (!(text != "all") || !(item != text)) { LearnRitual(localPlayer, item, item2); } } args.Context.AddString((text == "all") ? "All rituals learned." : ("Learned: " + text)); } }; <>c.<>9__84_8 = val9; obj9 = (object)val9; } new ConsoleCommand("ath_learn", "ath_learn [ritual|all] — unlock ritual discovery (for testing)", (ConsoleEvent)obj9, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj10 = <>c.<>9__84_9; if (obj10 == null) { ConsoleEvent val10 = delegate(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { string text = ((args.Args.Length > 1) ? args.Args[1].ToLower() : "all"); (string, bool, string, string)[] ritualItemMap = RitualItemMap; for (int i = 0; i < ritualItemMap.Length; i++) { string item = ritualItemMap[i].Item3; if (!(text != "all") || !(item != text)) { localPlayer.m_customData.Remove("ath_known_" + item); } } args.Context.AddString((text == "all") ? "All rituals forgotten." : ("Forgotten: " + text)); } }; <>c.<>9__84_9 = val10; obj10 = (object)val10; } new ConsoleCommand("ath_forget", "ath_forget [ritual|all] — reset ritual discovery", (ConsoleEvent)obj10, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj11 = <>c.<>9__84_10; if (obj11 == null) { ConsoleEvent val11 = delegate(ConsoleEventArgs args) { //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("ZNetScene not ready."); } else { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; Dictionary<int, GameObject> dictionary = typeof(ZNetScene).GetField("m_namedPrefabs", bindingAttr)?.GetValue(instance) as Dictionary<int, GameObject>; if (args.Length < 2 || args[1] == "list") { if (dictionary != null) { List<string> list = (from g in dictionary.Values where (Object)(object)g != (Object)null select ((Object)g).name into n where n.StartsWith("vfx_") || n.StartsWith("fx_") || n.StartsWith("sfx_") orderby n select n).ToList(); args.Context.AddString($"=== {list.Count} VFX prefabs ==="); { foreach (string item4 in list) { args.Context.AddString(" " + item4); } return; } } args.Context.AddString("Could not read prefab list."); } else { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { GameObject prefab = instance.GetPrefab(args[1]); if ((Object)(object)prefab == (Object)null) { args.Context.AddString("Prefab '" + args[1] + "' not found."); } else { Object.Instantiate<GameObject>(prefab, ((Component)localPlayer).transform.position, Quaternion.identity); args.Context.AddString("Spawned " + args[1]); } } } } }; <>c.<>9__84_10 = val11; obj11 = (object)val11; } new ConsoleCommand("ath_vfx", "ath_vfx <prefabName|list> — preview a VFX at your position, or list all vfx_ prefabs", (ConsoleEvent)obj11, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj12 = <>c.<>9__84_11; if (obj12 == null) { ConsoleEvent val12 = delegate(ConsoleEventArgs args) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { Vagon val16 = CartUpgrade.FindNearest(localPlayer, 10f); if ((Object)(object)val16 == (Object)null) { args.Context.AddString("No cart within 10m."); } else { CartUpgrade.Upgrade(localPlayer, val16, args); } } }; <>c.<>9__84_11 = val12; obj12 = (object)val12; } new ConsoleCommand("ath_upgradecart", "upgrade nearest cart capacity (or Shift+E on cart)", (ConsoleEvent)obj12, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj13 = <>c.<>9__84_12; if (obj13 == null) { ConsoleEvent val13 = delegate(ConsoleEventArgs args) { EnvMan instance = EnvMan.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("EnvMan not ready."); return; } args.Context.AddString($"=== Environments ({instance.m_environments.Count}) ==="); foreach (EnvSetup environment in instance.m_environments) { args.Context.AddString(" " + environment.m_name); } }; <>c.<>9__84_12 = val13; obj13 = (object)val13; } new ConsoleCommand("ath_envlist", "lists all registered environments", (ConsoleEvent)obj13, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj14 = <>c.<>9__84_13; if (obj14 == null) { ConsoleEvent val14 = delegate(ConsoleEventArgs args) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { int num = 0; MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(); foreach (MonoBehaviour val16 in array) { if (!((Object)(object)val16 == (Object)null) && !(((object)val16).GetType().Name != "RandomFlyingBird") && !(Vector3.Distance(((Component)val16).transform.position, ((Component)localPlayer).transform.position) > 60f)) { num++; args.Context.AddString($"--- Bird {num} ({((Object)((Component)val16).gameObject).name}) ---"); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo[] fields = ((object)val16).GetType().GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { try { args.Context.AddString($" {fieldInfo.FieldType.Name} {fieldInfo.Name} = {fieldInfo.GetValue(val16)}"); } catch { } } Component[] componentsInChildren = ((Component)val16).GetComponentsInChildren<Component>(); foreach (Component val17 in componentsInChildren) { PropertyInfo propertyInfo = ((object)val17)?.GetType().GetProperty("parameters"); if (!(propertyInfo == null) && propertyInfo.GetValue(val17) is Array array2) { foreach (object item5 in array2) { PropertyInfo property = item5.GetType().GetProperty("name"); PropertyInfo property2 = item5.GetType().GetProperty("type"); args.Context.AddString($" Anim param: {property?.GetValue(item5)} ({property2?.GetValue(item5)})"); } } } } } if (num == 0) { args.Context.AddString("No birds within 60m."); } } }; <>c.<>9__84_13 = val14; obj14 = (object)val14; } new ConsoleCommand("ath_birdparams", "dump RandomFlyingBird fields and animator params on nearby birds", (ConsoleEvent)obj14, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj15 = <>c.<>9__84_14; if (obj15 == null) { ConsoleEvent val15 = delegate(ConsoleEventArgs args) { EnvMan instance = EnvMan.instance; if ((Object)(object)instance == (Object)null) { args.Context.AddString("EnvMan not ready."); } else { FieldInfo[] fields = typeof(EnvMan).GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { string name = fieldInfo.Name; if (name.ToLower().Contains("env") || name.ToLower().Contains("current") || name.ToLower().Contains("debug") || name.ToLower().Contains("time")) { object value = fieldInfo.GetValue(instance); string text = ((value == null) ? "null" : value.ToString()); EnvSetup val16 = (EnvSetup)((value is EnvSetup) ? value : null); if (val16 != null) { text = "EnvSetup(" + val16.m_name + ")"; } args.Context.AddString(fieldInfo.FieldType.Name + " " + name + " = " + text); } } } }; <>c.<>9__84_14 = val15; obj15 = (object)val15; } new ConsoleCommand("ath_envdump", "dumps env-related EnvMan fields", (ConsoleEvent)obj15, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } internal static void ActivateSeek(Terminal? ctx = null, string message = "The wind stirs.") { //IL_0043: 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_0073: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } SeekOverrideTarget = null; var (text, prefabName) = GetNextBoss(); if (text == null) { Msg(ctx, "All known bosses defeated. The path is your own."); return; } if (!FindClosestLocation(prefabName, ((Component)localPlayer).transform.position, out var result)) { Msg(ctx, "Next boss: " + text + " — altar not yet in loaded zones."); return; } Vector3 position = ((Component)localPlayer).transform.position; float num = result.x - position.x; float num2 = result.z - position.z; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = Mathf.Atan2(num, num2) * 57.29578f; if (num4 < 0f) { num4 += 360f; } StatusEffect val = ObjectDB.instance?.m_StatusEffects?.Find((StatusEffect s) => ((Object)s).name == "SE_GuidingWind"); if ((Object)(object)val == (Object)null) { val = (StatusEffect)(object)GuidingWindSE; } if ((Object)(object)val != (Object)null) { ((Character)localPlayer).GetSEMan().AddStatusEffect(val, true, 0, 0f); Log.LogInfo((object)$"[EnvR] Applied SE: {((Object)val).name} ttl={val.m_ttl}"); } else { Log.LogWarning((object)"[EnvR] GuidingWindSE is null — ObjectDB patch may not have run"); } SeekEnvExpiry = Time.time + SeekEnvDuration; if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = "LastLight"; } if ((Object)(object)ctx != (Object)null) { Msg(ctx, "=== Guiding Wind ==="); Msg(ctx, "Seek : " + text); Msg(ctx, $"Distance : {num3:F0}m ({num3 / 1000f:F1}km)"); Msg(ctx, $"Bearing : {num4:F0}°"); Msg(ctx, "Follow the wind."); } else { ((Character)localPlayer).Message((MessageType)2, message.Replace("{boss}", text), 0, (Sprite)null); } } internal static void ActivateCooldownReset(Player player, string message = "The flame accepts your offering. {power} is ready.") { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = typeof(Player).GetField("m_guardianPower", bindingAttr); FieldInfo field2 = typeof(Player).GetField("m_guardianPowerCooldown", bindingAttr); string powerName = field?.GetValue(player) as string; if (string.IsNullOrEmpty(powerName)) { ((Character)player).Message((MessageType)2, "No forsaken power to reset.", 0, (Sprite)null); return; } if (((field2?.GetValue(player) is float num) ? num : 0f) <= 0f) { ((Character)player).Message((MessageType)2, "Your power is already ready.", 0, (Sprite)null); return; } field2?.SetValue(player, 0f); string newValue = (ObjectDB.instance?.m_StatusEffects?.Find((StatusEffect s) => ((Object)s).name == powerName))?.m_name ?? powerName; ((Character)player).Message((MessageType)2, message.Replace("{power}", newValue), 0, (Sprite)null); RainExpiry = Time.time + RainDuration; if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = "Rain"; } } private static bool IsUnexplored(Vector3 pos) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Minimap.instance == (Object)null) { return true; } if ((object)_isExploredMethod == null) { _isExploredMethod = typeof(Minimap).GetMethod("IsExplored", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_isExploredMethod == null) { return true; } if (_isExploredMethod.Invoke(Minimap.instance, new object[1] { pos }) is bool flag) { return !flag; } return false; } private static bool FindNearestUnexplored(string[] locationNames, Vector3 from, out Vector3 bestPos, out string bestName, out float bestDist) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) bestPos = Vector3.zero; bestName = ""; bestDist = float.MaxValue; foreach (string text in locationNames) { if (FindClosestLocation(text, from, out var result) && IsUnexplored(result)) { float num = Vector3.Distance(from, result); if (num < bestDist) { bestDist = num; bestPos = result; bestName = text; } } } return bestDist < float.MaxValue; } internal static void ActivateDungeonSeek(Player player, string trophyPrefab, string message = "The veil parts — something stirs nearby.") { //IL_000b: 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) if (!FindNearestUnexplored(DungeonLocations, ((Component)player).transform.position, out Vector3 bestPos, out string bestName, out float bestDist)) { ((Character)player).Message((MessageType)2, "The spirits do not answer. No unexplored dungeon found.", 0, (Sprite)null); return; } SeekOverrideTarget = bestPos; DungeonEnvExpiry = Time.time + DungeonEnvDuration; if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = "VoidWhisper"; } StatusEffect val = (StatusEffect)(((object)ObjectDB.instance?.m_StatusEffects?.Find((StatusEffect s) => ((Object)s).name == "SE_GuidingWind")) ?? ((object)GuidingWindSE)); if ((Object)(object)val != (Object)null) { ((Character)player).GetSEMan().AddStatusEffect(val, true, 0, 0f); } ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); Log.LogInfo((object)$"[EnvR] Dungeon seek: {bestName} at {bestDist:F0}m"); } internal static void ActivateTraderSeek(Player player) { //IL_000b: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) //IL_0068: 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_0124: Unknown result type (might be due to invalid IL or missing references) if (!FindNearestUnexplored(TraderLocations, ((Component)player).transform.position, out Vector3 bestPos, out string bestName, out float bestDist)) { bestDist = float.MaxValue; string[] traderLocations = TraderLocations; foreach (string text in traderLocations) { if (FindClosestLocation(text, ((Component)player).transform.position, out var result)) { float num = Vector3.Distance(((Component)player).transform.position, result); if (num < bestDist) { bestDist = num; bestPos = result; bestName = text; } } } if (bestDist == float.MaxValue) { ((Character)player).Message((MessageType)2, "The merchants are beyond reach.", 0, (Sprite)null); return; } } ((Character)player).Message((MessageType)2, Cfg.Rituals.Items.GetValueOrDefault("seek_trader")?.Message ?? "Gold calls to gold...", 0, (Sprite)null); Log.LogInfo((object)$"[EnvR] Trader seek: {bestName} at {bestDist:F0}m"); Vector3 val = bestPos - ((Component)player).transform.position; val.y = 0f; if (val != Vector3.zero && (Object)(object)Scheduler != (Object)null) { Scheduler.SendBird(((Vector3)(ref val)).normalized); } } internal static void ActivateKindle(Player player, string message = "The darkness yields.") { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) int num = 0; Fireplace[] array = Object.FindObjectsOfType<Fireplace>(); foreach (Fireplace val in array) { if (!(Vector3.Distance(((Component)val).transform.position, ((Component)player).transform.position) > 20f)) { val.SetFuel(val.m_maxFuel); num++; } } string text = ((num > 0) ? message : "No fires nearby to kindle."); ((Character)player).Message((MessageType)2, text, 0, (Sprite)null); Log.LogInfo((object)$"[Pilgrim] Kindle: lit {num} fires within {20f}m"); } internal static void ActivatePlayerSeek(Player player) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) Player val = null; float num = float.MaxValue; foreach (Player allPlayer in Player.GetAllPlayers()) { if (!((Object)(object)allPlayer == (Object)(object)player)) { float num2 = Vector3.Distance(((Component)player).transform.position, ((Component)allPlayer).transform.position); if (num2 < num) { num = num2; val = allPlayer; } } } if ((Object)(object)val == (Object)null) { ((Character)player).Message((MessageType)2, "You are alone...", 0, (Sprite)null); return; } Vector3 val2 = ((Component)val).transform.position - ((Component)player).transform.position; val2.y = 0f; if (val2 != Vector3.zero && (Object)(object)Scheduler != (Object)null) { Scheduler.SendBird(((Vector3)(ref val2)).normalized); } ((Character)player).Message((MessageType)2, "Find fellowship.", 0, (Sprite)null); Log.LogInfo((object)$"[EnvR] Player seek: {val.GetPlayerName()} at {num:F0}m"); } internal static void ActivateHomeSeek(Player player, string message = "The flower carries you home...") { //IL_00a1: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00ef: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) Bed val = null; float num = float.MaxValue; Bed[] array = Object.FindObjectsOfType<Bed>(); foreach (Bed val2 in array) { object obj = typeof(Bed).GetMethod("IsMine", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(val2, null); if (obj is bool && (bool)obj) { float num2 = Vector3.Distance(((Component)player).transform.position, ((Component)val2).transform.position); if (num2 < num) { num = num2; val = val2; } } } Vector3 val3 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.position : Vector3.zero); Log.LogInfo((object)$"[EnvR] HomeSeek: bed={((val != null) ? ((Object)val).name : null)} pos={val3} dist={num:F0}m"); if (val3 == Vector3.zero) { ((Character)player).Message((MessageType)2, "No bed found in loaded area — travel closer to home.", 0, (Sprite)null); return; } SeekOverrideTarget = val3; HomeEnvExpiry = Time.time + HomeEnvDuration; if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = "DreamWalk"; } StatusEffect val4 = (StatusEffect)(((object)ObjectDB.instance?.m_StatusEffects?.Find((StatusEffect s) => ((Object)s).name == "SE_GuidingWind")) ?? ((object)GuidingWindSE)); if ((Object)(object)val4 != (Object)null) { ((Character)player).GetSEMan().AddStatusEffect(val4, true, 0, 0f); } float num3 = Vector3.Distance(((Component)player).transform.position, val3); ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); Log.LogInfo((object)$"[EnvR] Home seek: bed at {val3}, dist {num3:F0}m"); } internal static void ActivateFeatherRitual(Player player, string message = "Light as a feather — fall without fear.") { ZNetScene instance = ZNetScene.instance; GameObject obj = ((instance != null) ? instance.GetPrefab("CapeFeather") : null); StatusEffect val = ((obj != null) ? obj.GetComponent<ItemDrop>() : null)?.m_itemData?.m_shared?.m_equipStatusEffect; if ((Object)(object)val == (Object)null) { ((Character)player).Message((MessageType)2, "The feathers scatter in the wind... (feather SE not found)", 0, (Sprite)null); Log.LogWarning((object)"[EnvR] CapeFeather SE not found — check prefab name"); return; } StatusEffect val2 = Object.Instantiate<StatusEffect>(val); val2.m_ttl = 60f; val2.m_startMessage = ""; val2.m_stopMessage = ""; ((Character)player).GetSEMan().AddStatusEffect(val2, true, 0, 0f); FeatherRitualExpiry = Time.time + 60f; ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); } internal static void ActivateClearSkies(Player player, string message = "The clouds part.") { ClearSkiesExpiry = Time.time + ClearSkiesDuration; if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = "Clear"; } ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); Log.LogInfo((object)$"[Pilgrim] Clear skies active for {ClearSkiesDuration}s"); } internal static void ActivateWaterWalk(Player player, string message = "The sea grows still beneath your feet.") { WaterWalkExpiry = Time.time + WaterWalkDuration; if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.SetDebugWind(0f, 0f); } StatusEffect val = (StatusEffect)(((object)ObjectDB.instance?.m_StatusEffects?.Find((StatusEffect s) => ((Object)s).name == "SE_WaterWalk")) ?? ((object)WaterWalkSE)); if ((Object)(object)val != (Object)null) { ((Character)player).GetSEMan().AddStatusEffect(val, true, 0, 0f); } ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); } internal static void ActivateGiant(Player player, string message = "The mountain answers. You are vast.") { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) float num = Cfg.Rituals.Items.GetValueOrDefault("giant")?.Duration ?? 180f; GiantExpiry = Time.time + num; GiantTargetScale = 3f; ZNetView component = ((Component)player).GetComponent<ZNetView>(); if (component != null) { ZDO zDO = component.GetZDO(); if (zDO != null) { zDO.Set("ath_scale", 3f); } } player.m_maxCarryWeight += 300f; StatusEffect val = (StatusEffect)(((object)ObjectDB.instance?.m_StatusEffects?.Find((StatusEffect s) => ((Object)s).name == "SE_Giant")) ?? ((object)GiantSE)); if ((Object)(object)val != (Object)null) { val.m_ttl = num; ((Character)player).GetSEMan().AddStatusEffect(val, true, 0, 0f); } ApplyGiantSpeed(player); SharedData val2 = ((Humanoid)player).m_unarmedWeapon?.m_itemData?.m_shared; if (val2 != null) { _origUnarmedDmg = val2.m_damages; _origUnarmedTier = (short)val2.m_toolTier; _origAttackRange = val2.m_attack.m_attackRange; _origAttackHeight = val2.m_attack.m_attackHeight; _origAttackOffset = val2.m_attack.m_attackOffset; val2.m_damages.m_blunt = 200f; val2.m_damages.m_chop = 200f; val2.m_damages.m_pickaxe = 200f; val2.m_toolTier = 100; val2.m_attack.m_attackRange = _origAttackRange * 3f; val2.m_attack.m_attackHeight = _origAttackHeight * 3f; val2.m_attack.m_attackOffset = _origAttackOffset * 3f; } VdsSwimSuppressor.Suppress(); if ((Object)(object)EnvMan.instance != (Object)null) { EnvMan.instance.m_debugEnv = "GoldenAscent"; } ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); } internal static void ApplyGiantSpeed(Player player) { if (!GiantSpeedApplied) { ((Character)player).m_walkSpeed = ((Character)player).m_walkSpeed * 1.5f; ((Character)player).m_runSpeed = ((Character)player).m_runSpeed * 2.5f; ((Character)player).m_swimSpeed = ((Character)player).m_swimSpeed * 1.5f; ((Character)player).m_jumpForce = ((Character)player).m_jumpForce * 1.2f; _origAutoPickupRange = player.m_autoPickupRange; player.m_autoPickupRange = 0f; _origSwimDepth = ((Character)player).m_swimDepth; ((Character)player).m_swimDepth = _origSwimDepth * 3f; GiantSpeedApplied = true; ((Character)player).Message((MessageType)1, "Auto-pickup disabled while giant.", 0, (Sprite)null); } } internal static void RemoveGiantSpeed(Player player) { if (GiantSpeedApplied) { ((Character)player).m_walkSpeed = ((Character)player).m_walkSpeed / 1.5f; ((Character)player).m_runSpeed = ((Character)player).m_runSpeed / 2.5f; ((Character)player).m_swimSpeed = ((Character)player).m_swimSpeed / 1.5f; ((Character)player).m_jumpForce = ((Character)player).m_jumpForce / 1.2f; player.m_autoPickupRange = _origAutoPickupRange; ((Character)player).m_swimDepth = _origSwimDepth; GiantSpeedApplied = false; } } internal static void DeactivateGiant(Player player) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) GiantExpiry = 0f; GiantTargetScale = 1f; ZNetView component = ((Component)player).GetComponent<ZNetView>(); if (component != null) { ZDO zDO = component.GetZDO(); if (zDO != null) { zDO.Set("ath_scale", 1f); } } RemoveGiantSpeed(player); SharedData val = ((Humanoid)player).m_unarmedWeapon?.m_itemData?.m_shared; if (val != null) { val.m_damages = _origUnarmedDmg; val.m_toolTier = _origUnarmedTier; val.m_attack.m_attackRange = _origAttackRange; val.m_attack.m_attackHeight = _origAttackHeight; val.m_attack.m_attackOffset = _origAttackOffset; } player.m_maxCarryWeight = Mathf.Max(player.m_maxCarryWeight - 300f, 300f); SEMan sEMan = ((Character)player).GetSEMan(); SE_Giant? giantSE = GiantSE; sEMan.RemoveStatusEffect((giantSE != null) ? ((StatusEffect)giantSE).NameHash() : 0, false); VdsSwimSuppressor.Restore(); if (EnvMan.instance?.m_debugEnv == "GoldenAscent") { EnvMan.instance.m_debugEnv = "Rain"; } GiantRainExpiry = Time.time + 600f; ((Character)player).Message((MessageType)1, "You return to mortal scale.", 0, (Sprite)null); } internal static void ActivateFlamingSword(Player player, string message = "Dyrnwyn answers. Let it burn.") { if (FlamingSwordExpiry > 0f) { DeactivateFlamingSword(player, immediate: true); } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; object? obj = typeof(Humanoid).GetField("m_rightItem", bindingAttr)?.GetValue(player); ItemData val = (ItemData)((obj is ItemData) ? obj : null); if (val != null) { ((Humanoid)player).UnequipItem(val, true); ((Humanoid)player).GetInventory().RemoveItem(val); } ItemData val2 = ((Humanoid)player).GetInventory().AddItem("SwordIronFire", 1, 1, 0, 0L, "", false); if (val2 == null) { ((Character)player).Message((MessageType)2, "No room in your pack for the flame.", 0, (Sprite)null); if (val != null) { ((Humanoid)player).GetInventory().AddItem(val); ((Humanoid)player).EquipItem(val, true); } return; } _origRightItem = val; _flamingSwordItem = val2; ((Humanoid)player).EquipItem(val2, true); SpawnSmokePuff(player); float num = Cfg.Rituals.Items.GetValueOrDefault("flaming_sword")?.Duration ?? 60f; FlamingSwordExpiry = Time.time + num; StatusEffect val3 = (StatusEffect)(((object)ObjectDB.instance?.m_StatusEffects?.Find((StatusEffect s) => ((Object)s).name == "SE_FlamingSword")) ?? ((object)FlamingSwordSE)); if ((Object)(object)val3 != (Object)null) { val3.m_ttl = num; ((Character)player).GetSEMan().AddStatusEffect(val3, true, 0, 0f); } TryPlayEmote(player, "cheer"); Scheduler?.RunDelayed(0.5f, delegate { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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) ZNetScene instance = ZNetScene.instance; GameObject val4 = ((instance != null) ? instance.GetPrefab("fx_chainlightning_hit") : null); if (!((Object)(object)val4 == (Object)null)) { Vector3 val5 = (((Component)player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHandMiddle1") ?? ((Component)player).transform).position + Vector3.up * 0.5f + ((Component)player).transform.forward * 0.5f; Object.Destroy((Object)(object)Object.Instantiate<GameObject>(val4, val5, Quaternion.identity), 4f); Log.LogInfo((object)"[Pilgrim] FlamingSword VFX: fx_chainlightning_hit"); } }); ((Character)player).Message((MessageType)2, message, 0, (Sprite)null); Log.LogInfo((object)string.Format("[Pilgrim] FlamingSword: swapped in {0} for {1}s", "SwordIronFire", num)); } private static void TryPlayEmote(Player player, string emoteName) { try { if (!((Object)(object)player != (Object)(object)Player.m_localPlayer)) { player.StartEmote(emoteName, true); } } catch (Exception ex) { Log.LogWarning((object)("[Pilgrim] TryPlayEmote failed: " + ex.Message)); } } internal static void DeactivateFlamingSword(Player player, bool immediate = false) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) FlamingSwordExpiry = 0f; ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.GetPrefab("fx_fireskeleton_nova") : null); if ((Object)(object)val != (Object)null) { Object.Instantiate<GameObject>(val, ((Component)player).transform.position, Quaternion.identity); } if (immediate) { FinishSwordSwapBack(player); return; } Scheduler?.RunDelayed(0.5f, delegate { FinishSwordSwapBack(player); }); } private static void FinishSwordSwapBack(Player player) { if (_flamingSwordItem != null) { ((Humanoid)player).UnequipItem(_flamingSwordItem, true); ((Humanoid)player).GetInventory().RemoveItem(_flamingSwordItem); if (_origRightItem != null) { ((Humanoid)player).GetInventory().AddItem(_origRightItem); ((Humanoid)player).EquipItem(_origRightItem, true); } _flamingSwordItem = null; _origRightItem = null; } SpawnSmokePuff(player); SEMan sEMan = ((Character)player).GetSEMan(); SE_FlamingSword? flamingSwordSE = FlamingSwordSE; sEMan.RemoveStatusEffect((flamingSwordSE != null) ? ((StatusEffect)flamingSwordSE).NameHash() : 0, false); ((Character)player).Message((MessageType)1, "The flame fades.", 0, (Sprite)null); } private static void SpawnSmokePuff(Player player) { //IL_003e: 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) ZNetScene instance = ZNetScene.instance; GameObject val = ((instance != null) ? instance.GetPrefab("vfx_Smoked") : null); if (!((Object)(object)val == (Object)null)) { Transform val2 = ((Component)player).transform.Find("Visual/Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHandMiddle1") ?? ((Component)player).transform; Object.Destroy((Object)(object)Object.Instantiate<GameObject>(val, val2.position, Quaternion.identity), 3f); } } internal static void GrantTrophyPower(Player player, string trophyPrefab, Terminal? ctx = null, Vector3? vfxPos = null) { //IL_007e: 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) if (TrophyToPower.TryGetValue(trophyPrefab, out string value)) { player.SetGuardianPower(value); trophyPrefab.Replace("Trophy", "").Replace("TheElder", "The Elder").Replace("DragonQueen", "Moder") .Replace("GoblinKing", "Yagluth") .Replace("SeekerQueen", "The Queen"); SpawnTrophyVFX((Vector3)(((??)vfxPos) ?? ((Component)player).transform.position)); ((Character)player).Message((MessageType)1, "You claim the power of the forsaken.", 0, (Sprite)null); } } internal static void SpawnRitualVFX(Vector3 firePos, Vector3 playerPos) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null) { return; } GameObject prefab = instance.GetPrefab("fx_batteringram_fire"); if ((Object)(object)prefab != (Object)null) { Vector3 val = firePos - playerPos; val.y = 0f; if (val == Vector3.zero) { val = Vector3.forward; } Object.Destroy((Object)(object)Object.Instantiate<GameObject>(prefab, firePos, Quaternion.LookRotation(((Vector3)(ref val)).normalized)), 4f); } GameObject prefab2 = instance.GetPrefab("fx_fireskeleton_nova"); if ((Object)(object)prefab2 != (Object)null) { Object.Instantiate<GameObject>(prefab2, firePos, Quaternion.identity); } } private static void SpawnTrophyVFX(Vector3 pos) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null) { return; } string[] array = new string[4] { Cfg.Trophies.Vfx, "vfx_guardianpower_activate", "vfx_offering", "vfx_lootspawn" }; foreach (string text in array) { GameObject prefab = instance.GetPrefab(text); if ((Object)(object)prefab != (Object)null) { Object.Instantiate<GameObject>(prefab, pos, Quaternion.identity); Log.LogInfo((object)("[Pilgrim] Trophy VFX: " + text)); break; } } } internal static (string? boss, string? prefab) GetNextBoss() { ZoneSystem instance = ZoneSystem.instance; if ((Object)(object)instance == (Object)null) { return (boss: null, prefab: null); } for (int i = 0; i < BossChain.Length; i++) { if (i >= BossKeys.Length || !instance.GetGlobalKey(BossKeys[i])) { return (boss: BossChain[i].boss, prefab: BossChain[i].prefab); } } return (boss: null, prefab: null); } internal static bool FindClosestLocation(string prefabName, Vector3 refPos, out Vector3 result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) result = Vector3.zero; ZoneSystem instance = ZoneSystem.instance; if ((Object)(object)instance == (Object)null) { return false; } LocationInstance val = default(LocationInstance); if (instance.FindClosestLocation(prefabName, refPos, ref val)) { result = val.m_position; return true; } return false; } private static void PrintSchedule(ConsoleEventArgs args, EnvScheduler s) { args.Context.AddString(string.Format("Scheduler : {0} | prob {1:P0}", s.Active ? "ON" : "OFF", s.Probability)); args.Context.AddString("Night pool: " + string.Join(", ", s.NightPool)); args.Context.AddString("Noon pool : " + string.Join(", ", s.NoonPool)); } private static string? GetEnvSetupName(EnvMan em, string fieldName) { object? obj = typeof(EnvMan).GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(em); EnvSetup val = (EnvSetup)((obj is EnvSetup) ? obj : null); if (val != null && !string.IsNullOrEmpty(val.m_name)) { return val.m_name; } return null; } private static object? AnyField(object obj, params string[] names) { Type type = obj.GetType(); foreach (string name in names) { object obj2 = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj); if (obj2 != null) { return obj2; } } return null; } private static void Msg(Terminal? ctx, string text) { if ((Object)(object)ctx != (Object)null) { ctx.AddString(text); return; } MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)1, text, 0, (Sprite)null, false); } } private static void Announce(string text) { if ((Object)(object)Chat.instance != (Object)null) { Chat.instance.SendText((Type)1, text); } } internal static float GetTod() { EnvMan instance = EnvMan.instance; if ((Object)(object)instance != (Object)null) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo? field = typeof(EnvMan).GetField("m_debugTimeOfDay", bindingAttr); FieldInfo field2 = typeof(EnvMan).GetField("m_debugTime", bindingAttr); object obj = field?.GetValue(instance); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { obj = field2?.GetValue(instance); if (obj is float) { return (float)obj; } } } if ((Object)(object)ZNet.instance == (Object)null) { return 0f; } return (float)(ZNet.instance.GetTimeSeconds() % 1800.0 / 1800.0); } private static string GetTodLabel(float t) { if (t < 0.25f) { return "night"; } if (t < 0.32f) { return "dawn"; } if (t < 0.5f) { return "morning"; } if (t < 0.68f) { return "afternoon"; } if (t < 0.75f) { return "dusk"; } return "night"; } internal static Random GetRng() { return Rng; } } [HarmonyPatch(typeof(Character), "ApplyDamage")] internal class FeatherFallPatch { private static void Prefix(Character __instance, ref HitData hit) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !(Time.time > Plugin.FeatherRitualExpiry) && (int)hit.m_hitType == 3) { hit.m_damage.m_damage = 0f; } } } [HarmonyPatch(typeof(Character), "IsOnGround")] internal class WaterWalkGroundPatch { private static bool Prefix(Character __instance, ref bool __result) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } if (Plugin.WaterWalkExpiry <= 0f || Time.time >= Plugin.WaterWalkExpiry) { return true; } WaterVolume val = null; float waterLevel = Floating.GetWaterLevel(((Component)__instance).transform.position, ref val); if (((Component)__instance).transform.position.y <= waterLevel + 0.02f) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(Character), "IsSwimming")] internal class WaterWalkSwimPatch { private static bool Prefix(ref bool __result) { if (Plugin.WaterWalkExpiry > 0f && Time.time < Plugin.WaterWalkExpiry) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Character), "UpdateWater")] internal class WaterWalkUpdatePatch { private static bool Prefix() { if (Plugin.WaterWalkExpiry > 0f) { return !(Time.time < Plugin.WaterWalkExpiry); } return true; } } [HarmonyPatch(typeof(Character), "Jump")] internal class WaterWalkJumpPatch { private static void Postfix(Character __instance) { //IL_002f: 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) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer || Plugin.WaterWalkExpiry <= 0f || Time.time >= Plugin.WaterWalkExpiry) { return; } WaterVolume val = null; float waterLevel = Floating.GetWaterLevel(((Component)__instance).transform.position, ref val); if (!(((Component)__instance).transform.position.y > waterLevel + 0.5f)) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic; object? obj = typeof(Character).GetField("m_body", bindingAttr)?.GetValue(__instance); Rigidbody val2 = (Rigidbody)((obj is Rigidbody) ? obj : null); if (val2 != null) { val2.AddForce(Vector3.up * 4f, (ForceMode)2); } } } } [HarmonyPatch(typeof(Fireplace), "GetHoverText")] internal class FireplaceHoverPatch { private static readonly string[] CampfirePrefabs = new string[3] { "fire_pit", "fire_pit_iron", "hearth" }; private static void Postfix(Fireplace __instance, ref string __result) { if (!__instance.IsBurning()) { return; } string goName = ((Object)((Component)__instance).gameObject).name.ToLower().Replace("(clone)", "").Trim(); if (!Array.Exists(CampfirePrefabs, (string p) => goName.StartsWith(p)) || !Plugin.Cfg.Rituals.Enabled) { return; } Player player = Player.m_localPlayer; Dictionary<string, RitualItemConfig> items = Plugin.Cfg.Rituals.Items; HashSet<string> hashSet = new HashSet<string>(); StringBuilder stringBuilder = new StringBuilder(); (string, bool, string, string)[] ritualItemMap = Plugin.RitualItemMap; for (int num = 0; num < ritualItemMap.Length; num++) { string item = ritualItemMap[num].Item3; if (hashSet.Add(item) && KnownAndEnabled(item) && items.TryGetValue(item, out RitualItemConfig value)) { stringBuilder.Append("\n <color=yellow>" + item switch { "seek_altar" => "Boar Meat", "restore_power" => "Mushroom", "seek_bed" => "Dandelion", "feather_fall" => "Feathers", "seek_trader" => "Coins", "seek_dungeon" => "Trophy", "clear_skies" => "Greydwarf Eye", "water_walk" => "Stone", "growth" => "Ancient Seed", "tame_flock" => "Bone Fragments", "seek_player" => "Flint", "kindle" => "Resin", "giant" => "Ymir Flesh", "flaming_sword" => "Surtling Core", _ => item, } + "</color> — " + value.HoverText); } } HashSet<string> hashSet2 = new HashSet<string>(); HashSet<string> hashSet3 = new HashSet<string>(); ritualItemMap = Plugin.RitualItemMap; for (int num = 0; num < ritualItemMap.Length; num++) { string item2 = ritualItemMap[num].Item3; if (items.TryGetValue(item2, out RitualItemConfig value2) && value2.Enabled) { hashSet2.Add(item2); if ((Object)(object)player != (Object)null && Plugin.IsRitualKnown(player, item2)) { hashSet3.Add(item2); } } } if (stringBuilder.Length != 0) { string text = ((Plugin.RitualCooldownRemaining > 0f) ? $" <color=red>({Plugin.RitualCooldownRemaining:F0}s)</color>" : ""); string text2 = string.Format(" <color={0}>{1}/{2}</color>", (hashSet3.Count < hashSet2.Count) ? "yellow" : "green", hashSet3.Count, hashSet2.Count); __result = __result + "\n<size=14><color=orange>── Offerings" + text2 + text + " ──</color>"; __result += stringBuilder.ToString(); __result += "</size>"; } bool KnownAndEnabled(string key) { if (items.TryGetValue(key, out RitualItemConfig value3) && value3.Enabled) { if (!((Object)(object)player == (Object)null)) { return Plugin.IsRitualKnown(player, key); } return true; } return false; } } } [HarmonyPatch(typeof(Player), "UseHotbarItem")] internal class UseHotbarItemPatch { private static readonly string[] CampfirePrefabs = new string[3] { "fire_pit", "fire_pit_iron", "hearth" }; private static bool Prefix(Player __instance, int index) { //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } GameObject hoverObject = ((Humanoid)__instance).GetHoverObject(); if ((Object)(object)hoverObject == (Object)null) { return true; } Fireplace componentInParent = hoverObject.GetComponentInParent<Fireplace>(); if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsBurning()) { return true; } string goName = ((Object)((Component)componentInParent).gameObject).name.ToLower().Replace("(clone)", "").Trim(); if (!Array.Exists(CampfirePrefabs, (string p) => goName.StartsWith(p))) { return true; } if (!Plugin.Cfg.Rituals.Enabled) { return true; } ItemData itemAt = ((Humanoid)__instance).GetInventory().GetItemAt(index - 1, 0); if ((Object)(object)itemAt?.m_dropPrefab == (Object)null) { return true; } string prefab = ((Object)itemAt.m_dropPrefab).name; Dictionary<string, RitualItemConfig> ritualItems = Plugin.Cfg.Rituals.Items; if ((!(prefab == Plugin.SeekFood) || !RitualEnabled("seek_altar")) && (!prefab.StartsWith("Mushroom") || !RitualEnabled("restore_power")) && (!(prefab == Plugin.HomeFood) || !RitualEnabled("seek_bed