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.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using HarmonyLib; using Splatform; using TMPro; using UnityEngine; using UnityEngine.Experimental.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ValheimMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ValheimMod")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5bd3bb56-8412-4715-841f-75c0d11515f3")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace WildlingMod; internal class Alignment { private class ClanMemberData { public string m_clan; public int m_rank; public bool m_barter; public float m_trust; public float m_discoverRadius; public ClanMemberData(string clan = "", bool barter = false, float trust = 0.2f, float discoverRadius = 0f) { if (clan == "") { clan = "NONE"; } m_clan = clan; m_trust = trust; m_barter = barter; m_discoverRadius = discoverRadius; if (!m_clanSize.ContainsKey(clan)) { m_clanSize.Add(clan, 0); } m_rank = m_clanSize[clan]++; } } private class CharacterOnConsumedItem { public Character m_character; public CharacterOnConsumedItem(Character character) { m_character = character; } public void OnConsumedItem(ItemDrop item) { if (item.m_itemData != null && !((Object)(object)m_character == (Object)null) && !m_character.IsDead()) { try { PickupItem(item, m_character); } catch { WDBUG.Log("CATCH: OnConsumeItem for " + WUTIL.ActorName(m_character)); } } } } [HarmonyPatch(typeof(BaseAI), "IsEnemy", new Type[] { typeof(Character), typeof(Character) })] private class PatchBaseAIFaction { private static void Postfix(Character a, Character b, ref bool __result) { //IL_0039: 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) __result = IsEnemy(a, b, __result); if (__result && ((Object)(object)a == (Object)(object)Player.m_localPlayer || (Object)(object)b == (Object)(object)Player.m_localPlayer) && Vector3.Distance(((Component)a).transform.position, ((Component)b).transform.position) < m_playerNoEnemyRange) { World.m_locationUnsafe = true; } } } [HarmonyPatch(typeof(Projectile), "IsValidTarget")] private class PatchProjectileIsValidTarget { private static void Prefix(IDestructible destr, Character ___m_owner) { Character val = (Character)(object)((destr is Character) ? destr : null); if ((Object)(object)val != (Object)null && (Object)(object)___m_owner != (Object)null && (Object)(object)val != (Object)(object)___m_owner) { IgnoreNextIsEnemyCheck(); } } } [HarmonyPatch(typeof(BaseAI), "CanSenseTarget", new Type[] { typeof(Character) })] private class PatchBaseAICanSenseTarget { public static bool Prefix(BaseAI __instance, Character target, Character ___m_character, ref bool __result) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Invalid comparison between Unknown and I4 //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Invalid comparison between Unknown and I4 //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Invalid comparison between Unknown and I4 //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Invalid comparison between Unknown and I4 //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Invalid comparison between Unknown and I4 //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Invalid comparison between Unknown and I4 //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Invalid comparison between Unknown and I4 //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Invalid comparison between Unknown and I4 //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Invalid comparison between Unknown and I4 //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Invalid comparison between Unknown and I4 //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Invalid comparison between Unknown and I4 //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)___m_character == (Object)null || (Object)(object)target == (Object)null) { return true; } __result = true; string text = WUTIL.ActorName(___m_character); if ((Object)(object)target == (Object)(object)Player.m_localPlayer) { bool flag = AlertedToPlayer(___m_character); if ((int)___m_character.GetFaction() == 7 && WUTIL.TestLuck(0.01f * (float)Quest.GetAchievement("DarklingShade"))) { __result = false; } else if (m_characterDazed.ContainsKey(___m_character) && m_characterDazed[___m_character] >= 100f) { WDBUG.Log($"{___m_character.GetHoverName()} should not see you for {m_characterDazed[___m_character] - 100f}s!", WDBUG.Level.warn, 1f); __result = false; } else if (Fairy.PinePasteActive(___m_character)) { __result = false; } else if (text == "Pixie") { if (___m_character.GetHealthPercentage() < 0.99f || SwampDungeon.AtGreatOak(((Component)___m_character).transform)) { return true; } Vector3 val = ((Component)___m_character).transform.position - ((Component)target).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 30f) { if (AlertedToPlayer(___m_character, anyTarget: true) && magnitude < 8f) { if (Wildling.IsWildling) { __result = Quest.GetAchievement("BoundYgnie") != 1 && WUTIL.TestLuck(); } else { Transform transform = ((Component)___m_character).transform; transform.position += 10f * ((Vector3)(ref val)).normalized; WDBUG.Log("Pixie vanish", WDBUG.Level.Wildlife); } } else if (magnitude < 12f) { if (Wildling.IsWildling) { __result = !PlayerHiddenFromTarget(___m_character); if (__result) { FlickTarget(___m_character); } } else { Transform transform2 = ((Component)___m_character).transform; transform2.position += 12f * ((Vector3)(ref val)).normalized; FlickTarget(___m_character); } } if (WUTIL.RandomSpin() < 0.2f) { WUTIL.PlaceObject("ygnie_blind_aoe", ((Component)___m_character).transform.position, 0.5f); val = WUTIL.OnCircle(Vector3.zero, 0.5f + WUTIL.RandomSpin()); val.y = WUTIL.RandomSpin(); Transform transform3 = ((Component)___m_character).transform; transform3.position += val; WUTIL.PlaceObject("ygnie_blind_aoe", ((Component)___m_character).transform.position, 0.5f); } } } if (__result) { Faction faction = target.GetFaction(); if ((int)faction == 3 || (int)faction == 4) { if (m_holdingDraugrRatTail) { __result = !WUTIL.TestLuck(0.7f); } if (__result && (int)Wildling.BiomeClothingBuff == 4) { __result = !WUTIL.TestLuck(2f * Equipment.HideClothingBuff + 0.5f); } } else if ((int)faction == 5) { if ((int)Wildling.BiomeClothingBuff == 4) { __result = !WUTIL.TestLuck(3f * Equipment.HideClothingBuff + 0.5f); } } else if ((int)faction == 7 && (int)Wildling.BiomeClothingBuff == 16) { __result = !WUTIL.TestLuck(3f * Equipment.HideClothingBuff + 0.5f); } } if (__result && m_holdingRatTail && (text.StartsWith("Skeleton") || text.StartsWith("Draugr") || text == "Ghost")) { __result = !WUTIL.TestLuck(0.8f); } if (__result && PlayerHiddenFromTarget(___m_character)) { __result = false; } else if (!__result && flag && WUTIL.TestLuck(0.2f)) { StopHunt(___m_character); } } else { string text2 = WUTIL.ActorName(target); if (text2 == "Pixie" || text2 == "Ygnie") { __result = GetClan(___m_character) == "Goblin" || text == "Ghost" || text == "Wraith" || text == "Doxie"; } else if (text2.StartsWith("Rabbit")) { text2 = text2.Substring(6); float num = 0f; Biome val2 = Heightmap.FindBiome(((Component)target).transform.position); switch (text2) { case "White": num = (((int)val2 == 4) ? 0.95f : 0f); break; case "Tan": num = (((int)val2 == 16) ? 0.95f : 0.2f); break; case "Grey": num = (((int)val2 == 2) ? 0.95f : (((int)val2 == 4) ? 0f : 0.8f)); break; } __result = num == 0f || WUTIL.RandomSpin() < num; } } return __result; } } [HarmonyPatch(typeof(Character), "IsTamed", new Type[] { })] private class PatchCharacterIsTamed { public static bool Prefix(Character __instance, ref bool ___m_tamed, ref bool __result) { if (Object.op_Implicit((Object)(object)((Component)__instance).GetComponent()) || Object.op_Implicit((Object)(object)((Component)__instance).GetComponent())) { return true; } string text = WUTIL.ActorName(__instance); if (text == "Ygnie") { Fairy.YgnieCapture(__instance); __result = WUTIL.Timer("ygnie_tamed_cooldown") == 0f; } else { __result = Riding.IsRiding(__instance) || IsBeastFriendly(__instance, OrTameable: false); if (___m_tamed && !__result) { WDBUG.Log("Untaming " + text, WDBUG.Level.Taming); __instance.SetTamed(false); ___m_tamed = false; } } return false; } } [HarmonyPatch(typeof(Character), "Awake")] private class PatchCharacterAwake { public static void Postfix(Character __instance) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Riding.Awake(__instance); if (!Fairy.Awoke(__instance) && !World.Unspawn(__instance)) { if ((Object)(object)((Component)__instance).gameObject.GetComponent() == (Object)null) { __instance.IsTamed(); } if (((Component)__instance).transform.position.y > 5000f) { bool flag = MountainDungeon.InSnakeBodyRegion(((Component)__instance).transform.position); Place.RecustomizeCharacter(__instance, !flag); } } } } [HarmonyPatch(typeof(Character), "GetHoverName")] private class PatchCharacterGetHoverName { public static void Postfix(Character __instance, ref string __result) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null && !((Object)__instance).name.Contains("(Clone")) { __result = ((Object)__instance).name; } } } [HarmonyPatch(typeof(AnimalAI), "UpdateAI")] private class PatchAnimalAIUpdateAI { public static void Postfix(AnimalAI __instance, float dt, ref float ___m_inDangerTimer, ref Character ___m_target) { Riding.UpdateAI(((Component)__instance).gameObject, dt); if ((Object)(object)m_signalUnalert == (Object)(object)__instance) { m_signalUnalert = null; ___m_inDangerTimer = __instance.m_timeToSafe; ___m_target = null; } else if (((BaseAI)__instance).IsAlerted()) { Character component = ((Component)__instance).gameObject.GetComponent(); if (Riding.IsRidingBonded(component)) { ___m_inDangerTimer = __instance.m_timeToSafe; ___m_target = null; } } else { string text = UpdateConsumeItem((BaseAI)(object)__instance); if (text != "" && text != "!") { FeedAnimal(((Component)__instance).gameObject.GetComponent(), text); } } TrackScentTypes(((Component)__instance).gameObject.GetComponent()); } } [HarmonyPatch(typeof(MonsterAI), "UpdateAI")] private class PatchMonsterAIUpdateAI { private static float m_minFleeDistRun = 0f; private static float m_fleeIfLowHealth = -1f; public static void Prefix(MonsterAI __instance, ref Character ___m_targetCreature) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer != (Object)null && AutoFlee(__instance)) { ___m_targetCreature = (Character)(object)Player.m_localPlayer; ((Component)__instance).GetComponent().SetLookDir(((Component)__instance).transform.position - ((Component)___m_targetCreature).transform.position, 0f); } } public static void Postfix(MonsterAI __instance, float dt, ref float ___m_timeSinceSensedTargetCreature, ref Character ___m_targetCreature) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown if (!((Object)(object)Player.m_localPlayer != (Object)null)) { return; } Riding.UpdateAI(((Component)__instance).gameObject, dt); if ((Object)(object)m_signalUnalert == (Object)(object)__instance) { m_signalUnalert = null; ___m_timeSinceSensedTargetCreature = 99f; ___m_targetCreature = null; } if (m_fleeIfLowHealth >= 0f) { if (m_fleeIfLowHealth > 99f) { if (WUTIL.TestLuck()) { ((Component)__instance).gameObject.GetComponent().Damage(new HitData { m_damage = { m_damage = 9999f } }); } else { Transform transform = ((Component)__instance).transform; transform.position += 100f * Vector3.up; } } else { __instance.m_fleeIfLowHealth = m_fleeIfLowHealth; } m_fleeIfLowHealth = -1f; } TrackScentTypes(((Component)__instance).gameObject.GetComponent()); } private static bool AutoFlee(MonsterAI monsterAI) { //IL_0104: 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) Character component = ((Component)monsterAI).gameObject.GetComponent(); bool flag = false; if (m_characterDazed.ContainsKey(component)) { float num = m_characterDazed[component]; flag = num < 100f && num > 5f; } else { float num2 = 0f; if (ElderWand.Turned(component)) { num2 = 3f + component.GetRadius(); } else if (WUTIL.ActorName(component) == "Pixie") { num2 = 12f; } if (num2 > 0f) { num2 -= (float)(((Character)Player.m_localPlayer).IsCrouching() ? 2 : 0); if (WUTIL.Timer("flee_dist_update") == 0f) { m_minFleeDistRun = num2 + (float)WUTIL.DieRoll(9); WUTIL.TimerReset("flee_dist_update", WUTIL.RandomSpin(1f, 2.5f)); } float num3 = Vector3.Distance(((Component)component).transform.position, ((Component)Player.m_localPlayer).transform.position); if (num3 <= num2) { ((BaseAI)monsterAI).Alert(); } if (num3 < m_minFleeDistRun) { flag = true; } else { if (num3 < m_minFleeDistRun + 6f) { return false; } if (num3 > 64f) { m_fleeIfLowHealth = 100f; } } } } if (flag && monsterAI.m_fleeIfLowHealth < 2f) { m_fleeIfLowHealth = monsterAI.m_fleeIfLowHealth; monsterAI.m_fleeIfLowHealth = 2f; } return flag; } } [HarmonyPatch(typeof(MonsterAI), "CanConsume")] private class PatchMonsterAICanConsume { private static void Postfix(MonsterAI __instance, ItemData item, ref bool __result) { if (!__result && WUTIL.ItemName(item) == "RabbitMeat") { string text = WUTIL.GameName(((Component)__instance).gameObject); if (text == "Wolf" || IsMarlonCat(text)) { __result = true; } } } } [HarmonyPatch(typeof(BaseAI), "SetAlerted")] private class PatchBaseAISetAlerted { public static void Prefix(BaseAI __instance, ref bool alert) { if (alert) { alert = !IsCalmed(((Component)__instance).gameObject.GetComponent()); } } } [HarmonyPatch(typeof(MonsterAI), "UpdateConsumeItem")] private class PatchMonsterAIUpdateConsumeItem { public static void Prefix(ItemDrop ___m_consumeTarget) { if ((Object)(object)___m_consumeTarget != (Object)null) { ItemData itemData = ___m_consumeTarget.m_itemData; if (itemData == null) { WDBUG.Log("PatchMonsterAIUpdateConsumeItem detected null ItemData"); } else if ((Object)(object)___m_consumeTarget.m_itemData.m_dropPrefab == (Object)null) { WUTIL.FixItemPrefab(itemData, "PatchHumanoidDropItem"); } } } public static void Postfix(MonsterAI __instance, ref bool __result, ItemDrop ___m_consumeTarget) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if (__result) { GameObject gameObject = ((Component)__instance).gameObject; string text = WUTIL.GameName(gameObject); if (text == "DefiledRoot" && gameObject.transform.localScale.y < 3.5f) { Humanoid component = gameObject.GetComponent(); ((Character)component).SetMaxHealth(Mathf.Min(((Character)component).GetMaxHealth() + 2f, 1000f)); ((Character)component).SetHealth(((Character)component).GetHealth() + 2f); Transform transform = gameObject.transform; transform.localScale += 0.01f * Vector3.one; WDBUG.Log($"Growing DefiledRoot to {((Component)__instance).transform.localScale.y} hp: {((Character)component).GetMaxHealth()}", WDBUG.Level.Wildlife); Place.Object("digger_undig", ((Component)__instance).transform.position); } } else { string text2 = UpdateConsumeItem((BaseAI)(object)__instance); if (text2 == "!") { __result = true; } else if (text2 != "") { FeedAnimal(((Component)__instance).gameObject.GetComponent(), text2); __result = true; } } } } [HarmonyPatch(typeof(Tameable), "OnConsumedItem")] private class PatchTameableOnConsumedItem { public static bool Prefix(ItemDrop item, Character ___m_character) { return (Object)(object)___m_character != (Object)null && (Object)(object)item != (Object)null && item.m_itemData != null; } } [HarmonyPatch(typeof(RandomIdle), "GetRandomIdle")] private class PatchRandomIdleGetRandomIdle { public static void Postfix(ref int __result, Character ___m_character) { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return; } string text = WUTIL.ActorName(___m_character); if (text.StartsWith("Rabbit")) { if (__result == 9) { __result = 0; } } else if (text == "Eikthyr") { WDBUG.Log($"{text} idle: {__result}"); } else if (text == "Deer") { if (WUTIL.Timer("Deer_consume") > 0f) { __result = 1; } else if (Riding.IsRiding(___m_character) && (__result == 1 || IsBonded(___m_character))) { __result = 0; } } } } [HarmonyPatch(typeof(Tameable), "IsHungry")] private class PatchTameableIsHungry { public static bool Prefix(Tameable __instance, ref bool __result) { Character component = ((Component)__instance).gameObject.GetComponent(); if (m_characterFoodTime.ContainsKey(component)) { if (WUTIL.ActorName(component) == "Boar") { __instance.m_commandable = true; } __result = GetAnimalFedTime(component) <= 10f; return false; } if (__instance.m_commandable && WUTIL.ActorName(component) == "Boar") { BaseAI baseAI = component.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if ((Object)(object)val.GetFollowTarget() != (Object)null) { __instance.Command((Humanoid)(object)Player.m_localPlayer, false); } __instance.m_commandable = false; } return true; } } [HarmonyPatch(typeof(CharacterDrop), "OnDeath")] private class PatchCharacterDropOnDeath { public static void Postfix(CharacterDrop __instance) { ForestDungeon.OnDeath(((Component)__instance).gameObject); Loki.OnDeath(((Component)__instance).gameObject); Fairy.OnDeath(((Component)__instance).gameObject); } } [HarmonyPatch(typeof(Character), "ApplyDamage")] private class PatchCharacterApplyDamage { public static void Postfix(Character __instance, HitData hit) { if (!Wildling.IsWildling || !((Object)(object)hit.GetAttacker() == (Object)(object)Player.m_localPlayer) || __instance.GetHealth() > 0f) { return; } string text = WUTIL.ActorName(__instance); if (text == "Deer") { if (Wildling.SkillFactor((SkillType)0) > 0.03f) { Quest.AdvanceAchievement("DeerKilled"); } } else if (text == "Greyling") { if (Wildling.SkillFactor((SkillType)0) > 0.06f) { Quest.AdvanceAchievement("GreydwarfKilled"); m_greydwarfReputaion -= 20f; } } else if (text.StartsWith("Greydwarf")) { if (Wildling.SkillFactor((SkillType)0) > 0.09f) { Quest.AdvanceAchievement("GreydwarfKilled"); m_greydwarfReputaion -= 30 * GetClanRank(__instance); } } else if (text.StartsWith("Rat")) { Quest.AdvanceAchievement("RatsKilled"); } if (Equipment.m_weaponObjectivePass) { Quest.CheckObjective(2, set: false); } if (Equipment.m_justThrewPebble) { Equipment.m_justThrewPebble = false; Slingshot.CheckAchievement(); } } } [HarmonyPatch(typeof(RandomAnimation), "FixedUpdate")] private class PatchRandomAnimationFixedUpdate { public static bool Prefix(RandomAnimation __instance) { if (Wildling.IsWildling && m_friendlyEikthyr) { Character component = ((Component)__instance).GetComponent(); if ((Object)(object)component != (Object)null && WUTIL.ActorName(component) == "Eikthyr") { StopHunt(component); return false; } } return true; } } [HarmonyPatch(typeof(BaseAI), "IdleMovement")] private class PatchBaseAIIdleMovement { public static bool Prefix(BaseAI __instance) { return !Quest.IsGathered(((Component)__instance).gameObject.GetComponent()); } } public static int m_treecareReward = 0; public static bool m_holdingRatTail = false; public static bool m_holdingDraugrRatTail = false; public static bool m_friendlyEikthyr = false; public static bool m_friendlyElder = false; public static bool m_justDropped = false; public static bool m_debugIsEnemy = false; public static bool m_pixieAttackAdult = false; public static bool m_detectScentsInside = true; public static float m_greydwarfReputaion = 1000000f; public static float m_holdingRabbitFootLuck = 0f; public static string m_lastCreatureSeen = ""; public static string m_lastDroppedItem = ""; private const float c_mountDistance = 2f; private static IDictionary m_clanMembers = new Dictionary(); private static IDictionary m_clanSize = new Dictionary(); private const float c_pettingCommandCooldown = 1f; private const float c_clanUnfriendlyCooldown = 5f; private const float c_barterDistanceFactor = 0.93f; private const float c_gdRecentDropsResetDelay = 120f; private const float c_barterReputationMin = -20f; private const float c_frientlyReputationMin = -50f; private const float c_reputationRecoverRate_GD = 0.1f; private const float c_reputationDamageRate_GD = 1f; private const float c_reputationMinimum_GD = -1200f; private const float c_clanMemberTrustMin = 0.1f; private const float c_clanMemberTrustMax = 0.35f; private const float c_clanMemberTrustGainPerBarter = 0.005f; private const float c_stopHuntMinDF = 0.24f; private const float c_unhideUnseenMaxDF = 0.7f; private const float c_lookAwayBaseTime = 100f; private const float c_nolongerTameTime = 110f; private const float c_hiddenMovementFactor = 0.51f; private const float c_dazedFleeUntilTime = 5f; private const float c_holdingRabbitFootLuck = 0.1f; private const float c_luckySeenHidingChance = 0.5f; private const float c_luckyUnseenHidingChance = 0.9f; private const float c_holdingRatTailProtection = 0.8f; private const float c_holdingDraugrRatTailProtection = 0.7f; private const float c_pixieJitterRate = 0.2f; private const float c_pixieSkipSpeed = 8f; private const float c_pixieApproachDistMin = 12f; private const float c_pixieApproachDistMax = 30f; private const string c_tradeColorQuestTrg = "#8AF"; private const string c_tradeColorDontcare = "#AA6"; private const string c_tradeColorCondense = "#CC8"; private const string c_tradeColorTreecare = "#8C4"; private const string c_tradeColorExchange = "#CCA"; private const string c_tradeColorResource = "#FC8"; private const string c_tradeColorTrophies = "#FDA"; private const string c_tradeColorInsulted = "#F44"; private const string c_tradeColorSpecials = "#FBC"; private static bool m_ignoreIsEnemyCheck = false; private static bool m_wildlingHidden = false; private static float m_playerNoEnemyRange = 15f; private static BaseAI m_signalUnalert = null; private static Character m_followingBonded = null; private static List m_gdRecentDrops = new List(); private static Dictionary m_scentTypes = new Dictionary(); private static string[] m_gdExchangeItems = "Wood,Raspberry,Mushroom,PebbleRough,Resin,PebbleSmooth,BeechSeeds,Feathers,CarrotSeeds,FirCone,Stone,Blueberries,Coal,Thistle,PineCone,PebbleFine,FineWood,Pukeberries,TurnipSeeds,BirchSeeds,Flint,Dandelion,Carrot,MushroomYellow,OnionSeeds,Acorn,RoundLog,Apples,Cloudberry,MushroomBlue".Split(new char[1] { ',' }); private static float[] m_gdExchangeItemValues = new float[30] { 0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2f, 2.1f, 2.2f, 2.3f, 2.4f, 2.5f, 2.6f, 2.7f, 2.8f, 2.9f }; private static string[] m_gdTrophyItems = "BoneFragments,Amber,AmberPearl,QueenBee,Ruby,Crystal,TrophySkeleton,Bloodbag,TrophySkeletonPoison,Ooze,Entrails,Chain,DoxieDust,Root,SurtlingCore,Guck,WitheredBone,TrophyLeech,TrophyBlob,TrophyDraugr,TrophyDraugrFem,TrophyDraugrElite,TrophyWraith,TrophySurtling,TrophyGrowth,TrophyAbomination,TrophyGoblin,TrophyGoblinBrute,TrophyGoblinShaman,TrophyBonemass,TrophyGoblinKing".Split(new char[1] { ',' }); private static float[] m_gdTrophyItemValues = new float[31] { 0.4f, 0.9f, 1.2f, 1.3f, 1.4f, 1.5f, 2f, 2.2f, 2.25f, 2.3f, 2.4f, 2.5f, 2.5f, 2.5f, 3f, 3.1f, 3.2f, 3.3f, 3.35f, 3.4f, 3.5f, 3.6f, 3.7f, 4f, 4.1f, 4.2f, 4.3f, 4.4f, 4.5f, 4.6f, 4.7f }; private static string[] m_gdRewardItems = "BeechSeeds,PineCone,FirCone,Mushroom:3,FineWood,PebbleFine:2,PebbleSmooth:5,Resin:5,Carrot:2,TurnipSeeds:3,Cloudberry,Truffle,Onion,Apples:2,Honey:3,Thistle:5,OnionSeeds:3,FineWood:3,RoundLog,Turnip:3,Onion:3,Truffle:3,RoundLog:3,Apples:3,ElderBark,MushroomBlue:3,SilverNecklace,AncientMushroom,KnifeCopper,MeadStaminaMinor,MeadHealthMinor,MeadPoisonResist,MeadStaminaMedium,MeadHealthMedium,MeadFrostResistMeadPoisonResist:5,MeadStaminaMedium:10,MeadHealthMedium:10,MeadFrostResist:10,MeadPoisonResist:10".Split(new char[1] { ',' }); private static float[] m_gdRewardItemValues = new float[40] { 0.4f, 0.5f, 0.5f, 0.5f, 0.6f, 0.7f, 0.7f, 0.8f, 0.8f, 0.8f, 0.8f, 0.8f, 1f, 1.1f, 1.2f, 1.25f, 1.3f, 1.3f, 1.3f, 1.35f, 1.4f, 1.45f, 2f, 2.2f, 2.3f, 2.4f, 2.5f, 2.6f, 2.7f, 3f, 3.1f, 3.3f, 3.4f, 3.5f, 3.6f, 4f, 4.2f, 4.4f, 4.6f, 4.8f }; private static string[] m_gdInsultItems = "GreydwarfEye,AncientSeed,TrophyGreydwarf,TrophyGreydwarfBrute,TrophyGreydwarfShaman,TrophyEikthyr,TrophyTheElder".Split(new char[1] { ',' }); private static float[] m_gdInsultItemValues = new float[7] { 0f, 1f, 2f, 2.2f, 2.3f, 2.5f, 3f }; private const float c_beehiveCheckCooldown = 300f; private const float c_consumeSearchRange = 30f; private const float c_consumeMinRange = 1f; private const float c_consumeRunRangeFactor = 0.2f; private const float c_consumeSearchFrequency = 0.2f; private const float c_consumeLoseScentChance = 0.01f; private const float c_rabbitAttactorStrength = 0.7f; private const float c_consumeFishFoodRange = 16f; private const float c_consume2ndFoodRange = 4f; private const float c_consumeBearBaitPoison = 200f; private static Dictionary m_consumeRanges = new Dictionary { { "Bjorn", 1.6f }, { "Fenring", 1.2f }, { "Fenringlin", 1.2f }, { "Deer", 1.9f }, { "Boar", 1.4f }, { "Wolf", 1.5f }, { "Neck", 0.8f } }; private static Dictionary m_animalFoods = new Dictionary { { "RabbitTan", "RabbitBait,6;Carrot,3" }, { "RabbitGrey", "RabbitBait,5;Carrot,3" }, { "RabbitWhite", "RabbitBait,4;Carrot,3" }, { "Deer", "DeerBait,240;Mushroom,180" }, { "Neck", "FishRaw,90;Fish,120" }, { "Boar", "Truffle,90;DeerBait,120" }, { "Ygnie", "Acorn,20" }, { "Wolf", "WolfBait,180;BoneFragments,30" }, { "Fenring", "DeadRat,9" }, { "Fenringlin", "DeadRat,9" }, { "Bjorn", "BearBait,10;Honey,5" } }; private static Dictionary m_locatedConsumables = new Dictionary(); private const float c_animalMaxDigest = 3f; private const float c_animalFoodTimeLow = 10f; private const float c_animalFoodTimeMod = 20f; private const float c_animalFoodTimeSnack = 50f; private const float c_animalBondedTime = 1024f; private const float c_goblinBribePickupTime = 10f; private const float c_goblinBribePickupRange = 10f; private static Dictionary m_characterFoodTime = new Dictionary(); private static Dictionary m_animalCalmed = new Dictionary(); private static Dictionary m_characterDazed = new Dictionary(); private static Dictionary m_characterStunned = new Dictionary(); private static Dictionary m_characterBribeAttempt = new Dictionary(); private static Dictionary m_characterBribeItem = new Dictionary(); public static void SetupAlignments() { RegisterClanMember("Boar_piggy", "Animal"); RegisterClanMember("Lox_Calf", "Animal"); RegisterClanMember("Wolf_cub", "Animal"); RegisterClanMember("RabbitTan", "Animal", barter: false, 0.1f); RegisterClanMember("RabbitGrey", "Animal", barter: false, 0.1f); RegisterClanMember("RabbitWhite", "Animal", barter: false, 0.1f); RegisterClanMember("Deer", "Animal", barter: false, 0.1f, 1.008f); RegisterClanMember("Rat", "Animal", barter: false, 0.1f); RegisterClanMember("Neck", "Animal", barter: false, 0.15f); RegisterClanMember("Boar", "Animal"); RegisterClanMember("Wolf", "Animal"); RegisterClanMember("Lox", "Animal"); RegisterClanMember("Bjorn", "Animal"); RegisterClanMember("Troll", "Troll"); RegisterClanMember("TrollForest", "Troll"); RegisterClanMember("Greyling", "Greydwarf", barter: true, 0.3f); RegisterClanMember("Greydwarf", "Greydwarf", barter: true, 0.22f); RegisterClanMember("Greydwarf_Elite", "Greydwarf", barter: true, 0.18f); RegisterClanMember("Greydwarf_Shaman", "Greydwarf", barter: true, 0.18f); RegisterClanMember("Greydwarf_Commander", "Greydwarf"); RegisterClanMember("Greydwarf_Warlock", "Greydwarf"); RegisterClanMember("TentaRoot", "Greydwarf"); RegisterClanMember("DefiledRoot", "Greydwarf"); RegisterClanMember("Goblin", "Goblin"); RegisterClanMember("GoblinArcher", "Goblin"); RegisterClanMember("GoblinBrute", "Goblin"); RegisterClanMember("GoblinShaman", "Goblin"); RegisterClanMember("Yigath", "Goblin"); RegisterClanMember("Ngalygoth", "Goblin"); RegisterClanMember("Uthorax", "Goblin"); } public static void Update(float dt) { UpdateDigestion(dt); UpdateBlinded(dt); UpdateStunned(dt); UpdateCalmed(dt); UpdateBribeAttempt(dt); if (m_greydwarfReputaion > 999999f) { m_greydwarfReputaion = Wildling.GetPlayerData("GDReputation"); } m_greydwarfReputaion -= dt * 0.1f * (float)Math.Sign(m_greydwarfReputaion); if (Math.Abs(m_greydwarfReputaion) < dt) { m_greydwarfReputaion = 0f; } Wildling.SetPlayerData("GDReputation", m_greydwarfReputaion); } public static bool ModifyAttack(Attack attack, Character attacker, string weaponName) { //IL_012e: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.ActorName(attacker); ElderWand.PowerAttacker(attacker, attack); switch (text) { case "Eikthyr": if (m_friendlyEikthyr) { attack.m_attackAnimation = "Eikthyr_antler"; } return false; case "gd_king": if (m_friendlyElder) { attack.m_attackAnimation = "gd_king_scream"; } return false; case "Ygnie": if (IsBribed(attacker, orDazed: true)) { attack.m_projectileBursts = 1; } else if (WUTIL.TestLuck()) { attack.m_projectileBursts = 3; } return false; case "Neck": if (Riding.IsRiding(attacker)) { Riding.ResetNeckXp(attacker, 2); } break; case "Borat": if (WasRecentlySeen(text)) { Quest.CheckObjective(38); if (attack.m_attackAnimation == "attack_taunt") { ForestDungeon.RaiseDraugrRats(((Component)attacker).transform.position); } } break; case "Greydwarf_Warlock": if (attack.m_attackAnimation == "punch") { Transform attach = attacker.GetVisual().transform.Find("Armature/root/spine1/spine2/spine3/l_shoulder/l_arm1/l_arm2/l_hand/l_middle1/l_middle2/l_middle3"); WUTIL.CreateAttachedEffect("Greydwarf_Warlock_rootball_fx", attach, -0.5f); } break; default: switch (weaponName) { case "Sparx": attack.m_attackAnimation = ((WUTIL.RandomSpin() < 0.5f) ? "attack_cast" : "attack_poke"); break; case "Thorscorn": attack.m_attackAnimation = "spear_throw"; break; case "Bowdacious": attack.m_attackAnimation = "swing_longsword"; break; } break; } if ((Object)(object)attacker.GetBaseAI().GetTargetCreature() == (Object)(object)Player.m_localPlayer && Fairy.YgnieBlind(attacker)) { attack.Abort(); return true; } return false; } public static bool IsEnemy(Character source, Character target, bool isNaturalEnemy) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0052: Invalid comparison between Unknown and I4 //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Invalid comparison between Unknown and I4 //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Invalid comparison between Unknown and I4 //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0780: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07b9: Invalid comparison between Unknown and I4 //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Invalid comparison between Unknown and I4 //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_0878: Invalid comparison between Unknown and I4 //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_0b72: Unknown result type (might be due to invalid IL or missing references) //IL_0b7f: Unknown result type (might be due to invalid IL or missing references) //IL_0b89: Unknown result type (might be due to invalid IL or missing references) //IL_0b8e: Unknown result type (might be due to invalid IL or missing references) //IL_0b93: Unknown result type (might be due to invalid IL or missing references) //IL_0b98: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba2: Unknown result type (might be due to invalid IL or missing references) //IL_0ba6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)source == (Object)(object)target || source.IsPlayer()) { return isNaturalEnemy; } if (m_ignoreIsEnemyCheck) { m_ignoreIsEnemyCheck = false; return isNaturalEnemy; } Faction faction = source.GetFaction(); if ((int)faction == 6) { return isNaturalEnemy; } if (Quest.GetAchievement("MainTutorial") < 3) { return isNaturalEnemy; } float num = Vector3.Distance(((Component)source).transform.position, ((Component)target).transform.position); string text = WUTIL.ActorName(source); string text2 = WUTIL.ActorName(target); Player val = (Player)(object)((target is Player) ? target : null); bool flag = Wildling.IsWildlingPlayer(val); if (m_debugIsEnemy) { WDBUG.Log("IsEnemy source: " + text + " target: " + text2); } if (ElderWand.Turned(source)) { return false; } if (text == "Ygnie") { return !flag && Fairy.YgnieSeesEnemy(target); } if (text == "DefiledRoot") { if (num > 6f && AlertedToPlayer(source)) { StopHunt(source); } return !flag; } if (num > 50f) { SenseCreature(source, AlertDistanceFactor(((Component)source).transform.position)); return !ElderWand.AffectCharacter(source) && isNaturalEnemy; } if (m_characterDazed.ContainsKey(source)) { return !flag && !(m_characterDazed[source] > 5f) && (source.GetBaseAI().IsAlerted() ? (-0.2f) : 0.1f) + WUTIL.RandomSpin() < AlertDistanceFactor(((Component)source).transform.position); } if (text == "Fenringlin") { return WUTIL.RandomSpin() > ((text2 == "Fenring") ? 0.5f : 0.2f) || isNaturalEnemy; } string clan = GetClan(source); if ((int)faction == 7 && clan != "Goblin" && ElderWand.IsActive()) { return !target.IsPlayer() && !ElderWand.ObeysElderWand(target) && isNaturalEnemy; } if (IsMarlonCat(text)) { bool flag2 = text2.StartsWith("Rat") || text2.StartsWith("Rabbit"); BaseAI baseAI = source.GetBaseAI(); MonsterAI val2 = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); string text3 = WUTIL.ActorName(((BaseAI)val2).GetTargetCreature()); if (text3.StartsWith("Rat") || text3.StartsWith("Rabbit")) { return flag2; } if (flag2 && !((BaseAI)val2).IsAlerted()) { float num2 = Vector3.Distance(((Component)source).transform.position, ((Component)target).transform.position); if (num2 < 12f) { SetAttackTarget(source, target); text3 = WUTIL.ActorName(((BaseAI)val2).GetTargetCreature()); WDBUG.Log($"Flicked Cat is now alerted: {((BaseAI)val2).IsAlerted()} to {text3}", WDBUG.Level.ModSupport); if (source.m_speed < 4f) { source.m_speed = 4f; source.m_runSpeed = 8f; source.m_turnSpeed = 360f; source.m_acceleration = 0.6f; val2.m_alertRange = 40f; return true; } } } if (source.m_runSpeed > 4f) { WDBUG.Log("Reverted to standard hunting " + text3, WDBUG.Level.ModSupport); source.m_speed = 1.5f; source.m_runSpeed = 4f; source.m_turnSpeed = 120f; source.m_acceleration = 0.3f; val2.m_alertRange = 20f; } if (GetClan(target) != "Greydwarf") { return isNaturalEnemy; } } if (!target.IsPlayer()) { if (text2 == "Ygnie" || text2 == "Pixie") { return text == "Doxie" || text == "Wraith" || text == "Ghost"; } if (ElderWand.IgnoreEnemy(source)) { return false; } if (Riding.IsRiding(target) || IsBonded(target)) { if (Quest.Protected()) { return false; } if (clan == GetClan(target)) { return Vector3.Distance(((Component)source).transform.position, ((Component)target).transform.position) < WUTIL.RandomSpin(0.5f, 2f) && !WUTIL.TestLuck(0.88f); } } if (Wildling.IsWildling && (target.IsTamed() || source.IsTamed())) { if (GetClan(target) == "Greydwarf") { if (IsFollowing(source) || !AlertedToPlayer(target)) { StopHunt(source, tame: true); return false; } } else if (clan == "Greydwarf" && Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)target).transform.position) < 10f) { return false; } } return isNaturalEnemy; } if ((Object)(object)target != (Object)(object)Player.m_localPlayer) { if (flag && ((int)faction == 2 || (m_friendlyEikthyr && text == "Eikthyr") || (m_friendlyElder && text == "gd_king"))) { return false; } return isNaturalEnemy; } if (text.StartsWith("Rat") && Wildling.RatImmunity()) { return false; } if (text == "Deathsquito" && Fairy.PinePasteActive()) { if (Vector3.Distance(((Component)source).transform.position, ((Component)target).transform.position) < WUTIL.RandomSpin(2.5f, 3.5f)) { DazeCharacter(source, 5f + WUTIL.RandomSpin(4f, 8f)); } return false; } if (Riding.IsRiding(source)) { return false; } if (!isNaturalEnemy && IsBeastFamilar(source)) { SenseCreature(source, AlertDistanceFactor(((Component)source).transform.position)); } bool flag3 = !WDBUG.AlignAll; if (WUTIL.Timer("SE_DoxieDust") > 0f) { if (flag3 && (int)faction != 3 && (int)faction != 4) { return true; } StopHunt(source); return false; } if (!isNaturalEnemy) { return false; } if (!flag) { return (text == "Pixie") ? m_pixieAttackAdult : (!ElderWand.AffectCharacter(source, AlertDistanceFactor(((Component)source).transform.position))); } float num3 = AlertMovementFactor(); bool flag4 = ((Character)val).IsCrouching() && num3 <= 0.51f; if (!flag4 && !Pocket.IsOpen()) { m_wildlingHidden = true; } if ((int)faction == 8) { if ((m_friendlyEikthyr && text == "Eikthyr") || (m_friendlyElder && text == "gd_king")) { StopHunt(source, tame: true); source.GetBaseAI().Alert(); StunCharacter(source, 5f); return false; } return isNaturalEnemy; } float num4 = AlertDistanceFactor(((Component)source).transform.position); SenseCreature(source, num4); if (IsBeastFriendly(source, OrTameable: false)) { return false; } if (source.m_group == "boar") { MapMarker.CheckTruffleSpawner(((Component)source).transform.position, num4); } ElderWand.TrackEnemy(source, num4); if (ElderWand.AffectCharacter(source, num4)) { return false; } if (m_friendlyElder && clan == "Greydwarf") { if (Quest.IsGuide(source)) { WUTIL.Message(source.GetHoverName() + " expects you to follow", center: true, MapMarker.GetCharacterIcon(source), blockNext: false, logOpt: true); } else if (Quest.GetAchievement("QuestElder") > 7) { StunCharacter(source); } return false; } isNaturalEnemy = isNaturalEnemy && flag3; if (ElderWand.ObeysElderLight(source)) { isNaturalEnemy = false; } float currentTrust = GetCurrentTrust(source); if (num4 > DiscoverRadius(source)) { m_wildlingHidden = false; return isNaturalEnemy; } if (flag4) { if (CheckHiddenChased(source, num4)) { isNaturalEnemy = false; } } else { m_wildlingHidden = false; } if (currentTrust < 0.01f || AlertedToPlayer(source, anyTarget: true)) { return isNaturalEnemy; } if (isNaturalEnemy) { float num5 = 0.5f * WUTIL.RandomSpin() + currentTrust; isNaturalEnemy = num5 < num4 * num3; } if (!isNaturalEnemy && CanBarter(source, num4)) { if (InPositionToBarter(source)) { bool flag5 = (Object)(object)source == (Object)(object)val.GetHoverCreature(); WDBUG.Log(text + " in position to barter! In sight: " + flag5, WDBUG.Level.Barter); bool flag6 = text == "Greyling"; if (AssignAllGrabables(source)) { WUTIL.TimerReset("barterListResetCooldown", 10f); } if (flag5) { if (m_treecareReward > 0 && !flag6) { string exchangeItem = GetExchangeItem(source, "treecare", 3); float num6 = 1f + 0.5f * (float)GetClanRank(source); Vector3 position = ((Component)source).transform.position + num6 * (((Component)source).transform.forward * 1.5f + Vector3.up); ItemData val3 = WUTIL.DropItemOutside(exchangeItem, position, "sfx_greydwarf_elite_alerted", m_treecareReward); if (val3 != null) { string msg = source.GetHoverName() + " rewarded you with " + WUTIL.ItemName(val3, goName: false); WUTIL.Message(msg, center: true, MapMarker.GetCharacterIcon(source)); WUTIL.CustomLog(msg, "#8C4"); Quest.AdvanceAchievement("Treecare", m_treecareReward); } m_treecareReward = 0; } else if (WUTIL.Timer("gd_message_cooldown") == 0f) { WUTIL.TimerReset("gd_message_cooldown", 6f); Sprite characterIcon = MapMarker.GetCharacterIcon(source); if (!WUTIL.FlushDelayedMessage(Object.op_Implicit((Object)(object)characterIcon))) { WUTIL.Message(source.GetHoverName() + (flag6 ? " wants to play." : " is willing to barter."), center: true, characterIcon); } } } } } else if (GetClan(source) == "Greydwarf") { if (WUTIL.Timer("barterListResetCooldown") == 0f) { ForgetAllGrabables(source); WUTIL.FlushDelayedMessage(); } if (m_greydwarfReputaion < -50f) { isNaturalEnemy = true; } } if (isNaturalEnemy) { AlertClan(source); } return isNaturalEnemy; } public static bool IsBaby(string name) { return name.EndsWith("_piggy") || name.EndsWith("_cub") || name.EndsWith("_Calf"); } public static bool CheckRecentExchangeDrops(string name, int modify = 0) { bool flag = m_gdRecentDrops.Contains(name); if (flag) { if (WUTIL.Timer("reset_exchanged_delay") == 0f) { m_gdRecentDrops.Clear(); return false; } if (modify == -1) { m_gdRecentDrops.Remove(name); } } else { if (modify == 1) { m_gdRecentDrops.Add(name); } WUTIL.TimerReset("reset_exchanged_delay", 120f); } return flag; } public static void MoveToTarget(Character character, Vector3 point, bool run) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_0037: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) List list = new List(); if (Pathfinding.instance.GetPath(((Component)character).transform.position, point, list, (AgentType)1, false, true, true)) { while (list.Count > 0) { if (Utils.DistanceXZ(list[0], ((Component)character).transform.position) > 1f) { character.GetBaseAI().MoveTowards(list[0] - ((Component)character).transform.position, run); break; } list.RemoveAt(0); } } else { character.GetBaseAI().MoveTowards(point - ((Component)character).transform.position, run); } } public static bool AlertedToPlayer(Character character, bool anyTarget = false) { BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if ((Object)(object)val == (Object)null) { return false; } if (!((BaseAI)val).IsAlerted()) { return false; } return anyTarget || (Object)(object)((BaseAI)val).GetTargetCreature() == (Object)(object)Player.m_localPlayer; } public static bool Unalert(Character character, bool unalert = true, float calmTime = 0f) { bool result = character.GetBaseAI().IsAlerted(); if (calmTime > 0f) { CalmAnimal(character, calmTime, calmTime * 2f); } if (unalert) { m_signalUnalert = character.GetBaseAI(); } return result; } public static bool StopHunt(Character character, bool tame = false, bool toggleFollow = false) { BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if ((Object)(object)val == (Object)null) { if (tame) { character.SetTamed(tame); } if (toggleFollow && IsBonded(character)) { if ((Object)(object)m_followingBonded != (Object)(object)character) { m_followingBonded = character; return true; } m_followingBonded = null; character.GetBaseAI().SetPatrolPoint(); return false; } return Unalert(character); } bool flag = ((BaseAI)val).IsAlerted() && (Object)(object)((BaseAI)val).GetTargetCreature() == (Object)(object)Player.m_localPlayer; bool tamed = character.IsTamed(); if (flag || tame) { val.MakeTame(); } if (!tame) { character.SetTamed(tamed); if (toggleFollow) { val.SetFollowTarget((GameObject)null); } } else if (toggleFollow) { if ((Object)(object)val.GetFollowTarget() == (Object)null) { ((BaseAI)val).ResetPatrolPoint(); val.SetFollowTarget(((Component)Player.m_localPlayer).gameObject); return true; } val.SetFollowTarget((GameObject)null); ((BaseAI)val).SetPatrolPoint(); return false; } return flag; } public static void HuntTargetAndAlert(Character character, Character target, bool alert = true) { if (!Object.op_Implicit((Object)(object)character)) { return; } BaseAI baseAI = character.GetBaseAI(); AnimalAI val = (AnimalAI)(object)((baseAI is AnimalAI) ? baseAI : null); if ((Object)(object)val != (Object)null) { if (m_animalCalmed.ContainsKey(character)) { m_animalCalmed.Remove(character); } character.SetTamed(false); ((BaseAI)val).Alert(); return; } BaseAI baseAI2 = character.GetBaseAI(); MonsterAI val2 = (MonsterAI)(object)((baseAI2 is MonsterAI) ? baseAI2 : null); ((BaseAI)val2).ResetPatrolPoint(); if ((Object)(object)target == (Object)null) { val2.SetFollowTarget((GameObject)null); } else { val2.SetFollowTarget(((Component)target).gameObject); } if (alert) { ((BaseAI)val2).Alert(); } } public static void FlickTarget(Character character, float damage = 0.5f) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (character.GetHealthPercentage() > 0.99f) { character.Damage(new HitData { m_damage = { m_damage = damage } }); } } public static void SetAttackTarget(Character character, Character attacker) { //IL_0021: 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_0037: Expected O, but got Unknown if ((Object)(object)attacker == (Object)null) { StopHunt(character); return; } float health = character.GetHealth(); HitData val = new HitData { m_damage = { m_damage = 0.2f } }; val.SetAttacker(attacker); character.ApplyDamage(val, false, false, (DamageModifier)0); character.SetHealth(health); } public static void GuardObject(Character character, GameObject target) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) BaseAI obj = ((character != null) ? character.GetBaseAI() : null); MonsterAI val = (MonsterAI)(object)((obj is MonsterAI) ? obj : null); if (!((Object)(object)target == (Object)null) && !((Object)(object)val == (Object)null)) { val.MakeTame(); character.SetTamed(false); val.SetFollowTarget(target); WDBUG.Log($"Guarding {WUTIL.GameName(target)} at pos: {target.transform.position}"); } } public static void BribeCharacter(Character character, float duration, bool hire = false) { if (duration <= 0f) { DazeCharacter(character, duration); return; } DazeCharacter(character, duration + 100f); StopHunt(character, hire, hire); } public static void ConfuseCharacter(Character character, float duration = 10f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected I4, but got Unknown Faction faction = character.GetFaction(); Faction val = faction; switch ((int)val) { case 0: case 1: case 3: case 8: return; case 4: if (!WUTIL.TestLuck()) { return; } break; } WDBUG.Log($"Confuse {character.GetHoverName()} for {duration}s", WDBUG.Level.Chimes); StunCharacter(character); float num = character.GetRadius(); if (GetClan(character) == "Goblin" && !m_characterDazed.ContainsKey(character)) { Unalert(character); BribeCharacter(character, duration * 3f); num *= 0.25f; } else { DazeCharacter(character, duration); if (IsCalmed(character)) { CalmAnimal(character, 0f); character.GetBaseAI().Alert(); } else { Unalert(character, unalert: true, 3f); } } WUTIL.CreateHeadEffect("chimes_confuse_fx", character, attach: true, num); } public static bool DazeCharacter(Character character, float duration) { if (m_characterDazed.ContainsKey(character)) { m_characterDazed[character] = duration; } else if (duration > 0f) { m_characterDazed.Add(character, duration); return true; } return false; } public static void StunCharacter(Character character, float minDuration = 1f, float maxDuration = 3f) { if (maxDuration <= minDuration) { m_characterStunned[character] = minDuration; } else { m_characterStunned[character] = WUTIL.RandomSpin(minDuration, maxDuration, 0.1f); } character.GetBaseAI().StopMoving(); } public static void CalmAnimal(Character character, float minDuration = 1f, float maxDuration = 1f) { if (minDuration <= 0f) { m_animalCalmed.Remove(character); } else if (maxDuration <= minDuration) { m_animalCalmed[character] = minDuration; } else { m_animalCalmed[character] = WUTIL.RandomSpin(minDuration, maxDuration, 0.1f); } } public static bool IsCalmed(Character character) { return !((Object)(object)character == (Object)null) && m_animalCalmed.ContainsKey(character); } public static bool IsParalyzed(Character character) { return (Object)(object)character != (Object)null && m_characterStunned.ContainsKey(character); } public static bool IsBribed(Character character, bool orDazed = false) { if ((Object)(object)character == (Object)null || !m_characterDazed.ContainsKey(character)) { return false; } return orDazed || m_characterDazed[character] > 100f; } public static void IgnoreNextIsEnemyCheck() { m_ignoreIsEnemyCheck = true; } public static void SetHidden(bool hidden = true) { m_wildlingHidden = hidden & Wildling.IsWildling; } public static void PlayerDroppedItem(ItemData item, int amount = 1) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) m_justDropped = true; m_lastDroppedItem = WUTIL.ItemName(item); CheckRecentExchangeDrops(m_lastDroppedItem, -1); Transform transform = ((Component)Player.m_localPlayer).transform; Vector3 position = transform.position + 4f * transform.forward; float itemCoinValue = Pocket.GetItemCoinValue(item, amount); Character val; if (itemCoinValue >= 1f) { val = World.ClosestCharacter(position, "Goblin"); if ((Object)(object)val != (Object)null) { if (StopHunt(val)) { val.GetBaseAI().StopMoving(); } AttemptBribe(val, item); return; } } val = World.ClosestCharacter(position, "Greydwarf", 3f); if ((Object)(object)val == (Object)null) { val = World.ClosestCharacter(position, "Greyling", 3f); } if ((Object)(object)val != (Object)null && !GetTakeableItems(val).Contains(m_lastDroppedItem)) { string msg = val.GetHoverName() + " did not seem interested in " + WUTIL.ItemName(item, goName: false); WUTIL.DelayedMessage(msg, 5f, MapMarker.GetCharacterIcon(val)); WUTIL.CustomLog(msg, "#AA6"); WUTIL.TimerReset("gd_message_cooldown", 3f); Quest.HelpWithBarter(GetClanRank(val)); } if (m_lastDroppedItem == "RabbitBait") { float num = (PlayerIsHiding() ? 25 : 30) + ((!WUTIL.TestLuck()) ? 10 : 0); WDBUG.Log($"Dropped rabbit bait, spawn attempt at dist: {num}", WDBUG.Level.Taming); World.SpawnLocalRabbit(num, num + 10f, 3f); } } public static bool PlayerIsHiding() { if (((Character)Player.m_localPlayer).IsCrouching()) { if (Equipment.HideClothingBuff >= 0.04f) { return true; } } else { m_wildlingHidden = false; } return m_wildlingHidden; } public static bool PlayerHiddenFromTarget(Character target = null) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return PlayerIsHiding(); } if (!PlayerIsHiding()) { return false; } return HiddenAtDistance(AlertDistanceFactor(((Component)target).transform.position)); } public static float CharacterScentPower(Character character) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected I4, but got Unknown float num = 1f; Faction faction = character.GetFaction(); Faction val = faction; switch ((int)val) { case 3: num = 2f; break; case 4: case 5: case 6: num = 4f; break; case 7: num = 8f; break; case 0: case 11: num = (character.IsTamed() ? 2 : 0); break; } Humanoid component = ((Component)character).GetComponent(); return num + (((Object)(object)component == (Object)null) ? 0f : (0.01f * ((Character)component).GetMaxHealth())); } public static void UpdateLuckyCharms() { m_holdingRabbitFootLuck = ((WUTIL.GetInventoryItemData("RabbitFoot") == null) ? 0f : 0.1f); m_holdingRatTail = WUTIL.GetInventoryItemData("RatTail") != null; m_holdingDraugrRatTail = WUTIL.GetInventoryItemData("RatTailDraugr") != null; } public static float AlertDistanceFactor(Vector3 targetPos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0032: 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) Vector3 val = targetPos - ((Component)Player.m_localPlayer).transform.position; float num = val.x * val.x + val.y * val.y + val.z * val.z; return Mathf.Exp((0f - num) / 400f); } public static bool WasRecentlySeen(string target, bool reset = false) { if (target == "") { return WUTIL.Timer("eyeContactCooldown") > 0f; } if (target == "Truffle") { target = "Boar"; } if (reset) { m_lastCreatureSeen = target; WUTIL.TimerReset("eyeContactCooldown", 10f); return true; } return WUTIL.Timer("eyeContactCooldown") > 0f && target == m_lastCreatureSeen; } public static bool UpdateHoverReport() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) if (!Wildling.IsWildling || TextViewer.instance.IsVisible()) { return false; } Player localPlayer = Player.m_localPlayer; Character hoverCreature = localPlayer.GetHoverCreature(); if ((Object)(object)hoverCreature == (Object)null || Pocket.LostContact(hoverCreature)) { return false; } string hoverName = hoverCreature.GetHoverName(); WasRecentlySeen(hoverName, reset: true); string text = ""; string clan = GetClan(hoverCreature); string text2 = ((WUTIL.GameName(((Component)hoverCreature).gameObject) == hoverName) ? ("the " + hoverName) : hoverName); if (clan == "Goblin") { text = Pocket.PickReady(hoverCreature); if (text == "yes") { text = WUTIL.KeyHighlightText("Use") + " to pickpocket " + hoverName; } } else if (clan == "Animal") { if (Vector3.Distance(((Component)localPlayer).transform.position, ((Component)hoverCreature).transform.position) > 2f) { return false; } bool flag = (Object)(object)((Component)hoverCreature).GetComponent() != (Object)null; bool flag2 = hoverCreature.IsTamed(); if (Quest.Compelled(hoverCreature)) { flag2 = true; text = hoverName + " wants to take you somewhere."; } else if (flag) { text = hoverCreature.GetHoverText(); } else if (flag2) { string tamedStatus = GetTamedStatus(hoverCreature); if (tamedStatus == "") { return false; } text = hoverName + " (" + tamedStatus + ")"; if (tamedStatus.StartsWith("Frightened")) { text = text + "\n" + WUTIL.KeyHighlightText("Use") + " to calm " + text2 + "."; } } if (flag2) { if (Riding.IsRiding(hoverCreature)) { if (!flag) { text = text + "\n" + WUTIL.KeyHighlightText("Use") + " to calm " + text2; } text = text + "\n(" + WUTIL.KeyHighlightText("Use") + " otherwise to dismount " + text2 + ")"; } else if (Riding.IsRidable(hoverCreature)) { string alt = Localization.instance.Localize(WUTIL.KeyHighlightText("Block", "", braces: false)); text = text + "\n" + WUTIL.KeyHighlightText("Use", alt) + " to ride " + text2 + "."; } } } if (text == "") { return false; } ((TMP_Text)Hud.instance.m_hoverName).text = text; ((Graphic)Hud.instance.m_crosshair).color = Color.yellow; return true; } public static bool Interact(GameObject go) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) if (!Wildling.IsWildling) { return false; } Character component = go.GetComponent(); if ((Object)(object)component == (Object)null) { if (World.PlayerInInterior()) { return false; } if ((Object)(object)go.transform.parent != (Object)null) { go = ((Component)go.transform.parent).gameObject; } if (WUTIL.GameName(((Object)go).name) == "Beehive") { if (Vector3.Distance(go.transform.position, ((Component)Player.m_localPlayer).transform.position) >= 2.5f) { WUTIL.Message("Move closer to check for honey."); } else { if (WUTIL.Timer("beehive_interact_cooldown") > 0f) { return true; } WUTIL.TimerReset("beehive_interact_cooldown", 2f); if (WUTIL.Timer("beehive_check_cooldown") == 0f) { WUTIL.TimerReset("beehive_check_cooldown", 300f); if (WUTIL.TestLuck(0.7f)) { WUTIL.Message("You found honey!"); Place.Object("Honey", go.transform.position); Quest.AdvanceAchievement("HoneyTaken"); return true; } } WUTIL.Message("You did not find honey."); } return true; } return false; } string clan = GetClan(component); if (clan == "Goblin") { return Pocket.Open(component); } if (Riding.IsRiding(component)) { if ((Object)(object)Player.m_localPlayer.GetHoverCreature() != (Object)(object)component) { Riding.Dismount(signal: true); return true; } } else if (Riding.IsRidable(component)) { if (WUTIL.GetButton("Block")) { return Riding.Mount(component); } if ((Object)(object)((Component)component).GetComponent() == (Object)null && Input.GetKey((KeyCode)304)) { if (IsBonded(component)) { WDBUG.Log("Full bonded Rename not implemented"); RenameCharacter(component); } return false; } } float num = 0.6f * Wildling.SkillFactor((SkillType)0) + 0.2f; string text = WUTIL.ActorName(component); if (clan == "Animal" || clan == "Greydwarf") { bool flag = component.IsTamed(); float num2 = (float)(3 + component.GetLevel()) * ((clan == "Animal") ? 0.5f : 1.5f) * (float)(1 + GetClanRank(component)); bool flag2 = WUTIL.TestLuck(num * Math.Min(6f / num2, 1f)); if (flag || flag2) { int num3 = WUTIL.DieRoll(); float num4 = 0.2f + 0.1f * (float)num3; if (Unalert(component)) { WUTIL.CreateAttachedEffect("fx_boar_pet", ((Component)component).transform, 0f, 0f, num4); } else if (text == "Neck") { if (component.IsSwimming() && GetTamedStatus(component, asSpeed: true) == "stop" && num3 >= 3 && (flag || Flight.GetHeightAboveSolid(((Component)component).transform.position) > 5f)) { SetAnimalFoodTime(component, WUTIL.TestLuck(0.1f) ? (80 + num3) : (3 * num3 - 6)); } WUTIL.CreateAttachedEffect("fx_boar_pet", ((Component)component).transform, 0f, 0f, num4); } else { string hoverName = component.GetHoverName(); if (flag && IsTamedCommandable(component)) { WUTIL.TimerReset("petting_cooldown", 1f); Sprite characterIcon = MapMarker.GetCharacterIcon(component); if (ToggleFollowing(component)) { WUTIL.Message(hoverName + " will follow you", center: false, characterIcon); } else { WUTIL.Message(hoverName + " will stay here", center: false, characterIcon); } WUTIL.CreateAttachedEffect("fx_boar_pet", ((Component)component).transform, 0f, 0f, num4); if (flag2 && text == "Wolf") { Wildling.AddPetsTouch(hoverName, "TrophyWolf"); } return false; } if (flag2 && IsBaby(text)) { int startIndex = text.IndexOf('_'); if (Wildling.AddPetsTouch(hoverName, "Trophy" + text.Remove(startIndex))) { WUTIL.CreateAttachedEffect("fx_boar_pet", ((Component)component).transform, 0f, 0f, num4); } } else { StopHunt(component); WUTIL.CreateAttachedEffect("fx_wolf_pet", ((Component)component).transform, 0f, 0f, 2f * num4); } } } return (Object)(object)go.GetComponent() == (Object)null; } if (text == "Ygnie") { Fairy.YgnieInteract(); } else if (IsMarlonCat(text)) { if (WUTIL.TestLuck(num)) { Wildling.AddPetsTouch(component.GetHoverName()); } StopHunt(component); } return false; } public static void SetAnimalFoodTime(Character character, float foodTime) { m_characterFoodTime[character] = (IsBonded(character) ? (1024f + foodTime) : foodTime); } public static bool SetBonded(Character character, bool bond = true) { if (Quest.Protected()) { return false; } float num = (m_characterFoodTime.ContainsKey(character) ? m_characterFoodTime[character] : 0f); if (num >= 1024f) { if (!bond) { m_characterFoodTime[character] -= 1024f; } } else if (bond) { m_characterFoodTime[character] = num + 1024f; WUTIL.Message(character.GetHoverName() + " has bonded with you."); return true; } return false; } public static bool IsBonded(Character character) { return (Object)(object)character != (Object)null && m_characterFoodTime.ContainsKey(character) && m_characterFoodTime[character] >= 1024f; } public static float GetAnimalFedTime(Character character, bool unbound = true) { if ((Object)(object)character != (Object)null && m_characterFoodTime.ContainsKey(character)) { float num = m_characterFoodTime[character]; return (unbound && num >= 1024f) ? (num - 1024f) : num; } return 0f; } public static bool IsBeastFriendly(Character character, bool OrTameable = true) { return (OrTameable && Object.op_Implicit((Object)(object)((Component)character).GetComponent())) || WUTIL.ActorName(character) == "Ygnie" || IsBonded(character) || Quest.Compelled(character) || GetAnimalFedTime(character) > 0f; } public static bool IsBeastFamilar(Character character) { return character.IsTamed() || GetAnimalFedTime(character) > 0f; } public static bool IsTamedCommandable(Character character) { string text = WUTIL.ActorName(character); if (text == "Deer" && !IsBonded(character)) { return false; } if (text == "Neck" || Riding.IsRiding(character) || IsBaby(text)) { return false; } return WUTIL.Timer("petting_cooldown") == 0f; } public static string GetTamedStatus(Character character, bool asSpeed = false, bool showFoodTime = false) { if ((Object)(object)character == (Object)null) { WDBUG.Log("GetTamedStatuse passed character = null"); return ""; } if (Quest.Protected()) { return "Compelled"; } float animalFedTime = GetAnimalFedTime(character); if (character.GetHoverName() == "Ygnie") { return (!(animalFedTime > 0f)) ? (asSpeed ? "march" : "") : (asSpeed ? "dart" : "Energized"); } Tameable component = ((Component)character).GetComponent(); string text = ""; string text2 = "Hungry"; bool flag = character.IsRunning(); if (IsBonded(character)) { if (asSpeed && animalFedTime <= 0f) { return "march"; } text = "Bonded, "; } else if (animalFedTime <= 0f) { if ((Object)(object)component != (Object)null && !component.IsHungry()) { if (asSpeed) { return flag ? "run" : "walk"; } text2 = "Happy"; } else { if (asSpeed) { return ((Object)(object)component == (Object)null) ? "stop" : "march"; } text = "Unhappy, "; } } if (animalFedTime > 10f) { string consumeTarget = GetConsumeTarget(character, 0, foodTime: true); if (!float.TryParse(consumeTarget, out var result)) { WDBUG.Log("Could not get foodTime '" + consumeTarget + "' for " + WUTIL.ActorName(character), WDBUG.Level.warn, 2f); result = 60f; } if (asSpeed) { return (!flag) ? "walk" : ((animalFedTime < 0.9f * result) ? "run" : "sprint"); } text2 = ((animalFedTime <= result) ? "Happy" : "Enamored"); } return text + text2 + (showFoodTime ? (" " + (int)animalFedTime) : ""); } public static bool IsHungry(Character character, bool orPeckish = false) { if ((Object)(object)((Component)character).GetComponent() != (Object)null && !((Component)character).GetComponent().IsHungry()) { return orPeckish; } return GetAnimalFedTime(character) <= (orPeckish ? 50f : 20f); } public static void RenameCharacter(Character character, string name = "") { ZNetView component = ((Component)character).GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log("RenameTamedCharacter did not get ZNetView"); } else if (component.IsValid() && component.IsOwner()) { if (!(name == "?") && name == "") { name = Game.instance.GetPlayerProfile().GetName() + "'s " + Localization.instance.Localize(character.m_name); } WDBUG.Log("Naming " + character.GetHoverName() + " to " + name, WDBUG.Level.Taming); if (Object.op_Implicit((Object)(object)((Component)character).GetComponent())) { component.GetZDO().Set("TamedName", name); } else { ((Object)character).name = name; } } } public static void ResetFollowing(Character character, bool stay = true) { if ((Object)(object)character == (Object)null) { m_followingBonded = null; return; } if (IsBonded(character)) { if (stay) { m_followingBonded = null; character.GetBaseAI().SetPatrolPoint(); } else { m_followingBonded = character; } return; } BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if ((Object)(object)val != (Object)null) { val.MakeTame(); if (stay) { ((BaseAI)val).SetPatrolPoint(); val.SetFollowTarget((GameObject)null); } else { ((BaseAI)val).ResetPatrolPoint(); val.SetFollowTarget(((Component)Player.m_localPlayer).gameObject); } } } public static bool ToggleFollowing(Character character) { return StopHunt(character, tame: true, toggleFollow: true); } public static bool IsFollowing(Character character, GameObject target = null) { BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); return (Object)(object)val != (Object)null && (Object)(object)val.GetFollowTarget() != (Object)(object)target; } public static string GetClan(Character character) { ClanMemberData clanMemberData = GetClanMemberData(character); return (clanMemberData == null) ? "" : clanMemberData.m_clan; } public static int GetClanRank(Character character) { return GetClanMemberData(character)?.m_rank ?? 0; } public static void AlertClan(Character character, float cooldown = 5f) { if (character.GetBaseAI().IsAlerted()) { string clan = GetClan(character); if (clan != "") { WUTIL.TimerReset(clan, cooldown); } } } public static int NumTraderItems() { return m_gdExchangeItems.Length - 1; } public static int NumHunterTrophies() { return m_gdTrophyItems.Length; } public static void SummerizeBarterLog(bool replace = false) { if (replace) { WUTIL.CustomLog("", "", add: false, remove: true, resort: true); } int achievement = Quest.GetAchievement("Trader"); bool flag = Quest.GetAchievement("Barter", 2) > 0 && Wildling.SkillFactor((SkillType)0) <= 16f; string text = ""; string text2 = "Greyling"; int num = 1; int num2 = 2; while (num <= m_gdExchangeItems.Length) { if (num == 10 || num == 20 || num == m_gdExchangeItems.Length) { if (text != "") { WUTIL.CustomLog(text2 + " can give you " + WrittenList(text) + ".", "#CC8"); text = ""; } text2 = ((num == 20 && flag) ? "Greydwarf elite" : "Greydwarf"); } if ((achievement & num2) > 0) { text = text + ((text == "") ? "" : ", ") + WUTIL.ItemName(m_gdExchangeItems[num]); } num++; num2 <<= 1; } achievement = Quest.GetAchievement("Hunter"); string text3 = ""; string text4 = ""; string text5 = ""; bool flag2 = false; bool flag3 = false; int num3 = 0; int num4 = 1; while (num3 <= m_gdTrophyItems.Length) { if ((achievement & num4) > 0) { string text6 = m_gdTrophyItems[num3]; if (text6 == "Guck") { flag2 = true; } else if (text6 == "SurtlingCore") { flag3 = Quest.GetAchievement("Barter", 5) > 0; } if (text6.StartsWith("Trophy")) { text6 = WUTIL.ItemName(text6); int num5 = text6.LastIndexOf(" Trophy"); text3 = text3 + ((text3 == "") ? "" : ", ") + ((num5 > 0) ? text6.Remove(num5) : text6); } else if (num3 >= 1 && num3 <= 5) { text5 = text5 + ((text5 == "") ? "" : ", ") + WUTIL.ItemName(text6); } else { text4 = text4 + ((text4 == "") ? "" : ", ") + WUTIL.ItemName(text6); } } num3++; num4 <<= 1; } if (text5 != "") { WUTIL.CustomLog("Greydwarf seem to like " + WrittenList(text5) + ".", "#FDA"); } if (text4 != "") { WUTIL.CustomLog("Greydwarf accept " + WrittenList(text4) + " as undead trophies.", "#FDA"); } if (flag2) { if (Quest.GetAchievement("Treecare") > 0) { WUTIL.CustomLog("Greydwarf reward you for planting trees and take Guck as evidence of treecare.", "#8C4"); } else { WUTIL.CustomLog("Greydwarf accept Guck as evidence of treecare.", "#8C4"); } } else if (Quest.GetAchievement("Treecare") > 0) { WUTIL.CustomLog("Greydwarf will reward you for planting saplings.", "#8C4"); } if (text3 != "") { WUTIL.CustomLog("Greydwarf appreciate enemy " + WrittenList(text3) + " trophies.", "#FDA"); } if (Quest.GetAchievement("Barter", 8) > 0) { WUTIL.CustomLog("Greydwarf elite has a special reward for Ectoplasm.", "#FBC"); } if (flag3) { WUTIL.CustomLog("Greydwarf shaman will give you a surtling spike for a surtling core.", "#8AF"); } if (Quest.GetAchievement("Barter", 7) > 0) { WUTIL.CustomLog("Greydwarf shaman will give you elderberries for Abomination roots.", "#8AF"); } } public unsafe static string GetMarkerName(Character character) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Invalid comparison between Unknown and I4 //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Invalid comparison between Unknown and I4 //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Invalid comparison between Unknown and I4 Faction faction = character.GetFaction(); if ((int)faction == 1 || (int)faction == 8 || (int)faction == 6) { WDBUG.Log("Unknown marker faction: " + ((object)(*(Faction*)(&faction))/*cast due to .constrained prefix*/).ToString()); return ""; } string text = GetClan(character); string text2 = WUTIL.ActorName(character); if (IsMarlonCat(text2)) { return "PetCat"; } if (text == "Animal") { string text3 = "Pet" + text2; text = ((text2 == "Pixie" || text2 == "Ygnie") ? "" : ((IsBeastFamilar(character) && MapMarker.IsScentMarker(text3)) ? text3 : ((text2 == "Neck") ? text2 : "Animal"))); } else if ((int)faction == 0) { text = (((Character)Player.m_localPlayer).IsPVPEnabled() ? "Enemy" : "Ally"); } else if ((int)faction == 4) { text = "Demon"; } else if ((int)faction == 3) { if (text2.StartsWith("Skeleton")) { text = "Undead"; } else if (text2.StartsWith("Draugr")) { text = "Undead1"; } else { switch (text2) { default: if (!(text2 == "Doxie")) { text = "Undead3"; break; } goto case "Ghost"; case "Ghost": case "Wraith": case "Witherin": text = "Undead2"; break; } } } else if (text == "") { text = ((text2 == "Hatchling") ? "" : "Monster"); } return text; } public static string GetNextMarker(string name) { if (name == "Deer") { return "DeerMeat"; } if (name.StartsWith("Rabbit")) { return "RabbitMeat"; } if (name.StartsWith("Rat")) { return "RatMeat"; } if (name.StartsWith("Boar")) { return "BoarMeat"; } if (name.StartsWith("Wolf")) { return "WolfMeat"; } if (name.StartsWith("Lox")) { return "LoxMeat"; } if (name.StartsWith("Bjorn")) { return "BjornMeat"; } return ""; } public static void SummarizeKnownScents(bool replace = true) { if (replace) { WUTIL.CustomLog("", "", add: false, remove: true, resort: true); } string text = "You know the "; string text2 = ""; string text3 = ""; string text4 = ""; string text5 = ""; string text6 = ""; string text7 = ""; foreach (string knownScent in MapMarker.GetKnownScents()) { if (!m_scentTypes.ContainsKey(knownScent)) { continue; } string text8 = (m_scentTypes.ContainsKey(knownScent) ? m_scentTypes[knownScent] : ""); if (text8 == "Animal" || text8 == "Neck") { string text9 = ((knownScent.EndsWith("rabbit") || knownScent.EndsWith("bunny")) ? "Rabbit" : knownScent); if (!text2.Contains(text9)) { text2 = text2 + ((text2 == "") ? "" : ", ") + text9; } continue; } switch (text8) { case "Greydwarf": text7 = text7 + ((text7 == "") ? "" : ", ") + knownScent; break; default: if (!(text8 == "Pixie")) { if (text8.StartsWith("Undead")) { string text10 = (knownScent.StartsWith("Draugr") ? "Draugr" : knownScent); if (!text3.Contains(text10)) { text3 = text3 + ((text3 == "") ? "" : ", ") + text10; } break; } if (text8 == "Monster" || text8 == "Goblin" || text8 == "Monster") { if (!text5.Contains(knownScent)) { text5 = text5 + ((text5 == "") ? "" : ", ") + knownScent; } break; } switch (text8) { default: if (!text8.StartsWith("Pet")) { goto end_IL_013c; } break; case "Ally": case "Enemy": case "Ygnie": break; } text6 = text6 + ((text6 == "") ? "" : ", ") + knownScent; break; } goto case "Demon"; case "Demon": case "Undead3": { text4 = text4 + ((text4 == "") ? "" : ", ") + knownScent; break; } end_IL_013c: break; } } if (text6 != "") { WUTIL.CustomLog(text + "familiar scent of " + WrittenList(text6) + "."); } if (text2 != "") { WUTIL.CustomLog(text + "beastly smell of " + WrittenList(text2) + "."); } if (text7 != "") { WUTIL.CustomLog(text + "woody smell of " + WrittenList(text7) + "."); } if (text3 != "") { WUTIL.CustomLog(text + "ghastly odor of " + WrittenList(text3) + "."); } if (text5 != "") { WUTIL.CustomLog(text + "monsterous stench of " + WrittenList(text3) + "."); } if (text4 != "") { WUTIL.CustomLog(text + "otherworldly presence of " + WrittenList(text4) + "."); } } public static void CheckObjectives(string itemGiven = "", bool refresh = false) { if (itemGiven != "") { int num = Array.IndexOf(m_gdExchangeItems, itemGiven); if (num > 0 && Quest.SetAchievement("Trader", num, bit: true)) { WUTIL.PlaySecretFoundSfx(); } } if (Quest.CheckObjective(9, set: true, test: true) && Quest.GetAchievement("Treecare") >= 10 && Quest.GetAchievement("Treeportal") > 10) { Quest.CheckObjective(9, set: false); } int achievement = Quest.GetAchievement("Barter"); if (achievement == 0 || achievement >= 511) { return; } int achievement2 = Quest.GetAchievement("Trader"); bool flag = (achievement2 & 0x240) == 576; bool flag2 = (achievement2 & 0x4010000) == 67174400; int achievement3 = Quest.GetAchievement("BarterDreamState"); if (flag) { Quest.CheckObjective(22, set: false); } else if (achievement3 >= 2) { Quest.CheckObjective(22, set: true, test: false, refresh); } if (achievement != 1) { Quest.CheckObjective(7, set: false); if (flag2) { Quest.CheckObjective(23, set: false); } else if (achievement3 >= 4 || flag) { Quest.CheckObjective(23, set: true, test: false, refresh); } if ((achievement & 0x10) > 0) { Quest.CheckObjective(24, set: false); } else if ((achievement & 4) > 0) { Quest.CheckObjective(24, set: true, test: false, refresh); } if ((achievement & 0x20) > 0) { Quest.CheckObjective(25, set: false); Quest.CheckObjective(24); } else if (achievement3 >= 7 || (achievement & 8) > 0) { Quest.CheckObjective(25, set: true, test: false, refresh); } if ((achievement & 0x40) > 0) { Quest.CheckObjective(26, set: false); } else if (achievement3 >= 8 && (achievement & 8) > 0) { Quest.CheckObjective(26, set: true, test: false, refresh); } } } public static bool IsMarlonCat(string name) { return name.Length <= 8 && name.StartsWith("CT_Cat"); } private static string WrittenList(string csvList) { int num = csvList.LastIndexOf(','); return ((num > 0) ? (csvList.Remove(num) + " and" + csvList.Substring(num + 1)) : csvList).ToLower(); } private static bool HiddenAtDistance(float distanceFactor) { float num = (EnvMan.IsDaylight() ? 0.8f : 1f); float num2 = 0.5f * (Wildling.SkillFactor((SkillType)0) + num + Equipment.HideClothingBuff); return distanceFactor < num2; } private static float GetCurrentBarterLevel(Character character) { return GetCurrentTrust(character) - 0.3f + Wildling.BarterBuff; } private static float GetCurrentTrust(Character character) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 string clan = GetClan(character); if (clan == "" || WUTIL.Timer(clan) > 0f) { return 0f; } float num = GetClanMemberData(character).m_trust; if (clan == "Greydwarf") { if (m_greydwarfReputaion < -10f) { return 0f; } if (m_greydwarfReputaion < 0f) { num /= 2f; } else if (m_greydwarfReputaion > 0f) { float num2 = Mathf.Min(2f, 0.01f * m_greydwarfReputaion); num *= 1f + num2; } } num += Wildling.SkillFactor((SkillType)0); int achievement = Quest.GetAchievement("DarklingShade"); Faction faction = character.GetFaction(); Faction val = faction; return ((int)val == 2) ? (num * (1f - 0.01f * (float)achievement)) : (((int)val != 7) ? Mathf.Max(num, 0.005f * (float)achievement) : Mathf.Max(num, 0.01f * (float)achievement)); } private static bool CanBarter(Character character, float distanceFactor) { if (!(GetClan(character) == "Greydwarf") || GetClanRank(character) > 3) { return false; } if (distanceFactor > 0.93f || m_greydwarfReputaion < -20f) { return false; } return GetCurrentBarterLevel(character) >= 0f; } private static void TrackScentTypes(Character character) { if ((Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)character != (Object)null) { string hoverName = character.GetHoverName(); if (!m_scentTypes.ContainsKey(hoverName)) { m_scentTypes.Add(hoverName, GetMarkerName(character)); } } } private static ClanMemberData GetClanMemberData(Character character) { string text = WUTIL.ActorName(character); if (text != "" && m_clanMembers.ContainsKey(text)) { return m_clanMembers[text]; } return null; } private static void RegisterClanMember(string name, string clan = "", bool barter = false, float trust = 0.2f, float discoverRadius = 0f) { if (m_clanMembers.ContainsKey(name)) { WDBUG.Log("Denighed repeat clan registery for " + name + " -> " + clan); return; } m_clanMembers.Add(name, new ClanMemberData(clan, barter, trust, discoverRadius)); WDBUG.Log($"{name} clan: {clan} rank: {m_clanMembers[name].m_rank} trust: {trust} barter: {barter})", WDBUG.Level.ClanConfig); } private static bool CheckHiddenChased(Character source, float distanceFactor) { bool flag = HiddenAtDistance(distanceFactor); bool flag2 = source.GetBaseAI().CanSeeTarget((Character)(object)Player.m_localPlayer); bool flag3 = AlertedToPlayer(source); string hoverName = source.GetHoverName(); float num = ((hoverName == "Greyling") ? 0.2f : 0f); if (GetClan(source) == "Goblin") { num = 0.005f * (float)Quest.GetAchievement("DarklingShade"); } if (!flag && (m_wildlingHidden || WUTIL.TestLuck())) { if (!flag2 && distanceFactor < 0.7f + Equipment.HideClothingBuff + num) { flag = true; } } else if (flag && !m_wildlingHidden) { Quest.ShowMainTutorial(4); StatusEffect val = (StatusEffect)(object)(Wildling.SE_Hidden)(object)ScriptableObject.CreateInstance(typeof(Wildling.SE_Hidden)); m_wildlingHidden = true; ((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect(val, false, 0, 0f); } if (flag) { if (flag2) { WDBUG.Log($"Seen hidden by {hoverName} at df: {distanceFactor} alerted: {flag3}", WDBUG.Level.Sense); if (!flag3 && distanceFactor > 0.24f && WUTIL.TestLuck()) { Wildling.RaisePrimarySkill(distanceFactor * 1f, "hide close to " + hoverName, 5f, (SkillType)0); } } else if (flag3) { if (distanceFactor > 0.24f && WUTIL.TestLuck(0.9f)) { StopHunt(source); float exp = ((num > 0f || GetClan(source) == "Animal") ? 2f : 5f); Wildling.RaisePrimarySkill(exp, "stop hunt of " + hoverName, World.PlayerInInterior() ? 100 : 10, (SkillType)0); } else { WDBUG.Log($"Stop hunt failed for {hoverName} at df: {distanceFactor}", WDBUG.Level.Sense); } } } m_wildlingHidden = flag; return flag; } private static string GetClanSpeechSfx(Character character, int reaction = 0) { ClanMemberData clanMemberData = GetClanMemberData(character); if (reaction > 3 || clanMemberData == null) { WDBUG.Log($"Unexpected call to GetClanSpeechSfx({character.GetHoverName()}, {reaction})"); return ""; } int num = clanMemberData.m_rank; if (num < 0 || num > 3) { WDBUG.Log($"No speech for {character.GetHoverName()} found due to rank {num}"); return ""; } if (clanMemberData.m_clan != "Greydwarf") { WDBUG.Log("No speech for " + character.GetHoverName() + " found due to clan"); return ""; } if (reaction < 0) { reaction = WUTIL.DieRoll(3); num = WUTIL.DieRoll(num + 1); } List list = new List { "sfx_greyling_idle", "sfx_greydwarf_idle", "sfx_greydwarf_elite_idle", "sfx_greydwarf_idle", "sfx_greyling_hit", "sfx_greydwarf_hit", "sfx_greydwarf_hit", "sfx_greydwarf_hit", "sfx_greyling_alerted", "sfx_greydwarf_alerted", "sfx_greydwarf_elite_alerted", "sfx_greydwarf_alerted", "sfx_greyling_attack", "sfx_greydwarf_attack", "sfx_greydwarf_elite_attack", "sfx_greydwarf_shaman_attack" }; return list[num + reaction * 4]; } private static List GetTakeableItems(Character character) { if (GetClanRank(character) == 0) { } return GreydwarfAcceptItems(GetClanRank(character)); } private static string GetExchangeItem(Character character, string item, int rankOverride = 0) { //IL_0277: Unknown result type (might be due to invalid IL or missing references) ClanMemberData clanMemberData = GetClanMemberData(character); if (clanMemberData == null) { return ""; } float num = 2f * GetCurrentBarterLevel(character); if (num < 0f) { return ""; } Quest.HelpWithBarter(); WUTIL.FlushDelayedMessage(show: false); float num2 = num + WUTIL.RandomSpin(0f, 0.1f + m_holdingRabbitFootLuck); int num3 = ((rankOverride > 0) ? rankOverride : clanMemberData.m_rank); float num4 = 0.5f - 2f * m_holdingRabbitFootLuck; WDBUG.Log($"Barter Rank: {num3} Deficit: {num4} Credit: {num} Stetch: {num2}", WDBUG.Level.Barter); CheckRecentExchangeDrops(item, -1); string text = GreydwarfExchangeItem(character, item, num4, num2, num3); if (!text.StartsWith("Insult:")) { clanMemberData.m_trust = Mathf.Min(clanMemberData.m_trust + 0.005f, 0.35f); m_greydwarfReputaion += 5f; CheckRecentExchangeDrops(text, 1); Quest.SetAchievement("Barter", num3, bit: true); WDBUG.Log("Barter exchange: " + text, WDBUG.Level.Barter); return text; } float num5 = float.Parse(text.Substring(7)); float num6 = 5f; if (num5 >= 3f) { WUTIL.Message("Your offering really offended the whole clan!"); num6 = 1000f; } else if (num5 >= 2f) { WUTIL.Message("Your offering was deeply insulting!"); num6 = 100f; } else if (num5 >= 1f) { WUTIL.Message("Your offering was not appreciated at all!", center: false); num6 = 20f; } else { WUTIL.Message("Your offering was not appreciated!", center: false); } num6 *= 1f; m_greydwarfReputaion = Math.Max(m_greydwarfReputaion - num6, -1200f); clanMemberData.m_trust = Mathf.Max(clanMemberData.m_trust - num5 * num5 * 0.005f, 0.1f); WUTIL.PlaySfx(GetClanSpeechSfx(character, (num5 >= 2f) ? 3 : 2), ((Component)character).transform.position); return "insult"; } private static float DiscoverRadius(Character character) { ClanMemberData clanMemberData = GetClanMemberData(character); float num = clanMemberData?.m_discoverRadius ?? 0f; if (num <= 0f) { float radius = character.GetRadius(); num = 1f - 0.025f * radius * radius * radius; if (clanMemberData != null) { clanMemberData.m_discoverRadius = num; } } return num; } private static void SenseCreature(Character character, float distFactor) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) if (character.IsFlying() || (m_detectScentsInside && World.PlayerInInterior()) || (ElderWand.IsPowered() && ElderWand.ObeysElderWand(character)) || Riding.IsRiding(character) || MapMarker.CharacterSenseCooldown(character) > 0f) { return; } string markerName = GetMarkerName(character); if (markerName == "") { return; } string text = WUTIL.ActorName(character); string hoverName = character.GetHoverName(); string nextMarker = (markerName.StartsWith("Pet") ? "" : GetNextMarker(text)); bool isSmall = text.StartsWith("Rat"); if ((Object)(object)((Component)character).GetComponent() != (Object)null) { int num = text.IndexOf('_'); if (num > 0) { isSmall = true; text = text.Remove(num); } } else if (text.StartsWith("Rabbit")) { hoverName = (text = "Rabbit"); isSmall = true; } else if (text.StartsWith("Draugr")) { text = "Draugr"; hoverName = Localization.instance.Localize("$enemy_draugr"); } if (MapMarker.DetectScent(text, ((Component)character).transform.position, distFactor, hoverName, markerName, nextMarker, isSmall, CharacterScentPower(character))) { MapMarker.CharacterSenseCooldown(character, 5); } } private static float AlertMovementFactor() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = ((Character)Player.m_localPlayer).GetVelocity(); float num = velocity.x * velocity.x + 0.25f * (velocity.y * velocity.y) + velocity.z * velocity.z; if (((Character)Player.m_localPlayer).IsCrouching()) { num *= 0.25f; } return 1f - 0.5f * Mathf.Exp(-0.05f * num); } private static bool InPositionToBarter(Character character) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)localPlayer)) { return false; } bool flag = true; Vector3 val2 = ((Character)localPlayer).m_eye.position - character.m_eye.position; float num = Utils.LengthXZ(val2); if (num > 0.01f) { ((Vector3)(ref val2)).Normalize(); } if (!((BaseAI)val).CanSeeTarget((Character)(object)localPlayer)) { flag = false; } if (num > 10f) { character.SetWalk(true); flag = false; } else { if (num < 5f) { character.SetMoveDir(Vector3.zero); } if (m_justDropped) { m_justDropped = false; WUTIL.TimerReset("witness_barter", 15f); if (flag && num < 2f) { WDBUG.Log($"Yeet! Assumed threw behind ({num} <3)", WDBUG.Level.Barter); val2 = -val2; } } } character.SetLookDir(val2, 0f); return flag; } private static bool AssignAllGrabables(Character character, bool onlyIfNone = true, bool debug = false) { BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if (!Object.op_Implicit((Object)(object)val) || (onlyIfNone && val.m_consumeItems.Count > 0)) { return false; } List takeableItems = GetTakeableItems(character); foreach (string item in takeableItems) { AddPickupItemToMonster(character, item); } if (debug) { string text = ""; foreach (string item2 in takeableItems) { text = text + " " + item2; } WDBUG.Log("Assigned grabbles:" + text, WDBUG.Level.Barter); } return true; } private static void ForgetAllGrabables(Character character) { AddPickupItemToMonster(character, ""); } private static void PickupItem(ItemDrop item, Character character) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) WUTIL.FlushDelayedMessage(show: false); string text = WUTIL.ItemName(item.m_itemData); Vector3 position = ((Component)character).transform.position; string hoverName = character.GetHoverName(); if (CheckRecentExchangeDrops(text)) { WDBUG.Log("Ungifting: " + text, WDBUG.Level.Barter); CheckRecentExchangeDrops(text, -1); WUTIL.PlaySfx(GetClanSpeechSfx(character, WUTIL.DieRoll(2)), position); if (WUTIL.TestLuck(0.6f)) { WUTIL.CustomLog(hoverName + " took back " + WUTIL.ItemName(item), "#CC8"); } return; } string text2 = WUTIL.ItemName(item.m_itemData, goName: false); text = GetExchangeItem(character, text); Player closestPlayer = Player.GetClosestPlayer(position, 16f); if (Object.op_Implicit((Object)(object)closestPlayer)) { if (!Wildling.IsWildlingPlayer(closestPlayer) || (Object)(object)closestPlayer != (Object)(object)Player.m_localPlayer) { return; } Vector3 val = ((Character)closestPlayer).m_eye.position - character.m_eye.position; float num = Utils.LengthXZ(val); if (num > 0.01f) { ((Vector3)(ref val)).Normalize(); } character.SetLookDir(val, 0f); float num2 = 0.5f; position = (1f - num2) * ((Component)closestPlayer).transform.position + num2 * position; if (num < 14f && WUTIL.Timer("witness_barter") > 0f && (double)Vector3.Dot(-val, ((Character)closestPlayer).GetLookDir()) > 0.9) { WDBUG.Log("Assumed Wildling witnessed barter", WDBUG.Level.Barter); Quest.ShowMainTutorial(8); } position += Vector3.up; if (text == "insult") { Wildling.RaisePrimarySkill(1f, "insult gift " + hoverName, 5f, (SkillType)0); WUTIL.PlaySfx(GetClanSpeechSfx(character, 3), position); character.GetBaseAI().Alert(); WUTIL.CustomLog("Offering " + WUTIL.ItemName(item.m_itemData, goName: false) + " to a Greydwarf did not go down well!", "#F44"); return; } int clanRank = GetClanRank(character); Wildling.RaisePrimarySkill(1f * (float)(clanRank + 1), $"barter gift {hoverName} at rank: {clanRank}", 5f, (SkillType)0); WUTIL.CreateHeadEffect("vfx_creature_soothed", character); StopHunt(character); if (text == "") { if (WasRecentlySeen(hoverName)) { WUTIL.Message(hoverName + " seemed to like your gift.", center: false); } List list = new List(); for (int i = 0; i < 2 + WUTIL.DieRoll(3); i++) { string clanSpeechSfx = GetClanSpeechSfx(character, -1); if (!list.Contains(clanSpeechSfx)) { WUTIL.PlaySfx(clanSpeechSfx, position, 0.1f * (float)i); list.Add(clanSpeechSfx); } } return; } WUTIL.PlaySfx(GetClanSpeechSfx(character, WUTIL.DieRoll(2)), position); List list2 = new List { "sfx_barley_hit", "sfx_hit", "sfx_greydwarf_throw", "sfx_neck_hit" }; string sfx_name = list2[WUTIL.DieRoll(list2.Count)]; int number = 1; int num3 = text.IndexOf(':'); if (num3 > 0) { number = int.Parse(text.Substring(num3 + 1)); text = text.Remove(num3); } WDBUG.Log(hoverName + " should gift " + number + "x " + text, WDBUG.Level.Barter); ItemData val2 = WUTIL.DropItemOutside(text, position, sfx_name, number); if (val2 != null) { string msg = hoverName + " traded " + WUTIL.ItemName(val2, goName: false) + " for " + text2; WUTIL.CustomLog(msg, BarterLogColor(text), text2 != "Guck"); if (WasRecentlySeen(hoverName)) { WUTIL.Message(msg, center: true, MapMarker.GetCharacterIcon(character)); } Quest.SetAchievement("BarterDreamState", (hoverName == "Greyling") ? 3 : 4, bit: false, if_lower: true); CheckObjectives(text); if (text == "KnifeCopper") { Quest.AdvanceAchievement(text); val2.m_quality = Mathf.Min(Quest.GetAchievement(text), 4); } } } else { WDBUG.Log("No player to nearby to accept " + text, WDBUG.Level.Barter); } } private static string BarterLogColor(string item) { if (item == "Guck") { return "#8C4"; } int num = "CarrotSeeds,BeechSeeds,FirCone,FineWood,RoundLog".IndexOf(item); return (num >= 0) ? "#FC8" : (m_gdTrophyItems.Contains(item) ? "#FDA" : "#CCA"); } private static void AddPickupItemToMonster(Character character, string itemName) { BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if (!Object.op_Implicit((Object)(object)val)) { return; } if (itemName == "") { if (val.m_consumeItems.Count > 0) { WDBUG.Log("Clearing " + WUTIL.ActorName(character) + " grab list", WDBUG.Level.Barter); val.m_consumeItems.Clear(); val.m_onConsumedItem = null; } return; } GameObject prefab = WUTIL.GetPrefab(itemName); ItemDrop val2 = ((prefab != null) ? prefab.GetComponent() : null); if ((Object)(object)val2 == (Object)null) { WDBUG.Log("AddPickupItemToMonster failed - " + itemName + " is not an ItemDrop"); return; } if (!val.m_consumeItems.Contains(val2)) { val.m_consumeItems.Add(val2); } int num = 0; if (val.m_onConsumedItem != null) { Delegate[] invocationList = val.m_onConsumedItem.GetInvocationList(); for (int i = 0; i < invocationList.Length; i++) { Action action = (Action)invocationList[i]; if (action.Target is CharacterOnConsumedItem) { num++; break; } } } if (num == 0) { val.m_onConsumedItem = (Action)Delegate.Combine(val.m_onConsumedItem, new Action(new CharacterOnConsumedItem(character).OnConsumedItem)); } if (val.m_onConsumedItem.GetInvocationList().Length != 1) { WDBUG.Log($"{character.GetHoverName()} has {val.m_onConsumedItem.GetInvocationList().Length} onConsumedItem delegates"); } } private static List GreydwarfAcceptItems(int rank) { List list = new List(); if (rank > 3) { return list; } float num = Mathf.Max(0f, (float)rank - 0.5f); float num2 = rank + 1; WDBUG.Log($"Checking for accepted exchange items of value {num} - {num2}", WDBUG.Level.Barter); for (int i = 0; i < m_gdExchangeItemValues.Length; i++) { if (m_gdExchangeItemValues[i] >= num && m_gdExchangeItemValues[i] < num2) { list.Add(m_gdExchangeItems[i]); } } if (rank == 0) { list.Add("PebbleSharp"); list.Add("PebbleFine"); } else { list.AddRange(m_gdTrophyItems); list.Add("Ectoplasm"); list.AddRange(m_gdInsultItems); } return list; } private static string GreydwarfExchangeItem(Character giver, string item, float decicit, float credit, int rank) { bool flag = item == "treecare"; List list = new List(); float num = rank + 1; bool flag2 = true; int num2 = Array.IndexOf(m_gdExchangeItems, item); if (num2 < 0 && rank == 0 && item == "PebbleSharp") { num2 = Array.IndexOf(m_gdExchangeItems, "PebbleSmooth"); } float num3; float num4; if (num2 >= 0) { num3 = Mathf.Max(0f, m_gdExchangeItemValues[num2] - decicit); num4 = Mathf.Min(num, m_gdExchangeItemValues[num2] + credit); for (int i = 0; i < m_gdExchangeItemValues.Length; i++) { if (m_gdExchangeItems[i] != item && m_gdExchangeItemValues[i] >= num3 && m_gdExchangeItemValues[i] < num4 && !CheckRecentExchangeDrops(m_gdExchangeItems[i])) { list.Add(m_gdExchangeItems[i]); } } if (rank == 0 && item == "PebbleFine") { if (!list.Contains("PebbleSmooth")) { list.Add("PebbleSmooth:3"); } if (!list.Contains("CarrotSeeds")) { list.Add("CarrotSeeds:2"); } if (!list.Contains("Acorn") && WUTIL.TestLuck(0.05f)) { list.Add("Acorn"); } } } else { if (item == "Ectoplasm") { if (rank == 2 && (Object)(object)ZNetScene.instance.GetPrefab("CT_CatGiftBox") != (Object)null) { if (Quest.GetAchievement("Barter", 8) == 0) { Quest.SetAchievement("Barter", 8, bit: true); WUTIL.PlaySecretFoundSfx(4); } return "CT_CatGiftBox"; } item = "TrophySkeleton"; } num2 = Array.IndexOf(m_gdTrophyItems, flag ? "Guck" : item); if (num2 < 0) { num2 = Array.IndexOf(m_gdInsultItems, item); return (num2 < 0) ? "" : ("Insult:" + m_gdInsultItemValues[num2]); } flag2 = false; if (!flag && Quest.SetAchievement("Hunter", num2, bit: true)) { WUTIL.PlaySecretFoundSfx(2); } num3 = m_gdTrophyItemValues[num2] - decicit; num4 = m_gdTrophyItemValues[num2] + credit; if (rank >= 3) { switch (item) { case "Root": if (Quest.GetAchievement("Barter", 7) == 0) { WUTIL.PlaySecretFoundSfx(3); Quest.SetAchievement("Barter", 7, bit: true); WUTIL.CustomLog("Greydwarf shaman will give you elderberries for Abomination roots.", "#8AF"); } return "Elderberries:2"; case "SurtlingCore": if (Quest.GetAchievement("Barter", 5) == 0) { WUTIL.PlaySecretFoundSfx(3); Quest.SetAchievement("Barter", 5, bit: true); Quest.SetAchievement("BarterDreamState", 8); WUTIL.CustomLog("The Greydwarf Shaman will exchange Surtling spike for Surtling core.", "#8AF"); } return "SurtlingSpike"; case "WitheredBone": if (Quest.GetAchievement("QuestElder") == 0) { if (Quest.StartElderQuest(giver)) { WUTIL.PlaySecretFoundSfx(5); Quest.SetAchievement("Barter", 6, bit: true); WUTIL.Message("The shaman seemed excited to take your offer.", center: true, null, blockNext: true, logOpt: true); WUTIL.CustomLog("The Greydwarf Shaman wants to lead you somewhere.", "#8AF"); return ""; } int count = World.GetLocationPositions("Greydwarf_camp1").Count; WDBUG.Log($"Shaman out of range of conclave of {count}: Non-quest exchange and flee", WDBUG.Level.Barter); return item; } break; } } if (m_gdTrophyItemValues[num2] > 2f && rank >= 2 && Quest.GetAchievement("Barter", 4) == 0) { Quest.SetAchievement("Barter", 4, bit: true); Quest.SetAchievement("BarterDreamState", 7); WUTIL.PlaySecretFoundSfx(4); WUTIL.CustomLog(giver.GetHoverName() + " exchanged an undead trophy for a Crypt Key", "#8AF"); return "CryptKey"; } for (int j = 0; j < m_gdRewardItemValues.Length; j++) { if (m_gdRewardItemValues[j] >= num3 && m_gdRewardItemValues[j] < num4) { string text = m_gdRewardItems[j]; if (Quest.GetAchievement(text) < 4 && !CheckRecentExchangeDrops(text)) { list.Add(text); } } } } string text2 = ""; foreach (string item2 in list) { text2 = text2 + item2 + " "; } WDBUG.Log($"{giver.GetHoverName()} for {item} value {num3} - {num4} gives {text2}", WDBUG.Level.Barter); if (flag2 && WUTIL.TestLuck(0.4f - 0.5f * Wildling.SkillFactor((SkillType)0))) { if (list.Contains("RoundLog")) { return WUTIL.TestLuck(0.8f) ? "RoundLog" : "FineWood"; } if (list.Contains("FineWood")) { return WUTIL.TestLuck(0.7f) ? "FineWood" : "FirCone"; } if (list.Contains("BeechSeeds")) { return WUTIL.TestLuck(0.6f) ? "BeechSeeds" : "FirCone"; } if (list.Contains("CarrotSeeds")) { return WUTIL.TestLuck(0.7f) ? "CarrotSeeds" : "FirCone"; } } return (list.Count == 0) ? "" : list[WUTIL.DieRoll(list.Count)]; } private static string UpdateConsumeItem(BaseAI baseAI) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return ""; } Character component = ((Component)baseAI).gameObject.GetComponent(); string text = WUTIL.ActorName(component); if (WUTIL.Timer(text + "_no_consume") > 0f) { return ""; } bool flag = GetClan(component) == "Goblin"; ItemDrop val = null; float consumeRange = GetConsumeRange(text); float num = WUTIL.RandomSpin(); if (flag) { consumeRange = 1.5f * component.GetRadius(); val = FindClosestConsumableItem(component, consumeRange * 10f); } else { bool flag2 = component.IsTamed(); float num2 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)baseAI).transform.position); float num3 = ((text == "Ygnie" || flag2) ? 0.5f : ((float)(baseAI.IsAlerted() ? 15 : (m_wildlingHidden ? 4 : 8)))); num3 *= 1f + WUTIL.RandomSpin(-0.25f, 0.25f); if (Wildling.IsWildling) { num3 -= Math.Min(Wildling.SkillFactor((SkillType)0) * 4f, 2f); } if (Riding.IsRiding(component)) { if (IsHungry(component, WUTIL.GetButton("Crouch"))) { num = (Object.op_Implicit((Object)(object)GetDetectedItemDrop(baseAI)) ? 0.21000001f : 0f); } } else if (num2 < num3) { WUTIL.TimerReset(text + "_no_consume", WUTIL.RandomSpin(5f, 15f)); SetDetectedItemDrop(baseAI, null); return ""; } consumeRange *= 0.8f + 0.2f * WUTIL.GetLevelSize(component); if (num <= 0.2f) { val = FindClosestConsumableItem(component, Math.Max(consumeRange, 0.75f) * 30f); SetDetectedItemDrop(baseAI, val); } else if (num >= 0.99f) { SetDetectedItemDrop(baseAI, null); } else { val = GetDetectedItemDrop(baseAI); } } if ((Object)(object)val == (Object)null) { if (num < 0.7f) { AttactRabbit(baseAI); } return ""; } string text2 = WUTIL.GameName(((Object)val).name); if ((Object)(object)((Component)val).gameObject.GetComponent() != (Object)null) { consumeRange = ((!component.IsSwimming()) ? 1 : 2); } float num4 = Vector3.Distance(((Component)val).transform.position, ((Component)baseAI).transform.position); if (num4 <= consumeRange) { SetDetectedItemDrop(baseAI, null); if (flag) { WDBUG.Log($"{text} considering {text2} at dist: {num4}", WDBUG.Level.Barter); if (m_characterBribeAttempt.ContainsKey(component)) { m_characterBribeAttempt[component] = 0f; } string text3 = Pocket.PickupBribe(component, val.m_itemData); if (text3 != "ignore") { WUTIL.Destroy(((Component)val).gameObject); if (text3 != "") { WDBUG.Log(component.GetHoverName() + " threw down " + text3); WUTIL.DropItemOutside(text3, ((Component)component).transform.position); } } Quest.ShowMainTutorial(13); return ""; } if (ConsumeOneItem(val)) { WUTIL.TimerReset(text + "_no_consume", WUTIL.RandomSpin(2f, 3f)); if (text == "Deer") { WDBUG.Log($"{text} should bend to eat {text2} at dist: {num4}", WDBUG.Level.Taming); DeerEatAnimation(baseAI); } else { WDBUG.Log($"{text} should consume {text2} at dist: {num4}", WDBUG.Level.Taming); WUTIL.PlaySfx("sfx_creature_consume", ((Component)baseAI).transform.position, 1f); ZSyncAnimation component2 = ((Component)baseAI).gameObject.GetComponent(); component2.SetTrigger((text == "Neck") ? "throw" : "consume"); } return text2; } WDBUG.Log($"{text} failed to consume {text2} at {num4}m of " + val.m_itemData.m_stack); } else { bool run = num4 > 6f; MoveToTarget(component, ((Component)val).transform.position, run); } return "!"; } private static bool ConsumeOneItem(ItemDrop food) { if (food.RemoveOne()) { return true; } try { WDBUG.Log("Trying to destroy " + ((Object)food).name, WDBUG.Level.Taming); WUTIL.Destroy(((Component)food).gameObject); } catch { return false; } return true; } private static void DeerEatAnimation(BaseAI baseAI) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) WUTIL.PlaySfx("sfx_creature_consume", ((Component)baseAI).transform.position, 1f); WUTIL.TimerReset("Deer_consume", 2f); baseAI.ResetRandomMovement(); } private static ItemDrop FindClosestConsumableItem(Character character, float maxRange) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null || maxRange <= 0f) { return null; } string consumeTarget = GetConsumeTarget(character); if (consumeTarget == "") { return null; } string consumeTarget2 = GetConsumeTarget(character, 1); bool flag = consumeTarget2 == "Fish" && (!character.IsSwimming() || Riding.IsRiding(character)); Vector3 val = ((Component)character).transform.position + 0.5f * ((Component)character).transform.forward * character.GetRadius(); ItemDrop val2 = null; float num = maxRange; Collider[] array = Physics.OverlapSphere(val, maxRange, WUTIL.c_foodRayMask); foreach (Collider val3 in array) { if (!Object.op_Implicit((Object)(object)val3.attachedRigidbody)) { continue; } ItemDrop component = ((Component)val3.attachedRigidbody).GetComponent(); if (!((Object)(object)component != (Object)null) || !((Component)component).GetComponent().IsValid()) { continue; } string text = WUTIL.ItemName(component.m_itemData); float num2; if (text == consumeTarget) { num2 = maxRange; } else if (flag && text.StartsWith("Fish")) { num2 = 16f; } else { if (!(text == consumeTarget2)) { continue; } num2 = 4f; } Vector3 displacement = ((Component)character).transform.position - ((Component)component).transform.position; if (MapMarker.WindCheck(displacement, 0.75f)) { float magnitude = ((Vector3)(ref displacement)).magnitude; if (magnitude <= num2 && magnitude < num) { val2 = component; num = magnitude; } } } if ((Object)(object)val2 != (Object)null && consumeTarget == "Acorn") { Fairy.YgnieSeesAcorn(maxRange); } return val2; } private static void AttactRabbit(BaseAI baseAI) { //IL_004e: 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_00b4: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) if (!WUTIL.GameName(((Object)baseAI).name).StartsWith("Rabbit")) { return; } Transform val = FindClosestAttractor(baseAI, 30f); if ((Object)(object)val == (Object)null) { return; } float num = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)baseAI).transform.position); float num2 = (baseAI.IsAlerted() ? 15 : (m_wildlingHidden ? 4 : 8)); if (Wildling.IsWildling) { num2 -= Math.Min(Wildling.SkillFactor((SkillType)0) * 4f, 2f); } if (num < num2) { return; } Vector3 val2 = val.position - ((Component)baseAI).transform.position; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude < 1f) { if (num < 12f) { WUTIL.Message("A rabbit just ate your young carrot!"); } ZSyncAnimation component = ((Component)baseAI).gameObject.GetComponent(); component.SetTrigger("consume"); WUTIL.Destroy(((Component)val).gameObject); } else { ((Vector3)(ref val2)).Normalize(); baseAI.LookTowards(val2); baseAI.MoveTowards(val2, magnitude > 6f); } } private static Transform FindClosestAttractor(BaseAI baseAI, float maxRange) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) Transform val = null; Collider[] array = Physics.OverlapSphere(((Component)baseAI).transform.position, maxRange, WUTIL.c_pickableRayMask); foreach (Collider val2 in array) { if (!Object.op_Implicit((Object)(object)((Component)val2).transform)) { continue; } GameObject gameObject = ((Component)((Component)val2).transform).gameObject; if (!((Object)(object)gameObject != (Object)null) || !((Object)(object)gameObject.GetComponent() != (Object)null) || !gameObject.GetComponent().IsValid()) { continue; } switch (WUTIL.GameName(gameObject)) { case "sapling_seedcarrot": case "Pickable_Carrot": case "sapling_carrot": { float num = Vector3.Distance(gameObject.transform.position, ((Component)baseAI).transform.position); if (num < maxRange) { val = gameObject.transform; maxRange = num; } break; } } } if ((Object)(object)val != (Object)null && Pathfinding.instance.HavePath(((Component)baseAI).transform.position, val.position, baseAI.m_pathAgentType)) { return val; } return null; } private static float GetConsumeRange(string name) { return m_consumeRanges.ContainsKey(name) ? m_consumeRanges[name] : 1f; } private static string GetConsumeTarget(Character character, int foodChoice = 0, bool foodTime = false) { string key = WUTIL.ActorName(character); if (foodChoice >= 0 && m_animalFoods.ContainsKey(key)) { string[] array = m_animalFoods[key].Split(new char[1] { ';' }); if (foodChoice < array.Length) { string[] array2 = array[foodChoice].Split(new char[1] { ',' }); if (foodTime) { return array2[1]; } if (GetAnimalFedTime(character) < float.Parse(array2[1]) * 3f * WUTIL.GetLevelSize(character)) { return array2[0]; } } } return m_characterBribeItem.ContainsKey(character) ? m_characterBribeItem[character] : ""; } private static void SetDetectedItemDrop(BaseAI baseAI, ItemDrop item) { string key = WUTIL.GameName(((Object)baseAI).name); if (!m_animalFoods.ContainsKey(key)) { return; } if ((Object)(object)item == (Object)null) { if (m_locatedConsumables.ContainsKey(baseAI)) { m_locatedConsumables.Remove(baseAI); } } else { m_locatedConsumables[baseAI] = item; } } private static ItemDrop GetDetectedItemDrop(BaseAI baseAI) { return m_locatedConsumables.ContainsKey(baseAI) ? m_locatedConsumables[baseAI] : null; } private static void AttemptBribe(Character character, ItemData item) { if (!((Object)(object)character == (Object)null) && item != null) { m_characterBribeAttempt[character] = 10f; m_characterBribeItem[character] = WUTIL.ItemName(item); } } private static void FeedAnimal(Character character, string food) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_01a6: Unknown result type (might be due to invalid IL or missing references) if (!NearPlayer(((Component)character).transform.position)) { return; } string text = WUTIL.ActorName(character); float num; if (food == GetConsumeTarget(character)) { num = float.Parse(GetConsumeTarget(character, 0, foodTime: true)); } else { if (!food.StartsWith(GetConsumeTarget(character, 1))) { WDBUG.Log("Unmatched " + text + " food " + food); return; } num = float.Parse(GetConsumeTarget(character, 1, foodTime: true)); if (text == "Neck" && food.StartsWith("Fish")) { string hoverName = character.GetHoverName(); if (int.TryParse(food.Substring(4, 1), out var result)) { num += (float)(result * 5); WDBUG.Log($"{hoverName} just ate {food} for +{result * 5}s -> total {num}s", WDBUG.Level.Taming); } WUTIL.CreateAttachedEffect("fx_wolf_pet", ((Component)character).transform, 0f, 0f, 0.5f); WUTIL.CreateAttachedEffect("vfx_BloodHit", ((Component)character).transform); if (GetTamedStatus(character) == "Enamored" && WUTIL.TestLuck(0.2f + 0.5f * Wildling.SkillFactor((SkillType)110))) { Vector3 position = character.GetHeadPoint() + ((Component)character).transform.forward; WUTIL.PlaceObject("vfx_BloodHit", position); WUTIL.DropItemOutside("FishRaw", position); WUTIL.Message(hoverName + " dropped some half-eaten fish", center: true, WUTIL.GetIcon("FishRaw")); Riding.ResetNeckXp(character, 2); } else if (character.IsSwimming()) { WUTIL.Message(hoverName + " just caught and ate a fishy."); Riding.ResetNeckXp(character); } } } if (num > 0f) { Wildling.RaisePrimarySkill(1f, "feed " + text, 5f, (SkillType)0); } if (text.StartsWith("Rabbit")) { StunCharacter(character, num, num + 1f); WDBUG.Log($"{text} stunned for {num}s", WDBUG.Level.Taming); return; } if (text.StartsWith("Bjorn")) { StunCharacter(character, num, num + 1f); WDBUG.Log($"{text} ate {food} and stunned for {num}s", WDBUG.Level.Taming); if (food == "BearBait") { WDBUG.Log($"... and posioned for {200f} damage", WDBUG.Level.Taming); character.Damage(new HitData { m_damage = { m_poison = 200f } }); return; } } else { float num2 = num * 3f * WUTIL.GetLevelSize(character); num += GetAnimalFedTime(character); WDBUG.Log($"{text} fed on {food} for {num} / {(int)num2}s", WDBUG.Level.Taming); SetAnimalFoodTime(character, (num > num2) ? (num2 + (num2 - num) * 0.25f) : num); switch (text) { default: if (!(text == "Neck")) { break; } goto case "Boar"; case "Boar": case "Wolf": case "Deer": Quest.ShowMainTutorial(15); break; } } if (text == "Boar" || text == "Wolf") { WUTIL.CreateAttachedEffect("fx_creature_tamed", ((Component)character).transform, 0.5f); return; } if (text == "Ygnie") { Fairy.YgnieSnack(); return; } WUTIL.CreateAttachedEffect("vfx_creature_soothed", ((Component)character).transform, (text == "Neck") ? 0.5f : 1f); StopHunt(character, tame: true); } private static bool NearPlayer(Vector3 position, float maxRange = 20f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return WUTIL.WithinCylinder(position, ((Component)Player.m_localPlayer).transform.position, maxRange, 8f); } private static void UpdateDigestion(float dt) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (m_characterFoodTime.Count == 0) { return; } Transform transform = ((Component)Player.m_localPlayer).transform; bool flag = WUTIL.Timer("hungertick") == 0f; Dictionary dictionary = new Dictionary(); foreach (KeyValuePair item in m_characterFoodTime) { if (!((Object)(object)item.Key != (Object)null) || item.Key.IsDead() || !(item.Value > dt)) { continue; } float value = item.Value; if (value >= 1024f) { value = Mathf.Max(value - dt, 1024f); if ((Object)(object)item.Key == (Object)(object)m_followingBonded) { Quest.UpdateCharacterFollow(item.Key, transform.position); } } else { value -= dt; } dictionary.Add(item.Key, value); if (flag && !Object.op_Implicit((Object)(object)((Component)item.Key).gameObject.GetComponent())) { float num = item.Key.GetMaxHealth() * 2f / 3600f; item.Key.Heal(Mathf.Max(num, 0.2f), true); } } m_characterFoodTime = dictionary; if (flag) { WUTIL.TimerReset("hungertick", 2f); } } private static void UpdateBlinded(float dt) { if (m_characterDazed.Count == 0) { return; } Dictionary dictionary = new Dictionary(); foreach (KeyValuePair item in m_characterDazed) { if (!((Object)(object)item.Key != (Object)null) || !(item.Value > dt)) { continue; } if (item.Value > dt) { if (WUTIL.TimeIsAlmost(item.Value, 110f)) { StopHunt(item.Key); } else if (!WUTIL.TimeIsAlmost(item.Value, 100f)) { dictionary.Add(item.Key, item.Value - dt); } } else { StopHunt(item.Key); } } m_characterDazed = dictionary; } private static void UpdateStunned(float dt) { if (m_characterStunned.Count == 0) { return; } Dictionary dictionary = new Dictionary(); foreach (KeyValuePair item in m_characterStunned) { if ((Object)(object)item.Key != (Object)null && item.Value > dt) { dictionary.Add(item.Key, item.Value - dt); } } m_characterStunned = dictionary; } private static void UpdateCalmed(float dt) { if (m_animalCalmed.Count == 0) { return; } Dictionary dictionary = new Dictionary(); foreach (KeyValuePair item in m_animalCalmed) { if ((Object)(object)item.Key != (Object)null && item.Value > dt) { dictionary.Add(item.Key, item.Value - dt); } } m_animalCalmed = dictionary; } private static void UpdateBribeAttempt(float dt) { if (m_characterBribeAttempt.Count == 0) { return; } Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); foreach (KeyValuePair item in m_characterBribeAttempt) { if ((Object)(object)item.Key != (Object)null && item.Value > dt) { dictionary.Add(item.Key, item.Value - dt); dictionary2.Add(item.Key, m_characterBribeItem[item.Key]); } } m_characterBribeAttempt = dictionary; m_characterBribeItem = dictionary2; } } internal class Equipment { [HarmonyPatch(typeof(Attack), "Start")] private class PatchAttackStart { public static bool Prefix(Attack __instance, Humanoid character, ItemData weapon, ref bool __result) { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null) { return true; } string text = ((weapon == null || (Object)(object)weapon.m_dropPrefab == (Object)null) ? "" : WUTIL.GameName(((Object)weapon.m_dropPrefab).name)); if (!((Character)character).IsPlayer()) { if (Alignment.ModifyAttack(__instance, (Character)(object)character, text)) { __result = false; return false; } return true; } if (WUTIL.Timer("attack_block_cooldown") > 0f) { return false; } if (text == "Digger") { Digger.ModifyAttackStamina(__instance); } if (WUTIL.HaveStatusEffect("SE_SwiftPotion", (Character)(object)character)) { __instance.m_attackStamina *= 0.5f; } float attackStamina = __instance.m_attackStamina; float skillFactor = ((Character)character).GetSkillFactor(weapon.m_shared.m_skillType); attackStamina -= attackStamina * 0.33f * skillFactor; if (attackStamina <= 0f || !((Character)character).HaveStamina(attackStamina + 0.1f)) { return true; } if (!ModifyAttack(__instance, (Character)(object)character, text)) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Player), "PlayerAttackInput")] private class PatchPlayerPlayerAttackInput { public static void Prefix(Player __instance, bool ___m_secondaryAttack, bool ___m_secondaryAttackHold) { ItemData currentWeapon = ((Humanoid)__instance).GetCurrentWeapon(); if (WUTIL.IsWildlingObject(currentWeapon.m_dropPrefab)) { Slingshot.ModifyAttack(currentWeapon, ___m_secondaryAttack || ___m_secondaryAttackHold); } } } [HarmonyPatch(typeof(Humanoid), "OnAttackTrigger")] private class PatchHumanoidOnAttackTrigger { private static EffectList m_effectList; private static ItemData m_weapon; public static void Prefix(Humanoid __instance, Attack ___m_currentAttack) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown if (___m_currentAttack != null && !___m_currentAttack.m_bowDraw) { ItemData currentWeapon = __instance.GetCurrentWeapon(); if (WUTIL.ItemName(currentWeapon) == "Chimes") { m_effectList = currentWeapon.m_shared.m_triggerEffect; currentWeapon.m_shared.m_triggerEffect = new EffectList(); currentWeapon.m_shared.m_damages.m_blunt = 8f; currentWeapon.m_shared.m_damages.m_spirit = 0f; m_weapon = currentWeapon; } } } public static void Postfix() { if (m_weapon != null) { m_weapon.m_shared.m_triggerEffect = m_effectList; m_weapon.m_shared.m_damages.m_blunt = 0f; m_weapon.m_shared.m_damages.m_spirit = 200f; m_effectList = null; m_weapon = null; } } } [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(ItemData), typeof(int), typeof(bool), typeof(float), typeof(int) })] private class PatchItemDropItemDataGetTooltip { public static void Prefix(ItemData item) { Slingshot.CheckType(item); CarryItemExtractContent(item); } public static void Postfix(ItemData item, int qualityLevel, ref string __result) { if (!WUTIL.IsWildlingObject(item.m_dropPrefab)) { Crafting.ModifyCraftItemMessage(item, ref __result); } else if (!ModifyItemTooltip(item, qualityLevel, ref __result) && m_customData != "") { __result += CarryItemFormatContent(WUTIL.ItemName(item) == "FoodHamper"); AddDataToItem(item, m_customData); m_customData = ""; } } private static string CarryItemFormatContent(bool food) { string text = "\nContent: "; int num = 0; string[] array = m_customData.Split(new char[1] { '\n' }); foreach (string text2 in array) { if (text2 == "") { continue; } num++; string[] array2 = text2.Split(new char[1] { ',' }); if (food) { string text3 = FoodColor(CreateItemFromRecipe(text2)); text = text + "\n* " + array2[0] + ": " + array2[1] + "/" + array2[2] + ""; continue; } string text4 = StoredItemColor(array2[3]); if (array2[3].StartsWith("Pebble")) { text = text + "\n* " + array2[0] + ": " + array2[1] + "/" + array2[2] + ""; } else { string text5 = ((array2[1] == "1") ? "" : (" [" + array2[1] + "]")); string text6 = (0.01f * (float)int.Parse(array2[2])).ToString("0"); text = text + "\n* " + array2[0] + text5 + ": " + text6 + "%"; } } if (num == 0) { text += " Empty"; } return text; } private static void CarryItemExtractContent(ItemData item) { if (CheckCarryItem(item)) { CarryItemResetQuality(item); if (item.m_quality > 0) { m_customData = GetItemData(item, remove: true); } } } } [HarmonyPatch(typeof(ItemData), "GetWeight")] private class PatcheItemDropItemDataGetWeight { private static void Postfix(ItemData __instance, ref float __result) { if (!CheckCarryItem(__instance)) { return; } string text = ((m_customData == "") ? GetItemData(__instance) : m_customData); string[] array = text.Split(new char[1] { '\n' }); foreach (string text2 in array) { if (!(text2 == "")) { string[] array2 = text2.Split(new char[1] { ',' }); if (array2.Length > 4) { __result += 0.01f * (float)int.Parse(array2[4]); } } } } } [HarmonyPatch(typeof(ItemData), "GetIcon")] private class PatcheItemDropItemDataGetIcon { private static void Prefix(ItemData __instance) { Throwstick.ClutchCheckCapacity(__instance); } } [HarmonyPatch(typeof(ItemData), "GetStatusEffectTooltip")] private class PatcheItemDropItemDataGetStatusEffectTooltip { private static void Postfix(ItemData __instance, int quality, float skillLevel, ref string __result) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Invalid comparison between Unknown and I4 if (__result != "" || (Object)(object)Player.m_localPlayer == (Object)null) { return; } int num = 0; string text = GetRagsEffectName(__instance.m_shared.m_name); string text2 = ""; string text3 = ""; bool flag = __instance.m_shared.m_name == "Dark dyed cuirass"; if (__instance.m_shared.m_name == "Swim shorts" || __instance.m_shared.m_name == "Wildling cap") { text2 = "SE_WildlingBonus"; num = 1; } if (text == "" || flag) { if ((int)__instance.m_shared.m_itemType == 11) { text = "SE_FurShoes"; } string text4 = "Unseen\nHiding and undetected bonus"; if (__instance.m_shared.m_name.StartsWith("Wildling ")) { num = ((!(__instance.m_shared.m_name == "Wildling cape")) ? 1 : 2); if (__instance.m_shared.m_name == "Wildling boots") { text2 = "SE_WildlingBonus"; } else { text = "SE_WildlingBonus"; } } else if (__instance.m_shared.m_setName == "Eathensuit") { text3 = text4 + ", especially in the meadows and plains."; } else if (__instance.m_shared.m_setName == "Shadowsuit" || flag) { text3 = text4 + ", especially in darker places."; } else { if (!(__instance.m_shared.m_setName == "Snowsuit")) { return; } text3 = text4 + " in the snow, but may make you stand out elsewhere."; } } if (text == "" && text3 != "") { __result = text3; return; } StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(text)); if (!((Object)(object)statusEffect != (Object)null)) { return; } __result = "" + statusEffect.m_name + "\n" + statusEffect.GetTooltipString(); if (text3 != "") { __result = __result + "\n" + text3; } if (text2 != "") { statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(text2)); __result = __result + "\n" + statusEffect.m_name + "\n" + statusEffect.GetTooltipString(); } if (num > 0) { SE_Stats val = (SE_Stats)(object)((statusEffect is SE_Stats) ? statusEffect : null); if ((Object)(object)val != (Object)null) { val.m_skillLevelModifier = num; } } } } [HarmonyPatch(typeof(ItemData), "GetSetStatusEffectTooltip")] private class PatcheItemDropItemDataGetSetStatusEffectTooltip { private static void Prefix(ItemData __instance, int quality, float skillLevel) { StatusEffect setStatusEffect = __instance.m_shared.m_setStatusEffect; if (Object.op_Implicit((Object)(object)setStatusEffect)) { SE_Stats val = (SE_Stats)(object)((setStatusEffect is SE_Stats) ? setStatusEffect : null); if (Object.op_Implicit((Object)(object)val) && __instance.m_shared.m_setName == "wildling_armor") { val.m_dodgeStaminaUseModifier = -0.25f; } } } private static void Postfix(ItemData __instance, ref string __result) { if (!(__instance.m_shared.m_name != "Wildling boots")) { StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_FurWarmth")); if (Object.op_Implicit((Object)(object)statusEffect)) { __result = __result + "\n$item_seteffect (" + __instance.m_shared.m_setSize + " $item_parts):" + statusEffect.m_name + "\n" + statusEffect.GetTooltipString(); } } } } public class SE_FurShoes : SE_Stats { public SE_FurShoes() { ((Object)this).name = "SE_FurShoes"; ((StatusEffect)this).m_name = "Fur feet"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TorchCrystalSmall"); ((StatusEffect)this).m_ttl = 0f; base.m_noiseModifier = -0.1f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return !Wildling.IsWildling; } public override string GetIconText() { return ""; } } public class SE_FurWarmth : SE_Stats { public SE_FurWarmth() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = "SE_FurWarmth"; ((StatusEffect)this).m_name = "All furs"; ((StatusEffect)this).m_tooltip = "Wearing a full set of fur armor protects you from the cold."; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TorchCrystal"); ((StatusEffect)this).m_ttl = 0f; base.m_noiseModifier = -0.1f; base.m_mods.Add(new DamageModPair { m_type = (DamageType)64, m_modifier = (DamageModifier)1 }); } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return !Wildling.IsWildling; } } public class SE_WildlingBonus : SE_Stats { public SE_WildlingBonus() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = "SE_WildlingBonus"; ((StatusEffect)this).m_name = "Wildling Wear"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TorchCrystalWall"); ((StatusEffect)this).m_ttl = 0f; base.m_skillLevel = Wildling.WildlingSkill; base.m_skillLevelModifier = 100f * SkillClothingBuff; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return base.m_skillLevelModifier == 0f || !Wildling.IsWildling; } public override string GetIconText() { base.m_skillLevelModifier = 0.1f * (float)(int)(1000f * SkillClothingBuff); return ((base.m_skillLevelModifier < 0f) ? "" : "+") + base.m_skillLevelModifier.ToString("0.#"); } } public class SE_RagsStalk : SE_Stats { public SE_RagsStalk() { ((Object)this).name = "SE_RagsStalk"; ((StatusEffect)this).m_name = "Fox legs"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TunicRagsDark"); ((StatusEffect)this).m_ttl = 0f; base.m_sneakStaminaUseModifier = -0.2f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return !Wildling.IsWildling; } } public class SE_RagsJump : SE_Stats { public SE_RagsJump() { //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) ((Object)this).name = "SE_RagsJump"; ((StatusEffect)this).m_name = "Frog legs"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TunicRagsLight"); ((StatusEffect)this).m_ttl = 0f; base.m_jumpModifier = new Vector3(0f, 0.2f, 0f); base.m_fallDamageModifier = -0.5f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return !Wildling.IsWildling; } } public class SE_RagsAttack : SE_Stats { public SE_RagsAttack() { ((Object)this).name = "SE_RagsAttack"; ((StatusEffect)this).m_name = "Riled"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TunicRagsRed"); ((StatusEffect)this).m_ttl = 0f; base.m_attackStaminaUseModifier = -0.25f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return !Wildling.IsWildling; } } public class SE_RagsAttackDamage : SE_Stats { public SE_RagsAttackDamage() { ((Object)this).name = "SE_RagsAttackDamage"; ((StatusEffect)this).m_name = "Adroit"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TunicRagsPurple"); ((StatusEffect)this).m_ttl = 0f; base.m_attackStaminaUseModifier = -0.05f; base.m_percentigeDamageModifiers.m_blunt = 0.1f; base.m_percentigeDamageModifiers.m_slash = 0.1f; base.m_percentigeDamageModifiers.m_pierce = 0.1f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return !Wildling.IsWildling; } } public class SE_RagsSwim : SE_Stats { public SE_RagsSwim() { ((Object)this).name = "SE_RagsSwim"; ((StatusEffect)this).m_name = "Buoyancy"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("TunicRagsOrange"); ((StatusEffect)this).m_ttl = 0f; base.m_swimStaminaUseModifier = -0.5f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return !Wildling.IsWildling; } } public class SE_RagsSwimSkill : SE_Stats { public SE_RagsSwimSkill() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = "SE_RagsSwimSkill"; ((StatusEffect)this).m_name = "Waterborn"; ((StatusEffect)this).m_tooltip = ""; ((StatusEffect)this).m_icon = WUTIL.GetIcon("PantsRagsSwim"); ((StatusEffect)this).m_ttl = 0f; base.m_skillLevel = (SkillType)103; base.m_skillLevelModifier = 5f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override bool IsDone() { return base.m_skillLevelModifier == 0f || !Wildling.IsWildling; } } public class SE_RagsFocus : SE_Stats { public SE_RagsFocus() { ((Object)this).name = "SE_RagsFocus"; ((StatusEffect)this).m_name = "Focus"; ((StatusEffect)this).m_tooltip = "Allows you to pull on a slignshot a bit faster and use less stamina holding on to your shot."; ((StatusEffect)this).m_icon = WUTIL.GetIcon("HoodRagsWildling"); ((StatusEffect)this).m_ttl = 0f; } public override bool CanAdd(Character character) { return character.IsPlayer() && Wildling.IsWildling; } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); Slingshot.SetDrawFactor(0.8f); } public override bool IsDone() { return !Wildling.IsWildling; } public override void Stop() { Slingshot.SetDrawFactor(); } } [HarmonyPatch(typeof(Humanoid), "DrainEquipedItemDurability")] private class PatchHumanoidDrainEquipedItemDurability { private static bool Prefix(Humanoid __instance, ItemData item, float dt) { if (((Character)__instance).IsPlayer()) { string text = WUTIL.ItemName(item, goName: false); if (text == "Match") { if (item.m_durability - item.m_shared.m_durabilityDrain <= 0f) { if (item.m_stack > 1) { WUTIL.Message(text + " broke.", center: false, item.GetIcon()); item.m_stack--; item.m_durability = item.GetMaxDurability(item.m_quality); __instance.UnequipItem(item, false); return false; } item.m_shared.m_destroyBroken = true; } else { UpdateStatusEffect("Cold", add: false); } } } return true; } } [HarmonyPatch(typeof(Humanoid), "Pickup")] private class PatchHumanoidPickup { private static void Prefix(Humanoid __instance, GameObject go) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { Throwstick.Pickup(go); } } private static void Postfix(Humanoid __instance, GameObject go, ref bool __result) { if (__result && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { if (WUTIL.IsWildlingObject(go) || WUTIL.GameName(go) == "PickaxeStone") { Quest.CollectItem(WUTIL.GameName(go)); } ItemData itemData = go.GetComponent().m_itemData; if (itemData.m_equipped && !WUTIL.EquipPermitted(itemData)) { __instance.UnequipItem(itemData, true); } } } } [HarmonyPatch(typeof(Inventory), "CanAddItem", new Type[] { typeof(ItemData), typeof(int) })] private class PatchInventoryCanAddItem { private static bool Prefix(ItemData item, ref bool __result) { if (item.m_shared.m_setName == "WildlingPigment") { WDBUG.Log("Faking inventory space for Hairdye", WDBUG.Level.Crafting); __result = true; return false; } return true; } private static void Postfix(ItemData item, ref bool __result) { if (!__result) { __result = Throwstick.ClutchCanLoad(item); } } } [HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(ItemData) })] private class PatchInventoryAddItem { public static bool m_addItemDirect; private static bool Prefix(ItemData item, Inventory __instance, ref bool __result, List ___m_inventory) { //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.ItemName(item); if (m_addItemDirect) { WDBUG.Log($"Forced inventory add {item.m_stack}x {text} at {item.m_gridPos.x},{item.m_gridPos.x} ownerID: {item.m_crafterID}"); m_addItemDirect = false; __result = true; ___m_inventory.Add(item); return false; } if ((Object)(object)Player.m_localPlayer != (Object)null && __instance != ((Humanoid)Player.m_localPlayer).GetInventory()) { return true; } if (Throwstick.Pickup(item)) { __result = true; return false; } if (Loki.CustomizeThorscorn(item) || Fairy.CustomizeBook(item)) { return true; } Alignment.CheckRecentExchangeDrops(text, -1); if (text != "Match") { return true; } float maxDurability = item.GetMaxDurability(item.m_quality); float num = maxDurability - 0.1f; if (item.m_durability >= num) { item.m_durability = maxDurability; return true; } WDBUG.Log($"Merging {item.m_stack} matches, durability: {item.m_durability} / {maxDurability}", WDBUG.Level.Matches); bool flag = false; ItemData[] array = ___m_inventory.ToArray(); foreach (ItemData val in array) { if (WUTIL.ItemName(val) == text && val.m_quality == item.m_quality && val.m_stack < val.m_shared.m_maxStackSize) { int num2 = Mathf.Min(val.m_shared.m_maxStackSize - val.m_stack, item.m_stack - 1); val.m_stack += num2; item.m_stack -= num2; if (item.m_stack == 1 && val.m_stack < val.m_shared.m_maxStackSize && item.m_durability >= num) { val.m_stack++; item.m_stack--; flag = true; break; } } } for (int j = 0; j < __instance.GetHeight(); j++) { if (flag) { break; } for (int k = 0; k < __instance.GetWidth(); k++) { if (__instance.GetItemAt(k, j) == null) { item.m_gridPos = new Vector2i(k, j); flag = true; break; } } } __instance.RemoveItem(item, 0); __result = flag; return false; } } [HarmonyPatch(typeof(InventoryGrid), "DropItem")] private class PatchInventoryGridDropItem { private static bool Prefix(Inventory ___m_inventory, ref bool __result, Inventory fromInventory, ItemData item, int amount, Vector2i pos) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.ItemName(item); if (text != "Match") { return true; } float maxDurability = item.GetMaxDurability(item.m_quality); bool flag = item.m_durability < maxDurability - 0.1f; bool flag2 = item.m_stack > amount; ItemData itemAt = ___m_inventory.GetItemAt(pos.x, pos.y); if (itemAt == null) { if (flag2) { WDBUG.Log($"Adding {amount} new {text} to empty slot", WDBUG.Level.Matches); __result = ___m_inventory.MoveItemToThis(fromInventory, item, amount, pos.x, pos.y); ___m_inventory.GetItemAt(pos.x, pos.y).m_durability = maxDurability; return false; } } else if (itemAt != item && text == WUTIL.ItemName(itemAt) && item.m_quality == itemAt.m_quality && itemAt.m_stack < itemAt.m_shared.m_maxStackSize) { float durability = itemAt.m_durability; if (flag && !flag2) { if (itemAt.m_durability < maxDurability - 0.1f) { amount--; WDBUG.Log($"Cannot add used Match to used stack, adding {itemAt.m_shared.m_maxStackSize - itemAt.m_stack}/{amount} new", WDBUG.Level.Matches); if (itemAt.m_stack < itemAt.m_shared.m_maxStackSize) { WUTIL.Message("You may only have one used " + text + " in a stack."); } } else if (itemAt.m_stack + amount <= itemAt.m_shared.m_maxStackSize) { durability = item.m_durability; WDBUG.Log($"Adding {itemAt.m_shared.m_maxStackSize - itemAt.m_stack}/{amount} new matches", WDBUG.Level.Matches); } else { WDBUG.Log($"Adding unused {amount} Matches to stack at {durability}", WDBUG.Level.Matches); } } __result = ___m_inventory.MoveItemToThis(fromInventory, item, amount, pos.x, pos.y); ___m_inventory.GetItemAt(pos.x, pos.y).m_durability = durability; return false; } return true; } private static void Postfix(Inventory ___m_inventory, bool __result, ItemData item, Vector2i pos) { if (__result) { WUTIL.TimerReset("EquipClothingDisable", 0.1f); } } } [HarmonyPatch(typeof(ItemDrop), "DropItem")] private class PatchItemDropDropItem { private static void Prefix(ItemData item) { ElderWand.Equip(item, ElderWand.WandAction.drop); } private static void Postfix(ItemDrop __result) { World.TrackDroppedItem(__result); } } [HarmonyPatch(typeof(Humanoid), "DropItem")] private class PatchHumanoidDropItem { private static void Prefix(Humanoid __instance, Inventory inventory, ItemData item) { if (item != null && ((Character)__instance).IsPlayer() && inventory.ContainsItem(item) && (Object)(object)item.m_dropPrefab == (Object)null) { WUTIL.FixItemPrefab(item, "PatchHumanoidDropItem"); if (!((Object)(object)item.m_dropPrefab == (Object)null)) { } } } private static void Postfix(Humanoid __instance, ItemData item, int amount, ref bool __result) { if (__result && ((Character)__instance).IsPlayer()) { string text = WUTIL.ItemName(item); if (text == "Match") { WDBUG.Log("Player dropped " + text + " from inventory", WDBUG.Level.Matches); item.m_durability = item.GetMaxDurability(item.m_quality); } else if (text == "MagicChest") { WDBUG.Log("Player dropped " + text + " from inventory", WDBUG.Level.MagicChest); } else { WDBUG.Log("Player dropped " + text + " from inventory", WDBUG.Level.Barter); Alignment.PlayerDroppedItem(item, amount); } } } } [HarmonyPatch(typeof(Player), "ToggleEquipped")] private class PatchPlayerToggleEquipped { private static bool m_skipRecursiveCall; private static bool Prefix(ref bool __result, ItemData item) { if (m_skipRecursiveCall) { return true; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || !item.IsEquipable()) { return true; } __result = true; if (localPlayer.IsEquipActionQueued(item)) { CheckUnunequipDeferredItem(item); } MagicChest.CheckSideEffects(item); bool flag = !((Humanoid)localPlayer).IsItemEquiped(item); if (flag) { if (!WUTIL.EquipPermitted(item)) { WUTIL.Message("You cannot use " + WUTIL.ItemName(item, goName: false) + "."); return false; } if (FoodHamperEquip(item) || AmmoPouchEquip(item)) { return false; } m_skipRecursiveCall = true; if (ClothSackEquip(item)) { m_skipRecursiveCall = false; return false; } m_skipRecursiveCall = false; if (MagicChest.BlockEquip(item)) { WUTIL.Message("You may not equip a second " + WUTIL.ItemName(item, goName: false)); return false; } } Slingshot.AmmoToggle(item, flag); Throwstick.ClutchToggle(item, flag); Fairy.OpenBook(item, flag); Fairy.ReadPage(item, flag); Loki.ReadLetter(item, flag); ElderWand.ReadScroll(item, flag); return true; } } [HarmonyPatch(typeof(Humanoid), "UnequipItem")] private class PatchHumanoidUnequipItem { private static bool Prefix(Humanoid __instance, ItemData item) { if (((Character)__instance).IsPlayer() && item != null && (Object)(object)item.m_dropPrefab == (Object)null) { WUTIL.FixItemPrefab(item, "PatchHumanoidUnequipItem"); } return true; } private static void Postfix(Humanoid __instance, ItemData item) { if (!Pocket.InventoryItemJustSelected() && item != null && ((Character)__instance).IsPlayer()) { if (WUTIL.m_allowCustomEquip) { EquipClothing(item, equip: false); Throwstick.Equip(item, equip: false); ElderWand.Equip(item, ElderWand.WandAction.unequip); Slingshot.PostEquipUpdate(item, equip: false); Crafting.PestleAndMortarEnable(item, enable: false); } DefferedUnequipAction(item); } } } [HarmonyPatch(typeof(Humanoid), "EquipItem")] private class PatchHumanoidEquipItem { private static void Prefix(Humanoid __instance, ItemData item) { if (((Character)__instance).IsPlayer() && item != null) { if ((Object)(object)item.m_dropPrefab == (Object)null) { WUTIL.FixItemPrefab(item, "PatchHumanoidEquipItem"); } else { ElderWand.Equip(item); } } } private static void Postfix(Humanoid __instance, ItemData item) { if (item != null && ((Character)__instance).IsPlayer() && WUTIL.m_allowCustomEquip) { EquipClothing(item, equip: true); Throwstick.Equip(item); ElderWand.Equip(item, ElderWand.WandAction.equip); Slingshot.PostEquipUpdate(item, equip: true); Crafting.PestleAndMortarEnable(item, enable: true); } } } [HarmonyPatch(typeof(Player), "UseHotbarItem")] private class PatchPlayerUseHotbarItem { public static bool Prefix(int index, Inventory ___m_inventory) { ItemData itemAt = ___m_inventory.GetItemAt(index - 1, 0); if (itemAt != null) { if (WUTIL.GetButton("Block")) { int num = ((!Input.GetKey((KeyCode)308)) ? 1 : itemAt.m_stack); string text = WUTIL.ItemName(itemAt); string text2 = text; if (text2 == "HealingSalve" || text2 == "PatchKit") { num = itemAt.m_stack; } WUTIL.Message("Yeet!", center: true, WUTIL.GetIcon(itemAt.m_dropPrefab, itemAt.m_variant), blockNext: true); ((Humanoid)Player.m_localPlayer).DropItem(___m_inventory, itemAt, num); return false; } if (WDBUG.UseDebugItem(itemAt, index)) { return false; } } return true; } } public static bool m_weaponObjectivePass = false; public static bool m_justThrewPebble = false; public static float SkillClothingBuff = 0f; public static float HideClothingBuff = 0f; private const string c_customItemBind = "\n\tWT*%#@"; private const int c_defaultMaxStacks = 4; private const int c_pouchMaxStacks = 4; private const int c_hamperMaxStacks = 4; private const float c_hamperStackFraction = 0.4f; private const float c_pouchStackFraction = 0.25f; private const float c_fursBuffScale = 2f; private const float c_tooltipCooldown = 2f; private static bool m_allFurBonus = false; private static bool m_furFeetBonus = false; private static string m_lastTooltipItem = ""; private static string m_customData = ""; private static ItemData m_deferredSackReference = null; private static Dictionary m_deferredSackExchange = new Dictionary(); private static List m_equippedClothing = new List(); public static void Reset() { SkillClothingBuff = 0f; HideClothingBuff = 0f; m_allFurBonus = false; m_furFeetBonus = false; m_equippedClothing.Clear(); } private static bool ModifyAttack(Attack attack, Character player, string weaponName) { //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) m_weaponObjectivePass = false; m_justThrewPebble = weaponName.StartsWith("Pebble"); if (m_justThrewPebble || weaponName == "" || weaponName == "Chimes" || weaponName.StartsWith("Slingshot")) { if (weaponName == "" && Throwstick.ClutchAnimating(hold: true)) { WDBUG.Log(string.Format("Prevent {0} at {1}", attack.m_attackAnimation, WUTIL.Timer("c_clutchLastThrowCooldown")), WDBUG.Level.Throwstick); return false; } if (Wildling.IsWildling && player.IsCrouching()) { if (Quest.GetAchievement("MainTutorial") == 2) { Quest.SetAchievement("MainTutorial", 3); } if (attack.m_attackAnimation == "unarmed_kick") { attack.m_specialHitSkill = (SkillType)11; attack.m_attackAnimation = "knife_secondary"; attack.m_attackType = (AttackType)1; attack.m_attackChainLevels = 0; attack.m_damageMultiplier *= 3f; m_weaponObjectivePass = weaponName != ""; } } return true; } m_weaponObjectivePass = true; if (weaponName.StartsWith("Throwstick")) { if (Throwstick.ClutchAnimating()) { WDBUG.Log(string.Format("Prevent {0} at {1}", attack.m_attackAnimation, WUTIL.Timer("c_clutchLastThrowCooldown")), WDBUG.Level.Throwstick); return false; } Throwstick.ModifyAttack(attack, weaponName); } else { switch (weaponName) { case "Digger": if (Digger.ModifyAttack(attack)) { return false; } break; case "ElderWand": ElderWand.ModifyAttack(attack); break; case "Match": m_weaponObjectivePass = false; if (attack.m_attackAnimation == "battleaxe_secondary") { if (player.IsCrouching()) { attack.m_attackAnimation = "knife_secondary"; attack.m_attackType = (AttackType)1; attack.m_attackChainLevels = 0; attack.m_damageMultiplier *= 3f; attack.m_hitTerrain = true; m_weaponObjectivePass = true; } } else if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "spear_poke"; attack.m_attackChainLevels = 0; attack.m_damageMultiplier *= 0.6f; attack.m_forceMultiplier *= 0.6f; attack.m_staggerMultiplier *= 0.6f; attack.m_attackAngle = 5f; attack.m_attackRayWidth = 0.1f; m_weaponObjectivePass = true; } break; case "SharpenedStick": if (attack.m_attackAnimation == "sword_secondary") { if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "battleaxe_secondary"; attack.m_damageMultiplier *= 0.7f; attack.m_forceMultiplier *= 0.7f; attack.m_staggerMultiplier *= 0.7f; } else if (player.IsCrouching()) { attack.m_attackAnimation = "knife_secondary"; attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; } } else { m_weaponObjectivePass = false; } break; case "Sparx": Loki.ModifySparxAttack(attack, player.IsCrouching()); break; case "Thorscorn": Loki.ModifyThorscornAttack(attack); break; case "Stick": m_weaponObjectivePass = false; if (attack.m_attackAnimation == "mace_secondary") { if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "spear_poke"; attack.m_damageMultiplier *= 0.7f; attack.m_forceMultiplier *= 0.7f; attack.m_staggerMultiplier *= 0.7f; m_weaponObjectivePass = true; } else if (player.IsCrouching()) { attack.m_attackAnimation = "swing_pickaxe"; attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; m_weaponObjectivePass = true; } } break; case "SurtlingSpike": if (attack.m_attackAnimation == "knife_secondary") { if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "battleaxe_secondary"; attack.m_attackType = (AttackType)0; attack.m_damageMultiplier *= 0.8f; attack.m_forceMultiplier *= 0.8f; attack.m_staggerMultiplier *= 0.8f; attack.m_hitTerrain = false; } else if (((Character)Player.m_localPlayer).IsCrouching()) { attack.m_attackAnimation = "sword_secondary"; attack.m_specialHitSkill = (SkillType)7; attack.m_hitTerrain = false; } } Quest.ShowMainTutorial(10); break; default: m_weaponObjectivePass = false; break; } } return true; } private static bool ModifyItemTooltip(ItemData item, int qualityLevel, ref string description) { //IL_04ec: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.ItemName(item); int num = Slingshot.GetType(text); if (num >= 0) { text = "# SLIGNSHOT #"; } bool flag = text != m_lastTooltipItem; string text2 = ""; string text3 = ""; switch (text) { case "# SLIGNSHOT #": num += 4 + qualityLevel; text2 = text2 + "\nShot Damage: " + num + "x"; text2 += "\nPunch: [Attack] (unloaded)"; text2 += "\nKick: [2nd Attack]"; text2 += "\nPounce: [Crouch] + [2nd Attack]"; break; case "Match": text2 += "\nClub: [Block] + [Attack]"; text2 += "\nPounce: [Couch] + [2nd Attack]"; break; case "Chimes": text2 += "\nKick: [2nd Attack]"; text2 += "\nPounce: [Couch] + [2nd Attack]"; break; case "Throwstick": case "ThrowstickPoisoned": text2 += "\nPoke: [Block] + [Attack]"; text2 += "\nCombo: [Block] + [Hold Attack] + [Move F]"; text2 += "\nSwing: [Block] + [Attack] + [Move L/R]"; text2 += "\nPound: [Block] + [Attack] + [Move B]"; text2 += "\nHigh pound: [Jump] + [Attack]"; text2 += "\nPounce: [Crouch] + [Attack] + [Move B]"; break; case "Digger": text2 += "\nDig/Fill: [Attack]"; text2 += "\nTill/Plant: [Crouch] + [Attack]"; text2 += "\nWhack: [Block] + [Attack]"; text2 += "\nSwing: [2nd Attack]"; text2 += "\nPounce: [Crouch] + [2nd Attack]"; break; case "ElderWand": text2 += "\nThrust: [Block] + [Attack]"; text2 += "\nLow pound: [Crouch] + [Attack]"; text2 += "\nHigh pound: [Jump] + [Attack]"; text2 += "\nSwing: [Block] + [2nd Attack]"; if (ElderWand.IsPowered()) { text2 += "\nSignal Rally: Equip in Right Hand"; text2 += "\nSignal Attack: Equip in Left Hand"; text2 += "\nSignal Defend: Ready on back"; text2 += "\nSignal Retreat: Swap to Right Hand"; text2 = text2 + "\nHeal or Promote Recruit: " + WUTIL.KeyHighlightText("Use"); } break; case "SharpenedStick": text2 += "\nStab: [Block] + [2nd Attack]"; text2 += "\nPounce: [Crouch] + [2nd Attack]"; break; case "Stick": text2 += "\nPommel: [Block] + [2nd Attack]"; text2 += "\nWhack: [Crouch] + [2nd Attack]"; break; case "SurtlingSpike": text2 += "\nLow thrust: [Crouch] + [2nd Attack]"; text2 += "\nParry poke: [Block] + [2nd Attack]"; break; case "Thorscorn": text2 += "\nThunderball: [2nd Attack]"; text2 += "\nThunderbolt: [Block] + [2nd Attack]"; break; case "Sparx": text2 += "\nShock blast: [2nd Attack]"; text2 += "\nShock wave: [Crouch] + [2nd Attack]"; text2 += "\nShock sweep: [Block] + [2nd Attack]"; break; default: if (m_lastTooltipItem != "") { WUTIL.TimerReset("tooltipCooldown"); m_lastTooltipItem = ""; } return false; } if (flag) { WUTIL.TimerReset("tooltipCooldown", 2f); m_lastTooltipItem = text; text2 = "\n..."; } else if (WUTIL.Timer("tooltipCooldown") > 0f) { text2 = "\n..."; } else if (num >= 0) { item.m_shared.m_itemType = (ItemType)5; } if (text3 != "") { int num2 = description.IndexOf(text3); if (num2 >= 0) { num2 += text3.Length; description = description.Remove(num2) + text2 + description.Substring(num2); return true; } } description += text2; return true; } public static bool ClothSackEquip(ItemData sack) { //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Invalid comparison between Unknown and I4 //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Invalid comparison between Unknown and I4 //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Invalid comparison between Unknown and I4 //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Invalid comparison between Unknown and I4 //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Invalid comparison between Unknown and I4 //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Invalid comparison between Unknown and I4 //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Invalid comparison between Unknown and I4 //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Invalid comparison between Unknown and I4 //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 if (!WUTIL.ItemName(sack).StartsWith("ClothSack")) { return false; } bool flag = sack.m_gridPos.y == 0 && !InventoryGui.IsVisible(); bool flag2 = AltActionKey(); int num = ((sack.m_shared.m_maxStackSize <= 1) ? sack.m_quality : 0); bool flag3 = num == 0; bool flag4 = num < 4; ItemData val = null; ItemData sackItem = null; ItemData val2 = null; ItemData sackItem2 = null; ItemData val3 = null; ItemData sackItem3 = null; ItemData val4 = null; ItemData sackItem4 = null; int num2 = 0; if (flag2 || flag4) { Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); int width = inventory.GetWidth(); foreach (ItemData allItem in inventory.GetAllItems()) { if (allItem.m_equipped != flag2 || !WUTIL.IsWildlingObject(allItem.m_dropPrefab)) { continue; } int itemInventoryIndex = GetItemInventoryIndex(allItem, width); ItemType itemType = allItem.m_shared.m_itemType; ItemType val5 = itemType; if ((int)val5 <= 7) { if ((int)val5 != 6) { if ((int)val5 == 7 && itemInventoryIndex < GetItemInventoryIndex(val, width)) { val = allItem; num2 |= 1; } } else if (itemInventoryIndex < GetItemInventoryIndex(val2, width)) { val2 = allItem; num2 |= 2; } } else if ((int)val5 != 11) { if ((int)val5 == 17 && itemInventoryIndex < GetItemInventoryIndex(val4, width)) { val4 = allItem; num2 |= 8; } } else if (itemInventoryIndex < GetItemInventoryIndex(val3, width)) { val3 = allItem; num2 |= 4; } } if (num2 == 0 && flag3) { if (flag2) { WUTIL.Message("Equip clothing first to pack."); } else { WUTIL.Message("No unequipped clothing to pack.", !flag); } return true; } if (sack.m_shared.m_maxStackSize > 1 && sack.m_stack > 1 && inventory.GetEmptySlots() == 0) { WUTIL.Message("No space in inventory for a packed sack.", !flag); return true; } } string itemData = GetItemData(sack, remove: true); string[] array = itemData.Split(new char[1] { '\n' }); foreach (string text in array) { ItemData val6 = CreateItemFromRecipe(text); if (val6 == null) { continue; } ItemType itemType2 = val6.m_shared.m_itemType; ItemType val7 = itemType2; if ((int)val7 <= 7) { if ((int)val7 == 6) { sackItem2 = val6; continue; } if ((int)val7 == 7) { sackItem = val6; continue; } } else { if ((int)val7 == 11) { sackItem3 = val6; continue; } if ((int)val7 == 17) { sackItem4 = val6; continue; } } WDBUG.Log("WARNING: Ignoring illegal item for Sack recipe: " + text); } if (flag3 && sack.m_shared.m_maxStackSize > 1) { sack = ReplaceInventoryItem(sack, "ClothSack"); } bool loadOnly = num2 > 0 && flag4 && !flag2; m_deferredSackExchange.Clear(); itemData = SackExchangeItems(sackItem, val, sack, flag2, loadOnly); itemData += SackExchangeItems(sackItem2, val2, sack, flag2, loadOnly); itemData += SackExchangeItems(sackItem3, val3, sack, flag2, loadOnly); itemData += SackExchangeItems(sackItem4, val4, sack, flag2, loadOnly); AddDataToItem(sack, itemData); CarryItemResetQuality(sack); SackUpdateToContent(sack); if (m_deferredSackExchange.Count == 0 && sack.m_shared.m_maxStackSize == 1 && sack.m_quality == 0) { ReplaceInventoryItem(sack, "ClothSackEmpty"); } if (flag && num != sack.m_quality) { string text2 = ((num < sack.m_quality) ? "to" : "from"); WUTIL.Message("Clothing moved " + text2 + " " + WUTIL.ItemName(sack, goName: false) + "."); } return true; } public static bool FoodHamperEquip(ItemData hamper) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 if (WUTIL.ItemName(hamper) != "FoodHamper") { return false; } bool flag = hamper.m_gridPos.y == 0 && !InventoryGui.IsVisible(); bool flag2 = AltActionKey(); WDBUG.Log("FoodHamper unload: " + flag2, WDBUG.Level.FoodHamper); string itemData = GetItemData(hamper, remove: true); List list = new List(); string[] array = itemData.Split(new char[1] { '\n' }); foreach (string recipe in array) { ItemData val = CreateItemFromRecipe(recipe); if (val != null) { list.Add(val); } } Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); List list2 = new List(); int num = 9999; int width = inventory.GetWidth(); ItemData val2 = null; foreach (ItemData allItem in inventory.GetAllItems()) { if ((int)allItem.m_shared.m_itemType != 2 || !(allItem.m_shared.m_foodBurnTime > 0f) || !(allItem.m_shared.m_foodRegen > 0f) || (!(allItem.m_shared.m_food > 0f) && !(allItem.m_shared.m_foodStamina > 0f))) { continue; } list2.Add(allItem); bool flag3 = false; foreach (ItemData item in list) { if (item.m_shared.m_name == allItem.m_shared.m_name) { flag3 = true; break; } } if (!flag3) { int itemInventoryIndex = GetItemInventoryIndex(allItem, width); if (itemInventoryIndex < num || (itemInventoryIndex == num && allItem.m_stack > val2.m_stack)) { val2 = allItem; num = itemInventoryIndex; } } } string text = ""; if (flag2) { if (list.Count == 0) { WUTIL.Message("Hamper is empty."); return true; } int num2 = 0; int num3 = 0; ItemData[] array2 = list.ToArray(); foreach (ItemData val3 in array2) { num3 += val3.m_stack; int num4 = inventory.CountItems(val3.m_shared.m_name, -1, true); if (!inventory.AddItem(val3)) { continue; } int num5 = inventory.CountItems(val3.m_shared.m_name, -1, true) - num4; if (num5 > 0) { WDBUG.Log($"Added {num5} {WUTIL.ItemName(val3)} to inventory vs. Hamper stack {val3.m_stack}", WDBUG.Level.FoodHamper); num2 += num5; if (val3.m_stack == num5) { list.Remove(val3); } else { val3.m_stack -= num5; } } } if (num2 == 0) { WUTIL.Message("No space to move items from the hamper", !flag); } else if (num2 == num3) { WUTIL.Message("Hamper emptied to inventory", !flag); } else { WDBUG.Log($"Emptied {num2} items from the hamper", WDBUG.Level.FoodHamper); } } else if (list2.Count == 0) { WUTIL.Message("No suitable food items to move to the hamper", !flag); } else { bool flag4 = false; int num6 = 0; foreach (ItemData item2 in list) { int num7 = (int)(0.5f + 0.4f * (float)item2.m_shared.m_maxStackSize); int num8 = num7 - item2.m_stack; if (num8 <= 0) { continue; } num6 += num8; foreach (ItemData item3 in list2) { if (item3.m_shared.m_name == item2.m_shared.m_name) { int num9 = Math.Min(num8, item3.m_stack); WDBUG.Log($"Moving {num9} stack from {item3.m_stack}x {WUTIL.ItemName(item3)} to Hamper", WDBUG.Level.FoodHamper); inventory.RemoveItem(item3, num9); item2.m_stack += num9; flag4 = true; break; } } if (!flag4) { continue; } break; } if (!flag4) { if (list.Count >= 4) { if (num6 == 0 && !flag) { WUTIL.Message("Hamper is full. Use the Shift key to unload.", !flag); } else { WUTIL.Message("Hamper cannot hold more food items from your inventory.", !flag); } } else if (val2 == null) { WUTIL.Message("No suitable food items in your inventory.", !flag); } else { string recipe2 = MakeItemRecipe(val2, 0.4f); ItemData val4 = CreateItemFromRecipe(recipe2); WDBUG.Log($"Moving new stack {WUTIL.ItemName(val4)} x{val4.m_stack} to Hamper", WDBUG.Level.FoodHamper); inventory.RemoveItem(val2, val4.m_stack); list.Add(val4); if (flag) { WUTIL.Message($"Moved {WUTIL.ItemName(val4, goName: false)} x{val4.m_stack} to Hamper", !flag); } } } } foreach (ItemData item4 in list) { text += MakeItemRecipe(item4, 0.4f); } AddDataToItem(hamper, text); CarryItemResetQuality(hamper); inventory.RemoveItem(hamper, 0); return true; } public static bool AmmoPouchEquip(ItemData pouch) { if (WUTIL.ItemName(pouch) != "AmmoPouch") { return false; } bool flag = pouch.m_gridPos.y == 0 && !InventoryGui.IsVisible(); bool flag2 = flag || AltActionKey(); string text = WUTIL.ItemName(pouch, goName: false); string itemData = GetItemData(pouch, remove: true); List list = new List(); int num = 0; int num2 = 0; string[] array = itemData.Split(new char[1] { '\n' }); foreach (string recipe in array) { ItemData val = CreateItemFromRecipe(recipe); if (val != null) { int num3 = Slingshot.AmmoPower(WUTIL.ItemName(val), biasLastUsed: true); if (num3 > num) { num = num3; list.Insert(0, val); } else { list.Add(val); } num2 += val.m_stack; } } bool flag3 = !flag2; bool flag4 = flag; Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); List list2 = new List(); int num4 = 9999; int width = inventory.GetWidth(); ItemData val2 = null; foreach (ItemData allItem in inventory.GetAllItems()) { if ((flag3 && allItem.m_equipped) || !WUTIL.ItemName(allItem).StartsWith("Pebble")) { continue; } list2.Add(allItem); if (flag4 && allItem.m_equipped && allItem.m_stack < allItem.m_shared.m_maxStackSize) { foreach (ItemData item in list) { if (allItem.m_shared.m_name == item.m_shared.m_name) { val2 = allItem; num4 = -1; break; } } } else if (num4 > 0) { int itemInventoryIndex = GetItemInventoryIndex(allItem, width); if (itemInventoryIndex < num4 || (itemInventoryIndex == num4 && allItem.m_stack > val2.m_stack)) { val2 = allItem; num4 = itemInventoryIndex; } } } string text2 = ""; if (flag2) { if (list.Count == 0) { WUTIL.Message(text + " is empty.", !flag); return true; } int num5 = 0; ItemData[] array2 = list.ToArray(); foreach (ItemData val3 in array2) { if (num4 < 0 && val3.m_shared.m_name != val2.m_shared.m_name) { continue; } int num6 = inventory.CountItems(val3.m_shared.m_name, -1, true); if (!inventory.AddItem(val3)) { continue; } int num7 = inventory.CountItems(val3.m_shared.m_name, -1, true) - num6; if (num7 > 0) { WDBUG.Log($"Added {num7} {WUTIL.ItemName(val3)} to inventory vs. {text} stack {val3.m_stack}", WDBUG.Level.AmmoPouch); num5 += num7; val2 = val3; if (val3.m_stack == num7) { list.Remove(val3); } else { val3.m_stack -= num7; } if (flag4) { break; } } } if (num5 == 0) { WUTIL.Message("No space in inventory to move items from " + text + ".", !flag); } else if (flag4) { string text3 = WUTIL.ItemName(val2, goName: false); string text4 = ((num4 < 0) ? "Reloaded" : "Unloaded"); WUTIL.Message($"{text4} {num5}x {text3} from {text}.", center: true, val2.GetIcon()); Slingshot.SaveAmmoType(val2); Slingshot.ReloadUpdate(); } else if (num5 == num2) { WUTIL.Message(text + " emptied to inventory.", !flag); } else { WDBUG.Log($"{num5} ammo moved from {text} to inventory.", WDBUG.Level.AmmoPouch); } } else if (list2.Count == 0) { WUTIL.Message("No suitable items to move to the " + text + ".", !flag); } else { bool flag5 = false; int num8 = 0; foreach (ItemData item2 in list) { int num9 = (int)(0.5f + 0.25f * (float)item2.m_shared.m_maxStackSize); int num10 = num9 - item2.m_stack; if (num10 <= 0) { continue; } num8 += num10; foreach (ItemData item3 in list2) { if (item3.m_shared.m_name == item2.m_shared.m_name) { int num11 = Math.Min(num10, item3.m_stack); WDBUG.Log($"Moving {num11} from {item3.m_stack}x {WUTIL.ItemName(item3)} to AmmoPouch", WDBUG.Level.AmmoPouch); inventory.RemoveItem(item3, num11); item2.m_stack += num11; flag5 = true; break; } } if (!flag5) { continue; } break; } if (!flag5) { if (list.Count >= 4) { if (num8 == 0) { WUTIL.Message(text + " is full. Use the Shift key to unload.", !flag); } else { WUTIL.Message(text + " cannot hold more items from your inventory.", !flag); } } else if (val2 == null) { WUTIL.Message("No suitable slignshot ammunition in your inventory.", !flag); } else { string recipe2 = MakeItemRecipe(val2, 0.25f); ItemData val4 = CreateItemFromRecipe(recipe2); WDBUG.Log($"Moving new stack {WUTIL.ItemName(val4)} x{val4.m_stack} to AmmoPouch", WDBUG.Level.FoodHamper); inventory.RemoveItem(val2, val4.m_stack); list.Add(val4); } } } foreach (ItemData item4 in list) { text2 += MakeItemRecipe(item4, 0.25f); } AddDataToItem(pouch, text2); CarryItemResetQuality(pouch); inventory.RemoveItem(pouch, 0); return true; } public static bool PendingDefferUnequip(bool cancel = false) { if (cancel) { ItemData[] array = m_deferredSackExchange.Keys.ToArray(); foreach (ItemData item in array) { RemovedDeferredItem(item); } return true; } return m_deferredSackExchange.Count > 0; } public static bool IsCarryItem(string item) { switch (item) { case "ClothSack": case "FoodHamper": case "AmmoPouch": case "throwstickClutch": return true; default: return false; } } public static string GetItemData(ItemData item, bool remove = false) { string result = ""; int num = item.m_crafterName.IndexOf("\n\tWT*%#@"); if (num > 1) { result = item.m_crafterName.Substring(num + "\n\tWT*%#@".Length); if (remove) { item.m_crafterName = item.m_crafterName.Remove(num); } } return result; } public static void LoadCarryItem(ItemData carryItem, List itemList, bool fromInventory = true) { if (carryItem == null || itemList.Count == 0) { return; } string text = GetItemData(carryItem, remove: true); Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); foreach (ItemData item in itemList) { text += MakeItemRecipe(item); if (fromInventory) { inventory.RemoveItem(item); } } AddDataToItem(carryItem, text); CarryItemResetQuality(carryItem); inventory.RemoveItem(carryItem, 0); } public static int UnloadCarryItem(ItemData carryItem, int maxUnload = 999, bool equipLast = false) { if (carryItem == null) { return 0; } Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); string itemData = GetItemData(carryItem, remove: true); string text = ""; int num = 0; string[] array = itemData.Split(new char[1] { '\n' }); foreach (string text2 in array) { if (text2 == "") { continue; } if (num < maxUnload) { ItemData val = CreateItemFromRecipe(text2); if (inventory.AddItem(val)) { num++; if (equipLast && num == maxUnload) { ((Humanoid)Player.m_localPlayer).EquipItem(val, true); } continue; } } text = text + "\n" + text2; } AddDataToItem(carryItem, text); CarryItemResetQuality(carryItem); inventory.RemoveItem(carryItem, 0); return num; } public static bool AltActionKey() { return InventoryGui.IsVisible() && (ZInput.GetKey((KeyCode)304, true) || ZInput.GetKey((KeyCode)303, true)); } public static void SackUpdateToContent(ItemData sack) { if (sack == null) { return; } int num = 0; int num2 = 0; string itemData = GetItemData(sack); string[] array = itemData.Split(new char[1] { '\n' }); foreach (string text in array) { if (!(text == "")) { num++; string[] array2 = text.Split(new char[1] { ',' }); string text2 = ((array2.Length > 3) ? array2[3] : ""); num2 += ((text2.Contains("Boots") || text2.Contains("Hood") || text2.Contains("Rags")) ? 1 : 2); } } if (num != sack.m_quality) { WDBUG.Log($"Sack initial quality {sack.m_quality} did not match content {num}", WDBUG.Level.ClothSack); sack.m_quality = num; } if (num == 2 && num2 == 4) { num2 = 3; } else if (num == 3 && num2 > 3) { num2--; } num2 = Math.Min(num2, 4); if (sack.m_shared.m_icons.Length != 0) { sack.m_variant = Math.Min(num2, sack.m_shared.m_icons.Length - 1); } Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); inventory.RemoveItem(sack, 0); if ((Object)(object)sack.m_dropPrefab == (Object)null || (Object)(object)sack.m_dropPrefab.transform == (Object)null) { WDBUG.Log("sack had no prefab (instance)"); return; } Transform val = sack.m_dropPrefab.transform.Find("attach"); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to find sack attach transform"); return; } ((Component)val.Find("bag 0")).gameObject.SetActive(num2 == 0); ((Component)val.Find("bag 1")).gameObject.SetActive(num2 == 1); ((Component)val.Find("bag 2")).gameObject.SetActive(num2 == 2); ((Component)val.Find("bag 3")).gameObject.SetActive(num2 == 3); ((Component)val.Find("bag 4")).gameObject.SetActive(num2 == 4); } public static bool CheckCarryItem(ItemData item) { switch (WUTIL.ItemName(item)) { case "ClothSack": case "FoodHamper": case "AmmoPouch": item.m_shared.m_maxQuality = 4; return true; case "throwstickClutch": return true; default: return false; } } private static ItemData ReplaceInventoryItem(ItemData item, string swapItem, int newAmount = 1) { //IL_005a: 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) //IL_0099: Unknown result type (might be due to invalid IL or missing references) bool flag = item.m_stack <= 1; WDBUG.Log($"Replace {WUTIL.ItemName(item)} for {newAmount} new {swapItem} in-place: {flag}", WDBUG.Level.ClothSack); Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); Vector2i gridPos = item.m_gridPos; inventory.RemoveOneItem(item); item = WUTIL.CreateItemData(swapItem, newAmount); item.m_crafterID = Player.m_localPlayer.GetPlayerID(); item.m_crafterName = Player.m_localPlayer.GetPlayerName(); if (flag) { inventory.AddItem(item, gridPos); } else { inventory.AddItem(item); } return item; } private static int GetItemInventoryIndex(ItemData item, int inventoryWidth = 8) { return (item == null) ? 9999 : (item.m_gridPos.x + item.m_gridPos.y * inventoryWidth); } private static void DefferedUnequipAction(ItemData item) { if (!m_deferredSackExchange.ContainsKey(item)) { return; } if (m_deferredSackReference != null) { Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); string text = MakeItemRecipe(item); WDBUG.Log("Adding recipe to sack " + text, WDBUG.Level.ClothSack); inventory.RemoveItem(item); if (m_deferredSackReference.m_shared.m_maxStackSize > 1) { m_deferredSackReference = ReplaceInventoryItem(m_deferredSackReference, "ClothSack"); } AddDataToItem(m_deferredSackReference, text); SackUpdateToContent(m_deferredSackReference); } RemovedDeferredItem(item); } private static void CheckUnunequipDeferredItem(ItemData item) { if (m_deferredSackExchange.ContainsKey(item)) { WDBUG.Log("Caught Sack transfer cancel of " + item.m_shared.m_name, WDBUG.Level.ClothSack); RemovedDeferredItem(item); } } private static void RemovedDeferredItem(ItemData item) { m_deferredSackExchange.Remove(item); if (m_deferredSackExchange.Count == 0 && m_deferredSackReference != null) { WDBUG.Log("Late reset sack quality for " + m_deferredSackReference.m_shared.m_name, WDBUG.Level.ClothSack); CarryItemResetQuality(m_deferredSackReference); SackUpdateToContent(m_deferredSackReference); if (m_deferredSackReference.m_shared.m_maxStackSize == 1 && m_deferredSackReference.m_quality == 0) { ReplaceInventoryItem(m_deferredSackReference, "ClothSackEmpty"); } m_deferredSackReference = null; } } private static ItemData CreateItemFromRecipe(string recipe) { if (recipe.Length <= 1) { return null; } string[] array = recipe.Split(new char[1] { ',' }); if (array.Length < 4) { WDBUG.Log("WARNING: Not enough data in Sack recipe: " + recipe); return null; } ItemData val = WUTIL.CreateItemData(array[3]); if (val == null) { WDBUG.Log("WARNING: Could create inventory item for recipe: " + recipe); return null; } bool flag = val.m_shared.m_maxStackSize > 1; if (!int.TryParse(array[1], out var result)) { WDBUG.Log("Warning: Could not extract " + (flag ? "stack" : "quality") + " for recipe: " + recipe); return null; } if (!int.TryParse(array[2], out var result2)) { WDBUG.Log("WARNING: Could not extract " + (flag ? "max stack" : "durability") + " for recipe: " + recipe); return null; } if (flag) { val.m_stack = result; } else { val.m_quality = result; val.m_durability = 0.0001f * (float)result2 * val.GetMaxDurability(); } val.m_worldLevel = (byte)Game.m_worldLevel; return val; } private static string MakeItemRecipe(ItemData item, float stackFraction = 1f) { if (item == null || item.m_stack <= 0) { return ""; } string text = "\n" + WUTIL.ItemName(item, goName: false) + ","; if (item.m_shared.m_maxStackSize > 1) { int val = (int)(0.5f + stackFraction * (float)item.m_shared.m_maxStackSize); text = text + Math.Min(item.m_stack, val) + "," + val; } else { text = text + item.m_quality + "," + (int)(10000f * item.GetDurabilityPercentage()); } return text + "," + WUTIL.ItemName(item) + "," + (int)(100f * item.GetWeight(-1)); } private static void AddDataToItem(ItemData item, string recipe) { if (item != null && recipe.Length > 1) { int num = item.m_crafterName.IndexOf("\n\tWT*%#@"); if (num < 0) { item.m_crafterName = item.m_crafterName + "\n\tWT*%#@" + recipe; } else { item.m_crafterName += recipe; } } } private static void CarryItemResetQuality(ItemData item, int maxQuality = 4) { item.m_quality = 0; string itemData = GetItemData(item); foreach (char c in itemData) { if (c == '\n') { item.m_quality++; } } } private static string SackExchangeItems(ItemData sackItem, ItemData wornItem, ItemData sack, bool autoEquip, bool loadOnly = false) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (loadOnly && sackItem != null) { return MakeItemRecipe(sackItem); } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return ""; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (sackItem != null && wornItem != null) { string result = MakeItemRecipe(wornItem); Vector2i gridPos = wornItem.m_gridPos; if (autoEquip) { WDBUG.Log("Unequip " + wornItem.m_shared.m_name + " and exchange equip for " + sackItem.m_shared.m_name, WDBUG.Level.ClothSack); ((Humanoid)localPlayer).UnequipItem(wornItem, true); } else { WDBUG.Log("Direct exchange for (uneqipped) " + wornItem.m_shared.m_name + " and for " + sackItem.m_shared.m_name, WDBUG.Level.ClothSack); } inventory.RemoveItem(wornItem); inventory.AddItem(sackItem, gridPos); if (autoEquip) { ((Humanoid)localPlayer).UseItem(inventory, sackItem, false); } return result; } if (sackItem == null && wornItem != null) { if (!autoEquip) { WDBUG.Log("Moving (unequipped) " + wornItem.m_shared.m_name + " directly to sack", WDBUG.Level.ClothSack); string result2 = MakeItemRecipe(wornItem); inventory.RemoveItem(wornItem); return result2; } WDBUG.Log("Unequipping and deferred move of " + wornItem.m_shared.m_name + " sack", WDBUG.Level.ClothSack); ((Humanoid)localPlayer).UseItem(inventory, wornItem, false); m_deferredSackExchange.Add(wornItem, sackItem); if (sack == null) { return MakeItemRecipe(wornItem); } m_deferredSackReference = sack; } else if (sackItem != null) { if (!WUTIL.CompressInventory(inventory)) { WUTIL.Message("Not enough room to empty sack to inventory"); return MakeItemRecipe(sackItem); } inventory.AddItem(sackItem); if (autoEquip) { WDBUG.Log("Move from sack and equip for " + sackItem.m_shared.m_name, WDBUG.Level.ClothSack); ((Humanoid)localPlayer).UseItem(inventory, sackItem, false); } else { WDBUG.Log("Moving (unequipped) " + sackItem.m_shared.m_name + " directly from sack", WDBUG.Level.ClothSack); } } return ""; } private static string FoodColor(ItemData item) { if (item == null) { return "#F00"; } if (item.m_shared.m_food < item.m_shared.m_foodEitr / 2f && item.m_shared.m_foodStamina < item.m_shared.m_foodEitr / 2f) { return "#88E"; } if (item.m_shared.m_foodStamina < item.m_shared.m_food / 2f) { return "#E77"; } if (item.m_shared.m_food < item.m_shared.m_foodStamina / 2f) { return "#EE7"; } return "#EEE"; } private static string StoredItemColor(string itemName) { if (itemName == "PebbleBad" || itemName == "PebbleColdball" || itemName.EndsWith("Poisoned")) { return "#181"; } if (itemName.StartsWith("Throwstick")) { return "#AAA"; } if (itemName.StartsWith("Pebble")) { return itemName.Contains("Gold") ? "#DB4" : (itemName.Contains("Silver") ? "#BBB" : "#888"); } if (itemName.EndsWith("Rags")) { return "#CA8"; } if (itemName.StartsWith("TunicRags")) { switch (itemName.Substring(9)) { case "Light": return "#CCC"; case "Dark": return "#444"; case "Blue": return "#22E"; case "Green": return "#2E2"; case "Red": return "#E22"; case "Orange": return "#E82"; case "Purple": return "#E2E"; case "Yellow": return "#EE2"; } } if (itemName.EndsWith("Leather")) { return "#A62"; } if (itemName.EndsWith("Troll")) { return "#47B"; } if (itemName.EndsWith("Wildling") || itemName == "PantsRagsSwim") { return "#483"; } if (itemName.StartsWith("Fur")) { return itemName.Contains("Grey") ? "#444" : (itemName.Contains("White") ? "#DDD" : "#B73"); } return "#82E"; } public static void UpdateClothingEffects(bool scanInventory = true) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Invalid comparison between Unknown and I4 //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Invalid comparison between Unknown and I4 //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Invalid comparison between Unknown and I4 //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Invalid comparison between Unknown and I4 //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Invalid comparison between Unknown and I4 if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } if (scanInventory) { m_equippedClothing.Clear(); foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { if (allItem.m_equipped) { string text = WUTIL.ItemName(allItem); if (text.StartsWith("Fur") || text.EndsWith("Wildling") || text.StartsWith("TunicRags") || text == "PantsRagsSwim") { m_equippedClothing.Add(text); } } } } SkillClothingBuff = 0f; Biome val = Heightmap.FindBiome(((Component)Player.m_localPlayer).transform.position); bool flag = World.PlayerInInterior(); bool flag2 = !EnvMan.IsDaylight(); int num = 0; int num2 = 0; int num3 = 0; string text2 = ""; float num4 = 0f; float num5 = 0f; foreach (string item in m_equippedClothing) { string text3 = item; if (item.StartsWith("TunicRags")) { SetRagsEffect(item, equip: true); if (item != "TunicRagsDark") { continue; } text3 = "FurHoodGrey"; } if (text3.StartsWith("Fur")) { string text4 = (text3.EndsWith("Tan") ? "Tan" : (text3.EndsWith("Grey") ? "Grey" : "White")); string text5 = text3.Substring(3, text3.Length - text4.Length - 3); float num6; switch (text5) { default: num6 = 0.01f; break; case "Boots": num6 = 0f; break; case "Cloak": case "Vest": num6 = 0.02f; break; } float num7 = num6; if (text3 == item) { num3++; if (text2 != text4) { text2 = text4; num = 1; } else { num++; } num2 |= ((text5 == "Boots" || text5 == "Pants") ? 1 : 2); } if (flag) { switch (text4) { case "Tan": num7 = 0f; break; case "White": num7 *= -0.5f; break; case "Grey": num7 *= 1.5f; break; } } else { switch (text4) { case "White": num7 *= (float)(((int)val == 4) ? 2 : (-1)); break; case "Tan": num7 *= (((int)val == 16) ? 2f : (((int)val == 1) ? 1f : 0.5f)); break; case "Grey": num7 *= ((flag2 || (int)val == 2) ? 2f : (((int)val == 8) ? 1f : 0.5f)); break; } } num4 += num7; } else { if (text2 != "wildling") { text2 = "wildling"; num = 1; } else { num++; } num2 |= 4; string text6 = item.Remove(item.Length - 8); float num8 = ((text6 == "Cape") ? 0.02f : 0.01f); if (item == "PantsRagsSwim" || item == "HoodRagsWildling") { SetRagsEffect(item, equip: true); } else if (text6 == "Boots") { num2 |= 1; num3++; } num5 += num8; } } if (num == 4 && text2 != "wildling") { num4 *= 1.2f; } HideClothingBuff = 0.001f * (float)WUTIL.Floor(2000f * num4); SkillClothingBuff = 0.001f * (float)WUTIL.Floor(1000f * num5); m_allFurBonus = num3 == 4 && num < 4; m_furFeetBonus = num3 < 4 && (num2 & 1) > 0; UpdateStatusEffect("SE_WildlingBonus", (num2 & 4) > 0); UpdateStatusEffect("SE_FurWarmth", m_allFurBonus); UpdateStatusEffect("SE_FurShoes", m_furFeetBonus); } public static void EquipClothing(ItemData item, bool equip) { if ((Object)(object)Player.m_localPlayer == (Object)null || item == null) { return; } string text = WUTIL.ItemName(item); if ((equip && WUTIL.Timer("EquipClothingDisable") > 0f) || (!text.StartsWith("Fur") && !text.EndsWith("Wildling") && !text.StartsWith("TunicRags") && !(text == "PantsRagsSwim"))) { return; } bool flag = m_equippedClothing.Contains(text); if (equip) { if (!flag) { m_equippedClothing.Add(text); } } else { if (flag) { m_equippedClothing.Remove(text); } SetRagsEffect(text, equip: false); } UpdateClothingEffects(scanInventory: false); WDBUG.Log($"Clothing equip: {equip} for {text} of {m_equippedClothing.Count} items, Hiding: {HideClothingBuff} Skill: {SkillClothingBuff}", WDBUG.Level.PlayerBuffs); } public static void UpdateStatusEffect(string name, bool add = true, bool resetTime = false) { SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan(); int stableHashCode = StringExtensionMethods.GetStableHashCode(name); bool flag = sEMan.HaveStatusEffect(stableHashCode); if (add) { if (!flag) { WDBUG.Log("Add effect " + name, WDBUG.Level.PlayerBuffs); sEMan.AddStatusEffect(stableHashCode, resetTime, 0, 0f); } } else if (flag) { WDBUG.Log("Remove effect " + name, WDBUG.Level.PlayerBuffs); sEMan.RemoveStatusEffect(stableHashCode, false); } } private static void SetRagsEffect(string rags, bool equip) { string ragsEffectName = GetRagsEffectName(rags); if (ragsEffectName != "") { UpdateStatusEffect(ragsEffectName, equip); } } private static string GetRagsEffectName(string itemName) { switch (itemName) { case "TunicRagsRed": case "Red dyed cuirass": return "SE_RagsAttack"; case "TunicRagsDark": case "Dark dyed cuirass": return "SE_RagsStalk"; case "TunicRagsOrange": case "Orange dyed cuirass": return "SE_RagsSwim"; case "TunicRagsPurple": case "Purple dyed cuirass": return "SE_RagsAttackDamage"; case "TunicRagsLight": case "Light shaded cuirass": return "SE_RagsJump"; case "PantsRagsSwim": case "Swim shorts": return "SE_RagsSwimSkill"; case "HoodRagsWildling": case "Wildling cap": return "SE_RagsFocus"; default: return ""; } } public static void FlagAddItemDirect() { PatchInventoryAddItem.m_addItemDirect = true; } } [BepInPlugin("DrengRobot.Wildling", "Valheim Wildling", "1.1.9")] [BepInProcess("valheim.exe")] internal class WildlingMod : BaseUnityPlugin { [HarmonyPatch(typeof(ZNetScene), "RemoveObjects")] public class PatchZNetSceneRemoveObjects { public static void Prefix(Dictionary ___m_instances) { ZDO[] array = ___m_instances.Keys.ToArray(); foreach (ZDO val in array) { if ((Object)(object)___m_instances[val] == (Object)null) { string text = val.GetString(val.GetPrefab(), "Unknown"); WDBUG.Log("Removing ZDO with null ZNetView for " + text, WDBUG.Level.artifacts); ZDOMan.instance.DestroyZDO(val); ___m_instances.Remove(val); } } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class PatchZNetSceneAwake { public static void Prefix(ZNetScene __instance, Dictionary ___m_namedPrefabs) { if ((Object)(object)__instance == (Object)null) { return; } WDBUG.Log("ZNetScene Awake", WDBUG.Level.startup); foreach (KeyValuePair w_gameObject in w_gameObjects) { __instance.m_prefabs.Add(w_gameObject.Value); } } } [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class PatchObjectDBAwake { public static void Postfix() { WDBUG.Log("ObjectDB Awake", WDBUG.Level.startup); SetupGameObjects("ObjectDB.Awake"); } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] public static class PatchObjectDBCopyOtherDB { public static void Postfix() { WDBUG.Log("CopyOtherDB Called", WDBUG.Level.startup); SetupGameObjects("ObjectDB.CopyOtherDB", partial: true); } } [HarmonyPatch(typeof(Humanoid), "GetBeard")] private class PatchHumanoidGetBeard { public static void Postfix(Humanoid __instance, ref ItemData ___m_rightItem, ref ItemData ___m_leftItem, ref ItemData ___m_hiddenRightItem, ref ItemData ___m_hiddenLeftItem, VisEquipment ___m_visEquipment, ZSyncAnimation ___m_zanim) { switch (m_getBeardAction) { case 1: m_getBeardItem = ___m_rightItem; break; case 2: m_getBeardItem = ___m_leftItem; break; case 3: m_getBeardItem = ___m_hiddenRightItem; break; case 4: m_getBeardItem = ___m_hiddenLeftItem; break; case 5: if (___m_leftItem != null || ___m_rightItem != null) { ItemData val3 = ___m_leftItem; ItemData val4 = ___m_rightItem; __instance.UnequipItem(___m_leftItem, true); __instance.UnequipItem(___m_rightItem, true); ___m_visEquipment.SetLeftItem("", 0); ___m_visEquipment.SetRightItem(""); ___m_hiddenLeftItem = val3; ___m_hiddenRightItem = val4; if (((Character)__instance).IsPlayer()) { string text = ((val3 == null) ? "Empty" : ((Object)val3.m_dropPrefab).name); string rightBackItem = ((val4 == null) ? "Empty" : ((Object)val4.m_dropPrefab).name); ___m_visEquipment.SetLeftBackItem(text, 0); ___m_visEquipment.SetRightBackItem(rightBackItem); } ___m_zanim.SetTrigger("equip_hip"); } break; case 6: if (___m_hiddenLeftItem != null || ___m_hiddenRightItem != null) { ItemData val = ___m_hiddenLeftItem; ItemData val2 = ___m_hiddenRightItem; ___m_hiddenLeftItem = null; ___m_hiddenRightItem = null; if (val != null) { __instance.EquipItem(val, true); } if (val2 != null) { __instance.EquipItem(val2, true); } ___m_zanim.SetTrigger("equip_hip"); } break; case 7: m_getBeardItem = ((___m_rightItem == null) ? ___m_leftItem : ___m_rightItem); break; } } } [HarmonyPatch(typeof(Player), "StartGuardianPower")] public class PatchPlayerStartGuardianPower { public static bool Prefix(Player __instance, StatusEffect ___m_guardianSE, ZSyncAnimation ___m_zanim, ref bool __result) { if ((Object)(object)___m_guardianSE == (Object)null || __instance.m_guardianPowerCooldown > 0f) { return true; } __result = false; if (((Character)__instance).InDodge() || !((Character)__instance).CanMove() || ((Character)__instance).IsKnockedBack() || ((Character)__instance).IsStaggering() || ((Character)__instance).InMinorAction()) { return false; } string prefabName = Utils.GetPrefabName(((Object)___m_guardianSE).name); string text = prefabName; switch (text) { default: if (text.Length != 0) { goto case null; } return false; case "GP_EikthyrBinding": if (((Character)__instance).InAttack()) { return false; } Game.instance.IncrementPlayerStat((PlayerStatType)97, 1f); break; case "GP_ElderLight": if (((Character)__instance).InAttack()) { return false; } Game.instance.IncrementPlayerStat((PlayerStatType)98, 1f); break; case null: return true; } ___m_zanim.SetTrigger("gpower"); Game.instance.IncrementPlayerStat((PlayerStatType)96, 1f); return false; } } [HarmonyPatch(typeof(Player), "SetGuardianPower")] public class PatchPlayerSetGuardianPower { public static bool Prefix(string name) { bool flag = false; switch (name) { case "GP_EikthyrBinding": if (Object.op_Implicit((Object)(object)ZoneSystem.instance)) { Game.instance.IncrementPlayerStat((PlayerStatType)88, 1f); } flag = true; break; case "GP_ElderLight": if (Object.op_Implicit((Object)(object)ZoneSystem.instance)) { Game.instance.IncrementPlayerStat((PlayerStatType)89, 1f); } flag = true; break; case "": flag = true; break; } if (flag) { WUTIL.TimerReset("block_next_log_warning", 0.1f); } return true; } } [HarmonyPatch(typeof(ZLog), "LogWarning")] public class PatchZLogLogWarning { public static bool Prefix() { if (WUTIL.Timer("block_next_log_warning") > 0f) { WUTIL.TimerReset("block_next_log_warning"); return false; } return true; } } [HarmonyPatch(typeof(Player), "FixedUpdate")] private class PatchPlayerFixedUpdate { private static int m_maxFood = 3; private static Transform m_foodTopTransform = null; private static Transform m_foodMidTransform = null; private static Vector3 m_foodSlotScale = Vector3.one; private static void Postfix(Player __instance, ZNetView ___m_nview, ZSyncAnimation ___m_zanim) { if ((Object)(object)___m_nview == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)___m_zanim == (Object)null) { return; } if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { Wildling.CheckNewPlayer(__instance); return; } World.CheckLocationsLocal(); if ((Object)(object)WUTIL.Player_nview == (Object)null) { WUTIL.Player_nview = ___m_nview; WUTIL.Player_zanim = ___m_zanim; Wildling.CompleteStartup(); } else if (Wildling.m_justDiedAsWildling) { if ((Object)(object)((Component)((Component)Player.m_localPlayer).GetComponent()).GetComponentInChildren() == (Object)null) { return; } if (Wildling.PlayState == 2) { Wildling.SetWilding(toWilding: true); } else { Wildling.ToggleWildling(1f); } Wildling.m_justDiedAsWildling = false; MagicChest.m_forceInventoryUpdate = true; } MagicChest.UpdateInventory(); UpdateFoodBar(); UpdateTimers(); } private static void UpdateLateStartup() { if (!WUTIL.m_updateLateStartup) { return; } if (WUTIL.TimerIsAlmost("wildlingMorphDelay", 0f)) { Wildling.ToggleWildling(); } float num = WUTIL.Timer("auto_reequip"); if (!(num > 0f)) { return; } if (WUTIL.TimeIsAlmost(num, 1f)) { WUTIL.TimerReset("auto_reequip"); Wildling.BroadcastStatus(); WUTIL.m_updateLateStartup = false; } else if (WUTIL.TimeIsAlmost(num, 0.2f)) { WDBUG.Log("Recall equiped @ " + num, WDBUG.Level.GUI); WUTIL.RecallEquiped(); } else if (WUTIL.TimeIsAlmost(num)) { if (WUTIL.m_captureHeldItems) { WUTIL.m_captureHeldItems = false; WUTIL.HideHandItems(); } WDBUG.Log("Allow special item updates @ " + num, WDBUG.Level.GUI); WUTIL.m_updateLateStartup = false; } } private static void UpdateFoodBar() { //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) Wildling.MaxFood = (Wildling.IsWildling ? 2 : 3); if (WUTIL.Timer("sickness") > 0f) { Wildling.MaxFood--; } int num = Mathf.Max(Player.m_localPlayer.GetFoods().Count, Wildling.MaxFood); if (m_maxFood == num) { return; } if (!Object.op_Implicit((Object)(object)m_foodTopTransform)) { Transform transform = ((Component)InventoryGui.instance.m_player).transform; Transform val = transform.parent.parent.parent.Find("HUD"); if ((Object)(object)val == (Object)null) { WDBUG.Log("UpdateFoodBar dailed to find HUD transform", WDBUG.Level.alert); return; } m_foodTopTransform = val.Find("hudroot/healthpanel/food2"); m_foodMidTransform = val.Find("hudroot/healthpanel/food1"); m_foodSlotScale = ((Component)m_foodTopTransform).transform.localScale; } ((Component)m_foodTopTransform).transform.localScale = ((num < 3) ? Vector3.zero : m_foodSlotScale); ((Component)m_foodMidTransform).transform.localScale = ((num < 2) ? Vector3.zero : m_foodSlotScale); m_maxFood = num; } private static void UpdateTimers() { float fixedDeltaTime = Time.fixedDeltaTime; WUTIL.UpdateTimers(fixedDeltaTime); UpdateLateStartup(); UpdateKnownRecipes(); WUTIL.UpdateDelayedMessage(); Wildling.Update(); Slingshot.Update(); Alignment.Update(fixedDeltaTime); Riding.Update(fixedDeltaTime); Throwstick.Update(); MapMarker.Update(); TreePortal.Update(); Fairy.Update(); Loki.Update(); Quest.Update(); ElderWand.Update(); World.Update(fixedDeltaTime); } private static void UpdateKnownRecipes() { if (!Wildling.IsWildling || WUTIL.Timer("check_recipes") > 0f) { return; } WUTIL.TimerReset("check_recipes", 2f); foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { Player.m_localPlayer.AddKnownItem(allItem); } if (!CheckAchievementRecipe("Throwsticks", "throwstickClutch") && !CheckAchievementRecipe("SkeletonKey", "LocksPicked") && !CheckAchievementRecipe("BLD:PebbleRough", "PebbleRough") && !CheckAchievementRecipe("BLD:PebbleSharp", "PebbleSharp")) { } } } [HarmonyPatch(typeof(Game), "Shutdown")] private class PatchGameShutdown { private static void Prefix() { if (Object.op_Implicit((Object)(object)Player.m_localPlayer)) { bool flag = GetHandAction(7, (Humanoid)(object)Player.m_localPlayer) != null; Wildling.SetPlayerData("PHIDEHANDS", (float)(flag ? 1 : 0)); WDBUG.Log($"Shutdown PHIDEHANDS: {flag}", WDBUG.Level.PlayerStats); WUTIL.ShowHandItems(); MagicChest.OnShutdown(); } } private static void Postfix() { MapMarker.Reset(); Wildling.Reset(); Quest.Reset(); WUTIL.Reset(); } } [HarmonyPatch(typeof(Humanoid), "HideHandItems")] private class PatchHumanoidHideHandItems { private static void Prefix(Humanoid __instance) { if (((Character)__instance).IsPlayer()) { ElderWand.Equip(null, ElderWand.WandAction.ready); Throwstick.Ready(); Slingshot.Ready(); } } } [HarmonyPatch(typeof(Player), "Interact")] private class PatchPlayerInteract { public static bool Prefix(Player __instance, GameObject go, bool hold) { if (((Character)__instance).InAttack() || ((Character)__instance).InDodge() || hold) { return true; } return !ElderWand.Interact(go) && !Alignment.Interact(go); } } [HarmonyPatch(typeof(Debug), "Log", new Type[] { typeof(object) })] private class PatchDebugLog { public static bool Prefix(object message) { if (!(message is string text)) { return true; } if (text.StartsWith("PlatformUserID") && text.EndsWith("failed to parse!")) { return false; } return !text.Contains("is tamed but missing tameable"); } } public const string c_gameObjectTag = "Wildling_"; public static Dictionary w_gameObjects = new Dictionary(); public static Dictionary w_gameObjectRecipes = new Dictionary(); public static Dictionary w_gameRecipes = new Dictionary(); public static Dictionary w_gamePlacers = new Dictionary(); public static Dictionary m_gameObjectTypeCounts = new Dictionary(); private readonly Harmony harmony = new Harmony("DrengRobot.Wildling"); private static AssetBundle w_assetBundle; private static int m_getBeardAction = 0; private static ItemData m_getBeardItem = null; private void Awake() { WDBUG.Log("Wildling Mod Awake", WDBUG.Level.AssetLoad); Game.isModded = true; WDBUG.StartupConsoleCommand(); m_gameObjectTypeCounts.Clear(); w_assetBundle = GetAssetBundleFromResources("wildlingmodbundle"); RegisterGameObject("TreehousePlatformThin", "MakingTable:Wood,4"); RegisterGameObject("TreehousePlatform", "MakingTable:Wood,5"); RegisterGameObject("pixiedust_vfx"); RegisterGameObject("pixie_alert_sfx"); RegisterGameObject("pixie_idle_sfx"); RegisterGameObject("doxiedust_vfx"); RegisterGameObject("undead_vfx"); RegisterGameObject("sparx_projectile"); RegisterGameObject("sparx_hit_terrain"); RegisterGameObject("sparx_charge_fx"); RegisterGameObject("burning_fx"); RegisterGameObject("electric_fx"); RegisterGameObject("thorscorn_projectile"); RegisterGameObject("thorscorn_implosion_vfx"); RegisterGameObject("thorscorn_explosion_vfx"); RegisterGameObject("bowdacious_projectile"); RegisterGameObject("chimes_projectile"); RegisterGameObject("chimes_hit_fx"); RegisterGameObject("chimes_sfx"); RegisterGameObject("chimes_confuse_fx"); RegisterGameObject("chimes_discovery_fx"); RegisterGameObject("eikthyr_spawn_fx"); RegisterGameObject("Greydwarf_Warlock_rootball_fx"); RegisterGameObject("pebblecoldball_aoe_uw"); RegisterGameObject("bribe_fx"); RegisterGameObject("summon_small_fx"); RegisterGameObject("fireblast_fx"); RegisterGameObject("truffle_vfx"); RegisterGameObject("heavygate_sfx"); RegisterGameObject("runHitDamager"); RegisterGameObject("ygnie_blind_aoe"); RegisterGameObject("elderwand_aoe"); RegisterGameObject("tepee_flatten"); RegisterGameObject("digger_aoe"); RegisterGameObject("digger_aoe2"); RegisterGameObject("digger_dig"); RegisterGameObject("digger_undig"); RegisterGameObject("digger_fill"); RegisterGameObject("digger_preplant"); RegisterGameObject("digger_grass"); RegisterGameObject("digger_groundhit_vfx"); RegisterGameObject("picklock_sfx"); RegisterGameObject("pickbreak_sfx"); RegisterGameObject("Pickable_pebbles"); RegisterGameObject("Spawner_Proxy"); RegisterGameObject("Piece_Proxy"); RegisterGameObject("GhostChest"); RegisterGameObject("IceNest"); RegisterGameObject("GreatOakEmblem"); RegisterGameObject("CryptGate"); RegisterGameObject("RiddleStone"); RegisterGameObject("VegvisirSerpent"); RegisterGameObject("GreatOak"); RegisterGameObject("GlowLight"); RegisterGameObject("attach_base"); RegisterGameObject("attach_edge"); RegisterGameObject("attach_edge2"); RegisterGameObject("ElderChest"); RegisterGameObject("GuckBurner"); RegisterGameObject("StoneTile"); RegisterGameObject("StoneFloorDirt"); RegisterGameObject("Piece_Coffin"); RegisterGameObject("Piece_CoffinGlass"); RegisterGameObject("Piece_AmberCasing"); RegisterGameObject("Headstone"); RegisterGameObject("PropTable"); RegisterGameObject("StoneFloorSewers"); RegisterGameObject("TorchCrystal"); RegisterGameObject("TorchCrystalWall"); RegisterGameObject("TorchCrystalSmall"); RegisterGameObject("Piece_Fang"); RegisterGameObject("Shipwreck"); RegisterGameObject("BubbleShield"); RegisterGameObject("MagicShield"); RegisterGameObject("DefiledRoot_Sapling"); RegisterGameObject("RabbitFur"); RegisterGameObject("CatItem"); RegisterGameObject("Repair"); RegisterGameObject("RabbitTan"); RegisterGameObject("RabbitGrey"); RegisterGameObject("RabbitWhite"); RegisterGameObject("Rat"); RegisterGameObject("RatDraugr"); RegisterGameObject("Pixie"); RegisterGameObject("Doxie"); RegisterGameObject("Greydwarf_Commander"); RegisterGameObject("Greydwarf_Warlock"); RegisterGameObject("TentaRoot"); RegisterGameObject("DefiledRoot"); RegisterGameObject("Borat"); RegisterGameObject("BoratRat"); RegisterGameObject("Ygnie"); RegisterGameObject("RabbitFurTan"); RegisterGameObject("RabbitFurGrey"); RegisterGameObject("RabbitFurWhite"); RegisterGameObject("RabbitMeat"); RegisterGameObject("CookedRabbit"); RegisterGameObject("PixieDust"); RegisterGameObject("DoxieDust"); RegisterGameObject("RabbitFoot"); RegisterGameObject("RatTail"); RegisterGameObject("RatTailDraugr"); RegisterGameObject("BoratTrophy"); RegisterGameObject("GoblinPrinceTrophy"); RegisterGameObject("DeadRat"); RegisterGameObject("CookedRat"); RegisterGameObject("MagicChest"); RegisterGameObject("Chimes"); RegisterGameObject("ElderWand"); RegisterGameObject("Bowdacious"); RegisterGameObject("Sparx"); RegisterGameObject("Thorscorn"); RegisterGameObject("FairyTale"); RegisterGameObject("FairyTalePages1"); RegisterGameObject("FairyTalePages2"); RegisterGameObject("FairyTalePages3"); RegisterGameObject("FairyTalePages4"); RegisterGameObject("FairyTalePages5"); RegisterGameObject("SideNote1"); RegisterGameObject("ElderScroll"); RegisterGameObject("Letter_Bowdacious"); RegisterGameObject("Letter_Sparx"); RegisterGameObject("Letter_Thorscorn"); RegisterGameObject("FancyJacket"); RegisterGameObject("ClothSack"); RegisterGameObject("TreePortal", "SurtlingCore"); RegisterGameObject("SurtlingSpike"); RegisterGameObject("PebbleFine"); RegisterGameObject("AncientMushroom"); RegisterGameObject("Apples"); RegisterGameObject("Truffle"); RegisterGameObject("Elderberries"); RegisterGameObject("BadSeed"); RegisterGameObject("MatchPlaced", "Match,-1"); RegisterGameObject("FirePit", "Stone,3;Wood,-1"); RegisterGameObject("FirePlinth", "Plinth;PebbleSmooth,4"); RegisterGameObject("FirePlinthCoal", "Plinth;CauldronLeg,4;Coal,-1"); RegisterGameObject("Tepee", "Wood,4;LeatherScraps,8"); RegisterGameObject("Campsite1", "Campkit1"); RegisterGameObject("Campsite2", "Campkit2"); RegisterGameObject("Campsite3", "Campkit3"); RegisterGameObject("TreehouseRailing", "MakingTable:Wood,1"); RegisterGameObject("TreehouseHalfwall", "MakingTable:Wood,2"); RegisterGameObject("TreehouseGate", "MakingTable:Wood,2;Stretch"); RegisterGameObject("TreehouseWall", "MakingTable:Wood,3"); RegisterGameObject("TreehouseExtender", "MakingTable:Wood,1"); RegisterGameObject("TreehouseHalffloor", "MakingTable:Wood,2"); RegisterGameObject("TreehouseStairs", "MakingTable:Wood,3"); RegisterGameObject("TreehouseStairsLeft", "MakingTable:Wood,3"); RegisterGameObject("TreehouseStairsRight", "MakingTable:Wood,3"); RegisterGameObject("TreehousePlatformThin2", "MakingTable:Wood,4"); RegisterGameObject("TreehousePlatform2", "MakingTable:Wood,5"); RegisterGameObject("TreehouseRoof", "MakingTable:LeatherScraps,3;Wood,2"); RegisterGameObject("TreehouseSmokeRoof", "MakingTable:LeatherScraps,4;Wood,3"); RegisterGameObject("TreehouseDoor", "MakingTable:LeatherScraps,4;Wood,1"); RegisterGameObject("TreehouseSideDoor", "MakingTable:LeatherScraps,3;Wood,3"); RegisterGameObject("TreehouseSiding", "MakingTable:FineWood,2"); RegisterGameObject("TreehouseShutter", "MakingTable:FineWood,2;Wood,2"); RegisterGameObject("TreehouseLadder", "MakingTable:RoundLog;Wood"); RegisterGameObject("TreehouseConnector", "MakingTable:RoundLog;Wood,2"); RegisterGameObject("TreehouseBridge", "MakingTable:RoundLog,2;Wood,5"); RegisterGameObject("Spit", "Wood", "DeadRat,CookedRat,15;RabbitMeat,CookedRabbit,20;FishRaw,FishCooked,25;NeckTail,NeckTailGrilled,30;RawMeat,CookedMeat,35"); RegisterGameObject("Cookpot", "Cauldron;CauldronLeg,3"); RegisterGameObject("MakingTable", "Wood,5"); RegisterGameObject("StoneGrip", "MakingTable:Wood,6;Resin,4;LeatherScraps,3"); RegisterGameObject("ToolShelf", "MakingTable:FineWood,6;Resin,4;BoneFragments,3"); RegisterGameObject("HidingRack", "MakingTable:Wood,5;Flint,3;LeatherScraps,6"); RegisterGameObject("Soaker", "HidingRack:Wood,6;Resin,6;LeatherScraps,2"); RegisterGameObject("Washbasin", "HidingRack:FineWood,6;Resin,4;Cauldron"); RegisterGameObject("Hotpress", "HidingRack:RoundLog,6;Plinth,2;Resin,4;LeatherScraps,2"); RegisterGameObject("Bin", "Wood,6"); RegisterGameObject("BedrollPlaced", "Bedroll"); RegisterGameObject("StonePeg", "CauldronLeg"); RegisterGameObject("SharpenedStickPlaced", "MakingTable:SharpenedStick,-1"); RegisterGameObject("Lantern", "MakingTable:FineWood;Resin,-1;Flint,-1"); RegisterGameObject("TreehouseStool", "MakingTable:FineWood,3"); RegisterGameObject("LockBox", "MakingTable:FineWood,8;BoneFragments,4;LeatherScraps:2"); RegisterGameObject("FeatherFuton", "MakingTable:Bedroll,2;FineWood,4;LeatherScraps,6;Feathers,100"); RegisterGameObject("Chipper", "Basic:Wood,2,0;Stone", "Repair,MatchPlaced,FirePit,FirePlinth,FirePlinthCoal,Tepee,Campsite1,Campsite2,Campsite3,Spit,Cookpot,MakingTable,StoneGrip,ToolShelf,HidingRack,Soaker,Washbasin,Hotpress,TreehouseRailing,TreehouseHalfwall,TreehouseGate,TreehouseWall,TreehouseExtender,TreehouseHalffloor,TreehouseStairs,TreehouseStairsLeft,TreehouseStairsRight,TreehousePlatformThin2,TreehousePlatform2,TreehouseRoof,TreehouseSmokeRoof,TreehouseDoor,TreehouseSideDoor,TreehouseSiding,TreehouseShutter,TreehouseLadder,TreehouseConnector,TreehouseBridge,Bin,LockBox,BedrollPlaced,SharpenedStickPlaced,StonePeg,Lantern,TreehouseStool,FeatherFuton"); RegisterGameObject("Match", "Basic,1,2:Wood;Resin"); RegisterGameObject("Stick", "Basic:Wood"); RegisterGameObject("PebbleRough", "Basic,1,5:Stone"); RegisterGameObject("PebbleSharp", "Basic,1,5:Flint"); RegisterGameObject("Campkit1", "Basic:Bedroll;LeatherScraps,8;Wood,5;Stone,3"); RegisterGameObject("Campkit2", "Basic:Campkit1;Cauldron;CauldronLeg,3;Wood"); RegisterGameObject("Campkit3", "Basic:Campkit2;Plinth;CauldronLeg,4;Coal"); RegisterGameObject("PebbleBad", "Basic,1,5:PebbleSharp,5;StickyPoison"); RegisterGameObject("ArrowFlintPoisoned", "Basic,1,5:ArrowFlint,5,0;StickyPoison"); RegisterGameObject("AxeFlintPoisoned", "Basic:AxeFlint,1,0;StickyPoison;Flint,0,3;LeatherScraps,0,2"); RegisterGameObject("KnifeFlintPoisoned", "Basic:KnifeFlint,1,0;StickyPoison;Flint,0,2"); RegisterGameObject("SpearFlintPoisoned", "Basic:SpearFlint,1,0;StickyPoison;Wood,0,4;Flint,0,5"); RegisterGameObject("ThrowstickPoisoned", "Basic:Throwstick,1,0;StickyPoison;FineWood,0,1;Flint,0,1"); RegisterGameObject("RabbitBait", "MakingTable:Raspberry;Dandelion,3"); RegisterGameObject("DeerBait", "MakingTable:Truffle;Mushroom,2"); RegisterGameObject("WolfBait", "MakingTable:Truffle;RabbitMeat"); RegisterGameObject("PinePaste", "MakingTable,1,2:PineCone;Thistle,2;MushroomYellow,2"); RegisterGameObject("PoisonBase", "MakingTable:DeadRat;Thistle,2;BoneFragments"); RegisterGameObject("PowderedCrystal", "MakingTable,1,3:Crystal"); RegisterGameObject("TanningMix", "MakingTable,1,3:BeechSeeds;FirCone;BoneFragments;Resin"); RegisterGameRecipe("KnifeFlint", "MakingTable:Wood,2,0;Flint,4,2;LeatherScraps,1,0"); RegisterGameObject("SharpenedStick", "MakingTable:Wood"); RegisterGameObject("SlingshotWood", "MakingTable:Wood,1,0;Stretch"); RegisterGameObject("Throwstick", "MakingTable,2:FineWood;Flint;Resin,1,0"); RegisterGameObject("KnifeBone", "MakingTable,2:BoneFragments,4,2;Resin,1;LeatherScraps,1,0"); RegisterGameObject("SlingshotBone", "MakingTable,2:BoneFragments,1,0;Stretch,2"); RegisterGameObject("SlingshotFinewood", "MakingTable,2:FineWood,1,0;Stretch,3"); RegisterGameObject("FoodHamper", "MakingTable,2:FineWood,2;FineBones;BjornHide"); RegisterGameObject("SlingshotHardwood", "MakingTable,3:RoundLog,1,0;Stretch,4"); RegisterGameObject("SlingshotElderwood", "MakingTable,3:ElderBark,1,0;Stretch,5"); RegisterGameObject("SkeletonKey", "MakingTable,3:FineBones,1,0;Resin,1,0"); RegisterGameObject("Digger", "StoneGrip,2:Chipper;Stone,2;Wood,3,0;FineWood,0,2"); RegisterGameObject("MushroomBuckler", "StoneGrip,2:Chipper;AncientMushroom;LeatherScraps,1,0;ElderBark,0,1"); RegisterGameObject("PestleAndMortar", "StoneGrip,3:Chipper;Stone,2,0;Flint,0,2"); RegisterGameObject("Plinth", "StoneGrip,2:Chipper;Stone,4"); RegisterGameObject("PebbleSmooth", "StoneGrip,1,5:Chipper;Stone"); RegisterGameObject("Cauldron", "StoneGrip,3:Chipper;Stone,5"); RegisterGameObject("CauldronLeg", "StoneGrip:Chipper;Stone"); RegisterGameRecipe("LeatherScraps", "HidingRack:RabbitFur"); RegisterGameObject("Bedroll", "HidingRack:LeatherScraps,2;RabbitFur,6"); RegisterGameObject("throwstickClutch", "HidingRack,2:RabbitFur,2;BoneFragments"); RegisterGameObject("PebbleColdball", "HidingRack,3,3:RabbitFur,3;ColdPoison"); RegisterGameObject("PatchKit", "HidingRack,3,8:LeatherScraps,2;RabbitFur,2;BoneFragments,2;PebbleSharp,2"); RegisterGameObject("Stretch", "HidingRack:RabbitFur;Blueberries,2;Resin"); RegisterGameObject("AmmoPouch", "HidingRack,2:LeatherScraps,5;BoneFragments,2;Resin,2;Stretch,2"); RegisterGameObject("ClothSackEmpty", "HidingRack,2:BjornHide,2;Stretch"); RegisterGameObject("HoodRags", "HidingRack:LeatherScraps,2,1;Resin,0,1"); RegisterGameObject("PantsRags", "HidingRack:LeatherScraps,3,2"); RegisterGameObject("TunicRags", "HidingRack:LeatherScraps,3,2"); RegisterGameObject("HoodLeather", "HidingRack:LeatherScraps,3,2;BoneFragments,0,1"); RegisterGameObject("CapeLeather", "HidingRack:LeatherScraps,5,4;BoneFragments,0,2"); RegisterGameObject("TunicLeather", "HidingRack:LeatherScraps,5,4;BoneFragments,0,3"); RegisterGameObject("PantsLeather", "HidingRack:LeatherScraps,5,4;BoneFragments,0,3"); RegisterGameObject("FurHoodTan", "HidingRack:RabbitFurTan,4,2;BoneFragments,0,1"); RegisterGameObject("FurCloakTan", "HidingRack:RabbitFurTan,6,3;BoneFragments,1"); RegisterGameObject("FurVestTan", "HidingRack:RabbitFurTan,6,3;BoneFragments,3,2"); RegisterGameObject("FurBootsTan", "HidingRack:RabbitFurTan,4,3;BoneFragments,0,2"); RegisterGameObject("FurHoodGrey", "HidingRack:RabbitFurGrey,4,2;BoneFragments,0,1"); RegisterGameObject("FurCloakGrey", "HidingRack:RabbitFurGrey,6,3;BoneFragments,1"); RegisterGameObject("FurVestGrey", "HidingRack:RabbitFurGrey,6,3;BoneFragments,3,2"); RegisterGameObject("FurPantsGrey", "HidingRack:RabbitFurGrey,6,3;BoneFragments,2,2"); RegisterGameObject("FurHoodWhite", "HidingRack:RabbitFurWhite,4,2;BoneFragments,0,1"); RegisterGameObject("FurCloakWhite", "HidingRack:RabbitFurWhite,6,3;BoneFragments,1"); RegisterGameObject("FurVestWhite", "HidingRack:RabbitFurWhite,6,3;BoneFragments,3,2"); RegisterGameObject("FurPantsWhite", "HidingRack:RabbitFurWhite,6,3;BoneFragments,2,2"); RegisterGameObject("HoodTroll", "HidingRack,2:TrollHide,3,1;BoneFragments"); RegisterGameObject("CapeTroll", "HidingRack,2:TrollHide,4,1;BoneFragments,3,2"); RegisterGameObject("TunicTroll", "HidingRack,2:TrollHide,4,1;BoneFragments"); RegisterGameObject("PantsTroll", "HidingRack,2:TrollHide,4,1;BoneFragments"); RegisterGameObject("SoakerRequired", "Soaker:TanningMix"); RegisterGameObject("HoodRagsWildling", "Soaker:HoodRags,1,0;TanningMix,1,1;LeatherScraps,0,1;Resin,0,1"); RegisterGameObject("HoodWildling", "Soaker:HoodLeather,1,0;TanningMix,1,1;LeatherScraps,0,2;BoneFragments,0,1"); RegisterGameObject("CapeWildling", "Soaker:CapeLeather,1,0;TanningMix,3,1;LeatherScraps,0,4;BoneFragments,0,2"); RegisterGameObject("TunicWildling", "Soaker:TunicLeather,1,0;TanningMix,3,1;LeatherScraps,0,4;BoneFragments,0,3"); RegisterGameObject("PantsWildling", "Soaker:PantsLeather,1,0;TanningMix,3,1;LeatherScraps,0,4;BoneFragments,0,3"); RegisterGameObject("BootsWildling", "Soaker:FurBootsTan,1,0;TanningMix,2,1;RabbitFur,0,3;BoneFragments,0,2"); RegisterGameObject("PantsRagsSwim", "Soaker:PantsRags,1,0;TanningMix;RabbitFur,0,2;Coal,1,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsDark", "Soaker:TunicRags,1,0;TanningMix;Truffle,1,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsLight", "Soaker:TunicRags,1,0;TanningMix;Thistle,2,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsRed", "Soaker:TunicRags,1,0;TanningMix;Mushroom,3,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsYellow", "Soaker:TunicRags,1,0;TanningMix;MushroomYellow,2,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsOrange", "Soaker:TunicRags,1,0;TanningMix;Mushroom,2,0;MushroomYellow,1,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsBlue", "Soaker:TunicRags,1,0;TanningMix;MushroomBlue,1,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsPurple", "Soaker:TunicRags,1,0;TanningMix;Mushroom,2,0;MushroomBlue,1,0;LeatherScraps,0,1"); RegisterGameObject("TunicRagsGreen", "Soaker:TunicRags,1,0;TanningMix;MushroomYellow,1,0;MushroomBlue,1,0;LeatherScraps,0,1"); RegisterGameObject("WashbasinRequired", "Washbasin:TanningMix"); RegisterGameObject("HairdyeBlack", "Washbasin:TanningMix;Truffle"); RegisterGameObject("HairdyeBleach", "Washbasin:TanningMix;Thistle,2"); RegisterGameObject("HairdyeRed", "Washbasin:TanningMix;Mushroom,3"); RegisterGameObject("HairdyeYellow", "Washbasin:TanningMix;MushroomYellow,2"); RegisterGameObject("HairdyeOrange", "Washbasin:TanningMix;Mushroom,2;MushroomYellow"); RegisterGameObject("HairdyeBlue", "Washbasin:TanningMix;MushroomBlue"); RegisterGameObject("HairdyePurple", "Washbasin:TanningMix;Mushroom,2;MushroomBlue"); RegisterGameObject("HairdyeGreen", "Washbasin:TanningMix;MushroomYellow;MushroomBlue"); RegisterGameObject("BlueJelly", "Cookpot:Blueberries,2;Raspberry"); RegisterGameObject("BraisedBoar", "Cookpot:RawMeat;Onion;Apples"); RegisterGameObject("NeckSurprise", "Cookpot:NeckTail;Truffle;Honey"); RegisterGameObject("RabbitStew", "Cookpot:RabbitMeat;Mushroom,2"); RegisterGameObject("SweetSoup", "Cookpot:Carrot;Raspberry,2"); RegisterGameObject("TruffleBroth", "Cookpot:Truffle;Turnip;Blueberries,2"); RegisterGameObject("BearBait", "Cookpot:PoisonBase;Honey,2"); RegisterGameObject("BearPotroast", "Cookpot,1,2:BjornMeat;Truffle;Onion,2;Carrot,2"); RegisterGameObject("BoiledWolf", "Cookpot,1,2:WolfMeat"); RegisterGameObject("StickyPoison", "Cookpot,1,4:PoisonBase;Resin,2"); RegisterGameObject("ColdPoison", "Cookpot,2:FreezeGland;PoisonBase;PowderedCrystal"); RegisterGameObject("FineBones", "Cookpot,2:BjornPaw"); RegisterGameObject("HealingSalve", "Cookpot,2,5:Honey;Cloudberry;Dandelion,5;PowderedCrystal"); RegisterGameObject("PixieCola", "Cookpot,2:PixieDust;Honey;MushroomBlue;PowderedCrystal"); RegisterGameObject("SwiftPotion", "Cookpot,2,3:PixieDust;Honey,3;MushroomYellow,3;PowderedCrystal,3"); RegisterGameObject("DedoxTonic", "Cookpot,2,3:DoxieDust;Honey,3;WolfFang;PowderedCrystal,3"); RegisterGameObject("DobbieJuice", "Cookpot,2,3:DoxieDust;Guck;PoisonBase;PowderedCrystal,3"); RegisterGameObject("DoxsickOil", "Cookpot,2,3:DoxieDust;BadSeed;RatTail;PowderedCrystal,3"); RegisterGameObject("DoxsickTar", "Cookpot,2,3:DoxieDust;BadSeed;RatTailDraugr;PowderedCrystal,3"); RegisterGameObject("PebbleGold", "Cookpot,2,5:Coins,5"); RegisterGameObject("PebbleSilver", "Cookpot,2:SilverNecklace"); RegisterGameObject("PebbleWhiteGold", "Cookpot,2,5:SilverNecklace;Coins,5"); TreePortal.RegisterTreeTargets("Oak1", "DrakeNest01"); TreePortal.RegisterTreeTargets("Beech1", "SunkenCrypt4"); TreePortal.RegisterTreeTargets("FirTree", "SunkenCrypt4"); TreePortal.RegisterTreeTargets("Pinetree_01", "GoblinCamp2"); TreePortal.RegisterTreeTargets("SwampTree1", "StartTemple"); Alignment.SetupAlignments(); harmony.PatchAll(); } private static bool IsObjectDBReady() { return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Wood") != (Object)null; } private static AssetBundle GetAssetBundleFromResources(string fileName) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(fileName)); using Stream stream = executingAssembly.GetManifestResourceStream(name); return AssetBundle.LoadFromStream(stream); } private static void RegisterGameObject(string itemName, string recipeRecipe = "", string pieces = "") { if ((Object)(object)w_assetBundle == (Object)null) { WDBUG.Log("RegisterGameObject(" + itemName + ") call before assetBundle has been set."); return; } GameObject val = null; try { val = w_assetBundle.LoadAsset("Assets/CustomItems/Wildling_" + itemName + ".prefab"); } catch { val = null; } if ((Object)(object)val == (Object)null) { WDBUG.Log("ERROR: No asset found at Wildling_" + itemName + ".prefab"); return; } WDBUG.Log("Loaded prefab Wildling_" + itemName, WDBUG.Level.AssetLoad); AddGameObject(itemName, val); RegisterGameRecipe(itemName, recipeRecipe); RegisterGamePlacer(itemName, pieces); } private static void RegisterGameRecipe(string itemName, string recipeRecipe) { if (!(itemName == "") && !(recipeRecipe == "")) { if (w_gameRecipes.ContainsKey(itemName)) { WDBUG.Log("A registered recipe for " + itemName + " already exists. Add another using a call to AddItemRecipe"); return; } WDBUG.Log("Registering recipe for " + itemName + " = " + recipeRecipe, WDBUG.Level.AssetLoad); w_gameRecipes.Add(itemName, recipeRecipe); } } private static void RegisterGamePlacer(string itemName, string pieceList) { if (!(itemName == "") && !(pieceList == "")) { if (w_gamePlacers.ContainsKey(itemName)) { WDBUG.Log("A registered placer list for " + itemName + " already exists."); } else { w_gamePlacers.Add(itemName, pieceList); } } } private static bool AddGameObject(string itemName, GameObject prefab, bool lateRegister = false) { if (itemName == "" || (Object)(object)prefab == (Object)null) { WDBUG.Log("Cannot register '" + itemName + "' (null) prefab to game object list."); return false; } if (w_gameObjects.ContainsKey(itemName)) { WDBUG.Log("A registered game object for " + itemName + " already exists."); return false; } w_gameObjects.Add(itemName, prefab); if (lateRegister) { ZNetScene.instance.m_prefabs.Add(prefab); } return true; } private static Recipe MakeRecipe(string wildlingItem, string recipeRecipe) { if (recipeRecipe == "" || recipeRecipe.StartsWith("#")) { return null; } GameObject prefab = WUTIL.GetPrefab(wildlingItem); if ((Object)(object)prefab == (Object)null) { WDBUG.Log(wildlingItem + " is not a registered WildlingMod or Valheim prefab name"); return null; } ItemDrop component = prefab.GetComponent(); CraftingStation craftingStation = null; if ((Object)(object)component == (Object)null && (Object)(object)prefab.GetComponent() == (Object)null) { WDBUG.Log(wildlingItem + " is not an item or piece - recipe will have null reference"); } int minStationLevel = 1; int amount = 1; string text = recipeRecipe; string text2 = ""; string[] array = recipeRecipe.Split(new char[1] { ':' }); if (array.Length > 1) { try { string[] array2 = array[0].Split(new char[1] { ',' }); text2 = ((array2.Length != 0) ? array2[0] : ""); minStationLevel = ((array2.Length <= 1) ? 1 : int.Parse(array2[1])); amount = ((array2.Length <= 2) ? 1 : int.Parse(array2[2])); text = array[1]; } catch { WDBUG.Log("MakeRecipe(" + wildlingItem + ", " + recipeRecipe + " failed parsing " + array[0] + " - try/catch (non-integers?)"); text2 = ""; } } if (text2 == "") { WDBUG.Log("Recipe " + recipeRecipe + " did not specify a bench for " + wildlingItem + " - Basic (null) assumed.", WDBUG.Level.AssetConfig); text2 = "Basic"; } else if (text2 != "Basic") { if (!w_gameObjects.ContainsKey(text2) || (Object)(object)w_gameObjects[text2].GetComponent() == (Object)null) { WDBUG.Log("MakeRecipe(" + wildlingItem + ", " + recipeRecipe + " - " + text2 + " did not specify a valid CraftingTable"); text2 = "Basic"; } else { craftingStation = w_gameObjects[text2].GetComponent(); } } List list = new List(); string[] array3 = text.Split(new char[1] { ';' }); foreach (string text3 in array3) { try { string[] array4 = text3.Split(new char[1] { ',' }); string text4 = array4[0]; if (text4 == "") { WDBUG.Log("MakeRecipe missing ingredient '" + text3 + "' of recipe " + text + " for " + wildlingItem); continue; } int num = ((array4.Length <= 1) ? 1 : int.Parse(array4[1])); int amountPerLevel = ((array4.Length <= 2) ? 1 : int.Parse(array4[2])); bool recover = true; if (num < 0) { num = -num; recover = false; } Requirement val = RecipeRequirement(text4, num, amountPerLevel, recover); if (val != null) { list.Add(val); } } catch { WDBUG.Log("Failed parsing resource " + text3 + " for " + wildlingItem); } } if (list.Count == 0) { WDBUG.Log("Failed to make resources for " + wildlingItem + " using " + recipeRecipe + " @ " + text2 + " for " + recipeRecipe); return null; } Recipe val2 = ScriptableObject.CreateInstance(); val2.m_item = component; val2.m_resources = list.ToArray(); val2.m_amount = amount; val2.m_minStationLevel = minStationLevel; val2.m_craftingStation = craftingStation; if (text2 == "Basic") { craftingStation = w_gameObjects["MakingTable"].GetComponent(); val2.m_repairStation = craftingStation; } if ((Object)(object)component == (Object)null) { text2 = "Piece"; } if (m_gameObjectTypeCounts.ContainsKey(text2)) { Dictionary gameObjectTypeCounts = m_gameObjectTypeCounts; string key = text2; int value = gameObjectTypeCounts[key] + 1; gameObjectTypeCounts[key] = value; } else { m_gameObjectTypeCounts.Add(text2, 1); } WDBUG.Log($"{text2}:{m_gameObjectTypeCounts[text2]} {wildlingItem} recipe added: {recipeRecipe}", WDBUG.Level.AssetConfig); return val2; } private static Requirement RecipeRequirement(string itemName, int amount = 1, int amountPerLevel = 0, bool recover = true) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown ItemDrop val = null; GameObject prefab = WUTIL.GetPrefab(itemName); if (!Object.op_Implicit((Object)(object)prefab)) { WDBUG.Log("RecipeRequirement(): GetPrefab(" + itemName + ") failed."); return null; } val = prefab.GetComponent(); if ((Object)(object)val == (Object)null && (Object)(object)prefab.GetComponent() == (Object)null) { WDBUG.Log("RecipeRequirement " + itemName + " is not for an ItemDrop or Piece"); } Requirement val2 = new Requirement(); val2.m_resItem = val; val2.m_amount = amount; val2.m_amountPerLevel = amountPerLevel; val2.m_recover = recover; return val2; } private static void SetupPieceTable(string toolName, string pieceList) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (!w_gameObjects.ContainsKey(toolName)) { WDBUG.Log("SetupPieceTable: " + toolName + " is not a Wildling item."); return; } if ((Object)(object)w_gameObjects[toolName].GetComponent() != (Object)null) { WDBUG.Log("Deferred PieceTable for cooking station " + toolName, WDBUG.Level.AssetConfig); return; } ItemDrop component = w_gameObjects[toolName].GetComponent(); PieceTable val = new PieceTable(); if (val.m_categories.Count == 0) { string[] array = "Camp|Crafting|Treehouse|Furniture".Split(new char[1] { '|' }); for (int i = 0; i < 4; i++) { PieceCategory item = (PieceCategory)((i == 3) ? 4 : i); val.m_categories.Add(item); val.m_categoryLabels.Add(array[i]); } } string[] array2 = pieceList.Split(new char[1] { ',' }); foreach (string text in array2) { if (w_gameObjects.ContainsKey(text)) { Piece component2 = w_gameObjects[text].GetComponent(); if ((Object)(object)component2 == (Object)null) { WDBUG.Log("Cannot add non-Piece " + text + " to " + toolName + " from\n" + pieceList + "."); } else { WDBUG.Log("Adding Piece Prefab " + text + " to " + toolName, WDBUG.Level.AssetConfig); val.m_pieces.Add(w_gameObjects[text]); } } else { WDBUG.Log("Piece " + text + " is not a Wildling object."); } } if (val.m_pieces.Count > 0) { if ((Object)(object)component.m_itemData.m_shared.m_buildPieces == (Object)null) { WDBUG.Log(toolName + " replacing missing PieceTable"); component.m_itemData.m_shared.m_buildPieces = val; return; } WDBUG.Log($"Replacing {toolName} {component.m_itemData.m_shared.m_buildPieces.m_pieces.Count} for {val.m_pieces.Count} pieces", WDBUG.Level.AssetConfig); component.m_itemData.m_shared.m_buildPieces.m_pieces = val.m_pieces; component.m_itemData.m_shared.m_buildPieces.m_categories = val.m_categories; component.m_itemData.m_shared.m_buildPieces.m_categoryLabels = val.m_categoryLabels; } } private static void SetupCookingList(string cookerName, string cookList) { //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown if (!w_gameObjects.ContainsKey(cookerName)) { WDBUG.Log("SetupCookList found no prefab registered for " + cookerName); return; } CookingStation component = w_gameObjects[cookerName].GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } List list = new List(); string[] array = cookList.Split(new char[1] { ';' }); foreach (string text in array) { try { string[] array2 = text.Split(new char[1] { ',' }); if (array2.Length < 2) { WDBUG.Log("SetupCookList for " + cookerName + " failed to parse " + text + " - did not specify to, from items"); continue; } GameObject prefab = WUTIL.GetPrefab(array2[0]); ItemDrop val = (((Object)(object)prefab == (Object)null) ? null : prefab.GetComponent()); if ((Object)(object)val == (Object)null) { WDBUG.Log("SetupCookList for " + cookerName + " failed to parse " + text + " - " + array2[0] + " is not an ItemDrop prefab."); continue; } GameObject prefab2 = WUTIL.GetPrefab(array2[1]); ItemDrop val2 = (((Object)(object)prefab2 == (Object)null) ? null : prefab2.GetComponent()); if ((Object)(object)val2 == (Object)null) { WDBUG.Log("SetupCookList for " + cookerName + " failed to parse " + text + " - " + array2[1] + " is not an ItemDrop prefab."); } else { float num = ((array2.Length > 2) ? ((float)int.Parse(array2[2])) : 10f); ItemConversion val3 = new ItemConversion(); val3.m_from = val; val3.m_to = val2; val3.m_cookTime = num; list.Add(val3); WDBUG.Log($"Added Cooking {((Object)val).name} -> {((Object)val2).name} ({num}s) to {cookerName}", WDBUG.Level.AssetConfig); } } catch { WDBUG.Log("SetupCookList for " + cookerName + " failed to parse " + text + " - try/catch"); } } if (list.Count == 0) { WDBUG.Log("Empty cook list added to " + cookerName + " for " + cookList); } component.m_conversion = list; } private static void AddItemPrefab(string itemName, GameObject prefab, string pieceNames = "") { if (pieceNames != "") { SetupPieceTable(itemName, pieceNames); } ItemDrop component = prefab.GetComponent(); if (!((Object)(object)component == (Object)null)) { WDBUG.Log("Registering item " + itemName, WDBUG.Level.AssetLoad); if ((Object)(object)ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(((Object)prefab).name)) == (Object)null) { ObjectDB.instance.m_items.Add(prefab); Dictionary dictionary = (Dictionary)typeof(ObjectDB).GetField("m_itemByHash", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(ObjectDB.instance); dictionary[StringExtensionMethods.GetStableHashCode(((Object)prefab).name)] = prefab; WDBUG.Log("Added ItemDrop " + itemName + " prefab and hash to ObjectDB", WDBUG.Level.AssetLoad); } else { WDBUG.Log("Didn't re-add " + itemName + " prefab due to exisitng hash", WDBUG.Level.AssetLoad); } } } private static void AddItemRecipe(string itemName, string recipeRecipe) { if (recipeRecipe == "") { return; } GameObject prefab = WUTIL.GetPrefab(itemName); if ((Object)(object)prefab == (Object)null) { WDBUG.Log("AddItemRecipe: " + itemName + " is not a registered prefab name"); return; } ItemDrop component = prefab.GetComponent(); Piece component2 = prefab.GetComponent(); if ((Object)(object)component == (Object)null && (Object)(object)component2 == (Object)null) { if ((Object)(object)prefab.GetComponent() == (Object)null) { WDBUG.Log("AddItemRecipe(" + itemName + ", " + recipeRecipe + ") called for unexpected prefab type "); } return; } Recipe val = MakeRecipe(itemName, recipeRecipe); if ((Object)(object)val == (Object)null) { WDBUG.Log("AddItemRecipe(" + itemName + ", " + recipeRecipe + ") failed for recipe"); return; } if ((Object)(object)component != (Object)null) { if ((Object)(object)val.m_item == (Object)null) { WDBUG.Log("AddItemRecipe(" + itemName + ", " + recipeRecipe + ") failed - no item in MakeRecipe() recipe"); return; } val.m_enabled = Wildling.IsWildling; string name = ((Object)val.m_item).name; if (ObjectDB.instance.m_recipes.Contains(val)) { WDBUG.Log("ObjectDB already had recipe for " + name); } else { ObjectDB.instance.m_recipes.Add(val); WDBUG.Log("Added Recipe for " + name + " prefab to ObjectDB", WDBUG.Level.AssetLoad); } if (!w_gameObjectRecipes.ContainsKey(name)) { w_gameObjectRecipes.Add(name, val); return; } WDBUG.Log("Refreshed recipe for " + name, WDBUG.Level.AssetLoad); w_gameObjectRecipes[name] = val; return; } component2.m_craftingStation = val.m_craftingStation; component2.m_resources = val.m_resources; if (!((Object)(object)prefab.GetComponent() != (Object)null)) { return; } string[] array = recipeRecipe.Split(new char[1] { ':' }); if (array.Length <= 1) { return; } if (!w_gameObjects.ContainsKey(array[0])) { WDBUG.Log("StationExtension target " + array[0] + " is not a wilding object"); return; } CraftingStation component3 = w_gameObjects[array[0]].GetComponent(); if ((Object)(object)component3 == (Object)null) { WDBUG.Log("StationExtension target " + array[0] + " is not a crafting station"); return; } w_gameObjects[itemName].GetComponent().m_craftingStation = component3; WDBUG.Log("Added " + itemName + " as a StationExtension to " + array[0], WDBUG.Level.AssetConfig); } private static void SetupGameObjects(string caller, bool partial = false) { if (!IsObjectDBReady()) { WDBUG.Log("SetupGameObjects " + caller + " is not ready", WDBUG.Level.startup); return; } WDBUG.Log($"SetupGameObjects from {caller} partial: {partial}", WDBUG.Level.AssetConfig); foreach (KeyValuePair w_gameObject in w_gameObjects) { if (!partial) { ReconfigGO(w_gameObject.Value); } string pieceNames = (w_gamePlacers.ContainsKey(w_gameObject.Key) ? w_gamePlacers[w_gameObject.Key] : ""); AddItemPrefab(w_gameObject.Key, w_gameObject.Value, pieceNames); } TreePortal.RegisterPortal(); if (partial) { WUTIL.TimerReset("startupTutorialDelay", 120f); return; } WDBUG.Log("SetupGameObjects adding recipes", WDBUG.Level.AssetConfig); foreach (KeyValuePair w_gameRecipe in w_gameRecipes) { AddItemRecipe(w_gameRecipe.Key, w_gameRecipes[w_gameRecipe.Key]); } string text = ""; foreach (KeyValuePair gameObjectTypeCount in m_gameObjectTypeCounts) { text = text + " " + gameObjectTypeCount.Key + ": " + gameObjectTypeCount.Value; } WDBUG.Log("Setup" + text, WDBUG.Level.AssetConfig); AddItemRecipe("PebbleRough", "StoneGrip,1,5:Stone"); AddItemRecipe("PebbleSharp", "StoneGrip,1,5:Flint"); AddItemRecipe("LeatherScraps", "HidingRack:DeerHide"); AddItemRecipe("LeatherScraps", "HidingRack,2,2:WolfPelt"); AddItemRecipe("LeatherScraps", "HidingRack,2,3:BjornHide"); AddItemRecipe("LeatherScraps", "HidingRack,3,3:LoxPelt"); WDBUG.Log("SetupGameObjects cooking conversions for cooker pieces", WDBUG.Level.AssetConfig); foreach (KeyValuePair w_gamePlacer in w_gamePlacers) { SetupCookingList(w_gamePlacer.Key, w_gamePlacer.Value); } WDBUG.Log("SetupGameObjects adding map markers", WDBUG.Level.AssetConfig); MapMarker.AddMarkerRecipes(1, "PetDeer,familiar,TrophyDeer;PetBoar,familiar,TrophyBoar;PetNeck,familiar,TrophyNeck;PetWolf,familiar,TrophyWolf"); MapMarker.AddMarkerRecipes(1, "Ally,familiar,ShieldWood,2;Animal,animal,RawMeat;Neck,fishy,NeckTail;Troll,earthy,TrollHide"); MapMarker.AddMarkerRecipes(1, "Greydwarf,woody,AncientSeed;Goblin,pungent,BlackMetalScrap;Enemy,warning,MaceSilver"); MapMarker.AddMarkerRecipes(1, "Undead,rotten,BoneFragments;Undead1,putrid,attach_edge2;Undead2,acrid,TrophyWraith;Undead3,fetid,Ooze"); MapMarker.AddMarkerRecipes(1, "Demon,farty,attach_edge;Monster,foul,BoratTrophy;Truffle,fusty,Truffle"); MapMarker.AddMarkerRecipes(2, "Greyling,8,TrophyGreydwarf;Greydwarf,12,TrophyGreydwarf;Greydwarf_Shaman,15,TrophyGreydwarfShaman"); MapMarker.AddMarkerRecipes(2, "Greydwarf_Elite,18,TrophyGreydwarfBrute;Troll,18,TrophyFrostTroll"); MapMarker.AddMarkerRecipes(2, "Greydwarf_Warlock,12,TrophyTheElder;Greydwarf_Commander,18,TrophyGreydwarfBrute;Attack,0,attach_base"); MapMarker.AddMarkerRecipes(0, "Chimes,0,Headstone;Borat,0,PropTable;GreatOak,0,Piece_AmberCasing;Prince,0,GoblinPrinceTrophy"); MapMarker.AddMarkerRecipes(0, "TreePortal;MatchPlaced,0,piece_groundtorch_wood;BoundDeer,0,TrophyEikthyr"); MapMarker.AddMarkerRecipes(3, "Borat1;GreatOak1;Prince0;Prince1;Prince2"); MapMarker.AddMarkerRecipes(4, "Ygnie,8,ElderChest"); MapMarker.AddMarkerRecipes(1, "PetBoar_piggy,baby,TrophyBoar;PetWolf_cub,fuzzy,TrophyWolf;PetLox,massive,TrophyLox;PetLox_Calf,loxy,TrophyLox"); MapMarker.AddMarkerRecipes(1, "RabbitMeat,sweet,RabbitFur;DeerMeat,musky,DeerHide;BoarMeat,taint,LeatherScraps;RatMeat,fetid,DeadRat;WolfMeat,slightly spicy,WolfPelt;LoxMeat,earthy,LoxPelt;BjornMeat,fusty,BjornHide"); MapMarker.AddMarkerRecipes(0, "SunkenShip,30,Shipwreck;ShipWreck,26,tepee_flatten;SunkenChest,6,TreasureChest_swamp"); MapMarker.AddMarkerRecipes(1, "PetCat,familiar,CatItem"); WDBUG.Log("Adding status effects", WDBUG.Level.AssetConfig); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); ObjectDB.instance.m_StatusEffects.Add((StatusEffect)(object)ScriptableObject.CreateInstance()); } private void OnDestroy() { harmony.UnpatchSelf(); } private static bool CheckAchievementRecipe(string achievement, string item, int minValue = 1) { string key = "Wildling_" + item; if (w_gameObjectRecipes.ContainsKey(key)) { w_gameObjectRecipes[key].m_enabled = Quest.GetAchievement(achievement) >= minValue; return true; } return false; } public static ItemData GetHandAction(int action, Humanoid humanoid) { m_getBeardAction = action; if ((Object)(object)humanoid == (Object)null) { ((Humanoid)Player.m_localPlayer).GetBeard(); } else { humanoid.GetBeard(); } m_getBeardAction = 0; ItemData getBeardItem = m_getBeardItem; m_getBeardItem = null; return getBeardItem; } private static void ReconfigGO(GameObject go) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) Piece component = go.GetComponent(); if ((Object)(object)component != (Object)null && (int)component.m_category == 3) { component.m_category = (PieceCategory)4; } } } internal class Crafting { [HarmonyPatch(typeof(InventoryGui), "UpdateRepair")] private class PatchInventoryGuiUpdateRepair { private static bool Prefix(InventoryGui __instance) { if (m_hideRepairButton) { ((Component)__instance.m_repairPanel).gameObject.SetActive(false); ((Component)__instance.m_repairPanelSelection).gameObject.SetActive(false); ((Component)__instance.m_repairButton).gameObject.SetActive(false); return false; } return true; } } [HarmonyPatch(typeof(InventoryGui), "CanRepair")] private class PatchInventoryGuiCanRepair { private static bool Prefix(ItemData item, ref bool __result) { if ((Object)(object)Player.m_localPlayer == (Object)null || !item.m_shared.m_canBeReparied || Player.m_localPlayer.NoCostCheat()) { return true; } CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if ((Object)(object)currentCraftingStation == (Object)null) { return true; } Recipe recipe = ObjectDB.instance.GetRecipe(item); if ((Object)(object)recipe == (Object)null || (Object)(object)recipe.m_craftingStation == (Object)null) { return true; } string name = currentCraftingStation.m_name; string text = name; if (!(text == "Making table")) { if (text == "Hiding rack" && recipe.m_craftingStation.m_name == "Soaker") { __result = true; return false; } } else if (recipe.m_craftingStation.m_name == "Stone grip" || WUTIL.GameName(((Component)recipe.m_item).gameObject).StartsWith("Knife")) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(Inventory), "AddItem", new Type[] { typeof(string), typeof(int), typeof(int), typeof(int), typeof(long), typeof(string), typeof(Vector2i), typeof(bool) })] private class PatchInventoryAddItem_Craft { private static bool Prefix(string name, ref ItemData __result) { string text = WUTIL.GameName(name); if (text.StartsWith("Hairdye")) { DyeHairColor(text.Substring(7)); __result = WUTIL.CreateItemData(name); return false; } return true; } private static void Postfix(long crafterID, ItemData __result) { if (__result != null && Wildling.IsWildling && crafterID == WUTIL.PlayerID) { Quest.TrackCraft(__result); } } private static void DyeHairColor(string dye) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: 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_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) WDBUG.Log("DyeHairColor: " + dye, WDBUG.Level.Crafting); Vector3 hairColor = Wildling.HairColor; switch (dye) { case "Red": hairColor = c_hairColorRed; break; case "Blue": hairColor = c_hairColorBlue; Quest.SetAchievement("Deja Blue", 1); break; case "Green": hairColor = c_hairColorGreen; break; case "Orange": hairColor = c_hairColorOrange; break; case "Purple": hairColor = c_hairColorPurple; break; case "Yellow": hairColor = c_hairColorYellow; break; case "Black": hairColor *= 0.75f; if (hairColor.x < 0.1f) { hairColor.x = 0.1f; } if (hairColor.y < 0.1f) { hairColor.y = 0.1f; } if (hairColor.z < 0.1f) { hairColor.z = 0.1f; } break; case "Bleach": hairColor *= 1.25f; if (hairColor.x > 0.9f) { hairColor.x = 0.9f; } if (hairColor.y > 0.9f) { hairColor.y = 0.9f; } if (hairColor.z > 0.9f) { hairColor.z = 0.9f; } break; default: WDBUG.Log("Unknown hair dye: " + dye); return; } m_hairColorChange = (hairColor - Wildling.HairColor) * Time.fixedDeltaTime / 4f; WUTIL.TimerReset("change_hair", 4f); } } [HarmonyPatch(typeof(Player), "AddKnownRecipe")] private class PatchPlayerAddKnownRecipe { private static bool Prefix(Player __instance, Recipe recipe, HashSet ___m_knownRecipes) { if (m_checkAddKnownRecipe) { WDBUG.Log("Checking AddKnownRecipe for " + recipe.m_item.m_itemData.m_shared.m_name); } if (___m_knownRecipes.Contains(recipe.m_item.m_itemData.m_shared.m_name)) { if (m_checkAddKnownRecipe) { WDBUG.Log("Recipe known"); } return true; } bool flag = true; string text = recipe.m_item.m_itemData.m_shared.m_setName; if (text == "WildlingPigment") { flag = Quest.GetAchievement("BLD:Washbasin") > 0; } else if (text == "Clutch") { flag = Quest.GetAchievement("Throwsticks") > 0; } else if (text.EndsWith(" pebble")) { flag = Quest.GetAchievement("BLD:MakingTable") > 0; } else { text = WUTIL.GameName(((Component)recipe.m_item).gameObject); if (c_pestleAndMortorRecipes.Contains(text)) { flag = Quest.GetAchievement("CFT:PestleAndMortar") > 0; } else if (text == "SkeletonKey") { flag = Quest.GetAchievement("LocksPicked") > 0; } } if (!flag) { WDBUG.Log("Blocked locked AddKnownRecipe for " + text, WDBUG.Level.RecipeUnlock); } return flag; } } [HarmonyPatch(typeof(MessageHud), "QueueUnlockMsg")] public class PatchMessageHudQueueUnlockMsg { public static bool Prefix(string description) { if (m_blockUnlockMessage.Contains(description)) { WDBUG.Log("Blocked unlock message for " + description, WDBUG.Level.RecipeUnlock); m_blockUnlockMessage.Remove(description); return false; } return true; } } [HarmonyPatch(typeof(Player), "AddKnownStation")] public class PatchPlayerAddKnownStation { public static void Prefix(CraftingStation station) { TrackFound(((Component)station).gameObject); } } [HarmonyPatch(typeof(Player), "AddKnownItem")] private class PatchPlayerAddKnownItem { private static void Prefix(ItemData item, HashSet ___m_knownMaterial) { if (!___m_knownMaterial.Contains(item.m_shared.m_name)) { TrackFound(item.m_dropPrefab); } } private static void Postfix(ItemData item, HashSet ___m_knownMaterial) { if (!___m_knownMaterial.Contains("Rabbit fur")) { switch (WUTIL.ItemName(item)) { case "RabbitFurTan": case "RabbitFurGrey": case "RabbitFurWhite": AddKnownItems("RabbitFur"); break; } } } } [HarmonyPatch(typeof(InventoryGui), "UpdateRecipe")] public class PatchPlayerHaveRequirements { public static void Postfix(InventoryGui __instance, Player player, List ___m_reqList) { if (___m_reqList.Count == 0) { return; } Transform parent = __instance.m_recipeRequirementList[0].transform.parent; if ((Object)(object)parent != (Object)null) { ((Component)parent).gameObject.SetActive(true); } CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); string text = (((Object)(object)currentCraftingStation == (Object)null) ? "" : currentCraftingStation.m_name); if (___m_reqList.Count == 1 && (text == "Soaker" || text == "Washbasin") && WUTIL.ItemName(___m_reqList[0].m_resItem, goName: true) == "TanningMix") { WDBUG.Log("Hidding requirements for " + WUTIL.ItemName(___m_reqList[0].m_resItem)); ((Component)__instance.m_craftButton).gameObject.SetActive(false); if ((Object)(object)parent != (Object)null) { ((Component)parent).gameObject.SetActive(false); } ((Component)__instance.m_minStationLevelIcon).gameObject.SetActive(false); for (int i = 0; i < __instance.m_recipeRequirementList.Length; i++) { InventoryGui.HideRequirement(__instance.m_recipeRequirementList[i].transform); } } } } [HarmonyPatch(typeof(Inventory), "CanAddItem", new Type[] { typeof(GameObject), typeof(int) })] private class PatchInventoryCanAddItem_Craft { private static bool Prefix(GameObject prefab, int stack, ref bool __result) { if (WUTIL.IsWildlingObject(prefab)) { string text = ReplacedItem(WUTIL.GameName(prefab)); if (WUTIL.IsEmptySlot(text, stack)) { WDBUG.Log($"Can replace {text} x{stack}", WDBUG.Level.Crafting); __result = true; return false; } } return true; } } [HarmonyPatch(typeof(Player), "GetAvailableRecipes")] private class PatchPlayerGetAvailableRecipes { private static void Postfix(Player __instance, ref List available) { if (!Wildling.IsWildling) { return; } CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); bool flag = (Object)(object)currentCraftingStation == (Object)null; string text = (flag ? "" : currentCraftingStation.m_name); bool flag2 = text == "Stone grip"; bool flag3 = text == "Hiding rack"; bool flag4 = text == "Soaker" || text == "Washbasin"; bool flag5 = flag && WUTIL.GetInventoryItemData("StickyPoison") == null; bool flag6 = flag && WUTIL.GetInventoryItemData("PestleAndMortar", mustBeEquipped: true) == null; bool flag7 = flag && WUTIL.GetInventoryItemData("Bedroll") == null; bool flag8 = flag && WUTIL.GetInventoryItemData("Campkit1") == null; bool flag9 = flag && WUTIL.GetInventoryItemData("Campkit2") == null; bool flag10 = !((Selectable)InventoryGui.instance.m_tabUpgrade).interactable; bool flag11 = Quest.AchievementAwarded("Hammer"); bool flag12 = false; flag4 &= available.Count > 1; foreach (Recipe item in available.ToList()) { string text2 = WUTIL.GameName(((Component)item.m_item).gameObject); bool flag13 = text2.StartsWith("Knife"); bool flag14 = false; if (flag3 && text2 == "LeatherScraps") { flag14 = !__instance.IsMaterialKnown(item.m_resources[0].m_resItem.m_itemData.m_shared.m_name); } else { if (!flag13 && !WUTIL.IsWildlingObject(((Component)item.m_item).gameObject)) { continue; } if (flag4 && text2.EndsWith("Required")) { flag14 = true; flag4 = false; } else if (flag2) { if ((Object)(object)item.GetRequiredStation(0) == (Object)null) { if (text2 == "Chipper") { item.m_repairStation = currentCraftingStation; } else { flag14 = true; } } } else if (flag10) { if (!(text2 == "Chipper" || text2 == "Stick" || flag13)) { flag14 = (flag12 ? (text2.EndsWith("Poisoned") || text2.EndsWith("Wildling")) : ((!text2.EndsWith("Poisoned")) ? Equipment.IsCarryItem(text2) : (!(flag13 || text2.StartsWith("Throwstick") || flag11)))); } else { item.m_repairStation = currentCraftingStation; } } else if (flag) { flag14 = (flag5 && (text2.EndsWith("Poisoned") || text2 == "PebbleBad")) || (flag6 && (text2 == "PebbleRough" || text2 == "PebbleSharp")) || (flag7 && text2 == "Campkit1") || (flag8 && text2 == "Campkit2") || (flag9 && text2 == "Campkit3"); } else { bool flag15 = false; } } if (flag14) { available.Remove(item); } } } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static class PatchInventoryGuiDoCrafting { public static bool Prefix(InventoryGui __instance, Player player, Recipe ___m_craftRecipe, ItemData ___m_craftUpgradeItem, int ___m_craftVariant, bool ___m_multiCrafting) { if ((Object)(object)___m_craftRecipe == (Object)null || !Wildling.IsWildling) { return true; } string text = WUTIL.GameName(((Component)___m_craftRecipe.m_item).gameObject); if (text.EndsWith("Required")) { return false; } string text2 = ""; string text3 = ""; int decQuality = 0; if (___m_craftUpgradeItem == null && WUTIL.IsWildlingObject(((Component)___m_craftRecipe.m_item).gameObject)) { text2 = ReplacedItem(text); if (text2 != "") { if (text.StartsWith("TunicRags") || text == "PantsRagsSwim" || text == "HoodRagsWildling") { decQuality = -1; } else if (text.EndsWith("Wildling")) { decQuality = 0; } GameObject prefab = WUTIL.GetPrefab(text2); ItemData val = ((prefab == null) ? null : prefab.GetComponent()?.m_itemData); if (val == null) { WDBUG.Log("PatchInventoryGuiDoCrafting could not get item data for " + text2); } else { text3 = val.m_shared.m_name; } } } bool flag = text3 != ""; bool flag2 = false; Requirement[] resources = ___m_craftRecipe.m_resources; foreach (Requirement val2 in resources) { if (flag && val2.m_resItem.m_itemData.m_shared.m_name == text3) { flag = false; } if (val2.m_resItem.m_itemData.m_shared.m_name == "Chipper") { flag2 = true; } } if (flag2 && ChipperBreak(player, ___m_craftRecipe)) { __instance.OnTabCraftPressed(); return false; } if (text2 != "") { int craftMultiplier = ((!___m_multiCrafting) ? 1 : __instance.m_multiCraftAmount); if (flag) { WDBUG.Log("Failed to match " + text2 + " to recipe for " + text); } else if (CraftReplacement(player, ___m_craftRecipe, text2, ___m_craftVariant, decQuality, craftMultiplier)) { __instance.OnTabCraftPressed(); } return false; } return true; } public static void Postfix(InventoryGui __instance, Player player, Recipe ___m_craftRecipe) { ItemData inventoryItemData = WUTIL.GetInventoryItemData("PestleAndMortar", mustBeEquipped: true); if (inventoryItemData != null) { string text = WUTIL.GameName(((Component)___m_craftRecipe.m_item).gameObject); bool flag = text.StartsWith("Pebble") && text != "PebbleBad"; if ((flag && !m_atStation) || c_pestleAndMortorRecipes.Contains(text)) { inventoryItemData.m_durability = Mathf.Max(inventoryItemData.m_durability - (float)(((!flag) ? 1 : 2) * ___m_craftRecipe.m_amount), 0f); WUTIL.TimerReset("crafting_autoequip", 0.05f); } } if (m_atCookpot) { CustomizeCraftingPanel("COOK"); } } private static bool ChipperBreak(Player player, Recipe craftRecipe) { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown if (player.NoCostCheat()) { return false; } ItemData inventoryItemData = WUTIL.GetInventoryItemData("Chipper", mustBeEquipped: false, -1); if (inventoryItemData == null) { WDBUG.Log("Failed to find expected Chipper in inventory"); return false; } Quest.ShowMainTutorial(6); float playerData = Wildling.GetPlayerData("WS.Chipping"); float durability = craftRecipe.m_item.m_itemData.m_durability; float num = 0.5f * (playerData + inventoryItemData.m_durability / durability); if (WUTIL.TestLuck(num)) { WDBUG.Log($"Chipper success chance: {num} dur: {inventoryItemData.m_durability} at skill: {100f * playerData} vs. target dur. {durability}", WDBUG.Level.Crafting); Wildling.RaiseSecondarySkill("Chipping", 0.0125f); return false; } Wildling.RaiseSecondarySkill("Chipping", 0.05f); Requirement[] array = (Requirement[])(object)new Requirement[craftRecipe.m_resources.Length]; for (int i = 0; i < craftRecipe.m_resources.Length; i++) { Requirement val = craftRecipe.m_resources[i]; float num2 = ((val.m_resItem.m_itemData.m_shared.m_name == "Chipper") ? 1f : num); array[i] = new Requirement(); array[i].m_resItem = val.m_resItem; array[i].m_amount = (int)(0.5f + num2 * (float)val.m_amount); array[i].m_amountPerLevel = (int)(0.5f + num2 * (float)val.m_amountPerLevel); array[i].m_recover = val.m_recover; } player.ConsumeResources(array, 1, -1, 1); WUTIL.Message("Your Chipper broke before you completed crafting."); return true; } public static bool CraftReplacement(Player player, Recipe craftRecipe, string replaceItem, int variant, int decQuality, int craftMultiplier) { //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) int num = craftRecipe.m_amount * craftMultiplier; if (num > 1 && !WUTIL.IsEmptySlot(replaceItem, num, force: true)) { WDBUG.Log($"CraftReplacement could not create inventory slot for {num}x {replaceItem}", WDBUG.Level.Crafting); } ItemData inventoryItemData = WUTIL.GetInventoryItemData(replaceItem, mustBeEquipped: false, decQuality + 1, num); if (num > 1 && inventoryItemData == null) { inventoryItemData = WUTIL.GetInventoryItemData(replaceItem, mustBeEquipped: false, (decQuality <= 0) ? 1 : (decQuality + 1)); } if (inventoryItemData == null) { WDBUG.Log("CraftReplacement did not find " + replaceItem + " in inventory"); return false; } int x = inventoryItemData.m_gridPos.x; int y = inventoryItemData.m_gridPos.y; float durability = inventoryItemData.m_durability; int num2 = inventoryItemData.m_quality - decQuality; string name = ((Object)((Component)craftRecipe.m_item).gameObject).name; Inventory inventory = ((Humanoid)player).GetInventory(); WDBUG.Log($"Craft replace {replaceItem} to {num}x {name} at quality {num2}", WDBUG.Level.Crafting); replaceItem = inventoryItemData.m_shared.m_name; int num3 = 0; Requirement[] resources = craftRecipe.m_resources; foreach (Requirement val in resources) { if (!Object.op_Implicit((Object)(object)val.m_resItem)) { continue; } int num4 = val.GetAmount(1) * craftMultiplier; if (num4 > 0) { if (val.m_resItem.m_itemData.m_shared.m_name == replaceItem) { num3 = num4; continue; } WDBUG.Log("Remove conversion recipe item " + WUTIL.ItemName(val.m_resItem) + " x" + num4, WDBUG.Level.Crafting); PlayerConsumeResources.RemoveGenericItem(inventory, val.m_resItem.m_itemData.m_shared.m_name, num4); } } ((Humanoid)Player.m_localPlayer).UnequipItem(inventoryItemData, false); int num5 = num3; if (inventoryItemData.m_stack <= num3) { WDBUG.Log($"Removing {inventoryItemData.m_stack}/{num3} {replaceItem}", WDBUG.Level.Crafting); num5 -= inventoryItemData.m_stack; inventory.RemoveItem(inventoryItemData); } if (num5 > 0) { WDBUG.Log($"Removing remaining {num5}x {replaceItem}", WDBUG.Level.Crafting); inventory.RemoveItem(replaceItem, num5, num2, true); } ItemData val2 = inventory.AddItem(name, num, num2, variant, player.GetPlayerID(), player.GetPlayerName(), false); name = WUTIL.GameName(name); if (val2 == null) { WDBUG.Log($"CraftReplacement failed for {replaceItem} to {num}x {name} at quality {num2}"); return false; } if (num3 == 1 && inventory.GetItemAt(x, y) == null) { inventoryItemData.m_gridPos.x = x; inventoryItemData.m_gridPos.y = y; } CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if ((Object)(object)currentCraftingStation == (Object)null) { WDBUG.Log("Transferring " + replaceItem + " durability " + durability, WDBUG.Level.Crafting); val2.m_durability = durability; InventoryGui.instance.m_craftItemDoneEffects.Create(((Component)player).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } else { currentCraftingStation.m_craftItemDoneEffects.Create(((Component)player).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } PlayerStats playerStats = Game.instance.GetPlayerProfile().m_playerStats; float num6 = playerStats[(PlayerStatType)1]; playerStats[(PlayerStatType)1] = num6 + 1f; return true; } } [HarmonyPatch(typeof(Inventory), "CountItems")] public class PatchInventoryCountItems { public static bool Prefix(Inventory __instance, string name, ref int __result) { if (name != "Rabbit fur") { return true; } int num = 0; foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { if (WUTIL.ItemName(allItem).StartsWith("RabbitFur")) { num += allItem.m_stack; } } __result = num; return false; } } [HarmonyPatch(typeof(Player), "ConsumeResources")] public class PlayerConsumeResources { public static bool Prefix(Requirement[] requirements, int qualityLevel) { bool flag = false; Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); foreach (Requirement val in requirements) { if ((Object)(object)val.m_resItem != (Object)null && val.GetAmount(qualityLevel) > 0 && val.m_resItem.m_itemData.m_shared.m_name == "Rabbit fur") { flag = true; break; } } if (!flag) { return true; } foreach (Requirement val2 in requirements) { if (Object.op_Implicit((Object)(object)val2.m_resItem)) { RemoveGenericItem(inventory, val2.m_resItem.m_itemData.m_shared.m_name, val2.GetAmount(qualityLevel)); } } return false; } public static void RemoveGenericItem(Inventory inventory, string sharedName, int amount, int quality = -1) { if (amount < 1) { return; } if (sharedName == "Rabbit fur") { foreach (KeyValuePair fur in GetFurs(amount)) { if (fur.Value > 0) { inventory.RemoveItem(fur.Key, fur.Value, quality, true); WDBUG.Log($"{fur.Value}/{amount} {fur.Key} used", WDBUG.Level.Crafting); } } return; } WDBUG.Log($"{amount} {sharedName} used", WDBUG.Level.Crafting); inventory.RemoveItem(sharedName, amount, quality, true); } private static Dictionary GetFurs(int amount) { List list = new List(); List list2 = new List(); foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { string text = WUTIL.ItemName(allItem); if (text.StartsWith("RabbitFur")) { int num = list.IndexOf(allItem.m_shared.m_name); if (num >= 0) { list2[num] += allItem.m_stack; continue; } list.Add(allItem.m_shared.m_name); list2.Add(allItem.m_stack); } } Dictionary dictionary = new Dictionary(); foreach (string item in list) { dictionary.Add(item, 0); } while (amount > 0 && list.Count > 0) { int index = WUTIL.DieRoll(list.Count); amount--; string key = list[index]; int value = dictionary[key] + 1; dictionary[key] = value; if (--list2[index] == 0) { list2.RemoveAt(index); list.RemoveAt(index); } } return dictionary; } } [HarmonyPatch(typeof(CraftingStation), "GetLevel")] private class PatchCraftingStationGetLevel { private static void Postfix(CraftingStation __instance, ref int __result) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.GameName(((Component)__instance).gameObject); if (text == "StoneGrip" || text == "Soaker") { StationExtension component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { CraftingStation val = component.FindClosestStationInRange(((Component)__instance).transform.position); if ((Object)(object)val != (Object)null) { __result = val.GetLevel(true); } } } else { if (!(text == "Cookpot")) { return; } Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, 0.5f, WUTIL.c_pieceRayMask); foreach (Collider val2 in array) { Transform val3 = (((Object)(object)((Component)val2).transform.parent == (Object)null) ? ((Component)val2).transform : ((Component)val2).transform.parent); if (WUTIL.GameName(((Component)val3).gameObject) == "FirePlinthCoal" && val3.position.y <= ((Component)__instance).transform.position.y && WUTIL.GroundDistance(val3.position, ((Component)__instance).transform.position) < 0.25f) { __result++; break; } } } } } [HarmonyPatch(typeof(Player), "SetCraftingStation")] private class PatchPlayerSetCraftingStation { private static bool m_showHands; private static Transform m_cauldronLid; private static bool Prefix(CraftingStation station) { m_atStation = (Object)(object)station != (Object)null; m_atMakingTable = (m_atCookpot = (m_atWashbasin = (m_showHands = false))); if (m_atStation) { if (station.m_name == "Making table") { m_atMakingTable = true; m_showHands = WUTIL.GetInventoryItemData("PestleAndMortar", mustBeEquipped: true) != null; EnablePestleAndMortarRecipes(m_showHands); } else if (station.m_name == "Washbasin") { m_atWashbasin = true; m_cauldronLid = ((Component)station).gameObject.transform.Find("lid"); CustomizeCraftingPanel("WASH"); if (WUTIL.Timer("washbasin_cooldown") == 0f) { Equipment.UpdateStatusEffect("Rested", add: true, resetTime: true); } } else if (station.m_name == "Cookpot") { m_atCookpot = true; m_showHands = WUTIL.GetInventoryItemData("PestleAndMortar", mustBeEquipped: true) != null; EnablePestleAndMortarRecipes(m_showHands); m_cauldronLid = ((Component)station).gameObject.transform.Find("lid"); CustomizeCraftingPanel("COOK"); } } return true; } private static void Postfix(CraftingStation station) { if (m_showHands) { WUTIL.ShowHandItems(); } if ((Object)(object)m_cauldronLid != (Object)null) { if ((Object)(object)station == (Object)null) { ((Component)m_cauldronLid).gameObject.SetActive(true); m_cauldronLid = null; } else { ((Component)m_cauldronLid).gameObject.SetActive(false); } } } } [HarmonyPatch(typeof(CraftingStation), "Interact")] private class PatchCraftingStationInteract { private static bool Prefix(CraftingStation __instance, Humanoid user, bool repeat, bool ___m_haveFire, ref bool __result) { if (repeat || (Object)(object)user != (Object)(object)Player.m_localPlayer || __instance.m_name != "Hot press") { return true; } __result = false; if (__instance.InUseDistance(user)) { if (___m_haveFire) { if (Wildling.IsWildling) { Quest.ReportEpilog(postPlay: false); } else { WUTIL.Message("Nothing happens"); } } else { WUTIL.Message(__instance.m_name + " must be placed over a fire to function"); } } return false; } } [HarmonyPatch(typeof(CraftingStation), "CheckFire")] private class PatchStationCraftingCheckFire { private static void Postfix(CraftingStation __instance, bool ___m_haveFire) { if (__instance.m_name == "Hot press") { StationExtension component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_maxStationDistance = (___m_haveFire ? 6 : 0); } } } } [HarmonyPatch(typeof(InventoryGui), "UpdateInventory")] private class PatchInventoryGuiUpdateInventory { private static void Postfix() { if (m_atCookpot) { CustomizeCraftingPanel("COOK"); } else if (m_atWashbasin) { CustomizeCraftingPanel("WASH"); } else { CustomizeCraftingPanel(); } } } [HarmonyPatch(typeof(SE_Rested), "UpdateTTL")] private class PatchSE_RestedUpdateTTL { private static void Postfix(SE_Rested __instance) { if (m_atWashbasin && WUTIL.Timer("washbasin_cooldown") == 0f) { WUTIL.TimerReset("washbasin_cooldown", __instance.m_TTLPerComfortLevel); ((StatusEffect)__instance).m_ttl = ((StatusEffect)__instance).m_ttl + __instance.m_TTLPerComfortLevel; WUTIL.Message("You are refreshed at the Washbasin", center: true, null, blockNext: true); } } } public static Vector3 c_hairColorBlue = new Vector3(0.2f, 0.25f, 0.6f); public static Vector3 c_hairColorRed = new Vector3(0.7f, 0.3f, 0.25f); public static Vector3 c_hairColorGreen = new Vector3(0.25f, 0.5f, 0.25f); public static Vector3 c_hairColorYellow = new Vector3(0.6f, 0.55f, 0.3f); public static Vector3 c_hairColorOrange = new Vector3(0.7f, 0.45f, 0.3f); public static Vector3 c_hairColorPurple = new Vector3(0.45f, 0.2f, 0.6f); public static Vector3 m_hairColorChange = Vector3.zero; private static List c_importedCraftItems = new List(); private const int c_poisonedItemRecipes = 7; private const int c_metalPelletRecipes = 3; private const float c_hairColorChangeTime = 4f; private const float c_hairColorMin = 0.1f; private const float c_hairColorMax = 0.9f; private static List c_pestleAndMortorRecipes = new List { "RabbitBait", "DeerBait", "WolfBait", "PinePaste", "PoisonBase", "PowderedCrystal", "TanningMix", "PebbleGold", "PebbleSilver", "PebbleWhiteGold" }; private static bool m_atStation = false; private static bool m_atCookpot = false; private static bool m_atWashbasin = false; private static bool m_atMakingTable = false; private static bool m_hideRepairButton = false; private static List m_blockUnlockMessage = new List(); private const int m_upgradeDecQuality = 0; private const bool c_upgradeFreezeQuality = false; private static bool m_checkAddKnownRecipe = false; public static int GetCraftTypeCount(string type) { return type switch { "ALC" => WUTIL.GetWildlingGOTypeCount("Cookpot") + WUTIL.GetWildlingGOTypeCount("Washbasin") + WUTIL.GetWildlingGOTypeCount("Soaker") + 7 + (c_pestleAndMortorRecipes.Count - 3), "BLD" => WUTIL.GetWildlingGOTypeCount("Piece"), "CFT" => WUTIL.GetWildlingGOTypeCount("Basic") + WUTIL.GetWildlingGOTypeCount("MakingTable") + WUTIL.GetWildlingGOTypeCount("StoneGrip") + WUTIL.GetWildlingGOTypeCount("HidingRack") - 7 - (c_pestleAndMortorRecipes.Count - 3), _ => 0, }; } public static void PestleAndMortarEnable(ItemData item, bool enable) { if (m_atMakingTable || m_atCookpot) { bool flag = true; if (WUTIL.ItemName(item) == "PestleAndMortar") { if (WUTIL.Timer("crafting_autoequip") > 0f) { if (!enable) { WDBUG.Log("Re-equip PestleAndMortar", WDBUG.Level.GrindingBowl); ((Humanoid)Player.m_localPlayer).EquipItem(item, true); } return; } if (item.m_durability <= 0f) { enable = false; } EnablePestleAndMortarRecipes(enable, item, m_atCookpot); if (enable) { WUTIL.ShowHandItems(); flag = false; } } if (flag) { WUTIL.HideHandItems(); } if (m_atCookpot) { CustomizeCraftingPanel("COOK"); } } else if (!m_atStation && WUTIL.ItemName(item) == "PestleAndMortar") { EnablePestleAndMortarRecipes(enable); } } public static void SetPlayerKnowableRecipes() { if (!Wildling.IsWildling) { WDBUG.Log("Forgetting wildling recipes, remembering all others.", WDBUG.Level.Knowledge); } Recipe[] array = ObjectDB.instance.m_recipes.ToArray(); foreach (Recipe val in array) { if ((Object)(object)val.m_item == (Object)null) { continue; } string name = ((Object)val.m_item).name; bool flag = WUTIL.IsWildlingRecipe(name); CraftingStation craftingStation = val.m_craftingStation; if (flag) { if ((Object)(object)craftingStation != (Object)null && craftingStation.m_name == "$piece_workbench") { flag = false; } } else { if (val.m_resources.Length == 1 && (Object)(object)craftingStation == (Object)null) { string hoverName = val.m_resources[0].m_resItem.GetHoverName(); int amount = val.m_resources[0].m_amount; if (hoverName == "$item_deerhide" && amount == 6) { WDBUG.Log($"Ignoring no-station recipe for {name} requiring {amount}x {hoverName}", WDBUG.Level.Knowledge); continue; } } flag = Quest.AchievementAwarded(name) || c_importedCraftItems.Contains(name); } if ((val.m_enabled = (flag ? Wildling.IsWildling : (!Wildling.IsWildling))) && flag) { WDBUG.Log("Recalling recipe for " + name + " at " + (((Object)(object)craftingStation == (Object)null) ? "Hand" : craftingStation.m_name), WDBUG.Level.Knowledge); } } } public static void AddKnownItems(string items, bool noMessage = true) { WDBUG.Log($"AddKnownItems {items} noMessage: {noMessage}", WDBUG.Level.RecipeUnlock); string[] array = items.Split(new char[1] { ',' }); foreach (string text in array) { ItemData val = WUTIL.CreateItemData(text); if (val == null) { WDBUG.Log("AddKnownItems:CreateItemData failed for " + text); continue; } if (noMessage && !m_blockUnlockMessage.Contains(val.m_shared.m_name)) { m_blockUnlockMessage.Add(val.m_shared.m_name); } Player.m_localPlayer.AddKnownItem(val); } } public static string GetCraftType(string item) { if (item == "") { return ""; } if (c_pestleAndMortorRecipes.Contains(item) || item == "PebbleBad" || item == "PebbleColdball" || item.EndsWith("Poisoned")) { return "ALC"; } GameObject wildlingGO = WUTIL.GetWildlingGO(item); GameObject wildlingGO2 = WUTIL.GetWildlingGO(item); if (Object.op_Implicit((Object)(object)((wildlingGO2 != null) ? wildlingGO2.GetComponent() : null))) { return "BLD"; } string wildlingRecipe = WUTIL.GetWildlingRecipe(item); if (wildlingRecipe == "") { return ""; } int num = wildlingRecipe.IndexOf(':'); if (num > 0) { int num2 = wildlingRecipe.IndexOf(','); switch (wildlingRecipe.Remove((num2 > 0 && num2 < num) ? num2 : num)) { case "Basic": case "MakingTable": case "StoneGrip": case "HidingRack": return "CFT"; case "Cookpot": case "Soaker": case "Washbasin": return "ALC"; } } WDBUG.Log("Unclassified craft for " + item + " for " + wildlingRecipe, WDBUG.Level.Quest); return ""; } public static bool HairIsColor(string dye) { //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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_0094: 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_00a2: Unknown result type (might be due to invalid IL or missing references) Vector3 hairColor = Wildling.HairColor; return dye switch { "Red" => hairColor == c_hairColorRed, "Blue" => hairColor == c_hairColorBlue, "Green" => hairColor == c_hairColorGreen, "Orange" => hairColor == c_hairColorOrange, "Purple" => hairColor == c_hairColorPurple, "Yellow" => hairColor == c_hairColorYellow, _ => false, }; } public static void ModifyCraftItemMessage(ItemData item, ref string description) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) bool flag = item.m_shared.m_setName == "WildlingStationRequirement"; bool flag2 = item.m_shared.m_setName == "WildlingPigment"; if (!(flag2 || flag)) { return; } int num = description.IndexOf("\n$item_weight:"); if (num > 0) { description = description.Substring(0, num); } bool flag3 = flag2 || item.m_shared.m_maxQuality > 1; int day = EnvMan.instance.GetDay(); if (!flag3) { string text = ""; switch ((int)(9f * WUTIL.RandomAtPos(new Vector3((float)day, 0f, 0f)))) { case 0: text = "\n\nHint: The recipe ingredients need to be ground together."; break; case 1: text = "\n\nHint: The recipe requires a fir cone."; break; case 2: text = "\n\nHint: The recipe includes a mix of tree seeds."; break; } description += text; return; } string text2 = "\n\nIt is " + WUTIL.GetDayPeriod() + " of your " + WUTIL.NumberText(day) + " day in this world."; if (!flag2) { description += text2; return; } num = item.m_shared.m_name.IndexOf(' '); if (num < 0) { return; } string text3 = item.m_shared.m_name.Substring(0, num); string text4 = ""; if (HairIsColor(text3)) { text2 = "\nYour hair is already this color." + text2; } else { int num2 = (int)(9f * WUTIL.RandomAtPos(Wildling.HairColor + new Vector3((float)day, 0f, 0f))); int num3 = (int)(10f * WUTIL.RandomAtPos(new Vector3(0f, 0f, (float)day))); string[] array = "Black,Bleaching,Red,Blue,Green,Orange,Purple,Yellow".Split(new char[1] { ',' }); int num4 = Array.IndexOf(array, text3); if (num4 == num2) { text4 = ((text3 == "Black") ? "\n\nMaybe a darker shade better suits this day?" : ((!(text3 == "Bleaching")) ? "\n\nThis seems a more interesting choice today." : "\n\nMaybe a lighter shade would be nice?")); } else if (num4 == num3) { text4 = ((text3 == "Black") ? "\n\nMaybe dark hair is better for hiding?" : ((text3 == "Bleaching") ? "\n\nOr maybe not..." : ((num2 <= num3) ? "\n\nMaybe today calls for a new look?" : "\n\nMaybe today is a good day to dye!"))); } } description = description + text2 + text4; } private static string ReplacedItem(string name) { switch (name) { case "PebbleBad": return "PebbleSharp"; case "BootsWildling": return "FurBootsTan"; case "HoodRagsWildling": return "HoodRags"; case "PantsRagsSwim": return "PantsRags"; default: if (name.EndsWith("Poisoned")) { return name.Remove(name.Length - 8); } if (name.EndsWith("Wildling")) { return name.Remove(name.Length - 8) + "Leather"; } if (name.StartsWith("TunicRags")) { return (name == "TunicRags") ? "" : "TunicRags"; } return ""; } } private static void EnablePestleAndMortarRecipes(bool enable, ItemData item = null, bool atCookpot = false) { Inventory val = ((enable && item != null) ? ((Humanoid)Player.m_localPlayer).GetInventory() : null); bool flag = false; foreach (string c_pestleAndMortorRecipe in c_pestleAndMortorRecipes) { if (WUTIL.EnableWildlingRecipe(c_pestleAndMortorRecipe, enable)) { WDBUG.Log($"Grinding bowl recipe {c_pestleAndMortorRecipe} enable: {enable}", WDBUG.Level.GrindingBowl); if (val != null && (c_pestleAndMortorRecipe.StartsWith("Pebble") ? atCookpot : (!atCookpot))) { flag = true; } } else { WDBUG.Log("Grinding bowl recipe " + c_pestleAndMortorRecipe + " is unknown", WDBUG.Level.GrindingBowl); } } if (flag) { WDBUG.Log("Attempting to force UpdateKnownRecipesList", WDBUG.Level.RecipeUnlock); m_checkAddKnownRecipe = true; val.RemoveItem(item, 0); m_checkAddKnownRecipe = false; } WUTIL.UpdateInventoryRecipes(); } private static void CustomizeCraftingPanel(string craftTitle = "CRAFT") { Transform val = ((Component)InventoryGui.instance.m_player).transform.parent.Find("Crafting"); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to find Crafting transform"); return; } bool flag = craftTitle == "CRAFT"; m_hideRepairButton = !flag; Transform val2 = val.Find("TabsButtons/UPGRADE"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.SetActive(flag); } if (craftTitle != "") { if (flag) { craftTitle = Localization.instance.Localize("$inventory_craftbutton").ToUpper(); } WUTIL.SetGUIText(val.Find("TabsButtons/Craft/Text"), craftTitle); } } private static bool TrackFound(GameObject go) { string text = WUTIL.GameName(go); string craftType = GetCraftType(text); if (craftType != "") { craftType = craftType + ":" + text; if (Quest.GetAchievement(craftType) == 0) { WDBUG.Log("Inherited achievement " + craftType, WDBUG.Level.RecipeUnlock); Quest.AdvanceAchievement(craftType); return true; } } return false; } } internal class Digger { [HarmonyPatch(typeof(Plant), "Awake")] private class PatchPlantAwake { public static void Postfix(Plant __instance) { if (m_plantList.Contains(WUTIL.GameName(((Component)__instance).gameObject))) { PlantedByWildling(((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(TreeBase), "Grow")] private class PatchPlantGrow { public static void Postfix(TreeBase __instance) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (((Object)((Component)__instance).gameObject).name.StartsWith("Oak")) { if (!Object.op_Implicit((Object)(object)World.ClosestCharacter(((Component)__instance).transform.position, "player")) && !Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(((Component)__instance).transform.position, (Type)223, 50f))) { Vector3 position = ((Component)__instance).transform.position + 2f * (((Component)__instance).transform.forward + ((Component)__instance).transform.up); Place.Object("Pixie", position); Place.Object("PixieDust", position); Quest.AdvanceAchievement("BlessedOak"); WDBUG.Log("A new oak tree has been Pixie Blessed"); } else { WDBUG.Log("An unblessed new oak tree has sprouted", WDBUG.Level.Digger); } } } } [HarmonyPatch(typeof(Pickable), "Awake")] private class PatchPickableAwake { public static bool forceCleanup; private static bool lateConfig; public static void Prefix(Pickable __instance, ZNetView ___m_nview) { //IL_000c: 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) //IL_0053: 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) if (m_buriedFruitSeeds.Contains(((Component)__instance).transform.position)) { string text = WUTIL.GameName(((Component)__instance).gameObject); __instance.m_defaultPicked = true; __instance.m_respawnTimeMinutes /= 10f; ((Component)__instance).transform.localScale = 0.1f * Vector3.one; m_buriedFruitSeeds.Remove(((Component)__instance).transform.position); lateConfig = !text.EndsWith("Bush"); WDBUG.Log($"Configure {text} to grow in {__instance.m_respawnTimeMinutes}mins", WDBUG.Level.Digger); } } public static void Postfix(Pickable __instance) { //IL_00b3: 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_005d: Unknown result type (might be due to invalid IL or missing references) if (lateConfig) { lateConfig = false; __instance.m_hideWhenPicked.SetActive(true); WDBUG.Log("Reset visible pickable when growing", WDBUG.Level.Digger); } if (forceCleanup) { string text = WUTIL.GameName(((Component)__instance).gameObject); if (m_buryPlantList.Contains(text) && ((Component)__instance).transform.localScale.y < 0.99f) { ZNetView component = ((Component)__instance).GetComponent(); component.ClaimOwnership(); component.Destroy(); WDBUG.Log("Force clean up of unripe " + text, WDBUG.Level.Digger); } } else if (((Component)__instance).transform.localScale == Vector3.one) { SetThistleSize(((Component)__instance).transform); } } } [HarmonyPatch(typeof(Pickable), "ShouldRespawn")] private class PatchPickableShouldRespawn { public static void Postfix(Pickable __instance, bool __result, ZNetView ___m_nview) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)___m_nview) || !__instance.m_defaultPicked || !(__instance.m_respawnTimeMinutes <= 30f)) { return; } string text = WUTIL.GameName(((Component)__instance).gameObject); if (__result) { __instance.m_respawnTimeMinutes *= 10f; WDBUG.Log("Fully grown " + text, WDBUG.Level.Digger); if (!text.EndsWith("Thistle")) { ((Component)__instance).transform.localScale = Vector3.one; } __instance.m_defaultPicked = false; } else { if (!(__instance.m_respawnTimeMinutes > 1f)) { return; } float num = __instance.m_respawnTimeMinutes * (text.EndsWith("Bush") ? 0.8f : 1f); long ticks = ___m_nview.GetZDO().GetLong(ZDOVars.s_pickedTime, 0L); DateTime dateTime = new DateTime(ticks); TimeSpan timeSpan = ZNet.instance.GetTime() - dateTime; if (timeSpan.TotalMinutes > 0.0 && timeSpan.TotalMinutes <= (double)num) { float num2 = (float)timeSpan.TotalMinutes / num; WDBUG.Log($"Growing ({(int)(100f * num2)}%) {text}", WDBUG.Level.Digger); ((Component)__instance).transform.localScale = num2 * Vector3.one + (1f - num2) * 0.2f * Vector3.up; if (SetThistleSize(((Component)__instance).transform)) { WDBUG.Log("Stunted " + text, WDBUG.Level.Digger); __instance.m_respawnTimeMinutes *= 10f; __instance.m_defaultPicked = false; } } else { WDBUG.Log("Ripening " + text, WDBUG.Level.Digger); } } } private static bool InNativeBiome(Vector3 position, string grower) { //IL_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Invalid comparison between Unknown and I4 int num = m_buryPlantList.IndexOf(grower); if (num < 0) { return true; } Heightmap val = Heightmap.FindHeightmap(position); Biome biome = val.GetBiome(position, 0.02f, false); bool flag = (int)biome == 1; return num <= 6 && (flag ? (num < 3) : (num >= 3)); } } [HarmonyPatch(typeof(Pickable), "Interact")] private class PatchPickableInteract { public static bool Prefix(Pickable __instance, ref bool __result) { //IL_0007: 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_002e: Unknown result type (might be due to invalid IL or missing references) if (((Component)__instance).transform.localScale.x <= 0.95f && ((Component)__instance).transform.localScale.x < ((Component)__instance).transform.localScale.y && m_buryPlantList.Contains(WUTIL.GameName(((Component)__instance).gameObject))) { WUTIL.Message(__instance.GetHoverName() + " not ready for harvesting."); __result = false; return false; } return true; } } private const int c_numMeadowsFruit = 3; private const int c_idxMeadowsFruitRare = 6; private const float c_digUseStaminaRate = 6f; private const float c_digTime = 2f; private const float c_digCooldown = 1f; private const float c_digStepTime = 0.25f; private const float c_plantStepTime = 0.5f; private const float c_digTruffle = 0.01f; private const float c_digNecklace = 0.002f; private const float c_digSomething = 0.4f; private const float c_growBerryRate = 10f; private static bool m_digInsideGround = false; private static List m_digTreasure = new List { "Coins", "PebbleRough", "PebbleSharp", "PebbleSmooth", "PebbleRough", "BoneFragments", "PebbleFine", "Coal" }; private static List m_seedList = new List { "CarrotSeeds", "TurnipSeeds", "OnionSeeds", "BeechSeeds", "FirCone", "PineCone", "BirchSeeds", "Acorn", "Carrot", "Turnip", "Onion", "BadSeed" }; private static List m_buryList = new List { "DeerHide", "DeerMeat", "TrophyDeer", "TrophyBoar", "TrophyNeck", "TrophyFrostTroll", "GreydwarfEye", "TrophyGreydwarf", "TrophyGreydwarfBrute", "TrophyGreydwarfShaman" }; private static List m_plantList = new List { "sapling_carrot", "sapling_turnip", "sapling_onion", "Beech_Sapling", "FirTree_Sapling", "PineTree_Sapling", "Birch_Sapling", "Oak_Sapling", "sapling_seedcarrot", "sapling_seedturnip", "sapling_seedonion", "DefiledRoot_Sapling" }; private static List m_buryFruitList = new List { "Dandelion", "Raspberry", "Mushroom", "Blueberries", "Thistle", "MushroomYellow", "MushroomBlue" }; private static List m_buryPlantList = new List { "Pickable_Dandelion", "RaspberryBush", "Pickable_Mushroom", "BlueberryBush", "Pickable_Thistle", "Pickable_Mushroom_yellow", "Pickable_Mushroom_blue" }; private static List m_buriedFruitSeeds = new List(); public static void ModifyAttackStamina(Attack attack) { if (attack.m_attackAnimation == "swing_hoe" && !WUTIL.GetButton("Block")) { attack.m_attackStamina = 1f; } } public static bool ModifyAttack(Attack attack) { //IL_0170: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) if (attack.m_attackAnimation == "swing_hoe") { if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "swing_pickaxe"; attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; if (InsideDig()) { WDBUG.Log("Attempt ground (ice) slam", WDBUG.Level.Digger); attack.m_damageMultiplier = 3f; attack.m_attackHeight = 0f; } else { attack.m_damageMultiplier = 2f; attack.m_attackHeight = 0.1f; } } else { if (!Action()) { return true; } if (InsideDig()) { WDBUG.Log("Attempt ground (ice) dig", WDBUG.Level.Digger); attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; attack.m_attackHeight = 0f; Vector3 position = ((Component)Player.m_localPlayer).transform.position + 0.75f * ((Component)Player.m_localPlayer).transform.forward; WUTIL.TimerReset("aoe_ignore_0hits", 0.1f); WUTIL.Spawn("digger_aoe2", position, ((Component)Player.m_localPlayer).transform.rotation); } } } else if (((Character)Player.m_localPlayer).IsCrouching()) { attack.m_attackAnimation = "knife_secondary"; attack.m_attackType = (AttackType)1; attack.m_damageMultiplier = 2.5f; attack.m_hitTerrain = true; attack.m_attackHeight = 0.1f; } return false; } public static void CheckObjectives() { if (Quest.CheckObjective(6, set: true, test: true) && Quest.GetAchievement("Buried") > 0 && Quest.GetAchievement("Truffle") > 0 && Quest.GetAchievement("PlantedFlags") > 0) { Quest.CheckObjective(6, set: false); } } private static bool Action() { if (WUTIL.Timer("digger_cooldown") > 0f) { return false; } bool flag = ((Character)Player.m_localPlayer).IsCrouching(); if (WUTIL.Timer("digger_digging") == 0f) { if (flag) { if (!CheckPlant()) { return false; } } else if (!CheckDig()) { return false; } WUTIL.TimerReset("digger_digging", 2f); } else if (WUTIL.TimerIsAlmost("digger_digging", 0f)) { if (flag) { if (Quest.GetAchievement("WS.PlantedFlags") == 0) { Quest.ShowMainTutorial(7); } CheckPlant(cultivate: true); } else { CheckDig(dig: true); } WUTIL.TimerReset("digger_digging", 1f); } ((Character)Player.m_localPlayer).UseStamina(6f * Time.fixedDeltaTime); if (WUTIL.Timer("digger_dig_step") > 0f) { return false; } float time = (flag ? 0.5f : 0.25f); WUTIL.TimerReset("digger_dig_step", time); WUTIL.TimerReset("freeze_player_movement", time); CheckObjectives(); return true; } private static bool InsideDig() { bool digInsideGround = m_digInsideGround; m_digInsideGround = false; return digInsideGround; } private static bool CheckPlant(bool cultivate = false, float offset = 0.75f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0106: Invalid comparison between Unknown and I4 //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Invalid comparison between Unknown and I4 //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)Player.m_localPlayer).transform.position + offset * ((Component)Player.m_localPlayer).transform.forward; Heightmap val2 = Heightmap.FindHeightmap(val); if ((Object)(object)val2 == (Object)null) { if (cultivate) { WUTIL.Message("No ground to cultivate."); } return false; } float num = default(float); if (!Heightmap.GetHeight(val, ref num)) { return false; } float num2 = num - World.GetGroundDepth(); WDBUG.Log($"PlantCheck: Ground Height: {num} Base Height: {num2}", WDBUG.Level.Digger); if (val.y - num > 1f || Flight.IsFlying()) { return false; } val.y = num; Biome biome = val2.GetBiome(val, 0.02f, false); int achievement = Quest.GetAchievement("PlantedFlags"); bool flag = (achievement & 0x7FF) == 2047; bool flag2 = (int)biome == 1 || (int)biome == 8; if (flag) { flag2 = flag2 || (int)biome == 2 || (int)biome == 16; } if (val2.IsCultivated(val)) { int num3 = 9999; int num4 = 9999; string text = ""; bool flag3 = false; int num5 = 0; int num6 = 3; if (flag) { num6 = m_seedList.Count; } else if ((achievement & 0xFF) == 255) { num6 = 11; } else if ((achievement & 7) == 7) { num6 = 8; } ItemData val3 = null; foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { string item = WUTIL.GameName(allItem.m_dropPrefab); int num7 = m_seedList.IndexOf(item); if (num7 >= 0) { if (num7 >= num6) { flag3 = true; } else if (allItem.m_gridPos.y < num4 || (allItem.m_gridPos.y == num4 && allItem.m_gridPos.x < num3)) { num4 = allItem.m_gridPos.y; num3 = allItem.m_gridPos.x; text = m_plantList[num7]; val3 = allItem; num5 = num7; } } } if (text == "") { if (flag3) { WUTIL.Message("You have no seeds that you know how to plant."); } else { WUTIL.Message("You have no plantable seeds."); } return false; } if (!flag2) { WUTIL.Message("You cannot plant here."); return false; } if (!HaveGrowSpace(val)) { WUTIL.Message("Not enough space for a seedling to grow."); return false; } if (cultivate) { GameObject plant = WUTIL.Spawn(text, val, ((Component)Player.m_localPlayer).transform.rotation); PlantedByWildling(plant); ((Humanoid)Player.m_localPlayer).GetInventory().RemoveOneItem(val3); WUTIL.PlaceObject("digger_groundhit_vfx", val, 0.5f); num5 = 1 << num5; if ((achievement & num5) == 0) { achievement |= num5; Quest.SetAchievement("PlantedFlags", achievement); WDBUG.Log($"Planted achievement flag for {val3}", WDBUG.Level.Progress); string text2 = ""; switch (achievement) { case 7: text2 = "You have learnt how to plant tree saplings"; break; case 255: text2 = "You have learnt to plant seedlings from tubers."; break; default: if (num5 == 2047) { text2 = "You have mastered wild cultivation, at least the natural stuff."; } break; } if (text2 != "") { WUTIL.PlaySecretFoundSfx(0); WUTIL.CustomLog(text2, "#BD2"); } } if (text.StartsWith("Defiled")) { Wildling.ModifyDarklingLevel(1); WUTIL.CustomLog("You mood has become darker.", "#44F"); Alignment.m_treecareReward = 0; Alignment.m_greydwarfReputaion -= 10f; } if (text.EndsWith("_Sapling")) { Alignment.m_treecareReward += 2; Alignment.m_greydwarfReputaion += 20f; } } } else { if (!flag2) { WUTIL.Message("You cannot cultivate the ground here."); return false; } if (num2 < 0.2f && num2 >= -0.5f && cultivate) { WDBUG.Log($"Culivating height: {num} depth: {num2} cleared: {val2.IsCleared(val)}", WDBUG.Level.Digger); WUTIL.Spawn("digger_preplant", val, ((Component)Player.m_localPlayer).transform.rotation); } } return true; } private static bool CheckDig(bool dig = false, float offset = 0.75f) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Invalid comparison between Unknown and I4 //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Invalid comparison between Unknown and I4 //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) if (Flight.IsFlying()) { return false; } Transform transform = ((Component)Player.m_localPlayer).transform; Vector3 val = transform.position + offset * transform.forward; Heightmap val2 = Heightmap.FindHeightmap(val); if ((Object)(object)val2 == (Object)null) { if (!dig) { WUTIL.Message("You cannot use Digger here."); } return false; } float num = default(float); if (!Heightmap.GetHeight(val, ref num)) { return false; } float num2 = num - World.GetGroundDepth(); WDBUG.Log($"Dig at height: {num} pos.y - height: {val.y - num} depth: {World.GetGroundDepth()} inseide: {MountainDungeon.PlayerInside()}"); if (val.y - num > 1f) { if (MountainDungeon.PlayerInside()) { m_digInsideGround = dig; return true; } return false; } val.y = num; Biome biome = val2.GetBiome(val, 0.02f, false); if ((int)biome != 1 && (int)biome != 8) { if (!dig) { WUTIL.Message("You cannot dig this ground."); } return false; } if (!dig) { return true; } if (num2 < -1f || num - transform.position.y > 1f) { WDBUG.Log($"Fill at depth: {num2} height: {num} vs. player: {transform.position.y}", WDBUG.Level.Digger); WUTIL.Spawn("digger_fill", transform.position, transform.rotation); Bury(val, biome, 1.5f, 4); return true; } if (num2 < -0.5f) { WDBUG.Log($"Undig at depth: {num2} height: {num} vs. player: {transform.position.y}", WDBUG.Level.Digger); WUTIL.Spawn("digger_undig", val, transform.rotation); Bury(val, biome, 1.5f, 3); return true; } WDBUG.Log($"Dig at depth: {num2} height: {num} vs. player: {transform.position.y}", WDBUG.Level.Digger); WUTIL.Spawn("digger_dig", val, transform.rotation); CheckFruitPlants(val); if (WUTIL.Timer("digger_find_cooldown") > 0f) { return true; } string text = ""; int num3 = 1; float num4 = WUTIL.RandomSpin() - 0.5f * Alignment.m_holdingRabbitFootLuck; string text2 = "#FC0"; if ((double)num2 > -0.8 && CheckTruffle()) { text = "Truffle"; WUTIL.Message("You have found " + text + "."); Quest.AdvanceAchievement("Truffle"); } else if (num4 <= 0.002f) { text = "SilverNecklace"; } else if (num4 <= 0.4f) { int num5 = WUTIL.DieRoll(m_digTreasure.Count); num3 = WUTIL.DieRoll(m_digTreasure.Count - num5) + 1; if (Alignment.m_holdingRabbitFootLuck > 0f) { num3 += 1 + num3 / 2; } text = m_digTreasure[num5]; if (num5 > 0) { text2 = ""; } } if (text != "") { GameObject val3 = WUTIL.Spawn(text, val, transform.rotation, num3); WUTIL.TimerReset("digger_find_cooldown", 8f); if (text2 != "") { WUTIL.CustomLog("You dug up " + WUTIL.ItemName(val3.GetComponent(), goName: false, withAmount: false), text2); } } return true; } private static void Bury(Vector3 position, Biome biome, float radius = 1.5f, int maxItemStacks = 1) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Invalid comparison between Unknown and I4 //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; List list = new List(); Collider[] array = Physics.OverlapSphere(position, radius, WUTIL.c_itemRayMask); foreach (Collider val in array) { Rigidbody attachedRigidbody = val.attachedRigidbody; ItemDrop val2 = ((attachedRigidbody != null) ? ((Component)attachedRigidbody).GetComponent() : null); if ((Object)(object)val2 == (Object)null || !((Component)val2).GetComponent().IsValid() || list.Contains(val2)) { continue; } ItemData itemData = val2.m_itemData; string text = WUTIL.ItemName(itemData); if ((itemData.m_shared.m_maxStackSize > 1 || itemData.m_shared.m_destroyBroken || text == "Torch" || text == "Club" || text.Contains("Rags")) && itemData.m_shared.m_teleportable && itemData.m_shared.m_value == 0) { list.Add(val2); num += itemData.m_stack; if (text == "GreydwarfEye") { num2 += itemData.m_stack; } if (maxItemStacks > 0 && list.Count == maxItemStacks) { break; } } } if (list.Count > 1) { WUTIL.Message($"Permanently buried {num} items"); } else if (list.Count == 1) { ItemDrop val3 = list[0]; ItemData itemData2 = val3.m_itemData; WUTIL.Message("Permanently buried " + WUTIL.ItemName(val3), center: true, WUTIL.GetIcon(itemData2.m_dropPrefab, itemData2.m_variant)); } bool flag = (int)biome == 1; bool flag2 = false; int num3 = 0; int index = 0; foreach (ItemDrop item2 in list) { string item = WUTIL.ItemName(item2, goName: true); int num4 = m_buryList.IndexOf(item); if (num4 >= 0) { Quest.SetAchievement("BuriedItems", num4, bit: true); } else if (num2 > 0) { int num5 = m_buryFruitList.IndexOf(item); if (num5 < 0) { continue; } bool flag3 = num5 <= 6 && (flag ? (num5 < 3) : (num5 >= 3)); if (flag2 && !flag3) { continue; } flag2 = flag3; int num6 = ((!flag3) ? 1 : (WUTIL.TestLuck(0.4f) ? 3 : 2)); if (num6 >= num3) { index = num5; num3 = num6; } } WUTIL.Destroy(((Component)item2).gameObject); } if (num > 0) { Quest.AdvanceAchievement("Buried"); } if (num2 > 0) { WDBUG.Log("Planting grass", WDBUG.Level.Digger); WUTIL.PlaceObject("digger_grass", position); } if (num3 > 0) { num3 = Mathf.Min(num3 + num2 - 1, 9); WDBUG.Log($"Fertilized planting {num3}x {m_buryPlantList[index]}", WDBUG.Level.Digger); BuryFruitSeeds(position, m_buryPlantList[index], num3); } } private static void BuryFruitSeeds(Vector3 position, string fruitGrower, int numGrow) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (numGrow > 0 && !(fruitGrower == "")) { float radius = (float)numGrow * 0.2f + (float)(fruitGrower.EndsWith("Bush") ? 2 : ((numGrow < 5) ? 1 : 3)); float rndRadius = ((numGrow < 5) ? 1 : 3); Place.Cluster(fruitGrower, position, m_buriedFruitSeeds, numGrow, radius, WUTIL.DieRoll(numGrow), rndRadius, 10f, 60f, 0f); WDBUG.Log("Buried Fruit Seeds remaining to awaken: " + m_buriedFruitSeeds.Count, WDBUG.Level.Digger); } } private static void CheckFruitPlants(Vector3 position, float radius = 2f, bool destroy = true) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Collider[] array = Physics.OverlapSphere(position, radius, WUTIL.c_harvestMask); foreach (Collider val in array) { Transform val2 = ((Component)val).transform; if (!Object.op_Implicit((Object)(object)val2) || Vector3.Distance(position, val2.position) > radius) { continue; } while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; } Pickable component = ((Component)val2).GetComponent(); if ((Object)(object)component != (Object)null && component.CanBePicked()) { component.Interact((Humanoid)(object)Player.m_localPlayer, false, false); } if (destroy) { Destructible component2 = ((Component)val2).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.Destroy((HitData)null); } else if ((Object)(object)component != (Object)null) { list.Add(((Component)component).gameObject); } } } if (list.Count <= 0) { return; } WDBUG.Log($"Distroying {list.Count} pickables", WDBUG.Level.Digger); foreach (GameObject item in list) { WUTIL.Destroy(item); } } private static bool CheckTruffle() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (MapMarker.TruffleCheck(((Component)Player.m_localPlayer).transform.position)) { return true; } return WUTIL.RandomSpin() <= 0.01f + 0.1f * Alignment.m_holdingRabbitFootLuck; } private static bool HaveGrowSpace(Vector3 position, float growRadius = 1f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(position, growRadius, WUTIL.c_growSpaceMask); foreach (Collider val in array) { if ((Object)(object)((Component)val).GetComponent() != (Object)null) { return false; } } return true; } private static bool PlantedByWildling(GameObject plant) { Piece component = plant.GetComponent(); if ((Object)(object)component == (Object)null) { return false; } component.m_targetNonPlayerBuilt = false; ((StaticTarget)component).m_primaryTarget = false; ((StaticTarget)component).m_randomTarget = false; WDBUG.Log($"Awake {WUTIL.GameName(plant)} assumed planted by wildling: {true}", WDBUG.Level.Digger); return true; } private static bool SetThistleSize(Transform thistle, float min = 0.6f, float max = 1f, bool growCheck = true) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Invalid comparison between Unknown and I4 //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.GameName(((Component)thistle).gameObject).EndsWith("Thistle")) { float num = Mathf.Max(min + (max - min) * WUTIL.RandomAtPos(thistle.position), 0.02f); Heightmap val = Heightmap.FindHeightmap(thistle.position); if ((Object)(object)val != (Object)null && (int)val.GetBiome(thistle.position, 0.02f, false) != 8) { num *= 0.5f; } if (growCheck && thistle.localScale.x <= num) { return false; } WDBUG.Log($"Set Thistle size to {100f * num}%", WDBUG.Level.Digger); thistle.localScale = num * Vector3.one; return true; } return false; } } internal class ForestDungeon { private static int m_buildRefreshMode = 2; private static int m_debugBuildLevel = 0; private const float c_minFindSkill = 0.25f; private const float c_buildRadius = 60f; private const float c_exitLevelOffset = -7.5f; private const string c_pretestPiece = "Piece_Fang"; private const string c_welcomeMessage = "There is expectionally foul stength to this place. All your instincts tell you to run far away."; private static Vector3 up = Vector3.up; private static Vector3 m_lastBuildPosition = Vector3.zero; private static Vector3 m_lastBoratPosition = Vector3.zero; private static int m_boratRats = 0; private static Vector3 m_dungeonEntry = Vector3.zero; private static List m_entryWalls = new List(); private static List m_entryLandings = new List(); private static List m_entryStyles = new List(); private static Dictionary m_wallAtXZ = new Dictionary(); private static int[,] m_forestDungeonRoomPlan = new int[7, 9] { { 1071, 24582, 17920, 27136, 983583, 985631, 985631, 985119, 986127 }, { 4099, 2, 16385, 1311, 4096, 9, 0, 1, 132383 }, { 4099, 527, 8193, 1311, 8194, 4099, 2592, 2591, 2335 }, { 0, 3, 4161, 6664, 6689, 10753, 0, 65535, 65535 }, { 65535, 2, 1280, 651279, 126991, 126991, 86025, 47, 65535 }, { 815, 16390, 1280, 587343, 916480, 520192, 983808, 195087, 3072 }, { 847873, 327682, 328463, 262912, 264448, 262144, 262144, 454671, 1302 } }; public static void ResetBuildMode(int mode = 1) { //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) m_lastBuildPosition = Vector3.zero; if (mode >= 0 && mode <= 2) { m_buildRefreshMode = mode; } } public static void Update() { Build(); } public static void Build() { if (BuildCryptDungeon()) { Place.NoteDungeonBuilding(); Quest.CheckObjective(32, set: false); Quest.CheckObjective(33); } } public static void OnDeath(GameObject go) { //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) //IL_0048: 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_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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.GameName(go); if (text == "Borat") { m_boratRats = 4; for (int i = 0; i < 6; i++) { if (!WUTIL.TestLuck(0.2f)) { Vector3 position = go.transform.position + WUTIL.RandomDir(); position.y += 0.2f * (float)i + WUTIL.RandomSpin(-1f); WUTIL.PlaceObject("BoratRat", position, WUTIL.RandomDir()); m_boratRats++; } } if (m_debugBuildLevel >= 1) { WDBUG.Log($"{m_boratRats} Borat rats released", WDBUG.Level.Quest); } } else if (text == "BoratRat" && m_boratRats > 0) { if (--m_boratRats == 0) { WUTIL.Message("Borat is vanquished!"); WUTIL.PlaceObject("BoratTrophy", go.transform.position, go.transform.forward); Quest.AdvanceAchievement("KillBorat"); Quest.CheckObjective(38, set: false); Quest.CheckObjective(39); } else if (m_boratRats == 1) { WUTIL.Message("Only one Borat rat remains. Do not let it escape!"); } if (m_debugBuildLevel >= 1) { WDBUG.Log($"{m_boratRats} Borat rats remain"); } } } public static void RaiseDraugrRats(Vector3 position, float radius = 8f, float playerRange = 12f) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_0118: Unknown result type (might be due to invalid IL or missing references) if (playerRange > 0f && Vector3.Distance(position, ((Component)Player.m_localPlayer).transform.position) > playerRange) { return; } int num = 0; Collider[] array = Physics.OverlapSphere(position, radius, WUTIL.c_raiseRayMask); foreach (Collider val in array) { Transform val2 = ((Component)val).transform; while ((Object)(object)val2.parent != (Object)null && (Object)(object)((Component)val2).gameObject != (Object)null) { val2 = val2.parent; } string text = WUTIL.GameName(((Component)val2).gameObject); if ((text == "Rat" || text == "DeadRat") && WUTIL.RandomSpin() < 0.7f) { Place.Object("summon_small_fx", val2.position); WDBUG.Log("Raising Draugr Rat from " + text); Place.Object("RatDraugr", val2.position); WUTIL.Destroy(((Component)val2).gameObject); num++; } } if (num > 0 && WUTIL.WithinCylinder(((Component)Player.m_localPlayer).transform.position, position, playerRange)) { WUTIL.Message((num == 1) ? "Borat raised a Draugr Rat" : "Borat raised Draugr Rats"); } } public unsafe static bool BuildCryptDungeon() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_06f3: Unknown result type (might be due to invalid IL or missing references) //IL_06f8: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_08b5: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_08ec: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Unknown result type (might be due to invalid IL or missing references) //IL_08fc: Unknown result type (might be due to invalid IL or missing references) //IL_0912: Unknown result type (might be due to invalid IL or missing references) //IL_0919: Unknown result type (might be due to invalid IL or missing references) //IL_091b: Unknown result type (might be due to invalid IL or missing references) //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_092a: Unknown result type (might be due to invalid IL or missing references) //IL_092c: Unknown result type (might be due to invalid IL or missing references) //IL_0931: Unknown result type (might be due to invalid IL or missing references) //IL_0948: Unknown result type (might be due to invalid IL or missing references) //IL_094f: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Unknown result type (might be due to invalid IL or missing references) //IL_0956: Unknown result type (might be due to invalid IL or missing references) //IL_0960: Unknown result type (might be due to invalid IL or missing references) //IL_0962: Unknown result type (might be due to invalid IL or missing references) //IL_0967: Unknown result type (might be due to invalid IL or missing references) //IL_097d: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_0986: Unknown result type (might be due to invalid IL or missing references) //IL_098b: Unknown result type (might be due to invalid IL or missing references) //IL_09a2: Unknown result type (might be due to invalid IL or missing references) //IL_09a9: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09c6: Unknown result type (might be due to invalid IL or missing references) //IL_09cd: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09e6: Unknown result type (might be due to invalid IL or missing references) //IL_09ed: Unknown result type (might be due to invalid IL or missing references) //IL_09ef: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Unknown result type (might be due to invalid IL or missing references) //IL_09fe: Unknown result type (might be due to invalid IL or missing references) //IL_0a00: Unknown result type (might be due to invalid IL or missing references) //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a11: Unknown result type (might be due to invalid IL or missing references) //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a50: Unknown result type (might be due to invalid IL or missing references) //IL_0a55: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0a88: Unknown result type (might be due to invalid IL or missing references) //IL_0a8a: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0a91: Unknown result type (might be due to invalid IL or missing references) //IL_0a9b: Unknown result type (might be due to invalid IL or missing references) //IL_0aa0: Unknown result type (might be due to invalid IL or missing references) //IL_0aa5: Unknown result type (might be due to invalid IL or missing references) //IL_0ac1: Unknown result type (might be due to invalid IL or missing references) //IL_0ac3: Unknown result type (might be due to invalid IL or missing references) //IL_0ac5: Unknown result type (might be due to invalid IL or missing references) //IL_0ad6: Unknown result type (might be due to invalid IL or missing references) //IL_0add: Unknown result type (might be due to invalid IL or missing references) //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Unknown result type (might be due to invalid IL or missing references) //IL_0aee: Unknown result type (might be due to invalid IL or missing references) //IL_0af3: Unknown result type (might be due to invalid IL or missing references) //IL_0af8: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_0b0a: Unknown result type (might be due to invalid IL or missing references) //IL_0b30: Unknown result type (might be due to invalid IL or missing references) //IL_0b37: Unknown result type (might be due to invalid IL or missing references) //IL_0b39: Unknown result type (might be due to invalid IL or missing references) //IL_0b3e: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0b45: Unknown result type (might be due to invalid IL or missing references) //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0b51: Unknown result type (might be due to invalid IL or missing references) //IL_0b6a: Unknown result type (might be due to invalid IL or missing references) //IL_0b71: Unknown result type (might be due to invalid IL or missing references) //IL_0b73: Unknown result type (might be due to invalid IL or missing references) //IL_0b78: Unknown result type (might be due to invalid IL or missing references) //IL_0b7d: Unknown result type (might be due to invalid IL or missing references) //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0b99: Unknown result type (might be due to invalid IL or missing references) //IL_0ba0: Unknown result type (might be due to invalid IL or missing references) //IL_0ba2: Unknown result type (might be due to invalid IL or missing references) //IL_0ba7: Unknown result type (might be due to invalid IL or missing references) //IL_0bbe: Unknown result type (might be due to invalid IL or missing references) //IL_0bc5: Unknown result type (might be due to invalid IL or missing references) //IL_0bc7: Unknown result type (might be due to invalid IL or missing references) //IL_0bcc: Unknown result type (might be due to invalid IL or missing references) //IL_0bce: Unknown result type (might be due to invalid IL or missing references) //IL_0bd3: Unknown result type (might be due to invalid IL or missing references) //IL_0bd8: Unknown result type (might be due to invalid IL or missing references) //IL_0bdf: Unknown result type (might be due to invalid IL or missing references) //IL_0bf3: Unknown result type (might be due to invalid IL or missing references) //IL_0bf5: Unknown result type (might be due to invalid IL or missing references) //IL_0bf7: Unknown result type (might be due to invalid IL or missing references) //IL_0bfc: Unknown result type (might be due to invalid IL or missing references) //IL_0c0b: Unknown result type (might be due to invalid IL or missing references) //IL_0c15: Unknown result type (might be due to invalid IL or missing references) //IL_0c1f: Unknown result type (might be due to invalid IL or missing references) //IL_0c21: Unknown result type (might be due to invalid IL or missing references) //IL_0c30: Unknown result type (might be due to invalid IL or missing references) //IL_0c32: Unknown result type (might be due to invalid IL or missing references) //IL_0c69: Unknown result type (might be due to invalid IL or missing references) //IL_0c92: Unknown result type (might be due to invalid IL or missing references) //IL_0c99: Unknown result type (might be due to invalid IL or missing references) //IL_0c9b: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Unknown result type (might be due to invalid IL or missing references) //IL_0cbe: Unknown result type (might be due to invalid IL or missing references) //IL_0cc3: Unknown result type (might be due to invalid IL or missing references) //IL_0cc5: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Unknown result type (might be due to invalid IL or missing references) //IL_0cc9: Unknown result type (might be due to invalid IL or missing references) //IL_0cd3: Unknown result type (might be due to invalid IL or missing references) //IL_0cd5: Unknown result type (might be due to invalid IL or missing references) //IL_0cda: Unknown result type (might be due to invalid IL or missing references) //IL_0cfb: Unknown result type (might be due to invalid IL or missing references) //IL_0d19: Unknown result type (might be due to invalid IL or missing references) //IL_0d20: Unknown result type (might be due to invalid IL or missing references) //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0d27: Unknown result type (might be due to invalid IL or missing references) //IL_0d2c: Unknown result type (might be due to invalid IL or missing references) //IL_0d2e: Unknown result type (might be due to invalid IL or missing references) //IL_0d3d: Unknown result type (might be due to invalid IL or missing references) //IL_0d54: Unknown result type (might be due to invalid IL or missing references) //IL_0d59: Unknown result type (might be due to invalid IL or missing references) //IL_0d5b: Unknown result type (might be due to invalid IL or missing references) //IL_0d72: Unknown result type (might be due to invalid IL or missing references) //IL_0d79: Unknown result type (might be due to invalid IL or missing references) //IL_0d7b: Unknown result type (might be due to invalid IL or missing references) //IL_0d80: Unknown result type (might be due to invalid IL or missing references) //IL_0d91: Unknown result type (might be due to invalid IL or missing references) //IL_0d9f: Unknown result type (might be due to invalid IL or missing references) //IL_0da6: Unknown result type (might be due to invalid IL or missing references) //IL_0da8: Unknown result type (might be due to invalid IL or missing references) //IL_0db2: Unknown result type (might be due to invalid IL or missing references) //IL_0db4: Unknown result type (might be due to invalid IL or missing references) //IL_0db9: Unknown result type (might be due to invalid IL or missing references) //IL_0dc3: Unknown result type (might be due to invalid IL or missing references) //IL_0dc8: Unknown result type (might be due to invalid IL or missing references) //IL_0dcd: Unknown result type (might be due to invalid IL or missing references) //IL_0dd2: Unknown result type (might be due to invalid IL or missing references) //IL_0dd7: Unknown result type (might be due to invalid IL or missing references) //IL_0dde: Unknown result type (might be due to invalid IL or missing references) //IL_0df2: Unknown result type (might be due to invalid IL or missing references) //IL_0df9: Unknown result type (might be due to invalid IL or missing references) //IL_0dfe: Unknown result type (might be due to invalid IL or missing references) //IL_0e03: Unknown result type (might be due to invalid IL or missing references) //IL_0f1f: Unknown result type (might be due to invalid IL or missing references) //IL_0f34: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Player.m_localPlayer).transform.position; Transform val = null; Transform val2 = null; Transform val3 = null; bool flag = false; bool flag2 = false; bool flag3 = false; Collider[] array = Physics.OverlapSphere(position, 60f, WUTIL.c_dungeonItemRayMask); foreach (Collider val4 in array) { Transform val5 = ((Component)val4).transform; if ((Object)(object)val5.parent != (Object)null) { val5 = val5.parent; } switch (WUTIL.GameName(((Component)val5).gameObject)) { case "Piece_Fang": if (m_buildRefreshMode == 0) { WDBUG.Log("Deleted dungeon already failed marker"); WUTIL.Destroy(((Component)val5).gameObject); break; } WDBUG.Log("Ignoring dungeon as previously searched", WDBUG.Level.Dungeon); m_lastBuildPosition = Vector3.zero; return false; case "ExteriorGateway": if (!ZNet.instance.IsServer()) { WDBUG.Log("Non-server player detected forest dungeon entry", WDBUG.Level.Multiplayer); } val = val5; break; case "Headstone": if ((Object)(object)val2 == (Object)null || val5.position.y > val2.position.y) { val2 = val5; } break; case "BoratRat": flag = true; m_lastBoratPosition = val5.position; WUTIL.Destroy(((Component)val5).gameObject); break; case "Borat": flag2 = true; break; case "MagicChest": flag3 = true; break; case "cauldron_ext3_butchertable": val3 = val5; break; } } if (flag2) { flag = false; } if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to find Exterior Gateway from player"); return false; } int num = m_buildRefreshMode; Vector3 position2 = val.position; if (position2 == m_lastBuildPosition) { if ((Object)(object)val2 == (Object)null) { WDBUG.Log("Custom forest dungeon has no keystone!"); } else { if (((Component)val2.Find("head10")).gameObject.activeSelf) { WDBUG.Log("Re-entry of custom forest dungeon in memory", WDBUG.Level.Dungeon); if (flag) { WDBUG.Log("Respawn Borat vs. Borat rat detected", WDBUG.Level.Dungeon); Place.Object("Borat", m_lastBoratPosition); } return true; } WDBUG.Log("Re-entry custom forest dungeon requires restore", WDBUG.Level.Dungeon); num = 2; } } bool flag4 = MapMarker.IsSharedLocation("Borat1"); if (num == 0) { WDBUG.Log($"Forcing dungeon build vs. restore: {(Object)(object)val2 != (Object)null} discovered: {flag4}"); } else if ((Object)(object)val2 == (Object)null) { if (flag4) { WDBUG.Log("Ignoring dungeon vs. known target", WDBUG.Level.Dungeon); return false; } if (!ZNet.instance.IsServer()) { WDBUG.Log("Forcing early build for non-server player", WDBUG.Level.Multiplayer); } else if (Quest.GetAchievement("QuestEikthyr") < 11 && Wildling.SkillFactor((SkillType)0) < 0.25f) { WDBUG.Log("Marked dungeon as untested non-target", WDBUG.Level.Dungeon); Place.Object("Piece_Fang", position2 - 3f * up); return false; } } else if (num == 2) { WDBUG.Log("Restoring map vs. Headstone detected", WDBUG.Level.Dungeon); m_lastBuildPosition = position2; Place.RestoreDungeon(position2, 50f, solidify: true); CheckBelowHeadstone(val2.position, clear: true); if (!flag3 && (Object)(object)val3 != (Object)null && Quest.GetAchievement("FairyTale") == 0 && Quest.GetAchievement("QuestEikthyr") >= 10) { Place.MapInitialize(position2, val.rotation); Vector3 val6 = val3.position - 2f * Place.MapFwd(0) - 14.5f * Place.MapFwd(1) + 0.5f * up; Place.Object("MagicChest", val6); WDBUG.Log($"Replaced Magic Chest at {val6}", WDBUG.Level.Dungeon); } if (flag) { WDBUG.Log("Respawn Borat vs. BoratRat detected", WDBUG.Level.Dungeon); Place.Object("Borat", m_lastBoratPosition); } if (WUTIL.WithinCylinder(position, position2, 4f, 4f)) { if (!MapMarker.IsSharedLocation("Borat1")) { MapMarker.AddPin(position2, "Borat1"); } WUTIL.Message("There is expectionally foul stength to this place. All your instincts tell you to run far away."); } return true; } m_lastBuildPosition = position2; if (num <= 1 && (Object)(object)val2 != (Object)null) { float num2 = val2.position.y + -7.5f; WDBUG.Log($"Destroying non-Crypt below height {num2}"); Place.DestroyDungeon(position2, 60f, val, 4900f, num2, drops: true, proxies: true, cryptFilter: true); } if (!FindCryptExits(val)) { WDBUG.Log("Placing invalid dungeon marker", WDBUG.Level.Dungeon); Place.Object("Piece_Fang", position2 - 3f * up); return false; } if (WUTIL.WithinCylinder(position, position2, 4f, 2f)) { WUTIL.Message("There is expectionally foul stength to this place. All your instincts tell you to run far away."); } Place.m_floorPlanCenter.y = m_entryLandings[0].y + -7.5f - 1.25f; Place.m_mapLocation.y = Place.m_floorPlanCenter.y; Place.m_mapLowerFloorHeight = Place.m_floorPlanCenter.y - 9.9f; Place.m_mapMaxWallHeight = Place.m_mapLowerFloorHeight + 5.5f; Place.m_roomPlanHasCeiling = true; Place.m_roomPlanTiledFloor = false; Place.m_roomPlanStoneCeiling = true; Place.m_levelRoomItems = ""; Place.m_stairTowerEntryStyle = 17304; Place.m_stairTowerDefaultStyle = 655642; Place.m_stairTowerEntryCorridorLength = 6; Place.m_roomDecorFakeItemChance = 0f; Place.m_roomDecorItemStandChance = 0.1f; Place.m_roomDecorLevel = 1; Place.m_torchDensity = 0.1f; Place.CustomizeMapGate(3, 4, "pickable"); Place.CustomizeMapGate(4, 7, "onewayReverse", '^'); Place.CustomizeMapGate(5, 3, "latch"); Place.CustomizeMapGate(6, 8, "stuck"); WUTIL.ResetRandomSeed(m_dungeonEntry); Place.RoomPlan(0, 5, 4.5f, m_forestDungeonRoomPlan, center: true, m_debugBuildLevel >= 2); Vector3 roomPlanPosition = Place.GetRoomPlanPosition(5, 5, -8f); Place.Object("Borat", roomPlanPosition); Place.OnPerimeter("Rat", roomPlanPosition, 3, 1f); Place.OnPerimeter("DeadRat", roomPlanPosition, 4); Vector3 val7 = Place.MapFwd(0); Vector3 val8 = Place.MapFwd(1); Place.Spawner("Rat", roomPlanPosition + val7); Place.Pickable("ForestCryptRemains01", roomPlanPosition + 7f * val7 + 5f * val8, 2, "AmberPearl"); Place.Spawner("Skeleton", roomPlanPosition + 7f * val7 + 5f * val8, 7f); Place.Pickable("ForestCryptRemains02", roomPlanPosition - 4f * val8, 0, "Coins:10"); Place.Spawner("SkeletonArcher", roomPlanPosition - 4f * val8, 7f); Place.Pickable("ForestCryptRemains03", roomPlanPosition - 2f * val7, 1, "MeadHealthMinor"); Vector3 val9 = roomPlanPosition + 5f * val7 - 2f * val8; Place.Object("MagicChest", val9); Vector3 val10 = val9; WDBUG.Log("Placing MagicChest at " + ((object)(*(Vector3*)(&val10))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); roomPlanPosition = Place.GetRoomPlanPosition(1, 2, -9.5f); Place.Piece("goblin_bed", roomPlanPosition + 0.5f * val7, 1); Place.Piece("piece_chair03", roomPlanPosition - val7 + val8 + 0.1f * up, 3); Place.Spawner("SkeletonArcher", roomPlanPosition - val7); Vector3 position3 = roomPlanPosition - 6f * val8 + 1.1f * up; for (int j = 0; j < 6; j++) { Place.Piece("iron_grate", position3, 1); } roomPlanPosition -= 6f * val7 + val8; Place.Piece("short_table_oak", roomPlanPosition, 1); Place.Pickable("Pickable_ForestCryptRemains04", roomPlanPosition + 0.05f * val7 + up, 2, "RabbitFurWhite;RabbitFurWhite;RabbitFurWhite;RabbitFurWhite"); Place.Torch("piece_brazierceiling01", roomPlanPosition + 0.125f * val7, 1.5f); roomPlanPosition -= 2.5f * val8 - val7; Place.Piece("cauldron_ext3_butchertable", roomPlanPosition, 0); Vector3 val11 = val9 - roomPlanPosition; WDBUG.Log($"Placing Butcher table at {roomPlanPosition} vs. {val11} Fwd:{Vector3.Dot(val11, val7)} Rht:{Vector3.Dot(val11, val8)}", WDBUG.Level.Dungeon); roomPlanPosition.y += 0.9f; Place.Piece("Skull1", roomPlanPosition, 2); roomPlanPosition.y += 1.1f; Place.Piece("forge_ext6", roomPlanPosition + 0.5f * val7, 2); roomPlanPosition = Place.GetRoomPlanPosition(1, 7, -9.5f); Place.RoomDecor(roomPlanPosition - val8 - 0.5f * val7, 0, 2.2f, 2f, 0f); Place.Spawner("Draugr", roomPlanPosition); roomPlanPosition.y += 1.5f; roomPlanPosition -= 0.1f * val8; Place.WallTorch(roomPlanPosition, 1, "piece_groundtorch_green"); Place.WallTorch(roomPlanPosition, 1, "piece_groundtorch"); roomPlanPosition = Place.GetRoomPlanPosition(1, 9, -10f); Place.StairWell(roomPlanPosition, 910); Place.SetPlanTiles(roomPlanPosition - 8f * val8, '-', 1, 2); Place.SetPlanTiles(roomPlanPosition, 'F', 0, 4); roomPlanPosition += 2f * val7 - 2f * val8 - 3f * up; Place.PieceUpright("stone_wall_2x1", roomPlanPosition, 0); Place.PieceUpright("stone_wall_2x1", roomPlanPosition - 2f * up, 0); Place.m_mapLowerFloorHeight -= 6f; Place.m_mapMaxWallHeight = Place.m_mapLowerFloorHeight + 4f; Place.m_floorPlanAnchor.y = Place.m_mapLowerFloorHeight; Place.m_doorStyleWallProb = 0.3f; Place.m_doorStyleBlocked = 0.2f; Place.m_doorStyleDoorway = 0.5f; Place.m_doorStyleArchWindow = 0.6f; Place.m_doorStyleLoseArchway = 0.1f; Place.m_doorStyleArchwaySkull = 0f; Place.m_doorStyleRoomWoodDoor = 0.1f; Place.m_doorStyleDoorMaterial = -5; Place.m_doorStyleCritter = 0.7f; Place.m_ratHoleSpawnUndead = 0f; Place.m_ratHoleSpawnDensity = 0.7f; Place.m_floorPlanSpaceItems = ""; Place.FloorPlanLevel(4f, 3f, 4f, 0, 775, 0f, "FW.", 2); AddStairwells(); BuildConnectionLevel(); WUTIL.ResetRandomSeed(); if (MapMarker.IsSharedLocation("Borat1")) { WDBUG.Log("Not replacing shared location marker for Borat"); } else { MapMarker.AddPin(position2, "Borat1"); } MapMarker.AddPin(m_entryLandings[0], "Borat"); return true; } private static bool CheckBelowHeadstone(Vector3 position, bool clear = false) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0099: 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) position.y -= 2.5f; bool result = false; Collider[] array = Physics.OverlapSphere(position, 1f, WUTIL.c_solidRayMask); foreach (Collider val in array) { Transform parent = ((Component)val).transform.parent; if ((Object)(object)parent != (Object)null && ((Object)((Component)parent).gameObject).name.StartsWith("stonewall") && Vector3.Distance(parent.position, position) <= 1f) { WDBUG.Log($"Found {((Object)((Component)parent).gameObject).name} under Headstone at offset: {parent.position - position}, removing: {clear}", WDBUG.Level.Dungeon); result = true; if (clear) { ((Component)parent).gameObject.SetActive(false); } } } return result; } private static bool FindCryptExits(Transform cryptEntrance, int maxExits = 1, bool blurFloorPlan = false) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_0610: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06f6: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_0e88: Unknown result type (might be due to invalid IL or missing references) //IL_0e8d: Unknown result type (might be due to invalid IL or missing references) //IL_0e91: Unknown result type (might be due to invalid IL or missing references) //IL_0e96: Unknown result type (might be due to invalid IL or missing references) //IL_0e9a: Unknown result type (might be due to invalid IL or missing references) //IL_0e9f: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_078d: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_0927: Unknown result type (might be due to invalid IL or missing references) //IL_0936: Unknown result type (might be due to invalid IL or missing references) //IL_0ec4: Unknown result type (might be due to invalid IL or missing references) //IL_0ec9: Unknown result type (might be due to invalid IL or missing references) //IL_0ecb: Unknown result type (might be due to invalid IL or missing references) //IL_0ed0: Unknown result type (might be due to invalid IL or missing references) //IL_0edb: Unknown result type (might be due to invalid IL or missing references) //IL_0ee0: Unknown result type (might be due to invalid IL or missing references) //IL_0ee2: Unknown result type (might be due to invalid IL or missing references) //IL_0ee7: Unknown result type (might be due to invalid IL or missing references) //IL_0ef2: Unknown result type (might be due to invalid IL or missing references) //IL_0ef7: Unknown result type (might be due to invalid IL or missing references) //IL_1042: Unknown result type (might be due to invalid IL or missing references) //IL_104c: Unknown result type (might be due to invalid IL or missing references) //IL_1060: Unknown result type (might be due to invalid IL or missing references) //IL_106a: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_08a1: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08a8: Unknown result type (might be due to invalid IL or missing references) //IL_08ad: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_0992: Unknown result type (might be due to invalid IL or missing references) //IL_0997: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_099e: Unknown result type (might be due to invalid IL or missing references) //IL_09a5: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_09ac: Unknown result type (might be due to invalid IL or missing references) //IL_09ae: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09b5: Unknown result type (might be due to invalid IL or missing references) //IL_09c3: Unknown result type (might be due to invalid IL or missing references) //IL_09c7: Unknown result type (might be due to invalid IL or missing references) //IL_09d3: Unknown result type (might be due to invalid IL or missing references) //IL_09d7: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0a1c: Unknown result type (might be due to invalid IL or missing references) //IL_0a3d: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_0a83: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0a96: Unknown result type (might be due to invalid IL or missing references) //IL_0a98: Unknown result type (might be due to invalid IL or missing references) //IL_0a9d: Unknown result type (might be due to invalid IL or missing references) //IL_0aa2: Unknown result type (might be due to invalid IL or missing references) //IL_0aac: Unknown result type (might be due to invalid IL or missing references) //IL_0ab3: Unknown result type (might be due to invalid IL or missing references) //IL_0ab5: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0abf: Unknown result type (might be due to invalid IL or missing references) //IL_0fac: Unknown result type (might be due to invalid IL or missing references) //IL_0fb6: Unknown result type (might be due to invalid IL or missing references) //IL_0f61: Unknown result type (might be due to invalid IL or missing references) //IL_0f6e: Unknown result type (might be due to invalid IL or missing references) //IL_0fe8: Unknown result type (might be due to invalid IL or missing references) //IL_0fca: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_0b05: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_0b0c: Unknown result type (might be due to invalid IL or missing references) //IL_0b11: Unknown result type (might be due to invalid IL or missing references) //IL_0b13: Unknown result type (might be due to invalid IL or missing references) //IL_0b15: Unknown result type (might be due to invalid IL or missing references) //IL_0b1a: Unknown result type (might be due to invalid IL or missing references) //IL_0b21: Unknown result type (might be due to invalid IL or missing references) //IL_0b2d: Unknown result type (might be due to invalid IL or missing references) //IL_0b36: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0b4f: Unknown result type (might be due to invalid IL or missing references) //IL_0b61: Unknown result type (might be due to invalid IL or missing references) //IL_0b66: Unknown result type (might be due to invalid IL or missing references) //IL_0b6b: Unknown result type (might be due to invalid IL or missing references) //IL_0bc3: Unknown result type (might be due to invalid IL or missing references) //IL_0c02: Unknown result type (might be due to invalid IL or missing references) //IL_0c04: Unknown result type (might be due to invalid IL or missing references) //IL_0c67: Unknown result type (might be due to invalid IL or missing references) //IL_0c3b: Unknown result type (might be due to invalid IL or missing references) //IL_0d7a: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0ced: Unknown result type (might be due to invalid IL or missing references) //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0d96: Unknown result type (might be due to invalid IL or missing references) //IL_0da4: Unknown result type (might be due to invalid IL or missing references) //IL_0da9: Unknown result type (might be due to invalid IL or missing references) //IL_0dab: Unknown result type (might be due to invalid IL or missing references) //IL_0db0: Unknown result type (might be due to invalid IL or missing references) //IL_0db5: Unknown result type (might be due to invalid IL or missing references) m_entryWalls.Clear(); m_entryLandings.Clear(); m_entryStyles.Clear(); m_wallAtXZ.Clear(); Vector3 position = cryptEntrance.position; Vector3 val = position; Vector3 val2 = position; Place.MapInitialize(position, cryptEntrance.rotation, "piece_groundtorch"); List list = new List(); Collider[] array = Physics.OverlapSphere(position, 60f, WUTIL.c_solidRayMask); foreach (Collider val3 in array) { Transform parent = ((Component)val3).gameObject.transform.parent; if ((Object)(object)parent == (Object)null) { continue; } string text = WUTIL.GameName(((Component)parent).gameObject); string text2 = (((Object)(object)parent.parent == (Object)null) ? "" : WUTIL.GameName(((Component)parent.parent).gameObject)); float num = parent.position.y - position.y; bool flag = false; bool flag2 = false; switch (text) { case "dirtfloor": case "floor": if (text2 == "Roof") { flag = true; } break; case "dirtwall": case "stonewall": if (num < 2f && text2 == "Walls") { flag = true; string name = ((Object)((Component)parent.parent.parent).gameObject).name; if (name.Contains("Stairs") || name.Contains("EndCap") || name.Contains("Chasm") || name.Contains("BurialChamber")) { flag = true; } else if (name.StartsWith("forestcrypt_Corridor")) { flag2 = true; } else if ((double)parent.localScale.y <= 0.7 && parent.localScale.z > 0.5f) { flag2 = true; } } else if (text2 == "Roof") { flag = true; } val.x = Mathf.Min(val.x, parent.position.x); val.z = Mathf.Min(val.z, parent.position.z); val2.x = Mathf.Max(val2.x, parent.position.x); val2.z = Mathf.Max(val2.z, parent.position.z); break; } if (flag2) { int key = WUTIL.HashMapPos(parent.position); if (m_wallAtXZ.ContainsKey(key)) { if (parent.position.y < m_wallAtXZ[key].position.y) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Replaced wall at {m_wallAtXZ[key].position} with lower at {parent.position}"); } m_wallAtXZ[key] = parent; } } else { m_wallAtXZ.Add(key, parent); } } if (flag) { list.Add(parent.position + 2f * parent.up); } } int num2 = 64 * WUTIL.Floor(position.x / 64f) - 32; WDBUG.Log($"X bounds: {val.x}, {val2.x} min: {num2}", WDBUG.Level.Dungeon); val.x = (float)num2 + 2f; val2.x = (float)(num2 + 64) - 2f; num2 = 64 * WUTIL.Floor(position.z / 64f) - 32; WDBUG.Log($"Z bounds: {val.z}, {val2.z} min: {num2}", WDBUG.Level.Dungeon); val.z = (float)num2 + 2f; val2.z = (float)(num2 + 64) - 2f; Place.m_mapBoundsMin = val; Place.m_mapBoundsMax = val2; Place.m_floorPlanCenter = 0.5f * (val + val2); Place.m_floorPlanAnchor = Place.m_floorPlanCenter; if (m_debugBuildLevel >= 1) { WDBUG.Log($"Located roofs: {list.Count} walls: {m_wallAtXZ.Count} bounds: {val} {val2} center/anchor: {Place.m_floorPlanCenter}", WDBUG.Level.Dungeon); } bool flag3 = Place.FloorPlanFromRoomMarkers(list, m_debugBuildLevel >= 2); m_dungeonEntry = Place.m_floorPlanCenter - 8f * Place.MapFwd(1); if (m_debugBuildLevel >= 3) { float heightOffset = 4f; WDBUG.Log($"Showing full floor plan at height {Place.m_floorPlanAnchor.y + 4f}"); Place.FloorPlan(heightOffset, showBounds: true); Place.Torch("piece_groundtorch_blue", Place.GetPlanTilePos(9, 9), heightOffset); Place.Torch("piece_groundtorch_green", Place.m_floorPlanCenter, heightOffset); Place.Torch("piece_groundtorch", m_dungeonEntry, heightOffset); } if (!flag3) { return false; } int num3 = 0; int num4 = 9999; float num5 = 0f; float num6 = 0f; foreach (Transform value in m_wallAtXZ.Values) { if (WUTIL.GroundDistance(value.position, position) < 8f) { continue; } string text3 = ((Object)value).name + "." + ((Object)value.parent).name + "." + ((Object)value.parent.parent).name; Vector3 val4 = 2f * value.right; Vector3 val5 = -4f * value.forward; int num7 = Place.GetMapNESW(val4, 0.9962f); if (num7 < 0) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Rejected {text3} at {value.position} for alignment"); } continue; } int num8 = 0; for (int j = -1; j <= 1; j += 2) { for (int k = -1; k <= 1; k += 2) { num8 <<= 1; Vector3 val6 = value.position + (float)j * val4; int num9 = 0; while (num9 < 3) { if (!Place.CheckPlanTilePos(val6, isTileEmpty: true)) { num8 |= 1; break; } if (m_debugBuildLevel >= 3) { switch (num9) { case 0: Place.Torch((k < 0) ? "piece_groundtorch_blue" : "piece_groundtorch_green", val6, -1f); break; case 1: Place.Torch("TorchCrystal", val6, -1f); break; case 2: Place.Torch("piece_groundtorch", val6, -2f); WDBUG.Log($"Should have path for {text3} {j},{k} waysBlocked: {num8}"); break; } } num9++; val6 += (float)k * val5; } } } if (num8 == 0 || num8 == 15) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Rejected {text3} at {value.position} {value.localScale} waysBlocked: {num8}"); } continue; } int num10 = (((num8 & 3) != 3) ? 1 : (-1)); if (num10 < 0) { num8 >>= 2; } Vector3 val7 = value.position + (float)num10 * val4; Vector3 planTilePos = Place.GetPlanTilePos(val7); val7 -= planTilePos; val7.y = 0f; float num11 = Vector3.Dot(val7, value.forward); float num12 = Vector3.Dot(val7, value.right); if (num11 * num11 > 0.36f) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Accepted {text3} at {value.position} doorTileOffset^2: {num11}x{num12} {val7}"); } continue; } bool flag4 = (num8 & 1) == 0; if (flag4 && (num8 & 2) == 0) { m_dungeonEntry.y = val7.y; if (Vector3.Distance(val7 - 3f * val5, m_dungeonEntry) < Vector3.Distance(val7 + 3f * val5, m_dungeonEntry)) { flag4 = false; } } int num13 = (flag4 ? 1 : (-1)); if (num10 < 0) { num7 += 2; flag4 = !flag4; } planTilePos = value.position + (float)num10 * val4; float num14 = Vector3.Dot(planTilePos - m_dungeonEntry, Place.MapFwd(num7)); bool flag5 = Place.CheckPlanTilePos(planTilePos + 4f * Place.MapFwd(num7)); bool flag6 = Place.CheckPlanTilePos(planTilePos + 4f * Place.MapFwd(num7 + ((!flag4) ? 1 : (-1)))); int num15 = ((num14 < 0f && flag5) ? 1 : (flag6 ? 2 : (flag5 ? 1 : 0))); if (num15 == 0) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Rejected {text3} at {value.position} as both landings are out of bounds"); } continue; } int num16 = (num7 & 3) | (flag4 ? 4 : 0) | (num15 << 4); num3++; float num17 = WUTIL.GroundDistance(planTilePos, m_dungeonEntry); if (num17 < 12f) { if (m_debugBuildLevel >= 1) { WDBUG.Log($"Rejected {text3} at {value.position} too close to dungeon: {num17}"); } continue; } int num18 = (int)planTilePos.y; bool flag7 = num18 < num4; if (num18 == num4) { flag7 = ((num17 > 12f) ? (num11 < num6) : (num17 > num5)); } if (flag7) { num4 = num18; num5 = num17; num6 = num11; if (m_entryWalls.Count > 0) { m_entryWalls.Add(m_entryWalls[0]); m_entryLandings.Add(m_entryLandings[0]); m_entryStyles.Add(m_entryStyles[0]); m_entryWalls[0] = value; m_entryLandings[0] = planTilePos; m_entryStyles[0] = num16; } else { m_entryWalls.Add(value); m_entryLandings.Add(planTilePos); m_entryStyles.Add(num16); } } else { m_entryWalls.Add(value); m_entryLandings.Add(planTilePos); m_entryStyles.Add(num16); } for (int l = 0; l < 3; l++) { Place.SetPlanTiles(planTilePos, 'F'); planTilePos += (float)num13 * val5; } } if (m_debugBuildLevel >= 1) { WDBUG.Log($"Found {m_entryWalls.Count}/{num3} viable exit walls, best dist: {num5}, door offset: {num6}"); } maxExits = Mathf.Min(maxExits, m_entryLandings.Count); if (maxExits == 0) { return false; } for (int m = 0; m < maxExits; m++) { Transform val8 = m_entryWalls[m]; Vector3 position2 = val8.position; Vector3 right = val8.right; Vector3 forward = val8.forward; foreach (Transform value2 in m_wallAtXZ.Values) { float num19 = Vector3.Dot(value2.position - position2, right); float num20 = Vector3.Dot(value2.position - position2, forward); float num21 = Vector3.Dot(value2.right, right); if (Mathf.Abs(num19) < 0.5f && Mathf.Abs(num20) < 2.2f && Mathf.Abs(num21) > 0.9f) { if (m_debugBuildLevel >= 1 && (Object)(object)value2 != (Object)(object)val8) { WDBUG.Log($"Deleting sidewall {value2.position} vs. {position2} wdotf: {num19} wdots: {num20} wdotw: {num21}"); } if (value2.position.y < position2.y) { position2.y = value2.position.y; } WDBUG.Log($"Deleting wall {((Object)value2).name} for doorway at {value2.position}", WDBUG.Level.Dungeon); ((Component)value2).gameObject.SetActive(false); } } m_entryLandings[m] = new Vector3(m_entryLandings[m].x, position2.y + -0.25f, m_entryLandings[m].z); } if (!blurFloorPlan) { Place.FloorPlanFromRoomMarkers(list); } ApplyMapOffset(0.05f); return true; } private static void ApplyMapOffset(float embed = 0f) { //IL_004a: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_00c1: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (embed != 0f) { List entryLandings = m_entryLandings; entryLandings[0] = entryLandings[0] + embed * Place.MapFwd(m_entryStyles[0] & 3); } Vector3 val = m_entryLandings[0] - Place.GetPlanTilePos(m_entryLandings[0]); val.y = 0f; if (m_debugBuildLevel >= 1) { WDBUG.Log($"Buildling {m_entryLandings[0]} to {m_dungeonEntry} with offset: {val}"); } Place.m_floorPlanAnchor += val; Place.m_mapLocation += val; Place.m_mapLocation.y = Place.m_floorPlanCenter.y; Place.m_floorPlanCenter = Place.GetPlanTilePos(Place.m_floorPlanCenter); m_dungeonEntry = Place.m_floorPlanCenter - 8f * Place.MapFwd(1); } private static void AddStairwells(int maxExits = 1) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) Transform val = m_entryWalls[0]; string text = ""; while ((Object)(object)val != (Object)null) { text = text + ((Object)((Component)val).gameObject).name + "."; val = val.parent; } WDBUG.Log("Buildling exit vs. " + text, WDBUG.Level.Dungeon); maxExits = Mathf.Min(maxExits, m_entryLandings.Count); for (int i = 0; i < maxExits; i++) { Transform val2 = m_entryWalls[i]; Vector3 position = val2.position; Vector3 right = val2.right; Vector3 forward = val2.forward; foreach (Transform value in m_wallAtXZ.Values) { float num = Vector3.Dot(value.position - position, right); float num2 = Vector3.Dot(value.position - position, forward); float num3 = Vector3.Dot(value.right, right); if (Mathf.Abs(num) < 0.5f && Mathf.Abs(num2) < 2f && Mathf.Abs(num3) > 0.9f) { Vector3 val3 = value.position - position; if (m_debugBuildLevel >= 1) { WDBUG.Log($"Removing sidewall d{val3} = {((Vector3)(ref val3)).magnitude} from entry wall, wdotf: {num} wdots: {num2} wdotw: {num3}", WDBUG.Level.Dungeon); } if (value.position.y < position.y) { position.y = value.position.y; } ((Component)value).gameObject.SetActive(false); } } m_entryLandings[i] = new Vector3(m_entryLandings[i].x, position.y + -0.25f, m_entryLandings[i].z); Place.StairWell(m_entryLandings[i], m_entryStyles[i], 0.75f); } } private static void BuildConnectionLevel(int maxExits = 1) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) Place.FloorPlanFromPlan(); Place.m_floorPlanAnchor.y = m_entryLandings[0].y + -7.5f; Place.m_mapLowerFloorHeight = Place.m_floorPlanAnchor.y; Place.m_mapMaxWallHeight = Place.m_mapLowerFloorHeight + 4f; maxExits = Mathf.Min(maxExits, m_entryLandings.Count); for (int i = 0; i < maxExits; i++) { Vector3 val = m_entryLandings[i]; int num = m_entryStyles[i] & 3; int nesw = num + (((m_entryStyles[i] & 4) > 0) ? 1 : (-1)); Place.SetPlanTiles(val, '-', nesw, 3, 1, m_debugBuildLevel >= 2); if (m_debugBuildLevel >= 3) { Place.Torch("piece_groundtorch_blue", val + Place.MapFwd(num + 1)); } int num2 = m_entryStyles[i] >> 4; switch (num2) { case 2: num += (((m_entryStyles[i] & 4) <= 0) ? 1 : (-1)); break; case 4: num += 2; break; default: num2 = 0; break; case 1: break; } if (num2 > 0) { val += 4f * Place.MapFwd(num); } Place.SetPlanTiles(val, '-', num + 2, 3); Place.SetPlanTiles(val, 'F'); if (!Place.FloorPlanMakePath(val, Place.m_floorPlanCenter, 2, 3, m_debugBuildLevel >= 3)) { WDBUG.Log($"Failed to make complete floor plan path for exit {i}"); } } if (!Place.FloorPlanMakePath(m_dungeonEntry, Place.m_floorPlanCenter, 0, 0, m_debugBuildLevel >= 3)) { WDBUG.Log("Failed to make complete floor plan path for path center to entry"); } Place.SetPlanTiles(m_dungeonEntry, 'W'); Place.SetPlanTiles(m_dungeonEntry + 4f * Place.MapFwd(0), ' ', 0, 2); Place.m_doorStyleDoorway = 0.7f; Place.m_doorStyleArchWindow = 0.1f; Place.m_doorStyleWallProb = 0.1f; Place.m_doorStyleLoseArchway = 0.1f; Place.m_doorStyleCritter = 0f; Place.m_ratHoleSpawnUndead = 0f; Place.m_doorStyleDoorMaterial = -1; Place.m_doorStyleRoomWoodDoor = 0.2f; Place.FloorPlanLevel(4f, 3f, 4f, 12, 273, 0.05f); } } internal class MountainDungeon { public static int m_buildRefreshMode = 2; public const string c_riddleItem = "Dandelion"; public const string c_riddleItemstand = "ALL_PlaceRiddleItem"; private static int c_iceCavernSeed = 917; private static bool c_checkPopulation = false; private static string c_mountainDungeonLocation = "MountainWell1"; private static string c_mountainDungeonLocation2 = "DrakeNest01"; private static bool m_gateOpenned = false; private static bool m_useSecondarySite = false; private static bool m_lateHeadPlacements = false; private static bool m_syncSnakeBody = true; private static int m_mountainDungeonNeckLevelOffset = 5; private static int m_clearanceWaits = 20; private static int m_mountainDungeonNESW = 3; private static int m_bodySectionActive = 1; private static Vector3 up = Vector3.up; private static Vector3 m_mountainDungeonSpinePos = Vector3.zero; private static List m_spinePieces = new List(); private static IEnumerator BodyBuilder = BuildBodyPart().GetEnumerator(); private const float c_portalWidth = 0.01f; private const float c_mountainDungeonGroundHeight = 2000f; private const float c_mountainDungeonBaseHeight = 5200f; private const float c_mountainDungeonSplitHeight = 5200f; private const float c_mountainDungeonCatchDepth = 64f; private const float c_mountainDungeonExitOpenTime = 120f; private const float c_mountainDungeonCullInterval = 30f; private static bool m_mountainDungeonBuildHead = true; private static bool m_mountainDungeonBuildBody = true; private static List m_serpentTeeth = new List(); private static int m_wasAtPortalUpside = 0; private static bool m_findChimesLocation = true; private static bool m_buildChimesLocation = false; private static bool m_insideMountainDungeon = false; private static bool m_insideMountainDungeonEntry = false; private static float m_mountainDungeonTrampolineHeight = 0f; private static Vector3 m_mountainDungeonPinLocation = Vector3.zero; private static Vector3 m_mountainDungeonBuildLocation = Vector3.zero; private static Vector3 m_mountainDungeonBuildPosition = Vector3.zero; private static Vector3 m_mountainDungeonGatePosition = Vector3.zero; private static Vector3 m_mountainDungeonBehindGatePos = Vector3.zero; private static Vector3 m_mountainDungeonHeadLevelExit = Vector3.zero; private static Vector3 m_mountainDungeonBodyLevelExit = Vector3.zero; private static Vector3 m_mountainDungeonCavern = Vector3.zero; private static string[] m_mountainDungeonLabrynthFloorPlan = new string[17] { "RFFFFF FFFFFFFRRR", "FFFFRFFFF f fRRR", "FR#FF F FF FFRRF", "FFF FF FFFF FFF", "F FFF FF FFF F F", "F F$FFF F FFFFFF", "F FF F Ffff", "FfffSSSF ffFFFfRf", "RF f , f F Ffff", "RRFF , WF FFFF", "RRRFnnn FFFF F", "RRFF FF FFF F", "RFRFF f F FFF", "RFFFF F FFF F ", "=FRFFFFRRFFFFFFFF", "=FRFRRFRRF fff###", "=FFFFFFFFF f##S=f" }; private static string[] m_mountainDungeonIceFloorPlan = new string[18] { " __i___Z ", " Z_i___i____ ", " __ffffff___Z_I ", " _fffI___fffE___ ", " _fI___iI_I_____ ", "__f_ffffff_i_..__", "_If_fi___fif_.._I", "_ffffff__w_f__f__", "ZfI_f_f W_fIifi_", "_f_IfIE fIf__f__", "_f__f_f__ffffffi_", "_.._f_fzii_f fI__", "_.._iiffffffIf___", " __________i_f_Z ", " _iNfffi_i_fff__ ", " __IIffffff_i_ ", " _______I___ ", " ___i___ " }; private static string[] m_mountainDungeonLowerIceFloorPlan = new string[9] { "ffff ffff", "ff #n# ff", "f FFFFF f", "f=FFFFF=f", "==FF.FF==", "f=FFFFF=f", "f FFFFF f", "ff ### ff", "ffff#ffff" }; private static int[,] m_forestDungeonRoomPlan = new int[7, 9] { { 1071, 24582, 17920, 27136, 983583, 985631, 985631, 985119, 986127 }, { 4099, 2, 16385, 1311, 4096, 9, 0, 1, 132383 }, { 4099, 527, 8193, 1311, 8194, 4099, 2592, 2591, 2335 }, { 0, 3, 4161, 6664, 6689, 10753, 0, 65535, 65535 }, { 65535, 2, 1280, 651279, 126991, 126991, 86025, 47, 65535 }, { 815, 32774, 1280, 587343, 916480, 520192, 983808, 195087, 3072 }, { 847873, 327682, 328463, 262912, 264448, 262144, 262144, 454671, 1302 } }; private static int[,] m_mountainDungeonRoomPlan = new int[12, 11] { { 1567, 2591, 3615, 2095, 2591, 2591, 2591, 3103, 3375, 2, 65535 }, { 1567, 2592, 2304, 4, 4, 16388, 0, 799, 2847, 3631, 2591 }, { 1823, 2592, 3074, 65535, 65535, 10, 4, 4, 4, 15, 0 }, { 1823, 2560, 3330, 65535, 65535, 8, 65535, 65535, 0, 12, 0 }, { 1823, 2592, 2306, 65535, 1, 31, 65535, 65535, 0, 32770, 3119 }, { 1280, 831, 2, 65535, 65535, 65535, 65535, 65535, 3, 16386, 0 }, { 1280, 1599, 2, 65535, 65535, 65535, 65535, 65535, 2, 2, 0 }, { 1823, 2592, 3074, 65535, 65535, 65535, 65535, 65535, 8193, 2, 3119 }, { 1823, 2560, 3330, 65535, 65535, 65535, 65535, 65535, 4, 9, 0 }, { 1823, 2592, 2306, 65535, 65535, 65535, 9, 1, 3375, 4, 4 }, { 20484, 3343, 12, 1281, 67, 4099, 4100, 5, 5, 3375, 0 }, { 0, 65535, 65535, 776, 2320, 0, 3375, 0, 0, 3375, 0 } }; public static void ResetBuildMode(int mode = -1) { m_buildChimesLocation = true; m_mountainDungeonBuildHead = true; m_mountainDungeonBuildBody = true; if (mode >= 0 && mode <= 2) { m_buildRefreshMode = mode; } } public static bool PlayerInside() { return m_insideMountainDungeon || m_insideMountainDungeonEntry; } public static bool MarkLocationOnMap(bool showOnMap = false) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return !m_findChimesLocation && MapMarker.MarkMap(m_mountainDungeonPinLocation, "Chimes", showOnMap); } public static bool InSnakeBodyRegion(Vector3 pos) { //IL_0001: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if (pos.y < 5200f) { return false; } if (m_findChimesLocation) { switch (EnvMan.instance.GetCurrentEnvironment().m_name) { case "Crypt": case "SunkenCrypt": case "Cave": return false; default: return true; } } pos -= m_mountainDungeonPinLocation; return pos.x * pos.x + pos.z * pos.z < 2500f; } public static bool InSnakeHeadRegion(Vector3 pos, bool debug = false) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_004c: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_00ad: 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_006c: 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_0079: Unknown result type (might be due to invalid IL or missing references) if (!m_buildChimesLocation) { return false; } pos -= m_mountainDungeonPinLocation; if (debug) { float num = Mathf.Sqrt(pos.x * pos.x + pos.z * pos.z); bool flag = pos.y < 9f && pos.y > -14f && pos.x * pos.x + pos.z * pos.z < 25f; WDBUG.Log($"InSnakeHeadRegion({pos}): {flag} vdist: {pos.y} hdist: {num}"); } return pos.y < 9f && pos.y > -14f && pos.x * pos.x + pos.z * pos.z < (float)((pos.y > 3f) ? 81 : 25); } public static void Update() { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_019c: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) if (!LocateDungeon() || !BuildDungeon()) { return; } Vector3 val = ((Component)Player.m_localPlayer).transform.position; Vector3 val2 = val - m_mountainDungeonGatePosition; val2.y = 0f; Player closestPlayer = Player.GetClosestPlayer(m_mountainDungeonGatePosition, 8f); if ((Object)(object)closestPlayer != (Object)null) { val2 = ((Component)closestPlayer).transform.position - m_mountainDungeonGatePosition; float magnitude = ((Vector3)(ref val2)).magnitude; val2.y = 0f; float num = 1f; Vector3 val3 = m_mountainDungeonBehindGatePos - m_mountainDungeonGatePosition; Vector3 normalized = ((Vector3)(ref val3)).normalized; bool gateOpenned = m_gateOpenned; m_gateOpenned = AllCrystalTorchesLit(); if (m_gateOpenned || (Vector3.Dot(val2, normalized) > 0f && magnitude < 3f)) { num = Mathf.Min(2.25f, Mathf.Max(1f, 1f * (3f - magnitude))); if (m_gateOpenned) { if (!gateOpenned) { WUTIL.PlaySfx("heavygate_sfx", m_mountainDungeonGatePosition); WUTIL.Spawn("digger_groundhit_vfx", m_mountainDungeonGatePosition, Quaternion.Euler(90f, 0f, 0f)); } } else if (m_bodySectionActive == 2) { m_bodySectionActive = 1; } } Transform val4 = Place.Captured("MD_mouth_gate_1"); val4.position = m_mountainDungeonGatePosition + up * num; Place.Captured("MD_mouth_gate_2").position = m_mountainDungeonGatePosition - up * num; } m_insideMountainDungeonEntry = Vector3.Distance(val, m_mountainDungeonBehindGatePos) < 3f; if (m_bodySectionActive > 0 || (m_bodySectionActive < 0 && Wildling.IsWildling)) { Quest.CheckObjective(36, set: false); Vector3 val5 = val - m_mountainDungeonHeadLevelExit; Vector3 val6 = val - m_mountainDungeonBodyLevelExit; float magnitude2 = ((Vector3)(ref val5)).magnitude; float magnitude3 = ((Vector3)(ref val6)).magnitude; if (magnitude2 < 1f || magnitude3 < 1f) { Vector3 val7 = m_mountainDungeonHeadLevelExit - m_mountainDungeonBodyLevelExit; val5.y = 0f; val6.y = 0f; int num2 = ((((Vector3)(ref val5)).magnitude <= ((Vector3)(ref val6)).magnitude) ? 1 : (-1)); bool flag = magnitude3 < magnitude2; if (m_wasAtPortalUpside != 0 && num2 != m_wasAtPortalUpside) { if (num2 > 0) { if (flag) { val += val7; Flight.DisableGroundHitDamage(); ((Component)Player.m_localPlayer).transform.position = val; WDBUG.Log($"Moving to snake HEAD upper {val}", WDBUG.Level.Dungeon); } else if (m_bodySectionActive < 2) { if (!SpikesUp()) { m_bodySectionActive = 2; WDBUG.Log("Spikes down: Deactivate Lower Body return"); } else { val -= val7; ((Component)Player.m_localPlayer).transform.position = val; WDBUG.Log($"Moving to snake BODY upper {val}", WDBUG.Level.Dungeon); } } } else if (flag) { val += val7; Flight.DisableGroundHitDamage(); ((Component)Player.m_localPlayer).transform.position = val; WDBUG.Log($"Moving to snake HEAD lower {val}", WDBUG.Level.Dungeon); } else { val -= val7; ((Component)Player.m_localPlayer).transform.position = val; WDBUG.Log($"Moving to snake BODY lower {val}", WDBUG.Level.Dungeon); } num2 = 0; } m_wasAtPortalUpside = num2; } else { m_wasAtPortalUpside = 0; } } if (val.y < 2000f) { if (((Vector3)(ref val2)).magnitude < 6f) { UpdateMotionOutside(); } if (((Vector3)(ref val2)).magnitude < 20f) { CheckPopulation(); } m_insideMountainDungeon = false; m_syncSnakeBody = true; } else if (val.y < m_mountainDungeonTrampolineHeight && val.y > 5200f) { float num3 = WUTIL.GroundDistance(val, m_mountainDungeonCavern); WDBUG.Log($"Teleporting to Dandelion fall hdist: {num3} teleporting: {((Character)Player.m_localPlayer).IsTeleporting()}", WDBUG.Level.Dungeon); Flight.DisableGroundHitDamage(3f); val = m_mountainDungeonCavern; val.y += 120f; ((Component)Player.m_localPlayer).transform.position = val; } else { UpdateMotionInside(); CheckPopulation(); } } public static bool PickableInteract(Transform piece, bool trigger = true) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.GameName(((Component)piece).gameObject); if (text.StartsWith("Pickable_")) { text = "MD_trigger_" + text.Substring(9); } return Place.CheckTriggerPiece(piece.position, text, trigger, "MD_sidewall_engaged", 120f, 4f); } public static bool PieceInteract(Transform piece) { //IL_0002: 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_004c: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) return Place.CheckTriggerPiece(piece.position, "MD_switch_snake_wallspin_1", trigger: false, "MD_wallspin_engaged", 2f) || Place.CheckTriggerPiece(piece.position, "MD_switch_snake_wallspin_2", trigger: false, "MD_wallspin_engaged", 2f) || Place.CheckTriggerPiece(piece.position, "MD_switch_iceworm_gate_1", trigger: false, "MD_barredgates_engaged", 20f) || Place.CheckTriggerPiece(piece.position, "MD_switch_iceworm_gate_2", trigger: false, "MD_barredgates_engaged", 20f) || Place.CheckTriggerPiece(piece.position, "MD_switch_beeway_1", trigger: false, "MD_walldrop_engaged", 12f) || Place.CheckTriggerPiece(piece.position, "MD_switch_beeway_2", trigger: false, "MD_walldrop_engaged", 12f); } public static bool PieceInteract(string pieceName, Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) return Place.CheckTriggerPiece(position, "MD_switch_snake_wallspin_1", trigger: true, "MD_wallspin_engaged", 2f) || Place.CheckTriggerPiece(position, "MD_switch_snake_wallspin_2", trigger: true, "MD_wallspin_engaged", 2f) || Place.CheckTriggerPiece(position, "MD_switch_iceworm_gate_1", trigger: true, "MD_barredgates_engaged", 20f) || Place.CheckTriggerPiece(position, "MD_switch_iceworm_gate_2", trigger: true, "MD_barredgates_engaged", 20f) || Place.CheckTriggerPiece(position, "MD_switch_beeway_1", trigger: true, "MD_walldrop_engaged", 12f) || Place.CheckTriggerPiece(position, "MD_switch_beeway_2", trigger: true, "MD_walldrop_engaged", 12f); } public static bool BedUnsafe(Bed bed) { if (WUTIL.GameName(((Component)bed).gameObject) == "piece_bed02") { Transform val = Place.CapturedGate("jotunnKey_11,4"); if ((Object)(object)val != (Object)null) { ZNetView component = ((Component)val).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && component.GetZDO().GetInt("state", 0) != 0) { WUTIL.Message("You cannot sleep with the cell door open."); return true; } } } return false; } public static bool CheckRiddleAnswer(ItemStand itemStand, ItemData item) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (((Object)itemStand).name == "ALL_PlaceRiddleItem") { switch (WUTIL.ItemName(item)) { case "Dandelion": { string text = (Wildling.IsWildling ? "Chimes" : "BattleaxeCrystal"); if (Wildling.IsWildling ? Quest.CollectedItem(text) : (Quest.GetAchievement(text) > 0)) { WUTIL.Message("Correct! But no reward for those that have answered before!"); return true; } WUTIL.Message("Congratulations on solving the riddle! Here's your prize."); Place.Object("chimes_discovery_fx", ((Component)itemStand).transform.position, 0.3f); Place.Object("fireblast_fx", ((Component)itemStand).transform.position); Place.Object("sfx_dragon_coldball_launch", ((Component)itemStand).transform.position); Place.CustomizeItemStand(((Component)itemStand).gameObject, 28 + ":" + text, attachItem: true, reset: true); if (!Wildling.IsWildling) { Quest.AdvanceAchievement(text); } Quest.CheckObjective(37, set: false); return false; } case "FancyJacket": WUTIL.Message("Thank you! That item is... a work in progress.\nIt is not the answer, but please accept this in exchange."); Place.RejectItemstandItem(itemStand, "AncientMushroom", defer: true); break; case "PickaxeStone": WUTIL.Message(item.m_shared.m_name + " is not the correct offering.\nAnd it's not for you."); Place.RejectItemstandItem(itemStand, "", defer: true); break; default: WUTIL.Message(item.m_shared.m_name + " is not the correct offering."); break; } return true; } return false; } public static bool CheckItemstandGift(ItemStand itemStand) { string name = ((Object)itemStand).name; if (!name.StartsWith("support_")) { return false; } name = name.Substring(8); if (name != WUTIL.TrimWildlingTag(itemStand.GetAttachedItem())) { return false; } switch (name) { case "Sparx": Place.RejectItemstandItem(itemStand, "Obsidian"); break; case "Thorscorn": Place.RejectItemstandItem(itemStand, "Crystal"); break; case "Bowdacious": Place.RejectItemstandItem(itemStand, "Ruby"); break; case "Digger": if (Wildling.IsWildling) { return false; } Place.RejectItemstandItem(itemStand, "Wood"); break; case "PickaxeStone": if (!Wildling.IsWildling) { return false; } Place.RejectItemstandItem(itemStand, "Stone"); break; default: return false; } WUTIL.Message("The item was an illusion!"); return true; } private static bool LocateDungeon() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.Timer("MountainDungeon_build") > 0f) { return false; } if (!World.GetStartPosition(out var pos)) { WUTIL.TimerReset("MountainDungeon_build", 0.1f); return false; } if (!m_findChimesLocation) { return true; } LocationInstance zloc; if (!ZNet.instance.IsServer()) { if (!World.GetUniquePosition("LokiDungeon", ref m_mountainDungeonPinLocation)) { WUTIL.TimerReset("MountainDungeon_build", 0.5f); return false; } WDBUG.Log($"LokiDungeon position {m_mountainDungeonPinLocation} acquired", WDBUG.Level.Dungeon); if (m_buildRefreshMode != 2) { WDBUG.Log("Forcing refresh mode for non-server player and adding 2s build delay"); WUTIL.TimerReset("MountainDungeon_build", 2f); m_buildRefreshMode = 2; } } else if (World.FindBestLocation(c_mountainDungeonLocation, pos, out zloc, 4000f, 2, "Mountain")) { m_mountainDungeonPinLocation = zloc.m_position; WDBUG.Log($"LokiDungeon primary location {m_mountainDungeonPinLocation} determined", WDBUG.Level.Dungeon); } else { WDBUG.Log($"Failed to find primary: {c_mountainDungeonLocation} Server: {ZNet.instance.IsServer()}", WDBUG.Level.Dungeon); if (!World.FindBestLocation(c_mountainDungeonLocation2, pos, out zloc, 4000f, 2)) { WDBUG.Log("Failed to find Great Serpent location: " + c_mountainDungeonLocation2); WUTIL.TimerReset("MountainDungeon_build", 4f); return false; } WDBUG.Log("Parkcor Great Serpent World!", WDBUG.Level.info); m_mountainDungeonPinLocation = zloc.m_position + 12f * up; m_useSecondarySite = true; } WDBUG.DebugLocation = m_mountainDungeonPinLocation + new Vector3(6f, 0f, 6f); m_findChimesLocation = false; m_buildChimesLocation = true; if (ZNet.instance.IsServer()) { World.SetUniquePosition("LokiDungeon", m_mountainDungeonPinLocation); } return true; } private static bool BuildDungeon() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)Player.m_localPlayer).transform.position; if (m_buildChimesLocation) { if (position.y >= 5200f) { position.y = m_mountainDungeonPinLocation.y; } else if (position.y >= 2000f) { return false; } if (Vector3.Distance(position, m_mountainDungeonPinLocation) < 100f) { if (m_mountainDungeonBuildBody && m_buildRefreshMode > 0) { RefreshDungeon(); } if (m_mountainDungeonBuildHead && BuildHead()) { m_mountainDungeonBuildHead = false; if (MarkLocationOnMap()) { WUTIL.Message("New location marked on map."); } Place.NoteDungeonBuilding(); } m_buildChimesLocation = m_mountainDungeonBuildBody || m_mountainDungeonBuildHead; } if (WUTIL.Timer("MountainDungeon_build") > 0f) { return false; } } if (m_mountainDungeonBuildHead || m_mountainDungeonGatePosition == Vector3.zero) { return false; } Vector3 val = position - m_mountainDungeonGatePosition; float magnitude = ((Vector3)(ref val)).magnitude; val.y = 0f; m_insideMountainDungeon = ((Vector3)(ref val)).magnitude < 50f; if (!m_insideMountainDungeon) { return false; } if (m_mountainDungeonBuildBody && CheckBodyBuilt()) { WDBUG.Log("Snake Body built marker detected, build mode " + m_buildRefreshMode, WDBUG.Level.Dungeon); if (m_buildRefreshMode < 1) { m_buildRefreshMode = 2; } RefreshDungeon(); m_mountainDungeonBuildBody = false; } if (m_mountainDungeonBuildBody) { WDBUG.Log("Building body part at horizonal dist " + ((Vector3)(ref val)).magnitude, WDBUG.Level.Dungeon); WUTIL.TimerReset("mapmarkers", 0.1f); if (BodyBuilder.MoveNext()) { Place.NoteDungeonBuilding(); WDBUG.Log($"Built Body part {BodyBuilder.Current}", WDBUG.Level.Dungeon); return false; } m_mountainDungeonBuildBody = false; } else if (!m_mountainDungeonBuildHead) { foreach (Transform serpentTooth in m_serpentTeeth) { if ((Object)(object)serpentTooth == (Object)null) { WDBUG.Log("Force MD Restore mode vs. in-memory loss"); ResetBuildMode(); return false; } } } if (m_lateHeadPlacements && magnitude < 16f) { WDBUG.Log("Late placement of outside Pickables", WDBUG.Level.Dungeon); m_lateHeadPlacements = false; Vector3 val2 = Place.MapFwd(m_mountainDungeonNESW); int num = m_mountainDungeonNESW + 1; Vector3 val3 = Place.MapFwd(num); Vector3 val4 = m_mountainDungeonBehindGatePos + 6f * val2 + 1.8f * val3 - 11f * up; Place.Pickable("Dandelion", val4, num, "MD_trigger_Dandelion"); Place.Pickable("Pickable_ForestCryptRemains01", val4 - 0.8f * val3, num, "FairyTalePages3"); Place.Pickable("Pickable_ForestCryptRemains04", val4 + 1.7f * val3 - 2.3f * val2, num + 1, "SideNote1"); val4 = m_mountainDungeonBehindGatePos + 1.4f * val2 - 3f * val3 - 12f * up; Place.Pickable("Pickable_Dandelion", val4, m_mountainDungeonNESW, "PixieDust"); if (magnitude < 8f) { Quest.CheckObjective(35, set: false); Quest.CheckObjective(36); } } if (magnitude < 16f && MarkLocationOnMap()) { WUTIL.Message("New location marked on map."); } return true; } private static void RefreshDungeon() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = m_mountainDungeonPinLocation + 5200f * up; if (m_buildRefreshMode == 2) { if (ZNet.instance.IsServer() || Place.RestoreMinablesReady(val)) { int num = Place.RestoreDungeon(val, 100f); WDBUG.Log($"Restored {num} Snake Body custom pieces, ice: {Place.m_restoredIce}", WDBUG.Level.Dungeon); if (num > 500) { m_mountainDungeonBuildBody = false; m_buildRefreshMode = 0; Place.RestoreInhabitants(val); } else { m_buildRefreshMode = 1; } } else { WDBUG.Log("Snake Body restore waiting 0.5s on Ice", WDBUG.Level.Dungeon); WUTIL.TimerReset("MountainDungeon_build", 0.5f); } } if (m_buildRefreshMode == 1) { WDBUG.Log("Destroying Snake Body and forcing Rebuild mode"); Place.DestroyDungeon(val, 100f, null, 4900f, 9999f, drops: true, proxies: true); m_buildRefreshMode = -1; } } private static void SyncSnakeBody() { //IL_004d: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0067: Unknown result type (might be due to invalid IL or missing references) WDBUG.Log("SyncSnakeBody", WDBUG.Level.Multiplayer); Place.SyncRotation("MD_snake_wallspin"); Place.SyncRotation("MD_switch_snake_wallspin_1"); Place.SyncPosition("MD_switch_snake_wallspin_1"); Place.SyncRotation("MD_switch_snake_wallspin_2"); Place.SyncPosition("MD_switch_snake_wallspin_2"); Vector3 position = m_mountainDungeonPinLocation + 5200f * up; Place.RestoreInhabitants(position); } private static void UpdateMotionInside() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00a5: 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_00b9: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) if (m_syncSnakeBody) { SyncSnakeBody(); m_syncSnakeBody = false; } float num = WUTIL.Timer("MD_wallspin_engaged"); if (num > 0f) { Transform val = Place.Captured("MD_switch_snake_wallspin_1"); Transform val2 = Place.Captured("MD_switch_snake_wallspin_2"); Transform val3 = Place.Captured("MD_snake_wallspin"); val.position = val3.position - 0.55f * val3.up + 0.5f * up; val.rotation *= Quaternion.AngleAxis(45f * Time.fixedDeltaTime, Vector3.up); val2.position = val3.position + 0.55f * val3.up + 0.5f * up; val2.rotation *= Quaternion.AngleAxis(45f * Time.fixedDeltaTime, Vector3.up); val3.rotation *= Quaternion.AngleAxis(45f * Time.fixedDeltaTime, Vector3.right); } num = WUTIL.Timer("MD_barredgates_engaged"); if (num > 0f) { Transform val4 = Place.Captured("MD_switch_iceworm_gate_1"); Transform val5 = Place.Captured("MD_switch_iceworm_gate_2"); float num2 = ((num > 16f) ? 45f : (-11.25f)); val4.rotation *= Quaternion.AngleAxis(num2 * Time.fixedDeltaTime, Vector3.right); val5.rotation *= Quaternion.AngleAxis(num2 * Time.fixedDeltaTime, Vector3.right); Transform val6 = Place.Captured("MD_barredgate1"); Transform val7 = Place.Captured("MD_barredgate2"); float num3 = ((num > 16f) ? 0.5f : (-0.125f)); val6.position += new Vector3(0f, num3 * Time.fixedDeltaTime, 0f); val7.position -= new Vector3(0f, num3 * Time.fixedDeltaTime, 0f); } num = WUTIL.Timer("MD_walldrop_engaged"); if (num > 0f) { Transform val8 = Place.Captured("MD_switch_beeway_1"); Transform val9 = Place.Captured("MD_switch_beeway_2"); float num4 = ((num > 6f) ? (-22.5f) : 22.5f); val8.rotation *= Quaternion.AngleAxis(num4 * Time.fixedDeltaTime, Vector3.right); val9.rotation *= Quaternion.AngleAxis(num4 * Time.fixedDeltaTime, Vector3.right); if (num > 8f || num <= 4f) { Transform val10 = Place.Captured("MD_walldrop"); val10.position += ((num > 6f) ? (-0.87f) : 0.87f) * Time.fixedDeltaTime * up; } } } private static void UpdateMotionOutside() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) float num = WUTIL.Timer("MD_sidewall_engaged"); if (!(num > 0f)) { return; } if ((Object)(object)Place.Captured("MD_outside_walldrop") == (Object)null) { WDBUG.Log("WARNING: MD_outside_walldrop key not availble"); WUTIL.TimerReset("MD_sidewall_engaged"); return; } if (num <= 8f || num >= 112f) { Transform val = Place.Captured("MD_outside_walldrop"); val.position += ((num <= 8f) ? 0.25f : (-0.25f)) * Time.fixedDeltaTime * up; } if (m_bodySectionActive != 2) { m_bodySectionActive = 2; BuildSpine(spiked: false); } } private static void CheckPopulation() { //IL_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) if (!c_checkPopulation || WUTIL.Timer("md_check_poulation") > 0f) { return; } WUTIL.TimerReset("md_check_poulation", 30f); Vector3 val = m_mountainDungeonBodyLevelExit; val.y -= 28f; Player closestPlayer = Player.GetClosestPlayer(val, 40f); if ((Object)(object)closestPlayer != (Object)null) { val = ((Component)closestPlayer).transform.position; } Dictionary dictionary = new Dictionary(); foreach (Character allCharacter in Character.GetAllCharacters()) { if (allCharacter.IsPlayer() || !WUTIL.WithinCylinder(((Component)allCharacter).transform.position, val, 40f, 36f)) { continue; } string hoverName = allCharacter.GetHoverName(); if (allCharacter.IsDead()) { WDBUG.Log($"Detected DEAD {hoverName} at {val.y - ((Component)allCharacter).transform.position.y} below {val}"); continue; } if (val.y - ((Component)allCharacter).transform.position.y > 36f) { WDBUG.Log($"Detected {hoverName} at {val.y - ((Component)allCharacter).transform.position.y} below {val}"); } if (dictionary.ContainsKey(hoverName)) { dictionary[hoverName]++; } else { dictionary.Add(hoverName, 1); } } string text = $"MD Critter Counts from {val}: " + dictionary.Count; foreach (KeyValuePair item in dictionary) { text = text + "\n" + item.Value + " " + item.Key; } WDBUG.Log(text); } private static bool SpikesUp() { //IL_0022: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (m_spinePieces.Count == 0) { return true; } Quaternion rotation = m_spinePieces[0].rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; int num = (int)(eulerAngles.z + 361f) / 90; return (num & 1) > 0; } private static bool AllCrystalTorchesLit() { foreach (Transform serpentTooth in m_serpentTeeth) { if ((Object)(object)serpentTooth == (Object)null) { WDBUG.Log($"Found a null tooth of {m_serpentTeeth.Count}"); return false; } if (!((Component)serpentTooth).GetComponent().IsBurning()) { return false; } } return true; } private static void SetEntryPoints(int nesw, bool debug = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_005a: 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) //IL_0069: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0244: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_017b: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_0211: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Place.MapFwd(nesw); Vector3 val2 = Place.MapFwd(nesw + 1); m_mountainDungeonBuildPosition = m_mountainDungeonBuildLocation - 2.7f * val - 2f * val2 + 2f * up; Vector3 val3 = m_mountainDungeonBuildPosition - 1.25f * val + 1.5f * val2; m_mountainDungeonSpinePos = val3 + 8f * val + 3f * up; m_mountainDungeonHeadLevelExit = val3 + 6f * val - val2 - (float)(2 * m_mountainDungeonNeckLevelOffset) * up; m_mountainDungeonBodyLevelExit = m_mountainDungeonHeadLevelExit - 0.01f * val + 5200f * up; m_mountainDungeonTrampolineHeight = m_mountainDungeonBodyLevelExit.y - 64f; m_mountainDungeonBodyLevelExit.y += 4 * m_mountainDungeonNeckLevelOffset; if (debug) { WDBUG.Log($"SetEntryPoints(nesw:{nesw})"); Place.Torch("piece_groundtorch", m_mountainDungeonHeadLevelExit + val); Place.Torch("piece_groundtorch_green", m_mountainDungeonHeadLevelExit); Place.Torch("piece_groundtorch_blue", m_mountainDungeonHeadLevelExit - 0.01f * val); Place.Torch("piece_groundtorch", m_mountainDungeonBodyLevelExit + val); Place.Torch("piece_groundtorch_green", m_mountainDungeonBodyLevelExit); Place.Torch("piece_groundtorch_blue", m_mountainDungeonBodyLevelExit - 0.01f * val); } m_mountainDungeonBehindGatePos = val3 + val; m_mountainDungeonGatePosition = 0.5f * (Place.Captured("MD_mouth_gate_1").position + Place.Captured("MD_mouth_gate_2").position); m_mountainDungeonCavern = m_mountainDungeonBuildPosition + 3f * val + 1.5f * val2; m_mountainDungeonCavern.y += 5184f; } private static int OrientHead(Vector3 position, bool tower = false, bool debug = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) Place.MapInitialize(position, Quaternion.identity); float num = (tower ? 15 : 10); float num2 = (tower ? 20 : 0); float num3 = 9999f; int num4 = 0; for (int i = 0; i < 4; i++) { Vector3 pos = position + num * Place.MapFwd(i); float num5 = Place.HeightAboveTerrain(pos, 40f); pos.y -= num5; num5 -= num2; if (Mathf.Abs(num5) < Mathf.Abs(num3)) { num3 = num5; num4 = i; } if (debug) { WDBUG.Log($"Jaw height NESW={i}: height: {num5 + num2} minDist: {num3} for NESW: {num4}"); } } num4 = (num4 + 2) & 3; if (debug) { WDBUG.Log($"Orienting to NESW: {num4} Jaw height: {num3}", WDBUG.Level.Dungeon); for (int j = 0; j < 4; j++) { Place.Object((j == num4) ? "piece_groundtorch_blue" : "TorchCrystal", position + 5f * Place.MapFwd(j)); } } return num4; } private static bool BuildHead() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Unknown result type (might be due to invalid IL or missing references) //IL_0700: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_072a: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_0745: Unknown result type (might be due to invalid IL or missing references) //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Unknown result type (might be due to invalid IL or missing references) //IL_07c6: Unknown result type (might be due to invalid IL or missing references) //IL_07c8: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07fc: Unknown result type (might be due to invalid IL or missing references) //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_0805: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_0826: Unknown result type (might be due to invalid IL or missing references) //IL_082d: Unknown result type (might be due to invalid IL or missing references) //IL_082f: Unknown result type (might be due to invalid IL or missing references) //IL_0834: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0843: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0869: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0884: Unknown result type (might be due to invalid IL or missing references) //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_08d6: Unknown result type (might be due to invalid IL or missing references) //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_08df: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_0911: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_091a: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0929: Unknown result type (might be due to invalid IL or missing references) //IL_092b: Unknown result type (might be due to invalid IL or missing references) //IL_0930: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_0964: Unknown result type (might be due to invalid IL or missing references) //IL_0966: Unknown result type (might be due to invalid IL or missing references) //IL_096b: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09c2: Unknown result type (might be due to invalid IL or missing references) //IL_09c9: Unknown result type (might be due to invalid IL or missing references) //IL_09cb: Unknown result type (might be due to invalid IL or missing references) //IL_09d0: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_09f1: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_09f8: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Unknown result type (might be due to invalid IL or missing references) //IL_0a09: Unknown result type (might be due to invalid IL or missing references) //IL_0a13: Unknown result type (might be due to invalid IL or missing references) //IL_0a18: Unknown result type (might be due to invalid IL or missing references) //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) //IL_0a22: Unknown result type (might be due to invalid IL or missing references) //IL_0a24: Unknown result type (might be due to invalid IL or missing references) //IL_0a2b: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Unknown result type (might be due to invalid IL or missing references) //IL_0a32: Unknown result type (might be due to invalid IL or missing references) //IL_0a3c: Unknown result type (might be due to invalid IL or missing references) //IL_0a3e: Unknown result type (might be due to invalid IL or missing references) //IL_0a43: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a52: Unknown result type (might be due to invalid IL or missing references) //IL_0a57: Unknown result type (might be due to invalid IL or missing references) //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0a7e: Unknown result type (might be due to invalid IL or missing references) //IL_0a80: Unknown result type (might be due to invalid IL or missing references) //IL_0a82: Unknown result type (might be due to invalid IL or missing references) //IL_0aa0: Unknown result type (might be due to invalid IL or missing references) //IL_0abb: Unknown result type (might be due to invalid IL or missing references) //IL_0abd: Unknown result type (might be due to invalid IL or missing references) //IL_0abf: Unknown result type (might be due to invalid IL or missing references) //IL_0ad8: Unknown result type (might be due to invalid IL or missing references) //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Unknown result type (might be due to invalid IL or missing references) //IL_0aee: Unknown result type (might be due to invalid IL or missing references) //IL_0af0: Unknown result type (might be due to invalid IL or missing references) //IL_0af5: Unknown result type (might be due to invalid IL or missing references) //IL_0aff: Unknown result type (might be due to invalid IL or missing references) //IL_0b01: Unknown result type (might be due to invalid IL or missing references) //IL_0b06: Unknown result type (might be due to invalid IL or missing references) //IL_0b0b: Unknown result type (might be due to invalid IL or missing references) //IL_0b10: Unknown result type (might be due to invalid IL or missing references) //IL_0b12: Unknown result type (might be due to invalid IL or missing references) //IL_0b19: Unknown result type (might be due to invalid IL or missing references) //IL_0b1e: Unknown result type (might be due to invalid IL or missing references) //IL_0b28: Unknown result type (might be due to invalid IL or missing references) //IL_0b2a: Unknown result type (might be due to invalid IL or missing references) //IL_0b2f: Unknown result type (might be due to invalid IL or missing references) //IL_0b39: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0b45: Unknown result type (might be due to invalid IL or missing references) //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0b51: Unknown result type (might be due to invalid IL or missing references) //IL_0b6a: Unknown result type (might be due to invalid IL or missing references) //IL_0b85: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0b8e: Unknown result type (might be due to invalid IL or missing references) //IL_0b93: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba2: Unknown result type (might be due to invalid IL or missing references) //IL_0ba7: Unknown result type (might be due to invalid IL or missing references) //IL_0bc5: Unknown result type (might be due to invalid IL or missing references) //IL_0bcc: Unknown result type (might be due to invalid IL or missing references) //IL_0bce: Unknown result type (might be due to invalid IL or missing references) //IL_0bd3: Unknown result type (might be due to invalid IL or missing references) //IL_0bdd: Unknown result type (might be due to invalid IL or missing references) //IL_0be2: Unknown result type (might be due to invalid IL or missing references) //IL_0be7: Unknown result type (might be due to invalid IL or missing references) //IL_0c0e: Unknown result type (might be due to invalid IL or missing references) //IL_0c15: Unknown result type (might be due to invalid IL or missing references) //IL_0c17: Unknown result type (might be due to invalid IL or missing references) //IL_0c1c: Unknown result type (might be due to invalid IL or missing references) //IL_0c21: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) //IL_0c2a: Unknown result type (might be due to invalid IL or missing references) //IL_0c2c: Unknown result type (might be due to invalid IL or missing references) //IL_0c31: Unknown result type (might be due to invalid IL or missing references) //IL_0c36: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_061e: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0c41: Unknown result type (might be due to invalid IL or missing references) //IL_0c4a: Unknown result type (might be due to invalid IL or missing references) //IL_0c4c: Unknown result type (might be due to invalid IL or missing references) //IL_0c56: Unknown result type (might be due to invalid IL or missing references) //IL_0c58: Unknown result type (might be due to invalid IL or missing references) //IL_0c5d: Unknown result type (might be due to invalid IL or missing references) //IL_0c62: Unknown result type (might be due to invalid IL or missing references) //IL_0c67: Unknown result type (might be due to invalid IL or missing references) //IL_0c6c: Unknown result type (might be due to invalid IL or missing references) //IL_0c71: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c78: Unknown result type (might be due to invalid IL or missing references) //IL_0c81: Unknown result type (might be due to invalid IL or missing references) //IL_0c83: Unknown result type (might be due to invalid IL or missing references) //IL_0c8d: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Unknown result type (might be due to invalid IL or missing references) //IL_0c94: Unknown result type (might be due to invalid IL or missing references) //IL_0c99: Unknown result type (might be due to invalid IL or missing references) //IL_0c9e: Unknown result type (might be due to invalid IL or missing references) //IL_0ca3: Unknown result type (might be due to invalid IL or missing references) //IL_0ca8: Unknown result type (might be due to invalid IL or missing references) //IL_0cad: Unknown result type (might be due to invalid IL or missing references) //IL_0cb4: Unknown result type (might be due to invalid IL or missing references) //IL_0cda: Unknown result type (might be due to invalid IL or missing references) //IL_0d15: Unknown result type (might be due to invalid IL or missing references) //IL_0d1f: Unknown result type (might be due to invalid IL or missing references) //IL_0d21: Unknown result type (might be due to invalid IL or missing references) //IL_0d26: Unknown result type (might be due to invalid IL or missing references) //IL_0d30: Unknown result type (might be due to invalid IL or missing references) //IL_0d32: Unknown result type (might be due to invalid IL or missing references) //IL_0d37: Unknown result type (might be due to invalid IL or missing references) //IL_0d50: Unknown result type (might be due to invalid IL or missing references) //IL_0d5a: Unknown result type (might be due to invalid IL or missing references) //IL_0d5c: Unknown result type (might be due to invalid IL or missing references) //IL_0d61: Unknown result type (might be due to invalid IL or missing references) //IL_0d6b: Unknown result type (might be due to invalid IL or missing references) //IL_0d6d: Unknown result type (might be due to invalid IL or missing references) //IL_0d72: Unknown result type (might be due to invalid IL or missing references) //IL_0d8a: Unknown result type (might be due to invalid IL or missing references) //IL_0d8f: Unknown result type (might be due to invalid IL or missing references) //IL_0d91: Unknown result type (might be due to invalid IL or missing references) //IL_0d9b: Unknown result type (might be due to invalid IL or missing references) //IL_0d9d: Unknown result type (might be due to invalid IL or missing references) //IL_0da2: Unknown result type (might be due to invalid IL or missing references) //IL_0dc0: Unknown result type (might be due to invalid IL or missing references) //IL_0dc5: Unknown result type (might be due to invalid IL or missing references) //IL_0dc7: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Unknown result type (might be due to invalid IL or missing references) //IL_0dd3: Unknown result type (might be due to invalid IL or missing references) //IL_0dd8: Unknown result type (might be due to invalid IL or missing references) //IL_0de2: Unknown result type (might be due to invalid IL or missing references) //IL_0de7: Unknown result type (might be due to invalid IL or missing references) //IL_0dec: Unknown result type (might be due to invalid IL or missing references) //IL_0e13: Unknown result type (might be due to invalid IL or missing references) //IL_0e1a: Unknown result type (might be due to invalid IL or missing references) //IL_0e1c: Unknown result type (might be due to invalid IL or missing references) //IL_0e21: Unknown result type (might be due to invalid IL or missing references) //IL_0e2b: Unknown result type (might be due to invalid IL or missing references) //IL_0e2d: Unknown result type (might be due to invalid IL or missing references) //IL_0e32: Unknown result type (might be due to invalid IL or missing references) //IL_0e48: Unknown result type (might be due to invalid IL or missing references) //IL_0e4f: Unknown result type (might be due to invalid IL or missing references) //IL_0e51: Unknown result type (might be due to invalid IL or missing references) //IL_0e56: Unknown result type (might be due to invalid IL or missing references) //IL_0e60: Unknown result type (might be due to invalid IL or missing references) //IL_0e62: Unknown result type (might be due to invalid IL or missing references) //IL_0e67: Unknown result type (might be due to invalid IL or missing references) //IL_0e7d: Unknown result type (might be due to invalid IL or missing references) //IL_0e84: Unknown result type (might be due to invalid IL or missing references) //IL_0e86: Unknown result type (might be due to invalid IL or missing references) //IL_0e8b: Unknown result type (might be due to invalid IL or missing references) //IL_0ea1: Unknown result type (might be due to invalid IL or missing references) //IL_0ea8: Unknown result type (might be due to invalid IL or missing references) //IL_0eaa: Unknown result type (might be due to invalid IL or missing references) //IL_0eaf: Unknown result type (might be due to invalid IL or missing references) //IL_0eb9: Unknown result type (might be due to invalid IL or missing references) //IL_0ebb: Unknown result type (might be due to invalid IL or missing references) //IL_0ec0: Unknown result type (might be due to invalid IL or missing references) //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) //IL_0eed: Unknown result type (might be due to invalid IL or missing references) //IL_0eef: Unknown result type (might be due to invalid IL or missing references) //IL_0ef4: Unknown result type (might be due to invalid IL or missing references) //IL_0f0e: Unknown result type (might be due to invalid IL or missing references) //IL_0f15: Unknown result type (might be due to invalid IL or missing references) //IL_0f17: Unknown result type (might be due to invalid IL or missing references) //IL_0f1c: Unknown result type (might be due to invalid IL or missing references) //IL_0f46: Unknown result type (might be due to invalid IL or missing references) //IL_0f4d: Unknown result type (might be due to invalid IL or missing references) //IL_0f4f: Unknown result type (might be due to invalid IL or missing references) //IL_0f54: Unknown result type (might be due to invalid IL or missing references) //IL_0f59: Unknown result type (might be due to invalid IL or missing references) //IL_0f5b: Unknown result type (might be due to invalid IL or missing references) //IL_0f62: Unknown result type (might be due to invalid IL or missing references) //IL_0f64: Unknown result type (might be due to invalid IL or missing references) //IL_0f69: Unknown result type (might be due to invalid IL or missing references) //IL_0f80: Unknown result type (might be due to invalid IL or missing references) //IL_0fa4: Unknown result type (might be due to invalid IL or missing references) //IL_0fab: Unknown result type (might be due to invalid IL or missing references) //IL_0fad: Unknown result type (might be due to invalid IL or missing references) //IL_0fb2: Unknown result type (might be due to invalid IL or missing references) //IL_0fbc: Unknown result type (might be due to invalid IL or missing references) //IL_0fbe: Unknown result type (might be due to invalid IL or missing references) //IL_0fc3: Unknown result type (might be due to invalid IL or missing references) //IL_0fda: Unknown result type (might be due to invalid IL or missing references) //IL_0fe1: Unknown result type (might be due to invalid IL or missing references) //IL_0fe3: Unknown result type (might be due to invalid IL or missing references) //IL_0fe8: Unknown result type (might be due to invalid IL or missing references) //IL_100f: Unknown result type (might be due to invalid IL or missing references) //IL_1016: Unknown result type (might be due to invalid IL or missing references) //IL_1018: Unknown result type (might be due to invalid IL or missing references) //IL_101d: Unknown result type (might be due to invalid IL or missing references) //IL_1034: Unknown result type (might be due to invalid IL or missing references) //IL_103b: Unknown result type (might be due to invalid IL or missing references) //IL_103d: Unknown result type (might be due to invalid IL or missing references) //IL_1042: Unknown result type (might be due to invalid IL or missing references) //IL_1047: Unknown result type (might be due to invalid IL or missing references) //IL_1049: Unknown result type (might be due to invalid IL or missing references) //IL_105f: Unknown result type (might be due to invalid IL or missing references) //IL_1066: Unknown result type (might be due to invalid IL or missing references) //IL_1068: Unknown result type (might be due to invalid IL or missing references) //IL_106d: Unknown result type (might be due to invalid IL or missing references) //IL_1072: Unknown result type (might be due to invalid IL or missing references) //IL_1074: Unknown result type (might be due to invalid IL or missing references) //IL_1090: Unknown result type (might be due to invalid IL or missing references) //IL_1095: Unknown result type (might be due to invalid IL or missing references) //IL_109c: Unknown result type (might be due to invalid IL or missing references) //IL_109e: Unknown result type (might be due to invalid IL or missing references) //IL_10a8: Unknown result type (might be due to invalid IL or missing references) //IL_10aa: Unknown result type (might be due to invalid IL or missing references) //IL_10af: Unknown result type (might be due to invalid IL or missing references) //IL_10b4: Unknown result type (might be due to invalid IL or missing references) //IL_10c6: Unknown result type (might be due to invalid IL or missing references) //IL_10c8: Unknown result type (might be due to invalid IL or missing references) //IL_10ca: Unknown result type (might be due to invalid IL or missing references) //IL_10da: Unknown result type (might be due to invalid IL or missing references) //IL_1100: Unknown result type (might be due to invalid IL or missing references) //IL_1105: Unknown result type (might be due to invalid IL or missing references) //IL_1107: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) m_serpentTeeth.Clear(); m_spinePieces.Clear(); float y = m_mountainDungeonPinLocation.y; float num = y + 7.9f; int num2 = 0; Collider[] array = Physics.OverlapSphere(m_mountainDungeonPinLocation, 16f, WUTIL.c_dungeonPiecesScanRayMask); foreach (Collider val in array) { Transform val2 = ((Component)val).gameObject.transform; while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; } string text = WUTIL.GameName(((Component)val2).gameObject); if (text == "TorchCrystalSmall") { m_serpentTeeth.Add(val2); } else if (text == "stone_arch" && val2.position.y > y) { m_spinePieces.Add(val2); } else if (text == "stone_floor_2x2" && val2.position.y > num && val2.eulerAngles.z > 89f) { m_spinePieces.Add(val2); } else if (text.StartsWith("stone_")) { num2++; } else if (text.StartsWith("Pickable_") && InSnakeHeadRegion(val2.position)) { Place.AddDungeonPickables(val2); } } WDBUG.Log($"Snake Head teeth: {m_serpentTeeth.Count} spine: {m_spinePieces.Count} stone: {num2}", WDBUG.Level.Dungeon); if (m_serpentTeeth.Count != 6 || m_buildRefreshMode < 0) { if (!ZNet.instance.IsServer() && (((Component)Player.m_localPlayer).transform.position.y >= 5200f || m_spinePieces.Count > 20)) { if (WUTIL.Timer("MountainDungeon_build") == 0f) { WDBUG.Log("Defer restore 1s while in Body or no torches", WDBUG.Level.Multiplayer); WUTIL.TimerReset("MountainDungeon_build", 1f); } return false; } if (num2 == 0 && m_clearanceWaits > 0) { WDBUG.Log($"Waiting {0.1f * (float)m_clearanceWaits}s for stones to show up at Mountain Dungeon", WDBUG.Level.Dungeon); WUTIL.TimerReset("MountainDungeon_build", 0.1f); m_clearanceWaits--; return false; } if (m_serpentTeeth.Count == 0 || m_buildRefreshMode < 0) { WDBUG.Log("Clearing Serpent Head site", WDBUG.Level.Dungeon); } else { WDBUG.Log("Rebuilding vs. bad Serpent Head site"); } Vector3 center = m_mountainDungeonPinLocation - 8f * up; Place.DestroyDungeon(center, 20f, null, 0f, 9999f, drops: false, proxies: true); m_buildRefreshMode = 0; m_serpentTeeth.Clear(); } if (m_serpentTeeth.Count > 0) { int num3 = 0; foreach (Transform serpentTooth in m_serpentTeeth) { if ((Object)(object)serpentTooth == (Object)null) { num3++; } } if (num3 <= 0) { WDBUG.Log($"Restoring Serpent Head Open: {m_gateOpenned} Spiked: {SpikesUp()}", WDBUG.Level.Dungeon); Place.MapInitialize(m_mountainDungeonPinLocation, m_serpentTeeth[0].rotation, "TorchCrystalWall"); m_mountainDungeonBuildLocation = m_mountainDungeonPinLocation; if (!m_useSecondarySite) { Vector3 val3 = 0.5f * Place.MapFwd(1) - 0.8f * Place.MapFwd(0); m_mountainDungeonBuildLocation += val3; WDBUG.Log($"Snake well offset: {val3}", WDBUG.Level.Dungeon); } Place.RestoreDungeon(m_mountainDungeonBuildLocation - 8f * up, 16f, solidify: true); SetEntryPoints(m_mountainDungeonNESW = 0); m_gateOpenned = AllCrystalTorchesLit(); return true; } WDBUG.Log($"Found {num3} lost teeth of {m_serpentTeeth.Count} => destroy/rebuild"); m_serpentTeeth.Clear(); } m_gateOpenned = false; int nesw = OrientHead(m_mountainDungeonPinLocation, m_useSecondarySite); Place.MapInitialize(m_mountainDungeonPinLocation, Place.MapRot(nesw), "TorchCrystalWall"); nesw = (m_mountainDungeonNESW = 0); Vector3 val4 = Place.MapFwd(nesw); Vector3 val5 = Place.MapFwd(nesw + 1); m_mountainDungeonBuildLocation = m_mountainDungeonPinLocation; if (!m_useSecondarySite) { Vector3 val6 = 0.5f * val5 - 0.8f * val4; m_mountainDungeonBuildLocation += val6; WDBUG.Log($"Snake well offset: {val6}", WDBUG.Level.Dungeon); } if (m_useSecondarySite) { BuildKeep(m_mountainDungeonBuildLocation + 0.7f * val4 - 0.5f * val5, nesw); } m_mountainDungeonBuildPosition = m_mountainDungeonBuildLocation - 2.7f * val4 - 2f * val5 + 2f * up; Vector3 val7 = m_mountainDungeonBuildPosition - 0.25f * val4 + 1.5f * val5; Place.Floor(val7, nesw); Place.Piece("stone_wall_1x1", val7 - 0.5f * val4 + 4f * up, nesw + 1); Place.Stairs(val7 + val4 + 4.5f * up, nesw + 2, 2f, 1, floor: false, ceiling: true); val7 -= val4; Place.RoomDoor(-11, val7 + 2f * up, nesw, Vector3.zero); Place.CaptureCaptured("MD_mouth_gate_1", "room_door"); Place.CaptureCaptured("MD_mouth_gate_2", "room_door2"); SetEntryPoints(nesw); Place.Piece("stone_wall_2x1", m_mountainDungeonSpinePos - up, nesw + 1); m_spinePieces.Clear(); BuildSpine(m_bodySectionActive != 2); Place.Floor(val7 - 2f * val5, nesw, -1f, 3); Place.Stairs(val7, nesw + 2, 2.5f, 1, floor: false, ceiling: true, -1.5f); Place.Stairs(val7 - 2f * val4, nesw + 2, 2.25f, 1, floor: false, ceiling: true, -0.5f); Place.Stairs(val7 - 2f * val4 - 0.625f * up, nesw, 2.25f, 1, floor: true, ceiling: true); Place.Stairs(val7 - 4f * val4 - 1.625f * up, nesw, 2f, 1, floor: true, ceiling: true); Place.Stairs(val7 - 6f * val4, nesw, 1.7f, 1, floor: true, ceiling: false, 2.625f); val7.y += 4.5f; Place.Stairs(val7 + 1.5f * val4 - 1.25f * val5, nesw + 1, 1f, 1, floor: false, ceiling: true); Place.Stairs(val7 + 1.5f * val4 + 1.25f * val5, nesw + 3, 1f, 1, floor: false, ceiling: true); Place.Stairs(val7 - 3f * val4 - 2f * val5, nesw + 1, 4f, 1, floor: false, ceiling: true); Place.Stairs(val7 - 3f * val4 + 2f * val5, nesw + 3, 4f, 1, floor: false, ceiling: true); Place.Stairs(val7 - 6f * val4, nesw, 2.75f, 1, floor: false, ceiling: true); Vector3 val8 = val7 - 3.375f * val4 - 2.9f * val5 - 0.125f * up; Vector3 val9 = val7 - 3.375f * val4 + 2.9f * val5 - 0.125f * up; Place.Piece("crystal_wall_1x1", val8, nesw + 1); Place.Piece("crystal_wall_1x1", val8 - val4, nesw + 1); Place.Piece("crystal_wall_1x1", val9, nesw - 1); Place.Piece("crystal_wall_1x1", val9 - val4, nesw - 1); val8 += 0.25f * up - 0.625f * val4 + 0.55f * val5; val9 += 0.25f * up - 0.625f * val4 - 0.55f * val5; Place.Piece("GuckSack_small", val8, nesw); Place.Piece("GuckSack_small", val9, nesw + 2); Place.Piece("Piece_Fang", val8 - 2.35f * val4 - 2.5f * up, nesw + 2); Place.Piece("Piece_Fang", val9 - 2.35f * val4 - 2.5f * up, nesw + 2); float num4 = 0.625f; float heightOffset = -4.15f; val8 += 3.15f * val4; val9 += 3.15f * val4; for (int j = 0; j < 3; j++) { val8 -= num4 * (2f * val4 - 0.35f * val5 + up); val9 -= num4 * (2f * val4 + 0.35f * val5 + up); Place.Torch("TorchCrystalSmall", val8, heightOffset); m_serpentTeeth.Add(Place.LastPlaced()); Place.Torch("TorchCrystalSmall", val9, heightOffset); m_serpentTeeth.Add(Place.LastPlaced()); } Place.ItemStand(514, m_mountainDungeonBehindGatePos + 3f * val4 - 1.25f * val5, nesw, 0.4f, "NONE"); Place.ItemStand(14, m_mountainDungeonBehindGatePos + 3f * val4 - 1.25f * val5, nesw, 0.9f, "ALL_PlaceRiddleItem"); Place.ItemStand(1, m_mountainDungeonBehindGatePos + val4 + 0.5f * val5, nesw + 1, 2f, "Torch"); Place.Piece("RiddleStone", m_mountainDungeonBehindGatePos + val4 - 1.9f * val5 + 3f * up, nesw); val7.y += 0.5f; Place.Floor(val7 - 2f * val4 - 2f * val5, nesw, 1f, 3); Place.Floor(val7 - 2f * val4 - 2f * val5, nesw, 0f, 1, 2); Place.Floor(val7 - 4f * val4, nesw, -0.125f, 1, 3); Place.Floor(val7 - 2f * val4 + 2f * val5, nesw, 0f, 1, 2); val7.y -= 0.5f; Place.Stairs(val7 - 5.75f * val4, nesw, 2.75f); Place.Stairs(val7 - 4f * val4, nesw, 3f, 1, floor: true, ceiling: false, -0.75f); val7.y -= 5f; val7 -= 2.5f * val5; Place.Wall(val7 + 5f * val5, nesw + 1, 1, 2); Place.Wall(val7, nesw - 1, 1, 2); val7.y += 1f; Place.Wall(val7 + 2f * val4 + 5f * val5, nesw + 1, 1, 2); Place.Wall(val7 + 2f * val4, nesw - 1, 1, 2); val7.y += 1f; Place.Wall(val7 + 4f * val4, nesw - 1, 1, 1); Place.Floor(val7 + 6f * val4 + val5, nesw, 0.5f, 1); Place.Stairs(val7 + 4f * val4 + val5, nesw + 2, 1f, 1, floor: false, ceiling: true, 2f); Vector3 mountainDungeonBuildPosition = m_mountainDungeonBuildPosition; Vector3 val10 = 1.75f * val4 + 0.5f * val5; mountainDungeonBuildPosition.y -= 16f; Place.Staircase(mountainDungeonBuildPosition + val10, nesw, 8, 2, 2, 6, down: false, -1, 1, 6, 3); if (Place.CaptureCaptured("MD_outside_walldrop", "stairs_sidewall")) { val7 = Place.Captured("MD_outside_walldrop").position; Place.Wall(val7, nesw + 1, 1, 1, -3f); } m_lateHeadPlacements = true; return true; } private static void BuildSpine(bool spiked, bool lit = false) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0355: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: 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: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) Vector3 val = m_mountainDungeonSpinePos; float num = val.y - 6f; bool flag = true; Transform[] array = m_spinePieces.ToArray(); foreach (Transform val2 in array) { if ((Object)(object)val2 != (Object)null && val2.position.y > num) { WUTIL.Destroy(((Component)val2).gameObject); flag = false; } } m_spinePieces.Clear(); int num2 = (spiked ? 6 : 5); int mountainDungeonNESW = m_mountainDungeonNESW; Vector3 val3 = Place.MapFwd(mountainDungeonNESW); Vector3 val4 = Place.MapFwd(mountainDungeonNESW + 1); int num3 = 0; while (num3 < 6) { if (num3 < 5) { if (flag) { Place.Stairs(val - 1.5f * up, mountainDungeonNESW + 2, 3f); } } else { val -= 0.9f * val3 + 0.55f * up; } if (num3 >= 3) { if (num3 < num2) { Place.Wall(val, mountainDungeonNESW + 1, 1, 1, -2.5f); if (num3 == 5) { m_spinePieces.Add(Place.LastPlaced()); } } if (lit && flag) { Place.Torch("piece_groundtorch_green", val - 2f * up); } } if (spiked) { Place.Piece("stone_arch", val + 1.5f * val3 - 0.5f * up, mountainDungeonNESW - 1, 90f, altTilt: true); m_spinePieces.Add(Place.LastPlaced()); Place.Piece("stone_arch", val, mountainDungeonNESW - 1, 180f); m_spinePieces.Add(Place.LastPlaced()); } else if (num3 < 5) { Place.Piece("stone_arch", val, mountainDungeonNESW + 1, 180f); m_spinePieces.Add(Place.LastPlaced()); } else { Place.Piece("stone_arch", val + val3 - 0.5f * up, mountainDungeonNESW + 3, 180f); m_spinePieces.Add(Place.LastPlaced()); } num3++; val -= 2f * val3 - up; } if (spiked) { val.y -= 2.5f; Place.Piece("stone_arch", val + 0.5f * val3, mountainDungeonNESW + 3, 270f, altTilt: true); m_spinePieces.Add(Place.LastPlaced()); val.y -= 3.25f; val += 5.5f * val3; if (flag) { Place.Piece("stone_stair", val + 3f * val4, mountainDungeonNESW + 2, 90f, altTilt: true); Place.Piece("stone_stair", val - 3f * val4, mountainDungeonNESW + 2, 270f, altTilt: true); } } } private static void BuildKeep(Vector3 position, int nesw, int levels = 4, float baseOffset = -15f) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) int num = 18 * (nesw & 3) / 4; position.y += baseOffset; int num2 = 0; while (num2 < levels) { Place.OnPerimeter("stone_wall_4x2", position, 18, 5.3f, 0f, 0, 0f, 90f, altTilt: true); Place.OnPerimeter("iron_floor_2x2", position, 18, 5.9f, -2f, num, 0f, 0f, altTilt: false, 1f, 2f / 9f, 6.264f); num2++; position.y += 4f; } if (num == 4 || num == 13) { num++; } WDBUG.Log($"Placing top step vs. segOffset: {num}"); Place.OnPerimeter("iron_floor_2x2", position, 1, 5.9f, -2.1f); Vector3 val = Place.MapFwd(nesw); Vector3 val2 = Place.MapFwd(nesw + 1); position += 3.6f * val2 + 2.8f * val - up; int num3 = 0; while (num3 < 6) { Place.Piece("iron_floor_1x1", position, nesw + 1); Place.Piece("iron_floor_1x1", position - ((num3 == 3) ? 6.72f : 7.2f) * val2, nesw + 3); position -= val; num3++; position.y += 1f; } } private static bool CheckBodyBuilt(bool build = false) { //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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) Vector3 mountainDungeonBuildPosition = m_mountainDungeonBuildPosition; mountainDungeonBuildPosition.y += 5182f; if (Place.GetPinDataAt(mountainDungeonBuildPosition) != "") { return true; } if (build) { Place.Torch("GuckBurner", mountainDungeonBuildPosition); } return false; } private static IEnumerable BuildBodyPart() { WUTIL.ResetRandomSeed(m_mountainDungeonPinLocation); int nesw = m_mountainDungeonNESW; Vector3 fwd = Place.MapFwd(nesw); Vector3 rht = Place.MapFwd(nesw + 1); Vector3 placePos = m_mountainDungeonBuildPosition; placePos.y += 5184f; if (CheckBodyBuilt(build: true)) { WDBUG.Log("Rebuilding over existing Snake Body"); } Vector3 staircaseOffset = 1.75f * fwd + 0.5f * rht; Place.m_roomDecorFakeItemChance = 0.1f; Place.m_roomDecorItemStandChance = 0.7f; Place.m_roomDecorLevel = 3; Place.m_nextDoorHeadstone = 9; Place.Staircase(placePos + staircaseOffset, nesw, 14, 2, 2, 12, down: false, 1, -1, 7, 10, 3); Transform wall = Place.Captured("stairs_backwall"); if ((Object)(object)wall != (Object)null) { Place.CaptureAs("MD_snake_wallspin", wall); Place.Torch("TorchCrystalWall", wall.position + 0.55f * fwd + 0.5f * up, 0f, nesw + 3); Place.CaptureLastPlacedAs("MD_switch_snake_wallspin_1"); Place.Torch("TorchCrystalWall", wall.position - 0.55f * fwd + 0.5f * up, 0f, nesw + 1); Place.CaptureLastPlacedAs("MD_switch_snake_wallspin_2"); } float hoff = 16.5f; Place.OnPerimeter("RockFinger", m_mountainDungeonCavern, 26, 36.75f, hoff, 0, 180f, 21f); hoff += 16.5f; float scale = 1.3f; Place.OnPerimeter("stone_arch", m_mountainDungeonCavern, 26, scale * 3.15f, hoff, 0, 90f, 22.5f, altTilt: true, scale); Place.OnPerimeter("stone_arch", m_mountainDungeonCavern, 13, 1.5f, hoff + 0.75f, 0, 270f, -22.5f, altTilt: true); Vector3 cavernExit = placePos + staircaseOffset + 4.5f * rht - 2f * fwd; cavernExit.y += 4f; Vector3 iceLevel = (Place.m_floorPlanAnchor = Place.Staircase(cavernExit, nesw, 1, 4, 0, 24)) + (4f * rht - 3.5f * fwd + 0.5f * up); Place.Stairs(iceLevel, nesw + 2, 1f, 1, floor: true, ceiling: true); Place.Stairs(iceLevel - 2f * fwd + up, nesw + 2, 1f, 1, floor: true, ceiling: true); iceLevel += 2f * up - 4f * fwd; Place.Floor(iceLevel - 0.5f * up, nesw, 0f, 1); Place.Stairs(iceLevel + 2f * rht, nesw + 1, 1f, 1, floor: true, ceiling: true); Place.Stairs(iceLevel + 4f * rht + up, nesw + 1, 1f, 1, floor: true, ceiling: true); Place.Floor(iceLevel + 6f * rht + 1.5f * up, nesw, 0f, 1); WUTIL.ResetRandomSeed(); yield return "1.Neck+Ribcage:Staircase+DaisyDome"; int dseed = ((c_iceCavernSeed > 0) ? c_iceCavernSeed : WUTIL.DieRoll(1000)); WDBUG.Log($"Setting ice floor plan seed: {dseed}", WDBUG.Level.Dungeon); WUTIL.ResetRandomSeed(dseed); Place.m_floorPlanAnchor += rht - 7f * fwd; Place.m_floorPlanSpaceItems = "SerpentTunnels"; Place.m_levelRoomItems = "Room2"; Place.m_icefloorRndNesw = (nesw + 2) & 3; Place.FloorPlanFromPlan(m_mountainDungeonIceFloorPlan); Place.FloorPlanLevel(7f, 4f, 4f, 0, 0, 0.2f, "", 4); Place.m_mapMaxWallHeight = Place.m_floorPlanAnchor.y + 3.5f; Place.GateCorridor(Place.m_floorPlanAnchor - 2f * fwd - 8f * rht, nesw, 0, 0f, 26); Place.CaptureCapturedGate("snakewooddoor", "pickable", "room_door"); Place.Piece("cauldron_ext3_butchertable", Place.m_floorPlanAnchor + 2f * fwd - 7.3f * rht + 0.35f * up, nesw, 0f, altTilt: false, 75f); Place.Piece("StatueEvil", Place.m_floorPlanAnchor + 4f * fwd - 8f * rht + 0.2f * up, nesw, 0f, altTilt: false, 45f); Place.StairTower(Place.m_floorPlanAnchor + 27.5f * fwd + 8f * rht, nesw + 1, 4, 1575173, 0, exitFloor: true, 3); Place.CaptureCapturedGate("snakehead1", "oneway", "room_door"); Place.StairTower(Place.m_floorPlanAnchor - 23.5f * fwd - 12f * rht, nesw + 3, 4, 2885893, 0, exitFloor: true, 3); Place.CaptureCapturedGate("snakehead2", "stuck", "room_door"); Place.Spawner("IcewormLarge", Place.m_floorPlanAnchor + 8f * fwd + 8f * rht, 12f); Place.m_floorPlanAnchor += 24f * fwd + 13f * up; Place.Piece("IceNest", Place.m_floorPlanAnchor - up, nesw); Place.Spawner("Hatchling", Place.m_floorPlanAnchor); Place.m_floorPlanAnchor.y -= 4f; Place.Piece("ice_floor_tall", Place.m_floorPlanAnchor, nesw); Place.m_floorPlanAnchor += 16f * rht - 40f * fwd; Place.Piece("ice_floor_tall", Place.m_floorPlanAnchor, nesw + 2); Place.Piece("IceNest", Place.m_floorPlanAnchor - 2f * fwd - 5f * rht + 3f * up, nesw + 1); Place.Piece("IceNest", Place.m_floorPlanAnchor + fwd + 4f * up, nesw + 3); Place.Spawner("Hatchling", Place.m_floorPlanAnchor, 7f); Place.Spawner("Ice_Dragon", Place.m_floorPlanAnchor + 8f * fwd - 8f * rht, 8f); WUTIL.ResetRandomSeed(); yield return "2.Chest:IceCavernMaze"; WUTIL.ResetRandomSeed(m_mountainDungeonPinLocation); placePos += 0.5f * rht; placePos.y += 4f; Place.Floor(placePos, 0, 0f, 0, 1, ceiling: true); Place.Floor(placePos + 4f * rht, 0, 0f, 0, 1, ceiling: true); Place.Floor(placePos - 4f * fwd, 0, 0f, 0, 1, ceiling: true); Place.Floor(placePos - 4f * fwd + 4f * rht, 0, 0f, 0, 1, ceiling: true); placePos.y -= 3f; Place.Wall(placePos + 2.75f * fwd + 2f * rht, nesw + 1, 1, 2, -1.5f); Place.Wall(placePos + 2f * fwd + 4f * rht, nesw); Place.Wall(placePos - 6f * fwd, nesw + 2); Place.Wall(placePos - 6f * fwd + 4f * rht, nesw + 2); placePos.y -= 1f; Place.Floor(placePos, 0, 0.02f); Place.Floor(placePos + 4f * rht, 0, 0.02f); Place.Floor(placePos - 4f * fwd, 0, 0.02f); Place.Floor(placePos - 4f * fwd + 4f * rht, 0, 0.02f); float radius = 3.247f; float stoner = 3.631f; Vector3 center = placePos - 2f * fwd + rht + 3f * up; float fwdTheta = 180f; int i = 0; while (i < 18) { float spin = i * 20; bool pillar = (i & 1) == 0; Vector3 dir = Quaternion.Euler(0f, spin, 0f) * fwd; Vector3 pos = center + radius * dir; spin += fwdTheta; if (pillar) { Place.Piece("stone_wall_1x1", center + stoner * dir, nesw, 0f, altTilt: false, spin + 220f); pos.y -= 1.7f; Place.Piece("Piece_Fang", pos, nesw + 2, 0f, altTilt: false, spin); } else { Place.Headstone(pos, (i >> 1) + 20 + 1, 0, 0f, spin); } int num = i + 1; i = num; } center.y += 0.4f; Place.Piece("ice_flower", center, Quaternion.Euler(180f, 0f, 0f)); center.y -= 0.45f; Place.Piece("ice_flower", center, Quaternion.Euler(-10f, 120f, 0f)); Place.Torch("TorchCrystal", center, -0.05f); Place.LastPlaced().localScale = 0.05f * Vector3.one; Place.CustomizeScale(Place.LastPlaced()); Vector3 cachePosition = placePos + 3f * fwd + 4.5f * rht; Place.Floor(cachePosition, nesw, 0.02f, 4, 3); cachePosition.y += 0.5f; cachePosition += 0.5f * fwd + 4f * rht; Place.Pickable("Pickable_ForestCryptRemains02", cachePosition + 1.8f * fwd - 2.5f * rht + up, nesw, "FairyTalePages2;DoxieDust:3"); Place.RoomDecor(cachePosition + 1.3f * fwd, nesw + 2, 2.1f, 4f, 0.2f); Place.Spawner("Rat", cachePosition); cachePosition += 4f * fwd + 2f * rht; Place.Wall(cachePosition, nesw + 2, 4, 2); Place.Floor(cachePosition - fwd, nesw + 2, 3.5f, 1); cachePosition += rht - fwd; Place.Wall(cachePosition, nesw + 1, 3, 2); cachePosition -= 7.95f * rht; Place.Wall(cachePosition, nesw + 1, 3, 2); Place.Floor(cachePosition + 1.45f * rht, nesw + 1, 3.5f, 3); placePos.y -= 6f; Vector3 exitPos1 = placePos - 4f * rht; Place.StairTower(exitPos1, nesw + 2, 4, 884741, 0, exitFloor: true, 7); Place.CaptureCapturedGate("beetrap", "pickable", "room_door"); exitPos1.y += 1.5f; int c = 0; while (c < 5) { float sideWallDrop = -0.5f; exitPos1 += 4f * fwd; Place.Floor(exitPos1 - 4f * rht, 0, -1.5f, 0, 1, ceiling: true); Place.Floor(exitPos1 - 4f * rht, 0, 2f); Place.Wall(exitPos1 - 6f * rht, nesw + 1, 0, 0, sideWallDrop); if (c == 0) { Place.CaptureLastPlacedAs("MD_walldrop"); Place.Piece("iron_wall_2x2", exitPos1 + 0.5f * fwd - 2f * rht - 1.5f * up, nesw); Place.Spawner("Keeper_Ranged_Guard", exitPos1 - 2f * rht); } if (c < 4) { Place.Floor(exitPos1, 0, -1.5f, 0, 1, ceiling: true); Place.Floor(exitPos1, 0, 2f); Place.Wall(exitPos1 + 2f * rht, nesw + 3, 0, 0, -0.5f); if (c > 0) { Place.FourPieces("iron_wall_2x2", exitPos1 - rht, fwd, nesw + 1, upright: false, 1f, (c == 3) ? 12 : 15); Place.FourPieces("iron_wall_2x2", exitPos1 - 3f * rht, fwd, nesw + 1, upright: false, 1f, (c == 3) ? 12 : 15); } else { Place.FourPieces("iron_wall_2x2", exitPos1 + 0.5f * fwd - rht, fwd, nesw + 1, upright: false, 1f, 12); Place.FourPieces("iron_wall_2x2", exitPos1 + 0.5f * fwd - 3f * rht, fwd, nesw + 1, upright: false, 1f, 12); } } else { Place.Wall(exitPos1 - 2f * fwd, nesw + 2, 0, 0, -0.5f); Place.Wall(exitPos1 + 2f * fwd - 4f * rht, nesw + 2, 0, 0, -0.5f); Place.Piece("dungeon_sunkencrypt_irongate", exitPos1 - 4f * fwd - 2f * rht - up, nesw); Place.Torch("TorchCrystalWall", exitPos1 + 1.3f * fwd - 4f * rht, 0f, nesw + 1); Place.CaptureLastPlacedAs("MD_switch_beeway_1"); } int num = c + 1; c = num; } exitPos1 += -3.125f * rht - 0.25f * fwd; Place.Headstone(exitPos1 + 0.75f * fwd + 3.3f * rht, 15, nesw + 3, 0.5f); exitPos1 = Place.StairsToSewers(exitPos1, nesw + 1, 32); WUTIL.ResetRandomSeed(); yield return "3.Liver:Landing+BeehiveRun"; WUTIL.ResetRandomSeed(m_mountainDungeonPinLocation); Vector3 exitPos2 = placePos - 4f * rht + 4f * fwd; exitPos2.y += 6f; Place.Floor(exitPos2); Place.Floor(exitPos2, nesw, 4f, 0, 1, ceiling: true); Place.Floor(exitPos2 - 4f * rht, nesw); Place.Floor(exitPos2 - 4f * rht, nesw, 4f, 0, 1, ceiling: true); Place.Floor(exitPos2 - 8f * rht, nesw); Place.Floor(exitPos2 - 8f * rht, nesw, 4f, 0, 1, ceiling: true); Place.Wall(exitPos2 - 8f * rht - 2f * fwd, nesw + 2, 0, 0, 0.5f); Place.Wall(exitPos2 + 2f * rht, nesw + 1, 0, 0, 0.5f); Place.Wall(exitPos2 - 9.5f * rht, nesw + 3, 0, 0, 0.5f); Place.Wall(exitPos2 - 4f * rht + 2.4f * fwd, nesw, 0, 0, 0.5f); exitPos2 += 1.9f * fwd; cachePosition = Place.Staircase(exitPos2 - 7.5f * rht, nesw); Place.Wall(cachePosition + fwd + 2.5f * rht, nesw, 1, 2); cachePosition.y += 1f; Place.Piece("iron_wall_2x2", cachePosition + 4f * fwd - 2.75f * rht + 1.5f * up, nesw); Place.Wall(cachePosition + fwd + 5.5f * rht, nesw); Place.Wall(cachePosition - 1.5f * fwd + 16f * rht, nesw - 1); Place.Wall(cachePosition + 2.5f * fwd + 16f * rht, nesw - 1); cachePosition.y += 0.5f; Place.Torch("piece_brazierceiling01", cachePosition + 2f * fwd - 2.75f * rht, 0.05f, nesw, tilt: false, "Coal"); Place.Wall(cachePosition + 4.5f * fwd + 16.5f * rht, nesw, 2, 1); cachePosition += 9.5f * rht - 9f * fwd; Place.FourPieces("stone_floor_2x2", cachePosition + 3f * fwd + rht, 2.5f * rht, nesw, upright: true); Place.Piece("iron_grate", cachePosition + fwd - 1.9f * rht, nesw + 1); Place.CaptureLastPlacedAs("gate"); Place.CaptureCapturedGate("keeperLevel", "oneway", "gate"); Place.FourPieces("woodiron_pole", cachePosition - 1.1f * fwd + rht + up, fwd, nesw + 1, upright: false, 1f, 3); cachePosition.y += 0.125f; Place.FourPieces("iron_wall_2x2", cachePosition + 0.1f * rht, rht, nesw); Place.FourPieces("iron_wall_2x2", cachePosition + 4.1f * rht, rht, nesw); Place.FourPieces("iron_wall_2x2", cachePosition + 2f * fwd + 6.1f * rht, fwd, nesw + 1); Place.FourPieces("iron_wall_2x2", cachePosition - 0.18f * fwd + rht, fwd, nesw + 1, upright: false, 1f, 3); cachePosition.y -= 1.125f; Vector3 roomPlacer = cachePosition; Place.Piece("charcoal_kiln", roomPlacer + 10.75f * fwd - 8f * rht - 4f * up, nesw + 2); Place.Piece("smelter", roomPlacer + 6.5f * fwd - 3f * rht, nesw + 2); Place.Piece("forge", roomPlacer + 8.8f * fwd - 6.8f * rht, nesw); Place.Piece("forge_ext4", roomPlacer + 4f * fwd - 6.6f * rht, nesw); Place.Piece("forge_ext5", roomPlacer + 7.5f * fwd - 4.6f * rht, nesw + 1); Place.Piece("forge_ext6", roomPlacer + 9.5f * fwd - 4.5f * rht + 2f * up, nesw + 2); Place.Piece("piece_throne01", roomPlacer - 4.9f * fwd + 2f * rht, nesw); Place.Piece("shipwreck_karve_dragonhead", roomPlacer - 12f * fwd + 2f * rht + 4.8f * up, nesw + 2, -45f); Place.Piece("fenrir_head", roomPlacer - 5.4f * fwd + 2.82f * rht + 1.8f * up, nesw); Place.ItemStand(268, roomPlacer - 3.75f * fwd + 1.25f * rht, nesw + 2, 1.75f, "TrophyDraugrFem"); Place.Chest("TreasureChest_sunkencrypt", roomPlacer - 8.75f * fwd - 18f * rht, nesw + 2); Place.Chest("TreasureChest_meadows", roomPlacer - 8f * fwd + 9f * rht, nesw + 1); Place.Chest("TreasureChest_meadows", roomPlacer - 8f * fwd - 5f * rht, nesw + 3); Place.Piece("goblin_bed", roomPlacer - 7.1f * fwd + 4f * rht, nesw + 1); Place.Piece("goblin_bed", roomPlacer - 7.1f * fwd, nesw + 3); Place.Chest("TreasureChest_plains_stone", roomPlacer - 4f * fwd - 0.9f * rht, nesw + 1); Place.Chest("shipwreck_karve_chest", roomPlacer - 4f * fwd + 5f * rht, nesw + 1); Place.Torch("piece_walltorch", roomPlacer - 5.35f * fwd, 1.5f, nesw + 3); Place.Torch("piece_walltorch", roomPlacer - 5.35f * fwd + 4f * rht, 1.5f, nesw + 3); roomPlacer += 11.5f * rht - 3.5f * fwd; Place.Piece("piece_table", roomPlacer, nesw); Place.Piece("piece_oven", roomPlacer + 4.55f * fwd - 1.5f * rht, nesw + 1); Place.DisplacedObject("Pickable_RandomFood", roomPlacer - 0.25f * fwd + 0.3f * rht, nesw, 0.8f, 0.1f); Place.DisplacedObject("Pickable_RandomFood", roomPlacer - 0.1f * fwd - 0.9f * rht, nesw, 0.8f, 0.1f); Place.DisplacedObject("Pickable_RandomFood", roomPlacer + 0.2f * fwd - 0.1f * rht, nesw, 0.8f, 0.1f); roomPlacer += 11.6f * fwd - 3.5f * rht; Place.Barrel(roomPlacer, nesw); Place.Barrel(roomPlacer + 2f * fwd - rht, nesw); Place.Barrel(roomPlacer + 3f * fwd + rht, nesw); Place.Chest("TreasureChest_mountains", roomPlacer + 4f * fwd, nesw + 2); roomPlacer = cachePosition; Place.Spawner("Keeper_Elite", roomPlacer - 12f * fwd - 12f * rht); Place.Spawner("Keeper_Ranged_Guard", roomPlacer - 12f * fwd - 16f * rht); Place.Spawner("Keeper_Ranged_Guard", roomPlacer - 12f * fwd - 20f * rht); Place.Spawner("Keeper", roomPlacer + 7f * fwd - 5f * rht); Place.Spawner("Keeper_Ranged_Guard", roomPlacer - 1.5f * fwd - 6f * rht); Place.Spawner("Keeper_Ranged", roomPlacer + 3f * fwd + 22f * rht); Place.Spawner("Ghost", roomPlacer - 2f * fwd + 21f * rht); Place.Spawner("Wraith", roomPlacer - 12f * fwd); Place.Spawner("Ghost", roomPlacer + 20f * fwd + rht); Place.Spawner("Keeper_Elite", roomPlacer + 20f * fwd - 12f * rht); Place.Spawner("DraugrPile", roomPlacer + 24f * fwd + rht, 0f, nesw + 1); Place.Spawner("Witherin", roomPlacer + 18f * rht); Place.Spawner("Keeper_Elite", roomPlacer + 20f * fwd + 18f * rht); Place.ItemStand(1, roomPlacer + 24f * fwd + 21.875f * rht, nesw + 1, 1.5f, "PickaxeIron"); Place.Chest("TreasureChest_meadows", roomPlacer + 26f * fwd + 22.5f * rht, nesw + 3); Place.Barrel(roomPlacer + 23.5f * fwd + 23f * rht, nesw); Place.Barrel(cachePosition + 22f * fwd + 23.4f * rht, nesw); roomPlacer += 12.125f * fwd - 17f * rht; Place.Piece("piece_bed02", roomPlacer + 0.25f * fwd + 1.125f * rht, nesw); Place.Chest("shipwreck_karve_chest", roomPlacer + 2.5f * fwd + 1.125f * rht, nesw); Place.Torch("piece_walltorch", roomPlacer - 1.3f * fwd - 0.5f * rht, 1.5f, nesw + 3); Place.ItemStand(1, roomPlacer + 0.1f * fwd + 1.15f * rht, nesw + 2, 2.3f, "ShieldSerpentscale"); Place.ItemStand(1, roomPlacer + 3f * fwd + 0.85f * rht, nesw + 1, 2f, "HelmetDrake"); cachePosition.y -= 0.5f; Vector3 exitPos3 = Place.Staircase(cachePosition + 26.75f * fwd - 22f * rht, nesw, 1, 8, 0, 256, down: true); exitPos3 -= 2f * fwd; Place.Floor(exitPos3, nesw, 0.125f, 0, 1, ceiling: true); Place.Floor(exitPos3, nesw, 4f); exitPos3.y += 1f; Place.Wall(exitPos3 - 2f * rht, nesw + 1); Place.Wall(exitPos3 + 2f * rht - 4f * fwd, nesw + 3); Place.Torch("TorchCrystalWall", exitPos3 - 1.3f * rht, 1.25f, nesw); Place.CaptureLastPlacedAs("MD_switch_beeway_2"); exitPos3.y -= 1f; Place.Torch("piece_groundtorch_wood", exitPos3 - 2f * fwd + 3.5f * rht); exitPos3 = Place.Staircase(exitPos3 - 2f * fwd + 3.5f * rht, nesw - 1, 1, 3, 0, 32, down: true); Place.Floor(exitPos3 - 2f * rht, 0, 1f); exitPos3 -= 8f * fwd + 2f * rht; exitPos3.y += 1f; Place.Floor(exitPos3); Place.Floor(exitPos3, 0, 4f); Place.Floor(exitPos3 - 4f * rht); Place.Wall(exitPos3 - 2f * fwd, nesw, 0, 0, 1f); Place.Wall(exitPos3 + 2f * fwd, nesw + 2, 0, 0, 1f); Place.WallTorch(exitPos3 + 1.75f * up, nesw); exitPos3.y -= 0.9f; exitPos3 = Place.Staircase(exitPos3 - 2f * rht, nesw - 1, 1, 3, 3, 1); exitPos3 += rht - fwd; Place.Floor(exitPos3, nesw, 0f, 1, 2); Place.Floor(exitPos3, nesw, 3.9f, 1, 2); WUTIL.ResetRandomSeed(); yield return "4.Heart:KeeperLevel"; cachePosition.y += 0.127f; cachePosition = Place.Staircase(cachePosition - 14.25f * fwd + 21f * rht, nesw - 1, 1, 12, 0, 0, down: true); cachePosition.y += 0.12f; cachePosition = Place.Staircase(cachePosition, nesw + 1, 1, 0, 5, 1); cachePosition = Place.Staircase(cachePosition + 2f * fwd + 0.5f * rht, nesw + 1, 1, 6, 0, 0, down: true); cachePosition.y += 2f; cachePosition -= 7.125f * rht + 0.375f * fwd; Place.Spawner("Fenring", cachePosition + 8f * fwd - 4f * rht); Place.Spawner("Fenring", cachePosition + 52f * fwd - 9f * rht); Place.Spawner("Fenring", cachePosition - 46f * rht); Place.Spawner("Fenring", cachePosition + 50f * fwd - 58f * rht); Vector3 placeOffset = 12f * fwd + 4f * rht; Vector3 spawnOffset = 3f * rht - up; int i2 = 0; while (i2 < 3) { bool keyed = i2 == 2 || WUTIL.RandomSpin() > 0.5f; Place.RoomDoor(keyed ? (-12) : (-2), cachePosition, nesw + 1, Place.MapFwd(nesw + 2)); if (keyed) { Place.CaptureCapturedGate("low_irongate", "fenrirKey", "room_door"); Place.Spawner("Fenringlin", cachePosition + spawnOffset); } if (i2 == 1) { Place.RoomDoor(-2, cachePosition + 6.3755f * rht, nesw, Place.MapFwd(nesw + 1)); Place.CaptureCapturedGate("low_irongate", "fenrirKey", "room_door"); } keyed = WUTIL.RandomSpin() > 0.6f; Place.RoomDoor(keyed ? (-12) : (-2), cachePosition + placeOffset, nesw + 1, Place.MapFwd(nesw + 2)); if (keyed) { Place.CaptureCapturedGate("low_irongate", "fenrirKey", "room_door"); Place.Spawner("Fenringlin", cachePosition + placeOffset + spawnOffset); } int num = i2 + 1; i2 = num; cachePosition -= 4f * fwd; } exitPos2 = Place.Staircase(exitPos2, nesw, 1, 2, 10, 1); exitPos2 = Place.Staircase(exitPos2 - 2f * rht, nesw + 2, 2, 2, 2, 0, down: true); exitPos2 = Place.Staircase(exitPos2 + 0.5f * rht, nesw + 2, 2, 3, 4, 1, down: true); exitPos2 = Place.Staircase(exitPos2, nesw + 2, 2, 4, 5, 33, down: true); exitPos2.y -= 0.125f; exitPos2 = Place.Staircase(exitPos2 + 2f * rht, nesw, 1, 0, 3, 1, down: true); exitPos2 = Place.Staircase(exitPos2, nesw + 1, 1, 3, 1, 1, down: true); exitPos2 -= 1.5f * rht - 0.5f * fwd; Place.StairTower(exitPos2, nesw + 3, 4, 197380); WUTIL.ResetRandomSeed(); yield return "5.Stomach:FenringCells"; WUTIL.ResetRandomSeed(m_mountainDungeonPinLocation); exitPos2 += 7.875f * fwd + 2.75f * rht + 1.875f * up; Place.Staircase(exitPos2 - 0.5f * fwd, nesw - 1, 1, 4, 0, 24); Place.m_floorPlanAnchor = exitPos2 - 0.45f * fwd + 5.9f * rht - 3.1f * up; Place.GateCorridor(Place.m_floorPlanAnchor + 4f * rht, nesw - 1, 3, 10f, 384); Place.FloorPlanFromPlan(m_mountainDungeonLowerIceFloorPlan); Place.m_floorPlanAnchor += 18f * rht; Place.m_floorPlanSpaceItems = "IcewormTunnels"; Place.m_levelRoomItems = "Room2"; Place.FloorPlanLevel(4f, 3.4f, 4f, 0, 407, 0.2f, "", 2); Vector3 pit = Place.m_floorPlanAnchor + 4f * up; Place.FloorFrame(pit, 0f, 1); pit -= 2f * rht; pit.y += 0.502f; int i3 = -1; while (i3 < 2) { Place.Wall(pit - 6f * fwd + (float)(i3 * 4) * rht, nesw); if (i3 == 1) { Place.Wall(pit - 1.25f * rht + 3.5f * fwd, nesw + 1); } else { Place.Wall(pit - 6f * rht + (float)(i3 * 4) * fwd, nesw + 1); } Place.Wall(pit + 6f * fwd + (float)(i3 * 4) * rht, nesw + 2); Place.Wall(pit + 6f * rht + (float)(i3 * 4) * fwd, nesw + 3); int num = i3 + 1; i3 = num; } Place.ItemStand(8, pit - 4.03f * rht, nesw + 3, 1.5f, "FancyJacket"); Place.ItemStand(1, pit + 3.95f * fwd + 3f * rht, nesw, 1.5f, "Digger"); Place.ItemStand(1, pit + 3.95f * fwd + 4f * rht, nesw, 1.5f, "PickaxeStone"); pit = Place.m_floorPlanAnchor - 2f * up; float pitWidth = 1.5f; int d = 0; while (d < 10) { Place.Wall(pit + pitWidth * fwd, nesw); Place.Wall(pit + pitWidth * rht, nesw + 1); Place.Wall(pit - pitWidth * fwd, nesw + 2); Place.Wall(pit - pitWidth * rht, nesw + 3); int num = d + 1; d = num; pit.y -= 4f; pitWidth -= 0.06f; } Place.Floor(pit, nesw, 2.5f); WUTIL.ResetRandomSeed(); yield return "6.Bowls:IcewormNursery+Pit"; WUTIL.ResetRandomSeed(m_mountainDungeonPinLocation); cachePosition = Place.m_floorPlanAnchor - 23.25f * rht + 4f * fwd + 3f * up; Place.m_mapLowerFloorHeight = cachePosition.y; Place.Torch("TorchCrystalWall", cachePosition - 1.35f * fwd - 0.75f * rht, 1.75f, nesw + 3); Place.CaptureLastPlacedAs("MD_switch_iceworm_gate_2"); m_mountainDungeonTrampolineHeight = pit.y + 4f; Place.m_mapMaxWallHeight = Place.m_mapLowerFloorHeight + 3.5f; Place.m_roomPlanHasCeiling = false; Place.m_levelRoomItems = ""; Place.Room(16393, cachePosition, 0, -1f, 0f, nesw); cachePosition += 4f * rht; Place.Room(40973, cachePosition, 0, -1f, 0f, nesw); Place.CaptureCapturedGate("eastereggway", "pickable", "room_door"); Place.Chest("TreasureChest_mountains", cachePosition - fwd + 0.4f * rht, nesw + 2, 0.5f); Place.Chest("TreasureChest_plains_stone", cachePosition - fwd + 3.6f * rht, nesw, 0.9f); Place.Stairs(cachePosition + fwd + 0.5f * rht, nesw + 1, 1f, 1, floor: true, ceiling: false, 0.12f); Place.Headstone(cachePosition + 0.7f * fwd + 2f * rht, 16, nesw + 3, 3.6f); cachePosition.y += 1f; int i4 = 0; while (i4 < 3) { cachePosition += 4f * rht; Place.Wall(cachePosition + 2f * fwd, nesw); Place.Wall(cachePosition - 2f * fwd, nesw + 2); int num = i4 + 1; i4 = num; } Place.Spawner("Bat", cachePosition + 8f * rht, 0f); Place.Spawner("Bat", cachePosition + 8.5f * rht, 0f); Place.WallTorch(cachePosition + 2f * up, nesw); Place.Torch("piece_brazierceiling01", cachePosition - 7f * fwd + 2f * rht, 1.05f, nesw); Place.RoomDecor(cachePosition - 7.65f * fwd + 7f * rht + 0.5f * up, nesw + 1, 3.6f, 1.7f, 0f); Place.RoomDecor(cachePosition - 0.65f * fwd + 7f * rht + 0.5f * up, nesw, 2f, 3.6f, 0f); Place.Stairs(cachePosition - 3.75f * rht, nesw + 1, 2f, 1, floor: true, ceiling: false, 0.5f); Place.m_roomPlanHasCeiling = true; Place.Piece("ice_floor_sheet", Place.m_floorPlanAnchor + 4f * rht + -0.1f * up, nesw); Place.Spawner("Iceworm", Place.m_floorPlanAnchor + 4f * fwd + 4f * rht); Place.Spawner("Iceworm", Place.m_floorPlanAnchor - 4f * fwd - 4f * rht); Place.Spawner("Iceworm_Larva", Place.m_floorPlanAnchor + 12f * fwd + 12f * rht); Place.Spawner("Iceworm_Larva", Place.m_floorPlanAnchor - 12f * fwd - 12f * rht); exitPos2.y += 4f; cachePosition = exitPos2 + 0.625f * fwd + 1.25f * rht + 1.625f * up; Place.Piece("iron_wall_2x2", cachePosition, nesw); Place.CaptureLastPlacedAs("MD_barredgate1"); Place.Headstone(cachePosition - 0.05f * fwd, 17, nesw, 1.6f); Place.Wall(cachePosition, nesw, 1, 1, 1f); Place.Wall(cachePosition + 2f * rht, nesw, 1, 2, -1f); exitPos2 = Place.Staircase(exitPos2 - 0.875f * fwd + 0.25f * rht, nesw - 1, 1, 4, 0, 128); cachePosition = exitPos2 + 1.5f * fwd - 2.5f * up; Place.Piece("iron_wall_2x2", cachePosition, nesw - 1); Place.CaptureLastPlacedAs("MD_barredgate2"); Place.LastPlaced().localScale = new Vector3(0.8f, 1f, 1f); cachePosition.y += 1.5f; Place.Floor(cachePosition + 0.75f * rht, nesw + 1, 0f, 1); Place.Headstone(cachePosition + 0.37f * rht, 12, nesw + 3); Place.Floor(cachePosition + 2.25f * rht, nesw + 1, 0f, 1); Place.Floor(exitPos2 + fwd, nesw, 0f, 1); Place.Floor(exitPos2 + fwd + 1.25f * rht, nesw, 4f, 1, 2, ceiling: true); exitPos2 -= 0.5f * rht; Place.Wall(exitPos2 + 2.5f * fwd + 0.5f * rht, nesw, 1, 2, 0.5f); exitPos2.y += 1f; Place.Wall(exitPos2 + 3.75f * rht, nesw + 2); Place.Wall(exitPos2 + 7.75f * rht, nesw + 2); Place.Wall(exitPos2 - 7.5f * fwd + 1.75f * rht, nesw); Place.Wall(exitPos2 - 7.5f * fwd + 5.75f * rht, nesw); Place.Chest("TreasureChest_sunkencrypt", exitPos2 - 1.5f * fwd + 6.75f * rht - 0.5f * up, nesw + 3); exitPos2 -= 2f * fwd; Place.Wall(exitPos2 + 4f * fwd, nesw + 1); cachePosition = exitPos2 - 2f * fwd + 0.7f * rht; Place.Torch("TorchCrystalWall", cachePosition - 0.02f * rht, 1f, nesw); Place.CaptureLastPlacedAs("MD_switch_iceworm_gate_1"); Place.FourPieces("Beehive", cachePosition + 0.2f * fwd + 1.8f * up, 1.5f * fwd, nesw + 1, upright: false, 0.15f, 9); cachePosition += 4f * rht; Place.Spawner("DraugrPile", cachePosition - fwd + rht, -0.5f, nesw + 1); int n = 0; while (n < 4) { Place.Piece("Beehive", cachePosition, WUTIL.DieRoll(4)); int num = n + 1; n = num; cachePosition.y += 0.75f; } cachePosition -= 3f * fwd + rht + up; Place.Piece("Beehive", cachePosition + 6.5f * fwd, nesw + 2); cachePosition += 6.5f * fwd - 4.5f * rht + 2.2f * up; Place.FourPieces("Beehive", cachePosition, 1.7f * fwd + 0.05f * rht, nesw + 3, upright: false, -0.3f, 9); Place.FourPieces("Beehive", cachePosition - 2f * fwd, 1.6f * fwd - 0.1f * rht, nesw + 3, upright: false, -0.1f, 9); cachePosition -= 5f * fwd + 6.5f * rht; Place.FourPieces("Beehive", cachePosition - 0.2f * rht, 1.9f * fwd + 0.1f * rht, nesw + 1, upright: false, -0.25f, 9); Place.FourPieces("Beehive", cachePosition + 6f * fwd, 1.7f * fwd - 0.15f * rht, nesw + 1, upright: false, 0.1f, 9); Place.Wall(exitPos2, nesw + 1); Place.Wall(exitPos2 - 4f * fwd, nesw + 1); exitPos2 += 7.75f * rht; Place.Wall(exitPos2, nesw + 3); Place.Wall(exitPos2 - 4f * fwd, nesw + 3); exitPos2.y += 3f; exitPos2 -= 1.25f * rht; Place.Floor(exitPos2, nesw); Place.Floor(exitPos2 - 4f * rht, nesw); exitPos2 -= 4f * fwd; Place.Floor(exitPos2, nesw); Place.Floor(exitPos2 - 4f * rht, nesw); Place.StairTower(placePos + 8f * rht, nesw + 1, 4, 2360080, 0, exitFloor: true, 7); Place.Floor(placePos - fwd - 5f * rht, nesw, 0f, 8, 2); Place.Floor(placePos, 0, 3.25f, 0, 1, ceiling: true); Place.Floor(placePos + 4f * rht, 0, 3.25f, 0, 1, ceiling: true); placePos.y += 1.5f; Place.Headstone(placePos + 4.25f * fwd + 3.5f * rht, 15, nesw + 2, 0.5f); Place.Headstone(placePos - 4.35f * fwd + 0.5f * rht, 11, nesw, 0.75f); Place.StairsToSewers(placePos + fwd + 4.25f * rht, nesw, 16); exitPos2 = Place.StairsToSewers(placePos - fwd - 0.25f * rht, nesw + 2, 16); Place.Piece("stone_wall_4x2", exitPos2 + 0.5f * rht - 2f * up, nesw); Place.Piece("stone_wall_4x2", exitPos2 + 4.5f * rht - 2f * up, nesw); Place.Floor(exitPos2 - 0.74f * fwd + 1.625f * rht, nesw, 2.5f, 0, 1, ceiling: true); Place.Floor(exitPos2 - 2.26f * fwd - 1.375f * rht, nesw, 2.5f, 1, 2, ceiling: true); Place.Wall(exitPos2 - 2.5f * fwd + 3.75f * rht, nesw + 2, 0, 0, -1f); Place.Wall(exitPos2 - 1.5f * fwd + 6.25f * rht, nesw + 1, 1, 2, -1f); Place.Piece("stone_wall_4x2", exitPos2 - 2f * fwd - 2f * rht + 3.1f * up, nesw + 1); WUTIL.ResetRandomSeed(); yield return "7.Guts:StairMaze+BeeKeeper+OverPit"; WUTIL.ResetRandomSeed(m_mountainDungeonPinLocation); cachePosition = Place.m_mapLocation; Place.m_mapLocation = m_mountainDungeonCavern - 3f * fwd - rht; Place.m_mapLowerFloorHeight = cavernExit.y; Place.m_mapMaxWallHeight = Place.m_mapLowerFloorHeight + 3.5f; Place.m_trapdoorUpperOffset = -3.5f * rht - 1.75f * fwd; Place.m_roomPlanHasCeiling = false; Place.m_roomPlanTiledFloor = true; Place.m_roomPlanStoneCeiling = false; Place.m_torchDensity = 0.2f; Place.m_stairTowerEntryStyle = 410; Place.m_stairTowerDefaultStyle = 410; Place.CustomizeMapGate(1, 9, "stuck"); Place.CustomizeMapGate(1, 1, "stuck"); Place.CustomizeMapGate(2, 1, "stuck"); Place.CustomizeMapGate(1, 5, "pickable"); Place.CustomizeMapGate(4, 5, "oneway"); Place.CustomizeMapGate(10, 0, "helKey"); Place.CustomizeMapGate(11, 4, "jotunnKey"); Place.m_levelRoomItems = "KeeperQuarters"; Place.RoomPlan(6, 6, 4f, m_mountainDungeonRoomPlan); Place.m_mapLocation = cachePosition; Place.m_floorPlanAnchor = m_mountainDungeonCavern - 3.7f * fwd - 0.25f * rht; Place.m_floorPlanAnchor.y = exitPos1.y - 1.5f; Place.m_doorStyleWallProb = 0.2f; Place.m_doorStyleDoorway = 0.05f; Place.m_doorStyleBlocked = 0.1f; Place.m_doorStyleArchWindow = 0.5f; Place.m_doorStyleLoseArchway = 0f; Place.m_doorStyleArchwaySkull = 0.4f; Place.m_doorStyleRoomWoodDoor = 0.1f; Place.m_doorStyleCritter = 0.1f; Place.m_ratHoleSpawnUndead = 0f; Place.m_doorStyleRoomWoodDoor = 0.7f; Place.m_doorStyleDoorMaterial = -6; Place.m_floorPlanSpaceItems = "FenringTunnels"; Place.m_levelRoomItems = "FenringRooms"; Place.m_mapTorch = "TorchCrystal"; Place.FloorPlanFromPlan(m_mountainDungeonLabrynthFloorPlan); Place.FloorPlanLevel(6f, 3.25f, 4f, 8, 65535, 0.25f, "FNESW", 1); WUTIL.ResetRandomSeed(); yield return "8.Belly:FenringLabrynth"; } } internal class Place { [HarmonyPatch(typeof(Bed), "Awake")] private class PatchBedAwake { public static void Postfix(Bed __instance) { //IL_0082: 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) if (!((Object)((Component)__instance).gameObject).name.StartsWith("Wildling_Piece_Proxy")) { return; } if (m_awakeDataPins.Contains(((Component)__instance).gameObject)) { WDBUG.Log("DataPin already Awoke!"); return; } m_awakeDataPins.Add(((Component)__instance).gameObject); string proxyData = GetProxyData(((Component)__instance).gameObject); if (proxyData != "" && !m_awakeProxyData.ContainsKey(((Component)__instance).transform.position)) { m_awakeProxyData.Add(((Component)__instance).transform.position, proxyData); } } } [HarmonyPatch(typeof(Bed), "GetHoverText")] private class PatchBedGetHoverText { public static bool Prefix(Bed __instance, ref string __result) { if (IsProxyObject(((Component)__instance).gameObject)) { __result = ""; return false; } if (!Wildling.IsWildling && WUTIL.IsWildlingObject(((Component)__instance).gameObject)) { __result = "Cannot use"; return false; } return true; } } [HarmonyPatch(typeof(Bed), "Interact")] private class PatchBedInteract { public static bool Prefix(Bed __instance, ref bool __result) { if (IsProxyObject(((Component)__instance).gameObject)) { __result = false; return false; } if (__instance.IsCurrent() && Fairy.SE_DoxieDust.IsActive) { WUTIL.Message("The dead do not sleep."); __result = false; return false; } return Wildling.IsWildling || !WUTIL.IsWildlingObject(((Component)__instance).gameObject); } public static void Postfix(Bed __instance) { if (__instance.IsCurrent()) { World.TrackBedPositions(((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(Bed), "CheckEnemies")] private class PatchBedCheckEnemies { public static bool Prefix(Bed __instance, ref bool __result) { if (IsProxyObject(((Component)__instance).gameObject)) { __result = false; return false; } return true; } public static void Postfix(Bed __instance, ref bool __result) { if ((m_playerNearCustomObjects & __result) && MountainDungeon.BedUnsafe(__instance)) { __result = false; } } } [HarmonyPatch(typeof(WearNTear), "Awake")] private class PatchWearNTearAwake { public static void Postfix(WearNTear __instance) { //IL_0007: 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) if (IsInDungeon(((Component)__instance).transform.position, piece: true)) { if (!Solidify(((Component)__instance).gameObject)) { WDBUG.Log("PatchWearNTearAwake failed to solidify " + ((Object)((Component)__instance).gameObject).name + " in custom Dungeon"); } } else if (MountainDungeon.InSnakeHeadRegion(((Component)__instance).transform.position) && !Solidify(((Component)__instance).gameObject)) { WDBUG.Log("PatchWearNTearAwake failed to solidify " + ((Object)((Component)__instance).gameObject).name + " in Snake Head"); } } } [HarmonyPatch(typeof(SpawnArea), "Awake")] private class PatchSpawnAreaAwake { public static void Postfix(SpawnArea __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (((Component)__instance).transform.position.y >= 5100f) { TrackDungeonSpawner(((Component)__instance).transform); if (((Component)__instance).transform.position.y >= 5200f) { WDBUG.Log("Configuring MD Area Spawner " + WUTIL.GameName(((Component)__instance).gameObject), WDBUG.Level.Dungeon); __instance.m_spawnIntervalSec = 30f; __instance.m_maxNear = 5; __instance.m_maxTotal = 10; __instance.m_nearRadius = 12f; __instance.m_farRadius = 30f; } } } } [HarmonyPatch(typeof(SpawnArea), "GetInstances")] private class PatchSpawnAreaGetInstances { public static void Postfix(SpawnArea __instance, ref int near, ref int total) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (((Component)__instance).transform.position.y >= 5200f) { WDBUG.Log($"Population check for {WUTIL.GameName(((Component)__instance).gameObject)} at height: {((Component)__instance).transform.position.y} nearby: {near} total: {total}", WDBUG.Level.Dungeon); } } } [HarmonyPatch(typeof(SpawnArea), "IsSpawnPrefab")] private class PatchSpawnAreaIsSpawnPrefab { public static bool Prefix(SpawnArea __instance, GameObject go, ref bool __result) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (((Component)__instance).transform.position.y >= 5100f && WUTIL.GameName(((Object)__instance).name) == "Spawner_DraugrPile" && WUTIL.GameName(go) == "Keeper") { __result = true; return false; } return true; } } [HarmonyPatch(typeof(CreatureSpawner), "Awake")] private class PatchCreatureSpawnerAwake { public static void Postfix(CreatureSpawner __instance) { if (((Object)((Component)__instance).gameObject).name.StartsWith("Wildling_Spawner_Proxy")) { ConfigureSpawner(__instance, GetProxyData(((Component)__instance).gameObject)); } } } [HarmonyPatch(typeof(CreatureSpawner), "Spawn")] private class PatchCreatureSpawnerSpawn { public static void Postfix(CreatureSpawner __instance, ref ZNetView __result) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)__result == (Object)null) { return; } string text = WUTIL.GameName(((Object)__instance).name); if (!text.Contains("Spawner")) { if (text == "Borat") { WUTIL.Destroy(((Component)__instance).gameObject); } else { CustomizeCharacter(((Component)__result).gameObject.GetComponent(), text, ((Component)__instance).transform.localScale); } } } } [HarmonyPatch(typeof(PickableItem), "Awake")] private class PatchPickableItemAwake { public static void Postfix(PickableItem __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (IsInDungeon(((Component)__instance).transform.position)) { AddDungeonPickables(((Component)__instance).transform); } } } [HarmonyPatch(typeof(Pickable), "Awake")] private class PatchPickableAwake { public static void Postfix(Pickable __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!IsInDungeon(((Component)__instance).transform.position)) { return; } WUTIL.TimerReset("check_log_error", 300f); StaticPhysics component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_checkSolids = true; } if (!SwampDungeon.AtGreatOak(((Component)__instance).transform)) { string text = WUTIL.GameName(((Component)__instance).gameObject); if (!text.Contains("Mountain") && !text.Contains("MeatPile") && !text.Contains("hanging")) { AddDungeonPickables(((Component)__instance).transform); } } } } [HarmonyPatch(typeof(Destructible), "Awake")] private class PatchDestructibleAwake { public static void Postfix(Destructible __instance) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (IsInDungeon(((Component)__instance).transform.position)) { StaticPhysics component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_checkSolids = true; } } } } [HarmonyPatch(typeof(Pathfinding), "BuildTile")] public static class PatchPathfindingBuildTile { public static void Prefix(Pathfinding __instance, out LayerMask? __state) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) __state = null; if (WUTIL.Timer("no_navmesh_update") > 0f) { __state = __instance.m_layers; __instance.m_layers = LayerMask.op_Implicit(0); } } public static void Postfix(Pathfinding __instance, LayerMask? __state) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (__state.HasValue) { __instance.m_layers = __state.Value; } } } [HarmonyPatch(typeof(ItemStand), "UseItem")] private class PatchItemStandUseItem { public static bool Prefix(ItemStand __instance, ref bool __result, ref ItemData item) { if (m_playerNearCustomObjects && __instance.m_powerActivationDelay == 0f) { __result = false; return false; } return true; } public static void Postfix(ItemStand __instance, Humanoid user, ItemData item, bool __result) { if (m_playerNearCustomObjects && MountainDungeon.CheckRiddleAnswer(__instance, item) && m_itemstandLastAttachForced > 0) { RejectItemstandItem(__instance, (m_itemstandLastAttachForced == 1) ? WUTIL.ItemName(item) : m_itemstandExchangeItem); } } } [HarmonyPatch(typeof(ItemStand), "UpdateAttach")] public class PatchItemStandUpdateAttach { private static int m_catchQueuedItemStack; private static ItemData m_catchQueuedItem; private static ItemStand m_deferedItemSwap; private static Transform m_deferedItemTran; public static bool Prefix(ItemStand __instance, ZNetView ___m_nview, ItemData ___m_queuedItem) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Invalid comparison between Unknown and I4 if ((Object)(object)___m_nview == (Object)null || !___m_nview.IsOwner()) { return true; } if (__instance.m_supportedItems.Count != 1) { string text = WUTIL.ItemName(___m_queuedItem); if (text == "HealingSalve" || text == "PatchKit") { m_catchQueuedItem = ___m_queuedItem; m_catchQueuedItemStack = ___m_queuedItem.m_stack; } else if ((int)___m_queuedItem.m_shared.m_itemType == 21) { if (!PlayerHoldingBlade()) { WUTIL.Message("You must be holding a blade to butcher fish."); ((MonoBehaviour)__instance).CancelInvoke("UpdateAttach"); return false; } m_deferedItemSwap = __instance; WUTIL.TimerReset("late_update_attach", 0.5f); } return true; } if ((Object)(object)__instance.m_supportedItems[0] == (Object)null) { return false; } string name = ((Object)__instance.m_supportedItems[0]).name; switch ((int)__instance.m_powerActivationDelay) { case -2: __instance.m_powerActivationDelay = 2f; __instance.m_supportedItems.Clear(); break; case -1: __instance.m_powerActivationDelay = 0f; __instance.m_supportedItems.Clear(); WDBUG.Log("ItemStand Gift Inactivate", WDBUG.Level.Dungeon); break; default: return true; } ((MonoBehaviour)__instance).CancelInvoke("UpdateAttach"); ItemData val = WUTIL.CreateItemData(name); ___m_nview.GetZDO().Set("item", ((Object)val.m_dropPrefab).name); ItemDrop.SaveToZDO(val, ___m_nview.GetZDO()); try { ___m_nview.InvokeRPC(ZNetView.Everybody, "SetVisualItem", new object[3] { name, val.m_variant, val.m_quality }); } catch { WDBUG.Log($"ERROR: CATCH: UpdateAttach.InvokeRPC {name} variant: {val.m_variant}", WDBUG.Level.Dungeon); } return false; } public static void Postfix(ItemStand __instance, ZNetView ___m_nview, GameObject ___m_visualItem) { //IL_0028: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_deferedItemSwap != (Object)null && (Object)(object)___m_visualItem != (Object)null) { Transform transform = ___m_visualItem.transform; Vector3 val = transform.position - ((Component)Player.m_localPlayer).transform.position; val.y = 0f; transform.rotation = Quaternion.AngleAxis(90f, Vector3.up) * Quaternion.FromToRotation(transform.forward, val) * transform.rotation; switch (m_deferedItemSwap.GetAttachedItem()) { case "Fish8": case "Fish10": transform.position += 0.1f * Vector3.up; break; case "Fish5": case "Fish11": transform.position += 0.15f * Vector3.up; break; case "Fish12": transform.position += 0.2f * Vector3.up; break; } m_deferedItemTran = transform; } if (m_catchQueuedItem != null) { ItemData val2 = m_catchQueuedItem.Clone(); val2.m_stack = m_catchQueuedItemStack; ___m_nview.GetZDO().Set("item", ((Object)m_catchQueuedItem.m_dropPrefab).name); ItemDrop.SaveToZDO(val2, ___m_nview.GetZDO()); ((Humanoid)Player.m_localPlayer).GetInventory().RemoveItem(m_catchQueuedItem); m_catchQueuedItem = null; return; } bool flag = (int)__instance.m_powerActivationDelay == -4; if (flag || (int)__instance.m_powerActivationDelay == -3) { if (__instance.HaveAttachment()) { __instance.m_powerActivationDelay = ((!flag) ? 2 : 0); string attachedItem = __instance.GetAttachedItem(); __instance.DestroyAttachment(); if (m_itemstandExchangeItem == "") { return; } WDBUG.Log("ItemStand exchanging " + attachedItem + " for " + m_itemstandExchangeItem, WDBUG.Level.World); WUTIL.Spawn(m_itemstandExchangeItem, __instance.m_dropSpawnPoint.position, __instance.m_dropSpawnPoint.rotation); } else { WDBUG.Log("Could not reject non-attached item for " + ((Object)__instance).name); } m_itemstandExchangeItem = ""; } World.UpdateHungTrophies(__instance); } public static void LateUpdateAttach() { //IL_004f: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)m_deferedItemSwap)) { Transform val = (((Object)(object)m_deferedItemTran == (Object)null) ? m_deferedItemSwap.m_dropSpawnPoint : m_deferedItemTran); float num = (((Object)(object)m_deferedItemTran == (Object)null) ? 90 : 0); for (int i = 0; i < 2; i++) { Quaternion val2 = val.rotation * Quaternion.Euler(0f, num + (float)(i * 180), 0f); Vector3 val3 = val2 * Vector3.forward; float num2 = 0.15f + WUTIL.RandomSpin(0f, 0.1f); Vector3 position = m_deferedItemSwap.m_dropSpawnPoint.position + num2 * val3; position.y += 0.3f + num2; WUTIL.Spawn("FishRaw", position, val2); } WUTIL.PlaceObject("vfx_BloodHit", m_deferedItemSwap.m_dropSpawnPoint.position, 0.05f); m_deferedItemSwap.DestroyAttachment(); m_deferedItemSwap = null; m_deferedItemTran = null; } } public static bool PlayerHoldingBlade() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected I4, but got Unknown ItemData currentWeapon = ((Humanoid)Player.m_localPlayer).GetCurrentWeapon(); bool flag = currentWeapon != null && (int)currentWeapon.m_shared.m_itemType == 3; if (flag) { SkillType skillType = currentWeapon.m_shared.m_skillType; SkillType val = skillType; switch (val - 1) { default: flag = false; break; case 0: case 1: case 4: case 6: break; } } return flag; } } [HarmonyPatch(typeof(ItemStand), "GetAttachPrefab")] private class PatchItemStandGetAttachPrefab { public static void Postfix(ref GameObject __result, GameObject item) { m_itemstandLastAttachForced = (((Object)(object)__result == (Object)null) ? 1 : 0); if (m_playerNearCustomObjects && m_itemstandLastAttachForced > 0) { __result = item; } } } [HarmonyPatch(typeof(ItemStand), "GetHoverText")] private class PatchItemStandGetHoverText { public static bool Prefix(ItemStand __instance, ref string __result) { if ((Object)(object)Player.m_localPlayer != (Object)null) { if (!__instance.HaveAttachment()) { string text = WUTIL.GameName(((Object)__instance).name); if (text.StartsWith("attach_")) { ItemData autoattachItem = World.GetAutoattachItem(__instance); if (autoattachItem != null) { __result = Localization.instance.Localize(__instance.m_name + "\n" + WUTIL.KeyHighlightText("Use") + " attach " + autoattachItem.m_shared.m_name + ".\n" + WUTIL.KeyHighlightText("1-8") + " to attach."); return false; } } else { if (text == "FirePlinth") { __result = Localization.instance.Localize("Fire plinth.\n" + WUTIL.KeyHighlightText("1-8") + " to butcher a live fish."); return false; } if (__instance.m_name == "ALL_PlaceRiddleItem") { ItemData autoattachItem2 = World.GetAutoattachItem(__instance); __result = Localization.instance.Localize("Answer the riddle.\n" + WUTIL.KeyHighlightText("Use") + " place " + autoattachItem2.m_shared.m_name + ".\n" + WUTIL.KeyHighlightText("1-8") + " to place."); return false; } } } if (m_playerNearCustomObjects && __instance.m_powerActivationDelay == 0f) { __result = ""; return false; } if ((Object)(object)__instance.m_guardianPower != (Object)null) { return !Quest.CheckGaurdianPowerReset(__instance, ref __result); } } return true; } } [HarmonyPatch(typeof(Container), "UseItem")] private class PatchContainerUseItem { public static void Postfix(Container __instance, Inventory ___m_inventory, ItemData item) { if (item != null) { return; } ___m_inventory.RemoveAll(); foreach (ItemData dropListItem in __instance.m_defaultItems.GetDropListItems()) { ___m_inventory.AddItem(dropListItem); } } } [HarmonyPatch(typeof(Fireplace), "Awake")] private class PatchFireplaceAwake { public static void Prefix(Fireplace __instance) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (((Object)((Component)__instance).gameObject).name.StartsWith("piece_brazierceiling01")) { if (IsInDungeon(((Component)__instance).transform.position)) { __instance.m_startFuel = 0f; } } else if (WUTIL.GameName(((Component)__instance).gameObject) == "GuckBurner") { __instance.m_startFuel = WUTIL.DieRoll(2); } } } [HarmonyPatch(typeof(Fireplace), "GetHoverText")] private class PatchFireplaceGetHoverText { public static bool Prefix(Fireplace __instance, ref string __result) { string name = WUTIL.GameName(((Component)__instance).gameObject); name = WUTIL.TrimWildlingTag(name); if (name.StartsWith("TorchCrystal")) { string text = WUTIL.KeyHighlightText("Use"); __result = ""; if (name == "TorchCrystalSmall") { if (!__instance.IsBurning()) { __result = text + " Add Crystal"; } } else if (MountainDungeon.PieceInteract(((Component)__instance).gameObject.transform) && Wildling.IsWildling) { __result = text + " Interact"; } return false; } if (name == "MatchPlaced") { __result = WUTIL.KeyHighlightText("Use") + " to remove"; return false; } return true; } } [HarmonyPatch(typeof(Fireplace), "Interact")] private class PatchFireplaceInteract { public static bool Prefix(Fireplace __instance, Humanoid user, ZNetView ___m_nview, ItemDrop ___m_fuelItem) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.GameName(((Component)__instance).gameObject); if (MountainDungeon.PieceInteract(((Component)__instance).gameObject.transform)) { World.SendServerRequest("Trigger", text, ((Component)__instance).gameObject.transform.position); return false; } if (text == "MatchPlaced") { ___m_nview.InvokeRPC("RPC_AddFuel", Array.Empty()); return false; } if (text == "GuckBurner") { __instance.m_fuelAddedEffects.m_effectPrefabs[0].m_enabled = true; __instance.m_fuelAddedEffects.m_effectPrefabs[1].m_enabled = true; } else if (text.Contains("TorchCrystal")) { if (__instance.IsBurning()) { return false; } Inventory inventory = user.GetInventory(); if (inventory != null && inventory.HaveItem(___m_fuelItem.m_itemData.m_shared.m_name, true)) { inventory.RemoveItem(___m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true); ___m_nview.InvokeRPC("RPC_AddFuel", Array.Empty()); return false; } } return true; } } [HarmonyPatch(typeof(Fireplace), "RPC_AddFuel")] private class PatchFireplaceRPC_AddFuel { public static bool Prefix(Fireplace __instance) { if (WUTIL.GameName(((Component)__instance).gameObject) == "MatchPlaced") { ((Component)__instance).gameObject.GetComponent().ApplyDamage(999f, (HitData)null); return false; } return true; } } [HarmonyPatch(typeof(Fireplace), "UpdateState")] private class PatchFireplaceUpdateState { public static void Postfix(Fireplace __instance) { if (WUTIL.GameName(((Component)__instance).gameObject) == "MatchPlaced" && !__instance.IsBurning()) { WearNTear component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.ApplyDamage(999f, (HitData)null); } } } } [HarmonyPatch(typeof(Pickable), "RPC_SetPicked")] private class PatchPickableSetPicked { public static void Prefix(Pickable __instance, bool picked, ZNetView ___m_nview) { if (picked) { MountainDungeon.PickableInteract(((Component)__instance).gameObject.transform); } } } [HarmonyPatch(typeof(Door), "Awake")] private class PatchDoorAwake { public static void Postfix(Door __instance, ZNetView ___m_nview) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (___m_nview.GetZDO() == null) { return; } if (__instance.m_name == "Shutter") { Transform val = ((Component)__instance).gameObject.transform.Find("window/shutter"); if ((Object)(object)val != (Object)null) { val.rotation *= Quaternion.AngleAxis((float)(90 * ___m_nview.GetZDO().GetInt("state", 0)), Vector3.up); } } else if (__instance.m_name == "Sewer gates") { Transform val2 = ((Component)__instance).gameObject.transform.Find("sidedoor"); if ((Object)(object)val2 != (Object)null) { val2.rotation *= Quaternion.AngleAxis((float)(-90 * ___m_nview.GetZDO().GetInt("state", 0)), Vector3.up); } } } } [HarmonyPatch(typeof(Door), "GetHoverText")] private class PatchDoorGetHoverText { public static bool Prefix(Door __instance, ref string __result) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_name == "Shutter") { Vector3 val = ((Component)Player.m_localPlayer).transform.position - ((Component)__instance).transform.position; if (val.y > 1f || Vector3.Dot(((Component)__instance).transform.forward, ((Vector3)(ref val)).normalized) > 0f) { __result = ""; return false; } } return true; } } [HarmonyPatch(typeof(Door), "Interact")] private class PatchDoorInteract { private static int m_pickAttempts; private static bool m_OpenPartnerGate; public static bool Prefix(Door __instance, bool hold, ZNetView ___m_nview) { if (hold) { return true; } if (__instance.m_name == "Shutter") { return OpenShutter(__instance, ___m_nview.GetZDO().GetInt("state", 0)); } if (__instance.m_name == "Sprung gate") { OpenGateWithPartner(__instance, ___m_nview.GetZDO().GetInt("state", 0)); return true; } if (m_playerNearCustomObjects) { int num = ___m_nview.GetZDO().GetInt("state", 0); bool open = num != 0; Transform transform = ((Component)__instance).gameObject.transform; string[] array = m_capturedGates.Keys.ToArray(); foreach (string text in array) { if ((Object)(object)transform == (Object)(object)m_capturedGates[text]) { if (CheckGateLocked(transform, text, open)) { return false; } break; } } if (__instance.m_name == "Sewer gates") { OpenSidedoor(__instance, num); } } return true; } private static bool BehindDoor(Transform door) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)Player.m_localPlayer).transform.position - door.position; return ((Vector3)(ref val)).magnitude < 0.1f || Vector3.Dot(door.forward, ((Vector3)(ref val)).normalized) < 0f; } private static bool OpenShutter(Door door, int state) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (((Component)Player.m_localPlayer).transform.position.y - ((Component)door).transform.position.y > 1f || !BehindDoor(((Component)door).transform)) { WUTIL.Message("Shutter cannot be operated from here."); return false; } Transform val = ((Component)door).gameObject.transform.Find("window/shutter"); if ((Object)(object)val == (Object)null || m_worldShutters.ContainsKey(val)) { return false; } m_worldShutters.Add(val, (state == 0) ? 1f : 0.5f); WUTIL.TimerReset("freeze_player_movement", 0.5f); return true; } private static void OpenSidedoor(Door door, int state) { Transform val = ((Component)door).gameObject.transform.Find("sidedoor"); if ((Object)(object)val != (Object)null && !m_cryptSidedoors.ContainsKey(val)) { float value = ((state == 1) ? 0.5f : 1f); if (state == 0) { value = (BehindDoor(((Component)door).transform) ? 1f : 0.5f); } m_cryptSidedoors.Add(val, value); } } private static bool CheckGateLocked(Transform piece, string gateID, bool open) { //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05d9: Unknown result type (might be due to invalid IL or missing references) int num = gateID.IndexOf(':'); if (num < 0) { WDBUG.Log("CheckTriggerGate: Ignored unrecognized gateName format: " + gateID, WDBUG.Level.Dungeon); return false; } bool flag = BehindDoor(piece); bool flag2 = Wildling.IsWildling; float stamina = Player.m_localPlayer.GetStamina(); float num2 = 0f; string text = "Gate is locked."; string text2 = gateID.Remove(num); num = gateID.IndexOf("Reverse"); if (num > 0) { text2 = text2.Remove(num); flag = !flag; } switch (text2) { case "latch": case "oneway": if (open && text2 == "oneway") { m_capturedGates.Remove(gateID); } if (open || flag) { return false; } if (WUTIL.GameName(((Object)piece).name).EndsWith("_door")) { text = "Door opens from the other side."; flag2 = false; } else if (flag2) { num2 = 10f; if (stamina < num2) { return false; } text = "Gate opened by reaching around the bars."; } else { text = "Gate opens from the other side."; } break; case "stuck": flag2 = !flag2; if (flag2) { num2 = 20f; if (stamina < num2) { return true; } text = "Gate was stuck and required some effort to move."; } else { num2 = 5f; text = "Gate seems to be stuck."; } break; case "jotunnKey": { ItemData inventoryItemData2 = WUTIL.GetInventoryItemData("SerpentScale"); if (inventoryItemData2 == null) { inventoryItemData2 = WUTIL.GetInventoryItemData("TrophySerpent"); } flag2 = inventoryItemData2 != null; if (open) { if (flag2) { return false; } text = "Gate seems to be stuck."; } else { text = ((!flag2) ? "Gate opens to Serpents." : ("Gate opened when you raised the " + ((WUTIL.ItemName(inventoryItemData2) == "SerpentScale") ? "Iceworm scales." : "Serpent head."))); } break; } case "helKey": flag2 = WUTIL.GetInventoryItemData("TrophyDraugrFem") != null; if (open) { if (flag2) { return false; } text = "Gate seems to be stuck."; } else { text = (flag2 ? "Gate opened when you raised the Draugr head." : "Gate opens to female Keepers."); } break; case "fenrirKey": flag2 = WUTIL.GetInventoryItemData("TrophyFenring") != null; if (open) { if (flag2) { return false; } text = "Gate seems to be stuck."; } else { text = (flag2 ? "Gate opened when you applied the Fenring paw." : "Gate opens to Fenring."); } break; case "pickable": { if (open) { m_capturedGates.Remove(gateID); return false; } num2 = 10f; Quest.ShowMainTutorial(11); if (stamina < num2) { return true; } if (!flag2) { break; } if (WUTIL.Timer("lockpick_cooldown") > 0f) { return true; } WUTIL.TimerReset("lockpick_cooldown", 3f); if (WUTIL.Timer("lockpick_count_reset_cooldown") == 0f) { m_pickAttempts = 0; WUTIL.TimerReset("lockpick_count_reset_cooldown", 35f); } float playerData = Wildling.GetPlayerData("WS.Lockpick"); ItemData inventoryItemData = WUTIL.GetInventoryItemData("SkeletonKey"); playerData = ((inventoryItemData == null) ? (playerData + (float)m_pickAttempts * 0.01f) : (playerData + 0.25f)); float num3 = 0.75f * playerData + 0.05f; if (WUTIL.RandomSpin() <= num3) { text = "Lock picked."; if (m_pickAttempts > 0 && playerData < 1f) { text += ".. Your skill increased."; if (Wildling.RaiseSecondarySkill("Lockpick", 0.05f) >= 0.8f) { Quest.CheckObjective(10, set: false); } Quest.AdvanceAchievement("LocksPicked"); } m_pickAttempts = 0; WUTIL.PlaySfx("picklock_sfx", ((Component)piece).transform.position + Vector3.up); } else { flag2 = false; m_pickAttempts++; text += ".. Lockpick attempt failed."; if (inventoryItemData != null && !WUTIL.TestLuck(1.05f - 0.1f * (float)m_pickAttempts)) { ((Humanoid)Player.m_localPlayer).GetInventory().RemoveOneItem(inventoryItemData); text += " Lockpick broken!"; WUTIL.PlaySfx("pickbreak_sfx", ((Component)piece).transform.position + Vector3.up); } } break; } default: flag2 = true; WDBUG.Log($"Gate {gateID} ({text2}) behind: {flag} open: {open}"); text = ""; break; case "locked": break; } WUTIL.Message(text); ((Character)Player.m_localPlayer).UseStamina(num2); return !flag2; } private static void OpenGateWithPartner(Door door, int state) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) if (m_OpenPartnerGate) { WDBUG.Log("Blocked OpenPartnerGate recursion", WDBUG.Level.World); return; } Transform val = ((Component)door).gameObject.transform.Find("door/connnector"); if (!((Object)(object)val != (Object)null)) { return; } if (m_worldSprungGates.ContainsKey(val)) { WDBUG.Log("Intercepted autoclose request", WDBUG.Level.World); m_worldSprungGates.Remove(val); } else { if (state != 0) { return; } m_worldSprungGates.Add(val, 0.6f); Collider[] array = Physics.OverlapSphere(val.position, 0.25f, WUTIL.c_pieceRayMask); foreach (Collider val2 in array) { Transform val3 = ((Component)val2).transform; if (!(((Object)val3).name == "connnector")) { continue; } while ((Object)(object)val3.parent != (Object)null) { val3 = val3.parent; } if (!(WUTIL.GameName(((Component)val3).gameObject) == "TreehouseGate")) { continue; } Door component = ((Component)val3).gameObject.GetComponent(); if ((Object)(object)component == (Object)(object)door) { continue; } float num = Vector3.Distance(val.position, ((Component)val2).transform.position); if (!(num > 0.2f)) { Vector3 value = 0.5f * (((Component)door).transform.position + ((Component)component).transform.position) - ((Component)val2).transform.position; value.y = 0f; WDBUG.Log("Opening partner gates at skew " + ((Vector3)(ref value)).magnitude, WDBUG.Level.World); if (((Vector3)(ref value)).magnitude > 0.1f) { value = ((Vector3)(ref value)).normalized; m_worldSprungGatesDir.Add(door, value); m_worldSprungGatesDir.Add(component, value); } m_OpenPartnerGate = true; m_worldSprungGates.Add(((Component)val2).transform, 0.6f); component.Interact((Humanoid)(object)Player.m_localPlayer, false, false); m_OpenPartnerGate = false; break; } } } } } [HarmonyPatch(typeof(Door), "SetState")] private class PatchDoorSetState { public static void Postfix(Door __instance, int state) { if (state == 0) { return; } Transform transform = ((Component)__instance).gameObject.transform; string text = ""; foreach (string key in m_capturedGates.Keys) { if ((Object)(object)transform == (Object)(object)m_capturedGates[key]) { if (CheckUnlocked(key)) { text = key; } break; } } if (text != "") { m_capturedGates.Remove(text); } } private static bool CheckUnlocked(string doorID) { int num = doorID.IndexOf(':'); if (num < 0) { return false; } doorID = doorID.Remove(num); num = doorID.IndexOf("Reverse"); if (num > 0) { doorID = doorID.Remove(num); } return doorID == "pickable" || doorID == "oneway"; } } [HarmonyPatch(typeof(Door), "Open")] private class PatchDoorOpen { public static bool Prefix(Door __instance, Vector3 userDir, ZNetView ___m_nview) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_name == "Sprung gate") { Transform val = ((Component)__instance).transform.Find("reference"); if ((Object)(object)val != (Object)null) { if (m_worldSprungGatesDir.ContainsKey(__instance)) { userDir = m_worldSprungGatesDir[__instance]; m_worldSprungGatesDir.Remove(__instance); } ___m_nview.InvokeRPC("UseDoor", new object[1] { Vector3.Dot(val.forward, userDir) < 0f }); return false; } } return true; } } public const float c_dungeonBuildBaseHeight = 5000f; public const float c_mapLowerFloorDepth = 9.9f; public const float c_mapLowerFloorCeiling = 3.5f; public const float c_mapMinCeilingHeight = 2f; public const float c_mountainDungeonExitOpenTime = 120f; public const int c_outerWallStyleMaskNone = 0; public const int c_outerWallStyleMaskUpperCoving = 4; public const int c_outerWallStyleMaskLowerCoving = 8; public const int c_outerWallStyleMaskAllCoving = 12; public const int c_floorStyleDefault = 0; public const int c_floorStyleDirt = 1; public const int c_floorStyleSewer = 2; public const int c_floorStyleFlooded = 3; public const int c_floorStyleIcy = 4; public const int c_floorStyleSewerRoof = 5; public const int c_stairTowerEntryStyleDefault = 410; public const int c_stairTowerEntryStyleDirt = 920; public const int c_stairTowerEntryStylePit = 42241; public const int c_stairTowerEntryStyleForest = 17304; public const int c_stairTowerEntryStyleBorat = 655642; public const int c_doorTypeIronGrate = -1; public const int c_doorTypeIronGrateSmall = -2; public const int c_doorTypeIronGrateFramed = -3; public const int c_doorTypeIronWallGrate = -4; public const int c_doorTypeWooden = -5; public const int c_doorTypeArchway = -6; public const int c_doorTypeSmallArchway = -7; public const int c_doorTypeTallArchway = -8; public const int c_doorTypeLargeBarredWindow = -9; public const int c_doorTypeSmallBarredWindow = -10; public const int c_doorTypeLargeBarredEntry = -11; public const int c_doorTypeIronGrateSmallNoPin = -12; public const int c_trapdoorLockAbove = 1; public const int c_trapdoorUnlocked = 2; public const int c_trapdoorLockBelow = 3; public const int c_itemStandWall = 0; public const int c_itemStandWallGift = 1; public const int c_itemStandCup = 2; public const int c_itemStandWallSpot = 4; public const int c_itemStandFloorSpotGift = 5; public const int c_itemStandWallDisplay = 8; public const int c_itemStandCupDisplay = 10; public const int c_itemStandSpotDisplay = 12; public const int c_itemStandFloorSpotDisplay = 14; public const int c_itemStandAltSpotDisplay = 28; public const string c_torchCeiling = "piece_brazierceiling01"; public const string c_torchWall = "piece_walltorch"; public const string c_torchWood = "piece_groundtorch_wood"; public const string c_torchOrange = "piece_groundtorch"; public const string c_torchBlue = "piece_groundtorch_blue"; public const string c_torchGreen = "piece_groundtorch_green"; public const string c_torchCeilingGreen = "GuckBurner"; public const string c_torchCrystal = "TorchCrystal"; public const string c_torchCrystalSmall = "TorchCrystalSmall"; public const string c_torchCrystalWall = "TorchCrystalWall"; public const string c_torchYellow = "piece_groundtorch_green,piece_groundtorch"; public const string c_torchMagenta = "piece_groundtorch_blue,piece_groundtorch"; public const string c_torchCyan = "piece_groundtorch_blue,piece_groundtorch_green"; public const string c_torchCrystalOrange = "TorchCrystal,piece_groundtorch"; public const string c_torchCrystalBlue = "TorchCrystal,piece_groundtorch_blue"; public const string c_torchCrystalGreen = "TorchCrystal,piece_groundtorch_green"; public const string c_cryptCrittersDryEnv = "Rat,Skeleton,Ghost,Skeleton_Poison,Draugr"; public const string c_cryptCrittersWetEnv = "Sewer_Snake,RatDraugr,Blob,Skeleton_Poison,Draugr,Draugr_Elite"; public const char c_noHotTile = 'x'; public const string c_roomDoor = "room_door"; public const string c_roomDoor2 = "room_door2"; public const string c_wallAttachPoint = "wall_attach"; public const string c_stairsBackWall = "stairs_backwall"; public const string c_stairsSideWall = "stairs_sidewall"; public const string c_proxieSpawner = "Proxy"; public const int c_buildReportRequireRHPath = 1; public const int c_buildReportViableRHPath = 2; public const int c_buildReportRequireLHPath = 4; public const int c_buildReportViableLHPath = 8; public const int c_buildReportRequireBackFloor = 16; public const int c_buildReportRequirePushBack = 32; public const int c_buildReportRequireTileBack = 64; public static int m_buildReport = 0; public static int m_restoredIce = 0; private static bool m_debugHideIce = false; private static bool m_debugSetPlanTiles = false; private static bool m_playerNearCustomObjects = false; public static int m_stairTowerDefaultStyle = 410; public static int m_stairTowerEntryStyle = 410; public static int m_stairTowerEntryCorridorLength = 1; public static int m_doorStyleDoorMaterial = -5; public static int m_outerWallStyleMask = 4; public static int m_gateToMapX = 0; public static int m_gateToMapY = 0; public static int m_mapRotationToPlan = 0; public static int m_floorPlanNESW = 1; public static int m_icefloorRndNesw = 0; public static bool m_entryConnection = false; public static bool m_roomPlanStoneCeiling = true; public static bool m_roomPlanHasCeiling = true; public static bool m_roomPlanTiledFloor = false; public static float m_torchDensity = 0.5f; public static float m_floorPlanChestChange = 1f; public static float m_doorStyleWallProb = 0.5f; public static float m_doorStyleDoorway = 0.5f; public static float m_doorStyleBlocked = 0.2f; public static float m_doorStyleArchWindow = 0.5f; public static float m_doorStyleCritter = 0.5f; public static float m_doorStyleRoomWoodDoor = 0f; public static float m_doorStyleLoseArchway = 0f; public static float m_doorStyleArchwaySkull = 0.5f; public static float m_ratHoleSpawnDensity = 0.5f; public static float m_ratHoleSpawnUndead = 0f; public static float m_mapMaxWallHeight = 0f; public static float m_mapLowerFloorHeight = 0f; public static float m_mapWallExclusionHeight = 0f; public static int m_roomDecorLevel = 3; public static int m_trapdoorStyle = 1; public static float m_roomDecorFakeItemChance = 0f; public static float m_roomDecorItemStandChance = 0f; public static string m_mapTorch = ""; public static int m_nextDoorHeadstone = 0; public static string m_captureNextPiecePlacedAs = ""; public static string m_addContainerItems = ""; public static char[,] m_floorPlan = null; public static Vector3 m_floorPlanAnchor = Vector3.zero; public static Vector3 m_floorPlanCenter = Vector3.zero; public static Vector3 m_mapLocation = Vector3.zero; public static Vector3 m_trapdoorUpperOffset = Vector3.zero; public static Vector3 m_trapdoorLowerOffset = Vector3.zero; public static Vector3 m_mapBoundsMin = Vector3.zero; public static Vector3 m_mapBoundsMax = Vector3.zero; public static Vector3 m_floorPlanDirectionX = Vector3.zero; public static Vector3 m_floorPlanDirectionY = Vector3.zero; public const int c_pillarStylePlacer = 65535; public const int c_pillarStyleDefault = 128; public const int c_pillarStyleCoffin = 130; public const int c_pillarStyleGlukLit = 131; public const int c_pillarStyleHollow = 3873; public const int c_pillarStyleFull = 1281; public const int c_pillarStyleRandom = 17; public const int c_pillarStylePathMap = 273; public const int c_pillarStyleIceWorm = 407; public const int c_pillarStyleCastle = 1299; public const int c_pillarStyleSewer0 = 129; public const int c_pillarStyleSewer1 = 1041; public const int c_pillarStyleSewer2 = 775; public const int c_pillarStyleSewer3 = 519; public const int c_pillarStyleSewer4 = 551; public const int c_headstoneTall = 0; public const int c_headstoneIceworm = 1; public const int c_headstoneLarva = 2; public const int c_headstoneDrake = 3; public const int c_headstoneDragon = 4; public const int c_headstoneFenrir = 5; public const int c_headstoneVampyre = 6; public const int c_headstoneInsect = 7; public const int c_headstoneHel = 8; public const int c_headstoneSerpent = 9; public const int c_headstoneSkull = 10; public const int c_headstoneHeadOnly = 10; public const int c_headstoneArch = 20; public const int c_containerWood = 1; public const int c_containerStone = 2; public const int c_containerExtra = 3; public static string m_floorPlanSpaceItems = ""; public static string m_levelRoomItems = ""; private static List m_awakeDataPins = new List(); private static List m_awakeDungeonSpawners = new List(); private static List m_awakeDungeonPickables = new List(); private static Dictionary m_awakeProxyData = new Dictionary(); private static Dictionary m_capturedPieces = new Dictionary(); private static Dictionary m_capturedGates = new Dictionary(); private static Dictionary m_customMapDoors = new Dictionary(); private static List m_awakeWorldSpawners = new List(); private static Dictionary m_worldShutters = new Dictionary(); private static Dictionary m_cryptSidedoors = new Dictionary(); private static Dictionary m_worldSprungGates = new Dictionary(); private static Dictionary m_worldSprungGatesDir = new Dictionary(); public static string m_itemstandExchangeItem = ""; private static bool m_checkOOB = false; private static bool m_blockRoomDoorTall = false; private static int m_itemstandLastAttachForced = 0; private static Vector3[] m_dungeonDirection = null; private static Vector3 up = Vector3.up; private static Quaternion m_mapRotation = Quaternion.identity; private static Quaternion[] m_dungeonRotation = null; private static Dictionary m_wallTracker = new Dictionary(); private static Transform m_lastPlaced = null; private static Transform m_lastDataPin = null; private const int c_itemStand_Default = 2; private const int c_itemStand_Inactive = 0; private const int c_itemStand_GiftInactive = -1; private const int c_itemStand_GiftActive = -2; private const int c_itemStand_RejectItem = -3; private const int c_itemStand_RejectDisable = -4; private const float c_lockpickAttemptCooldown = 3f; private const float c_lockpickCountResetCooldown = 35f; private const float c_shutterAnimateTime = 0.5f; private const float c_sidedoorAnimateTime = 0.5f; private static Dictionary m_randomItems = new Dictionary { { "Room1", "RoomUpper,Chest1" }, { "Room2", "RoomUpper,Chest2" }, { "IcewormTunnels", "IceFloor,Remains,Pebbles" }, { "SerpentTunnels", "Pebbles,Remains" }, { "FenringTunnels", "Pebbles,Pebbles,Remains,Props" }, { "FenringRooms", "RoomLower,Cell,Remains" }, { "KeeperQuarters", "Remains" }, { "KeeperCells", "Cell" }, { "Pebbles", "PebbleFine:98,Pickable_pebbles:50,Pickable_Stone:45,Pickable_Mushroom_blue:44" }, { "RoomUpper", "treasure_pile:99,barrell:90,piece_workbench_ext1:80,piece_chair:70,rug_deer:55,cauldron_ext3_butchertable:40,Pickable_DolmenTreasure:35:goblin_bed:30" }, { "RoomLower", "Skull1:90,CargoCrate:85,CastleKit_braided_box01:80,piece_chair:70" }, { "Cell", "bucket:92,goblin_bed:90,LeatherScraps:80,Pickable_ForestCryptRemains04:60" }, { "Remains", "Pickable_ForestCryptRemains01:98,Pickable_ForestCryptRemains02:96,Pickable_ForestCryptRemains03:94,Skull1:90,BoneFragments:85,RoundLog:83,Wood:80,Feathers:79" }, { "Chest2", "TreasureChest_mountains:90,shipwreck_karve_chest:80,TreasureChest_meadows_buried:70,loot_chest_stone:60,TreasureChest_trollcave:50,TreasureChest_blackforest:40" }, { "Chest1", "TreasureChest_meadows_buried:90,TreasureChest_forestcrypt:80,TreasureChest_fCrypt:70,TreasureChest_blackforest:60,TreasureChest_trollcave:50,TreasureChest_meadows:40,loot_chest_wood:30" }, { "IceFloor", "treasure_pile:99,Crystal:97,Ruby:95,Coins:91,KnifeChitin:90,SerpentScale:88,Coal:85,Pickable_ForestCryptRemains04:80" }, { "Props", "marker02:95,marker01:90,StatueEvil:85,mudpile_frac:80" } }; private static List m_randomDropOnce = new List { "Sparx", "Bowdacious", "Thorscorn", "PickaxeStone" }; private const string c_randomDropItemsWood = "Thistle;Raspberry:6;CarrotSeeds:3;QueensJam:2;Honey:3;Cloudberry:4;BoarJerky:2;Apples"; private const string c_randomDropItemsStone = "Stone;Mushroom:3;Coal:2;MushroomYellow:2;Acorn:2;MushroomBlue:1;Sausages:4;WolfJerky:2"; private const string c_randomLuckyExtras = "Coins:100;Crystal;BloodPudding;Obsidian;SerpentScale;Truffle:3"; private const string c_randomDropWeapons = "Club;Torch;AxeFlint;ShieldWood;KnifeFlint;Bow;SpearFlint;SwordBronze;MaceIron;SpearChitin"; private const string c_randomDropPotion = "MeadTasty;MeadHealthMinor;MeadStaminaMinor;MeadPoisonResist;MeadFrostResist"; private const string c_randomDropItemsIceRock = "KnifeFlint;WitheredBone;Obsidian;Crystal;SerpentScale;Coins:5;BoneFragments:1,2;LeatherScraps;PebbleSharp:4,3;PebbleRough:4,2;PebbleSmooth:4,2"; private static string[] m_testFloorPlan = new string[17] { "RFFFFF FFFFFFFRRR", "FFFFRFFFF f fRRR", "FR#FF F FF FFRRF", "FFF FF FFFF FFF", "F FFF FF FFF F F", "F F$FFF F FFFFFF", "F FF F Ffff", "FfffSSSF ffFFFfRf", "RF f - f F Ffff", "RRFF - WF FFFF", "RRRFnnn FFFF F", "RRFF FF FFF F", "RFRFF f F FFF", "RFFFF F FFF F ", "=FRFFFFRRFFFFFFFF", "=FRFRRFRRF fff###", "=FFFFFFFFF f##S=f" }; private static int[,] m_testMaze = new int[7, 9] { { 1071, 24582, 17920, 27136, 983583, 985631, 986655, 986143, 986127 }, { 4099, 2, 16385, 1311, 4096, 16393, 0, 197407, 132383 }, { 4099, 527, 8193, 1311, 0, 32778, 799, 2591, 2335 }, { 0, 3, 4161, 6664, 6689, 10753, 0, 65535, 65535 }, { 65535, 2, 1280, 651279, 126991, 126991, 86025, 47, 65535 }, { 815, 16390, 1280, 587343, 916480, 520192, 983808, 195087, 3072 }, { 847873, 327682, 328463, 262912, 264448, 262144, 262144, 454671, 1302 } }; public static string AnalyzePiece(Transform piece, bool dirTorches = false) { //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)piece == (Object)null) { return "AnalyzePiece did not have a transform!"; } string text = ""; string text2 = ""; GameObject val = null; Transform val2 = piece; while ((Object)(object)val2 != (Object)null) { val = ((Component)val2).gameObject; Hoverable component = val.GetComponent(); text = WUTIL.GameName(val) + ((component == null) ? ("/" + component.GetHoverName()) : ""); text2 += text; if ((Object)(object)val2.parent != (Object)null) { text2 += "."; } val2 = val2.parent; } if ((Object)(object)val.GetComponent() != (Object)null) { text = text + " Health: " + val.GetComponent().m_health; } else if ((Object)(object)val.GetComponent() != (Object)null) { text = text + " Health: " + val.GetComponent().m_health; } else if ((Object)(object)val.GetComponent() != (Object)null) { text = text + " Health: " + val.GetComponent().m_health; } if ((Object)(object)val.GetComponent() != (Object)null) { text = text + " (" + ((object)Unsafe.As(ref val.GetComponent().m_itemData.m_shared.m_itemType)/*cast due to .constrained prefix*/).ToString() + ")"; } if (!World.PlayerInInterior()) { return text; } string text3 = $"{text2} at {piece.position} scale: {piece.localScale} "; if (OutOfBounds(piece.position)) { text3 += "is beyond blackbox"; } else { GetPlanTileXY(piece.position, out var ix, out var iy); text3 += $"under tile: '{GetPlanTile(ix, iy)}' at {ix},{iy}"; } WDBUG.Log(text3); if (dirTorches) { Torch("TorchCrystal", piece.position + piece.forward); Torch("piece_groundtorch_green", piece.position + piece.right); Torch("piece_groundtorch_blue", piece.position + piece.up); } return text; } public static void UpdateShutters(float dt) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (m_worldShutters.Count <= 0) { return; } float num = 90f * dt / 0.5f; KeyValuePair[] array = m_worldShutters.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; float num2 = ((keyValuePair.Value > 0.5f) ? (keyValuePair.Value - 0.5f) : keyValuePair.Value); if ((int)(1000f * num2) > 0) { Transform key = keyValuePair.Key; key.rotation *= Quaternion.AngleAxis((keyValuePair.Value > 0.5f) ? num : (0f - num), Vector3.up); m_worldShutters[keyValuePair.Key] -= dt; } else { m_worldShutters.Remove(keyValuePair.Key); } } } public static void UpdateSprungGates(float dt) { //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) KeyValuePair[] array = m_worldSprungGates.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; if (keyValuePair.Value > dt) { m_worldSprungGates[keyValuePair.Key] -= dt; continue; } Transform parent = keyValuePair.Key.parent; Transform val = ((parent != null) ? parent.parent : null); Door val2 = ((val != null) ? ((Component)val).gameObject.GetComponent() : null); if ((Object)(object)val2 == (Object)null) { WDBUG.Log("Did not relocate sprung door"); m_worldSprungGates.Remove(keyValuePair.Key); continue; } Transform val3 = val.Find("reference"); if ((Object)(object)val3 == (Object)null) { WDBUG.Log("Sprung gate did not have closed reference point"); m_worldSprungGates.Remove(keyValuePair.Key); continue; } Vector3 val4 = val3.position - parent.position; Vector3 normalized = ((Vector3)(ref val4)).normalized; Collider[] array2 = Physics.OverlapSphere(parent.position, 0.8f, WUTIL.c_characterRayMask); foreach (Collider val5 in array2) { if (Vector3.Dot(((Component)val5).transform.position - parent.position, normalized) >= 0f) { m_worldSprungGates[keyValuePair.Key] = 0.1f; return; } } WDBUG.Log("Sprung gate auto-close", WDBUG.Level.World); val2.Interact((Humanoid)(object)Player.m_localPlayer, false, false); } } public static void UpdateSidedoors(float dt) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (m_cryptSidedoors.Count <= 0) { return; } float num = 90f * dt / 0.5f; KeyValuePair[] array = m_cryptSidedoors.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; float num2 = ((keyValuePair.Value > 0.5f) ? (keyValuePair.Value - 0.5f) : keyValuePair.Value); if ((int)(1000f * num2) > 0) { Transform key = keyValuePair.Key; key.rotation *= Quaternion.AngleAxis((keyValuePair.Value > 0.5f) ? (0f - num) : num, Vector3.up); m_cryptSidedoors[keyValuePair.Key] -= dt; } else { m_cryptSidedoors.Remove(keyValuePair.Key); } } } public static void EnablePatched(bool enable) { m_playerNearCustomObjects = enable; } public static void MapInitialize(Vector3 position, Quaternion rotation, string torch = "") { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0109: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) if (position == Vector3.zero) { m_mapLocation = ((Component)Player.m_localPlayer).transform.position; m_mapRotation = Quaternion.identity; } else { m_mapLocation = position; m_mapRotation = rotation; } m_mapTorch = torch; m_mapMaxWallHeight = m_mapLocation.y - 3.5f; m_mapLowerFloorHeight = m_mapLocation.y - 9.9f; m_dungeonRotation = (Quaternion[])(object)new Quaternion[4]; m_dungeonRotation[0] = m_mapRotation; m_dungeonRotation[1] = Quaternion.LookRotation(m_mapRotation * Vector3.right); m_dungeonRotation[2] = Quaternion.LookRotation(m_mapRotation * Vector3.back); m_dungeonRotation[3] = Quaternion.LookRotation(m_mapRotation * Vector3.left); m_dungeonDirection = (Vector3[])(object)new Vector3[4]; for (int i = 0; i < 4; i++) { m_dungeonDirection[i] = m_dungeonRotation[i] * Vector3.forward; } m_floorPlanAnchor = m_mapLocation + m_dungeonDirection[0]; m_floorPlanNESW = 1; m_floorPlanDirectionX = m_dungeonDirection[m_floorPlanNESW]; m_floorPlanDirectionY = m_dungeonDirection[(m_floorPlanNESW + 1) & 3]; } public static void DestroyDungeon(Vector3 center, float maxRange = 50f, Transform ignore = null, float baseHeight = 4900f, float peakHeight = 9999f, bool drops = false, bool proxies = false, bool cryptFilter = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0321: 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) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) if (center == Vector3.zero) { center = ((Component)Player.m_localPlayer).transform.position; } WDBUG.Log($"DestroyDungeon: {center} radius: {maxRange} base: {baseHeight} peak: {peakHeight}", WDBUG.Level.Dungeon); float num = 0f; string arg = ""; Dictionary dictionary = new Dictionary(); Dictionary dictionary2 = new Dictionary(); Collider[] array = Physics.OverlapSphere(center, maxRange, WUTIL.c_dungeonPiecesDestroyMask); foreach (Collider val in array) { Transform val2 = (((Object)(object)val == (Object)null) ? null : ((Component)val).transform); if ((Object)(object)val2 == (Object)null) { WDBUG.Log("Skiping null collider or transform"); continue; } bool flag = false; while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; if (cryptFilter) { string text = WUTIL.GameName(((Component)val2).gameObject); if (text.StartsWith("CastleKit") || text.StartsWith("root") || text.StartsWith("Vegvisir") || text.StartsWith("SunkenKit") || text.StartsWith("mud") || text.StartsWith("sunkencrypt")) { flag = text.StartsWith("TreasureChest") || !((Object)val2).name.Contains("braided"); break; } } } if ((Object)(object)val2 == (Object)(object)ignore || flag) { continue; } GameObject gameObject = ((Component)val2).gameObject; if ((Object)(object)gameObject.GetComponent() != (Object)null) { continue; } string text2 = WUTIL.GameName(gameObject); if ((Object)(object)gameObject.GetComponent() != (Object)null && gameObject.GetComponent().GetCreator() != 0) { if (dictionary2.ContainsKey(gameObject)) { WDBUG.Log("Ignoring player placed piece " + text2, WDBUG.Level.Dungeon); dictionary2.Add(gameObject, value: true); } } else if ((Object)(object)gameObject.GetComponent() != (Object)null && gameObject.GetComponent().m_itemData.m_crafterID != 0) { if (dictionary2.ContainsKey(gameObject)) { WDBUG.Log("Ignoring player crafted item " + text2, WDBUG.Level.Dungeon); dictionary2.Add(gameObject, value: true); } } else { if (text2.StartsWith("cave") || text2.Contains("Mountain") || text2.StartsWith("hanging_") || text2.StartsWith("Spawner") || text2.Contains("Proxy") || dictionary.ContainsKey(gameObject)) { continue; } bool flag2 = val2.position.y >= baseHeight && val2.position.y <= peakHeight; if (text2 == "Spawner_DraugrPile") { WDBUG.Log($"Deleting Spawner_DraugrPile deleteMe: {flag2}"); flag2 = true; } if (!flag2 && maxRange > 200f) { continue; } if (WUTIL.IsWildlingObject(gameObject)) { flag2 = true; } else if ((Object)(object)gameObject.GetComponent() != (Object)null) { if (gameObject.GetComponent().IsPlayer() || text2 == "Ygnie") { continue; } flag2 |= text2 == "Rat" || !cryptFilter; } else if ((Object)(object)gameObject.GetComponent() != (Object)null) { flag2 = flag2 || drops; } else if (text2 == "Skull1" || text2 == "StatueEvil") { flag2 = true; } else if (text2.StartsWith("FirTree") || text2 == "DrakeNest01") { flag2 = true; } else if ((Object)(object)gameObject.GetComponent() != (Object)null || (Object)(object)gameObject.GetComponent() != (Object)null || (Object)(object)gameObject.GetComponent() != (Object)null || (Object)(object)gameObject.GetComponent() != (Object)null || (Object)(object)gameObject.GetComponent() != (Object)null) { flag2 = true; } if (flag2) { dictionary.Add(gameObject, value: true); float num2 = Vector3.Distance(val2.position, center); if (num2 > num) { num = num2; arg = text2; } } } } WDBUG.Log($"Deleting {dictionary.Count} objects, maxDist: {num} {arg}", WDBUG.Level.Dungeon); GameObject[] array2 = dictionary.Keys.ToArray(); foreach (GameObject val3 in array2) { if ((Object)(object)val3 != (Object)null) { WUTIL.Destroy(val3); } } if (proxies) { DeleteDungeonProxies(baseHeight, peakHeight, cryptFilter); } } private static void DeleteDungeonProxies(float baseHeight = 0f, float peakHeight = 9999f, bool cryptFilter = false) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) WDBUG.Log($"Deleting Spawners: {m_awakeDungeonSpawners.Count} Pickables: {m_awakeDungeonPickables.Count} DataPins: {m_awakeProxyData.Count}", WDBUG.Level.Dungeon); Transform[] array = m_awakeDungeonPickables.ToArray(); foreach (Transform val in array) { if ((Object)(object)val != (Object)null && (!cryptFilter || ((Object)((Component)val).gameObject).name.Contains("ForestCryptRemains")) && !((Object)((Component)val).gameObject).name.Contains("MountainCave") && val.position.y >= baseHeight && val.position.y < peakHeight) { WUTIL.Destroy(((Component)val).gameObject); } } Transform[] array2 = m_awakeDungeonSpawners.ToArray(); foreach (Transform val2 in array2) { if ((Object)(object)val2 != (Object)null) { WUTIL.Destroy(((Component)val2).gameObject); } } GameObject[] array3 = m_awakeDataPins.ToArray(); foreach (GameObject val3 in array3) { if ((Object)(object)val3 != (Object)null) { WUTIL.Destroy(val3); } } m_awakeDungeonPickables.Clear(); m_awakeDungeonSpawners.Clear(); m_awakeDataPins.Clear(); m_awakeProxyData.Clear(); m_capturedPieces.Clear(); m_capturedGates.Clear(); m_customMapDoors.Clear(); } public static bool RestoreMinablesReady(Vector3 center, float maxRange = 50f, int minIce = 60) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) List list = new List(); Collider[] array = Physics.OverlapSphere(center, maxRange, WUTIL.c_dungeonPieceRestoreMask); foreach (Collider val in array) { Transform val2 = ((Component)val).transform; if (!((Object)(object)val2 == (Object)null)) { while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; } if ((Object)(object)((Component)val2).gameObject.GetComponent() != (Object)null && !list.Contains(val2)) { list.Add(val2); } } } WDBUG.Log($"RestoreReady found {list.Count}/{minIce} minables", WDBUG.Level.Dungeon); return list.Count >= minIce; } public static int RestoreDungeon(Vector3 center, float maxRange = 50f, bool solidify = false, bool debug = false) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) if (debug) { WDBUG.Log($"RestoreDungeon {center} radius: {maxRange} solidify: {solidify}", WDBUG.Level.Dungeon); } m_restoredIce = 0; Dictionary dictionary = new Dictionary(); Collider[] array = Physics.OverlapSphere(center, maxRange, WUTIL.c_dungeonPieceRestoreMask); foreach (Collider val in array) { Transform val2 = ((Component)val).transform; if ((Object)(object)val2 == (Object)null) { continue; } while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; } GameObject gameObject = ((Component)val2).gameObject; if (solidify && ((Object)gameObject).name.StartsWith("stone_stair")) { Solidify(gameObject); } string text = GetPinDataAt(val2.position); if (text == "") { Container component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_privacy = (PrivacySetting)2; WDBUG.Log($"Re-custom container for {component.GetInventory().NrOfItems()} items", WDBUG.Level.Dungeon); } else if (((Object)gameObject).name.StartsWith("barrel")) { text = BarrelData(); WDBUG.Log("Reset barrel data: " + text, WDBUG.Level.Dungeon); CustomizeContainer(val2, text); } else if (((Object)gameObject).name.Contains("ElderChest") || ((Object)gameObject).name.Contains("AmberCasing")) { WDBUG.Log($"Restore detected {((Object)gameObject).name} at {val2.position}", WDBUG.Level.Dungeon); } } else { if (dictionary.ContainsKey(val2)) { continue; } dictionary.Add(val2, value: false); if (solidify) { Solidify(gameObject); } string text2 = ""; if ((Object)(object)gameObject.GetComponent() != (Object)null) { int num = text.IndexOf(':'); if (num > 0) { text2 = "Door"; CaptureGate(val2, text); text = text.Substring(num + 1); } if (CustomizeScale(val2, text, pinData: false)) { text2 = "Door scale"; } } else if (CustomizeItemStand(gameObject, text, attachItem: false)) { text2 = "ItemStand"; } else if (CustomizeContainer(val2, text)) { text2 = "Container"; } else if (CustomizeMinable(gameObject, text, pinData: false)) { text2 = "Minable"; m_restoredIce++; } else if (CustomizePickable(gameObject, text, pinData: false)) { text2 = "Pickable"; } else { if (CustomizeTable(val2, text) || CustomizeFloor(val2, text) || CustomizeHeadstone(val2, text) || CustomizeScale(val2, text, pinData: false)) { continue; } text2 = "object"; CaptureAs(text, gameObject.transform, pinData: false); } if (debug && text2 != "") { WDBUG.Log("Restore custom " + text2 + " " + WUTIL.GameName(gameObject) + " with " + text); } } } return dictionary.Count; } public static float HeightAboveTerrain(Vector3 pos, float maxDepth = 9999f, float groundOffset = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(pos + 100f * up, Vector3.down, ref val, 100f + maxDepth, WUTIL.c_terrainRayMask)) { return pos.y - ((RaycastHit)(ref val)).point.y + groundOffset; } return 0f - maxDepth; } public static void SyncRotation(string pieceName) { //IL_0022: 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_002a: Unknown result type (might be due to invalid IL or missing references) if (m_capturedPieces.ContainsKey(pieceName)) { Quaternion rotation = m_capturedPieces[pieceName].rotation; World.SendServerRequest("SetRot", pieceName, ((Quaternion)(ref rotation)).eulerAngles); } } public static void SyncPosition(string pieceName) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (m_capturedPieces.ContainsKey(pieceName)) { World.SendServerRequest("SetPos", pieceName, m_capturedPieces[pieceName].position); } } public static void SetRotation(string pieceName, Vector3 eular) { //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) if (m_capturedPieces.ContainsKey(pieceName)) { WDBUG.Log("SetRotation for trigger piece: " + pieceName, WDBUG.Level.Dungeon); m_capturedPieces[pieceName].rotation = Quaternion.Euler(eular); } } public static void SetPosition(string pieceName, Vector3 position) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (m_capturedPieces.ContainsKey(pieceName)) { WDBUG.Log("SetPosition for trigger piece: " + pieceName, WDBUG.Level.Dungeon); m_capturedPieces[pieceName].position = position; } } public static bool GetCapturedPieceData(string pieceName, string data, ref Vector3 vec) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (m_capturedPieces.ContainsKey(pieceName)) { if (data.EndsWith("Pos")) { vec = m_capturedPieces[pieceName].position; return true; } if (data.EndsWith("Rot")) { Quaternion rotation = m_capturedPieces[pieceName].rotation; vec = ((Quaternion)(ref rotation)).eulerAngles; return true; } } return false; } public static bool SetCapturedPieceData(string pieceName, string data, Vector3 vec) { //IL_002c: 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_0053: Unknown result type (might be due to invalid IL or missing references) if (m_capturedPieces.ContainsKey(pieceName)) { if (data.EndsWith("Pos")) { m_capturedPieces[pieceName].position = vec; return true; } if (data.EndsWith("Rot")) { m_capturedPieces[pieceName].rotation = Quaternion.Euler(vec); return true; } } return false; } public static void FloorPlanFromPlan(string[] floorPlan = null) { int num = 18; int num2 = 18; if (floorPlan != null && floorPlan.Length != 0) { num = Math.Min(num2, floorPlan.Length); num2 = Math.Min(num, floorPlan[0].Length); } m_floorPlan = new char[num, num2]; m_gateToMapX = -num / 2; m_gateToMapY = -num2 / 2; if (floorPlan != null) { for (int i = 0; i < num2; i++) { for (int j = 0; j < num; j++) { MarkPlanTile(floorPlan[j][i], j, i); } } } for (int k = 0; k < num; k++) { for (int l = 0; l < num2; l++) { if (m_floorPlan[k, l] == '\0') { m_floorPlan[k, l] = ' '; } } } m_checkOOB = false; } public static bool FloorPlanFromRoomMarkers(List roomMarkers, bool showDebug = false) { //IL_007e: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) int num = 18; int num2 = 18; m_gateToMapX = (m_gateToMapY = -9); m_floorPlan = new char[num, num2]; for (int i = 0; i < num; i++) { for (int j = 0; j < num2; j++) { MarkPlanTile(' ', i, j); } } int num3 = 999; int num4 = 0; int num5 = 999; int num6 = 0; foreach (Vector3 roomMarker in roomMarkers) { if (OutOfBounds(roomMarker)) { continue; } if (!GetPlanTileXY(roomMarker, out var ix, out var iy)) { WDBUG.Log($"Piece at {roomMarker} was out-of-bounds at {ix},{iy}", WDBUG.Level.Dungeon); continue; } MarkPlanTile('F', ix, iy); if (ix < num3) { num3 = ix; } if (ix > num4) { num4 = ix; } if (iy < num5) { num5 = iy; } if (iy > num6) { num6 = iy; } } int num7 = num4 - num3 + 1; int num8 = num6 - num5 + 1; if (Mathf.Min(num7, num8) <= 6) { WDBUG.Log($"Floor plan {num7} x {num8} is not large enough", WDBUG.Level.Dungeon); return false; } m_checkOOB = true; return true; } public static bool FloorPlanMakePath(Vector3 srtPos, Vector3 endPos, int sideRoomDepth = 0, int maxCritters = 0, bool showDebug = false, string critters = "Rat,Skeleton,Ghost,Skeleton_Poison,Draugr") { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) if (!GetPlanTileXY(srtPos, out var ix, out var iy)) { WDBUG.Log($"FloorPlanMakePath srtPos OOB at {ix}, {iy}"); return false; } if (!GetPlanTileXY(endPos, out var ix2, out var iy2)) { WDBUG.Log($"FloorPlanMakePath endPos OOB at {ix2}, {iy2}"); return false; } if (showDebug) { WDBUG.Log($"Path: ({ix},{iy})->({ix2},{iy2}) sideDepth: {sideRoomDepth} critters: {maxCritters}"); } int num = sideRoomDepth - 1; List list = new List(); List list2 = new List(); int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; bool flag = false; while (num5 < 3) { if (num4 == 0 || flag) { int num6 = ix2 - ix; int num7 = iy2 - iy; num2 = ((num6 > 0) ? 1 : (-1)); num3 = ((num7 > 0) ? 1 : (-1)); if (Mathf.Abs(num6) >= Mathf.Abs(num7)) { if (num6 == 0) { break; } num3 = 0; num4 = 1 + (Mathf.Abs(num6) >> 1); } else { num2 = 0; num4 = 1 + (Mathf.Abs(num7) >> 1); } if (flag) { num2 *= -1; num3 *= -1; ix += num2; iy += num3; num4 = 1; flag = false; if (showDebug) { WDBUG.Log($"Path regress at fail {num5} to {ix},{iy} then 1 step dir: {num2},{num3}"); } } else if (showDebug) { WDBUG.Log($"New path for {num4} steps at {ix},{iy} dir: {num2},{num3}"); } } char planTile = GetPlanTile(ix + num2, iy + num3); if (planTile == 'F') { if (showDebug) { WDBUG.Log($"Path ended early at {ix + num2},{iy + num3} on tile '{planTile}'"); } break; } if (planTile == ' ' || planTile == 'R') { ix += num2; iy += num3; MarkPlanTile('F', ix, iy); num4--; num5 = 0; if (showDebug) { WDBUG.Log($"Path floor at {ix},{iy} on tile: '{planTile}'"); } list2.Add((ix << 8) + iy); for (int i = 0; i < sideRoomDepth; i++) { int num8 = ix + i * num3; int num9 = iy + i * num2; if (GetPlanTile(num8, num9) == ' ') { m_floorPlan[num8, num9] = 'R'; if (showDebug) { WDBUG.Log($"Path room at {num8},{num9} cell: {i == num}"); } if (i == num) { list.Add((ix << 8) + num9); } } num8 = ix - i * num3; num9 = iy - i * num2; if (GetPlanTile(num8, num9) == ' ') { m_floorPlan[num8, num9] = 'R'; if (showDebug) { WDBUG.Log($"Path room at {num8},{num9} cell: {i == num}"); } if (i == num) { list.Add((num8 << 8) + num9); } } } } else if (++num5 == 1) { if (num2 == 0) { num2 = ((ix2 > ix) ? 1 : (-1)); num3 = 0; } else { num2 = 0; num3 = ((iy2 > iy) ? 1 : (-1)); } num4 = 1; if (showDebug) { WDBUG.Log($"Blocked {num5} at {ix},{iy} by tile: '{planTile}', new dir: {num2},{num3}"); } } else { flag = true; } } if (sideRoomDepth > 0) { foreach (int item in list2) { MarkPlanTile('F', item >> 8, item & 0xFF); } } else { list = list2; } if (maxCritters <= 0 || critters == "" || num5 >= 3) { return num5 < 3; } string[] array = critters.Split(new char[1] { ',' }); int num10 = Mathf.Max(1, array.Length - sideRoomDepth); int num11 = list.Count; maxCritters = Mathf.Min(maxCritters, num11); int num12 = 0; while (num11 > 0 && num12 < maxCritters) { int index = WUTIL.DieRoll(num11); int num13 = list[index]; list[index] = list[--num11]; Vector3 planTilePos = GetPlanTilePos(num13 >> 8, num13 & 0xFF); int num14 = WUTIL.DieRoll(num10); Spawner(array[num14], planTilePos); if (showDebug) { WDBUG.Log($"Placed prisoner {num14}+Rnd({num10}) {array[num14]} in cell ({num12 + 1}/{maxCritters})"); } num12++; } return true; } public static Vector3 FloorPlanEdgeExit(float floorHeight = 0f, int style = 1, bool showDebug = false) { //IL_0281: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0323: 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_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0319: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00d1: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) if (floorHeight <= 0f) { floorHeight = m_mapLowerFloorHeight; } int num = -1; int num2 = 0; int num3 = 9; for (int i = 0; i < 4; i++) { string torch = i switch { 2 => "piece_groundtorch", 1 => "piece_groundtorch_green", 0 => "piece_groundtorch_blue", _ => "TorchCrystal", }; Vector3 val = 4f * MapFwd(i); Vector3 val2 = 4f * MapFwd(i + 1); Vector3 val3 = m_floorPlanCenter + 9f * val; int num4 = -3; int num5 = 9; for (int j = 0; j < 9; j++, val3 -= val) { char planTile = GetPlanTile(val3); if (planTile == '0') { continue; } int planTile2 = GetPlanTile(val3 + val2); int planTile3 = GetPlanTile(val3 - val2); if (planTile != ' ' || planTile2 != 32 || planTile3 != 32) { if (planTile == '-') { WDBUG.Log($"Edge exit blocked by special tile in dir: {i}"); num4 = -1; break; } if (planTile == 'R') { SetPlanTiles(val3, 'F'); } if (planTile2 == 82) { SetPlanTiles(val3 + val2, 'F'); } if (planTile3 == 82) { SetPlanTiles(val3 - val2, 'F'); } num5 = j; break; } if (num4 < 0) { if (++num4 < 0) { continue; } num4 = j; } val3.y = floorHeight; if (showDebug) { Torch(torch, val3); } } if (num4 >= 0 && (num < 0 || num5 < num3 || (num5 == num3 && WUTIL.TestLuck(0.4f)))) { num3 = num5; num2 = num4; num = i; } } if (num < 0) { WDBUG.Log("FloorPlanEdgeExit did not find a suitable coffin room", WDBUG.Level.Dungeon); return Vector3.zero; } num3 = 9 - num3; num2 = 9 - num2; if (showDebug) { WDBUG.Log($"FloorPlanEdgeExit returned pos for dir: {num} from {num3}-{num2}"); } Vector3 val4 = m_floorPlanCenter + (float)(num2 * 4) * MapFwd(num); val4.y = floorHeight; if (style > 0) { SetPlanTiles(val4, 'F', num + 2, num2 - num3 + 1); SetPlanTiles(val4, '.', num, 2); LevelConnectorRoom(val4, num, style); } return val4; } public static void LevelConnectorRoom(Vector3 position, int nesw, int style) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0028: 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_0031: 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_003d: 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) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0554: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d6: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0301: 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) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0332: 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_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Unknown result type (might be due to invalid IL or missing references) //IL_065b: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_0687: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_077e: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Unknown result type (might be due to invalid IL or missing references) //IL_0741: Unknown result type (might be due to invalid IL or missing references) //IL_074b: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0a22: Unknown result type (might be due to invalid IL or missing references) //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a25: Unknown result type (might be due to invalid IL or missing references) //IL_0a2f: Unknown result type (might be due to invalid IL or missing references) //IL_0a30: Unknown result type (might be due to invalid IL or missing references) //IL_0a35: Unknown result type (might be due to invalid IL or missing references) //IL_0a4c: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a4f: Unknown result type (might be due to invalid IL or missing references) //IL_0a59: Unknown result type (might be due to invalid IL or missing references) //IL_0a5a: Unknown result type (might be due to invalid IL or missing references) //IL_0a5f: Unknown result type (might be due to invalid IL or missing references) //IL_0a7b: Unknown result type (might be due to invalid IL or missing references) //IL_0a8e: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0a90: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0a9b: Unknown result type (might be due to invalid IL or missing references) //IL_0aa0: Unknown result type (might be due to invalid IL or missing references) //IL_0ab7: Unknown result type (might be due to invalid IL or missing references) //IL_0796: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07c0: Unknown result type (might be due to invalid IL or missing references) //IL_07c1: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_07d3: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_07f1: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_0800: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0821: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Unknown result type (might be due to invalid IL or missing references) //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_0837: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) //IL_0851: Unknown result type (might be due to invalid IL or missing references) //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_086c: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_087b: Unknown result type (might be due to invalid IL or missing references) //IL_087c: Unknown result type (might be due to invalid IL or missing references) //IL_0881: Unknown result type (might be due to invalid IL or missing references) //IL_0896: Unknown result type (might be due to invalid IL or missing references) //IL_089d: Unknown result type (might be due to invalid IL or missing references) //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08a8: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08bd: Unknown result type (might be due to invalid IL or missing references) //IL_08d0: Unknown result type (might be due to invalid IL or missing references) //IL_08d7: Unknown result type (might be due to invalid IL or missing references) //IL_08d8: Unknown result type (might be due to invalid IL or missing references) //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_08e8: Unknown result type (might be due to invalid IL or missing references) //IL_08ed: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_0906: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_091f: Unknown result type (might be due to invalid IL or missing references) //IL_0920: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_092f: Unknown result type (might be due to invalid IL or missing references) //IL_0930: Unknown result type (might be due to invalid IL or missing references) //IL_0935: Unknown result type (might be due to invalid IL or missing references) //IL_094b: Unknown result type (might be due to invalid IL or missing references) //IL_0952: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0958: Unknown result type (might be due to invalid IL or missing references) //IL_095d: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_0971: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_09ae: Unknown result type (might be due to invalid IL or missing references) //IL_09af: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09bb: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Unknown result type (might be due to invalid IL or missing references) //IL_09ca: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_09e2: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Unknown result type (might be due to invalid IL or missing references) //IL_09fa: Unknown result type (might be due to invalid IL or missing references) //IL_09ff: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Unknown result type (might be due to invalid IL or missing references) //IL_0b2e: Unknown result type (might be due to invalid IL or missing references) //IL_0b34: Unknown result type (might be due to invalid IL or missing references) //IL_0b35: Unknown result type (might be due to invalid IL or missing references) //IL_0b3a: Unknown result type (might be due to invalid IL or missing references) //IL_0b44: Unknown result type (might be due to invalid IL or missing references) //IL_0b45: Unknown result type (might be due to invalid IL or missing references) //IL_0b4a: Unknown result type (might be due to invalid IL or missing references) //IL_0b54: Unknown result type (might be due to invalid IL or missing references) //IL_0b59: Unknown result type (might be due to invalid IL or missing references) //IL_0b5e: Unknown result type (might be due to invalid IL or missing references) //IL_0b00: Unknown result type (might be due to invalid IL or missing references) //IL_0b06: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_0b0c: Unknown result type (might be due to invalid IL or missing references) if (style <= 0) { return; } Vector3 val = position; Vector3 val2 = MapFwd(nesw); Vector3 val3 = 4f * val2; Vector3 val4 = MapFwd(nesw + 1); Vector3 val5 = 4f * val4; Vector3 val6 = 1.75f * val2 + 2f * val4; bool flag = style == 3; if (flag) { position = Staircase(val, nesw, 14, 2, 2, 14, down: true, -1, -1, -1, -1, 1) - val6; Floor(position, nesw, 3.99f, 0, 1, ceiling: true); Floor(position - val3, nesw, 3.99f, 0, 1, ceiling: true); Floor(position + val5, nesw, 3.99f, 0, 1, ceiling: true); Floor(position - val3 + val5, nesw, 3.99f, 0, 1, ceiling: true); Floor(position + 3f * val2 - val4, nesw, 3.99f, 1, 3, ceiling: true); Stairs(position - 7f * val2 - 0.5f * up, nesw, 2f); CaptureNextPlacedAs("room_door"); Piece("wood_door", position + 2.05f * val2 - 0.75f * val4 + 1.5f * up, nesw); CaptureCapturedGate("goak_wood_lft", "pickable", "room_door"); Floor(position + 2.75f * val2 - val4, nesw, 3f, 1); Floor(position + val3, nesw); Floor(position + 7f * val2 - val4, nesw, 0f, 2); Wall(position + 6.75f * val2 + 0.5f * val4, nesw + 1, 1, 2, -0.5f); Chest("piece_chest_private", position + 7f * val2 - 0.5f * val4, nesw + 2, 0.5f, 3); CaptureNextPlacedAs("room_door2"); Piece("wood_door", position + 2.05f * val2 + 4.5f * val4 + 1.5f * up, nesw + 2); CaptureCapturedGate("goak_wood_lft", "pickable", "room_door2"); Floor(position + 2.75f * val2 + 4.5f * val4, nesw, 3f, 1); FloorPartial(position + 3f * val2 + 2f * val4, nesw, 1, 6, -0.5f); Stairs(position + 3f * val2 + 4.5f * val4 - 0.41f * up, nesw + 2, 1f, 2); Chest("TreasureChest_trollcave", position + 5.5f * val2 + 1.5f * val4, nesw - 1, 0.5f, 3); Barrel(position + 7f * val2 + 4.5f * val4, nesw, 0f, 0.5f); Barrel(position + 5f * val2 + 4f * val4, nesw, 0f, 0.5f); Barrel(position + 3f * val2 + 3f * val4, nesw + 2); } else { val += 1.75f * val4 - 2.25f * val2 + 0.02f * up; Floor(position - val3 - val5, nesw, -0.05f, 0, 1, ceiling: true); Floor(position - 2f * val3 - val5, nesw, -0.05f, 0, 1, ceiling: true); Pillar(position + 0.5f * (val5 - val3) + up); position = Staircase(val, nesw, 2, 2, 2, 0, down: true) - val6; Wall(position + 2f * val2 - val4, nesw, 1, 2); } Floor(position); Floor(position + val5); Floor(position - val3); Floor(position - val3 + val5); if (style == 2) { Floor(position + val3 + val5); Floor(position + 7f * val2 + 5f * val4, 0, 0f, 1); Wall(position + 4.25f * val2 + 4f * val4 + 0.4f * up, nesw, 1, 1); Wall(position + 4.75f * val2 + 5.5f * val4 + 0.4f * up, nesw + 1, 1, 1); CaptureNextPlacedAs("room_door"); Piece("iron_grate", position + 1.9f * val2 + 4.5f * val4 + 1.4f * up, nesw + 2); CaptureCapturedGate("crypt_elder_gate", "pickable", "room_door"); } else if (!flag) { Wall(position + 2f * val2 + 4.5f * val4, nesw, 1, 2); } position += 2f * val4 - 2f * val2; if (flag) { Wall(position + val5 + 9f * val2, nesw + 1, 7, 2); Wall(position - val5 - 3f * val2, nesw - 1, 7, 2); Wall(position + 10f * val2 - 2.5f * val4, nesw, 4, 2); Vector3 val7 = position + 10f * val2 + 4.5f * val4; FloorPartial(val7, nesw + 2, 1, 16, 4.5f); FloorPartial(val7, nesw + 2, 1, 16, -0.5f); FloorPartial(val7 - 0.5f * val2 + 0.5f * val4, nesw + 2, 1, 6, -1.5f); val7 -= 9f * val4; FloorPartial(val7, nesw + 2, 1, 16, 4.5f); FloorPartial(val7, nesw + 2, 1, 16, -0.5f); val7 += 1.5f * val4 + 0.5f * val2; FloorPartial(val7, nesw + 1, 1, 8, 4.5f); FloorPartial(val7, nesw + 1, 1, 8, -0.5f); FloorPartial(val7 + 0.5f * val2 - 0.5f * val4, nesw + 1, 1, 10, -1.5f); val7 -= 15f * val2; FloorPartial(val7, nesw + 1, 1, 8, 4.5f); FloorPartial(val7, nesw + 1, 1, 8, -0.5f); Wall(position - val3 + 3f * val4, nesw + 2, 2, 2); RoomDoor(-8, position - val3 - 2f * val4 + 1.5f * up, nesw + 2, 2f * val4); Piece("hearth", position + 0.5f * up, nesw); } else { Wall(position + val5 + 3f * val2, nesw + 1, 4, 2); Wall(position - val5 - 3f * val2, nesw - 1, 4, 2); Torch("TorchCrystal", position, -2f); Wall(position - val3 + 3f * val4, nesw + 2, 4, 2); Coffin(position, nesw + 1, empty: false, 3.5f, 3.25f, (style == 2) ? 5 : WUTIL.DieRoll(15)); int num = WUTIL.DieRoll(4); if (num < 2) { Spawner((num == 0) ? "RatDraugr" : "Draugr", position + 3f * val2); } if (style == 2) { Piece("GreatOakEmblem", position + 6.2f * val2 + 2.5f * val4 + 2f * up, nesw + 2); } } } private static void FloorPlanModify(Vector3 position) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0041: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a0: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_00ff: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: 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: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) int floorPlanNESW = m_floorPlanNESW; Vector3 val = 4f * MapFwd(floorPlanNESW); Vector3 val2 = 4f * MapFwd(floorPlanNESW + 1); Headstone(position + 0.25f * val - 0.95f * val2, 20, floorPlanNESW + 1, 2.3f); m_mapLowerFloorHeight -= 6f; SetPlanTiles(position, 'R', floorPlanNESW, -4, 7); SetPlanTiles(position, 'W'); SetPlanTiles(position - val2, '-', floorPlanNESW, 1, -2); SetPlanTiles(position - 3f * val2, 'f'); Chest("TreasureChest_trollcave", position + 0.15f * val - 3.5f * val2, floorPlanNESW + 3, -0.5f); SetPlanTiles(position - val - 2f * val2, ' ', floorPlanNESW, 1, 4); SetPlanTiles(position + val, 'R', floorPlanNESW, 1, -3); SetPlanTiles(position + val2, 'F', floorPlanNESW, 1, 2); SetPlanTiles(position + val + val2, ' ', floorPlanNESW, 1, 2); SetPlanTiles(position + 3f * val2, ' ', floorPlanNESW, -2); SetPlanTiles(position + 2f * val2 + val, 'F', floorPlanNESW, -5); SetPlanTiles(position + 2f * val2 - 5f * val, ' ', floorPlanNESW); SetPlanTiles(position + 3f * val2 - 2f * val, 'F', floorPlanNESW, 1, 3); Spawner("Witherin", position + 5f * val2 - 2f * val); m_mapLowerFloorHeight += 6f; } public static void Object(string name, Vector3 position, float size = 1f) { //IL_0002: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //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) GameObject val = WUTIL.PlaceObject(name, position); if (!((Object)(object)val == (Object)null)) { m_lastPlaced = val.transform; if (size >= 0f && size != 1f) { m_lastPlaced.localScale = size * Vector3.one; m_lastPlaced.LookAt(val.transform.position, Vector3.forward); } } } public static void Piece(string name, Vector3 position, Quaternion rotation, bool dropPin = true) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) string text = name; switch (name) { case "low_irongate": text = "dungeon_sunkencrypt_irongate"; break; case "fenrir_head": text = "darkwood_wolf"; break; case "ice_flower": text = "IceNest"; break; case "short_table_oak": text = "piece_table_oak"; break; } bool flag = text.StartsWith("ice_floor"); if (flag) { if (m_debugHideIce) { return; } text = "ice_rock1_frac"; } GameObject val = WUTIL.Spawn(text, position, rotation); if ((Object)(object)val == (Object)null) { m_lastPlaced = null; return; } m_lastPlaced = val.transform; if (m_captureNextPiecePlacedAs != "") { m_capturedPieces[m_captureNextPiecePlacedAs] = m_lastPlaced; m_captureNextPiecePlacedAs = ""; } Solidify(val); if (flag) { CustomizeMinable(val, name, dropPin); } else { CustomizeScale(m_lastPlaced, name, dropPin); } } public static void Piece(string name, Vector3 position, int nesw, float tilt = 0f, bool altTilt = false, float turn = 0f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0028: Unknown result type (might be due to invalid IL or missing references) Quaternion val = MapRot(nesw); Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; if (altTilt) { Piece(name, position, Quaternion.Euler(0f, eulerAngles.y + turn, tilt)); } else { Piece(name, position, Quaternion.Euler(tilt, eulerAngles.y + turn, 0f)); } } public static void Piece(string name, Transform parent, string attachPoint, bool dropPin = false) { //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) Transform val = ((attachPoint == "") ? null : parent.Find(attachPoint)); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to find attach transform " + attachPoint + " of " + ((Object)parent).name + " to place " + name); m_lastPlaced = null; } else { Piece(name, val.position, val.rotation, dropPin); } } public static void PieceUpright(string name, Vector3 position, int nesw, bool upsideDown = false, float spin = 0f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) Quaternion val = MapRot(nesw); Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; Quaternion rotation = (upsideDown ? Quaternion.Euler(0f, eulerAngles.y + spin, 180f) : Quaternion.Euler(0f, eulerAngles.y + spin, 90f)); Piece(name, position, rotation); } public static void Floor(Vector3 position, int nesw = 0, float heightOffset = 0f, int width = 0, int depth = 1, bool ceiling = false, int floorStyle = 0, bool pinData = true) { //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030a: 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_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) position.y += heightOffset; int num = 0; int num2 = 0; int a = 0; int num3 = 0; float num4 = 0.5f; float num5 = 0.05f; if (width == 0) { float num6 = WUTIL.RandomSpin(); int nesw2 = WUTIL.DieRoll(4); string name = "StoneFloorSewers"; switch (floorStyle) { case 1: name = "StoneFloorDirt"; nesw2 = (int)(0.5f * position.x) & 2; nesw2 += ((int)(0.5f * position.z) & 2) >> 1; ceiling = true; break; case 4: ceiling = false; break; case 2: a = 5; num2 = 3; num4 = 0.02f; if (WUTIL.RandomSpin() < 0.4f) { num = 1; } ceiling = false; break; case 3: if (ceiling) { floorStyle = 2; } ceiling = false; a = 7; num3 = 3; num2 = 4; num4 = 0.33f; break; case 5: ceiling = true; break; default: floorStyle = 0; name = "stone_floor"; pinData = false; break; } if (ceiling) { Piece(name, position, MapRot(nesw2)); } else { Quaternion val = MapRot(nesw2); Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; Piece(name, position, Quaternion.Euler(0f, eulerAngles.y, 180f)); } if (floorStyle == 1) { bool flag = CheckTriggerPiece(position, "MD_barredgate1") || CheckTriggerPiece(position, "MD_barredgate2"); num2 = ((!flag) ? 3 : 0); for (int i = 0; i < num2; i++) { if (WUTIL.RandomSpin() >= num5) { break; } num |= 1 << WUTIL.DieRoll(10) + 10; } a = (flag ? 5 : 10); num3 = (flag ? 5 : 0); num2++; } for (int j = 0; j < num2; j++) { if (WUTIL.RandomSpin() < num4) { num |= 1 << num3 + WUTIL.DieRoll(a); } else if (num4 > 0.1f) { break; } } string text = "Floor:" + floorStyle; if (num > 0) { text += $",{num}"; } CustomizeFloor(m_lastPlaced, text); if (pinData && floorStyle != 0) { DataPin(m_lastPlaced, text); } return; } Vector3 val2 = 2f * MapFwd(nesw); Vector3 val3 = 2f * MapFwd(nesw + 1); int num7 = 0; while (num7 < depth) { Vector3 val4 = position; int num8 = 0; while (num8 < width) { Piece("stone_floor_2x2", val4, nesw); num8++; val4 += val3; } num7++; position += val2; } } public static bool CustomizeFloor(Transform transform, string data) { if (data.Length < 7 || !data.StartsWith("Floor:")) { return false; } data = data.Substring(6); int num = data.IndexOf(','); int num2 = ((num < 0) ? int.Parse(data) : int.Parse(data.Remove(num))); int num3 = ((num >= 0) ? int.Parse(data.Substring(num + 1)) : 0); switch (num2) { case 3: ((Component)transform.Find("flooded")).gameObject.SetActive(true); break; case 2: ((Component)transform.Find("floor")).gameObject.SetActive(true); break; case 5: ((Component)transform.Find("ceiling")).gameObject.SetActive(true); break; } try { if (num2 == 1) { int num4 = 0; int num5 = 1; while (num4 < 20) { if ((num5 & num3) > 0) { if (num4 < 10) { ((Component)transform.Find($"decor/prop{num4}")).gameObject.SetActive(true); } else { ((Component)transform.Find($"decor2/prop{num4 - 10}")).gameObject.SetActive(true); } } num4++; num5 <<= 1; } } else { int num6 = 0; int num7 = 1; while (num6 < 10) { if ((num7 & num3) > 0) { ((Component)transform.Find($"prop{num6}")).gameObject.SetActive(true); } num6++; num7 <<= 1; } } } catch { WDBUG.Log("Customize Floor:" + data + " not parse props: " + num3.ToString("X")); } return true; } public static void Headstone(Vector3 position, int style = 0, int nesw = 0, float heightOffset = 0f, float turn = 0f) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) position.y += heightOffset; Piece("Headstone", position, nesw, 0f, altTilt: false, turn); if (style > 0) { string data = "head" + style; CustomizeHeadstone(m_lastPlaced, data); DataPin(m_lastPlaced, data); } } public static bool CustomizeHeadstone(Transform transform, string data) { if (WUTIL.GameName(((Component)transform).gameObject) != "Headstone") { return false; } if (data.StartsWith("head")) { try { int num = int.Parse(data.Substring(4)); if (num > 10) { ((Component)transform.Find("tallstone")).gameObject.SetActive(false); num -= 10; if (num > 10) { ((Component)transform.Find("headstone")).gameObject.SetActive(true); num -= 10; } } if (num > 10) { WDBUG.Log($"Ignored illegal Headstone style: {num} for {data}"); } else if (num > 0) { ((Component)transform.Find($"head{num}")).gameObject.SetActive(true); } } catch { string text = (((Object)(object)transform == (Object)null) ? "null" : ((Object)transform).name); WDBUG.Log("CATCH: Failed to parse " + data + " for " + text); } return true; } return false; } public static void Table(Vector3 position, int nesw = 0, float heightOffset = 0f, float turn = 0f) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) position.y += heightOffset; Piece("PropTable", position, nesw + 2, 0f, altTilt: false, turn); int num = 0; for (int i = 0; i < 7; i++) { if (WUTIL.RandomSpin() < 0.1f) { break; } num |= 1 << WUTIL.DieRoll(7); } string data = "table" + num; CustomizeTable(m_lastPlaced, data); DataPin(m_lastPlaced, data); if ((num & 0x10) > 0 && WUTIL.RandomSpin() < 0.5f) { Piece("Pickable_RandomFood", position - 0.25f * MapFwd(nesw) + 0.85f * up, nesw, 0f, altTilt: false, WUTIL.RandomSpin(-30f, 80f)); } } public static bool CustomizeTable(Transform transform, string data) { if (data.StartsWith("table") && data.Length > 5) { try { int num = int.Parse(data.Substring(5)); int num2 = 1; int num3 = 1; while (num2 <= 7) { if ((num & num3) > 0) { Transform val = transform.Find($"prop{num2}"); if ((Object)(object)val == (Object)null) { WDBUG.Log($"Failed to find node prop{num2}"); } else { ((Component)transform.Find($"prop{num2}")).gameObject.SetActive(true); } } num2++; num3 <<= 1; } return true; } catch { WDBUG.Log("CATCH: Failed to table data: " + data); } } return false; } public static void Wall(Vector3 position, int nesw, int width = 0, int height = 0, float heightOffset = 0f, int floorStyle = 0, bool pinData = true) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) position.y += heightOffset + 1f; if (width <= 0) { if (height <= 0) { PieceUpright("stone_floor", position, nesw + 1); } else { PieceUpright("stone_wall_4x2", position, nesw); } return; } if (height <= 0) { Piece("stone_wall_4x2", position, nesw); return; } Vector3 val = 2f * MapFwd(nesw + 1); nesw++; int num = 0; while (num < height) { Vector3 val2 = position; int num2 = 0; while (num2 < width) { PieceUpright("stone_floor_2x2", val2, nesw); num2++; val2 += val; } num++; position.y += 2f; } } public static void RandomItem(string itemSet, Vector3 position, int nesw = 0, float heightOffset = 0f, int mapPiece = 0, bool randomOffset = true) { //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) if (itemSet == "") { return; } if (!m_randomItems.ContainsKey(itemSet)) { WDBUG.Log("Unknown item set/group " + itemSet); return; } int num = mapPiece & 0xF0FF; if ((mapPiece & 0xF) == 15 && (num != 15 || num != 63)) { return; } bool flag = (mapPiece & 0xFF0) > 0; bool flag2 = false; position.y += heightOffset; float num2 = 0.8f; string text = m_randomItems[itemSet]; if (text.IndexOf(':') > 0) { text = itemSet; } string[] array = text.Split(new char[1] { ',' }); foreach (string text2 in array) { if (WUTIL.RandomSpin() > num2) { break; } num2 *= 0.5f; bool flag3 = false; int num3 = ((!flag3) ? 1 : WUTIL.DieRoll(4)); for (int j = 0; j < num3; j++) { string randomItem = GetRandomItem(text2); if (randomItem == "") { continue; } float turn = WUTIL.RandomSpin(-40f, 40f); if (randomOffset) { float min = (flag3 ? 0.2f : 0f); float max = (flag3 ? 1.2f : 0.5f); if (text2.StartsWith("Chest") || randomItem.IndexOf("Remains04") > 0) { flag2 = !flag; flag = true; turn = 0f; } else if (randomItem == "goblin_bed" || randomItem == "rug_deer") { if (!flag) { max = 0.2f; } turn = 0f; } if (flag) { min = 1.1f; } float num4 = WUTIL.RandomSpin(min, max, 0.1f, randomSign: true); float num5 = (flag2 ? 0f : WUTIL.RandomSpin(min, max, 0.1f, randomSign: true)); Vector3 val = num4 * MapFwd(nesw) + num5 * MapFwd(nesw + 1); Piece(randomItem, position + val, nesw, 0f, altTilt: false, turn); } else { Piece(randomItem, position, nesw, 0f, altTilt: false, turn); } } } } public static void DisplacedObject(string name, Vector3 position, int nesw = 0, float heightOffset = 0f, float randomDisplace = 0f) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) position.y += heightOffset; if (randomDisplace > 0f) { position.x += WUTIL.RandomSpin(0f - randomDisplace, randomDisplace); position.y += WUTIL.RandomSpin(0f - randomDisplace, randomDisplace); } Piece(name, position, nesw); } public static void OnPerimeter(string piece, Vector3 position, int segments = 8, float radius = 4f, float heightOffset = 0f, int segOffset = 0, float tangent = 0f, float tilt = 0f, bool altTilt = false, float scale = 1f, float climb = 0f, float ztilt = 0f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_005a: 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) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) float num = 360f / (float)segments; Vector3 val = radius * Vector3.forward; position.y += heightOffset; float num2 = (altTilt ? ztilt : tilt); float num3 = (altTilt ? tilt : ztilt); int num4 = 0; while (num4 < segments) { float num5 = (float)(num4 + segOffset) * num; Piece(piece, position + Quaternion.Euler(0f, num5, 0f) * val, Quaternion.Euler(num2, num5 + tangent, num3)); if (scale != 1f) { Transform lastPlaced = m_lastPlaced; lastPlaced.localScale *= scale; CustomizeScale(m_lastPlaced); } num4++; position.y += climb; } } public static void Cluster(string piece, Vector3 position, List notAt, int segments = 8, float radius = 4f, int segOffset = 0, float rndRadius = 0f, float rndAngle = 0f, float rndTangent = 60f, float rndSkip = 0.05f, bool ground = true, bool spawner = false, float heightOffset = 4f, float maxHeight = 9999f) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) if (segments == 0) { return; } float num = 360f / (float)segments; float num2 = Mathf.Max(0.5f * radius, 1f); position.y += heightOffset; for (int i = 0; i < segments; i++) { if (rndSkip > 0f && WUTIL.RandomSpin() < rndSkip) { continue; } float num3 = (float)(i + segOffset) * num * (1f + WUTIL.RandomSpin(0f - rndAngle, rndAngle)); float num4 = radius * (1f + WUTIL.RandomSpin(0f - rndRadius, rndRadius)); Vector3 val = position + Quaternion.Euler(0f, num3, 0f) * (num4 * Vector3.forward); if (notAt != null) { bool flag = true; foreach (Vector3 item in notAt) { if (WUTIL.GroundDistance(item, val) < num2) { flag = false; break; } } if (!flag) { continue; } } if (ground) { if (val.y > 5000f) { val.y -= Flight.GetHeightAboveSolid(val, 1f); } else { val.y = ZoneSystem.instance.GetGroundHeight(val); } } if (!(val.y > maxHeight)) { notAt?.Add(val); if (spawner) { Spawner(piece, val); continue; } float num5 = ((rndTangent > 0f) ? WUTIL.RandomSpin(0f - rndTangent, rndTangent) : 0f); Piece(piece, val, Quaternion.Euler(0f, num3 + num5, 0f)); } } } public static void FourPieces(string name, Vector3 position, Vector3 offsetH, int nesw = 0, bool upright = false, float offsetV = 1f, int lLrR = 15, float spin = 0f, float tilt = 0f, bool reflect = false) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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) if ((lLrR & 0x10) > 0) { position.y += 1f; } Vector3 val = offsetV * up; if (upright) { spin *= -1f; if ((lLrR & 1) > 0) { PieceUpright(name, position + offsetH + val, nesw, upsideDown: false, spin); } if ((lLrR & 2) > 0) { PieceUpright(name, position + offsetH - val, nesw, upsideDown: false, spin); } if (reflect) { nesw += 2; spin *= -1f; } if ((lLrR & 4) > 0) { PieceUpright(name, position - offsetH + val, nesw, upsideDown: false, spin); } if ((lLrR & 8) > 0) { PieceUpright(name, position - offsetH - val, nesw, upsideDown: false, spin); } } else if (spin != 0f) { Quaternion val2 = MapRot(nesw); Vector3 eulerAngles = ((Quaternion)(ref val2)).eulerAngles; Quaternion rotation = Quaternion.Euler(0f, eulerAngles.y + spin, 0f); if ((lLrR & 1) > 0) { Piece(name, position + offsetH + val, rotation); } if ((lLrR & 2) > 0) { Piece(name, position + offsetH - val, rotation); } if (reflect) { rotation = Quaternion.Euler(0f, eulerAngles.y + 180f + spin, 0f); } if ((lLrR & 4) > 0) { Piece(name, position - offsetH + val, rotation); } if ((lLrR & 8) > 0) { Piece(name, position - offsetH - val, rotation); } } else { if ((lLrR & 1) > 0) { Piece(name, position + offsetH + val, nesw, tilt); } if ((lLrR & 2) > 0) { Piece(name, position + offsetH - val, nesw, tilt); } if (reflect) { nesw += 2; } if ((lLrR & 4) > 0) { Piece(name, position - offsetH + val, nesw, tilt); } if ((lLrR & 8) > 0) { Piece(name, position - offsetH - val, nesw, tilt); } } } public static void PlaceStud(Vector3 position, int nesw = 0, float heightOffset = 0f) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004d: 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) position.y += heightOffset; position += 0.142f * (MapFwd(nesw) + MapFwd(nesw + 1)); Piece("stone_wall_1x1", position, MapRot(nesw) * Quaternion.Euler(45f, 45f, 0f)); } public static void Torch(string torch, Vector3 position, float heightOffset = 0f, int nesw = 0, bool tilt = false, string fuel = "") { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0091: Unknown result type (might be due to invalid IL or missing references) string[] array = torch.Split(new char[1] { ',' }); foreach (string name in array) { Piece(name, position + heightOffset * up, nesw); } if ((Object)(object)m_lastPlaced == (Object)null) { return; } if (tilt) { Quaternion val = MapRot(nesw); Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; m_lastPlaced.rotation = Quaternion.Euler(-35f, eulerAngles.y, 0f); } if (!(fuel != "")) { return; } Fireplace component = ((Component)m_lastPlaced).gameObject.GetComponent(); if (WUTIL.GameName(((Component)component.m_fuelItem).gameObject) != fuel) { GameObject prefab = WUTIL.GetPrefab(fuel); ItemDrop val2 = (((Object)(object)prefab == (Object)null) ? null : prefab.GetComponent()); if ((Object)(object)val2 == (Object)null) { WDBUG.Log("Invalid " + torch + " fuel " + fuel + "."); } else { GameObject val3 = Object.Instantiate(prefab); component.m_fuelItem = val3.GetComponent(); WUTIL.Destroy(val3); } } } public static void Pickable(string name, Vector3 position, int nesw = 0, string itemDrops = "", bool ground = true) { //IL_0023: 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) if (!name.StartsWith("Pickable_")) { name = "Pickable_" + name; } GameObject val = WUTIL.Spawn(name, position, MapRot(nesw), 1, 0f, ground); m_lastPlaced = val.transform; if (itemDrops != "") { WDBUG.Log("Placed " + name + " with " + itemDrops, WDBUG.Level.Dungeon); if (!CustomizePickable(val, itemDrops)) { WDBUG.Log("ERROR: " + name + " is not a known Pickable prefab"); } } } public static bool CustomizePickable(GameObject go, string data, bool pinData = true) { if ((Object)(object)go == (Object)null || (Object)(object)go.GetComponent() == (Object)null || data == "") { return false; } if (data.Contains("_trigger_")) { WDBUG.Log("Restore " + ((Object)go).name + " as " + data, WDBUG.Level.Dungeon); CaptureAs(data, go.transform, pinData); return true; } Pickable component = go.GetComponent(); component.m_spawnOffset = 0f; component.m_respawnTimeMinutes = 0f; component.m_extraDrops = CustomDropTable(data, 0, component.m_extraDrops); component.m_extraDrops.m_oneOfEach = true; component.m_extraDrops.m_dropChance = 1f; component.m_extraDrops.m_dropMin = component.m_extraDrops.m_drops.Count; component.m_extraDrops.m_dropMax = component.m_extraDrops.m_dropMin; if (pinData) { DataPin(m_lastPlaced, data); } return true; } public static Transform LastPlaced() { return m_lastPlaced; } public static Transform Captured(string name) { return m_capturedPieces.ContainsKey(name) ? m_capturedPieces[name] : null; } public static Transform CapturedGate(string name) { return m_capturedGates.ContainsKey(name) ? m_capturedGates[name] : null; } public static void CaptureNextPlacedAs(string name) { m_captureNextPiecePlacedAs = name; } public static void CaptureLastPlacedAs(string name, bool pinData = true) { CaptureAs(name, m_lastPlaced, pinData); } public static void CaptureAs(string name, Transform piece, bool pinData = true) { if ((Object)(object)piece == (Object)null) { WDBUG.Log("Ignored null piece as " + name); return; } if (m_capturedPieces.ContainsKey(name)) { m_capturedPieces[name] = piece; } else { m_capturedPieces.Add(name, piece); } if (pinData) { DataPin(piece, name); } } public static bool CaptureCaptured(string name, string captured) { if (m_capturedPieces.ContainsKey(captured)) { CaptureAs(name, m_capturedPieces[captured]); return true; } return false; } public static void CaptureGate(Transform piece, string gateID, bool versioned = true) { if (m_capturedGates.ContainsKey(gateID)) { if (!versioned) { WDBUG.Log("Captured gate: Replaced " + WUTIL.GameName(((Object)piece).name) + " as " + gateID); m_capturedGates[gateID] = piece; return; } while (m_capturedGates.ContainsKey(gateID)) { int num = gateID.LastIndexOf('.') + 1; if (num <= 0) { gateID += ".0"; continue; } int num2 = int.Parse(gateID.Substring(num)) + 1; gateID = gateID.Remove(num) + num2; } m_capturedGates.Add(gateID, piece); } else { m_capturedGates.Add(gateID, piece); } } public static void CaptureCapturedGate(string gateName, string gateType, string captured, bool pinData = true) { if (gateType == "") { return; } Transform val = Captured(captured); if ((Object)(object)val == (Object)null) { WDBUG.Log("CaptureGate(" + gateName + "," + gateType + "," + captured + ") requires a Captured piece"); } else { string text = gateType + ":" + gateName; CaptureGate(val, text); if (pinData) { DataPin(val, text); } } } public static void CustomizeMapGate(int mapX, int mapY, string gateType, char sep = ',') { string text = $"{mapX}{sep}{mapY}"; if (m_customMapDoors.ContainsKey(text)) { WDBUG.Log("Already have " + gateType + " door at " + text); } else { m_customMapDoors.Add(text, gateType); } } public static void CaptureMapPiece(int mapPiece, string captured, int mapX, int mapY, char sep = ',') { string text = $"{mapX}{sep}{mapY}"; if (!m_customMapDoors.ContainsKey(text)) { return; } string text2 = m_customMapDoors[text]; if (text2 == "") { return; } if ((mapPiece & 0xF00F) == 15 || mapPiece == 0) { CaptureCapturedGate(text, text2, captured); return; } bool flag = (mapPiece & 0xF0000) == 0; int num = 4097; int num2 = 272; int num3 = 0; while (num3 < 4) { if (flag && (mapPiece & num) == num) { CaptureCapturedGate(text, text2, captured); break; } if ((mapPiece & num2) == num2) { CaptureCapturedGate(text, text2, captured); break; } num3++; num2 <<= 1; num <<= 1; } } public static bool CheckTriggerPiece(Vector3 piecePos, string pieceName, bool trigger = false, string timer = "", float runTime = 0f, float proximity = 2.3f) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (m_capturedPieces.ContainsKey(pieceName)) { if ((Object)(object)m_capturedPieces[pieceName] == (Object)null) { WDBUG.Log("Ignored null captured piece for " + pieceName); m_capturedPieces.Remove(pieceName); } else if (Vector3.Distance(piecePos, m_capturedPieces[pieceName].position) <= proximity) { if (trigger && WUTIL.Timer(timer) == 0f) { WUTIL.TimerReset(timer, runTime); } return true; } } return false; } public static void FloorPlan(float heightOffset = 0f, bool showBounds = false, bool showFloor = false) { //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) int length = m_floorPlan.GetLength(0); int length2 = m_floorPlan.GetLength(1); for (int i = 0; i < length; i++) { for (int j = 0; j < length2; j++) { Vector3 planTilePos = GetPlanTilePos(i, j, heightOffset); if (showFloor) { if (!OutOfBounds(planTilePos)) { Floor(planTilePos, 0, 0f, 0, 1, ceiling: true); } continue; } char c = m_floorPlan[i, j]; switch (c) { case 'F': Floor(planTilePos, 0, 0f, 0, 1, ceiling: true); continue; case ' ': continue; } if (c != '-') { Floor(planTilePos); } } } if (showBounds) { float num = m_mapBoundsMax.x - m_mapBoundsMin.x; float num2 = m_mapBoundsMax.z - m_mapBoundsMin.z; num /= 8f; num2 /= 8f; float x = m_mapBoundsMin.x; float z = m_mapBoundsMin.z; Vector3 floorPlanAnchor = m_floorPlanAnchor; floorPlanAnchor.y += heightOffset; for (int k = 0; k <= 8; k++) { floorPlanAnchor.x = x; floorPlanAnchor.z = z + num2 * (float)k; Torch("piece_groundtorch_blue", floorPlanAnchor); floorPlanAnchor.x = x + 8f * num; Torch("piece_groundtorch_green", floorPlanAnchor); floorPlanAnchor.x = x + num * (float)k; floorPlanAnchor.z = z; Torch("piece_groundtorch_wood", floorPlanAnchor); floorPlanAnchor.z = z + 8f * num2; Torch("piece_groundtorch", floorPlanAnchor); } } } public static void FloorPlanLevel(float highCeiling = 4f, float lowCeiling = 3f, float doorCeiling = 4f, int wallStyleMask = 0, int pillarStyle = 0, float torchDensity = 0.1f, string roomTiles = "", int floorStyle = 0, int openLargeSpaces = 0) { //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0da5: Unknown result type (might be due to invalid IL or missing references) //IL_0daa: Unknown result type (might be due to invalid IL or missing references) //IL_0db3: Unknown result type (might be due to invalid IL or missing references) //IL_0d40: Unknown result type (might be due to invalid IL or missing references) //IL_0d53: Unknown result type (might be due to invalid IL or missing references) //IL_15f1: Unknown result type (might be due to invalid IL or missing references) //IL_15f6: Unknown result type (might be due to invalid IL or missing references) //IL_15f8: Unknown result type (might be due to invalid IL or missing references) //IL_15ff: Unknown result type (might be due to invalid IL or missing references) //IL_1601: Unknown result type (might be due to invalid IL or missing references) //IL_1603: Unknown result type (might be due to invalid IL or missing references) //IL_1608: Unknown result type (might be due to invalid IL or missing references) //IL_160d: Unknown result type (might be due to invalid IL or missing references) //IL_1612: Unknown result type (might be due to invalid IL or missing references) //IL_164d: Unknown result type (might be due to invalid IL or missing references) //IL_1599: Unknown result type (might be due to invalid IL or missing references) //IL_15ac: Unknown result type (might be due to invalid IL or missing references) //IL_1853: Unknown result type (might be due to invalid IL or missing references) //IL_170f: Unknown result type (might be due to invalid IL or missing references) //IL_173b: Unknown result type (might be due to invalid IL or missing references) //IL_1758: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_1804: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_179c: Unknown result type (might be due to invalid IL or missing references) //IL_17a0: Unknown result type (might be due to invalid IL or missing references) //IL_17a5: Unknown result type (might be due to invalid IL or missing references) //IL_17b3: Unknown result type (might be due to invalid IL or missing references) //IL_17b8: Unknown result type (might be due to invalid IL or missing references) //IL_17bd: Unknown result type (might be due to invalid IL or missing references) //IL_17c2: Unknown result type (might be due to invalid IL or missing references) //IL_17c6: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_1961: Unknown result type (might be due to invalid IL or missing references) //IL_17e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_0aab: Unknown result type (might be due to invalid IL or missing references) //IL_0aad: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_075d: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_1145: Unknown result type (might be due to invalid IL or missing references) //IL_0f82: Unknown result type (might be due to invalid IL or missing references) //IL_0f84: Unknown result type (might be due to invalid IL or missing references) //IL_0f86: Unknown result type (might be due to invalid IL or missing references) //IL_0f9b: Unknown result type (might be due to invalid IL or missing references) //IL_0f9d: Unknown result type (might be due to invalid IL or missing references) //IL_0f9f: Unknown result type (might be due to invalid IL or missing references) //IL_1165: Unknown result type (might be due to invalid IL or missing references) //IL_1167: Unknown result type (might be due to invalid IL or missing references) //IL_1169: Unknown result type (might be due to invalid IL or missing references) //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae3: Unknown result type (might be due to invalid IL or missing references) //IL_0afb: Unknown result type (might be due to invalid IL or missing references) //IL_0afd: Unknown result type (might be due to invalid IL or missing references) //IL_0aff: Unknown result type (might be due to invalid IL or missing references) //IL_092c: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0945: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_127f: Unknown result type (might be due to invalid IL or missing references) //IL_1281: Unknown result type (might be due to invalid IL or missing references) //IL_1283: Unknown result type (might be due to invalid IL or missing references) //IL_129b: Unknown result type (might be due to invalid IL or missing references) //IL_129d: Unknown result type (might be due to invalid IL or missing references) //IL_129f: Unknown result type (might be due to invalid IL or missing references) //IL_11a5: Unknown result type (might be due to invalid IL or missing references) //IL_11a7: Unknown result type (might be due to invalid IL or missing references) //IL_11a9: Unknown result type (might be due to invalid IL or missing references) //IL_0bc4: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Unknown result type (might be due to invalid IL or missing references) //IL_0be2: Unknown result type (might be due to invalid IL or missing references) //IL_0be4: Unknown result type (might be due to invalid IL or missing references) //IL_0c06: Unknown result type (might be due to invalid IL or missing references) //IL_0c0d: Unknown result type (might be due to invalid IL or missing references) //IL_0c0f: Unknown result type (might be due to invalid IL or missing references) //IL_0c14: Unknown result type (might be due to invalid IL or missing references) //IL_09e0: Unknown result type (might be due to invalid IL or missing references) //IL_09e2: Unknown result type (might be due to invalid IL or missing references) //IL_09e4: Unknown result type (might be due to invalid IL or missing references) //IL_0986: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098a: Unknown result type (might be due to invalid IL or missing references) //IL_0c3a: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09bc: Unknown result type (might be due to invalid IL or missing references) //IL_09be: Unknown result type (might be due to invalid IL or missing references) //IL_1439: Unknown result type (might be due to invalid IL or missing references) //IL_143b: Unknown result type (might be due to invalid IL or missing references) //IL_143d: Unknown result type (might be due to invalid IL or missing references) //IL_1455: Unknown result type (might be due to invalid IL or missing references) //IL_1457: Unknown result type (might be due to invalid IL or missing references) //IL_1459: Unknown result type (might be due to invalid IL or missing references) //IL_149f: Unknown result type (might be due to invalid IL or missing references) //IL_14b2: Unknown result type (might be due to invalid IL or missing references) //IL_11dc: Unknown result type (might be due to invalid IL or missing references) //IL_0c81: Unknown result type (might be due to invalid IL or missing references) //IL_0c94: Unknown result type (might be due to invalid IL or missing references) float torchDensity2 = m_torchDensity; m_torchDensity = torchDensity; m_outerWallStyleMask = wallStyleMask; float y = m_floorPlanAnchor.y; float mapMaxWallHeight = m_floorPlanAnchor.y + highCeiling - 0.5f; float num = m_floorPlanAnchor.y + doorCeiling - 0.5f; float num2 = m_floorPlanAnchor.y + lowCeiling - 0.5f; int length = m_floorPlan.GetLength(0); int length2 = m_floorPlan.GetLength(1); int num3 = length - 1; int num4 = 0; int num5 = length2 - 1; int num6 = 0; for (int i = 0; i < length; i++) { for (int j = 0; j < length2; j++) { if (m_floorPlan[i, j] != ' ') { if (i < num3) { num3 = i; } if (i > num4) { num4 = i; } if (j < num5) { num5 = j; } if (j > num6) { num6 = j; } } } } char[,] array = new char[length, length2]; if (roomTiles != "") { for (int k = num3 + 1; k <= num4 - 1; k++) { for (int l = num5 + 1; l <= num6 - 1; l++) { int num7 = 0; int num8 = 0; for (int m = -1; m <= 1; m++) { for (int n = -1; n <= 1; n++) { char c = m_floorPlan[k + m, l + n]; if (c == ' ') { num8++; } else if (Enumerable.Contains(roomTiles, c)) { num7++; } } } if (num7 == 9) { array[k, l] = 'R'; } else if (num8 == 9) { for (int num9 = 0; num9 < openLargeSpaces; num9++) { WDBUG.Log("Breaking 3x3 space with extra floor"); array[k + WUTIL.DieRoll(3) - 1, l + WUTIL.DieRoll(3) - 1] = 'R'; } } } } } int floorPlanNESW = m_floorPlanNESW; int num10 = 1 << floorPlanNESW; int num11 = 1 << ((floorPlanNESW + 1) & 3); int mapPiece = 1 << ((floorPlanNESW + 2) & 3); int mapPiece2 = 1 << ((floorPlanNESW + 3) & 3); Vector3 val = 4f * m_floorPlanDirectionX; Vector3 val2 = 4f * m_floorPlanDirectionY; Vector3 val3 = Vector3.zero; m_wallTracker.Clear(); for (int num12 = length - 1; num12 >= 0; num12--) { bool flag = true; char c2 = ' '; char c3 = ' '; bool flag2 = false; char c; char c4; bool flag5; for (int num13 = length2 - 1; num13 >= 0; num13--, c2 = c, c3 = c4, flag2 = flag5) { val3 = GetPlanTilePos(num12, num13, 2f); if (m_checkOOB && OutOfBounds(val3)) { m_floorPlan[num12, num13] = ' '; } else if (array[num12, num13] > '\0') { m_floorPlan[num12, num13] = array[num12, num13]; } c = m_floorPlan[num12, num13]; bool flag3 = c == '$'; bool flag4 = c == 'f' || c == 'r' || c == '=' || c == '#'; if (c == '$') { c = 's'; } c4 = ((c >= 'a') ? ((char)(c - 32)) : c); flag5 = c4 == 'N' || c4 == 'S' || c4 == 'W' || c4 == 'E' || c4 == 'D'; m_mapLowerFloorHeight = y; m_mapMaxWallHeight = mapMaxWallHeight; int num14 = 12; bool flag6 = false; if (c4 == 'I' || c4 == 'Z') { Vector3 val4 = val3; val4.y += 0.2f; if (WUTIL.DieRoll(2) == 0) { val4.y += 2.7f; Piece("ice_floor_thin", val4 + 0.25f * val, floorPlanNESW + 1); } else { val4.y += 2f; Piece("ice_floor", val4 + 0.25f * val, floorPlanNESW + 1); } switch (c) { case 'z': val4.y += 1f; Piece("ice_floor_tall", val4 - 1.2f * val + val2, floorPlanNESW, 260f); break; case 'Z': val4.y += 8f; Piece("ice_floor_large", val4, floorPlanNESW, 180f); break; case 'I': if (WUTIL.DieRoll(3) > 0) { val4.y += WUTIL.RandomSpin(4f, 8f); Piece("ice_floor_tall", val4, m_icefloorRndNesw + WUTIL.DieRoll(4), WUTIL.RandomSpin(-5f, 5f)); } else { val4.y += WUTIL.RandomSpin(0f, 2f); Piece("ice_floor_tall", val4, m_icefloorRndNesw + WUTIL.DieRoll(4), WUTIL.RandomSpin(175f, 185f)); } break; } c = '_'; } if (c == '_') { c = ' '; Floor(val3, 0, -2f, 0, 1, ceiling: false, floorStyle); } float torchHeight; if (c == ' ') { c4 = ' '; if (flag) { continue; } flag = true; if (flag2) { m_mapMaxWallHeight = num; if (c3 == 'N' || c3 == 'S') { num14 = 4; } else if (c3 == 'W') { num14 = ((c2 == 'W') ? 2 : 3); } } else { switch (c2) { case 'f': m_mapMaxWallHeight = num2; break; case '#': num14 = 0; m_mapMaxWallHeight = num2; break; default: if (c3 == 'R') { num14 = 4; } else if (c2 == '-') { num14 = 0; } break; } } if (c2 != '.' && c2 != ',') { torchHeight = m_mapMaxWallHeight - m_mapLowerFloorHeight - 1.5f; OuterWall(mapPiece2, val3 + val2, num14, torchHeight); TrackWalls(val3 + val2, num14); } continue; } flag = c2 == ' '; if (c == '.') { continue; } int mapPiece3 = num11; Floor(val3, 0, -2f, 0, 1, ceiling: false, floorStyle); if (c == ',') { continue; } if (c == '-') { if (!flag) { continue; } num14 = 8; } float heightOffset; if (flag5) { m_mapMaxWallHeight = num; if (c4 == 'N' || c4 == 'S') { if (c2 != 'n') { num14 = 4; } } else if (c4 == 'E') { num14 = ((c == 'E') ? 2 : 3); } if (c4 == 'W' && c3 == 'R') { num14 |= GetDoorStyle(); m_mapMaxWallHeight = mapMaxWallHeight; flag = true; } else if (c2 == 'F' || c2 == 'R') { m_mapLowerFloorHeight = num; m_mapMaxWallHeight = mapMaxWallHeight; num14 = 132; flag6 = true; } else if (c2 == 'f' || c2 == 'r') { m_mapLowerFloorHeight = num2; m_mapMaxWallHeight = num - 0.5f; num14 = 132; flag6 = true; } else if (flag) { m_mapMaxWallHeight = num; } if (c2 == '#') { flag = true; } heightOffset = 2f; } else if (flag4) { m_mapMaxWallHeight = num2; if (c == '#' || c2 == '#') { flag = true; if (flag2) { flag = true; OuterWall(mapPiece2, val3, 15, 0f); OuterWall(mapPiece2, val3 + val2, 143, 0f); m_mapMaxWallHeight = num; } else if (c2 == 'F' || c2 == 'R') { OuterWall(mapPiece2, val3 + val2, 143, 0f); m_mapMaxWallHeight = mapMaxWallHeight; if (c2 == 'F') { OuterWall(mapPiece2, val3 + val2, 15, 0f); } num14 = 0; } else { OuterWall(mapPiece2, val3 + val2, 15, 0f); } } else if (c2 == 'F') { m_mapMaxWallHeight = mapMaxWallHeight; m_mapLowerFloorHeight = num2 - 0.95f; num14 = 132; flag6 = true; } else if (c3 == 'R') { num14 |= GetDoorStyle(); flag = true; m_mapMaxWallHeight = mapMaxWallHeight; } else if (flag2) { m_mapLowerFloorHeight = num2 - 1f; num14 = 4; } heightOffset = lowCeiling - 2f; } else { if (flag2) { m_mapLowerFloorHeight = num; num14 = 4; flag6 = true; } else if (c2 == '#') { m_mapMaxWallHeight = num2; OuterWall(mapPiece2, val3 + val2, 15, 0f); m_mapMaxWallHeight = mapMaxWallHeight; num14 = ((c4 == 'F') ? 140 : 0); OuterWall(mapPiece2, val3 + val2, num14, 0f); TrackWalls(val3 + val2, num14); } else if ((c2 == 'f' || c2 == 'r') && c4 == 'F') { m_mapLowerFloorHeight = num2 - 0.95f; num14 = 4; flag6 = true; } if (c4 == 'F' || c == '-') { if (c2 == '=') { m_mapMaxWallHeight = num2 - 0.95f; num14 = 2; flag = true; } else if (c3 == 'R') { num14 |= GetDoorStyle(); flag = true; } } else if (c4 == 'R' && c3 == 'F') { num14 |= GetDoorStyle(); OuterWall(mapPiece2, val3 + val2, num14, 0f); TrackWalls(val3 + val2, num14); } heightOffset = highCeiling - 2f; } if (flag3) { Floor(val3 - 0.12f * val, 0, heightOffset, 0, 1, ceiling: true); } else if (c != '-') { Floor(val3, 0, heightOffset, 0, 1, ceiling: true); } if (flag6) { flag = true; torchHeight = 0f; } else { torchHeight = m_mapMaxWallHeight - m_mapLowerFloorHeight - 1.5f; } if (flag) { OuterWall(mapPiece3, val3, num14, torchHeight, -1f, flag6); TrackWalls(val3, num14); flag = false; } } if (!flag) { bool flag6 = false; int num14 = 12; m_mapLowerFloorHeight = y; if (flag2) { m_mapMaxWallHeight = num; if (c2 == 'e') { num14 = 6; } } else if (c2 == 'f' || c2 == '#') { m_mapMaxWallHeight = num2; } else { m_mapMaxWallHeight = mapMaxWallHeight; } float torchHeight = m_mapMaxWallHeight - m_mapLowerFloorHeight - 1.5f; OuterWall(mapPiece2, val3, num14, torchHeight, -1f, flag6); TrackWalls(val3, num14); } } for (int num15 = length2 - 1; num15 >= 0; num15--) { bool flag7 = true; char c5 = ' '; char c6 = ' '; bool flag8 = false; char c; char c4; bool flag11; for (int num16 = length - 1; num16 >= 0; num16--, c5 = c, c6 = c4, flag8 = flag11) { val3 = GetPlanTilePos(num16, num15, 2f); if (m_checkOOB && OutOfBounds(val3)) { m_floorPlan[num16, num15] = ' '; } c = m_floorPlan[num16, num15]; bool flag9 = c == '$'; bool flag10 = c == 'f' || c == 'r' || c == '=' || c == '#'; if (flag9) { c = 's'; } c4 = ((c >= 'a') ? ((char)(c - 32)) : c); flag11 = c4 == 'N' || c4 == 'S' || c4 == 'W' || c4 == 'E'; m_mapLowerFloorHeight = y; m_mapMaxWallHeight = mapMaxWallHeight; int num14 = 12; bool flag6 = false; if (c == '_' || c4 == 'I' || c4 == 'Z') { c = ' '; } float torchHeight; if (c == ' ') { if (!flag7) { flag7 = true; if (flag8) { m_mapMaxWallHeight = num; if (c6 == 'E' || c6 == 'W') { num14 = 4; } else if (c6 == 'N') { num14 = ((c5 == 'N') ? 2 : 6); if (c5 == 'N') { m_mapMaxWallHeight -= 0.5f; } } } else { switch (c5) { case 'f': m_mapMaxWallHeight = num2; break; case '=': num14 = 0; m_mapMaxWallHeight = num2; break; default: if (c6 == 'R') { num14 = 4; } else if (c5 == '-') { num14 = 0; } break; } } if (c5 != '.' && c5 != ',') { torchHeight = m_mapMaxWallHeight - m_mapLowerFloorHeight - 1.5f; OuterWall(mapPiece, val3 + val, num14, torchHeight); TrackWalls(val3 + val, num14); } } c4 = ' '; continue; } int mapPiece3 = num10; flag7 = c5 == ' '; if (c == '.' || c == ',') { continue; } if (c == '-') { if (!flag7) { continue; } num14 = 8; } if (flag11) { m_mapMaxWallHeight = num; if (c4 == 'W' || c4 == 'E') { num14 = 4; } else if (c4 == 'S' && c5 == ' ') { if (flag9) { flag7 = false; } else { num14 = ((c == 'S') ? 6 : 15); } } if (c4 == 'N') { if (c6 == 'R') { num14 |= GetDoorStyle(); flag7 = true; } if (num14 == 78) { num14 = 2; } } else if (c5 == 'F' || c5 == 'R') { m_mapMaxWallHeight = mapMaxWallHeight; m_mapLowerFloorHeight = num; num14 = 132; flag6 = true; } else if (c5 == 'f' || c5 == 'r') { m_mapLowerFloorHeight = num2; m_mapMaxWallHeight = num - 0.5f; num14 = 132; flag6 = true; } else if (c5 == '=') { num14 = 12; flag7 = true; } } else if (flag10) { m_mapMaxWallHeight = num2; switch (c) { case '=': flag7 = true; OuterWall(mapPiece, val3, 15, 0f); if (flag8) { OuterWall(mapPiece, val3 + val, 143, 0f); m_mapMaxWallHeight = num; } else if (c5 == 'f' || c5 == 'r') { OuterWall(mapPiece, val3 + val, 15, 0f); } else if (c5 == 'F' || c5 == 'R') { OuterWall(mapPiece3, val3, 15, 0f); num14 = 0; m_mapMaxWallHeight = mapMaxWallHeight; } break; case '#': if (c5 == 'F') { if (highCeiling - lowCeiling > 1.01f) { m_mapMaxWallHeight = mapMaxWallHeight; m_mapLowerFloorHeight = num2; flag6 = true; num14 = 132; } else { m_mapMaxWallHeight = num2 - 0.95f; flag7 = true; num14 = 2; } } else if (flag8) { if (c6 == 'S') { m_mapMaxWallHeight = num; OuterWall(mapPiece, val3 + val, 15, 0f); TrackWalls(val3 + val, num14); } m_mapMaxWallHeight = num2; flag7 = true; } else if (c5 == '=') { flag7 = true; } break; default: if (c5 == 'F') { m_mapMaxWallHeight = mapMaxWallHeight; m_mapLowerFloorHeight = num2 - 0.95f; num14 = 132; flag6 = true; } else if (c6 == 'R') { m_mapMaxWallHeight = mapMaxWallHeight; num14 |= GetDoorStyle(); flag7 = true; } else if (flag8) { m_mapLowerFloorHeight = num2 - 1f; m_mapMaxWallHeight = num; num14 = 132; } else if (c5 == '=') { flag7 = true; } break; } } else { if (flag8) { m_mapLowerFloorHeight = num; num14 = 4; flag6 = true; } else if (c5 == 'f' || c5 == 'r' || c5 == '#') { if (c == 'F') { m_mapLowerFloorHeight = num2 - 0.95f; num14 = 4; flag6 = true; } } else if (c5 == '=' && (c == 'F' || c == 'R')) { flag7 = true; } if (c4 == 'F' || c == '-') { if (c6 == 'R') { num14 |= GetDoorStyle(); flag7 = true; } } else if (c4 == 'R' && c6 == 'F') { num14 |= GetDoorStyle(); OuterWall(mapPiece, val3 + val, num14); TrackWalls(val3 + val, num14); } } if (flag6) { flag7 = true; torchHeight = 0f; } else { torchHeight = m_mapMaxWallHeight - m_mapLowerFloorHeight - 1.5f; } if (flag7) { OuterWall(mapPiece3, val3, num14, torchHeight, -1f, flag6); TrackWalls(val3, num14); flag7 = false; } if (c == '=' || c == '#') { m_floorPlan[num16, num15] = ' '; } else { m_floorPlan[num16, num15] = c4; } } if (!flag7) { int num14 = 12; bool flag6 = false; m_mapLowerFloorHeight = y; if (flag8) { m_mapMaxWallHeight = num; if (c5 == 'n') { num14 = 6; } } else if (c5 == 'f' || c5 == '=') { m_mapMaxWallHeight = num2; } else { m_mapMaxWallHeight = mapMaxWallHeight; } float torchHeight = m_mapMaxWallHeight - m_mapLowerFloorHeight - 1.5f; OuterWall(mapPiece, val3, num14, torchHeight, -1f, flag6); TrackWalls(val3, num14); } } int doorStyleDoorMaterial = m_doorStyleDoorMaterial; for (int num17 = 0; num17 < length - 1; num17++) { for (int num18 = 0; num18 < length2 - 1; num18++) { Vector3 planTilePos = GetPlanTilePos(num17, num18, 2f); val3 = planTilePos + 0.5f * (val + val2); planTilePos.y = y + 0.5f; int num19 = 0; if (m_floorPlan[num17, num18] == 'R') { num19++; RandomItem(m_levelRoomItems, planTilePos); } if (m_floorPlan[num17, num18 + 1] == 'R') { num19++; } if (m_floorPlan[num17 + 1, num18 + 1] == 'R') { num19++; } if (m_floorPlan[num17 + 1, num18] == 'R') { num19++; } if (num19 == 4) { m_doorStyleDoorMaterial = ((WUTIL.RandomSpin() < m_doorStyleRoomWoodDoor) ? (-5) : doorStyleDoorMaterial); int num20 = (floorPlanNESW + WUTIL.DieRoll(4)) & 3; int num21 = 0; int num22 = (num20 + 2) & 3; if (AddRoomWall(val3, num20, 32)) { num21++; } bool flag12 = num21 > 0; num20 = (num20 + WUTIL.RandomSign()) & 3; if (AddRoomWall(val3, num20)) { num21++; } else if (AddRoomWall(val3, num22)) { num21++; if (flag12 && WUTIL.RandomSpin() < m_floorPlanChestChange) { Vector3 position = val3 - MapFwd(num22) + 2f * MapFwd(num22 + 1); position.y = planTilePos.y; Chest((m_roomDecorLevel < 2) ? "TreasureChest_forestcrypt" : "shipwreck_karve_chest", position, num22); } } if (num21 < 2) { AddRoomWall(val3, (num20 + 2) & 3); } } else { if (pillarStyle <= 0) { continue; } int num23 = 0; if (m_floorPlan[num17, num18] != ' ') { num23++; RandomItem(m_floorPlanSpaceItems, planTilePos); } if (m_floorPlan[num17, num18 + 1] != ' ') { num23++; } if (m_floorPlan[num17 + 1, num18] != ' ') { num23++; } if (m_floorPlan[num17 + 1, num18 + 1] != ' ') { num23++; } if (num23 == 4) { int num24 = 0; if (m_floorPlan[num17, num18 + 1] == 'F') { num24 |= 8; } if (m_floorPlan[num17, num18] == 'F') { num24 |= 4; } if (m_floorPlan[num17 + 1, num18] == 'F') { num24 |= 2; } if (m_floorPlan[num17 + 1, num18 + 1] == 'F') { num24 |= 1; } Pillar(val3, RotateRoomCode(num24, floorPlanNESW + 2), pillarStyle); } } } } m_doorStyleDoorMaterial = doorStyleDoorMaterial; m_torchDensity = torchDensity2; } private static bool TrackWalls(Vector3 wallPos, int doorStyle = 0) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((doorStyle & 3) > 0) { return true; } int key = WUTIL.HashMapPos(wallPos); if (m_wallTracker.ContainsKey(key)) { return false; } m_wallTracker.Add(key, doorStyle); return true; } public static bool AddRoomWall(Vector3 center, int nesw, int style = 0) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_002e: 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_0048: Unknown result type (might be due to invalid IL or missing references) Vector3 val = center - 2f * MapFwd(nesw) + 1.5f * MapFwd(nesw + 1); if (!TrackWalls(val, style)) { return false; } OuterWall(1 << nesw, val, style); return true; } public static float FloorPlanOpenness(bool by3x3 = false, float addRoomsChance = 0f) { bool flag = addRoomsChance > 0f; int num = (by3x3 ? 8 : 4); int num2 = (by3x3 ? 1 : 0); int length = m_floorPlan.GetLength(0); int length2 = m_floorPlan.GetLength(1); int num3 = 0; int num4 = 0; for (int i = 1; i < length - num2; i++) { for (int j = 1; j < length2 - num2; j++) { if (m_floorPlan[i, j] == 'F') { num3++; } int num5 = 0; for (int k = -1; k <= num2; k++) { for (int l = -1; l <= num2; l++) { if (m_floorPlan[i + k, j + l] == 'F') { num5++; } } } if (num5 < num) { continue; } num4++; if (flag && (float)WUTIL.RandomSign() < addRoomsChance) { flag = false; for (int m = -1; m <= num2; m++) { for (int n = -1; n <= num2; n++) { if (WUTIL.DieRoll() > 0) { m_floorPlan[i + m, j + n] = 'R'; } } } } else { flag = addRoomsChance > 0f; } } } return (num3 > 0) ? ((float)num4 / (float)num3) : 0f; } public static void RoomPlan(int mapWE = 0, int mapNS = 0, float ceilingHeight = -1f, int[,] roomPlan = null, bool center = false, bool flagOutOfBounds = false, bool recallLocation = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_00e7: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) if (roomPlan == null) { return; } int length = roomPlan.GetLength(0); int length2 = roomPlan.GetLength(1); Vector3 val = 4f * MapFwd(m_floorPlanNESW + 1); Vector3 val2 = 4f * MapFwd(m_floorPlanNESW + 2); if (center) { m_mapLocation = m_floorPlanCenter - val2 * (float)(length >> 1) - val * (float)(length2 >> 1); } else { m_mapLocation -= val * (float)mapWE; m_mapLocation -= val2 * (float)mapNS; } if (recallLocation) { return; } for (int i = 0; i < length2; i++) { int num = ((i == 0) ? 8 : 0); if (i == length2 - 1) { num |= 2; } Vector3 val3 = m_mapLocation + (float)i * val; for (int j = 0; j < length; j++) { int mapPiece = roomPlan[j, i]; int num2 = ((j == 0) ? (num | 1) : num); if (j == length - 1) { num2 |= 4; } if (flagOutOfBounds && OutOfBounds(val3)) { WDBUG.Log($"Room placed out of bounds at {j},{i}"); Torch("piece_groundtorch_blue", val3); } m_entryConnection = j == mapNS && i == mapWE; Room(mapPiece, val3, num2, ceilingHeight, 2f, m_floorPlanNESW); CaptureMapPiece(mapPiece, "room_door", j, i); CaptureMapPiece(mapPiece, "room_door2", j, i, '^'); val3 += val2; } } m_trapdoorUpperOffset = Vector3.zero; m_trapdoorLowerOffset = Vector3.zero; } public static void CreateRandomConnection(Vector3 from_pos, int from_nesw, Vector3 to_pos, int to_nesw, float ceilingHeight = 4f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_031f: 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) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) Vector3 val = to_pos - from_pos; int num = TurnTowardsVector(val, from_nesw); WDBUG.Log($"Entry at {from_pos} requires {num} turns"); int mapPiece = ((num == 0) ? 10 : (1 | ((num > 0) ? 8 : 2))); Room(RotateRoomCode(mapPiece, from_nesw), from_pos, 0, 0f, 0f); if (num != 0) { int num2 = ((num >= 0) ? 1 : (-1)); from_nesw += num2; from_pos += 4f * MapFwd(from_nesw); mapPiece = ((num == 1 || num == -1) ? 10 : ((num < 0) ? 3 : 9)); mapPiece |= ((num == 1 || num == -1) ? 4097 : 8194); Room(RotateRoomCode(mapPiece, from_nesw), from_pos, 0, ceilingHeight); PieceUpright("stone_wall_4x2", from_pos - 2f * MapFwd(from_nesw) + MapFwd(from_nesw + num2) + 2.5f * up, from_nesw); } if (num == 2) { from_nesw++; } int num3 = TurnTowardsVector(-val, to_nesw); WDBUG.Log($"Exit at {to_pos} requires {num3} turns"); mapPiece = ((num3 == 0) ? 10 : (1 | ((num3 > 0) ? 8 : 2))); Room(RotateRoomCode(mapPiece, to_nesw), to_pos, 0, 0f, 0f); if (num3 != 0) { to_nesw += ((num3 >= 0) ? 1 : (-1)); to_pos += 4f * MapFwd(to_nesw); if (num3 == 2) { to_nesw++; to_pos += 4f * MapFwd(to_nesw); Room(RotateRoomCode(9, to_nesw), to_pos, 0, ceilingHeight); } } if (num3 == 2) { to_nesw++; } val = to_pos - from_pos; Vector3 val2 = MapFwd(from_nesw); Vector3 val3 = MapFwd(from_nesw + 1); float num4 = Vector3.Dot(val, val2); float num5 = Vector3.Dot(val, val3); int num6 = (int)Mathf.Abs(num4 / 4f) + 1; int num7 = (int)Mathf.Abs(num5 / 4f); if (num5 < 1f) { val3 *= -1f; } if (Mathf.Abs(num4) - (float)(num6 * 4) > 0.1f) { WDBUG.Log($"Forward extension from exit: {Mathf.Abs(num4) - (float)(num6 * 4)}"); } Vector3 val4 = from_pos; WDBUG.Log($"Under floor size fwd x rht: {num4} x {num5} -> tiles: {num6} x {num7}"); for (int i = 0; i < num6; i++) { Room(0, val4, 0, ceilingHeight); val4 += 4f * val2; } for (int j = 0; j < num7; j++) { Room(0, val4, 0, ceilingHeight); val4 += 4f * val3; } for (int k = 1; k < num6; k++) { Room(0, val4, 0, ceilingHeight); val4 -= 4f * val2; } for (int l = 0; l < num7; l++) { Room(0, val4, 0, ceilingHeight); val4 -= 4f * val3; } } public static void Pit(Vector3 piecePos, float depth = 24f, int stairTowerLevels = 12) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: 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_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0332: 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_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) int floorPlanNESW = m_floorPlanNESW; Vector3 val = 4f * MapFwd(floorPlanNESW); Vector3 val2 = 4f * MapFwd(floorPlanNESW + 1); float mapMaxWallHeight = m_mapMaxWallHeight; float mapLowerFloorHeight = m_mapLowerFloorHeight; m_mapMaxWallHeight = m_mapLowerFloorHeight - 1f; m_mapLowerFloorHeight -= depth; OuterWall(RotateRoomCode(32782, floorPlanNESW), piecePos, 0, 0f); Torch("TorchCrystal,piece_groundtorch_green", piecePos, 0f - depth - 9f); piecePos.y = m_mapWallExclusionHeight - 2f; GateCorridor(piecePos + 0.5f * val2 - 0.5f * MapFwd(floorPlanNESW), floorPlanNESW + 1, 0, 0f, 26); CaptureCapturedGate("pit_door", "pickable", "room_door"); piecePos.y += 1.5f; RoomDoor(-9, piecePos - 0.5f * val, floorPlanNESW + 2, 0.5f * val2); Headstone(piecePos - 0.51f * val - 1.12f * val2, 20, floorPlanNESW + 2, 1.6f); piecePos.y = m_mapWallExclusionHeight - 0.5f; Piece("stone_wall_4x2", piecePos - 0.5f * val2, floorPlanNESW + 3); piecePos.y += 2f; Piece("stone_wall_4x2", piecePos - 0.5f * val2, floorPlanNESW + 3); piecePos.y = m_mapLowerFloorHeight; Vector3 val3 = piecePos + 0.125f * val2 + up; Piece("VegvisirSerpent", piecePos + 0.375f * val2 + 1.5f * up, floorPlanNESW + 2); CaveIn(val3, floorPlanNESW + 1, 2, 3, 2, 0.4f, 2f); CaveIn(val3 - 1.1f * up, floorPlanNESW + 3, 2, 3, 3, 0.25f, 3f); piecePos += val - val2; piecePos.y = m_mapLowerFloorHeight; m_addContainerItems = "FairyTalePages1;PixieDust:3;Crystal:3"; StairTower(piecePos, floorPlanNESW, stairTowerLevels, 42241, 2); piecePos -= val; m_mapMaxWallHeight = piecePos.y + 5.5f; Room(RotateRoomCode(12, floorPlanNESW), piecePos, 0, -1f, 0f); char markMap = 'S'; piecePos -= 0.5f * (MapFwd(floorPlanNESW) + MapFwd(floorPlanNESW + 1)); m_mapLowerFloorHeight = m_mapWallExclusionHeight - 2f; SetPlanTiles(piecePos, ' ', floorPlanNESW, 3, 2); SetPlanTiles(piecePos - val, markMap); SetPlanTiles(piecePos + val2, '.'); SetPlanTiles(piecePos - val + 3f * val2, ' ', floorPlanNESW, 4, 4); SetPlanTiles(piecePos - val + val2, 'F', floorPlanNESW, 1, 2); SetPlanTiles(piecePos + 2f * val2, 'F', floorPlanNESW, 1, 2); SetPlanTiles(piecePos + 4f * val2, 'F', floorPlanNESW, 3); SetPlanTiles(piecePos - val + 4f * val2, 'F', floorPlanNESW, 1, 4); SetPlanTiles(piecePos + 7f * val2, 'F', floorPlanNESW, 8); m_mapMaxWallHeight = mapMaxWallHeight; m_mapLowerFloorHeight = mapLowerFloorHeight; } public static Vector3 StairsToSewers(Vector3 piecePos, int nesw, int style = 0, float exitFloorOffset = 0.13f, bool debugExit = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_00a7: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: 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_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045a: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_135c: Unknown result type (might be due to invalid IL or missing references) //IL_1362: Unknown result type (might be due to invalid IL or missing references) //IL_1363: Unknown result type (might be due to invalid IL or missing references) //IL_1368: Unknown result type (might be due to invalid IL or missing references) //IL_1372: Unknown result type (might be due to invalid IL or missing references) //IL_1377: Unknown result type (might be due to invalid IL or missing references) //IL_137c: Unknown result type (might be due to invalid IL or missing references) //IL_1381: Unknown result type (might be due to invalid IL or missing references) //IL_1388: Unknown result type (might be due to invalid IL or missing references) //IL_138f: Unknown result type (might be due to invalid IL or missing references) //IL_1390: Unknown result type (might be due to invalid IL or missing references) //IL_13ae: Unknown result type (might be due to invalid IL or missing references) //IL_13b5: Unknown result type (might be due to invalid IL or missing references) //IL_13b6: Unknown result type (might be due to invalid IL or missing references) //IL_13bb: Unknown result type (might be due to invalid IL or missing references) //IL_13c0: Unknown result type (might be due to invalid IL or missing references) //IL_13c5: Unknown result type (might be due to invalid IL or missing references) //IL_13ca: Unknown result type (might be due to invalid IL or missing references) //IL_13d1: Unknown result type (might be due to invalid IL or missing references) //IL_13d8: Unknown result type (might be due to invalid IL or missing references) //IL_13d9: Unknown result type (might be due to invalid IL or missing references) //IL_1716: Unknown result type (might be due to invalid IL or missing references) //IL_171c: Unknown result type (might be due to invalid IL or missing references) //IL_171d: Unknown result type (might be due to invalid IL or missing references) //IL_1722: Unknown result type (might be due to invalid IL or missing references) //IL_172c: Unknown result type (might be due to invalid IL or missing references) //IL_172d: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_068c: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_069c: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_175d: Unknown result type (might be due to invalid IL or missing references) //IL_1763: Unknown result type (might be due to invalid IL or missing references) //IL_1764: Unknown result type (might be due to invalid IL or missing references) //IL_1769: Unknown result type (might be due to invalid IL or missing references) //IL_1773: Unknown result type (might be due to invalid IL or missing references) //IL_1774: Unknown result type (might be due to invalid IL or missing references) //IL_17c1: Unknown result type (might be due to invalid IL or missing references) //IL_17a8: Unknown result type (might be due to invalid IL or missing references) //IL_17ae: Unknown result type (might be due to invalid IL or missing references) //IL_17af: Unknown result type (might be due to invalid IL or missing references) //IL_17b4: Unknown result type (might be due to invalid IL or missing references) //IL_17b9: Unknown result type (might be due to invalid IL or missing references) //IL_17ba: Unknown result type (might be due to invalid IL or missing references) //IL_1407: Unknown result type (might be due to invalid IL or missing references) //IL_140e: Unknown result type (might be due to invalid IL or missing references) //IL_140f: Unknown result type (might be due to invalid IL or missing references) //IL_1414: Unknown result type (might be due to invalid IL or missing references) //IL_1419: Unknown result type (might be due to invalid IL or missing references) //IL_17c3: Unknown result type (might be due to invalid IL or missing references) //IL_1443: Unknown result type (might be due to invalid IL or missing references) //IL_144a: Unknown result type (might be due to invalid IL or missing references) //IL_144b: Unknown result type (might be due to invalid IL or missing references) //IL_1450: Unknown result type (might be due to invalid IL or missing references) //IL_17c7: Unknown result type (might be due to invalid IL or missing references) //IL_1515: Unknown result type (might be due to invalid IL or missing references) //IL_151c: Unknown result type (might be due to invalid IL or missing references) //IL_151d: Unknown result type (might be due to invalid IL or missing references) //IL_1522: Unknown result type (might be due to invalid IL or missing references) //IL_1527: Unknown result type (might be due to invalid IL or missing references) //IL_1529: Unknown result type (might be due to invalid IL or missing references) //IL_153d: Unknown result type (might be due to invalid IL or missing references) //IL_1544: Unknown result type (might be due to invalid IL or missing references) //IL_1545: Unknown result type (might be due to invalid IL or missing references) //IL_154a: Unknown result type (might be due to invalid IL or missing references) //IL_1561: Unknown result type (might be due to invalid IL or missing references) //IL_1568: Unknown result type (might be due to invalid IL or missing references) //IL_1569: Unknown result type (might be due to invalid IL or missing references) //IL_156e: Unknown result type (might be due to invalid IL or missing references) //IL_1573: Unknown result type (might be due to invalid IL or missing references) //IL_1575: Unknown result type (might be due to invalid IL or missing references) //IL_1589: Unknown result type (might be due to invalid IL or missing references) //IL_1590: Unknown result type (might be due to invalid IL or missing references) //IL_1591: Unknown result type (might be due to invalid IL or missing references) //IL_1596: Unknown result type (might be due to invalid IL or missing references) //IL_14cf: Unknown result type (might be due to invalid IL or missing references) //IL_15b9: Unknown result type (might be due to invalid IL or missing references) //IL_15c0: Unknown result type (might be due to invalid IL or missing references) //IL_15c1: Unknown result type (might be due to invalid IL or missing references) //IL_15c6: Unknown result type (might be due to invalid IL or missing references) //IL_15dd: Unknown result type (might be due to invalid IL or missing references) //IL_15e4: Unknown result type (might be due to invalid IL or missing references) //IL_15e5: Unknown result type (might be due to invalid IL or missing references) //IL_15ea: Unknown result type (might be due to invalid IL or missing references) //IL_15f4: Unknown result type (might be due to invalid IL or missing references) //IL_15f5: Unknown result type (might be due to invalid IL or missing references) //IL_15fa: Unknown result type (might be due to invalid IL or missing references) //IL_168d: Unknown result type (might be due to invalid IL or missing references) //IL_1693: Unknown result type (might be due to invalid IL or missing references) //IL_1694: Unknown result type (might be due to invalid IL or missing references) //IL_1699: Unknown result type (might be due to invalid IL or missing references) //IL_16a3: Unknown result type (might be due to invalid IL or missing references) //IL_16a8: Unknown result type (might be due to invalid IL or missing references) //IL_16ad: Unknown result type (might be due to invalid IL or missing references) //IL_0761: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Unknown result type (might be due to invalid IL or missing references) //IL_07b1: Unknown result type (might be due to invalid IL or missing references) //IL_07b2: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_16ce: Unknown result type (might be due to invalid IL or missing references) //IL_16d4: Unknown result type (might be due to invalid IL or missing references) //IL_16d5: Unknown result type (might be due to invalid IL or missing references) //IL_16da: Unknown result type (might be due to invalid IL or missing references) //IL_1650: Unknown result type (might be due to invalid IL or missing references) //IL_1656: Unknown result type (might be due to invalid IL or missing references) //IL_1657: Unknown result type (might be due to invalid IL or missing references) //IL_165c: Unknown result type (might be due to invalid IL or missing references) //IL_1668: Unknown result type (might be due to invalid IL or missing references) //IL_166d: Unknown result type (might be due to invalid IL or missing references) //IL_1672: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_088a: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_089d: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08bc: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08c9: Unknown result type (might be due to invalid IL or missing references) //IL_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_08cf: Unknown result type (might be due to invalid IL or missing references) //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_0925: Unknown result type (might be due to invalid IL or missing references) //IL_0926: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_093f: Unknown result type (might be due to invalid IL or missing references) //IL_0940: Unknown result type (might be due to invalid IL or missing references) //IL_0945: Unknown result type (might be due to invalid IL or missing references) //IL_094a: Unknown result type (might be due to invalid IL or missing references) //IL_094c: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0954: Unknown result type (might be due to invalid IL or missing references) //IL_0959: Unknown result type (might be due to invalid IL or missing references) //IL_095e: Unknown result type (might be due to invalid IL or missing references) //IL_0a29: Unknown result type (might be due to invalid IL or missing references) //IL_0a30: Unknown result type (might be due to invalid IL or missing references) //IL_0a31: Unknown result type (might be due to invalid IL or missing references) //IL_0a36: Unknown result type (might be due to invalid IL or missing references) //IL_0a40: Unknown result type (might be due to invalid IL or missing references) //IL_0a41: Unknown result type (might be due to invalid IL or missing references) //IL_0a46: Unknown result type (might be due to invalid IL or missing references) //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a5d: Unknown result type (might be due to invalid IL or missing references) //IL_0a64: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a6a: Unknown result type (might be due to invalid IL or missing references) //IL_0b77: Unknown result type (might be due to invalid IL or missing references) //IL_0b7c: Unknown result type (might be due to invalid IL or missing references) //IL_0b7d: Unknown result type (might be due to invalid IL or missing references) //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0b92: Unknown result type (might be due to invalid IL or missing references) //IL_0b33: Unknown result type (might be due to invalid IL or missing references) //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0b39: Unknown result type (might be due to invalid IL or missing references) //IL_0b3e: Unknown result type (might be due to invalid IL or missing references) //IL_0b48: Unknown result type (might be due to invalid IL or missing references) //IL_0b49: Unknown result type (might be due to invalid IL or missing references) //IL_0b4e: Unknown result type (might be due to invalid IL or missing references) //IL_0aa5: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0acd: Unknown result type (might be due to invalid IL or missing references) //IL_0ace: Unknown result type (might be due to invalid IL or missing references) //IL_0ad3: Unknown result type (might be due to invalid IL or missing references) //IL_0be5: Unknown result type (might be due to invalid IL or missing references) //IL_0bec: Unknown result type (might be due to invalid IL or missing references) //IL_0bed: Unknown result type (might be due to invalid IL or missing references) //IL_0bf2: Unknown result type (might be due to invalid IL or missing references) //IL_0bfc: Unknown result type (might be due to invalid IL or missing references) //IL_0bfd: Unknown result type (might be due to invalid IL or missing references) //IL_0c02: Unknown result type (might be due to invalid IL or missing references) //IL_0d96: Unknown result type (might be due to invalid IL or missing references) //IL_0d9b: Unknown result type (might be due to invalid IL or missing references) //IL_0d9c: Unknown result type (might be due to invalid IL or missing references) //IL_0da1: Unknown result type (might be due to invalid IL or missing references) //IL_0dab: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0db1: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0dcb: Unknown result type (might be due to invalid IL or missing references) //IL_0dcc: Unknown result type (might be due to invalid IL or missing references) //IL_0dd1: Unknown result type (might be due to invalid IL or missing references) //IL_0ddb: Unknown result type (might be due to invalid IL or missing references) //IL_0ddc: Unknown result type (might be due to invalid IL or missing references) //IL_0de1: Unknown result type (might be due to invalid IL or missing references) //IL_0de8: Unknown result type (might be due to invalid IL or missing references) //IL_0ded: Unknown result type (might be due to invalid IL or missing references) //IL_0df2: Unknown result type (might be due to invalid IL or missing references) //IL_0c43: Unknown result type (might be due to invalid IL or missing references) //IL_0c4a: Unknown result type (might be due to invalid IL or missing references) //IL_0c4b: Unknown result type (might be due to invalid IL or missing references) //IL_0c50: Unknown result type (might be due to invalid IL or missing references) //IL_0c5a: Unknown result type (might be due to invalid IL or missing references) //IL_0c5b: Unknown result type (might be due to invalid IL or missing references) //IL_0c60: Unknown result type (might be due to invalid IL or missing references) //IL_0c65: Unknown result type (might be due to invalid IL or missing references) //IL_0c6d: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c77: Unknown result type (might be due to invalid IL or missing references) //IL_0c7c: Unknown result type (might be due to invalid IL or missing references) //IL_0eed: Unknown result type (might be due to invalid IL or missing references) //IL_0ef4: Unknown result type (might be due to invalid IL or missing references) //IL_0ef5: Unknown result type (might be due to invalid IL or missing references) //IL_0efa: Unknown result type (might be due to invalid IL or missing references) //IL_0f04: Unknown result type (might be due to invalid IL or missing references) //IL_0f05: Unknown result type (might be due to invalid IL or missing references) //IL_0f0a: Unknown result type (might be due to invalid IL or missing references) //IL_0f0f: Unknown result type (might be due to invalid IL or missing references) //IL_0f11: Unknown result type (might be due to invalid IL or missing references) //IL_0f21: Unknown result type (might be due to invalid IL or missing references) //IL_0f28: Unknown result type (might be due to invalid IL or missing references) //IL_0f29: Unknown result type (might be due to invalid IL or missing references) //IL_0f2e: Unknown result type (might be due to invalid IL or missing references) //IL_0ff4: Unknown result type (might be due to invalid IL or missing references) //IL_0ff9: Unknown result type (might be due to invalid IL or missing references) //IL_0ffa: Unknown result type (might be due to invalid IL or missing references) //IL_0fff: Unknown result type (might be due to invalid IL or missing references) //IL_1009: Unknown result type (might be due to invalid IL or missing references) //IL_100a: Unknown result type (might be due to invalid IL or missing references) //IL_100f: Unknown result type (might be due to invalid IL or missing references) //IL_0f69: Unknown result type (might be due to invalid IL or missing references) //IL_0d2f: Unknown result type (might be due to invalid IL or missing references) //IL_0d36: Unknown result type (might be due to invalid IL or missing references) //IL_0d37: Unknown result type (might be due to invalid IL or missing references) //IL_0d3c: Unknown result type (might be due to invalid IL or missing references) //IL_0d46: Unknown result type (might be due to invalid IL or missing references) //IL_0d47: Unknown result type (might be due to invalid IL or missing references) //IL_0d4c: Unknown result type (might be due to invalid IL or missing references) //IL_0d53: Unknown result type (might be due to invalid IL or missing references) //IL_0d58: Unknown result type (might be due to invalid IL or missing references) //IL_0d5d: Unknown result type (might be due to invalid IL or missing references) //IL_0cdd: Unknown result type (might be due to invalid IL or missing references) //IL_0ce4: Unknown result type (might be due to invalid IL or missing references) //IL_0ce5: Unknown result type (might be due to invalid IL or missing references) //IL_0cea: Unknown result type (might be due to invalid IL or missing references) //IL_0cf4: Unknown result type (might be due to invalid IL or missing references) //IL_0cf5: Unknown result type (might be due to invalid IL or missing references) //IL_0cfa: Unknown result type (might be due to invalid IL or missing references) //IL_1072: Unknown result type (might be due to invalid IL or missing references) //IL_1077: Unknown result type (might be due to invalid IL or missing references) //IL_1078: Unknown result type (might be due to invalid IL or missing references) //IL_107d: Unknown result type (might be due to invalid IL or missing references) //IL_1087: Unknown result type (might be due to invalid IL or missing references) //IL_1088: Unknown result type (might be due to invalid IL or missing references) //IL_108d: Unknown result type (might be due to invalid IL or missing references) //IL_0f8a: Unknown result type (might be due to invalid IL or missing references) //IL_0f91: Unknown result type (might be due to invalid IL or missing references) //IL_0f92: Unknown result type (might be due to invalid IL or missing references) //IL_0f97: Unknown result type (might be due to invalid IL or missing references) //IL_10e0: Unknown result type (might be due to invalid IL or missing references) //IL_10e7: Unknown result type (might be due to invalid IL or missing references) //IL_10e8: Unknown result type (might be due to invalid IL or missing references) //IL_10ed: Unknown result type (might be due to invalid IL or missing references) //IL_10f7: Unknown result type (might be due to invalid IL or missing references) //IL_10f8: Unknown result type (might be due to invalid IL or missing references) //IL_10fd: Unknown result type (might be due to invalid IL or missing references) //IL_1291: Unknown result type (might be due to invalid IL or missing references) //IL_1296: Unknown result type (might be due to invalid IL or missing references) //IL_1297: Unknown result type (might be due to invalid IL or missing references) //IL_129c: Unknown result type (might be due to invalid IL or missing references) //IL_12a6: Unknown result type (might be due to invalid IL or missing references) //IL_12a7: Unknown result type (might be due to invalid IL or missing references) //IL_12ac: Unknown result type (might be due to invalid IL or missing references) //IL_12bf: Unknown result type (might be due to invalid IL or missing references) //IL_12c6: Unknown result type (might be due to invalid IL or missing references) //IL_12c7: Unknown result type (might be due to invalid IL or missing references) //IL_12cc: Unknown result type (might be due to invalid IL or missing references) //IL_12d6: Unknown result type (might be due to invalid IL or missing references) //IL_12d7: Unknown result type (might be due to invalid IL or missing references) //IL_12dc: Unknown result type (might be due to invalid IL or missing references) //IL_12e3: Unknown result type (might be due to invalid IL or missing references) //IL_12e8: Unknown result type (might be due to invalid IL or missing references) //IL_12ed: Unknown result type (might be due to invalid IL or missing references) //IL_113e: Unknown result type (might be due to invalid IL or missing references) //IL_1145: Unknown result type (might be due to invalid IL or missing references) //IL_1146: Unknown result type (might be due to invalid IL or missing references) //IL_114b: Unknown result type (might be due to invalid IL or missing references) //IL_1155: Unknown result type (might be due to invalid IL or missing references) //IL_1156: Unknown result type (might be due to invalid IL or missing references) //IL_115b: Unknown result type (might be due to invalid IL or missing references) //IL_1160: Unknown result type (might be due to invalid IL or missing references) //IL_1168: Unknown result type (might be due to invalid IL or missing references) //IL_1171: Unknown result type (might be due to invalid IL or missing references) //IL_1172: Unknown result type (might be due to invalid IL or missing references) //IL_1177: Unknown result type (might be due to invalid IL or missing references) //IL_122a: Unknown result type (might be due to invalid IL or missing references) //IL_1231: Unknown result type (might be due to invalid IL or missing references) //IL_1232: Unknown result type (might be due to invalid IL or missing references) //IL_1237: Unknown result type (might be due to invalid IL or missing references) //IL_1241: Unknown result type (might be due to invalid IL or missing references) //IL_1242: Unknown result type (might be due to invalid IL or missing references) //IL_1247: Unknown result type (might be due to invalid IL or missing references) //IL_124e: Unknown result type (might be due to invalid IL or missing references) //IL_1253: Unknown result type (might be due to invalid IL or missing references) //IL_1258: Unknown result type (might be due to invalid IL or missing references) //IL_11d8: Unknown result type (might be due to invalid IL or missing references) //IL_11df: Unknown result type (might be due to invalid IL or missing references) //IL_11e0: Unknown result type (might be due to invalid IL or missing references) //IL_11e5: Unknown result type (might be due to invalid IL or missing references) //IL_11ef: Unknown result type (might be due to invalid IL or missing references) //IL_11f0: Unknown result type (might be due to invalid IL or missing references) //IL_11f5: Unknown result type (might be due to invalid IL or missing references) Vector3 val = MapFwd(nesw); Vector3 val2 = MapFwd(nesw + 1); bool flag = (style & 1) > 0; bool flag2 = (style & 2) > 0; bool flag3 = (style & 4) > 0; bool raiseEntryCeiling = (style & 8) > 0; bool flag4 = (style & 0x10) > 0; bool flag5 = (style & 0x20) > 0; bool flag6 = (style & 0xC0) > 0; bool flag7 = (style & 0x80) > 0; bool flag8 = flag7 && !flag; if (flag2) { Vector3 position = piecePos + 0.25f * val; if (flag) { position.y += 0.5f; } FourPieces("stone_floor_2x2", position, 1.49f * val2, nesw, upright: true); FourPieces("stone_floor_2x2", position, val2, nesw, upright: false, 1.5f, flag ? 5 : 15); FourPieces("stone_pillar", piecePos, 2.25f * val2, nesw, upright: false, 1f, 3); FourPieces("stone_pillar", piecePos - val2 + (flag3 ? 1.45f : 0.75f) * val, val2, nesw, upright: false, 1f, 12); } if (flag8) { Piece("stone_stair", piecePos - 1.75f * val - 2.125f * up, nesw + 2); CaptureNextPlacedAs("room_door"); Piece("CryptGate", piecePos + 0.25f * val - up, nesw + 2); } piecePos.y -= 1.5f; if (flag) { Piece("stone_floor_2x2", piecePos - 0.25f * val2, 0); piecePos.y += 0.5f; if (flag2) { Piece("stone_stair", piecePos, nesw + 2); } else { Piece("stone_stair", piecePos - 1.25f * val2, nesw + 2); Piece("stone_stair", piecePos + 0.75f * val2, nesw + 2); } piecePos.y += 0.5f; } piecePos.y += 1.5f; piecePos += 2f * val; FourPieces("stone_floor_2x2", piecePos, (flag2 ? 1.425f : 1.25f) * val2, nesw, upright: true, 1f, 3); piecePos -= 0.25f * val2; FourPieces("stone_floor_2x2", piecePos + 1.25f * val, val2, nesw + 1, upright: true); FourPieces("stone_floor_2x2", piecePos, val2, nesw, upright: false, 1.5f); piecePos.y -= 2.625f; piecePos -= 4f * val2; GateCorridor(piecePos, nesw + 1, 1, -1f, 136, 3); piecePos.y += 1.6f; if (!flag8) { WallTorch(piecePos + 1.5f * val - 0.1f * val2, nesw - 1); } piecePos.y += 0.025f; FourPieces("stone_floor_2x2", piecePos - val2 + 1.25f * val, val, nesw, upright: false, 1.5f); PieceUpright("stone_floor", piecePos - 2f * val2 + 1.25f * val, nesw); piecePos.y += 0.25f; FourPieces("stone_floor_2x2", piecePos - 0.75f * val2 + 1.25f * val, 2.5f * val, nesw + 1, upright: true); piecePos.y -= 3.75f; piecePos += 2.5f * val + 4f * val2; GateCorridor(piecePos, nesw - 1, 2, -1f, 136); piecePos.y += 1.6f; piecePos += 0.75f * val2 - val; FourPieces("stone_floor_2x2", piecePos, val, nesw, upright: false, 1.6f, 3); FourPieces("stone_floor_2x2", piecePos + 1.25f * val2 + 0.5f * up, val, nesw, upright: true, 1f, 3); FourPieces("stone_floor_2x2", piecePos + 1.25f * val, val, nesw + 1, upright: true, 1f, 3); piecePos -= 8f * val; piecePos.y -= 5.75f; GateCorridor(piecePos, nesw, 4, -1f, 136, 15, raiseEntryCeiling); m_buildReport = 0; bool flag9 = false; bool flag10 = false; bool flag11 = false; bool flag12 = true; bool flag13 = flag7; piecePos.y += 1.5f; Vector3 val3 = piecePos; if (flag7) { flag9 = flag6 && WUTIL.TestLuck(); flag10 = !WUTIL.TestLuck(0.05f); Vector3 val4 = GetPlanTilePos(val3); val4.y = val3.y; Vector3 val5 = val4 - val3; float num = Vector3.Dot(val, val5); float num2 = Vector3.Dot(val2, val5) - 0.75f; float num3 = exitFloorOffset + 2.5f; float num4 = exitFloorOffset - 0.5f; int num5 = 0; int num6 = 0; int num7 = 0; if (num2 > -0.25f) { num5 = 4; } else if (num2 > -1f) { num6 = 1; } else { num5 = (int)(0.5f - num2); } if (num > 0f) { num7 = 1 + (int)(num + 0.75f); } bool flag14 = num < 0.75f; int num8 = ((num7 == 2) ? 3 : 4); int num9 = ((num7 == 2) ? 5 : 3); if (debugExit) { Torch("piece_groundtorch_wood", val3 + 0.75f * val2, -1.5f); Torch("TorchCrystal", val4, -1.5f); WDBUG.Log($"Landing {val3} (wood torch: {val3 + 0.75f * val2}) nesw: {nesw}"); WDBUG.Log($"tileOffset: {val5} -> fwd: {num} drht: {num2} ({num2 + 0.75f}) ->"); WDBUG.Log($"fwdRoof: {num7} lhsRoof: {num5} rhsRoof: {num6}"); } switch (num7) { case 3: if (debugExit) { WDBUG.Log("Entry requires tile moved back, extra 1x2 front+back + 2x4 lhs roof"); } FloorPartial(val3 - val2, nesw + 1, 1, 4, num3); FloorPartial(val3 + 11f * val, nesw + 1, 1, 2, num3); FloorPartial(val4 - val - 1.5f * val2, nesw, 2, 4, num3); m_buildReport |= 64; flag13 = false; num7 = 0; break; case 2: if (debugExit) { WDBUG.Log("Placing 2x4 front roof, extending partial side roofs, blocking side walls"); } FloorPartial(val3 - val2, nesw + 1, 2, 4, num3); val4 -= 4f * val; val3 -= 4f * val; num8 += 3; num9 -= 2; m_buildReport |= 32; break; case 1: if (debugExit) { WDBUG.Log($"Ignoring fwdRoof: {num7}"); } break; default: if (debugExit) { WDBUG.Log("No front roof required"); } break; } flag11 = num5 > 1 || (num5 == 1 && !flag14); switch (num5) { case 4: { if (debugExit) { WDBUG.Log($"Placing LHS roof 4 x 2 * {num8}, LHS required"); } num6 = 2; Vector3 val6 = val4 + (float)(num9 + 1) * val - 4f * val2; Floor(val6, nesw, num3, 0, 1, ceiling: true); Floor(val6 + 4f * val, nesw, num3, 0, 1, ceiling: true); if (WUTIL.RandomSpin() > 0.5f) { Torch("GuckBurner", val6, 1f, nesw); } if (num7 == 2) { Floor(val6 + 8f * val, nesw, num3, 0, 1, ceiling: true); } m_buildReport |= 4; break; } case 3: if (debugExit) { WDBUG.Log($"Placing LHS roof 3 x 2 * {num8}"); } num6 = 3; FloorPartial(val4 + (float)num9 * val + 0.5f * val2, nesw, -3, 2 * num8, num3); break; case 2: num6 = 4; FloorPartial(val4 + (float)num9 * val - 1.5f * val2, nesw, 2, 2 * num8, num3); break; case 1: if (num7 == 2) { if (debugExit) { WDBUG.Log("Placing 1x2 lhs roof filler"); } FloorPartial(val4 + 1.5f * val - 2f * val2, nesw, 1, 2, num3); } else if (flag14) { if (debugExit) { WDBUG.Log("Placing 4x8 lhs wall"); } Vector3 val7 = val4 + 4.5f * val - 2f * val2; for (int i = 0; i < 4; i++) { Wall(val7 + (float)((i & 1) * 4) * val, nesw - 1, 2, 0, (float)(i & 2) + num4 - 1f); } if (num2 < -1.1f) { if (debugExit) { WDBUG.Log("Placing 2x4 lhs wall endcap"); } Wall(val4 + 2f * val - 1.5f * val2, nesw, 0, 2, num4); } else { if (debugExit) { WDBUG.Log("Placing 1x4 lhs wall endcap"); } Pillar(val4 + 2f * val - 2f * val2 + num4 * up); } } else { if (debugExit) { WDBUG.Log("Placing 1x8 lhs roof and back pillar - exposed lhs side"); } FloorPartial(val4 + (float)num9 * val - 1.4f * val2, nesw, -1, 2 * num8, num3); Pillar(val4 + 10f * val - 2f * val2 + num4 * up); } break; default: if (debugExit) { flag11 = true; WDBUG.Log($"Should have exposed lhs, cellarAccess: {flag11}"); } break; } flag12 = num6 > 1 || (num6 == 1 && !flag14); if (debugExit) { WDBUG.Log($"Exit build fwdRoof: {num7} lhsRoof: {num5} rhsRoof: {num6} depth: {num8} lhsAccess: {flag11} rhsAccess: {flag12}"); } switch (num6) { case 4: { if (debugExit) { WDBUG.Log($"Placing 4x{num8} rhs roof above tile, RHS required"); } Vector3 val9 = val4 + (float)(num9 + 1) * val + 4f * val2; Floor(val9, nesw, num3, 0, 1, ceiling: true); Floor(val9 + 4f * val, nesw, num3, 0, 1, ceiling: true); if (WUTIL.RandomSpin() > 0.5f) { Torch("GuckBurner", val9, 1f, nesw); } if (num7 == 2) { Floor(val9 + 8f * val, nesw, num3, 0, 1, ceiling: true); } m_buildReport |= 1; break; } case 3: if (debugExit) { WDBUG.Log($"Placing 3x{num8} rhs roof above tile, RHS required"); } FloorPartial(val4 + (float)num9 * val + 3.5f * val2, nesw, 3, 2 * num8, num3); m_buildReport |= 1; break; case 2: if (debugExit) { WDBUG.Log($"Placing 2x{num8} rhs roof at height offset: {num3}, no RHS Required"); } FloorPartial(val4 + (float)num9 * val + 0.5f * val2, nesw, 2, 2 * num8, num3); break; case 1: if (num7 == 2) { if (debugExit) { WDBUG.Log("Placing 1x2 rhs roof filler"); } FloorPartial(val4 + 1.5f * val + 2f * val2, nesw, 1, 2, num3); } else if (flag14) { if (debugExit) { WDBUG.Log("Placing 4x8 rhs wall"); } Vector3 val8 = val4 + 4.5f * val + 2f * val2; for (int j = 0; j < 4; j++) { Wall(val8 + (float)((j & 1) * 4) * val, nesw - 1, 2, 0, (float)(j & 2) + num4 - 1f); } if (num2 < -1.1f) { if (debugExit) { WDBUG.Log("Placing 2x4 rhs wall endcap"); } Wall(val4 + 2f * val + 1.5f * val2, nesw, 0, 2, num4); } else { if (debugExit) { WDBUG.Log("Placing 1x4 rhs wall endcap"); } Pillar(val4 + 2f * val + 2f * val2 + num4 * up); } } else { if (debugExit) { WDBUG.Log("Placing 1x8 rhs roof - exposed RHS"); } FloorPartial(val4 + (float)num9 * val + 1.5f * val2, nesw, 1, 2 * num8, num3); Pillar(val4 + 10f * val + 2f * val2 + num4 * up); } break; default: if (debugExit) { flag12 = true; WDBUG.Log($"Should have exposed rhs, cellarAccess: {flag12}"); } break; } flag11 &= WUTIL.TestLuck(); flag12 &= WUTIL.TestLuck(); } if (flag6) { Vector3 val10 = piecePos + 3f * val - 2f * up; FourPieces("stone_floor_2x2", val10, 1.25f * val2, nesw, upright: true, 1f, 5); val10 += 2f * val + up; FourPieces("stone_floor_2x2", val10, 1.25f * val2, nesw, upright: true, 1f, ((!flag11) ? 4 : 0) | ((!flag12) ? 1 : 0)); val10 += 1.25f * val2; int num10 = WUTIL.DieRoll(3); if (flag11 && flag10) { CaptureNextPlacedAs("room_door2"); Piece("CryptGate", val10 - 2.5f * val2, nesw - 1); if (num10 > 0) { CaptureCapturedGate("sewer_gate", (num10 == 1) ? "pickable" : "stuck", "room_door2"); num10 = 0; } else if (flag12) { num10 = WUTIL.DieRoll(2) + 1; } } if (flag12 && flag10) { CaptureNextPlacedAs("room_door2"); Piece("CryptGate", val10, nesw + 1); if (num10 > 0) { CaptureCapturedGate("sewer_gate", (num10 == 1) ? "pickable" : "stuck", "room_door2"); } } val10 += 2f * val; Wall(val10, nesw - 1, 1, 2, -1f); Wall(val10 - 2.5f * val2, nesw + 1, 1, 2, -1f); val10 += 2f * val; Wall(val10, nesw - 1, 1, 2); Wall(val10 - 2.5f * val2, nesw + 1, 1, 2); if (!flag7) { Wall(val10 - 3.5f * val2, nesw + 1, 0, 2, 1f); Wall(val10 - 3.5f * val2 - 8f * val, nesw + 1, 0, 2, 1f); } if (flag11 || flag12) { if (flag9) { m_addContainerItems = "+Guck"; string name = (WUTIL.TestLuck() ? "TreasureChest_sunkencrypt" : "TreasureChest_swamp"); Chest(name, piecePos + 3f * val + (exitFloorOffset - 1.125f) * up, nesw); } else { Piece("stone_floor_2x2", piecePos + 3f * val - 0.5f * up, nesw); } if (flag13) { Wall(piecePos + 9f * val, nesw, 0, 1); } } } else { piecePos.y += 1f; if (flag4) { FourPieces("stone_wall_2x1", piecePos + 0.5f * val, 2.25f * val2, nesw, upright: true, 1f, 12); } else if (flag5) { FourPieces("stone_wall_2x1", piecePos + 2.25f * val, 2.25f * val2, nesw, upright: true, 1f, 3); } piecePos.y -= 1f; } return flag7 ? val3 : (piecePos - 2f * val - val2); } public static void FloorPartial(Vector3 position, int nesw, int width = 1, int depth = 1, float heightOffset = 0f) { //IL_0064: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) int num = ((width >= 0) ? 1 : (-1)); width *= num; if ((depth & 1) > 0 || width < 1 || width > 3 || depth < 1) { WDBUG.Log($"PartialCeiling not implemented for width: {width} depth: {depth}"); return; } depth >>= 1; Vector3 val = 2f * MapFwd(nesw++); position.y += heightOffset; if ((width & 1) > 0) { for (int i = 0; i < depth; i++) { Piece("stone_wall_2x1", position + (float)i * val, nesw); } if (width == 1) { return; } position += (float)num * 1.5f * MapFwd(nesw); } else { position += (float)num * 0.5f * MapFwd(nesw); } if ((depth & 1) > 0) { Piece("stone_floor_2x2", position, nesw); position += 1.5f * val; } else { position += 0.5f * val; } for (int j = 0; j < depth; j += 2) { Piece("stone_wall_4x2", position + (float)j * val, nesw, 90f); } } public static void StairTower(Vector3 piecePos, int nesw, int levels = 4, int style = 0, int corridorLength = 0, bool exitFloor = true, int spireHeight = 0) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0205: 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_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_024c: 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_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_0690: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0712: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Unknown result type (might be due to invalid IL or missing references) //IL_0728: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_080a: Unknown result type (might be due to invalid IL or missing references) //IL_0821: Unknown result type (might be due to invalid IL or missing references) //IL_084a: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_0889: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_0992: Unknown result type (might be due to invalid IL or missing references) //IL_0997: Unknown result type (might be due to invalid IL or missing references) //IL_099e: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_09a5: Unknown result type (might be due to invalid IL or missing references) //IL_09a7: Unknown result type (might be due to invalid IL or missing references) //IL_09a9: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_1067: Unknown result type (might be due to invalid IL or missing references) //IL_108b: Unknown result type (might be due to invalid IL or missing references) //IL_1095: Unknown result type (might be due to invalid IL or missing references) //IL_109a: Unknown result type (might be due to invalid IL or missing references) //IL_109f: Unknown result type (might be due to invalid IL or missing references) //IL_10ca: Unknown result type (might be due to invalid IL or missing references) //IL_1006: Unknown result type (might be due to invalid IL or missing references) //IL_100b: Unknown result type (might be due to invalid IL or missing references) //IL_1010: Unknown result type (might be due to invalid IL or missing references) //IL_101b: Unknown result type (might be due to invalid IL or missing references) //IL_1020: Unknown result type (might be due to invalid IL or missing references) //IL_1025: Unknown result type (might be due to invalid IL or missing references) //IL_1027: Unknown result type (might be due to invalid IL or missing references) //IL_1029: Unknown result type (might be due to invalid IL or missing references) //IL_102b: Unknown result type (might be due to invalid IL or missing references) //IL_1030: Unknown result type (might be due to invalid IL or missing references) //IL_1032: Unknown result type (might be due to invalid IL or missing references) //IL_09ed: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Unknown result type (might be due to invalid IL or missing references) //IL_09f6: Unknown result type (might be due to invalid IL or missing references) //IL_09fb: Unknown result type (might be due to invalid IL or missing references) //IL_0a18: Unknown result type (might be due to invalid IL or missing references) //IL_0a1a: Unknown result type (might be due to invalid IL or missing references) //IL_0a1c: Unknown result type (might be due to invalid IL or missing references) //IL_0a34: Unknown result type (might be due to invalid IL or missing references) //IL_0a3b: Unknown result type (might be due to invalid IL or missing references) //IL_0a3d: Unknown result type (might be due to invalid IL or missing references) //IL_0a42: Unknown result type (might be due to invalid IL or missing references) //IL_118d: Unknown result type (might be due to invalid IL or missing references) //IL_1195: Unknown result type (might be due to invalid IL or missing references) //IL_119d: Unknown result type (might be due to invalid IL or missing references) //IL_11a2: Unknown result type (might be due to invalid IL or missing references) //IL_11a7: Unknown result type (might be due to invalid IL or missing references) //IL_11ac: Unknown result type (might be due to invalid IL or missing references) //IL_0a71: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Unknown result type (might be due to invalid IL or missing references) //IL_0a84: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0b0d: Unknown result type (might be due to invalid IL or missing references) //IL_0b14: Unknown result type (might be due to invalid IL or missing references) //IL_0b16: Unknown result type (might be due to invalid IL or missing references) //IL_0b1b: Unknown result type (might be due to invalid IL or missing references) //IL_0b20: Unknown result type (might be due to invalid IL or missing references) //IL_0b37: Unknown result type (might be due to invalid IL or missing references) //IL_0b4c: Unknown result type (might be due to invalid IL or missing references) //IL_0b55: Unknown result type (might be due to invalid IL or missing references) //IL_0b5a: Unknown result type (might be due to invalid IL or missing references) //IL_0b5f: Unknown result type (might be due to invalid IL or missing references) //IL_0b64: Unknown result type (might be due to invalid IL or missing references) //IL_0eca: Unknown result type (might be due to invalid IL or missing references) //IL_0ed1: Unknown result type (might be due to invalid IL or missing references) //IL_0ed3: Unknown result type (might be due to invalid IL or missing references) //IL_0ed8: Unknown result type (might be due to invalid IL or missing references) //IL_0d3c: Unknown result type (might be due to invalid IL or missing references) //IL_0bf6: Unknown result type (might be due to invalid IL or missing references) //IL_0bf8: Unknown result type (might be due to invalid IL or missing references) //IL_0bfa: Unknown result type (might be due to invalid IL or missing references) //IL_0c04: Unknown result type (might be due to invalid IL or missing references) //IL_0c06: Unknown result type (might be due to invalid IL or missing references) //IL_0c0b: Unknown result type (might be due to invalid IL or missing references) //IL_0c10: Unknown result type (might be due to invalid IL or missing references) //IL_0c12: Unknown result type (might be due to invalid IL or missing references) //IL_0b6f: Unknown result type (might be due to invalid IL or missing references) //IL_0b73: Unknown result type (might be due to invalid IL or missing references) //IL_0b78: Unknown result type (might be due to invalid IL or missing references) //IL_0b82: Unknown result type (might be due to invalid IL or missing references) //IL_0b87: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0ab8: Unknown result type (might be due to invalid IL or missing references) //IL_0abf: Unknown result type (might be due to invalid IL or missing references) //IL_0ac1: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0f55: Unknown result type (might be due to invalid IL or missing references) //IL_0f5e: Unknown result type (might be due to invalid IL or missing references) //IL_0f63: Unknown result type (might be due to invalid IL or missing references) //IL_0f68: Unknown result type (might be due to invalid IL or missing references) //IL_0f6d: Unknown result type (might be due to invalid IL or missing references) //IL_0f20: Unknown result type (might be due to invalid IL or missing references) //IL_0f27: Unknown result type (might be due to invalid IL or missing references) //IL_0f29: Unknown result type (might be due to invalid IL or missing references) //IL_0f2e: Unknown result type (might be due to invalid IL or missing references) //IL_0efe: Unknown result type (might be due to invalid IL or missing references) //IL_0f00: Unknown result type (might be due to invalid IL or missing references) //IL_0f02: Unknown result type (might be due to invalid IL or missing references) //IL_0dd0: Unknown result type (might be due to invalid IL or missing references) //IL_0dd2: Unknown result type (might be due to invalid IL or missing references) //IL_0dd4: Unknown result type (might be due to invalid IL or missing references) //IL_0dd9: Unknown result type (might be due to invalid IL or missing references) //IL_0de0: Unknown result type (might be due to invalid IL or missing references) //IL_0df4: Unknown result type (might be due to invalid IL or missing references) //IL_0dfb: Unknown result type (might be due to invalid IL or missing references) //IL_0dfd: Unknown result type (might be due to invalid IL or missing references) //IL_0e02: Unknown result type (might be due to invalid IL or missing references) //IL_0e1a: Unknown result type (might be due to invalid IL or missing references) //IL_0e21: Unknown result type (might be due to invalid IL or missing references) //IL_0e23: Unknown result type (might be due to invalid IL or missing references) //IL_0e28: Unknown result type (might be due to invalid IL or missing references) //IL_0e2d: Unknown result type (might be due to invalid IL or missing references) //IL_0e34: Unknown result type (might be due to invalid IL or missing references) //IL_0e36: Unknown result type (might be due to invalid IL or missing references) //IL_0e3b: Unknown result type (might be due to invalid IL or missing references) //IL_0e57: Unknown result type (might be due to invalid IL or missing references) //IL_0e59: Unknown result type (might be due to invalid IL or missing references) //IL_0e5b: Unknown result type (might be due to invalid IL or missing references) //IL_0e87: Unknown result type (might be due to invalid IL or missing references) //IL_0e89: Unknown result type (might be due to invalid IL or missing references) //IL_0e8b: Unknown result type (might be due to invalid IL or missing references) //IL_0d5a: Unknown result type (might be due to invalid IL or missing references) //IL_0d61: Unknown result type (might be due to invalid IL or missing references) //IL_0d63: Unknown result type (might be due to invalid IL or missing references) //IL_0d68: Unknown result type (might be due to invalid IL or missing references) //IL_0d6d: Unknown result type (might be due to invalid IL or missing references) //IL_0d84: Unknown result type (might be due to invalid IL or missing references) //IL_0d86: Unknown result type (might be due to invalid IL or missing references) //IL_0da5: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_0dae: Unknown result type (might be due to invalid IL or missing references) //IL_0db3: Unknown result type (might be due to invalid IL or missing references) //IL_0cb6: Unknown result type (might be due to invalid IL or missing references) //IL_0cbd: Unknown result type (might be due to invalid IL or missing references) //IL_0cbf: Unknown result type (might be due to invalid IL or missing references) //IL_0cc4: Unknown result type (might be due to invalid IL or missing references) //IL_0cc9: Unknown result type (might be due to invalid IL or missing references) //IL_0ce0: Unknown result type (might be due to invalid IL or missing references) //IL_0c4a: Unknown result type (might be due to invalid IL or missing references) //IL_0c51: Unknown result type (might be due to invalid IL or missing references) //IL_0c53: Unknown result type (might be due to invalid IL or missing references) //IL_0c58: Unknown result type (might be due to invalid IL or missing references) //IL_0c5d: Unknown result type (might be due to invalid IL or missing references) //IL_0c74: Unknown result type (might be due to invalid IL or missing references) //IL_0c76: Unknown result type (might be due to invalid IL or missing references) //IL_0c95: Unknown result type (might be due to invalid IL or missing references) //IL_0c97: Unknown result type (might be due to invalid IL or missing references) //IL_0c99: Unknown result type (might be due to invalid IL or missing references) //IL_1139: Unknown result type (might be due to invalid IL or missing references) //IL_1142: Unknown result type (might be due to invalid IL or missing references) //IL_114b: Unknown result type (might be due to invalid IL or missing references) //IL_1150: Unknown result type (might be due to invalid IL or missing references) //IL_1155: Unknown result type (might be due to invalid IL or missing references) //IL_115a: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0f83: Unknown result type (might be due to invalid IL or missing references) //IL_130a: Unknown result type (might be due to invalid IL or missing references) //IL_1312: Unknown result type (might be due to invalid IL or missing references) //IL_1317: Unknown result type (might be due to invalid IL or missing references) //IL_131c: Unknown result type (might be due to invalid IL or missing references) //IL_1324: Unknown result type (might be due to invalid IL or missing references) //IL_1329: Unknown result type (might be due to invalid IL or missing references) //IL_1483: Unknown result type (might be due to invalid IL or missing references) //IL_148a: Unknown result type (might be due to invalid IL or missing references) //IL_148c: Unknown result type (might be due to invalid IL or missing references) //IL_1491: Unknown result type (might be due to invalid IL or missing references) //IL_1496: Unknown result type (might be due to invalid IL or missing references) //IL_1357: Unknown result type (might be due to invalid IL or missing references) //IL_135f: Unknown result type (might be due to invalid IL or missing references) //IL_1364: Unknown result type (might be due to invalid IL or missing references) //IL_1369: Unknown result type (might be due to invalid IL or missing references) //IL_1387: Unknown result type (might be due to invalid IL or missing references) //IL_138e: Unknown result type (might be due to invalid IL or missing references) //IL_1390: Unknown result type (might be due to invalid IL or missing references) //IL_1395: Unknown result type (might be due to invalid IL or missing references) //IL_13a7: Unknown result type (might be due to invalid IL or missing references) //IL_13b1: Unknown result type (might be due to invalid IL or missing references) //IL_13b6: Unknown result type (might be due to invalid IL or missing references) //IL_13bb: Unknown result type (might be due to invalid IL or missing references) //IL_13c0: Unknown result type (might be due to invalid IL or missing references) //IL_12c8: Unknown result type (might be due to invalid IL or missing references) //IL_12d0: Unknown result type (might be due to invalid IL or missing references) //IL_12d5: Unknown result type (might be due to invalid IL or missing references) //IL_12da: Unknown result type (might be due to invalid IL or missing references) //IL_12e2: Unknown result type (might be due to invalid IL or missing references) //IL_12e7: Unknown result type (might be due to invalid IL or missing references) //IL_1230: Unknown result type (might be due to invalid IL or missing references) //IL_1238: Unknown result type (might be due to invalid IL or missing references) //IL_123d: Unknown result type (might be due to invalid IL or missing references) //IL_1242: Unknown result type (might be due to invalid IL or missing references) //IL_124a: Unknown result type (might be due to invalid IL or missing references) //IL_124f: Unknown result type (might be due to invalid IL or missing references) //IL_1254: Unknown result type (might be due to invalid IL or missing references) //IL_1256: Unknown result type (might be due to invalid IL or missing references) //IL_145d: Unknown result type (might be due to invalid IL or missing references) //IL_141a: Unknown result type (might be due to invalid IL or missing references) //IL_141d: Unknown result type (might be due to invalid IL or missing references) //IL_1422: Unknown result type (might be due to invalid IL or missing references) //IL_142f: Unknown result type (might be due to invalid IL or missing references) //IL_1434: Unknown result type (might be due to invalid IL or missing references) //IL_1439: Unknown result type (might be due to invalid IL or missing references) int num = style & 0xFF; int num2 = style >> 8; bool flag = num > 0 || corridorLength > 0; bool flag2 = spireHeight > 0; bool flag3 = (num2 & 1) > 0; bool flag4 = (num2 & 2) > 0; bool flag5 = (num2 & 4) > 0; bool flag6 = (num2 & 8) > 0; bool flag7 = (num2 & 0x10) > 0; bool flag8 = (num2 & 0x20) > 0; bool flag9 = (num2 & 0x40) > 0; bool flag10 = (num2 & 0x80) > 0; bool flag11 = (num2 & 0x100) > 0; bool flag12 = (num2 & 0x200) > 0; bool flag13 = (num2 & 0x400) > 0; bool flag14 = (num2 & 0x800) > 0; int num3 = (num2 >> 12) & 0xF; bool flag15 = flag3 || flag14; bool flag16 = flag13 && flag10; bool flag17 = flag && num == 16; Vector3 val = 0.5f * up; Vector3 val2 = piecePos + 2f * MapFwd(nesw) + 2f * MapFwd(nesw + 1); float y = piecePos.y; int num4 = nesw; int num5 = (flag5 ? (levels + 1) : levels); int num6 = ((flag13 || flag12) ? (num5 - 1) : (-1)); if (flag16) { flag10 = false; } if (flag10) { num5++; } int num7 = 0; while (num7 < num5) { Vector3 val3 = 0.5f * MapFwd(num4); Vector3 val4 = 0.5f * MapFwd(num4 + 1); val2.y += 0.4375f; Piece("stone_stair", val2 - 5f * val4 - val3, num4 + 2); val2.y += 0.5f; Piece("stone_stair", val2 - 5f * val4 + val3, num4 + 2); val2.y += 0.5625f; Piece("stone_floor_2x2", val2 - 5f * val4 + 5f * val3, num4); if (num7 == num6) { Floor(val2 - val3 - val4, num4, 0f, 3, 3); if (flag12) { if (!flag14) { CaptureNextPlacedAs("room_door2"); } Piece("wood_door", val2 + 5f * val3 - 2f * val4 + 1.5f * up, num4 + 3); Piece("stone_wall_2x1", val2 + 5f * val3 - 2f * val4 + 3f * up, num4 + 1); Wall(val2 + val3 - 2f * val4, num4 + 1, 1, 2); Wall(val2 - 2f * val3 + 7f * val4, num4 + 2, 3, 2); if (!flag5) { if (WUTIL.RandomSpin() < 0.5f) { if (WUTIL.RandomSpin() < 0.4f) { Chest("TreasureChest_mountains", val2 + 5f * val3 + 6f * val4, num4 + 3, 0.5f, 1); } if (WUTIL.RandomSpin() < 0.5f) { Chest("loot_chest_wood", val2 + 5f * val4, num4, 0.5f, 1); } if (WUTIL.RandomSpin() < 0.5f) { Barrel(val2 + 2.3f * val4, num4, 1f); } string[] array = "Club;Torch;AxeFlint;ShieldWood;KnifeFlint;Bow;SpearFlint;SwordBronze;MaceIron;SpearChitin".Split(new char[1] { ';' }); string itemSupport = array[WUTIL.DieRoll(array.Length)]; ItemStand(1, val2 + 4f * val3 + 4f * val4, num4, 2f, itemSupport); } else { Vector3 center = val2 + 3f * val3 + 3f * val4; center.y += 0.5f; RoomDecor(center, num4, 2f, 2f, 0.5f, doorNorth: true); } } } else { Piece("iron_wall_2x2", val2 + 5f * val4 - 1.9f * val3 + up, num4); switch (num3) { case 1: Barrel(val2 + 5f * val4 + 1.5f * up, num4); break; case 2: Chest("TreasureChest_mountains", val2 + 5f * val4, num4, 0.5f, 1); break; } } } num7++; num4++; } if (flag5) { val2.y += 2.8f; CaveIn(val2 - 2.5f * MapFwd(num4) - 3.5f * MapFwd(num4 + 1), num4 + 1, 3, 3, 2); } val2.y = y + 1f; if (flag10) { num5++; } if (flag2) { num5 += spireHeight; } else if (flag12) { num5--; } float num8 = (flag10 ? (-0.5f) : 0.5f) + 1.5f * (float)num5 + val2.y + (float)((!flag12) ? 2 : 0); Vector3 val5 = val2; num4 = nesw; int num9 = 0; while (num9 < 4) { Vector3 val6 = 0.5f * MapFwd(num4); Vector3 val7 = 0.5f * MapFwd(num4 + 1); val5 = val2 - 2f * val7 - val6; for (int i = Math.Min(num9 - 1, 0); i <= num5; i++) { if (!(val5.y <= num8)) { break; } PieceUpright("stone_floor_2x2", val5, num4); val5.y += 2f; } num9++; num4++; val2.y += 1.5f; } if (flag2) { val2.y = val5.y - 2.1f; Piece("stone_wall_1x1", val2, 0); val2.y += 1.5f; Piece("stone_pillar", val2, 0); val2.y += 0.5f; if (m_mapTorch == "TorchCrystalWall") { Piece("TorchCrystal", val2, 0); } else { Piece((m_mapTorch == "piece_walltorch") ? "piece_groundtorch" : m_mapTorch, val2, 0); } } if (flag7) { return; } val2.y = y + 1f; int num10 = 4; int num11 = 3 * levels + 1; int num12 = (flag ? (3 * levels) : (-1)); int num13 = (flag ? (num12 + 4) : (-1)); int num14 = ((flag12 || (flag5 && !flag10)) ? (-1) : num11); int num15 = ((flag4 || flag16) ? num11 : (-1)); int num16 = (flag16 ? (num15 + 4) : (-1)); int num17 = (flag14 ? 3 : (-1)); num4 = nesw + 2; int num18 = 2 + 3 * levels / 4; if (flag10) { num18++; } int num19 = 0; int num20 = 0; while (num19 < num18) { int num21 = 0; while (num21 < 4) { Vector3 val8 = 4f * MapFwd(num4); Vector3 val9 = MapFwd(num4 + 1); Vector3 val10 = 0.5f * val9; Vector3 val11 = val2 + val8; bool flag18 = false; bool flag19 = num20 != num16; if (num20 == 0) { flag18 = true; } else if (num20 == num17) { flag19 = false; Piece("stone_wall_4x2", val11 + 3f * val10, num4); PieceUpright("stone_wall_2x1", val11 - val9, num4); PieceUpright("stone_wall_2x1", val11 - 4f * val9, num4); if (num17 < 4) { CaptureNextPlacedAs("room_door2"); Piece("wood_door", val11 - 5f * val10 + val, num4); num17 += 4; } else { int style2 = ((num3 == 1 || num3 == 2) ? 1 : 0); Headstone(val11 - 5f * val10, style2, nesw + 1, 0.25f); } } else if (num20 == num12) { if (flag17) { flag19 = false; } else { flag18 = true; Vector3 val12 = val11 + 5f * val10; val12.y -= 1f; Piece("stone_wall_2x1", val12, num4); val12 += 0.5f * MapFwd(num4); if (flag6) { Stairs(val12 + MapFwd(num4) - 0.5f * up, num4 + 2, 1f, 3); } float gatePosition = (flag8 ? (corridorLength - 1) : (2 * corridorLength)); GateCorridor(val12, num4, corridorLength, gatePosition, num); } } else if (num20 == num10) { flag18 = true; if (!flag11) { PieceUpright("stone_floor_2x2", val2 + val8 + 5f * val10 + val, num4 + 1); } } else if (num20 == num13) { if (flag17) { flag19 = false; Vector3 val13 = val11 - 4f * val9; val13.y -= 1f; FourPieces("stone_wall_2x1", val13, Vector3.zero, num4, upright: true, 1f, 3); Wall(val13 + val10, num4, 4, 1, -3.5f); } else { flag18 = true; Vector3 position = val11 + 5f * val10; position.y += 1f; Piece("stone_wall_2x1", position, num4); } } if (num20 == num15) { if (style == 771) { WDBUG.Log($"Have upper alt exit, openBalcony: {flag16}"); Torch("piece_groundtorch_blue", val11); } if (flag16) { Vector3 val14 = val11 - 4f * val9; val14.y += 1f; FourPieces("stone_wall_2x1", val14, Vector3.zero, num4, upright: true, 1f, 3); Wall(val14 + 3f * val10, num4, 1, 1, -3.5f); } else { Vector3 val15 = val11 - val9; PieceUpright("stone_wall_2x1", val15, nesw); Piece("stone_wall_4x2", val15 + 5f * val10, num4); val15 -= 2f * val9; Piece("stone_wall_1x1", val15 - up, nesw); Piece("stone_pillar", val15 + val9, nesw, WUTIL.RandomSpin(-10f, 5f)); Piece("stone_pillar", val15 - val9, nesw, WUTIL.RandomSpin(-5f, -10f)); } } else if (flag19) { Piece("stone_wall_4x2", val11 - 5f * val10, num4); if (flag18) { PieceUpright("stone_floor_2x2", val11 + val10, num4 + 1); } else { Piece("stone_wall_4x2", val11 + 3f * val10, num4); } } if (num20 == num14) { Vector3 position2 = val2 + 2.97f * MapFwd(num4); position2.y += ((!flag10) ? 1 : 3); WallTorch(position2, num4 + 2); } num21++; num20++; num4++; } num19++; val2.y += 2f; } if (!flag10) { val2.y -= 1f; for (int j = 0; j < 4; j++) { Vector3 val16 = 2f * MapFwd(j); Vector3 val17 = 2f * MapFwd(j + 1); Floor(val2 + val16 + val17, 0, 0f, 0, 1, ceiling: true); } } if (flag9) { Floor(piecePos); exitFloor = false; val2.y = y + 3f; CaveIn(val2 + 2f * MapFwd(nesw + 1), nesw + 2, 5, 3, 2, 0.35f, 3f); val2.y += 0.2f; CaveIn(val2, nesw + 2, 6, 1, 1, 0.3f, 2f); } else if (flag15) { val2.y = y + 2f; num4 = (nesw + 2) & 3; int num22 = (nesw + 2) & 3; val2.y = y; for (int k = 0; k < 4; k++) { if (k != num4 && k != num22) { Floor(val2 + 2f * (MapFwd(k) + MapFwd(k + 1))); } } } if (exitFloor) { Floor(val2 - 2f * (MapFwd(nesw) + MapFwd(nesw + 1))); } val2.y = y + 1f; for (int l = 0; l < Mathf.Min(levels - 1, 3); l++) { if (flag3 && l <= 1) { if (l == 0) { if (!flag9) { if (!flag14 && !flag12) { CaptureNextPlacedAs("room_door2"); } Piece("wood_door", val2 - 2.5f * MapFwd(nesw) - MapFwd(nesw + 1) + val, nesw + 1); } } else { float num23 = WUTIL.RandomSpin(); int num24 = ((num23 < 0.05f) ? 6 : ((num23 < 0.2f) ? 10 : 0)); int nesw2 = ((num24 == 10 && (double)num23 < 0.15) ? (nesw + 1) : (nesw + 3)); Headstone(val2 - 2.5f * MapFwd(nesw) - MapFwd(nesw + 1), num24, nesw2, 0.25f); } } else { PieceUpright("stone_floor_2x2", val2 - 2.5f * MapFwd(nesw) - MapFwd(nesw + 1), nesw); } if (flag15 && l == 0) { Piece("stone_wall_4x2", val2 + 1.5f * MapFwd(nesw), nesw + 1); PieceUpright("stone_wall_2x1", val2 + 4f * val, nesw); Vector3 center2 = val2 + 2f * MapFwd(nesw + 1); center2.y -= 0.5f; bool flag20 = WUTIL.RandomSpin() < 0.5f; if (flag20) { string torch = ((m_mapTorch == "TorchCrystalSmall") ? m_mapTorch : "piece_walltorch"); Torch(torch, val2 - MapFwd(nesw) - 0.32f * MapFwd(nesw + 1), 2f, nesw); } if (!flag9) { RoomDecor(center2, nesw, 3.3f, 1.3f, flag20 ? 0.05f : 0.4f); } } val2 += 4f * val; } } public static Vector3 Staircase(Vector3 position, int nesw, int levels = 2, int stairLength = 2, int corridorLength = 2, int style = 0, bool down = false, int wallCaptureLevel = -1, int sideWallCaptureLevel = -1, int windowLevel = -1, int windowLevel2 = -1, int doorLevel = -1) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_09c9: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_08c6: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_069d: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06fc: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_0748: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_074f: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_076c: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07a6: Unknown result type (might be due to invalid IL or missing references) //IL_07ab: Unknown result type (might be due to invalid IL or missing references) //IL_07b5: Unknown result type (might be due to invalid IL or missing references) //IL_07b7: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Unknown result type (might be due to invalid IL or missing references) //IL_07dc: Unknown result type (might be due to invalid IL or missing references) //IL_07de: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0824: Unknown result type (might be due to invalid IL or missing references) //IL_0829: Unknown result type (might be due to invalid IL or missing references) //IL_0840: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0857: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_085e: Unknown result type (might be due to invalid IL or missing references) //IL_09c3: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Unknown result type (might be due to invalid IL or missing references) //IL_0880: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_09c5: Unknown result type (might be due to invalid IL or missing references) //IL_08d7: Unknown result type (might be due to invalid IL or missing references) //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_08de: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_08a2: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032c: 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_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08f7: Unknown result type (might be due to invalid IL or missing references) //IL_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_08fe: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_0911: Unknown result type (might be due to invalid IL or missing references) //IL_097f: Unknown result type (might be due to invalid IL or missing references) //IL_0986: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_0997: Unknown result type (might be due to invalid IL or missing references) //IL_0999: Unknown result type (might be due to invalid IL or missing references) //IL_099e: Unknown result type (might be due to invalid IL or missing references) //IL_0940: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04c9: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e8: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) if (levels < 1 || stairLength < 0 || corridorLength < 0) { return position; } bool flag = (style & 1) > 0; bool flag2 = (style & 2) > 0; bool flag3 = (style & 4) > 0; bool flag4 = (style & 8) > 0; bool flag5 = (style & 0x10) > 0; bool flag6 = (style & 0x20) > 0; bool flag7 = (style & 0x40) > 0; bool flag8 = (style & 0x80) > 0; bool flag9 = (style & 0x100) > 0; bool flag10 = flag5 && flag5; if (flag10) { flag4 = false; } bool flag11 = corridorLength == 2; bool flag12 = corridorLength > 0 && !flag11; int num = (flag ? (-1) : (levels - 1)); int num2 = (flag2 ? (-1) : (levels - 2)); int num3 = ((flag11 || flag7) ? 12 : 15); if (flag8) { num3 &= 0xF3; } int num4 = ((!flag11) ? 1 : 0); int num5 = 1 + 2 * corridorLength; int num6 = corridorLength + num4; if (corridorLength == 1) { num5 = 4; } int num7 = ((flag5 || flag4) ? (levels - 1) : levels); int num8 = ((flag5 || flag4) ? (levels - 1) : levels); int style2 = (flag6 ? 193 : 129); int height = ((!flag11) ? 2 : 0); int width = ((!flag11) ? num6 : 0); float num9 = (flag11 ? (-1.5f) : (-0.5f)); float num10 = (flag11 ? 1 : 0); float heightOffset = num10 - 0.5f; int num11 = (flag6 ? 2 : 0); int num12 = (flag9 ? (2 * stairLength + 1) : (-1)); if (flag9) { num11++; } Vector3 val = MapFwd(nesw); Vector3 val2 = MapFwd(nesw + 1); if (down) { int num13 = 2 * corridorLength - num11; if ((levels & 1) > 0) { position -= (float)(2 * stairLength) * val; if (corridorLength < 2) { position += 2f * val2 - 0.5f * val; } else if (flag) { position -= (float)num13 * val2; } } else if (!flag) { position -= (float)num13 * val2; } position.y -= levels * stairLength; } Vector3 val3 = position; Vector3 val4 = position + val + val2; Vector3 position2 = val4 + 2f * val; int num14 = 0; while (num14 < levels) { val = MapFwd(nesw); val2 = MapFwd(nesw + 1); int num15 = ((flag3 && (num14 & 1) == 0) ? 16 : 0); if (stairLength > 0) { if (num14 < num8) { GateCorridor(position, nesw, stairLength, num12, style2, num3 | num15); if (flag6) { position += (float)num11 * val; } } else { GateCorridor(position, nesw, stairLength, num12, 145, 0); } } if (flag3 && num14 == 0) { Wall(position + val - 1.5f * val2, nesw + 1, 1, 1, -0.5f); Wall(position + 3f * val - 1.5f * val2, nesw + 1, 1, 1, 0.5f); } position += (float)(2 * stairLength) * val; position.y += stairLength; position += val - (float)num4 * val2; if (flag12 || num14 == num2) { Floor(position - 0.25f * val, nesw, 4f, num6); } if (num14 != num || flag4) { Floor(position, nesw, 0f, num6); } if (num14 != num) { if (num14 < num7) { float heightOffset2 = ((flag3 && (num14 & 1) == 1) ? 0.5f : (-0.5f)); if (corridorLength > 1) { if (num14 == sideWallCaptureLevel) { CaptureNextPlacedAs("stairs_sidewall"); } Wall(position + num9 * val2, nesw + 3, 1, 2, heightOffset2); } if (num14 == wallCaptureLevel) { CaptureNextPlacedAs("stairs_backwall"); } if (num14 == doorLevel) { RoomDoor(-6, position + val + val2 + 1.9f * up, nesw, 2f * val2, coving: false, addHighFrame: false); } else if (num14 == windowLevel || num14 == windowLevel2) { RoomDoor(-9, position + val + num10 * val2 + up, nesw, 2f * val2, coving: false, addHighFrame: false); } else { Wall(position + val + num10 * val2, nesw, width, height, heightOffset); } if (corridorLength > 3) { Wall(position - 1.5f * val + (float)(num5 - 5) * val2, nesw + 2, corridorLength - 3, 2, heightOffset); } position += (float)num5 * val2; Wall(position + num9 * val2, nesw + 1, 1, 2, heightOffset2); } else { position += (float)num5 * val2; } position -= val + (float)(3 - num4) * val2; } num14++; nesw += 2; } if (flag11) { if (flag4) { levels--; Piece("stone_wall_2x1", position - 4f * val + val2 + 2f * up, nesw + 1); Piece("stone_wall_2x1", position + 3.5f * val2 + up, nesw + 1); Piece("stone_wall_2x1", position - 1.5f * val2 + up, nesw + 3); Wall(position - 2f * val - 1.5f * val2, nesw + 1, 1, 1, -0.5f); Wall(position - 4f * val - 1.5f * val2, nesw + 1, 1, 2, -1.5f); Stairs(position - 2f * val + 2f * val2, nesw, 1f, 1, floor: true, ceiling: false, -0.5f); Stairs(position - 4f * val + 2f * val2, nesw, 1f, 1, floor: true, ceiling: false, -1.5f); Floor(position + 4f * val2, nesw, 2f, 1, 4); Floor(position - 2f * val2, nesw, 2f, 1, 4); Wall(position + 1.45f * val, nesw + 2, 2, 1, -0.5f); Floor(position + 2f * val + 4f * val2, nesw, 2f, 4); } if (stairLength > 0) { Wall(val4, nesw + 1, 1, levels + 2, 0.5f); } if (stairLength > 1) { Wall(position2, nesw + 1, 1, levels + 1, 1.5f); } } if (flag5) { Vector3 val5 = position + (flag10 ? 2.5f : 2f) * val2; nesw++; for (int i = 0; i < stairLength; i++) { val5 -= 2f * val; if (i > 0) { Wall(val5, nesw, 1, i + 1 >> 1, -0.5f - (float)i); } if ((i & 1) == 0) { Piece("stone_wall_2x1", val5, nesw); } } if ((float)levels >= 3.5f) { Piece("stone_wall_2x1", val5 - 0.5f * val - 1.5f * val2, --nesw); } } return down ? val3 : position; } public static void StairWell(Vector3 position, int style = 0, float doorWidth = 1f, float doorOffset = 0f) { //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) //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_0066: 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_0086: 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_008d: 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_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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_05b7: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) int num = style & 3; int num2 = (((style & 4) > 0) ? 1 : (-1)); bool flag = (style & 8) == 0; int num3 = style >> 4; bool flag2 = (num3 & 7) != 0; bool flag3 = (num3 & 8) > 0; bool flag4 = (num3 & 0x10) == 0; bool flag5 = (num3 & 0x20) > 0; int num4 = num + num2; int num5 = 0; Vector3 val = MapFwd(num); Vector3 val2 = MapFwd(num + 1); float mapMaxWallHeight = m_mapMaxWallHeight; if (flag) { m_mapMaxWallHeight = position.y + 3f; m_nextDoorHeadstone = 10; RoomDoor(-6, position - 2f * val - doorOffset * val2 + 1.8f * up, num, doorWidth * val2); } if (flag3) { Floor(position - val - (float)num2 * val2, num4, 0f, 1, 4); Floor(position + (float)(8 * num2) * val2); } else { Floor(position - val - val2, num, 0f, 2); Wall(position - val + (float)(num2 * 2) * val2, num4, 0, 2, 0.5f); } position.y -= 0.5f; Floor(position, 0, 4f, 0, 1, ceiling: true); m_mapMaxWallHeight = position.y + -6.5f + 1f; Vector3 val3 = position + 2f * val; val3.y += 1.5f; Wall(val3, num); if (flag5) { Wall(val3, num, 2, 0, -3f); } else { Wall(val3, num, 0, 0, -4f); } if ((num3 & 1) > 0) { num5++; m_nextDoorHeadstone = -1; RoomDoor(-6, val3 + -6.5f * up, num + 2, doorWidth * val2); } else if (flag2) { Wall(val3, num, 0, 0, -8f); } Floor(position + val - (float)num2 * val2, 0, 0.5f, 1); for (int i = 0; i < 2; i++) { val3 += (float)(num2 * 4) * val2; for (int j = 0; j < 3; j++) { Wall(val3, num, 0, 0, -4 * j); if (i == 1) { Wall(val3 - 2f * val + (float)(num2 * 2) * val2, num4, 0, 0, -4 * j); } if (flag4 || j > 0) { Wall(val3 - 4f * val, num + 2, 0, 0, -4 * j); } } Floor(val3 - 2f * val, 0, 2.5f, 0, 1, ceiling: true); } val3 = position - (float)(num2 * 2) * val2; val3.y += 1.5f; Wall(val3, num4 + 2); if (flag5) { Wall(val3, num4 + 2, 2, 0, -3f); } else { Wall(val3, num4 + 2, 0, 0, -4f); } if ((num3 & 2) > 0) { num5++; m_nextDoorHeadstone = -1; RoomDoor(-6, val3 + -6.5f * up, num + 1, doorWidth * val2); } else if (flag2) { Wall(val3, num4 + 2, 0, 0, -8f); } if (!flag5) { string name = (m_mapTorch.Contains("Crystal") ? "TorchCrystalWall" : "piece_walltorch"); WallTorch(position - 3.75f * up, num + num2 + 2, name); } val3 = position + val + (float)num2 * val2; Vector3 val4 = val3 - 2f * val; val4.y -= 7f; int num6 = 0; while (num6 < 4) { Stairs(val3, num - num2); Stairs(val4, num + num2, 1f, 1, floor: true, ceiling: false, (num6 == 0 && flag5) ? (-6) : 0); val3 += (float)(num2 * 2) * val2; if (num6 > 0) { Wall(val4 + 1.5f * val, num, 1, 4 - num6, -1f); } else { Wall(val3 + 0.5f * val, num, 1, 3, -7f); } val4 += (float)(num2 * 2) * val2; num6++; val3.y -= 1f; val4.y += 1f; } Floor(val3, 0, 0.5f, 1); Floor(val4, 0, -0.5f, 1); val3 = position - 2f * val + 1.5f * up; if (flag5) { Wall(val3, num + 2, 2, 0, -3f); } else { Wall(val3, num + 2, 0, 0, -4f); } if ((num3 & 4) > 0) { num5++; m_nextDoorHeadstone = -1; RoomDoor(-6, val3, num, val2); } else if (flag2) { Wall(val3, num + 2, 0, 0, -8f); } m_mapMaxWallHeight = mapMaxWallHeight; } public static void GateCorridor(Vector3 position, int nesw, int corridorLength = 0, float gatePosition = 0f, int style = 7, int walls_lLrR = 15, bool raiseEntryCeiling = false, bool coving = false) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: 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_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: 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_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) int num = style & 3; bool flag = (style & 4) > 0; bool flag2 = (style & 8) > 0; bool flag3 = (style & 0x10) > 0; bool flag4 = (style & 0x20) > 0; bool flag5 = (style & 0x40) > 0; bool flag6 = (style & 0x80) > 0; bool flag7 = (style & 0x100) > 0; bool flag8 = (style & 0x200) > 0; bool flag9 = flag && !(flag2 || flag3); float num2 = 1.25f + (float)num * 0.25f; bool flag10 = flag2 && flag3; if (flag10) { num = style & 7; num2 = ((num > 0) ? 1.45f : 1.5f); flag = false; flag3 = false; flag2 = corridorLength > 0; } if (flag5) { if (gatePosition < 0f) { gatePosition = 0f; } gatePosition += (float)(2 * corridorLength + 2); } Vector3 val = MapFwd(nesw); Vector3 val2 = MapFwd(nesw + 1); Vector3 val3 = num2 * val2; float num3 = (flag9 ? 2.5f : 2f); Vector3 val4 = position + val; val4.y += (flag6 ? (num3 + 0.5f) : num3); int num4 = ((!(num2 > 1.501f)) ? 1 : 2); float num5 = (flag2 ? (num3 - 0.375f) : num3); int num6 = ((!raiseEntryCeiling) ? (-1) : 0); int num7 = ((flag10 && num == 0) ? (corridorLength - 1) : (-1)); int lLrR = (flag3 ? 10 : 15); int num8 = 0; while (num8 < corridorLength) { Vector3 val5 = (flag2 ? (val4 - 0.375f * up) : val4); FourPieces("stone_floor_2x2", val4, val3, nesw, upright: true, 1f, walls_lLrR); if (flag6) { if (num8 == num6) { Stairs(val5, nesw, num4, 1, floor: true, ceiling: false, num5); val5.y += num5 + 0.5f; Piece("stone_wall_2x1", val5 + 0.5f * val, nesw, 55f); } else if (num8 == num7) { Floor(val5, nesw, 0f - num5 - 0.375f, 1); Vector3 position2 = val5; float width = num4; float centerHeight = num5; Stairs(position2, nesw, width, 1, floor: false, !flag3, centerHeight); } else { Vector3 position3 = val5; float width2 = num4; float centerHeight = num5; Stairs(position3, nesw, width2, 1, floor: true, !flag3, centerHeight); } val4.y += 1f; } else { FourPieces("stone_floor_2x2", val5, val2, nesw, upright: false, num5, lLrR); } num8++; val4 += 2f * val; } if (gatePosition < 0f) { return; } float num9 = gatePosition - (float)(2 * corridorLength); val4 -= 0.5f * val; if (flag6) { val4.y -= 0.5f; } val3 *= 1.05f; Vector3 val6 = (flag2 ? (-0.375f) : 0f) * up; int num10 = (int)num9; int num11 = (flag7 ? (num10 / 2) : (-1)); int num12 = (flag8 ? (num10 / 2) : (-1)); for (int i = 0; i < num10; i++) { int num13 = 15; if (i == num11) { num13 &= 0xC; } if (i == num12) { num13 &= 3; } FourPieces("stone_wall_2x1", val4, val3, nesw, upright: true, 1f, num13); FourPieces("stone_wall_2x1", val4 + val6, val2, nesw, upright: false, num5 - 0.125f); val4 += val; } if (flag4) { FourPieces("stone_wall_2x1", val4 - up, val2, nesw, upright: false, 1f, 10); } if (!flag6 || num10 >= 2) { val4 -= 0.5f * val; if (num9 < 0f) { val4 += val * num9; } if (flag9) { val4.y -= 0.5f; } if (num > 0 && !flag10) { Vector3 offsetH = val2 * ((num == 1) ? 1.05f : 1.5f); FourPieces("woodiron_pole,stone_pillar,stone_wall_2x1".Split(new char[1] { ',' })[num - 1], val4, offsetH, nesw, num == 3); } if (flag) { FourPieces("stone_wall_2x1", val4, val2, nesw, upright: false, 2f, 5); } if (num > 0) { val4.y -= 0.5f; RoomDoor(flag10 ? num : (-1), val4, nesw, val3, coving); } } } public static void RoomDoor(int doorType, Vector3 position, int nesw, Vector3 postOffset, bool coving = false, bool addHighFrame = true) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0304: 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) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_067c: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_088f: Unknown result type (might be due to invalid IL or missing references) //IL_0892: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_0907: Unknown result type (might be due to invalid IL or missing references) //IL_0908: Unknown result type (might be due to invalid IL or missing references) //IL_08c8: Unknown result type (might be due to invalid IL or missing references) //IL_08ce: Unknown result type (might be due to invalid IL or missing references) //IL_08d0: Unknown result type (might be due to invalid IL or missing references) //IL_09d7: Unknown result type (might be due to invalid IL or missing references) //IL_09b7: Unknown result type (might be due to invalid IL or missing references) //IL_0aac: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Unknown result type (might be due to invalid IL or missing references) //IL_0ab1: Unknown result type (might be due to invalid IL or missing references) //IL_0ab6: Unknown result type (might be due to invalid IL or missing references) //IL_0ad1: Unknown result type (might be due to invalid IL or missing references) //IL_0ad4: Unknown result type (might be due to invalid IL or missing references) //IL_0ad6: Unknown result type (might be due to invalid IL or missing references) //IL_0adb: Unknown result type (might be due to invalid IL or missing references) //IL_0b1d: Unknown result type (might be due to invalid IL or missing references) //IL_0b23: Unknown result type (might be due to invalid IL or missing references) //IL_0b28: Unknown result type (might be due to invalid IL or missing references) //IL_0b2d: Unknown result type (might be due to invalid IL or missing references) //IL_0c79: Unknown result type (might be due to invalid IL or missing references) //IL_0b74: Unknown result type (might be due to invalid IL or missing references) //IL_0b7a: Unknown result type (might be due to invalid IL or missing references) //IL_0b7f: Unknown result type (might be due to invalid IL or missing references) //IL_0b84: Unknown result type (might be due to invalid IL or missing references) //IL_0c3d: Unknown result type (might be due to invalid IL or missing references) //IL_0caa: Unknown result type (might be due to invalid IL or missing references) //IL_0cb0: Unknown result type (might be due to invalid IL or missing references) //IL_0cb5: Unknown result type (might be due to invalid IL or missing references) //IL_0cba: Unknown result type (might be due to invalid IL or missing references) //IL_0dbe: Unknown result type (might be due to invalid IL or missing references) //IL_0dc4: Unknown result type (might be due to invalid IL or missing references) //IL_0dc6: Unknown result type (might be due to invalid IL or missing references) //IL_0dcb: Unknown result type (might be due to invalid IL or missing references) //IL_0dd0: Unknown result type (might be due to invalid IL or missing references) //IL_0dd7: Unknown result type (might be due to invalid IL or missing references) //IL_0dda: Unknown result type (might be due to invalid IL or missing references) //IL_0ddc: Unknown result type (might be due to invalid IL or missing references) //IL_0de1: Unknown result type (might be due to invalid IL or missing references) //IL_0dfd: Unknown result type (might be due to invalid IL or missing references) //IL_0e00: Unknown result type (might be due to invalid IL or missing references) //IL_0e02: Unknown result type (might be due to invalid IL or missing references) //IL_0e07: Unknown result type (might be due to invalid IL or missing references) //IL_0cf8: Unknown result type (might be due to invalid IL or missing references) //IL_0cfb: Unknown result type (might be due to invalid IL or missing references) //IL_0cfd: Unknown result type (might be due to invalid IL or missing references) //IL_0d02: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Unknown result type (might be due to invalid IL or missing references) //IL_0d20: Unknown result type (might be due to invalid IL or missing references) //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0d27: Unknown result type (might be due to invalid IL or missing references) //IL_0d43: Unknown result type (might be due to invalid IL or missing references) //IL_0d5d: Unknown result type (might be due to invalid IL or missing references) bool flag = doorType == -11; bool flag2 = doorType == -9 || flag; bool flag3 = doorType == -10; bool flag4 = doorType == -7; bool flag5 = doorType == -8; bool flag6 = flag5 || flag4 || doorType == -6; bool flag7 = false; bool blockRoomDoorTall = m_blockRoomDoorTall; m_blockRoomDoorTall = false; float num = position.y - 1f; int num2 = m_nextDoorHeadstone; m_nextDoorHeadstone = 0; CaptureNextPlacedAs("room_door"); switch (doorType) { case -1: Piece("iron_grate", position, nesw); return; case -2: Piece("low_irongate", position - 0.9f * up, nesw); return; case -12: Piece("low_irongate", position - 0.9f * up, MapRot(nesw), dropPin: false); return; case -3: Piece("iron_grate", position - up, nesw); FourPieces("stone_wall_2x1", position, postOffset, nesw, upright: true); position.y += 2f; Piece("stone_wall_2x1", position, nesw); if (num2 > 0) { Headstone(position, num2 + 10, nesw + 2); } return; case -4: Piece("dungeon_sunkencrypt_irongate", position - 0.875f * up, nesw); FourPieces("iron_wall_1x1", position, postOffset, nesw, upright: true, 0.5f); FourPieces("iron_wall_1x1", position, postOffset, nesw, upright: true, 1.5f); return; } if (flag3) { doorType = 6; } else if (flag2 || flag6) { doorType = 5; } float num3 = m_mapMaxWallHeight - position.y + 1.5f; if (coving) { num3 -= 0.5f; } Vector3 val = MapFwd(nesw); Vector3 val2 = MapFwd(nesw + 1); if (doorType == 0 || doorType >= 7) { position.y += 0.5f; FourPieces("stone_wall_2x1", position, 1.1f * postOffset, nesw, upright: true); position.y += 1.125f; CaveIn(position, nesw, 1, 2); return; } if (doorType == 1) { position -= 0.25f * val; position.y += 1.5f; CaveIn(position, nesw); } if (doorType == 2) { FourPieces("stone_wall_2x1", position + 0.5f * up, postOffset, nesw, upright: true); CaptureNextPlacedAs("room_door"); int num4 = 0; if (!blockRoomDoorTall && addHighFrame && num3 >= 3f) { if (m_doorStyleDoorMaterial == -5) { position.y -= 1f; Piece("dungeon_forestcrypt_door", position, nesw + 2); position.y += 3.5f; num4 = 1; } else if (m_doorStyleDoorMaterial == -1) { Piece("iron_grate", position, nesw + 2); position.y += 2.5f; num4 = 1; } } else if (m_doorStyleDoorMaterial == -1) { position.y -= 1f; Piece("dungeon_sunkencrypt_irongate", position, nesw + 2); position.y += 2.75f; num4 = 1; } else if (m_doorStyleDoorMaterial == -5) { Piece("wood_door", position, nesw + 2); position.y += 2f; num4 = 2; } if (num4 > 0) { if (num2 > 0) { Headstone(position, (num4 == 1) ? (num2 + 10) : num2, nesw + 2); } if (num4 == 1) { Piece("stone_wall_2x1", position, nesw); } else { Headstone(position, 0, nesw + 2, -0.25f); } } if (m_doorStyleDoorMaterial != -6) { return; } flag6 = true; doorType = 5; } switch (doorType) { case 3: FourPieces("stone_wall_2x1", position, 1.5f * val2, nesw, upright: true); FourPieces("stone_pillar", position, 1.25f * val2, nesw, upright: false, 1f, 15, 0f, WUTIL.RandomSpin(-3f, 3f)); if (WUTIL.RandomSpin() < 0.3f) { position.y += 1.75f; CaveIn(position, nesw, 1, 2, 1, 0f); } else { position.y += 2f; Headstone(position, 0, nesw, -0.25f); } break; case 4: position.y += 0.5f; FourPieces("stone_wall_2x1", position, 1.5f * val2, nesw, upright: true); position.y += 1.2f; CaveIn(position, nesw, 4, 3, 1, 0f); break; default: if (doorType != 6) { break; } goto case 5; case 5: { bool flag8 = m_doorStyleLoseArchway > 0f && WUTIL.RandomSpin() < m_doorStyleLoseArchway; int num5 = ((!(doorType == 5 || flag8)) ? ((WUTIL.RandomSpin() < m_doorStyleCritter) ? 1 : 2) : (flag2 ? 4 : (flag4 ? 3 : (WUTIL.DieRoll(2) + 3)))); int num6 = ((num5 == 2 && WUTIL.RandomSpin() < 0.8f - m_doorStyleCritter) ? 1 : 0); float num7 = (addHighFrame ? (0.5f * (float)num5) : 2.25f); float num8 = 0.5f * (num7 + 1f); if (num5 == 3 && WUTIL.RandomSpin() > 0.6f) { num8 -= 0.25f; if (WUTIL.RandomSpin() < 0.05f) { num8 -= 0.26f; } } if (flag6) { num7 = (flag5 ? 2.5f : (flag4 ? 1f : 1.5f)); num8 = (flag4 ? 1f : 1.5f); } else if (flag3) { num5 = 2; num6 = 1; num8 = 0.125f * (float)WUTIL.DieRoll() + 0.625f; num7 = 0.75f; flag7 = WUTIL.DieRoll(4) == 0; } position.y += 0.5f; FourPieces("stone_wall_2x1", position, num8 * val2, nesw, upright: true); if (num8 < 1.5f) { FourPieces("stone_wall_2x1", position, 1.5f * val2, nesw, upright: true); } position.y += num7 - 0.65f + (float)num6; Vector3 position2 = position; switch (num5) { case 1: position2.y -= 0.45f; break; case 2: position2.y -= 0.3f; break; case 3: position2.y -= 0.25f; break; } int num9 = Mathf.Max((int)num3, 3); if (flag6 && num2 == 0 && WUTIL.RandomSpin() < m_doorStyleArchwaySkull) { num2 = 10; } for (int i = 0; i < num9 - (int)num7 - num6; i++) { if (num2 > 0 && i == 0) { Headstone(position2, num2 + 10, nesw + 2); } Piece("stone_wall_2x1", position2, nesw); position2.y += 1f; } if (flag8) { break; } position.y -= 0.45f; num8 -= 0.45f; bool flag9 = num5 == 1 && WUTIL.RandomSpin() < 0.5f; float tilt = (flag9 ? WUTIL.RandomSpin(15f, 85f) : 45f); float num10 = (flag9 ? WUTIL.RandomSpin(15f, 85f) : 45f); Piece("stone_wall_1x1", position + num8 * val2, nesw + 1, tilt); Piece("stone_wall_1x1", position - num8 * val2, nesw + 1, 0f - num10); if (num5 == 2 && doorType == 6 && !flag3) { if (num6 > 0) { Piece("stone_wall_1x1", position - 2f * up, nesw); num8 = 0.05f; } if (WUTIL.RandomSpin() < 0.8f) { Piece("iron_wall_1x1", position - 1.45f * up, nesw); } } else if (num5 == 1) { num8 += WUTIL.RandomSpin(0f, 0.2f); position.y += 0.5f; if (WUTIL.RandomSpin() < m_ratHoleSpawnDensity) { string name = ((!(m_ratHoleSpawnUndead > 0f)) ? "Rat" : ((WUTIL.RandomSpin() > m_ratHoleSpawnUndead) ? "RatDraugr" : "Sewer_Snake")); Spawner(name, position, 0f); } } if (flag2 || flag3) { position.y -= 1f; CaptureNextPlacedAs("room_door"); Piece("iron_wall_2x2", position, nesw, flag7 ? 45 : 0, flag7); if (flag) { CaptureNextPlacedAs("room_door2"); Piece("iron_wall_2x2", position - 2f * up, nesw); } else { position.y -= (addHighFrame ? 1f : 1.25f); Piece("stone_wall_1x1", position + num8 * val2, nesw + 1, tilt); Piece("stone_wall_1x1", position - num8 * val2, nesw + 1, 0f - num10); position.y = (flag3 ? num : (position.y - 0.4f)); Piece("stone_wall_2x1", position, nesw); } } if (coving && num5 < 3) { num8 = ((num6 <= 0) ? (num8 + 0.45f) : 0.5f); position.y -= (float)num6 + 1.4f; position -= 0.5f * val; Piece("stone_wall_1x1", position + num8 * val2, nesw, 45f); Piece("stone_wall_1x1", position - num8 * val2, nesw, 45f); } break; } } } public static void Room(int mapPiece, Vector3 position, int walls = 0, float ceilingHeight = -1f, float torchHeight = 2f, int align_nesw = 0) { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_067f: Unknown result type (might be due to invalid IL or missing references) //IL_073b: Unknown result type (might be due to invalid IL or missing references) //IL_0757: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05ec: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) if (mapPiece == 65535) { return; } if (ceilingHeight < 0f) { ceilingHeight = Mathf.Max(2f, m_mapMaxWallHeight - m_mapLowerFloorHeight - 1f); } mapPiece = RotateRoomCode(mapPiece, align_nesw); walls = RotateRoomCode(walls, align_nesw); int num = mapPiece & 0xF00F; int num2 = (mapPiece >> 16) & 0xF; bool flag = num2 > 0; bool flag2 = num == 15; bool flag3 = flag && num == 61440; bool flag4 = flag && num == 61455; int num3 = ((flag && (num & 0xF000) == 61440) ? (mapPiece & 0xF) : 0); bool flag5 = flag4 || flag3 || num3 > 0; bool flag6 = num2 == 15; bool flag7 = true; bool flag8 = m_roomPlanHasCeiling && !flag3; bool flag9 = false; float heightOffset = 3.5f; Vector3 val = position; val.y = m_mapLowerFloorHeight; if (flag2) { int num4 = mapPiece >> 8; int num5 = (mapPiece >> 4) & 3; mapPiece = 0; switch (num5) { case 0: if (num4 == 0) { Floor(val, 0, 0f, 0, 1, m_roomPlanTiledFloor); val.y += ceilingHeight; FloorFrame(val + m_trapdoorUpperOffset, 0f, m_trapdoorStyle); return; } OuterWall(num4 << 12, val, 1, torchHeight); if (num2 == 15) { flag8 = (flag6 = false); } break; case 1: if (num4 == 0) { FloorFrame(val + m_trapdoorLowerOffset, 0f, m_trapdoorStyle); return; } PlaceInnerWall(num4 << 4, val, 1); flag9 = true; torchHeight = 0f; break; case 2: if (num4 < 4) { int corridorLength = (m_entryConnection ? m_stairTowerEntryCorridorLength : 0); int style = (m_entryConnection ? m_stairTowerEntryStyle : m_stairTowerDefaultStyle); StairTower(val, num4, 4, style, corridorLength); return; } if (num4 < 8) { num4 >>= 2; num4 = (num4 - 1) & 3; Vector3 val2 = 1.5f * MapFwd(num4) + 0.25f * MapFwd(num4 + 1); val2.y = 1f; Vector3 position2 = StairsToSewers(val + val2, num4, 89); FloorPlanModify(position2); int num8 = 1 << num4; if ((walls & num8) > 0) { walls ^= num8; } OuterFrame(val, num4, 5); } else if (num4 < 10) { int num9 = num4 & 1; RoomDoor(-7, val + 2f * up, num9, 2f * MapFwd(num9 + 1)); } else { if (num4 < 12) { return; } if (num4 < 14) { int num10 = num4 & 1; RoomDoor(-6, val + 2f * up, num10, 2f * MapFwd(num10 + 1)); } else { GateCorridor(val, num4 & 1); } } break; case 3: { int num6 = 0; int num7 = 1; while (num6 < 4) { if ((num4 & num7) > 0) { int doorType = ((WUTIL.DieRoll(2) == 0) ? (-10) : (-9)); if (WUTIL.DieRoll(5) == 0) { doorType = -11; } RoomDoor(doorType, val + 2f * MapFwd(num6) + 2f * up, num6, 2f * MapFwd(num6 + 1)); } num6++; num7 <<= 1; } break; } } } if (mapPiece > 0) { if (!flag5) { OuterWall(mapPiece, val, 0, torchHeight); } PlaceInnerWall(mapPiece, val); } if (walls > 0) { if (num3 > 0 || flag3) { OuterWall(walls, val, 0, torchHeight); } else if ((mapPiece & walls) != walls) { walls ^= mapPiece & walls; OuterWall(walls, val, 0, torchHeight); } } if (!(ceilingHeight > 0f)) { return; } val.y += ceilingHeight; if (flag9) { val.y -= (flag ? 2f : 0.5f); flag = false; } if (num2 > 0) { val.y += 0.75f; if (!flag6 || flag9 || flag3) { m_mapLowerFloorHeight += 5.75f; m_mapMaxWallHeight += 3.5f; float num11 = (flag9 ? 1 : 2); int num12 = 1; int num13 = 0; while (num13 < 4) { if ((num2 & num12) > 0) { if (flag3) { Balcony(val, num13); } else if (flag) { OuterWall(num12, val, 0, 1.5f); } if (flag4) { FourPieces("stone_wall_2x1", val + num11 * MapFwd(num13), MapFwd(num13 + 1), num13, upright: false, 0f, 5); } } num13++; num12 <<= 1; } m_mapLowerFloorHeight -= 5.75f; m_mapMaxWallHeight -= 3.5f; } val.y += (flag9 ? 1f : 0.75f); if (flag) { Vector3 position3 = val; bool roomPlanStoneCeiling = m_roomPlanStoneCeiling; Floor(position3, 0, heightOffset, 0, 1, roomPlanStoneCeiling); } } int num14 = num3; int num15 = num14; if (num15 == 1) { FloorFrame(val); FloorFrame(val, m_mapLowerFloorHeight); FloorFrame(val, m_mapLowerFloorHeight - 6f); m_mapWallExclusionHeight = m_mapLowerFloorHeight - 4f; Pit(val); m_mapWallExclusionHeight = 0f; return; } if (flag8) { Floor(val, 0, 0f, 0, 1, m_roomPlanStoneCeiling); } if (flag7) { val.y = m_mapLowerFloorHeight; Floor(val, 0, 0f, 0, 1, m_roomPlanTiledFloor); RandomItem(m_levelRoomItems, val, 0, 0.5f, mapPiece); } } public static void OuterWall(int mapPiece, Vector3 piecePos, int style = 0, float torchHeight = 2f, float torchDensity = -1f, bool aboveFloor = false) { //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: 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_0714: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0765: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: 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_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) style &= m_outerWallStyleMask ^ 0xFFFF; bool flag = (style & 1) > 0; bool flag2 = (style & 2) > 0; bool flag3 = (style & 4) > 0; bool flag4 = (style & 8) > 0; int num = (style & 0x70) >> 4; bool flag5 = (style & 0x80) > 0; bool flag6 = (style & 0x100) > 0; bool flag7 = !(flag2 && flag); int num2 = 1; int num3 = 4096; if (torchDensity < 0f) { torchDensity = m_torchDensity; } if (flag2 || num > 0 || torchHeight < 1.5f) { torchDensity = 0f; } float num4 = (flag5 ? 0.5f : (-0.5f)); float num5 = m_mapMaxWallHeight - m_mapLowerFloorHeight; if (num5 < 1f) { return; } float num6 = (aboveFloor ? (m_mapMaxWallHeight + 1f) : m_mapMaxWallHeight); float num7 = (aboveFloor ? (m_mapLowerFloorHeight + 1f) : m_mapLowerFloorHeight); num7 -= 0.01f; int num8 = 0; while (num8 < 4) { bool flag8 = (mapPiece & num2) == 0; bool flag9 = (mapPiece & num3) == 0; bool flag10 = flag3 || flag4; if (!(flag8 && flag9)) { bool flag11 = flag3; bool flag12 = flag4; if (num > 0 || flag2) { flag9 = false; } Vector3 val = MapFwd(num8); Vector3 val2 = MapFwd(num8 + 1); Vector3 val3 = 0.5f * val2; Vector3 val4 = piecePos + 2f * val; val4.y = m_mapLowerFloorHeight + 1f; float y = val4.y; float num9 = (flag ? y : (y + 2f)); if (flag11 && torchHeight > 0f) { torchHeight -= 0.5f; } int num10 = (int)(num6 - y); if (aboveFloor && flag3 && num10 > 1) { num10 -= 2; } val4.y += num10; while (val4.y > num7) { if (!(val4.y > num6)) { if (flag10) { flag10 = false; Vector3 val5 = val4 + num4 * val - 3f * val3; val5.y = m_mapMaxWallHeight; if (flag11) { Piece("stone_wall_2x1", val5, num8, 45f); Piece("stone_wall_2x1", val5 + 4f * val3, num8, 45f); if (flag7) { Piece("stone_wall_1x1", val5 + 7f * val3, num8, 45f); } } } if (!(Mathf.Abs(val4.y - m_mapWallExclusionHeight) < 1.1f)) { if (val4.y <= y && flag12) { flag12 = false; Vector3 val6 = val4 + num4 * val - 3f * val3 - 0.5f * up; if (num5 < 3.5f) { val6.y += 1f; } Piece("stone_wall_2x1", val6, num8, 45f); if (num == 0 || num == 4) { Piece("stone_wall_2x1", val6 + 4f * val3, num8, 45f); } if (flag7) { Piece("stone_wall_1x1", val6 + 7f * val3, num8, 45f); } } if (flag2) { if (flag7) { Vector3 piecePos2 = val4 - 2f * val; piecePos2.y = m_mapLowerFloorHeight; OuterFrame(piecePos2, num8, (num5 > 3f) ? 15 : 7, num5 + 0.5f); break; } } else if (val4.y > num9 || flag9) { if (flag5) { Piece("stone_wall_4x2", val4 - val3, num8); } else { Piece("stone_wall_4x2", val4 + val3, num8); } } else if (flag8) { if (flag) { PieceUpright("stone_wall_2x1", val4, num8); Vector3 val7 = MapFwd(num8 + 3) * 1.7f; Piece("stone_pillar", val4 + val7, num8, WUTIL.RandomSpin(-10f, 5f)); Piece("stone_pillar", val4 - val7, num8, WUTIL.RandomSpin(-5f, -10f)); val4 -= MapFwd(num8 + 3) * 0.75f; Piece("stone_pillar", val4, num8, WUTIL.RandomSpin(-5f, 5f)); } else { PieceUpright("stone_wall_2x1", val4 + 4f * val3, num8); PieceUpright("stone_wall_2x1", val4 - 4f * val3, num8); PieceUpright("stone_floor_2x2", val4 + 2f * val3, num8 + 1); if (val4.y > y) { Piece("stone_wall_2x1", val4 - 2f * val3 + 0.5f * up, num8); } } } else if (val4.y <= y) { if (num > 0) { m_blockRoomDoorTall = flag3; GateCorridor(val4 - up + val3, num8, 0, 0f, 24 + num, 15, raiseEntryCeiling: false, flag4); } else { GateCorridor(val4 - up, num8); } } } } val4.y -= 2f; } if (WUTIL.DieRoll(4 - num8) == 0 && WUTIL.RandomSpin() < torchDensity) { piecePos.y = m_mapLowerFloorHeight + torchHeight; if (WallTorch(piecePos - 0.05f * val, num8, "", mapPiece)) { torchDensity = 0f; } } } num8++; num2 <<= 1; num3 <<= 1; } } public static void Balcony(Vector3 piecePos, int nesw, bool stoneExtension = true) { //IL_0021: 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_002b: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00bd: 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_00c4: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0047: 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) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) piecePos.y += 0.5f; Vector3 val = (stoneExtension ? 1.95f : 2.1f) * MapFwd(nesw); Vector3 val2 = MapFwd(nesw + 1); if (stoneExtension) { Piece("woodiron_beam", piecePos + val + val2, nesw); Piece("woodiron_beam", piecePos + val - val2, nesw); } piecePos.y += 0.9f; Piece("iron_wall_2x2", piecePos + val + val2, nesw); Piece("iron_wall_2x2", piecePos + val - val2, nesw); } public static void FloorFrame(Vector3 piecePos, float height = 0f, int style = 0) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0042: 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_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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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) style &= 3; if (height != 0f) { piecePos.y = height; } for (int i = 0; i < 4; i++) { FourPieces("stone_wall_2x1", piecePos + 1.5f * MapFwd(i), MapFwd(i + 1), i, upright: false, 0f, 5); } if (style > 0) { piecePos.y += 0.25f; Quaternion val = MapRot(0); Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; Quaternion rotation = Quaternion.Euler(eulerAngles.x + (float)((style == 3) ? 270 : 90), eulerAngles.y, 0f); CaptureNextPlacedAs("room_door"); Piece("wood_door", piecePos, rotation); if (style != 2) { CaptureCapturedGate("trapdoor", "oneway", "room_door"); } } } public static void OuterFrame(Vector3 piecePos, int nesw, int dulr = 15, float height = 4f) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003e: 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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) piecePos.y += 2f; if ((dulr & 3) > 0) { int lLrR = (dulr & 2) * 6 + (dulr & 1) * 3; FourPieces("stone_wall_2x1", piecePos + 2f * MapFwd(nesw), 2f * MapFwd(nesw + 1), nesw, upright: true, 1f, lLrR); } dulr >>= 2; if (dulr > 0) { int lLrR2 = dulr * 5; FourPieces("stone_wall_2x1", piecePos + 2f * MapFwd(nesw), MapFwd(nesw + 1), nesw, upright: false, height / 2f, lLrR2); } } public static void PlaceInnerWall(int mapPiece, Vector3 position, int style = 0) { //IL_0025: 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) //IL_0047: 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) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ac: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_01a1: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) bool flag = (style & 1) > 0; bool flag2 = (style & 2) > 0; bool flag3 = (style & 4) > 0; int num = 256; int num2 = 16; Vector3 val = 0.5f * up; int num3 = 0; while (num3 < 4) { if (flag3) { PieceUpright("stone_wall_2x1", position - up, num3); PieceUpright("stone_wall_2x1", position + up, num3); flag3 = false; } bool flag4 = (mapPiece & num2) == 0; bool flag5 = (mapPiece & num) == 0; if (!(flag5 && flag4)) { Vector3 val2 = MapFwd(num3); Vector3 val3 = position + val2; val3.y = m_mapLowerFloorHeight + 1.5f; int nesw = num3 + 1; if (flag5) { Vector3 val4 = MapFwd(nesw); if (flag) { if (flag2) { val3 += 0.5f * val2; } PieceUpright("stone_wall_4x2", val3 + val, nesw); } else { val3 += val2 - val4; PieceUpright("stone_wall_2x1", val3 - val4 - val, num3); PieceUpright("stone_wall_2x1", val3 - val4 + 3f * val, num3); PieceUpright("stone_wall_2x1", val3 - val4 + 7f * val, num3); Piece("iron_wall_2x2", val3, num3); Piece("iron_wall_2x2", val3 + 4f * val, num3); } } else if (flag4) { val3.y -= 0.125f; Piece("iron_wall_2x2", val3, nesw); val3.y += 2f; Piece("iron_wall_2x2", val3, nesw); } else { CaptureNextPlacedAs("room_door"); Piece("iron_grate", val3, nesw); val3.y += 2f; Piece("iron_wall_1x1", val3 - 0.5f * val2, nesw); Piece("iron_wall_1x1", val3 + 0.5f * val2, nesw); } } num3++; num2 <<= 1; num <<= 1; } } public static bool WallTorch(Vector3 position, int nesw, string name = "", int mapPiece = 0) { //IL_0065: 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_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_007d: 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_008d: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) int num = 4096 << nesw; if ((mapPiece & num) == num) { return false; } nesw &= 3; if (name == "") { name = m_mapTorch; } bool flag = name.Contains("Wall") || name.Contains("wall"); Quaternion val = MapRot(flag ? (nesw + 1) : nesw); Vector3 eulerAngles = ((Quaternion)(ref val)).eulerAngles; Quaternion rotation = Quaternion.Euler((float)((!flag) ? (-35) : 0), eulerAngles.y, 0f); Vector3 val2 = MapFwd(nesw); Vector3 val3 = position + (flag ? 1.3f : 1.5f) * val2; int num2 = 256 << nesw; if ((mapPiece & num2) == num2) { val3 += 0.6f * MapFwd(nesw + ((WUTIL.RandomSpin() < 0.5f) ? 1 : (-1))); } Piece(name, val3, rotation); return true; } public static void CaveIn(Vector3 topPosition, int nesw, int height = 4, int width = 3, int depth = 1, float spread = 0.25f, float randomness = 1f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) Vector3 val = MapFwd(nesw); Vector3 val2 = MapFwd(nesw + 1); topPosition -= val2 * (float)(width - 1) / 2f; int num = 0; while (num < depth) { Vector3 val3 = topPosition; float num2 = topPosition.y; int num3 = 0; while (num3 < height) { Vector3 val4 = val3; val4.y = num2; for (int i = 0; i < width; i++) { float num4 = WUTIL.RandomSpin(90f - 23f * randomness, 90f - 3f * randomness); if (WUTIL.RandomSpin() < 0.5f) { num4 *= -1f; } Piece("stone_wall_1x1", val4, WUTIL.DieRoll(4), num4, WUTIL.RandomSpin() < 0.5f); val4 += val2 + randomness * WUTIL.RandomSpin(-0.1f, 0.05f) * val; val4.y += randomness * WUTIL.RandomSpin(-0.05f, 0.05f); } val3 += spread * val; num3++; num2 -= 1f; } num++; topPosition += val; } } public static void Pillar(Vector3 position, int cornerMask = 15, int style = 128) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0548: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_077c: Unknown result type (might be due to invalid IL or missing references) //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_0781: Unknown result type (might be due to invalid IL or missing references) //IL_0783: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_07d0: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_07fc: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) string name = "stone_pillar"; if (style == 0 || style == 65535) { return; } bool flag = (cornerMask & 0xF) != 15; if (flag && style == 3873) { style = 131; } if ((style & 0x80) > 0) { if (flag && style != 131) { return; } int nesw = WUTIL.DieRoll(4); switch (style & 0x7F) { default: return; case 0: Piece("stone_pillar", position, nesw); Piece("stone_pillar", position + 2f * up, nesw); return; case 1: break; case 2: Coffin(position - 2.25f * up, nesw, empty: false, 0.25f); return; case 3: Torch("GuckBurner", position, 0.3f, nesw); return; } switch (WUTIL.DieRoll(4)) { case 0: Piece("StatueEvil", position - 3f * up, nesw, 0f, altTilt: false, 45f); return; case 1: Torch("GuckBurner", position, 0.3f, nesw); return; case 2: switch (WUTIL.DieRoll(5)) { default: return; case 0: Coffin(position - 2.25f * up, nesw); return; case 1: Torch("piece_brazierceiling01", position, 0.35f, nesw); return; case 2: style = 3873; break; case 3: style = 17; break; } break; default: switch (WUTIL.DieRoll(5)) { case 0: Coffin(position - 2.25f * up, nesw); return; case 1: style = 3873; Torch("GuckBurner", position, 0.35f, nesw); break; default: style = 1281; break; } break; } } bool flag2 = (style & 1) > 0; bool flag3 = (style & 2) > 0; bool flag4 = (style & 4) > 0; bool flag5 = (style & 8) > 0; bool flag6 = (style & 0x10) > 0; bool flag7 = (style & 0x20) > 0; bool flag8 = (style & 0x40) > 0; bool upright = flag7; float num = style >> 8; int lLrR = 3 * (cornerMask & 5); int lLrR2 = 3 * ((cornerMask >> 1) & 5); int lLrR3 = (int)(3 * ((((cornerMask & 3) == 3) ? 1u : 0u) | (uint)(((cornerMask & 0xC) == 12) ? 4 : 0))); int lLrR4 = (int)(3 * ((((cornerMask & 9) == 9) ? 1u : 0u) | (uint)(((cornerMask & 6) == 6) ? 4 : 0))); if (style == 3873) { name = "StoneTile"; position.y += 0.4f; Vector3 val = 1.2f * MapFwd(0); Vector3 val2 = 1.2f * MapFwd(1); switch (WUTIL.DieRoll(7)) { case 0: lLrR3 = 7; position += val; break; case 1: lLrR3 = 13; position -= val; break; case 2: lLrR4 = 7; position += val2; break; case 3: lLrR4 = 13; position -= val2; break; case 4: lLrR3 = (lLrR4 = 5); num = 20f; name = "stone_floor_2x2"; break; case 5: num = 13f; name = "stone_floor_2x2"; break; default: WDBUG.Log("Made fountain"); num = 13f; position.y -= 1.5f; lLrR3 = (lLrR4 = (lLrR = (lLrR2 = 10))); name = "stone_floor_2x2"; if (WUTIL.DieRoll(2) == 0) { Torch("GuckBurner", position, 0.3f); } break; } } else if (flag) { if (flag6) { return; } num = 3f; } else if (num == 0f) { num = WUTIL.DieRoll(); } float num2 = 0.18f * num / 5f; float num3 = 0.7071f * num2; Vector3 val3 = 4f * MapFwd(0); Vector3 val4 = 4f * MapFwd(1); if (flag2) { FourPieces(name, position, num2 * val4, 0, upright, 1f, lLrR4); FourPieces(name, position, num2 * val3, 0, upright, 1f, lLrR3, 90f); FourPieces(name, position, num3 * val3 + num3 * val4, 0, upright, 1f, lLrR, 45f); FourPieces(name, position, num3 * val3 - num3 * val4, 0, upright, 1f, lLrR2, 135f); } if (cornerMask > 0) { float num4 = 0.375f; if (flag5) { num4 *= WUTIL.RandomSpin(0.8f, 0.9f, 0.02f); position.y += WUTIL.RandomSpin(0.05f, 0.25f, 0.05f); } num2 += num4; num3 += 0.7071f * num4; if (flag3) { lLrR3 = (((cornerMask & 3) == 3) ? 1 : 0) | (((cornerMask & 0xC) == 12) ? 4 : 0); lLrR4 = (((cornerMask & 9) == 9) ? 1 : 0) | (((cornerMask & 6) == 6) ? 4 : 0); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(1.4f, 1f, 1f); FourPieces("stone_arch", position, num2 * val3, 0, upright, 1f, lLrR3, 90f, 0f, reflect: true); m_lastPlaced.localScale = localScale; CustomizeScale(m_lastPlaced); FourPieces("stone_arch", position, num2 * val4, 0, upright, 1f, lLrR4, 180f, 0f, reflect: true); m_lastPlaced.localScale = localScale; CustomizeScale(m_lastPlaced); } if (flag4) { lLrR = cornerMask & 5; lLrR2 = (cornerMask >> 1) & 5; float num5 = (flag8 ? 0.31f : 0f); Vector3 localScale2 = default(Vector3); ((Vector3)(ref localScale2))..ctor(1.4f + num5, 1f, 1f); num3 += 0.5f * num5; FourPieces("stone_arch", position, num3 * (val3 - val4), 0, upright, 1f, lLrR2, 45f, 0f, reflect: true); m_lastPlaced.localScale = localScale2; CustomizeScale(m_lastPlaced); FourPieces("stone_arch", position, num3 * (val3 + val4), 0, upright, 1f, lLrR, 135f, 0f, reflect: true); m_lastPlaced.localScale = localScale2; CustomizeScale(m_lastPlaced); } } } public static void Coffin(Vector3 position, int nesw, bool empty = true, float bannerOffset = 3.5f, float bannerInset = 3.25f, int bannerColor = 0) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) Piece("Piece_Coffin", position, nesw); if (empty) { if (WUTIL.TestLuck()) { position += WUTIL.RandomSpin(-1.3f, 1.3f) * MapFwd(nesw) + 0.5f * WUTIL.RandomSpin(-1f) * MapFwd(nesw + 1); Pickable("Pickable_Mushroom_yellow", position + up, nesw); } return; } Piece("Piece_CoffinGlass", position, nesw); int num = WUTIL.DieRoll(10); for (int i = 0; i < 4; i++) { int num2 = ((bannerColor >= 1 && bannerColor <= 7) ? bannerColor : (1 + WUTIL.DieRoll(7))); num += num2; if (bannerOffset > 0f) { Vector3 position2 = position + bannerInset * MapFwd(i); position2.y += bannerOffset; Piece("piece_banner0" + num2, position2, i + 1); } } string text = "Coins:" + num; if (num > 20 && WUTIL.TestLuck()) { text += ";SilverNecklace"; } position.y += 1f; Pickable("Pickable_ForestCryptRemains04", position, nesw, text); position += WUTIL.RandomSpin(0.9f, 1.3f, 0.2f) * MapFwd(nesw) + 0.5f * WUTIL.RandomSpin(-1f) * MapFwd(nesw + 1); Pickable(WUTIL.TestLuck(0.2f) ? "Pickable_Mushroom_blue" : "Pickable_Mushroom_yellow", position, nesw); } public static void Stairs(Vector3 position, int nesw, float width = 1f, int depth = 1, bool floor = true, bool ceiling = false, float centerHeight = 0f, bool vertical = false) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) //IL_0049: 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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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) int nesw2 = nesw + 2; Vector3 val = 2f * MapFwd(nesw) + up; if (depth < 0) { val = -val; depth = -depth; } Vector3 val2 = MapFwd(nesw + 1); Vector3 val3 = position - (width - 1f) * val2; val3.y -= centerHeight; int num = Mathf.CeilToInt(width); float num2 = ((num > 1) ? ((2f * width - 2f) / (float)(num - 1)) : 0f); int num3 = 1; while (num3 <= depth) { Vector3 val4 = val3; int num4 = 0; while (num4 < num) { if (ceiling || num3 < depth) { PieceUpright("stone_stair", val4 + 2f * centerHeight * up, nesw, upsideDown: true); } if (floor) { Piece("stone_stair", val4, nesw2, vertical ? 90 : 0, vertical); } num4++; val4 += num2 * val2; } num3++; val3 -= val; } } public static GameObject ColliderObject(Collider collider) { IDestructible componentInParent = ((Component)collider).gameObject.GetComponentInParent(); if (componentInParent != null) { return ((Component)((componentInParent is MonoBehaviour) ? componentInParent : null)).gameObject; } if (((Component)collider).GetComponent() == null && Object.op_Implicit((Object)(object)collider.attachedRigidbody)) { return ((Component)collider.attachedRigidbody).gameObject; } if ((Object)(object)((Component)collider).gameObject.transform.parent != (Object)null) { return ((Component)((Component)collider).gameObject.transform.parent).gameObject; } return ((Component)collider).gameObject; } public static bool IsInDungeon(Vector3 position, bool piece = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) if (position.y < 4090f) { return false; } return piece || position.y >= 5100f || position.y <= 5068f; } public static Quaternion MapRot(int nesw) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) return (m_dungeonRotation == null) ? Quaternion.identity : m_dungeonRotation[nesw & 3]; } public static Vector3 MapFwd(int nesw) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return m_dungeonDirection[nesw & 3]; } public static void RotateDungeon(int nesw) { //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) //IL_0055: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) WDBUG.Log($"RotateDungeon {nesw}"); if ((nesw & 3) != 0) { Quaternion[] array = (Quaternion[])(object)new Quaternion[4]; int num = 0; while (num < 4) { array[num] = m_dungeonRotation[nesw & 3]; m_dungeonDirection[num] = array[num] * Vector3.forward; num++; nesw++; } m_dungeonRotation = array; } } public static int GetCompassDirection(Vector3 direction) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) int result = 0; float num = 0f; for (int i = 0; i < 4; i++) { float num2 = Vector3.Dot(direction, MapFwd(i)); if (num2 > num) { num = num2; result = i; } } return result; } public static int GetMapNESW(Vector3 dir, float alignTol = 0.7071f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 2; i++) { float num = Vector3.Dot(dir, MapFwd(i)); if (num > alignTol) { return i; } if (num < 0f - alignTol) { return i + 2; } } return -1; } public static Vector3 GetRoomPlanPosition(int ns, int we, float heightOffset = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) return m_mapLocation + (float)(ns * 4) * MapFwd(3) + (float)(we * 4) * MapFwd(2) + heightOffset * up; } public static int TurnTowardsVector(Vector3 vector, int nesw) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Vector3 normalized = ((Vector3)(ref vector)).normalized; int num = 0; float num2 = 0f; int num3 = 0; while (num3 < 4) { float num4 = Vector3.Dot(normalized, MapFwd(nesw)); if (num4 > num2) { num2 = num4; num = num3; } num3++; nesw++; } return (num == 3) ? (-1) : num; } public static Vector3 GetPlanTilePos(int ix, int iy, float heightOffset = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_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) //IL_0048: 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) return m_floorPlanAnchor + (float)((ix + m_gateToMapX) * 4) * m_floorPlanDirectionX + (float)((iy + m_gateToMapY) * 4) * m_floorPlanDirectionY + heightOffset * up; } public static Vector3 GetPlanTilePos(Vector3 position, float heightOffset = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) GetPlanTileXY(position, out var ix, out var iy); return GetPlanTilePos(ix, iy, heightOffset); } public static bool GetPlanTileXY(Vector3 position, out int ix, out int iy) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Vector3 val = 0.25f * (position - m_floorPlanAnchor); float num = Vector3.Dot(val, m_floorPlanDirectionX); float num2 = Vector3.Dot(val, m_floorPlanDirectionY); ix = Mathf.FloorToInt(num + 0.5f) - m_gateToMapX; iy = Mathf.FloorToInt(num2 + 0.5f) - m_gateToMapY; return ix >= 0 && iy >= 0 && ix < m_floorPlan.GetLength(0) && iy < m_floorPlan.GetLength(1); } public static char GetPlanTile(int x, int y) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (x < 0 || y < 0 || x >= m_floorPlan.GetLength(0) || y >= m_floorPlan.GetLength(1)) { return '0'; } return OutOfBounds(GetPlanTilePos(x, y)) ? '0' : m_floorPlan[x, y]; } public static char GetPlanTile(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (OutOfBounds(position) || !GetPlanTileXY(position, out var ix, out var iy)) { return '0'; } return m_floorPlan[ix, iy]; } public static bool CheckPlanTilePos(Vector3 position, bool isTileEmpty = false, char hotTile = 'x') { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!OutOfBounds(position) && GetPlanTileXY(position, out var ix, out var iy)) { return (hotTile != 'x') ? (m_floorPlan[ix, iy] != hotTile) : (!isTileEmpty || m_floorPlan[ix, iy] == ' '); } return hotTile != 'x'; } public static bool OutOfBounds(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0037: Unknown result type (might be due to invalid IL or missing references) return position.x < m_mapBoundsMin.x || position.x > m_mapBoundsMax.x || position.z < m_mapBoundsMin.z || position.z > m_mapBoundsMax.z; } public static void SetPlanTiles(Vector3 position, char markMap, int nesw = 0, int tileFwd = 1, int tileRht = 1, bool showDebug = false) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0047: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) showDebug |= m_debugSetPlanTiles; if (showDebug) { Torch("piece_groundtorch_wood", position, -0.25f); } Vector3 val = 4f * MapFwd(nesw) * Mathf.Sign((float)tileFwd); Vector3 val2 = 4f * MapFwd(nesw + 1) * Mathf.Sign((float)tileRht); int num = 0; while (num < Mathf.Abs(tileFwd)) { Vector3 val3 = position; for (int i = 0; i < Mathf.Abs(tileRht); i++, val3 += val2) { GetPlanTileXY(val3, out var ix, out var iy); MarkPlanTile(markMap, ix, iy); if (showDebug) { Vector3 planTilePos = GetPlanTilePos(ix, iy); planTilePos.y = m_mapLowerFloorHeight; object torch; switch (markMap) { case '.': Torch("TorchCrystal", planTilePos); continue; case ' ': Torch("piece_groundtorch_blue", planTilePos); continue; default: torch = "piece_groundtorch"; break; case 'F': torch = "piece_groundtorch_green"; break; } Torch((string)torch, planTilePos); } } num++; position += val; } } public static void MarkPlanTile(char markMap, int x, int y) { int length = m_floorPlan.GetLength(0); int length2 = m_floorPlan.GetLength(1); if (x >= 0 && y >= 0 && x < length && y < length2) { m_floorPlan[x, y] = markMap; } else { WDBUG.Log($"MarkPlanTile({markMap}, {x}, {y}) out of bounds", WDBUG.Level.Dungeon); } } public static bool Solidify(GameObject go) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.IsWildlingObject(go)) { return true; } Piece component = go.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_canBeRemoved = false; ((StaticTarget)component).m_primaryTarget = false; component.m_targetNonPlayerBuilt = false; component.m_resources = (Requirement[])(object)new Requirement[0]; } WearNTear component2 = go.GetComponent(); if ((Object)(object)component2 == (Object)null) { return false; } component2.m_noSupportWear = false; if ((int)component2.m_materialType > 0) { if (((Object)go).name.StartsWith("Beehive")) { DropOnDestroyed component3 = go.GetComponent(); if ((Object)(object)component3 != (Object)null) { component3.m_dropWhenDestroyed.m_dropChance = 0f; } } else { component2.m_damages.m_fire = (DamageModifier)4; } component2.m_damages.m_blunt = (DamageModifier)4; component2.m_damages.m_slash = (DamageModifier)4; component2.m_damages.m_pierce = (DamageModifier)4; component2.m_damages.m_pickaxe = (DamageModifier)4; component2.m_damages.m_chop = (DamageModifier)4; component2.m_damages.m_frost = (DamageModifier)4; component2.m_damages.m_lightning = (DamageModifier)4; component2.m_damages.m_poison = (DamageModifier)4; component2.m_damages.m_spirit = (DamageModifier)4; } return true; } public static int GetDoorStyle() { if (WUTIL.RandomSpin() < m_doorStyleWallProb) { return 0; } if (WUTIL.RandomSpin() < m_doorStyleBlocked) { return 64; } if (WUTIL.RandomSpin() < m_doorStyleDoorway) { float num = WUTIL.RandomSpin(); return (num > m_doorStyleArchWindow) ? 32 : ((num < m_doorStyleArchWindow * 0.6f) ? 80 : 48); } return (WUTIL.RandomSpin() < m_doorStyleArchWindow) ? 80 : 96; } public static int RotateRoomCode(int mapPiece, int rotRight = 1) { rotRight &= 3; if (rotRight == 0) { return mapPiece; } if ((mapPiece & 0xF00F) == 15) { int num = (mapPiece >> 8) & 0xF; int num2 = (mapPiece >> 4) & 0xF; if (num2 == 2) { if (num <= 3) { num = (num + rotRight) & 3; } else if (num <= 7) { num = (num - 4 + rotRight) & 3; num |= 4; } else { rotRight &= 1; num ^= rotRight; } } else if (num2 <= 3) { num <<= rotRight; num = (num >> 4) | (num & 0xF); } num2 = ((mapPiece >> 16) & 0xF) << rotRight; num2 = (num2 >> 4) | (num2 & 0xF); return (num2 << 16) | (num << 8) | (mapPiece & 0xFF); } int num3 = mapPiece; int num4 = 0; for (int i = 0; i < 5; i++) { int num5 = (num3 & 0xF) << rotRight; int num6 = num5 >> 4; num4 |= ((num5 & 0xF) | num6) << i * 4; num3 >>= 4; } if ((mapPiece & 0xF0000) > 0 && (mapPiece & 0xF000) == 61440) { num4 = (num4 & 0xFFFF0) | (mapPiece & 0xF); } return num4; } public static string GetRandomItem(string itemGroup, int maxLevel = 100) { if (itemGroup == "") { return ""; } if (!m_randomItems.ContainsKey(itemGroup)) { WDBUG.Log("Unknown itemGroup: " + itemGroup); return ""; } int num = Math.Min(WUTIL.DieRoll(100), maxLevel) + 1; string[] array = m_randomItems[itemGroup].Split(new char[1] { ',' }); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ':' }); if (array2.Length > 1 && num >= int.Parse(array2[1])) { return array2[0]; } } return ""; } public static bool WorldSpawnerAt(Vector3 position) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) position.y = 0f; return m_awakeWorldSpawners.Contains(position); } private static bool CustomizeMinable(GameObject go, string name, bool pinData = true) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) MineRock5 component = go.GetComponent(); if ((Object)(object)component == (Object)null || !name.StartsWith("ice_floor")) { return false; } CustomizeScale(go.transform, name, pinData); component.m_damageModifiers.m_fire = (DamageModifier)5; component.m_damageModifiers.m_chop = (DamageModifier)5; ((Object)component).name = "ice_floor"; component.m_dropItems = CustomDropTable("KnifeFlint;WitheredBone;Obsidian;Crystal;SerpentScale;Coins:5;BoneFragments:1,2;LeatherScraps;PebbleSharp:4,3;PebbleRough:4,2;PebbleSmooth:4,2", 0, null, "", fixedList: false, 0.2f); return true; } public static bool CustomizeScale(Transform transform, string name = "", bool pinData = true) { //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) if (name.StartsWith("piece_banner0")) { name = "banner"; } switch (name) { case "banner": transform.localScale = new Vector3(0.8f, 0.8f, 1f); break; case "low_irongate": transform.localScale = new Vector3(1.3f, 0.75f, 1f); break; case "fenrir_head": transform.localScale = new Vector3(0.55f, 0.4f, 0.4f); break; case "ice_flower": transform.localScale *= 0.25f; break; case "ice_floor": transform.localScale = new Vector3(0.79f, 0.23f, 1.15f); break; case "ice_floor_large": return true; case "ice_floor_tall": transform.localScale = new Vector3(0.3f, 0.4f, 0.4f); break; case "ice_floor_sheet": transform.localScale = new Vector3(4f, 0.125f, 4f); break; case "short_table_oak": transform.localScale = new Vector3(0.4f, 1f, 1f); break; case "ice_floor_thin": transform.localScale = new Vector3(0.79f, 0.15f, 1.15f); break; default: if (pinData) { if (transform.localScale == Vector3.one || name.Contains("Chest")) { return false; } name = $"{transform.localScale}"; } else if (!name.StartsWith("(")) { return false; } try { string[] array = name.Substring(1, name.Length - 2).Split(new char[1] { ',' }); float num = ((array.Length != 0) ? float.Parse(array[0]) : 1f); float num2 = ((array.Length > 1) ? float.Parse(array[1]) : 1f); float num3 = ((array.Length > 2) ? float.Parse(array[2]) : 1f); transform.localScale = new Vector3(num, num2, num3); } catch { WDBUG.Log("Failed to parse size for " + ((Object)transform).name + ": " + name); return false; } break; } if (pinData) { DataPin(transform, name); } return true; } public static void RoomDecor(Vector3 center, int nesw, float wallFwd = 1.5f, float wallRht = 1.5f, float torchChance = 0.5f, bool doorNorth = false) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0637: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_07d5: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_07dd: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Unknown result type (might be due to invalid IL or missing references) //IL_07e7: Unknown result type (might be due to invalid IL or missing references) //IL_07ec: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06d5: Unknown result type (might be due to invalid IL or missing references) //IL_06d7: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_077c: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) if (m_roomDecorLevel == 0) { return; } float num = ((m_addContainerItems == "") ? ((float)m_roomDecorLevel * 0.2f - 0.1f) : 1f); float num2 = 0.2f * (float)m_roomDecorLevel; bool flag = (double)wallFwd < 2.25; Vector3 val = MapFwd(nesw); Vector3 val2 = MapFwd(nesw + 1); float num3 = ((wallFwd >= 2.25f) ? 2.25f : (wallFwd - 0.5f)); wallFwd += 0.1f; wallRht += 0.1f; float num4 = WUTIL.RandomSpin(); if (num4 < torchChance) { if (num4 < 0.5f * torchChance) { Torch("piece_groundtorch_wood", center - wallFwd * val, 1.5f, nesw + 2, tilt: true); } else { Torch("piece_groundtorch_wood", center - val + wallRht * val2, 1.5f, nesw + 1, tilt: true); } } wallFwd -= 0.4f; wallRht -= 0.4f; num4 = WUTIL.RandomSpin(); bool flag2 = WUTIL.RandomSpin() < (float)m_roomDecorLevel * 0.4f - 0.3f; if (num4 < m_roomDecorItemStandChance) { string[] array = "Club;Torch;AxeFlint;ShieldWood;KnifeFlint;Bow;SpearFlint;SwordBronze;MaceIron;SpearChitin".Split(new char[1] { ';' }); bool flag3 = num4 < 0.5f * m_roomDecorItemStandChance; string itemSupport = array[WUTIL.DieRoll(flag3 ? (array.Length - 2) : array.Length)]; if (flag3) { if (num4 < m_roomDecorFakeItemChance) { int index = WUTIL.DieRoll(m_randomDropOnce.Count); itemSupport = m_randomDropOnce[index]; m_randomDropOnce.RemoveAt(index); } ItemStand(1, center + (wallFwd - 1.08f) * val + 0.2f * val2, nesw, 1.25f, itemSupport); } else { ItemStand(1, center - 2.8f * val + (wallRht - 1.08f) * val2, nesw + 1, 1.5f, itemSupport); } num -= 0.3f; } if (WUTIL.RandomSpin() < num) { int num5 = WUTIL.DieRoll(flag ? 2 : 4); Vector3 val3 = ((num5 >= 2) ? (center - wallFwd * val) : (center + (wallFwd - 0.1f) * val - 0.6f * val2)); if (doorNorth && num5 < 2) { num5 = 3; val3 += 0.25f * val2; } switch (num5) { case 0: Chest(flag2 ? "TreasureChest_mountains" : "TreasureChest_meadows", val3, nesw + 2, 0f, 1); break; case 1: Chest(flag2 ? "TreasureChest_forestcrypt" : "shipwreck_karve_chest", val3, nesw); break; case 2: Chest(flag2 ? "TreasureChest_trollcave" : "TreasureChest_blackforest", val3, nesw); break; default: Chest(flag2 ? "piece_chest_private" : "piece_chest_wood", val3, nesw, 0f, 3); break; } if (WUTIL.RandomSpin() < num) { Barrel(center + wallFwd * val + 0.7f * val2, nesw); } if (num5 < 2 && WUTIL.RandomSpin() < num) { Barrel(val3 + val2, nesw); } } wallRht -= 0.25f; num4 = WUTIL.RandomSpin(); float radius = 0.01f + 0.5f * WUTIL.RandomSpin(); Vector3 val4 = WUTIL.OnCircle(Vector3.zero, radius, 1, ground: false); if (WUTIL.RandomSpin() < 0.2f * (float)m_roomDecorLevel) { Piece("piece_chair", center - val - 0.25f * val2, nesw, 0f, altTilt: false, 70f); } if (WUTIL.RandomSpin() < 0.5f) { Piece(flag2 ? "piece_chair03" : "piece_chair02", center - num3 * val + wallRht * val2, nesw, 0f, altTilt: false, -30f); } if (WUTIL.RandomSpin() < 0.2f * (float)m_roomDecorLevel - 0.1f) { Piece("piece_chair", center + val + (wallRht + 0.25f) * val2, nesw + 3); } if (wallFwd >= 2f && num4 < num2) { val4.y += 0.8f; Vector3 position = center - 0.5f * val + wallRht * val2; Vector3 position2 = center + (wallFwd - 2f) * val - wallRht * val2; if (num4 < 0.5f * num2) { Table(position, nesw + 1); return; } Piece("goblin_bed", position2, nesw + 2); if (WUTIL.RandomSpin() < 0.2f * (float)m_roomDecorLevel) { Piece("bucket", center - val - 2f * val2, nesw); } if (WUTIL.RandomSpin() < 0.1f * (float)m_roomDecorLevel) { Piece("CastleKit_braided_box01", position, nesw, 0f, altTilt: false, WUTIL.RandomSpin(-30f, 80f)); } if (WUTIL.RandomSpin() < 0.4f) { Piece(flag2 ? "rug_fur" : "rug_deer", center + val + 0.5f * val2, nesw); } } else if (WUTIL.RandomSpin() < 0.3f * (float)m_roomDecorLevel) { Barrel(center + 2f * val4 + up); } } public static void Barrel(Vector3 position, int nesw = 0, float heightOffset = 0f, float jitter = 0f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) DisplacedObject("barrell", position, nesw, jitter); CustomizeContainer(m_lastPlaced, BarrelData()); } private static string BarrelData() { string[] array = "Thistle;Raspberry:6;CarrotSeeds:3;QueensJam:2;Honey:3;Cloudberry:4;BoarJerky:2;Apples".Split(new char[1] { ';' }); string text = array[WUTIL.DieRoll(array.Length)]; float num = WUTIL.RandomSpin(); if (num < 0.95f) { text = text + ";" + array[WUTIL.DieRoll(array.Length)]; } if (num < 0.5f) { array = "Club;Torch;AxeFlint;ShieldWood;KnifeFlint;Bow;SpearFlint;SwordBronze;MaceIron;SpearChitin".Split(new char[1] { ';' }); text = text + ";" + array[WUTIL.DieRoll(array.Length)]; } if (num < 0.1f) { array = "MeadTasty;MeadHealthMinor;MeadStaminaMinor;MeadPoisonResist;MeadFrostResist".Split(new char[1] { ';' }); text = text + ";" + array[WUTIL.DieRoll(array.Length)]; } return text; } public static void Chest(string name, Vector3 position, int nesw = 0, float heightOffset = 0f, int type = 2) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) position.y += heightOffset; Piece(name, position, nesw); if (type == 0 || m_roomDecorLevel <= 0) { return; } if (m_addContainerItems != "") { bool flag = m_addContainerItems.StartsWith("+"); CustomizeContainer(m_lastPlaced, flag ? m_addContainerItems.Substring(1) : m_addContainerItems, !flag); m_addContainerItems = ""; return; } string text = ((type == 1) ? "Thistle;Raspberry:6;CarrotSeeds:3;QueensJam:2;Honey:3;Cloudberry:4;BoarJerky:2;Apples" : "Stone;Mushroom:3;Coal:2;MushroomYellow:2;Acorn:2;MushroomBlue:1;Sausages:4;WolfJerky:2"); string[] array = text.Split(new char[1] { ';' }); int num = ((m_roomDecorLevel > 2) ? array.Length : (m_roomDecorLevel * 2 + 1)); string text2 = array[WUTIL.DieRoll(num)]; float num2 = ((type == 3) ? 0.011f : WUTIL.RandomSpin()); if (num2 < 0.95f) { text2 = text2 + ";" + array[WUTIL.DieRoll(num)]; } if (num2 < 0.7f) { array = "Club;Torch;AxeFlint;ShieldWood;KnifeFlint;Bow;SpearFlint;SwordBronze;MaceIron;SpearChitin".Split(new char[1] { ';' }); text2 = text2 + ";" + array[WUTIL.DieRoll((m_roomDecorLevel > 2) ? array.Length : num)]; } if (num2 < 0.3f) { array = "Thistle;Raspberry:6;CarrotSeeds:3;QueensJam:2;Honey:3;Cloudberry:4;BoarJerky:2;Apples".Split(new char[1] { ';' }); text2 = text2 + ";" + array[WUTIL.DieRoll((m_roomDecorLevel > 2) ? array.Length : num)]; } if (WUTIL.TestLuck(0.05f * (float)m_roomDecorLevel)) { array = "MeadTasty;MeadHealthMinor;MeadStaminaMinor;MeadPoisonResist;MeadFrostResist".Split(new char[1] { ';' }); text2 = text2 + ";" + array[WUTIL.DieRoll((m_roomDecorLevel > 2) ? array.Length : (num - 2))]; } if (WUTIL.TestLuck(0.02f * (float)m_roomDecorLevel)) { text2 = text2 + ";" + array[WUTIL.DieRoll(array.Length)]; } if (type == 3) { array = "Coins:100;Crystal;BloodPudding;Obsidian;SerpentScale;Truffle:3".Split(new char[1] { ';' }); text2 = text2 + ";" + array[WUTIL.DieRoll((m_roomDecorLevel > 2) ? array.Length : (num - 2))]; } CustomizeContainer(m_lastPlaced, text2); } public static bool CustomizeContainer(Transform transform, string data, bool fixedList = false, bool debug = false) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)transform == (Object)null || data == "") { return false; } DropOnDestroyed component = ((Component)transform).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { if (debug) { WDBUG.Log("Custom DoD " + WUTIL.GameName(((Object)transform).name) + " with: " + data); } component.m_dropWhenDestroyed = CustomDropTable(data, 8, component.m_dropWhenDestroyed, "TinOre,GreydwarfEye,DeerHide,IronScrap", fixedList); return true; } Container component2 = ((Component)transform).gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { if (debug) { WDBUG.Log("Custom Container " + WUTIL.GameName(((Object)transform).name) + " with: " + data); } component2.m_privacy = (PrivacySetting)2; component2.m_defaultItems = CustomDropTable(data, 0, component2.m_defaultItems, "TinOre,GreydwarfEye,DeerHide,IronScrap", fixedList); component2.UseItem((Humanoid)(object)Player.m_localPlayer, (ItemData)null); return true; } return false; } public static DropTable CustomDropTable(string newDrops = "", int maxItems = 0, DropTable refDropTable = null, string removeDrops = "", bool fixedList = false, float dropChance = 1f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) DropTable val = new DropTable(); string[] array = newDrops.Split(new char[1] { ';' }); int num = array.Length; if (fixedList) { val.m_dropMin = num; val.m_dropMax = num; val.m_dropChance = dropChance; val.m_oneOfEach = true; } else if (refDropTable != null) { string[] source = removeDrops.Split(new char[1] { ',' }); val.m_dropMin = refDropTable.m_dropMin; val.m_dropMax = refDropTable.m_dropMax; val.m_oneOfEach = refDropTable.m_oneOfEach; val.m_dropChance = refDropTable.m_dropChance; foreach (DropData drop in refDropTable.m_drops) { string value = WUTIL.GameName(drop.m_item.gameObject); if (!source.Contains(value)) { DropData item = new DropData { m_item = drop.m_item, m_stackMin = drop.m_stackMin, m_weight = drop.m_weight, m_stackMax = drop.m_stackMax }; val.m_drops.Add(item); } } } else { val.m_dropMin = 1; val.m_dropMax = 4; val.m_dropChance = dropChance; val.m_oneOfEach = true; } if (!fixedList && maxItems > 0) { int i = val.m_drops.Count; string text = ""; for (; i < maxItems; i++) { if (num <= 0) { break; } int num2 = WUTIL.DieRoll(num); text = text + ";" + array[num2]; array[num2] = array[--num]; } if (i > 0 && text.Length > 0) { newDrops = text.Substring(1); } } string[] array2 = newDrops.Split(new char[1] { ';' }); foreach (string text2 in array2) { int num3 = text2.IndexOf(":"); string name = ((num3 >= 0) ? text2.Remove(num3) : text2); GameObject prefab = WUTIL.GetPrefab(name); if ((Object)(object)prefab == (Object)null) { continue; } DropData val2 = new DropData { m_item = prefab }; if (num3 < 1) { val2.m_stackMax = 1; val2.m_stackMin = 0; val2.m_weight = 1f; } else { try { string[] array3 = text2.Substring(num3 + 1).Split(new char[1] { ',' }); val2.m_stackMax = ((array3.Length == 0) ? 1 : int.Parse(array3[0])); val2.m_stackMin = (fixedList ? val2.m_stackMax : (val2.m_stackMax / 3)); val2.m_weight = ((array3.Length <= 1) ? 1 : int.Parse(array3[1])); val.m_dropChance = dropChance; } catch { WDBUG.Log("Failed to parse drop list for " + text2 + " " + text2.Substring(num3)); continue; } } val.m_drops.Add(val2); } return val; } public static void DataPin(Transform target, string data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) string pinDataAt = GetPinDataAt(target.position); if (pinDataAt == data) { if (ZNet.instance.IsServer()) { WDBUG.Log("Server not creating DataPin with same data: " + data, WDBUG.Level.Dungeon); } return; } if (pinDataAt != "") { m_awakeProxyData[target.position] = data; return; } Transform lastPlaced = m_lastPlaced; Object("Piece_Proxy", target.position); m_lastDataPin = m_lastPlaced; m_lastPlaced = lastPlaced; if ((Object)(object)m_lastDataPin != (Object)null && !SetPinData(((Component)m_lastDataPin).gameObject, data)) { WDBUG.Log("Object was not created for a DataPin for " + ((Object)m_lastDataPin).name + " data: " + data); } } public static bool IsProxyObject(GameObject go) { return ((Object)go).name.Contains("_Proxy"); } public static bool SetPinData(GameObject go, string data) { if (IsProxyObject(go)) { Bed component = go.GetComponent(); ZNetView component2 = go.GetComponent(); if ((Object)(object)component2 == (Object)null && (Object)(object)component == (Object)null) { WDBUG.Log("Invalid proxy item: " + ((Object)go).name + " for data: " + data); return false; } component2.InvokeRPC("SetOwner", new object[2] { Game.instance.GetPlayerProfile().GetPlayerID(), data }); return true; } return false; } private static string GetProxyData(GameObject go) { return go.GetComponent().GetZDO().GetString("ownerName", ""); } public static string GetPinDataAt(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return m_awakeProxyData.ContainsKey(position) ? m_awakeProxyData[position] : ""; } public static void Spawner(string name, Vector3 position, float heightOffset = 1f, int nesw = 0) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (name == "DraugrPile") { DisplacedObject("Spawner_DraugrPile", position, nesw, heightOffset); position = WUTIL.OnCircle(position, 2f, 1, ground: false); heightOffset += 1f; name = "RatDraugr"; } position.y += heightOffset; GameObject val = WUTIL.PlaceObject("Spawner_Proxy", position); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to create Spawner_Proxy"); return; } if (!SetPinData(val, name)) { WDBUG.Log("Failed to set Spawner data: " + name + " for " + ((Object)val).name); } ConfigureSpawner(val.GetComponent(), name); } private static void ConfigureSpawner(CreatureSpawner spawner, string name) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_06a8: Unknown result type (might be due to invalid IL or missing references) //IL_05e3: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) if (name == "") { return; } bool flag = IsInDungeon(((Component)spawner).transform.position, piece: true); bool spawnInPlayerBase = flag; int num = ((!flag) ? 1 : 2); int num2 = ((!flag) ? 1 : 3); float triggerDistance = ((!flag) ? 50 : (SwampDungeon.AtGreatOak(((Component)spawner).transform) ? 150 : 30)); float respawnTimeMinuts = 10f; string text = name; Vector3 val = Vector3.one; switch (name) { case "Rat": spawnInPlayerBase = true; break; case "SkeletonArcher": text = "Skeleton"; num = 4; ((Vector3)(ref val))..ctor(0.9f, 0.8f, 0.9f); break; case "Wraith": val = Vector3.one; num = 4; num2 = 5; break; case "Witherin": text = "Wraith"; ((Vector3)(ref val))..ctor(0.7f, 0.8f, 0.7f); num = 1; num2 = 2; break; case "Keeper": text = "Draugr"; break; case "Keeper_Guard": text = "Draugr"; num = 4; break; case "Keeper_Ranged": text = "Draugr_Ranged"; num2 = 1; break; case "Keeper_Ranged_Guard": text = "Draugr_Ranged"; num = 4; respawnTimeMinuts = 1f; break; case "Keeper_Elite": text = "Draugr_Elite"; break; case "Keeper_Elite_Guard": text = "Draugr_Elite"; num = 4; break; case "Hatchling": triggerDistance = 50f; break; case "Ice_Dragon": text = "Hatchling"; num = 4; val *= 2f; triggerDistance = 50f; break; case "Fenringlin": text = "Ulv"; ((Vector3)(ref val))..ctor(0.5f, 0.7f, 0.5f); num2 = 1; break; case "Iceworm_Larva": text = "Leech_cave"; ((Vector3)(ref val))..ctor(0.3f, 0.3f, 0.5f); num = 4; break; case "Sewer_Snake": text = "Leech_cave"; ((Vector3)(ref val))..ctor(0.2f, 0.2f, 0.2f); respawnTimeMinuts = 1f; num2 = 1; break; case "Iceworm": text = "Serpent"; val *= 0.15f; num2 = 1; break; case "IcewormLarge": text = "Serpent"; name = "Iceworm"; val *= 0.5f; num = 4; triggerDistance = 40f; break; case "Troll": case "Greydwarf_Warlock": case "Greydwarf_Commander": triggerDistance = 60f; break; case "TentaRoot": triggerDistance = 6f; respawnTimeMinuts = 0.2f; break; } GameObject prefab = WUTIL.GetPrefab(text); if ((Object)(object)prefab == (Object)null) { WDBUG.Log("Failed to create " + name + " prefab for spawner " + text); return; } ((Object)spawner).name = name; spawner.m_creaturePrefab = prefab; spawner.m_respawnTimeMinuts = respawnTimeMinuts; if (name.StartsWith("Rat")) { val *= 0.2f; if (flag) { num = 1; spawner.m_respawnTimeMinuts = 10f; } else { val *= WUTIL.RandomSpin(1f, 1.3f, 0.1f); } } spawner.m_minLevel = Mathf.Min(num, num2); spawner.m_maxLevel = Mathf.Max(num, num2); ((Component)spawner).transform.localScale = val; spawner.m_spawnAtDay = true; spawner.m_spawnInPlayerBase = spawnInPlayerBase; spawner.m_triggerDistance = triggerDistance; spawner.m_requireSpawnArea = false; spawner.m_maxGroupSpawned = 0; WDBUG.Log($"Configuring {name} level: {spawner.m_minLevel}-{spawner.m_maxLevel} ({text}) scale: {val}", WDBUG.Level.Dungeon); if (flag || MountainDungeon.InSnakeHeadRegion(((Component)spawner).transform.position)) { if (!flag) { WDBUG.Log("Captured Shake Head Spawner: " + name, WDBUG.Level.Dungeon); } TrackDungeonSpawner(((Component)spawner).transform); return; } Vector3 position = ((Component)spawner).transform.position; position.y = 0f; if (!m_awakeWorldSpawners.Contains(position)) { m_awakeWorldSpawners.Add(position); } } public static bool CustomizeCharacter(Character character, string spawnName, Vector3 scale) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_006e: 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_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010c: 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) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)character).gameObject; string text = WUTIL.GameName(gameObject); if (scale != Vector3.one) { gameObject.transform.localScale = scale; } else if (spawnName == "") { return false; } WDBUG.Log($"Customize {text} ({character.GetLevel()}) as {spawnName} x{scale}", WDBUG.Level.Dungeon); Humanoid component = gameObject.GetComponent(); MonsterAI component2 = gameObject.GetComponent(); CharacterDrop component3 = gameObject.GetComponent(); int level = character.GetLevel(); float y = scale.y; switch (spawnName) { case "Iceworm": { ((Object)gameObject).name = ((y >= 0.4f) ? "Mature Iceworm" : spawnName); Tail component5 = gameObject.GetComponent(); component5.m_gravity = 0f; component5.m_waterSurfaceCheck = false; ((Character)component).m_damageModifiers.m_frost = (DamageModifier)3; ((Character)component).m_damageModifiers.m_fire = (DamageModifier)0; ((Character)component).m_faction = (Faction)5; ((Character)component).m_health = ((Character)component).m_health * y; component2.m_avoidLand = false; ((BaseAI)component2).m_serpentTurnRadius = 5f; ((BaseAI)component2).m_pathAgentType = (AgentType)((!(y > 0.2f)) ? 1 : 10); ((BaseAI)component2).m_idleSound.m_effectPrefabs = (EffectData[])(object)new EffectData[0]; ((BaseAI)component2).m_idleSoundChance = 0f; while (component3.m_drops.Count > 1) { component3.m_drops.RemoveAt(0); } component3.m_drops[0].m_amountMin = 1; component3.m_drops[0].m_amountMax = 2; component3.m_drops[0].m_levelMultiplier = false; SetSkinTone(gameObject, "Visual/Serpant", -0.2f * y, 0.1f, -0.1f); break; } case "Iceworm_Larva": { ((Object)gameObject).name = "Iceworm Larva"; Transform val2 = gameObject.transform.Find("Visual/Armature/root"); Tail component6 = ((Component)val2).GetComponent(); if ((Object)(object)component6 != (Object)null) { component6.m_gravity = 0f; component6.m_waterSurfaceCheck = false; } ((Character)component).m_damageModifiers.m_frost = (DamageModifier)3; ((Character)component).m_faction = (Faction)5; ((Character)component).m_walkSpeed = 2f; ((Character)component).m_speed = 1f; component2.m_avoidLand = false; ((BaseAI)component2).m_serpentTurnRadius = 5f; ((BaseAI)component2).m_pathAgentType = (AgentType)1; component3.m_drops.Clear(); break; } case "Ice_Dragon": ((Object)gameObject).name = "Ice Dragon"; ((Character)component).m_health = ((Character)component).m_health * y; ((Character)component).m_airControl = 0.2f; component2.m_avoidLand = false; ((BaseAI)component2).m_pathAgentType = (AgentType)10; ((BaseAI)component2).m_airDuration = 5f; ((BaseAI)component2).m_groundDuration = 15f; ((BaseAI)component2).m_randomCircleInterval = 10f; ((BaseAI)component2).m_randomMoveRange = 30f; ((BaseAI)component2).m_groundDuration = 20f; component2.m_alertRange = 50f; SetSkinTone(gameObject, "Visual/Hatchling_mountain/Hatchling", -0.15f, 0f, 0f); SetSkinTone(gameObject, "Visual/Hatchling_mountain/Hatchling.001", 0.1f, 0f, 0f); SetSkinTone(gameObject, "Visual/Hatchling_mountain/Horns", 0.2f, 0.05f, 0f); SetSkinTone(gameObject, "Visual/Hatchling_mountain/eyes", -0.2f, 1f, 0.9f); break; case "Sewer_Snake": { ((Object)gameObject).name = "Sewer Snake"; Transform val = gameObject.transform.Find("Visual/Armature/root"); Tail component4 = ((Component)val).GetComponent(); if ((Object)(object)component4 != (Object)null) { component4.m_gravity = 0f; component4.m_waterSurfaceCheck = false; } ((Character)component).m_damageModifiers.m_frost = (DamageModifier)3; ((Character)component).m_faction = (Faction)3; ((Character)component).m_walkSpeed = 2f; ((Character)component).m_speed = 1f; component2.m_avoidLand = false; ((BaseAI)component2).m_serpentTurnRadius = 5f; ((BaseAI)component2).m_pathAgentType = (AgentType)1; component3.m_drops.Clear(); break; } case "Witherin": ((Object)gameObject).name = spawnName; ((Character)component).m_health = ((Character)component).m_health * y; ((BaseAI)component2).m_pathAgentType = (AgentType)1; component2.m_sleeping = true; component2.m_alertRange = 4f; component3.m_drops.Clear(); SetSkinTone(gameObject, "Visual/wraith/wraith", 0.25f, 0.2f, 0.1f); break; case "Wraith": if (((Object)gameObject).name != spawnName) { ((Object)gameObject).name = spawnName; WDBUG.Log("Restore Wraith name at level " + character.GetLevel(), WDBUG.Level.Dungeon); } SetSkinTone(gameObject, "Visual/wraith/wraith", 0.8f, 0.2f, 0.1f); break; case "Fenringlin": ((Object)gameObject).name = spawnName; ((Character)component).m_health = ((Character)component).m_health * y; ((BaseAI)component2).m_pathAgentType = (AgentType)1; component2.m_sleeping = true; component2.m_alertRange = 3f; component3.m_drops.Clear(); break; case "SkeletonArcher": ((Object)gameObject).name = "Skeleton"; component.m_randomWeapon = (GameObject[])(object)new GameObject[1] { component.m_randomWeapon[2] }; component2.m_sleeping = true; component2.m_alertRange = 4f; component3.m_drops.Clear(); SetSkinTone(gameObject, "Visual/_skeleton_base/Skeleton", 0.2f, 0.1f, -0.1f); break; default: if (spawnName.StartsWith("Keeper")) { ((Object)gameObject).name = "Keeper"; if (spawnName.EndsWith("_Guard")) { ((Character)component).m_speed = 2f; ((Character)component).m_walkSpeed = 0f; ((Character)component).m_runSpeed = 0f; ((BaseAI)component2).m_randomMoveRange = 0f; } else { ((Character)component).m_speed = 1f; ((Character)component).m_walkSpeed = 5f; ((Character)component).m_runSpeed = 6f; ((BaseAI)component2).m_randomMoveRange = 10f; } ((Character)component).SetLevel(Math.Min(((Character)component).GetLevel(), 3)); break; } return false; } return true; } public static void RestoreInhabitants(Vector3 position, float maxRange = 40f, bool sewers = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(position, maxRange, WUTIL.c_characterRayMask); foreach (Collider val in array) { Transform val2 = ((Component)val).gameObject.transform; while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; } RecustomizeCharacter(((Component)val2).gameObject.GetComponent(), sewers); } } public static bool RecustomizeCharacter(Character character, bool sewers = false) { //IL_0035: 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_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null || character.IsPlayer()) { return false; } string text = WUTIL.GameName(((Component)character).gameObject); int level = character.GetLevel(); Vector3 val = Vector3.one; string text2 = ""; switch (text) { case "Draugr": case "Draugr_Ranged": case "Draugr_Elite": if (sewers) { return false; } text2 = "Keeper" + text.Substring(6); if (level > 3) { text2 += "_Guard"; } break; case "Serpent": text2 = "Iceworm"; val *= ((level > 3) ? 0.5f : 0.15f); break; case "Hatchling": if (level > 3) { text2 = "Ice_Dragon"; val *= 2f; } break; case "Leech_cave": text2 = ((level > 3 || !sewers) ? "Iceworm_Larva" : "Sewer_Snake"); val = ((level > 3) ? new Vector3(0.3f, 0.3f, 0.5f) : new Vector3(0.2f, 0.2f, 0.2f)); break; case "Skeleton": if (level > 3 && sewers) { text2 = "SkeletonArcher"; ((Vector3)(ref val))..ctor(0.8f, 0.7f, 0.8f); } break; case "Ulv": text2 = "Fenringlin"; ((Vector3)(ref val))..ctor(0.5f, 0.7f, 0.5f); break; case "Wraith": if (level > 3) { text2 = text; break; } text2 = "Witherin"; ((Vector3)(ref val))..ctor(0.7f, 0.8f, 0.7f); break; default: return false; } CustomizeCharacter(character, text2, val); return true; } public static void TrackDungeonSpawner(Transform t) { if (!m_awakeDungeonSpawners.Contains(t)) { m_awakeDungeonSpawners.Add(t); } } private static void SetSkinTone(GameObject go, string renderTarget, float hue, float saturation, float value) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown Transform val = go.transform.Find(renderTarget); if ((Object)(object)val == (Object)null) { WDBUG.Log("SetSkinTone for " + ((Object)go).name + " did not have " + renderTarget + " transform"); return; } Renderer component = ((Component)val).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log("SetSkinTone for " + ((Object)go).name + "." + renderTarget + " has no Renderer"); } else { Material[] sharedMaterials = component.sharedMaterials; sharedMaterials[0] = new Material(sharedMaterials[0]); sharedMaterials[0].SetFloat("_Hue", hue); sharedMaterials[0].SetFloat("_Saturation", saturation); sharedMaterials[0].SetFloat("_Value", value); component.sharedMaterials = sharedMaterials; } } public static void AddDungeonPickables(Transform t) { if (!m_awakeDungeonPickables.Contains(t)) { m_awakeDungeonPickables.Add(t); } } public static void NoteDungeonBuilding() { WUTIL.TimerReset("no_navmesh_update", 0.5f); } public static bool ItemStand(int type, Vector3 position, int nesw, float heightOffset = 1.5f, string itemSupport = "", int mapPiece = 0) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) //IL_004a: 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) //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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) bool flag = (type & 2) == 0; bool flag2 = (type & 4) != 0; int num = 4096 << nesw; if ((mapPiece & num) == num) { return false; } nesw &= 3; Vector3 val = MapFwd(nesw); if (flag) { position += 1.5f * val; } int num2 = 256 << nesw; if ((mapPiece & num2) == num2) { position += 0.6f * MapFwd(nesw + ((WUTIL.RandomSpin() < 0.5f) ? 1 : (-1))); } position.y += heightOffset; string name = (flag2 ? "dragoneggcup" : (flag ? "itemstand" : "goblinking_totemholder")); if (flag2 && flag) { Quaternion val2 = MapRot(nesw + 2); Vector3 eulerAngles = ((Quaternion)(ref val2)).eulerAngles; Quaternion rotation = Quaternion.Euler(-90f, eulerAngles.y + 90f, 90f); Piece(name, position, rotation, dropPin: false); } else { Piece(name, position, nesw + 2); } if (itemSupport == "") { return true; } string data = type + ":" + itemSupport; CustomizeItemStand(((Component)m_lastPlaced).gameObject, data); m_lastDataPin = null; DataPin(m_lastPlaced, data); return true; } public static bool CustomizeItemStand(GameObject go, string data, bool attachItem = true, bool reset = false) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) ItemStand component = go.GetComponent(); if ((Object)(object)component == (Object)null) { return false; } int num = data.IndexOf(':'); if (num < 0) { return false; } int num2 = int.Parse(data.Remove(num)); string text = data.Substring(num + 1); bool flag = (num2 & 1) != 0; bool flag2 = (num2 & 2) != 0; bool flag3 = (num2 & 4) != 0; bool flag4 = (num2 & 8) != 0; bool flag5 = (num2 & 0x10) == 0; bool flag6 = (num2 & 0x20) == 0; bool flag7 = flag && flag4; bool flag8 = !flag3 && flag2; int num3 = num2 >> 8; if (num3 > 0) { float num4 = num3 + 1; go.transform.localScale = num4 * Vector3.one; } if (reset) { if (component.HaveAttachment()) { component.DestroyAttachment(); } if (flag3 && !flag2) { Quaternion rotation = go.transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; if (flag6) { WDBUG.Log("Reconfigure ItemStand for alternate delivery", WDBUG.Level.Dungeon); go.transform.rotation = Quaternion.Euler(-90f, eulerAngles.y + 90f, 90f); Transform transform = go.transform; transform.position += 0.2f * up; } } } if (flag5) { component.m_destroyEffects = new EffectList(); } component.m_canBeRemoved = !flag7; component.m_supportedTypes.Clear(); component.m_supportedItems.Clear(); if (text == "NONE") { component.m_powerActivationDelay = 0f; component.m_autoAttach = false; return true; } ((Object)component).name = (flag8 ? "" : ("support_" + text)); if (text.StartsWith("ALL")) { if (text != "ALL") { ((Object)component).name = text; } text = ""; } component.m_autoAttach = !flag8 && text != ""; if (!component.m_autoAttach) { return true; } GameObject prefab = WUTIL.GetPrefab(text); ItemDrop val = ((prefab != null) ? prefab.GetComponent() : null); if ((Object)(object)val == (Object)null) { WDBUG.Log("ItemStand could not set to " + text); return false; } component.m_supportedItems.Add(val); if (attachItem && (flag || flag4)) { component.m_powerActivationDelay = (flag ? (-2) : (-1)); if (!component.HaveAttachment()) { ((MonoBehaviour)component).InvokeRepeating("UpdateAttach", 0.1f, 0.1f); } } return true; } public static void RejectItemstandItem(ItemStand itemStand, string exchange = "", bool defer = false) { m_itemstandExchangeItem = exchange; if (defer) { m_itemstandLastAttachForced = 2; return; } itemStand.m_powerActivationDelay = -3f; ((MonoBehaviour)itemStand).InvokeRepeating("UpdateAttach", 0.1f, 0.1f); } } internal class Slingshot { private static bool c_nonAmmoUnequip = false; private const float c_pebbleSlingshotCooldown = 0.1f; private const string c_slignshots = "Elderwood,Hardwood,Finewood,Bone,Wood"; private const string c_pebbles = "Coldball,WhiteGold,Gold,Silver,Bad,Fine,Sharp,Smooth,Rough"; private static int m_slingshotPower = 0; private static bool m_initialUpdate = true; private static bool m_preventAmmoAutoEquip = false; private static bool m_preventAmmoAutoEquipFromReady = false; private static float m_drawFactor = 1f; private static string m_lastEquipedPebble = ""; private static string m_lastEquipedSlingshot = ""; public static void Update() { if (m_initialUpdate) { RecallAmmoType(Quest.GetAchievement("SlingshotAmmo")); m_initialUpdate = false; } if (WUTIL.TimerIsAlmost("slingshotreload", 0f)) { UpdateAmmoAction(AmmoFromInventory(), SlingshotFromInventory()); } } public static void ModifyAttack(ItemData weapon, bool attackHold) { string text = WUTIL.ItemName(weapon); if (!(weapon.m_shared.m_attack.m_attackAnimation == "bow_fire") && !text.StartsWith("Pebble")) { return; } if (attackHold) { weapon.m_shared.m_attack.m_bowDraw = false; weapon.m_shared.m_attack.m_drawAnimationState = ""; } else if (text.StartsWith("Pebble")) { weapon.m_shared.m_attack.m_drawStaminaDrain = m_drawFactor * (float)m_slingshotPower; if (m_slingshotPower > 0) { weapon.m_shared.m_attack.m_bowDraw = true; weapon.m_shared.m_attack.m_drawAnimationState = "bow_aim"; weapon.m_shared.m_attack.m_drawDurationMin = m_drawFactor * (0.2f + (float)m_slingshotPower * 0.3f); } else { weapon.m_shared.m_attack.m_bowDraw = false; weapon.m_shared.m_attack.m_drawAnimationState = ""; weapon.m_shared.m_attack.m_drawDurationMin = 0f; } } else if (!weapon.m_shared.m_attack.m_bowDraw) { weapon.m_shared.m_attack.m_bowDraw = true; weapon.m_shared.m_attack.m_drawAnimationState = "bow_aim"; weapon.m_shared.m_attack.m_drawDurationMin = 1f; weapon.m_shared.m_attack.m_drawStaminaDrain = 2f; } } public static void SetDrawFactor(float factor = 1f) { m_drawFactor = ((factor > 0f) ? factor : 1f); } public static int GetType(string name) { if (name.StartsWith("Slingshot")) { name = name.Substring(9); string[] array = "Wood,Bone,Finewood,Hardwood,Elderwood".Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { if (array[i] == name) { return i; } } } return -1; } public static void AmmoToggle(ItemData item, bool equip) { string text = WUTIL.ItemName(item); if (text.StartsWith("Pebble")) { if (equip) { UnequipIfHolding(justChimes: true); } else { m_preventAmmoAutoEquip = true; WUTIL.TimerReset("slingshotreload"); } } else if (c_nonAmmoUnequip && equip && !text.StartsWith("Slingshot")) { WUTIL.TimerReset("slingshotreload"); UnequipIfHolding(); } m_preventAmmoAutoEquipFromReady = false; } public static int AmmoPower(string name, bool biasLastUsed = false) { if (!name.StartsWith("Pebble")) { return 0; } string[] array = "Coldball,WhiteGold,Gold,Silver,Bad,Fine,Sharp,Smooth,Rough".Split(new char[1] { ',' }); if (biasLastUsed && name == m_lastEquipedPebble) { return array.Length + 1; } int num = Array.IndexOf(array, name.Substring(6)); return (num >= 0) ? (array.Length - num) : 0; } public static void PostEquipUpdate(ItemData item, bool equip) { string text = WUTIL.ItemName(item); if (text.StartsWith("Pebble")) { if (!equip) { if (m_preventAmmoAutoEquip) { WDBUG.Log("Reconfigure pebble without autoequip", WDBUG.Level.PebblesAndSlingshots); } else { WDBUG.Log("Last pebble use unequipped (replaced/used/dropped)", WDBUG.Level.PebblesAndSlingshots); } UpdateAmmoAction(item, null); return; } m_lastEquipedSlingshot = ""; } else if (!text.StartsWith("Slingshot")) { m_preventAmmoAutoEquip = !(c_nonAmmoUnequip || equip); return; } if (!equip) { m_slingshotPower = 0; } ReloadUpdate(); } public static void CheckType(ItemData item) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (GetType(WUTIL.ItemName(item)) >= 0 && AmmoFromInventory() != null) { item.m_shared.m_itemType = (ItemType)4; } } public static void CheckAchievement() { if (m_slingshotPower == 0) { Quest.AdvanceAchievement("PebbleKilled"); } } public static void Ready() { if (!c_nonAmmoUnequip) { ItemData leftItem = WUTIL.GetLeftItem(); m_preventAmmoAutoEquipFromReady = WUTIL.ItemName(leftItem).StartsWith("Slingshot"); if (m_preventAmmoAutoEquipFromReady) { WDBUG.Log("Ready Slingshot", WDBUG.Level.PebblesAndSlingshots); } } } public static void ReloadUpdate() { if (m_initialUpdate) { RecallAmmoType(Quest.GetAchievement("SlingshotAmmo")); m_initialUpdate = false; } WUTIL.TimerReset("slingshotreload", 0.1f); } public static void SaveAmmoType(ItemData pebble) { m_lastEquipedPebble = WUTIL.ItemName(pebble); if (m_lastEquipedPebble != "") { Quest.SetAchievement("SlingshotAmmo", AmmoPower(m_lastEquipedPebble)); } else { WDBUG.Log("Unset default ammo type", WDBUG.Level.PebblesAndSlingshots); } } private static void RecallAmmoType(int type) { string[] array = "Coldball,WhiteGold,Gold,Silver,Bad,Fine,Sharp,Smooth,Rough".Split(new char[1] { ',' }); m_lastEquipedPebble = ((type < 1 || type > array.Length) ? "" : ("Pebble" + array[type - 1])); WDBUG.Log($"Slignshot RecallAmmoType({type}) -> '{m_lastEquipedPebble}'", WDBUG.Level.PebblesAndSlingshots); } private static ItemData GetInventoryAmmoItem(string groupName, string groupMemberList = "", bool equipped = true) { if (groupMemberList == "") { groupMemberList = groupName; groupName = ""; } string[] array = groupMemberList.Split(new char[1] { ',' }); foreach (string text in array) { string itemName = groupName + text; ItemData inventoryItemData = WUTIL.GetInventoryItemData(itemName, equipped); if (inventoryItemData != null) { return inventoryItemData; } } return null; } private static void UnequipIfHolding(bool justChimes = false) { ItemData leftItem = WUTIL.GetLeftItem(); string text = WUTIL.ItemName(leftItem); if (text == "Chimes" || (!justChimes && text.StartsWith("Slingshot"))) { WUTIL.m_allowCustomEquip = false; ((Humanoid)Player.m_localPlayer).UnequipItem(leftItem, true); WUTIL.m_allowCustomEquip = true; } } private static ItemData AmmoFromInventory(bool equiped = true) { return GetInventoryAmmoItem("Pebble", "Coldball,WhiteGold,Gold,Silver,Bad,Fine,Sharp,Smooth,Rough", equiped); } private static ItemData SlingshotFromInventory(bool equiped = true) { return GetInventoryAmmoItem("Slingshot", "Elderwood,Hardwood,Finewood,Bone,Wood", equiped); } private static void UpdateAmmoAction(ItemData pebble, ItemData slingshot) { //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) bool flag = slingshot != null; if (pebble == null) { if (!flag) { return; } if (m_lastEquipedPebble != "") { WDBUG.Log("Looking to equip " + m_lastEquipedPebble + " again", WDBUG.Level.PebblesAndSlingshots); pebble = GetInventoryAmmoItem(m_lastEquipedPebble, "", equipped: false); } if (pebble == null) { WDBUG.Log("Looking to equip best pebble in inventory", WDBUG.Level.PebblesAndSlingshots); pebble = AmmoFromInventory(equiped: false); } if (pebble == null) { WUTIL.Message("You are out of pebbles."); SaveAmmoType(pebble); } else { SaveAmmoType(pebble); if (m_preventAmmoAutoEquipFromReady) { WDBUG.Log("Blocked pebble auto-equip from Ready state", WDBUG.Level.PebblesAndSlingshots); } else { ((Humanoid)Player.m_localPlayer).EquipItem(pebble, true); WDBUG.Log("Autoequipping " + WUTIL.ItemName(pebble), WDBUG.Level.PebblesAndSlingshots); WUTIL.Message("Equipped " + WUTIL.ItemName(pebble, goName: false), center: false); } } m_preventAmmoAutoEquipFromReady = false; return; } SaveAmmoType(pebble); SharedData shared = pebble.m_shared; Attack attack = shared.m_attack; if (flag) { string text = ((Object)slingshot.m_dropPrefab).name.Substring(9); if (!(text == m_lastEquipedSlingshot)) { if (m_preventAmmoAutoEquip) { WDBUG.Log("Prevented autoequip pebble after shoot config", WDBUG.Level.PebblesAndSlingshots); m_preventAmmoAutoEquip = false; } else { WDBUG.Log("Set to autoequip pebble after bow config", WDBUG.Level.PebblesAndSlingshots); ReloadUpdate(); } m_lastEquipedSlingshot = text; int type = GetType(text); if (type < 0) { WDBUG.Log("Unknown slingshot type " + text + " - ignoring effect"); WUTIL.TimerReset("slingshotreload"); return; } int num = type + slingshot.m_quality; WDBUG.Log($"Configure {m_lastEquipedPebble} shootable for {num} strings", WDBUG.Level.PebblesAndSlingshots); shared.m_skillType = (SkillType)8; attack.m_attackAnimation = "bow_fire"; shared.m_holdStartEffect.m_effectPrefabs[0].m_enabled = true; shared.m_triggerEffect.m_effectPrefabs[2].m_enabled = true; shared.m_trailStartEffect.m_effectPrefabs[0].m_enabled = false; shared.m_backstabBonus = 3f; attack.m_projectileVel = num * 5 + 25; attack.m_attackStamina = 0f; attack.m_attackRange = 0.5f; attack.m_attackHeight = 1.5f; attack.m_attackOffset = 0.4f; attack.m_projectileVelMin = 1f; attack.m_projectileAccuracyMin = 20f; attack.m_projectileAccuracy = ((num < 5) ? 1 : 0) + ((!Wildling.IsWildling) ? 4 : 0); attack.m_damageMultiplier = 4 + num; attack.m_forceMultiplier = 2f + 0.5f * (float)num; m_slingshotPower = num; } } else { WDBUG.Log("Configure " + m_lastEquipedPebble + " throwable", WDBUG.Level.PebblesAndSlingshots); shared.m_skillType = (SkillType)11; attack.m_attackAnimation = "throw_bomb"; shared.m_holdStartEffect.m_effectPrefabs[0].m_enabled = false; shared.m_triggerEffect.m_effectPrefabs[2].m_enabled = false; shared.m_trailStartEffect.m_effectPrefabs[0].m_enabled = true; shared.m_backstabBonus = 3f; attack.m_attackStamina = 5f; attack.m_projectileVel = 20f; attack.m_attackRange = 1.5f; attack.m_attackHeight = 1.5f; attack.m_attackOffset = 0.1f; attack.m_projectileVelMin = 2f; attack.m_projectileAccuracyMin = 20f; attack.m_projectileAccuracy = (Wildling.IsWildling ? 2 : 4); attack.m_damageMultiplier = 1f; attack.m_forceMultiplier = 1f; m_lastEquipedSlingshot = ""; m_slingshotPower = 0; } } } internal class SwampDungeon { [HarmonyPatch(typeof(Character), "GetLiquidLevel")] public class PatchCharacterGetLiquidLevel { public static void Postfix(Character __instance, ref float __result, float ___m_waterLevel, ref float ___m_tarLevel) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) float y = ((Component)__instance).transform.position.y; if (!(y > m_greatOakGround0.y - 20f) || !(y < m_greatOakGround0.y + 1f) || !AtGreatOak(((Component)__instance).transform)) { return; } if (WUTIL.WithinCylinder(((Component)__instance).transform.position, m_greatOakGround0, 9.5f, 2f)) { if (WUTIL.WithinCylinder(((Component)__instance).transform.position, m_greatOakGround0, 6f, 100f)) { return; } if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { float health = __instance.GetHealth(); if (health < __instance.GetMaxHealth()) { __instance.SetHealth(health + 2f * Time.fixedDeltaTime); } } __result = m_greatOakGround0.y + 0.55f; } else { __result = m_greatOakGround0.y - 5f; } ___m_tarLevel = ___m_waterLevel - 10000f; } } private const float c_standardEntranceHeight = 5033f; private const float c_greatOakSplitHeight = 5320f; private const float c_greatOakBaseHeight = 5200f; private static bool m_debugShowPlan = false; private static int m_buildRefreshMode = 2; private static int m_debugBuildLevel = 1; private static int m_neswGO = 0; private const int c_greatOakLevelsOffset = 3; private const float c_greatOakDepth = 35f; private const float c_greatOakGroundHeight = 8f; private const float c_maxEntrySeparation = 500f; private const float c_minFindSkill = 0.35f; private const float c_cryptDiscoverRadius = 90f; private const float c_cryptBuildRadius = 60f; private const float c_exitLevelOffset = -1.38f; private const string c_pretestPiece = "Piece_Fang"; private const string c_entryGreatOak = "TorchCrystalSmall"; private static float m_maxWallHeight = 0f; private static float m_waterHeight2Wall = 0f; private static Vector3 up = Vector3.up; private static Vector3 m_lastBuildPosition = Vector3.zero; private static Vector3 m_dungeonEntry = Vector3.zero; private static Vector3 m_portalLower = Vector3.zero; private static Vector3 m_portalUpper = Vector3.zero; private static Vector3 m_lowerStaircase = Vector3.zero; private static Vector3 m_upperStaircase = Vector3.zero; private static Vector3 m_greatOakPosition = Vector3.zero; private static Vector3 m_greatOakGround0 = Vector3.zero; private static Transform m_emblem = null; private static List m_mainGates = new List(); private static List m_sewerEntries = new List(); private static List m_entryWalls = new List(); private static List m_mudpiles = new List(); private static List m_obstaclePieces = new List(); private static List m_doorblockPieces = new List(); private static List m_entryLandings = new List(); private static List m_entryStyles = new List(); private static Dictionary m_wallAtXZ = new Dictionary(); private static bool m_deferredOpenMap = false; public static void ResetBuildMode(int mode = -1) { //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) m_lastBuildPosition = Vector3.zero; if (mode >= 0 && mode <= 2) { m_buildRefreshMode = mode; } } public unsafe static void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) if (!LocateGreatOakRegion()) { return; } Vector3 position = ((Component)Player.m_localPlayer).transform.position; if ((Object)(object)m_emblem == (Object)null) { if (position.y >= 5200f && WUTIL.Timer("greatoak_restore_cooldown") == 0f) { Vector3 val = position; WDBUG.Log("Checking rebuild from GreatOak vs. player @" + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); if (BuildCryptSewers(80f, fromGreatOak: true)) { Place.NoteDungeonBuilding(); } else { WUTIL.TimerReset("greatoak_restore_cooldown", 1f); } } return; } Vector3 val2 = position - m_portalLower; Vector3 val3 = position - m_portalUpper; float magnitude = ((Vector3)(ref val2)).magnitude; float magnitude2 = ((Vector3)(ref val3)).magnitude; if (!(magnitude < 1f) && !(magnitude2 < 1f)) { return; } Vector3 val4 = m_portalUpper - m_portalLower; val2.y = 0f; val3.y = 0f; bool flag = ((Vector3)(ref val2)).magnitude <= ((Vector3)(ref val3)).magnitude; bool flag2 = magnitude < magnitude2; if (flag) { if (flag2) { position += val4; ((Component)Player.m_localPlayer).transform.position = position; Quest.CheckObjective(41, set: false); Quest.CheckObjective(42); } } else if (!flag2) { Flight.DisableGroundHitDamage(); position -= val4; ((Component)Player.m_localPlayer).transform.position = position; } } public static bool LocateGreatOakRegion(bool openMap = false) { //IL_0075: 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_00b2: Unknown result type (might be due to invalid IL or missing references) if (!World.GetStartPosition(out var pos)) { return false; } if (World.GetUniquePosition("GreatOak", ref pos)) { openMap |= m_deferredOpenMap; m_deferredOpenMap = false; if (openMap && MapMarker.MarkMap(pos, "GreatOak", openMap)) { WUTIL.Message("New location marked on map."); } return true; } if (ZNet.instance.IsServer()) { if (World.FindClusterLocation(pos, "SunkenCrypt", ref pos)) { WDBUG.Log("Server located Great Oak search region", WDBUG.Level.Quest); World.SetUniquePosition("GreatOak", pos); m_deferredOpenMap = openMap; return true; } WDBUG.Log("Server failed to locate Great Oak search location"); } return false; } public static bool AtGreatOak(Transform transform, bool byHeight = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) return !(transform.position.y < 5200f) && (((Object)(object)m_emblem == (Object)null) ? byHeight : WUTIL.WithinCylinder(transform.position, m_greatOakGround0, 85f, 100f)); } public static bool NearGreatOakMarker(Vector3 position, bool checkQuest = true) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0047: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (checkQuest && Quest.GetAchievement("QuestElder") < 13) { return false; } if (LocateGreatOakRegion()) { Vector3 locPos = Vector3.zero; if (World.GetUniquePosition("GreatOak", ref locPos)) { bool flag = WUTIL.WithinCylinder(position, locPos, 500f); WDBUG.Log($"Near to GreatOak marker at {locPos}: {flag} at dist: " + Vector3.Distance(position, locPos), WDBUG.Level.Dungeon); return true; } } else { WDBUG.Log("Failed to get GreatOak marker"); } return false; } public static bool ExitGreatOak() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_emblem == (Object)null) { WDBUG.Log("Emblem not found from GreatOak Exit"); return false; } ((Character)Player.m_localPlayer).SetLookDir(m_emblem.forward, 0f); TreePortal.TeleportPlayer(m_emblem.position + m_emblem.forward - 1.5f * up, allowImmediate: true, blackScreen: true, ground: false); return true; } public unsafe static bool BuildCryptSewers(float maxRange = 50f, bool fromGreatOak = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_08ab: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_073e: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_077f: Unknown result type (might be due to invalid IL or missing references) //IL_0969: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_0988: Unknown result type (might be due to invalid IL or missing references) //IL_098d: Unknown result type (might be due to invalid IL or missing references) //IL_0993: Unknown result type (might be due to invalid IL or missing references) if (m_debugBuildLevel == 0 && WDBUG.IsLevelReported(WDBUG.Level.Dungeon)) { m_debugBuildLevel = 1; } Vector3 position = ((Component)Player.m_localPlayer).transform.position; if (position.y >= 5200f) { position.y = 5033f; } m_emblem = null; Transform val = null; m_mainGates.Clear(); List list = new List(); Collider[] array = Physics.OverlapSphere(position, 90f, WUTIL.c_dungeonRayMask); foreach (Collider val2 in array) { Transform val3 = ((Component)val2).transform; if ((Object)(object)val3.parent != (Object)null) { val3 = val3.parent; } switch (WUTIL.GameName(((Component)val3).gameObject)) { case "ExteriorGateway": WDBUG.Log($"Found ExteriorGate at {val3.position} vs. playerPos {position}", WDBUG.Level.Dungeon); m_mainGates.Add(val3); break; case "TorchCrystalSmall": val = val3; break; case "Piece_Fang": if (m_buildRefreshMode == 0) { WDBUG.Log("Destroy dungeon already failed marker"); WUTIL.Destroy(((Component)val3).gameObject); break; } WDBUG.Log("Ignoring dungeon as previously searched", WDBUG.Level.Dungeon); m_lastBuildPosition = Vector3.zero; return false; case "CryptGate": list.Add(val3); break; case "GreatOakEmblem": if ((Object)(object)m_emblem == (Object)null || val3.position.y < m_emblem.position.y) { WDBUG.Log("Have Great Oak Emblem", WDBUG.Level.Dungeon); m_emblem = val3; } break; } } if (m_mainGates.Count == 0) { return false; } if (fromGreatOak) { Vector3 val4; if ((Object)(object)val == (Object)null) { val4 = position; WDBUG.Log("Failed to locate Great Oak Entry reference at " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); return false; } val4 = position; WDBUG.Log("Located Great Oak Entry reference at " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); position = val.position; } Transform val5 = null; float num = maxRange; foreach (Transform mainGate in m_mainGates) { float num2 = Vector3.Distance(mainGate.position, position); if (num2 < num) { num = num2; val5 = mainGate; } } Vector3 position2 = val5.position; bool flag = (Object)(object)m_emblem != (Object)null && (Object)(object)val != (Object)null; if (flag) { flag = Vector3.Distance(position2, val.position) < 4f; if (flag) { Vector3 val4 = position2; WDBUG.Log("Have Great Oak crypt gateway at " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); } } m_maxWallHeight = position2.y; m_waterHeight2Wall = m_maxWallHeight - 2f; m_mainGates.Remove(val5); m_sewerEntries.Clear(); foreach (Transform item in list) { if (item.position.y > m_waterHeight2Wall - 1f && !m_sewerEntries.Contains(item)) { m_sewerEntries.Add(item); WDBUG.Log("Located sewer gate at " + ((object)item.position/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); } } bool flag2 = m_sewerEntries.Count > 0; if (position2 == m_lastBuildPosition) { WDBUG.Log($"Re-entry custom Swamp Sewers with {m_sewerEntries.Count} entries and GreatOak: {flag}", WDBUG.Level.Dungeon); if (flag2) { return true; } } m_lastBuildPosition = position2; if (flag2 && m_buildRefreshMode != 2) { m_sewerEntries.Clear(); float num3 = position2.y + -1.38f - 2f; if (m_debugBuildLevel >= 1) { WDBUG.Log($"Destroying non-Crypt below height {num3}", WDBUG.Level.Dungeon); } Place.DestroyDungeon(position2, 60f, val5, 4900f, num3, drops: true, proxies: true, cryptFilter: true); if (flag) { Vector3 position3 = m_emblem.position; position3.y = 5320f; if (m_debugBuildLevel >= 1) { Vector3 val4 = position3; WDBUG.Log("Destroying Great Oak from " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); } Place.DestroyDungeon(position3, 100f, null, 5200f, 9999f, drops: true, proxies: true); m_emblem = null; if (m_buildRefreshMode <= 0) { WDBUG.Log("Removing Great Oak crypt entry marker", WDBUG.Level.Dungeon); WUTIL.Destroy(((Component)val).gameObject); } } if (m_buildRefreshMode <= 0) { WDBUG.Log("Removing Great Oak hidden found marker", WDBUG.Level.Dungeon); MapMarker.RemoveSharedLocation("GreatOak1"); } } if (flag2 && m_buildRefreshMode == 2) { if (!FindCryptExits(val5, blurFloorPlan: false, restore: true)) { WDBUG.Log("FindCryptExits failed for restore", WDBUG.Level.Dungeon); ClearWorkSpace(); return false; } if (flag) { Place.MapInitialize(position2, val5.rotation); SetMarkers(); Vector3 val4 = m_greatOakGround0; WDBUG.Log("Re-customize sewer to Great Oak G0: " + ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Dungeon); Place.RestoreDungeon(m_upperStaircase, 80f, solidify: false, m_debugBuildLevel >= 1); } else { WDBUG.Log("Re-customize sewer passages", WDBUG.Level.Dungeon); } Place.RestoreDungeon(position2, 50f, solidify: true, m_debugBuildLevel >= 1); Place.RestoreInhabitants(position2, 50f, sewers: true); int index = 0; float num4 = 99999f; for (int j = 0; j < m_sewerEntries.Count; j++) { ClearSewerGate(m_sewerEntries[j]); float num5 = Vector3.Distance(m_sewerEntries[j].position, position2); if (num5 < num4) { num4 = num5; index = j; } } ClearPathOfMudpiles(val5, m_sewerEntries[index], (!flag) ? 1 : 2); ClearWorkSpace(); return true; } WUTIL.ResetRandomSeed(position2); if (!FindCryptExits(val5)) { WDBUG.Log("Placing invalid dungeon marker", WDBUG.Level.Dungeon); Place.Object("Piece_Fang", position2 - 4f * up); ClearWorkSpace(); WUTIL.ResetRandomSeed(); return false; } OrderStairwells(position2, 5); ApplyMapOffset(0.05f); AddStairwells(); bool flag3 = !MapMarker.IsSharedLocation("GreatOak1"); if (!flag3) { WDBUG.Log("No Great Oak build vs. known placement", WDBUG.Level.Dungeon); } else if (NearGreatOakMarker(position2)) { WDBUG.Log("Located crypt near to Great Oak marker", WDBUG.Level.Dungeon); } else if (Wildling.SkillFactor((SkillType)0) < 0.35f) { flag3 = false; WDBUG.Log($"No Great Oak build near region at {position2} (or for skill level)", WDBUG.Level.Dungeon); } BuildConnectionLevel(-1, clearPlan: true, flag3); ClearPathOfMudpiles(val5, m_entryWalls[0], (!flag3) ? 1 : 2); if ((Object)(object)m_emblem != (Object)null) { WUTIL.Message("The stench of this crypt seems milder...\nAs if a more fragrant air is mixed in."); SetMarkers(); BuildGreatOak(); MapMarker.RemovePinByName("GreatOak"); MapMarker.AddPin(position2, "GreatOak1"); Place.Piece("TorchCrystalSmall", position2 - 3f * up, val5.rotation); Quest.CheckObjective(40, set: false); Quest.CheckObjective(41); } ClearWorkSpace(); WUTIL.ResetRandomSeed(); return true; } private static bool FindCryptExits(Transform cryptEntrance, bool blurFloorPlan = false, bool restore = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_0539: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_06f5: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05ce: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_077c: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_07b3: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Unknown result type (might be due to invalid IL or missing references) //IL_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0804: Unknown result type (might be due to invalid IL or missing references) //IL_081f: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_0890: Unknown result type (might be due to invalid IL or missing references) //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_089e: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Unknown result type (might be due to invalid IL or missing references) //IL_08a5: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_0936: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_094b: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0955: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_0b01: Unknown result type (might be due to invalid IL or missing references) //IL_0b10: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0b62: Unknown result type (might be due to invalid IL or missing references) //IL_0b6a: Unknown result type (might be due to invalid IL or missing references) //IL_0b6c: Unknown result type (might be due to invalid IL or missing references) //IL_0b71: Unknown result type (might be due to invalid IL or missing references) //IL_0b76: Unknown result type (might be due to invalid IL or missing references) //IL_0b78: Unknown result type (might be due to invalid IL or missing references) //IL_0b7f: Unknown result type (might be due to invalid IL or missing references) //IL_0b84: Unknown result type (might be due to invalid IL or missing references) //IL_0b86: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Unknown result type (might be due to invalid IL or missing references) //IL_0b8a: Unknown result type (might be due to invalid IL or missing references) //IL_0b8f: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ba1: Unknown result type (might be due to invalid IL or missing references) //IL_0bad: Unknown result type (might be due to invalid IL or missing references) //IL_0bb1: Unknown result type (might be due to invalid IL or missing references) //IL_097b: Unknown result type (might be due to invalid IL or missing references) //IL_0987: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_0c09: Unknown result type (might be due to invalid IL or missing references) //IL_0c2a: Unknown result type (might be due to invalid IL or missing references) //IL_0a76: Unknown result type (might be due to invalid IL or missing references) //IL_0a7b: Unknown result type (might be due to invalid IL or missing references) //IL_0a7d: Unknown result type (might be due to invalid IL or missing references) //IL_0a82: Unknown result type (might be due to invalid IL or missing references) //IL_0a87: Unknown result type (might be due to invalid IL or missing references) //IL_0c70: Unknown result type (might be due to invalid IL or missing references) //IL_0c7c: Unknown result type (might be due to invalid IL or missing references) //IL_0c83: Unknown result type (might be due to invalid IL or missing references) //IL_0c85: Unknown result type (might be due to invalid IL or missing references) //IL_0c8a: Unknown result type (might be due to invalid IL or missing references) //IL_0c8f: Unknown result type (might be due to invalid IL or missing references) //IL_0c99: Unknown result type (might be due to invalid IL or missing references) //IL_0ca0: Unknown result type (might be due to invalid IL or missing references) //IL_0ca2: Unknown result type (might be due to invalid IL or missing references) //IL_0ca7: Unknown result type (might be due to invalid IL or missing references) //IL_0cac: Unknown result type (might be due to invalid IL or missing references) //IL_0a5a: Unknown result type (might be due to invalid IL or missing references) //IL_09ec: Unknown result type (might be due to invalid IL or missing references) //IL_0cea: Unknown result type (might be due to invalid IL or missing references) //IL_0cf2: Unknown result type (might be due to invalid IL or missing references) //IL_0cf4: Unknown result type (might be due to invalid IL or missing references) //IL_0cf9: Unknown result type (might be due to invalid IL or missing references) //IL_0cfe: Unknown result type (might be due to invalid IL or missing references) //IL_0d00: Unknown result type (might be due to invalid IL or missing references) //IL_0d02: Unknown result type (might be due to invalid IL or missing references) //IL_0d07: Unknown result type (might be due to invalid IL or missing references) //IL_0d0e: Unknown result type (might be due to invalid IL or missing references) //IL_0d1a: Unknown result type (might be due to invalid IL or missing references) //IL_0d23: Unknown result type (might be due to invalid IL or missing references) //IL_0d28: Unknown result type (might be due to invalid IL or missing references) //IL_0d2d: Unknown result type (might be due to invalid IL or missing references) //IL_0d3c: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0d53: Unknown result type (might be due to invalid IL or missing references) //IL_0d58: Unknown result type (might be due to invalid IL or missing references) //IL_0db0: Unknown result type (might be due to invalid IL or missing references) //IL_0e42: Unknown result type (might be due to invalid IL or missing references) //IL_0e57: Unknown result type (might be due to invalid IL or missing references) //IL_0e5c: Unknown result type (might be due to invalid IL or missing references) //IL_0e5e: Unknown result type (might be due to invalid IL or missing references) //IL_0e63: Unknown result type (might be due to invalid IL or missing references) //IL_0e68: Unknown result type (might be due to invalid IL or missing references) //IL_0e02: Unknown result type (might be due to invalid IL or missing references) //IL_0e70: Unknown result type (might be due to invalid IL or missing references) //IL_0e7e: Unknown result type (might be due to invalid IL or missing references) //IL_0e85: Unknown result type (might be due to invalid IL or missing references) //IL_0e87: Unknown result type (might be due to invalid IL or missing references) //IL_0e8c: Unknown result type (might be due to invalid IL or missing references) //IL_0e9d: Unknown result type (might be due to invalid IL or missing references) //IL_0ea2: Unknown result type (might be due to invalid IL or missing references) //IL_0ea4: Unknown result type (might be due to invalid IL or missing references) //IL_0ea9: Unknown result type (might be due to invalid IL or missing references) //IL_0eae: Unknown result type (might be due to invalid IL or missing references) Vector3 position = cryptEntrance.position; Vector3 val = position; Vector3 val2 = position; Place.MapInitialize(position, cryptEntrance.rotation, "piece_groundtorch_green"); float num = position.y + 5f; float num2 = position.y - 2f; float waterHeight2Wall = m_waterHeight2Wall; float num3 = m_waterHeight2Wall + 1f; bool flag = m_mainGates.Count > 0; List list = new List(); Collider[] array = Physics.OverlapSphere(position, 60f, WUTIL.c_solidRayMask); foreach (Collider val3 in array) { Transform parent = ((Component)val3).gameObject.transform.parent; if ((Object)(object)parent == (Object)null) { continue; } if (flag) { float num4 = 0.7f * WUTIL.GroundDistance(position, parent.position); foreach (Transform mainGate in m_mainGates) { if (WUTIL.GroundDistance(mainGate.position, parent.position) < num4) { num4 = -1f; break; } } if (num4 < 0f) { continue; } } string text = WUTIL.GameName(((Component)parent).gameObject); if (text.StartsWith("mudpile2")) { if (!m_mudpiles.Contains(parent)) { m_mudpiles.Add(parent); } continue; } if (!text.StartsWith("SunkenKit")) { if (parent.position.y > num) { WUTIL.Destroy(((Component)parent).gameObject); } continue; } val.x = Mathf.Min(val.x, parent.position.x); val.z = Mathf.Min(val.z, parent.position.z); val2.x = Mathf.Max(val2.x, parent.position.x); val2.z = Mathf.Max(val2.z, parent.position.z); if (!text.EndsWith("_4x4")) { if (text.EndsWith("wall_2x4")) { m_doorblockPieces.Add(parent); } continue; } list.Add(parent.position); if (parent.position.y <= num2 && text.EndsWith("floor_4x4")) { m_obstaclePieces.Add(parent); } else { if (!text.EndsWith("wall_4x4")) { continue; } string text2 = (((Object)(object)parent.parent == (Object)null) ? "" : WUTIL.GameName(((Component)parent.parent).gameObject)); if (text2.Contains("End") || text2.Contains("Stair") || text2.Contains("Start")) { continue; } if (parent.position.y < waterHeight2Wall || parent.position.y > num3) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Ignored wall at {parent.position} scale: {parent.localScale} due to height above water: {parent.position.y - m_waterHeight2Wall}"); } continue; } int key = WUTIL.HashMapPos(parent.position); if (m_wallAtXZ.ContainsKey(key)) { if (parent.position.y < m_wallAtXZ[key].position.y) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Replaced wall at {m_wallAtXZ[key].position} scale: {parent.localScale} with lower at {parent.position}"); } m_wallAtXZ[key] = parent; } } else { m_wallAtXZ.Add(key, parent); } } } int num5 = 64 * WUTIL.Floor(position.x / 64f) - 32; val.x = (float)num5 + 2f; val2.x = (float)(num5 + 64) - 2f; num5 = 64 * WUTIL.Floor(position.z / 64f) - 32; val.z = (float)num5 + 2f; val2.z = (float)(num5 + 64) - 2f; Place.m_mapBoundsMin = val; Place.m_mapBoundsMax = val2; Place.m_floorPlanCenter = 0.5f * (val + val2); Place.m_floorPlanCenter.y = Place.m_floorPlanAnchor.y; Place.m_floorPlanAnchor = Place.m_floorPlanCenter; m_dungeonEntry = Place.m_floorPlanCenter - 8f * Place.MapFwd(1); bool flag2 = Place.FloorPlanFromRoomMarkers(list, m_debugBuildLevel >= 2); if (restore) { foreach (Transform sewerEntry in m_sewerEntries) { Vector3 center = sewerEntry.position + 0.5f * sewerEntry.forward + up; foreach (Transform value in m_wallAtXZ.Values) { if (WUTIL.WithinCylinder(value.position, center, 0.5f)) { WDBUG.Log($"Clear sewer gate wall {((Object)((Component)value).gameObject).name} at {value.position}", WDBUG.Level.Dungeon); ((Component)value).gameObject.SetActive(false); } } } return true; } if (m_debugBuildLevel >= 2) { WDBUG.Log($"Map pieces: {list.Count} xwalls: {m_wallAtXZ.Count} mudpiles: {m_mudpiles.Count} bounds: {val} {val2}"); } if (m_debugShowPlan || m_debugBuildLevel >= 3) { float num6 = 6f; WDBUG.Log($"Showing full floor plan at height {Place.m_floorPlanAnchor.y + num6}"); Place.FloorPlan(num6, showBounds: true); Place.Torch("piece_groundtorch_blue", position, num6); Place.Torch("TorchCrystal", Place.GetPlanTilePos(9, 9), num6); Place.Torch("piece_groundtorch_green", Place.m_floorPlanCenter, num6); } if (!flag2) { return false; } foreach (Transform value2 in m_wallAtXZ.Values) { if (WUTIL.GroundDistance(value2.position, position) < 8f || Place.OutOfBounds(value2.position)) { continue; } string text3 = ((Object)value2).name + "." + ((Object)value2.parent).name + "." + ((Object)value2.parent.parent).name; Vector3 val4 = 2f * value2.forward; Vector3 val5 = 4f * value2.right; int num7 = Place.GetMapNESW(val4, 0.9962f); if (num7 < 0) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Rejected {text3} at {value2.position} for alignment"); } continue; } int num8 = 0; for (int j = -1; j <= 1; j += 2) { for (int k = -1; k <= 1; k += 2) { num8 <<= 1; if (k * j == 1) { num8 |= 1; continue; } Vector3 val6 = value2.position + 1.5f * (float)j * val4 - (float)k * val5; int num9 = 0; while (num9 < 4) { char hotTile = ((num9 == 0 || num9 == 3) ? '-' : 'x'); if (!Place.CheckPlanTilePos(val6, isTileEmpty: true, hotTile) || !Place.CheckPlanTilePos(val6 + (float)(2 * j) * val4, isTileEmpty: true, hotTile)) { num8 |= 1; break; } if (m_debugBuildLevel >= 3) { switch (num9) { case 0: Place.Torch((k < 0) ? "piece_groundtorch_blue" : "piece_groundtorch_green", val6, -num9); break; case 3: WDBUG.Log($"Should have path for {text3} {j},{k} waysBlocked: {num8}"); break; default: Place.Torch("piece_groundtorch_wood", val6, -num9); break; } } num9++; val6 += (float)k * val5; } } } if (num8 == 0 || num8 == 15) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Rejected {text3} at {value2.position} {value2.localScale} waysBlocked: {num8}"); } continue; } int num10 = (((num8 & 3) != 3) ? 1 : (-1)); if (num10 < 0) { num8 >>= 2; } Vector3 val7 = value2.position + (float)num10 * val4; Vector3 planTilePos = Place.GetPlanTilePos(val7); val7 -= planTilePos; val7.y = 0f; float num11 = Vector3.Dot(val7, value2.forward); float num12 = Vector3.Dot(val7, value2.right); if (Mathf.Abs(num11) > 2f || Mathf.Abs(num11) > 2f) { if (m_debugBuildLevel >= 2) { WDBUG.Log($"Rejected {text3} at {value2.position} doorTileOffset^2: {num11} x {num12} {val7}"); } continue; } bool flag3 = (num8 & 1) == 0; if (flag3 && (num8 & 2) == 0) { m_dungeonEntry.y = val7.y; if (Vector3.Distance(val7 - 4f * val5, m_dungeonEntry) < Vector3.Distance(val7 + 4f * val5, m_dungeonEntry)) { flag3 = false; } } int num13 = (flag3 ? 1 : (-1)); if (num10 < 0) { num7 += 2; flag3 = !flag3; } planTilePos = value2.position + (float)num10 * val4; float num14 = Vector3.Dot(planTilePos - m_dungeonEntry, Place.MapFwd(num7)); bool flag4 = Place.CheckPlanTilePos(planTilePos + 4f * Place.MapFwd(num7)); bool flag5 = Place.CheckPlanTilePos(planTilePos + 4f * Place.MapFwd(num7 + ((!flag3) ? 1 : (-1)))); int num15 = ((num14 < 0f && flag4) ? 1 : (flag5 ? 2 : (flag4 ? 1 : 0))); if (num15 == 0) { if (m_debugBuildLevel >= 2) { WDBUG.Log($"Rejected {text3} at {value2.position} as both landings are out of bounds"); } continue; } int item = (num7 & 3) | (flag3 ? 4 : 0) | (num15 << 4); if (m_debugBuildLevel >= 2) { WDBUG.Log($"Wall at {value2.position} vs. tile fwd: {num11} rht: {num12}"); } m_entryWalls.Add(value2); m_entryLandings.Add(planTilePos); m_entryStyles.Add(item); planTilePos -= (float)num13 * val5; for (int l = 0; l < 4; l++) { Place.SetPlanTiles(planTilePos, '-'); Place.SetPlanTiles(planTilePos + (float)(2 * num10) * val4, '-'); planTilePos += (float)num13 * val5; } } if (!blurFloorPlan) { Place.FloorPlanFromRoomMarkers(list); } if (m_debugBuildLevel >= 3) { WDBUG.Log($"Found {m_entryWalls.Count} sewer entry walls"); } return m_entryLandings.Count > 0; } private static void ClearWorkSpace() { m_mainGates.Clear(); m_entryWalls.Clear(); m_doorblockPieces.Clear(); m_obstaclePieces.Clear(); m_mudpiles.Clear(); m_entryLandings.Clear(); m_entryStyles.Clear(); m_wallAtXZ.Clear(); } private static void OrderStairwells(Vector3 target, int maxExits = 8, float minDist = 12f) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) if (m_entryLandings.Count == 0 || maxExits <= 0) { return; } List list = new List(); for (int i = 0; i < m_entryLandings.Count; i++) { list.Add(m_entryLandings[i] - 4f * Place.MapFwd(m_entryStyles[i] & 3)); } List list2 = new List(); List list3 = new List(); for (int j = 0; j < m_entryLandings.Count; j++) { float num = Vector3.Distance(list[j], target); int num2 = list3.Count; for (int k = 0; k < num2; k++) { if (num < list3[k]) { num2 = k; break; } } list3.Insert(num2, num); list2.Insert(num2, j); } if (m_debugBuildLevel >= 1) { for (int l = 0; l < list3.Count; l++) { WDBUG.Log($"Entry dist {l}: {list3[l]} at {m_entryWalls[l].position} -> idx: {list2[l]}", WDBUG.Level.Dungeon); } } for (int m = 0; m < list3.Count; m++) { int index = list2[m]; int nesw = m_entryStyles[index] & 3; int num3 = ClearSewerEntry(m_entryWalls[index], nesw); if (num3 > 0) { WDBUG.Log($"Found {num3} blockages for stairway {m}", WDBUG.Level.Dungeon); if (num3 > 1) { list2[m] = -1; } } } for (int n = 0; n < list3.Count; n++) { int num4 = list2[n]; if (num4 < 0) { continue; } for (int num5 = n + 1; num5 < list3.Count; num5++) { int num6 = list2[num5]; if (num6 < 0) { continue; } float num7 = Vector3.Distance(list[num4], list[num6]); if (num7 < minDist) { list2[num5] = -1; if (m_debugBuildLevel >= 2) { WDBUG.Log($"Excluding landing {num5} vs. {n} dist: {num7}"); } } else if (m_debugBuildLevel >= 3) { WDBUG.Log($"Retaining landing {num5} vs. {n} dist: {num7}"); } } } int num8 = -maxExits; foreach (int item in list2) { if (item >= 0) { num8++; } } bool flag = maxExits < 2; for (int num9 = 0; num9 < list2.Count; num9++) { if (num8 <= 0) { break; } if (list2[num9] < 0) { continue; } if (flag) { if (m_debugBuildLevel >= 2) { WDBUG.Log($"Excluding landing {num9} nprune: {num8}"); } list2[num9] = -1; num8--; } flag = !flag; } List list4 = new List(); List list5 = new List(); list.Clear(); foreach (int item2 in list2) { if (item2 >= 0) { list.Add(m_entryLandings[item2]); list4.Add(m_entryStyles[item2]); list5.Add(m_entryWalls[item2]); } } m_entryStyles = list4; m_entryLandings = list; m_entryWalls = list5; WDBUG.Log($"Using {m_entryWalls.Count} of {list2.Count} exit walls", WDBUG.Level.Dungeon); if (m_debugBuildLevel >= 2) { for (int num10 = 0; num10 < m_entryLandings.Count; num10++) { WDBUG.Log($"Exit {num10} at {m_entryWalls[num10].position}"); } } } private static void AddStairwells(float floorOffset = 0f, bool restore = false, bool clearBlockage = false) { //IL_0038: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0264: 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_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (m_entryLandings.Count == 0) { WDBUG.Log("ERROR: AddStairwells called with no exits"); return; } float y = m_entryWalls[0].position.y + floorOffset; for (int i = 0; i < m_entryLandings.Count; i++) { if (m_debugBuildLevel >= 3) { WDBUG.Log($"Height above water: {m_entryLandings[i].y - m_waterHeight2Wall} vs. {m_waterHeight2Wall}"); } int nesw = m_entryStyles[i] & 3; if (!restore) { Vector3 piecePos = m_entryLandings[i] - 1.74f * Place.MapFwd(nesw); piecePos.y = y; int style = ((m_entryLandings[i].y < m_waterHeight2Wall) ? 115 : 130); m_entryLandings[i] = Place.StairsToSewers(piecePos, nesw, style, 0.13f, m_debugBuildLevel >= 2); m_entryStyles[i] |= Place.m_buildReport << 8; string gateType = ""; if (i < m_entryLandings.Count - 1) { switch (i) { case 0: gateType = (WUTIL.TestLuck() ? "latch" : "pickable"); break; case 1: gateType = (WUTIL.TestLuck() ? "pickable" : "stuck"); break; case 2: gateType = (WUTIL.TestLuck() ? "oneway" : "stuck"); break; } } Place.CaptureCapturedGate("crypt_entry", gateType, "room_door"); m_sewerEntries.Add(Place.Captured("room_door")); } if (m_debugBuildLevel >= 2) { WDBUG.Log($"Clearing about wall {i} at {m_entryWalls[i].position}"); Place.Torch("piece_groundtorch_green", m_entryWalls[i].position, -1.5f); Place.Torch("piece_groundtorch", m_sewerEntries[i].position + 0.5f * m_sewerEntries[i].forward, -0.5f); } ClearSewerGate(m_sewerEntries[i]); ((Component)m_entryWalls[i]).gameObject.SetActive(false); } } private static void ApplyMapOffset(float embed = 0f, float shift = 1.25f) { //IL_0017: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0048: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = m_entryStyles[num] & 3; Vector3 val = m_entryLandings[num] + embed * Place.MapFwd(num2) + shift * Place.MapFwd(num2 + 1); val -= Place.GetPlanTilePos(val); val.y = 0f; if (m_debugBuildLevel >= 2) { WDBUG.Log($"Moving mapPlan by {val} from landing {num}"); } Place.m_floorPlanAnchor += val; Place.m_mapLocation += val; Place.m_mapLocation.y = Place.m_floorPlanCenter.y; Place.m_floorPlanCenter = Place.GetPlanTilePos(Place.m_floorPlanCenter); m_dungeonEntry = Place.m_floorPlanCenter - 8f * Place.MapFwd(1); } private static void BuildConnectionLevel(int maxSideRoomDepth = -1, bool clearPlan = true, bool greatOakWay = false) { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) int wallStyleMask = 0; bool flag = true; float num = Place.FloorPlanOpenness(); float num2 = Place.FloorPlanOpenness(by3x3: true); if (maxSideRoomDepth < 0) { clearPlan = greatOakWay || m_entryLandings.Count > 2 || num2 > 0.4f; maxSideRoomDepth = ((m_entryLandings.Count <= 2) ? 2 : ((m_entryLandings.Count <= 4) ? 1 : 0)); } int pillarStyle = 273; if (clearPlan) { flag = true; pillarStyle = 129; Place.FloorPlanFromPlan(); wallStyleMask = 4; maxSideRoomDepth = 0; } else if ((double)num > 0.4) { Place.FloorPlanOpenness(by3x3: false, 0.5f); pillarStyle = 129; } WDBUG.Log($"Below crypt entries: {m_entryLandings.Count} Density 2x2: {num} 3x3: {num2}", WDBUG.Level.Dungeon); WDBUG.Log($"Sewer: {!clearPlan} maxSideRoomDepth: {maxSideRoomDepth} coffinRoom: {flag} greatOakWay: {greatOakWay}", WDBUG.Level.Dungeon); Place.m_floorPlanAnchor = Place.m_floorPlanCenter; Place.m_floorPlanAnchor.y = m_entryLandings[0].y + -1.38f; Place.m_mapLowerFloorHeight = Place.m_floorPlanAnchor.y; Place.m_mapMaxWallHeight = Place.m_mapLowerFloorHeight + 4f; for (int i = 0; i < m_entryLandings.Count; i++) { Vector3 val = m_entryLandings[i]; int nesw = m_entryStyles[i] & 3; int num3 = m_entryStyles[i] >> 8; bool flag2 = (num3 & 0x20) > 0; bool flag3 = (num3 & 0x10) > 0; Place.SetPlanTiles(val, '-', nesw, (flag2 || flag3) ? 4 : 3); Place.SetPlanTiles(val, 'F'); int num4 = maxSideRoomDepth + 1; int num5 = WUTIL.DieRoll(num4); if (Place.FloorPlanMakePath(val, Place.m_floorPlanCenter, num5, num4, m_debugBuildLevel >= 2, "Sewer_Snake,RatDraugr,Blob,Skeleton_Poison,Draugr,Draugr_Elite")) { WDBUG.Log($"Make path {i} sideRoomDepth: {num5} critters: {num4}", WDBUG.Level.Dungeon); } else { WDBUG.Log("Failed to make complete floor plan path for exit " + i); } } for (int j = 0; j < m_entryLandings.Count; j++) { int num6 = m_entryStyles[j] & 3; int num7 = m_entryStyles[j] >> 8; Vector3 val2 = 4f * Place.MapFwd(num6); Vector3 val3 = 4f * Place.MapFwd(num6 + 1); int tileFwd = (((num7 & 0x20) > 0) ? 3 : 2); if ((num7 & 1) > 0) { Place.SetPlanTiles(m_entryLandings[j] + val3, 'F', num6, tileFwd); Place.SetPlanTiles(m_entryLandings[j] + val2 + val3, '-', num6, tileFwd); } if ((num7 & 4) > 0) { Place.SetPlanTiles(m_entryLandings[j] - val3, 'F', num6, tileFwd); Place.SetPlanTiles(m_entryLandings[j] + val2 - val3, '-', num6, tileFwd); } if ((num7 & 0x40) > 0) { Place.SetPlanTiles(m_entryLandings[j], '-'); Place.SetPlanTiles(m_entryLandings[j] - val2 - val3, 'F', num6, 1, 3); } } if (flag) { m_dungeonEntry = Place.FloorPlanEdgeExit(0f, (!greatOakWay) ? 1 : 2); if (m_dungeonEntry.y > 0f) { if (greatOakWay) { m_emblem = Place.LastPlaced(); } if (m_debugShowPlan) { Place.Torch("piece_groundtorch", m_dungeonEntry, 16f); } } else if (greatOakWay) { WDBUG.Log("Failed to find suitable exit for GreatOak"); } } Place.m_doorStyleArchWindow = 0.3f; Place.m_doorStyleWallProb = 0.1f; Place.m_doorStyleLoseArchway = 0.1f; Place.m_doorStyleCritter = 0.3f; Place.m_ratHoleSpawnUndead = 0.3f; Place.m_doorStyleDoorMaterial = -1; Place.m_doorStyleRoomWoodDoor = 0f; int openLargeSpaces = ((!clearPlan) ? 4 : 0); Place.FloorPlanLevel(4f, 3.25f, 4f, wallStyleMask, pillarStyle, 0.02f, "", 3, openLargeSpaces); } private static int ClearSewerEntry(Transform wall, int nesw, bool checkBlockage = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //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) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) Vector3 val = wall.position + 3.5f * Place.MapFwd(nesw) - 1.5f * Place.MapFwd(nesw + 1); val.y -= 3f; int num = 0; foreach (Transform obstaclePiece in m_obstaclePieces) { if (WUTIL.WithinCylinder(obstaclePiece.position, val, 4.7f, 3f) && WUTIL.OverlapGrid(obstaclePiece.position, val, 2.3f)) { num++; if (checkBlockage) { WDBUG.Log($"Detected floor at {obstaclePiece.position} (d{obstaclePiece.position - val}) in stair well at {wall.position} -> {val}", WDBUG.Level.Dungeon); } else { WDBUG.Log($"NOT Removing {((Object)((Component)obstaclePiece).gameObject).name} at {obstaclePiece.position} (d{obstaclePiece.position - val}) from stair well at {wall.position} -> {val}", WDBUG.Level.Dungeon); } } } Vector3 center = wall.position - Place.MapFwd(nesw); foreach (Transform doorblockPiece in m_doorblockPieces) { if (checkBlockage) { if (WUTIL.WithinCylinder(doorblockPiece.position, val, 3f, 4f)) { WDBUG.Log($"Detected wall at {doorblockPiece.position} (d{doorblockPiece.position - val}) in stair well at {wall.position} -> {val}", WDBUG.Level.Dungeon); num++; } } else if (WUTIL.WithinCylinder(doorblockPiece.position, center, 1.2f)) { WDBUG.Log($"Clear front entry of {((Object)((Component)doorblockPiece).gameObject).name} at {doorblockPiece.position}", WDBUG.Level.Dungeon); ((Component)doorblockPiece).gameObject.SetActive(false); num++; } } return num; } private static void ClearSewerGate(Transform gate) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00a9: Unknown result type (might be due to invalid IL or missing references) WDBUG.Log($"Clear sewer gate @{gate.position} fwd: {gate.forward} vs. {m_doorblockPieces.Count} blocks", WDBUG.Level.Dungeon); Vector3 center = gate.position + 1.5f * gate.forward + up; foreach (Transform doorblockPiece in m_doorblockPieces) { if (WUTIL.WithinCylinder(doorblockPiece.position, center, 1.2f)) { WDBUG.Log($"Removing sewer gate block {((Object)((Component)doorblockPiece).gameObject).name} at {doorblockPiece.position}", WDBUG.Level.Dungeon); ((Component)doorblockPiece).gameObject.SetActive(false); } } } private static void ClearPathOfMudpiles(Transform fromTran, Transform toTran, int blockExpand = 1, bool showPath = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) Vector3 val = fromTran.position + 6f * (fromTran.rotation * fromTran.forward); Vector3 position = toTran.position; position.y = val.y; if (m_debugShowPlan) { Place.Torch("piece_groundtorch_green,piece_groundtorch", position, 7.5f); Place.Torch("piece_groundtorch_blue,piece_groundtorch_green", val, 6f); } Place.GetPlanTileXY(val, out var ix, out var iy); Place.GetPlanTileXY(position, out var ix2, out var iy2); if (ix > ix2) { int num = ix2; ix2 = ix; ix = num; } if (iy > iy2) { int num2 = iy2; iy2 = iy; iy = num2; } for (int i = 0; i < blockExpand; i++) { ix--; iy--; ix2++; iy2++; } showPath |= m_debugShowPlan || m_debugBuildLevel >= 3; int num3 = 0; foreach (Transform mudpile in m_mudpiles) { Place.GetPlanTileXY(mudpile.position, out var ix3, out var iy3); if (ix3 >= ix && ix3 <= ix2 && iy3 >= iy && iy3 <= iy2) { if (showPath) { Place.Torch("TorchCrystal", mudpile.position, -1f); } ((Component)mudpile).gameObject.SetActive(false); num3++; continue; } foreach (Transform entryWall in m_entryWalls) { if (Vector3.Distance(entryWall.position, mudpile.position) < 4f) { ((Component)mudpile).gameObject.SetActive(false); num3++; } } } WDBUG.Log($"Cleared {num3} mudpiles from tiles {ix},{iy} to {ix2},{iy2}", WDBUG.Level.Dungeon); } private static void SetMarkers(bool debug = false) { //IL_0030: 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) //IL_004d: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00a7: 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_00b2: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_emblem == (Object)null) { WDBUG.Log("SetTeleport called without marker"); return; } m_neswGO = (Place.GetCompassDirection(m_emblem.forward) + 2) & 3; Vector3 val = Place.MapFwd(m_neswGO); Vector3 val2 = Place.MapFwd(m_neswGO + 1); m_portalLower = m_emblem.position + m_emblem.forward + 2f * val2 - 5f * up; m_portalUpper = m_portalLower - 0.01f * val2; m_portalUpper.y = 5320f; m_lowerStaircase = m_emblem.position - 2.75f * val + 1.5f * val2 - 2f * up; m_upperStaircase = m_lowerStaircase; m_upperStaircase.y = 5331f; m_greatOakPosition = m_upperStaircase - 10f * val - 55f * val2; m_greatOakPosition.y -= 35f; m_greatOakGround0 = m_greatOakPosition + 8f * up; WDBUG.Log($"Great Oak Base: {m_greatOakPosition} Ground0: {m_greatOakGround0} Portals Lower: {m_portalLower} Upper: {m_portalUpper}", WDBUG.Level.Dungeon); if (debug) { Place.Torch("piece_groundtorch_blue", m_portalLower, -1.3f); Place.Torch("piece_groundtorch", m_portalUpper, -1.3f); } } private static void BuildGreatOak() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_0472: 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_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) Place.Staircase(m_lowerStaircase, m_neswGO + 1, 4, 2, 2, 0, down: true); Place.LevelConnectorRoom(m_upperStaircase, m_neswGO + 1, 3); Place.Piece("GreatOak", m_greatOakPosition, m_neswGO); Transform parent = Place.LastPlaced(); Place.Piece("Piece_AmberCasing", parent, "Amber Casing"); Place.Piece("ElderChest", parent, "Elder Chest"); Place.Piece("TreasureChest_trollcave", parent, "troll chest"); Transform val = Place.LastPlaced(); if ((Object)(object)val != (Object)null) { Place.Spawner("Troll", val.position - 5f * val.forward); } Place.OnPerimeter("TorchCrystal", m_greatOakGround0, 9, 9.75f, 0.2f); List notAt = new List(); int num = 2; int num2 = 3; for (int i = 0; i < 70; i++) { Vector3 val2 = WUTIL.OnCircle(m_greatOakGround0, i / 2 + 13, 32, ground: false); if (WUTIL.WithinCylinder(val2, m_upperStaircase, 8f, 100f)) { continue; } float radius = Mathf.Min(0.5f * (float)i, 8f); float num3 = 0.05f; float maxHeight = val2.y + 8f + (float)i * 0.1f; int segments = (i + 2) / 2; switch (WUTIL.DieRoll(11)) { case 0: Place.Cluster("BlueberryBush", val2, notAt, segments, radius, 0, 0.4f, 0.4f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); break; case 1: Place.Cluster("RaspberryBush", val2, notAt, segments, radius, 0, 0.5f, 0.2f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); break; case 2: Place.Cluster("Bush02_en", val2, notAt, 1 + WUTIL.DieRoll(3), radius, 0, 0.3f, 0.4f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); num3 = 0.1f; break; case 3: if (i > 20) { Place.Cluster((WUTIL.RandomSpin() > 0.6f) ? "Bush02_en" : "Bush01", val2, notAt, segments, 3f, 0, 0.5f, 0.3f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); num3 = 0.3f; } else { Place.Cluster((WUTIL.RandomSpin() > 0.6f) ? "Pickable_Stone" : "Pickable_Branch", val2, notAt, 1 + WUTIL.DieRoll(5), 4f, 0, 0.7f, 0.5f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); } break; case 4: case 5: Place.Cluster("Bush01", val2, notAt, segments, radius, 0, 0.5f, 0.3f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); num3 = 0.2f; break; case 6: Place.Cluster("Greydwarf_Root", val2, notAt, segments, radius, 0, 0.5f, 7f, 60f, 0.05f, ground: true, spawner: false, 4f, val2.y + 1f); break; case 7: Place.Cluster("Bush01_heath", val2, notAt, segments, radius, 0, 0.3f, 7f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); num3 = 0.2f; break; case 8: Place.Cluster("TentaRoot", val2, notAt, segments, radius, 0, 0.3f, 0.5f, 60f, 0.05f, ground: true, spawner: true); break; default: { int num4 = WUTIL.DieRoll(WUTIL.DieRoll(9)); string text = "Dandelion,Branch,Thistle,SeedCarrot,SeedTurnip,Mushroom_blue,pebbles,Stone".Split(new char[1] { ',' })[num4]; Place.Cluster("Pickable_" + text, val2, notAt, 1 + WUTIL.DieRoll(num4 - 3), 2f, 0, 0.3f, 0.4f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); num3 = 0f; break; } } if (num3 > 0f) { float num5 = WUTIL.RandomSpin(); if (num5 < num3) { num5 /= num3; string piece = ((num5 < 0.3f) ? "Pickable_Mushroom_yellow" : "Pickable_Mushroom"); Place.Cluster(piece, val2, notAt, segments, radius, 0, 0f, 0.1f, 60f, 0.05f, ground: true, spawner: false, 4f, maxHeight); } } if (i % 10 == 9) { string name = "Greydwarf"; if (num2 > 0 && WUTIL.TestLuck(0.2f)) { name = "Greydwarf_Commander"; num2--; } else if (num > 0 && WUTIL.TestLuck(0.4f)) { name = "Greydwarf_Warlock"; num--; } Place.Spawner(name, val2); } if (i < 3) { Place.Spawner("Pixie", val2, 40f); } } Vector3 val3 = m_greatOakGround0 + 40f * Place.MapFwd(m_neswGO) + 40f * Place.MapFwd(m_neswGO + 1); Place.Object("GlowingMushroom", val3 - 0.5f * up); Place.Cluster("Pickable_Mushroom_blue", val3, notAt, 7, 2.5f, 0, 0.05f, 0.05f); } } internal class Wildling { [HarmonyPatch(typeof(FejdStartup), "OnNewCharacterDone")] public static class PatchFejdStartupOnNewCharacterDone { public static void Prefix() { m_preventSaveToDisk = true; } } [HarmonyPatch(typeof(FileHelpers), "Delete")] public static class PatchFileHelpersDelete { public static bool m_noPatchEffect; public static void Postfix(string path, FileSource fileSource, bool __result) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) if (!__result || m_noPatchEffect) { m_noPatchEffect = false; return; } int num = path.LastIndexOf('/'); if (num < 0 || !path.EndsWith(".fch")) { WDBUG.Log("PatchFileHelpersDelete had unexpected filepath: " + path); return; } string text = path.Substring(num + 1); text = text.Remove(text.Length - 4); string text2 = path.Remove(num) + "/Wildling/" + text + "_W.fch"; m_noPatchEffect = true; bool flag = FileHelpers.Delete(text2, fileSource); WDBUG.Log($"Deleted Wildling data {flag} at {text2}", WDBUG.Level.PlayerProfile); } } [HarmonyPatch(typeof(PlayerProfile), "SavePlayerToDisk")] private class PatchPlayerProfileSavePlayerToDisk { public static void Postfix(PlayerProfile __instance, string ___m_filename) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) if (m_preventSaveToDisk) { WDBUG.Log("Not creating Wildling data for new player", WDBUG.Level.PlayerProfile); m_preventSaveToDisk = false; m_wildlingPlayerData.Clear(); } if (m_wildlingPlayerData.Count == 0) { return; } FileSource fileSource = __instance.m_fileSource; string path = PlayerProfile.GetPath(fileSource, ___m_filename); int num = path.LastIndexOf('/'); if (num < 0) { WDBUG.Log("Unexpected player data save file path: " + path); return; } string text = path.Remove(num) + "/Wildling/" + ___m_filename + "_W.fch"; DateTime now = DateTime.Now; bool flag = SaveSystem.CheckMove(text, (SaveDataType)1, ref fileSource, now, 0uL, false); ZPackage val = new ZPackage(); val.Write(PlayState); val.Write(m_originalHairStyle); val.Write(m_originalBeardStyle); foreach (KeyValuePair wildlingPlayerDatum in m_wildlingPlayerData) { val.Write(wildlingPlayerDatum.Key); val.Write(wildlingPlayerDatum.Value); } val.Write(""); foreach (KeyValuePair achivement in Quest.GetAchivements()) { val.Write(achivement.Key); val.Write(achivement.Value); } val.Write(""); string text2 = text + ".old"; string text3 = text + ".new"; byte[] array = val.GetArray(); byte[] array2 = val.GenerateHash(); FileWriter val2 = new FileWriter(text3, (FileHelperType)0, fileSource); val2.m_binary.Write(array.Length); val2.m_binary.Write(array); val2.m_binary.Write(array2.Length); val2.m_binary.Write(array2); val2.Finish(); FileHelpers.ReplaceOldFile(text, text3, text2, fileSource); WDBUG.Log($"Saved {text}\nState: {PlayState}, Keys: {m_wildlingPlayerData.Count}, Size: {array.Length + array2.Length + 8}b", WDBUG.Level.PlayerProfile); } } [HarmonyPatch(typeof(PlayerProfile), "LoadPlayerFromDisk")] private class PatchPlayerProfileLoadPlayerFromDisk { public static void Postfix(PlayerProfile __instance, string ___m_filename) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) PlayState = 0; m_wildlingPlayerData.Clear(); Quest.ResetAchievements(); string path = PlayerProfile.GetPath(__instance.m_fileSource, ___m_filename); int num = path.LastIndexOf('/'); if (num < 0) { WDBUG.Log("Unexpected player data load file path: " + path); return; } string text = path.Remove(num) + "/Wildling/" + ___m_filename + "_W.fch"; try { ZPackage val = LoadPlayerDataFromDisk(text, __instance.m_fileSource); if (val != null) { PlayState = val.ReadInt(); m_originalHairStyle = val.ReadString(); m_originalBeardStyle = val.ReadString(); string key; while ((key = val.ReadString()) != "") { m_wildlingPlayerData.Add(key, val.ReadSingle()); } while ((key = val.ReadString()) != "") { Quest.SetAchievement(key, val.ReadInt(), bit: false, if_lower: false, checkAwards: true, initialize: true); } } } catch (Exception ex) { WDBUG.Log("Error reading wildling player data from: " + text + "\n" + ex.ToString()); } WDBUG.Log($"LOADED P.floats: {m_wildlingPlayerData.Count} Q.ints: {Quest.GetAchivements().Count}", WDBUG.Level.PlayerProfile); string name = __instance.GetName(); WDBUG.Log(string.Format("Player {0} WSTATE: {1} {2}/{3}", name, PlayState, m_originalHairStyle, GetPlayerDataVector3("WHAIRCOLOR")), WDBUG.Level.PlayerProfile); m_playerProfileState[name] = PlayState; m_playerProfileHairStyle[name] = m_originalHairStyle; m_playerProfileHairColor[name] = GetPlayerDataVector3("WHAIRCOLOR"); if (PlayState == 0) { WDBUG.Log("Resetting wildling data", WDBUG.Level.PlayerStats); m_wildlingPlayerData.Clear(); Quest.ResetAchievements(); } } private static ZPackage LoadPlayerDataFromDisk(string fileName, FileSource fileSource) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown FileReader val; try { WDBUG.Log("Loading wildling player data: " + fileName, WDBUG.Level.PlayerStats); val = new FileReader(fileName, fileSource, (FileHelperType)0); } catch { WDBUG.Log("No wildling player data: " + fileName, WDBUG.Level.PlayerStats); return null; } byte[] array; try { BinaryReader binary = val.m_binary; int num = binary.ReadInt32(); array = binary.ReadBytes(num); int num2 = binary.ReadInt32(); binary.ReadBytes(num2); WDBUG.Log($"LOADED {num}+{num2}={num + num2}b from {fileName}", WDBUG.Level.PlayerProfile); } catch { ZLog.LogError((object)"WildlingMod: Error loading player data."); val.Dispose(); return null; } val.Dispose(); return new ZPackage(array); } } [HarmonyPatch(typeof(PlayerProfile), "LoadPlayerData")] public static class PatchPlayerProfileLoadPlayerData { public static void Postfix(PlayerProfile __instance, Player player) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if (((IEnumerable)((Character)player).GetSkills().GetSkillList()).FirstOrDefault((Func)((Skill x) => x.m_info == WildlingSkillDef)) == null) { Skill val = (Skill)AccessTools.Method(typeof(Skills), "GetSkill", (Type[])null, (Type[])null).Invoke(((Character)player).GetSkills(), new object[1] { WildlingSkill }); GetPlayerSkill(((object)Unsafe.As(ref WildlingSkill)/*cast due to .constrained prefix*/).ToString(), out val.m_level, out val.m_accumulator); } } } [HarmonyPatch(typeof(Skills), "GetSkillList")] public static class PatchSkillsGetSkillList { public static void Postfix(List __result) { //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) if (PlayState != 1) { return; } Skill[] array = __result.ToArray(); foreach (Skill val in array) { if (val.m_info.m_skill == WildlingSkill) { __result.Remove(val); } } } } [HarmonyPatch(typeof(FejdStartup), "SetupCharacterPreview")] public static class PatchFejdStartupSetupCharacterPreview { public static void Postfix(PlayerProfile profile, GameObject ___m_playerInstance) { if (profile != null && (Object)(object)___m_playerInstance != (Object)null) { string name = profile.GetName(); if (m_playerProfileState.ContainsKey(name) && m_playerProfileState[name] > 1) { Player component = ___m_playerInstance.GetComponent(); SetWildlingAppearance(component, name); Throwstick.ClutchProfileUpdate(component); } } } } [HarmonyPatch(typeof(Skills), "GetSkillDef")] public static class PatchSkillsGetSkillDef { [HarmonyPostfix] public static void Postfix(SkillType type, ref SkillDef __result, List ___m_skills) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) if (type == WildlingSkill && __result == null) { ___m_skills.Add(WildlingSkillDef); string text = "skill_" + 413; Traverse.Create((object)Localization.instance).Method("AddWord", new object[2] { text, "Wildling" }).GetValue(new object[2] { text, "Wildling" }); __result = WildlingSkillDef; if ((Object)(object)__result.m_icon == (Object)null) { __result.m_icon = WUTIL.GetIcon("TorchCrystalWall"); } } } } [HarmonyPatch(typeof(Player), "OnSkillLevelup")] private class PatchPlayerOnSkillLevelup { private static void Postfix() { Throwstick.ClutchSetCapacity(); } } [HarmonyPatch(typeof(Skills), "LowerAllSkills")] private class PatchSkillsLowerAllSkills { private static int m_level; private static void Prefix(float factor) { m_level = (int)(100f * SkillFactor((SkillType)0)); } private static void Postfix() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) int num = (int)(100f * SkillFactor((SkillType)0)); WDBUG.Log($"Wildling skill was already adjusted on death {m_level} -> {num}", WDBUG.Level.PlayerStats); if (num >= m_level) { return; } foreach (Skill skill in ((Character)Player.m_localPlayer).GetSkills().GetSkillList()) { if (skill.m_info.m_skill == WildlingSkill) { SetPlayerSkill(((object)Unsafe.As(ref WildlingSkill)/*cast due to .constrained prefix*/).ToString(), skill.m_level = num, skill.m_accumulator = 0f); break; } } } } public class SE_Hidden : SE_Stats { private static string hiddenBuff = ""; public SE_Hidden() { ((Object)this).name = (((StatusEffect)this).m_name = "Hidden"); ((StatusEffect)this).m_tooltip = "When you are couching and not moving, enemies are less likely to notice or continue hunting you. You can only hide if you are not too close, depending on your hiding ability. The Hidden status means you are sufficiently far away from all nearby enemies."; ((StatusEffect)this).m_icon = WUTIL.GetIcon("StoneFloorSewers"); ((StatusEffect)this).m_ttl = 0f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override bool IsDone() { if (!((StatusEffect)this).m_character.IsCrouching()) { Alignment.SetHidden(hidden: false); return true; } return !Alignment.PlayerIsHiding(); } public override string GetIconText() { float num = 0.1f * (float)(int)(1000f * Equipment.HideClothingBuff); hiddenBuff = ((num == 0f) ? "" : (((num < 0f) ? "" : "+") + num + "%")); return hiddenBuff; } public override string GetTooltipString() { if (hiddenBuff == "") { return ((StatusEffect)this).m_tooltip; } return ((StatusEffect)this).m_tooltip + " Your clothing is affecting your ability to hide in this environment.\nHiding: " + hiddenBuff + ""; } } public class SE_Disease : StatusEffect { public SE_Disease() { ((Object)this).name = "SE_Disease"; base.m_name = "Sickness"; base.m_tooltip = "You are nausiated from Rat Bite Sickness. You will not be able to eat so much for a while, depending on the severity of your infection."; base.m_icon = WUTIL.GetIcon("GuckBurner"); } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); if (m_restartStatusEffectTime > 0f) { WUTIL.TimerReset("sickness", m_restartStatusEffectTime); } base.m_ttl = WUTIL.Timer("sickness"); } public override void UpdateStatusEffect(float dt) { base.m_time = 0f; base.m_ttl = WUTIL.Timer("sickness"); SetPlayerData(((Object)this).name, base.m_ttl); ((StatusEffect)this).UpdateStatusEffect(dt); } public override void Stop() { ((StatusEffect)this).Stop(); WUTIL.TimerReset("sickness", base.m_ttl = 0f); SetPlayerData(((Object)this).name, 0f); } public override bool IsDone() { return base.m_ttl <= 0f; } } public class SE_RatPoisonResist : SE_Stats { public SE_RatPoisonResist() { //IL_0043: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) ((Object)this).name = "SE_RatPoisonResist"; ((StatusEffect)this).m_name = "Poison Resistance"; ((StatusEffect)this).m_tooltip = "You have gained temporary resistance to poison from digesting cooked rat meat."; ((StatusEffect)this).m_icon = WUTIL.GetIcon("Piece_Coffin"); base.m_mods.Add(new DamageModPair { m_type = (DamageType)256, m_modifier = (DamageModifier)5 }); ((StatusEffect)this).m_ttl = 60f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); ((StatusEffect)this).m_time = m_restartStatusEffectTime; } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); SetPlayerData(((Object)this).name, ((StatusEffect)this).m_time); } public override void Stop() { ((StatusEffect)this).Stop(); SetPlayerData(((Object)this).name, 0f); } } public class SE_Nausia : SE_Puke { public SE_Nausia() { //IL_0043: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown ((Object)this).name = "SE_Nausia"; ((StatusEffect)this).m_name = "Nausia"; ((StatusEffect)this).m_tooltip = "You are vomiting."; ((StatusEffect)this).m_icon = WUTIL.GetIcon("StoneFloorDirt"); ((SE_Stats)this).m_mods.Add(new DamageModPair { m_type = (DamageType)256, m_modifier = (DamageModifier)5 }); ((StatusEffect)this).m_ttl = 4f; ((SE_Stats)this).m_tickInterval = 2.1f; ((SE_Stats)this).m_healthPerTick = -1f; ((SE_Stats)this).m_speedModifier = -0.5f; base.m_removeInterval = 2.1f; ((StatusEffect)this).m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[3]; ((StatusEffect)this).m_startEffects.m_effectPrefabs[0] = new EffectData { m_prefab = WUTIL.GetPrefab("fx_Puke"), m_attach = true, m_inheritParentRotation = true, m_childTransform = "Jaw" }; ((StatusEffect)this).m_startEffects.m_effectPrefabs[1] = new EffectData { m_prefab = WUTIL.GetPrefab("sfx_Puke_male"), m_variant = 0, m_attach = true }; ((StatusEffect)this).m_startEffects.m_effectPrefabs[2] = new EffectData { m_prefab = WUTIL.GetPrefab("sfx_Puke_female"), m_variant = 1, m_attach = true }; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((SE_Puke)this).Setup(character); ((StatusEffect)this).m_time = m_restartStatusEffectTime; } public override void UpdateStatusEffect(float dt) { ((SE_Puke)this).UpdateStatusEffect(dt); SetPlayerData(((Object)this).name, ((StatusEffect)this).m_time); } public override void Stop() { ((StatusEffect)this).Stop(); SetPlayerData(((Object)this).name, 0f); } } public class SE_PetsTouch : StatusEffect { public SE_PetsTouch() { ((Object)this).name = "SE_PetsTouch"; base.m_name = "Pets Touch"; base.m_tooltip = "You feel comfortable and confident from playing with your pet.\nHealth: +5\nStamina: +5"; base.m_ttl = 600f; SetIcon(); } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); base.m_time = m_restartStatusEffectTime; m_baseHealthBuff = 5f; m_baseStaminaBuff = 5f; SetIcon(); } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); SetPlayerData(((Object)this).name, base.m_time); } public override void Stop() { ((StatusEffect)this).Stop(); m_baseHealthBuff = 0f; m_baseStaminaBuff = 0f; SetPlayerData(((Object)this).name, 0f); } private void SetIcon() { int num = Quest.GetAchievement("PetsTouchIdx"); if (num < 0 || num >= m_petIcons.Count) { num = 1; } Sprite icon = WUTIL.GetIcon(m_petIcons[num]); base.m_icon = ((num == 0) ? icon : WUTIL.GetIcon(icon, (num == 3) ? 0.7f : 0.6f)); } } [HarmonyPatch(typeof(ShipControlls), "GetHoverText")] private class PatchShipControllsGetHoverText { public static bool Prefix(ShipControlls __instance, ref string __result) { //IL_001f: 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) if ((Object)(object)Player.m_localPlayer != (Object)null && IsWildling && Vector3.Distance(((Component)Player.m_localPlayer).transform.position, __instance.m_attachPoint.position) < __instance.m_maxUseRange && WUTIL.GameName(((Component)__instance).transform) != "Raft") { __result = "Cannot use " + WUTIL.GameName(((Component)((Component)__instance).transform).gameObject); return false; } return true; } } [HarmonyPatch(typeof(ShipControlls), "Interact")] private class PatchShipControllsInteract { public static bool Prefix(ShipControlls __instance, Humanoid character, ref bool __result) { if ((Object)(object)Player.m_localPlayer != (Object)null && IsWildling && WUTIL.GameName(((Component)__instance).transform) != "Raft") { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] private class PatchPlayerGetTotalFoodValue { private static void Postfix(ref float hp, ref float stamina) { if (IsWildling) { hp += -15f; stamina += -25f + StaminaBuff; } hp += m_baseHealthBuff; stamina += m_baseStaminaBuff; } } [HarmonyPatch(typeof(Player), "GetBaseFoodHP")] private class PatchPlayerGetBaseFoodHP { private static void Postfix(ref float __result) { if (IsWildling) { __result += -15f; } } } [HarmonyPatch(typeof(Player), "CanEat")] private class PatchPlayerCanEat { private static void Postfix(ref bool __result, Player __instance, ItemData item, List ___m_foods) { //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown if (!__result) { return; } if (WUTIL.Timer("SE_DoxieDust") > 0f) { WUTIL.Message("You cannot eat right now."); __result = false; } else { if (!IsWildling) { return; } ItemData val = null; string msg = ""; float num = item.m_shared.m_food + item.m_shared.m_foodStamina; if (num > 60f) { float num2 = 60f / num; val = WUTIL.CreateItemData(((Object)item.m_dropPrefab).name); val.m_shared.m_food = (int)(0.5f + val.m_shared.m_food * num2); val.m_shared.m_foodStamina = (int)(0.5f + val.m_shared.m_foodStamina * num2); msg = "You could not eat all of the " + item.m_shared.m_name + ".\n" + $"Health +{val.m_shared.m_food} Stamina +{val.m_shared.m_foodStamina}"; } if (___m_foods.Count < MaxFood) { if (val == null) { return; } Food val2 = null; foreach (Food ___m_food in ___m_foods) { if (___m_food.m_item.m_shared.m_name == item.m_shared.m_name) { val2 = ___m_food; break; } } if (val2 == null) { val2 = new Food(); ___m_foods.Add(val2); } val2.m_item = val; val2.m_name = ((Object)val.m_dropPrefab).name; val2.m_health = val.m_shared.m_food; val2.m_stamina = val.m_shared.m_foodStamina; val2.m_eitr = val.m_shared.m_foodEitr; val2.m_time = val.m_shared.m_foodBurnTime; WUTIL.Message(msg); m_forcedDigestion = true; __result = false; return; } int num3 = ___m_foods.Count; Food val3 = null; foreach (Food ___m_food2 in ___m_foods) { if (___m_food2.CanEatAgain()) { if (___m_food2.m_item.m_shared.m_name == item.m_shared.m_name) { val3 = ___m_food2; num3 = 0; break; } num3--; if (val3 == null || ___m_food2.m_health < val3.m_health) { val3 = ___m_food2; } } } if (num3 >= MaxFood) { WUTIL.Message("$msg_isfull"); } else if (val3 == null) { WDBUG.Log("Expected to replace flashing food item but did not find one"); } else { if (val != null) { item = val; } else { msg = $"Health +{item.m_shared.m_food} Stamina +{item.m_shared.m_foodStamina}"; } val3.m_item = item; val3.m_name = ((Object)item.m_dropPrefab).name; val3.m_health = item.m_shared.m_food; val3.m_stamina = item.m_shared.m_foodStamina; val3.m_time = item.m_shared.m_foodBurnTime; WUTIL.Message(msg); m_forcedDigestion = true; } __result = false; } } } [HarmonyPatch(typeof(Player), "CanConsumeItem")] private class PatchPlayerCanConsumeItem { private static ItemData m_repairItem; private static bool Prefix(ItemData item, ref bool __result) { string text = WUTIL.ItemName(item); if (text == "PatchKit") { if (!PatchRepair()) { __result = false; return false; } m_stopConsumeAnimation = true; } return true; } private static void Postfix(ItemData item, ref bool __result) { if (!__result && !m_forcedDigestion) { return; } if (m_repairItem != null) { WUTIL.Message("Repaired " + WUTIL.ItemName(m_repairItem, goName: false), center: true, WUTIL.GetIcon(m_repairItem.m_dropPrefab)); ((Humanoid)Player.m_localPlayer).UnequipItem(m_repairItem, true); m_repairItem = null; } else if (WUTIL.ItemName(item) == "CookedRat") { m_pukeOnlyRatMeat = RatBite(60f, 1f, ResistSickness() ? "" : "You suddenly feel nauseous!"); m_ratMeatPukeResist = m_pukeOnlyRatMeat && ResistPuking(); Quest.AdvanceAchievement("CookedRat"); if (m_forcedDigestion && !m_ratMeatPukeResist) { WUTIL.TimerReset("autopukeDelay", 0.1f); } } else { Fairy.Consume(item); } } private static bool ResistSickness() { return GetPlayerData("WS.DiseaseResistance") + DiseaseResistanceBuff > WUTIL.RandomSpin(); } private static bool PatchRepair() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0040: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected I4, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 m_repairItem = null; float num = 0f; foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { ItemType itemType = allItem.m_shared.m_itemType; ItemType val = itemType; switch (val - 5) { default: if ((int)val != 17) { continue; } goto case 1; case 1: case 2: case 6: { string text = WUTIL.ItemName(allItem); if (!text.Contains("Troll") && (WUTIL.IsWildlingObject(allItem.m_dropPrefab) || text.Contains("Leather") || text.Contains("Rags"))) { break; } continue; } case 0: if (WUTIL.ItemName(allItem) == "throwstickClutch") { break; } continue; case 3: case 4: case 5: continue; } float num2 = allItem.GetMaxDurability() - allItem.m_durability; if (num2 > num) { num = num2; m_repairItem = allItem; } } if (m_repairItem == null) { WUTIL.Message("You do not hold any patchable items"); return false; } m_repairItem.m_durability = (WUTIL.TestLuck() ? m_repairItem.GetMaxDurability() : Mathf.Min(m_repairItem.m_durability + 300f, m_repairItem.GetMaxDurability())); return true; } } [HarmonyPatch(typeof(Player), "ConsumeItem")] private class PatchPlayerConsumeItem { private static void Postfix(Inventory inventory, ItemData item, ref bool __result) { if (!__result && m_forcedDigestion) { inventory.RemoveOneItem(item); m_forcedDigestion = false; __result = true; } if (m_stopConsumeAnimation) { m_stopConsumeAnimation = false; ((Component)Player.m_localPlayer).GetComponent().SetTrigger("emote_stop"); Player.m_localPlayer.StartEmote("swing_hammer", true); } } } [HarmonyPatch(typeof(Player), "RemoveOneFood")] private class PatchPlayerRemoveOneFood { private static bool Prefix(ref bool __result, List ___m_foods) { if (m_pukeOnlyRatMeat && ___m_foods.Count > 0) { m_pukeOnlyRatMeat = false; Food val = null; foreach (Food ___m_food in ___m_foods) { if (WUTIL.ItemName(___m_food.m_item) == "CookedRat") { val = ___m_food; break; } } if (val != null) { ___m_foods.Remove(val); __result = true; return false; } } return true; } } [HarmonyPatch(typeof(Character), "ApplyDamage")] private class PatchCharacterApplyDamage { private static bool Prefix(Character __instance, HitData hit) { if ((Object)(object)Player.m_localPlayer == (Object)null) { return true; } if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return !Quest.Protected() || !Riding.IsRidingBonded(); } Character attacker = hit.GetAttacker(); if ((Object)(object)attacker == (Object)null) { return !Quest.Protected() || !Riding.IsRidingBonded(); } if (Riding.IsRiding(attacker)) { return false; } bool flag = WUTIL.Timer("ratbite_immunity") > 0f; switch (WUTIL.ActorName(attacker)) { case "Rat": if (flag) { return false; } RatBite(WUTIL.RandomSpin(300f, 600f, 1f) + (float)(60 * attacker.GetLevel()), 6f, "You were bitten!"); break; case "RatDraugr": if (flag) { return false; } RatBite(WUTIL.RandomSpin(1500f, 3000f, 1f) + (float)(600 * attacker.GetLevel()), 3f, "You were bitten by a Draugr Rat!"); hit.m_damage.m_poison *= 4f; break; case "BoratRat": if (flag) { return false; } hit.m_damage.m_fire = 10f; break; } if (hit.m_damage.m_poison > 0f) { float num = (flag ? 1f : GetPlayerData("WS.DiseaseResistance")); if (num >= 0.8f) { float num2 = 0.25f * (num - 0.8f) / 0.19999999f; WDBUG.Log($"Resisted {hit.m_damage.m_poison * num2} posion damage ({num2 * 100f}%)", WDBUG.Level.Disease); hit.m_damage.m_poison *= 1f - num2; } } return true; } } [HarmonyPatch(typeof(Projectile), "OnHit")] private class PatchProjectileOnHit { private static bool Prefix(Projectile __instance, Collider collider, Vector3 hitPoint, bool water, Character ___m_owner) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (water) { return true; } GameObject val = (((Object)(object)collider == (Object)null) ? null : Projectile.FindHitObject(collider)); if ((Object)(object)___m_owner == (Object)(object)Player.m_localPlayer) { if (Throwstick.CheckHit(__instance, hitPoint, water, collider)) { return true; } } else if ((Object)(object)val.GetComponent() == (Object)(object)Player.m_localPlayer && Fairy.ProjectileHitShieldedPlayer(__instance)) { return false; } return Loki.ProjectileOnHit(__instance, val, hitPoint, ___m_owner); } } [HarmonyPatch(typeof(Aoe), "OnHit")] public class PatchAoeOnHit { public static Character m_catchDeath; private static bool Prefix(Aoe __instance, Collider collider, Character ___m_owner) { if ((Object)(object)collider == (Object)null) { return true; } GameObject val = Projectile.FindHitObject(collider); if ((Object)(object)___m_owner == (Object)null) { if ((Object)(object)val.GetComponent() == (Object)(object)Player.m_localPlayer) { if (WUTIL.GameName(((Component)__instance).gameObject) == "Beehive" && Fairy.PinePasteActive()) { return false; } if (Fairy.ProjectileHitShieldedPlayer() || Riding.HitBoxShielded(__instance)) { return false; } } } else if ((Object)(object)___m_owner == (Object)(object)Player.m_localPlayer) { m_catchDeath = ((val != null) ? val.GetComponent() : null); if ((Object)(object)m_catchDeath != (Object)null && m_catchDeath.GetHealth() <= 0f) { m_catchDeath = null; } } else if ((Object)(object)val.GetComponent() == (Object)(object)Player.m_localPlayer && (Fairy.ProjectileHitShieldedPlayer() || Riding.HitBoxShielded(__instance))) { return false; } return true; } private static void Postfix(Aoe __instance, bool __result) { World.CheckAoEDamaged(__instance, m_catchDeath); m_catchDeath = null; } } [HarmonyPatch(typeof(Projectile), "FixedUpdate")] private class PatchProjectileFixedUpdate { private static void Postfix(Projectile __instance, Character ___m_owner, ZNetView ___m_nview) { if (___m_nview.IsValid() && __instance.m_ttl > 0f) { Fairy.ProjectileShield(__instance, ___m_owner); Loki.ProjectileFixedUpdate(__instance, ___m_owner); } } } [HarmonyPatch(typeof(DropOnDestroyed), "OnDestroyed")] private class PatchDropOnDestroyedOnDestroyed { private static void Postfix(DropOnDestroyed __instance) { if (WUTIL.GameName(((Component)__instance).gameObject) == "GuckSack") { Quest.AdvanceAchievement("Treecare"); } } } public const int c_wstateAdultNoPlay = 0; public const int c_wstateAdultPlayed = 1; public const int c_wstateWildling = 2; public const int c_wstateAdultOnDeath = 3; public const int c_wstateAdultOnExit = 4; public const float c_xpScentPickup = 0.2f; public const float c_xpHideSuccess = 1f; public const float c_xpHideStopAnimalAlert = 2f; public const float c_xpHideStopHuntSuccess = 5f; public const float c_xpFeed = 1f; public const float c_xpBond = 1f; public const float c_xpBarter = 1f; public const float c_xpBribePoor = 4f; public const float c_xpBribeWell = 8f; public const float c_xpBribeHire = 16f; public const float c_chipperSkillLearnRate = 0.05f; public const float c_lockpickSkillLearnRate = 0.05f; public const float c_skeletonKeySkillBuff = 0.25f; public static int PlayState = 0; public static int InventoryRows = 4; public static int MaxFood = 3; public static bool IsWildling = false; public static bool IsFemaleModel = false; public static float StaminaBuff = 0f; public static float BarterBuff = 0f; public static float SenseBuff = 0f; public static float DiseaseResistanceBuff = 0f; public static float DiseaseRecoveryBuff = 0f; public static Biome BiomeClothingBuff = (Biome)0; public static Vector3 HairColor = Vector3.zero; public static bool m_justDiedAsWildling = false; public static float m_restartStatusEffectTime = 0f; public static Vector3 m_originalSkinColor = Vector3.zero; public static Vector3 m_backupPlayerScale = Vector3.zero; private const bool c_cannotSteerRaft = false; private const float c_peerStatusCheckTick = 5f; private const float c_skillIncreaseCooldown = 5f; private const float c_partEatFoodPower = 60f; private const float c_baseHealth = 10f; private const float c_baseStamina = 50f; private const float c_scaleSize = 0.7f; private const float c_diseaseResistanceGainRate = 0.1f; private const float c_diseaseResistancePoison = 0.8f; private const float c_diseaseMaxPoisonResist = 0.25f; private const float c_ratMeatNausiaCooldown = 60f; private const float c_ratNausiaResistBase = 0.05f; private const float c_ratPoisonResistTime = 120f; private static Vector3 c_skinToneDarkling = new Vector3(0.6f, 0.9f, 0.7f); private static Vector3 c_skinToneFlushed = new Vector3(0.9f, 0.5f, 0.5f); private static bool m_pukeOnlyRatMeat = false; private static bool m_ratMeatPukeResist = false; private static bool m_forcedDigestion = false; private static bool m_stopConsumeAnimation = false; private static float m_newDiseaseDuration = 0f; private static float m_diseaseRecoveryBonus = 0f; private static float m_baseHealthBuff = 0f; private static float m_baseStaminaBuff = 0f; private static string m_diseaseContractedMsg = ""; private static string m_originalHairStyle = "Hair1"; private static string m_originalBeardStyle = "BeardNone"; private static Dictionary m_otherPlayerStatus = new Dictionary(); private static Dictionary m_wildlingPlayerData = new Dictionary(); private static bool m_preventSaveToDisk = false; private static Dictionary m_playerProfileState = new Dictionary(); private static Dictionary m_playerProfileHairStyle = new Dictionary(); private static Dictionary m_playerProfileHairColor = new Dictionary(); public const int WildlingSkillEnum = 413; public const string WildlingSkillName = "Wildling"; public static SkillType WildlingSkill = (SkillType)413; public static SkillDef WildlingSkillDef = new SkillDef { m_skill = WildlingSkill, m_icon = null, m_description = "Adaption to your native habitat, including heightened senses.", m_increseStep = 1f }; private static List m_petIcons = new List { "CatItem", "TrophyBoar", "TrophyWolf", "TrophyLox" }; public static void CompleteStartup() { InventoryRows = ((Humanoid)Player.m_localPlayer).GetInventory().GetHeight(); WDBUG.CommandLine(); MagicChest.ResetInventory(); Quest.ActivateEntryPortal(PlayState == 0); if (PlayState >= 2 && !IsWildling) { WDBUG.Log("Restart as Wildling", WDBUG.Level.PlayerProfile); ToggleWildling(0.2f); } else { WUTIL.TimerReset("auto_reequip", 1.3f); } Throwstick.Startup(); ResetOriginalSkinColor(); Crafting.AddKnownItems("SoakerRequired,WashbasinRequired,HairdyeBleach,HairdyeBlack"); Crafting.AddKnownItems("HairdyeYellow,HairdyeGreen,HairdyeBlue,HairdyeRed,HairdyeOrange,HairdyePurple"); Quest.BlockTutorials(block: false); WUTIL.PlayerID = Player.m_localPlayer.GetPlayerID(); WUTIL.m_captureHeldItems = GetPlayerData("PHIDEHANDS") > 0f; RestoreStatusEffects(); World.UpdateSafePoint(reset: true); if (!Raven.m_tutorialsEnabled && PlayState != 1 && Quest.CountAchievements("MainTutorial", 15, 1) < 15) { WUTIL.DelayedMessage("LOUD:It is recommended you enable Raven Tutorials in your settings."); } int num = Mathf.Abs((int)(float)ZNet.World.m_seed); int playerDataInt = GetPlayerDataInt("LastWordSeed"); WDBUG.Log($"This world seed = {ZNet.World.m_seed} -> {num} vs. last {playerDataInt}", WDBUG.Level.World); if (num != playerDataInt) { SetPlayerData("LastWordSeed", (float)num); World.ClearBedPositions(); } WDBUG.Log("Beta version start up complete. Njota.", WDBUG.Level.Beta); Quest.ProgressSummary(); } public static void Reset() { PlayState = 0; IsWildling = false; Equipment.Reset(); } public static void Update() { UpdateDiseases(); UpdateHairColor(); } private static void UpdateHairColor() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.Timer("change_hair") > 0f) { HairColor += Crafting.m_hairColorChange; Player.m_localPlayer.SetHairColor(HairColor); SetPlayerData("WHAIRCOLOR", HairColor); } } public static void SetWilding(bool toWilding) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } MagicChest.m_forceInventoryUpdate = IsWildling != toWilding; IsWildling = toWilding; if (IsWildling) { WUTIL.UnequipAllTemporary(); if (PlayState == 0) { BackupPlayerAttributes(); WDBUG.Log("Newborn Wildling", WDBUG.Level.PlayerStats); ((Character)Player.m_localPlayer).GetSkills().Clear(); SetPlayerData("WHAIRCOLOR", Crafting.c_hairColorBlue); Quest.CheckObjective(0); } else if (PlayState == 2) { if (!m_justDiedAsWildling) { Quest.PatchObjectives(); Riding.Remount(); } } else { WDBUG.Log("Restore Former Wildling", WDBUG.Level.PlayerStats); RestorePlayerAttributes(keepImprovedSkills: false); } PlayState = 2; SetWildlingAppearance(); SetWildlingStats(); } else { if (PlayState == 0) { WDBUG.Log($"Unexpected SetWilding({toWilding}) called for non-wilding"); WUTIL.m_updateLateStartup = false; return; } if (PlayState == 3) { WUTIL.Message("Your journey as the Wildling is over.\nPerhaps you will go farther next time.", center: true, null, blockNext: false, logOpt: true); } else if (PlayState == 4) { WUTIL.Message(Quest.EndSummary(), center: true, null, blockNext: false, logOpt: true); } WUTIL.UnequipAllTemporary(); WDBUG.Log("Restore Player Attributes", WDBUG.Level.PlayerStats); PlayState = 1; RestorePlayerAttributes(keepImprovedSkills: true); Player.m_localPlayer.SetGuardianPower(""); } Crafting.SetPlayerKnowableRecipes(); Loki.CustomizeThorscorn(WUTIL.GetInventoryItemData("Thorscorn")); Fairy.CustomizeBook(WUTIL.GetInventoryItemData("FairyTale")); ElderWand.Equip(); BroadcastStatus(); } public static void ToggleWildling(float deferTime = 0f) { if (deferTime > 0f) { WUTIL.TimerReset("wildlingMorphDelay", deferTime); WUTIL.m_updateLateStartup = true; } else { WDBUG.Log("Toggle Wildling", WDBUG.Level.PlayerProfile); SetWilding(!IsWildling); } } public static void BroadcastStatus(string special = "") { if ((Object)(object)WUTIL.Player_nview != (Object)null && WUTIL.Player_nview.IsValid() && WUTIL.Player_nview.IsOwner()) { string text = ((!(special == "")) ? special : (IsWildling ? "Wildling" : "Adult")); World.SendServerRequest("Status", Player.m_localPlayer.GetPlayerName() + "$" + text); } } public static void ResetOriginalSkinColor(Player player = null) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { player = Player.m_localPlayer; if ((Object)(object)player == (Object)null) { return; } } if (PlayState > 1) { m_originalSkinColor = GetPlayerDataVector3("PSKINCOLOR"); } if (m_originalSkinColor == Vector3.zero) { ZNetView component = ((Component)player).gameObject.GetComponent(); if (component.GetZDO() != null) { m_originalSkinColor = component.GetZDO().GetVec3("SkinColor", m_originalSkinColor); } } } public static bool IsDarkling() { return IsWildling && Quest.GetAchievement("DarklingLevel") >= 20; } public static bool RatImmunity() { return WUTIL.Timer("ratbite_immunity") > 0f || IsDarkling(); } public static bool HasEaten(string foodName = "") { List foods = Player.m_localPlayer.GetFoods(); if (foodName == "") { return foods.Count > 0; } foreach (Food item in foods) { if (item.m_item.m_shared.m_name == foodName) { return true; } } return false; } public static void ModifyDarklingLevel(int add, bool ifDarkling = true) { if (!((Object)(object)Player.m_localPlayer == (Object)null) && PlayState >= 1) { int num = ((ifDarkling && !IsDarkling()) ? 9 : 100); int num2 = Mathf.Clamp(Quest.GetAchievement("DarklingLevel") + add, 0, num); Quest.SetAchievement("DarklingLevel", num2); SetDarklingShade((num2 > 9) ? num2 : 0); } } public static void SetDarklingShade(int shade, bool debug = false) { //IL_0022: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) Quest.SetAchievement("DarklingShade", shade, bit: false, if_lower: false, checkAwards: true, initialize: false, debug); Vector3 val = 0.01f * (float)Mathf.Clamp(shade, 0, 100) * (c_skinToneDarkling - m_originalSkinColor); Player.m_localPlayer.SetSkinColor(m_originalSkinColor + val); } public static void SetFlushedShade(int shade) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) Vector3 val = 0.01f * (float)Mathf.Clamp(shade, 0, 100) * (c_skinToneFlushed - m_originalSkinColor); Player.m_localPlayer.SetSkinColor(m_originalSkinColor + val); } public static float SkillFactor(SkillType skillType = (SkillType)0) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((int)skillType == 0) { return ((Character)Player.m_localPlayer).GetSkills().GetSkillFactor(WildlingSkill) + Equipment.SkillClothingBuff; } return ((Character)Player.m_localPlayer).GetSkills().GetSkillFactor(skillType); } public static void RaisePrimarySkill(float exp = 1f, string source = "xp", float xp_cooldown = 5f, SkillType skillType = (SkillType)0) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) string name = source + "_cooldown"; if (WUTIL.Timer(name) != 0f) { return; } if ((int)skillType == 0) { WUTIL.TimerReset(name, xp_cooldown); if (IsWildling) { WDBUG.Log($"Raise Wildling skill by: {exp} for: {source}", WDBUG.Level.Progress); ((Character)Player.m_localPlayer).RaiseSkill(WildlingSkill, exp); foreach (Skill skill in ((Character)Player.m_localPlayer).GetSkills().GetSkillList()) { if (skill.m_info.m_skill == WildlingSkill) { SetPlayerSkill(((object)Unsafe.As(ref WildlingSkill)/*cast due to .constrained prefix*/).ToString(), skill.m_level, skill.m_accumulator); break; } } if (exp > 0f) { CheckObjectives(); } } else { WDBUG.Log($"Raise Wildling skill by: {exp} for: {source} declined for non-wildling", WDBUG.Level.Progress); } } else { WDBUG.Log($"Raised {skillType} skill by: {exp} for: {source}", WDBUG.Level.Progress); ((Character)Player.m_localPlayer).RaiseSkill(skillType, exp); } } public static void CheckObjectives() { if (SkillFactor((SkillType)0) >= 0.1f) { if (SkillFactor((SkillType)101) >= 0.1f) { Quest.CheckObjective(3, set: false); } if (Quest.CheckObjective(4, set: true, test: true) && MapMarker.CheckKnownScent("Rabbit") >= 1f) { Quest.CheckObjective(4, set: false); } } } public static float RaiseSecondarySkill(string name, float exp) { float num = GetPlayerData("WS." + name); if (num < 1f) { num = Mathf.Min(num + exp * (1f - num * num), 1f); if (num > 0.995f) { num = 1f; WUTIL.Message("You have mastered the Wildling " + name + " skill!"); } else { WDBUG.Log($"Raised {name} skill to {num}", WDBUG.Level.Progress); } SetPlayerData("WS." + name, num); } return num; } public static void SetPlayerData(string key, float value) { m_wildlingPlayerData[key] = value; } public static void SetPlayerData(string key, Vector3 value) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) m_wildlingPlayerData[key + ".x"] = value.x; m_wildlingPlayerData[key + ".y"] = value.y; m_wildlingPlayerData[key + ".z"] = value.z; } public static float GetPlayerData(string key, float def = 0f) { return m_wildlingPlayerData.ContainsKey(key) ? m_wildlingPlayerData[key] : def; } public static int GetPlayerDataInt(string key) { return (int)(GetPlayerData(key) + 0.5f); } public static Vector3 GetPlayerDataVector3(string key) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) return new Vector3(GetPlayerData(key + ".x"), GetPlayerData(key + ".y"), GetPlayerData(key + ".z")); } public static void DeletePlayerData(string key) { m_wildlingPlayerData.Remove(key); } public static void DeletePlayerDataVector3(string key) { m_wildlingPlayerData.Remove(key + ".x"); m_wildlingPlayerData.Remove(key + ".y"); m_wildlingPlayerData.Remove(key + ".z"); } public static void SetPlayerSkill(string key, float level, float accum) { SetPlayerData("SK." + key, (float)(int)(1f + level * 1000f) + accum); } public static void GetPlayerSkill(string key, out float level, out float accum) { float playerData = GetPlayerData("SK." + key); level = (int)(playerData / 1000f); accum = playerData - (float)(int)playerData; } public static void RemovePlayerData(string prefix) { if (prefix == "") { WDBUG.Log("Removing ALL Wildling player data!"); m_wildlingPlayerData.Clear(); return; } string[] array = m_wildlingPlayerData.Keys.ToArray(); foreach (string text in array) { if (text.StartsWith(prefix)) { m_wildlingPlayerData.Remove(text); } } } public static string PrintPlayerData(string prefix = "", string setValue = "", string sep = "\n") { StringBuilder stringBuilder = new StringBuilder($"Player State: {PlayState} "); bool flag = sep == "\n"; if (prefix != "") { float result; if (setValue == "x") { if (m_wildlingPlayerData.ContainsKey(prefix)) { DeletePlayerData("prefix"); stringBuilder.Append("Vitals: Removed float for key " + prefix); } else if (m_wildlingPlayerData.ContainsKey(prefix + ".x")) { DeletePlayerDataVector3("prefix"); stringBuilder.Append("Vitals: Removed Vector3 for key " + prefix); } } else if (m_wildlingPlayerData.ContainsKey(prefix) && float.TryParse(setValue, out result) && result >= 0f) { if (flag) { stringBuilder.Append($"Vitals: [was value: {m_wildlingPlayerData[prefix]}]"); } m_wildlingPlayerData[prefix] = result; } else if (setValue != "") { stringBuilder.Append((setValue == "") ? "Vitals:\n" : ("Vitals: [ignored value: " + setValue + "]")); } } stringBuilder.Append(sep); foreach (KeyValuePair item in m_wildlingPlayerData.OrderBy((KeyValuePair x) => x.Key)) { if (prefix == "" || item.Key.StartsWith(prefix)) { if (item.Key.EndsWith(".x")) { stringBuilder.Append($"{item.Key.Remove(item.Key.Length - 2)}: {item.Value}, "); } else if (item.Key.EndsWith(".y")) { stringBuilder.Append($"{item.Value}, "); } else if (item.Key.EndsWith(".z")) { stringBuilder.Append(item.Value + sep); } else { stringBuilder.Append($"{item.Key}: {item.Value}{sep}"); } } } return stringBuilder.ToString(); } public static List ListPlayerData(string prefix, float minVal = 0f) { List list = new List(); int length = prefix.Length; foreach (KeyValuePair item in m_wildlingPlayerData.OrderBy((KeyValuePair x) => x.Key)) { if ((length == 0 || item.Key.StartsWith(prefix)) && item.Value >= minVal) { list.Add(item.Key.Substring(length)); } } return list; } public static void RestoreStatusEffects() { List list = new List(); foreach (string key in m_wildlingPlayerData.Keys) { if ((key.StartsWith("SE_") || key.StartsWith("GP_")) && m_wildlingPlayerData[key] > 0f) { list.Add(key); } } if (list.Count <= 0) { return; } SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan(); foreach (string item in list) { m_restartStatusEffectTime = m_wildlingPlayerData[item]; WDBUG.Log($"Restore {item} for {m_restartStatusEffectTime}s", WDBUG.Level.AssetConfig); if ((Object)(object)sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode(item), false, 0, 0f) == (Object)null) { WDBUG.Log($"Failed to add StatusEffect {item} for {m_restartStatusEffectTime}"); m_wildlingPlayerData[item] = 0f; } } m_restartStatusEffectTime = 0f; } public static void SetWildlingStats() { bool flag = Quest.GetAchievement("UpgradeLevel") > 0; Player localPlayer = Player.m_localPlayer; localPlayer.m_maxPlaceDistance = 4f; localPlayer.m_maxInteractDistance = 4f; localPlayer.m_dodgeStaminaUsage = 8f; localPlayer.m_sneakStaminaDrain = 4f; ((Character)localPlayer).m_walkSpeed = 4f; ((Character)localPlayer).m_crouchSpeed = 3f; ((Character)localPlayer).m_swimDepth = 1f; localPlayer.m_maxCarryWeight = 100f; localPlayer.m_runStaminaDrain = (flag ? 8 : 9); MaxFood = 2; InventoryRows = (flag ? 3 : 2); } private static void BackupPlayerAttributes() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } WDBUG.Log("Backup player attributes for new wildling", WDBUG.Level.PlayerProfile); Vector3 vec = default(Vector3); ((Vector3)(ref vec))..ctor(0.6f, 0.5f, 0.4f); ZNetView component = ((Component)localPlayer).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { m_originalSkinColor = component.GetZDO().GetVec3(ZDOVars.s_skinColor, m_originalSkinColor); vec = component.GetZDO().GetVec3(ZDOVars.s_hairColor, vec); } Animator componentInChildren = ((Component)((Component)localPlayer).GetComponent()).GetComponentInChildren(); SetPlayerData("PSIZE", ((Component)localPlayer).transform.localScale); SetPlayerData("PHEAD", ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)10)).transform.localScale); SetPlayerData("PHIPS", ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)0)).transform.localScale); m_originalHairStyle = ((Humanoid)localPlayer).GetHair(); m_originalBeardStyle = ((Humanoid)localPlayer).GetBeard(); WDBUG.Log("Cache original hairstyle: " + m_originalHairStyle); SetPlayerData("PHAIRCOLOR", vec); SetPlayerData("PSKINCOLOR", m_originalSkinColor); SetPlayerData("PCARRYWEIGHT", localPlayer.m_maxCarryWeight); SetPlayerData("PMAXPLACEDST", localPlayer.m_maxPlaceDistance); SetPlayerData("PMAXINACTDST", localPlayer.m_maxInteractDistance); SetPlayerData("PRUNSTMDRAIN", localPlayer.m_runStaminaDrain); SetPlayerData("PDGESTMDRAIN", localPlayer.m_dodgeStaminaUsage); SetPlayerData("PSNKSTMDRAIN", localPlayer.m_sneakStaminaDrain); SetPlayerData("PCROUCHSPEED", ((Character)localPlayer).m_crouchSpeed); SetPlayerData("PWALKSPEED", ((Character)localPlayer).m_walkSpeed); SetPlayerData("PSWIMDEPTH", ((Character)localPlayer).m_swimDepth); SetPlayerData("PFOODCOUNT", (float)localPlayer.GetFoods().Count); SetPlayerData("PINVNTROWS", (float)((Humanoid)localPlayer).GetInventory().GetHeight()); foreach (Skill skill in ((Character)localPlayer).GetSkills().GetSkillList()) { SetPlayerSkill(((object)Unsafe.As(ref skill.m_info.m_skill)/*cast due to .constrained prefix*/).ToString(), skill.m_level, skill.m_accumulator); } } private static void RestorePlayerAttributes(bool keepImprovedSkills) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } ZNetView component = ((Component)localPlayer).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { return; } Vector3 playerDataVector = GetPlayerDataVector3("PSIZE"); if (playerDataVector != Vector3.zero) { Animator componentInChildren = ((Component)((Component)localPlayer).GetComponent()).GetComponentInChildren(); ((Component)localPlayer).transform.localScale = playerDataVector; ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)10)).transform.localScale = GetPlayerDataVector3("PHEAD"); ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)0)).transform.localScale = GetPlayerDataVector3("PHIPS"); } ((Humanoid)localPlayer).SetHair(m_originalHairStyle); ((Humanoid)localPlayer).SetBeard(m_originalBeardStyle); localPlayer.SetHairColor(GetPlayerDataVector3("PHAIRCOLOR")); localPlayer.SetSkinColor(GetPlayerDataVector3("PSKINCOLOR")); localPlayer.m_maxCarryWeight = GetPlayerData("PCARRYWEIGHT"); localPlayer.m_maxPlaceDistance = GetPlayerData("PMAXPLACEDST"); localPlayer.m_maxInteractDistance = GetPlayerData("PMAXINACTDST"); localPlayer.m_runStaminaDrain = GetPlayerData("PRUNSTMDRAIN"); localPlayer.m_dodgeStaminaUsage = GetPlayerData("PDGESTMDRAIN"); localPlayer.m_sneakStaminaDrain = GetPlayerData("PSNKSTMDRAIN"); ((Character)localPlayer).m_crouchSpeed = GetPlayerData("PCROUCHSPEED"); ((Character)localPlayer).m_walkSpeed = GetPlayerData("PWALKSPEED"); ((Character)localPlayer).m_swimDepth = GetPlayerData("PSWIMDEPTH", 1.5f); MaxFood = GetPlayerDataInt("PFOODCOUNT"); InventoryRows = GetPlayerDataInt("PINVNTROWS"); foreach (Skill skill in ((Character)localPlayer).GetSkills().GetSkillList()) { if (skill.m_info.m_skill == WildlingSkill && !IsWildling) { continue; } string key = ((skill.m_info.m_skill == WildlingSkill) ? "Wildling" : ((object)Unsafe.As(ref skill.m_info.m_skill)/*cast due to .constrained prefix*/).ToString()); GetPlayerSkill(key, out var level, out var accum); if (keepImprovedSkills) { if (level < skill.m_level) { level = skill.m_level; accum = skill.m_accumulator; } else if (level == skill.m_level && accum < skill.m_accumulator) { accum = skill.m_accumulator; } } SetPlayerSkill(key, skill.m_level, skill.m_accumulator); skill.m_level = level; skill.m_accumulator = accum; } ((Character)localPlayer).SetHealth(((Character)localPlayer).GetMaxHealth()); } private static void SetWildlingAppearance(Player player = null, string playerName = "") { //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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) bool flag = !Object.op_Implicit((Object)(object)player); if (flag) { player = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)player)) { WDBUG.Log("Ignoring SetWildlingAppearance for local player null!"); return; } } SetWildlingShape(player); string text = ((playerName == "") ? m_originalHairStyle : m_playerProfileHairStyle[playerName]); if (text == "") { text = m_originalHairStyle; } string hair = "Hair6"; switch (text) { case "HairNone": case "Hair5": case "Hair14": hair = "Hair8"; break; case "Hair8": case "Hair10": case "Hair12": hair = "Hair5"; break; case "Hair6": hair = "Hair7"; break; } ((Humanoid)player).SetBeard("BeardNone"); ((Humanoid)player).SetHair(hair); IsFemaleModel = player.GetPlayerModel() == 1; HairColor = ((playerName == "") ? GetPlayerDataVector3("WHAIRCOLOR") : m_playerProfileHairColor[playerName]); player.SetHairColor(HairColor); if (flag) { ResetOriginalSkinColor(player); ModifyDarklingLevel(0); } } private static void SetWildlingShape(Player player, bool normal = false, float scale = 1f) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { WDBUG.Log("Ignoring SetWildlingSize for local player null!"); return; } Animator componentInChildren = ((Component)((Component)player).GetComponent()).GetComponentInChildren(); if (normal) { ((Component)player).transform.localScale = scale * Vector3.one; ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)10)).transform.localScale = Vector3.one; ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)0)).transform.localScale = Vector3.one; } else { ((Component)player).transform.localScale = scale * 0.7f * Vector3.one; ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)10)).transform.localScale = new Vector3(1f, 0.9f, 1f); ((Component)componentInChildren.GetBoneTransform((HumanBodyBones)0)).transform.localScale = new Vector3(0.8f, 1.04f, 0.8f); } } public static void CheckOtherPlayer(string playerName, string status) { Player val = null; foreach (Player allPlayer in Player.GetAllPlayers()) { if (allPlayer.GetPlayerName() == playerName) { if ((Object)(object)allPlayer == (Object)(object)Player.m_localPlayer) { return; } val = allPlayer; break; } } if ((Object)(object)val == (Object)null) { WDBUG.Log("Removing unknown player " + playerName + " from local player roster", WDBUG.Level.Multiplayer); m_otherPlayerStatus.Remove(playerName); return; } WDBUG.Log("Local player set " + status + " status for player " + playerName, WDBUG.Level.Multiplayer); m_otherPlayerStatus[playerName] = status; switch (status) { case "Wildling": SetWildlingShape(val); break; case "Fairy": WUTIL.UnequipAllTemporary(); SetWildlingShape(val, normal: false, 0.18f); break; case "Adult": SetWildlingShape(val, normal: true); break; } WUTIL.TimerReset("peer_status_tick", 5f); } public static bool IsWildlingPlayer(Player player) { if ((Object)(object)player == (Object)null) { return false; } if ((Object)(object)player == (Object)(object)Player.m_localPlayer) { return IsWildling; } string playerName = player.GetPlayerName(); return m_otherPlayerStatus.ContainsKey(playerName) && m_otherPlayerStatus[playerName] != "Adult"; } public static void CheckNewPlayer(Player player) { if ((Object)(object)player != (Object)null && !ZNet.instance.IsServer() && WUTIL.Timer("check_new_player") == 0f) { WUTIL.TimerReset("check_new_player", 0.5f); string playerName = player.GetPlayerName(); if (!m_otherPlayerStatus.ContainsKey(playerName)) { WDBUG.Log("New player requesting wildling status for " + playerName, WDBUG.Level.Multiplayer); BroadcastStatus(); } else if (WUTIL.Timer("peer_status_tick") == 0f) { WDBUG.Log("Heartbeat requesting wildling status for player " + playerName, WDBUG.Level.Multiplayer); BroadcastStatus(); } } } private static void UpdateDiseases() { if (m_ratMeatPukeResist || WUTIL.TimerIsAlmost("autopukeDelay", 0f)) { WDBUG.Log("Trying to prevent puking", WDBUG.Level.Disease); SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan(); StatusEffect statusEffect = sEMan.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Wildling_puke_SE")); if ((Object)(object)statusEffect != (Object)null) { if (m_ratMeatPukeResist) { sEMan.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Wildling_puke_SE"), true); SE_RatPoisonResist sE_RatPoisonResist = (SE_RatPoisonResist)(object)ScriptableObject.CreateInstance(typeof(SE_RatPoisonResist)); ((StatusEffect)sE_RatPoisonResist).m_ttl = 120f; sEMan.AddStatusEffect((StatusEffect)(object)sE_RatPoisonResist, false, 0, 0f); } } else { m_ratMeatPukeResist = ResistPuking(); if (!m_ratMeatPukeResist && (Object)(object)sEMan.AddStatusEffect(StringExtensionMethods.GetStableHashCode("SE_Nausia"), false, 0, 0f) == (Object)null) { SE_Nausia sE_Nausia = (SE_Nausia)(object)ScriptableObject.CreateInstance(typeof(SE_Nausia)); sEMan.AddStatusEffect((StatusEffect)(object)sE_Nausia, false, 0, 0f); } } if (m_ratMeatPukeResist) { m_ratMeatPukeResist = false; m_diseaseContractedMsg = "You resisted the urge to puke."; } } float num = WUTIL.Timer("diseaseMsg"); if (m_diseaseContractedMsg != "" && WUTIL.TimeIsAlmost(num)) { WUTIL.Message(m_diseaseContractedMsg); } else if (num > 0f) { return; } float num2 = WUTIL.Timer("sickness"); if (m_newDiseaseDuration > 0f) { float playerData = GetPlayerData("WS.DiseaseResistance"); if (WUTIL.TestLuck(playerData + DiseaseResistanceBuff + 0.05f)) { WUTIL.TimerReset("diseaseMsg", 2f); m_diseaseContractedMsg = "You resisted contracting Rat Sickness"; if (RaiseSecondarySkill("DiseaseResistance", 0.0050000004f) >= 0.8f) { Quest.CheckObjective(8, set: false); } } else if (m_newDiseaseDuration > num2 / 4f) { float num3 = m_newDiseaseDuration / 60f; float num4 = Mathf.Sqrt(num3 / 60f); if (num3 > 60f) { m_diseaseContractedMsg = "very severe"; } else if (num3 > 35f) { m_diseaseContractedMsg = "severe"; } else if (num3 > 15f) { m_diseaseContractedMsg = "nasty"; } else if (num3 > 5f) { m_diseaseContractedMsg = "mild"; } else { num4 = 0.15f; m_diseaseContractedMsg = "very mild"; } m_diseaseRecoveryBonus = 0.1f * num4; WDBUG.Log($"Disease Recovery Bonus set to {m_diseaseRecoveryBonus}", WDBUG.Level.Disease); WUTIL.TimerReset("diseaseMsg", 2f); m_diseaseContractedMsg = "You have contracted a " + m_diseaseContractedMsg + " case of Rat Sickness."; WUTIL.TimerReset("sickness", m_newDiseaseDuration); SE_Disease sE_Disease = (SE_Disease)(object)ScriptableObject.CreateInstance(typeof(SE_Disease)); ((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect((StatusEffect)(object)sE_Disease, false, 0, 0f); if (!m_pukeOnlyRatMeat) { WUTIL.TimerReset("autopukeDelay", 5f); } Quest.ShowMainTutorial(9); } m_newDiseaseDuration = 0f; } else { if (num2 == 0f) { return; } if (WUTIL.TimeIsAlmost(num2, 5f)) { WUTIL.Message("The effect of the rat sickness is wearing off.", center: false); } else if (WUTIL.TimeIsAlmost(num2, 2f)) { m_ratMeatPukeResist = false; m_pukeOnlyRatMeat = false; float playerData2 = GetPlayerData("WS.DiseaseResistance"); if (playerData2 < 1f) { WUTIL.Message("Your resistance to Rat Sickness has increased.", center: false); RaiseSecondarySkill("DiseaseResistance", m_diseaseRecoveryBonus); m_diseaseContractedMsg = ""; WDBUG.Log($"Disease resistance increased to {playerData2}", WDBUG.Level.Disease); } } if (DiseaseRecoveryBuff != 0f) { WUTIL.TimerReset("sickness", num2 - DiseaseRecoveryBuff * Time.fixedDeltaTime); } } } private static bool ResistPuking() { return WUTIL.TestLuck(GetPlayerData("WS.DiseaseResistance") - 0.05f); } public static bool AddPetsTouch(string name, string iconName = "CatItem", float cooldown = 10f, bool cycle = false) { if (WUTIL.Timer("petstouch_cooldown") > 0f) { return false; } WUTIL.TimerReset("petstouch_cooldown", cooldown); int achievement = Quest.GetAchievement("PetsTouchIdx"); int num = m_petIcons.IndexOf(iconName); if (cycle) { num = (achievement + 1) % 4; } else if (num < 0) { WDBUG.Log("Unrecognized pet icon " + iconName + " - default to last " + m_petIcons[achievement]); num = achievement; } Quest.SetAchievement("PetsTouchIdx", (num >= 0) ? num : 0); SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan(); bool flag = num == achievement; if (!flag) { sEMan.RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("SE_PetsTouch"), true); } SE_PetsTouch sE_PetsTouch = (SE_PetsTouch)(object)ScriptableObject.CreateInstance(typeof(SE_PetsTouch)); sEMan.AddStatusEffect((StatusEffect)(object)sE_PetsTouch, flag, 0, 0f); WUTIL.Message("Petting " + name + " comforts you.", center: true, ((StatusEffect)sE_PetsTouch).m_icon); return true; } private static bool RatBite(float duration, float contractDelay = 1f, string contractMessage = "") { if (Fairy.DedoxTonicActive()) { return false; } float num = 1f - GetPlayerData("WS.DiseaseResistance"); WDBUG.Log($"Rat Bite duration {duration} -> {duration * num}", WDBUG.Level.Disease); duration *= num; if (duration < contractDelay) { WDBUG.Log($"Resisted RatBite {duration} vs. {contractDelay}"); return false; } WUTIL.TimerReset("diseaseMsg", contractDelay); m_diseaseContractedMsg = contractMessage; m_newDiseaseDuration = duration; return true; } } internal class World { [HarmonyPatch(typeof(Heightmap), "GetWorldHeight")] private class PatchHeightMapGetWorldHeight { public static void Postfix(Heightmap __instance, Vector3 worldPos, bool __result, int ___m_width, HMBuildData ___m_buildData) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (__result) { int num = default(int); int num2 = default(int); __instance.WorldToVertex(worldPos, ref num, ref num2); int num3 = ___m_width + 1; m_groundBaseHeight = ___m_buildData.m_baseHeights[num2 * num3 + num] + ((Component)__instance).transform.position.y; } else { m_groundBaseHeight = 0f; } } } [HarmonyPatch(typeof(Fireplace), "UseItem")] private class PatchFireplaceUseItem { public static bool Prefix(Fireplace __instance, Humanoid user, ItemData item, ZNetView ___m_nview, ref bool __result) { //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061b: Unknown result type (might be due to invalid IL or missing references) if (!__instance.m_canRefill || item.m_shared.m_name == __instance.m_fuelItem.m_itemData.m_shared.m_name || __instance.m_infiniteFuel) { return true; } bool flag = true; int num = 1; switch (WUTIL.GameName(((Component)__instance).gameObject)) { case "fire_pit": case "bonfire": num = 2; break; default: return true; case "FirePit": break; } int num2 = 1; int num3 = 0; float num4 = 1f; string text = WUTIL.ItemName(item); if (item.IsWeapon() && text.EndsWith("Wood")) { text = "Wooden_"; } switch (text) { case "Stick": num4 = 0.6f; break; case "Chipper": num3 = 2; num4 = 0.4f; break; case "Hammer": case "Digger": num3 = 3; break; case "BeechSeeds": case "BirchSeeds": num4 = 0.2f; break; case "SlingshotWood": case "FirCone": case "PineCone": num4 = 0.3f; break; case "Torch": num4 = 0.1f + item.m_durability / item.m_shared.m_maxDurability; break; case "Match": num4 = ((item.m_stack == 1) ? (0.1f + 0.4f * item.m_durability / item.m_shared.m_maxDurability) : 0.5f); break; case "Throwstick": case "ThrowstickPoisoned": case "SlingshotFinewood": case "SlingshotHardwood": case "ShieldWood": if (num < 2 || flag) { return true; } break; default: if (text.StartsWith("Arrow")) { num4 = 0.1f; break; } return true; case "Club": case "Hoe": case "SharpenedStick": case "Wooden_": break; } if (item.m_stack < num2) { return true; } if ((float)Mathf.CeilToInt(___m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f)) >= __instance.m_maxFuel) { ((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_cantaddmore", new string[1] { "fuel" }), 0, (Sprite)null); } else { if (item.IsWeapon()) { user.UnequipItem(item, true); } Inventory inventory = user.GetInventory(); string text2 = ((num2 > 1) ? $"{num2}x " : ""); ((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_fireadding", new string[1] { text2 + item.m_shared.m_name }), 0, (Sprite)null); inventory.RemoveItem(item, num2); if (num4 >= 1f) { ___m_nview.InvokeRPC("RPC_AddFuel", Array.Empty()); } else { __instance.AddFuel(num4); } if (num3 > 0) { WUTIL.Spawn("PebbleRough", ((Component)__instance).transform.position + 0.3f * Vector3.up, Quaternion.identity, 1, num3); } } __result = true; return false; } } [HarmonyPatch(typeof(Chair), "Interact")] private class PatchChairInteract { private static Vector3 c_futonHighWildling = new Vector3(0f, 0.17f, 0f); private static Vector3 c_futonCenterWildling = new Vector3(0.34f, 0.38f, -0.1f); private static Vector3 c_futonCenterGrownup = new Vector3(0.13f, 0.38f, -0.2f); private static Vector3 c_raftOffsetWildling = new Vector3(-0.78f, -0.12f, 0.25f); private static Vector3 c_mastOffsetWildling = new Vector3(-0.8f, -0.12f, 0.2f); private static Vector3 c_chairOffsetWildling = new Vector3(0f, 0.12f, 0.1f); private static Vector3 c_throneOffsetWildling = new Vector3(0f, 0.15f, 0f); private static bool m_resetAttach = false; private static Vector3 m_origAttachPoint = Vector3.zero; public static bool Prefix(Chair __instance, Humanoid human, bool hold) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) m_resetAttach = false; if (hold || !((Character)human).IsPlayer() || ((Character)human).IsAttached()) { return true; } if (!ChairSitEnabled(__instance)) { return false; } m_origAttachPoint = __instance.m_attachPoint.localPosition; m_resetAttach = Wildling.IsWildling; WDBUG.Log("Sitting on " + ((Object)((Component)__instance).gameObject).name, WDBUG.Level.World); switch (((Object)((Component)__instance).gameObject).name) { case "FutonSitHigh": if (m_resetAttach) { Transform attachPoint3 = __instance.m_attachPoint; attachPoint3.localPosition += c_futonHighWildling; } break; case "FutonSitCenter": __instance.m_attachPoint.localPosition = (m_resetAttach ? c_futonCenterWildling : c_futonCenterGrownup); m_resetAttach = true; break; case "mast": if (m_resetAttach) { Transform attachPoint2 = __instance.m_attachPoint; attachPoint2.localPosition += ((WUTIL.GameName(((Component)__instance).transform) == "Raft") ? c_raftOffsetWildling : c_mastOffsetWildling); } break; case "$piece_throne01": case "$piece_stonethrone": if (m_resetAttach) { Transform attachPoint4 = __instance.m_attachPoint; attachPoint4.localPosition += c_throneOffsetWildling; } break; default: if (m_lastSeatWildling) { m_resetAttach = false; } else if (m_resetAttach) { Transform attachPoint = __instance.m_attachPoint; attachPoint.localPosition += c_chairOffsetWildling; } break; } WDBUG.Log($"Chair attachPoint {m_origAttachPoint} -> {__instance.m_attachPoint.localPosition}", WDBUG.Level.World); return true; } public static void Postfix(Chair __instance, Humanoid human, bool hold) { //IL_0065: 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_006f: 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_0037: 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) if (hold || !((Character)human).IsPlayer() || __instance.GetHoverText() != "" || !ChairSitEnabled(__instance) || Vector3.Distance(((Component)human).transform.position, __instance.m_attachPoint.position) >= __instance.m_useDistance) { if (m_resetAttach) { Transform attachPoint = __instance.m_attachPoint; attachPoint.localPosition += c_mastOffsetWildling; } return; } if (((Object)((Component)__instance).gameObject).name.StartsWith("Futon")) { Flight.DisableColliders((Character)(object)human, ((Component)__instance).transform); if (((Object)((Component)__instance).gameObject).name == "FutonRecline") { human.UnequipItem(WUTIL.GetRightItem(human), true); human.UnequipItem(WUTIL.GetLeftItem(human), true); } } if (m_resetAttach) { Flight.ResetUprightOnMove(((Component)__instance).transform, m_origAttachPoint); } } } [HarmonyPatch(typeof(Chair), "GetHoverText")] private class PatchChairGetHoverText { public static bool Prefix(Chair __instance, ref string __result) { if (ChairSitEnabled(__instance)) { return true; } __result = ((Wildling.IsWildling || ((Object)((Component)__instance).gameObject).name.StartsWith("Futon")) ? "" : "Cannot use"); return false; } } [HarmonyPatch(typeof(Player), "Repair")] public class PatchPlayerRepair { public static void Prefix(Player __instance, Piece repairPiece) { m_allowNextVanillaRepair = ((Character)__instance).InPlaceMode() && WUTIL.GameName(((Component)repairPiece).gameObject) == "Repair" && !ZoneSystem.instance.GetGlobalKey((GlobalKeys)22); } } [HarmonyPatch(typeof(Player), "CheckCanRemovePiece")] public class PatchPlayerCheckCanRemovePiece { public static bool Prefix(Player __instance, Piece piece, ref bool __result) { CheckExtendRange(piece); if (m_allowNextVanillaRepair) { m_allowNextVanillaRepair = false; if (!CheckCanRemovePiece(__instance, piece) && CheckCanRemovePiece(__instance, piece, "Making table")) { __result = true; return false; } } return true; } private static bool CheckCanRemovePiece(Player player, Piece piece, string craftingStation = "") { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)piece.m_craftingStation == (Object)null) { return true; } WearNTear component = ((Component)piece).gameObject.GetComponent(); if ((Object)(object)component == (Object)null || (int)component.m_materialType > 0) { return false; } if (craftingStation == "") { craftingStation = piece.m_craftingStation.m_name; } WDBUG.Log("Checking override Repair of " + WUTIL.GameName(((Component)piece).gameObject) + " at " + craftingStation, WDBUG.Level.World); return (Object)(object)piece.m_craftingStation == (Object)null || Object.op_Implicit((Object)(object)CraftingStation.HaveBuildStationInRange(craftingStation, ((Component)player).transform.position)); } } [HarmonyPatch(typeof(Player), "HaveRequirements", new Type[] { typeof(Piece), typeof(RequirementMode) })] public class PatchPlayerHaveRequirements { public static void Prefix(Piece piece, RequirementMode mode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)mode == 0) { CheckExtendRange(piece); } } } [HarmonyPatch(typeof(Hud), "SetupPieceInfo")] public class PatchHudSetupPieceInfo { public static void Prefix(Piece piece) { CheckExtendRange(piece); } } [HarmonyPatch(typeof(CraftingStation), "HaveBuildStationInRange")] public class PatchCraftingStationHaveBuildStationInRange { public static void Postfix(string name, Vector3 point, ref CraftingStation __result) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (m_allowNextBuildStationCheck) { m_allowNextBuildStationCheck = false; if ((Object)(object)__result == (Object)null && Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(point, (Type)4, 0f))) { __result = CraftingStation.FindClosestStationInRange(name, point, 200f); } } } } [HarmonyPatch(typeof(WearNTear), "OnPlaced")] public class PatchWearNTearOnPlaced { private static bool m_ignoreOnPlaced; public static void Postfix(WearNTear __instance) { //IL_004e: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)__instance) || m_ignoreOnPlaced || !WUTIL.IsWildlingObject(((Component)__instance).gameObject)) { return; } string text = WUTIL.GameName(((Component)__instance).gameObject); switch (text) { case "MatchPlaced": WDBUG.Log($"Placed {text} at {((Component)__instance).transform.position}", WDBUG.Level.MapMarker); MapMarker.AddPin(((Component)__instance).transform.position, "MatchPlaced"); if (WUTIL.GetButton("Sit")) { UpdateSafePoint(reset: false, checkSafe: false); } break; case "ToolShelf": WDBUG.Log("Placed " + text, WDBUG.Level.Treehouse); PlaceAttachPoint(((Component)__instance).transform, "top", "attach_edge"); PlaceAttachPoint(((Component)__instance).transform, "top2", "attach_edge"); PlaceAttachPoint(((Component)__instance).transform, "mid", "attach_edge2"); PlaceAttachPoint(((Component)__instance).transform, "mid2", "attach_base"); PlaceAttachPoint(((Component)__instance).transform, "mid3", "attach_edge2"); PlaceAttachPoint(((Component)__instance).transform, "base", "attach_base"); PlaceAttachPoint(((Component)__instance).transform, "base2", "attach_base"); break; case "BedrollPlaced": UpdateSafePoint(reset: false, checkSafe: false, startTemple: false, isBed: true); break; default: if (text.StartsWith("Campsite")) { m_ignoreOnPlaced = true; Transform transform = ((Component)__instance).transform; WUTIL.PlacePiece("Tepee", transform.position, transform.rotation); Transform val = transform.Find("bedroll"); if ((Object)(object)val != (Object)null) { WUTIL.PlacePiece("BedrollPlaced", ((Component)val).transform.position, ((Component)val).transform.rotation); } val = transform.Find("firepit"); if ((Object)(object)val != (Object)null) { WUTIL.Spawn("tepee_flatten", 0.5f * (((Component)val).transform.position + transform.position), transform.rotation); WUTIL.PlacePiece("FirePit", ((Component)val).transform.position, ((Component)val).transform.rotation); } else { WUTIL.Spawn("Wood", transform.position + Vector3.up, transform.rotation); WUTIL.Spawn("Stone", transform.position + Vector3.up, transform.rotation, 3); } val = transform.Find("spit"); if ((Object)(object)val != (Object)null) { WUTIL.PlacePiece("Spit", ((Component)val).transform.position, ((Component)val).transform.rotation); } else if (!text.EndsWith("1")) { WUTIL.Spawn("Wood", transform.position + Vector3.up, transform.rotation); } val = transform.Find("cookpot"); if ((Object)(object)val != (Object)null) { WUTIL.PlacePiece("Cookpot", ((Component)val).transform.position, ((Component)val).transform.rotation); } val = transform.Find("coalfire"); if ((Object)(object)val != (Object)null) { WUTIL.PlacePiece("FirePlinthCoal", ((Component)val).transform.position, ((Component)val).transform.rotation); } WUTIL.Destroy(((Component)__instance).gameObject); UpdateSafePoint(reset: false, checkSafe: false, startTemple: false, isBed: true); } break; } Quest.TrackPlacement(text); } private static void PlaceAttachPoint(Transform parent, string target, string stand) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Transform val = parent.Find("attach " + target); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to get attach " + target); } else if ((Object)(object)WUTIL.Spawn(stand, val.position, val.rotation) != (Object)null) { WDBUG.Log("Added " + stand + " to attach " + target, WDBUG.Level.Treehouse); } } } [HarmonyPatch(typeof(Piece), "DropResources")] private class PatchPieceDropResources { public static bool Prefix(Piece __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.GameName(((Component)__instance).gameObject); switch (text) { case "MatchPlaced": WDBUG.Log(text + " destroyed, tagged map pin for removal", WDBUG.Level.MapMarker); MapMarker.TagForRemovalByPosition(((Component)__instance).transform.position); break; case "TreePortal": MapMarker.TagForRemovalByPosition(((Component)__instance).transform.position); break; case "ToolShelf": DestroyToolShelfStands(__instance); break; default: if (!(text == "fire_pit")) { break; } goto case "FirePit"; case "FirePit": { WDBUG.Log("Destroyed fire pit", WDBUG.Level.Treehouse); Fireplace component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log(text + " has no Fireplace", WDBUG.Level.Treehouse); return true; } if (component.IsBurning()) { WDBUG.Log("No coal from burning fire", WDBUG.Level.Treehouse); return true; } Vector3 position = ((Component)__instance).transform.position; Collider[] array = Physics.OverlapSphere(position, 0.4f, WUTIL.c_pieceRayMask); foreach (Collider val in array) { Transform val2 = WUTIL.BaseTransform(((Component)val).transform); if (position.y > val2.position.y && WUTIL.GameName(((Component)val2).gameObject) == "FirePlinth") { if (WUTIL.TestLuck(0.7f)) { WDBUG.Log("Added coal to FirePlinth from dead fire", WDBUG.Level.Treehouse); position.y += 0.5f; WUTIL.Spawn("Coal", position, val2.rotation); } else { WDBUG.Log("Unlucky with FirePlinth free coal.", WDBUG.Level.Treehouse); } break; } } break; } } return true; } private static void DestroyToolShelfStands(Piece toolshelf) { WDBUG.Log("Destroying ToolShelf stands"); string[] array = "top,top2,mid,mid2,mid3,base,base2".Split(new char[1] { ',' }); foreach (string target in array) { DestroyAttachPoint(((Component)toolshelf).transform, target); } } private static void DestroyAttachPoint(Transform parent, string target) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) Transform val = parent.Find("attach " + target); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to get attach " + target); return; } Collider[] array = Physics.OverlapSphere(val.position, 0.1f, WUTIL.c_pieceRayMask); foreach (Collider val2 in array) { Transform val3 = (((Object)(object)((Component)val2).transform.parent == (Object)null) ? ((Component)val2).transform : ((Component)val2).transform.parent); GameObject gameObject = ((Component)val3).gameObject; string text = WUTIL.GameName(gameObject); if (text.StartsWith("attach_")) { ItemStand component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null && component.HaveAttachment()) { WDBUG.Log("Dropping attached item and destroying " + text, WDBUG.Level.Treehouse); component.Interact((Humanoid)(object)Player.m_localPlayer, false, false); } else { WDBUG.Log("Destroying " + text, WDBUG.Level.Treehouse); } WUTIL.Destroy(gameObject); } } } } [HarmonyPatch(typeof(ItemStand), "Awake")] private class PatchItemStandAwake { public static void Postfix(ItemStand __instance) { UpdateHungTrophies(__instance); } } [HarmonyPatch(typeof(ItemStand), "CanAttach")] public class PatchItemStandCanAttach { public static void Postfix(ItemStand __instance, ItemData item, ref bool __result) { if (__result && BlockAttach(__instance, item)) { __result = false; } } } [HarmonyPatch(typeof(ItemStand), "SetVisualItem")] private class PatchItemStandSetVisualItem { public static bool Prefix(ItemStand __instance, string itemName, GameObject ___m_visualItem) { return itemName != "Wildling_FancyJacket"; } public static void Postfix(ItemStand __instance, string itemName, GameObject ___m_visualItem) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Invalid comparison between Unknown and I4 //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) if (!(WUTIL.GameName(((Component)__instance).gameObject) == "SharpenedStickPlaced")) { return; } Transform val = ((Component)__instance).transform.Find("PlayerBase"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(__instance.HaveAttachment()); } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(itemName); ItemDrop val2 = ((itemPrefab != null) ? itemPrefab.GetComponent() : null); if (!((Object)(object)val2 != (Object)null)) { return; } string text = WUTIL.ItemName(val2, goName: true); if ((int)val2.m_itemData.m_shared.m_itemType == 6 || text.StartsWith("Mushroom")) { Transform val3 = ((Component)__instance).transform.Find("attach_helm"); if ((Object)(object)val3 != (Object)null && (Object)(object)___m_visualItem != (Object)null) { ___m_visualItem.transform.position = ((Component)val3).transform.position; ___m_visualItem.transform.rotation = ((Component)val3).transform.rotation; } return; } Vector3 position = ((Component)__instance).transform.Find("attach_other").position; Vector3 forward = ___m_visualItem.transform.forward; switch (text) { case "TrophyGreydwarf": case "TrophyGreydwarfBrute": case "TrophyGreydwarfShaman": ___m_visualItem.transform.position = position + 0.04f * forward; break; case "TrophyBjorn": case "TrophyUnbjorn": { Transform val4 = ((Component)__instance).transform.Find("attach_large"); if (Object.op_Implicit((Object)(object)val4)) { ___m_visualItem.transform.position = ((Component)val4).transform.position; } break; } } } } [HarmonyPatch(typeof(ItemStand), "Interact")] public class PatchItemStandInteract { private static string m_dummy = ""; public static bool Prefix(ItemStand __instance, Humanoid user, bool hold) { if (hold || (Object)(object)user != (Object)(object)Player.m_localPlayer) { return true; } if (__instance.HaveAttachment()) { if (MountainDungeon.CheckItemstandGift(__instance)) { return false; } } else { if ((Object)(object)__instance.m_guardianPower != (Object)null) { return !Quest.CheckGaurdianPowerReset(__instance, ref m_dummy, activate: true); } ItemData autoattachItem = GetAutoattachItem(__instance); if (autoattachItem != null) { __instance.UseItem(user, autoattachItem); } } return true; } public static void Postfix(ItemStand __instance, bool hold, ref bool __result) { if ((hold | __result) || __instance.HaveAttachment()) { UpdateHungTrophies(__instance); return; } ItemData autoattachItem = GetAutoattachItem(__instance); if (autoattachItem != null) { __result = true; } } } [HarmonyPatch(typeof(WearNTear), "GetMaterialProperties")] public class PatchWearNTearGetMaterialProperties { public static void Postfix(WearNTear __instance, ref float minSupport, ref float horizontalLoss) { switch (WUTIL.GameName(((Component)__instance).gameObject)) { case "TreehouseBridge": case "TreehouseConnector": horizontalLoss = 0.1f; break; case "TreehouseStairsLeft": case "TreehouseStairsRight": horizontalLoss = 1f / 7f; break; case "Cookpot": case "FirePlinth": case "FirePlinthCoal": minSupport = 10f; break; } } } [HarmonyPatch(typeof(WearNTear), "Destroy")] public class PatchWearNTearDestroy { public static void Prefix(WearNTear __instance, ZNetView ___m_nview) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) if (Wildling.IsWildling && WUTIL.GameName(((Component)__instance).gameObject) == "Raft") { WDBUG.Log("Reset rafts for wildling", WDBUG.Level.Tracking); Quest.SetAchievement("RaftsPlaced", 0); } else { if (!IsWildlingBed(((Component)__instance).gameObject)) { return; } TrackBedPositions(((Component)__instance).gameObject, untrack: true); Bed component = ((Component)__instance).gameObject.GetComponent(); if ((Object)(object)component == (Object)null || !component.IsCurrent()) { return; } float num = 99999f; int playerDataInt = Wildling.GetPlayerDataInt("BedCount"); int num2 = playerDataInt; for (int i = 0; i < playerDataInt; i++) { Vector3 playerDataVector = Wildling.GetPlayerDataVector3("Bed" + i); float num3 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, playerDataVector); if (num3 < num) { num = num3; num2 = i; } } if (num2 == playerDataInt) { WUTIL.Message("You no longer have a bed", center: false); return; } WDBUG.Log($"Reclaim bed Bed{num2} pos at {num}m away", WDBUG.Level.Tracking); Game.instance.GetPlayerProfile().SetCustomSpawnPoint(Wildling.GetPlayerDataVector3("Bed" + num2)); WUTIL.Message("Reclaimed distant bed", center: false); } } } [HarmonyPatch(typeof(RandEventSystem), "SetRandomEvent")] public class PatchRandEventSystemSetRandomEvent { public static bool Prefix(RandomEvent ev, Vector3 pos) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) if (!Wildling.IsWildling || ev == null || !ev.m_enabled) { return true; } bool flag = Vector3.Distance(pos, ((Component)Player.m_localPlayer).transform.position) <= 40f; if (flag) { int num = TrophiesHeldOrHungNearby(); float num2 = (((num & 1) > 0) ? 0.1f : 0f); switch (ev.m_name) { case "skeletons": if ((num & 2) > 0) { num2 += 0.3f; } if ((num & 4) > 0) { num2 += 0.6f; } break; case "army_eikthyr": num2 = (((num & 8) > 0 || Quest.GetAchievement("BoundYgnie") == 1) ? 1f : (0.05f + 0.2f * Wildling.SkillFactor((SkillType)0) + 0.1f * (float)Quest.GetAchievement("QuestEikthyr"))); break; case "foresttrolls": case "army_theelder": num2 = (((num & 8) > 0 || Quest.GetAchievement("ElderLight") == 1) ? 1f : (0.25f * Wildling.SkillFactor((SkillType)0) + 0.1f * (float)Quest.GetAchievement("QuestElder"))); break; case "blobs": case "army_bonemass": if ((num & 2) > 0) { num2 += 0.1f; } if ((num & 4) > 0) { num2 += 0.5f; } break; case "surtlings": if ((num & 4) > 0) { num2 += 0.5f; } if ((num & 8) > 0) { num2 += 0.5f; } break; case "bats": case "wolves": case "army_moder": if ((num & 8) > 0) { num2 += 0.4f; } if ((num & 0x10) > 0) { num2 += 0.4f; } break; case "army_goblin": if ((num & 0x10) > 0) { num2 += 0.9f; } break; } flag = WUTIL.TestLuck(num2); WDBUG.Log($"Nearby event {ev.m_name} in {ev.m_biome} halted: {flag}", WDBUG.Level.World); } else { WDBUG.Log($"Detected distance event {ev.m_name} in {ev.m_biome} at {pos}", WDBUG.Level.World); } return !flag; } } [HarmonyPatch(typeof(Hud), "UpdateCrosshair")] private class PatchHudUpdateCrosshair { public static bool Prefix(Player player, float bowDrawPercentage) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)(object)Player.m_localPlayer && bowDrawPercentage <= 0f) { if (ElderWand.UpdateHoverReport() || Alignment.UpdateHoverReport()) { return false; } GameObject val = ((Humanoid)player).GetHoverObject(); if ((Object)(object)val == (Object)null) { return true; } while ((Object)(object)val.transform.parent != (Object)null) { val = ((Component)val.transform.parent).gameObject; } string text = WUTIL.GameName(val); if (text == "Beehive") { if (Vector3.Distance(val.transform.position, ((Component)player).transform.position) < 2.5f && Quest.GetAchievement("HoneyTaken") == 0) { WUTIL.Message(WUTIL.KeyHighlightText("Use") + " to check for honey", center: false); } } else if (text == "Piece_CoffinGlass") { ((TMP_Text)Hud.instance.m_hoverName).text = "A crystal covered coffin.\nLikely the resting place of someone important."; return false; } } return true; } } [HarmonyPatch(typeof(Game), "RPC_DiscoverClosestLocation")] private class PatchGameRPC_DiscoverClosestLocation { private static bool Prefix(long sender, string name, Vector3 point, string pinName, int pinType) { //IL_0079: 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_00b2: 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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && pinName.StartsWith("WildlingBroadcast:")) { if (!ZNet.instance.IsServer()) { WDBUG.Log("Non-server ignored request " + pinName); return true; } pinName = pinName.Substring("WildlingBroadcast:".Length); switch (name) { case "Portal": if (TreePortal.CreatePortalPair(point, pinName)) { WDBUG.Log("Sending Portal Marker request"); ResponseRPC(sender, point, "Marker"); ResponseRPC(sender, TreePortal.m_teleportToPos, "Marker"); } return false; case "Status": { string data = (Riding.IsRidingFairy() ? "Fairy" : (Wildling.IsWildling ? "Wildling" : "Adult")); ResponseRPC(sender, point, Player.m_localPlayer.GetPlayerName(), data, '$'); WDBUG.Log("Server broadcast " + name + ": " + pinName, WDBUG.Level.Multiplayer); ResponseRPC(ZNetView.Everybody, point, pinName); return false; } case "Locate": ResponseRPC(sender, point, pinName, EncodeLocations(pinName), '@'); return false; case "Unique": if (GetUniquePosition(pinName, ref point)) { ResponseRPC(sender, point, name, pinName); } else { WDBUG.Log("Server does not have unique " + pinName + " position ready"); } return false; default: Place.GetCapturedPieceData(pinName, name, ref point); WDBUG.Log($"Server broadcast {name}: {pinName} at {point} ({pinType})", WDBUG.Level.Multiplayer); ResponseRPC(ZNetView.Everybody, point, name, pinName); return false; } } return true; } private static void ResponseRPC(long sender, Vector3 point, string target, string data = "", char sep = ',', int pinType = 0) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (data != "") { target = target + sep + data; } ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RPC_DiscoverLocationResponse", new object[4] { "WildlingBroadcast:" + target, pinType, point, false }); } } [HarmonyPatch(typeof(Game), "RPC_DiscoverLocationResponse")] private class PatchGameRPC_DiscoverLocationResponse { private static bool Prefix(string pinName, int pinType, Vector3 pos) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Player.m_localPlayer) && pinName.StartsWith("WildlingBroadcast:")) { pinName = pinName.Substring("WildlingBroadcast:".Length); int num = pinName.IndexOf('@'); if (num > 0) { AddLocations(pinName.Remove(num), pinName.Substring(num + 1)); return false; } num = pinName.IndexOf('$'); if (num > 0) { Wildling.CheckOtherPlayer(pinName.Remove(num), pinName.Substring(num + 1)); return false; } num = pinName.IndexOf(','); if (num <= 0) { if (pinName == "Marker") { MapMarker.MarkMap(pos); return false; } WDBUG.Log("Local player ignoring unexpected msg: " + pinName); return false; } WDBUG.Log($"Local player recieved: {pinName} @ {pos} ({pinType})", WDBUG.Level.Multiplayer); string text = pinName.Remove(num); pinName = pinName.Substring(num + 1); switch (text) { case "Trigger": MountainDungeon.PieceInteract(pinName, pos); break; case "SetRot": Place.SetRotation(pinName, pos); break; case "SetPos": Place.SetPosition(pinName, pos); break; case "Marker": MapMarker.MarkMap(pos, pinName); break; case "Unique": if (ZNet.instance.IsServer()) { WDBUG.Log("Server ignored " + text + " request: " + pinName, WDBUG.Level.Multiplayer); } else { SetUniquePosition(pinName, pos); } break; default: WDBUG.Log("Local player ignored unknown RPC action: " + text); break; } return false; } return true; } } [HarmonyPatch(typeof(Pickable), "RPC_Pick")] private class PatchPickableRPC_Pick { private static void Prefix(Pickable __instance) { if (WUTIL.GameName(((Component)__instance).gameObject) == "Pickable_pebbles") { __instance.m_dontScale = true; } } } [HarmonyPatch(typeof(EnvMan), "SetForceEnvironment")] public class PatchEnvManSetForceEnvironment { private static bool underWater = false; private static bool resetInterp = false; private static bool revertPostfix = false; private static float m_fogDensityDay = 0f; private static float m_fogDensityNight = 0f; private static float m_lightIntensityDay = 0f; private static float m_lightIntensityNight = 0f; private static string m_forceEnv = ""; private static Color m_fogColorDay = Color.white; private static Color m_ambColorDay = Color.white; private static Color m_fogColorNight = Color.white; private static Color m_ambColorNight = Color.white; private static Color m_underWaterFogColor = new Color(0.3f, 0.6f, 0.4f); private static Color m_underWaterAmbColor = new Color(0.1f, 0.1f, 0.3f); public static void Prefix(ref string env, ref string ___m_forceEnv) { if (env == "WildlingUnderwater" || env == "WildlingOverwater") { resetInterp = env == "WildlingOverwater"; WDBUG.Log("Forcing environment reset to " + env + " (foreceEnv: " + ___m_forceEnv + ")", WDBUG.Level.World); WUTIL.TimerReset("block_next_log_warning", 0.1f); m_forceEnv = ___m_forceEnv; ___m_forceEnv = env; env = ""; revertPostfix = true; PatchEnvManInterpolateEnvironment.disable = true; PatchEnvManUpdateEnvironment.disable = true; SetUnderwaterEnv(resetInterp); } } public static void Postfix(ref string ___m_forceEnv) { if (revertPostfix) { if (resetInterp) { PatchEnvManInterpolateEnvironment.disable = false; PatchEnvManUpdateEnvironment.disable = false; ReflectionUpdate.instance.m_transitionDuration = 0.1f; } ___m_forceEnv = m_forceEnv; revertPostfix = (resetInterp = false); } } private static void SetUnderwaterEnv(bool reset = false, bool force = false) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (reset) { if (underWater || force) { underWater = false; EnvSetup currentEnvironment = EnvMan.instance.GetCurrentEnvironment(); currentEnvironment.m_fogDensityDay = m_fogDensityDay; currentEnvironment.m_fogDensityNight = m_fogDensityNight; currentEnvironment.m_fogColorDay = m_fogColorDay; currentEnvironment.m_fogColorNight = m_fogColorNight; currentEnvironment.m_lightIntensityDay = m_lightIntensityDay; currentEnvironment.m_lightIntensityNight = m_lightIntensityNight; currentEnvironment.m_ambColorDay = m_ambColorDay; currentEnvironment.m_ambColorNight = m_ambColorNight; } } else if (!underWater || force) { underWater = true; EnvSetup currentEnvironment2 = EnvMan.instance.GetCurrentEnvironment(); m_fogColorDay = currentEnvironment2.m_fogColorDay; m_ambColorDay = currentEnvironment2.m_ambColorDay; m_fogColorNight = currentEnvironment2.m_fogColorNight; m_ambColorNight = currentEnvironment2.m_ambColorNight; m_fogDensityDay = currentEnvironment2.m_fogDensityDay; m_fogDensityNight = currentEnvironment2.m_fogDensityNight; m_lightIntensityDay = currentEnvironment2.m_lightIntensityDay; m_lightIntensityNight = currentEnvironment2.m_lightIntensityNight; currentEnvironment2.m_fogColorDay = m_underWaterFogColor; currentEnvironment2.m_ambColorDay = m_underWaterAmbColor; currentEnvironment2.m_fogColorNight = m_underWaterFogColor; currentEnvironment2.m_ambColorNight = m_underWaterAmbColor; currentEnvironment2.m_fogDensityDay = 0.06f; currentEnvironment2.m_fogDensityNight = 0.06f; currentEnvironment2.m_lightIntensityDay *= 0.3f; currentEnvironment2.m_lightIntensityNight *= 0.3f; } } } [HarmonyPatch(typeof(EnvMan), "InterpolateEnvironment", new Type[] { typeof(float) })] public class PatchEnvManInterpolateEnvironment { public static bool disable; public static bool Prefix(ref float ___m_transitionTimer) { if (disable) { ___m_transitionTimer = 1f; } return !disable; } } [HarmonyPatch(typeof(EnvMan), "UpdateEnvironment")] public class PatchEnvManUpdateEnvironment { public static bool disable; public static bool Prefix() { return !disable; } } [HarmonyPatch(typeof(ReflectionUpdate), "Update")] public class PatchReflectionUpdateUpdate { public static void Postfix() { if (ReflectionUpdate.instance.m_transitionDuration < 1f) { ReflectionUpdate.instance.m_transitionDuration = 3f; } } } [HarmonyPatch(typeof(TreeBase), "Awake")] public class PatchTreeBaseAwake { public static void Postfix(TreeBase __instance) { //IL_000c: 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) if (!m_trackedTrees.ContainsKey(((Component)__instance).transform.position)) { m_trackedTrees.Add(((Component)__instance).transform.position, null); } } } [HarmonyPatch(typeof(WearNTear), "UpdateWear")] public class PatchWearNTearUpdateWear { public static void Postfix(WearNTear __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown if (WUTIL.GameName(((Component)__instance).gameObject) == "GlowLight") { if (m_elderSightActive) { __instance.Repair(); return; } __instance.Damage(new HitData { m_damage = { m_damage = WUTIL.RandomSpin(20f, 50f) } }); } } } [HarmonyPatch(typeof(Piece), "Awake")] public class PatchPieceAwake { public static void Postfix(Piece __instance) { if (WUTIL.GameName(((Component)__instance).gameObject) == "Shipwreck") { CustomizeShipwreck(((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(Inventory), "MoveItemToThis", new Type[] { typeof(Inventory), typeof(ItemData) })] private class PatchInventoryMoveItemToThis_Stack { private static void Postfix(Inventory __instance, ItemData item) { if ((Object)(object)Player.m_localPlayer != (Object)null && __instance == ((Humanoid)Player.m_localPlayer).GetInventory()) { TakeSunkenTreasure(item); } } } [HarmonyPatch(typeof(Inventory), "MoveItemToThis", new Type[] { typeof(Inventory), typeof(ItemData), typeof(int), typeof(int), typeof(int) })] private class PatchInventoryMoveItemToThis_Split { private static void Postfix(Inventory __instance, ItemData item, int amount, bool __result) { if (__result && (Object)(object)Player.m_localPlayer != (Object)null && __instance == ((Humanoid)Player.m_localPlayer).GetInventory()) { TakeSunkenTreasure(item, amount); } } } public const int c_locationRouteClosest = 0; public const int c_locationRouteAccessible = 1; public const int c_locationRouteHighest = 2; public const int c_locationRouteFirst = 3; public const string WBroadcast = "WildlingBroadcast:"; public static bool m_locationUnsafe = false; public static bool m_lastPlacedBed = false; public static bool m_isRaining = false; public static int m_dungeonEnvironment = 0; public static string m_environment = ""; public static Vector3 m_lastSafePosition = Vector3.zero; public static Vector3 m_prevSafePosition = Vector3.zero; private const int c_maxLocalRabbits = 20; private const float c_localSpawnCooldownDay = 20f; private const float c_localSpawnCooldownNight = 60f; private const float c_safePointCheckCooldown = 10f; private const float c_minSafePosSeparation = 15f; private const float c_minSafeBedSeparation = 50f; private const float c_minRaftFindSkill = 0.17f; private const float c_sunkenChestMinDepth = 12f; private const float c_sunkenChestMidDepth = 18f; private const float c_sunkenWreckMinDepth = 24f; private const float c_sunkenWreckMidDepth = 34f; private const float c_sunkenChestMaxDepth = 42f; private const float c_sunkenChestGridSize = 64f; private const float c_sunkenPlacementRadius = 26f; private const float c_sunkenChestLongTick = 30f; private const float c_sunkenChestShortTick = 5f; private const float c_sunkenChestPingDist = 20f; private const float c_sunkenWreckPingDist = 48f; private const float c_coldballExplodeVelocity = -18f; private const float c_underwaterEnvSwitchDepth = 2f; private const string WOverwater = "WildlingOverwater"; private const string WUnderwater = "WildlingUnderwater"; private static Dictionary c_trophies = new Dictionary { { "RabbitFoot", 1 }, { "RatTail", 2 }, { "RatTailDraugr", 4 }, { "BoratTrophy", 8 }, { "GoblinPrinceTrophy", 16 } }; private static bool m_elderSightActive = false; private static float m_playerNoEnemyRange = 15f; private static float m_playerNearBaseRange = 15f; private static float m_localSpawnCooldown = 5f; private static float m_checkPickablePebblesCooldown = 0f; private static string m_lastWeather = ""; private static string m_prevWeather = ""; private static Vector3 m_lastSunkenChestPos = Vector3.zero; private static List m_droppedItems = new List(); private static List m_routedLocations = new List(); private const int c_base = 100; private const int c_endo = 27; private const int c_ceno = 5000; private static Dictionary m_uniqueSites = new Dictionary(); private static Dictionary> m_locationSites = new Dictionary>(); private const int c_envOutside = 0; private const int c_envSnake = 1; private const int c_envCrypt = 2; private const int c_envSewers = 3; private const int c_envGreatOak = 4; private const int c_envCave = 5; private static bool m_haveStartPosition = false; private static bool m_lastSeatWildling = false; private static Vector3 m_startPositon = Vector3.zero; private static List m_path = new List(); private static List m_deferredActorDestroy = new List(); private static List m_sunkenChests = new List(); private static List m_lostShipwrecks = new List(); private static Dictionary m_hungTrophies = new Dictionary(); private static float m_groundBaseHeight = 0f; private static bool m_allowNextVanillaRepair = false; private static bool m_allowNextBuildStationCheck = false; private static Dictionary m_trackedTrees = new Dictionary(); public static void ResetBuildMode(int mode = -1) { ForestDungeon.ResetBuildMode(mode); SwampDungeon.ResetBuildMode(mode); MountainDungeon.ResetBuildMode(mode); } public static void Update(float dt) { if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } if (((Character)Player.m_localPlayer).IsTeleporting()) { ResetBuildMode(); return; } if (m_deferredActorDestroy.Count > 0) { for (int i = 0; i < m_deferredActorDestroy.Count; i++) { if ((Object)(object)m_deferredActorDestroy[i] != (Object)null && (Object)(object)((Component)m_deferredActorDestroy[i]).gameObject != (Object)null) { WUTIL.Destroy(((Component)m_deferredActorDestroy[i]).gameObject); } } m_deferredActorDestroy.Clear(); } CheckEnvironnment(); m_localSpawnCooldown -= dt; if (m_localSpawnCooldown <= 0f) { m_localSpawnCooldown = (EnvMan.IsDaylight() ? 20f : 60f); if (!PlayerInInterior()) { SpawnLocalRabbit(); CheckLocationSpawners(); } } switch (m_dungeonEnvironment) { case 0: UpdateWorldPieces(dt); break; case 3: Place.UpdateSidedoors(dt); break; } UpdateSafePoint(); UpdateGlowSites(); UpdateDroppedItems(dt); } public static bool PlayerInInterior() { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return false; } return MountainDungeon.PlayerInside() || ((Character)Player.m_localPlayer).InInterior(); } public static bool IsSafePosition(ref Vector3 position, bool forPlayer = true, bool checkMonsters = true, bool debug = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (!Physics.Raycast(position, Vector3.down, ref val, 9999f, WUTIL.c_terrainRayMask)) { if (debug) { WDBUG.Log($"Raycast failed @{position}"); } return false; } if (((RaycastHit)(ref val)).point.y < ZoneSystem.instance.m_waterLevel) { if (debug) { WDBUG.Log("Position is below water"); } return false; } position.y = ((RaycastHit)(ref val)).point.y; if (Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(position, (Type)4, m_playerNearBaseRange))) { if (debug && !forPlayer) { WDBUG.Log("Position too close to a player base"); } return forPlayer; } if (Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(position, (Type)2, 2f))) { if (debug) { WDBUG.Log("Position is too close to fire"); } return false; } if (checkMonsters && Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(position, (Type)32, m_playerNoEnemyRange))) { if (debug) { WDBUG.Log("Position is too close to a monster"); } return false; } return true; } public static void UpdateSafePoint(bool reset = false, bool checkSafe = true, bool startTemple = false, bool isBed = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Invalid comparison between Unknown and I4 //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Invalid comparison between Unknown and I4 //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Invalid comparison between Unknown and I4 if (startTemple) { m_prevSafePosition = m_lastSafePosition; GetStartPosition(out m_prevSafePosition); m_locationUnsafe = false; return; } if (reset) { m_lastSafePosition = ((Component)Player.m_localPlayer).transform.position; PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); if (playerProfile.HaveCustomSpawnPoint()) { m_prevSafePosition = playerProfile.GetCustomSpawnPoint(); } else { GetStartPosition(out m_prevSafePosition); } m_locationUnsafe = false; WDBUG.Log("Reset last save position", WDBUG.Level.Tracking); return; } Vector3 position = ((Component)Player.m_localPlayer).transform.position; if (checkSafe) { if (((Character)Player.m_localPlayer).IsTeleporting() || WUTIL.Timer("safe_point_check") > 0f) { return; } WUTIL.TimerReset("safe_point_check", 10f); Alignment.UpdateLuckyCharms(); if (PlayerInInterior()) { m_locationUnsafe = true; return; } Biome val = Heightmap.FindBiome(position); Biome val2 = val; if ((int)val2 == 4 || (int)val2 == 32 || (int)val2 == 256) { m_locationUnsafe = true; return; } if (!IsSafePosition(ref position)) { WDBUG.Log("Current location is unsafe", WDBUG.Level.Tracking); m_locationUnsafe = true; return; } } m_locationUnsafe = false; float num = (m_lastPlacedBed ? 50f : 15f); if (!checkSafe || Vector3.Distance(position, m_lastSafePosition) > num) { WDBUG.Log("Updated new safe location", WDBUG.Level.Tracking); m_prevSafePosition = m_lastSafePosition; m_lastSafePosition = position; m_lastPlacedBed = isBed; } else if (isBed) { m_lastPlacedBed = isBed; } } public static Vector3 RecallSafePoint() { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_008f: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) Vector3 position = m_lastSafePosition; if (position == Vector3.zero || !IsSafePosition(ref position)) { WDBUG.Log("Last safe position unsafe", WDBUG.Level.Tracking); if (m_prevSafePosition == Vector3.zero || !IsSafePosition(ref m_prevSafePosition)) { WDBUG.Log("Previous safe position also unsafe - trying bed", WDBUG.Level.Tracking); UpdateSafePoint(reset: true); } position = m_prevSafePosition; } return position; } public static void ClearBedPositions() { int playerDataInt = Wildling.GetPlayerDataInt("BedCount"); for (int i = 0; i < playerDataInt; i++) { WDBUG.Log("Removing Bed" + i); Wildling.DeletePlayerDataVector3("Bed" + i); } Wildling.DeletePlayerData("BedCount"); } public static void TrackBedPositions(GameObject go, bool untrack = false) { //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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) if (!IsWildlingBed(go)) { return; } Bed component = go.GetComponent(); Vector3 spawnPoint = component.GetSpawnPoint(); if (((Vector3)(ref spawnPoint)).magnitude < 2f) { return; } int playerDataInt = Wildling.GetPlayerDataInt("BedCount"); int num = playerDataInt; for (int i = 0; i < playerDataInt; i++) { if (Wildling.GetPlayerDataVector3("Bed" + i) == spawnPoint) { num = i; break; } } if (num == playerDataInt) { if (!untrack) { Wildling.SetPlayerData("BedCount", (float)(playerDataInt + 1)); Wildling.SetPlayerData("Bed" + playerDataInt, spawnPoint); WDBUG.Log($"Recorded Bed{playerDataInt} at {spawnPoint}, count: {playerDataInt}", WDBUG.Level.Tracking); } } else if (untrack) { Wildling.SetPlayerData("BedCount", (float)(--playerDataInt)); if (num < playerDataInt) { Vector3 playerDataVector = Wildling.GetPlayerDataVector3("Bed" + playerDataInt); Wildling.SetPlayerData("Bed" + num, playerDataVector); WDBUG.Log($"Forgot Bed{num} at {spawnPoint} <- Bed{playerDataInt}", WDBUG.Level.Tracking); } else { WDBUG.Log($"Forgot Bed{num} at {spawnPoint}, count: {playerDataInt}", WDBUG.Level.Tracking); } Wildling.DeletePlayerDataVector3("Bed" + playerDataInt); } } public static Character ClosestCharacter(Vector3 position, string matchName = "", float maxDist = 30f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) Character result = null; float num = maxDist + 2f; bool flag = matchName == "player"; Collider[] array = Physics.OverlapSphere(position, maxDist, WUTIL.c_characterRayMask); foreach (Collider val in array) { if (!((Object)(object)val.attachedRigidbody != (Object)null)) { continue; } Character component = ((Component)val.attachedRigidbody).GetComponent(); if (!((Object)(object)component == (Object)null) && !component.IsDead() && (component.IsPlayer() ? flag : WUTIL.ActorName(component).StartsWith(matchName))) { float num2 = Vector3.Distance(((Component)component).transform.position, position); if (num2 < num) { num = num2; result = component; } } } return result; } public static bool GetStartPosition(out Vector3 pos) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004b: Unknown result type (might be due to invalid IL or missing references) if (!m_haveStartPosition) { Vector3 startPositon = default(Vector3); m_haveStartPosition = ZoneSystem.instance.GetLocationIcon(Game.instance.m_StartLocation, ref startPositon); if (m_haveStartPosition) { m_startPositon = startPositon; WDBUG.Log($"Get location for {Game.instance.m_StartLocation} {m_startPositon}", WDBUG.Level.Dungeon); } else { WDBUG.Log($"Get location failed for {Game.instance.m_StartLocation} {m_startPositon}"); } } pos = m_startPositon; return m_haveStartPosition; } public static bool FindClusterLocation(Vector3 fromPoint, string target, ref Vector3 clusterPoint, float maxSep = 500f, float maxDist = 5000f, string marker = "") { //IL_0019: 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_0021: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (Vector3 locationPosition in GetLocationPositions(target)) { if (Vector3.Distance(locationPosition, fromPoint) <= maxDist) { list.Add(locationPosition); } } float num = 0f; int num2 = -1; for (int i = 0; i < list.Count; i++) { float num3 = 0f; int num4 = 0; for (int j = 0; j < list.Count; j++) { if (i == j) { continue; } float num5 = Vector3.Distance(list[i], list[j]); if (!(num5 > maxSep)) { if (num5 > num3) { num3 = num5; } num4++; } } if (num4 > 0) { float num6 = (float)num4 / num3; if (num6 > num) { num = num6; num2 = i; } } } if (num2 < 0) { return false; } int num7 = 0; clusterPoint = Vector3.zero; for (int k = 0; k < list.Count; k++) { if (k == num2) { continue; } float num8 = Vector3.Distance(list[k], list[num2]); if (!(num8 > maxSep)) { num7++; clusterPoint += list[k]; if (marker != "") { MapMarker.AddPin(list[k], marker); } } } clusterPoint /= (float)num7; WDBUG.Log($"FindClusterLocation {num2} neightbors: {num7} density: {num} COM: {clusterPoint}", WDBUG.Level.World); return true; } public static bool FindBestLocation(string targetPrefab, Vector3 fromPoint, out LocationInstance zloc, float maxDistance = 9999f, int routing = 0, string biome = "", string markAll = "") { //IL_0002: 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_0043: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) zloc = default(LocationInstance); bool flag = false; bool flag2 = biome != ""; float num = 0f; float num2 = maxDistance + 1f; foreach (LocationInstance location in ZoneSystem.instance.GetLocationList()) { if (!location.m_location.m_prefabName.StartsWith(targetPrefab) || (flag2 && ((object)Unsafe.As(ref location.m_location.m_biome)/*cast due to .constrained prefix*/).ToString() != biome)) { continue; } float num3 = Vector3.Distance(location.m_position, fromPoint); if (num3 > maxDistance) { continue; } if (markAll != "") { MapMarker.AddPin(location.m_position, markAll); } switch (routing) { case 3: if (!flag) { zloc = location; if (markAll == "") { return flag; } } break; case 2: if (location.m_position.y > num) { zloc = location; num = location.m_position.y; } break; default: if (!(num3 < num2)) { break; } if (routing == 1) { if (!Pathfinding.instance.GetPath(fromPoint, location.m_position, m_path, (AgentType)1, true, false, true)) { Pathfinding.instance.GetPath(fromPoint, location.m_position, m_path, (AgentType)1, false, true, false); } WDBUG.Log($"Pathfinding found site at dist: {num3} with path count: {m_path.Count}"); } zloc = location; num2 = num3; break; } flag = true; } return flag; } public static int CheckLocalPopulation(Vector3 position, string nameMatch = "", float maxDist = 100f, float cullDist = -1f, bool namePrefix = false) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; List list = new List(); Collider[] array = Physics.OverlapSphere(position, maxDist, WUTIL.c_characterRayMask); foreach (Collider val in array) { if (!((Object)(object)val.attachedRigidbody != (Object)null)) { continue; } Character component = ((Component)val.attachedRigidbody).GetComponent(); string text = WUTIL.ActorName(component); if ((namePrefix && text.StartsWith(nameMatch)) || text == nameMatch) { if (cullDist >= 0f && Vector3.Distance(((Component)component).transform.position, position) >= cullDist) { num2++; list.Add(component); } else { num++; } } } if (num2 > 0) { WDBUG.Log($"Culling {num2} {nameMatch} of {num + num2}", WDBUG.Level.Wildlife); foreach (Character item in list) { WUTIL.Destroy(((Component)item).gameObject); } } return num; } public static void PlaceLocalPickableItems(string name, string aboutTarget, float minOffset = 1f, float maxOffset = 2f) { //IL_0024: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_0498: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } Transform transform = ((Component)Player.m_localPlayer).transform; Biome val = Heightmap.FindBiome(transform.position); Biome val2 = val; if ((int)val2 != 1 && (int)val2 != 8) { return; } bool flag = Wildling.IsWildling && Quest.GetAchievement("RaftsFound") == 0 && WUTIL.TestLuck(Wildling.SkillFactor((SkillType)0) - 0.17f); float num = ((!WDBUG.RemoveLocalPebbles) ? 30 : 0); float num2 = minOffset + maxOffset; float num3 = 60f + num2; List list = new List(); List list2 = new List(); Collider[] array = Physics.OverlapSphere(transform.position, num3, WUTIL.c_itemRayMask); foreach (Collider val3 in array) { Transform transform2 = ((Component)val3).transform; if ((Object)(object)transform2 == (Object)null || (Object)(object)transform2.parent == (Object)null || Vector3.Distance(transform.position, transform2.position) < num) { continue; } transform2 = transform2.parent; GameObject gameObject = ((Component)transform2).gameObject; if ((Object)(object)gameObject == (Object)null || (Object)(object)gameObject.GetComponent() == (Object)null || !gameObject.GetComponent().IsValid()) { continue; } string text = WUTIL.GameName(gameObject); if (text == aboutTarget) { if (list.Contains(transform2)) { continue; } if (flag && Vector3.Distance(transform.position, transform2.position) > 50f && Floating.GetLiquidLevel(transform2.position, 0f, (LiquidType)10) > transform2.position.y) { flag = WUTIL.TestLuck(); if (!Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(transform2.position, (Type)4, 80f)) && Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(transform2.position, (Type)32, 20f))) { WDBUG.Log($"Placed Raft {50f}-{60f}m from wildling", WDBUG.Level.World); Quest.AdvanceAchievement("RaftsPlaced"); GameObject val4 = WUTIL.PlaceObject("Raft", transform2.position, WUTIL.RandomDir()); Piece component = val4.GetComponent(); if ((Object)(object)component != (Object)null) { ((StaticTarget)component).m_primaryTarget = false; ((StaticTarget)component).m_randomTarget = false; } continue; } } list.Add(transform2); } else if (text == name && !list2.Contains(transform2)) { list2.Add(transform2); } } if (WDBUG.RemoveLocalPebbles) { WDBUG.RemoveLocalPebbles = false; WDBUG.Log($"Removing local {name}: {list2.Count}", WDBUG.Level.World); Transform[] array2 = list2.ToArray(); foreach (Transform val5 in array2) { WUTIL.Destroy(((Component)val5).gameObject); } return; } if (list2.Count >= 20) { WDBUG.Log($"Local perimeter already abundant {name}: {list2.Count}", WDBUG.Level.World); return; } Transform[] array3 = list.ToArray(); foreach (Transform val6 in array3) { foreach (Transform item in list2) { if (Vector3.Distance(item.position, val6.position) < num2) { list.Remove(val6); break; } } } if (list.Count == 0) { return; } int num4 = Mathf.Min(list.Count, 20); foreach (Transform item2 in list) { if (--num4 == 0) { break; } Vector3 position = WUTIL.OnCircle(item2.position, minOffset + maxOffset * WUTIL.RandomSpin()); WUTIL.PlaceObject(name, position, WUTIL.RandomDir()); } } public static void SpawnLocalRabbit(float minDist = 25f, float maxDist = 50f, float maxNumber = 20f) { //IL_002a: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected I4, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Invalid comparison between Unknown and I4 if (PlayerInInterior()) { return; } Transform transform = ((Component)Player.m_localPlayer).transform; float cullDist = (EnvMan.IsDaylight() ? (-1) : 30); if ((float)CheckLocalPopulation(transform.position, "Rabbit", maxDist, cullDist, namePrefix: true) < maxNumber) { string text = ""; int num = WUTIL.DieRoll(100); Biome val = Heightmap.FindBiome(transform.position); Biome val2 = val; switch (val2 - 1) { default: if ((int)val2 != 8) { if ((int)val2 == 16) { text = ((num <= 85) ? "RabbitTan" : ((num <= 97) ? "RabbitGrey" : "RabbitWhite")); } } else { text = ((num <= 80) ? "RabbitGrey" : "RabbitTan"); } break; case 0: text = ((num <= 75) ? "RabbitTan" : ((num <= 98) ? "RabbitGrey" : "RabbitWhite")); break; case 1: text = ((num <= 10) ? "RabbitGrey" : ""); break; case 3: text = ((num <= 95) ? "RabbitWhite" : "RabbitGrey"); break; case 2: break; } if (text != "") { Vector3 position = WUTIL.OnCircle(transform.position, WUTIL.RandomSpin(minDist, maxDist)); if (IsSafePosition(ref position, forPlayer: false)) { WDBUG.Log($"Spawning Rabbit at dist: {Vector3.Distance(position, transform.position)}", WDBUG.Level.Wildlife); WUTIL.Spawn(text, position, Quaternion.LookRotation(-transform.forward)); } } } else { WDBUG.Log("Too many rabbits in vacinity to spawn", WDBUG.Level.Wildlife); } } public static void CheckLocationSpawners() { if (!((Object)(object)Player.m_localPlayer != (Object)null) || !ZNet.instance.IsServer()) { return; } foreach (Player allPlayer in Player.GetAllPlayers()) { CheckLocationSpawners(allPlayer); } } public static int TrophiesHeldOrHungNearby(float range = 20f) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (KeyValuePair c_trophy in c_trophies) { if (WUTIL.GetInventoryItemData(c_trophy.Key) != null) { num |= c_trophy.Value; WDBUG.Log("Detected held trophy: " + c_trophy.Key, WDBUG.Level.World); } } return num | TrophiesNear(((Component)Player.m_localPlayer).transform.position, range); } public static void UpdateHungTrophies(ItemStand itemStand) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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)itemStand == (Object)null) { return; } if (itemStand.HaveAttachment()) { string text = WUTIL.GameName(itemStand.GetAttachedItem()); if (c_trophies.ContainsKey(text)) { m_hungTrophies[((Component)itemStand).transform.position] = c_trophies[text]; WDBUG.Log($"Tracked hung trophy: {text} ({c_trophies[text]})", WDBUG.Level.World); } } else if (m_hungTrophies.ContainsKey(((Component)itemStand).transform.position)) { WDBUG.Log($"Untracked hung trophy: {m_hungTrophies[((Component)itemStand).transform.position]}", WDBUG.Level.World); m_hungTrophies.Remove(((Component)itemStand).transform.position); } } public static int TrophiesNear(Vector3 pos, float range = 12f) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (range <= 0f) { return 0; } int num = 0; foreach (KeyValuePair hungTrophy in m_hungTrophies) { if (WUTIL.WithinCylinder(hungTrophy.Key, pos, range)) { num |= hungTrophy.Value; } } return num; } public static bool Unspawn(Character character) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.ActorName(character).StartsWith("Rat") && (TrophiesNear(((Component)character).transform.position) & 6) > 0) { WDBUG.Log("Unspawn rat near hung Rat Tail trophy", WDBUG.Level.World); m_deferredActorDestroy.Add(character); return true; } return false; } public static float DepthBelowWater(Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return Floating.GetLiquidLevel(pos, 1f, (LiquidType)10) - pos.y; } public static bool SetUnderwaterView(Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) float num = DepthBelowWater(pos); if (num >= 2f) { WUTIL.TimerReset("allow_view_underwater", Mathf.Min(0.1f * num, 3f)); UpdateSunkenProximity(); return true; } return false; } public static void SetUnderWaterEnvironment(bool reset = false) { EnvMan.instance.SetForceEnvironment(reset ? "WildlingOverwater" : "WildlingUnderwater"); if (!reset) { PlaceSunkenSite(); } } public static void TrackSunkenChest(Container chest = null, bool newChest = true) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)chest == (Object)null) { WDBUG.Log($"Removing {m_sunkenChests.Count} + {m_lostShipwrecks.Count} tracked sunken sites"); foreach (Container sunkenChest in m_sunkenChests) { if (Object.op_Implicit((Object)(object)sunkenChest)) { WUTIL.Destroy(((Component)WUTIL.BaseTransform(((Component)sunkenChest).transform)).gameObject); } } m_sunkenChests.Clear(); GameObject[] array = m_lostShipwrecks.ToArray(); foreach (GameObject val in array) { if (Object.op_Implicit((Object)(object)val)) { WUTIL.Destroy(val); } } m_lostShipwrecks.Clear(); return; } float num = Floating.GetLiquidLevel(((Component)chest).transform.position, 1f, (LiquidType)10) - ((Component)chest).transform.position.y; if (num < 4f) { return; } PruneSunkenSites(); bool flag = !m_sunkenChests.Contains(chest); if (flag) { m_sunkenChests.Add(chest); } CustomizeSunkenChest(chest, num, newChest); if (WDBUG.IsLevelReported(WDBUG.Level.Underwater)) { string text = (flag ? ("Tracked" + (newChest ? " and configured" : "")) : "Reconfigured"); text += $" sunken chest #{m_sunkenChests.Count} @{GridPos(((Component)chest).transform.position)} at depth {num}"; Transform val2 = WUTIL.BaseTransform(((Component)chest).transform); if ((Object)(object)val2 != (Object)(object)((Component)chest).transform) { text = text + " and Shipwreck @" + GridPos(val2.position); } WDBUG.Log(text); } } public static void UpdateSunkenProximity() { if (WUTIL.Timer("check_sunken_proximity") > 0f) { PlaceSunkenSite(); return; } WUTIL.TimerReset("check_sunken_proximity", 2f); PruneSunkenSites(); CheckSunkenSiteProximity(); } public static void TrackDroppedItem(ItemDrop itemDrop) { if (WUTIL.GameName(((Component)itemDrop).gameObject) == "PebbleColdball") { m_droppedItems.Add(itemDrop); } } public static void TakeSunkenTreasure(ItemData item, int amount = 0) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (item == null || WUTIL.WithinSameZone(m_lastSunkenChestPos, ((Component)Player.m_localPlayer).transform.position)) { return; } float num = DepthBelowWater(((Component)Player.m_localPlayer).transform.position); if (!(num < 12f)) { int num2 = ((amount > 0) ? amount : ((item.m_stack <= 0) ? 1 : item.m_stack)); WDBUG.Log($"Taken {WUTIL.ItemName(item)} x{num2} from sunken chest at depth ~{num}", WDBUG.Level.Underwater); if (num >= 24f) { Quest.AdvanceAchievement("DiverWreck"); num2 = 0; } if (num >= 34f) { Quest.AdvanceAchievement("DiverWild"); num2 = 0; } if (WUTIL.ItemName(item).EndsWith("Pearl")) { Quest.AdvanceAchievement("DiverPearl"); num2 = 0; } if (num2 == 0) { m_lastSunkenChestPos = ((Component)Player.m_localPlayer).transform.position; } } } public static void CheckAoEDamaged(Aoe aoe, Character character) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)character == (Object)null) && !character.IsPlayer() && !Riding.IsRiding(character) && character.GetHealth() <= 0f && WUTIL.GameName(((Component)aoe).gameObject) == "pebblecoldball_aoe_uw" && DepthBelowWater(((Component)character).transform.position) > 2f) { Quest.AdvanceAchievement("DiverBombs"); } } private static string GridPos(Vector3 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) return $"({(int)Mathf.Floor(pos.x)},{(int)Mathf.Floor(pos.y)},{(int)Mathf.Floor(pos.z)})" + $"[{(int)Mathf.Floor(0.5f + pos.x / 64f)},{(int)Mathf.Floor(0.5f + pos.z / 64f)}]"; } private static void PlaceSunkenSite() { //IL_003f: 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) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06bc: Unknown result type (might be due to invalid IL or missing references) //IL_071e: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.Timer("place_sunken_site_tick") > 0f) { return; } WUTIL.TimerReset("place_sunken_site_tick", 30f); PruneSunkenSites(); Vector3 position = ((Component)Player.m_localPlayer).transform.position; WDBUG.Log($"Checking player @{GridPos(position)} vs. {m_sunkenChests.Count} sunken chests and {m_lostShipwrecks.Count} pending shipwrecks", WDBUG.Level.Underwater); foreach (Container sunkenChest in m_sunkenChests) { if (WUTIL.WithinSameZone(position, ((Component)sunkenChest).transform.position)) { WDBUG.Log("Player in same zone as Sunken chest @" + GridPos(((Component)sunkenChest).transform.position), WDBUG.Level.Underwater); return; } } foreach (GameObject lostShipwreck in m_lostShipwrecks) { if (WUTIL.WithinSameZone(position, lostShipwreck.transform.position)) { WDBUG.Log("Player in same zone as lost shipwreck @" + GridPos(lostShipwreck.transform.position), WDBUG.Level.Underwater); return; } } Vector3 val = position; val.x = 64f * (0.5f + Mathf.Floor(val.x / 64f)); val.z = 64f * (0.5f + Mathf.Floor(val.z / 64f)); float num = WUTIL.RandomSpin(6.5f, 26f); float num2 = 0f; float num3 = (float)(45 * WUTIL.DieRoll(8)) * ((float)Math.PI / 180f); int num4 = 0; bool flag = true; int num5 = 0; float heightAboveSolid = default(float); while (num5 < 8) { position.x = val.x + num * Mathf.Sin(num3); position.z = val.z + num * Mathf.Cos(num3); num4++; if (!WUTIL.WithinSameZone(position, val)) { WDBUG.Log("Chest site ignored as not in the current grid cell", WDBUG.Level.Underwater); } else if (Heightmap.GetHeight(position, ref heightAboveSolid)) { position.y = heightAboveSolid; heightAboveSolid = Flight.GetHeightAboveSolid(position, 99f); if (heightAboveSolid > 1f) { WDBUG.Log($"Chest site above sea bed by {heightAboveSolid} ignored", WDBUG.Level.Underwater); } else { num2 = Floating.GetLiquidLevel(position, 1f, (LiquidType)10) - position.y; if (num2 >= 12f && num2 <= 42f) { if (heightAboveSolid > 0.5f) { string text = "Pickable_Thistle,Pickable_Flax_Wild,Pickable_Barley_Wild"; string text2 = text.Split(new char[1] { ',' })[WUTIL.DieRoll(3)]; WDBUG.Log($"Chest site above sea bed by {heightAboveSolid} replaced for {text2}", WDBUG.Level.Underwater); position.y += heightAboveSolid; WUTIL.Spawn(text2, position, Quaternion.Euler(0f, (float)WUTIL.DieRoll(360), 0f)); } else if (WUTIL.WithinSameZone(position, val)) { flag = false; break; } } } } num5++; num3 += (float)Math.PI * 3f / 4f; } if (flag) { WDBUG.Log("Did not locate a good sunken chest location", WDBUG.Level.Underwater); WUTIL.TimerReset("sunken_chest_tick", 5f); return; } float num6 = WUTIL.DieRoll(360); float num7 = WUTIL.DieRoll(19) - 9; float num8 = 0f; Vector3 val2 = Quaternion.Euler(0f, num6, 0f) * Vector3.forward; float num9 = default(float); if (Heightmap.GetHeight(position + 4f * val2, ref num9)) { num8 = Mathf.Atan(0.25f * (position.y - num9)) / ((float)Math.PI / 180f); } if (num2 >= 24f) { float num10 = 2f * num7 + (float)((WUTIL.RandomSpin() > 0.7f) ? (90 * WUTIL.RandomSign()) : 0); if (Mathf.Abs(num10) > 60f) { position.y += 1f; } float num11 = default(float); Heightmap.GetHeight(position, ref num11); float heightAboveSolid2 = Flight.GetHeightAboveSolid(position, 1f); WDBUG.Log($"Creating Shipwreck @{GridPos(position)} ground Y {num11} at depth {num2} above solid {heightAboveSolid2} pitch {num8} roll {num10} (site {num4})", WDBUG.Level.Underwater); WUTIL.Spawn("Shipwreck", position, Quaternion.Euler(num8, num6, num10)); if (!WUTIL.TestLuck(0.85f)) { string text3 = "Skeleton,Skeleton_Poison,Blob,Draugr_Elite,BlobElite".Split(new char[1] { ',' })[WUTIL.DieRoll(5)]; position.y += 3f; int num12 = ((!text3.StartsWith("Skeleton")) ? 1 : (WUTIL.DieRoll(3) + 1)); for (int i = 0; i < num12; i++) { WUTIL.Spawn(text3, WUTIL.OnCircle(position, 5f), Quaternion.identity, WUTIL.DieRoll(2) + 1, 0f, ground: true); text3 = (WUTIL.TestLuck() ? "Pickable_ForestCryptRemains01" : "Skeleton"); } WDBUG.Log("Added " + text3 + " guard", WDBUG.Level.Underwater); } } else { float num13 = default(float); Heightmap.GetHeight(position, ref num13); float heightAboveSolid3 = Flight.GetHeightAboveSolid(position, 1f); num8 += (float)(WUTIL.DieRoll(9) - 4); WDBUG.Log($"Creating sunken chest @{GridPos(position)} ground Y {num13} at depth {num2} above solid {heightAboveSolid3} pitch {num8} (site {num4})", WDBUG.Level.Underwater); position.y -= 0.25f; WUTIL.Spawn("shipwreck_karve_chest", position, Quaternion.Euler(num8, num6, num7)); } } private static void CustomizeSunkenChest(Container chest, float depth, bool newContent = true) { WearNTear component = ((Component)chest).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_noSupportWear = false; } if (newContent && depth > 18f) { string text = ((depth < 24f) ? "MeadHealthMinor;MeadStaminaMinor;NeckSurprise;LoxPie;SwiftPotion;HealingSalve:5;BoiledWolf:3;Truffle:2;SilverNecklace" : "MeadStaminaMedium;MeadHealthMinor:2;MeadStaminaMinor:3;PixieCola;DoxieDust;TruffleBroth;MushroomBlue:2;Sausages:4;PebbleColdball;2"); if (depth > 34f) { text += ";DoxsickOil;BadSeed;BraisedBoar;PebbleColdball:6"; } Place.CustomizeContainer(((Component)chest).transform, text); } } private static void CustomizeShipwreck(GameObject shipwreck = null) { //IL_0069: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) Transform val = shipwreck.transform.Find("ship"); if ((Object)(object)val == (Object)null) { WDBUG.Log("CustomizeShipwreck failed to find " + WUTIL.GameName(shipwreck) + "/ship"); return; } ZNetView component = shipwreck.GetComponent(); bool activate = Object.op_Implicit((Object)(object)component) && component.IsOwner(); Quaternion rotation = shipwreck.transform.rotation; float num = ((Quaternion)(ref rotation)).eulerAngles.z; if (num > 180f) { num -= 360f; } bool flag = Math.Abs(num) > 60f; WUTIL.ResetRandomSeed(WUTIL.HashMapPos(val.position)); int num2 = ((!flag) ? WUTIL.DieRoll(2) : 0); RandomizeModel(val, "base", 2, 0.5f, 0, num2, sink: false); WDBUG.Log($"Customize Shipwreck base ({num2}) roll {num} at @{GridPos(shipwreck.transform.position)}", WDBUG.Level.Underwater); Transform val2 = val.Find($"base ({num2})"); if (num2 == 0) { int trgIdn = ((!(num > 30f)) ? WUTIL.DieRoll(2) : 0); RandomizeModel(val2.Find("hull"), "hull", 2, 0.5f, 0, trgIdn, sink: false); RandomizeModel(val2.Find("hull"), "default", 11, 0.4f, 0, -1, flag); RandomizeModel(val2.Find("shields"), "Shield", 15, 0.7f, 0, -1, flag); try { RandomizeModel(val2.Find("chests"), "chest", 4, 0.5f, 0, WUTIL.DieRoll(flag ? 2 : 4), sink: false, activate); } catch (Exception) { WDBUG.Log("Caught lost start up chest"); } } else { RandomizeModel(val2.Find("hull"), "plank", 33, 0.6f); RandomizeModel(val2.Find("shields"), "Shield", 14, 0.6f); try { RandomizeModel(val2.Find("chests"), "chest", 5, 0.5f, 0, WUTIL.DieRoll(5), sink: true, activate); } catch (Exception) { WDBUG.Log("Caught lost start up chest"); } RandomizeModel(val2.Find("heads"), "head", 6, 0.5f, 0, WUTIL.DieRoll()); RandomizeModel(val2.Find("storage"), "default", 12); } WUTIL.ResetRandomSeed(); bool flag2 = false; foreach (Container sunkenChest in m_sunkenChests) { if (Object.op_Implicit((Object)(object)sunkenChest) && (Object)(object)shipwreck.transform == (Object)(object)WUTIL.BaseTransform(((Component)sunkenChest).transform)) { flag2 = true; break; } } if (!flag2) { if (m_lostShipwrecks.Contains(shipwreck)) { WDBUG.Log("Still tracking Shipwreck chest for late customize."); return; } WDBUG.Log("Tracking Shipwreck chest for late customize.", WDBUG.Level.Underwater); m_lostShipwrecks.Add(shipwreck); } } private static void RandomizeModel(Transform parent, string nodeId, int endIdn, float chance = 0.5f, int srtIdn = 0, int trgIdn = -1, bool sink = true, bool activate = true) { //IL_00d5: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_0139: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parent == (Object)null) { return; } if (endIdn <= srtIdn) { endIdn = srtIdn + 1; } float num2 = default(float); for (int i = srtIdn; i < endIdn; i++) { Transform val = parent.Find($"{nodeId} ({i})"); if ((Object)(object)val == (Object)null) { WDBUG.Log($"RandomizeModel Failed to find {WUTIL.GameName(((Component)parent).gameObject)}/{nodeId} ({i})"); continue; } bool flag = ((trgIdn < 0) ? (chance > WUTIL.RandomSpin()) : (i == trgIdn)); if (sink && flag) { float num = WUTIL.RandomSpin(0.05f, 0.5f); if (Heightmap.GetHeight(val.position, ref num2)) { num += val.position.y - num2; if (nodeId == "chest") { WDBUG.Log($"RandomizeModel set {WUTIL.GameName(((Component)parent).gameObject)}/{nodeId} ({i}) floor height {val.position.y - num2} activate: {activate}", WDBUG.Level.Underwater); } } else { num += Flight.GetHeightAboveSolid(val.position, 5f); } val.position -= num * Vector3.up; Quaternion rotation = val.rotation; float num3 = ((Quaternion)(ref rotation)).eulerAngles.x + (float)WUTIL.DieRoll(39) - 19f; rotation = val.rotation; float num4 = ((Quaternion)(ref rotation)).eulerAngles.y + (float)WUTIL.DieRoll(19) - 9f; rotation = val.rotation; val.rotation = Quaternion.Euler(num3, num4, ((Quaternion)(ref rotation)).eulerAngles.z + (float)WUTIL.DieRoll(19) - 9f); } if (activate) { ((Component)val).gameObject.SetActive(flag); } } } private static void PruneSunkenSites() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (m_sunkenChests.Count <= 0) { return; } List list = new List(); Container[] array = m_sunkenChests.ToArray(); foreach (Container val in array) { if (!((Object)(object)val != (Object)null)) { continue; } Transform transform = ((Component)val).transform; ZNetView component = ((Component)val).GetComponent(); bool flag = true; if (Object.op_Implicit((Object)(object)component) && component.IsOwner()) { foreach (Container item in list) { if (WUTIL.WithinSameZone(transform.position, ((Component)item).transform.position)) { GameObject gameObject = ((Component)WUTIL.BaseTransform(transform)).gameObject; WDBUG.Log("Pruned extra " + WUTIL.GameName(gameObject) + " in same zone @" + GridPos(transform.position)); WUTIL.Destroy(gameObject); flag = false; break; } } } if (flag) { list.Add(val); } } if (list.Count < m_sunkenChests.Count) { WDBUG.Log($"Now tracking {list.Count} sunken chests of {m_sunkenChests.Count}", WDBUG.Level.Underwater); m_sunkenChests = list; } } private static void CheckSunkenSiteProximity() { //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_0095: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)Player.m_localPlayer).transform; foreach (Container sunkenChest in m_sunkenChests) { if (!Object.op_Implicit((Object)(object)sunkenChest)) { continue; } Transform parent = ((Component)sunkenChest).transform.parent; bool flag = (Object)(object)parent != (Object)null && ((Object)parent).name == "chests"; bool flag2 = flag && ((Object)parent.parent).name == "base (0)"; Vector3 position = WUTIL.BaseTransform(((Component)sunkenChest).transform).position; if (WUTIL.WithinCylinder(position, transform.position, flag ? 48f : 20f, 40f)) { string text = (flag2 ? "SunkenShip" : (flag ? "ShipWreck" : "SunkenChest")); if (MapMarker.MarkMap(position, text)) { WDBUG.Log($"Marking map for {text} @{transform.position}", WDBUG.Level.Underwater); } } } } private static void UpdateDroppedItems(float dt) { //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.TimerIsAlmost("late_update_attach", 0f)) { Place.PatchItemStandUpdateAttach.LateUpdateAttach(); } if (m_droppedItems.Count > 0) { List list = new List(); ItemDrop[] array = m_droppedItems.ToArray(); foreach (ItemDrop val in array) { Rigidbody val2 = ((val != null) ? ((Component)val).GetComponent() : null); if (!Object.op_Implicit((Object)(object)val2)) { continue; } string text = WUTIL.GameName(((Component)val).gameObject); if (text == "PebbleColdball") { float y = val2.velocity.y; if (y < 0f) { float heightAboveSolid = Flight.GetHeightAboveSolid(((Component)val).transform.position); if (heightAboveSolid < 0.5f || heightAboveSolid < (0f - dt) * y) { if (DepthBelowWater(((Component)val).transform.position) > 1.5f || y < -18f + WUTIL.RandomSpin(-1f)) { WDBUG.Log($"Coldball hit bottom at {y}mps", WDBUG.Level.Underwater); WUTIL.PlaceAoe("pebblecoldball_aoe_uw", ((Component)val).transform.position, (Character)(object)Player.m_localPlayer); WUTIL.Destroy(((Component)val).gameObject); } continue; } } } list.Add(val); } m_droppedItems = list; } if (m_lostShipwrecks.Count <= 0) { return; } Transform transform = ((Component)Player.m_localPlayer).transform; List list2 = new List(); GameObject[] array2 = m_lostShipwrecks.ToArray(); foreach (GameObject val3 in array2) { if (Object.op_Implicit((Object)(object)val3)) { if (WUTIL.WithinCylinder(transform.position, val3.transform.position, 32f)) { WDBUG.Log("Late customize of Shipwreck @" + GridPos(val3.transform.position), WDBUG.Level.Underwater); CustomizeShipwreck(val3.gameObject); } else { list2.Add(val3); } } } if (list2.Count < m_lostShipwrecks.Count) { WDBUG.Log($"Now tracking {list2.Count} ghost Shipwrecks of {m_lostShipwrecks.Count}", WDBUG.Level.Underwater); m_lostShipwrecks = list2; } } public static void SendServerRequest(string msgType, string msg) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) SendServerRequest(msgType, msg, ((Component)Player.m_localPlayer).transform.position); } public static void SendServerRequest(string msgType, string msg, Vector3 position, int pinType = 0) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) ZRoutedRpc.instance.InvokeRoutedRPC("RPC_DiscoverClosestLocation", new object[6] { msgType, position, "WildlingBroadcast:" + msg, pinType, false, false }); WDBUG.Log($"SendServerRequest {msgType}: {msg} @ {position} ({pinType})", WDBUG.Level.Multiplayer); } public static List GetLocationPositions(string name = "") { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) bool flag = name == ""; List list = new List(); foreach (KeyValuePair> locationSite in m_locationSites) { if (flag || locationSite.Key.StartsWith(name)) { list.AddRange(locationSite.Value); } } if (list.Count == 0 && ZNet.instance.IsServer()) { foreach (LocationInstance location in ZoneSystem.instance.GetLocationList()) { if (flag || location.m_location.m_prefabName.StartsWith(name)) { list.Add(location.m_position); } } } return list; } public static bool GetNearestLocationPosition(string name, Vector3 nearPos, ref Vector3 locPos, float maxDist = 9999f) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) nearPos.y = 0f; float num = maxDist; foreach (Vector3 locationPosition in GetLocationPositions(name)) { float num2 = Vector3.Distance(nearPos, locationPosition); if (num2 < num) { num = num2; locPos = locationPosition; } } return num < maxDist; } public static bool GetUniquePosition(string name, ref Vector3 locPos) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (m_uniqueSites.ContainsKey(name)) { locPos = m_uniqueSites[name]; return true; } if (!ZNet.instance.IsServer()) { SendServerRequest("Unique", name); } return false; } public static void SetUniquePosition(string name, Vector3 locPos) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) WDBUG.Log("Set unique location: " + name, WDBUG.Level.Multiplayer); m_uniqueSites[name] = locPos; } public static void CheckLocationsLocal() { if (m_routedLocations.Count == m_locationSites.Count || WUTIL.Timer("poll_locations") > 0f || (Object)(object)WUTIL.Player_nview == (Object)null || !WUTIL.Player_nview.IsValid() || !WUTIL.Player_nview.IsOwner()) { return; } WUTIL.TimerReset("poll_locations", 0.5f); foreach (string routedLocation in m_routedLocations) { if (!m_locationSites.ContainsKey(routedLocation)) { SendServerRequest("Locate", routedLocation); break; } } } public static void AddLocations(string name, string encodedPositions) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (ZNet.instance.IsServer()) { List list = new List(); foreach (LocationInstance location in ZoneSystem.instance.GetLocationList()) { if (location.m_location.m_prefabName.StartsWith(name)) { list.Add(location.m_position); } } m_locationSites[name] = list; WDBUG.Log($"Server cached {list.Count} positions for location {name}", WDBUG.Level.Multiplayer); } else { m_locationSites[name] = DecodeLocations(encodedPositions); WDBUG.Log($"Decoded {m_locationSites[name].Count}/{(float)encodedPositions.Length / 6f} positions for location {name}", WDBUG.Level.Multiplayer); } } public static string EncodeLocations(string name) { //IL_0021: 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_0028: 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) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) int num = 0; StringBuilder stringBuilder = new StringBuilder(); foreach (LocationInstance location in ZoneSystem.instance.GetLocationList()) { if (location.m_location.m_prefabName.StartsWith(name)) { int num2 = (int)((8192f + location.m_position.x) * 16f); int num3 = (int)((8192f + location.m_position.z) * 16f); stringBuilder.Append((char)((num2 >> 12) + 32)); stringBuilder.Append((char)(((num2 >> 6) & 0x3F) + 32)); stringBuilder.Append((char)((num2 & 0x3F) + 32)); stringBuilder.Append((char)((num3 >> 12) + 32)); stringBuilder.Append((char)(((num3 >> 6) & 0x3F) + 32)); stringBuilder.Append((char)((num3 & 0x3F) + 32)); num++; } } WDBUG.Log($"Encoded {(float)stringBuilder.Length / 6f}/{num} positions matching location {name} of {ZoneSystem.instance.GetLocationList().Count}", WDBUG.Level.Multiplayer); return stringBuilder.ToString(); } private static List DecodeLocations(string encodedPositions) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = encodedPositions.Length / 6; int num2 = 0; for (int i = 0; i < num; i++) { int num3 = encodedPositions[num2++] - 32; num3 = (num3 << 6) | (encodedPositions[num2++] - 32); num3 = (num3 << 6) | (encodedPositions[num2++] - 32); int num4 = encodedPositions[num2++] - 32; num4 = (num4 << 6) | (encodedPositions[num2++] - 32); num4 = (num4 << 6) | (encodedPositions[num2++] - 32); list.Add(new Vector3(0.0625f * (float)num3 - 8192f, 0f, 0.0625f * (float)num4 - 8192f)); } return list; } private static List DecodeLocationsLowRes(string encodedPositions) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) List list = new List(); int num = encodedPositions.Length / 4; int num2 = 0; for (int i = 0; i < num; i++) { int num3 = encodedPositions[num2++] - 27; int num4 = encodedPositions[num2++] - 27; int num5 = encodedPositions[num2++] - 27; int num6 = encodedPositions[num2++] - 27; list.Add(new Vector3((float)(2 * (100 * num3 + num4) - 5000), 0f, (float)(2 * (100 * num5 + num6) - 5000))); } return list; } private static void CheckLocationSpawners(Player player) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0040: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0059: 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_0060: 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) //IL_004e: Invalid comparison between Unknown and I4 //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Invalid comparison between Unknown and I4 //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Invalid comparison between Unknown and I4 string text = ""; Transform transform = ((Component)player).transform; foreach (LocationInstance location in ZoneSystem.instance.GetLocationList()) { Biome biome = location.m_location.m_biome; Biome val = biome; Biome val2 = val; if (val2 - 1 > 1 && (int)val2 != 8) { continue; } float num = Vector3.Distance(location.m_position, transform.position); if (num > 100f) { continue; } string prefabName = location.m_location.m_prefabName; int num2 = 1; float num3 = 0.5f; float heightOffset = 0f; if (prefabName.StartsWith("SwampRuin") || prefabName == "Grave1" || prefabName == "WoodVillage1" || prefabName == "SwampWell1") { text = "RatDraugr"; num2 = 3; } else if (prefabName.StartsWith("Runestone_Greydwarfs") && (int)biome == 8) { text = "Pixie"; heightOffset = 20f; } else if (prefabName == "InfestedTree01") { if (WUTIL.RandomAtPos(location.m_position) > 0.3f) { continue; } text = "Doxie"; heightOffset = 6f; } else if (prefabName.Contains("House") || prefabName.StartsWith("Ruin") || prefabName == "TrollCave02") { if ((int)biome != 2) { text = "Rat"; num2 = 2; } } else { if (!(prefabName == "WoodFarm1")) { continue; } text = "Rat"; num2 = 4; num3 = 1.5f; } if (!Place.WorldSpawnerAt(location.m_position)) { WDBUG.Log($"Placing {text} spawner at {prefabName} + {num2 - 1} more near {player.GetPlayerName()}", WDBUG.Level.Wildlife); Place.Spawner(text, location.m_position, heightOffset); num2 = 1; for (int i = 1; i < num2; i++) { Vector3 position = WUTIL.OnCircle(location.m_position, (float)i * num3 * WUTIL.RandomSpin()); Place.Spawner(text, position, heightOffset); } } } } private static void CheckEnvironnment() { bool flag = m_environment == ""; string name = EnvMan.instance.GetCurrentEnvironment().m_name; if (m_environment != name) { bool flag2 = m_dungeonEnvironment != 0; m_dungeonEnvironment = 0; m_isRaining = name.Contains("Rain"); switch (name) { case "Crypt": m_dungeonEnvironment = 2; ForestDungeon.Build(); break; case "SunkenCrypt": m_dungeonEnvironment = 3; SwampDungeon.BuildCryptSewers(); break; case "Cave": m_dungeonEnvironment = 5; WDBUG.Log("You have entered a Cave zone", WDBUG.Level.Dungeon); break; default: if (MountainDungeon.PlayerInside()) { m_dungeonEnvironment = 1; } else { if (!Wildling.IsWildling || Flight.IsFlying()) { break; } bool flag3 = name.Contains("Storm"); bool flag4 = m_lastWeather.Contains("Storm"); string text = ""; string text2 = ""; if (flag4 && !flag3) { text2 = "The storm is passing."; } else if (flag3 && !flag4) { text2 = ((!name.Contains("SnowStorm")) ? ("A " + (name.Contains("Thunder") ? "big " : "") + "storm is approaching.") : "A blizzard is approaching."); text = "Storm"; } bool isRaining = m_isRaining; bool flag5 = m_lastWeather.Contains("Rain"); bool flag6 = name.Contains("Snow"); bool flag7 = m_lastWeather.Contains("Snow"); if (isRaining && !flag5) { if (text2 != "") { text2 += " "; } text2 = "It will rain soon."; text += "Rain"; } else if (flag6 && !flag7) { if (text2 != "") { text2 += " "; } text2 = "It will snow soon."; text += "Snow"; } else if ((flag5 || flag7) && text2 == "") { text2 = "The weather is clearing."; } if (text != m_lastWeather) { if (!(text2 == "" || text == m_prevWeather || m_environment == "" || flag2)) { WUTIL.Message(text2); } m_prevWeather = m_lastWeather; m_lastWeather = ((text == "") ? "Calm" : text); WDBUG.Log($"Weather change {m_prevWeather} -> {m_lastWeather}, {text2} wasInside: {flag2}", WDBUG.Level.World); } } break; } m_environment = name; Equipment.UpdateClothingEffects(); if (flag2 != (m_dungeonEnvironment != 0)) { Wildling.BroadcastStatus(); } } else if (WUTIL.Timer("BiomeCheck") == 0f) { Equipment.UpdateClothingEffects(); WUTIL.TimerReset("BiomeCheck", 5f); } if (flag || m_dungeonEnvironment == 0 || m_dungeonEnvironment == 1) { MountainDungeon.Update(); } Place.EnablePatched(PlayerInInterior()); if (m_dungeonEnvironment == 0) { if (MountainDungeon.PlayerInside()) { m_dungeonEnvironment = 1; } else if (SwampDungeon.AtGreatOak(((Component)Player.m_localPlayer).transform, byHeight: true)) { m_dungeonEnvironment = 4; } } if (m_dungeonEnvironment == 3 || m_dungeonEnvironment == 4) { SwampDungeon.Update(); } if (flag) { WDBUG.Log("Restart dungeon env: " + m_dungeonEnvironment, WDBUG.Level.Dungeon); } } private static void UpdateWorldPieces(float dt) { m_checkPickablePebblesCooldown -= dt; if (m_checkPickablePebblesCooldown <= 0f) { m_checkPickablePebblesCooldown = 10f; PlaceLocalPickableItems("Pickable_pebbles", "Pickable_Flint"); } Place.UpdateShutters(dt); Place.UpdateSprungGates(dt); } public static bool IsWildlingBed(GameObject go) { return (Object)(object)go != (Object)null && (((Object)go).name.StartsWith("Wildling_FeatherFuton") || ((Object)go).name.StartsWith("Wildling_Bedroll")); } public static void SetElderSightActive(bool set) { m_elderSightActive = set; } private static bool ChairSitEnabled(Chair chair) { string name = ((Object)((Component)chair).gameObject).name; m_lastSeatWildling = name.StartsWith("Futon"); if (m_lastSeatWildling) { return Wildling.IsWildling || name == "FutonSitCenter" || name == "FutonSitHigh"; } if ((Object)(object)((Component)chair).transform.parent != (Object)null) { name = ((Object)((Component)((Component)chair).transform.parent).gameObject).name; } m_lastSeatWildling = WUTIL.GameName(name) == "TreehouseStool"; return Wildling.IsWildling || !m_lastSeatWildling; } public static float GetGroundDepth() { return m_groundBaseHeight; } private static void CheckExtendRange(Piece piece) { if (WUTIL.GameName(((Component)piece).gameObject) == "SharpenedStickPlaced") { m_allowNextBuildStationCheck = true; } } public static ItemData GetAutoattachItem(ItemStand itemStand) { ItemData val = WUTIL.GetRightItem(); if (val == null || BlockAttach(itemStand, val)) { val = WUTIL.GetLeftItem(); if (val == null || BlockAttach(itemStand, val)) { return null; } } return val; } private static bool BlockAttach(ItemStand itemStand, ItemData item) { //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected I4, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Invalid comparison between Unknown and I4 //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected I4, but got Unknown //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Invalid comparison between Unknown and I4 //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Invalid comparison between Unknown and I4 //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Invalid comparison between Unknown and I4 string text = WUTIL.GameName(((Object)itemStand).name); string text2 = WUTIL.ItemName(item); if (item == null || !text.StartsWith("attach_")) { if (text == "SharpenedStickPlaced") { if (text2.StartsWith("RatTail") || text2.StartsWith("Slingshot")) { return true; } if (text2.StartsWith("Arrow") || text2.StartsWith("Mushroom")) { return false; } switch (text2) { case "TrophyEikthyr": case "TrophyTheElder": case "TrophyBonemass": case "TrophyDragonQueen": case "TrophyGoblinKing": case "RabbitFoot": return true; case "throwstickClutch": return false; } ItemType itemType = item.m_shared.m_itemType; ItemType val = itemType; if (val - 5 > 1 && (int)val != 13) { return true; } } if (text == "FirePlinth" && (int)item.m_shared.m_itemType != 21) { return true; } return false; } text = text.Substring(7); ItemType itemType2 = item.m_shared.m_itemType; ItemType val2 = itemType2; switch (val2 - 1) { default: switch (val2 - 14) { case 0: case 6: break; case 4: return !(text2 == "MagicChest") || text != "base"; case 5: return (text2 == "PestleAndMortar") ? (text != "base") : (text != "edge2"); case 1: return (text2 == "Match") ? (text != "edge2") : (text != "edge"); default: return true; } goto case 2; case 2: if ((int)item.m_shared.m_skillType == 2) { return text != "edge2"; } if (text2.StartsWith("Pebble")) { return !(text == "edge2") && !(text == "base"); } if (text2 == "FairyTale") { return text != "base"; } return text != "edge"; case 4: if (text2.StartsWith("Slingshot")) { return text != "edge2"; } if (text2 == "throwstickClutch") { if (item.m_quality > 0) { return true; } return !(text == "edge2") && !(text == "base"); } return true; case 3: return text != "edge2"; case 1: if (text2.StartsWith("Cooked")) { return !text.StartsWith("edge"); } if (item.m_shared.m_food + item.m_shared.m_foodStamina > 0f) { return true; } return text != "base"; case 0: if (text2 == "Stretch" || text2.StartsWith("RabbitFur")) { return text != "edge2"; } if (WUTIL.IsWildlingObject(item.m_dropPrefab)) { return text != "base" && text2 != "Plinth" && text2 != "Cauldron"; } return true; } } private static void UpdateGlowSites() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)Player.m_localPlayer).transform; KeyValuePair[] array = m_trackedTrees.ToArray(); for (int i = 0; i < array.Length; i++) { KeyValuePair keyValuePair = array[i]; if (!WUTIL.WithinCylinder(transform.position, keyValuePair.Key, 384f)) { m_trackedTrees.Remove(keyValuePair.Key); } else if (!m_elderSightActive) { m_trackedTrees[keyValuePair.Key] = null; } else if ((Object)(object)keyValuePair.Value == (Object)null && WUTIL.WithinCylinder(transform.position, keyValuePair.Key, 32f, 32f)) { float num = 2f + Flight.GetHeightAboveSolid(keyValuePair.Key); m_trackedTrees[keyValuePair.Key] = WUTIL.PlaceObject("GlowLight", keyValuePair.Key + num * Vector3.up); } } } } internal class MagicChest { [HarmonyPatch(typeof(InventoryGui), "UpdateInventoryWeight")] private class PatchInventoryGuiUpdateInventoryWeight { private static void Postfix() { UpdateTabText(force: false); } } [HarmonyPatch(typeof(InventoryGui), "OnSelectedItem")] private class PatchInventoryGuiOnSelectedItem { private static void Postfix(Modifier mod) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)mod == 0) { UpdateTabText(force: true); } } } [HarmonyPatch(typeof(Container), "Awake")] private class PatchContainerAwake { private static bool m_newChest; public static void Prefix(Container __instance) { ZNetView val = (Object.op_Implicit((Object)(object)__instance.m_rootObjectOverride) ? ((Component)__instance.m_rootObjectOverride).GetComponent() : ((Component)__instance).GetComponent()); if (val.GetZDO() != null) { m_newChest = val.IsOwner() && !val.GetZDO().GetBool(ZDOVars.s_addedDefaultItems, false); } } public static void Postfix(Container __instance, ZNetView ___m_nview, Inventory ___m_inventory, ref bool ___m_loading) { //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown bool newChest = m_newChest; m_newChest = false; if (___m_inventory == null || ((Object)(object)___m_nview == (Object)null && !___m_nview.IsOwner())) { return; } if (WUTIL.GameName(((Component)__instance).gameObject) != "GhostChest") { World.TrackSunkenChest(__instance, newChest); } else if (m_contents.Count > 0) { WDBUG.Log($"Awake {__instance.m_name} saving {m_contents.Count} items to Ghost Chest"); ___m_inventory.RemoveAll(); foreach (KeyValuePair content in m_contents) { ItemData key = content.Key; key.m_gridPos.y = content.Value / 100; key.m_gridPos.x = content.Value - key.m_gridPos.y * 100; if (string.IsNullOrEmpty(key.m_crafterName)) { key.m_crafterID = WUTIL.PlayerID; } WUTIL.ForceAddItemToInventory(___m_inventory, key); } m_contents.Clear(); ZPackage val = new ZPackage(); ___m_inventory.Save(val); string @base = val.GetBase64(); ___m_nview.GetZDO().Set("items", @base); } else { string text = ___m_nview.GetZDO().GetString("items", ""); if (!string.IsNullOrEmpty(text)) { ZPackage val2 = new ZPackage(text); ___m_loading = true; ___m_inventory.Load(val2); ___m_loading = false; } WDBUG.Log($"Awake {__instance.m_name} deferred recall of {___m_inventory.NrOfItems()} items", WDBUG.Level.MagicChest); m_startupContainers.Add(__instance); } } } public static bool m_forceInventoryUpdate = false; private const int c_chestRows = 1; private const float c_tabIconOffset = 4f; private const string c_magicChestName = "MagicChest"; private static Vector3 c_tabIconScale = new Vector3(1.2f, 1.2f, 0f); private static bool m_isClosed = true; private static bool m_preventUpdate = false; private static int m_last_inventoryRows = 4; private static float m_inventoryOffset = 0f; private static float m_containerOffset = 0f; private static float m_contentWeight = 0f; private static float m_totalWeightCheck = 0f; private static float m_inventoryArmorOffset = 0f; private static float m_inventoryWeightOffset = 0f; private static Transform m_inventoryTab = null; private static Transform m_inventoryTransform = null; private static Transform m_invSunkenTransform = null; private static Transform m_containerTransform = null; private static Transform m_inventoryArmorTransform = null; private static Transform m_inventoryWeightTransform = null; private static ItemData m_magicChest = null; private static Resolution m_resolution = default(Resolution); private static Dictionary m_contents = new Dictionary(); private static List m_startupContainers = new List(); public static void UpdateInventory() { if (WUTIL.m_updateLateStartup) { return; } if (m_forceInventoryUpdate || m_last_inventoryRows != Wildling.InventoryRows) { WDBUG.Log($"Update inventory size force: {m_forceInventoryUpdate}, row last: {m_last_inventoryRows} current: {Wildling.InventoryRows}", WDBUG.Level.MagicChest); int num = (m_last_inventoryRows = Wildling.InventoryRows); if (IsOpen()) { num++; } if (m_forceInventoryUpdate) { m_forceInventoryUpdate = false; ResizeInventory(num, add: false); } else { ResizeInventory(num - ((Humanoid)Player.m_localPlayer).GetInventory().GetHeight()); } } UpdateChest(); } public static void ResetInventory() { //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) m_resolution = Screen.currentResolution; ((Resolution)(ref m_resolution)).width = Screen.width; ((Resolution)(ref m_resolution)).height = Screen.height; WDBUG.Log($"ResetInventory for screen resolution: {Screen.width} x {Screen.height}", WDBUG.Level.GUI); if ((Object)(object)m_inventoryTransform != (Object)null) { SetInventoryBkgd(4, checkChest: false); m_inventoryTransform = null; m_forceInventoryUpdate = true; } } public static void SetContent(string items) { WDBUG.Log("MagicChest SetContent: " + items, WDBUG.Level.MagicChest); int num = 100 * ((Humanoid)Player.m_localPlayer).GetInventory().GetHeight(); string[] array = items.Split(new char[1] { ',' }); foreach (string text in array) { ItemData val = WUTIL.CreateItemData(text); if (val != null) { WDBUG.Log($"Adding {text} to Magic Chest at {num}", WDBUG.Level.MagicChest); m_contents.Add(val, num++); } else { WDBUG.Log($"Failed to add {text} to Magic Chest at {num}"); } } } public static bool BlockEquip(ItemData item) { return m_magicChest != null && item != m_magicChest && WUTIL.ItemName(item) == "MagicChest"; } public static bool CheckSideEffects(ItemData item) { return WUTIL.ItemName(item) == "MagicChest" && Equipment.PendingDefferUnequip(cancel: true); } public static bool IsOpen() { m_magicChest = WUTIL.GetInventoryItemData("MagicChest"); return m_magicChest != null && !m_magicChest.m_equipped; } public static void ResizeInventory(int numRows, bool add = true) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown WDBUG.Log($"ResizeInventory rows: {numRows} add: {add} Extra: {IsOpen()}", WDBUG.Level.GUI); Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || numRows == 0) { return; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); int height = inventory.GetHeight(); if (add) { numRows += height; } if (numRows < 1 || numRows > 9) { WDBUG.Log($"Prevent attempt to open chest to size {numRows} - that's just redicuous.", WDBUG.Level.warn, 5f); return; } bool flag = m_magicChest != null && height > numRows; if (m_magicChest != null && height > numRows) { inventory.RemoveItem(m_magicChest); if (m_magicChest.m_equipped) { WeighAndTransfer(transfer: true, numRows + 1, noMagicChests: false); } } WUTIL.ShowHandItems(); bool isClosed = m_magicChest == null || m_magicChest.m_equipped; m_preventUpdate = true; WUTIL.m_allowCustomEquip = false; WUTIL.UnequipAllTemporary(0f); Inventory val = new Inventory("Inventory", (Sprite)null, 8, numRows); val.MoveAll(inventory); if (flag && m_magicChest != null) { int x = m_magicChest.m_gridPos.x; int y = m_magicChest.m_gridPos.y; if (y < numRows && val.GetItemAt(x, y) == null) { WDBUG.Log($"Restoring MagicChest to pos {x},{y}", WDBUG.Level.MagicChest); val.AddItem(m_magicChest); m_magicChest.m_gridPos.x = x; m_magicChest.m_gridPos.y = y; } else if (WUTIL.CompressInventory(val)) { WDBUG.Log($"Compressed inventory to hold Magic Chest from pos {x},{y}", WDBUG.Level.MagicChest); val.AddItem(m_magicChest); } else { WDBUG.Log("Could not compress inventory to fit MagicChest"); WDBUG.Log($"Attempting to swap out last item at {x},{numRows - 1}"); ItemData itemAt = val.GetItemAt(x, numRows - 1); val.RemoveItem(itemAt); inventory.AddItem(itemAt); val.AddItem(m_magicChest); } } List list = new List(inventory.GetAllItems()); if (list.Count > 0) { if (WDBUG.DestroyExcessInventoryItems) { WDBUG.Log($"Magic Chest destroyed {list.Count} excess items.", WDBUG.Level.MagicChest); } else { foreach (ItemData item in list) { WDBUG.Log($"Forced drop of {item.m_shared.m_name} ({item.m_stack})", WDBUG.Level.MagicChest); ((Humanoid)localPlayer).DropItem(inventory, item, item.m_stack); } } } Traverse.Create((object)localPlayer).Field("m_inventory").SetValue((object)val); m_isClosed = isClosed; SetInventoryBkgd(numRows); WUTIL.RecallEquiped(); m_preventUpdate = false; WUTIL.m_allowCustomEquip = true; if (WUTIL.m_captureHeldItems) { WDBUG.Log("HideHandItems after inventory toggle", WDBUG.Level.MagicChest); WUTIL.HideHandItems(); } } public static bool ShowInventoryTab(float tabOffset) { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_0113: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_inventoryTab == (Object)null) { WDBUG.Log("Creating Magic Chest Inventory Tab", WDBUG.Level.MagicChest); Transform transform = ((Component)InventoryGui.instance.m_player).transform; Transform val = transform.Find("Weight"); if ((Object)(object)val == (Object)null) { return false; } m_inventoryTab = Object.Instantiate(val, transform); ((Object)((Component)m_inventoryTab).gameObject).name = "MagicChestTab"; m_inventoryTab.SetAsFirstSibling(); WUTIL.SetGUIText(m_inventoryTab.Find("weight_text"), ""); ItemDrop component = WUTIL.GetPrefab("MagicChest").GetComponent(); Transform val2 = m_inventoryTab.Find("weight_icon"); Image component2 = ((Component)val2).GetComponent(); component2.sprite = component.m_itemData.m_shared.m_icons[0]; val2.localScale = c_tabIconScale; val2.localPosition = new Vector3(0f, val2.localPosition.y - 4f, 0f); } Vector3 localPosition = m_inventoryTab.localPosition; localPosition.y = tabOffset; m_inventoryTab.localPosition = localPosition; m_inventoryTab.localScale = (m_isClosed ? Vector3.zero : Vector3.one); return !m_isClosed; } public static void UpdateTabText(bool force) { if (!m_isClosed && !((Object)(object)m_inventoryTab == (Object)null)) { float totalWeight = ((Humanoid)Player.m_localPlayer).GetInventory().GetTotalWeight(); bool flag = force || totalWeight != m_totalWeightCheck; if (flag) { m_totalWeightCheck = totalWeight; m_contentWeight = WeighAndTransfer(transfer: false); } string text = "-/-"; if (m_contentWeight >= 0f) { int num = Mathf.CeilToInt(totalWeight - m_contentWeight); int num2 = Mathf.CeilToInt(Player.m_localPlayer.GetMaxCarryWeight()); string arg = ((num > num2 && Mathf.Sin(Time.time * 10f) > 0f) ? $"{num}" : num.ToString()); text = $"{arg}/{Mathf.CeilToInt(m_contentWeight)}"; flag = flag || num > num2; } if (flag || m_contentWeight < 0f) { WUTIL.SetGUIText(m_inventoryTab.Find("weight_text"), text); } } } public static void OnShutdown(bool forceDrop = false) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (m_contents.Count <= 0) { return; } if (m_magicChest == null || forceDrop) { if (m_magicChest != null) { WDBUG.Log("Forced dropped Ghost Container"); } Place.Object("GhostChest", ((Component)Player.m_localPlayer).transform.position); } else { if (m_magicChest.m_equipped) { int num = ((Humanoid)Player.m_localPlayer).GetInventory().NrOfItems(); Open(); WDBUG.Log($"Shutdown exposed Magic Chest items: {((Humanoid)Player.m_localPlayer).GetInventory().NrOfItems() - num}", WDBUG.Level.MagicChest); } m_magicChest = null; } m_contents.Clear(); } public static void CheckSetupInventories(bool reset = false) { if (reset) { m_contents.Clear(); m_startupContainers.Clear(); } if ((Object)(object)Player.m_localPlayer == (Object)null || m_startupContainers.Count == 0) { return; } long playerID = WUTIL.PlayerID; foreach (Container startupContainer in m_startupContainers) { Inventory inventory = startupContainer.GetInventory(); foreach (ItemData allItem in inventory.GetAllItems()) { if (allItem.m_crafterID != playerID) { break; } WDBUG.Log($"Recalling {allItem.m_stack}x {WUTIL.ItemName(allItem)} at {allItem.m_gridPos.x},{allItem.m_gridPos.x} ownerID: {allItem.m_crafterID} '{allItem.m_crafterName}'", WDBUG.Level.MagicChest); if (string.IsNullOrEmpty(allItem.m_crafterName)) { allItem.m_crafterID = 0L; } m_contents.Add(allItem, allItem.m_gridPos.y * 100 + allItem.m_gridPos.x); } inventory.RemoveAll(); } m_startupContainers.Clear(); } private static bool UpdateChest() { if ((Object)(object)m_inventoryTransform == (Object)null) { return false; } if (WUTIL.m_updateLateStartup || m_preventUpdate) { WDBUG.Log($"Blocked call for Magic Chest Open: {IsOpen()} Closed: {m_isClosed}", WDBUG.Level.MagicChest); return false; } if (IsOpen() != m_isClosed) { return false; } if (m_isClosed) { if (m_contents.Count == 0) { if (Quest.GetAchievement("FairyTale") == 0) { WDBUG.Log("Open Chest with 0 items - adding FairyTale", WDBUG.Level.MagicChest); Quest.SetAchievement("FairyTale", 1); SetContent("FairyTale"); WUTIL.PlaySecretFoundSfx(6); Quest.CheckObjective(33, set: false); Quest.CheckObjective(34); } else { CheckSetupInventories(); } } Open(); m_isClosed = false; } else { if (WeighAndTransfer(transfer: true) < 0f) { WDBUG.Log($"Cannot close MagicChest: {m_magicChest != null} Open: {IsOpen()} Closed: {m_isClosed}", WDBUG.Level.MagicChest); ((Humanoid)Player.m_localPlayer).UnequipItem(m_magicChest, true); m_isClosed = false; return false; } ResizeInventory(-1); m_isClosed = true; } WUTIL.UpdateInventoryRecipes(); return true; } private static void Open() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown WDBUG.Log("MagicChest Open", WDBUG.Level.MagicChest); ResizeInventory(1); Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); Inventory val = new Inventory("passInventory", (Sprite)null, 8, 1); int width = inventory.GetWidth(); int num = inventory.GetHeight() - 1; List list = new List(); int num2 = 0; foreach (KeyValuePair content in m_contents) { int num3 = content.Value / 100; if (num2 < num3) { num2 = num3; } } foreach (KeyValuePair content2 in m_contents) { ItemData key = content2.Key; int num4 = content2.Value / 100; int num5 = content2.Value - num4; if (num4 == num2 && num5 < width) { WDBUG.Log($"Recalling {((Object)key.m_dropPrefab).name} to original Inventory at {num5},{num}", WDBUG.Level.MagicChest); val.AddItem(key); inventory.MoveItemToThis(val, key, key.m_stack, num5, num); list.Add(num5); } } foreach (KeyValuePair content3 in m_contents) { ItemData key2 = content3.Key; int num6 = content3.Value / 100; int num7 = content3.Value - num6 * 100; bool flag = num7 >= width || list.Contains(num7); if (flag) { for (int i = 0; i < width; i++) { if (!list.Contains(i)) { num7 = i; flag = false; break; } } } if (flag) { WDBUG.Log("MagicChest does not have enough space for " + ((Object)key2.m_dropPrefab).name + " - losing"); continue; } WDBUG.Log($"Recalling {((Object)content3.Key.m_dropPrefab).name} to new inventory at {num7},{num}", WDBUG.Level.MagicChest); val.AddItem(key2); inventory.MoveItemToThis(val, key2, key2.m_stack, num7, num); list.Add(num7); } m_contents.Clear(); } private static float WeighAndTransfer(bool transfer, int lastRowOverride = 0, bool noMagicChests = true) { if (transfer && m_contents.Count > 0) { WDBUG.Log("CloseMagicChest on non-empty MagicChest", WDBUG.Level.MagicChest); return -1f; } if (lastRowOverride > 0) { WDBUG.Log("WeighAndTransfer force container transfer for items on row " + lastRowOverride, WDBUG.Level.MagicChest); } else if (m_magicChest != null) { int num = CheckContents(); if (num < 0) { if (CannotClose()) { if (transfer) { WUTIL.Message("Magic chest may not be closed because you carry too many unportable items."); } return -1f; } if (transfer) { ItemData inventoryItemData = WUTIL.GetInventoryItemData("MagicChest"); WUTIL.Message("Magic chest cannot contain non-teleportable items.", Object.op_Implicit((Object)(object)inventoryItemData.m_shared.m_icons[0])); } } } Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); int count = inventory.GetAllItems().Count; int height = inventory.GetHeight(); int width = inventory.GetWidth(); int num2 = ((lastRowOverride > 0) ? (lastRowOverride - 1) : (height - 1)); int num3 = 0; int num4 = 0; SortedList sortedList = new SortedList(); foreach (ItemData allItem in inventory.GetAllItems()) { if ((!noMagicChests || !(WUTIL.ItemName(allItem) == "MagicChest")) && allItem.m_shared.m_teleportable && allItem != m_magicChest) { num3++; if (allItem.m_gridPos.y == num2) { num4++; } int num5 = allItem.m_gridPos.y * 100 + allItem.m_gridPos.x; sortedList.Add(-num5, allItem); } } int num6 = count - num2 * width; int num7 = ((num6 > num4) ? num6 : num4); float num8 = 0f; if (num7 > 0) { foreach (KeyValuePair item in sortedList) { ItemData value = item.Value; ((Humanoid)Player.m_localPlayer).UnequipItem(value, true); num8 += value.GetWeight(-1); if (transfer) { int num9 = -item.Key; m_contents.Add(value, num9); inventory.RemoveItem(value); int num10 = num9 / 100; int num11 = num9 - num10 * 100; WDBUG.Log($"Stashing {((Object)value.m_dropPrefab).name} at [{num11},{num10}]", WDBUG.Level.MagicChest); } if (--num7 == 0) { break; } } } if (transfer) { WDBUG.Log(string.Format("{0} closed containing {1} items weighting {2}", "MagicChest", m_contents.Count, num8), WDBUG.Level.MagicChest); } return num8; } private static int CheckContents() { Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); int num = inventory.GetHeight() - 1; int num2 = 0; foreach (ItemData allItem in inventory.GetAllItems()) { if (allItem.m_gridPos.y == num) { if (!allItem.m_shared.m_teleportable) { return -1; } num2++; } } return num2; } private static bool CannotClose() { Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); List list = new List(); foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { int num = allItem.m_stack; if (num == allItem.m_shared.m_maxStackSize) { list.Add(allItem.Clone()); continue; } foreach (ItemData item in list) { if (item.m_shared.m_name == allItem.m_shared.m_name && item.m_quality == allItem.m_quality) { int num2 = item.m_shared.m_maxStackSize - item.m_stack; item.m_stack += ((num <= num2) ? num : num2); num -= num2; if (num <= 0) { break; } } } if (num > 0) { list.Add(allItem.Clone()); } } int num3 = list.Count - inventory.GetWidth() * (inventory.GetHeight() - 1); if (num3 <= 0) { return false; } foreach (ItemData item2 in list) { if (item2.m_shared.m_teleportable && WUTIL.TrimWildlingTag(((Object)item2.m_dropPrefab).name) != "MagicChest" && --num3 == 0) { return false; } } return true; } private static void SetInventoryBkgd(int numRows, bool checkChest = true) { //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_inventoryTransform)) { Transform transform = ((Component)InventoryGui.instance.m_player).transform; if (!Object.op_Implicit((Object)(object)transform)) { WDBUG.Log("Inventory transforms not ready"); return; } m_inventoryTransform = transform.Find("Bkg"); m_invSunkenTransform = transform.Find("sunken"); m_containerTransform = transform.parent.Find("Container"); m_inventoryArmorTransform = transform.Find("Armor"); m_inventoryWeightTransform = transform.Find("Weight"); m_inventoryOffset = m_inventoryTransform.localPosition.y; m_containerOffset = m_containerTransform.localPosition.y; m_inventoryArmorOffset = m_inventoryArmorTransform.localPosition.y; m_inventoryWeightOffset = m_inventoryWeightTransform.localPosition.y; } if (numRows < 1) { return; } float num = (float)numRows * 0.25f; m_inventoryTransform.localScale = new Vector3(1f, num, 1f); m_invSunkenTransform.localScale = new Vector3(1f, num, 1f); num *= m_inventoryOffset; Vector3 localPosition = m_inventoryTransform.localPosition; localPosition.y = num; Vector3 localPosition2 = m_containerTransform.localPosition; localPosition2.y = m_containerOffset + 2f * (num - m_inventoryOffset); Vector3 localPosition3 = m_inventoryArmorTransform.localPosition; localPosition3.y = m_inventoryArmorOffset; Vector3 localPosition4 = m_inventoryWeightTransform.localPosition; localPosition4.y = m_inventoryWeightOffset; if (numRows < 4) { localPosition3.y += 40f; localPosition4.y += 118f; } if (checkChest) { try { float num2 = (float)(28 + numRows) + 2f * num; if (ShowInventoryTab(num2)) { if (numRows == 4) { localPosition4.y = 14f + 0.5f * (localPosition3.y + num2); } } else if (numRows == 3) { localPosition3.y -= 40f; localPosition4.y -= 40f; } } catch { WDBUG.Log("Catch inventory tab issue"); } } ((Component)m_inventoryTransform).transform.localPosition = localPosition; ((Component)m_containerTransform).transform.localPosition = localPosition2; ((Component)m_inventoryArmorTransform).transform.localPosition = localPosition3; ((Component)m_inventoryWeightTransform).transform.localPosition = localPosition4; } } internal class Pocket { [HarmonyPatch(typeof(InventoryGui), "UpdateContainer")] private class PatchInventoryGuiUpdateContainer { private static void Prefix(ref bool ___m_firstContainerUpdate) { Update(ref ___m_firstContainerUpdate); } } [HarmonyPatch(typeof(UITooltip), "OnHoverStart")] private class PatchUITooltipOnHoverStart { private static void Postfix(GameObject go, string ___m_topic) { if (WUTIL.GameName(((Object)go).name) == "InventoryElement") { HoverItem(___m_topic); } } } [HarmonyPatch(typeof(InventoryGui), "UpdateContainerWeight")] private class PatchInventoryGuiUpdateContainerWeight { private static bool Prefix() { return !IsOpen(); } } [HarmonyPatch(typeof(InventoryGui), "OnSelectedItem")] private class PatchInventoryGuiOnSelectedItem { private static bool Prefix(ItemData item, Modifier mod, InventoryGrid ___m_containerGrid) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 if (IsOpen()) { m_activeItemSeleted = true; if ((int)mod != 1 || item.m_stack <= 1) { Pick(item, ___m_containerGrid); return false; } m_pickItem = item; } else if ((int)mod == 1) { string text = WUTIL.ItemName(item); if (text == "HealingSalve" || text == "PatchKit") { WUTIL.Message("This item cannot be split."); return false; } } return true; } private static void Postfix(Modifier mod, InventoryGrid ___m_containerGrid) { m_activeItemSeleted = false; if (IsOpen()) { Transform transform = ((Component)InventoryGui.instance.m_player).transform; ((Component)transform.parent.Find("SplitDialog/darken")).gameObject.SetActive(false); } } } [HarmonyPatch(typeof(InventoryGui), "OnSplitOk")] private class PatchInventoryGuiUpdateOnSplitOk { private static void Prefix(ref ItemData ___m_splitItem, Slider ___m_splitSlider, InventoryGrid ___m_containerGrid) { if (m_pickItem != null) { int num = (int)___m_splitSlider.value; WDBUG.Log($"Attempting to steal {num}/{___m_splitItem.m_stack} is same: {___m_splitItem == m_pickItem}", WDBUG.Level.Pickpocket); Pick(m_pickItem, ___m_containerGrid, num); ___m_splitItem = null; } } } private static Dictionary m_materialValues = new Dictionary { { "GreydwarfEye", 2 }, { "TrophyGreydwarf", 2 }, { "TrophyGreydwarfBrute", 5 }, { "TrophyGreydwarfShaman", 10 }, { "AncientSeed", 50 }, { "TrophyWolf", 10 }, { "TrophyHatchling", 15 }, { "TrophyLox", 15 }, { "TrophySerpent", 50 }, { "DeerHide", 2 }, { "TrollHide", 5 }, { "WolfPelt", 10 }, { "LoxPelt", 10 }, { "BjornHide", 10 }, { "BlackMetalScrap", 20 }, { "BlackMetal", 25 }, { "FlametalOre", 30 }, { "Flametal", 40 } }; private static bool m_activeItemSeleted = false; private const int c_minItemSlots = 3; private const int c_maxItemSlots = 8; private const int c_peekDailyMax = 3; private const int c_repickPeriodOffset = 100; private const int c_pickMinTime = 5; private const int c_pickMidTime = 45; private const int c_pickMaxTime = 85; private const float c_ownerUpdateTime = 60f; private const float m_pickWeightToTime = 2f; private const float m_pickTimeColorRate = 0.75f; private const float c_openTime = 10f; private const float c_openDelay = 0.4f; private const float c_pickMaxStackFind = 0.1f; private const float c_pickMaxStackFindBoss = 0.4f; private const float c_bribeLevelFactor = 1f; private const float c_bribeHealthFactor = 0.01f; private static Vector3 m_inventoryOffset = new Vector3(650f, -320f, 0f); private static Vector3 m_ownerTabOffset = new Vector3(0f, -96f, 0f); private static int m_pickItemTime = 0; private static int m_hourCheck = 0; private static float m_timeOpenBuff = 0f; private static bool m_opened = false; private static bool m_closeLate = false; private static bool m_openLate = false; private static bool m_openRequiresUnarmed = true; private static bool m_picking = false; private static float m_pickChance = 0f; private static int m_pickItemAmount = 0; private static bool m_ownerIsPrince = false; private static string m_ownerName = ""; private static string m_ownerCrown = ""; private static string m_ownerIcon = ""; private static ItemData m_pickItem = null; private static InventoryGrid m_containerGrid = null; private static Container m_pocket = null; private static Transform m_transform = null; private static Vector3 m_origPos = Vector3.zero; private static Character m_owner = null; private static int m_ownerSize = 0; private static Transform m_ownerTab = null; private static Vector3 m_ownerTabOrigPos = Vector3.zero; private static Vector3 m_ownerCrownOrigPos = Vector3.zero; private static Sprite m_ownerTabOrigSprite = null; private static Sprite m_ownerCrownOrigSprite = null; private static Dictionary m_hotPockets = new Dictionary(); private static Dictionary m_goblinItems = new Dictionary { { "Goblin", "Coins,BlackMetalScrap,RawMeat,LeatherScraps,FishRaw,FishWraps,KnifeFlint" }, { "GoblinArcher", "Coins,BlackMetalScrap,DeerMeat,DeerHide,AmberPearl,Feathers,KnifeCopper" }, { "GoblinBrute", "Coins,BlackMetalScrap,LoxMeat,LoxPelt,LoxPie,Ruby,DoxieDust,Battleaxe" }, { "GoblinShaman", "Coins,BlackMetalScrap,DeerMeat,Pukeberries,GreydwarfEye,BloodPudding,BarleyWine,PixieDust" } }; private const float c_pickDistance = 1.4f; private const float c_pickDistanceBrute = 2f; private const float c_pickDistanceTooClose = 0.7f; private const float c_ownerTabSizeSmall = 1.1f; private const float c_ownerTabSizeMedium = 0.65f; private const float c_ownerTabSizeLarge = 0.9f; private const float c_ownerTabRaise = 28f; public static string PickReady(Character character) { if ((Object)(object)m_pocket != (Object)null || !Pickable(character, checkPickReady: false)) { return ""; } int num = Hotness(character); if (num >= 100) { return "Too soon to pickpocket again."; } if (num >= 3) { return "You have perused these pockets too many times today."; } bool flag = m_openRequiresUnarmed && WUTIL.GetRightItem() != null; if (!Alignment.PlayerIsHiding()) { string text = (flag ? "unarmed" : "close but not touching"); return "You must be hidden and " + text + " to start pickpocketing."; } if (flag) { return "You must be unarmed to pickpocket."; } return "yes"; } public static bool Open(Character character) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_pocket != (Object)null || !Pickable(character)) { return false; } int num = Hotness(character); if (num >= 3) { return false; } Player localPlayer = Player.m_localPlayer; GameObject val = WUTIL.PlaceObject("Chest", ((Component)localPlayer).transform.position, Vector3.forward); val.transform.localScale = new Vector3(0.01f, 0.01f, 0.01f); m_pocket = val.GetComponent(); if ((Object)(object)m_pocket == (Object)null) { WDBUG.Log("Failed to open Goblin inventory"); return false; } m_openLate = true; m_pickItemTime = 0; WUTIL.TimerReset("pocketcooldown", 0.4f); CustomizeForOwner(character); string content = GetContent(); if (++num >= 3) { num = 3 + PeriodOfDay(); } SetContent(content, num); ConfigVisual(content, m_ownerIsPrince ? 0.4f : 0.1f); m_pocket.Interact((Humanoid)(object)localPlayer, false, false); ((Component)m_pocket).gameObject.SetActive(false); return true; } public static bool Update(ref bool firstContainerUpdate) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.Timer("pocket_owner_cleanup") == 0f) { OwnerUpdate(); } if (m_opened) { m_opened = false; firstContainerUpdate = false; return false; } if ((Object)(object)m_pocket == (Object)null || WUTIL.Timer("pocketcooldown") > 0f) { return false; } if (m_closeLate) { WDBUG.Log("Pocket completing close", WDBUG.Level.Pickpocket); m_closeLate = false; ConfigVisual(); WUTIL.Destroy(((Component)m_pocket).gameObject); m_containerGrid = null; m_pocket = null; Quest.ShowMainTutorial(12); return false; } float num = (int)(10f * WUTIL.Timer("pickpocket_progress")); if (m_openLate) { m_transform.localScale = Vector3.one; m_transform.localPosition = m_inventoryOffset; m_ownerTab.localPosition = m_ownerTabOffset; m_openLate = false; ((Component)m_pocket).gameObject.SetActive(true); WUTIL.TimerReset("pickpocket", 10f + m_timeOpenBuff); } else if (WUTIL.Timer("pickpocket") == 0f || !m_pocket.IsInUse() || !Pickable(m_owner)) { if (InventoryGui.IsVisible()) { if (m_picking && num > 0f) { WUTIL.Message("Pickpocket interrupted"); } WDBUG.Log("Pocket closing", WDBUG.Level.Pickpocket); m_owner = null; ((Component)m_pocket).gameObject.SetActive(false); ((Component)m_transform).transform.localScale = Vector3.zero; InventoryGui.instance.Hide(); WUTIL.TimerReset("pocketcooldown", 0.4f); WUTIL.TimerReset("pickpocket_progress"); m_containerGrid = null; m_pickItem = null; m_pickItemAmount = 0; m_picking = false; m_closeLate = true; } } else { if (m_picking) { if (num == 0f) { Picked(); } } else { num = m_pickItemTime; } int num2 = (int)(10f * WUTIL.Timer("pickpocket")); float num3 = ((num > 0f) ? ((float)num2 * 0.75f / num) : 1f); string arg = "green"; if (num3 <= 0.5f) { arg = "#F00"; } else if (num3 <= 0.75f) { arg = "#FA0"; } else if (num3 < 1f) { arg = "#FF0"; } WUTIL.SetGUIText(m_ownerTab.Find("weight_text"), $"{num}/{num2}"); } return true; } public static bool IsOpen() { if (m_closeLate) { bool firstContainerUpdate = false; return Update(ref firstContainerUpdate); } return (Object)(object)m_pocket != (Object)null; } public static bool LostContact(Character character) { if (IsOpen() && !Pickable(character)) { m_pocket.SetInUse(false); return true; } return false; } public static void HoverItem(string name) { if (!((Object)(object)m_pocket != (Object)null) || m_picking) { return; } ItemData item = null; foreach (ItemData allItem in m_pocket.GetInventory().GetAllItems()) { if (allItem.m_shared.m_name == name) { item = allItem; break; } } PocketItemSetPickTime(item); } public static string PickupBribe(Character character, ItemData item) { string hoverName = character.GetHoverName(); if ((Object)(object)m_pocket != (Object)null || Hotness(character) >= 100) { WUTIL.Message(hoverName + " has become suspicious."); if (!WUTIL.TestLuck(0.6f)) { character.GetBaseAI().Alert(); } return "ignore"; } float num = 1f * (float)character.GetLevel() + 0.01f * character.GetMaxHealth(); float itemCoinValue = GetItemCoinValue(item); string text = WUTIL.ItemName(item); WDBUG.Log($"{text} is worth {itemCoinValue} vs. minBribe: {num}"); if (text == "AncientSeed" && WUTIL.ActorName(character) == "GoblinShaman") { Wildling.ModifyDarklingLevel(1); WUTIL.CustomLog(hoverName + " corrupted the " + WUTIL.ItemName(item, goName: false), "#BD2"); WUTIL.CustomLog("You mood has become darker.", "#44F"); Quest.AdvanceAchievement("BadSeed"); return "BadSeed"; } if (itemCoinValue < num && !Alignment.IsBribed(character)) { WUTIL.Message(hoverName + " is insulted by your gift."); WUTIL.CustomLog(hoverName + " felt insulted by your bribe.", "#F44"); character.GetBaseAI().Alert(); return ""; } string result = ""; bool flag = false; CustomizeForOwner(character); string content = GetContent(); string[] array = content.Split(new char[1] { ',' }); foreach (string text2 in array) { WDBUG.Log("Checking pocket " + text2 + " vs. " + text, WDBUG.Level.Pickpocket); if (text2 == text) { flag = true; break; } } if (!flag) { SetContent(text); WDBUG.Log("Reset pocket items: " + GetContent()); } float num2 = itemCoinValue; bool flag2 = itemCoinValue >= 50f + num * 20f; if (flag2) { num2 = (num2 - 50f) / num; WUTIL.Message($"{character.GetHoverName()} took payment as a bodyguard, for a while. ({num2}s)"); Wildling.RaisePrimarySkill(16f, "hire " + hoverName, 5f, (SkillType)0); WUTIL.CustomLog(hoverName + " took your generous payment to protect you for a while.", "#FDO"); if (itemCoinValue >= 230f && Quest.AdvanceAchievement("BadSeed")) { Quest.CheckObjective(12, set: false); } } else if (itemCoinValue < 2f * num && !WUTIL.TestLuck(0.6f)) { num2 *= 0.25f; WUTIL.Message($"{hoverName} picked up your gift but doesn't look impressed. ({num2}s)"); Wildling.RaisePrimarySkill(4f, "poor bribe " + hoverName, 5f, (SkillType)0); WUTIL.CustomLog(hoverName + " was unimpressed by your bribe.", "#FDO"); } else { num2 *= 0.5f; WUTIL.Message(hoverName + " took your bribe and will ignore you, for a while."); int num3 = 10 * (int)(num2 / 10f); int num4 = 10; string text3 = " seconds."; if (num3 >= 60) { num4 = 5; num3 = 5 * (num3 / 300); text3 = " minutes."; } text3 = ((num3 < num4) ? "a few" : ("about " + num3)) + text3; WUTIL.CustomLog("You successfully bribed a " + hoverName + " for " + text3, "#FDO"); Wildling.RaisePrimarySkill(8f, "good bribe " + hoverName, 5f, (SkillType)0); } WUTIL.CreateHeadEffect("bribe_fx", character, attach: false, 0.5f * character.GetRadius()); Alignment.BribeCharacter(character, num2, flag2); Quest.AdvanceAchievement("Bribery", (int)itemCoinValue); return result; } public static float GetItemCoinValue(ItemData item, int amount = 0) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Invalid comparison between Unknown and I4 //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Invalid comparison between Unknown and I4 //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Invalid comparison between Unknown and I4 //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Invalid comparison between Unknown and I4 if (amount <= 0) { amount = item.m_stack; } float num = item.m_shared.m_value; if (num > 0f) { return num * (float)amount; } if (item.IsWeapon()) { num = ((DamageTypes)(ref item.m_shared.m_damages)).GetTotalDamage() + item.GetBlockPower(0f); return (num >= 500f) ? 50f : num; } if ((int)item.m_shared.m_itemType == 5) { return item.GetArmor() + item.GetBlockPower(0f); } if ((int)item.m_shared.m_itemType == 2 || (int)item.m_shared.m_itemType == 13) { string text = WUTIL.ItemName(item); num = ((!text.StartsWith("Mead") && !(text == "BarleyWine")) ? (2E-05f * (item.m_shared.m_food + item.m_shared.m_foodStamina) * item.m_shared.m_foodBurnTime * item.m_shared.m_foodRegen * item.m_shared.m_foodRegen) : ((float)(text.Length * 2))); } else if ((int)item.m_shared.m_itemType == 1) { string key = WUTIL.ItemName(item); if (m_materialValues.ContainsKey(key)) { num = m_materialValues[key]; } } return num * (float)amount; } public static bool InventoryItemJustSelected() { return m_activeItemSeleted; } private static bool Pickable(Character character, bool checkPickReady = true) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null || character.GetBaseAI().IsAlerted()) { return false; } if (checkPickReady && (!Alignment.PlayerIsHiding() || (m_openRequiresUnarmed && WUTIL.GetRightItem() != null))) { return false; } int ownerSize; switch (WUTIL.ActorName(character)) { default: ownerSize = 2; break; case "GoblinBrute": ownerSize = 3; break; case "Goblin": case "GoblinArcher": ownerSize = 1; break; } m_ownerSize = ownerSize; float num = ((m_ownerSize == 3) ? 2f : 1.4f); num *= 0.7f * WUTIL.GetLevelSize(character); float num2 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)character).transform.position); return num2 > num && num2 <= num + 1f; } private static int Hotness(Character character) { if (m_hotPockets.ContainsKey(character)) { return int.Parse(m_hotPockets[character].Split(new char[1] { ':' })[0]); } return 0; } private static void SetContent(string itemList = "", int setState = 0) { if (m_hotPockets.ContainsKey(m_owner)) { string[] array = m_hotPockets[m_owner].Split(new char[1] { ':' }); if (array[0] == "0") { itemList = array[1] + "," + itemList; } if (setState > 0) { array[0] = setState.ToString(); } m_hotPockets[m_owner] = array[0] + ":" + itemList; WDBUG.Log("Modified pocket content: " + m_hotPockets[m_owner], WDBUG.Level.Pickpocket); } else { m_hotPockets.Add(m_owner, setState + ":" + itemList); WDBUG.Log("Initial pocket content: " + m_hotPockets[m_owner], WDBUG.Level.Pickpocket); } } private static string GetContent() { string text = ""; if (m_hotPockets.ContainsKey(m_owner)) { string[] array = m_hotPockets[m_owner].Split(new char[1] { ':' }); if (!(array[0] == "0")) { return array[1]; } text = "," + array[1]; } int num = 2; string text2 = Loki.PrincelyInventory(m_owner); if (text2 == "") { if (m_goblinItems.ContainsKey(m_ownerName)) { text2 = m_goblinItems[m_ownerName]; } else { WDBUG.Log("No inventory for " + m_ownerName); text2 = m_goblinItems["Goblin"]; } num = 0; } text2 += text; List list = text2.Split(new char[1] { ',' }).ToList(); if (num <= 0 && list.Count > 3) { num = WUTIL.DieRoll(list.Count - 3 + 1); if (list.Count > 8) { num = 8 - list.Count; } } if (num > 0) { for (int i = 0; i < num; i++) { int index = 2 + WUTIL.DieRoll(list.Count - 2); list.RemoveAt(index); } text2 = string.Join(",", list); } return text2; } private static void PocketItemSetPickTime(ItemData item, int amount = 0) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 if (item == null) { m_pickItemTime = 0; } else if (item.IsWeapon()) { m_pickItemTime = (((int)item.m_shared.m_skillType == 2) ? 45 : 85); } else { m_pickItemTime = Mathf.Max((int)(2f * item.m_shared.m_weight * (float)((amount > 0) ? amount : item.m_stack)), 5); } } private static void Pick(ItemData item, InventoryGrid containerGrid, int amount = 0) { if (item != null && !m_picking && (Object)(object)m_pocket != (Object)null && m_pocket.IsInUse()) { PocketItemSetPickTime(item, amount); if (m_pickItemTime > 0) { float num = WUTIL.Timer("pickpocket"); m_pickChance = 10f * num / (float)m_pickItemTime; m_pickItem = item; m_containerGrid = containerGrid; m_pickItemAmount = amount; WUTIL.TimerReset("pickpocket_progress", m_pickItemTime / 10); m_picking = true; } } } private static void Picked() { if (m_pickItem == null || (Object)(object)m_pocket == (Object)null || (Object)(object)m_containerGrid == (Object)null) { return; } WDBUG.Log($"PocketPicked {WUTIL.ItemName(m_pickItem)} ({m_pickItemAmount}) chance: {m_pickChance}", WDBUG.Level.Pickpocket); if (m_pickChance < WUTIL.RandomSpin()) { WDBUG.Log("Pickpocket failed!", WDBUG.Level.alert); PickAlert(); } else { string text = WUTIL.ItemName(m_pickItem); Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); int num = 0; if (m_pickItemAmount <= 0) { m_pickItemAmount = m_pickItem.m_stack; if (!inventory.AddItem(m_pickItem)) { m_pickItemAmount -= m_pickItem.m_stack; WDBUG.Log($"Had room for only {m_pickItemAmount} of {m_pickItem.m_shared.m_name}", WDBUG.Level.alert); } if (m_pickItemAmount > 0) { num = (int)GetItemCoinValue(m_pickItem, m_pickItemAmount); m_pocket.GetInventory().RemoveItem(m_pickItem, m_pickItemAmount); } } else { ItemData val = WUTIL.CreateItemData(text, m_pickItemAmount); if (!inventory.AddItem(val)) { m_pickItemAmount -= val.m_stack; WDBUG.Log($"Had room for only {m_pickItemAmount} of {m_pickItem.m_shared.m_name}", WDBUG.Level.alert); } if (m_pickItemAmount > 0) { num = (int)GetItemCoinValue(m_pickItem, m_pickItemAmount); m_pocket.GetInventory().RemoveItem(m_pickItem.m_shared.m_name, m_pickItemAmount, -1, true); } } m_containerGrid.UpdateInventory(m_pocket.GetInventory(), (Player)null, (ItemData)null); if (Loki.LetterID(text) > 0) { Quest.AdvanceAchievement("stole_letter"); Quest.AdvanceAchievement("stole_" + text); Loki.SetCustomedTag(m_owner, Loki.GetCustomedTag(m_owner) & 5); Loki.ModifyDropList(m_owner, text, remove: true); } else if (Loki.WeaponID(text) > 0) { Quest.AdvanceAchievement("stole_lokiweapon"); Quest.AdvanceAchievement("stole_" + text); Loki.SetCustomedTag(m_owner, Loki.GetCustomedTag(m_owner) & 6); Loki.ModifyDropList(m_owner, text, remove: true); ReplaceStolenWeapon(); PickAlert(); num = 200; } WDBUG.Log($"Pickpocketed {m_pickItemAmount}x {text}", WDBUG.Level.Pickpocket); Quest.AdvanceAchievement("Pickpocket", num); WUTIL.TimerReset("attack_block_cooldown", 0.5f); if (num >= 200) { Quest.CheckObjective(11, set: false); } } SetContent("", 100 + PeriodOfDay()); m_picking = false; m_pickItemTime = 0; m_pickItemAmount = 0; m_pickItem = null; m_containerGrid = null; } public static void ReplaceStolenWeapon() { Inventory inventory = m_pocket.GetInventory(); ItemData val = null; foreach (ItemData allItem in inventory.GetAllItems()) { if (allItem.IsWeapon()) { val = allItem; break; } } Loki.ReplaceEquipedWeapon(m_owner, (val == null) ? "GoblinSpear" : WUTIL.ItemName(val)); } private static void PickAlert() { m_pocket.SetInUse(false); Alignment.BribeCharacter(m_owner, 0f); Alignment.HuntTargetAndAlert(m_owner, (Character)(object)Player.m_localPlayer); } private static int PeriodOfDay() { return (int)(EnvMan.instance.GetDayFraction() * 12f); } private static void OwnerUpdate() { WUTIL.TimerReset("pocket_owner_cleanup", 60f); int num = PeriodOfDay(); bool flag = m_hourCheck != num; if (flag) { m_hourCheck = num; } bool flag2 = false; Character[] array = m_hotPockets.Keys.ToArray(); foreach (Character val in array) { if ((Object)(object)val == (Object)null) { flag2 = true; } else { if (!flag) { continue; } int num2 = Hotness(val); if (num2 >= 3) { num2 -= ((num2 >= 100) ? 100 : 3); if (m_hourCheck == num2) { m_hotPockets[val] = ""; flag2 = true; } } } } if (!flag2) { return; } Dictionary dictionary = new Dictionary(); foreach (KeyValuePair hotPocket in m_hotPockets) { if ((Object)(object)hotPocket.Key != (Object)null && hotPocket.Value != "") { dictionary.Add(hotPocket.Key, hotPocket.Value); } } m_hotPockets = dictionary; } private static void CustomizeForOwner(Character character) { m_owner = character; m_ownerName = WUTIL.ActorName(m_owner); m_ownerIsPrince = Loki.PrincelyInventory(character) != ""; m_ownerSize = ((m_ownerName == "GoblinBrute") ? 3 : ((!(m_ownerName == "GoblinShaman")) ? 1 : 2)); m_ownerIcon = ((m_ownerSize >= 2) ? "TrophyGoblinBrute" : "TrophyGoblin"); m_ownerCrown = (m_ownerIsPrince ? "HelmetDverger" : ""); if (m_ownerSize != 2) { return; } Humanoid val = ((character != null) ? ((Component)character).gameObject.GetComponent() : null); m_ownerCrown = "TrophyGoblinShaman"; foreach (ItemData allItem in val.GetInventory().GetAllItems()) { if (WUTIL.ItemName(allItem) == "GoblinShaman_Headdress_antlers") { m_ownerCrown = "HelmetDrake"; break; } } } private static void ConfigVisual(string itemList = "", float maxStackFrac = 0f, string pocketText = "") { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) bool flag = itemList.Trim().Length == 0; if (!flag) { List list = itemList.Split(new char[1] { ',' }).ToList(); int num = list.Count; if (num == 0) { num = 8; } Inventory val = new Inventory(pocketText, (Sprite)null, num, 1); Traverse.Create((object)m_pocket).Field("m_inventory").SetValue((object)val); foreach (string item in list) { if (item.Length <= 2) { continue; } ItemData val2 = WUTIL.CreateItemData(item); if (val2 != null) { if (maxStackFrac >= 1f) { val2.m_stack = val2.m_shared.m_maxStackSize; } else if (maxStackFrac > 0f) { val2.m_stack = Mathf.Max(1, (int)(0.5f + maxStackFrac * (float)val2.m_shared.m_maxStackSize)); } val.AddItem(val2); } } } Transform transform = ((Component)InventoryGui.instance.m_player).transform; ((Component)transform.parent.Find("Player")).gameObject.SetActive(flag); ((Component)transform.parent.Find("Info")).gameObject.SetActive(flag); ((Component)transform.parent.Find("Crafting")).gameObject.SetActive(flag); Transform val3 = transform.parent.Find("Container"); m_transform = transform.parent; if ((Object)(object)val3 == (Object)null) { WDBUG.Log("Failed to find Goblin Container root"); return; } if (flag) { m_transform.localScale = Vector3.one; m_transform.localPosition = m_origPos; } else { m_transform.localScale = Vector3.zero; m_origPos = m_transform.localPosition; m_transform.localPosition = m_inventoryOffset; } ((Component)val3.Find("Bkg")).gameObject.SetActive(flag); ((Component)val3.Find("Darken")).gameObject.SetActive(flag); ((Component)val3.Find("TakeAll")).gameObject.SetActive(flag); m_ownerTab = ((Component)val3).transform.Find("Weight"); Transform val4 = ((Component)m_ownerTab).transform.Find("weight_icon"); if (m_ownerCrown == "") { ((Component)((Component)m_ownerTab).transform.Find("weight_icon")).gameObject.SetActive(flag); } else if (flag) { val4.localScale = Vector3.one; val4.localPosition = m_ownerCrownOrigPos; ((Component)val4).GetComponent().sprite = m_ownerCrownOrigSprite; } else { ItemDrop component = WUTIL.GetPrefab(m_ownerCrown).GetComponent(); m_ownerCrownOrigPos = val4.localPosition; Image component2 = ((Component)val4).GetComponent(); m_ownerCrownOrigSprite = component2.sprite; ((Component)val4).GetComponent().sprite = component.m_itemData.m_shared.m_icons[0]; if (m_ownerCrown == "HelmetDverger") { val4.localScale *= 1.1f; val4.localPosition += new Vector3(-2f, 13f, 0f); ((Graphic)component2).color = new Color(0.9f, 0.9f, 0.7f); } else if (m_ownerCrown == "HelmetDrake") { val4.localScale *= 0.9f; val4.localPosition += new Vector3(-1.6f, 4f, 0f); ((Graphic)component2).color = new Color(0.6f, 0.5f, 0.2f); } else if (m_ownerCrown == "TrophyGoblinShaman") { val4.localScale = new Vector3(4f, 1.3f, 4f); val4.localPosition += new Vector3(-1f, 13f, 0f); ((Graphic)component2).color = new Color(0.4f, 0.2f, 0f); } } Image component3 = ((Component)m_ownerTab.Find("bkg")).GetComponent(); if ((Object)(object)component3 == (Object)null) { WDBUG.Log("Failed to get image"); return; } if (flag) { component3.sprite = m_ownerTabOrigSprite; ((Component)component3).transform.localScale = Vector3.one; ((Component)component3).transform.localPosition = Vector3.zero; ((Component)m_ownerTab).transform.localPosition = m_ownerTabOrigPos; return; } m_ownerTabOrigPos = ((Component)m_ownerTab).transform.localPosition; m_ownerTabOffset.x = (7 - m_pocket.GetInventory().GetWidth()) * 35; ((Component)m_ownerTab).transform.localPosition = m_ownerTabOffset; m_ownerTabOrigSprite = component3.sprite; component3.sprite = WUTIL.GetIcon(m_ownerIcon); if (m_ownerSize == 2) { ((Graphic)component3).color = new Color(0.8f, 1f, 0.8f); } float num2 = ((m_ownerSize == 3) ? 0.9f : ((m_ownerSize == 2) ? 0.65f : 1.1f)); float num3 = ((m_ownerSize == 2) ? 0.52f : num2); ((Component)component3).transform.localScale = new Vector3(num2, num3, 1f); ((Component)component3).transform.localPosition = new Vector3(0f, 28f, 0f); m_opened = true; } } internal class Quest { [HarmonyPatch(typeof(OfferingBowl), "UseItem", null)] public class PatchOfferingBowlUseItem { public static bool Prefix(ItemData item, ItemDrop ___m_bossItem, ref bool __result) { if (!Wildling.IsWildling || (Object)(object)___m_bossItem == (Object)null || item.m_shared.m_name != ___m_bossItem.m_itemData.m_shared.m_name) { return true; } string text = WUTIL.ItemName(item); WDBUG.Log("Checking offering: " + text + " (" + item.m_shared.m_name + ")"); bool flag = text == "TrophyDeer"; if (flag || text == "AncientSeed") { string text2 = (flag ? "Eikthyr" : "The Elder"); int achievement = GetAchievement(flag ? "BoundYgnie" : "ElderLight"); if (achievement < 2 && WUTIL.Timer("boss_summon_confirm_time") == 0f) { string text3 = "If you summon " + text2 + " now you will "; if (achievement == 1) { text3 = text3 + "lose the ability to " + (flag ? "summon Ygnie" : "command the Greydwarf"); text3 += " but may continue the path of the wildling."; } else { text3 += "no longer be able to follow your path as the wildling and shall return to your older form when you next die."; } ShowDialogText("Instinct makes you pause to reconsider your action.", text3 + " Present your offering again now if this is your choice.", autoClose: true, (Style)2); WUTIL.CustomLog("You considered enraging " + text2 + " with a dark offering."); WUTIL.TimerReset("boss_summon_confirm_time", 20f); __result = true; return false; } if (achievement == 1) { if (flag) { SetAchievement("BoundYgnie", 2); Fairy.YgnieSummon(unsummon: true); } else { SetAchievement("ElderLight", 2); ElderWand.SetElderPower(set: false); } WUTIL.CustomLog("You have summoned " + text2 + " to anger and broken your sacred pact. A Darkling deed!"); Wildling.ModifyDarklingLevel(10); } else { Wildling.PlayState = 3; } } return true; } } [HarmonyPatch(typeof(Raven), "AddTempText")] private class PatchRavenAddTempText { private static string m_lastKey = ""; public static bool Prefix(string key, ref bool munin) { if (m_blockTutorials) { return false; } bool flag = key != m_lastKey; m_lastKey = key; if (key.StartsWith("Wildling:") && GetAchievement("MainTutorial") < 4) { if (flag) { WDBUG.Log("Suppressing Wildling Piece Tutorial: " + key, WDBUG.Level.Quest, 0.2f); } return false; } bool flag2 = Wildling.IsWildling; if (WUTIL.Timer("startupTutorialDelay") > 0f) { if (flag2) { WUTIL.TimerReset("startupTutorialDelay"); } flag2 = true; } if (m_forceMuninTutorial) { munin = true; m_forceMuninTutorial = false; } if (!Wildling.IsWildling) { if (key.StartsWith("Wildling:")) { if (flag) { WDBUG.Log("Suppressing Wildling Piece Tutorial: " + key, WDBUG.Level.Quest, 0.2f); } return false; } return true; } if (key.StartsWith("Munin: ")) { WDBUG.Log("Permitting Wildling Tutorial: " + key, WDBUG.Level.Quest, 0.2f); return true; } if (key == "death") { if (!Wildling.IsWildling && !Wildling.m_justDiedAsWildling) { return true; } if (flag) { ShowMainTutorial(0, 20f); } return false; } if (flag2) { if (flag) { WDBUG.Log("Suppressing non-Wildling Tutorial: " + key, WDBUG.Level.Quest, 0.2f); } return false; } if (flag) { WDBUG.Log($"Unexpected Tutorial: {key} Filtered: {flag2}", WDBUG.Level.warn, 0.2f); } return true; } } [HarmonyPatch(typeof(TextViewer), "LateUpdate")] private class PatchTextViewerLateUpdate { public static bool Prefix(TextViewer __instance, float ___m_showTime) { if (m_dialogAchievement == "" || ___m_showTime <= 0.2f) { return true; } return WUTIL.GetButton("Use") || Input.GetKeyDown((KeyCode)27); } } [HarmonyPatch(typeof(TextViewer), "Hide")] private class PatchTextViewerHide { public static void Postfix() { if (m_dialogAchievement != "") { WDBUG.Log("PatchTextViewHide"); AdvanceAchievement(m_dialogAchievement); m_dialogAchievement = ""; } } } [HarmonyPatch(typeof(Chat), "UpdateNpcTexts")] private class PatchChatUpdateNpcTexts { public static void Postfix(List ___m_npcTexts) { if (___m_npcTexts == null || (!(m_dialogAchievement != "") && !m_showProgression) || (___m_npcTexts.Count != 0 && !WUTIL.GetButton("Use"))) { return; } foreach (NpcText ___m_npcText in ___m_npcTexts) { ___m_npcText.m_ttl = 0f; } WUTIL.TimerReset("freeze_player_movement"); m_dialogAchievement = ""; m_showProgression = false; } } [HarmonyPatch(typeof(Chat), "ClearNpcText", new Type[] { typeof(NpcText) })] private class PatchChatNpcTextClearNpcText { public static bool Prefix(NpcText npcText) { return m_dialogAchievement == "" || npcText.m_ttl < 0.1f; } } [HarmonyPatch(typeof(Player), "SetSleeping")] private class PatchPlayerSetSleeping { public static bool Prefix(bool sleep, ref bool ___m_sleeping, ref DateTime ___m_wakeupTime) { if (m_badSleep && !sleep && ___m_sleeping != sleep) { ___m_sleeping = sleep; m_badSleep = false; ___m_wakeupTime = DateTime.Now; WUTIL.Message("$msg_goodmorning"); return false; } return true; } } [HarmonyPatch(typeof(SE_Rested), "UpdateStatusEffect")] private class PatchSE_RestedUpdateStatusEffect { private static void Postfix(float ___m_ttl, ref float ___m_time) { if (m_cancelRestedBonus) { m_cancelRestedBonus = false; ___m_time = ___m_ttl; } } } [HarmonyPatch(typeof(SleepText), "ShowDreamText")] private class PatchSleepTextShowDreamText { private static Color m_defaultTextColor = Color.black; public static bool Prefix(SleepText __instance) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) if (!Wildling.IsWildling || !Player.m_localPlayer.IsSleeping()) { return true; } if (++m_dreamCount > 1) { return true; } if (m_defaultTextColor == Color.black) { m_defaultTextColor = ((Graphic)__instance.m_dreamField).color; } string dreamText = GetDreamText(); if (dreamText == "") { ((Graphic)__instance.m_dreamField).color = m_defaultTextColor; PatchObjectives(force: true); CheckUpgrade(); return true; } float num = Mathf.Max(7f, 2f + 0.05f * (float)dreamText.Length); ((Behaviour)__instance.m_dreamField).enabled = true; ((Graphic)__instance.m_dreamField).canvasRenderer.SetAlpha(0f); ((Graphic)__instance.m_dreamField).CrossFadeAlpha(1f, 1.5f, true); __instance.m_dreamField.text = dreamText; ((Graphic)__instance.m_dreamField).color = (m_badSleep ? c_nightmareTextColor : c_dreamTextColor); ((MonoBehaviour)__instance).Invoke("HideDreamText", num); ShowMainTutorial(14); PatchObjectives(force: true); WUTIL.CustomLog("" + dreamText + "", m_badSleep ? "#44F" : "#4F4"); if (m_badSleep) { WUTIL.TimerReset("bad_dream_delay", 10f); } else { CheckUpgrade(); } return false; } private static void CheckUpgrade() { if (GetAchievement("UpgradeLevel") == 0) { AdvanceAchievement("UpgradeLevel"); MagicChest.m_forceInventoryUpdate = true; Wildling.SetWildlingStats(); WUTIL.TimerReset("awaking_message", 9f); } } private static string GetDreamText() { int num = Mathf.Min(10, (int)(50f * Wildling.SkillFactor((SkillType)0))); m_badSleep = GetAchievement("DeerKilled") >= num; string text = ""; if (m_badSleep) { text = m_animalNightmares[WUTIL.DieRoll(m_animalNightmares.Count)]; SetAchievement("DeerKilled", num); } else if (GetAchievement("GreydwarfKilled") >= num) { m_badSleep = true; text = m_greydwalfNightmares[WUTIL.DieRoll(m_greydwalfNightmares.Count)]; SetAchievement("GreydwarfKilled", num); } if (GetAchievement("GreydwarfKilled") > 0) { AdvanceAchievement("GreydwarfKilled", -1); } if (GetAchievement("DeerKilled") > 0) { AdvanceAchievement("DeerKilled", -1); } if (m_badSleep || WUTIL.RandomSpin() < 0.3f) { return text; } bool flag = GetAchievement("QuestEikthyr") < 3; bool flag2 = GetAchievement("QuestElder") < 3; if (flag && flag2) { flag = WUTIL.TestLuck(); } if (flag) { int achievement = GetAchievement("animalDreamSkip"); if (achievement > 0) { SetAchievement("animalDreamSkip", achievement - 1); return ""; } int achievement2 = GetAchievement("AnimalDreamState"); int achievement3 = GetAchievement("TimesBonded"); text = ((achievement2 < m_animalDreams.Count) ? m_animalDreams[achievement2] : ""); WDBUG.Log(string.Format("{0}: {1} bonded: {2}", "AnimalDreamState", achievement2, achievement3), WDBUG.Level.Quest); if (text != "" && achievement3 > 0) { if (achievement2 < achievement3 + 7) { SetAchievement("AnimalDreamState", achievement3 + 7); } } else if (achievement2 < 7) { AdvanceAchievement("AnimalDreamState"); } else if (achievement2 == 7 && WUTIL.TestLuck()) { SetAchievement("AnimalDreamState", achievement2 - WUTIL.DieRoll(3)); SetAchievement("animalDreamSkip", 1 + WUTIL.DieRoll(3)); } } if (text == "" && flag2) { int achievement4 = GetAchievement("barterDreamSkip"); if (achievement4 > 0) { SetAchievement("barterDreamSkip", achievement4 - 1); return ""; } int achievement5 = GetAchievement("BarterDreamState"); if (achievement5 < m_greydwarfDreams.Count) { text = m_greydwarfDreams[achievement5]; if (achievement5 < 3 || GetAchievement("Barter", achievement5 - 3) > 0) { AdvanceAchievement("BarterDreamState"); } else if (achievement5 >= 6 && GetAchievement("Barter") < 4) { AdvanceAchievement("BarterDreamState", -WUTIL.DieRoll(3)); SetAchievement("barterDreamSkip", 2 + WUTIL.DieRoll(3)); } else if (achievement5 >= 4 && GetAchievement("Barter") < 2) { AdvanceAchievement("BarterDreamState", -WUTIL.DieRoll(3)); SetAchievement("barterDreamSkip", 1 + WUTIL.DieRoll(2)); } else { AdvanceAchievement("BarterDreamState"); } } else if (WUTIL.TestLuck()) { AdvanceAchievement("BarterDreamState", -1); } } if (text == "" && WUTIL.DieRoll(m_dreamReminderFreq) == 0) { if (!flag && GetAchievement("BoundYgnie") != 1 && WUTIL.DieRoll(2) == 0) { m_badSleep = true; text = m_animalReminderDreams[WUTIL.DieRoll(m_animalReminderDreams.Count)]; } else if (!flag2 && Mathf.Min(GetAchievement("PrincesKilled"), 3) + WUTIL.CountBits(GetAchievement("QuestItems"), 3) < 2) { m_badSleep = true; text = m_greydwalfReminderDreams[WUTIL.DieRoll(m_greydwalfReminderDreams.Count)]; } if (m_badSleep) { m_dreamReminderFreq = WUTIL.DieRoll(4) + 2; WDBUG.Log("Attempting reminder dream: " + text, WDBUG.Level.Quest); } } return text; } } [HarmonyPatch(typeof(InventoryGui), "UpdateTrophyList")] private class PatchInventoryGuiUpdateTrophyList { private static bool m_needsReset = false; private static int m_lastCount = 0; private static Dictionary m_trophyLore = new Dictionary { { "Rabbit foot", "Some rabbits are thought to be spirits, and a foot from one considered a lucky trophy." }, { "Rat tail", "The tail of a vicious rat that you well got the better of." }, { "Draugr rat tail", "The tail of a dredded undead rat. Many would rather face a dragon than the plague." }, { "Borat", "The trophy head of a notorious demon. Quite the achievement for even a mighty drengr." }, { "Goblin prince trophy", "Head of a fabled Fulrin Prince. Gaining this makes you a hero of legend." } }; private static void Postfix(InventoryGui __instance, List ___m_trophyList) { int num = 0; foreach (GameObject ___m_trophy in ___m_trophyList) { Transform transform = ___m_trophy.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); string gUIText = WUTIL.GetGUIText(((Transform)val).Find("name")); if (gUIText != "" && m_trophyLore.ContainsKey(gUIText)) { num++; WUTIL.SetGUIText(((Transform)val).Find("description"), m_trophyLore[gUIText]); } } if (num > 0) { if (!m_needsReset) { SetTrophySpace(__instance); m_needsReset = true; } if (num > m_lastCount) { WDBUG.Log($"Collected wildling trophies: {num}", WDBUG.Level.Progress); m_lastCount = num; } } else if (m_needsReset) { SetTrophySpace(__instance, reset: true); m_needsReset = false; } } private static void SetTrophySpace(InventoryGui invGui, bool reset = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) float num = (reset ? (0f - invGui.m_trophieListSpace) : invGui.m_trophieListSpace); RectTransform trophieListRoot = invGui.m_trophieListRoot; Vector2 anchoredPosition = trophieListRoot.anchoredPosition; anchoredPosition.x += 1.5f * num; trophieListRoot.anchoredPosition = anchoredPosition; RectTransform obj = trophieListRoot; Rect rect = trophieListRoot.rect; obj.SetSizeWithCurrentAnchors((Axis)0, ((Rect)(ref rect)).width + num); Transform val = ((Component)InventoryGui.instance.m_player).transform.parent.Find("Trophies/TrophiesFrame"); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to find TrophiesFrame for resize"); return; } trophieListRoot = ((Component)val).gameObject.GetComponent(); RectTransform obj2 = trophieListRoot; rect = trophieListRoot.rect; obj2.SetSizeWithCurrentAnchors((Axis)0, ((Rect)(ref rect)).width + num); trophieListRoot = ((Component)val.Find("Trophies")).gameObject.GetComponent(); RectTransform obj3 = trophieListRoot; rect = trophieListRoot.rect; obj3.SetSizeWithCurrentAnchors((Axis)0, ((Rect)(ref rect)).width + num); trophieListRoot = ((Component)val.Find("Trophies/TrophyListScroll")).gameObject.GetComponent(); anchoredPosition = trophieListRoot.anchoredPosition; anchoredPosition.x += num / 2f; trophieListRoot.anchoredPosition = anchoredPosition; } } public const string c_questEikthyrKey = "QuestEikthyr"; public const string c_questElderKey = "QuestElder"; public const string c_barterDreamState = "BarterDreamState"; private static string c_muninHelpBarter = "Greydwarf can be a bit difficult to deal with and it helps to know\r\na bit about them. Their most feared enemy are the Fulrin. But the unnatural they simply can't abide. Senior Greydwarf\r\nwill reward you for \"trophies\", presuming you are preenting them as evidence of a recently destroyed enemy. Greydwarf\r\nreally do not think like humans but they kind of understand that fleshy creatures \"eat\" food from the ground, or should,\r\nand they share a somewhat common fascination for \"pretty\" natural things, like flowers, feathers, pebbles and gemstones."; private static string c_muninDeathSaveTutorial = "Another chance.\r\nWell I'm sorry you didn't get far. It's not like me to be wrong about someone and Odin has allowed me\r\nto bring you back. But just this one time mind you, so be sure not to die again, if you can help it.\r\nOn the up side, you will not have to find your way back here. Take care!"; private static string c_muninDeathTutorial = "You died!\r\nNot too surprising given your natural weaknesses. Death in this realm is not permanent,\r\nalthough it can be a real pain and set back, enough to make you want to give up. You may\r\nhave lost some of your skills, but not your memories. Claiming a bed marks where you wake\r\nup, even if you haven't slept."; private static List c_mainTutorialTexts = new List { "Welcome return!\r\nI am Munin, sent to greet you with an opportunity most extraordinary.\r\nDo not let my brother, Hugin, distract you. You cannot remember, but you have been here on the\r\n10th World before, as a child. You lived here for some time in fact, and learned many things.\r\nI offer you a chance to reclaim the life stolen from you. The past is written, but you can become\r\nyourself as you once were and finish a journey cut short. To do so, sit in the center of the Temple\r\nwhere you arrived and pray to Odin. But you might want to linger and prepare yourself beforehand.\r\nYou will revert to your form at twelve years old, so even the lesser dangers of this world may be fatal.\r\nEventually you must return to yourself as you are now, if not wiser and rewarded for your adventure.\r\nWe will meet again on the other side, but until then take heed of my most valuable wisdom:\r\nKeep your head down, remember to sleep, and always be ready to run!", "Ho, Wildling!\r\nSo you made it out of immediate danger, and are likely full of questions? First off, you are what\r\nhere is known as a wildling. A child of the wild, perhaps once abandoned to the forest, that somehow\r\nmanaged to survive and become much more. True wildlings are so rare as to be considered mythical.\r\nBut for now it is most important for you to find food, warmth and shelter. Pickup anything that might\r\nbe of use to you, and look for a nice safe spot to make your first base.\r\nI will see you again soon.", "New abilities.\r\nAs wildling you have a few active abilities. While in a blocking stance, you can toss a single item\r\nusing your hotkey access. This is just a convenient alternative to dropping from your inventory. You\r\nalso have an additional log of recent messages and can zoom in a little further on your minimap. \r\nWhen unarmed and crouching you have a pouncing secondary attack.\r\nSome weapons also allow you to perform unarmed or special attacks whilst crouching, blocking, and so on.\r\nI recommended you practice defending yourself with any new weapons you come across.\r\nYou also have other new abilites, some that improve with use or as your Wildling skill increases.\r\nI can teach you more about these as you progress.", "Hiding.\r\nYou have some ability to blend into the background whenever you are crouching and holding still.\r\nBut you will only remain hidden while sufficiently far from any enemy that is likely to notice you.\r\nThis means you may also know if there is a creature within your own sensory range,\r\nwhich is extended while in this silent pose.\r\nHiding is similar to sneaking, but more like you belong here, or are just part of the background,\r\nlike a tree or a stream... Well, at least far from standing out like a big old Viking, I suppose.\r\nAnd I would say that hiding is one of your primary wildling abilities. I know, doesn't sound so great so far.\r\nPracticing will gain you more general wildling skill, and that skill level reflects how well you can hide.\r\nBut you cannot improve by just crouching in an empty field. You will only gain experience while hidden\r\nif a creature might otherwise notice you or gives up on searching. Know that being hidden does not guarentee\r\nyour position is unknown, especially once an enemy is alerted. Not all entities are as easy to hide from, and\r\nother factors likely include wind direction, daylight and ducking out of sight.", "Hightened senses.\r\nAs I may have said already, a wildling lives closer to nature and has developed some animal-like senses.\r\nThe most of it is picking up scents from the ground, and on the wind, and eventually being able to distinguish them.\r\nI guess that may be why some stories describe a wildling as \"part wolf\". Once you have learned the scent\r\nof something, you will be able to picture it's location in your mind and track it, or at least where it\r\nwas recently. This is another of your primary wildling abilities that improves slowly whenever you are\r\nclose to something you are stalking.", "Chipping.\r\nEven as a wildling, you do not have the strength to build structures out of stone.\r\nBut you can learn to sculpt rock into some useful things using a chipper. Making these will consume a whole\r\nchipper in the process. And your work may be unsuccessful if the chipper is worn or not of sufficient\r\nquality to finish the job. If so, you may lose some materials, but try again with a new or upgraded chipper.\r\nChipping is a secondary wildling skill, meaning it is independent and only improves with practice.\r\nOnce mastered, you can craft successfully even with a near-broken chipper.", "Planting.\r\nYour digger truely is a remarkable tool. Most would say it be a little clumsy for landscaping. But it is\r\nexactly what you need for \"planting your path\", and also serves as a decent backup weapon.\r\nOnce you have used it to create a patch of cultivated ground, use it again to plant a seed.\r\nThe seed will need room to grow and you may have to guard it from hungry rabbits. Suitable seeds will be\r\ntaken from your inventory, using the stack nearest to the top-left. Growing plants successfully will\r\neventually allow you to plant more things. You will frequently uncover mundane things when digging and\r\noccassionally something more interesting, like a truffle, especially if you know where to look.\r\nYou can also bury some things with a digger, if you want to be rid of them.", "Barter.\r\nA wildling is able to communicate in a primative way with some creatures through gift exchange. \r\nThis is a primary wildling ability, meaning you can barter for better items, and with more creatures,\r\nat higher Wildling skill level, and exchanges will gain you experience. Successful barters will also increase\r\nthe creature's trust and your reputation with its clan. But be mindful not to offend with your offering,\r\nas this can severely damage your standing, preventing barter or even causing hositility. Either way, your\r\ndeeds are forgotten in time. Barter is the main, if not sole, way for you to acquire certain materials.", "Disease.\r\nIn the world of the wildling there are nasty things like rats and the sicknesses they carry. Such diseases do\r\nnot just affect the wildling. Fortunately, they are rarely directly fatal and on recovery you will gain\r\nincreased resistance. But a nasty rat bite may keep you down for a while so beware.", "Treecare.\r\nThe Surtling Spike you have been given can be used as a very effective knife. But it is\r\nactually a tool created by Greydwarf Shaman for tree surgery. \"For seed and forest,\"\r\nas they would say. This includes culling old trees and quarterizing others of infestation.\r\nAlthough you might never know it, humans showing similar care is looked on favorably, including\r\nplanting new trees to replace those you have 'butchered'. But the real power of the spike is\r\nits ability to create portals to move between distant forests. To do so you must thrust the spike\r\ninto the base of suitable tree trunk. Without the deep understanding of a Greydwarf Shaman,\r\nyou have no control of where the portal exit will appear but they are very useful, especially\r\nto get to places otherwise inaccessible.", "Lock picking.\r\nSmall and nimble fingers allow a wildling to open some gates and pick simple door locks.\r\nLock picking is a secondary wildling skill that becomes easier with practice.\r\nPersistance is the key. Hehe. Some doors can only opened by strong grown-ups\r\nor require a key of some kind.", "Pocket picking.\r\nNatural stealth and dexterity allow the wildling to steal items from more humanoid enemies. Those that have\r\naccessible pockets, or carry bags and such like. Pickpocket is a secondary wildling skill that is more\r\nabout judgement and timing. To examine a target's inventory you must first be hidden and very close, but\r\nnot touching. Once you open a pocket you have only a short time to decide which and how many items to 'lift'.\r\nOnce you click on an item you must allow time for the lift to complete and hope that the target does not move\r\naway or notice you. The time required to lift an item is indicated when you hover it in an openned pocket.\r\nIf the timer is yellow or red then there is a risk you do not have enough time to take this without being\r\ndetected. All told, attemping to steal items from an enemy is a very risky venture. You can lift as many\r\nitems as you have time for, but may not attempt the same pocket more than three times in the same day,\r\nor again after a successful pick or bungled attempt.", "Bribery.\r\nFor different reasons, some creatures are uncertain what to think of you as a wildling. Their\r\ntendancy will be to attack as usual, but you offereing a gift may be taken as a token of good will.\r\nOr in other words, a bribe to look the other way. Bribes are considered based on the subjective\r\ncoin value of the items that you toss their way. Some bribe offerings may be completely ignored,\r\nwhile others may cause the target to halt their attack just long enough to take a look. An generous\r\nbribe might result in an exchange, for something discarded, or even taken as a retainer to escort you\r\nfor a while. Like barter, bribery is a primative form of communication and practice may increase your\r\nwildling skill. However, your skill level does not determine whether a bribe is accepted.", "Bedtime.\r\nCongratulations! A sound night's sleep really helps to recover your strength and, in your case,\r\nwhat you have forgotten. You would do well to contemplate your dreams, as it may be your instincts trying\r\nto guide you. A bad dream will not only leave you unrested, but could be a sign you are on the wrong path.", "Animal empathy.\r\nAnimals are naturally more accepting of a wildling and this makes it easier for one to tame those\r\nthat abide humans and, with their favorite foods, others that would not. Given your small size,\r\nsome might allow you to ride them without any harness and may even be charged into enemies!\r\nAt least so long as they are not too hungry or afraid. You also have the wildling ability to calm animals,\r\nand sometimes other creatures by petting them repeatedly. Deer cannot be tamed but you may form a temporary\r\nbond after some time together. A bonded deer may follow you and will always let you ride, all the faster\r\nif fed red mushrooms regularly, but will soon forget you if you are apart for too long." }; private static List c_objectives = new List { "Survive the forest and make it to safety.", "Find food, warmth and shelter.", "Make weapons and learn to defend yourself.", "Practice sneaking and hiding from enemies.", "Stalk creatures to learn their scents and habits.", "Practice chipping rock to sculpt useful stuff.", "Practice using a digger, and hunt for truffles.", "Learn how to trade items with the Greydwarf.", "Gain immunity from rat bite sickness.", "Explore distant lands as Greydwarf, planting trees and treating those with infection.", "Practice lock picking at every opportunity.", "Practice stealing from Fulring.", "Learn how to deal with Fulring through bribery.", "Follow your dreams to discover your destiny.", "Befriend animals and learn how to ride them.", "15", "16", "Hunt rabbit and boar for furs and skins.", "Make a bed and finally get a good sleep.", "Build yourself a proper base.", "20", "21", "Trade with Greyling for essential seeds.", "Trade with Greydwarf for quality woods.", "Trade with Greydwarf Elite for reward items.", "Trade with Greydwarf Shaman for special items.", "Deliver the bones of a great enermy to the Greydwarf.", "Follow the Shaman to meet The Elder.", "Meet Eikthyr at his shrine, riding a stag(?).", "29", "30", "31", "Find the burial chamber above Borat's prison.", "Delve Borat's fetid dungeon and plunder what you can.", "Search \"The Pit\" for something that will help you destroy the monster.", "Quest to the Great Serpent marked on your map.", "Find a way inside the Great Serpent head.", "Solve the Ultimate Riddle.", "Find a way to defeat the demon Borat.", "Present Borat's head to Eikthyr at the Temple.", "Find the sunken crypt hiding the entry to the Greydwarf sanctum. The general location is marked on your map.", "Find the passage way to the Greydwarf sanctum.", "Retrieve the Elder Wand.", "Use the Elder Wand to raise a Greydwarf Army.", "Use the Elder Wand to raise a Warlock.", "Destroy or disarm the Goblin princes.", "Find the remaining quest items.", "Revisit the Great Oak and wrap up your wildling adventure.", "Defeat Eikthyr and The Elder in combat.", "Lead Fulring on a path of wanton destruction.", "Return to Loki at the Great Oak.", "Stomp around like a god until you quit!", "52" }; private const int c_minGathering = 16; private const int c_stagDreamOffset = 7; private const float c_moveTurnTime = 0.2f; private const float c_moveForwardTime = 2f; private const float c_updateCooldown = 3f; private const float c_npcDialogTime = 24f; private const float c_deerGatherDist = 10f; private const float c_guideReturnMaxCloserDist = 3f; private const float c_updateCooldownOnWakeup = 5f; private const float c_eikthyrSenseRange = 600f; private const float c_eikthyrGatherTimeout = 120f; private const float c_startSitPreyCooldown = 3f; private const float c_startReminderDistance = 10f; private const float c_startReminderRepeatCooldown = 20f; private const string c_animalDreamState = "AnimalDreamState"; private const string c_questUpdateCooldown = "QuestUpdate"; private const string c_logObjectivePrefix = "Objective: "; private const string c_logAchievementPrefix = "Achievement: "; private const string c_objectiveLogColor = "#F4F"; private const string c_dreamLogColor = "#4F4"; private const string c_nightmareLogColor = "#44F"; private static Color c_dreamTextColor = new Color(0.44f, 1f, 0.44f); private static Color c_nightmareTextColor = new Color(0.44f, 0.44f, 1f); private static int m_randomSiteOffset = -1; private static int m_delayedTutorialIndex = 0; private static int m_messageTicker = 0; private static int m_dreamCount = 0; private static int m_dreamReminderFreq = 2; private static int m_awardedAchievements = 0; private static int m_missedAchievements = 0; private static int m_sumProgress = 0; private static bool m_blockTutorials = true; private static bool m_entryPortalActivted = false; private static bool m_haveEikthyrTargetPos = false; private static bool m_haveElderTargetPos = false; private static bool m_mountProtected = false; private static bool m_forceMuninTutorial = false; private static bool m_badSleep = false; private static bool m_cancelRestedBonus = false; private static bool m_showProgression = false; private static bool m_wasRiding = false; private static float m_guideReturnCloserDist = 3f; private static string m_dialogAchievement = ""; private static string m_achievementsList = ""; private static string m_progressionsList = ""; private static string m_achievementsFormatted = ""; private static string m_progressionsFormatted = ""; private static string m_progressSummary = ""; private static Vector3 m_EikthyrTargetPos = Vector3.zero; private static Vector3 m_elderTargetPos = Vector3.zero; private static Character m_bossSpawn = null; private static Character m_eikthyrQuestGuide = null; private static Character m_elderQuestGuide = null; private static Dictionary m_achievements = new Dictionary(); private static Dictionary m_gatheredPos = new Dictionary(); private static List m_animalDreams = new List { "You are back in a familiar bedroom, playing happily on your wooden horse. At your command, the horse comes alive and glides outside towards the nearby woods. It gradually becomes real, warn and hairy, and begins to trot quickly through the trees. ", "You are back in your bedroom, playing happily on your wooden horse. Again the horse comes alive and takes you out to the nearby woods. But it suddenly will go no farther, now only interested in snuffling at the ground, at something you see buried beneath.", "You are riding through the forest. This time your 'horse' leads you out to the shore and stops in front of the water. At first it will go no farther but then transforms into an ugly walking fish. It then swims out, with you still riding.", "Again you are riding through trees, but this time your steed seems taller and gallops at an alarming speed. Suddenly it slows down and rears, and you immediately understand why. All around, you sense inhuman enemy eyes watching from behind the trees.", "Once again you are galloping through trees on a handsom tall steed. As before, it shortly rears on sensing danger. But as your own fear rises, your mount turns into a monsterous wolf beneath you. Snarling, it begins to slowly pad forward.", "You are excited to see the beautiful doe again, but it gallops away when you approach. You chase it for miles and catch it in a clearing. This time you stay back and toss out a mushroom, which it cautiously approaches. But yet again it bolts on sensing you.", "Again you dream about a familiar wooden horse becoming a piggy, which you chase out into the meadow. You are watching it try to dig up something and notice colored fumes arising from the ground.", "You dream yet again about riding wild beasts, but mixed up with lots of other stuff. Often you awake and can still hear the sounds of snorts and snuffling.", "You are riding a nobel stag towards a clearing, that you know to be just ahead. But your progress is hampered by obstacles and enemies clawing at your steed.", "You are riding a nobel stag in a woods clearing, approachng a stone table. The Deer God is there waiting for you.", "You dreamt again about meeting Eikthyr at his Alter." }; private static List m_greydwarfDreams = new List { "You are chashing rabbits in the meadows and spot something man-size moving ahead. From a distance it almost looks like a walking tree stump, yet there is something oddly familiar about it. You do not feel as fearful as you probably should be.", "You are walking towards the strange creature in the meadows. It watches your approach but then suddenly charges. You turn and run a while, then crouch behind a tree, but it finds you. You repeat the game of hide and seek several times before it seems to lose interest.You are again approaching your strange new friend, that has head like a horse and thin arms, like twigs. It is somewhat monsterous but seems friendly and playful, if not comical. Soon you are playing Catch together, tossing something ball-like between you.", "You are again playing catch with your treestump-like friend, who appears happy to see you again. But you notice you are no longer tossing a ball but things you pick up from the ground, and each time something different is thrown back.", "You are slowly arroaching a creature in the forest, similar to the one you know, but much bigger and more monsterous. It seems wary and mostly ignores you. It does not seem at all playful, and yet you eventually end up playing Catch together.", "You are deep in the dark forest with several of the bigger tree-like creatures, exchanging many things more casually but not getting what you are seeking...", "You are back trading with creatures of the dark forest and finally bartering for more useful materials. Now even bigger versions of the creatures are showning an interest but seem to have little new to barter. They seem to want nasty dead things, maybe as trophies?", "You again dream of trading with the trunk-like creatures but this time with a wiser, and uglier, version that you can almost understand. It wants you to bring them 'fire', but you know that is not precisely what it means.", "You dream once more of the greydwarf shaman. It speaks to you of the Elder and asks that you retrieve the remains of their former enemies." }; private static List m_animalNightmares = new List { "You are meeting a beautiful stag in the meadow. It slowly approaches until its deep dark eyes stare into yours. But then something is horribly wrong. You turn away and stare down at your hands, which are now drenched in its blood." }; private static List m_greydwalfNightmares = new List { "You chase the playful Greyling through thick forest, eventually coming out at a Greydwarf conclave. But the site is devastated and scattered all around lie sticky remains. Then the air - your lungs are burning, eyes weeping acid. Loud barking noises and a crushing hail of stones." }; private static List m_animalReminderDreams = new List { "You are watching Eikthyr staring back at you far ahead in the forest. You feel a deep emptiness. You start to run towards this only sign of life but slip and trip. The ground beneath you is slick and covered with a black ooze. You know there is something you must finish." }; private static List m_greydwalfReminderDreams = new List { "You are hiding in a thicket. All around you hear snarling and the screams of animals in torment. You must move soon as behind you see flames through the trees and there is a strong smell of smoke in the air. And other smells you don't want to think about. The ground trembles with the voice of The Elder, \"Save us\"." }; private static string[] m_EikthyrDialog = new string[4] { "Welcome wildling, friend to the beasts of the woods and meadows! For I see how the creatures under my care trust you and even the nobelist now pays you homage. Yet I now appear before you because I discern that your fortune may be woven with Our own. And now that which has gone before. Ammends must be made for an injustice once commited by Our Fey subjects and We request that you to become their champion.", "Trapped in a dungeon not far from here is the demon Borat. If you have not found it already, you will know it by the strong reek of malevolence. It was summoned to gaurd a Fey treasure and has taken the lives of many greedy or hapless adventurers that have wandered into its domain. This treasure is no longer of significance and anything you find you may keep with Our consent. But the mere presence of this monster brings sickness to the nearby lands. It is a foreboding evil that must be destroyed.", "Defeating Borat would be a challenge for even the greatest of warriors, and you could not be expected to meet it head on. But you are wily, and there is a path beyond seven gates that is open to one of your stature. Should you vanquish Borat for good, bring a trophy to the Temple and I shall bestow on you my Blessing. Farewell and Odin's Speed.", "Trapped in a dungeon not far from here is the demon Borat... you will know it by the strong reek of malevolence. It guards a treasure that you may keep with Our consent. Defeating Borat would be a challenge for even the greatest of warriors, but you are wily, and there is a path beyond seven gates that is open to you. Should you vanquish Borat for good, bring a trophy to the Temple and I shall bestow on you my Blessing." }; private static string[] m_ElderDialog = new string[5] { "Greetings wildling, Child of Light! For you are here at this moment and that is who you must be. Providence has lead you here and you must accept my task for the sake of the land. Many human lifespans past I drempt of the End of the Greydwarf and the subsequent Ruin all of the forests and natural beauty of this world. My kin shall be hunted to extinction for their eyes. And all set ablaze for naught but the joy of Chaos, by an army lead by three Fulring cheiftans, each wielding a wonderous magical weapon.", "But I have also forseen of Our salvation by the Wrath of the Greydwalf, commanded to war by a human child! A wilding of the forest. You must fulfil this destinity, and to this end I give you my blessing and my wand. Together these may be used to compel my guardians to battle. You must yourself raise an army. But first you must retrieve Our wand, which is hidden in our most sacred place in what is now swampland, unwittenly guarded by our enemy.", "I shall guide you through Greydwarf tree portals to these so-called 'princes'. They are not yet aware of their own destiny and must not be allowed to come together in common cause. Destroy them, or claim their weapons, so this future may not come to pass. But beware, I suspect these weapons were gifted by Loki, God of Mischief. His macinations run deep and prophecy is apt to be fulfilled in kind. Therefore all three princes must be annulled for Our best chance of survival. I now reveal the region you must explore to locate the Great Oak. Go hence swiftly with my blessing in the Light.", "My spawn are hunted to extinction for their eyes, if not for the pure joy of Chaos, by an army lead by three goblin cheiftans, each wielding a wonderous magical weapon. But I have also forseen of Our salvation by the Wrath of the Greydwalf, commanded to war by a human child! A wilding of the forest. You must fulfil this destinity, and to this end I give you my blessing, for I see you have already somehow acquired the my wand! I must hope that is a good sign. Now you must yourself raise an army to face our great enemy.", "You must fulfil a prophecy by becoming the Wildling Savior of the Greydwarf, if not the World, and by leading them into battle against the Furling. You must defeat three Goblin princes, each empowered with a magical weapon. The Elder will guide you to these so-called princes through Tree Portals. But first you must find the Elder Wand and learn how to use it to raise and control an army. The Elder has revealed its approximate location in the swamp and marked it on your map." }; private static string[] m_questItems = new string[14] { "Thorscorn", "Bowdacious", "Sparx", "MagicChest", "Chimes", "ElderWand", "ElderScroll", "Letter_Thorscorn", "Letter_Bowdacious", "Letter_Sparx", "SideNote1", "FancyJacket", "PickaxeStone", "BattleaxeCrystal" }; public static void CollectItem(string name, bool reset = false) { int num = Array.IndexOf(m_questItems, name); if (num < 0) { return; } SetAchievement("QuestItems", reset ? (-1 - num) : num, bit: true); if (reset) { return; } if (name == "ElderWand") { CheckObjective(42, set: false); CheckObjective(43); CheckObjective(45); } else if ((num & 7) == 7) { CheckObjective(45, set: false); if ((num & 0x3F) == 63) { CheckObjective(46, set: false); CheckObjective(47); } else { CheckObjective(46); } } } public static bool CollectedItem(string name) { int num = Array.IndexOf(m_questItems, name); if (num >= 0) { return (GetAchievement("QuestItems") & (1 << num)) > 0; } return false; } public static void TrackCraft(ItemData item) { string text = WUTIL.ItemName(item); string craftType = Crafting.GetCraftType(text); if (craftType != "") { AdvanceAchievement(craftType + ":" + text); } } public static void TrackPlacement(string name) { AdvanceAchievement("BLD:" + name); } public static bool AdvanceAchievement(string name, int delta = 1) { return SetAchievement(name, GetAchievement(name) + delta); } public static bool SetAchievement(string name, int value, bool bit = false, bool if_lower = false, bool checkAwards = true, bool initialize = false, bool debug = true) { if (initialize) { m_achievements[name] = value; return true; } int achievement = GetAchievement(name); if (if_lower && achievement > value) { return false; } bool flag = false; if (bit) { if (value >= 0) { flag = (achievement & (1 << value)) == 0; if (flag) { if (debug) { WDBUG.Log($"Achievement {name} bit {value} set", WDBUG.Level.Quest); } m_achievements[name] = achievement | (1 << value); } } else { value = -1 - value; if (debug) { WDBUG.Log($"Achievement {name} bit {value} reset", WDBUG.Level.Quest); } int num = -1 ^ (1 << value); m_achievements[name] = achievement & num; } } else { flag = achievement != value; if (flag) { if (debug && !WUTIL.m_updateLateStartup) { WDBUG.Log($"Achievement {name} set to {value} 0x" + value.ToString("X"), WDBUG.Level.Quest); } m_achievements[name] = value; } } if (flag && checkAwards) { CheckAchievementAwards(); } return flag; } public static bool ShowMainTutorial(int index, float delay = 0f, bool checkSeen = false, bool refreshLog = false, bool flatten = true) { bool flag = index >= 0 && index <= c_mainTutorialTexts.Count; if (!checkSeen) { if (!Wildling.IsWildling && index != 1) { return false; } if (delay > 0f) { WDBUG.Log($"Delay show main tutorial {index} for {delay}s", WDBUG.Level.Quest, 1f); WUTIL.TimerReset("quest_message_delay", delay); m_delayedTutorialIndex = index; return true; } if (flag) { int num = GetAchievement("MainTutorial"); if (!refreshLog) { int num2 = 1 << index; if ((num & num2) > 0) { return false; } WDBUG.Log((checkSeen ? "Check seen" : "Show") + " main tutorial " + index, WDBUG.Level.Quest); if (index > 3 && (num & 8) == 0) { return false; } if (index > 1) { num |= 2; } if (Raven.m_tutorialsEnabled) { SetAchievement("MainTutorial", num | num2); } } if (index > 1) { CheckObjective(index - 1, set: true, test: false, refreshLog); switch (index) { case 2: CheckObjective(0, set: false); break; case 14: CheckObjective(18, set: false); break; } } if (refreshLog) { return true; } } } string text = ((index == 0) ? c_muninDeathTutorial : (flag ? c_mainTutorialTexts[index - 1] : c_muninDeathSaveTutorial)); int num3 = text.IndexOf('.'); int num4 = text.IndexOf('!'); if (num4 > 0 && (num3 < 0 || num4 < num3)) { num3 = num4 + 1; } if (num3 <= 0) { WDBUG.Log($"Unknown subject in tutorial index: {index}"); return false; } string text2 = text.Substring(0, num3); if (!text2.EndsWith("!")) { text = text.Substring(num3 + 1).TrimStart(Array.Empty()); } text2 = "Munin: " + text2; if (Player.m_localPlayer.HaveSeenTutorial(text2)) { return checkSeen; } if (checkSeen) { return false; } RavenTutorialText(text2, flatten ? text.Replace("\r\n", " ") : text); if (index == 2) { index++; delay = 120f; WUTIL.TimerReset("quest_message_delay", delay); m_delayedTutorialIndex = index; return true; } return true; } public static bool CheckObjective(int index, bool set = true, bool test = false, bool refresh = false) { if (index < 0 || index >= c_objectives.Count) { WDBUG.Log("CheckObjective ignored index out of range: " + index); return false; } int achievement = GetAchievement("objectivesBase"); int achievement2 = GetAchievement("objectivesHigh"); long num = (long)(((ulong)(uint)achievement2 << 32) | (uint)achievement); long num2 = 1L << index; bool flag = (num & num2) > 0; if (test) { return set ? flag : WUTIL.CustomLog(c_objectives[index], "#F4F", add: false, remove: false); } if (flag) { if (!set) { num ^= (uint)num2; SetAchievement("objectivesBase", (int)num, bit: false, if_lower: false, checkAwards: false); SetAchievement("objectivesHigh", (int)(num >> 32), bit: false, if_lower: false, checkAwards: false); if (index >= 32) { num2 >>= 32; SetAchievement("objectivesHighDone", GetAchievement("objectivesHighDone") | (int)num2); } else { SetAchievement("objectivesBaseDone", GetAchievement("objectivesBaseDone") | (int)num2); } if (WUTIL.CustomLog("Objective: " + c_objectives[index], "#F4F", add: false)) { WUTIL.DelayedMessage("Objective achieved:\n" + c_objectives[index], (index < 32) ? 3 : 10); } } else if (refresh) { WUTIL.CustomLog("Objective: " + c_objectives[index], "#F4F"); } } else if (set && ((index < 32) ? ((GetAchievement("objectivesBaseDone") & num2) == 0) : ((GetAchievement("objectivesHighDone") & (int)(num2 >> 32)) == 0))) { num |= num2; SetAchievement("objectivesBase", (int)num, bit: false, if_lower: false, checkAwards: false); SetAchievement("objectivesHigh", (int)(num >> 32), bit: false, if_lower: false, checkAwards: false); WUTIL.CustomLog("Objective: " + c_objectives[index], "#F4F"); } return flag; } public static void ActivateEntryPortal(bool activate) { m_entryPortalActivted = activate; } public static void BlockTutorials(bool block) { m_blockTutorials = block; } public static void Reset(bool achievements = false) { m_entryPortalActivted = false; m_wasRiding = false; if (achievements) { m_achievements.Clear(); } else { m_blockTutorials = true; } } public static void PatchObjectives(bool force = false) { bool flag = GetAchievement("objectivesBase") == 0 || WUTIL.CustomLog(""); if (force || flag) { if (flag) { ResetDreams(restore: true); } Alignment.SummarizeKnownScents(!flag); Alignment.SummerizeBarterLog(); string[] array = m_achievementsList.Split(new char[1] { '\n' }); foreach (string achievement in array) { AchievementAward(achievement, objectivesCheck: true); } int num = GetAchievement("MainTutorial"); int num2 = 0; while (num > 0) { if ((num & 1) > 0) { ShowMainTutorial(num2, 0f, checkSeen: false, refreshLog: true); } num >>= 1; num2++; } CheckObjectives(refresh: true); Alignment.CheckObjectives("", refresh: true); Digger.CheckObjectives(); Wildling.CheckObjectives(); } if (GetAchievement("MainTutorial", 2) == 0) { ShowMainTutorial(2, 60f); } else if (GetAchievement("MainTutorial", 3) == 0) { ShowMainTutorial(3, 60f); } } public static void Update() { CheckEntryPortal(); if (WUTIL.TimerIsAlmost("quest_message_delay", 0f)) { ShowMainTutorial(m_delayedTutorialIndex); } if (WUTIL.TimerIsAlmost("awaking_message", 0f)) { ShowDialogText("Best sleep ever!", "You are finding it hard to believe how much better you feel today. As if some fatigue you was not even aware of was suddenly lifted. It seems you can now carry more things and run farther.", autoClose: true, (Style)2); } if (WUTIL.TimerIsAlmost("bad_dream_delay", 0f)) { WUTIL.Message("You had a disturbed sleep."); m_cancelRestedBonus = true; } if (WUTIL.Timer("QuestUpdate") == 0f) { if (Player.m_localPlayer.IsSleeping()) { WUTIL.TimerReset("QuestUpdate", 5f); return; } m_dreamCount = 0; if (!UpdateQuestEikthyr() && !UpdateQuestElder()) { WUTIL.TimerReset("QuestUpdate", 3f); CheckObjectives(); } } if (m_gatheredPos.Count > 0 && WUTIL.Timer("MoveTowardsTarget_tick") == 0f) { WUTIL.TimerReset("MoveTowardsTarget_tick", 2.2f); } } public static void EndAdventure(bool kill = true) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown if (GetAchievement("BoundYgnie") == 1 && GetAchievement("FairyTale") == 31) { SetAchievement("FairyTale", 6); } CheckObjective(47, set: false); WDBUG.SetLokiMode(enable: false); World.UpdateSafePoint(reset: false, checkSafe: true, startTemple: true); Wildling.PlayState = 4; Game.instance.GetPlayerProfile().ClearCustomSpawnPoint(); SetAchievement("BoundYgnie", 2); Fairy.YgnieSummon(unsummon: true); SetAchievement("ElderLight", 2); ElderWand.SetElderPower(set: false); WUTIL.CustomLog("^^"); if (kill) { ((Character)Player.m_localPlayer).Damage(new HitData { m_damage = { m_damage = 1E+10f } }); } } public static void ReportEpilog(bool postPlay = true) { m_dialogAchievement = ""; if (postPlay) { if (Wildling.PlayState != 1) { WUTIL.Message("You must fulfil your destiny."); return; } AdvanceAchievement("Reflection"); } FormatProgress(); string text = (postPlay ? (EndSummary() + "\n" + m_achievementsFormatted + "\n" + m_progressionsFormatted) : (m_achievementsFormatted + "\n" + m_progressionsFormatted)); Fairy.OpenStats(text.Trim(), postPlay ? "Wildling Epilog" : "Wildling Progress"); } public static void ProgressSummary() { CompileProgress(); WDBUG.Log(" --- Progress ---\n" + m_progressSummary); } public static string EndSummary() { int achievement = GetAchievement("QuestItems"); int num = achievement & 0x3F; int num2 = 0; int num3 = 0; while (num3 < 3) { if ((num & 1) > 0) { num2++; } num3++; num >>= 1; } int num4 = 0; int num5 = 0; while (num5 < 3) { if ((num & 1) > 0) { num4++; } num5++; num >>= 1; } string text = "Congratulations! Your journey as the Wildling has come to a " + ((num2 > 0) ? "glorious" : "successful") + " conclusion."; switch (num2) { case 1: text += "\nYou may have saved the World!"; break; case 2: text += "\nYou have very likely saved the Tenth World!"; break; case 3: text += "\nYou have spared Valheim from a terrible future!"; break; default: if (num4 > 1) { text += "\nAnd found yourself some powerful items."; } else if (num4 > 0) { text += "\nAnd returned with a powerful artifact."; } break; } return text; } public static void CheckAchievementAwards() { string achievementsList = m_achievementsList; CompileProgress(); if (!(achievementsList != m_achievementsList)) { return; } string[] array = m_achievementsList.Split(new char[1] { '\n' }); int num = array.Length; int num2 = 0; string[] array2 = achievementsList.Split(new char[1] { '\n' }); foreach (string text in array2) { if (text != array[num2]) { AchievementAward(array[num2]); return; } num2++; if (num2 >= num) { break; } } WDBUG.Log("Did not locate difference in achievement lists", WDBUG.Level.Quest); } private static void AchievementAward(string achievement, bool objectivesCheck = false) { int num = achievement.IndexOf('('); if (num < 0) { return; } int num2 = -1; string name = "DefiledRoot_Sapling"; string text = achievement.Remove(num).Trim(); string text2 = text; if (!(text2 == "Wild Artisan")) { if (text2 == "Wild Grower") { name = "Hoe"; num2 = 9; } } else { name = "Hammer"; num2 = 8; } if (objectivesCheck) { WUTIL.CustomLog("Achievement: " + achievement, "#CC0"); return; } if (num2 > -1) { SetAchievement("unlocks", GetAchievement("unlocks") | (1 >> num2)); Crafting.SetPlayerKnowableRecipes(); } WUTIL.Message("Acheivement awarded: " + achievement, center: true, WUTIL.GetIcon(name)); if (!WUTIL.CustomLog("Achievement: " + achievement, "#CC0")) { WUTIL.PlaySecretFoundSfx(7); } } public static bool AchievementAwarded(string name) { return name switch { "ArmorRagsLegs" => true, "Hammer" => WDBUG.AllowHammerAndHoe || GetAchievement("unlocks", 8) > 0, "Hoe" => WDBUG.AllowHammerAndHoe || GetAchievement("unlocks", 9) > 0, _ => false, }; } public static void ResetAchievements() { m_achievements.Clear(); } public static int GetAchievement(string name, int bit = -1) { return m_achievements.ContainsKey(name) ? ((bit < 0) ? m_achievements[name] : (m_achievements[name] & (1 << bit))) : 0; } public static Dictionary GetAchivements() { return m_achievements; } public static int CountAchievements(string name, int maxBits = 32, int srtBit = 0) { return WUTIL.CountBits(GetAchievement(name) >> srtBit, maxBits); } public static string ViewAchievements(string filter = "") { StringBuilder stringBuilder = new StringBuilder(); List list = m_achievements.Keys.ToList(); list.Sort(); bool flag = filter == ""; foreach (string item in list) { if (flag || item.StartsWith(filter)) { stringBuilder.AppendFormat("\n{0}: {1} #{2}", item, m_achievements[item], m_achievements[item].ToString("X")); } } return (stringBuilder.Length == 0 && !flag) ? ("No match for key " + filter) : stringBuilder.ToString(); } public static bool RemoveAcievement(string name) { if (m_achievements.ContainsKey(name)) { m_achievements.Remove(name); return true; } return false; } public static void HelpWithBarter(int rank = -1) { int achievement = GetAchievement("failedBarterAttempts"); if (achievement >= 10 || rank < 0) { if (rank > 0) { RavenTutorialText("Munin: Friends and foes", c_muninHelpBarter.Replace("\r\n", " ")); } SetAchievement("failedBarterAttempts", 0); } else { AdvanceAchievement("failedBarterAttempts"); } } public static bool Compelled(Character character) { return (Object)(object)character != (Object)null && (Object)(object)character == (Object)(object)m_eikthyrQuestGuide; } public static bool Protected() { return m_mountProtected; } public static bool IsGuide(Character character) { return (Object)(object)character == (Object)(object)m_elderQuestGuide; } public static bool HuntingElderWand(bool found = false) { if (GetAchievement("QuestElder") == 13) { if (found) { SetAchievement("ElderLight", 1); Loki.RevealPrinceLocations(); AdvanceAchievement("QuestElder"); } return true; } return false; } public static string PortalOverride(ref Vector3 target) { //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) int achievement = GetAchievement("QuestElder"); if (CheckObjective(35, set: true, test: true) && World.GetUniquePosition("LokiDungeon", ref target) && (!HuntingElderWand() || achievement > 16 || WUTIL.DieRoll(2) > 0)) { return "LokiDungeon"; } string text = ""; if (HuntingElderWand()) { return World.GetUniquePosition("GreatOak", ref target) ? "GreatOak" : ""; } if (achievement == 18) { text = "GreatOak1"; AdvanceAchievement("QuestElder"); } else if (achievement >= 14 && achievement <= 16) { if (m_randomSiteOffset < 0) { m_randomSiteOffset = WUTIL.DieRoll(3, (int)WUTIL.PlayerID); } if (Loki.PrincePortalOverride(ref target, m_randomSiteOffset)) { return "Prince"; } } if (text != "" && MapMarker.IsSharedLocation(text)) { target = MapMarker.GetSharedLocation(text); return text; } return ""; } public static bool StartElderQuest(Character guide) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (CheckConclaveProximity(((Component)guide).transform.position)) { SetAchievement("BarterDreamState", 9); SetAchievement("QuestElder", 1); m_elderQuestGuide = guide; return true; } return false; } private static bool CheckConclaveProximity(Vector3 fromPos, float maxDist = 500f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) m_haveElderTargetPos = World.GetNearestLocationPosition("Greydwarf_camp1", fromPos, ref m_elderTargetPos, maxDist); return m_haveElderTargetPos; } public static void ResetDreams(bool restore) { if (restore) { int num = Math.Min(GetAchievement("AnimalDreamState"), m_animalDreams.Count); int num2 = Math.Min(GetAchievement("BarterDreamState"), m_greydwarfDreams.Count); for (int i = 0; i < Math.Max(num, num2); i++) { if (i < num) { WUTIL.CustomLog("" + m_animalDreams[i] + "", "#4F4"); } if (i < num2) { WUTIL.CustomLog("" + m_greydwarfDreams[i] + "", "#4F4"); } } } else { RemoveAcievement("DeerKilled"); RemoveAcievement("GreydwarfKilled"); RemoveAcievement("AnimalDreamState"); RemoveAcievement("BarterDreamState"); } } public static bool CheckGaurdianPowerReset(ItemStand itemStand, ref string hoverMessage, bool activate = false) { //IL_008d: 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) if (!Wildling.IsWildling || ((Object)itemStand.m_guardianPower).name != "GP_Eikthyr") { return false; } if (GetAchievement("BoundYgnie") == 0) { ItemData inventoryItemData = WUTIL.GetInventoryItemData("BoratTrophy"); if (inventoryItemData == null) { return false; } if (!activate) { hoverMessage = WUTIL.KeyHighlightText("Use") + " to set attach Borat's head trophy."; return true; } ((Humanoid)Player.m_localPlayer).GetInventory().RemoveOneItem(inventoryItemData); WUTIL.Spawn("BoratTrophy", itemStand.m_attachOther.position, itemStand.m_attachOther.rotation); ShowDialogText("Eikthyr's Binding", "For proving that Borat is vanquished you have received Eikthyr's blessing. Use the " + WUTIL.KeyHighlightText("GP") + " key to use this new power. Eikthyr has no further interest in this trophy, and it is not required should you need to reactivate this power by returning here.", autoClose: true, (Style)2); SetAchievement("BoundYgnie", 1); CheckObjective(39, set: false); } else if (Player.m_localPlayer.GetGuardianPowerName() == "GP_EikthyrBinding") { if (activate) { return false; } hoverMessage = "Eikthyr's Binding is set as your selected Forsaken power"; return true; } if (activate) { Player.m_localPlayer.SetGuardianPower("GP_EikthyrBinding"); WDBUG.Log("Set guardian power to: " + Player.m_localPlayer.GetGuardianPowerName(), WDBUG.Level.Quest); } else { hoverMessage = WUTIL.KeyHighlightText("Use") + " to set Eikthyr's Binding as your selected Forsaken power."; } return true; } public static void ShowDialogText(string topic, string text, bool autoClose = true, Style style = (Style)2) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) TextViewer.instance.ShowText(style, topic, text, autoClose); } public static void ShowNpcDialog(Character talker, string text, string topic = "", float showTime = 24f, bool autoClose = false, float cullDistance = 12f) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (topic.Length > 0) { text = "" + topic + "\n" + text; } if ((Object)(object)talker == (Object)null) { ShowDialogText(topic, text, autoClose: true, (Style)2); return; } Animator componentInChildren = ((Component)talker).GetComponentInChildren(); if ((Object)(object)talker == (Object)null) { WDBUG.Log("ShowNpcDialog failed to get Animator for " + ((Object)talker).name); ShowDialogText(topic, text, autoClose, (Style)2); } else { Chat.instance.SetNpcText(((Component)talker).gameObject, Vector3.up, cullDistance, showTime, topic, text, true); componentInChildren.SetTrigger("talk"); } } private static void RavenTutorialText(string label, string text, string topic = "", bool munin = true) { //IL_0033: 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_0044: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown string key = label; TutorialText val = Tutorial.instance.m_texts.Find((TutorialText x) => x.m_name == key); if (val == null) { val = new TutorialText { m_name = key, m_text = text, m_topic = topic, m_label = label }; Tutorial.instance.m_texts.Add(val); } m_forceMuninTutorial = munin; Player.m_localPlayer.ShowTutorial(key, false); } private static void CompileProgress() { int achievement = GetAchievement("QuestItems"); int num = CountAchievements("FairyTale", 6); int progress = 14 * num + 3 * WUTIL.CountBits(achievement >> 6, 5) + 1; int num2 = Mathf.Min(GetAchievement("AnimalDreamState") / 2, 4) + Mathf.Min(5 * GetAchievement("TimesBonded"), 20) + Mathf.Min(GetAchievement("QuestEikthyr"), 11); if (CollectedItem("Chimes")) { num2 += 5; } int num3 = Mathf.Min(GetAchievement("BarterDreamState") / 2, 4) + Mathf.Min(GetAchievement("QuestElder"), 10); int num4 = Mathf.Min(GetAchievement("TimesBonded"), 10); int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; foreach (string key in m_achievements.Keys) { if (m_achievements[key] == 0) { continue; } if (key.StartsWith("BLD:")) { num5++; if (key == "BLD:TreePortal") { num3 += 10; } } else if (key.StartsWith("CFT:")) { num6++; if (key.Contains("Pebble") || key.Contains("Slingshot")) { num8++; } } else if (key.StartsWith("ALC:")) { num7++; if (key == "ALC:DeerBait") { num2 += 3; } } else if (key.StartsWith("RIDE:")) { num4 += 2; } } if (GetAchievement("Truffle") > 0) { num2 += 2; } if (GetAchievement("KillBorat") > 0) { num2 += 50; } if (GetAchievement("BoundYgnie") > 0) { num2 = 100; } int num9 = Mathf.Min(GetAchievement("PrincesKilled"), 3) + WUTIL.CountBits(achievement, 3); if (num9 > 0) { num3 = 88 + 2 * num9; } else if (GetAchievement("ElderLight") > 1) { num3 = 50; } else if (GetAchievement("QuestEikthyr") > 12) { num3 += 11; } WriteProgress(); WriteProgress(progress, "Story", "The Full Story (well as far as it goes)", 100, 2); m_progressSummary = $"Story {m_sumProgress}%"; m_sumProgress = 0; WriteProgress(num2, Wildling.IsDarkling() ? "" : "Eikthyr's Quest", "Demon Slayer (fully complete Eikthyr's quest)"); WriteProgress(num3, "The Elder's Quest", "Prince of the Forest (fully complete The Elder's quest)"); if (Wildling.IsDarkling()) { WriteProgress(GetAchievement("DarklingLevel"), "Darkling", "Servant of Chaos (complete Loki's quest)", 100, 4); m_sumProgress /= 3; } else { m_sumProgress /= 2; } m_progressSummary += $" Quests {m_sumProgress}%"; m_sumProgress = 0; WriteProgress(num5, "Building", "Wild Artisan (construct all pieces, unlock Hammer)", Crafting.GetCraftTypeCount("BLD"), 2); WriteProgress(num6, "Crafting", "Wild Artificer (craft all items)", Crafting.GetCraftTypeCount("CFT"), 3); WriteProgress(num7, "Alchemy", "Wild Alchemist (craft or employ all substances)", Crafting.GetCraftTypeCount("ALC"), 3); m_progressSummary += $" Making {m_sumProgress / 3}%"; int missedAchievements = m_missedAchievements; m_sumProgress = 0; WriteProgress(CountAchievements("PlantedFlags", 11), "Planting", "Wild Seeder (plant all seeds, unlock Hoe)", 11, 2); WriteProgress((int)(0.5f + 100f * Wildling.GetPlayerData("WS.Chipping")), "Chipping", "Chief Chippaway (learn all you can about chipping rocks)", 100, 2); WriteProgress((int)(0.5f + 100f * Wildling.GetPlayerData("WS.DiseaseResistance")), "Resist sickness", "An aquired taste (immune to rat bite sickness, unlock resist poison)"); WriteProgress(num4, "Rough riding", "Wild Rider (ride all steeds and bond with 10 deer)", 20); WriteProgress(CountAchievements("Trader", Alignment.NumTraderItems()), "Items traded", "Grey Trader (exchange all barter items)", Alignment.NumTraderItems(), 2); WriteProgress(CountAchievements("Hunter", Alignment.NumHunterTrophies()), "Trophies traded", "Draugr Witcher (trade all enemy trinkets and trophies)", Alignment.NumHunterTrophies()); WriteProgress((int)(0.5f + 100f * Wildling.GetPlayerData("WS.Lockpick")), "Lockpick", "Not much I can't open (learn all you can about opening locks)", 100, 2, hideZero: true); WriteProgress(GetAchievement("Bribery"), "Bribery", "Bigshot coming through (gift 4000 coins towards your own safety)", 4000, 3, hideZero: true); WriteProgress(GetAchievement("Pickpocket"), "Pickpocket", "Dab hand (steal 2000 coins worth of items without getting caught)", 2000, 3, hideZero: true); m_progressSummary += $" Mastery {m_sumProgress / 9}%"; m_sumProgress = 0; if (m_missedAchievements - missedAchievements == 0) { WriteProgress(1, "", "Wildling mastery (master all wildling abilities)", 1); } else { m_missedAchievements++; } WriteProgress(num, "Together at last (restore A Tale of Fairies)", 6); WriteProgress("CookedRat", "It's too stringy to be pork (consume cooked rat)", 1); WriteProgress(num8, "Sucker for slingshots (craft all slignshots and ammo)", 14); WriteProgress("Throwsticks", "A cure for what aiels you (kill throwing a throwstick, unlock clutch)", 1); WriteProgress(CountAchievements("SpearFisher", 4), "Spear fisher (speare 4 types of fish)", 4); WriteProgress(CountAchievements("BuriedItems", 3), "Return to Eikthyr (buried deer hide, meat and trophy)", 3); WriteProgress(CountAchievements("BuriedItems", 4, 6), "From root to rot (buried 4 different greydwarf trophies)", 4); WriteProgress(CountAchievements("BuriedItems", 10), "No flies here (buried 10 woodland creature remnants)", 10); WriteProgress("Deja Blue", "Deja blue (dye hair blue, again?)", 1); WriteProgress("RatsKilled", "Verminator (kill 100 rats)", 100); WriteProgress("HoneyTaken", "Sweet tooth (collect honey 50 times)", 50); WriteProgress("PebbleKilled", "Stone cold killer (kill something with a thrown pebble)", 1); WriteProgress("PixieDust", "But what if you fly! (use pixie dust)", 1); WriteProgress("DoxieDust", "Walking with the dead (use doxie dust)", 1); WriteProgress("Treecare", "Tree friend (rewarded for 30 acts of tree care)", 30); WriteProgress("BlessedOak", "Druidlin (raised 2 blessed wild oaks from saplings)", 2); WriteProgress("FlyFishing", "Fly fisher (speared 10 fish while flying)", 10); WriteProgress("DiverPearl", "Pearl diver (found underwater pearls)", 2); WriteProgress("DiverWreck", "Wreck diver (looted a lot of underwater shipwrecks)", 20); WriteProgress("DiverWild", "Deep seeker (looted treasure from a deep shipwreck)", 1); WriteProgress("DiverJumps", "Splish splash splosh (three big leaps out the water)", 3); WriteProgress("DiverBombs", "Bubble bubble BOOM (destroyed an enemy with a Coldball underwater)", 3); WriteProgress("NeckTrainer", "Neck trainer (helped a Neck to bulk up)", 1); WriteProgress("LocksPicked", "A key insight! (picked a lock, unlock a lockpick)", 1); int progress2 = WUTIL.CountBits(achievement >> 4, 1) + WUTIL.CountBits(achievement >> 13, 1); WriteProgress(progress2, "No wait, I know this one (answer the ultimate riddle as wildling and adult)", 2); int progress3 = WUTIL.CountBits(achievement >> 11, 2); WriteProgress(progress3, "Gunter (find 2 easter eggs)", 2); WriteProgress("Reflection", "Retrospective (review your adventure epilog)", 1); missedAchievements = (int)(100f * (float)m_awardedAchievements / (float)(m_awardedAchievements + m_missedAchievements)); if (m_missedAchievements == 0) { WriteProgress(1, "", "Completionist (get all achievements)", 1); } m_progressSummary += $" Achievements {missedAchievements}%"; m_achievementsList = m_achievementsList.Trim(); m_progressionsList = m_progressionsList.Trim(); } private static void FormatProgress() { CompileProgress(); m_achievementsFormatted = ""; m_progressionsFormatted = ""; if (m_achievementsList.Length > 0) { m_achievementsFormatted = "\t\t\t\t\t\t--- Achievements ---\n\n"; if (m_progressionsList.Length > 0) { m_progressionsFormatted = "\t\t\t\t\t\t --- Progression ---\n\n"; } } int num = 0; string[] array = m_achievementsList.Split(new char[1] { '\n' }); foreach (string text in array) { int num2 = text.IndexOf('('); string text2 = ((num2 < 0) ? text : ("" + text.Remove(num2) + "" + text.Substring(num2) + "")); if (++num < 1) { m_achievementsFormatted = m_achievementsFormatted + text2 + "\t\t"; continue; } m_achievementsFormatted = m_achievementsFormatted + text2 + "\n"; num = 0; } num = 0; string text3 = ""; string[] array2 = m_progressionsList.Split(new char[1] { '\n' }); foreach (string text4 in array2) { if (++num < 3) { if (text4 != "") { text3 = text3 + text4 + "\t\t"; } continue; } text3 += text4; text3.Trim(); if (text3.Length > 0) { m_progressionsFormatted = m_progressionsFormatted + text3 + "\n"; } num = 0; text3 = ""; } text3.Trim(); if (text3.Length > 0) { m_progressionsFormatted = m_progressionsFormatted + text3 + "\n"; } } private static void WriteProgress(string achievement, string master, int maxProg) { WriteProgress(GetAchievement(achievement), "", master, maxProg); } private static void WriteProgress(int progress, string master, int maxProg) { WriteProgress(progress, "", master, maxProg); } private static void WriteProgress(int progress = 0, string subject = "", string master = "", int maxProg = 100, int etabs = 1, bool hideZero = false) { if (WDBUG.ShowProgressOverride >= 0) { progress = ((WDBUG.ShowProgressOverride > 100) ? maxProg : ((int)(0.5f + (float)maxProg * 0.01f * (float)WDBUG.ShowProgressOverride))); } if (progress < 0) { return; } if (subject == "") { if (master == "") { m_sumProgress = 0; m_awardedAchievements = (m_missedAchievements = 0); m_achievementsList = (m_progressionsList = ""); m_progressSummary = ""; } else if (progress >= maxProg) { m_awardedAchievements++; m_achievementsList = m_achievementsList + master + "\n"; } else { m_missedAchievements++; } return; } if (hideZero && progress == 0) { m_missedAchievements++; m_progressionsList += "\n"; return; } if (maxProg > 0) { if (progress >= maxProg) { if (master != "") { m_awardedAchievements++; m_achievementsList = m_achievementsList + master + "\n"; m_progressionsList += "\n"; return; } progress = 100; } else { m_missedAchievements++; progress = (int)(0.5f + 100f * (float)progress / (float)maxProg); } } if (etabs < 0) { etabs = 11 - m_progressionsList.Length / 2; } m_progressionsList = m_progressionsList + subject + ": " + new string('\t', etabs) + ((progress <= 9) ? " " : "") + progress; if (maxProg > 0) { m_progressionsList += "%"; } m_progressionsList += "\n"; m_sumProgress += progress; } private static void CheckEntryPortal() { //IL_0039: 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_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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) Player localPlayer = Player.m_localPlayer; if (World.GetStartPosition(out var pos)) { if (m_entryPortalActivted) { bool flag = ShowMainTutorial(1, 0f, checkSeen: true); float num = Vector3.Distance(((Component)localPlayer).transform.position, pos); if (flag && num < 1f && WUTIL.GetButton("Sit")) { m_entryPortalActivted = false; WUTIL.TimerReset("startSitPreyCooldown", 3f); WUTIL.TimerReset("freeze_player_movement", 3f); } else if (num <= 10f && WUTIL.Timer("startReminderCooldown") == 0f) { if (!Raven.m_tutorialsEnabled && Wildling.PlayState == 0) { Raven.m_tutorialsEnabled = true; WUTIL.DelayedMessage("LOUD:Raven tutorials have been enabled.", 20f); WDBUG.Log("Raven tutorials temporarily enabled to begin a new game."); } WUTIL.TimerReset("startReminderCooldown", 20f); if (flag) { WUTIL.Message("Sit in the center of the Temple to prey.", center: false, null, blockNext: false, logOpt: true); } else { ShowMainTutorial(1); } } } else if (WUTIL.TimerIsAlmost("startSitPreyCooldown", 0f)) { Vector3 forward = ((Component)localPlayer).transform.forward; TreePortal.CreatePortalPair(pos, forward, "StartWildling"); } } else { WDBUG.Log("Failed to get start position for " + localPlayer.GetPlayerName()); } } private static void CheckObjectives(bool refresh = false) { if (GetAchievement("BLD:MakingTable") > 0) { int comfortLevel = Player.m_localPlayer.GetComfortLevel(); if (comfortLevel > 8) { CheckObjective(19, set: false); CheckObjective(1, set: false); } else if (comfortLevel > 3) { CheckObjective(1, set: false); CheckObjective(19, set: true, test: false, refresh); } else if (ShowMainTutorial(2, 0f, checkSeen: true) && !CheckObjective(1, set: true, test: true)) { CheckObjective(19, set: true, test: false, refresh); } } if (CheckObjective(14, set: true, test: true) && GetAchievement("RIDE:Wolf") > 1 && GetAchievement("RIDE:Neck") > 1 && GetAchievement("RIDE:Deer") > 1 && GetAchievement("RIDE:Boar") > 1) { CheckObjective(14, set: false); } if (GetAchievement("MainTutorial", 14) > 0) { CheckObjective(17, set: false); CheckObjective(18, set: false); } else { if (GetAchievement("CFT:Bedroll") > 0) { CheckObjective(17, set: false); } else if (GetAchievement("BLD:MakingTable") > 0) { CheckObjective(17, set: true, test: false, refresh); } if (GetAchievement("BLD:HidingRack") > 0) { CheckObjective(18, set: true, test: false, refresh); } } if (CheckObjective(5, set: true, test: true) && GetAchievement("CFT:Cauldron") > 0 && GetAchievement("CFT:CauldronLeg") > 0 && GetAchievement("CFT:PestleAndMortar") > 0 && GetAchievement("CFT:Plinth") > 0) { CheckObjective(5, set: false); } if (refresh) { int num = GetAchievement("objectivesHigh"); SetAchievement("objectivesHigh", 0); int num2 = 32; while (num > 0 && num2 < 63) { if ((num & 1) > 0) { CheckObjective(num2); } num2++; num >>= 1; } } if (GetAchievement("LocksPicked") == 0 && Wildling.GetPlayerData("WS.Lockpick") >= 0.05f) { AdvanceAchievement("LocksPicked"); } } private static bool UpdateQuestEikthyr() { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_08d8: Unknown result type (might be due to invalid IL or missing references) //IL_08e3: Unknown result type (might be due to invalid IL or missing references) //IL_08e8: Unknown result type (might be due to invalid IL or missing references) //IL_08ed: Unknown result type (might be due to invalid IL or missing references) //IL_0909: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_0913: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_09af: Unknown result type (might be due to invalid IL or missing references) //IL_09b4: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0766: Unknown result type (might be due to invalid IL or missing references) //IL_076b: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Unknown result type (might be due to invalid IL or missing references) //IL_07e7: Unknown result type (might be due to invalid IL or missing references) //IL_07ec: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_040d: 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_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: 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_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) if (GetAchievement("BoundYgnie") > 0) { return false; } Transform transform = ((Component)Player.m_localPlayer).transform; int achievement = GetAchievement("QuestEikthyr"); CheckObjective(28, achievement < 2 && GetAchievement("AnimalDreamState") > 8); if (achievement >= 10) { CheckObjective(32); } m_mountProtected = achievement > 5 && achievement < 10; if (!m_haveEikthyrTargetPos && m_mountProtected) { WDBUG.Log(string.Format("Restart {0} from state {1}", "QuestEikthyr", achievement), WDBUG.Level.Quest); if (achievement >= 5) { m_bossSpawn = World.ClosestCharacter(transform.position, "Eikthyr"); if ((Object)(object)m_bossSpawn != (Object)null) { WUTIL.Destroy(((Component)m_bossSpawn).gameObject); m_bossSpawn = null; } } SetAchievement("QuestEikthyr", (achievement < 5) ? 1 : 5); return true; } float num = (m_haveEikthyrTargetPos ? Vector3.Distance(transform.position, m_EikthyrTargetPos) : 600f); if (num < 4f && achievement < 4) { WDBUG.Log("Something is happening!", WDBUG.Level.alert); WUTIL.TimerReset("eikthyr_gather_timeout", 120f); ((Component)Player.m_localPlayer).GetComponent().SetTrigger("emote_stop"); SetAchievement("QuestEikthyr", 4); return false; } switch (achievement) { case 0: if (GetAchievement("TimesBonded") > 0) { AdvanceAchievement("QuestEikthyr"); SetAchievement("AnimalDreamState", 8); } return false; case 1: if (GetAchievement("QuestBonded") < 4) { return false; } if (num < 600f) { AdvanceAchievement("QuestEikthyr"); } else if (World.GetNearestLocationPosition("Eikthyrnir", transform.position, ref m_EikthyrTargetPos, 600f)) { m_haveEikthyrTargetPos = true; AdvanceAchievement("QuestEikthyr"); } else { WDBUG.Log("Failed to get QuestEikthyr target", WDBUG.Level.Quest, 2f); } break; case 2: if (Riding.IsRiding()) { RemoveGathered(m_eikthyrQuestGuide); m_eikthyrQuestGuide = null; AdvanceAchievement("QuestEikthyr"); break; } if ((Object)(object)m_eikthyrQuestGuide == (Object)null) { string text = "Summon local"; Vector3 val = m_EikthyrTargetPos - transform.position; Vector3 val2 = 20f * ((Vector3)(ref val)).normalized; m_eikthyrQuestGuide = World.ClosestCharacter(transform.position + val2, "Deer", 50f); if ((Object)(object)m_eikthyrQuestGuide == (Object)null) { text = "Spawn new"; val2 *= WUTIL.RandomSpin(1.5f, 2f); m_eikthyrQuestGuide = WUTIL.Spawn("Deer", transform.position + val2, transform.rotation, 3).GetComponent(); } WDBUG.Log(text + " Eikthyr ride at dist " + Vector3.Distance(transform.position, ((Component)m_eikthyrQuestGuide).transform.position), WDBUG.Level.Quest); } else if (Vector3.Distance(transform.position, ((Component)m_eikthyrQuestGuide).transform.position) > 60f) { RemoveGathered(m_eikthyrQuestGuide); WUTIL.Destroy(((Component)m_elderQuestGuide).gameObject); m_eikthyrQuestGuide = null; } if (UpdateCharacterFollow(m_eikthyrQuestGuide, transform.position)) { m_eikthyrQuestGuide.SetLookDir(m_EikthyrTargetPos - ((Component)m_eikthyrQuestGuide).transform.position, 2f); } break; case 3: if (Riding.IsRiding()) { if (!m_wasRiding) { WUTIL.Message("Your mount seems to be taking you somewhere!"); WUTIL.TimerReset("Eikthyr_msg_delay", 4f); Riding.SetAutoRide(m_EikthyrTargetPos, m_wasRiding = true); RemoveGathered(m_eikthyrQuestGuide); m_eikthyrQuestGuide = null; } if (WUTIL.TimerIsAlmost("Eikthyr_msg_delay", 0f)) { WUTIL.Message("Your steed may need help to take you to your destination."); } } else if (m_wasRiding) { Riding.SetAutoRide(m_EikthyrTargetPos, m_wasRiding = false); SetAchievement("QuestEikthyr", 2); } break; case 4: { WUTIL.TimerReset("freeze_player_movement", 5f); int numFound; int num2 = GatherAtDestination(out numFound, m_EikthyrTargetPos, "Deer", 10f, 32); float num3 = WUTIL.Timer("eikthyr_gather_timeout"); if (num2 >= 16 || num3 == 0f || (num2 <= 2 && num3 < 90f)) { AdvanceAchievement("QuestEikthyr"); } else if (numFound >= 10 && m_messageTicker == 0) { m_messageTicker++; WUTIL.Message("Something seems to be happening with the animals around you."); } else if (num2 >= 10 && m_messageTicker == 1) { m_messageTicker++; WUTIL.Message("The deer appear to be waiting for something."); } break; } case 5: WDBUG.Log("Eikthyr is here!", WDBUG.Level.alert); WUTIL.TimerReset("freeze_player_movement", 5f); Alignment.m_friendlyEikthyr = true; SummonStaticBoss("Eikthyr", "eikthyr_spawn_fx"); ((Component)m_bossSpawn).transform.rotation = Quaternion.LookRotation(-transform.forward); m_EikthyrTargetPos = ((Component)m_bossSpawn).transform.position; m_haveEikthyrTargetPos = true; m_eikthyrQuestGuide = null; m_messageTicker = 0; AdvanceAchievement("QuestEikthyr"); break; case 6: case 7: case 8: if (WUTIL.Timer("freeze_player_movement") == 0f) { ShowNpcDialog(m_bossSpawn, m_EikthyrDialog[achievement - 6] + "\n" + WUTIL.KeyHighlightText("Use") + " ..."); Alignment.StunCharacter(m_bossSpawn, 24f); WUTIL.TimerReset("freeze_player_movement", 24f); ((Character)Player.m_localPlayer).SetLookDir(((Component)m_bossSpawn).transform.position - transform.position, 0f); AdvanceAchievement("QuestEikthyr"); } m_dialogAchievement = (WUTIL.GetButton("Use") ? "" : "QuestEikthyr"); HoldGathered(); break; case 9: if (WUTIL.Timer("freeze_player_movement") == 0f) { m_dialogAchievement = ""; ((Component)m_bossSpawn).transform.rotation = Quaternion.LookRotation(-transform.forward); WUTIL.TimerReset("freeze_player_movement", 2f); ((Character)Player.m_localPlayer).SetLookDir(((Component)m_bossSpawn).transform.position - transform.position, 0f); Alignment.StunCharacter(m_bossSpawn, 0f, 0f); AdvanceAchievement("QuestEikthyr"); Player.m_localPlayer.AddKnownText("Eikthyr's Quest", m_EikthyrDialog[0] + "\n\n" + m_EikthyrDialog[1] + "\n\n" + m_EikthyrDialog[2]); Riding.SetAutoRide(m_EikthyrTargetPos, m_wasRiding = false); } else { m_dialogAchievement = (WUTIL.GetButton("Use") ? "" : "QuestElder"); } break; case 10: DisperseAnyAtPoint(transform.position + 25f * transform.forward); ((Component)m_bossSpawn).transform.rotation = Quaternion.LookRotation(-transform.forward); if (WUTIL.Timer("freeze_player_movement") == 0f) { m_dialogAchievement = ""; if ((Object)(object)m_bossSpawn != (Object)null) { SummonStaticBoss("", "vfx_ghost_death", 2f); Alignment.m_friendlyEikthyr = false; } m_haveEikthyrTargetPos = false; AdvanceAchievement("QuestEikthyr"); WDBUG.Log("QuestEikthyr: Pre-quest complete", WDBUG.Level.Quest); } break; case 11: Alignment.m_friendlyEikthyr = false; if (!DisperseAnyAtPoint(transform.position + 25f * transform.forward)) { AdvanceAchievement("QuestEikthyr"); } break; default: return false; } return true; } private static bool UpdateQuestElder() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06ac: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)Player.m_localPlayer).transform; int achievement = GetAchievement("QuestElder"); if (achievement >= 1 && GetAchievement("QuestEikthyr") >= 5) { CheckObjective(13, set: false); } Alignment.m_friendlyElder = achievement > 1 && achievement < 12; switch (achievement) { case 1: CheckObjective(26, set: false); if ((Object)(object)m_elderQuestGuide == (Object)null) { WDBUG.Log("Looking to regain shaman guide", WDBUG.Level.Quest); UpdateShamanGuide(15f); } else { WUTIL.Message("The Greydwarf shaman wants to show you something."); CheckObjective(27); AdvanceAchievement("QuestElder"); } return false; case 2: if (!UpdateShamanGuide()) { SetAchievement("QuestElder", 1); } break; case 3: if (CheckConclaveProximity(transform.position)) { if (!TreePortal.MarkPositionIfAvailable(m_elderTargetPos)) { WDBUG.Log("Old portal pair/partner may remain."); return false; } Vector3 inDir = transform.position - m_elderTargetPos; inDir.y = 0f; if (TreePortal.CreatePortalPair(m_elderTargetPos, inDir, "GDKing")) { WUTIL.Message("The shaman wants you to approach the Greydwarf portal."); TreePortal.RestrictToPortal(m_elderTargetPos); WUTIL.TimerReset("freeze_player_movement", 2f); ((Character)Player.m_localPlayer).SetMoveDir(Vector3.zero); Flight.SetControls(jump: false, crouch: false, block: true); } else { WDBUG.Log("Failed to get a GDKing site!"); m_haveElderTargetPos = false; } } else { WDBUG.Log("Failed to find nearby Greydwarf_camp1"); } if (!m_haveElderTargetPos) { if ((Object)(object)m_elderQuestGuide != (Object)null) { WUTIL.Message("The Greydwarf seems confused about something", center: true, MapMarker.GetCharacterIcon(m_elderQuestGuide)); m_elderQuestGuide = null; } SetAchievement("QuestElder", 0); TreePortal.RestrictToPortal(Vector3.zero); return false; } AdvanceAchievement("QuestElder"); WUTIL.TimerReset("elder_portal_timeout", 120f); WUTIL.TimerReset("elder_guide_timeout", 5f); WUTIL.PlaceObject("fx_Potion_frostresist", m_elderTargetPos, 2f); break; case 4: if ((Object)(object)m_elderQuestGuide != (Object)null) { if (WUTIL.Timer("elder_guide_timeout") > 0f) { if (WUTIL.TimerIsAlmost("elder_guide_timeout", 3f)) { WUTIL.PlaceObject("eikthyr_spawn_fx", m_elderTargetPos, 2f); } m_elderQuestGuide.SetLookDir(m_elderTargetPos - ((Component)m_elderQuestGuide).transform.position, 0f); m_elderQuestGuide.SetMoveDir(Vector3.zero); } else { RemoveGathered(m_elderQuestGuide); WUTIL.Destroy(((Component)m_elderQuestGuide).gameObject); m_elderQuestGuide = null; } } if (WUTIL.Timer("elder_portal_timeout") == 0f) { WUTIL.TimerReset("destroyTreePortalDelay", 1f); WDBUG.Log("Reset Elder Quest sequence for portal timeout."); m_haveElderTargetPos = false; SetAchievement("QuestElder", 0); CheckObjective(27, set: false); } break; case 5: if ((Object)(object)m_elderQuestGuide != (Object)null) { WDBUG.Log("Late remove shaman guide"); RemoveGathered(m_elderQuestGuide); WUTIL.Destroy(((Component)m_elderQuestGuide).gameObject); m_elderQuestGuide = null; } transform.position += 2f * transform.forward; Place.Piece("Greydwarf_Shaman", transform.position + transform.forward + 2f * transform.right, transform.rotation); AdvanceAchievement("QuestElder"); return false; case 6: WDBUG.Log("The Elder is here!", WDBUG.Level.alert); WUTIL.TimerReset("freeze_player_movement", 12f); SummonStaticBoss("gd_king", "eikthyr_spawn_fx", 2.5f); ((Component)m_bossSpawn).transform.rotation = Quaternion.LookRotation(-transform.forward); AdvanceAchievement("QuestElder"); CheckObjective(27, set: false); break; case 7: case 8: case 9: if (WUTIL.Timer("freeze_player_movement") == 0f) { int num = achievement - 7; if (num == 1 && GetAchievement("ElderLight") == 3) { num = 3; } ShowNpcDialog(m_bossSpawn, m_ElderDialog[num] + "\n" + WUTIL.KeyHighlightText("Use") + " ..."); WUTIL.TimerReset("freeze_player_movement", 24f); ((Character)Player.m_localPlayer).SetLookDir(((Component)m_bossSpawn).transform.position - transform.position, 0f); AdvanceAchievement("QuestElder"); } m_dialogAchievement = (WUTIL.GetButton("Use") ? "" : "QuestElder"); break; case 10: if (WUTIL.Timer("freeze_player_movement") == 0f) { ((Component)m_bossSpawn).transform.rotation = Quaternion.LookRotation(-transform.forward); m_dialogAchievement = ""; WUTIL.TimerReset("freeze_player_movement", 0.5f); ((Character)Player.m_localPlayer).SetLookDir(((Component)m_bossSpawn).transform.position - transform.position, 0f); AdvanceAchievement("QuestElder"); int num2 = ((GetAchievement("ElderLight") != 3) ? 1 : 3); Player.m_localPlayer.AddKnownText("The Elder's Quest", m_ElderDialog[0] + "\n\n" + m_ElderDialog[num2] + "\n\n" + m_ElderDialog[2]); } else { m_dialogAchievement = (WUTIL.GetButton("Use") ? "" : "QuestElder"); } break; case 11: ((Component)m_bossSpawn).transform.rotation = Quaternion.LookRotation(-transform.forward); if (WUTIL.Timer("freeze_player_movement") == 0f) { if ((Object)(object)m_bossSpawn != (Object)null) { SummonStaticBoss("", "vfx_ghost_death", 2f); } m_elderQuestGuide = null; m_haveElderTargetPos = false; AdvanceAchievement("QuestElder"); WUTIL.TimerReset("freeze_player_movement", 2f); WDBUG.Log("QuestElder: Pre-quest complete", WDBUG.Level.Quest); } break; case 12: if (WUTIL.Timer("freeze_player_movement") == 0f) { AdvanceAchievement("QuestElder"); CheckObjective(40); if (GetAchievement("ElderLight") == 3) { SetAchievement("ElderLight", 1); AdvanceAchievement("QuestElder"); Loki.RevealPrinceLocations(); } else { SwampDungeon.LocateGreatOakRegion(openMap: true); } } break; case 13: SwampDungeon.LocateGreatOakRegion(); break; case 19: WUTIL.Message("Thank you Wildling! Our world is saved!", center: true, MapMarker.GetCharacterIcon("TheElder")); AdvanceAchievement("QuestElder"); break; default: return false; } if ((Object)(object)m_elderQuestGuide != (Object)null) { if (m_elderQuestGuide.IsDead()) { m_elderQuestGuide = null; } else { Alignment.Unalert(m_elderQuestGuide); } } return true; } private static void SummonStaticBoss(string bossName = "", string fx = "", float fxScale = 1f) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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 ((Object)(object)m_bossSpawn != (Object)null) { if (bossName == "") { if (fx != "") { GameObject val = WUTIL.Spawn(fx, ((Component)m_bossSpawn).transform.position, ((Component)m_bossSpawn).transform.rotation); Transform transform = val.transform; transform.localScale *= fxScale; } WUTIL.Destroy(((Component)m_bossSpawn).gameObject); m_bossSpawn = null; return; } WUTIL.Destroy(((Component)m_bossSpawn).gameObject); } Transform transform2 = ((Component)Player.m_localPlayer).transform; Vector3 position = transform2.position + 5f * fxScale * transform2.forward + Vector3.up; if (fx != "") { WUTIL.PlaceObject(fx, position, fxScale); } GameObject val2 = WUTIL.Spawn(bossName, position, Quaternion.LookRotation(-transform2.forward)); CharacterDrop component = val2.GetComponent(); component.m_drops.Clear(); Humanoid component2 = val2.GetComponent(); ((Character)component2).m_deathEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[0]; m_bossSpawn = val2.GetComponent(); m_bossSpawn.SetLevel(1); m_bossSpawn.m_boss = false; m_bossSpawn.m_bossEvent = ""; m_bossSpawn.m_faction = (Faction)2; MonsterAI component3 = ((Component)m_bossSpawn).gameObject.GetComponent(); component3.m_enableHuntPlayer = false; component3.m_attackPlayerObjects = false; Alignment.StopHunt(m_bossSpawn, tame: true); ((BaseAI)component3).Alert(); } public static bool UpdateCharacterFollow(Character character, Vector3 targetPos, bool stare = false, bool stop = false) { //IL_001f: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null || Riding.IsRiding(character)) { return false; } Vector3 val = targetPos - ((Component)character).transform.position; float num = (stop ? 1f : ((Vector3)(ref val)).magnitude); if (num > 4f) { MoveTowardsTarget(character, targetPos, num > 8f); return false; } character.SetRun(false); character.SetMoveDir(Vector3.zero); if (stare && num > 0.1f) { character.SetLookDir(val, 2f); } return true; } public static bool MoveTowardsTarget(Character character, Vector3 targetPos, bool run = true, bool checkTrack = true, bool debug = false) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) if (checkTrack) { if ((Object)(object)character == (Object)null || character.IsDead()) { WDBUG.Log("MoveTowardsTarget passed dead character " + character.GetHoverName()); RemoveGathered(character); return false; } if (!m_gatheredPos.ContainsKey(character)) { Vector3 position = ((Component)character).transform.position; position.y = 1f; m_gatheredPos.Add(character, position); } } Vector3 val = m_gatheredPos[character]; float num = val.y; float num2 = WUTIL.Timer("MoveTowardsTarget_tick"); if (num2 == 0f) { Vector3 position2 = ((Component)character).transform.position; position2.y = 0f; float num3 = Vector3.Distance(position2, val); if (num3 < (run ? 0.6f : 0.3f)) { if (num == 0f) { num = ((WUTIL.RandomSpin() < 0.5f) ? 1 : (-1)); } } else { num = 0f; } if (debug) { float num4 = WUTIL.GroundDistance(position2, targetPos); string text = (Riding.IsRiding(character) ? "Your steed" : character.GetHoverName()); WDBUG.Log($"MoveTowardsTarget '{text}' Hdist: {num4} distMoved: {num3} turnDir: {val.y}->{num} run: {run}"); } num = (position2.y = 0f); m_gatheredPos[character] = position2; num2 = 2.2f; } if (num == 0f) { character.GetBaseAI().MoveTowards(targetPos - ((Component)character).transform.position, run); } else if (num2 < 2f) { character.GetBaseAI().MoveTowards(character.GetLookDir(), run); } else { character.GetBaseAI().MoveTowards(num * ((Component)character).transform.right, run); } return true; } public static bool RemoveGathered(Character character) { return !((Object)(object)character == (Object)null) && m_gatheredPos.Remove(character); } public static bool IsGathered(Character character) { return (Object)(object)character != (Object)null && m_gatheredPos.ContainsKey(character); } private static int GatherAtDestination(out int numFound, Vector3 targetPos, string nameSuffix, float minDist = 1f, int maxFind = 0) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) Dictionary dictionary = new Dictionary(); foreach (Character key in m_gatheredPos.Keys) { if ((Object)(object)key != (Object)null && !key.IsDead()) { dictionary.Add(key, m_gatheredPos[key]); } } m_gatheredPos = dictionary; numFound = 0; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; if (WUTIL.Timer("MoveTowardsTarget_tick") == 0f) { if (m_gatheredPos.Count < maxFind) { Collider[] array = Physics.OverlapSphere(targetPos, 100f, WUTIL.c_characterRayMask); foreach (Collider val in array) { if (m_gatheredPos.Count >= maxFind) { break; } if ((Object)(object)val.attachedRigidbody != (Object)null) { Character component = ((Component)val.attachedRigidbody).GetComponent(); if (!Riding.IsRiding(component) && WUTIL.ActorName(component).StartsWith(nameSuffix) && !m_gatheredPos.ContainsKey(component)) { Vector3 position = ((Component)component).transform.position; position.y = 0f; m_gatheredPos.Add(component, position); } } } } if (m_gatheredPos.Count < maxFind) { Vector3 val2 = WUTIL.OnCircle(targetPos, 60f, maxFind); float num5 = WUTIL.RandomSpin(); GameObject val3 = WUTIL.Spawn(nameSuffix, val2, Quaternion.identity, (num5 >= 0.95f) ? 3 : ((!(num5 >= 0.65f)) ? 1 : 2)); val2.y = 0f; m_gatheredPos.Add(val3.GetComponent(), val2); num2++; } } Character[] array2 = m_gatheredPos.Keys.ToArray(); foreach (Character val4 in array2) { numFound++; float num6 = Vector3.Distance(((Component)val4).transform.position, targetPos); if (num6 > minDist) { if (MoveTowardsTarget(val4, targetPos, num6 > minDist + 4f, checkTrack: false)) { if (num6 > minDist + 2f) { num4++; } else { num++; } } } else { Alignment.StopHunt(val4); val4.GetBaseAI().StopMoving(); val4.SetLookDir(targetPos - ((Component)val4).transform.position, 0f); num++; } } if (WUTIL.Timer("MoveTowardsTarget_tick") == 0f) { WDBUG.Log($"Gathered: {num}, found: {numFound}, spawned: {num2}, dead: {num3}, moving: {num4}", WDBUG.Level.Quest); } return num; } private static void HoldGathered() { Character[] array = m_gatheredPos.Keys.ToArray(); foreach (Character val in array) { if ((Object)(object)val != (Object)null && !val.IsDead()) { val.GetBaseAI().StopMoving(); } } } private static bool DisperseAnyAtPoint(Vector3 point, float despawnDist = 100f, int maxKeep = 7) { //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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (m_gatheredPos.Count <= maxKeep) { m_gatheredPos.Clear(); return false; } if (WUTIL.Timer("disperse_cooldown") > 0f) { return true; } WUTIL.TimerReset("disperse_cooldown", 1f); Dictionary dictionary = new Dictionary(); foreach (Character key in m_gatheredPos.Keys) { if ((Object)(object)key != (Object)null) { Vector3 val = ((Component)key).transform.position - point; if (((Vector3)(ref val)).magnitude < despawnDist) { key.GetBaseAI().Alert(); key.SetLookDir(val, 0f); dictionary.Add(key, m_gatheredPos[key]); } else if (!key.IsDead()) { WUTIL.Destroy(((Component)key).gameObject); } } } m_gatheredPos = dictionary; return true; } private static bool UpdateShamanGuide(float relocateRange = 0f) { //IL_0024: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)Player.m_localPlayer).transform; if (relocateRange > 0f) { m_guideReturnCloserDist = 3f; m_elderQuestGuide = World.ClosestCharacter(transform.position, "Greydwarf_Shaman", relocateRange); } if ((Object)(object)m_elderQuestGuide == (Object)null) { return false; } if (!Wildling.IsWildling && m_elderQuestGuide.IsDead()) { m_elderQuestGuide = null; return false; } float num = Vector3.Distance(((Component)m_elderQuestGuide).transform.position, transform.position); if (num > 8f - m_guideReturnCloserDist) { WDBUG.Log("Guide moving to wildling", WDBUG.Level.Quest, 1f); MoveTowardsTarget(m_elderQuestGuide, transform.position, num > 5f); if (m_guideReturnCloserDist == 0f) { float num2 = WUTIL.RandomSpin(); if (num2 > 0.5f) { m_guideReturnCloserDist = num2 * 3f; } } else if (num < 6f && WUTIL.RandomSpin() < 0.9f) { m_elderQuestGuide.SetMoveDir(Vector3.zero); } } else if (m_haveElderTargetPos) { m_guideReturnCloserDist = 0f; float num3 = Vector3.Distance(((Component)m_elderQuestGuide).transform.position, m_elderTargetPos); if (num3 < 2f) { if (num < 3f) { AdvanceAchievement("QuestElder"); } WDBUG.Log("Guide arrived and waiting for wildling", WDBUG.Level.Quest, 1f); } else { WDBUG.Log("Guide moving to conclave", WDBUG.Level.Quest, 1f); MoveTowardsTarget(m_elderQuestGuide, m_elderTargetPos, num3 > 6f && num < 5f); } } return true; } } internal class Riding { public class SE_NeckSurprise : StatusEffect { public SE_NeckSurprise() { ((Object)this).name = "SE_NeckSurprise"; base.m_name = "Neck surprise"; base.m_tooltip = "You seem to be able to hold your breath under water better than usual. You also notice a fizzy sensation in your stomach. "; base.m_icon = WUTIL.GetIcon("NeckSurprise"); base.m_ttl = 2f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); base.m_time = Wildling.m_restartStatusEffectTime; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, base.m_time); } public override void Stop() { ((StatusEffect)this).Stop(); Wildling.SetDarklingShade(Quest.GetAchievement("DarklingLevel")); Wildling.SetPlayerData(((Object)this).name, 0f); } public override string GetIconText() { return ""; } } [HarmonyPatch(typeof(Sadle), "UpdateStamina")] private class PatchSadleUpdateStamina { public static bool Prefix(Sadle __instance, float dt, ref float ___m_staminaRegenTimer, Character ___m_character, ZNetView ___m_nview) { if ((Object)(object)___m_character == (Object)null) { return false; } if ((Object)(object)__instance != (Object)(object)m_horseSadle) { return (Object)(object)((Component)___m_character).gameObject.GetComponent() != (Object)null; } if ((Object)(object)m_horse == (Object)null || (Object)(object)___m_character != (Object)(object)m_horse || m_staminaBurn < 0f) { return false; } ___m_staminaRegenTimer -= dt; if (Alignment.GetTamedStatus(___m_character, asSpeed: true) != "stop") { m_rideTime += dt; } if (___m_staminaRegenTimer > 0f || ___m_character.InAttack()) { return false; } m_sadleStamina = Mathf.Max(__instance.GetStamina() - m_staminaBurn - m_diveStaminaRate, 0f); m_diveStaminaRate = 0f; float maxStamina = __instance.GetMaxStamina(); if (m_sadleStamina < maxStamina) { int num = m_horse.GetLevel() + m_rideLevelBuff; float num2 = (Alignment.IsBeastFriendly(___m_character) ? __instance.m_staminaRegen : __instance.m_staminaRegenHungry); if (___m_character.IsSwimming()) { num2 *= ((m_horseType == "Neck") ? 0.8f : 0.25f); m_autoStopSwim = m_sadleStamina <= 13f - (float)(3 * num); } num2 += (1f - m_sadleStamina / maxStamina) * num2; m_sadleStamina += num2 * dt; if (m_sadleStamina > maxStamina) { m_sadleStamina = maxStamina; } ___m_nview.GetZDO().Set("stamina", m_sadleStamina); } return false; } } [HarmonyPatch(typeof(Sadle), "UpdateDrown")] private class PatchSadleUpdateDrown { public static bool Prefix(Character ___m_character) { return (Object)(object)((Component)___m_character).gameObject.GetComponent() != (Object)null && (Object)(object)___m_character == (Object)(object)m_horse; } } [HarmonyPatch(typeof(Sadle), "ApplyControlls")] private class PatchSadleApplyControls { public static void Prefix(Vector3 moveDir, bool run, bool block) { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { return; } if (m_horseFlies) { float num = (run ? (2f * m_horseVerticalSpeedMax) : m_horseVerticalSpeedMax); if (WUTIL.GetButton("Jump")) { if (!block) { m_horseVerticalSpeed += (run ? (2f * m_horseVerticalAcceleration) : m_horseVerticalAcceleration); if (m_horseVerticalSpeed > num) { m_horseVerticalSpeed = m_horseVerticalSpeedMax; } } } else if (block) { m_horseVerticalSpeed -= 2f * m_horseVerticalAcceleration; if (m_horseVerticalSpeed < 0f - num) { m_horseVerticalSpeed = 0f - num; } } else { m_horseVerticalSpeed = 0f; } } if (run) { m_sadleSpeed = 2; } else if (moveDir.z > 0.5f) { m_sadleSpeed = 1; } else if (moveDir.z < -0.5f) { float num2 = WUTIL.Timer("rider_brakes"); if (num2 == 0f) { m_sadleSpeed = 0; WUTIL.TimerReset("rider_brakes", 3f); } else if (num2 < 2f) { m_sadleSpeed = -1; if (m_sadleStrafe == 0) { m_sadleStrafe = ((WUTIL.RandomSpin() < 0.5f) ? 1 : (-1)); } } } if (block && !m_horseFlies) { m_sadleSpeed += 3; } if ((double)moveDir.x > 0.5) { m_sadleStrafe = 1; } else if ((double)moveDir.x < -0.5) { m_sadleStrafe = -1; } else if (m_sadleSpeed >= 0) { m_sadleStrafe = 0; } } } [HarmonyPatch(typeof(Sadle), "UpdateRiding")] private class PatchSadleUpdateRiding { public static bool Prefix(Sadle __instance, float dt, ref bool __result, Vector3 ___m_controlDir) { //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_079d: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07b3: Unknown result type (might be due to invalid IL or missing references) //IL_0752: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_06c6: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)m_horseSadle) { return true; } __result = false; if (((Character)Player.m_localPlayer).IsTeleporting()) { return false; } BaseAI baseAI = m_horse.GetBaseAI(); if (!((Behaviour)baseAI).isActiveAndEnabled || !__instance.HaveValidUser() || !m_horse.IsTamed()) { return false; } if (m_horse.IsSwimming()) { m_swimRideTime += dt; } else { m_swimRideTime = 0f; } if (m_devMode) { WDBUG.Log($"Time swim riding: {(int)m_swimRideTime}", WDBUG.Level.show, 0.5f); } m_horse.m_runSpeed = m_runSpeed; m_horse.m_swimSpeed = m_swimSpeed; if (!Alignment.IsBeastFriendly(m_horse) && m_swimRideTime < 20f) { m_swimRideTime = 0f; if (!Quest.Protected()) { __result = false; m_staminaBurn = 0f; return false; } } __result = true; SetPlayerMountState(); string text = Alignment.GetTamedStatus(m_horse, asSpeed: true); if (m_autoRide) { m_staminaBurn = 0f; float num = Vector3.Distance(((Component)m_horse).transform.position, m_desination); if (num < 3f) { Vector3 val = ((Component)m_horse).transform.position - m_desination; baseAI.LookTowards(((Vector3)(ref val)).normalized); m_horse.SetRun(false); baseAI.StopMoving(); return false; } if (m_sadleStrafe == 0) { Character horse = m_horse; horse.m_runSpeed *= 1.5f; Character horse2 = m_horse; horse2.m_swimSpeed *= 2f; if ((m_sadleSpeed == 0 && m_sadleStamina >= 98f) || (m_sadleSpeed == 1 && m_sadleStamina >= 20f)) { m_sadleSpeed = 2; text = "sprint"; } RideTowardsDestination(num > 6f && text != "walk"); return false; } m_sadleSpeed = 1; } bool flag = m_sadleSpeed == 2; int num2 = m_horse.GetLevel() + m_rideLevelBuff; m_allowSwimDive = false; if (m_autoStopSwim || m_sadleSpeed == 0 || ((Vector3)(ref ___m_controlDir)).magnitude == 0f || text == "stop") { m_autoStopSwim = false; m_sadleSpeed = 0; m_horse.SetRun(false); baseAI.StopMoving(); } else if (m_sadleSpeed == 1 || m_sadleSpeed == 2) { float num3 = dt * Mathf.Lerp(1f, 0.5f, __instance.GetRiderSkill()); float stamina = __instance.GetStamina(); if (stamina == 0f) { flag = false; m_sadleSpeed = ((m_horse.IsSwimming() && m_sadleSpeed == 2) ? 1 : 0); Character horse3 = m_horse; horse3.m_swimSpeed *= 0.25f; } if (m_horse.IsSwimming()) { if (m_horseType == "Neck") { m_allowSwimDive = text != "stop"; Character horse4 = m_horse; horse4.m_swimSpeed *= (flag ? ((float)(num2 + ((text == "sprint") ? 6 : 4))) : (1f + 0.5f * (float)num2)); num3 *= (flag ? 0.75f : 0.5f); } else { num3 *= (flag ? 0.95f : 0.8f); Character horse5 = m_horse; horse5.m_swimSpeed *= (flag ? 2f : 0.5f); } UseStamina(__instance, __instance.m_swimStaminaDrain * num3); } else if (flag) { num3 *= 1f; if (m_horseVerticalSpeed != 0f) { m_horse.m_runSpeed = ((Character)Player.m_localPlayer).m_runSpeed; } else { switch (text) { case "march": m_horse.m_runSpeed = ((Character)Player.m_localPlayer).m_runSpeed - 1f; break; case "run": if (m_horseType == "Deer") { Character horse8 = m_horse; horse8.m_runSpeed *= 1.3f; num3 *= 0.7f; } break; case "sprint": { Character horse7 = m_horse; horse7.m_runSpeed *= ((m_horseType == "Deer") ? 2f : 1.5f); num3 *= 1f; break; } case "dart": { Character horse6 = m_horse; horse6.m_runSpeed *= 2f; num3 *= 1f; break; } } } Character horse9 = m_horse; horse9.m_runSpeed += 2f * Wildling.SkillFactor((SkillType)110); float num4 = stamina - 10f; float num5 = 18 - num2 * 4; if (num4 < num5) { m_horse.m_runSpeed = Math.Max(m_horse.m_runSpeed * num4 / num5, (stamina <= 2f) ? 0.5f : 1f); if (num4 <= 0f) { m_sadleSpeed = 1; } } UseStamina(__instance, __instance.m_runStaminaDrain * num3); } if (m_sadleStrafe > 0) { baseAI.MoveTowards(0.3f * ___m_controlDir + 0.3f * ((Component)m_horse).transform.right, flag); } else if (m_sadleStrafe < 0) { baseAI.MoveTowards(0.7f * ___m_controlDir - 0.3f * ((Component)m_horse).transform.right, flag); } else { baseAI.MoveTowards(___m_controlDir, flag); } } else if (m_sadleSpeed >= 3) { if (m_sadleSpeed == 3) { m_horse.SetRun(false); baseAI.StopMoving(); } else { m_sadleSpeed -= 3; m_sadleSpeed = ((!m_horse.IsRunning()) ? 1 : 2); } baseAI.LookTowards(___m_controlDir); } if (m_horseVerticalSpeed < 0f) { float heightAboveSolid = Flight.GetHeightAboveSolid(((Component)m_horse).transform.position, 0f, 3f); if (-2f * m_horseVerticalSpeed * dt > heightAboveSolid) { m_horseVerticalSpeed = 0f; m_sadleSpeed = 0; } } Transform transform = ((Component)m_horse).transform; transform.position += m_horseVerticalSpeed * dt * Vector3.up; if (m_sadleSpeed < 0) { m_horse.SetRun(false); baseAI.MoveTowards((float)m_sadleStrafe * ((Component)m_horse).transform.right, false); m_sadleSpeed = 0; } else { baseAI.ResetRandomMovement(); } EnableHitBox(flag && text != "march"); if (!flag) { m_staminaBurn = 0f; } return false; } public static void UseStamina(Sadle saddle, float amount) { ZNetView component = ((Component)saddle).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { float num = Mathf.Max(saddle.GetStamina() - amount, 0f); component.GetZDO().Set(ZDOVars.s_stamina, num); WDBUG.Log($"Apply stamina drain {amount} to {saddle.GetStamina()}", WDBUG.Level.Riding, 1f); m_staminaBurn = -1f; } else { m_staminaBurn = amount; } } } [HarmonyPatch(typeof(Player), "StopDoodadControl")] private class PatchPlayerStopDoodadControl { public static bool Prefix() { //IL_0148: Unknown result type (might be due to invalid IL or missing references) IDoodadController doodadController = Player.m_localPlayer.GetDoodadController(); if (doodadController != null && doodadController is Sadle && (Object)(object)m_horse != (Object)null) { int achievement = Quest.GetAchievement("QuestEikthyr"); if (achievement >= 5 && achievement <= 10) { return false; } if (WUTIL.GetButton("Jump")) { if (!((Character)Player.m_localPlayer).IsCrouching()) { Sadle val = (Sadle)(object)((doodadController is Sadle) ? doodadController : null); string tamedStatus = Alignment.GetTamedStatus(m_horse, asSpeed: true); if (tamedStatus != "stop" && !m_autoJump && m_horseName != "Ygnie" && val.GetStamina() >= 8f) { if (m_horse.IsSwimming()) { if (m_horseName != "Neck") { return false; } float num = ((m_sadleSpeed == 0) ? 1.2f : (1.4f + 0.05f * m_horse.m_swimSpeed)); float num2 = World.DepthBelowWater(((Component)m_horse).transform.position); if (num >= 1.8f && num2 > 3f && num2 < 7f) { num *= 2f; int num3 = Quest.GetAchievement("DiverJumps"); if (num3 > 4) { num3 = WUTIL.DieRoll(4); } Quest.AdvanceAchievement("DiverJumps"); WUTIL.Message("Whao!,Whee!,Whohoo!,Whooo!".Split(new char[1] { ',' })[num3], center: false); } WUTIL.TimerReset("sim_jump", num); } float num4 = ((tamedStatus == "walk") ? 1 : 2); PatchSadleUpdateRiding.UseStamina(val, m_jumpStaminaBurn); Character horse = m_horse; horse.m_jumpForceForward += num4; m_autoJump = true; } return false; } Flight.SetControls(jump: false, crouch: false, block: true); } if (!((Character)Player.m_localPlayer).IsTeleporting()) { WDBUG.Log("Dismounting from stop", WDBUG.Level.Riding); Dismount(); } } else if (m_deferTeleport) { WDBUG.Log($"Lost horse: {(Object)(object)m_horse == (Object)null} Lost saddle: {doodadController == null || !(doodadController is Sadle)}"); } return true; } } [HarmonyPatch(typeof(Player), "UpdateHover")] private class PatchPlayerUpdateHover { private static IDoodadController m_cacheDoodad; public static void Prefix(Player __instance, ref IDoodadController ___m_doodadController) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && IsRiding()) { m_cacheDoodad = ___m_doodadController; ___m_doodadController = null; } } public static void Postfix(Player __instance, ref IDoodadController ___m_doodadController) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && m_cacheDoodad != null) { ___m_doodadController = m_cacheDoodad; m_cacheDoodad = null; } } } [HarmonyPatch(typeof(Hud), "UpdateMount")] private class PatchHudUpdateMount { public static bool Prefix(Hud __instance, Player player) { IDoodadController doodadController = player.GetDoodadController(); Sadle val = (Sadle)(object)((doodadController is Sadle) ? doodadController : null); if ((Object)(object)val == (Object)null || (Object)(object)val.GetTameable() != (Object)null) { return true; } Character character = val.GetCharacter(); __instance.m_mountPanel.SetActive(true); __instance.m_mountHealthBarSlow.SetValue(character.GetHealthPercentage()); __instance.m_mountHealthBarFast.SetValue(character.GetHealthPercentage()); ((TMP_Text)__instance.m_mountHealthText).text = Mathf.CeilToInt(character.GetHealth()).ToString(); float stamina = val.GetStamina(); float maxStamina = val.GetMaxStamina(); __instance.m_mountStaminaBar.SetValue(stamina / maxStamina); ((TMP_Text)__instance.m_mountStaminaText).text = Mathf.CeilToInt(stamina).ToString(); ((TMP_Text)__instance.m_mountNameText).text = character.GetHoverName(); string tamedStatus = Alignment.GetTamedStatus(character, asSpeed: false, m_devMode); if (tamedStatus != "") { TextMeshProUGUI mountNameText = __instance.m_mountNameText; ((TMP_Text)mountNameText).text = ((TMP_Text)mountNameText).text + " (" + tamedStatus + ")"; } return false; } } public const float c_ygnieRideScale = 0.18f; private const int c_sitTypeAlternative = 1; private const int c_horseMaxLevel = 3; private const float c_ridingPoseCooldown = 2f; private const float c_autoRemountCooldown = 0.1f; private const float c_autoStopSwimStamina = 13f; private const float c_swimStaminaRegenNeck = 0.8f; private const float c_swimStaminaDrainNeck = 0.5f; private const float c_swimStaminaRegenDeer = 0.25f; private const float c_swimNeckSurpriseBuff = 0.5f; private const float c_swimDownStamina = 0.2f; private const float c_swimJumpForce = 1f; private const float c_swimDownRate = 0.1f; private const float c_holdBreathStaminaDrain = 0.5f; private const float c_runStaminaDrain = 1f; private const float c_runStaminaDrainDeer = 0.7f; private const float c_runStaminaDrainSprint = 1f; private const float c_runSpeedBuffDeer = 1.3f; private const float c_sprintSpeedBuff = 1.5f; private const float c_sprintSpeedBuffDeer = 2f; private const float c_dartSpeedBuff = 2f; private const float c_immediateJumpInterval = 0.1f; private const float c_bondingRideTime = 60f; private const float c_bondedSwimTime = 20f; private const string c_altSitTag = "ALT"; private const string c_mountObjName = "MountPoint"; private const string c_hitboxObjName = "runHitDamager"; private static bool m_devMode = false; private static bool m_autoJump = false; private static bool m_autoRide = false; private static bool m_horseFlies = false; private static bool m_autoRemount = false; private static bool m_autoStopSwim = false; private static bool m_allowSwimDive = false; private static bool m_deferTeleport = false; private static bool m_rideYgnieAllowed = true; private static bool m_riderScaledPlayer = false; private static int m_sitType = 0; private static int m_sadleSpeed = 0; private static int m_sadleStrafe = 0; private static int m_maxSitTypes = 3; private static int m_rideLevelBuff = 0; private static int m_autoRideTurnDir = 0; private static float m_rideTime = 0f; private static float m_swimRideTime = 0f; private static float m_runSpeed = 0f; private static float m_swimSpeed = 0f; private static float m_jumpForceForward = 0f; private static float m_drownDamageTimer = 0f; private static float m_jumpInterval = 0f; private static float m_jumpStaminaBurn = 10f; private static float m_sadleStamina = 100f; private static float m_horseVerticalAcceleration = 0.1f; private static float m_horseVerticalSpeed = 0f; private static float m_horseVerticalSpeedMax = 8f; private static float m_staminaBurn = -1f; private static float m_diveStaminaRate = 0f; private static string m_horseName = ""; private static string m_horseType = ""; private static Vector3 m_desination = Vector3.zero; private static Vector3 m_teleportVec = Vector3.zero; private static Sadle m_horseSadle = null; private static Character m_horse = null; private static GameObject m_horseHitbox = null; private static List m_sitTypes = new List { "attach_lox", "emote_sit", "attach_throne", "attach_chair", "attach_sitship" }; private static Dictionary m_attachPoints = new Dictionary { { "Deer", "CG/Pelvis/Spine/Spine1/Spine2/Neck" }, { "DeerALT", "CG/Pelvis/Spine/Spine1/Spine2" }, { "Neck", "Armature/Hips/Spine/Spine1" }, { "Boar", "CG/Pelvis/Spine/Spine1/Spine2" }, { "Wolf", "WolfSmooth/CG/Pelvis/Spine/Spine1/Spine2/Neck" }, { "WolfALT", "WolfSmooth/CG/Pelvis/Spine/Spine1" }, { "Ygnie", "Hatchling_mountain/Armature/Root/Spine1/saddle_point" } }; private static Dictionary m_attachOffsets = new Dictionary { { "Deer", new float[18] { -0.3506f, 0.0232f, -0.3188f, -0.0018f, -0.2528f, -0.0258f, -0.3206f, 0.0132f, -0.16f, -0.2242f, -0.2f, -0.2015f, 0.0775f, 0.2078f, -0.0375f, 0.1787f, -0.1148f, 0.1302f } }, { "Neck", new float[18] { 0.0022f, 0.0118f, 0.0024f, 0.0126f, 0.0022f, 0.0133f, 0.0064f, 0.0046f, 0.0067f, 0.0054f, 0.0069f, 0.0052f, -0.0018f, -0.0006f, -0.0018f, -0.0006f, -0.0007f, 0.0023f } }, { "Boar", new float[18] { -0.225f, 0.206f, -0.167f, 0.1405f, -0.2f, 0.11f, -0.0217f, -0.2187f, -0.1317f, -0.21318f, 0.0166f, -0.1954f, -0.225f, 0.206f, -0.167f, 0.1405f, -0.2f, 0.11f } }, { "Wolf", new float[18] { -0.135f, -0.1f, -0.1469f, -0.1017f, -0.1115f, -0.0802f, -0.085f, -0.11f, -0.0591f, -0.1127f, -0.0541f, -0.1166f, 0.012f, 0.145f, 0.022f, 0.1275f, 0.022f, 0.1095f } }, { "Ygnie", new float[6] { 0f, 0f, 0f, 0f, 0f, -0.5f } } }; private static Vector3 m_lastRidePos = Vector3.zero; public static void Awake(Character character) { GameObject val = AddMountPoint(character); if ((Object)(object)val != (Object)null) { Sadle val2 = val.AddComponent(); val2.m_attachPoint = val.transform; AddMountPoint(character, "ALT"); } } public static bool Mount(Character character) { //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) EnableHitBox(enable: true, remove: true); Player localPlayer = Player.m_localPlayer; if (IsRidable(character) && !((Character)localPlayer).IsRiding()) { Transform mountPoint = GetMountPoint(character, sadlePoint: true); if (Object.op_Implicit((Object)(object)mountPoint)) { m_horseSadle = ((Component)mountPoint).gameObject.GetComponent(); if (Object.op_Implicit((Object)(object)m_horseSadle)) { m_rideTime = 0f; m_swimRideTime = 0f; m_sitType = 0; m_horse = character; m_horseName = m_horse.GetHoverName(); m_horseType = WUTIL.ActorName(m_horse); if (!CustomMountHud(m_horseName, m_horseType)) { m_horse = null; return false; } if (m_maxSitTypes > 1 && Alignment.IsBonded(m_horse) && Wildling.SkillFactor((SkillType)110) >= 0.2f) { string text = WUTIL.KeyHighlightText("Sit"); WUTIL.Message(text + " change your sitting posture."); } WUTIL.TimerReset("ridingposecooldown", 1f); Flight.SetControls(jump: false, crouch: false, block: true); m_runSpeed = m_horse.m_runSpeed; m_swimSpeed = m_horse.m_swimSpeed; m_jumpForceForward = m_horse.m_jumpForceForward; m_jumpInterval = m_horse.GetBaseAI().m_jumpInterval; ((Component)m_horseSadle).gameObject.SetActive(true); m_horseFlies = m_horseType == "Ygnie"; SetRidingPose(); if (m_horseName == "Ygnie") { Transform transform = ((Component)Player.m_localPlayer).transform; transform.localScale *= 0.18f; m_riderScaledPlayer = true; Wildling.BroadcastStatus("Fairy"); } Quest.AdvanceAchievement("RIDE:" + WUTIL.ActorName(m_horse)); Alignment.GetAnimalFedTime(m_horse); return true; } } else { WDBUG.Log("Could not get mount point for " + WUTIL.ActorName(character) + " (" + character.m_name + ")"); } } return false; } public static void Remount() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) float playerData = Wildling.GetPlayerData("MountFeedTime"); if (playerData == 0f) { ResetNeckXp(); return; } Collider[] array = Physics.OverlapSphere(((Component)Player.m_localPlayer).transform.position, 0.7f, WUTIL.c_characterRayMask); foreach (Collider val in array) { if ((Object)(object)val.attachedRigidbody != (Object)null) { Character component = ((Component)val.attachedRigidbody).GetComponent(); if (IsRidable(component, remount: true)) { Vector3 val2 = ((Component)component).transform.position - ((Component)Player.m_localPlayer).transform.position; Alignment.SetAnimalFoodTime(component, playerData - 1f); Mount(component); WDBUG.Log($"Remounted {m_horseName} located at {val2} dist: {((Vector3)(ref val2)).magnitude}, fed for {playerData - 1f}s", WDBUG.Level.Riding); return; } } } Wildling.SetPlayerData("MountFeedTime", 0f); ResetNeckXp(); } public static void Dismount(bool signal = false) { //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) if (signal) { if ((Object)(object)m_horse != (Object)null) { Player.m_localPlayer.StopDoodadControl(); } return; } WDBUG.Log("Dismounting " + m_horseName, WDBUG.Level.Riding); Wildling.SetPlayerData("MountFeedTime", 0f); ResetNeckXp(); EnableHitBox(enable: true, remove: true); m_staminaBurn = -1f; if ((Object)(object)m_horse == (Object)null) { m_horseSadle = null; CustomMountHud("Lox"); return; } if (m_runSpeed > 0f && !m_horse.IsDead()) { m_horse.m_runSpeed = m_runSpeed; m_horse.m_swimSpeed = m_swimSpeed; m_horse.m_jumpForceForward = m_jumpForceForward; m_horse.GetBaseAI().m_jumpInterval = m_jumpInterval; m_runSpeed = 0f; } if (m_horseName == "Ygnie") { Wildling.BroadcastStatus(); WUTIL.UnequipAllTemporary(); } else if (!m_horse.IsDead()) { Alignment.Unalert(m_horse); Alignment.ResetFollowing(m_horse); } Quaternion localRotation = ((Component)Player.m_localPlayer).transform.localRotation; Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles; ((Component)Player.m_localPlayer).transform.localRotation = Quaternion.Euler(0f, eulerAngles.y, eulerAngles.z); if (m_riderScaledPlayer) { ((Component)Player.m_localPlayer).transform.localScale = Wildling.m_backupPlayerScale; m_riderScaledPlayer = false; } m_horseVerticalSpeed = 0f; m_horse = null; m_horseSadle = null; m_horseName = ""; CustomMountHud("Lox"); } public static void Update(float dt) { //IL_0119: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) if (((Character)Player.m_localPlayer).IsTeleporting() || WUTIL.Timer("autoremount") > 0f) { if (m_deferTeleport && (Object)(object)m_horse != (Object)null && Vector3.Distance(((Component)m_horse).transform.position, ((Component)Player.m_localPlayer).transform.position) > 10f) { ((Component)m_horse).transform.position = ((Component)Player.m_localPlayer).transform.position + m_teleportVec; } return; } if (m_deferTeleport) { m_deferTeleport = false; if ((Object)(object)m_horse == (Object)null) { WDBUG.Log("Recapture horse after teleport required"); } else { SetRidingPose(rotate: false, remount: true); } EnableColliders(enable: true); return; } if ((Object)(object)m_horse == (Object)null) { if (m_riderScaledPlayer) { ((Component)Player.m_localPlayer).transform.localScale = Wildling.m_backupPlayerScale; m_riderScaledPlayer = false; } return; } if (m_horse.IsDead()) { Dismount(); return; } if (m_autoRemount) { m_autoRemount = false; WUTIL.TimerReset("ridingposecooldown", 2f); CustomMountHud(m_horseName, m_horseType); ((Component)m_horseSadle).gameObject.SetActive(true); SetRidingPose(); } else if (WUTIL.Timer("ridingposecooldown") == 0f && WUTIL.GetButton("Sit") && Wildling.SkillFactor((SkillType)110) >= 0.2f) { WUTIL.TimerReset("ridingposecooldown", 2f); SetRidingPose(rotate: true); } else if (m_devMode && WUTIL.Timer("seatadjustcooldown") == 0f) { AdjustAttachOffset(); } if (m_autoJump) { float num = WUTIL.Timer("ride_autojump_cooldown"); if (num == 0f) { m_horse.GetBaseAI().m_jumpInterval = 0.1f; WUTIL.TimerReset("ride_autojump_cooldown", 0.2f); } else if (num < 0.05f) { m_horse.GetBaseAI().m_jumpInterval = m_jumpInterval; m_horse.m_jumpForceForward = m_jumpForceForward; m_autoJump = false; } } else if (m_allowSwimDive && (InventoryGui.instance.IsContainerOpen() || WUTIL.GetButton("Crouch"))) { Dive(dt); } float num2 = WUTIL.Timer("sim_jump"); if (num2 > 0f) { num2 *= 0.09f + 0.01f * m_horse.m_swimSpeed; Transform transform = ((Component)m_horse).transform; transform.position += num2 * Vector3.up; Transform transform2 = ((Component)Player.m_localPlayer).transform; transform2.position += num2 * Vector3.up; } if (m_rideTime >= 60f && m_horseType == "Deer" && Alignment.GetTamedStatus(m_horse, asSpeed: true) != "stop" && Alignment.SetBonded(m_horse)) { int level = m_horse.GetLevel(); Wildling.RaisePrimarySkill((float)level * 1f, $"bond {m_horseType} level {level}", 5f, (SkillType)0); level--; Quest.AdvanceAchievement("TimesBonded"); Quest.AdvanceAchievement("QuestBonded", 1 + level * level); } } public static void UpdateAI(GameObject characterGO, float dt) { if ((Object)(object)m_horseSadle != (Object)null && (Object)(object)characterGO.GetComponent() == (Object)(object)m_horse) { m_horseSadle.UpdateRiding(dt); } } public static bool IsRidable(Character character, bool remount = false) { if ((Object)(object)character == (Object)null || character.IsDead() || !Wildling.IsWildling) { return false; } switch (WUTIL.ActorName(character)) { case "Ygnie": return m_rideYgnieAllowed && (remount || Alignment.GetAnimalFedTime(character) > 50f); case "Deer": case "Boar": case "Neck": case "Wolf": return remount || character.IsTamed(); default: return false; } } public static bool IsRiding(Character character = null) { return ((Object)(object)character == (Object)null) ? ((Object)(object)m_horse != (Object)null) : ((Object)(object)character == (Object)(object)m_horse); } public static bool IsRidingBonded(Character character = null) { return IsRiding(character) && Alignment.IsBonded(character); } public static void SetAutoRide(Vector3 destination, bool enable = true) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) WDBUG.Log($"Set autoride: {enable}", WDBUG.Level.Riding); m_desination = destination; m_autoRide = enable; } public unsafe static void Teleport(float autoRemount = 1f) { //IL_001b: 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) //IL_0034: 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_0043: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_horse != (Object)null) { m_teleportVec = ((Component)m_horse).transform.position - ((Component)Player.m_localPlayer).transform.position; Vector3 teleportVec = m_teleportVec; WDBUG.Log("Horse teleporting ahead with offset: " + ((object)(*(Vector3*)(&teleportVec))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Riding); m_deferTeleport = true; WUTIL.TimerReset("autoremount", autoRemount); EnableColliders(enable: false); } } public static bool IsRidingFairy() { return m_riderScaledPlayer; } public static bool HitBoxShielded(Aoe aoe) { return ((Object)aoe).name == "wildling_charge"; } public static void EnableColliders(bool enable) { if (!enable && enable) { WUTIL.TimerReset("freeze_player_movement", enable ? 0.5f : 0f); if ((Object)(object)m_horse != (Object)null) { Alignment.StunCharacter(m_horse, 1f, 1f); } } } public static void ResetNeckXp(Character neck = null, int gain = 1) { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)neck == (Object)null) { Quest.SetAchievement("NeckBites", 0); m_rideLevelBuff = 0; return; } int num = Quest.GetAchievement("NeckBites") + gain; int num2 = neck.GetLevel() + 1; if (num2 <= 4 && num >= num2 * 2 && (num >= num2 * 4 || neck.GetHealthPercentage() < 0.9f)) { if (num2 < 4) { num = 0; neck.SetLevel(num2); if (num2 > 2) { Quest.AdvanceAchievement("NeckTrainer"); } } WUTIL.Message("Your mount just leveled up!", center: true, MapMarker.GetCharacterIcon(neck)); Transform headTransform = WUTIL.GetHeadTransform(neck); Player.m_localPlayer.m_skillLevelupEffects.Create(headTransform.position, headTransform.rotation, headTransform, 1f, -1); } if (num >= num2 * 4) { m_rideLevelBuff = 1; } Quest.SetAchievement("NeckBites", num); } private static void SetRidingPose(bool rotate = false, bool remount = false) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (rotate) { int num = (m_devMode ? m_sitTypes.Count : (Alignment.IsBonded(m_horse) ? m_maxSitTypes : Mathf.Min(m_maxSitTypes, 1 + (int)(Wildling.SkillFactor((SkillType)110) * 10f)))); if (num <= 1) { return; } if (++m_sitType >= num) { m_sitType = 0; } } m_horseSadle.m_attachAnimation = ((m_horseType == "Boar" && m_sitType == 0) ? "attach_chair" : m_sitTypes[m_sitType]); Transform mountPoint = GetMountPoint(m_horse); if (!((Object)(object)mountPoint == (Object)null)) { m_horseSadle.m_attachPoint = ((Component)mountPoint).gameObject.transform; ((Component)mountPoint).gameObject.transform.localPosition = GetAttachOffset(m_horse, m_sitType); m_horseSadle.m_detachOffset = ((Component)mountPoint).gameObject.transform.localPosition; if (remount) { m_horseSadle.m_attachAnimation = ""; rotate = false; } if (rotate) { int num2 = m_attachPoints[m_horseType].LastIndexOf('/'); WDBUG.Log("Attaching " + m_sitTypes[m_sitType] + " to " + m_horseType + " " + m_attachPoints[m_horseType].Substring(num2 + 1), WDBUG.Level.Riding); WUTIL.TimerReset("autoremount", 0.1f); m_autoRemount = true; m_horseSadle.OnUseStop(Player.m_localPlayer); } else { m_horseSadle.Interact((Humanoid)(object)Player.m_localPlayer, false, false); } } } private static void RideTowardsDestination(bool run) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) float num = WUTIL.Timer("autoride_move"); if (num == 0f) { float num2 = Vector3.Distance(m_lastRidePos, ((Component)m_horse).transform.position); if (num2 < (run ? 0.6f : 0.3f)) { if (m_autoRideTurnDir == 0) { m_autoRideTurnDir = ((WUTIL.RandomSpin() < 0.5f) ? 1 : (-1)); } } else { m_autoRideTurnDir = 0; } m_lastRidePos = ((Component)m_horse).transform.position; WUTIL.TimerReset("autoride_move", 1.2f); num = 1.2f; } if (m_autoRideTurnDir == 0) { m_horse.GetBaseAI().MoveTowards(m_desination - ((Component)m_horse).transform.position, run); } else if (num < 1f) { m_horse.GetBaseAI().MoveTowards(m_horse.GetLookDir(), run); } else { m_horse.GetBaseAI().MoveTowards((float)m_autoRideTurnDir * ((Component)m_horse).transform.right, run); } } private static Transform GetMountPoint(Character character, bool sadlePoint = false) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.ActorName(character); if ((Object)(object)character == (Object)null || !m_attachPoints.ContainsKey(text)) { return null; } bool flag = m_sitType == 1 && !sadlePoint && m_attachPoints.ContainsKey(text + "ALT"); if (flag) { text += "ALT"; } string text2 = m_attachPoints[text] + "/MountPoint" + (flag ? "ALT" : ""); Transform transform = character.GetVisual().transform; transform = ((transform != null) ? transform.Find(text2) : null); if ((Object)(object)transform == (Object)null) { WDBUG.Log("GetMountPoint(" + text + ") failed for /" + text2); } else if (m_horseFlies) { WDBUG.Log("Forcing mount transform to player orientation."); Vector3 eulerAngles = ((Component)Player.m_localPlayer).transform.eulerAngles; Vector3 eulerAngles2 = ((Component)character).transform.eulerAngles; transform.rotation = Quaternion.Euler(eulerAngles.x, eulerAngles2.y, eulerAngles.z); } return transform; } private static GameObject AddMountPoint(Character character, string altTag = "") { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_00c3: 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_0084: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.ActorName(character); string key = text + altTag; if (!m_attachPoints.ContainsKey(key)) { return null; } string text2 = m_attachPoints[key]; GameObject val = new GameObject("MountPoint" + altTag); val.transform.parent = character.GetVisual().transform.Find(text2); if (text == "Neck") { Quaternion rotation = ((Component)character).transform.rotation; Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles; val.transform.rotation = Quaternion.Euler(0f, eulerAngles.y, eulerAngles.z); } else { val.transform.rotation = ((Component)character).transform.rotation; } val.transform.localPosition = GetAttachOffset(character); return val; } private static void EnableHitBox(bool enable = true, bool remove = false, bool add = true) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) if (remove) { if ((Object)(object)m_horseHitbox != (Object)null) { WUTIL.Destroy(m_horseHitbox); m_horseHitbox = null; } } else if ((Object)(object)m_horseHitbox != (Object)null) { m_horseHitbox.SetActive(enable); } else { if (!add) { return; } m_horseHitbox = WUTIL.Spawn("runHitDamager", ((Component)m_horse).transform.position, ((Component)m_horse).transform.rotation); if ((Object)(object)m_horseHitbox == (Object)null) { WDBUG.Log("Failed to add hitbox to " + m_horseType); return; } Transform val = m_horseHitbox.transform.Find("wildling_charge"); if ((Object)(object)val == (Object)null) { WDBUG.Log(m_horseType + " hit box did not have an attach point"); return; } Aoe component = ((Component)val).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log(m_horseType + " hit box did not have Aoe"); return; } m_horseHitbox.transform.SetParent(((Component)m_horse).transform); int num = 1 + m_horse.GetLevel(); float num2 = 0f; switch (m_horseType) { case "Neck": component.m_damage.m_chop = num; component.m_damage.m_blunt = 3 * num; component.m_attackForce = 5 * num; num2 = 0.8f; break; case "Deer": if (num > 2 && Quest.GetAchievement("QuestEikthyr") >= 11) { component.m_damage.m_lightning = 5 * num; } num *= num; component.m_damage.m_chop = 12 - 2 * num; component.m_damage.m_pierce = 10 * (num - 2); component.m_attackForce = 10 * num; num2 = 1.2f; break; case "Boar": component.m_damage.m_chop = 2 * num; component.m_damage.m_blunt = 5 * num; component.m_damage.m_pierce = 5 * num; component.m_attackForce = 15 * num; num2 = 1f; break; case "Wolf": component.m_damage.m_chop = 20 + 10 * num; component.m_damage.m_blunt = 20 + 10 * num; component.m_damage.m_slash = 10 + 5 * num; component.m_attackForce = 60 + 20 * num; num2 = 1.5f; break; case "Ygnie": component.m_damage.m_chop = 0f; component.m_damage.m_blunt = 0f; component.m_damage.m_slash = 0f; component.m_damage.m_lightning = 10f; component.m_damage.m_spirit = 20f; component.m_attackForce = 20f; num2 = 0.8f; break; } if (num2 > 0f) { val.position += num2 * val.forward; } float num3 = component.m_damage.m_blunt + component.m_damage.m_pierce + component.m_damage.m_slash + component.m_damage.m_lightning; WDBUG.Log($"{m_horseType} hit box fwd: {num2} damage: {num3} force: {component.m_attackForce} chop: {component.m_damage.m_chop}", WDBUG.Level.Riding); m_horseHitbox.SetActive(enable); } } private static Vector3 GetAttachOffset(Character character, int sitType = 0) { //IL_0066: 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_006b: 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) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) int sitOffset = GetSitOffset(character, sitType); string text = WUTIL.ActorName(character); Vector3 result = ((text == "Neck") ? new Vector3(0f, m_attachOffsets[text][sitOffset + 1], m_attachOffsets[text][sitOffset]) : new Vector3(m_attachOffsets[text][sitOffset], m_attachOffsets[text][sitOffset + 1], 0f)); if (m_devMode) { string text2 = result.x.ToString("n4") + "f, " + result.y.ToString("n4") + "f, " + result.z.ToString("n4"); WDBUG.Log($"{text} level: {character.GetLevel()} sit type: {sitType} offset: {text2}f"); } return result; } private static void AdjustAttachOffset() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) WUTIL.TimerReset("seatadjustcooldown", 0.2f); int num = (Input.GetKey((KeyCode)275) ? 1 : (Input.GetKey((KeyCode)276) ? (-1) : 0)); int num2 = (Input.GetKey((KeyCode)273) ? (-1) : (Input.GetKey((KeyCode)274) ? 1 : 0)); if (num != 0 || num2 != 0) { int sitOffset = GetSitOffset(m_horse, m_sitType); float num3 = ((m_horseType == "Neck") ? 0.0002f : 0.005f) * WUTIL.GetLevelSize(m_horse); m_attachOffsets[m_horseType][sitOffset] += (float)num * num3; m_attachOffsets[m_horseType][sitOffset + 1] += (float)num2 * num3; Transform mountPoint = GetMountPoint(m_horse); ((Component)mountPoint).gameObject.transform.localPosition = GetAttachOffset(m_horse, m_sitType); } } private static int GetSitOffset(Character character, int sitType) { int num = character.GetLevel() - 1; num = ((num >= 0) ? (num % 3) : 0); string key = WUTIL.ActorName(character); int num2 = m_attachOffsets[key].Length / 6 - 1; num += 3 * Mathf.Min(sitType, num2); return num * 2; } private static void SetPlayerMountState() { Wildling.SetPlayerData("MountFeedTime", Alignment.GetAnimalFedTime(m_horse, unbound: false) + 1f); } private static void Dive(float dt) { //IL_000b: 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) //IL_0065: 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_006f: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(Flight.GetHeightAboveSolid(((Component)m_horse).transform.position) - 0.2f, 0f); float num2 = Mathf.Min(0.1f, num); m_diveStaminaRate = 0.2f * (1f + num2 / 0.1f); Transform transform = ((Component)m_horse).transform; transform.position -= num2 * Vector3.up; WUTIL.TimerReset("freeze_player_height", 0.2f); Player localPlayer = Player.m_localPlayer; Transform transform2 = ((Component)localPlayer).transform; transform2.position -= num2 * Vector3.up; bool flag = World.SetUnderwaterView(((Component)localPlayer).transform.position); if (Fairy.SE_DoxieDust.IsActive) { return; } float num3 = Wildling.SkillFactor((SkillType)103); float num4 = Mathf.Lerp(localPlayer.m_swimStaminaDrainMinSkill, localPlayer.m_swimStaminaDrainMaxSkill, num3); num4 *= 1f + ((Character)localPlayer).GetEquipmentSwimStaminaModifier(); SEMan sEMan = ((Character)localPlayer).GetSEMan(); sEMan.ModifySwimStaminaUsage(num4, ref num4, true); float num5 = (Wildling.HasEaten("Neck surprise") ? 0.5f : 1f); if (num5 < 1f) { SE_NeckSurprise sE_NeckSurprise = (SE_NeckSurprise)(object)ScriptableObject.CreateInstance(typeof(SE_NeckSurprise)); ((Character)localPlayer).GetSEMan().AddStatusEffect((StatusEffect)(object)sE_NeckSurprise, true, 0, 0f); } ((Character)localPlayer).UseStamina(dt * Game.m_moveStaminaRate * 0.5f * num4 * num5); if (!((Character)localPlayer).HaveStamina(0f)) { m_drownDamageTimer += dt; if (m_drownDamageTimer > 1f) { m_drownDamageTimer = 0f; float num6 = Mathf.Ceil(0.05f * num5 * ((Character)localPlayer).GetMaxHealth()); ((Character)localPlayer).SetHealth(((Character)localPlayer).GetHealth() - num6); DamageText.instance.ShowText((DamageModifier)0, ((Character)localPlayer).GetCenterPoint(), num6, true); Vector3 position = ((Component)localPlayer).transform.position; if (flag) { position.y = ((Character)localPlayer).GetLiquidLevel(); } localPlayer.m_drownEffects.Create(position, ((Component)localPlayer).transform.rotation, (Transform)null, 1f, -1); } } else { m_drownDamageTimer = 0f; } } private static bool CustomMountHud(string name, string trophyName = "") { Transform transform = ((Component)InventoryGui.instance.m_player).transform; Transform val = transform.parent.parent.parent.Find("HUD/hudroot/MountHud/MountPanel"); Transform val2 = val.Find("MountIcon"); Image component = ((Component)val2).GetComponent(); component.sprite = MapMarker.GetCharacterIcon((trophyName == "") ? name : trophyName); WDBUG.Log("Setting Hud text to '" + name + "'", WDBUG.Level.Riding); WUTIL.SetGUIText(val.Find("Name"), name); return true; } } internal class Throwstick { [HarmonyPatch(typeof(ItemDrop), "Awake")] private class PatchItemDropAwake { public static void Postfix(ItemDrop __instance) { if (((Object)__instance).name == "Wildling_throwstickClutch") { WDBUG.Log("Configure Awoke Clutch"); ClutchUpdateToContent(__instance.m_itemData); } else if (((Object)__instance).name == "Wildling_ClothSack") { WDBUG.Log("Configure Awoke Cloth sack"); Equipment.SackUpdateToContent(__instance.m_itemData); } else if (!(m_attachFish == "") && ((Object)__instance).name.StartsWith("Wildling_Throwstick")) { Transform val = ((Component)__instance).transform.Find("attach/" + m_attachFish); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(true); SharedData shared = __instance.m_itemData.m_shared; shared.m_name += " with a skewered fish."; WDBUG.Log("Set attach/" + m_attachFish + " '" + __instance.m_itemData.m_shared.m_name + "'", WDBUG.Level.Throwstick); } m_attachFish = ""; } } } [HarmonyPatch(typeof(Floating), "SetSurfaceEffect")] private class PatchFloatingSetSurfaceEffect { public static void Postfix(Floating __instance, bool enabled) { //IL_0092: 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) if (!enabled || !WUTIL.IsWildlingObject(((Component)__instance).gameObject)) { return; } string text = WUTIL.GameName(((Component)__instance).gameObject); if (text == "PebbleBad") { text = "PebbleSharp"; } else { if (!text.EndsWith("Poisoned")) { return; } text = text.Remove(text.Length - 8); } WDBUG.Log("Posioned " + text + " was floating", WDBUG.Level.Poisoned); GameObject val = WUTIL.Spawn(text, ((Component)__instance).transform.position, ((Component)__instance).transform.rotation); ItemData val2 = val.GetComponent()?.m_itemData; ItemData val3 = ((Component)__instance).gameObject.GetComponent()?.m_itemData; if (val2 != null && val3 != null) { val2.m_stack = val3.m_stack; val2.m_quality = val3.m_quality; val2.m_durability = val3.m_durability; WUTIL.Destroy(((Component)__instance).gameObject); } } } [HarmonyPatch(typeof(Humanoid), "DrainEquipedItemDurability")] private class PatchHumanoidDrainEquipedItemDurability { public static bool Prefix(Humanoid __instance, ItemData item, Inventory ___m_inventory) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 if (item.m_durability > 75f || item.m_durability < 1f || (int)item.m_shared.m_itemType != 9 || !WUTIL.IsWildlingObject(item.m_dropPrefab)) { return true; } string text = WUTIL.GameName(item.m_dropPrefab); if (text.EndsWith("Poisoned") && !text.StartsWith("Arrow") && !WUTIL.TestLuck(item.m_durability / 75f)) { bool flag = __instance.IsItemEquiped(item); text = text.Remove(text.Length - 8); ItemData val = WUTIL.CreateItemData(text); if (val != null) { WDBUG.Log("Created un-poisoned replacement of item " + text, WDBUG.Level.Poisoned); val.m_quality = item.m_quality; val.m_durability = item.m_durability; __instance.UnequipItem(item, false); if (___m_inventory.RemoveItem(item) && ___m_inventory.AddItem(val)) { if (flag) { __instance.EquipItem(val, false); } WUTIL.Message("Sticky poison wore off of " + WUTIL.ItemName(item, goName: false), center: true, item.GetIcon()); return false; } } else { WDBUG.Log("Failed un-poisoned replacement of item " + text); } } return true; } } private const int c_clutchMaxCapacity = 3; private const float c_maxWettedDepth = 0.7f; private const float c_pickupFishDelay = 0.1f; private const float c_checkWettedCooldown = 0.5f; private const float c_poisonLossChangeHit = 0.7f; private const float c_poisonLossChangeMiss = 0.3f; private const float c_pickupPoisonDurability = 2f; private const float c_maxPoisenedPickupDurability = 6f; private const string c_throwstick = "Throwstick"; private const string c_clutch = "throwstickClutch"; private const string c_poisonedID = "Poisoned"; private static float c_clutchFlickerDelay = Time.fixedDeltaTime + 0.001f; private static float c_throwAnimationDelay = 1f + 4f * c_clutchFlickerDelay; private static int m_clutchCapacity = 0; private static bool m_initialUpdate = true; private static bool m_pickupEquip = false; private static float m_lastHeldDurability = 40f; private static string m_attachFish = ""; private static ItemData m_clutchActive = null; public static void Startup() { ClutchSetCapacity(); } public static void ModifyAttack(Attack attack, string weaponName) { //IL_01ae: 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_021e: Unknown result type (might be due to invalid IL or missing references) if (attack.m_attackAnimation == "spear_throw") { Throw(weaponName); } else if (WUTIL.GetButton("Block")) { if (WUTIL.GetButton("Forward")) { attack.m_attackAnimation = "battleaxe_attack"; attack.m_attackAngle = 360f; attack.m_attackChainLevels = 3; attack.m_damageMultiplier *= 1.5f; attack.m_speedFactor = 0.1f; attack.m_speedFactorRotation *= 4f; } else if (WUTIL.GetButton("Backward")) { attack.m_attackAnimation = "swing_pickaxe"; attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; attack.m_damageMultiplier *= 1.5f; attack.m_forceMultiplier = 2f; attack.m_staggerMultiplier = 2f; attack.m_attackHeight = 0f; } else if (WUTIL.GetButton("Left") || WUTIL.GetButton("Right")) { attack.m_attackAnimation = "atgeir_secondary"; attack.m_attackAngle = 360f; attack.m_forceMultiplier = 1.5f; } else { attack.m_attackAnimation = "battleaxe_secondary"; attack.m_damageMultiplier *= 1.2f; attack.m_forceMultiplier = 0.8f; attack.m_staggerMultiplier = 0.8f; } } else if (((Character)Player.m_localPlayer).IsCrouching()) { if (WUTIL.GetButton("Backward")) { attack.m_attackAnimation = "knife_secondary"; attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; attack.m_damageMultiplier *= 1.8f; attack.m_forceMultiplier = 2f; attack.m_staggerMultiplier = 2f; attack.m_attackHeight = 0f; } } else if (WUTIL.GetButton("Jump") && !Flight.IsFlying()) { attack.m_attackAnimation = "swing_pickaxe"; attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; attack.m_damageMultiplier *= 2.5f; attack.m_forceMultiplier = 3f; attack.m_staggerMultiplier = 3f; attack.m_attackHeight = 0f; } } public static void Update() { //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Invalid comparison between Unknown and I4 if (m_initialUpdate) { WDBUG.Log("Throwstick startup held Clutch check", WDBUG.Level.Throwstick); ClutchUpdateToContent(ClutchGetActive()); m_initialUpdate = false; } if (WUTIL.TimerIsAlmost("throwstick_pickup_fish", 0f)) { WUTIL.AddItemToInventory((Humanoid)(object)Player.m_localPlayer, "FishRaw", equip: false, 2); } if (WUTIL.TimerIsAlmost("throwstick_clutch_pickup_delay", 0f)) { ClutchUpdateToContent(ClutchGetActive(), c_clutchFlickerDelay); } else if (WUTIL.TimerIsAlmost("throwstick_clutch_throw_delay", 0f)) { ItemData val = ClutchGetActive(); if (Equipment.UnloadCarryItem(val, 1, equipLast: true) == 0) { WDBUG.Log("Failed to unload Clutch post throw"); } else { ClutchUpdateToContent(val, c_clutchFlickerDelay); } } else if (WUTIL.TimerIsAlmost("throwstick_clutch_redraw_delay", 0f) && m_clutchActive != null) { ((Humanoid)Player.m_localPlayer).UnequipItem(m_clutchActive, true); ItemData rightItem = WUTIL.GetRightItem(); if (rightItem != null && (int)rightItem.m_shared.m_itemType == 19) { WDBUG.Log("Prevented Clutch auto-equip while holding Tool", WDBUG.Level.Throwstick); m_clutchActive = null; } else { WUTIL.TimerReset("throwstick_clutch_update_delay", c_clutchFlickerDelay); } } else if (WUTIL.TimerIsAlmost("throwstick_clutch_update_delay", 0f)) { foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { if (WUTIL.ItemName(allItem) == "throwstickClutch") { if (allItem == m_clutchActive) { WDBUG.Log($"Re-equip Clutch {allItem.m_quality}/{m_clutchCapacity}", WDBUG.Level.Throwstick); ((Humanoid)Player.m_localPlayer).EquipItem(allItem, true); } else { string arg = (allItem.m_equipped ? "equipped" : "unequipped"); WDBUG.Log($"Updating {arg} Clutch {allItem.m_quality}/{m_clutchCapacity}", WDBUG.Level.Throwstick); ClutchUpdateToContent(allItem); } } } m_clutchActive = null; } else if (WUTIL.Timer("throwstick_checkwetted") == 0f) { WUTIL.TimerReset("throwstick_checkwetted", 0.5f); CheckWetted(); } } public static void ClutchSetCapacity() { int clutchCapacity = m_clutchCapacity; m_clutchCapacity = (WDBUG.IsLevelReported(WDBUG.Level.Throwstick) ? 3 : Math.Min(1 + (int)(10f * Wildling.SkillFactor((SkillType)5)), 3)); if (m_clutchCapacity != clutchCapacity) { clutchCapacity = Quest.GetAchievement("ClutchCapacity"); if (m_clutchCapacity > clutchCapacity) { Quest.SetAchievement("ClutchCapacity", m_clutchCapacity); } else if (m_clutchCapacity < clutchCapacity) { m_clutchCapacity = clutchCapacity; } WDBUG.Log("Set clutch max capacity to " + m_clutchCapacity, WDBUG.Level.Throwstick); } } public static void ClutchProfileUpdate(Player player) { WDBUG.Log("Profile Clutch check", WDBUG.Level.Throwstick); ClutchUpdateToContent(ClutchGetActive(player)); } public static void ClutchCheckCapacity(ItemData clutch) { if (WUTIL.ItemName(clutch) == "throwstickClutch") { clutch.m_shared.m_maxQuality = m_clutchCapacity; } } public static void ClutchToggle(ItemData clutch, bool equiping = true) { if (WUTIL.ItemName(clutch) != "throwstickClutch") { if (WUTIL.ItemName(clutch).StartsWith("Throwstick")) { WUTIL.TimerReset("c_clutchLastThrowCooldown"); } } else { if (WUTIL.Timer("throwstick_clutch_ready_cooldown") > 0f || m_clutchActive != null) { return; } WUTIL.TimerReset("c_clutchLastThrowCooldown"); bool flag = Equipment.AltActionKey(); if (equiping) { ClutchLoad(clutch, !flag); } else if (flag && clutch.m_quality > 0) { if (Equipment.UnloadCarryItem(clutch) == 0) { WUTIL.Message("No space in inventory to unload Throwsticks"); } else { ClutchUpdateToContent(clutch); } } } } public static bool ClutchCanLoad(ItemData item) { if (!WUTIL.ItemName(item).StartsWith("Throwstick")) { return false; } return ClutchLoadable(checkUnarmedInventoryFull: false) != null; } public static bool ClutchAnimating(bool hold = false) { if (WUTIL.Timer("c_clutchLastThrowCooldown") > 0f) { if (hold) { WUTIL.TimerReset("c_clutchLastThrowCooldown", c_clutchFlickerDelay); } return true; } return m_clutchActive != null; } public static void Equip(ItemData item, bool equip = true) { if (m_clutchActive == null && WUTIL.ItemName(item).StartsWith("Throwstick")) { m_lastHeldDurability = item.m_durability; m_pickupEquip = false; } } public static void Throw(string name) { if (m_clutchActive != null) { WDBUG.Log("Throw with pending throwstick clutch! throwstick_clutch_update_delay: " + WUTIL.Timer("throwstick_clutch_update_delay"), WDBUG.Level.Throwstick); } ItemData val = ClutchGetActive(); if (val != null && val.m_quality > 0) { WDBUG.Log($"About to throw clutch: {val.m_quality}/{m_clutchCapacity}", WDBUG.Level.Throwstick); m_pickupEquip = false; if (val.m_quality > 0) { m_clutchActive = val; WUTIL.TimerReset("throwstick_clutch_throw_delay", c_throwAnimationDelay); } } else { WDBUG.Log("Throw last Throwstick", WDBUG.Level.Throwstick); WUTIL.TimerReset("c_clutchLastThrowCooldown", c_throwAnimationDelay); } } public static void Pickup(GameObject go) { if (WUTIL.GameName(go).StartsWith("Throwstick")) { ItemDrop component = go.GetComponent(); int num = AttachedFish(component); WDBUG.Log($"Player pickup '{component.m_itemData.m_shared.m_name}' fish: {num}", WDBUG.Level.Throwstick); int num2 = component.m_itemData.m_shared.m_name.IndexOf(" with a"); if (num2 > 0) { component.m_itemData.m_shared.m_name = component.m_itemData.m_shared.m_name.Substring(0, num2); } if (num > 0) { WUTIL.TimerReset("throwstick_pickup_fish", 0.1f); } m_pickupEquip = true; } } public static bool Pickup(ItemData item) { if (!m_pickupEquip) { return false; } string text = WUTIL.ItemName(item); if (!text.StartsWith("Throwstick")) { return false; } m_pickupEquip = false; ItemData val = ClutchLoadable(); if (val != null) { WDBUG.Log($"Pickup {text} to clutch {val.m_quality}/{m_clutchCapacity}", WDBUG.Level.Throwstick); List itemList = new List { item }; Equipment.LoadCarryItem(val, itemList, fromInventory: false); WUTIL.TimerReset("throwstick_clutch_pickup_delay", 0.1f); return true; } return false; } public static void Ready() { if (WUTIL.GetInventoryItemData("throwstickClutch", mustBeEquipped: true) != null) { CheckWetted(hideLarge: false); WUTIL.TimerReset("throwstick_clutch_ready_cooldown", 0.2f); } } public static bool CheckHit(Projectile projectile, Vector3 hitPoint, bool hitWater, Collider hitCollider) { //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.GameName(((Object)projectile).name); bool flag = text.StartsWith("throwstick"); if (!flag && !(text == "flintspear_projectile_poisoned")) { return false; } string text2; bool flag2; float num; if (text.EndsWith("poisoned")) { text2 = (flag ? "Throwstick" : "SpearFlint"); flag2 = hitWater; if (!hitWater) { if ((Object)(object)hitCollider != (Object)null) { GameObject obj = Projectile.FindHitObject(hitCollider); if ((Object)(object)((obj != null) ? obj.GetComponent() : null) == (Object)null) { num = 0.3f; goto IL_009f; } } num = 0.7f; goto IL_009f; } goto IL_00cc; } goto IL_0171; IL_00cc: projectile.m_spawnOnHit = WUTIL.GetPrefab(flag2 ? text2 : (text2 + "Poisoned")); ItemData val = projectile.m_spawnOnHit.GetComponent()?.m_itemData; if (val != null) { val.m_durability = Math.Max(m_lastHeldDurability - 2f, 0f); WDBUG.Log($"Reset {text2} durability to {val.m_durability} lose poison: {flag2}", WDBUG.Level.Poisoned); } if (!flag) { return true; } goto IL_0171; IL_0171: if (!hitWater) { if ((Object)(object)hitCollider != (Object)null && (Object)(object)hitCollider.attachedRigidbody != (Object)null) { Transform val2 = (Object.op_Implicit((Object)(object)((Component)hitCollider).transform.parent) ? ((Component)hitCollider).transform.parent : ((Component)hitCollider).transform); if ((Object)(object)((Component)val2).gameObject.GetComponent() != (Object)null) { Quest.AdvanceAchievement("Throwsticks"); } } return true; } Fish val3 = null; float num2 = 9999f; Collider[] array = Physics.OverlapSphere(hitPoint, 16f, WUTIL.c_foodRayMask); foreach (Collider val4 in array) { Transform val5 = ((Component)val4).transform; if (!((Object)(object)val5 != (Object)null)) { continue; } while ((Object)(object)val5.parent != (Object)null) { val5 = val5.parent; } Fish component = ((Component)val5).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { float num3 = Vector3.Distance(hitPoint, ((Component)component).transform.position); if (num3 < num2) { num2 = num3; val3 = component; } } } if ((Object)(object)val3 == (Object)null) { return true; } float num4 = hitPoint.y - ((Component)val3).transform.position.y; num2 -= num4; float num5 = Alignment.m_holdingRabbitFootLuck + 0.4f + 0.4f * Wildling.SkillFactor((SkillType)5); float num6 = WUTIL.RandomSpin(); if (num4 > 4f || 0.5f * num4 * num6 > num5 || num2 > 2f || num2 * num6 > num5) { return true; } m_attachFish = WUTIL.GameName(((Component)val3).gameObject); int num7 = 0; if (m_attachFish.StartsWith("Fish")) { int result; if (m_attachFish.StartsWith("Fish4")) { num7 = 4; } else if (int.TryParse(m_attachFish.Substring(4), out result)) { num7 = result; } } if (num7 <= 12) { Quest.SetAchievement("SpearFisher", num7, bit: true); if (Flight.IsFlying()) { Quest.AdvanceAchievement("FlyFishing"); } } if (num7 == 0 || num7 > 4) { WUTIL.Message("Spear was not effective on this fish.", center: true, WUTIL.GetIcon(m_attachFish)); m_attachFish = ""; } else { WUTIL.Message("You hit a fish!", center: true, WUTIL.GetIcon(m_attachFish)); WUTIL.Destroy(((Component)val3).gameObject); } return true; IL_009f: float num8 = num; flag2 = m_lastHeldDurability < 6f || WUTIL.RandomSpin() < num8; goto IL_00cc; } private static ItemData ClutchGetActive(Player player = null) { if (m_clutchActive != null) { return m_clutchActive; } Inventory val = (((Object)(object)player == (Object)null) ? ((Humanoid)Player.m_localPlayer).GetInventory() : ((Humanoid)player).GetInventory()); if (val == null) { WDBUG.Log("Failed to get invenory for player " + player.GetPlayerName()); return null; } foreach (ItemData allItem in val.GetAllItems()) { if (allItem.m_equipped && WUTIL.ItemName(allItem) == "throwstickClutch") { return allItem; } } return null; } private static ItemData ClutchLoadable(bool checkUnarmedInventoryFull = true) { ItemData currentWeapon = ((Humanoid)Player.m_localPlayer).GetCurrentWeapon(); if ((currentWeapon == null || currentWeapon.m_shared.m_name == "Unarmed") && checkUnarmedInventoryFull) { WDBUG.Log("Unarmed inventory full check", WDBUG.Level.Throwstick); Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); if (inventory.NrOfItems() < inventory.GetHeight() * inventory.GetWidth()) { return null; } } ItemData val = ClutchGetActive(); return (val == null || val.m_quality >= m_clutchCapacity) ? null : val; } private static void ClutchLoad(ItemData clutch, bool autoEquip = true) { int num = clutch.m_quality; Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); List list = new List(); bool flag = autoEquip; for (int i = 0; i < inventory.GetHeight(); i++) { for (int j = 0; j < inventory.GetWidth(); j++) { ItemData itemAt = inventory.GetItemAt(j, i); if (itemAt != null && itemAt.m_durability > 0f && WUTIL.ItemName(itemAt).StartsWith("Throwstick")) { if (itemAt.m_equipped) { flag = false; } else { list.Add(itemAt); } } } } ItemData val = null; List list2 = new List(); foreach (ItemData item in list) { if (flag) { val = item; flag = false; continue; } if (num < m_clutchCapacity) { list2.Add(item); num++; continue; } break; } if (flag && list2.Count == 0 && num > 0) { WDBUG.Log("Trying to autoequip from Clutch", WDBUG.Level.Throwstick); if (Equipment.UnloadCarryItem(clutch, 1, equipLast: true) > 0) { ClutchUpdateToContent(clutch, c_clutchFlickerDelay); return; } } else { Equipment.LoadCarryItem(clutch, list2); } if (val != null) { ((Humanoid)Player.m_localPlayer).EquipItem(val, true); } ClutchUpdateToContent(clutch); } private static void ClutchUpdateToContent(ItemData clutch, float redrawEquipDelay = 0f) { if (clutch == null) { return; } int num = 0; int num2 = 0; int num3 = clutch.m_quality; string itemData = Equipment.GetItemData(clutch); string[] array = itemData.Split(new char[1] { '\n' }); foreach (string text in array) { if (!(text == "")) { num++; string[] array2 = text.Split(new char[1] { ',' }); if (array2.Length > 3 && array2[3].EndsWith("Poisoned")) { num2++; } } } if (num != num3) { WDBUG.Log($"Clutch initial quality {num3} did not match content {num}"); num3 = (clutch.m_quality = num); } clutch.m_shared.m_maxQuality = m_clutchCapacity; if (clutch.m_shared.m_icons.Length > 1) { clutch.m_variant = Math.Min(clutch.m_quality, clutch.m_shared.m_icons.Length - 1); } clutch.m_shared.m_blockPower = 2 + num3 * 10; int num4 = ((num3 >= 3) ? 6 : (num3 switch { 1 => 3, 2 => 5, _ => 0, })); clutch.m_shared.m_movementModifier = -0.01f * (float)num4; WDBUG.Log($"Set clutch block: {clutch.m_shared.m_blockPower} movement modified: {clutch.m_shared.m_movementModifier}", WDBUG.Level.Throwstick); if ((Object)(object)clutch.m_dropPrefab == (Object)null || (Object)(object)clutch.m_dropPrefab.transform == (Object)null) { WDBUG.Log("throwstickClutch had no prefab (instance)"); return; } Transform val = clutch.m_dropPrefab.transform.Find("attach"); if ((Object)(object)val == (Object)null) { WDBUG.Log("Failed to find throwstickClutch attach transform"); return; } ((Component)val.Find("throwstick1p")).gameObject.SetActive(num3 > 0 && num2 > 0); ((Component)val.Find("throwstick1")).gameObject.SetActive(num3 > 0 && num2 <= 0); ((Component)val.Find("throwstick2p")).gameObject.SetActive(num3 > 1 && num2 > 1); ((Component)val.Find("throwstick2")).gameObject.SetActive(num3 > 1 && num2 <= 1); ((Component)val.Find("throwstick3p")).gameObject.SetActive(num3 > 2 && num2 > 2); ((Component)val.Find("throwstick3")).gameObject.SetActive(num3 > 2 && num2 <= 2); if (redrawEquipDelay > 0f) { m_clutchActive = clutch; WDBUG.Log($"Unequip Clutch redraw delay to {redrawEquipDelay}", WDBUG.Level.Throwstick); WUTIL.TimerReset("throwstick_clutch_redraw_delay", redrawEquipDelay); } } private static int AttachedFish(ItemDrop throwstick) { Transform transform = ((Component)throwstick).transform; for (int i = 1; i <= 3; i++) { Transform val = transform.Find("attach/Fish" + i); if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf) { return i; } } return 0; } private static void CheckWetted(bool hideLarge = true) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)((Character)localPlayer).GetStandingOnShip() != (Object)null || ((Character)localPlayer).IsAttachedToShip()) { return; } float num = ((Character)localPlayer).GetLiquidLevel() - ((Component)localPlayer).transform.position.y; if (!(num > (((Character)localPlayer).IsSitting() ? 0.4f : (Wildling.IsWildling ? 0.48999998f : 0.7f)))) { return; } ItemData inventoryItemData = WUTIL.GetInventoryItemData("throwstickClutch", mustBeEquipped: true); if (inventoryItemData != null) { WDBUG.Log($"Clutch touch water at depth: {num}", WDBUG.Level.Poisoned); ((Humanoid)Player.m_localPlayer).UnequipItem(inventoryItemData, true); } if (!WUTIL.IsWildlingObject(((Humanoid)localPlayer).GetCurrentWeapon().m_dropPrefab)) { return; } string text = WUTIL.ItemName(((Humanoid)localPlayer).GetCurrentWeapon()); if (!(text == "Coldball") && !(text == "PebbleBad") && !text.EndsWith("Poisoned")) { return; } WDBUG.Log($"{text} touch water at depth: {num}", WDBUG.Level.Poisoned); if (num > 0f && (text.StartsWith("Spear") || text.StartsWith("Throw"))) { if (hideLarge) { WUTIL.HideHandItems(); } } else { ((Humanoid)Player.m_localPlayer).UnequipItem(((Humanoid)localPlayer).GetCurrentWeapon(), true); } } } internal class Loki { [HarmonyPatch(typeof(Humanoid), "StartAttack")] private class PatchHumanoidStartAttack { private static void Prefix(Humanoid __instance, ref bool secondaryAttack) { if (!((Character)__instance).IsPlayer()) { switch (WUTIL.ItemName(__instance.GetCurrentWeapon())) { default: return; case "Sparx": case "Thorscorn": secondaryAttack = true; break; case "Bowdacious": break; } Alignment.IgnoreNextIsEnemyCheck(); } } private static void Postfix(Humanoid __instance, bool __result, Attack ___m_currentAttack, Rigidbody ___m_body, ZSyncAnimation ___m_zanim, CharacterAnimEvent ___m_animEvent, VisEquipment ___m_visEquipment, Attack ___m_previousAttack, float ___m_timeSinceLastAttack) { if (__result && !((Character)__instance).IsPlayer()) { switch (WUTIL.ItemName(__instance.GetCurrentWeapon())) { default: return; case "Sparx": case "Bowdacious": case "SpearWolfFang": ___m_currentAttack.m_attackAnimation = "spear_throw"; break; case "Thorscorn": ___m_currentAttack.m_attackAnimation = "attack_cast"; break; case "KnifeSilver": case "KnifeBlackMetal": ___m_currentAttack.m_attackAnimation = "swing_longsword"; ___m_currentAttack.m_attackChainLevels = 1; break; } ItemData currentWeapon = __instance.GetCurrentWeapon(); float num = 0.6f + WUTIL.RandomSpin(0.6f); ___m_currentAttack.Start(__instance, ___m_body, ___m_zanim, ___m_animEvent, ___m_visEquipment, currentWeapon, ___m_previousAttack, ___m_timeSinceLastAttack, num); } } } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] private class PatchHumanoidBlockAttack { public static void Postfix(Humanoid __instance, HitData hit, Character attacker, bool __result, ItemData ___m_leftItem) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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) if (__result && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && WUTIL.ItemName(___m_leftItem) == "Chimes") { if (!hit.m_ranged || Vector3.Distance(((Component)__instance).transform.position, ((Component)attacker).transform.position) < 2f) { float min = default(float); float max = default(float); ((Character)__instance).GetSkills().GetRandomSkillRange(ref min, ref max, ___m_leftItem.m_shared.m_skillType); float num = Mathf.RoundToInt(___m_leftItem.m_shared.m_damages.m_spirit * WUTIL.RandomSpin(min, max)); WDBUG.Log($"Chimes blocked hit and does spirit damage {num}", WDBUG.Level.Chimes); ChimesHitEffect((Character)(object)__instance, attacker, num); } HitData val = hit.Clone(); DamageModifiers damageModifiers = ((Character)__instance).GetDamageModifiers((WeakSpot)null); DamageModifier val2 = default(DamageModifier); val.ApplyResistance(damageModifiers, ref val2); val.ApplyArmor(((Character)__instance).GetBodyArmor()); float num2 = ((Character)__instance).GetHealth() - val.GetTotalDamage(); if (num2 < 1f) { float num3 = (WUTIL.TestLuck() ? 0.2f : 0.4f); val.ApplyModifier(num3); WDBUG.Log($"Attempt to rescue from certain death at {num2} (x{num3}) -> {((Character)__instance).GetHealth() - val.GetTotalDamage()}", WDBUG.Level.Chimes); hit.ApplyModifier(num3); } } } } [HarmonyPatch(typeof(Projectile), "Setup")] private class PatchProjectileSetup { private static bool Prefix(Projectile __instance, Character owner, ref Vector3 velocity, ItemData item, ref HitData hitData) { ProjectileSetup(__instance, ref velocity, owner, item, ref hitData); return true; } } [HarmonyPatch(typeof(DamageText), "ShowText", new Type[] { typeof(DamageModifier), typeof(Vector3), typeof(float), typeof(bool) })] private class PatchDamageTextShowText { private static bool Prefix(DamageModifier type, float dmg) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 if (dmg < 0.1f || (int)type == 4 || (int)type == 3) { return WUTIL.Timer("aoe_ignore_0hits") == 0f; } return true; } } [HarmonyPatch(typeof(TextViewer), "ShowText")] private class PatchTextViewerShowText { private static bool Prefix(TextViewer __instance, ref string topic, string textId, Animator ___m_animator, int ___s_visibleID, ref bool ___m_autoHide, ref Vector3 ___m_openPlayerPos, ref float ___m_showTime) { //IL_00f9: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { return true; } if (m_runicText != "") { if (m_postRunicText == "") { __instance.m_topic.text = topic; __instance.m_runeText.text = m_runicText; __instance.m_text.text = ""; m_runicText = topic; m_postRunicText = textId; WUTIL.TimerReset("post_runic_text_update", 3f); } else { __instance.m_topic.text = m_runicText; __instance.m_runeText.text = ""; __instance.m_text.text = Localization.instance.Localize(textId); m_runicText = (m_postRunicText = ""); } ___m_animator.SetBool(___s_visibleID, true); ___m_autoHide = true; ___m_openPlayerPos = ((Component)Player.m_localPlayer).transform.position; ___m_showTime = 4f; return false; } if (topic == "@dynamic") { topic = ""; int num = 0; foreach (char c in textId) { if (c == ' ') { num++; } } ___m_showTime = 1f + 0.5f * (float)num; } else if (topic == "Great Serpent Vegvisir") { MountainDungeon.MarkLocationOnMap(showOnMap: true); } else if (topic == "Riddle of the Ultimate Labyrinth") { Quest.CheckObjective(35, set: false); Quest.CheckObjective(36, set: false); Quest.CheckObjective(37); } return true; } } private class TreeBurn { public GameObject m_go; public int m_burnTicks; public float m_minDPS; public float m_maxDPS; public TreeBurn(GameObject go, int burnTicks = 5, float minDPS = 1f, float maxDPS = 3f) { m_go = go; m_burnTicks = burnTicks; m_minDPS = minDPS; m_maxDPS = maxDPS; } } private static List m_princeLocations = new List(); private static List m_gdcampLocations = new List(); private static int m_princeLocationsActive = 0; private static List m_goblinPrinceCasts = new List { "Goblin", "GoblinArcher", "GoblinShaman" }; private static List m_goblinPrinceNames = new List { "Ngalygoth", "Yigath", "Uthorax" }; private static List m_goblinPrinceWeapons = new List { "Thorscorn", "Bowdacious", "Sparx" }; private static List m_goblinPrinceLetters = new List { "Letter_Thorscorn", "Letter_Bowdacious", "Letter_Sparx" }; private static List m_goblinPrincePocketItems = new List { "KnifeSilver,Ruby,Coins,BloodPudding,MeadStaminaMedium,PixieDust", "SpearWolfFang,Ruby,Coins,FishWraps,MeadHealthMedium,PixieDust", "KnifeBlackMetal,Ruby,Coins,LoxPie,BarleyWine,DoxieDust" }; private const float c_princeTag = 0.98f; private static Dictionary m_goblinPrincesActive = new Dictionary(); private const int c_sparxHitsStartFire = 9; private const float c_sparxMinDamage = 1f; private const float c_sparxMaxDamage = 6f; private const float c_sparxMinFireDamage = 8f; private const float c_sparxMaxFireDamage = 21f; private const float c_sparxMinWoodFireBurstMinDamage = 8f; private const float c_sparxMaxWoodFireBurstDamage = 21f; private const float c_sparxMinWoodFireDPS = 2f; private const float c_sparxMaxWoodFireDPS = 4f; private static float m_sparxPulseDamage = 0f; private const int c_fireBurnTimeMin = 8; private const int c_fireBurnTimeMax = 40; private const int c_fireResparkTicks = 2; private const float c_fireDecayPS = 0.8f; private const float c_fireRekindleChance = 0.5f; private const float c_fireWalkChance = 0.5f; private const float c_fireWalkMinDist = 0.3f; private const float c_fireWalkMaxDist = 0.7f; private const float c_fireCheckWhenWet = 0.8f; private const bool c_bowdaciousEnableAirLight = false; private const int c_bowdaciousArrowNumColors = 2; private const float c_bowdaciousArrowRangeGain = 1.02f; private const float c_bowdaciousArrowBurstIntensity = 6f; private const float c_bowdaciousArrowBurstTTL = 10f; private const float c_bowdaciousArrowBurstTime = 6f; private const float c_bowdaciousArrowMinDamage = 13f; private const float c_bowdaciousArrowMaxDamage = 21f; private static Vector3 m_lightningColor = new Vector3(0.9f, 0.8f, 1f); private const float c_thorscornMaxFlightTime = 3.54f; private const float c_thorscornImplosionStart = 0.5f; private const float c_thorscornRotationSpeedMin = 360f; private const float c_thorscornRotationSpeedMax = 720f; public static string m_runicText = ""; public static string m_postRunicText = ""; private static int m_projectileCount = 0; private static Character m_thorscornOwner = null; private static GameObject m_implosion = null; private static Dictionary m_sparkColliderHits = new Dictionary(); private static Dictionary m_burningPositions = new Dictionary(); public static void Update() { UpdateBurning(); UpdateThorscorn(); if (m_gdcampLocations.Count < 3) { LocatePrinceVillages(); } else if (WUTIL.Timer("prince_loc_check") == 0f) { WUTIL.TimerReset("prince_loc_check", 5f); LocateLocalPrince(); } if (m_postRunicText != "" && WUTIL.Timer("post_runic_text_update") == 0f) { TextViewer.instance.ShowText((Style)0, m_runicText, m_postRunicText, true); } } public static void RevealPrinceLocations(bool debug = false) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (m_gdcampLocations.Count < 1) { WDBUG.Log("Prince Locations not available!"); return; } int num = 0; Vector3 val = Vector3.zero; for (int i = 0; i < m_gdcampLocations.Count; i++) { if ((m_princeLocationsActive & (1 << i)) == 0) { WDBUG.Log($"Prince{i} vanquished?"); continue; } MapMarker.MarkMap(m_princeLocations[i], "Prince"); if (debug) { MapMarker.MarkMap(m_gdcampLocations[i]); } val += m_princeLocations[i]; num++; } if (num > 0) { WUTIL.Message("New locations marked on map.", center: true, WUTIL.GetIcon("GoblinPrinceTrophy")); WUTIL.Message("New locations marked on map."); MapMarker.MarkMap(val / (float)m_gdcampLocations.Count, "", openMap: true); } } public static bool PrincePortalOverride(ref Vector3 target, int princeOffset = 0) { //IL_001d: 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) int num = -1; for (int i = 0; i < m_gdcampLocations.Count; i++) { int num2 = (i + princeOffset) % m_gdcampLocations.Count; if (!MapMarker.HavePinAtPosition(m_gdcampLocations[num2])) { num = num2; if (((m_princeLocationsActive & 7) ^ (1 << num2)) != 0) { break; } } } if (num < 0) { WDBUG.Log("No Prince teleport locations open", WDBUG.Level.Quest); return false; } target = m_gdcampLocations[num]; WDBUG.Log("Teleport override for Prince" + num, WDBUG.Level.Quest); return true; } public static void ModifySparxAttack(Attack attack, bool crouching = false) { if (attack.m_attackAnimation == "sword_secondary") { if (crouching) { attack.m_attackAnimation = "sword_secondary"; attack.m_forceMultiplier *= 1.5f; m_sparxPulseDamage = 20f; m_projectileCount = 0; } else if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "atgeir_secondary"; attack.m_damageMultiplier *= 3f; attack.m_projectileAccuracy = 1f; m_sparxPulseDamage = 10f; m_projectileCount = 10; } else { attack.m_attackAnimation = "battleaxe_secondary"; m_sparxPulseDamage = 0f; m_projectileCount = 10; } WUTIL.CreateAttachedEffect("sparx_charge_fx", WUTIL.HandTransform()); m_sparkColliderHits.Clear(); } } public static void ModifyThorscornAttack(Attack attack) { if (WUTIL.GetButton("Block")) { attack.m_launchAngle = 0f; attack.m_projectileAccuracy = 0.5f; WUTIL.CreateAttachedEffect("sparx_charge_fx", WUTIL.HandTransform()); } } public static bool ProjectileSetup(Projectile projectile, ref Vector3 velocity, Character owner, ItemData sourceItem, ref HitData hitData) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) switch (WUTIL.ItemName(sourceItem)) { case "Bowdacious": { int num = 1 + WUTIL.DieRoll(2); float min = 13f / (float)num; float max = 21f / (float)num; hitData.ApplyModifier(0f); Vector3 val2 = Vector3.zero; for (int i = 0; i < num; i++) { float num2 = WUTIL.RandomSpin(min, max, 0.1f); switch (WUTIL.DieRoll(4)) { case 1: hitData.m_damage.m_frost += num2; val2.z += 1f; break; case 2: hitData.m_damage.m_lightning += num2; val2 += m_lightningColor; break; case 3: val2.y += 1f; hitData.m_damage.m_poison += num2; break; default: val2.x += 1f; hitData.m_damage.m_fire += num2; break; } } ((Vector3)(ref val2)).Normalize(); Color val3 = default(Color); ((Color)(ref val3))..ctor(val2.x, val2.y, val2.z); Transform val4 = projectile.m_visual.transform.Find("Light"); Light component = ((Component)val4).GetComponent(); component.color = val3; Transform val5 = projectile.m_visual.transform.Find("AirLight"); ((Component)val5).gameObject.SetActive(false); Light component2 = ((Component)val5).GetComponent(); component2.color = val3; projectile.m_ttl = 10f + 0.5f * WUTIL.RandomSpin(); WDBUG.Log($"Bowdacious projectile type color {val3}", WDBUG.Level.Bowdacious); break; } case "Thorscorn": ((Component)projectile).transform.rotation = ((Component)owner).transform.rotation; if ((Object)(object)owner == (Object)(object)Player.m_localPlayer && WUTIL.GetButton("Block")) { projectile.m_visual.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); velocity *= 2f; projectile.m_gravity = 0f; } else { projectile.m_rotateVisual = WUTIL.RandomSpin(360f, 720f, 10f); } projectile.m_aoe = 6 + WUTIL.DieRoll(3); WUTIL.TimerReset("thorscorn_fly", 3.54f); m_thorscornOwner = owner; break; case "Sparx": if (owner.IsPlayer()) { if (m_projectileCount < 10) { m_projectileCount++; } Transform val = WUTIL.HandTransform(); if ((Object)(object)val != (Object)null) { ((Component)projectile).transform.localPosition = val.position + 0.1f * (float)m_projectileCount * val.forward; } } hitData.ApplyModifier(0f); hitData.m_damage.m_lightning = m_sparxPulseDamage + WUTIL.RandomSpin(1f, 6f + m_sparxPulseDamage, 0.2f); WDBUG.Log($"Spark damage {hitData.m_damage.m_lightning} (pulse {m_sparxPulseDamage})", WDBUG.Level.Sparx); m_sparxPulseDamage *= 0.6f; if (m_sparxPulseDamage < 0.1f) { m_sparxPulseDamage = 0f; } hitData.m_skill = (SkillType)0; break; default: return false; } return true; } public static bool ProjectileFixedUpdate(Projectile projectile, Character owner) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) switch (WUTIL.GameName(((Object)projectile).name)) { case "thorscorn_projectile": { float num = 0.5f + 2f * Time.fixedDeltaTime; if (projectile.m_ttl < Time.fixedDeltaTime && WUTIL.Timer("thorscorn_fly") > num) { WUTIL.TimerReset("thorscorn_fly", num); WDBUG.Log($"Thorscorn TTL explosion at {projectile.m_ttl} - set implosion count down", WDBUG.Level.Thorscorn); WUTIL.Spawn("thorscorn_explosion_vfx", ((Component)projectile).transform.position, Quaternion.identity); } break; } case "sparx_projectile": return true; case "bowdacious_projectile": { Transform val = projectile.m_visual.transform.Find("Light"); Light component = ((Component)val).GetComponent(); if (WUTIL.TimeIsAlmost(projectile.m_ttl, 6f)) { component.intensity = 6f; } else if (projectile.m_ttl < 5.9f) { component.intensity = 3f; component.range = 6f; } else { component.range *= 1.02f; } break; } default: return false; } return true; } public static bool ProjectileOnHit(Projectile projectile, GameObject hitObject, Vector3 hitPoint, Character owner) { //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) Character component = hitObject.GetComponent(); if ((Object)(object)component == (Object)(object)owner) { return false; } switch (WUTIL.GameName(((Object)projectile).name)) { case "Bowdacious": WUTIL.TimerReset("aoe_ignore_0hits", 0.1f); break; case "sparx_projectile": { string text = WUTIL.GameName(hitObject); bool flag = (Object)(object)component != (Object)null; bool flag2 = Burnable(hitObject) || flag; if (m_sparkColliderHits.ContainsKey(hitObject)) { if (++m_sparkColliderHits[hitObject] >= 9) { m_sparkColliderHits.Remove(hitObject); if (flag) { projectile.m_damage.m_fire = WUTIL.RandomSpin(8f, 21f, 0.1f); WDBUG.Log($"Fire burst on {text} for {projectile.m_damage.m_fire} damage ({component.m_damageModifiers.m_fire})", WDBUG.Level.Sparx); } else if (flag2) { int num2 = ((!((Object)(object)hitObject.GetComponent() == (Object)null)) ? hitObject.GetComponent().m_minToolTier : 0); projectile.m_damage.m_chop = WUTIL.RandomSpin(8f, 21f, 0.1f); projectile.m_damage.m_chop /= Mathf.Max(num2, 1); if (num2 > 1) { WDBUG.Log($"Adding extra burst damgage for chop resistance {projectile.m_damage.m_chop}", WDBUG.Level.Sparx); projectile.m_damage.m_damage = projectile.m_damage.m_chop; } SetBurning(hitObject, hitPoint); WDBUG.Log($"Fire started on {text} for {projectile.m_damage.m_chop} burst damage", WDBUG.Level.Sparx); } } else { float num3 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, hitPoint); WDBUG.Log($"Spark hit {text} {m_sparkColliderHits[hitObject]} times at {num3}", WDBUG.Level.Sparx); } } else if (flag2) { WDBUG.Log("Reset Sparx target to new burnable " + text, WDBUG.Level.Sparx); m_sparkColliderHits.Add(hitObject, 1); } if (!flag) { if (text != "Terrain" && WUTIL.DieRoll(12) == 0) { WUTIL.PlaceObject("electric_fx", hitPoint); WDBUG.Log("Added electric effect to " + text, WDBUG.Level.Sparx); } return false; } break; } case "thorscorn_projectile": { float num = 0.5f + 2f * Time.fixedDeltaTime; if (WUTIL.Timer("thorscorn_fly") > num) { WDBUG.Log($"Thorscorn HIT explosion at {projectile.m_ttl} - set implosion count down", WDBUG.Level.Thorscorn); WUTIL.TimerReset("thorscorn_fly", num); WUTIL.TimerReset("aoe_ignore_0hits", 0.1f); } break; } case "chimes_projectile": WUTIL.TimerReset("aoe_ignore_0hits", 0.1f); ChimesHitEffect(owner, component); break; } return true; } public static void SetBurning(GameObject go, Vector3 hitPoint, int burnTime = 0) { //IL_00d9: 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_0079: 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_00c7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)go != (Object)null) { int num = ((burnTime > 0) ? burnTime : (8 + WUTIL.DieRoll(32))); if (m_burningPositions.ContainsKey(hitPoint)) { m_burningPositions[hitPoint].m_burnTicks += num; WDBUG.Log($"Fire extended on {WUTIL.GameName(go)} to {num}s", WDBUG.Level.Sparx); } else { m_burningPositions.Add(hitPoint, new TreeBurn(go, num, 2f, 4f)); WDBUG.Log($"Fire started on {WUTIL.GameName(go)} for {1f}+ DPS over {num}s", WDBUG.Level.Sparx); } WUTIL.PlaceObject("fireblast_fx", hitPoint); } WUTIL.PlaceObject("burning_fx", hitPoint); } public static bool Mineable(GameObject go) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 if ((Object)(object)go != (Object)null && (Object)(object)go.GetComponent() != (Object)null) { DamageModifier pickaxe = go.GetComponent().m_damages.m_pickaxe; return (int)pickaxe != 4 && (int)pickaxe != 3; } return false; } public static bool Burnable(GameObject go) { //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 if ((Object)(object)go == (Object)null) { return false; } if ((Object)(object)go.GetComponent() != (Object)null || (Object)(object)go.GetComponent() != (Object)null) { return true; } if ((Object)(object)go.GetComponent() != (Object)null) { DamageModifier chop = go.GetComponent().m_damages.m_chop; return (int)chop != 4 && (int)chop != 3; } if ((Object)(object)go.GetComponent() != (Object)null) { DamageModifier chop2 = go.GetComponent().m_damages.m_chop; return (int)chop2 != 4 && (int)chop2 != 3; } return false; } public static bool CustomizeThorscorn(ItemData item) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (item == null || WUTIL.ItemName(item) != "Thorscorn") { return false; } if (Wildling.IsWildling) { item.m_shared.m_animationState = (AnimationState)2; item.m_shared.m_attachOverride = (ItemType)14; } else { item.m_shared.m_animationState = (AnimationState)1; item.m_shared.m_attachOverride = (ItemType)19; } WDBUG.Log("Thorscorn customized", WDBUG.Level.Thorscorn); return true; } public static void ReadLetter(ItemData item, bool equiping) { if (!equiping || !WUTIL.ItemName(item).StartsWith("Letter")) { return; } if (InventoryGui.IsVisible()) { InventoryGui.instance.Hide(); } string text = WUTIL.KeyHighlightText("Use"); RuneStone component = item.m_dropPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log("Letter not attached to Runestone"); return; } string text2 = "" + component.m_name + ""; string text3 = "It is herein stated that the artifact, hereby known as " + component.m_topic + ", is or has been owned by " + component.m_label + " according to the Common Goblin Statute of Acquisition."; string text4 = WUTIL.GetGUIText(item.m_dropPrefab.transform.Find("attach/page/Canvas/Text"), "Nothing interesting written here..."); int num = text4.IndexOf(component.m_text); if (num > 0) { text4 = text4.Substring(num); } m_runicText = text3 + "\n\n" + text4; text3 = "It is herein stated that the artifact, hereby known as " + component.m_topic + ", is or has been owned by " + component.m_label + " according to the Common Goblin Statute of Acquisition."; string text5 = "" + text3 + "\n\n" + text4 + "\n\n" + text + " to stop reading."; TextViewer.instance.ShowText((Style)0, text2, text5, true); } public static int WeaponID(string itemName) { return m_goblinPrinceWeapons.IndexOf(itemName) + 1; } public static int LetterID(string itemName) { return m_goblinPrinceLetters.IndexOf(itemName) + 1; } public static bool AnointPrince(Character character, bool anoint = true, int tagValue = 7, bool useClass = true, bool anounce = false) { string text = WUTIL.ActorName(character); if (m_goblinPrincesActive.ContainsKey(text)) { if (anoint) { WDBUG.Log(((Object)character).name + " is already a Goblin Prince.", WDBUG.Level.Loki); } return false; } int num = m_goblinPrinceCasts.IndexOf(text); if (num < 0) { if (anoint) { WDBUG.Log("Failed to anoint " + text + " - not a suitable Goblin.", WDBUG.Level.Loki); } return false; } List list = new List(); foreach (string goblinPrinceName in m_goblinPrinceNames) { if (m_goblinPrincesActive.ContainsKey(goblinPrinceName)) { if ((Object)(object)m_goblinPrincesActive[goblinPrinceName] == (Object)null) { if (anoint) { WDBUG.Log("Goblin Prince " + goblinPrinceName + " is no longer in scope", WDBUG.Level.Loki); } } else { if (!m_goblinPrincesActive[goblinPrinceName].IsDead()) { continue; } if (anoint) { WDBUG.Log("Goblin Prince " + goblinPrinceName + " is dead!", WDBUG.Level.alert); } } m_goblinPrincesActive.Remove(goblinPrinceName); } list.Add(goblinPrinceName); } if (list.Count == 0) { if (anoint) { WDBUG.Log("Failed to anoint " + text + " - all Princes abound.", WDBUG.Level.Loki); } return false; } string text2 = (useClass ? m_goblinPrinceNames[num] : list[WUTIL.DieRoll(list.Count)]); if (useClass && m_goblinPrincesActive.ContainsKey(text2)) { if (anoint) { WDBUG.Log("Failed to anoint " + text + " - Prince " + text2 + " yet lives.", WDBUG.Level.Loki); } return false; } if (!anoint) { return true; } Alignment.RenameCharacter(character, text2); character.SetLevel(3); SetCustomedTag(character, tagValue); m_goblinPrincesActive.Add(text2, character); if (anounce) { WUTIL.Message("Long live Prince " + ((Object)character).name + "!"); } if ((tagValue & 1) > 0) { ReplaceEquipedWeapon(character, m_goblinPrinceWeapons[num]); ModifyDropList(character, m_goblinPrinceWeapons[num]); } if ((tagValue & 2) > 0) { ModifyDropList(character, m_goblinPrinceLetters[num]); } ModifyDropList(character, "GoblinPrinceTrophy"); return true; } public static int GetCustomedTag(Character character) { if ((Object)(object)character == (Object)null) { return 0; } ZNetView component = ((Component)character).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { return 0; } int num = (int)(0.5f + 1000f * (component.GetZDO().GetFloat("RandomSkillFactor", 1f) - 0.98f)); return (num > 0 && num <= 9) ? num : 0; } public static void SetCustomedTag(Character character, int tagValue = 1) { ZNetView component = ((Component)character).gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log("SetCustomedTag(Character) has no ZNetView"); return; } float num = ((tagValue > 0) ? (0.98f + 0.001f * (float)tagValue) : 1f); component.GetZDO().Set("RandomSkillFactor", num); } public static void ReplaceEquipedWeapon(Character character, string weapon) { //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) Humanoid val = ((character != null) ? ((Component)character).gameObject.GetComponent() : null); if ((Object)(object)val == (Object)null) { return; } Inventory inventory = val.GetInventory(); ItemData[] array = inventory.GetAllItems().ToArray(); foreach (ItemData val2 in array) { string text = WUTIL.ItemName(val2); if (val2.IsWeapon()) { if (text != "GoblinShaman_attack_protect" && text != "GoblinShaman_attack_poke") { inventory.RemoveItem(val2); WDBUG.Log("Removed " + val2.m_shared.m_name + " from " + character.GetHoverName()); } } else if (text.Contains("Shield")) { inventory.RemoveItem(val2); } else if (((Object)val2.m_dropPrefab).name.StartsWith("GoblinShaman_Staff_")) { inventory.RemoveItem(val2); WDBUG.Log("Removed " + val2.m_shared.m_name + " from " + character.GetHoverName()); } } ItemData val3 = val.PickupPrefab(WUTIL.GetPrefab(weapon), 0, true); if (weapon == "Bowdacious") { val3.m_shared.m_aiAttackRange = 35f; val3.m_shared.m_itemType = (ItemType)3; val3.m_shared.m_animationState = (AnimationState)1; } else if (weapon == "Sparx") { val3.m_shared.m_aiAttackRange = 40f; } else { val3.m_shared.m_aiAttackRange = 30f; ItemData val4 = val.PickupPrefab(WUTIL.GetPrefab("ShieldBlackmetal"), 0, true); val.EquipItem(val4, false); } val.EquipItem(val3, false); } public static void ModifyDropList(Character character, string itemName, bool remove = false) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown CharacterDrop component = ((Component)character).gameObject.GetComponent(); Drop[] array = component.m_drops.ToArray(); foreach (Drop val in array) { if (WUTIL.GameName(val.m_prefab) == itemName) { component.m_drops.Remove(val); } } if (!remove) { Drop val2 = new Drop(); val2.m_prefab = WUTIL.GetPrefab(itemName); val2.m_onePerPlayer = false; val2.m_levelMultiplier = false; component.m_drops.Add(val2); } WDBUG.Log($"ModifyDropList({character.GetHoverName()}, {itemName}, remove: {remove}) -> items: {component.m_drops.Count}", WDBUG.Level.Loki); } public static string PrincelyInventory(Character character) { int num = m_goblinPrinceNames.IndexOf(((Object)character).name); return (num < 0) ? "" : (m_goblinPrinceWeapons[num] + "," + m_goblinPrinceLetters[num] + "," + m_goblinPrincePocketItems[num]); } public static void OnDeath(GameObject go) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) string text = WUTIL.GameName(go); if (!m_goblinPrincesActive.ContainsKey(text)) { return; } WUTIL.Message("Goblin Prince " + text + " is dead!"); Quest.AdvanceAchievement(text); int num = m_goblinPrinceNames.IndexOf(text); if (num >= 0 && m_princeLocationsActive > 0) { m_princeLocationsActive &= 7 ^ (1 << num); if (m_princeLocationsActive == 0) { Quest.SetAchievement("QuestElder", 18); } Quest.AdvanceAchievement("PrincesKilled"); WDBUG.Log($"Adding shared Prince{num} death marker", WDBUG.Level.Loki); MapMarker.MarkMap(m_princeLocations[num] + Vector3.right, $"Prince{num}"); if (Quest.GetAchievement("PrincesKilled") >= 3) { Quest.CheckObjective(45, set: false); } } m_goblinPrincesActive.Remove(text); } private static void ResetPrincesActive() { m_princeLocationsActive = 0; for (int i = 0; i < m_goblinPrinceNames.Count; i++) { if (MapMarker.IsSharedLocation($"Prince{i}")) { WDBUG.Log($"Prince{i} has been vanquished on this world", WDBUG.Level.Quest); continue; } WDBUG.Log($"Prince{i} is alive on this world", WDBUG.Level.Quest); m_princeLocationsActive |= 1 << i; } } private unsafe static void LocatePrinceVillages() { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) if (!World.GetStartPosition(out var pos)) { return; } if (!ZNet.instance.IsServer()) { if (WUTIL.Timer("prince_loc_request_cooldown") > 0f) { return; } WUTIL.TimerReset("prince_loc_request_cooldown", 0.2f); bool flag = m_princeLocations.Count > m_gdcampLocations.Count; int num = (flag ? m_gdcampLocations.Count : m_princeLocations.Count); string text = (flag ? "Prince" : "NearPrince") + num; if (World.GetUniquePosition(text, ref pos)) { if (flag) { m_gdcampLocations.Add(pos); } else { m_princeLocations.Add(pos); } Vector3 val = pos; WDBUG.Log("Acquired " + text + " site at " + ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.Multiplayer); if (m_gdcampLocations.Count == 3) { ResetPrincesActive(); } } return; } World.FindClusterLocation(pos, "GoblinCamp", ref pos, 999f); List locationPositions = World.GetLocationPositions("Greydwarf_camp"); List locationPositions2 = World.GetLocationPositions("GoblinCamp"); if (locationPositions.Count == 0 || locationPositions2.Count == 0) { WDBUG.Log("Server failed to locate Greydwarf or Goblin camps"); return; } float num2 = 9999f; float num3 = num2; float num4 = num2; int num5 = -1; int num6 = num5; int index = num5; int num7 = -1; int num8 = num7; int index2 = num7; for (int i = 0; i < locationPositions2.Count; i++) { for (int j = 0; j < locationPositions.Count; j++) { float num9 = Vector3.Distance(locationPositions2[i], locationPositions[j]); if (num9 < num2) { num4 = num3; num3 = num2; num2 = num9; index2 = num8; num8 = num7; num7 = i; index = num6; num6 = num5; num5 = j; } else if (num9 < num3) { num4 = num3; num3 = num9; index2 = num8; num8 = i; index = num6; num6 = j; } else if (num9 < num4) { num4 = num9; index2 = i; index = j; } } } WDBUG.Log("Server located 3 suitable Goblin Villages and nearby GD Conclaves", WDBUG.Level.Multiplayer); m_princeLocations.Add(locationPositions2[num7]); m_princeLocations.Add(locationPositions2[num8]); m_princeLocations.Add(locationPositions2[index2]); m_gdcampLocations.Add(locationPositions[num5]); m_gdcampLocations.Add(locationPositions[num6]); m_gdcampLocations.Add(locationPositions[index]); for (int k = 0; k < m_princeLocations.Count; k++) { World.SetUniquePosition($"Prince{k}", m_princeLocations[k]); World.SetUniquePosition($"NearPrince{k}", m_gdcampLocations[k]); } ResetPrincesActive(); } private static void LocateLocalPrince() { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) int num = -1; Transform transform = ((Component)Player.m_localPlayer).transform; for (int i = 0; i < m_princeLocations.Count; i++) { if ((m_princeLocationsActive & (1 << i)) > 0 && !MapMarker.IsSharedLocation($"Prince{i}") && Vector3.Distance(m_princeLocations[i], transform.position) < 100f) { num = i; break; } } if (num < 0) { return; } UpdateLocalPrinces(); string text = m_goblinPrinceNames[num]; if (m_goblinPrincesActive.ContainsKey(text)) { if ((Object)(object)m_goblinPrincesActive[text] == (Object)null) { WDBUG.Log("Prince " + text + " is out of memory"); m_goblinPrincesActive.Remove(text); } else { WDBUG.Log("Active " + text + " for home location", WDBUG.Level.Loki); } return; } Vector3 val = m_princeLocations[num]; string text2 = m_goblinPrinceCasts[num]; WDBUG.Log($"Player at Prince{num} location of {text2} {text}", WDBUG.Level.Loki); Character val2 = null; float num2 = 999f; Collider[] array = Physics.OverlapSphere(val, 30f, WUTIL.c_characterRayMask); foreach (Collider val3 in array) { if (!((Object)(object)val3.attachedRigidbody != (Object)null)) { continue; } Character component = ((Component)val3.attachedRigidbody).GetComponent(); if (!((Object)(object)component == (Object)null) && !component.IsDead() && WUTIL.ActorName(component).StartsWith(text2)) { float num3 = Vector3.Distance(((Component)component).transform.position, val); if (num3 < num2) { num2 = num3; val2 = component; } } } if ((Object)(object)val2 == (Object)null) { WDBUG.Log("No suitable " + text2 + " for " + text + " found at village", WDBUG.Level.Loki); } else { AnointPrince(val2, anoint: true, 7, useClass: true, Vector3.Distance(transform.position, ((Component)val2).transform.position) < 15f); } } private static void UpdateLocalPrinces() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(((Component)Player.m_localPlayer).transform.position, 50f, WUTIL.c_characterRayMask); foreach (Collider val in array) { if (!((Object)(object)val.attachedRigidbody != (Object)null)) { continue; } Character component = ((Component)val.attachedRigidbody).GetComponent(); if (!((Object)(object)component == (Object)null) && !component.IsDead() && ((Object)((Component)component).gameObject).name.StartsWith("Goblin")) { int customedTag = GetCustomedTag(component); if (customedTag > 0 && !m_goblinPrincesActive.ContainsValue(component)) { WDBUG.Log("Re-anointing marked " + WUTIL.ActorName(component), WDBUG.Level.Loki); AnointPrince(component, anoint: true, customedTag); } } } } private static void UpdateBurning() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) if (m_burningPositions.Count == 0 || WUTIL.Timer("treeburningtick") > 0f) { return; } WUTIL.TimerReset("treeburningtick", 1f); bool flag = !EnvMan.IsWet(); HitData val = new HitData(); Dictionary dictionary = new Dictionary(); foreach (Vector3 key in m_burningPositions.Keys) { TreeBurn treeBurn = m_burningPositions[key]; if (treeBurn == null || --treeBurn.m_burnTicks <= 0) { continue; } val.m_damage.m_chop = WUTIL.RandomSpin(treeBurn.m_minDPS, treeBurn.m_maxDPS, 0.1f); int burnTicks = treeBurn.m_burnTicks; bool flag2 = burnTicks % 2 == 0; GameObject go = treeBurn.m_go; bool flag3 = (Object)(object)go != (Object)null && (flag || WUTIL.RandomSpin() > 0.8f); bool flag4 = false; Vector3 val2 = Vector3.up; if (flag3) { flag4 = (Object)(object)go.GetComponent() != (Object)null; if (flag4) { TreeBase component = go.GetComponent(); flag3 = component.m_health - val.m_damage.m_chop > 0f; component.m_health -= val.m_damage.m_chop; val2 = component.m_trunk.transform.rotation * val2; } else if ((Object)(object)go.GetComponent() != (Object)null) { TreeLog component2 = go.GetComponent(); flag3 = component2.m_health - val.m_damage.m_chop > 0f; component2.Damage(val); } else if ((Object)(object)go.GetComponent() != (Object)null) { WearNTear component3 = go.GetComponent(); flag3 = component3.m_health - val.m_damage.m_chop > 0f; component3.Damage(val); } else if ((Object)(object)go.GetComponent() != (Object)null) { Destructible component4 = go.GetComponent(); flag3 = component4.m_health - val.m_damage.m_chop > 0f; component4.Damage(val); } else { WDBUG.Log("Removing unexpected burn target " + ((Object)go).name); flag3 = false; } } else { WDBUG.Log("Removed null (destroyed) target from burning list", WDBUG.Level.Sparx); } if (!flag3) { continue; } Vector3 val3 = key; if (flag2) { if (flag4 && WUTIL.RandomSpin() < 0.5f) { val3 += val2 * WUTIL.RandomSpin(0.3f, 0.7f); if (WUTIL.RandomSpin() < 0.5f) { treeBurn.m_maxDPS = 4f; } } WUTIL.PlaceObject("burning_fx", val3); WDBUG.Log($"Re-started fire for maxDPS {treeBurn.m_maxDPS} for {treeBurn.m_burnTicks}s", WDBUG.Level.Sparx); } else { treeBurn.m_maxDPS *= 0.8f; } dictionary.Add(val3, treeBurn); } m_burningPositions = dictionary; } private static void UpdateThorscorn() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) float num = WUTIL.Timer("thorscorn_fly"); if (num == 0f || (Object)(object)m_thorscornOwner == (Object)null) { return; } if (WUTIL.TimeIsAlmost(num, 0.5f)) { WDBUG.Log("Thorscorn implosion start", WDBUG.Level.Thorscorn); Transform transform = ((Component)((Component)m_thorscornOwner).gameObject.GetComponent().m_rightHand).transform; m_implosion = WUTIL.Spawn("thorscorn_implosion_vfx", transform.position, transform.rotation); } else if (WUTIL.TimeIsAlmost(num)) { Character thorscornOwner = m_thorscornOwner; Humanoid val = (Humanoid)(object)((thorscornOwner is Humanoid) ? thorscornOwner : null); ItemData val2 = WUTIL.AddItemToInventory(val, "Thorscorn", equip: true); if (val2 != null) { if (((Character)val).IsPlayer()) { CustomizeThorscorn(val2); } else { val2.m_shared.m_aiAttackRange = 25f; } } m_implosion = null; m_thorscornOwner = null; WDBUG.Log("Thorscorn returned at TTL: " + num, WDBUG.Level.Thorscorn); } else if (num < 0.5f && (Object)(object)m_implosion != (Object)null) { Transform transform2 = ((Component)((Component)m_thorscornOwner).gameObject.GetComponent().m_rightHand).transform; m_implosion.transform.localPosition = ((Component)transform2).transform.position; m_implosion.transform.rotation = ((Component)transform2).transform.rotation; } } private static void ChimesHitEffect(Character source, Character target, float spiritDamage = 0f) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0054: 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_0071: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)target)) { return; } Alignment.ConfuseCharacter(target); bool flag = (int)target.m_damageModifiers.m_spirit == 3 && ((int)target.GetFaction() == 3 || (int)target.GetFaction() == 4); if (flag) { source.m_damageModifiers.m_spirit = (DamageModifier)0; } if (spiritDamage > 0f) { HitData val = new HitData(); val.m_damage.m_spirit = spiritDamage; val.m_dir = ((Component)target).transform.position - ((Component)source).transform.position; val.m_dir.y = 0f; ((Vector3)(ref val.m_dir)).Normalize(); val.SetAttacker(source); val.m_hitType = (HitType)1; target.Damage(val); if (flag) { source.m_damageModifiers.m_spirit = (DamageModifier)3; } } } } internal class Fairy { [HarmonyPatch(typeof(Character), "RaiseSkill")] public class PatchCharacterRaiseSkill { public static bool Prefix(Character __instance) { return WUTIL.ActorName(__instance) != "Ygnie"; } } [HarmonyPatch(typeof(InventoryGui), "Update")] public class PatchInventoryGuiUpdate { public static void Postfix() { if (ZInput.GetKeyDown((KeyCode)27, true)) { CloseStats(); } } } [HarmonyPatch(typeof(Player), "UpdateStats", new Type[] { typeof(float) })] public class PatchPlayerUpdateStats { public static void Postfix(Player __instance, ZSyncAnimation ___m_zanim, ref float ___m_stamina) { if (!((Character)__instance).IsEncumbered() && !((Character)__instance).IsCrouching() && !((Character)__instance).IsBlocking() && !((Character)__instance).IsRunning() && WUTIL.Timer("SE_DoxieDust") > 0f) { ___m_zanim.SetBool("encumbered", true); } if (float.IsNaN(___m_stamina)) { WDBUG.Log("Auto-repair Player stamina!"); ___m_stamina = 0f; } } } [HarmonyPatch(typeof(Player), "OnDeath")] public class PatchPlayerOnDeath { public static bool Prefix(Player __instance, List ___m_foods, SEMan ___m_seman, ref float ___m_timeSinceDeath) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { WDBUG.Log("Detected Death for non-local Player!"); return true; } Riding.Dismount(); __instance.SetSkinColor(Wildling.m_originalSkinColor); Wildling.m_justDiedAsWildling = Wildling.IsWildling; if (Wildling.PlayState == 3) { WUTIL.Message("You Died!"); Game.instance.GetPlayerProfile().ClearCustomSpawnPoint(); Quest.EndAdventure(kill: false); return true; } bool flag = Wildling.PlayState == 4; if (flag) { WUTIL.Message("Farewell Wildling, Child of Light!"); } else if (WDBUG.AlwaysResurrect || WUTIL.HaveStatusEffect("SE_ResurrectionPotion", (Character)(object)__instance)) { WUTIL.Message("You Died!"); } else if (Quest.GetAchievement("MainTutorial") == 2) { if (!Raven.m_tutorialsEnabled) { WUTIL.Message("You Died! ... Please enable Raven Tutorials if you are new to the Wildling mod."); return true; } WUTIL.Message("You Died! ... maybe?"); Quest.ShowMainTutorial(32); Quest.ShowMainTutorial(2, 40f); World.UpdateSafePoint(reset: false, checkSafe: true, startTemple: true); } else { if (!YgnieActive()) { if (!Raven.m_tutorialsEnabled) { WUTIL.Message("You Died! ... Please enable Raven Tutorials if you are new to the Wildling mod.", center: true, null, blockNext: true); } return true; } WUTIL.Message("Fear not wildling, I have you!", center: true, MapMarker.GetCharacterIcon("Ygnie")); m_ygnieBanished = true; YgnieSummon(unsummon: true); } ___m_timeSinceDeath = 0f; ((Character)__instance).SetHealth(((Character)__instance).GetMaxHealth()); ((Humanoid)__instance).UnequipAllItems(); ___m_seman.RemoveAllStatusEffects(false); m_resurrecting = !flag; TeleportToSafety(__instance, m_resurrecting); return false; } } [HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[] { typeof(StatusEffect), typeof(bool), typeof(int), typeof(float) })] private class PatchSEManAddStatusEffect { public static bool Prefix(StatusEffect statusEffect, Character ___m_character) { if ((Object)(object)___m_character == (Object)(object)Player.m_localPlayer) { if (((Object)statusEffect).name == "Cold" && WUTIL.GetInventoryItemData("Match", mustBeEquipped: true) != null) { return false; } if (DedoxTonicActive()) { return SE_DoxieDust.AllowStatusEffect(((Object)statusEffect).name); } } return true; } } [HarmonyPatch(typeof(TextsDialog), "UpdateTextsList")] private class PatchTextsDialogUpdateTextsList { private static bool Prefix(List ___m_texts) { return (Object)(object)Player.m_localPlayer == (Object)null || !ReadBook(___m_texts); } } [HarmonyPatch(typeof(TextsDialog), "OnClose")] private class PatchTextsDialogOnClose { private static void Postfix() { CloseStats(); m_openBook = false; } } [HarmonyPatch(typeof(InventoryGui), "Show")] private class PatchInventoryGuiShow { private static void Prefix() { if ((Object)(object)Player.m_localPlayer != (Object)null) { ResetPlayerGui(); } } } [HarmonyPatch(typeof(RandomFlyingBird), "DangerNearby")] private class PatchRandomFlyingBirdDangerNearby { private static void Postfix(ref bool __result) { if (__result && Riding.IsRidingFairy()) { __result = false; } } } [HarmonyPatch(typeof(Character), "IsSwimming")] private class PatchCharacterIsSwimming { private static void Postfix(Character __instance, ref bool __result) { if (__result && SE_DoxieDust.IsActive && __instance.IsPlayer()) { __result = false; } } } [HarmonyPatch(typeof(SE_Puke), "UpdateStatusEffect")] private class PatchSE_PukeUpdateStatusEffect { private static string pukeThing = ""; private static float pukeThingTick = 0.25f; private static float pukeThingDelay = 0f; private static float pukeThingTime = 0f; private static void Prefix(SE_Puke __instance, float dt) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) if (m_pukeExtend > 0f) { pukeThing = m_pukeThing; ((StatusEffect)__instance).m_ttl = 2f * m_pukeExtend; ((SE_Stats)__instance).m_tickInterval = ((SE_Stats)__instance).m_tickInterval * 2.5f; __instance.m_removeInterval *= 2.5f; pukeThingDelay = 2f; pukeThingTick = ((m_pukeExtend == 2f) ? 0.25f : 0.4f); m_pukeExtend = 0f; m_pukeThing = ""; } if (!(pukeThing != "")) { return; } pukeThingTime += dt; if (pukeThingTime >= pukeThingTick && pukeThingTime > pukeThingDelay) { pukeThingTime = 0f; pukeThingDelay = 0f; Vector3 val = 0.5f * ((Component)Player.m_localPlayer).transform.forward; GameObject val2 = WUTIL.PlaceObject(pukeThing, val + ((Character)Player.m_localPlayer).GetHeadPoint(), val); Transform transform = val2.transform; transform.localScale /= (float)(20 + WUTIL.DieRoll(5)); val2.transform.position = WUTIL.OnCircle(val2.transform.position, WUTIL.RandomSpin(1f), 1, ground: false); float heightAboveSolid = Flight.GetHeightAboveSolid(val2.transform.position); if (heightAboveSolid < 0f) { Transform transform2 = val2.transform; transform2.position -= heightAboveSolid * Vector3.up; } m_pukedThings.Add(val2); } } } public class SE_PixieFlight : StatusEffect { public float m_normalFlightTime = 30f; public SE_PixieFlight() { ((Object)this).name = "SE_PixieFlight"; base.m_name = "Flying"; base.m_tooltip = "You can fly! Magic keeps you afloat but it takes willpower to move. Hold Jump to take off or ascend in the air, or Crouch to descend. Use regular movement controls to accelerate in the direction you are looking, and hold Block to slow down or brace against the wind. You stop flying when your feet rest on something solid. Sit to land quickly and safely. Bracing, ascending and flying fast will consume stamina."; GameObject prefab = WUTIL.GetPrefab("Feathers"); base.m_icon = prefab.GetComponent().m_itemData.GetIcon(); base.m_ttl = m_normalFlightTime; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); if (Wildling.m_restartStatusEffectTime > 0f) { m_normalFlightTime = Wildling.m_restartStatusEffectTime; Flight.SetFlightTime(m_normalFlightTime, triggerEffect: false); } else { WUTIL.Message("You suddenly feel like you can fly.", center: true, base.m_icon); } base.m_ttl = DilatedFlightTime(m_normalFlightTime); } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Stop() { ((StatusEffect)this).Stop(); WUTIL.TimerReset(((Object)this).name, base.m_ttl = 0f); Wildling.SetPlayerData(((Object)this).name, 0f); Flight.SetFlightTime(0f); } public override void UpdateStatusEffect(float dt) { if (Flight.m_continuousFlight) { base.m_time = 0.1f; return; } base.m_ttl = DilatedFlightTime(m_normalFlightTime); base.m_time += dt; Wildling.SetPlayerData(((Object)this).name, base.m_time); float value = base.m_ttl - base.m_time; if (WUTIL.TimeIsAlmost(value, 3f)) { WUTIL.Message("The effect of the pixie dust is wearing off.", center: true, base.m_icon); } else if (WUTIL.TimeIsAlmost(value)) { WUTIL.Message("You feel like yourself again - heavy.", center: true, base.m_icon); } } public override bool IsDone() { return !Flight.m_continuousFlight && (base.m_ttl <= 0f || base.m_time >= base.m_ttl); } public override string GetIconText() { return Flight.m_continuousFlight ? "" : ((StatusEffect)this).GetIconText(); } } public class SE_DoxieDust : StatusEffect { public static bool IsActive; public SE_DoxieDust() { //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) //IL_0079: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown ((Object)this).name = "SE_DoxieDust"; base.m_name = "Doxie dust"; base.m_tooltip = "Your form has assumed that of the undead and you are numbed to the living torments of pain, hunger and emotion. But otherwise your mind seems intact and, although movement is slowed, your health and stamina regenerate much quicker. The walking dead do not float and cannot swim."; base.m_icon = WUTIL.GetIcon("TrophySkeletonPoison"); base.m_ttl = 120f; base.m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1]; base.m_startEffects.m_effectPrefabs[0] = new EffectData { m_prefab = WUTIL.GetPrefab("undead_vfx"), m_attach = true, m_inheritParentRotation = true, m_childTransform = "Spine1" }; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).Setup(character); ((Player)((character is Player) ? character : null)).SetSkinColor(m_doxieDustSkinColor); base.m_time = Wildling.m_restartStatusEffectTime; RemoveStatusEffects(); } public override void UpdateStatusEffect(float dt) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, base.m_time); IsActive = true; if (!Riding.IsRiding() && World.SetUnderwaterView(((Component)Player.m_localPlayer).transform.position)) { Flight.DisableGroundHitDamage(); if (Flight.GetHeightAboveSolid(((Component)Player.m_localPlayer).transform.position) > 0.5f) { WUTIL.TimerReset("slowfall_underwater", 0.1f); } } } public override void Stop() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).Stop(); IsActive = false; Character character = base.m_character; ((Player)((character is Player) ? character : null)).SetSkinColor(Wildling.m_originalSkinColor); Wildling.SetPlayerData(((Object)this).name, 0f); } public override void ModifyDamageMods(ref DamageModifiers modifiers) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) modifiers.m_poison = (DamageModifier)3; modifiers.m_spirit = (DamageModifier)0; } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { if (!character.IsEncumbered() && !character.IsCrouching()) { speed *= 0.5f; } } public override void ModifySkillLevel(SkillType skill, ref float level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)skill == 100) { level = 0f; } } public override void ModifyMaxCarryWeight(float baseLimit, ref float limit) { limit = Math.Min(Math.Max(300f, limit * 2f), 900f); } public override void ModifyHealthRegen(ref float healthRegen) { healthRegen *= 3f; } public override void ModifyStaminaRegen(ref float staminaRegen) { if (!((Character)Player.m_localPlayer).IsEncumbered()) { staminaRegen *= 2f; } } public static bool AllowStatusEffect(string name) { switch (name) { case "Shelter": case "CampFire": case "Resting": case "Cold": case "Freezing": case "Smoked": case "Poison": return false; default: return true; } } public static void RemoveStatusEffects() { List list = new List(); foreach (StatusEffect statusEffect in ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffects()) { if (statusEffect.m_cooldown <= 0f && !AllowStatusEffect(((Object)statusEffect).name)) { list.Add(((Object)statusEffect).name); } } foreach (string item in list) { WDBUG.Log("Stopping status effect " + item, WDBUG.Level.effects); ((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(item), true); } } } public class SE_DobbieJuice : StatusEffect { public float m_rampRate = 20f; public float m_decayRate = 5f; private int m_originalShade = 0; private int m_lastShade = 0; private float m_currentShade = 0f; private float m_decayTime = 0f; public SE_DobbieJuice() { ((Object)this).name = "SE_DobbieJuice"; base.m_name = "Dobbie Juice"; base.m_tooltip = "Your temporary skin color and smell make you resemble a Fulrin."; base.m_icon = WUTIL.GetIcon("Piece_CoffinGlass"); base.m_ttl = 150f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); m_rampRate = Mathf.Max(m_rampRate, 1f); m_decayRate = Mathf.Max(m_decayRate, 1f); m_originalShade = Mathf.Max(Quest.GetAchievement("DarklingShade"), Quest.GetAchievement("DarklingLevel")); m_decayTime = base.m_ttl - (float)(100 - m_originalShade) / m_decayRate; m_lastShade = m_originalShade; m_currentShade = m_originalShade; base.m_time = Wildling.m_restartStatusEffectTime; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (base.m_time >= m_decayTime) { if (m_lastShade > m_originalShade) { m_currentShade -= dt * m_decayRate; } } else if (m_lastShade < 100) { m_currentShade += dt * m_rampRate; } int num = (int)m_currentShade; if (num != m_lastShade) { Wildling.SetDarklingShade(num); m_lastShade = num; } Wildling.SetPlayerData(((Object)this).name, base.m_time); } public override void Stop() { ((StatusEffect)this).Stop(); Wildling.SetDarklingShade(Quest.GetAchievement("DarklingLevel")); Wildling.SetPlayerData(((Object)this).name, 0f); } } public class SE_SwiftPotion : StatusEffect { public SE_SwiftPotion() { ((Object)this).name = "SE_SwiftPotion"; base.m_name = "Swift"; base.m_tooltip = "You are enfused with Pixie swiftness. For a while you will run and swim at double speed, and also jump higher and land better. All actions will take only half of the usual stamina drain, but your stamina and health will recover at only half of their usual rates."; base.m_icon = WUTIL.GetIcon("BubbleShield"); base.m_ttl = 30f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).Setup(character); ((Player)((character is Player) ? character : null)).SetSkinColor(m_swiftPotionSkinColor); base.m_time = Wildling.m_restartStatusEffectTime; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, base.m_time); } public override void Stop() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) ((StatusEffect)this).Stop(); Character character = base.m_character; ((Player)((character is Player) ? character : null)).SetSkinColor(Wildling.m_originalSkinColor); Wildling.SetPlayerData(((Object)this).name, 0f); } public override void ModifySpeed(float baseSpeed, ref float speed, Character character, Vector3 dir) { if (!character.IsEncumbered()) { speed *= 2f; } } public override void ModifyRunStaminaDrain(float baseDrain, ref float drain, Vector3 dir) { drain *= 0.5f; } public override void ModifyJumpStaminaUsage(float baseStaminaUse, ref float staminaUse) { staminaUse *= 0.5f; } public override void ModifySkillLevel(SkillType skill, ref float level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)skill == 100) { level = Math.Min(150f, 100f + level); } } public override void ModifyHealthRegen(ref float healthRegen) { healthRegen *= 0.5f; } public override void ModifyStaminaRegen(ref float staminaRegen) { if (!((Character)Player.m_localPlayer).IsEncumbered()) { staminaRegen *= 0.5f; } } } public class SE_DedoxTonic : StatusEffect { public float m_statusClearRepeat = 0.2f; private float m_tickTime; public SE_DedoxTonic() { ((Object)this).name = "SE_DedoxTonic"; base.m_name = "Dedox Tonic"; base.m_tooltip = "This magical tonic makes you feel warm from the inside and protects you from many effects, both beneficial and harmful, including poison, disease, burning and cold."; base.m_icon = WUTIL.GetIcon("DedoxTonic"); base.m_ttl = 120f; m_tickTime = 0f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); base.m_time = Wildling.m_restartStatusEffectTime; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (m_tickTime <= 0f) { m_tickTime = m_statusClearRepeat; m_removeEffects = true; } else { m_tickTime -= dt; } Wildling.SetPlayerData(((Object)this).name, base.m_time); } public override void Stop() { ((StatusEffect)this).Stop(); Wildling.SetPlayerData(((Object)this).name, 0f); WUTIL.TimerReset("BiomeCheck"); } public override void ModifyDamageMods(ref DamageModifiers modifiers) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) modifiers.m_fire = (DamageModifier)3; modifiers.m_frost = (DamageModifier)3; modifiers.m_lightning = (DamageModifier)3; modifiers.m_poison = (DamageModifier)3; modifiers.m_spirit = (DamageModifier)3; } public static bool AllowStatusEffect(string name) { switch (name) { case "SE_Hidden": case "SE_DedoxTonic": case "SE_FurShoes": case "SE_FurWarmth": case "SE_WildlingBonus": case "Feral instinct": case "SE_RagsJump": case "SE_RagsAttack": case "SE_RagsSwim": case "SE_RagsSwimSkill": case "Deer Legs": case "Goat Legs": case "Recovery": case "Fur suit": case "Shadow suit": case "Snow suit": case "SoftDeath": case "Wishbone": case "Encumbered": case "Wet": case "Shelter": case "CampFire": case "Resting": return true; default: return false; } } public static void RemoveStatusEffects() { List list = new List(); foreach (StatusEffect statusEffect in ((Character)Player.m_localPlayer).GetSEMan().GetStatusEffects()) { if (statusEffect.m_cooldown <= 0f && !AllowStatusEffect(((Object)statusEffect).name)) { list.Add(((Object)statusEffect).name); } } foreach (string item in list) { WDBUG.Log("Stopping status effect " + item, WDBUG.Level.effects); ((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode(item), true); } } } public class SE_ResurrectionPotion : StatusEffect { public SE_ResurrectionPotion() { ((Object)this).name = "SE_ResurrectionPotion"; base.m_name = "Resurrection"; base.m_tooltip = "You are protected from death by the effect of the pixie potion. For a while you will return from near death to the last place you felt somewhat safe. With all your equipment and no skill loss. But all current effects will be lost, including Resurrection and whatever food you were digesting."; base.m_icon = WUTIL.GetIcon("MagicShield"); base.m_ttl = 300f; } public override void Setup(Character character) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) ((StatusEffect)this).Setup(character); World.m_prevSafePosition = World.m_lastSafePosition; World.m_lastSafePosition = ((Component)character).transform.position; base.m_time = Wildling.m_restartStatusEffectTime; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, base.m_time); } public override void Stop() { ((StatusEffect)this).Stop(); Wildling.SetPlayerData(((Object)this).name, 0f); } } public class GP_EikthyrBinding : StatusEffect { public static bool m_shortText = true; public GP_EikthyrBinding() { //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_0085: Expected O, but got Unknown ((Object)this).name = "GP_EikthyrBinding"; base.m_name = "Eikthyr's Binding"; base.m_tooltip = "You have been granted the ability to summon a pixie companion."; base.m_icon = WUTIL.GetIcon("TrophyEikthyr"); base.m_cooldown = 1200f; base.m_ttl = 900f; base.m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1]; base.m_startEffects.m_effectPrefabs[0] = new EffectData { m_prefab = WUTIL.GetPrefab("fx_GP_Player") }; } public override void Setup(Character character) { if (Wildling.m_restartStatusEffectTime > 0f) { base.m_character = character; base.m_time = Wildling.m_restartStatusEffectTime; float remaningTime = ((StatusEffect)this).GetRemaningTime(); WUTIL.TimerReset("Eikthyr_power", remaningTime); WDBUG.Log($"GP_EikthyrBinding restarted for time: {remaningTime} ({base.m_time} used)", WDBUG.Level.Ygnie); } else { ((StatusEffect)this).Setup(character); WUTIL.TimerReset("Eikthyr_power", base.m_ttl); WDBUG.Log($"GP_EikthyrBinding started for time: {base.m_ttl} ({base.m_time} used)", WDBUG.Level.Ygnie); m_ygnieBanished = false; WUTIL.TimerReset("ygnie_summon_delay", 2f); } m_shortText = false; m_ygnieBanished = false; } public override bool CanAdd(Character character) { return character.IsPlayer() && (Wildling.m_restartStatusEffectTime > 0f || Wildling.IsWildling); } public override string GetTooltipString() { return m_shortText ? base.m_tooltip : "You have summoned a pixie companion and guardian. While summoned, you will share stamina and your maximum will be greater. The pixie will automatically regenerate health for itself and then you whenever you are rested. The bound pixie can also help you in many defensive ways and will do so automatically provided you have enough shared stamina, which the pixie consumes to make its magic. The bond will also greatly enhance your flying ability should you consume Pixie Dust. Most creatures will not notice your pixie companion but it can be easily hurt by collateral damage and must return to The Never if badly hurt."; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, base.m_time); } public override bool IsDone() { if (((StatusEffect)this).IsDone()) { WUTIL.TimerReset("Eikthyr_power"); m_shortText = true; return true; } return false; } public override void Stop() { ((StatusEffect)this).Stop(); Wildling.SetPlayerData(((Object)this).name, 0f); } } public class SE_PinePaste : SE_Stats { public SE_PinePaste() { ((Object)this).name = "SE_PinePaste"; ((StatusEffect)this).m_name = "Pine Paste"; ((StatusEffect)this).m_tooltip = "You are giving off a strong odor of Pine tree"; ((StatusEffect)this).m_icon = WUTIL.GetIcon("PinePaste"); ((StatusEffect)this).m_ttl = 180f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); ((StatusEffect)this).m_time = Wildling.m_restartStatusEffectTime; base.m_staminaRegenMultiplier = 2f; } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, ((StatusEffect)this).m_time); } public override void Stop() { ((StatusEffect)this).Stop(); Wildling.SetDarklingShade(Quest.GetAchievement("DarklingLevel")); Wildling.SetPlayerData(((Object)this).name, 0f); } } public class SE_ElderSight : SE_Stats { private static float m_jitterDist = 0f; private static float m_jitterTime = 0f; private static Vector3 m_lastPosition = Vector3.zero; private static Quaternion m_lastRotation = Quaternion.identity; public SE_ElderSight() { ((Object)this).name = "SE_ElderSight"; ((StatusEffect)this).m_name = "Elder Sight"; ((StatusEffect)this).m_tooltip = "You have a strange sense of knowing what is ahead of you."; ((StatusEffect)this).m_icon = WUTIL.GetIcon("StoneTile"); ((StatusEffect)this).m_ttl = 150f; } public override bool CanAdd(Character character) { return character.IsPlayer(); } public override void Setup(Character character) { ((SE_Stats)this).Setup(character); ((StatusEffect)this).m_time = Wildling.m_restartStatusEffectTime; World.SetElderSightActive(set: true); } public override void UpdateStatusEffect(float dt) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) ((SE_Stats)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, ((StatusEffect)this).m_time); if (!Wildling.HasEaten("Elderberries")) { if (((StatusEffect)this).m_character.IsAttached() || ((StatusEffect)this).m_character.IsTeleporting() || ((StatusEffect)this).m_character.IsDead()) { m_jitterDist = 0f; m_jitterTime = 10f; } else if (m_jitterTime > 0f) { m_jitterTime -= dt; } else if (m_jitterDist == 0f || WUTIL.TestLuck(0.6f)) { m_lastPosition = ((Component)((StatusEffect)this).m_character).transform.position; m_lastRotation = ((Component)((StatusEffect)this).m_character).transform.rotation; m_jitterTime = WUTIL.RandomSpin(0.5f, 3f, 0.5f); m_jitterDist = WUTIL.RandomSpin(1f, 3f, 0.5f); } else if (Vector3.Distance(((Component)((StatusEffect)this).m_character).transform.position, m_lastPosition) >= m_jitterDist) { ((Component)((StatusEffect)this).m_character).transform.position = m_lastPosition; ((Component)((StatusEffect)this).m_character).transform.rotation = m_lastRotation; m_jitterDist = 0f; } } } public override void Stop() { ((StatusEffect)this).Stop(); World.SetElderSightActive(set: false); Wildling.SetPlayerData(((Object)this).name, 0f); } } public const float c_ygnieStaminaBuff = 20f; public const float c_ygnieFlyFastSpeedBuff = 2f; public const float c_ygnieFlyTimeDilation = 5f; public const float c_ygnieFlyStaminaUseDilation = 0.2f; private const bool c_bookHidesInventory = true; private const float c_ygnieBlindCost = 10f; private const float c_ygnieArrowShieldCost = 10f; private const float c_ygnieMagicShieldCost = 20f; private const float c_ygnieFreeHealthFrac = 0.5f; private const float c_ygnieHealthRegenRate = 1f; private const float c_ygnieWildlingHealthRegenRate = 1.5f; private const float c_ygnieJitterTime = 3f; private const float c_ygnieReturnDistance = 18f; private const float c_ygnieAlertDistraction = 0.5f; private const float c_ygnieProtectionDistance = 15f; private const float c_ygnieAlertDistance = 8f; private const float c_ygnieMinHoverDistance = 0.1f; private const float c_ygnieMaxHoverDistance = 3f; private const float c_ygnieBlindDistance = 2f; private const float c_shieldActivationDistance = 4f; private const float c_shieldActivationArrowDistance = 2.5f; private const float c_ignieBlindChance = 0.99f; private const float c_dustAnimationDelay = 1.4f; private const float c_pixieDustDuration = 30f; private const float c_swiftPotionDuration = 30f; private const float c_detoxTonicaDuration = 120f; private const float c_doxieDustDuration = 120f; private const float c_dobbieJuiceDuration = 150f; private const float c_pinePasteDuration = 180f; private const float c_pixieColaDuration = 300f; private static Vector3 m_swiftPotionSkinColor = new Vector3(1f, 0.8f, 0.6f); private static Vector3 m_doxieDustSkinColor = new Vector3(0.8f, 1f, 0.8f); private static int m_ygnieCommentFlag = 0; private static bool m_teleportToPlayer = false; private static bool m_ygnieBanished = false; private static bool m_shieldActive = false; private static bool m_ygnieSeesThreat = false; private static bool m_ygnieAppearFromAbove = true; private static bool m_resurrecting = false; private static bool m_removeEffects = false; private static float m_pukeExtend = 0f; private static float m_ygnieHelloDist = 0f; private static float m_ygnieHuntTime = 20f; private static string m_ygnieThought = ""; private static string m_pukeThing = ""; private static Character Ygnie = null; private static bool m_openBook = false; private static bool m_hidePlayerGui = false; private static string m_pageText = ""; private static string m_pageTitle = ""; private static string m_pageDlgTitle = ""; private static string m_originalTextsDialogText = ""; private static Transform m_textDialogRoot = null; private static Transform m_infoDialogRoot = null; private static Transform m_craftDialogRoot = null; private const int c_ygniePageIdx = 10; private const string c_pageMissing = "-missing-"; private const string c_noteSrt = ""; private const string c_noteEnd = ""; private const string c_pageSignedBoy = "\n\n- Kono"; private const string c_pageSignedGirl = "\n\n- Katen"; private static List c_bookPages = new List { "When I was about 5 years old I met a fairy. But no one ever believed me and soon I had to stop talking about it.\r\nI had been playing with friends just inside the forest near our village when I accidentally slipped and tumbled down\r\na steep slope. Someway down I must have hit my head as I woke up at near dark with a twisted ankle. Cold, alone and\r\nterrified. Eventually I realized no one would hear my sobs and screams, and so began stumbling in a direction that I\r\nhoped would lead me home. I barely made it through that night. Late the next afternoon I noticed a twinkling light\r\noff far in the distance. My hopes of rescue soared so I limped as fast I could in that direction, shouting for help.\r\nBut the light was much closer than I thought and suddenly came rushing towards me. Within a sharp breath it had\r\nstopped just infront of my face. Once my heart stopped pounding I noticed tinkling sounds that slowly became a strange\r\nvoice in my head. I recall conversing like this for what seemed like at least an hour before I heard someone shouting,\r\nand not far away. The magical being vanished before my eyes, like a candle put out, and soon after I was discovered by\r\nmy parents and several others from my village, who had obviously been searching for me the whole time. My recollection\r\nof the events over the next months became ever more dream-like but much later, a few years shy of manhood, I started\r\nto remember fragments of my conversation with 'the fairy', as others sarcastically referred to my imaginary companion.\r\nI began to take long and longer trips to the forest and other villages. Unfortunately I found out very little and most\r\nof what I'm about recount is based on what I've put together from my own memories, if not even more doubtful sources.", "The first thing I recall is that the creature called itself a Pixie. It is still difficult to describe what the Pixie\r\nlooked like as it glowed with a bright light. The best I would say is a cross between a tiny child and a butterfly.\r\nThey are obviously magical but not immortal and actually quite weak to physical damage. Apparently, humans cannot\r\ntypically see or hear Pixies except for some younger children. Because of this they are compelled to 'neutralize'\r\nsuch children to protect the secret of their existence. I had the distinct impression that 'neutralize' meant kill\r\nbut did not consider then that might apply to me. Perhaps the Pixie knew no one would believe me, or maybe I was\r\nsupposed to forget the encounter, like a dream only remembered because something woke you up.\r\nBut the pixie was not at all threatening and said they consider themselves as peaceful guardians of the forest.\r\nAnd in comparison, the Pixie also mentioned Doxies, their dangerous cousins,\r\nwhich inhabit dark places and exist only to do harm. At first when I asked for more details the Pixie said they\r\nwill not speak of Doxies. But after more prompting it eventually revealed that Pixies have the power to heal and bring\r\nany mortal creature back to life within a few moments after death. They can even save themselves at the instant of\r\ntheir own death but only by turning into a Doxie, an undead version of themselves. All Pixies grow up knowing\r\nthat one day they will have to decide if they will truly die or return as undead and, like humans, they have no\r\ncertainty of what either means to the individual.", "The more we talked the more I felt at ease, if not protected, in the Pixie's strange company, whom I\r\npresumed to be female. But I noticed she would only tell me something after I told her something.\r\nShe was very interested in me, and my family, and our village life. But appeared to particularly like stories.\r\n\"Tell me, do any of your folk tell tales of fairies?\" she asked. So I tried to recall one grandma told me. The only\r\none I could was about leaving sick babies in the forest for fairies to either heal or steal. Luckily, that made her laugh.\r\n\"Those that abandon their children are desperate fools and we would not help nor harm them. But how about the story\r\nof planting acorns for good luck?\", she said, \"That one is actually closer to the truth of it. Pixies do occasionally\r\nbless saplings they find deep in the forest, but never at the same place twice.\" I then told another tale or two myself\r\nbut do not remember which, nor most of the friendly banter that followed. At some point she asked me if I'd ever heard\r\nthe legend of 'The Three Goblin Princes'? and then went on to \"remind me\" of it in case I'd forgotten. I remember this\r\nnow as it seemed somehow important, as if she had been leading the conversation here all along.", "\"It is an old story told by goblins to their spawn.\" the pixie began with a brief note of animosity, \"It has many\r\nversions, including a few human adaptations. Some involve supposedly real princes to a goblin king that ruled the world\r\nmany lifetimes ago. He had to choose an heir and so sent them away promising the kingdom to most rich or triumphant\r\nto return in exactly one year. To each he gives an unusual weapon that he deemed best suited their individual strengths.\r\nAnd although the king only asks them to impress him in some way, he expects them to eventually fight amongst themselves,\r\nand hopefully with huge armies they have raised to their claim. In other versions the goblins are commoners that\r\nbecome 'princes' through their adventures. These versions always begin by each goblin using their particular talents\r\nto acquire a magical artifact. My favorite version is about a farmer, a tinker and a monger...\" I was completely\r\nenraptured by the tale but she paused, perhaps seeing there was no recollection of anything she said in my eyes.\r\n\"Well, there's lots of accounts that usually end with a big glorious battle, or one prince that cleverly defeats the\r\nother two using his cunning.\" She concluded the tale seemly hastily, very much to my disappointment. \"So none of this\r\nsounds familiar to you? Ah well, no matter.\" She paused again but went on. \"So I guess you also never heard the tale\r\nof 'The Fourth Prince', or 'The Dark Prince'...? No, of course not, it is rarely heard even amongst the Fulring.", "Accursed fairies! I now know of their secrets, and their deceit. But I must first tell more of my own\r\nstory. At ten years old I was a little scrawny, and often the teeners would bully me or call me 'fairy-babe'. But many\r\nwanted to hear my stories, and sometimes even adults would linger near by to listen in. As was the case on this\r\nfine midsummer afternoon. Just I as finished off re-inventing my third story, a stranger clapped out loud, with a big\r\n\"Barvo!\". He was, by all accounts, a travelling tinker and a popular tell-tale himself. Later that evening he showed\r\nup uninvited at my home, but immediately handed over a copper coin and more praise for my story telling.\r\nI was completely abashed and could barely thank him. He seemed especially interested in how I had come to\r\nhear of the fable of the fairies and the acorns. I said I made it up, but he seemed doubtful. He said he had heard a\r\nsimilar story in a town he passed through several weeks past. Local legend even claimed the town was built\r\naround such a tree. He stayed for a while to entertain us with some conjuring tricks. (Not real magic of course.)\r\nNext morning he had moved on, and I never saw him again, but his few words changed my life. \r\nFrom then on I took every opportunity to travel with my father, usually for supplies\r\nand special materials for his own trade, that being a Bowyer, a crafter of very fine long bows and arrows.\r\nI would question him about his adventures and ask when I might have some of my own. As usual his answers were\r\nbrief and hinted at more than they told. Then one day he announched to the family that we were all to\r\ngo on a long trip, and taking everything but the house itself, which was to be used by a recently married\r\ncousin until we returned. He then explained how he had long been thinking of visiting a life-long\r\nfriend, who lived with his family on a sizable farmsteam... not far from a small town named \"Blessed Oak\"!", "It was late spring, a year after I met Faynson the Tinker, that we finally set off on our adventure.\r\nLots of long goodbyes and final arrangements, but surprisingly little talk of the obvious perils of travel.\r\nMy father and brother were both decent fighers, and very good with bows, if not axes. And, like many of our women,\r\nmother was also well trained for battle. So the only real concerns were for me and my two younger\r\nsisters. Thinking back, it must still have been a huge risk, if only because we must have exhausted the family coin.\r\nWe travelled in a large closed wagon that father had rented, and which later cost us as much in repairs.\r\nThe journey to Journ's homestead took a full moon cycle. For me it was mostly plesant but boring. We did encounter\r\nsome foul weather, bad luck and unwelcome company, but not too much. We were expected, and on arrival were welcomed\r\nwarmly with a great family feast, far better than my cousins wedding. And it was a big family, with many friends\r\nthat helped out on the farm, or the mill or smithy. Days later, when we were alone, I asked Journ when we could\r\nvisit the town. \"Is there a story to how Blessed Oak got it's name?\", I asked him, casually.\r\n\"Indeed there is,\" he replied, and went on to tell how druids had first founded a site near a large Oak tree.\r\nI remember feeling disapointed and thinking again how foolish it was to expect more. Happy weeks passed by\r\nbefore the first morning frosts appeared. In that time we helped father to completely rebuild one of the sheds\r\nto make a workshop, and then added a bedroom. Father also sold some bows in town and crafted new ones. He went\r\nwith Journ alone, saying I was to stay at home, at least for the time being. I suppose he assumed I couldn't get\r\nin to any misadventure that way.", "I was up early walking in the woods, along the dirt road we arrived on. Day dreaming of adventures, and avoiding\r\nchores. Up ahead I saw an old woman hobbling towards me. As she came closer I realized she wasn't that old but was\r\nbent over and half-dragging a large bundle of sticks. She stopped short of me, apparently ready to take a rest,\r\nand I saw she was quite fair-faced. I blushed. \"Have we met before young drengr?\" she asked with a big smile.\r\nWe got talking and soon enough I got to the question I had put to Journ.\r\n\"Yes, I've heard that story. But its not true. A hundred years ago the original town site\r\nwas burnt to the ground during a raid. Nothing survived except the mighty oak that grew in the center. So, if the tree\r\nwas blessed, it certainly didn't help the villagers. Ha! Instead they were all buried there, and then years later a\r\nnew village grew up nearby that coined the name.\" She chuckled and started back on her way. Then added on passing,\r\n\"If I remember true, the old gravesite is not far from here. One of the paths off this road, if it's still there.\"\r\nOf course, I spent the rest of the afternoon exploring the trails. Running back when they petered out or when I felt I'd\r\nstrayed too far. The place I eventually found was behind what could have been an old gateway. The space had fewer and smaller\r\ntrees, and the ground was dark mud with patches of brambles. And there, in the middle, was a large oak tree. Most of the\r\ntrunk was rotted and hollow, but a part still held strong with healthy branches and leaves. I passed by a kern and other\r\nlikely grave markers, but I did not linger, feeling a little uneased. The ancient oak was whimsically magical, but not\r\nextraordinary. I easily passed though a gap into the hollow, where I nervously shoulted out, \"Where are you pixie?\".\r\nJust in mockary of myself, for courage, but a familiar tinkle in my head immediately responded.\r\n\"I'm behind you, silly! And you are right on time!\" I spun around, with a huge grin, about to say something\r\nsacastic, but it wasn't the fairy I was expecting. It had similar dimensions, but its glow was green and its form appalling.\r\nAnd then, ... I died!", "Or so I thought. I awoke in a different place. Or perhaps the same place but different. I was flithy and almost naked\r\nbut for the tattered remnants of my pants. My skin was covered in small cuts and bruises. My head hurt and for a while I\r\nstumbled around confused. Yet somehow I circled out back to the pathroad and was back at the homestead well before sunset.\r\nBy then I had a credible story and did not expect to be in too much trouble. Only it could not have been much worse!\r\nAs I approached the center of the farmstead, those who saw me dropped what they were doing and stared. Some\r\neven looked horrified and backed away. Mother didn't seem to recognize me at first and then broke down with tears\r\nand ran to me. To them I had been lost, presumed dead, for two years! Everyone wanted to know what had happened, but when\r\nI tried to speak I discovered I could not. Only hours later did my speech start\r\nto return, enough to say I had been attacked and that was all I could remember. A few days later I was feeling almost\r\nmyself again, except I still could not recall anything after the oak tree. This perhaps made some people silently resentful,\r\nhaving spent weeks helping to look for me, and paying their respects to my parents, even as they would not accept I was gone.\r\nEventually people stopped talking about me, and my parents only cared that I was 'given' back. Leaving me the only one who cared\r\nabout what really happened. And I was changed in other ways. Even with children pleading, and goading from my brother, I could\r\nnot bring myself to tell stories as I used to. I was nervous, and easily startled, like a cat. At war play I was no less clumsy\r\nwith weapons but my new skittishness made me almost impossible to strike. Then one morning, an older boy from the mill and a\r\nfew others I had never seen before were mocking and poking me. Next thing I knew, all four were on the ground sobbing, bruished\r\nor bleeding. Apparently I became a whirlwind of kicks and 'claws', like a wild animal. That's where I got the nickname\r\n'Krazy Kono' and from then on most people avoided me.", "My family could hardly return to our old home with me missing. Father was now fully in business with Journ and over the\r\nnext year we established a store in Blessed Oak, where we all now worked on occassion. I had\r\nbecome good with runes and recorded all the transactions and sums for the business, while my brother was stuck with much of\r\nthe tedious fletching work. We all carted into town most days, while Mother and my sisters usually stayed at the farmstead.\r\nI was nearing manhood and quite content. My thoughts lingered more on becoming a trader or scholar than adventure. Then one\r\nafternoon, as I walked back to the store from market, I noticed a dishelvelled begger sitting at the cross street, supposedly\r\nblinded judging by the wrap around his eyes. Nothing unusual but as I passed by he said, \"Young man, please help me. I will\r\ntell your fortune for some of your bread.\" This startled me as I had just brought a loaf but had it well concealed from view.\r\n\"Sorry, I have no time for such foolishness,\" I began but waited for him to go on. \"I can tell you have seen beyond\r\nthis world. Yes! And you have a hole in your mind.\" I stood silent, then handed over the bread. \"Probably the Vanir - they\r\ndon't want us to know about them, you know.\" He continued in quieter tones, although anyone overhearing would have dismissed\r\nthe comment as lunacy. I was shaking, once again winded by the force of suppressed memories rushing back. \"In truth I cannot\r\nsee your fate but do see their mark upon you. Here, for your kindness take this. It supposedly contains a fairy concoction\r\nthat can save you from death. I have doubt but, either way, it is no use to me in my pitiful state.\" I took the small ampule\r\nof clear blue liquid, nodded my head in thanks, and walked away without further word. That evening I started\r\nto write down everything I could remember. And did so whenever I got chance over the next few weeks, until starting over\r\nin earnest with this current account. For no particular reason, I have become ever more suspicious of strangers and decided to\r\nencode this manuscript with a cypher.", "I'm writing this at my first respite in days. In truth I am uncertain of the time passed since I woke up in this strange land.\r\nI have had little sleep, and was running or hiding from monsters the whole time before finding the meadows. Thankfully I still\r\nknow how to hunt and cook. In fact it all seems so familiar somehow. Or perhaps this truly is Valhalla? It was late afternoon\r\nand I was tending the store, re-reading my story. I knew there would be more but this was all I had, for now.\r\n\"What ya readin?\", she asked and I looked up. She was pretty and smilling, a lot, and I sort of boastfully replied\r\n\"Oh just a silly story I'm writing, it's not ready for telling, out loud, or anything.\" Stupid. That evening, in our own\r\nstables, I was set upon by two roughs, with knives. \"We hear you have a book! Someone we know said they would give a fat\r\npurse for it. Now 'and it over, or it's over for you, pimple! And your family, if we has to.\" So I took them to get my book from its\r\nhiding place, where I also noticed and considered the begger's ampule. I grabbed both and ran out and down the street, with the thugs\r\nin hot pursuit. But I didn't get far, for another was waiting outside. I spun around and used my last moments to open the ampule\r\nand gulp down its content. \"Ad to run dint ya!\" was the last thing I heard before pain in my gut and the final realization...\r\nAnd so I should be dead now, this time for sure, but I do not think so. Once again it seems I've been duped by Pixie kind. The potion\r\nbrought me back to life alright but in their world, not mine! And should I find pixies here, I will make them pay in kind for their\r\ncallousness. Until then I must find somewhere dry and safe to leave my manuscript behind. It is a wonder that I managed to keep\r\nit from damage this far.", "Dear Kono,\r\n\r\nIt was fun having all those adventures, the battles, the treasure,\r\nand everything. But sadly I cannot stay forever and you will soon be\r\ngrown up, so we must part ways.\r\n\r\nI hope you won't mind me writing on this, your last page.\r\nGuessed you might want this old pixie tale for your book.\r\n\r\nFarewell my friend and hero.\r\nSincerely, Ygnie.\r\n\r\n\r\nWelcome the Wildling, adopted prince of the forest.\r\nMore man than animal, more child than man, more fairy than child.\r\n\r\nAbide not the Darkling, annointed servant of chaos.\r\nMore beast than man, more ghoul than beast, more goblin than ghoul.", "Well this was a suprise. I did not know where this path would lead, which now seems set well before me.\r\nMy dreams are filled with nothing but images from my lost time here before, including I think this very place inside\r\nthis overgrown oak. But this scroll, it almost seems to be about me.\r\nThe fairies must know of this Greydwarf prophecy and fear what I might become! That's why they have hunted me, and\r\nperhaps dispatched me back to my own world. Certainly they would not expect me to return. But then why bring me here\r\nat all? Well, it is fitting. If I acquire such weapons, they will have brought forth their own demise. I shall also\r\nreturn mighty and take whatever treasure these monsterous giants are guarding.", "Well it seems like just another 'dead' end. Obviously this sorry sap didn't get any farther.\r\nHe must have found the key to the secret door, but likely had no means to scale the pit once outside. I didn't discover\r\nit myself until after wasting more of my Pixie Dust trying to fly back through the void. But luckily I have\r\na little left and now only hope I will survive the journey back down the mountain. The wall has stayed down for\r\na while now, so I figured I'd stash another part of my story and leave this note. That you somehow end up back here, with\r\nescape just out of reach, makes this whole place seem like one big cruel joke. Good luck finding your own way out.\r\nI believe I know part of the answer: A labyrinth is designed to distract one from finding the true path. So the\r\n'Ultimate Labyrinth' is therefore pure distraction. The answer must be something simple, and easily at hand.\r\nOr there simply is no answer. Maybe I should --- wall just started closing --- K", "I have searched this maze for several weeks now and have followed many clues and hidden paths. I have returned with\r\nten or more answers, some I thought well fit the riddle, but all to no avail. Although there could easily be\r\nmore secrets to find, I am certain the 'ultimate' clue lies at the deepest point, the tail of the Serpent. I know\r\nI must be close and will try the way one more time. But upon failing I shall return to the surface to leave the mountain.\r\nI fear I have chanced my luck far too much down here already. Some places, like this room, seem almost inaccessible\r\nto someone larger, so I have decided to stash more of my story here. Likely you thought these were my remains!", "With these pages you should have also found some of my Fairy Dust. If you are desperate, use it to fly to the top\r\nof the pit, but consider that may well be a waste of something priceless. Know that this is proof of the existance of fairies,\r\nwhich you may care to reveal in my stead. I am headed for the marvelous weapon described by the snake runes, and taking\r\nmost of the crystal that was covering them. May Odin speed your own escape.", "I now not only have proof that fairies exist, but have made myself their enemy. I'm sure something has been sent to\r\nhunt me and maybe leaving my story in the chest here, protected by the rat monster, will at least make for a distraction,\r\nif not amends. No one will know its not whole unless they get this far, and the other parts should be unreadable without\r\nthe cypher here on the back cover. If the gods want me to escape this nightmare then perhaps I am to return to vanquish\r\nthis foul creature. I will delve deeper into this dungeon for such a means. Odin protect me!" }; private static List c_conversation = new List { "I am obliged to accompany and protect you, while our Lord's binding has power to retain me.", "Know that while we are close together, I can draw on some of your stamina to cast spells.", "If we, meaning more typically you, have enough stamina, I can blind enemies for an instant to prevent them striking you.", "And whenever we are both sufficiently rested, I will use my magic to gently heal us both of physical damage.", "I can also shield you from in-coming missle attacks, but only while we are not completely exhausted.", "I will even prevent you hurting yourself from falling.", "You may have noticed my glow helps you see in dark places. But don't worry. Most other beings see me not.", "You can prompt me to scout for enemies. But know that I can only directly hurt evil spirits.", "I'm usually very attentive but if I am ever distracted by an enemy you can always prompt me to stay near by.", "If I cannot prevent you from being killed, I can resurrect you and teleport you to somewhere safe, hopefully.", "Should I be struck fatally or need save you, I must immediately return to my own realm.", "You should not come to rely on me, especially in a big brawl.", "Our link will greatly increase your ability to fly, but you will still need pixie dust.", "Well, hem, you likely already noticed that I sometimes leave behind fairy dust when I 'vanish'. Hopefully this will not sour our relationship.", "Do you know of wild glass smithing? It's fairly easy to make a nifty potion of swifness with pixie dust, some crypt'shrooms and honey.", "I likely should not let this be revealed, again. I heard that one can make a potion of pixie resurrection, at least for this realm. It also requires Blue mushrooms.", "Small as I seem, I do not like tight spaces, especially underground. It's hard sometimes to not bump in and out of things.", "Rats are the only natural creature I will attack, and then only because they might be spies for the enemy.", "Our spiritual enemy and fear is the Doxie. I would be happy should we hunt them together. But understand that we are compelled to annihilate one another, which might hamper my ability to protect you.", "Yes, that's me you hear sometimes making bird-like sounds. Avian is one of our most popular languages, although I'm often just singing to myself.", "Speaking human is quite hard for us, and requires our magic. For fairy kind, magic is both stamina and food.", "Did you know that our kind has an affinity for acorns? We even nurse some lucky sapplings.", "Nice day for adventuring. How about we go bother some monsters?", "I'm not really sure what else useful I have to say. Perhaps you can talk about yourself?", "We should be careful around the Fulring as they can see me, and will hurt me if they can.", "I think we make a pretty good team, all told.", "Did you know a simple trophy like rat tail and rabbit paw will also help to protect places when hung nearby?", "The Borat head is a formidable trophy. You will not likely have many things attack a camp with this displayed.", "Do you ever feel like you have said everything already?", "Did you know that Chimes was a fairy fabrication?" }; private static List m_pukedThings = new List(); public static void Update() { if (m_removeEffects) { m_removeEffects = false; SE_DedoxTonic.RemoveStatusEffects(); } if (WUTIL.TimerIsAlmost("playergui_reset_delay", 0f)) { ResetPlayerGui(); } UpdateYgnie(); UpdatePixieDustEffect(); UpdateDoxieDustEffect(); UpdateRessurection(); UpdateDoxsick(); } public static void TeleportToSafety(Player player, bool resurrectionEffect = false) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) Vector3 val = World.RecallSafePoint(); bool flag = !resurrectionEffect || Vector3.Distance(((Component)player).transform.position, val) > 200f; Flight.DisableGroundHitDamage(flag ? 3f : 0.5f); ((Character)player).TeleportTo(val, ((Component)player).transform.rotation, flag); } public static void OpenBook(ItemData item, bool equip) { if (equip && WUTIL.ItemName(item) == "FairyTale") { OpenStats(""); } } public static void OpenStats(string text, string title = "", string dialogTitle = "") { m_pageText = text; m_pageTitle = title; m_pageDlgTitle = dialogTitle; if (!InventoryGui.IsVisible()) { InventoryGui.instance.Show((Container)null, 1); } m_openBook = true; InventoryGui.instance.OnOpenTexts(); } public static void CloseStats() { if (m_hidePlayerGui) { m_hidePlayerGui = false; InventoryGui.instance.Hide(); WUTIL.TimerReset("playergui_reset_delay", 0.5f); } } public static bool ReadBook(List texts) { //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Expected O, but got Unknown ResetPlayerGui(); if (!m_openBook) { return false; } m_openBook = false; if ((Object)(object)m_textDialogRoot == (Object)null) { m_textDialogRoot = ((Component)InventoryGui.instance.m_player).transform.parent.Find("Texts/Texts_frame"); m_infoDialogRoot = ((Component)InventoryGui.instance.m_player).transform.parent.Find("Info"); m_craftDialogRoot = ((Component)InventoryGui.instance.m_player).transform.parent.Find("Crafting"); } Transform txtTran = m_textDialogRoot.Find("topic"); m_originalTextsDialogText = WUTIL.GetGUIText(txtTran); texts.Clear(); m_hidePlayerGui = m_pageText != "" || true; if (m_hidePlayerGui) { ((Component)((Component)InventoryGui.instance.m_player).transform).gameObject.SetActive(false); ((Component)m_infoDialogRoot).gameObject.SetActive(false); ((Component)m_craftDialogRoot).gameObject.SetActive(false); } if (m_pageText != "") { ((Component)m_textDialogRoot.Find("TextList")).gameObject.SetActive(false); ((Component)m_textDialogRoot.Find("bkg")).gameObject.SetActive(false); texts.Add(new TextInfo(m_pageTitle, m_pageText)); WUTIL.SetGUIText(txtTran, m_pageDlgTitle); m_pageText = ""; return true; } int num = Quest.GetAchievement("FairyTale"); bool flag = false; int num2 = 1; int num3 = 2; while (num2 <= 5) { if ((num & num3) <= 0) { ItemData inventoryItemData = WUTIL.GetInventoryItemData($"FairyTalePages{num2}"); if (inventoryItemData != null) { ((Humanoid)Player.m_localPlayer).GetInventory().RemoveItem(inventoryItemData); flag = true; num |= num3; } } num2++; num3 <<= 1; } if (flag) { WUTIL.Message("Pages restored to A Tale of Fairies.", center: true, null, blockNext: false, logOpt: true); Quest.SetAchievement("FairyTale", num); } int num4 = 0; if ((num & 1) > 0) { num4 |= 0x8003; } if ((num & 2) > 0) { num4 |= 0x400C; } if ((num & 4) > 0) { num4 |= 0x2030; } if ((num & 8) > 0) { num4 |= 0x10C0; } if ((num & 0x10) > 0) { num4 |= 0xB00; } if ((num & 0x20) > 0) { num4 |= 0x400; } WUTIL.SetGUIText(txtTran, m_pageDlgTitle); string text = (Wildling.IsFemaleModel ? "\n\n- Katen" : "\n\n- Kono"); int num5 = 0; int num6 = 1; while (num5 < c_bookPages.Count) { if ((num4 & num6) == 0) { string text2 = "-missing-"; texts.Add(new TextInfo($"Page {num5 + 1}", text2)); } else if (num5 == 10) { string text2 = c_bookPages[num5]; texts.Add(new TextInfo($"Page {num5 + 1}", text2)); } else { string text2 = c_bookPages[num5].Replace('\n', ' ').Replace("\r", ""); if (num5 > 10) { text2 = "" + text2 + (((num5 & 1) > 0) ? text : ""); } texts.Add(new TextInfo($"Page {num5 + 1}", GenderizeText(text2))); } num5++; num6 <<= 1; } return true; } public static void ReadPage(ItemData item, bool equiping) { string text = WUTIL.ItemName(item); if (equiping && text.StartsWith("FairyTalePages")) { if (InventoryGui.IsVisible()) { InventoryGui.instance.Hide(); } string text2 = (Wildling.IsFemaleModel ? "\n\n- Katen" : "\n\n- Kono"); int num = 15 - int.Parse(text.Substring(14)); string text3 = ((num == 10) ? c_bookPages[num] : ("" + c_bookPages[num].Replace("\r\n", " ") + (((num & 1) > 0) ? text2 : ""))); string text4 = ((num == 10) ? "Hand written note" : "Loose pages"); string text5 = WUTIL.KeyHighlightText("Use"); Loki.m_runicText = GenderizeText(text3); TextViewer.instance.ShowText((Style)0, text4, text3 + "\n\n" + text5 + " to stop reading.", true); } } public static void ResetPlayerGui() { if (m_originalTextsDialogText != "" && (Object)(object)m_textDialogRoot != (Object)null) { ((Component)((Component)InventoryGui.instance.m_player).transform).gameObject.SetActive(true); ((Component)m_infoDialogRoot).gameObject.SetActive(true); ((Component)m_craftDialogRoot).gameObject.SetActive(true); ((Component)m_textDialogRoot.Find("TextList")).gameObject.SetActive(true); ((Component)m_textDialogRoot.Find("bkg")).gameObject.SetActive(true); WUTIL.SetGUIText(m_textDialogRoot.Find("topic"), m_originalTextsDialogText); m_originalTextsDialogText = ""; WUTIL.TimerReset("playergui_reset_delay"); } } public static string GenderizeText(string text) { if (!Wildling.IsFemaleModel) { return text; } Dictionary dictionary = new Dictionary { { "manhood", "womanhood" }, { "drengr", "dottir" }, { "Kono", "Katen" }, { "man,", "lady," }, { ", she asked", ", he asked" }, { "She was pretty", "He was handsom" } }; foreach (KeyValuePair item in dictionary) { if (text.Contains(item.Key)) { text = text.Replace(item.Key, item.Value); } } return text; } public static bool CustomizeBook(ItemData item) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (item == null || WUTIL.ItemName(item) != "FairyTale") { return false; } if (Wildling.IsWildling) { item.m_shared.m_animationState = (AnimationState)8; } else { item.m_shared.m_animationState = (AnimationState)0; WDBUG.Log("Is rotation setting working?", WDBUG.Level.show); } return true; } public static void Consume(ItemData item) { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan(); string text = WUTIL.ItemName(item); switch (text) { case "PixieDust": Player.m_localPlayer.StartEmote("cheer", true); if (DedoxTonicActive()) { WUTIL.Message("Nothing happens", center: false); return; } WUTIL.TimerReset("pixiedustdelay", 1.4f); Quest.AdvanceAchievement(text); return; case "SwiftPotion": { StatusEffect statusEffect = sEMan.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_DoxieDust")); if ((Object)(object)statusEffect != (Object)null) { sEMan.RemoveStatusEffect(statusEffect, true); } StatusEffect val2 = (StatusEffect)(object)(SE_SwiftPotion)(object)ScriptableObject.CreateInstance(typeof(SE_SwiftPotion)); sEMan.AddStatusEffect(val2, true, 0, 0f); WUTIL.CreateAttachedEffect("vfx_Potion_stamina_medium", ((Component)Player.m_localPlayer).transform); WUTIL.PlaySfx("sfx_Potion_stamina_Start", ((Component)Player.m_localPlayer).transform.position); if (DedoxTonicActive()) { WUTIL.Message("You drink the potion", center: false); } else { WUTIL.Message("You feel flush with energy and the urge to run!", center: false); } return; } case "PixieCola": { StatusEffect val4 = (StatusEffect)(object)(SE_ResurrectionPotion)(object)ScriptableObject.CreateInstance(typeof(SE_ResurrectionPotion)); sEMan.AddStatusEffect(val4, true, 0, 0f); WUTIL.CreateAttachedEffect("fx_Potion_frostresist", ((Component)Player.m_localPlayer).transform); if (DedoxTonicActive()) { WUTIL.Message("You drink the potion", center: false); } else { WUTIL.Message("You suddenly feel elated and carefree. But the feeling fades quickly.", center: false); } if (!Wildling.IsDarkling() && Quest.GetAchievement("DarklingLevel") > 0) { Wildling.ModifyDarklingLevel(-5); WUTIL.Message("You suddenly feel elated and carefree, as if a dark throughts were banished.", center: false); WUTIL.CustomLog("You mood has become much lighter.", "#4F8"); } return; } case "DoxieDust": Player.m_localPlayer.StartEmote("cheer", true); WUTIL.PlaySfx("sfx_blobtar_idle", ((Component)Player.m_localPlayer).transform.position); if (DedoxTonicActive()) { WUTIL.Message("Nothing happens", center: false); return; } WUTIL.TimerReset("SE_DoxieDust", 121.4f); Wildling.ModifyDarklingLevel(1); Quest.AdvanceAchievement(text); Wildling.ModifyDarklingLevel(1); WUTIL.CustomLog("You mood has become darker.", "#44F"); return; case "DedoxTonic": { StatusEffect val = (StatusEffect)(object)(SE_DedoxTonic)(object)ScriptableObject.CreateInstance(typeof(SE_DedoxTonic)); sEMan.AddStatusEffect(val, true, 0, 0f); WUTIL.CreateHeadEffect("truffle_vfx", (Character)(object)Player.m_localPlayer, attach: true, 0.5f); WUTIL.CreateHeadEffect("truffle_vfx", (Character)(object)Player.m_localPlayer, attach: true, 0.6f); WUTIL.CreateHeadEffect("truffle_vfx", (Character)(object)Player.m_localPlayer, attach: true, 0.7f); WUTIL.Message("Your throat burns as you force down the greasy liquid.", center: false); WUTIL.PlaySfx("sfx_greydwarf_shaman_heal", ((Component)Player.m_localPlayer).transform.position); return; } case "DobbieJuice": { StatusEffect val3 = (StatusEffect)(object)(SE_DobbieJuice)(object)ScriptableObject.CreateInstance(typeof(SE_DobbieJuice)); sEMan.AddStatusEffect(val3, true, 0, 0f); WUTIL.CreateHeadEffect("truffle_vfx", (Character)(object)Player.m_localPlayer, attach: true, 0.5f); WUTIL.CreateHeadEffect("truffle_vfx", (Character)(object)Player.m_localPlayer, attach: true, 0.6f); WUTIL.CreateHeadEffect("truffle_vfx", (Character)(object)Player.m_localPlayer, attach: true, 0.7f); if (DedoxTonicActive()) { WUTIL.Message("You drink the potion", center: false); } else { WUTIL.Message("You feel sick and irritable", center: false); } Wildling.ModifyDarklingLevel(1); WUTIL.CustomLog("You mood has become darker.", "#44F"); return; } } if (text.StartsWith("Doxsick")) { int num = 1; if (text.EndsWith("Oil")) { m_pukeThing = "Rat"; } else { num = 2; m_pukeThing = "RatDraugr"; } Wildling.ModifyDarklingLevel(num); m_pukeExtend = num + 1; WUTIL.TimerReset("ratbite_immunity", num * 100); WUTIL.CustomLog("You mood has become darker.", "#44F"); } else if (text == "PinePaste") { StatusEffect statusEffect2 = sEMan.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_PinePaste")); if ((Object)(object)statusEffect2 == (Object)null) { WUTIL.Message("Your skin burns cold for a moment after applying the paste", center: false); } else { sEMan.RemoveStatusEffect(statusEffect2, true); } StatusEffect val5 = (StatusEffect)(object)(SE_PinePaste)(object)ScriptableObject.CreateInstance(typeof(SE_PinePaste)); sEMan.AddStatusEffect(val5, true, 0, 0f); WUTIL.PlaySfx("sfx_Potion_stamina_Start", ((Component)Player.m_localPlayer).transform.position); } else if (text == "Elderberries") { StatusEffect statusEffect3 = sEMan.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_ElderSight")); if ((Object)(object)statusEffect3 != (Object)null) { sEMan.RemoveStatusEffect(statusEffect3, true); } StatusEffect val6 = (StatusEffect)(object)(SE_ElderSight)(object)ScriptableObject.CreateInstance(typeof(SE_ElderSight)); sEMan.AddStatusEffect(val6, true, 0, 0f); } } public static bool DedoxTonicActive() { return (Object)(object)((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_DedoxTonic")) != (Object)null; } public static bool PinePasteActive(Character actor = null) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 if (WUTIL.HaveStatusEffect("SE_PinePaste")) { if ((Object)(object)actor == (Object)null) { return true; } if ((int)actor.GetFaction() == 5) { return !WUTIL.ActorName(actor).StartsWith("Hatchling"); } if ((int)actor.GetFaction() == 7) { return WUTIL.ActorName(actor) == "Deathsquito"; } } return false; } public static bool ElderSightActive() { return (Object)(object)((Character)Player.m_localPlayer).GetSEMan().GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_ElderSight")) != (Object)null; } public static bool Awoke(Character character) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || WUTIL.PlayerID == 0) { return false; } switch (WUTIL.ActorName(character)) { case "Ygnie": if (WUTIL.Timer("summon_ygnie") == 0f) { WDBUG.Log("Skipping auto-destroy Ygnie on Awake?", WDBUG.Level.Ygnie); } return true; case "Pixie": if (!Wildling.IsWildling) { ((Component)character).transform.localScale = 0.1f * Vector3.one; Transform val = ((Component)character).transform.Find("Visual/Hatchling_mountain/Armature/Root/Spine1/Spine2/CenterLight"); if ((Object)(object)val != (Object)null) { Light component = ((Component)val).GetComponent(); component.range = 0.2f; component.intensity = 1f; } } return true; case "Doxie": if (YgnieActive(nearby: true) && Vector3.Distance(((Component)character).transform.position, ((Component)Player.m_localPlayer).transform.position) < 30f) { YgnieSpeak("There is a Doxie near by. Watch out, these things are nasty!"); } return true; default: return false; } } public static void OnDeath(GameObject go) { if ((Object)(object)Player.m_localPlayer == (Object)null || WUTIL.PlayerID == 0) { return; } switch (WUTIL.GameName(go)) { case "Ygnie": if ((Object)(object)Ygnie != (Object)null) { WUTIL.Message("Farewell young master!", center: true, MapMarker.GetCharacterIcon("Ygnie")); m_ygnieBanished = false; YgnieSummon(unsummon: true); m_ygnieBanished = true; } break; case "Pixie": break; case "Doxie": WUTIL.Message("Good riddance!"); break; } } public static float ModifyFlightSpeed(float speed, float buff = 2f) { return (YgnieActive() || WDBUG.PixieFlight) ? (buff * speed) : speed; } public static float ModifyFlightStaminaUse(float staminaUse = 1f) { return YgnieActive() ? (0.2f * staminaUse) : staminaUse; } public static float DilatedFlightTime(float time = 1f) { return (YgnieActive() || WDBUG.PixieFlight) ? (5f * time) : time; } public static float DilateTimer(string timerKey) { float num = WUTIL.Timer(timerKey); if (num > 0f && (YgnieActive() || WDBUG.PixieFlight)) { num += 0.8f * Time.fixedDeltaTime; WUTIL.TimerReset(timerKey, num); } return num; } public static bool ProjectileShield(Projectile projectile, Character owner) { //IL_0189: 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_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)owner == (Object)null || (Object)(object)localPlayer == (Object)null || (Object)(object)Ygnie == (Object)null || (Object)(object)owner == (Object)(object)localPlayer || (Object)(object)owner == (Object)(object)Ygnie || m_shieldActive) { return false; } string name = ((Object)projectile).name; bool flag = name.Contains("pebble") || name.Contains("bow_") || name.Contains("pear_") || name.Contains("throw_"); bool flag2 = projectile.m_aoe >= 1f; if (flag2 == flag) { flag2 = !flag; } float stamina = localPlayer.GetStamina(); float num = (flag2 ? 20f : 10f); if (num > stamina) { WDBUG.Log($"Stamina {stamina} to low {num} for shield", WDBUG.Level.Ygnie); return false; } float num2 = 0.5f * ((Character)localPlayer).GetHealth(); float totalDamage = ((DamageTypes)(ref projectile.m_damage)).GetTotalDamage(); if (totalDamage < num2 && totalDamage < num) { WDBUG.Log($"Ygnie did not consider {name} damage {totalDamage} < {num2} worth preventing for staminaUse: {num}", WDBUG.Level.Ygnie); return false; } float num3 = Vector3.Distance(((Component)projectile).transform.position, ((Component)localPlayer).transform.position); if (num3 < 4f) { if (num3 < 2.5f) { WDBUG.Log("Bubble shielding " + name, WDBUG.Level.Ygnie); WUTIL.PlaceObject("BubbleShield", ((Component)localPlayer).transform.position); WUTIL.TimerReset("ygnie_shield_time", 0.2f); m_shieldActive = true; } else if (flag2) { WDBUG.Log("Magic shielding " + name, WDBUG.Level.Ygnie); Vector3 facing = Vector3.Normalize(((Component)owner).transform.position - ((Component)localPlayer).transform.position); WUTIL.PlaceObject("MagicShield", ((Component)localPlayer).transform.position, facing); WUTIL.TimerReset("ygnie_shield_time", 0.4f); m_shieldActive = true; } } if (m_shieldActive) { ((Character)localPlayer).UseStamina(num); } return m_shieldActive; } public static bool ProjectileHitShieldedPlayer(Projectile projectile = null) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!m_shieldActive) { return false; } if ((Object)(object)projectile != (Object)null) { projectile.m_stayAfterHitStatic = false; } WDBUG.Log("Projectile hit while shielded at dist: " + Vector3.Distance(((Component)projectile).transform.position, ((Component)Player.m_localPlayer).transform.position), WDBUG.Level.Ygnie); return true; } public static void YgnieSummon(bool unsummon = false) { //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) if (unsummon) { if ((Object)(object)Ygnie != (Object)null) { if (WUTIL.Timer("ygnie_capture_window") > 0f) { WDBUG.Log("Removing captured unbound Ygnie", WDBUG.Level.Ygnie); WUTIL.TimerReset("ygnie_capture_window"); m_ygnieBanished = true; } else if (Quest.GetAchievement("BoundYgnie") == 2) { WUTIL.Message("Goodbye Wildling, I can no longer serve you.\nPlease do not take the dark path."); } if (m_ygnieBanished) { WDBUG.Log("Destroy Ygnie", WDBUG.Level.Ygnie); WUTIL.Destroy(((Component)Ygnie).gameObject); } else { Ygnie.Damage(new HitData { m_damage = { m_damage = 9999f } }); } Ygnie = null; Wildling.StaminaBuff = Math.Max(Wildling.StaminaBuff - 20f, 0f); } ((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("GP_EikthyrBinding"), true); Wildling.SetPlayerData("GP_EikthyrBinding", 0f); WUTIL.TimerReset("Eikthyr_power"); } else { if (m_ygnieBanished) { return; } Vector3 val = -((Component)Player.m_localPlayer).transform.forward; Vector3 val2 = ((Component)Player.m_localPlayer).transform.position - 1.5f * val + Vector3.up; if (m_ygnieAppearFromAbove && !World.PlayerInInterior()) { val2 += 10f * ((Component)Player.m_localPlayer).transform.forward + 25f * Vector3.up; } m_ygnieAppearFromAbove = true; if ((Object)(object)Ygnie == (Object)null) { WDBUG.Log("Summon Ygnie anew", WDBUG.Level.Ygnie); } else { float num = WUTIL.GroundDistance(val2, ((Component)Ygnie).transform.position); if (num > 64f) { WDBUG.Log("Summon Ygnie by renewal from far away " + num, WDBUG.Level.Ygnie); WUTIL.Destroy(((Component)Ygnie).gameObject); Ygnie = null; } else { ((Component)Ygnie).transform.position = val2; ((Component)Ygnie).transform.rotation = Quaternion.LookRotation(val); WDBUG.Log("Summon Ygnie by displacement from near by " + num, WDBUG.Level.Ygnie); } } if ((Object)(object)Ygnie == (Object)null) { WUTIL.TimerReset("summon_ygnie", 0.4f); Ygnie = WUTIL.PlaceObject("Ygnie", val2, val).GetComponent(); } Alignment.ToggleFollowing(Ygnie); ((Component)Ygnie).gameObject.GetComponent().m_alertRange = 0.1f; m_ygnieHelloDist = ((!(WUTIL.Timer("ygnie_speak_cooldown") > 0f)) ? (World.PlayerInInterior() ? 2 : 4) : 0); Ygnie.SetTamed(false); } } public static bool YgnieCapture(Character ygnie) { if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)ygnie == (Object)null) { return false; } ZNetView component = ((Component)ygnie).GetComponent(); if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner()) { return false; } if ((Object)(object)Ygnie != (Object)null && (Object)(object)ygnie != (Object)(object)Ygnie) { WDBUG.Log("Replacing previous Ygnie " + ((Object)((Component)Ygnie).gameObject).name + " with " + ((Object)((Component)ygnie).gameObject).name + "!"); WUTIL.Destroy(((Component)Ygnie).gameObject); Ygnie = null; } if (WUTIL.Timer("Eikthyr_power") > 0f) { if ((Object)(object)Ygnie != (Object)(object)ygnie) { WDBUG.Log("Capture new Ygnie", WDBUG.Level.Ygnie); WUTIL.TimerReset("ygnie_capture_window"); WUTIL.TimerReset("ygnie_respawn_delay"); if (Wildling.StaminaBuff < 20f) { Wildling.StaminaBuff = 20f; } Ygnie = ygnie; Alignment.ToggleFollowing(Ygnie); } return true; } if ((Object)(object)Ygnie == (Object)null) { float num = WUTIL.Timer("ygnie_capture_window"); if (num == 0f) { WUTIL.TimerReset("ygnie_capture_window", 4f); } else if (WUTIL.TimeIsAlmost(num, 2f)) { WDBUG.Log("Temporary capture unbound Ygnie", WDBUG.Level.Ygnie); Ygnie = ygnie; } } return false; } public static void YgnieReturn() { m_teleportToPlayer = (Object)(object)Ygnie != (Object)null; } public static bool YgnieActive(bool nearby = false) { return nearby ? ((Object)(object)Ygnie != (Object)null) : (WDBUG.PixieFlight || (!m_ygnieBanished && WUTIL.Timer("Eikthyr_power") > 0f)); } public static bool YgnieBlind(Character character, float confuseChance = 0.2f) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Ygnie == (Object)null) { return false; } Player localPlayer = Player.m_localPlayer; if (localPlayer.GetStamina() < 10f || Vector3.Distance(((Component)localPlayer).transform.position, ((Component)Ygnie).transform.position) > 15f) { return false; } Vector3 val = ((Component)character).transform.position - ((Component)localPlayer).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; float radius = character.GetRadius(); if ((magnitude < 1.5f * radius || magnitude - radius < 2f) && WUTIL.RandomSpin() < 0.99f && Alignment.DazeCharacter(character, 1f)) { character.Stagger(((Vector3)(ref val)).normalized); GameObject val2 = WUTIL.Spawn("ygnie_blind_aoe", character.GetEyePoint() + 0.25f * ((Component)character).transform.forward, ((Component)character).transform.rotation); val2.transform.localScale = radius * Vector3.one; ((Character)localPlayer).UseStamina(10f); if (confuseChance > 0f && WUTIL.TestLuck(confuseChance)) { Alignment.ConfuseCharacter(character, 6f); return true; } } return false; } public static void YgnieSeesAcorn(float dist) { if ((Object)(object)Ygnie != (Object)null) { WDBUG.Log($"Ygnie detected reachable acorn at dist: {dist}", WDBUG.Level.Ygnie); Alignment.HuntTargetAndAlert(Ygnie, null, alert: false); Alignment.StopHunt(Ygnie, tame: true); WUTIL.TimerReset("ygnie_sees_food", 6f); } } public static void YgnieSnack() { if (!((Object)(object)Ygnie == (Object)null)) { WDBUG.Log("Ygnie consumed an Acorn!", WDBUG.Level.Ygnie); Ygnie.SetHealth(Ygnie.GetMaxHealth()); Ygnie.AddStamina(Ygnie.GetMaxStamina()); float animalFedTime = Alignment.GetAnimalFedTime(Ygnie); string name = ((animalFedTime > 40f) ? "fx_Potion_frostresist" : ((animalFedTime > 25f) ? "vfx_Potion_stamina_medium" : "vfx_Potion_health_medium")); WUTIL.CreateAttachedEffect(name, ((Component)Ygnie).transform, 0f, 0f, 0.1f); WUTIL.CreateAttachedEffect(WUTIL.DieRoll(4) switch { 2 => "vfx_Potion_stamina_medium", 3 => "fx_Potion_frostresist", _ => "vfx_Potion_health_medium", }, ((Component)Ygnie).transform, 0f, 0f, 0.2f); WUTIL.TimerReset("ygnie_sees_food"); } } public static bool YgnieSeesEnemy(Character enemy) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Invalid comparison between Unknown and I4 //IL_000c: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Invalid comparison between Unknown and I4 //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 Faction faction = enemy.GetFaction(); if ((int)faction == 1 || ((int)faction == 0 && !((Character)Player.m_localPlayer).IsPVPEnabled())) { return false; } if (WUTIL.Timer("ygnie_sees_food") > 0f && WUTIL.TestLuck(0.75f)) { return false; } if (WUTIL.Timer("no_attack") > 0f) { return false; } float num = Vector3.Distance(((Component)enemy).transform.position, ((Component)Player.m_localPlayer).transform.position); m_ygnieSeesThreat |= num < 10f; if (Alignment.IsBribed(Ygnie, orDazed: true) || (int)faction == 3 || (int)faction == 4 || WUTIL.ActorName(enemy).StartsWith("Rat")) { float num2 = WUTIL.Timer("ygnie_attacking"); if (num2 > 0f) { if (num2 > m_ygnieHuntTime - 1f) { WUTIL.TimerReset("ygnie_attacking", m_ygnieHuntTime - 1f); Alignment.HuntTargetAndAlert(Ygnie, enemy); } return true; } if (Alignment.PlayerIsHiding() || WUTIL.TestLuck(num / 20f)) { WDBUG.Log("Allowing Ygnie to attack for 3s", WDBUG.Level.Ygnie); WUTIL.TimerReset("ygnie_attacking", 3f); Alignment.HuntTargetAndAlert(Ygnie, enemy); return true; } } return false; } public static void YgnieSpeak(string msg = "*#@%*!", float delay = 0f, bool prompt = false) { if (SE_DoxieDust.IsActive) { return; } if (delay > 0f) { string ygnieThought = m_ygnieThought; m_ygnieThought = msg; WUTIL.TimerReset("ygnie_message", delay); msg = ygnieThought; } if (!(msg != "")) { return; } int num = 0; string text = msg; foreach (char c in text) { if (c == ' ') { num++; } } Quest.ShowNpcDialog(Ygnie, msg, "", 1f + 0.5f * (float)num, autoClose: true, 9f); if (prompt) { msg = ""; } else if (num > 9) { int num2 = msg.IndexOf(',') + 1; if (num2 <= 0) { num2 = msg.IndexOf('.') + 1; } if (num2 > 0 && num2 < msg.Length) { msg = msg.Remove(num2 - 1) + "..."; } } WUTIL.DelayedMessage(msg, 2f, MapMarker.GetCharacterIcon("Ygnie")); } public static void YgnieInteract() { //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (SE_DoxieDust.IsActive) { return; } int num = WUTIL.DieRoll(10); if (m_ygnieThought != "" && WUTIL.Timer("ygnie_message") > 0f) { UpdateComments(force: true); int num2 = num + 10; WUTIL.TimerReset("ygnie_attacking", num2); WUTIL.TimerReset("no_attack", num2); WUTIL.TimerReset("ygnie_reset_following", num2); } else if (WUTIL.Timer("ygnie_attacking") == 0f) { if (num < 2) { WUTIL.CreateAttachedEffect("fx_boar_pet", ((Component)Ygnie).transform, 0f, 0f, 0.2f + 0.3f * (float)num); } string text = (EnvMan.IsDaylight() ? "shadows for enemies." : "darkness."); YgnieSpeak("I will check the " + text, 0f, prompt: true); WDBUG.Log("Allowing Ygnie to attack for " + m_ygnieHuntTime, WDBUG.Level.Ygnie); ((Component)Ygnie).gameObject.GetComponent().m_alertRange = 15f; WUTIL.TimerReset("no_attack"); WUTIL.TimerReset("ygnie_attacking", m_ygnieHuntTime); WUTIL.TimerReset("ygnie_reset_following", m_ygnieHuntTime); WUTIL.PlaySfx("pixie_alert_sfx", ((Component)Ygnie).transform.position); } else { if (num < 3) { WUTIL.CreateAttachedEffect("fx_boar_pet", ((Component)Ygnie).transform, 0f, 0f, 0.3f + 0.2f * (float)num); } YgnieSpeak("I will stay close.", 0f, prompt: true); ((Component)Ygnie).gameObject.GetComponent().m_alertRange = 0.1f; WUTIL.TimerReset("no_attack", 5f * m_ygnieHuntTime); WUTIL.TimerReset("ygnie_attacking"); WUTIL.TimerReset("ygnie_reset_following"); WUTIL.PlaySfx("pixie_idle_sfx", ((Component)Ygnie).transform.position); } } private static void UpdateYgnie() { //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !Wildling.IsWildling) { return; } float num = WUTIL.Timer("Eikthyr_power"); if (num == 0f) { if ((Object)(object)Ygnie != (Object)null) { WDBUG.Log("Unsummon Ygnie vs. no Elder Light", WDBUG.Level.Ygnie); YgnieSummon(unsummon: true); m_ygnieBanished = false; } return; } if ((Object)(object)Ygnie == (Object)null) { if (WUTIL.Timer("ygnie_summon_delay") > 0f) { if (WUTIL.TimerIsAlmost("ygnie_summon_delay", 0f)) { YgnieSummon(); } return; } float num2 = WUTIL.Timer("ygnie_respawn_delay"); if (num2 == 0f) { WDBUG.Log("Set Ygnie capture respawn delay, timeLeft: " + num, WDBUG.Level.Ygnie); WUTIL.TimerReset("ygnie_respawn_delay", 4f); } else if (WUTIL.TimeIsAlmost(num2)) { WDBUG.Log("Resummon new Ygnie after respawn delay", WDBUG.Level.Ygnie); YgnieSummon(); m_ygnieHelloDist = 0f; } return; } if (((Character)Player.m_localPlayer).IsTeleporting()) { m_teleportToPlayer = true; return; } if (m_teleportToPlayer) { m_teleportToPlayer = false; ((Component)Ygnie).transform.position = ((Component)Player.m_localPlayer).transform.position + 2f * (World.PlayerInInterior() ? ((Component)Player.m_localPlayer).transform.forward : Vector3.up); WDBUG.Log("Teleported Ygnie to " + Player.m_localPlayer.GetPlayerName(), WDBUG.Level.Ygnie); return; } if (WUTIL.TimeIsAlmost(num, 10f)) { if (Riding.IsRiding(Ygnie) || Flight.IsFlying()) { YgnieSpeak("Wildling, you had better land, for I must depart very soon."); } } else if (WUTIL.TimeIsAlmost(num, 3f)) { YgnieSpeak("Wildling, I must return to my home realm."); } if (WUTIL.TimerIsAlmost("ygnie_shield_time", 0f)) { m_shieldActive = false; } if (Ygnie.IsDead()) { Ygnie = null; WUTIL.TimerReset("Eikthyr_power"); return; } bool flag = Alignment.GetAnimalFedTime(Ygnie) > 0f; bool flag2 = (flag || Ygnie.GetStaminaPercentage() >= 0.99f) && WUTIL.Timer("ygnie_check_regenerate") == 0f; float num3 = ((!flag) ? 1 : 3); bool flag3 = Ygnie.GetBaseAI().IsAlerted(); if (flag2 && (flag || !flag3 || WUTIL.RandomSpin() >= 0.5f)) { WUTIL.TimerReset("ygnie_check_regenerate", 1f); if (Ygnie.GetHealthPercentage() < 1f) { WDBUG.Log("Ygnie healed herself", WDBUG.Level.Ygnie); Ygnie.SetHealth(Ygnie.GetHealth() + num3 * 1f); flag2 = flag; } } bool flag4 = WUTIL.Timer("ygnie_attacking") > 0f; if (!(flag3 || flag4) && !m_ygnieSeesThreat && WUTIL.Timer("ygnie_sees_food") > 0f) { return; } Vector3 val = ((Component)Ygnie).transform.position - ((Component)localPlayer).transform.position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < m_ygnieHelloDist) { if (num > 850f) { string text = (WUTIL.TestLuck() ? "Good to see you" : "Greetings"); string text2 = (WUTIL.TestLuck() ? localPlayer.GetPlayerName() : "wildling"); YgnieSpeak(text + ", " + text2 + "!"); } else { string text3 = (WUTIL.TestLuck(0.1f) ? " Did you miss me?" : ""); YgnieSpeak("I'm with you!" + text3); } m_ygnieHelloDist = 0f; WUTIL.TimerReset("ygnie_speak_cooldown", 20f); UpdateComments(force: false, sooner: true); } else { UpdateComments(); } if (m_ygnieSeesThreat || magnitude > 18f || m_ygnieHelloDist > 0f) { if (WUTIL.Timer("ygnie_reset_following") == 0f) { if (magnitude > 100f) { WDBUG.Log("Teleport Ygnie from distance " + magnitude, WDBUG.Level.Ygnie); YgnieSummon(); } WUTIL.TimerReset("ygnie_reset_following", m_ygnieSeesThreat ? 2 : 10); WUTIL.TimerReset("no_attack", 10f); Alignment.HuntTargetAndAlert(Ygnie, null, alert: false); Alignment.ToggleFollowing(Ygnie); ((Component)Ygnie).gameObject.GetComponent().m_alertRange = 0.1f; } else if (((Character)Player.m_localPlayer).IsRunning()) { WUTIL.TimerReset("ygnie_attacking", 2f); WUTIL.TimerReset("ygnie_reset_following"); } m_ygnieSeesThreat = false; } if (!(magnitude <= 15f)) { return; } if (flag) { ((Character)localPlayer).AddStamina(1f); } if (flag2 && ((Character)localPlayer).GetHealthPercentage() < 1f && ((Character)localPlayer).GetStaminaPercentage() >= 0.9f) { WDBUG.Log("Ygnie regenerated player health", WDBUG.Level.Ygnie); ((Character)localPlayer).SetHealth(Math.Min(((Character)localPlayer).GetMaxHealth(), ((Character)localPlayer).GetHealth() + num3 * 1.5f)); } if (!Riding.IsRidingFairy() && !flag4 && WUTIL.Timer("ygnie_jitter_time") == 0f) { bool flag5 = World.PlayerInInterior(); WUTIL.TimerReset("ygnie_jitter_time", 3f); if (!flag5 && magnitude <= 3f && (flag3 || (double)WUTIL.RandomSpin() < 0.25)) { WDBUG.Log("Jitter reset max alert distance " + 8f, WDBUG.Level.Ygnie); ((Component)Ygnie).gameObject.GetComponent().m_alertRange = 8f; Alignment.StopHunt(Ygnie, tame: true, WUTIL.TestLuck()); } else { Alignment.HuntTargetAndAlert(Ygnie, null, alert: false); Alignment.ToggleFollowing(Ygnie); float alertRange = (flag5 ? 1.5f : WUTIL.RandomSpin(0.1f, 1.6f, 0.3f)); ((Component)Ygnie).gameObject.GetComponent().m_alertRange = alertRange; } } } private static void UpdateComments(bool force = false, bool sooner = false) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) float num = WUTIL.Timer("ygnie_message"); if (m_ygnieThought != "" && (force || WUTIL.TimeIsAlmost(num))) { YgnieSpeak(m_ygnieThought, 0f, force); if (m_ygnieCommentFlag > 0) { Quest.SetAchievement("Ygnie_chat", m_ygnieCommentFlag - 1, bit: true); } } else if (num > 0f) { return; } m_ygnieThought = ""; m_ygnieCommentFlag = 0; if (Vector3.Distance(((Component)Ygnie).transform.position, ((Component)Player.m_localPlayer).transform.position) > 12f) { force = true; } int num2 = (sooner ? 30 : (force ? 120 : 300)); int num3 = WUTIL.DieRoll(num2) + num2; WUTIL.TimerReset("ygnie_message", num3); if (force) { WDBUG.Log($"Ygnie silent for {num3}s", WDBUG.Level.Ygnie); return; } int num4 = ((WUTIL.DieRoll(5) == 0) ? 1 : 0); int achievement = Quest.GetAchievement("Ygnie_chat"); int num5 = 0; int num6 = 1; while (num5 < c_conversation.Count) { if ((achievement & num6) == 0) { if (num4 <= 0 || num5 < 2) { m_ygnieCommentFlag = num5 + 1; m_ygnieThought = c_conversation[num5]; break; } num4--; } num5++; num6 <<= 1; } if (m_ygnieCommentFlag == 0) { int num7 = WUTIL.DieRoll(c_conversation.Count - 16) + 16; if (WUTIL.TestLuck(0.2f)) { num7 -= 12; } if (num7 < c_conversation.Count) { m_ygnieThought = c_conversation[num7]; } } WDBUG.Log($"Ygnie delayed thought for {num3}s {m_ygnieThought.Substring(0, 20)}...", WDBUG.Level.Ygnie); } private static void UpdateRessurection() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) if (!m_resurrecting) { return; } if (WUTIL.Timer("no_fall_damage") == 0f) { WUTIL.Message("You are being resurrected."); } if (!((Character)Player.m_localPlayer).IsTeleporting()) { m_resurrecting = false; Flight.DisableGroundHitDamage(3f); WUTIL.CreateAttachedEffect("pixiedust_vfx", ((Component)Player.m_localPlayer).transform); float num = 9f; Player localPlayer = Player.m_localPlayer; Vector3 position = ((Component)localPlayer).transform.position; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, Vector3.up, ref val, num + 2f, WUTIL.c_solidRayMask)) { num = ((RaycastHit)(ref val)).point.y - ((Character)localPlayer).GetHeadPoint().y; WDBUG.Log($"Found ceiling {num} above.", WDBUG.Level.Ygnie); } if (num > 0f) { num = Math.Min(WUTIL.RandomSpin(7f, num), num); position.y += num; ((Component)localPlayer).transform.position = position; } localPlayer.StartEmote("gpower", true); } } private static void UpdatePixieDustEffect() { if (WUTIL.Timer("pixiedustdelay") > 0f && WUTIL.TimerIsAlmost("pixiedustdelay", 0f)) { WUTIL.CreateAttachedEffect("pixiedust_vfx", WUTIL.HeadTransform()); if (!DedoxTonicActive()) { Flight.SetFlightTime(30f); } } } private static void UpdateDoxieDustEffect() { float num = WUTIL.Timer("SE_DoxieDust"); if (WUTIL.TimeIsAlmost(num, 120f)) { SEMan sEMan = ((Character)Player.m_localPlayer).GetSEMan(); StatusEffect statusEffect = sEMan.GetStatusEffect(StringExtensionMethods.GetStableHashCode("SE_SwiftPotion")); if ((Object)(object)statusEffect != (Object)null) { sEMan.RemoveStatusEffect(statusEffect, true); } WUTIL.CreateAttachedEffect("doxiedust_vfx", WUTIL.HeadTransform()); StatusEffect val = (StatusEffect)(object)(SE_DoxieDust)(object)ScriptableObject.CreateInstance(typeof(SE_DoxieDust)); sEMan.AddStatusEffect(val, true, 0, 0f); WUTIL.Message("You suddenly feel very odd. Infact you feel nothing at all!", center: false); } else if (!(num > 120f)) { if (WUTIL.TimeIsAlmost(num, 3f)) { WUTIL.Message("The effect of the Doxie dust is wearing off.", center: false); } else if (WUTIL.TimeIsAlmost(num)) { WUTIL.Message("You feel like yourself again - human.", center: false); } } } private static void UpdateDoxsick() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown if (m_pukedThings.Count <= 0) { return; } bool flag = WUTIL.Timer("ratbite_immunity") == 0f; List list = new List(); foreach (GameObject pukedThing in m_pukedThings) { Character val = ((pukedThing != null) ? pukedThing.GetComponent() : null); if ((Object)(object)val == (Object)null || !val.IsOwner() || val.IsDead()) { continue; } if (pukedThing.transform.localScale.x >= 0.2f) { if (flag) { val.Damage(new HitData { m_damage = { m_damage = 9999999f } }); } continue; } if (WUTIL.ActorName(val) == "Rat") { Transform transform = pukedThing.transform; transform.localScale *= 1.0618f; } else { Transform transform2 = pukedThing.transform; transform2.localScale += 0.008f * Vector3.one; } val.GetBaseAI().Alert(); list.Add(pukedThing); } m_pukedThings = list; } } internal class Flight { [HarmonyPatch(typeof(Character), "UpdateMotion")] public class PatchCharacterUpdateMotion { public static bool Prefix(Character __instance, ref bool ___m_run, Rigidbody ___m_body, ref Vector3 ___m_currentVel) { //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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer != (Object)null && !__instance.IsDead()) { if (__instance.IsPlayer()) { return !UpdateMotion(WUTIL.Player_zanim, ___m_body, ___m_run, ref ___m_currentVel); } if (Alignment.IsParalyzed(__instance)) { ___m_run = false; ___m_currentVel = Vector3.zero; } else if (Riding.IsRiding(__instance) && WUTIL.Timer("freeze_player_height") > 0f) { Vector3 velocity = ___m_body.velocity; velocity.y = 0f; Vector3 val = (___m_body.velocity = velocity); ___m_currentVel = val; } else { FollowUnderwater(__instance); } } return true; } private static void FollowUnderwater(Character character) { //IL_0031: 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) //IL_004e: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!Fairy.SE_DoxieDust.IsActive && !(WUTIL.ActorName(character) != "Serpent")) { Transform transform = ((Component)Player.m_localPlayer).transform; if (World.DepthBelowWater(transform.position) > 4f && WUTIL.WithinCylinder(((Component)character).transform.position, transform.position, 50f) && ((Component)character).transform.position.y - transform.position.y > 0f) { character.m_canSwim = false; character.m_flying = true; character.m_flyTurnSpeed = 100f; character.m_acceleration = 0.3f; MonsterAI component = ((Component)character).gameObject.GetComponent(); float heightAboveSolid = GetHeightAboveSolid(transform.position); ((BaseAI)component).m_flyAltitudeMin = Mathf.Max(0.5f, heightAboveSolid - 2f); ((BaseAI)component).m_flyAltitudeMax = heightAboveSolid + 2f; component.m_circulateWhileChargingFlying = true; } else if (character.m_flying) { character.m_flying = false; character.m_canSwim = true; character.m_acceleration = 0.1f; } } } } [HarmonyPatch(typeof(GameCamera), "GetCameraPosition")] private class PatchGetCameraPosition { private static bool underWater; private static bool Prefix(GameCamera __instance, float dt, out Vector3 pos, out Quaternion rot, float ___m_distance, Vector3 ___m_currentBaseOffset) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { pos = ((Component)__instance).transform.position; rot = ((Component)__instance).transform.rotation; return true; } if (___m_distance <= 0f || (!m_flying && !m_safeFall)) { if (!(WUTIL.Timer("allow_view_underwater") > 0f)) { pos = ((Component)__instance).transform.position; rot = ((Component)__instance).transform.rotation; if (underWater) { World.SetUnderWaterEnvironment(reset: true); underWater = false; } return true; } if (Floating.GetLiquidLevel(((Component)localPlayer).transform.position, 1f, (LiquidType)10) - ((Component)localPlayer).transform.position.y < 2f) { WUTIL.TimerReset("allow_view_underwater"); } else if (!underWater) { World.SetUnderWaterEnvironment(); underWater = true; } } Vector3 val = (((Character)localPlayer).UseMeleeCamera() ? __instance.m_3rdCombatOffset : __instance.m_3rdOffset); pos = ((Component)localPlayer).transform.position + val + ___m_currentBaseOffset - ___m_distance * ((Component)((Character)localPlayer).m_eye).transform.forward; rot = ((Component)((Character)localPlayer).m_eye).transform.rotation; return false; } } [HarmonyPatch(typeof(Character), "UpdateGroundContact")] public class PatchCharacterUpdateGroundContact { public static void Prefix(Character __instance, bool ___m_groundContact, ref float ___m_maxAirAltitude) { //IL_001c: 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) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer) { float num = Math.Min(___m_maxAirAltitude - ((Component)__instance).transform.position.y - 4f, 16f); if (PreventGroundHitDamage(___m_groundContact, num)) { ___m_maxAirAltitude = ((Component)__instance).transform.position.y; } else if (___m_groundContact && num > 0f && (WUTIL.HaveStatusEffect("SE_SwiftPotion", __instance) || WUTIL.TestLuck(0f))) { num *= 0.2f + 0.05f * WUTIL.RandomSpin(); ___m_maxAirAltitude = ((Component)__instance).transform.position.y + num + 4f; } } } public static bool PreventGroundHitDamage(bool hitGround, float distDamage) { m_hitGround = hitGround; if (distDamage > 0f) { if (m_safeFall || WDBUG.SimpleFlight || WUTIL.Timer("no_fall_damage") > 0f) { return true; } if (Fairy.YgnieActive()) { WDBUG.Log($"Ygnie cushion effect strength {distDamage}", WDBUG.Level.Ygnie); return true; } } return false; } } [HarmonyPatch(typeof(FootStep), "RPC_Step")] public class PatchFootStepRPC_Step { public static bool Prefix(Character ___m_character) { return !___m_character.IsPlayer() || (!m_flying && !m_autoSink); } } [HarmonyPatch(typeof(Character), "CanWallRun")] public class PatchCharacterCanWallRun { public static void Postfix(ref bool __result) { if (__result && (m_flying || m_autoSink)) { __result = false; } } } [HarmonyPatch(typeof(Player), "CanMove")] public class PatchPlayerCanMove { public static void Postfix(ref bool __result) { if (WUTIL.Timer("no_can_move") > 0f) { __result = false; } } } [HarmonyPatch(typeof(Ladder), "GetHoverText")] private class PatchLadderGetHoverText { public static bool Prefix(Ladder __instance, ref string __result) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c8: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_name == "godoorknob") { __result = ((Object)((Component)__instance).transform.parent).name; return false; } if (__instance.m_name == "mirror") { __result = "The way back?"; return false; } if (__instance.m_name == "Epilog") { __result = "Self reflection"; return false; } if (__instance.m_name != "Climbing pole") { return true; } Transform transform = ((Component)Player.m_localPlayer).transform; float num = Math.Min(Vector3.Distance(transform.position, ((Component)__instance).transform.position), Vector3.Distance(transform.position, __instance.m_targetPos.position)); if (num > __instance.m_useDistance) { return true; } float num2 = ((!(m_wireAutoAttachDist > 0f)) ? 0f : (Wildling.IsWildling ? m_wireAutoAttachDist : (m_wireAutoAttachDist + 0.15f))); if (IsWireAttached()) { __result = (m_wireCrouchToSlideDown ? "" : (WUTIL.KeyHighlightText("Use") + " to slide down")); } else if (num < num2) { __instance.Interact((Humanoid)(object)Player.m_localPlayer, false, false); } else { __result = ((m_wireAutoAttachDist > 0f) ? "Approach" : WUTIL.KeyHighlightText("Use")) + " to step on"; } return false; } } [HarmonyPatch(typeof(Ladder), "Interact")] private class PatchLadderInteract { public static bool Prefix(Ladder __instance, Humanoid character, bool hold) { //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: 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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: 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) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_050a: Unknown result type (might be due to invalid IL or missing references) if (hold || (Object)(object)character != (Object)(object)Player.m_localPlayer) { return true; } if (((Object)__instance).name.StartsWith("ladder")) { DisableGroundHitDamage(); return true; } if (((Object)__instance).name == "godoorknob") { DisableGroundHitDamage(); Fairy.YgnieReturn(); return true; } if (((Object)__instance).name == "goakemblem") { DisableGroundHitDamage(); Fairy.YgnieReturn(); SwampDungeon.ExitGreatOak(); return false; } if (__instance.m_name == "mirror") { if (Wildling.IsWildling) { Quest.EndAdventure(); } else { WUTIL.Message("Nothing happens."); } return false; } if (__instance.m_name == "Epilog") { Quest.ReportEpilog(); return false; } if (__instance.m_name != "Climbing pole") { return true; } if (WUTIL.Timer("ladder_step_motion") > 0f) { return false; } if (IsWireAttached()) { m_wireSlideDown = !m_wireCrouchToSlideDown; return false; } Transform transform = ((Component)Player.m_localPlayer).transform; if (((Component)__instance).transform.position.y - transform.position.y > 1.5f) { return false; } float num = Vector3.Distance(transform.position, ((Component)__instance).transform.position); float num2 = Vector3.Distance(transform.position, __instance.m_targetPos.position); if (num > __instance.m_useDistance && num2 > __instance.m_useDistance) { return false; } m_hitGround = false; m_wireTopNoJump = false; bool flag = num2 <= num; bool flag2 = (Object)(object)m_wireTran != (Object)null && Vector3.Dot(m_wireTran.forward, __instance.m_targetPos.forward) < 0f; if ((Object)(object)m_wireTran == (Object)null) { m_wireTopNoJump = flag; WUTIL.HideHandItems(character); SetControls(jump: false, crouch: false, block: true); ((Character)character).ResetCloth(); } m_wireTran = __instance.m_targetPos; m_wireBase = ((Component)__instance).transform.position; m_wireTop = __instance.m_targetPos.position; m_wireSteps = 4; m_wireStep = (m_wireTop - m_wireBase) / (float)m_wireSteps; m_wireOffset = (Wildling.IsWildling ? (-0.25f) : (-0.3f)) * m_wireTran.forward; m_wireOffset.y += 0.1f; w_wireCheckTop = m_wireTop.y + m_wireOffset.y; if (flag) { m_wireLock = m_wireTop + m_wireOffset; } else { m_wireLock = m_wireBase + m_wireOffset + m_wireStep; } float num3 = GetCeilingHeight(m_wireLock) - ((Character)Player.m_localPlayer).GetEyePoint().y; if (num3 < 0f) { WUTIL.Message("No space to fit on ladder."); return false; } int num4 = Mathf.Min((int)(num3 / m_wireStep.y), 4); m_wireTopBlocked = !flag && num4 < m_wireSteps; if (m_wireTopBlocked) { w_wireCheckTop -= m_wireStep.y * (float)(4 - num4); } m_wireStep /= m_wireStepTime; w_wireCheckBot = m_wireBase.y + m_wireStep.y + m_wireOffset.y; m_wireSideStep = 0f; m_stepRotation = __instance.m_targetPos.rotation * Quaternion.Euler(0f, -45f, 0f); transform.rotation = m_stepRotation; if (m_wireSlideDown || flag2) { ((Character)character).SetLookDir(__instance.m_targetPos.forward, 0f); } DisableColliders((Character)(object)character, m_wireTran); Ladder val = SwitchLadder(above: true, check: true); if (Object.op_Implicit((Object)(object)val)) { DisableColliders((Character)(object)character, ((Component)val).transform); } WDBUG.Log("Ladder step on " + (flag ? "top" : "bottom") + " with free rungs: " + num4, WDBUG.Level.Treehouse); transform.position = m_wireLock; return false; } } public static bool m_continuousFlight = false; private const float c_deg2rad = (float)Math.PI / 180f; private const float c_takeOffHeight = 0.9f; private const float c_windFactor = 0.1f; private const float c_windBraceStamimaFactor = 0.01f; private const float c_airBreakStamimaFactor = 0.1f; private const float c_walkSpeed = 8f; private const float c_runSpeed = 30f; private const float c_maxFlySpeed = 60f; private const float c_maxFloatSpeed = 25f; private const float c_maxClimbSpeed = 16f; private const float c_maxSafeFallSpeed = -20f; private const float c_acceleration = 20f; private const float c_speedDampen = 0.995f; private const float c_speedDampenBraced = 0.95f; private const float c_parachuteDeployHeight = 5f; private const float c_parachuteMinFallSpeed = 0.5f; private const float c_parachuteDeceleration = 0.98f; private const float c_maxSinkVelocity = -3f; private const float c_runStaminaDrain = 0.1f; private const float c_climbStaminaDrain = 0.1f; private const float c_maxTilt = 80f; private const float c_rotateToLookSpeed = 300f; private const float c_turnSpeed = 100f; private static int m_groundRetests = 0; private static bool m_autoSink = false; private static bool m_flying = false; private static bool m_safeFall = false; private static bool m_windBraced = false; private static bool m_quickLand = false; private static bool m_hitGround = false; private static bool m_simpleFlying = false; private static bool m_haveFlightControl = false; private static Vector3 m_airVelocity = Vector3.zero; private static int m_wireSteps = 0; private static int m_wireMoveDir = 0; private static bool m_wireTriggerSwitch = false; private static bool m_wireSlideDown = false; private static bool m_wireTopBlocked = false; private static bool m_wireTopNoJump = false; private static bool m_wireCrouchToSlideDown = true; private static float m_wireAutoAttachDist = 0f; private static float m_wireMaxSideStep = 0.3f; private static float m_wireStepTime = 0.5f; private static float w_wireCheckTop = 0f; private static float w_wireCheckBot = 0f; private static float m_wireSideStep = 0f; private static Vector3 m_wireLock = Vector3.zero; private static Vector3 m_wireOffset = Vector3.zero; private static Vector3 m_wireBase = Vector3.zero; private static Vector3 m_wireStep = Vector3.zero; private static Vector3 m_wireTop = Vector3.zero; private static Transform m_wireTran = null; private static Quaternion m_stepRotation; private static bool m_resetUprightOnMove = false; private static Vector3 m_resetAttachPoint = Vector3.zero; private static Transform m_resetCollidersOnMove = null; public static bool IsFlying() { return m_flying; } public static void ResetUprightOnMove(Transform resetColliders, Vector3 attachPoint) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) m_resetUprightOnMove = true; m_resetCollidersOnMove = resetColliders; m_resetAttachPoint = attachPoint; } public static bool IsWireAttached(bool detach = false) { if (detach) { WDBUG.Log("Ladder detach", WDBUG.Level.Treehouse); m_wireSteps = 0; m_wireMoveDir = 0; m_wireSlideDown = false; DisableColliders((Character)(object)Player.m_localPlayer, m_wireTran, disable: false); Ladder val = SwitchLadder(above: true, check: true); if (Object.op_Implicit((Object)(object)val)) { DisableColliders((Character)(object)Player.m_localPlayer, ((Component)val).transform, disable: false); } m_wireTran = null; if (m_wireAutoAttachDist > 0f) { WUTIL.TimerReset("ladder_step_motion", 1f); } } return m_wireSteps > 0; } public static void SetFlightTime(float undilatedDuration, bool triggerEffect = true) { m_continuousFlight = undilatedDuration < 0f; if (undilatedDuration == 0f) { m_haveFlightControl = false; } else if (triggerEffect) { Fairy.SE_PixieFlight sE_PixieFlight = (Fairy.SE_PixieFlight)(object)ScriptableObject.CreateInstance(typeof(Fairy.SE_PixieFlight)); sE_PixieFlight.m_normalFlightTime = undilatedDuration; ((Character)Player.m_localPlayer).GetSEMan().AddStatusEffect((StatusEffect)(object)sE_PixieFlight, true, 0, 0f); m_haveFlightControl = true; } else { WDBUG.Log($"Restart in-flight {undilatedDuration}s", WDBUG.Level.Flight); m_haveFlightControl = (m_flying = (m_safeFall = true)); } } public static void DisableGroundHitDamage(float time = 0.1f) { WUTIL.TimerReset("no_fall_damage", time); } public static bool UpdateMotion(ZSyncAnimation zanim, Rigidbody body, bool run, ref Vector3 p_currentVel) { //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) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00c8: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_0828: Unknown result type (might be due to invalid IL or missing references) //IL_082d: Unknown result type (might be due to invalid IL or missing references) //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_0837: Unknown result type (might be due to invalid IL or missing references) //IL_0870: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_087c: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06de: Unknown result type (might be due to invalid IL or missing references) //IL_08bf: Unknown result type (might be due to invalid IL or missing references) //IL_08c4: Unknown result type (might be due to invalid IL or missing references) //IL_08f2: Unknown result type (might be due to invalid IL or missing references) //IL_08f3: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_0944: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_09ec: Unknown result type (might be due to invalid IL or missing references) //IL_09ee: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Unknown result type (might be due to invalid IL or missing references) //IL_09f6: Unknown result type (might be due to invalid IL or missing references) //IL_09fc: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)zanim == (Object)null) { return false; } Vector3 val; if (!(WUTIL.Timer("freeze_player_movement") > 0f)) { if (WUTIL.Timer("freeze_player_height") > 0f) { Vector3 velocity = body.velocity; velocity.y = 0f; val = (p_currentVel = (body.velocity = velocity)); return true; } if (WUTIL.Timer("slowfall_underwater") > 0f) { Vector3 velocity2 = body.velocity; m_autoSink = velocity2.y < -3f; if (m_autoSink) { velocity2.y = -3f; } val = (p_currentVel = (body.velocity = velocity2)); return true; } m_autoSink = false; if (IsWireAttached()) { if (UpdateWireMotion(zanim)) { val = (p_currentVel = (body.velocity = Vector3.zero)); body.useGravity = false; return true; } body.useGravity = true; return IsWireAttached(detach: true); } if (m_resetUprightOnMove) { val = ((Character)localPlayer).GetMoveDir(); if (((Vector3)(ref val)).magnitude > 0.1f || WUTIL.GetButton("Jump")) { SetFlightVisuals(Vector3.zero, Vector3.zero); if ((Object)(object)m_resetCollidersOnMove != (Object)null) { DisableColliders((Character)(object)localPlayer, m_resetCollidersOnMove, disable: false); Chair component = ((Component)m_resetCollidersOnMove).GetComponent(); if ((Object)(object)component != (Object)null) { component.m_attachPoint.localPosition = m_resetAttachPoint; } m_resetCollidersOnMove = null; } m_resetUprightOnMove = false; return true; } } if (WDBUG.SimpleFlight) { if (WUTIL.PlayerTakeInput()) { bool button = WUTIL.GetButton("Jump"); if (!m_simpleFlying) { m_simpleFlying = button; } else if (WUTIL.GetButton("Crouch")) { SetControls(jump: false, crouch: false, block: true); ((Character)localPlayer).m_flying = (m_simpleFlying = false); } else if (m_simpleFlying) { ((Character)localPlayer).m_flying = !WUTIL.GetButton("Block"); if (((Character)localPlayer).m_flying) { if (button) { Vector3 position = ((Component)localPlayer).transform.position; position.y += Time.fixedDeltaTime * ((run || WUTIL.GetButton("Run")) ? 16f : 2f); ((Component)localPlayer).transform.position = position; } ((Component)localPlayer).transform.rotation = Quaternion.LookRotation(((Character)localPlayer).GetLookDir()); } } } return false; } if (m_simpleFlying) { ((Character)localPlayer).m_flying = false; body.useGravity = true; m_simpleFlying = false; } bool flag = m_haveFlightControl || m_continuousFlight; if (!flag) { if (!m_flying && !m_safeFall) { return false; } if (m_flying) { WDBUG.Log("Lost flight control", WDBUG.Level.Flight); } m_windBraced = false; m_flying = false; } Vector3 lookDir = ((Character)localPlayer).GetLookDir(); Vector3 val4 = ((Character)localPlayer).GetMoveDir(); float heightAboveSolid = GetHeightAboveSolid(((Component)localPlayer).transform.position); if (heightAboveSolid < 0.2f || ((Character)localPlayer).InWater() || m_hitGround) { if (m_hitGround && heightAboveSolid > 0.9f) { WDBUG.Log("Hit something while in the air", WDBUG.Level.Flight); } else if (m_safeFall) { m_flying = false; m_safeFall = false; ((Character)localPlayer).SetRun(false); zanim.SetBool("inWater", false); m_groundRetests = (flag ? 1 : 0); SetFlightVisuals(Vector3.zero, Vector3.zero); WDBUG.Log($"Touched down flightControl: {flag}", WDBUG.Level.Flight); } m_hitGround = false; if (m_groundRetests > 0 && --m_groundRetests == 0) { WDBUG.Log("Safe landing", WDBUG.Level.Flight); m_airVelocity = Vector3.zero; m_flying = false; m_safeFall = false; m_windBraced = false; m_groundRetests = 0; ((Character)localPlayer).m_flying = false; body.useGravity = true; if (m_quickLand) { SetCrouch(crouth: true); m_quickLand = false; } return false; } } bool flag2 = Player.m_localPlayer.GetStamina() > 0f; bool flag3 = run && flag2; float num = (flag3 ? Fairy.ModifyFlightSpeed(30f) : 8f); bool flag4 = false; if (!m_flying || val4 == Vector3.zero) { m_airVelocity *= (m_windBraced ? 0.95f : 0.995f); if (((Vector3)(ref m_airVelocity)).magnitude < 0.1f && m_windBraced) { m_airVelocity = Vector3.zero; } } else { val4 = 0.4f * lookDir + 0.6f * val4; if (m_windBraced) { m_airVelocity *= 0.95f; } } Vector3 val5 = m_airVelocity; float num2 = (flag3 ? 0.1f : 0f); m_windBraced = false; if (flag && WUTIL.PlayerTakeInput()) { bool flag5 = WUTIL.GetButton("Jump"); bool flag6 = WUTIL.GetButton("Crouch"); bool flag7 = flag3 || WUTIL.GetButton("Run"); if (flag5 && flag6) { flag5 = (flag6 = false); } if (WUTIL.GetButton("Block")) { m_windBraced = m_flying; } val5 += val4 * 20f * Time.fixedDeltaTime; if (flag2 && flag5) { if (!m_flying && heightAboveSolid >= 0.9f) { zanim.SetFloat("forward_speed", 0f); zanim.SetFloat("sideway_speed", 0f); m_flying = true; } if (m_flying) { m_safeFall = true; num2 += 0.1f; flag4 = true; val5.y = (flag7 ? Fairy.ModifyFlightSpeed(16f, 1.5f) : 2f); } } else if (m_flying) { if (flag6) { val5.y = (flag7 ? (-20f) : (-2.5f)); flag4 = false; SetControls(jump: false, crouch: false, block: true); } else if (WUTIL.GetButton("Sit")) { SetControls(jump: false, crouch: false, block: true); m_flying = false; m_quickLand = true; flag4 = false; } } } if (!World.PlayerInInterior()) { if (m_windBraced) { num2 += 0.01f * EnvMan.instance.GetWindIntensity(); } else { val5 += 0.1f * EnvMan.instance.GetWindForce(); } } if (m_windBraced) { num2 += 0.1f * ((Vector3)(ref val5)).magnitude; } float magnitude = ((Vector3)(ref val5)).magnitude; if (magnitude > num) { val5 *= num / magnitude; } if (flag4) { flag4 = magnitude <= 25f; } body.useGravity = !m_flying; if (!m_flying && !m_safeFall) { m_airVelocity = Vector3.zero; WDBUG.Log("Ready to take off", WDBUG.Level.Flight, 3f); return false; } if (m_flying) { SetFlightVisuals(val4, lookDir, magnitude / 60f); } ((Character)localPlayer).SetRun(false); zanim.SetBool("inWater", flag4); if (num2 > 0f) { ((Character)localPlayer).UseStamina(Fairy.ModifyFlightStaminaUse(num2)); } if (m_flying) { if (val5.y < -20f) { val5.y = -20f; } else if (val5.y > 16f) { val5.y = 16f; } } else { val5.y = body.velocity.y; if (heightAboveSolid < 5f && body.velocity.y < -0.5f) { WDBUG.Log("Applying parachute", WDBUG.Level.Flight); val5.y *= 0.98f; } } m_airVelocity = val5; p_currentVel = val5; body.velocity = val5; return true; } val = (p_currentVel = (body.velocity = Vector3.zero)); return true; } public static void SetCrouch(bool crouth, bool toggle = false) { if (toggle || crouth != ((Character)Player.m_localPlayer).IsCrouching()) { SetControls(); } } public static void Jump(bool fake = false) { if (fake) { ((Component)Player.m_localPlayer).GetComponent().SetTrigger("jump"); } else { SetControls(jump: true); } } public static void SetControls(bool jump = false, bool crouch = false, bool block = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) Player.m_localPlayer.SetControls(Vector3.zero, false, false, false, false, block, block, jump, crouch, false, false, false); } public static string FlyingLesson() { string text = WUTIL.KeyHighlightText("Jump"); string text2 = WUTIL.KeyHighlightText("Block"); string text3 = WUTIL.KeyHighlightText("Crouch"); if (WDBUG.SimpleFlight) { return text + " Takeoff / Assend\n" + text2 + " Descend\n" + text3 + " Quick Land"; } string text4 = WUTIL.KeyHighlightText("Sit"); return text + " Takeoff / Assend\n" + text3 + " Descend\n" + text2 + " Air brace.\n" + text4 + " Quick Land"; } public static float GetHeightAboveSolid(Vector3 position, float liftUp = 0f, float maxDepth = 100f) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_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) position.y += liftUp; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, Vector3.down, ref val, maxDepth, WUTIL.c_solidRayMask)) { return position.y - liftUp - ((RaycastHit)(ref val)).point.y; } return maxDepth + 1f; } public static float GetCeilingHeight(Vector3 position, float maxHeight = 8f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_001b: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, Vector3.up, ref val, maxHeight, WUTIL.c_coverRayMask)) { return ((RaycastHit)(ref val)).point.y; } return maxHeight + position.y; } private static bool UpdateWireMotion(ZSyncAnimation zanim) { //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_wireTran == (Object)null) { return false; } if (WUTIL.GetButton("Jump")) { return false; } float fixedDeltaTime = Time.fixedDeltaTime; Transform transform = ((Component)Player.m_localPlayer).transform; if (m_wireMaxSideStep > 0f) { int num = (WUTIL.GetButton("Left") ? (-1) : (WUTIL.GetButton("Right") ? 1 : 0)); if (num != 0) { m_wireLock += (float)num * fixedDeltaTime * m_wireTran.right; m_wireSideStep += fixedDeltaTime; WDBUG.Log("Ladder sidestep " + ((num > 0) ? "right" : "left"), WDBUG.Level.Treehouse); transform.rotation = Quaternion.Slerp(transform.rotation, m_wireTran.rotation, 4f * fixedDeltaTime); zanim.SetBool("encumbered", true); transform.position = m_wireLock; return m_wireSideStep >= 0f - m_wireMaxSideStep && m_wireSideStep <= m_wireMaxSideStep; } } if (WUTIL.Timer("ladder_step_motion") > 0f) { float num2 = WUTIL.Timer("ladder_step_motion"); m_wireLock += (float)m_wireMoveDir * fixedDeltaTime * m_wireStep; float num3 = fixedDeltaTime * Mathf.Cos((float)Math.PI * num2 / m_wireStepTime) * ((m_wireMoveDir > 0) ? (-1f) : 1f); m_wireLock.y += num3; transform.position = m_wireLock; transform.rotation = Quaternion.Slerp(transform.rotation, m_stepRotation, 4f * fixedDeltaTime); return true; } if (WUTIL.GetButton("Crouch") || ((Character)Player.m_localPlayer).IsCrouching()) { SetControls(jump: false, crouch: false, block: true); m_wireSlideDown = m_wireCrouchToSlideDown; if (!m_wireCrouchToSlideDown) { return false; } } if (m_wireSlideDown) { m_wireMoveDir = -1; DisableGroundHitDamage(); } if (m_wireTriggerSwitch) { m_wireTriggerSwitch = false; return Object.op_Implicit((Object)(object)SwitchLadder(m_wireMoveDir > 0)); } transform.position = m_wireLock; if (m_wireSlideDown) { m_wireLock -= 4f * fixedDeltaTime * m_wireStep; if (m_hitGround || transform.position.y <= w_wireCheckBot) { m_wireTriggerSwitch = Object.op_Implicit((Object)(object)SwitchLadder(above: false, check: true)); if (!m_wireTriggerSwitch) { WDBUG.Log("Ladder slide complete", WDBUG.Level.Treehouse); Jump(fake: true); return m_wireSlideDown = false; } } } m_wireMoveDir = 0; if (WUTIL.GetButton("Backward")) { if (transform.position.y <= w_wireCheckBot) { m_wireTriggerSwitch = Object.op_Implicit((Object)(object)SwitchLadder(above: false, check: true)); if (!m_wireTriggerSwitch) { WDBUG.Log("Ladder step off bottom", WDBUG.Level.Treehouse); Jump(fake: true); return false; } } m_wireMoveDir = -1; WDBUG.Log("Ladder step down", WDBUG.Level.Treehouse); Jump(fake: true); } else if (WUTIL.GetButton("Forward")) { if (transform.position.y >= w_wireCheckTop) { if (m_wireTopBlocked || m_wireTopNoJump) { WDBUG.Log("Ladder top blocked", WDBUG.Level.Treehouse, 1f); return true; } if (!Object.op_Implicit((Object)(object)SwitchLadder(above: true, check: true))) { WDBUG.Log("Ladder jump off top", WDBUG.Level.Treehouse); Jump(); return false; } m_wireTriggerSwitch = true; } m_wireMoveDir = 1; WDBUG.Log("Ladder step up", WDBUG.Level.Treehouse); Jump(fake: true); } if (m_wireMoveDir != 0) { WUTIL.TimerReset("ladder_step_motion", m_wireStepTime + fixedDeltaTime); } m_wireTopNoJump = false; return true; } private static Ladder SwitchLadder(bool above, bool check = false) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (above ? m_wireTop : (2f * m_wireBase - m_wireTop)); Collider[] array = Physics.OverlapSphere(val, 1f, WUTIL.c_pieceRayMask); foreach (Collider val2 in array) { Transform parent = ((Component)val2).transform.parent; if ((Object)(object)parent == (Object)null || WUTIL.GameName(((Component)parent).gameObject) != "TreehouseLadder") { continue; } float num = Vector3.Distance(val, parent.position); if (num < 0.1f) { Ladder component = ((Component)parent).GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log($"Failed to get ladder from top: {above} to TreehouseLadder at dist: {num}"); return null; } if (!check) { WDBUG.Log($"Transferring to ladder {num} " + (above ? "above" : "below"), WDBUG.Level.Treehouse); m_wireSteps = 0; component.Interact((Humanoid)(object)Player.m_localPlayer, false, false); } return component; } } return null; } public static void DisableColliders(Character character, Transform transform, bool disable = true) { if ((Object)(object)transform == (Object)null) { return; } CapsuleCollider component = ((Component)character).GetComponent(); if ((Object)(object)transform.parent != (Object)null) { transform = transform.parent; } if ((Object)(object)component != (Object)null && (Object)(object)((Component)transform).gameObject != (Object)null) { Collider[] componentsInChildren = ((Component)transform).gameObject.GetComponentsInChildren(); WDBUG.Log($"Colliders disable: {disable} for {componentsInChildren.Length} colliders of {((Object)((Component)transform).gameObject).name}", WDBUG.Level.Treehouse); Collider[] array = componentsInChildren; foreach (Collider val in array) { Physics.IgnoreCollision((Collider)(object)component, val, disable); } character.ResetCloth(); } } private static void SetFlightVisuals(Vector3 moveDir, Vector3 lookDir, float pitchFactor = 0f) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) float num = 80f * Mathf.Clamp01(pitchFactor); Player localPlayer = Player.m_localPlayer; Quaternion localRotation; if (lookDir == Vector3.zero) { localRotation = ((Component)localPlayer).transform.localRotation; Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles; ((Component)localPlayer).transform.localRotation = Quaternion.Euler(0f, eulerAngles.y, 0f); return; } float fixedDeltaTime = Time.fixedDeltaTime; bool flag = moveDir != Vector3.zero; bool button = WUTIL.GetButton("Right"); bool button2 = WUTIL.GetButton("Left"); Quaternion val = Quaternion.LookRotation(lookDir); if (button || button2) { if (!(button && button2) && flag) { val = Quaternion.LookRotation(moveDir); if (Mathf.Abs(Utils.GetYawDeltaAngle(((Component)localPlayer).transform.rotation, val)) > 0.001f) { ((Component)localPlayer).transform.rotation = Quaternion.RotateTowards(((Component)localPlayer).transform.rotation, val, 100f * fixedDeltaTime); } float num2 = 1f - Mathf.Abs(Vector3.Dot(moveDir, lookDir)); if (num2 > 0.98f) { pitchFactor = 0f; } ((Character)localPlayer).SetLookDir(Vector3.RotateTowards(lookDir, moveDir, num2 * 100f * ((float)Math.PI / 180f) * fixedDeltaTime, 0f), 0f); } } else { ((Component)localPlayer).transform.rotation = Quaternion.RotateTowards(((Component)localPlayer).transform.rotation, val, 300f * fixedDeltaTime); } if (flag && pitchFactor > 0.001f) { localRotation = ((Component)localPlayer).transform.localRotation; Vector3 eulerAngles2 = ((Quaternion)(ref localRotation)).eulerAngles; if (eulerAngles2.x < num) { ((Component)localPlayer).transform.localRotation = Quaternion.Euler(num * (float)Math.Sign(Vector3.Dot(lookDir, moveDir)), eulerAngles2.y, eulerAngles2.z); } } } } internal class TreePortal { [HarmonyPatch(typeof(TreeBase), "Damage")] private class PatchTreeBaseDamage { public static bool Prefix(TreeBase __instance, HitData hit, ZNetView ___m_nview) { return !TreeStrike(__instance, hit, ___m_nview); } } [HarmonyPatch(typeof(Humanoid), "DrainEquipedItemDurability")] private class PatchHumanoidDrainEquipedItemDurability { public static void Prefix(Humanoid __instance, ItemData item) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (item.m_durability <= 0f && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && WUTIL.ItemName(item) == "SurtlingSpike") { WUTIL.PlaceObject("SurtlingCore", WUTIL.HandTransform().position); WUTIL.Message("Broken Surtling spike reverted to a core", center: false); } } } [HarmonyPatch(typeof(TreeBase), "SpawnLog")] private class PatchTreeBaseSpawnLog { public static void Postfix(TreeBase __instance) { //IL_000c: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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) int num = DestroyPortalsInTreeTrunk(__instance.m_trunk.transform.position); if (num > 0) { WDBUG.Log($"Spawning {num} cores for destroyed portals", WDBUG.Level.SurtlingSpike); ForceUpdate(); WUTIL.Spawn("SurtlingCore", __instance.m_trunk.transform.position + Vector3.up, Quaternion.identity, num); } } } [HarmonyPatch(typeof(Teleport), "Interact")] public class PatchTeleportInteract { public static bool Prefix(Teleport __instance, Humanoid character, bool hold, ref bool __result) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) if (hold || (Object)(object)__instance.m_targetPoint == (Object)null || WUTIL.Timer("destroyTreePortalDelay") > 0f) { __result = false; return false; } Transform transform = ((Component)__instance.m_targetPoint).transform; m_teleportToPos = transform.position + transform.forward - transform.up; m_teleportFromPos = ((Component)character).transform.position; m_lastRemovedPos = Vector3.zero; WDBUG.Log($"Teleport portal to {m_teleportToPos} from {m_teleportFromPos}", WDBUG.Level.TreePortal); return true; } } [HarmonyPatch(typeof(TeleportWorld), "UpdatePortal")] public class PatchTeleportWorldUpdatePortal { public static void Postfix(TeleportWorld __instance) { //IL_001c: 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_0039: 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) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer != (Object)null && TeleporterIsTreePortal(__instance) && m_lastRemovedPos != ((Component)__instance).transform.position && Vector3.Distance(((Component)__instance).transform.position, ((Component)Player.m_localPlayer).transform.position) < 5f && MapMarker.MarkMap(((Component)__instance).transform.position)) { WDBUG.Log("Automap TreePortal", WDBUG.Level.TreePortal); } } } [HarmonyPatch(typeof(TeleportWorld), "Interact")] private class PatchTeleportWorldInteract { public static bool Prefix(TeleportWorld __instance, ref bool __result) { if (TeleporterIsTreePortal(__instance)) { Quest.AdvanceAchievement("Treeportal"); __result = false; return false; } return true; } } [HarmonyPatch(typeof(TeleportWorld), "GetHoverText")] private class PatchTeleportWorldGetHoverText { public static bool Prefix(TeleportWorld __instance, ref string __result) { return !GetHoverText(__instance, ref __result); } } [HarmonyPatch(typeof(TeleportWorld), "Teleport")] private class PatchTeleportWorldTeleport { private static bool m_debounce; public static bool Prefix(TeleportWorld __instance) { if (Fairy.ElderSightActive()) { WDBUG.Log($"TeleportFromMap debounce: {m_debounce}", WDBUG.Level.TreePortal); if (m_debounce) { m_debounce = false; } else { MapMarker.TeleportFromMap(toPortal: true); m_debounce = true; } return false; } m_debounce = false; if (m_restrictedPortal != "") { if (!(__instance.GetText() == m_restrictedPortal)) { WDBUG.Log("Restricted Treeportal disallowed"); return false; } WDBUG.Log("Restricted Treeportal allowed", WDBUG.Level.TreePortal); Quest.SetAchievement("RaftsPlaced", 0); m_restrictedPortal = ""; } return true; } public static void Postfix(TeleportWorld __instance, Player player, ZNetView ___m_nview) { //IL_0025: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_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_005a: 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) //IL_0064: 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_0075: 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_0089: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)(object)Player.m_localPlayer && ((Character)player).IsTeleporting()) { m_teleportFromPos = ((Component)player).transform.position; ZDO zDO = ZDOMan.instance.GetZDO(___m_nview.GetZDO().GetConnectionZDOID((ConnectionType)1)); m_teleportToPos = ((zDO == null) ? m_teleportFromPos : (zDO.GetPosition() + zDO.GetRotation() * Vector3.forward + Vector3.up)); WDBUG.Log($"TeleportWorld portal to {m_teleportToPos} from {m_teleportFromPos}", WDBUG.Level.TreePortal); } } } [HarmonyPatch(typeof(Player), "ShowTeleportAnimation")] public class PatchPlayerShowTeleportAnimation { public static void Postfix(ref bool __result, bool ___m_teleporting) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (__result && m_disableTeleportAnimation) { __result = false; } else if (!___m_teleporting) { m_disableTeleportAnimation = false; if (m_postTeleportHeight > 0f) { Vector3 position = ((Component)Player.m_localPlayer).transform.position; position.y = m_postTeleportHeight; m_postTeleportHeight = 0f; ((Component)Player.m_localPlayer).transform.position = position; } } } } [HarmonyPatch(typeof(ZDOMan), "CreateNewZDO", new Type[] { typeof(ZDOID), typeof(Vector3), typeof(int) })] private class PatchZDOMan { public static void Postfix(int prefabHashIn, ZDO __result) { //IL_0026: 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_003d: Unknown result type (might be due to invalid IL or missing references) if (((prefabHashIn != 0) ? prefabHashIn : __result.GetPrefab()) == m_treePortalID) { m_allTreePortals.Add(__result); MarkPositionIfAvailable(__result.GetPosition()); WDBUG.Log("Added Tree Portal to list at " + ((object)__result.GetPosition()/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.TreePortal); } } } [HarmonyPatch(typeof(ZDOMan), "HandleDestroyedZDO")] private class PatchZDOManHandleDestroyedZDO { public static void Prefix(ZDOMan __instance, ZDOID uid) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) ZDO zDO = __instance.GetZDO(uid); if (zDO != null && zDO.GetPrefab() == m_treePortalID) { string text = zDO.GetString(ZDOVars.s_tag, ""); bool flag = m_portalsToRemove.Contains(text); WDBUG.Log($"Deleting Tree Portal (tagged: {flag}) and to remove partner by tag {text}", WDBUG.Level.TreePortal); if (!flag) { m_portalsToRemove.Add(text); } m_allTreePortals.Remove(zDO); MarkPositionAsAvailable(zDO.GetPosition()); } } } [HarmonyPatch(typeof(Game), "ConnectPortals")] private class PatchGameConnectPortals { public static void Postfix() { //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) if (WUTIL.Timer("newportalcooldown") == 0f) { int num = 0; ZDO[] array = m_allTreePortals.ToArray(); foreach (ZDO val in array) { string text = val.GetString(ZDOVars.s_tag, ""); bool flag = m_deleteAllPortals || m_portalsToRemove.Contains(text); if (!flag) { ZDOID connectionZDOID = val.GetConnectionZDOID((ConnectionType)1); if (((ZDOID)(ref connectionZDOID)).IsNone() || ZDOMan.instance.GetZDO(connectionZDOID) == null) { WDBUG.Log("Deleting unconnected Tree Portal " + text, WDBUG.Level.TreePortal); flag = true; } } if (flag) { Vector3 position = val.GetPosition(); MapMarker.TagForRemovalByPosition(position); MarkPositionAsAvailable(position); m_allTreePortals.Remove(val); val.SetOwner(ZDOMan.GetSessionID()); ZDOMan.instance.DestroyZDO(val); num++; } } if (num > 0) { WDBUG.Log($"Deleted {num} Tree Portals", WDBUG.Level.TreePortal); } m_deleteAllPortals = false; m_portalsToRemove.Clear(); } float num2 = WUTIL.Timer("autoTeleportDelay"); int num3 = 0; UpdateList(); foreach (ZDO allTreePortal in m_allTreePortals) { ZDOID connectionZDOID2 = allTreePortal.GetConnectionZDOID((ConnectionType)1); if (!((ZDOID)(ref connectionZDOID2)).IsNone()) { continue; } string text2 = allTreePortal.GetString(ZDOVars.s_tag, ""); foreach (ZDO allTreePortal2 in m_allTreePortals) { if (allTreePortal2 == allTreePortal || !(allTreePortal2.GetString(ZDOVars.s_tag, "") == text2)) { continue; } connectionZDOID2 = allTreePortal2.GetConnectionZDOID((ConnectionType)1); if (((ZDOID)(ref connectionZDOID2)).IsNone() && allTreePortal2.GetString(ZDOVars.s_tag, "") == text2) { allTreePortal.SetOwner(ZDOMan.GetSessionID()); allTreePortal2.SetOwner(ZDOMan.GetSessionID()); allTreePortal.SetConnection((ConnectionType)1, allTreePortal2.m_uid); allTreePortal2.SetConnection((ConnectionType)1, allTreePortal.m_uid); ZDOMan.instance.ForceSendZDO(allTreePortal.m_uid); ZDOMan.instance.ForceSendZDO(allTreePortal2.m_uid); num3++; if (num2 > 0f) { WDBUG.Log($"Reset delay for auto-portal connection at {num2}s", WDBUG.Level.TreePortal); WUTIL.TimerReset("autoTeleportDelay", 1.5f); } } } } if (num3 > 0) { WDBUG.Log($"Connected {num3} Tree Portals", WDBUG.Level.TreePortal); } } } public static Vector3 m_teleportToPos = Vector3.zero; public static Vector3 m_teleportFromPos = Vector3.zero; private const string c_portalPinNamePrefix = "wtp@"; private const string c_treePortalPrefab = "Wildling_TreePortal"; private const string c_secondaryPortalTarget = "Greydwarf_camp1"; private const float c_newPortalCooldown = 6f; private const float c_maxTreeWidth = 2.5f; private const float c_portalEmbed = 0.25f; private const float c_autoTeleportSyncDelay = 1.5f; private const bool c_applyPortalDamage = true; private static int m_treePortalID = StringExtensionMethods.GetStableHashCode("Wildling_TreePortal"); private static bool m_teleporting = false; private static bool m_postTeleportRemount = false; private static bool m_disableTeleportAnimation = false; private static bool m_deleteAllPortals = false; private static float m_autoDestructCountdown = 0f; private static float m_postTeleportHeight = 0f; private static string m_temporaryPortal = ""; private static string m_restrictedPortal = ""; private static string m_remotePortalObject = ""; private static Vector3 m_temporaryPortalPos = Vector3.zero; private static Vector3 m_autoTeleportPosition = Vector3.zero; private static Vector3 m_lastRemovedPos = Vector3.zero; private static Dictionary m_treePortalTargets = new Dictionary(); private static List m_petsToSummon = new List(); private static List m_portalTagPositions = new List(); private static List m_portalsToRemove = new List(); private static List m_allTreePortals = new List(); public static void TeleportPlayer(Vector3 toPos, bool allowImmediate = true, bool blackScreen = false, bool ground = true) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0089: 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_0073: Unknown result type (might be due to invalid IL or missing references) if (ground) { float val = default(float); Heightmap.GetHeight(toPos, ref val); toPos.y = Math.Max(0f, val); m_postTeleportHeight = 0f; } else { m_postTeleportHeight = toPos.y; } allowImmediate = allowImmediate && !blackScreen; float num = default(float); if (allowImmediate && ZNetScene.instance.IsAreaReady(toPos) && ZoneSystem.instance.FindFloor(toPos, ref num)) { ((Component)Player.m_localPlayer).transform.position = toPos; return; } m_disableTeleportAnimation = blackScreen; ((Character)Player.m_localPlayer).TeleportTo(toPos, ((Component)Player.m_localPlayer).transform.rotation, true); } public static bool TeleportToClosestPortal(Vector3 fromPoint, float maxDist = 25.6f) { //IL_0021: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) float num = maxDist; ZDO val = null; ZDO[] array = m_allTreePortals.ToArray(); foreach (ZDO val2 in array) { Vector3 position = val2.GetPosition(); position.y = fromPoint.y; float num2 = Vector3.Distance(fromPoint, position); if (num2 < num) { num = num2; val = val2; } } if (val == null) { return false; } Quaternion rotation = val.GetRotation(); Vector3 val3 = val.GetPosition() + rotation * Vector3.forward + 0.2f * Vector3.up; Player localPlayer = Player.m_localPlayer; ((Character)localPlayer).TeleportTo(val3, rotation, Vector3.Distance(val3, ((Component)localPlayer).transform.position) > 60f); Game.instance.IncrementPlayerStat((PlayerStatType)15, 1f); return true; } public static void RegisterTreeTargets(string treePrefab, string primaryTargets) { if (m_treePortalTargets.ContainsKey(treePrefab)) { Dictionary treePortalTargets = m_treePortalTargets; treePortalTargets[treePrefab] = treePortalTargets[treePrefab] + "," + primaryTargets; } else { m_treePortalTargets.Add(treePrefab, primaryTargets); } } public static void RegisterPortal() { if (!((Object)(object)Game.instance == (Object)null) && !Game.instance.PortalPrefabHash.Contains(m_treePortalID)) { WDBUG.Log("Adding Tree Portal prefab reference " + m_treePortalID, WDBUG.Level.AssetConfig); Game.instance.PortalPrefabHash.Add(m_treePortalID); } } public static bool TreeStrike(TreeBase instance, HitData hit, ZNetView m_nview) { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Invalid comparison between Unknown and I4 //IL_01a9: 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) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hit.GetAttacker() != (Object)(object)Player.m_localPlayer) { return false; } ItemData inventoryItemData = WUTIL.GetInventoryItemData("SurtlingSpike", mustBeEquipped: true); if (inventoryItemData == null) { return false; } string text = WUTIL.GameName(((Object)instance).name); if (!m_treePortalTargets.ContainsKey(text)) { WDBUG.Log("Ignoring stike on " + text, WDBUG.Level.SurtlingSpike); return false; } float num = m_nview.GetZDO().GetFloat("health", instance.m_health); float num2 = instance.m_minToolTier; Vector3 point = hit.m_point; Vector3 val = hit.m_point - ((Component)instance).transform.position; val.y = 0f; Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 eulerAngles = instance.m_trunk.transform.eulerAngles; WDBUG.Log($"{text} (tt:{num2}) TreeBase hit for {hit.m_damage.m_chop}/{num}hp", WDBUG.Level.SurtlingSpike); WDBUG.Log($"Hit pos: {point} radialDir: {val} tree euler: {eulerAngles}", WDBUG.Level.SurtlingSpike); point.y = ((Component)Player.m_localPlayer).transform.position.y; Vector3 val2 = point - 0.25f * normalized; if (text == "SwampTree1") { val2 -= 0.5f * normalized; } if ((int)hit.m_skill != 7) { if (text.StartsWith("Oak") || text.StartsWith("Birch")) { WDBUG.Log("Strong tree is resistant", WDBUG.Level.SurtlingSpike); hit.ApplyModifier(0.5f); } } else if (hit.m_damage.m_chop >= num) { WUTIL.Message("Tree was too weak to contain the portal."); } else { if (MarkPositionIfAvailable(val2)) { Quest.TrackPlacement("TreePortal"); if (CreatePortalPair(val2, normalized, m_treePortalTargets[text])) { ((Humanoid)Player.m_localPlayer).UnequipItem(inventoryItemData, false); ((Humanoid)Player.m_localPlayer).GetInventory().RemoveItem(inventoryItemData); Quest.AdvanceAchievement("Treeportal", 5); } return false; } WUTIL.Message("Tree was too weak to contain another portal."); hit.m_damage.m_chop = 2f * num; } hit.m_skill = (SkillType)0; return false; } public static bool CreatePortalPair(Vector3 fromPos, Vector3 inDir, string targetLocation, bool useSecondary = true, bool markMap = true) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_01b3: Unknown result type (might be due to invalid IL or missing references) if (!ZNet.instance.IsServer()) { Quaternion val = Quaternion.LookRotation(inDir); int num = 360 + (int)((Quaternion)(ref val)).eulerAngles.y; World.SendServerRequest("Portal", targetLocation + (useSecondary ? '=' : ':') + num, fromPos); return true; } if (targetLocation == "StartWildling") { Vector3 val2 = 0.05f * Vector3.forward - Vector3.up; if (CreatePortalPair(fromPos, ((Vector3)(ref val2)).normalized, inDir, "Greydwarf_camp1", useSecondary: true, 10f, 5f, floorPortal: true)) { WDBUG.Log($"Set starting game entry portal to {fromPos}", WDBUG.Level.TreePortal); return true; } WDBUG.Log("ERROR: Failed to create game entry portal pair!"); return false; } if (targetLocation == "GDKing") { if (CreatePortalPair(fromPos, inDir, inDir, targetLocation, useSecondary: false, 30f)) { WDBUG.Log($"Created portal to GDKing {fromPos}", WDBUG.Level.TreePortal); return true; } WDBUG.Log("Failed to The Elder quest portal"); return false; } if (!CreatePortalPair(fromPos, inDir, inDir, targetLocation, useSecondary)) { return false; } if (markMap) { MapMarker.AddPin(fromPos, "TreePortal"); MapMarker.AddPin(m_teleportToPos, "TreePortal"); } return true; } public static bool CreatePortalPair(Vector3 fromPos, string targetLocation) { //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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 val = Vector3.forward; bool useSecondary = true; int num = targetLocation.IndexOf('='); if (num < 0) { num = targetLocation.IndexOf(':'); useSecondary = num < 0; } if (num > 0) { if (!int.TryParse(targetLocation.Substring(num + 1), out var result)) { WDBUG.Log("CreatePortalPair: failed to parse angle from: " + targetLocation); result = 0; } targetLocation = targetLocation.Remove(num); val = Quaternion.Euler(0f, (float)result, 0f) * val; } return CreatePortalPair(fromPos, val, targetLocation, useSecondary, markMap: false); } public static bool TeleporterIsTreePortal(TeleportWorld instance) { return !((Object)(object)instance == (Object)null) && instance.GetText().StartsWith("wtp@"); } public static bool GetHoverText(TeleportWorld instance, ref string text) { if (TeleporterIsTreePortal(instance)) { text = "Teleport to a distant Greyling portal."; return true; } return false; } public static void Update() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (WUTIL.TimerIsAlmost("autoTeleportDelay", 0f)) { if (((Character)localPlayer).IsTeleporting()) { WUTIL.TimerReset("autoTeleportDelay", 1f); } else { ((Character)localPlayer).TeleportTo(m_autoTeleportPosition + ((Component)localPlayer).transform.forward, ((Component)localPlayer).transform.rotation, true); Wildling.ToggleWildling(1.5f); WUTIL.Message("Keep your head down, remember to sleep, and get ready to run!"); } } float num = WUTIL.Timer("destroyTreePortalDelay"); if (((Character)localPlayer).IsTeleporting()) { if (m_autoDestructCountdown > 0f) { if (Vector3.Distance(m_temporaryPortalPos, m_teleportFromPos) < 2f) { WUTIL.TimerReset("destroyTreePortalDelay", m_autoDestructCountdown); m_autoDestructCountdown = 0f; } } else if (WUTIL.TimeIsAlmost(num)) { WUTIL.TimerReset("destroyTreePortalDelay", 1f); WDBUG.Log($"Destroy teleporter m_autoDestructCountdown: {m_autoDestructCountdown} autoDestuctTime: {num}"); } if (!m_teleporting) { Vector3 val = m_teleportToPos - m_teleportFromPos; ElderWand.TeleportArmy(val); if (Math.Abs(val.y) > 2000f) { FindPetsToSummon(); } else { Riding.Teleport(); m_postTeleportRemount = true; } } m_teleporting = true; return; } if (m_teleporting) { m_teleporting = false; PostTeleport(); } if (num > 0f) { if (Quest.GetAchievement("QuestElder") == 4) { Quest.SetAchievement("QuestElder", 5); } else if (Quest.GetAchievement("MainTutorial") < 4) { Quest.ShowMainTutorial(2, 120f); } if (WUTIL.TimeIsAlmost(num)) { WDBUG.Log("Marking " + m_temporaryPortal + " for destruction", WDBUG.Level.TreePortal); m_portalsToRemove.Add(m_temporaryPortal); m_temporaryPortal = ""; } } } public static bool MarkPositionIfAvailable(Vector3 position, bool justCheck = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) string text = PortalTag(position); if (m_portalTagPositions.Contains(text)) { WDBUG.Log("Portal already marked at: " + text, WDBUG.Level.TreePortal); return false; } if (!justCheck) { WDBUG.Log("Portal newly marked at: " + text, WDBUG.Level.TreePortal); m_portalTagPositions.Add(text); } return true; } public static int DestroyPortalsInTreeTrunk(Vector3 treeStrikePosition, bool limitHeight = false) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!limitHeight) { treeStrikePosition.y = 0f; } int num = 0; Vector3 val = default(Vector3); foreach (string portalTagPosition in m_portalTagPositions) { string[] array = portalTagPosition.Substring("wtp@".Length).Split(new char[1] { ':' }); ((Vector3)(ref val))..ctor((float)int.Parse(array[0]), (float)(limitHeight ? int.Parse(array[1]) : 0), (float)int.Parse(array[2])); if (Vector3.Distance(treeStrikePosition, val) < 2.5f) { WDBUG.Log("Marking portal " + portalTagPosition + " for deletion", WDBUG.Level.TreePortal); m_portalsToRemove.Add(portalTagPosition); num++; } } return num; } public static void RestrictToPortal(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) m_restrictedPortal = ((position == Vector3.zero) ? "" : PortalTag(position)); } public static void DeleteAll() { m_deleteAllPortals = true; } public static void SetLastPortalRemovedPos(Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) m_lastRemovedPos = pos; } public static bool FindClosestLocation(string locationName, Vector3 fromPoint, out Vector3 toPosition, float maxDist = 9999f, float minDist = 12f) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0051: Unknown result type (might be due to invalid IL or missing references) float num = maxDist; toPosition = fromPoint; foreach (Vector3 locationPosition in World.GetLocationPositions(locationName)) { if (MarkPositionIfAvailable(locationPosition, justCheck: true)) { float num2 = Vector3.Distance(locationPosition, fromPoint); if (num2 >= minDist && num2 < num) { num = num2; toPosition = locationPosition; } } } return num < maxDist; } private static void PostTeleport() { Wildling.BroadcastStatus(); SummonPets(); } private static void FindPetsToSummon(float range = 10f, float behindOffset = 8f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_002e: 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_0082: Unknown result type (might be due to invalid IL or missing references) m_petsToSummon.Clear(); Transform transform = ((Component)Player.m_localPlayer).transform; Vector3 val = transform.position - behindOffset * transform.forward; foreach (Character allCharacter in Character.GetAllCharacters()) { if (!allCharacter.IsPlayer() && allCharacter.IsTamed() && Alignment.IsFollowing(allCharacter) && !(WUTIL.ActorName(allCharacter) == "Ygnie") && Vector3.Distance(val, ((Component)allCharacter).transform.position) <= range) { if (Riding.IsRiding(allCharacter)) { m_postTeleportRemount = true; } m_petsToSummon.Add(allCharacter); } } } private static void SummonPets() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)Player.m_localPlayer).transform; foreach (Character item in m_petsToSummon) { ((Component)item).transform.position = WUTIL.OnCircle(transform.position, 1f, 1, ground: true, 1f) + 2f * transform.forward; } m_petsToSummon.Clear(); if (m_postTeleportRemount) { m_postTeleportRemount = false; Riding.Remount(); } } private static bool CreatePortalPair(Vector3 fromPos, Vector3 inDir, Vector3 outDir, string targetLocation, bool useSecondary = true, float autoDestructAfter = 0f, float autoTeleportAfter = 0f, bool floorPortal = false, float outDist = 0f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005c: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) if (!GetConnectedTarget(targetLocation, fromPos, out m_teleportToPos, useSecondary)) { WDBUG.Log("Failed to find suitable location for remote portal"); return false; } WUTIL.TimerReset("newportalcooldown", 6f); string text = PortalTag(fromPos); GameObject val = WUTIL.PlaceObject("TreePortal", fromPos, inDir); MarkPositionIfAvailable(m_teleportToPos); if (floorPortal) { ((Component)val.transform.Find("GuidePoint")).gameObject.SetActive(false); ((Component)val.transform.Find("_target_found_red")).gameObject.SetActive(false); ((Component)val.transform.Find("New/Black_suck_inactive")).gameObject.SetActive(false); ((Component)val.transform.Find("New/Black_spin_inactive")).gameObject.SetActive(false); ((Component)val.transform.Find("New/emission_inactive")).gameObject.SetActive(false); ((Component)val.transform.Find("New/floor_emission")).gameObject.SetActive(true); } if (autoDestructAfter > 0f) { WDBUG.Log($"Set portal {text} at {fromPos} for autodestuction in {autoDestructAfter}s", WDBUG.Level.TreePortal); m_autoDestructCountdown = autoDestructAfter; m_temporaryPortal = text; m_temporaryPortalPos = fromPos; WDBUG.Log($"Portal {text} set to auto-destruct after {autoDestructAfter}s", WDBUG.Level.TreePortal); } TeleportWorld component = val.GetComponent(); component.SetText(text); WDBUG.Log($"Created local portal target {text} at {fromPos.x}, {fromPos.y}, {fromPos.z}", WDBUG.Level.TreePortal); m_teleportFromPos = fromPos; GameObject val2 = WUTIL.PlaceObject("TreePortal", m_teleportToPos + outDist * outDir, outDir); if (floorPortal) { ((Component)val2.transform.Find("GuidePoint")).gameObject.SetActive(false); } if (m_remotePortalObject != "") { Transform transform = val2.transform; bool flag = m_remotePortalObject == "SwampTree2"; WUTIL.Spawn(m_remotePortalObject, transform.position + (flag ? 0.15f : (-0.2f)) * transform.forward, Quaternion.LookRotation(flag ? transform.right : transform.forward), 1, 0f, ground: true); m_remotePortalObject = ""; } TeleportWorld component2 = val2.GetComponent(); component2.SetText(text); WDBUG.Log($"Created remote portal {text} at {m_teleportToPos}", WDBUG.Level.TreePortal); if (autoTeleportAfter > 0f) { WUTIL.TimerReset("autoTeleportDelay", autoTeleportAfter); m_autoTeleportPosition = m_teleportToPos; WDBUG.Log("Portal " + text + " set for auto-teleport to remote target", WDBUG.Level.TreePortal); } return true; } private static string PortalTag(Vector3 position) { //IL_0016: 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_0034: Unknown result type (might be due to invalid IL or missing references) return string.Format("{0}{1}:{2}:{3}", "wtp@", (int)position.x, (int)position.y, (int)position.z); } private static void MarkPositionAsAvailable(Vector3 position) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) m_portalTagPositions.Remove(PortalTag(position)); } private static bool GetConnectedTarget(string primaryTarget, Vector3 fromPosition, out Vector3 teleportToPos, bool useSecondary = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) teleportToPos = fromPosition; if (PortalOverride(ref teleportToPos)) { return true; } WUTIL.ResetRandomSeed((int)fromPosition.x * 100000 + (int)fromPosition.z); float num = Random.Range(0f, (float)Math.PI * 2f); WUTIL.ResetRandomSeed(); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num)); float num2 = Mathf.Min(((Vector3)(ref fromPosition)).magnitude + (float)WUTIL.DieRoll(1000), 99999f); fromPosition = val * num2; if (!FindClosestLocation(primaryTarget, fromPosition, out teleportToPos)) { WDBUG.Log("Failed to find primary portal target " + primaryTarget + " ", WDBUG.Level.TreePortal); return false; } WDBUG.Log($"Primary portal target {primaryTarget} found at {teleportToPos}", WDBUG.Level.TreePortal); if (useSecondary && primaryTarget != "Greydwarf_camp1") { if (!FindClosestLocation("Greydwarf_camp1", teleportToPos, out teleportToPos)) { WDBUG.Log("Failed to find secondary portal target Greydwarf_camp1 ", WDBUG.Level.TreePortal); return false; } WDBUG.Log(string.Format("Secondary portal target {0} found at {1}", "Greydwarf_camp1", teleportToPos), WDBUG.Level.TreePortal); } return true; } private static bool PortalOverride(ref Vector3 target) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target; string text = Quest.PortalOverride(ref target); if (text == "") { return false; } if (WUTIL.WithinCylinder(val, target, 400f)) { WDBUG.Log("Portal override to " + text + " too close to current location", WDBUG.Level.TreePortal); } else { WDBUG.Log($"Checking {text} portal override at {target} vs. {val}", WDBUG.Level.TreePortal); if (FindClosestLocation("Greydwarf_camp1", target, out target, 400f)) { return true; } bool flag = text == "LokiDungeon"; if (flag || text == "GreatOak") { Vector3 val2 = target; if (FindClosestLocation(flag ? "AbandonedLogCabin" : "SunkenCrypt4", target, out target, 400f)) { Vector3 val3 = target; float num = (flag ? 6 : 12); Vector3 val4 = val2 - target; target = val3 + num * ((Vector3)(ref val4)).normalized; if (MarkPositionIfAvailable(target, justCheck: true)) { m_remotePortalObject = (flag ? "FirTree" : "SwampTree2"); return true; } WDBUG.Log($"Secondary {text} portal override blocked at {target}", WDBUG.Level.TreePortal); } } target = val; } WDBUG.Log("Portal override to " + text + " not available", WDBUG.Level.TreePortal); return false; } private static void ForceUpdate() { List list = new List(); int num = 0; while (!ZDOMan.instance.GetAllZDOsWithPrefabIterative("Wildling_TreePortal", list, ref num)) { } } private static void UpdateList(bool force = false) { if (force) { m_allTreePortals.Clear(); } if (m_allTreePortals.Count != 0) { return; } foreach (ZDO portal in ZDOMan.instance.GetPortals()) { if (portal.GetPrefab() == m_treePortalID && !m_allTreePortals.Contains(portal)) { m_allTreePortals.Add(portal); } } WDBUG.Log("Relocated " + m_allTreePortals.Count + " Tree Portals", WDBUG.Level.TreePortal); } } internal class MapMarker { [HarmonyPatch(typeof(Minimap), "UpdatePins")] private class PatchMinimapUpdatePins { private static void Prefix(List ___m_pins) { MinimapRefresh(___m_pins); } private static void Postfix(List ___m_pins) { MinimapUpdate(___m_pins); } } [HarmonyPatch(typeof(Minimap), "AddPin")] private class PatchMinimapAddPin { private static void Postfix(PinData __result) { UpdateShareLocation(__result); } } [HarmonyPatch(typeof(Minimap), "RemovePin", new Type[] { typeof(PinData) })] private class PatchMinimapRemovePin { private unsafe static void Prefix(PinData pin) { //IL_0021: 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_004a: Unknown result type (might be due to invalid IL or missing references) if (GetMarkerNameSubject(pin.m_name) == "TreePortal") { Vector3 pos = pin.m_pos; WDBUG.Log("Removing Teleport marker @" + ((object)(*(Vector3*)(&pos))/*cast due to .constrained prefix*/).ToString(), WDBUG.Level.MapMarker); TreePortal.SetLastPortalRemovedPos(pin.m_pos); } m_markerPins.Remove(pin); } } [HarmonyPatch(typeof(Minimap), "OnMapLeftClick")] private class PatchMinimapOnMapLeftClick { private static void Postfix(Minimap __instance, float ___m_largeZoom) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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) if (!m_teleportFromMap) { return; } if (m_teleportToMapPortal) { float maxDist = __instance.m_removeRadius * ___m_largeZoom * 2f; if (TreePortal.TeleportToClosestPortal(m_teleportFromMapPos, maxDist)) { Minimap.instance.SetMapMode((MapMode)1); } } else { Minimap.instance.SetMapMode((MapMode)1); Transform transform = ((Component)Player.m_localPlayer).transform; int num = (int)(0.5f + WUTIL.GroundDistance(transform.position, m_teleportFromMapPos)); Vector3 toPos = default(Vector3); ((Vector3)(ref toPos))..ctor(m_teleportFromMapPos.x, transform.position.y, m_teleportFromMapPos.z); WUTIL.Message($"Teleporting {num} paces", center: false, null, blockNext: true); TreePortal.TeleportPlayer(toPos); } } } [HarmonyPatch(typeof(Minimap), "ScreenToWorldPoint")] private class PatchMinimapScreenToWorldPoint { private static void Postfix(Vector3 __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) m_teleportFromMapPos = __result; } } [HarmonyPatch(typeof(Minimap), "GetClosestPin")] private class PatchMinimapGetClosestPin { private static void Postfix(PinData __result) { if (m_teleportToMapPortal && __result != null && __result.m_ownerID == 0) { __result.m_checked = !__result.m_checked; } } } [HarmonyPatch(typeof(Minimap), "SetMapMode")] private class PatchMinimapSetMapMode { private static void Prefix(MapMode mode) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 if (m_teleportFromMap && mode != Minimap.instance.m_mode && (int)mode == 1) { m_teleportFromMap = false; m_teleportToMapPortal = false; } } } [HarmonyPatch(typeof(Minimap), "UpdateMap")] private class PatchMinimapUpdateMap { private static void Prefix(Minimap __instance, Player player, bool takeInput, ref bool ___m_pinUpdateRequired) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 if (takeInput && (Object)(object)player == (Object)(object)Player.m_localPlayer) { __instance.m_minZoom = (((int)__instance.m_mode == 1 && Wildling.IsWildling) ? m_miniMapZoom : 0.01f); m_pinMinimapRadarScale = 500f * __instance.m_minZoom; if (Wildling.IsWildling) { ___m_pinUpdateRequired = true; } } } } public const int c_typePlace = 0; public const int c_typeScent = 1; public const int c_typeElder = 2; public const int c_typeShare = 3; public const int c_typeActor = 4; private const string c_sharedLocationMarker = "OnionSeeds"; private const string c_sharedLocationIcon = "onionseeds"; private const string c_scentIdPrefix = "scent."; private const string c_pinRemoveMeName = " "; private const float c_pinMinSize = 0.5f; private const float c_pinPopupSize = 16f; private const float c_pinSmallPopupSize = 10f; private const float c_pinWindFactor = 0.5f; private const float c_pinAnimateTick = 0.1f; private const float c_pinPopupRate = 2f; private const float c_pinShrinkRate = 0.9f; private const float c_pinRadarPopupScale = 500f; private const float c_minTruffleSeparation = 20f; private const float c_digTruffleSeparation = 1f; private const float c_truffleMarkerRefresh = 3f; private const float c_hidingScentBuff = 0.2f; private const float c_rainScentFactor = 1.2f; private const float c_maxScentLevel = 10f; private const float c_scentLearnCooldown = 2f; private const float c_scentLearnRate = 0.05f; private const float c_highSenseLevel = 7f; private const int c_maxTrufflesTracked = 4; private static bool m_reloadPins = true; private static bool m_removeAllPins = false; private static bool m_teleportFromMap = false; private static bool m_teleportToMapPortal = false; private static float m_miniMapZoom = 0.004f; private static float m_pinMinimapRadarScale = 500f * m_miniMapZoom; private static string m_pinRemoveMeName = ""; private static Vector3 m_teleportFromMapPos = Vector3.zero; private static Dictionary m_scentMarkers = new Dictionary(); private static Dictionary m_scentDescriptions = new Dictionary(); private static Dictionary m_characterIcons = new Dictionary(); private static Dictionary m_namedMarkerRecipes = new Dictionary(); private static Dictionary m_senseCooldowns = new Dictionary(); private static Dictionary m_sharedLocations = new Dictionary(); private static List m_sharedMarkerNames = new List(); private static List m_markerPins = new List(); private static List m_removePositionMarkers = new List(); private static List m_burriedTruffles = new List(); public static void Reset() { m_characterIcons.Clear(); m_scentMarkers.Clear(); m_scentDescriptions.Clear(); m_sharedMarkerNames.Clear(); m_namedMarkerRecipes.Clear(); m_senseCooldowns.Clear(); m_sharedLocations.Clear(); m_markerPins.Clear(); m_removePositionMarkers.Clear(); m_burriedTruffles.Clear(); } public static void AddMarkerRecipes(int type, string markerRecipes) { bool flag = type == 1; bool flag2 = type == 3; bool flag3 = type == 2 || type == 4; string[] array = markerRecipes.Split(new char[1] { ';' }); foreach (string text in array) { string[] array2 = text.Split(new char[1] { ',' }); string text2 = array2[0]; if (flag) { if (m_scentMarkers.ContainsKey(text2)) { WDBUG.Log("Scent marker " + text2 + " already registered", WDBUG.Level.NonFatal); continue; } } else if (GetSubjectMarkerName(text2) != "") { WDBUG.Log("Named marker " + text2 + " already registered", WDBUG.Level.NonFatal); continue; } string value = ((array2.Length > 1) ? array2[1] : "0"); string text3 = ((array2.Length > 2) ? array2[2] : text2); int num = ((array2.Length > 3) ? int.Parse(array2[3]) : 0); if (flag2) { m_sharedMarkerNames.Add(text2); text3 = "OnionSeeds"; } if (flag3) { m_characterIcons.Add(text2, text3); } Sprite value2 = null; GameObject prefab = WUTIL.GetPrefab(text3); if ((Object)(object)prefab == (Object)null) { WDBUG.Log("AddRadarMarkers marker icon item " + text3 + " is not a prefab"); continue; } if ((Object)(object)prefab.GetComponent() != (Object)null) { if (num >= prefab.GetComponent().m_itemData.m_shared.m_icons.Length) { WDBUG.Log($"AddRadarMarkers invalid variant {num} for {text3}"); continue; } value2 = prefab.GetComponent().m_itemData.m_shared.m_icons[num]; } else if ((Object)(object)prefab.GetComponent() != (Object)null) { value2 = prefab.GetComponent().m_icon; } else { WDBUG.Log("AddRadarMarkers unsupported pin object " + text3 + " (has no icon)"); } if (flag) { WDBUG.Log($"Registered scent marker {text2} sprite from {text3} ({num})", WDBUG.Level.MapMarker); m_scentMarkers.Add(text2, value2); m_scentDescriptions.Add(text2, value); continue; } int num2 = m_namedMarkerRecipes.Count + 1; string text4 = ""; string text5 = ""; while (num2 > 0) { text4 = (((num2 & 1) == 0) ? ' ' : '\t') + text4; text5 = (((num2 & 1) == 0) ? '0' : '1') + text5; num2 >>= 1; } m_namedMarkerRecipes.Add(text4, text); string text6 = (flag2 ? "shared" : "hidden"); WDBUG.Log($"Registered {text6} marker {m_namedMarkerRecipes.Count} = %{text5} for {text}", WDBUG.Level.MapMarker); } } public static bool IsScentMarker(string marker) { return marker != "" && m_scentMarkers.ContainsKey(marker); } public static float CheckKnownScent(string name, float learn = 0f) { if (name == "") { return 0f; } name = "scent." + name; float num = Wildling.GetPlayerData(name); if (learn > 0f && num < 10f) { num = Mathf.Min(10f, num + learn); Wildling.SetPlayerData(name, num); } return num; } public static List GetKnownScents() { return Wildling.ListPlayerData("scent.", 1f); } public static void Update() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Minimap.instance == (Object)null || WUTIL.Timer("mapmarkers") > 0f) { return; } WUTIL.TimerReset("mapmarkers", 0.1f); ElderWand.ClearDeadTargetMarkers(); UpdateCharacterSenseCooldown(); UpdateTruffleMarkers(); bool flag = World.PlayerInInterior(); PinData[] array = m_markerPins.ToArray(); foreach (PinData val in array) { if (val == null || (int)val.m_type != 8) { continue; } if (val.m_name == null || val.m_name == " ") { Minimap.instance.RemovePin(val); m_markerPins.Remove(val); continue; } if ((Object)(object)val.m_icon == (Object)null) { if (!RepairPin(val)) { WDBUG.Log("Update deleting bad map pin " + PinDebug(val)); m_markerPins.Remove(val); Minimap.instance.RemovePin(val); continue; } WDBUG.Log("Update repaired pin " + PinDebug(val), WDBUG.Level.MapMarker); } if (!m_scentMarkers.ContainsValue(val.m_icon)) { if (!((Object)(object)val.m_uiElement == (Object)null)) { } } else if (val.m_doubleSize) { float num = ((val.m_name == "") ? 10f : 16f); val.m_worldSize *= 2f; if (val.m_worldSize < num) { val.m_worldSize = num; val.m_doubleSize = false; } } else if (val.m_worldSize > 0.5f) { val.m_worldSize *= 0.9f; Vector3 val2 = (flag ? WUTIL.RandomDir() : EnvMan.instance.GetWindForce()); val.m_pos += 0.5f * val2; } else { Minimap.instance.RemovePin(val); m_markerPins.Remove(val); } } } public static string GetSubjectMarkerName(string subject) { string value = subject + ","; foreach (string key in m_namedMarkerRecipes.Keys) { if (m_namedMarkerRecipes[key] == subject || m_namedMarkerRecipes[key].StartsWith(value)) { return key; } } return ""; } public static bool MarkMap(Vector3 position, string iconName = "TreePortal", bool openMap = false) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) bool flag = iconName != "" && !HavePinAtPosition(position); if (flag) { AddPin(position, iconName); } if (openMap) { Minimap.instance.ShowPointOnMap(position); } return flag; } public static void RemoveAllPins() { m_removeAllPins = true; m_sharedLocations.Clear(); } public static bool IsSharedLocation(string name) { return m_sharedLocations.ContainsKey(name); } public static Vector3 GetSharedLocation(string name) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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) return m_sharedLocations.ContainsKey(name) ? m_sharedLocations[name] : Vector3.zero; } public static void RemoveSharedLocation(string name) { if (!(name == "") && m_sharedLocations.ContainsKey(name)) { RemovePinByName(name); m_sharedLocations.Remove(name); } } public static bool WindCheckMarker(Vector3 position, string markerName, bool isSmall, float distFact) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) Vector3 displacement = ((Component)Player.m_localPlayer).transform.localPosition - position; float num = distFact + 0.5f * (Wildling.SkillFactor((SkillType)0) + Wildling.SenseBuff); if (Alignment.PlayerIsHiding()) { num += 0.2f; } bool flag = WindCheck(displacement, num); if (flag && markerName != "") { AddPin(position, markerName, isSmall); } return flag; } public static bool WindCheck(Vector3 displacement, float bias = 0.5f) { //IL_001f: 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) if (World.PlayerInInterior()) { return WUTIL.TestLuck(0.5f + bias); } float num = Vector3.Dot(EnvMan.instance.GetWindForce(), ((Vector3)(ref displacement)).normalized) + bias; return WUTIL.TestLuck(World.m_isRaining ? num : (1.2f * num)); } public static void CheckTruffleSpawner(Vector3 position, float distanceFactor) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (distanceFactor > 0.25f || distanceFactor < 0.1f || CheckKnownScent("Boar") < 1f || Object.op_Implicit((Object)(object)EffectArea.IsPointInsideArea(position, (Type)4, 0f))) { return; } Vector3 item = Vector3.zero; float num = 0f; foreach (Vector3 burriedTruffle in m_burriedTruffles) { if (Vector3.Distance(burriedTruffle, position) < 20f) { return; } float num2 = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, burriedTruffle); if (num2 > num) { num = num2; item = burriedTruffle; } } if (m_burriedTruffles.Count >= 4) { if (Vector3.Distance(((Component)Player.m_localPlayer).transform.position, position) >= num) { return; } m_burriedTruffles.Remove(item); } WDBUG.Log($"Set buried truffle at vector: {position - ((Component)Player.m_localPlayer).transform.position}", WDBUG.Level.World); m_burriedTruffles.Add(position); } public static bool TruffleCheck(Vector3 position) { //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_0019: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector3 item = Vector3.zero; bool flag = false; foreach (Vector3 burriedTruffle in m_burriedTruffles) { if (Vector3.Distance(burriedTruffle, position) < 1f) { item = burriedTruffle; flag = true; break; } } if (flag) { m_burriedTruffles.Remove(item); } return flag; } public static Sprite GetCharacterIcon(Character character) { return GetCharacterIcon(WUTIL.GameName(((Component)character).gameObject)); } public static Sprite GetCharacterIcon(string name) { string text = (m_characterIcons.ContainsKey(name) ? m_characterIcons[name] : ("Trophy" + name)); Sprite icon = WUTIL.GetIcon(text); if ((Object)(object)icon == (Object)null) { WDBUG.Log("GetCharacterIcon could not use " + text + " Prefab for " + name); } return icon; } public static PinData AddPin(Vector3 position, string pinName, bool isSmall = false) { //IL_009e: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) PinData val = PinDataFromMarkerName(pinName, isSmall); if (val == null || (Object)(object)val.m_icon == (Object)null) { WDBUG.Log("Failed to create marker pin '" + pinName + "'"); return null; } long num = 0L; if (((Object)val.m_icon).name == "onionseeds") { WDBUG.Log($"Adding shared pin {pinName} / {((Object)val.m_icon).name} save: {val.m_save}", WDBUG.Level.Quest); } PinData val2 = Minimap.instance.AddPin(position, val.m_type, val.m_name, val.m_save, val.m_checked, num, default(PlatformUserID)); val2.m_animate = val.m_animate; val2.m_doubleSize = val.m_doubleSize; val2.m_worldSize = val.m_worldSize; val2.m_icon = val.m_icon; m_markerPins.Add(val2); return val2; } public static bool HavePinAtPosition(Vector3 pos) { //IL_0019: 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) foreach (PinData markerPin in m_markerPins) { if (markerPin.m_pos == pos) { return true; } } return false; } public static Vector3 NearestPinPos(Vector3 pos, string name = "") { //IL_0084: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) float num = 99999f; PinData val = null; foreach (PinData markerPin in m_markerPins) { if ((!(name != "") || !(name != markerPin.m_name)) && WUTIL.GroundDistance(pos, markerPin.m_pos) < num) { val = markerPin; } } return val?.m_pos ?? Vector3.zero; } public static void TagPinForRemoval(PinData pin) { if (pin != null) { pin.m_name = " "; } } public static void RemovePinByName(string name) { WDBUG.Log("RemovePinByName: '" + name + "'", WDBUG.Level.MapMarker); m_pinRemoveMeName = name; } public static void TagForRemovalByPosition(Vector3 pos) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) pos.y = 0f; if (!m_removePositionMarkers.Contains(pos)) { WDBUG.Log($"Tagged pin for removal at {pos.x}, {pos.y}, {pos.z}", WDBUG.Level.MapMarker); m_removePositionMarkers.Add(pos); } else { WDBUG.Log($"Map marker at {pos} already tagged for removal", WDBUG.Level.MapMarker); } } private static bool RemoveByPositionTag(Vector3 pos) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) pos.y = 0f; if (m_removePositionMarkers.Contains(pos)) { m_removePositionMarkers.Remove(pos); WDBUG.Log($"Deleting map pin tagged by positon at {pos.x}, {pos.y}, {pos.z}", WDBUG.Level.MapMarker); return true; } return false; } public static void MinimapRefresh(List worldPins) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) bool flag = m_pinRemoveMeName != ""; int num = 0; int num2 = 0; PinData[] array = worldPins.ToArray(); foreach (PinData val in array) { if (val == null || (int)val.m_type != 8 || ((Object)(object)val.m_icon != (Object)null && ((Object)val.m_icon).name.StartsWith("mapicon"))) { continue; } bool flag2 = false; if (m_removeAllPins || RemoveByPositionTag(val.m_pos)) { flag2 = true; } else if (val.m_name == " ") { WDBUG.Log("Deleting map pin tagged for removal", WDBUG.Level.MapMarker); flag2 = true; } else if (flag && val.m_name == m_pinRemoveMeName) { WDBUG.Log("Deleting map pin by name '" + m_pinRemoveMeName + "'", WDBUG.Level.MapMarker); flag2 = true; } else if ((Object)(object)val.m_icon == (Object)null) { if (RepairPin(val)) { WDBUG.Log("Repaired map pin " + PinDebug(val), WDBUG.Level.AssetConfig); } else { WDBUG.Log("Deleting unrepaired map pin " + GetMarkerNameSubject(val.m_name) + val.m_name); flag2 = true; } } if (flag2) { WDBUG.Log("Removing map pin " + PinDebug(val), WDBUG.Level.MapMarker); m_markerPins.Remove(val); Minimap.instance.RemovePin(val); } else { if (!m_reloadPins) { continue; } if (HavePinAtPosition(val.m_pos)) { WDBUG.Log("Removing duplicate pin " + PinDebug(val), WDBUG.Level.MapMarker); flag2 = true; continue; } m_markerPins.Add(val); if (UpdateShareLocation(val)) { num++; } else if (((Object)val.m_icon).name.EndsWith("TreePortal")) { TreePortal.MarkPositionIfAvailable(val.m_pos); WDBUG.Log("Captured visible local marker " + PinDebug(val), WDBUG.Level.MapMarker); num2++; } else if (val.m_worldSize == 0f) { PinData val2 = PinDataFromMarkerName(val.m_name); val.m_worldSize = val2.m_worldSize; WDBUG.Log("Captured visible local marker " + PinDebug(val), WDBUG.Level.MapMarker); } } } if (m_reloadPins) { WDBUG.Log($"Completed first pin sweep: detected shared: {num} tree portal: {num2}", WDBUG.Level.MapMarker); } m_reloadPins = false; m_removeAllPins = false; m_pinRemoveMeName = ""; m_removePositionMarkers.Clear(); } public static void MinimapUpdate(List worldPins) { //IL_004d: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Invalid comparison between Unknown and I4 Minimap instance = Minimap.instance; bool flag = !instance.m_largeRoot.activeSelf; float num = (flag ? Minimap.instance.m_pinSizeSmall : Minimap.instance.m_pinSizeLarge); RawImage mapImageSmall = instance.m_mapImageSmall; float num2 = instance.m_pixelSize * (float)instance.m_textureSize; Rect val = ((Graphic)mapImageSmall).rectTransform.rect; float width = ((Rect)(ref val)).width; val = mapImageSmall.uvRect; float num3 = width / ((Rect)(ref val)).width / num2; val = ((Graphic)mapImageSmall).rectTransform.rect; float height = ((Rect)(ref val)).height; val = mapImageSmall.uvRect; float num4 = height / ((Rect)(ref val)).height / num2; PinData[] array = worldPins.ToArray(); foreach (PinData val2 in array) { if (val2 == null || (Object)(object)val2.m_icon == (Object)null || (Object)(object)val2.m_uiElement == (Object)null || (int)val2.m_type != 8) { continue; } string markerNameSubject = GetMarkerNameSubject(val2.m_name); float num5 = ((val2.m_worldSize > 0f) ? val2.m_worldSize : num); if (flag && val2.m_worldSize > 0f) { val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, m_pinMinimapRadarScale * num3 * num5); val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, m_pinMinimapRadarScale * num4 * num5); continue; } switch (markerNameSubject) { case "TreePortal": val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, 1.4f * num5); val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, 1.4f * num5); break; case "MatchPlaced": val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, 0.8f * num5); val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, 0.5f * num5); break; case "Borat": val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, 1.2f * num5); val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, 1.2f * num5); Quest.CheckObjective(32, set: false); break; case "Chimes": val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, 1.5f * num5); val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, 1.4f * num5); Quest.CheckObjective(34, set: false); Quest.CheckObjective(35); break; case "Prince": val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)0, 1.5f * num5); val2.m_uiElement.SetSizeWithCurrentAnchors((Axis)1, 1.5f * num5); break; } } } public static bool RepairPin(PinData pin) { if (pin == null || pin.m_name == null || pin.m_name == "") { return false; } PinData val = PinDataFromMarkerName(pin.m_name); if (val != null && (Object)(object)val.m_icon != (Object)null) { pin.m_icon = val.m_icon; return true; } return false; } public static PinData PinDataFromMarkerName(string markerName, bool isSmall = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0009: Unknown result type (might be due to invalid IL or missing references) PinData val = new PinData(); val.m_type = (PinType)8; if (m_scentMarkers.ContainsKey(markerName)) { val.m_icon = m_scentMarkers[markerName]; val.m_animate = false; val.m_doubleSize = markerName != "Truffle"; val.m_worldSize = (val.m_doubleSize ? 4 : 8); val.m_save = false; val.m_name = (isSmall ? "" : " "); return val; } string text = (m_namedMarkerRecipes.ContainsKey(markerName) ? markerName : GetSubjectMarkerName(markerName)); if (text == "") { return null; } string[] array = m_namedMarkerRecipes[text].Split(new char[1] { ',' }); string text2 = array[0]; string s = ((array.Length > 1) ? array[1] : "0"); string name = ((array.Length > 2) ? array[2] : text2); int variant = ((array.Length > 3) ? int.Parse(array[3]) : 0); if (m_sharedMarkerNames.Contains(text2)) { name = "OnionSeeds"; val.m_worldSize = 0.1f; } else if (float.TryParse(s, out val.m_worldSize)) { if (isSmall) { val.m_worldSize *= 0.5f; } } else { val.m_worldSize = 0f; } val.m_name = text; val.m_icon = WUTIL.GetIcon(name, variant); val.m_doubleSize = false; val.m_animate = markerName == "Attack" || markerName == "BoundDeer"; val.m_save = !m_characterIcons.ContainsKey(text2); return val; } public static void TeleportFromMap(bool toPortal = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) m_teleportFromMap = true; m_teleportToMapPortal = toPortal; if (toPortal) { WUTIL.Message("Select Tree Portal to exit", center: true, WUTIL.GetIcon("TreePortal"), blockNext: true); } Minimap.instance.ShowPointOnMap(((Component)Player.m_localPlayer).transform.position); } public static float CharacterSenseCooldown(Character character, int cooldown = 0) { if (m_senseCooldowns.ContainsKey(character)) { return m_senseCooldowns[character]; } if (cooldown > 0) { m_senseCooldowns.Add(character, cooldown); } return cooldown; } public static bool DetectScent(string scentName, Vector3 position, float distFactor, string hoverName = "", string marker = "", string nextMarker = "", bool isSmall = false, float scentFactor = 1f) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (distFactor > 0.95f || scentName == "" || distFactor < SenseRangeDF(scentFactor)) { return false; } if (hoverName == "") { hoverName = scentName; } float num = CheckKnownScent(scentName); bool flag = num >= 1f; bool flag2 = num < 7f; if (marker == "") { marker = scentName; } else if (nextMarker != "" && !flag2) { marker = nextMarker; } if (WindCheckMarker(position, flag ? marker : "", isSmall, distFactor)) { string text = "scent." + scentName; if (WUTIL.Timer(text) == 0f) { WUTIL.TimerReset(text, 2f); if (Alignment.WasRecentlySeen(hoverName)) { Wildling.RaisePrimarySkill(0.2f * scentFactor, text, 5f, (SkillType)0); float num2 = CheckKnownScent(scentName, 0.05f); if (flag) { if (flag2 && num2 >= 7f * (1f - Wildling.SkillFactor((SkillType)0))) { if (num2 < 7f) { CheckKnownScent(scentName, 7f - num2); } if (nextMarker != "") { string msg = "You can now distinguish the " + ScentDescription(nextMarker) + " of " + hoverName; WUTIL.Message(msg); WUTIL.CustomLog(msg); } } } else if (num2 >= 1f) { string msg2 = "You have learned the " + ScentDescription(marker) + " of " + hoverName; WUTIL.Message(msg2); WUTIL.CustomLog(msg2); Quest.ShowMainTutorial(5); } } } } return flag; } public static void ForgetKnownScents() { WDBUG.Log("Removing all known scents"); Wildling.RemovePlayerData("scent."); } public static string PinDebug(PinData pin, bool full = false) { //IL_00ce: 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) if (pin == null) { return "null pin"; } string text = ((pin.m_name == " ") ? "REMOVEME" : GetMarkerNameSubject(pin.m_name)); if (text == "") { text = GetDebugMarkerName(pin.m_name); } string text2 = (((Object)(object)pin.m_icon == (Object)null) ? "null" : ((Object)pin.m_icon).name); return full ? $"{text} ({text2}) sz: {pin.m_worldSize} ui: {(Object)(object)pin.m_uiElement != (Object)null} @{pin.m_pos}" : $"{text} ({text2}) @{pin.m_pos}"; } public static string GetDebugMarkerName(string markerName) { string text = ""; foreach (char c in markerName) { text += ((c == '\t') ? '1' : '0'); } return text; } private static float SenseRangeDF(float scentStrength = 1f) { float num = Wildling.SkillFactor((SkillType)0) + Wildling.SenseBuff + 0.02f * scentStrength; if (num < 0f) { return 0f; } if (Fairy.PinePasteActive()) { num *= 0.5f; } return (num > 1f) ? 0.1f : Mathf.Lerp(0f, 0.1f, Mathf.Sqrt(num)); } private static string ScentDescription(string markerName, bool addFlavor = true) { string[] array = "scent,smell,stench,odor,aroma,stink,whiff".Split(new char[1] { ',' }); return (m_scentDescriptions.ContainsKey(markerName) ? m_scentDescriptions[markerName] : "strange") + " " + array[WUTIL.DieRoll(WUTIL.DieRoll(array.Length))]; } private static string GetMarkerNameSubject(string markerName) { if (markerName == null || !m_namedMarkerRecipes.ContainsKey(markerName)) { return ""; } string text = m_namedMarkerRecipes[markerName]; int num = text.IndexOf(','); return (num < 0) ? text : text.Remove(num); } private static void UpdateTruffleMarkers() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!Wildling.IsWildling || World.PlayerInInterior()) { return; } bool flag = WUTIL.Timer("trufflemarkers") == 0f; if (flag) { WUTIL.TimerReset("trufflemarkers", 3f); } bool flag2 = CheckKnownScent("Truffle") >= 1f; foreach (Vector3 burriedTruffle in m_burriedTruffles) { float num = Alignment.AlertDistanceFactor(burriedTruffle); if (flag) { DetectScent("Truffle", burriedTruffle, num, "Truffle, growing beneath the ground"); } if (flag2 && num > 0.5f && WUTIL.RandomSpin() < num) { WUTIL.PlaceObject("truffle_vfx", burriedTruffle); } } } private static void UpdateCharacterSenseCooldown() { Dictionary dictionary = new Dictionary(); Character[] array = m_senseCooldowns.Keys.ToArray(); foreach (Character key in array) { if (m_senseCooldowns[key] > 0f) { dictionary.Add(key, m_senseCooldowns[key] - 0.1f); } } m_senseCooldowns = dictionary; } private static bool UpdateShareLocation(PinData pin) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_006e: 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) if (pin == null || (int)pin.m_type != 8 || (Object)(object)pin.m_icon == (Object)null || ((Object)pin.m_icon).name != "onionseeds") { return false; } string markerNameSubject = GetMarkerNameSubject(pin.m_name); if (markerNameSubject == "") { return false; } pin.m_worldSize = 0.1f; m_sharedLocations[markerNameSubject] = pin.m_pos; WDBUG.Log($"Captured hidden shared marker {markerNameSubject} at: {pin.m_pos}", WDBUG.Level.MapMarker); return true; } } public class WDBUG { public enum Level { startup = 0, player = 1, abilities = 2, items = 3, artifacts = 4, teleport = 5, effects = 6, placements = 7, utility = 8, production = 9, AssetLoad = 100, Instanciate = 101, AssetConfig = 102, ClanConfig = 103, NonFatal = 104, PlayerProfile = 200, PlayerStats = 201, PlayerBuffs = 202, GUI = 203, RecipeUnlock = 204, Sense = 300, Knowledge = 301, Barter = 302, Taming = 303, Riding = 304, Pickpocket = 305, Progress = 306, Crafting = 307, Poisoned = 308, Throwstick = 400, PebblesAndSlingshots = 401, GrindingBowl = 402, Matches = 403, Digger = 404, ClothSack = 405, FoodHamper = 406, AmmoPouch = 407, Bowdacious = 500, Chimes = 501, ElderWand = 502, MagicChest = 503, Thorscorn = 504, Sparx = 505, TreePortal = 600, SurtlingSpike = 601, GamePortal = 602, Tracking = 603, Timers = 700, Disease = 701, Flight = 702, Doxie = 703, Ygnie = 704, Loki = 705, Treehouse = 800, World = 801, Wildlife = 802, Dungeon = 803, Quest = 804, MapMarker = 805, Multiplayer = 806, Underwater = 807, ModSupport = 808, Beta = 900, info = 10000, warn = 10001, show = 10002, alert = 10003 } [HarmonyPatch(typeof(Terminal), "TryRunCommand")] public class PatchTerminalTryRunCommand { public static bool Prefix(string text) { return !CommandLine(text, fromConsole: true); } } [HarmonyPatch(typeof(Player), "ResetCharacter")] private class PatchPlayerResetCharacter { public static bool Prefix(Dictionary ___m_knownTexts) { if (m_removeKnownTexts) { m_removeKnownTexts = false; ___m_knownTexts.Clear(); return false; } return true; } } private const string c_msgPrefix = "Wildling: "; private const string c_cmdFixed = "wildling"; private const string c_cmdAlias = "w"; private const string c_cmdEntry = "console"; public static bool AllowCommandsWithoutCheatsEnabled = true; public static bool AllowWildlingToggle = true; public static bool AllowLokiGodMode = true; public static bool AllowPerksToggle = true; public static bool AlignAll = false; public static bool AllowHammerAndHoe = false; public static bool AllowUseAllItems = false; public static bool AlwaysResurrect = false; public static bool LokiPowers = false; public static bool PixieFlight = false; public static bool SimpleFlight = false; public static bool WallWalk = false; public static bool RemoveAllPins = false; public static bool DestroyExcessInventoryItems = false; public static bool RemoveLocalPebbles = false; public static bool CheckAllMakMarkers = false; public static int DebugLevel = 9; public static int ShowProgressOverride = -1; public static Vector3 DebugLocation = Vector3.zero; private const int c_maxDebugLevel = 9; private const int c_maxSubgroups = 100; private const int c_unfilteredMsg = 10000; private static bool m_exitConsoleMode = false; private static bool m_consoleOnline = false; private static bool m_showAll = false; private static bool m_removeKnownTexts = false; private static string m_deferredCommands = ""; private static string m_cmdAlias = "w"; private static Dictionary m_debugFilter = new Dictionary(); public static void StartupConsoleCommand() { CommandLine("debug 8 NonFatal"); } public static bool CommandLine(string commands = "", bool fromConsole = false) { if (m_deferredCommands != "") { string[] array = m_deferredCommands.Split(new char[1] { ';' }); m_deferredCommands = ""; string[] array2 = array; foreach (string text in array2) { Command(text.Trim(), fromConsole: false); } } bool flag = false; if (commands != "") { string[] array3 = commands.Split(new char[1] { ';' }); foreach (string text2 in array3) { flag |= Command(text2.Trim(), fromConsole); fromConsole = false; } if (m_deferredCommands != "" && !m_exitConsoleMode) { Log("Deferred commands " + m_deferredCommands, Level.info); } } if (m_exitConsoleMode) { m_exitConsoleMode = false; m_consoleOnline = false; } return flag; } public static void Log(string msg, Level level = Level.warn, float messageCooldown = 0f) { if (m_debugFilter.Count == 0) { SetFiltersByLevel(); } if (level < Level.production) { if ((int)level < DebugLevel) { return; } } else if (level < Level.info && !m_debugFilter[level]) { return; } string name = level.ToString(); if (messageCooldown > 0f || (int)level / 100 == 1) { if (WUTIL.Timer(name) > 0f) { return; } WUTIL.TimerReset(name, messageCooldown); } if (level == Level.alert) { WUTIL.Message(msg); } else if (m_showAll || level == Level.show) { WUTIL.Message(msg, center: false); } if (level == Level.warn || level == Level.alert) { Debug.LogWarning((object)("Wildling: " + msg)); } else { Debug.Log((object)("Wildling: " + msg)); } } public static bool IsLevelReported(Level level) { return m_debugFilter.ContainsKey(level) && m_debugFilter[level]; } private static void ModifyDebugFilters(List words) { int num = ((m_debugFilter.Count != 0) ? (-1) : 0); if (words.Count > 0 && int.TryParse(words[0], out var result)) { result = Mathf.Max(result, 0); result = Mathf.Min(result, 9); num = result; words.RemoveAt(0); } bool flag = false; foreach (string word in words) { if (word == "help") { flag = true; break; } } if (num >= 0) { DebugLevel = num; SetFiltersByLevel(num); } if (flag) { words.Clear(); string[] array = new string[10]; foreach (int value in Enum.GetValues(typeof(Level))) { string name = Enum.GetName(typeof(Level), value); if (value < 10000) { int num3 = ((value <= 9) ? value : (value / 100 - 1)); if (array[num3] == null || array[num3] == "") { array[num3] = $"debug {num3} == '{name}', sublevels:"; continue; } ref string reference = ref array[num3]; reference = reference + " '" + name + "'"; } } string text = "w debug sets flags to control which messages are sent to the console.\r\ndebug (no args) => reports back current enabled level and sublevel settings, and the ~shortest config setting to reproduce this state\r\ndebug show => toggle console log output to show in-game\r\ndebug [level level ...] => set to a minimum priority level and/or toggle particular levels and sublevels:"; Debug.Log((object)(text + "\n" + string.Join("\n", array) + " => basically only warnings\ndebug production artifacts Torches => (example) only messages related to quest items and the Torch item")); } foreach (string word2 in words) { if (!Enum.TryParse(word2, out var _)) { Debug.LogWarning((object)("Ignored unknown debug key: " + word2 + "\nAvailable levels are:" + DebugFilters())); continue; } Level level = (Level)Enum.Parse(typeof(Level), word2); if (level == Level.show) { m_showAll = !m_showAll; WUTIL.Message($"Show all messages: {m_showAll}", center: false); } else if (level >= Level.AssetLoad) { m_debugFilter[level] = !m_debugFilter[level]; } else if (level <= Level.production) { SetFiltersByLevel((int)level, sublevel: true); } } } private static string GetDebugFilter(bool fromConsole = false) { if (m_debugFilter.Count == 0) { return "ERROR: DebugSettings called before setup"; } int num = 0; int num2 = 0; int[] array = new int[9]; int[] array2 = new int[9]; string text = ""; string text2 = ""; foreach (Level key in m_debugFilter.Keys) { int num3 = (int)key / 100 - 1; if (m_debugFilter[key]) { array[num3]++; text = text + " " + key; } else { array2[num3]++; num2++; text2 = text2 + " " + key; } } int num4 = 0; int num5 = num + num2; for (int i = 0; i < 9; i++) { num += array[i]; num2 -= array2[i]; if (num + num2 < num5) { num5 = num + num2; num4 = i + 1; } } List[] array3 = new List[9]; List[] array4 = new List[9]; for (int j = 0; j < 9; j++) { array3[j] = new List(); array4[j] = new List(); } foreach (Level key2 in m_debugFilter.Keys) { int num6 = (int)key2 / 100 - 1; if (num6 < num4) { if (m_debugFilter[key2]) { array3[num6].Add(key2); } else { array4[num6].Add(key2); } } else if (m_debugFilter[key2]) { array4[num6].Add(key2); } else { array3[num6].Add(key2); } } List list = new List(); for (int k = 0; k < 9; k++) { if (array3[k].Count > array4[k].Count + 1) { list.Add((Level)k); list.AddRange(array4[k]); } else { list.AddRange(array3[k]); } } string arg = string.Join(" ", list); string text3 = $"{num4} {arg}"; if (fromConsole) { string text4 = "sublevels enabled:\n " + text; if (text2 == "") { text4 = "at show all level"; } else if (text == "") { text4 = $"at production level ({9}) - no sublevels enabled"; text3 = "production"; } Log("w debug log " + text4 + "\ndebugConfig: " + text3); } return text3; } private static string DebugFilters() { if (m_debugFilter.Count == 0) { return "ERROR: DebugFilters called before setup"; } string text = ""; int num = 0; foreach (Level key in m_debugFilter.Keys) { text = text + ((num % 10 == 0) ? "\n" : ", ") + key; num++; } return text; } private static void SetFiltersByLevel(int level = 0, bool sublevel = false) { if (level < 0 || level >= 9) { level = 9; sublevel = false; } foreach (int value in Enum.GetValues(typeof(Level))) { int num2 = value / 100; if (num2 <= 0 || num2 >= 100) { continue; } num2--; Level key = (Level)value; if (!m_debugFilter.ContainsKey(key)) { m_debugFilter.Add(key, value: false); } if (sublevel) { if (num2 == level) { m_debugFilter[key] = !m_debugFilter[key]; } } else { m_debugFilter[key] = num2 >= level; } } } private static bool Command(string command, bool fromConsole) { //IL_180f: Unknown result type (might be due to invalid IL or missing references) //IL_181a: Unknown result type (might be due to invalid IL or missing references) //IL_181f: Unknown result type (might be due to invalid IL or missing references) //IL_1824: Unknown result type (might be due to invalid IL or missing references) //IL_1829: Unknown result type (might be due to invalid IL or missing references) //IL_182e: Unknown result type (might be due to invalid IL or missing references) //IL_0e8a: Unknown result type (might be due to invalid IL or missing references) //IL_0e95: Unknown result type (might be due to invalid IL or missing references) //IL_0f3b: Unknown result type (might be due to invalid IL or missing references) //IL_0f15: Unknown result type (might be due to invalid IL or missing references) //IL_0f20: Unknown result type (might be due to invalid IL or missing references) //IL_10ea: Unknown result type (might be due to invalid IL or missing references) //IL_0f7e: Unknown result type (might be due to invalid IL or missing references) //IL_18d9: Unknown result type (might be due to invalid IL or missing references) //IL_18db: Unknown result type (might be due to invalid IL or missing references) //IL_0f9b: Unknown result type (might be due to invalid IL or missing references) //IL_0fb2: Unknown result type (might be due to invalid IL or missing references) //IL_0fb7: Unknown result type (might be due to invalid IL or missing references) //IL_0f8f: Unknown result type (might be due to invalid IL or missing references) //IL_1a39: Unknown result type (might be due to invalid IL or missing references) //IL_1a41: Unknown result type (might be due to invalid IL or missing references) //IL_1a4b: Unknown result type (might be due to invalid IL or missing references) //IL_1a50: Unknown result type (might be due to invalid IL or missing references) //IL_1a63: Unknown result type (might be due to invalid IL or missing references) //IL_1a68: Unknown result type (might be due to invalid IL or missing references) //IL_1ac5: Unknown result type (might be due to invalid IL or missing references) //IL_1aca: Unknown result type (might be due to invalid IL or missing references) List list = command.Split().ToList(); if (list.Count == 0) { return false; } if (fromConsole) { string text = list[0]; list.RemoveAt(0); if (text == "wildling" || (m_consoleOnline && text == m_cmdAlias)) { if (list.Count > 0 && list[0] == "console") { m_consoleOnline = !m_consoleOnline; if (!m_consoleOnline || list.Count <= 1) { Log("wildling (" + m_cmdAlias + ") console commands " + (m_consoleOnline ? "enabled" : "disabled")); return true; } list.RemoveAt(0); m_exitConsoleMode = true; } } else if (text != m_cmdAlias) { return false; } if (!m_consoleOnline) { return false; } } if (list.Count == 0) { Log("Console commands on line. Type: " + m_cmdAlias + " help"); return true; } string text2 = list[0]; Player localPlayer = Player.m_localPlayer; if (text2 != "debug" && (Object)(object)localPlayer == (Object)null) { if (m_deferredCommands != "") { m_deferredCommands += ";"; } m_deferredCommands += command; return true; } list.RemoveAt(0); switch (text2.ToLower()) { case "alignall": case "a": if (AllowLokiGodMode) { AlignAll = !AlignAll; Log("Align all (neutral) mode: " + AlignAll); } else { Log("Align all mode (toggle) disabled" + AlignAll); } break; case "buildall": case "b": if (AllowPerksToggle) { AllowHammerAndHoe = !AllowHammerAndHoe; Crafting.SetPlayerKnowableRecipes(); Log("Use Hammer and Hoe: " + AllowHammerAndHoe); } else { Log("Use Hammer and Hoe (toggle) disabled"); } break; case "command": case "c": if (list.Count == 0 || list[0].Trim() == "") { Log("Check wildling console command alias. Provide new value. Current: " + m_cmdAlias); break; } Log("Reset wildling console command alias (" + m_cmdAlias + ") is now " + list[0]); m_cmdAlias = list[0].Trim(); break; case "debug": case "d": ModifyDebugFilters(list); GetDebugFilter(fromConsole); break; case "elderwand": case "e": foreach (string item in list) { switch (item.Trim()) { case "powered": ElderWand.SetPowered(!ElderWand.IsPowered()); break; case "debugMode": ElderWand.SetDebugMode(!ElderWand.GetDebugMode()); break; case "torchToWeapon": ElderWand.torchToWeapon = !ElderWand.torchToWeapon; break; case "wandReadyPower": ElderWand.wandReadyPower = !ElderWand.wandReadyPower; break; case "centerHoverReport": ElderWand.centerHoverReport = !ElderWand.centerHoverReport; break; } } Log("Elder wand mode: " + ElderWand.GetCommandMode() + " [use value to toggle])\n" + $" powered: {ElderWand.IsPowered()}\n" + $" debugMode: {ElderWand.GetDebugMode()}\n" + $" torchToWeapon: {ElderWand.torchToWeapon}\n" + $" wandReadyPower: {ElderWand.wandReadyPower}\n" + $" centerHoverReport: {ElderWand.centerHoverReport}"); break; case "fly": case "f": if (SimpleFlight) { SimpleFlight = false; PixieFlight = true; Flight.SetFlightTime(-1f); Log("Pixie flight enabled\n" + Flight.FlyingLesson(), Level.show); } else if (PixieFlight) { PixieFlight = false; Flight.SetFlightTime(0f); Log("Continuous flight disabled"); } else { PixieFlight = false; SimpleFlight = true; Log("Simple flight enabled\n" + Flight.FlyingLesson(), Level.show); } break; case "god": case "g": if (AllowLokiGodMode) { bool flag3 = text2.StartsWith("G"); SetLokiMode(!LokiPowers, flag3); string text9 = ((!LokiPowers) ? "human" : (flag3 ? "invunerable" : "resurrection")); Log("Loki mode: " + text9); } else { Log("Loki god mode (change) disabled"); } break; case "help": case "h": Log("Console commands provide general debug utilities and access to\ngame state variables. Type: " + m_cmdAlias + " [arg1 ...]\nConsole commands can be abbreviated to their first letter (a-z) and include:\nalignall buildall command debug elderwand fly god help jot known locate\nmark noob pin quest reset spawn tally useall vitals wildling xpunge ygnie"); break; case "jot": case "j": { if (list.Count == 0) { Log("Use 'w jot [%%] | [#RGB] [^^][message]' to write to Wildling log. ^^ to reset, %% to update"); break; } if (list.Count == 1 && list[0] == "%%") { Quest.PatchObjectives(force: true); break; } string color = ""; if (list.Count > 1 && list[0].StartsWith("#")) { color = list[0]; list.RemoveAt(0); } WUTIL.CustomLog(string.Join(" ", list.ToArray()), color, add: true, remove: true, resort: false, checkCooldown: false, trace: true); break; } case "known": case "k": Log("Updating known recipes - not implemented"); break; case "locate": case "l": { if (list.Count == 0) { Log("Locate to marked site. Use location name to reset target."); ((Character)localPlayer).TeleportTo(DebugLocation, ((Component)localPlayer).transform.rotation, false); break; } string text5 = list[0].Trim(); if (text5 == "safe") { Log("Locate to last safe location"); Fairy.TeleportToSafety(localPlayer); break; } if (text5 == "0") { Log("Locate to 0,0"); ((Character)localPlayer).TeleportTo(Vector3.zero, ((Component)localPlayer).transform.rotation, true); break; } if (!TreePortal.FindClosestLocation(text5, ((Component)localPlayer).transform.position, out DebugLocation)) { Log("Locate found no place: " + text5); break; } if (MapMarker.HavePinAtPosition(DebugLocation)) { MapMarker.TagForRemovalByPosition(DebugLocation); } MapMarker.AddPin(DebugLocation, "Attack"); float num3 = Vector3.Distance(((Component)localPlayer).transform.position, DebugLocation); Log($"Locate marked new {text5} on map at dist: {num3}"); break; } case "noob": case "n": if (AllowLokiGodMode) { AlwaysResurrect = !AlwaysResurrect; Log("Noob resurrection mode: " + AlwaysResurrect); } else { Log("Noob resurrection mode (toggle) disabled"); } break; case "mark": case "m": MapMarker.RemoveSharedLocation("GreatOak1"); MapMarker.RemoveSharedLocation("Prince0"); MapMarker.RemoveSharedLocation("Prince1"); MapMarker.RemoveSharedLocation("Prince2"); MountainDungeon.MarkLocationOnMap(); Loki.RevealPrinceLocations(debug: true); SwampDungeon.LocateGreatOakRegion(openMap: true); Log("Marked quest pins on map"); break; case "pin": case "p": { string text10 = ((list.Count > 0) ? list[0].Trim() : "MatchPlaced"); Log("Adding " + text10 + " pin to map"); MapMarker.AddPin(((Component)localPlayer).transform.position, text10); break; } case "quest": case "q": { string text6 = ""; if (list.Count == 0) { text6 = Quest.ViewAchievements(); } bool flag2 = false; for (int i = 0; i < list.Count; i++) { if (flag2) { flag2 = false; continue; } string text7 = list[i]; string text8 = ((i < list.Count - 1) ? list[i + 1] : ""); int result2; if (text8 == "x") { text6 = ((!Quest.RemoveAcievement(text7)) ? (text6 + text7 + " achievement not set") : (text6 + text7 + " achievement removed (" + text8 + ")")); flag2 = true; } else if (text8 != "" && int.TryParse(text8, out result2)) { Quest.SetAchievement(text7, result2); text6 += $"\n{text7}: {Quest.GetAchievement(list[i])}"; flag2 = true; } else { text6 += Quest.ViewAchievements(text7); } } Log("Quest achievements set: " + text6); break; } case "reset": case "r": { string text4 = ((list.Count > 0) ? list[0].Trim() : ""); string s = ((list.Count > 1) ? list[1].Trim() : "2"); switch (text4) { case "beds": World.ClearBedPositions(); Log("Reset Tracked Bed spawn points"); break; case "chest": MagicChest.CheckSetupInventories(reset: true); Quest.CollectItem("MagicChest", reset: true); Log("Reset Magic Chest"); break; case "dreams": Quest.ResetDreams(restore: false); Log("Reset dreams and nightmares"); break; case "dungeon": { if (int.TryParse(s, out var result)) { Log("Dungeon set to rebuild mode " + result); World.ResetBuildMode(result); } break; } case "entry": Wildling.Reset(); Quest.Reset(achievements: true); Player.ResetSeenTutorials(); Player.m_localPlayer.ResetCharacter(); Log("Game entry, tutorials and achievements reset"); break; case "event": if (RandEventSystem.InEvent()) { Log("End current game event"); RandEventSystem.instance.ResetRandomEvent(); } else { Log("Start random game event"); RandEventSystem.instance.StartRandomEvent(); } break; case "pebbles": RemoveLocalPebbles = true; Log("Removing local pebbles"); break; case "pins": ElderWand.ResetArmy(); MapMarker.RemoveAllPins(); Log("Reset Wildling world map pins"); break; case "portals": TreePortal.DeleteAll(); Log("Deleting all tree portals"); break; case "power": Log("Reset Guardian Power"); RemoveGuardianEffects(); break; case "rested": Log("Removed Rested effect"); ((Character)Player.m_localPlayer).GetSEMan().RemoveStatusEffect(StringExtensionMethods.GetStableHashCode("Rested"), false); break; case "skills": Log("Reset Wildling skills and experience"); Wildling.SetPlayerData("SK.Wildling", 0f); Wildling.SetPlayerData("WS.Chipping", 0f); Wildling.SetPlayerData("WS.DiseaseResistance", 0f); Wildling.SetPlayerData("WS.Lockpicking", 0f); Quest.SetAchievement("WS.PlantedFlags", 0); Quest.SetAchievement("TimesBonded", 0); MapMarker.ForgetKnownScents(); break; case "sunken": World.TrackSunkenChest(); break; case "texts": case "tutorials": m_removeKnownTexts = true; Player.ResetSeenTutorials(); Quest.RemoveAcievement("MainTutorial"); Player.m_localPlayer.ResetCharacter(); Log("Reset All Known Texts and Tutorials"); break; default: Log("Unknown reset target '" + text4 + "'. Valid options:\nbeds, chest, dungeon [0-2], dreams, entry, event, pebbles, pins, portals, power, rested, skills, tutorials"); break; } break; } case "spawn": case "s": { Vector3 val = ((Component)localPlayer).transform.position + ((Component)localPlayer).transform.forward + Vector3.up; foreach (string item2 in list) { int level = 0; string name = item2; if (item2 == "stag") { name = "Deer"; level = 3; } else if (item2 == "serpent" || item2 == "seaserpent") { name = "Serpent"; level = 1; } else if (item2 == "wolf") { name = "Wolf"; level = 1; } else if (item2 == "Borat") { level = 1; } GameObject val2 = WUTIL.Spawn(name, val, Quaternion.identity, level, 0f, ground: true); if ((Object)(object)val2 == (Object)null) { continue; } ItemDrop component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { string text3 = ((component.m_itemData.m_shared.m_maxStackSize <= 1) ? (" of durability " + component.m_itemData.m_durability + " / " + component.m_itemData.m_shared.m_maxDurability) : (" stack of " + component.m_itemData.m_stack + " / " + component.m_itemData.m_shared.m_maxStackSize)); Log("Spawned " + component.GetHoverName() + text3); if (Equipment.CheckCarryItem(component.m_itemData)) { component.m_itemData.m_crafterName = Player.m_localPlayer.GetPlayerName(); } continue; } Character component2 = val2.GetComponent(); if ((Object)(object)component2 == (Object)null) { Log("Spawned object " + WUTIL.GameName(val2)); continue; } val2.transform.position = val + ((Component)localPlayer).transform.forward * 6f; component2.SetLookDir(-((Component)localPlayer).transform.forward, 1f); float num = ((item2 == "serpent") ? 0.25f : ((item2 == "wolf") ? 0.5f : 1f)); if (num != 1f) { val2.transform.localScale = num * Vector3.one; } Log($"Spawned level {component2.GetLevel()} {component2.GetHoverName()} scale: {num}"); } break; } case "tally": case "t": if (list.Count == 0 || !int.TryParse(list[0], out ShowProgressOverride)) { ShowProgressOverride = -1; } Log($"Report Epilog (progress override: {ShowProgressOverride}%)"); Quest.ReportEpilog(postPlay: false); break; case "useall": case "u": if (AllowPerksToggle) { AllowUseAllItems = !AllowUseAllItems; Log("Allow use of all items: " + AllowUseAllItems); } else { Log("Allow use of all items (toggle) diabled"); } break; case "vitals": case "v": Log(Wildling.PrintPlayerData((list.Count > 0) ? list[0] : "", (list.Count > 1) ? list[1] : "")); break; case "wildling": case "w": if (AllowWildlingToggle) { Wildling.ToggleWildling(0.2f); string arg = (Wildling.IsWildling ? "Adult" : "Wildling"); float num2 = WUTIL.Timer("wildlingMorphDelay"); Log($"Transforming to {arg} in {num2}s"); } else { Log("Toggle Adult/Wildling transform is disabled"); } break; case "xpunge": case "x": DestroyExcessInventoryItems = !DestroyExcessInventoryItems; Log("Destroy excess inventory items on switch to wildling: " + DestroyExcessInventoryItems); break; case "ygnie": case "y": { bool flag = Fairy.YgnieActive(); if (!flag) { WUTIL.TimerReset("Eikthyr_power", localPlayer.m_guardianPowerCooldown); } Fairy.YgnieSummon(flag); Log((flag ? "Unsummon" : "Summon") + " Ygnie"); break; } default: Log("wildling (" + m_cmdAlias + ") " + text2 + " command not implemented.)"); return false; } return true; } public static void RemoveGuardianEffects(bool reset = false) { ((Character)Player.m_localPlayer).GetSEMan().RemoveAllStatusEffects(false); Player.m_localPlayer.m_guardianPowerCooldown = 0f; if (reset) { Player.m_localPlayer.SetGuardianPower(""); } } public static void SetLokiMode(bool enable, bool fullGod = false) { LokiPowers = enable; if (enable) { enable = fullGod; AlwaysResurrect = !fullGod; } else { AlwaysResurrect = false; Player.m_localPlayer.SetGhostMode(false); SimpleFlight = false; if (PixieFlight) { Flight.SetFlightTime(0f); PixieFlight = false; } } Player.m_localPlayer.SetGodMode(enable); } public static bool UseDebugItem(ItemData item, int hotkeyIndex = 1) { //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_06c9: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Invalid comparison between Unknown and I4 //IL_0643: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Unknown result type (might be due to invalid IL or missing references) //IL_0862: Unknown result type (might be due to invalid IL or missing references) //IL_0876: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05ba: Expected O, but got Unknown if (item != null && (!LokiPowers || ((Object)item.m_dropPrefab).name != "Dandelion")) { return false; } Player localPlayer = Player.m_localPlayer; string text = WUTIL.KeyHighlightText("L-Shift"); bool key = Input.GetKey((KeyCode)304); GameObject hoverObject = ((Humanoid)localPlayer).GetHoverObject(); Character val = ((hoverObject != null) ? hoverObject.GetComponent() : null); if ((Object)(object)val != (Object)null && val.IsPlayer() && hotkeyIndex != 1) { WUTIL.Message("This power may not effect things beyond this realm."); return true; } string text2 = WUTIL.GameName(hoverObject); string text3 = ""; switch (hotkeyIndex) { case 1: if (!key) { return false; } if ((Object)(object)hoverObject == (Object)null) { if (Input.GetKey((KeyCode)306)) { Quest.ReportEpilog(postPlay: false); return true; } text3 = "Use this power to see the nature of an object"; } break; case 2: if ((Object)(object)val == (Object)null) { text3 = "Use this power to " + (key ? "kill" : "calm") + " a creature."; } else if (key) { text3 = "Killed " + text2; val.Damage(new HitData { m_damage = { m_damage = 1E+10f } }); } else { text3 = "Calmed " + text2; Alignment.StopHunt(val); } break; case 3: if (key) { bool flag4 = Quest.GetAchievement("DarklingShade") > 0; text3 = "Your skin is now " + (flag4 ? "it's usual" : "full Darkling") + " color"; Wildling.ModifyDarklingLevel(flag4 ? (-100) : 100, ifDarkling: false); break; } if ((Object)(object)val == (Object)null) { text3 = "Use this power to heal or promote a creature."; break; } text3 = ElderWand.HealOrPromote(val, elderWand: false); if (text3 == "") { text3 = text2 + " cannot be promoted."; } break; case 4: if (key) { if (PixieFlight) { PixieFlight = false; Flight.SetFlightTime(0f); } SimpleFlight = !SimpleFlight; text3 = ((!SimpleFlight) ? "You are Corporeal again." : ("You have become Insubstancial and can hover, or walk on air.\n" + WUTIL.KeyHighlightText("Jump") + " to ascend, through ceilings\n" + WUTIL.KeyHighlightText("Block") + " to descend, " + WUTIL.KeyHighlightText("Crouch") + " to land")); WallWalk = SimpleFlight; localPlayer.SetGhostMode(SimpleFlight); } else if (PixieFlight) { SimpleFlight = false; PixieFlight = false; Flight.SetFlightTime(0f); text3 = "You no longer have the power of flight"; } else { SimpleFlight = false; PixieFlight = true; Flight.SetFlightTime(-1f); text3 = "You now have the power of flight\n" + WUTIL.KeyHighlightText("Jump") + " to take off and ascend, \n" + WUTIL.KeyHighlightText("Block") + " to brace\n" + WUTIL.KeyHighlightText("Crouch") + " to descend, " + WUTIL.KeyHighlightText("Alt") + " to land"; } break; case 5: if (key) { bool flag2 = ((Character)localPlayer).InGodMode(); localPlayer.SetGodMode(!flag2); AlwaysResurrect = flag2; text3 = ((!AlwaysResurrect) ? "You now have Loki's invunerability!" : "You now are now vunerable to mortal damage but will return."); } else { bool flag3 = !((Character)localPlayer).InGhostMode(); localPlayer.SetGhostMode(flag3); text3 = ((!flag3) ? "Creatures of this realm can see you again." : "Creatures of this realm will no longer see you."); } break; case 6: if (key) { text3 = "Click on the map to teleport"; MapMarker.TeleportFromMap(); } else { text3 = "Teleport 2 strides forward"; Transform transform = ((Component)Player.m_localPlayer).transform; transform.position += 2f * ((Character)Player.m_localPlayer).GetLookDir(); } break; case 7: { int num = 0; if (key) { ItemDrop[] array = (ItemDrop[])(object)Object.FindObjectsByType(typeof(ItemDrop), (FindObjectsSortMode)0); for (int i = 0; i < array.Length; i++) { ZNetView component2 = ((Component)array[i]).GetComponent(); if ((Object)(object)component2 != (Object)null && component2.IsValid() && component2.IsOwner()) { component2.Destroy(); num++; } } text3 = $"Obliterated {num} dropped items."; break; } foreach (Character allCharacter in Character.GetAllCharacters()) { if (!allCharacter.IsPlayer()) { allCharacter.Damage(new HitData { m_damage = { m_damage = 1E+10f } }); num++; } } text3 = $"Killed {num} creatures."; break; } case 8: { if ((Object)(object)hoverObject == (Object)null) { Vector3 position = ((Component)Player.m_localPlayer).transform.position; if (Input.GetKey((KeyCode)306) && position.y >= 5200f) { text3 = "Performing multiple Great Oak obliteration"; Place.DestroyDungeon(position, 800f, null, 5200f, 9999f, drops: true, proxies: true); } else { text3 = "Use this power to obliterate any object"; } break; } string text4 = text2; Transform val2 = hoverObject.transform; while ((Object)(object)val2.parent != (Object)null) { val2 = val2.parent; text4 = text4 + "." + ((Object)((Component)val2).gameObject).name; } ZNetView component = hoverObject.GetComponent(); bool flag = (Object)(object)component != (Object)null && (int)component.m_type == 3; if (text4 == "Terrain") { flag = true; } if (flag && !key) { text3 = "Use this power with " + text + " to destroy terrain."; break; } text3 = "Obliterated: " + text2 + ""; Debug.Log((object)("Destroying " + text4 + (flag ? "terrain" : ""))); WUTIL.Destroy(((Component)val2).gameObject); break; } } if (text3 != "") { WUTIL.Message(text3, center: true, WUTIL.GetIcon("Dandelion")); return true; } Transform transform2 = hoverObject.transform; if ((Object)(object)val == (Object)null) { text3 = Place.AnalyzePiece(transform2); } else { int customedTag = Loki.GetCustomedTag(val); text3 = $"{val.GetHoverName()} Faction: {val.GetFaction()} HP: {val.GetHealth()}/{val.GetMaxHealth()}" + ((customedTag == 0) ? "" : (" Tag: " + customedTag)); } WUTIL.Message(text3); Log($"{((Object)((Component)transform2).gameObject).name}: {text3} {Vector3.Distance(((Component)Player.m_localPlayer).transform.position, transform2.position)}m @{transform2.position}"); return true; } } internal class ElderWand : MonoBehaviour { public enum WandPower { none, backlight, respect, fear, torch, calling, hold, rally, attack, retreat } public enum WandAction { none, check, equip, drop, unequip, ready } [HarmonyPatch(typeof(Aoe), "Setup")] public class PatchAoeSetup { public static Character m_catchDeath; private static void Prefix(Aoe __instance, Character owner, HitData hitData) { if ((Object)(object)owner != (Object)null && (Object)(object)owner != (Object)(object)Player.m_localPlayer && WUTIL.GameName(((Component)__instance).gameObject) == "elderwand_aoe") { WDBUG.Log("AoE radius: " + m_aoeRadius); if (m_aoeRadius <= 0f) { ((DamageTypes)(ref hitData.m_damage)).Modify(0f); } __instance.m_radius = m_aoeRadius; WUTIL.TimerReset("aoe_ignore_0hits", 0.1f); } } private static void Postfix(Aoe __instance) { World.CheckAoEDamaged(__instance, m_catchDeath); m_catchDeath = null; } } public class GP_ElderLight : StatusEffect { public GP_ElderLight() { //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: Expected O, but got Unknown ((Object)this).name = "GP_ElderLight"; base.m_name = "Light of the Elder"; base.m_tooltip = "You have the power to channel commands using the Elder Wand.Hold the wand in your right hand to rally greydwarf to you, or move to the ready position on your back to have them defend the position around you. Hold in your left hand (by equiping a second weapon) to signal the attack of the nearest enemy, or put that weapon away to signal a retreat. You can also command, heal or promote indivdual (veteran) greydrawf recruits. The Light allows you to nearby Graydwarf and on your map."; GameObject prefab = WUTIL.GetPrefab("TrophyTheElder"); base.m_icon = prefab.GetComponent().m_itemData.GetIcon(); base.m_cooldown = 1200f; base.m_ttl = 900f; base.m_activationAnimation = "emote_cheer"; base.m_startEffects.m_effectPrefabs = (EffectData[])(object)new EffectData[1]; base.m_startEffects.m_effectPrefabs[0] = new EffectData { m_prefab = WUTIL.GetPrefab("fx_GP_Player") }; } public override void Setup(Character character) { if (Wildling.m_restartStatusEffectTime > 0f) { base.m_character = character; base.m_time = Wildling.m_restartStatusEffectTime; float remaningTime = ((StatusEffect)this).GetRemaningTime(); WUTIL.TimerReset("Elder_power", remaningTime); WDBUG.Log($"GP_ElderLight restarted for time: {remaningTime} ({base.m_time} used)", WDBUG.Level.ElderWand); } else { ((StatusEffect)this).Setup(character); WUTIL.TimerReset("Elder_power", base.m_ttl); } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); Wildling.SetPlayerData(((Object)this).name, base.m_time); } public override bool CanAdd(Character character) { return character.IsPlayer() && (Wildling.m_restartStatusEffectTime > 0f || Wildling.IsWildling); } public override bool IsDone() { if (((StatusEffect)this).IsDone()) { WUTIL.TimerReset("Elder_power"); return true; } return false; } public override void Stop() { ((StatusEffect)this).Stop(); Wildling.SetPlayerData(((Object)this).name, 0f); } } public const string c_goName = "Wildling_ElderWand"; public static bool torchToWeapon = true; public static bool wandReadyPower = true; public static bool torchUnarmedPower = true; public static bool centerHoverReport = true; public static bool enableColorFade = false; public static Color droppedColor = new Color(0f, 0f, 0f); public static Color torchColor = new Color(0.3f, 0.25f, 0.2f); public static Color respectColor = new Color(0f, 0.05f, 0f); public static Color fleeColor = new Color(0.3f, 0.3f, 0.26f); public static Color shieldColor = new Color(0f, 0.05f, 0f); public static Color callingColor = new Color(0.05f, 0.1f, 0.05f); public static Color holdColor = new Color(0.28f, 0.25f, 0.3f); public static Color rallyColor = new Color(0.05f, 0.3f, 0.05f); public static Color attackColor = new Color(0.3f, 0.05f, 0.05f); public static Color retreatColor = new Color(0f, 0.15f, 0.3f); private const int c_minQuestArmySize = 10; private const int c_promoteMaxLevel = 3; private const int c_promoteMaxRank = 4; private const float c_healBelowPcMaxHP = 0.95f; private const float c_promoteBelowPcMaxHP = 0.4f; private const float c_healTime = 10f; private const float c_maxHealPerTick = 20f; private const float c_healTick = 0.5f; private const float c_fadeColorTime = 2f; private const float c_promoteToShamanChance = 0.2f; private const float c_promoteToWarlockChance = 0.4f; private const float c_hoverReportMinDistance = 0.1f; private const float c_hoverReportMaxDistance = 3f; private const float c_respectDistanceFactor = 0.85f; private const string c_recruitHolding = "Holding position"; private const string c_recruitFollowing = "Following"; private const string c_recruitAttackingEnemy = "Attacking the enemy"; private const string c_recruitAttackingYou = "Attacking you"; private const string c_recruitPaniking = "Paniking"; private static WandPower m_command = WandPower.none; private static int m_commanderCount = 0; private static int m_warlockCount = 0; private static bool m_elderPowered = false; private static bool m_wandActive = false; private static bool m_radarActive = false; private static bool m_blockNextUpdate = false; private static GameObject m_droppedWand = null; private static ItemData m_heldWand = null; private static Character m_nearestEnemy = null; private static PinData m_nearestEnemyPin = null; private static int m_nearestEnemyPriority = 0; private static float m_aoeRadius = 0f; private static float m_nearestEnemyDF = 0f; private static Dictionary m_armyPin = new Dictionary(); private static Color m_fadeColorFrom = Color.black; private static Color m_fadeColorTo = Color.black; private static bool m_debugMode = false; private static Color m_droppedColorDebug = Color.black; private static Color m_torchColorDebug = Color.white; private static Color m_respectColorDebug = Color.yellow; private static Color m_fleeColorDebug = Color.cyan; private static Color m_shieldColorDebug = new Color(0.4f, 0.7f, 1f); private static Color m_callingColorDebug = Color.magenta; private static Color m_holdColorDebug = new Color(1f, 0.3f, 0f, 0f); private static Color m_rallyColorDebug = Color.green; private static Color m_attackColorDebug = Color.red; private static Color m_retreatColorDebug = Color.blue; private static string m_previousGaurdianPower = ""; private const string c_elderScrollHead = "The following I scribe at bequest of the Greydwarf. It is all I recall of my Dreaming, save waking\r\nin the forest, upright in the middle of the day with the sound of screaming in my head, or possibly that of\r\nmy own snarling! The dream vision of The Elder was deeply disturbing, far more so than I can relate."; private const string c_elderScrollText = "I am floating high above the forest. The air below is full of smoke, pulsating with a wonderous display of\r\ncolors from lightning and explosions. I hear snickering, as if trying to hold back more boisterous laughter.\r\nBut it is not me, for I am descending towards the chaos, slowly realizing the belied mayhem and horrow below.\r\nThe forest is afire, trees bursting into flame. Greydwarf and wildlife are panicking and running in all\r\ndirections, many also aflame or exploding. Swarms of goblins are causally following behind the wave of\r\ndevastation, slaughtering anything left alive. But now The Elder stands before them, raging as never before.\r\nThe fire and magical energy bursts now appear to be drawn, if not directed, towards the giant, where they are\r\nextinguished almost immediately. At first the on-slaught is halted and the screams become those of the Fulring\r\ncrushed and ripped apart by root and bough. But the flames gradually start to take hold and soon the Elder\r\nfalters. The scene fades into the distance, and I am a small human alone in the forest. Only not alone, for I ride\r\na proud stag and around me are Greydwarf in ranks not seen since ages past. My expression is dire as I raise a\r\nglowing staff above my head and begin a slow march towards the small Fulring village. The Greydwarf army follows\r\nclose behind me and yet I fear it may not be enough. Violence and loss ensue, but finally glory when it is their\r\nleader that is felled. Now I am on the plains, again at the head of the Greydwarf legion, its ranks swelled\r\nand more powerful than before. Before us lies the next Fulring tribe, and its cheftain that we must destroy.\r\nAgain I raise the signal to attack. But it is not Greydwarf that overtake me but Fulring, as if unleashed."; private const string c_elderScrollFoot = "Ruith Joroasatr, Archdruid to the Riki Myrkvior"; public static void ModifyAttack(Attack attack) { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) WUTIL.TimerReset("ygnie_tamed_cooldown", 1f); float num = 1f; float num2 = 1f; m_aoeRadius = 0f; if (attack.m_attackAnimation == "swing_pickaxe") { if (WUTIL.GetButton("Jump") || Flight.IsFlying()) { attack.m_attackAnimation = "knife_secondary"; num = 2f; m_aoeRadius = 4f; } else if (((Character)Player.m_localPlayer).IsCrouching()) { attack.m_attackAnimation = "swing_sledge"; num = 1.5f; m_aoeRadius = 2f; } else if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "battleaxe_secondary"; m_aoeRadius = 0.25f; } else { m_aoeRadius = 1f; } } else if (WUTIL.GetButton("Block")) { attack.m_attackAnimation = "atgeir_secondary"; num = 1.5f; } attack.m_attackType = (AttackType)0; attack.m_attackChainLevels = 0; attack.m_hitTerrain = attack.m_attackAnimation == "swing_sledge"; attack.m_attackHeight = 1f; switch (attack.m_attackAnimation) { case "swing_pickaxe": case "swing_sledge": case "knife_secondary": attack.m_attackType = (AttackType)1; attack.m_hitTerrain = true; attack.m_attackHeight = 0.1f; num2 = ((attack.m_attackAnimation == "knife_secondary") ? 3 : 2); break; case "battleaxe_attack": attack.m_attackChainLevels = 3; break; } attack.m_damageMultiplier = num; attack.m_forceMultiplier = num * num2; attack.m_staggerMultiplier = num * num2; } public static void PowerAttacker(Character attacker, Attack attack) { if (m_elderPowered && m_command == WandPower.attack && Alignment.GetClan(attacker) == "Greydwarf") { float num = 1.5f + Mathf.Max(0.5f * (float)m_commanderCount, 2f); attack.m_damageMultiplier *= num; attack.m_speedFactor *= num; attack.m_speedFactorRotation *= num; if (m_warlockCount > 0 && attacker.GetHealthPercentage() < 0.2f) { float num2 = 1f + Mathf.Max(0.02f * (float)m_commanderCount, 0.1f); attacker.SetHealth(attacker.GetMaxHealth() + attacker.GetMaxHealth() * num2); } } } public static void Update() { bool flag = WUTIL.Timer("Elder_power") > 0f; if (m_elderPowered != flag) { SetPowered(flag); WUTIL.TimerReset("elderwand_requip", 0.2f); WUTIL.HideHandItems(); } else if (WUTIL.TimerIsAlmost("elderwand_requip", 0f)) { WUTIL.ShowHandItems(); } CheckArmy(); } public static void SetPowered(bool powered) { bool flag = powered != m_elderPowered; m_elderPowered = powered; if (flag) { m_blockNextUpdate = false; Equip(); } } public static bool IsPowered() { return m_elderPowered; } public static bool IsActive() { return m_wandActive; } public static string GetCommandMode() { return m_command.ToString().ToUpper(); } public static void SetDebugMode(bool debugMode) { if (debugMode != m_debugMode) { m_debugMode = debugMode; SwapColors(ref m_droppedColorDebug, ref droppedColor); SwapColors(ref m_torchColorDebug, ref torchColor); SwapColors(ref m_respectColorDebug, ref respectColor); SwapColors(ref m_fleeColorDebug, ref fleeColor); SwapColors(ref m_shieldColorDebug, ref shieldColor); SwapColors(ref m_callingColorDebug, ref callingColor); SwapColors(ref m_holdColorDebug, ref holdColor); SwapColors(ref m_rallyColorDebug, ref rallyColor); SwapColors(ref m_attackColorDebug, ref attackColor); SwapColors(ref m_retreatColorDebug, ref retreatColor); } } public static bool GetDebugMode() { return m_debugMode; } public static void Equip(ItemData checkItem = null, WandAction action = WandAction.check) { //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: 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) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || ((Character)Player.m_localPlayer).IsTeleporting()) { return; } if (m_blockNextUpdate) { m_blockNextUpdate = false; return; } ItemData rightItem = WUTIL.GetRightItem(); ItemData leftItem = WUTIL.GetLeftItem(); bool flag = IsElderWand(rightItem); bool flag2 = IsElderWand(leftItem); bool flag3 = IsElderWand(checkItem); bool flag4 = flag2 || flag || flag3; if (!flag4 && m_command == WandPower.none) { return; } WandPower command = m_command; WDBUG.Log($"ElderWand.Update({checkItem != null}, {action}) isMoving: {flag3} right: {flag}: left {flag2} current command: {m_command}", WDBUG.Level.ElderWand); if (action == WandAction.drop && flag3) { if (m_debugMode) { string text = (m_elderPowered ? "Magenta" : "Black"); WDBUG.Log("ElderWand should be " + text, WDBUG.Level.show); } m_command = (m_elderPowered ? WandPower.calling : WandPower.none); SetFadeColor(checkItem, m_elderPowered ? callingColor : droppedColor); flag = (flag2 = false); m_droppedWand = checkItem.m_dropPrefab; } if (action == WandAction.ready && flag4) { if (wandReadyPower) { if (m_debugMode) { string text2 = (m_elderPowered ? "Orange" : "White"); WDBUG.Log("ElderWand should be " + text2, WDBUG.Level.show); } SetFadeColor(flag ? rightItem : leftItem, m_elderPowered ? holdColor : torchColor); m_command = ((!m_elderPowered) ? WandPower.backlight : WandPower.hold); } else { action = WandAction.unequip; } flag = (flag2 = false); m_blockNextUpdate = true; } if (action == WandAction.unequip && flag3) { if (m_debugMode) { WDBUG.Log("ElderWand unequiped (color Black)", WDBUG.Level.show); } m_command = WandPower.none; SetFadeColor(checkItem, droppedColor); flag = (flag2 = false); } if (flag2) { if (rightItem == null) { if (WUTIL.Timer("elderwand_rhs_swap") > 0f || WUTIL.Timer("thorscorn_fly") > 0f) { return; } if (torchUnarmedPower) { if (torchToWeapon) { m_blockNextUpdate = true; ((Humanoid)Player.m_localPlayer).UnequipItem(leftItem, false); m_blockNextUpdate = true; ((Humanoid)Player.m_localPlayer).EquipItem(leftItem, false); } if (m_debugMode) { string text3 = (m_elderPowered ? "Blue" : "Skyblue"); WDBUG.Log("ElderWand should be " + text3, WDBUG.Level.show); } m_command = (m_elderPowered ? WandPower.retreat : WandPower.torch); SetFadeColor(leftItem, m_elderPowered ? retreatColor : shieldColor); } else if (torchToWeapon) { if (m_debugMode) { WDBUG.Log("ElderWand should move to right hand", WDBUG.Level.show); } m_blockNextUpdate = true; ((Humanoid)Player.m_localPlayer).UnequipItem(leftItem, false); ((Humanoid)Player.m_localPlayer).EquipItem(leftItem, false); return; } } else { if (action == WandAction.check && !flag3) { WUTIL.TimerReset("elderwand_rhs_swap", 0.1f); return; } if (m_debugMode) { string text4 = (m_elderPowered ? "Red" : "Cyan"); WDBUG.Log("ElderWand should be " + text4, WDBUG.Level.show); } m_command = (m_elderPowered ? WandPower.attack : WandPower.fear); SetFadeColor(leftItem, m_elderPowered ? attackColor : fleeColor); } } else if (flag) { m_command = (m_elderPowered ? WandPower.rally : WandPower.respect); if (m_debugMode) { string text5 = (m_elderPowered ? "Green" : "Yellow"); WDBUG.Log("ElderWand should be " + text5, WDBUG.Level.show); } SetFadeColor(rightItem, m_elderPowered ? rallyColor : respectColor); } else if (action == WandAction.equip && !flag3 && m_command != WandPower.none) { if (m_debugMode) { WDBUG.Log("ElderWand should be unequiped from readied (Black)", WDBUG.Level.show); } m_command = WandPower.none; SetFadeColor(leftItem, droppedColor); } bool flag5 = m_elderPowered && m_command != WandPower.calling && m_command != WandPower.none; if (m_radarActive && !flag5) { WDBUG.Log($"ElderWand army size {m_armyPin.Count} on unequip", WDBUG.Level.ElderWand); ResetArmy(); } m_radarActive = flag5; if (command == m_command && action != WandAction.check) { return; } SetElderPower(m_command != WandPower.none && m_command != WandPower.calling); if (m_radarActive && (flag4 || m_command == WandPower.hold)) { WUTIL.Message(GetCommandMode() + "!", center: true, WUTIL.GetIcon("TrophyTheElder")); if (m_command != WandPower.attack) { RemoveAttackMarker(); } } foreach (Character key in m_armyPin.Keys) { ApplyCommand(m_command, key); } } public static bool IgnoreEnemy(Character character) { //IL_004b: 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) if (!AffectCharacter(character)) { return false; } if (m_command == WandPower.retreat) { character.SetRun(true); } else if (m_command != WandPower.rally) { return false; } return Vector3.Distance(((Component)character).transform.position, ((Component)Player.m_localPlayer).transform.position) > 8f; } public static string HealOrPromote(Character recruit, bool elderWand = true) { //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Expected O, but got Unknown //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) bool flag = !elderWand; float healthPercentage = recruit.GetHealthPercentage(); string text = ""; if (elderWand) { if (healthPercentage >= 0.95f) { return text; } string text2 = RecruitStatus(recruit); if (text2 == "Attacking you" || text2 == "Paniking") { return text; } Alignment.StopHunt(recruit, tame: true); } bool flag2 = true; string hoverName = recruit.GetHoverName(); if (flag || healthPercentage < 0.4f) { text = (elderWand ? "The Elder Wand promoted the veteran " : "Promoted the ") + hoverName; if (recruit.GetLevel() < 3) { Transform boneTransform = ((Component)recruit).GetComponentInChildren().GetBoneTransform((HumanBodyBones)10); Player.m_localPlayer.m_skillLevelupEffects.Create(boneTransform.position, boneTransform.rotation, boneTransform, 1f, -1); recruit.SetLevel(recruit.GetLevel() + 1); recruit.SetHealth(recruit.GetMaxHealth()); WUTIL.CreateAttachedEffect("vfx_HealthUpgrade", ((Component)recruit).transform); flag2 = false; } else { string text3 = WUTIL.ActorName(recruit); string text4 = ""; switch (text3) { case "Greyling": text4 = "Greydwarf"; break; case "Greydwarf": text4 = (WUTIL.TestLuck(0.2f) ? "Greydwarf_Shaman" : "Greydwarf_Elite"); break; case "Greydwarf_Shaman": text4 = (WUTIL.TestLuck(0.4f) ? "Greydwarf_Warlock" : ""); break; case "Greydwarf_Elite": text4 = "Greydwarf_Commander"; break; case "Goblin": case "GoblinArcher": case "GoblinShaman": if (!flag) { break; } if (Quest.GetAchievement("DarklingShade") == 100) { if (Loki.AnointPrince(recruit, anoint: true, 7, useClass: true, anounce: true)) { return "Anointed " + hoverName + " as Prince " + recruit.GetHoverName(); } } else if (text3 == "Goblin") { text4 = (WUTIL.TestLuck(0.2f) ? "GoblinShaman" : "GoblinArcher"); } else if (text3 == "GoblinArcher") { text4 = (WUTIL.TestLuck(0.2f) ? "GoblinShaman" : "GoblinBrute"); } break; case "Draugr": case "Draugr_Ranged": if (flag) { text4 = ((text3 == "Draugr") ? "Draugr_Ranged" : "Draugr_Elite"); } break; } if (text4 == "") { text = ""; } else { GameObject val = WUTIL.Spawn(text4, ((Component)recruit).transform.position, ((Component)recruit).transform.rotation); if ((Object)(object)val != (Object)null) { Character component = val.GetComponent(); text = text + " to a " + component.GetHoverName(); AffectCharacter(component); WUTIL.CreateAttachedEffect("vfx_StaminaUpgrade", ((Component)component).transform); WUTIL.Destroy(((Component)recruit).gameObject); recruit = component; flag2 = false; Quest.CheckObjective(44, text4 != "Greydwarf_Warlock"); } } } } if (flag2) { float num = recruit.GetMaxHealth() - recruit.GetHealth(); if (num > 0f) { if (text == "") { text = (elderWand ? "The Elder Wand is healing " : "Healed the ") + hoverName; } float num2 = num * 0.5f / 10f; SE_Stats val2 = (SE_Stats)ScriptableObject.CreateInstance(typeof(SE_Stats)); val2.m_healthOverTimeInterval = 0f; val2.m_tickInterval = 0.5f; ((StatusEffect)val2).m_ttl = 10f; val2.m_healthPerTick = Mathf.Max(20f, (float)(int)(0.5f + num2)); recruit.GetSEMan().AddStatusEffect((StatusEffect)(object)val2, false, 0, 0f); WUTIL.CreateAttachedEffect("vfx_Potion_health_medium", ((Component)recruit).transform); WUTIL.PlaySfx("sfx_Potion_health_Start", ((Component)recruit).transform.position); } } return text; } public static bool AffectCharacter(Character character, float distanceFactor = 1f) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) if (!ObeysElderWand(character)) { return false; } if (!m_elderPowered) { if (distanceFactor < 0.85f && character.GetBaseAI().IsAlerted()) { Alignment.StopHunt(character); } return true; } if (m_armyPin.ContainsKey(character)) { m_armyPin[character].m_pos = ((Component)character).transform.position; } else { string subjectMarkerName = MapMarker.GetSubjectMarkerName(WUTIL.ActorName(character)); if (subjectMarkerName != "") { PinData val = MapMarker.AddPin(((Component)character).transform.position, subjectMarkerName); if (val != null) { val.m_worldSize += (float)(character.GetLevel() - 1); m_armyPin.Add(character, val); ApplyCommand(m_command, character); } } } if ((Object)(object)m_nearestEnemy != (Object)null && m_nearestEnemyPin != null) { m_nearestEnemyPin.m_pos = ((Component)m_nearestEnemy).transform.position; if (m_command == WandPower.attack && (Object)(object)((BaseAI)/*isinst with value type is only supported in some contexts*/).GetTargetCreature() != (Object)(object)Player.m_localPlayer) { ApplyCommand(m_command, character); } } if (m_armyPin.Count >= 10 && Quest.CheckObjective(43, set: true, test: true)) { int num = 0; foreach (PinData value in m_armyPin.Values) { if (WUTIL.WithinCylinder(value.m_pos, ((Component)Player.m_localPlayer).transform.position, 12f, 99f) && ++num >= 10) { Quest.CheckObjective(43, set: false); if (num >= 20) { Quest.CheckObjective(44); } break; } } } return true; } public static void TrackEnemy(Character character, float distanceFactor) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0183: Unknown result type (might be due to invalid IL or missing references) if (m_command != WandPower.attack || (int)character.GetFaction() == 2) { return; } Character hoverCreature = Player.m_localPlayer.GetHoverCreature(); bool flag = (Object)(object)hoverCreature != (Object)null && !hoverCreature.IsDead(); if (flag && (int)hoverCreature.GetFaction() == 0) { flag = ((Character)Player.m_localPlayer).IsPVPEnabled(); } int num = ((!flag) ? Array.IndexOf("Goblin,Enemy,Undead,Monster".Split(new char[1] { ',' }), Alignment.GetMarkerName(character)) : 0); if (num < 0) { return; } if (flag) { distanceFactor = 2f; character = hoverCreature; WDBUG.Log("Marked specific enemy " + character.GetHoverName(), WDBUG.Level.ElderWand); } if (!((Object)(object)m_nearestEnemy == (Object)null) && num >= m_nearestEnemyPriority && (num != m_nearestEnemyPriority || !(distanceFactor > m_nearestEnemyDF))) { return; } if ((Object)(object)character != (Object)(object)m_nearestEnemy) { WDBUG.Log($"Assigning nearest priority {num} enemy: {WUTIL.ActorName(character)} " + "replaces: " + WUTIL.ActorName(m_nearestEnemy), WDBUG.Level.ElderWand); m_nearestEnemy = character; if (m_nearestEnemyPin != null) { MapMarker.TagPinForRemoval(m_nearestEnemyPin); m_nearestEnemyPin = null; } m_nearestEnemyPin = MapMarker.AddPin(((Component)m_nearestEnemy).transform.position, "Attack"); } m_nearestEnemyDF = distanceFactor; m_nearestEnemyPriority = num; } public static void TeleportArmy(Vector3 offset) { //IL_004b: 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_0051: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair item in m_armyPin) { if ((Object)(object)item.Key != (Object)null && !item.Key.IsDead()) { Transform transform = ((Component)item.Key).transform; transform.position += offset; } } } public static bool UpdateHoverReport() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (!m_elderPowered) { return false; } Character hoverCreature = Player.m_localPlayer.GetHoverCreature(); if ((Object)(object)hoverCreature == (Object)null) { return false; } string hoverReport = GetHoverReport(hoverCreature); if (hoverReport == "") { return false; } if (centerHoverReport) { if (!TextViewer.instance.IsVisible()) { ((TMP_Text)Hud.instance.m_hoverName).text = hoverReport; ((Graphic)Hud.instance.m_crosshair).color = Color.yellow; } } else { PinData val = MapMarker.PinDataFromMarkerName(WUTIL.ActorName(hoverCreature)); WUTIL.Message(hoverReport, center: false, val.m_icon); } return true; } public static string GetHoverReport(Character character) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (m_radarActive && m_command != WandPower.none && ObeysElderWand(character)) { float num = Vector3.Distance(((Component)character).transform.position, ((Component)Player.m_localPlayer).transform.position); if (num >= 0.1f && num <= 3f) { float healthPercentage = character.GetHealthPercentage(); string text = ((healthPercentage < 0.95f) ? "injured " : ""); string text2 = ((healthPercentage < 0.4f) ? "veteran" : "recruit"); string text3 = RecruitStatus(character); string text4 = ""; string text5 = " to "; if (text3 == "Attacking you" || text3 == "Paniking") { text4 = "calm"; } else if (healthPercentage < 0.95f) { text4 = ((healthPercentage < 0.4f && IsPromotable(character)) ? "promote" : "heal"); } else { text5 = "to order to "; text4 = ((text3 == "Holding position") ? "follow" : "hold position"); } string text6 = WUTIL.KeyHighlightText("Use"); text4 = WUTIL.KeyHighlightText(text4, "", braces: false, bold: false); return character.GetHoverName() + ": " + text + text2 + "\nStatus: " + text3 + "\n" + text6 + " " + text5 + text4; } } return ""; } public static string RecruitStatus(Character character) { BaseAI baseAI = character.GetBaseAI(); MonsterAI val = (MonsterAI)(object)((baseAI is MonsterAI) ? baseAI : null); if (!((BaseAI)val).IsAlerted()) { return ((Object)(object)val.GetFollowTarget() == (Object)null) ? "Holding position" : "Following"; } if ((Object)(object)((BaseAI)val).GetTargetCreature() != (Object)null || m_command == WandPower.attack) { return ((Object)(object)((BaseAI)val).GetTargetCreature() == (Object)(object)Player.m_localPlayer) ? "Attacking you" : "Attacking the enemy"; } return "Paniking"; } public static bool Interact(GameObject go) { //IL_0039: 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) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if (m_elderPowered && WUTIL.Timer("ewand_cooldown") == 0f) { Character component = go.GetComponent(); if (ObeysElderWand(component) && Vector3.Distance(((Component)component).transform.position, ((Component)Player.m_localPlayer).transform.position) <= 3f) { if (HealOrPromote(component) == "") { string text = (Alignment.ToggleFollowing(component) ? "following you" : "holding position"); WUTIL.Message("The " + component.GetHoverName() + " is now " + text, center: false); WUTIL.PlaySfx("sfx_greyling_idle", ((Component)component).transform.position); } WUTIL.TimerReset("ewand_cooldown", WUTIL.TestLuck() ? 0f : 0.5f); return true; } } return false; } public static bool ObeysElderWand(Character character) { if ((Object)(object)character == (Object)null || m_command == WandPower.none) { return false; } if (Alignment.GetClan(character) == "Greydwarf") { return true; } if (m_elderPowered) { return WUTIL.ActorName(character) == "Troll"; } return Turned(character); } public static bool ObeysElderLight(Character character) { return m_elderPowered && (Alignment.GetClan(character) == "Greydwarf" || WUTIL.ActorName(character) == "Troll"); } public static bool Turned(Character character) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 return (int)character.GetFaction() == 3 && (m_command == WandPower.fear || m_command == WandPower.attack); } public static bool IsElderWand(ItemData item) { return item != null && (Object)(object)item.m_dropPrefab != (Object)null && ((Object)item.m_dropPrefab).name == "Wildling_ElderWand"; } public static void RemoveAttackMarker() { m_nearestEnemy = null; if (m_nearestEnemyPin != null) { MapMarker.TagPinForRemoval(m_nearestEnemyPin); m_nearestEnemyPin = null; } } public static void ClearDeadTargetMarkers() { if (((Object)(object)m_nearestEnemy == (Object)null || (Object)(object)((Component)m_nearestEnemy).gameObject == (Object)null || m_nearestEnemy.IsDead()) && m_nearestEnemyPin != null) { MapMarker.TagPinForRemoval(m_nearestEnemyPin); m_nearestEnemyPin = null; } Dictionary dictionary = new Dictionary(); foreach (KeyValuePair item in m_armyPin) { Character key = item.Key; if ((Object)(object)key == (Object)null || key.IsDead() || (Object)(object)((Component)key).gameObject == (Object)null) { if (item.Value != null) { MapMarker.TagPinForRemoval(m_armyPin[key]); } } else { dictionary.Add(key, item.Value); } } m_armyPin = dictionary; } public static void ResetArmy() { foreach (Character key in m_armyPin.Keys) { MapMarker.TagPinForRemoval(m_armyPin[key]); Alignment.StopHunt(key); key.SetTamed(false); } m_armyPin.Clear(); m_radarActive = false; RemoveAttackMarker(); } public static void SetElderPower(bool set = true) { if (!Wildling.IsWildling) { set = false; } else if (set) { int achievement = Quest.GetAchievement("ElderLight"); if (achievement == 0) { if (Quest.HuntingElderWand(found: true)) { set = true; } else { Quest.SetAchievement("ElderLight", 3); } } else { set = achievement == 1; } } string guardianPowerName = Player.m_localPlayer.GetGuardianPowerName(); if (guardianPowerName == "GP_ElderLight") { if (!set) { if (m_previousGaurdianPower == "" && Quest.GetAchievement("BoundYgnie") == 1) { m_previousGaurdianPower = "GP_EikthyrBinding"; } Player.m_localPlayer.SetGuardianPower(m_previousGaurdianPower); m_previousGaurdianPower = ""; } } else if (set) { Player.m_localPlayer.SetGuardianPower("GP_ElderLight"); m_previousGaurdianPower = guardianPowerName; } m_wandActive = m_elderPowered && set; } public static void ReadScroll(ItemData item, bool equiping) { if (equiping && !(WUTIL.ItemName(item) != "ElderScroll")) { if (InventoryGui.IsVisible()) { InventoryGui.instance.Hide(); } string text = WUTIL.KeyHighlightText("Use"); Loki.m_runicText = "The following I scribe at bequest of the Greydwarf. It is all I recall of my Dreaming, save waking\r\nin the forest, upright in the middle of the day with the sound of screaming in my head, or possibly that of\r\nmy own snarling! The dream vision of The Elder was deeply disturbing, far more so than I can relate.\n\nI am floating high above the forest. The air below is full of smoke, pulsating with a wonderous display of\r\ncolors from lightning and explosions. I hear snickering, as if trying to hold back more boisterous laughter.\r\nBut it is not me, for I am descending towards the chaos, slowly realizing the belied mayhem and horrow below.\r\nThe forest is afire, trees bursting into flame. Greydwarf and wildlife are panicking and running in all\r\ndirections, many also aflame or exploding. Swarms of goblins are causally following behind the wave of\r\ndevastation, slaughtering anything left alive. But now The Elder stands before them, raging as never before.\r\nThe fire and magical energy bursts now appear to be drawn, if not directed, towards the giant, where they are\r\nextinguished almost immediately. At first the on-slaught is halted and the screams become those of the Fulring\r\ncrushed and ripped apart by root and bough. But the flames gradually start to take hold and soon the Elder\r\nfalters. The scene fades into the distance, and I am a small human alone in the forest. Only not alone, for I ride\r\na proud stag and around me are Greydwarf in ranks not seen since ages past. My expression is dire as I raise a\r\nglowing staff above my head and begin a slow march towards the small Fulring village. The Greydwarf army follows\r\nclose behind me and yet I fear it may not be enough. Violence and loss ensue, but finally glory when it is their\r\nleader that is felled. Now I am on the plains, again at the head of the Greydwarf legion, its ranks swelled\r\nand more powerful than before. Before us lies the next Fulring tribe, and its cheftain that we must destroy.\r\nAgain I raise the signal to attack. But it is not Greydwarf that overtake me but Fulring, as if unleashed.\n\nRuith Joroasatr, Archdruid to the Riki Myrkvior"; string text2 = "The following I scribe at bequest of the Greydwarf. It is all I recall of my Dreaming, save waking\r\nin the forest, upright in the middle of the day with the sound of screaming in my head, or possibly that of\r\nmy own snarling! The dream vision of The Elder was deeply disturbing, far more so than I can relate.\n\nI am floating high above the forest. The air below is full of smoke, pulsating with a wonderous display of\r\ncolors from lightning and explosions. I hear snickering, as if trying to hold back more boisterous laughter.\r\nBut it is not me, for I am descending towards the chaos, slowly realizing the belied mayhem and horrow below.\r\nThe forest is afire, trees bursting into flame. Greydwarf and wildlife are panicking and running in all\r\ndirections, many also aflame or exploding. Swarms of goblins are causally following behind the wave of\r\ndevastation, slaughtering anything left alive. But now The Elder stands before them, raging as never before.\r\nThe fire and magical energy bursts now appear to be drawn, if not directed, towards the giant, where they are\r\nextinguished almost immediately. At first the on-slaught is halted and the screams become those of the Fulring\r\ncrushed and ripped apart by root and bough. But the flames gradually start to take hold and soon the Elder\r\nfalters. The scene fades into the distance, and I am a small human alone in the forest. Only not alone, for I ride\r\na proud stag and around me are Greydwarf in ranks not seen since ages past. My expression is dire as I raise a\r\nglowing staff above my head and begin a slow march towards the small Fulring village. The Greydwarf army follows\r\nclose behind me and yet I fear it may not be enough. Violence and loss ensue, but finally glory when it is their\r\nleader that is felled. Now I am on the plains, again at the head of the Greydwarf legion, its ranks swelled\r\nand more powerful than before. Before us lies the next Fulring tribe, and its cheftain that we must destroy.\r\nAgain I raise the signal to attack. But it is not Greydwarf that overtake me but Fulring, as if unleashed.\n\nRuith Joroasatr, Archdruid to the Riki Myrkvior\n\n" + text + " to stop reading."; TextViewer.instance.ShowText((Style)0, "The Elder Scroll", text2, true); } } public static void SetLeftHandTorchColor(ItemData item) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) SetFadeColor(item, m_elderPowered ? retreatColor : shieldColor); } public static void UpdateColor() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0033: 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_004a: 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_0060: 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) float num = WUTIL.Timer("elderwandcolor"); if (num > 0f) { Color fadeColorFrom = m_fadeColorFrom; m_fadeColorFrom = Color.Lerp(m_fadeColorTo, m_fadeColorFrom, num / 2f); WDBUG.Log($"{m_fadeColorFrom} = {fadeColorFrom} -> {m_fadeColorTo} ({num / 2f})", WDBUG.Level.ElderWand); SetColor(m_heldWand, m_fadeColorFrom); } } private static void SetFadeColor(ItemData item, Color color) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_005a: Unknown result type (might be due to invalid IL or missing references) if (item != null) { if (!enableColorFade || color == droppedColor) { WUTIL.TimerReset("elderwandcolor"); m_fadeColorFrom = color; SetColor(item, color); } else { WUTIL.TimerReset("elderwandcolor", 2f); } m_fadeColorTo = color; } m_heldWand = item; } private static void SetColor(ItemData item, Color color) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (item != null && (Object)(object)item.m_dropPrefab != (Object)null) { Transform val = item.m_dropPrefab.transform.Find("attach/Attack"); if ((Object)(object)val != (Object)null) { Light component = ((Component)val).GetComponent(); component.color = color; } Transform val2 = item.m_dropPrefab.transform.Find("attach/Glow"); if ((Object)(object)val2 != (Object)null) { Light component2 = ((Component)val2).GetComponent(); component2.color = color; } } } private static void SwapColors(ref Color color1, ref Color color2) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Color val = color1; color1 = color2; color2 = val; } private static void ApplyCommand(WandPower command, Character recruit) { switch (command) { case WandPower.hold: Alignment.StopHunt(recruit, tame: true); Alignment.HuntTargetAndAlert(recruit, null, alert: false); break; case WandPower.rally: Alignment.HuntTargetAndAlert(recruit, null, alert: false); Alignment.ToggleFollowing(recruit); break; case WandPower.attack: Alignment.StopHunt(recruit, tame: true); Alignment.HuntTargetAndAlert(recruit, m_nearestEnemy); break; case WandPower.retreat: Alignment.HuntTargetAndAlert(recruit, null, alert: false); Alignment.ToggleFollowing(recruit); recruit.SetRun(true); break; case WandPower.calling: Alignment.GuardObject(recruit, m_droppedWand); break; } } private static bool IsPromotable(Character recruit) { if (recruit.GetLevel() < 3) { return true; } string text = WUTIL.ActorName(recruit); if (text == "Troll" || text == "Greydwarf_Shaman") { return false; } return Alignment.GetClanRank(recruit) < 4; } private static void CheckArmy() { m_commanderCount = 0; m_warlockCount = 0; foreach (KeyValuePair item in m_armyPin) { if (WUTIL.ActorName(item.Key) == "Greydwarf_Commander") { m_commanderCount++; } else if (WUTIL.ActorName(item.Key) == "Greydwarf_Warlock") { m_warlockCount++; } } } } public class WUTIL { [HarmonyPatch(typeof(Player), "AddKnownText")] private class PatchPlayerAddKnownText { public static bool m_addText = true; public static bool m_delText = true; public static bool m_orderText = false; public static bool m_foundText = false; public static string m_priorityPrefix1 = "Objective:"; public static string m_priorityPrefix2 = "Achievement:"; public static string m_priorityPrefix3 = ">"; public static string m_removeDetail1 = "You "; public static string m_removeDetail2 = ">Grey"; private static bool Prefix(string label, string text, Dictionary ___m_knownTexts) { if (label != "Wildling log") { return true; } m_foundText = false; if (text.StartsWith("^^")) { if (m_addText) { ___m_knownTexts["Wildling log"] = text.Substring(2); } return false; } string text2 = (___m_knownTexts.ContainsKey("Wildling log") ? ___m_knownTexts["Wildling log"] : ""); if (text == "") { m_foundText = text2.Length == 0; if (m_orderText) { ___m_knownTexts["Wildling log"] = OrderObjectives(text2); } return false; } if (text2.Length == 0 || (text2.Length < 100 && text2.Contains("--- Check here"))) { if (m_addText) { WDBUG.Log("Add log text:\n" + text, WDBUG.Level.Progress); ___m_knownTexts["Wildling log"] = text; } return false; } if (text2 == text || text2.StartsWith(text + "\n")) { m_foundText = true; if (m_delText && !m_addText) { if (text2 == text) { ___m_knownTexts["Wildling log"] = ""; } else { ___m_knownTexts["Wildling log"] = text2.Substring(text.Length + 2); } } return false; } if (m_orderText) { text2 = OrderObjectives(text2); } if (text2.EndsWith("\n\n" + text)) { m_foundText = true; if (m_delText) { text2 = text2.Remove(text2.Length - text.Length - 2); } } else { int num = text2.IndexOf("\n" + text + "\n"); if (num >= 0) { m_foundText = true; if (m_delText) { text2 = text2.Remove(num) + text2.Substring(num + text.Length + 2); } } } if (m_addText) { WDBUG.Log((m_foundText ? "Update" : "Add") + " log text:\n" + text, WDBUG.Level.Progress); text2 = text + "\n\n" + text2; if (text2.Length > 8000) { int startIndex = Math.Min(text2.LastIndexOf("\n\n"), 8000); WDBUG.Log("Wildling log length " + text2.Length + " cut to " + startIndex, WDBUG.Level.Progress); ___m_knownTexts["Wildling log"] = text2.Remove(startIndex); } else { ___m_knownTexts["Wildling log"] = text2; } } else if (m_foundText && m_delText) { WDBUG.Log("Removed log text:\n" + text, WDBUG.Level.Progress); ___m_knownTexts["Wildling log"] = text2; } return false; } private static string OrderObjectives(string objectives) { string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; int num = 0; while (true) { int num2 = objectives.IndexOf("\n\n", num); string text5 = ((num2 >= 0) ? objectives.Substring(num, num2 - num + 2) : (objectives.Substring(num) + "\n\n")); bool flag = m_delText; if (m_addText) { if (text5.Contains(m_priorityPrefix1)) { text += text5; flag = false; } else if (text5.Contains(m_priorityPrefix2)) { text2 += text5; flag = false; } else if (text5.Contains(m_priorityPrefix3)) { text3 += text5; flag = false; } } if (flag && !text5.StartsWith(m_removeDetail1) && !text5.Contains(m_removeDetail2)) { text4 += text5; } if (num2 < 0) { break; } num = num2 + 2; } text = text + text2 + text3 + text4; return text.EndsWith("\n\n") ? text.Remove(text.Length - 2) : text; } } [HarmonyPatch(typeof(MessageHud), "ShowMessage")] private class PatchMessageHudShowMessage { public static string m_logMessageOverride = ""; private static bool Prefix(List ___m_messageLog) { if (m_logMessageOverride.Length > 0) { ___m_messageLog.Add(m_logMessageOverride); m_logMessageOverride = ""; return false; } if (m_blockNextPlayerMessage) { m_blockNextPlayerMessage = false; return false; } return true; } } [HarmonyPatch(typeof(MessageHud), "AddLog")] private class PatchMessageHudAddLog { private static bool Prefix() { if (m_blockLogMessage) { m_blockLogMessage = false; return false; } return true; } } [HarmonyPatch(typeof(TextsDialog), "UpdateTextsList")] private class PatchTextsDialogUpdateTextsList { public static int m_wildlingLogRow = 1; private static void Postfix(List ___m_texts) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown int num = -1; for (int i = m_wildlingLogRow; i < ___m_texts.Count; i++) { if (___m_texts[i].m_topic == "Wildling log") { num = i; break; } } if (num > m_wildlingLogRow) { string text = ___m_texts[num].m_text; ___m_texts.RemoveAt(num); if (text != "") { ___m_texts.Insert(m_wildlingLogRow, new TextInfo("Wildling log", text)); } } } } [HarmonyPatch(typeof(Character), "GetHeadPoint")] private class PatchCharacter { private static void Postfix(Transform ___m_head) { m_characterHead = ___m_head; } } public const float c_stackItemDamageIgnored = 0.1f; public static int c_itemRayMask = LayerMask.GetMask(new string[1] { "item" }); public static int c_terrainRayMask = LayerMask.GetMask(new string[1] { "terrain" }); public static int c_pickableRayMask = LayerMask.GetMask(new string[1] { "piece_nonsolid" }); public static int c_characterRayMask = LayerMask.GetMask(new string[1] { "character" }); public static int c_pieceRayMask = LayerMask.GetMask(new string[1] { "piece" }); public static int c_foodRayMask = LayerMask.GetMask(new string[2] { "item", "character" }); public static int c_coverRayMask = LayerMask.GetMask(new string[5] { "Default", "static_solid", "Default_small", "piece", "vehicle" }); public static int c_viewBlockRayMask = LayerMask.GetMask(new string[7] { "Default", "static_solid", "Default_small", "piece", "terrain", "viewblock", "vehicle" }); public static int c_solidRayMask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "terrain", "vehicle" }); public static int c_dungeonRayMask = LayerMask.GetMask(new string[5] { "Default", "static_solid", "Default_small", "piece", "character" }); public static int c_dungeonItemRayMask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "Default_small", "piece", "character", "item" }); public static int c_raiseRayMask = LayerMask.GetMask(new string[2] { "character", "item" }); public static int c_solidPickableRayMask = LayerMask.GetMask(new string[6] { "Default", "piece", "piece_nonsolid", "static_solid", "blocker", "pathblocker" }); public static int c_blockingRayMask = LayerMask.GetMask(new string[8] { "Default", "static_solid", "Default_small", "piece", "blocker", "pathblocker", "character", "vehicle" }); public static int c_dungeonPiecesScanRayMask = LayerMask.GetMask(new string[5] { "Default", "static_solid", "piece", "piece_nonsolid", "item" }); public static int c_dungeonPiecesDestroyMask = LayerMask.GetMask(new string[7] { "Default", "item", "piece", "piece_nonsolid", "static_solid", "Default_small", "character" }); public static int c_dungeonPieceRestoreMask = LayerMask.GetMask(new string[5] { "Default", "item", "piece", "piece_nonsolid", "static_solid" }); public static int c_growSpaceMask = LayerMask.GetMask(new string[5] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid" }); public static int c_harvestMask = LayerMask.GetMask(new string[4] { "Default_small", "piece", "piece_nonsolid", "item" }); public static long PlayerID = 0L; public static ZNetView Player_nview = null; public static ZSyncAnimation Player_zanim = null; public static bool m_updateLateStartup = true; public static bool m_captureHeldItems = false; public static bool m_allowCustomEquip = true; private const int c_wildlingLogMaxSize = 8000; private const string c_wildlingLogLabel = "Wildling log"; private static bool m_blockLogMessage = false; private static bool m_blockNextPlayerMessage = false; private static string m_delayedMessage = ""; private static Transform m_handTransform = null; private static Transform m_headTransform = null; private static List m_equipedItems = new List(); private static List m_randomSeedStack = new List(); private static Dictionary m_timers = new Dictionary(); private static Sprite m_delayedMessageIcon = null; private static Transform m_characterHead = null; public static void Reset() { Player_nview = null; Player_zanim = null; PlayerID = 0L; m_captureHeldItems = false; m_allowCustomEquip = true; m_updateLateStartup = true; m_timers.Clear(); m_equipedItems.Clear(); m_randomSeedStack.Clear(); } public static void Message(string msg, bool center = true, Sprite icon = null, bool blockNext = false, bool logOpt = false) { if ((Object)(object)icon != (Object)null) { center = false; } if ((Object)(object)MessageHud.instance != (Object)null && msg != "") { if (logOpt) { if (center) { center = false; MessageHud.instance.ShowMessage((MessageType)2, msg, 0, (Sprite)null, false); } else { m_blockLogMessage = true; } } MessageHud.instance.ShowMessage((MessageType)((!center) ? 1 : 2), msg, 0, icon, false); } m_blockNextPlayerMessage = blockNext; } public static void DelayedMessage(string msg, float delay = 5f, Sprite icon = null) { m_delayedMessage = msg; m_delayedMessageIcon = icon; TimerReset("delayed_message_cooldown", delay); } public static void UpdateDelayedMessage() { if (m_delayedMessage != "" && TimerIsAlmost("delayed_message_cooldown", 0f)) { FlushDelayedMessage(); } } public static bool FlushDelayedMessage(bool show = true, Sprite icon = null) { bool flag = m_delayedMessage != "" && Timer("delayed_message_cooldown") > 0f; if (flag && show) { if (m_delayedMessage.StartsWith("LOUD:")) { Message(m_delayedMessage.Substring(5)); } else { Message(m_delayedMessage, center: false, ((Object)(object)icon == (Object)null) ? m_delayedMessageIcon : icon); } } m_delayedMessage = ""; m_delayedMessageIcon = null; TimerReset("delayed_message_cooldown"); return flag; } public static string KeyHighlightText(string keyFunction, string alt = "", bool braces = true, bool bold = true) { string text = ZInput.instance.GetBoundKeyString(keyFunction, false); if (text.StartsWith("MISSING")) { text = keyFunction; } if (alt != "") { string text2 = ZInput.instance.GetBoundKeyString(alt, false); if (text2.StartsWith("MISSING")) { text2 = alt; } text = text + " + " + text2; } if (bold) { text = "" + text + ""; } text = "" + text + ""; if (braces) { text = "[" + text + "]"; } return text; } public static void AddToMessageLog(string msg) { PatchMessageHudShowMessage.m_logMessageOverride = msg; MessageHud.instance.ShowMessage((MessageType)1, msg, 0, (Sprite)null, false); } public static bool CustomLog(string msg, string color = "", bool add = true, bool remove = true, bool resort = false, bool checkCooldown = false, bool trace = false) { if (msg == "") { trace = false; } else { if (add && checkCooldown && Timer("add_wildling_log") > 0f) { return false; } TimerReset("add_wildling_log", 0.1f); if (color.StartsWith("#")) { msg = ((!msg.StartsWith("^^")) ? ("" + msg + "") : ("^^" + msg.Substring(2) + "")); } } PatchPlayerAddKnownText.m_delText = remove; PatchPlayerAddKnownText.m_addText = add; PatchPlayerAddKnownText.m_orderText = resort; Player.m_localPlayer.AddKnownText("Wildling log", msg); if (trace) { if (remove) { WDBUG.Log((add ? "Update" : "Remove") + $" text ({PatchPlayerAddKnownText.m_foundText}) from Wildling log:\n" + msg, WDBUG.Level.info); } else { WDBUG.Log("Jotted text to Wildling log:\n" + msg, WDBUG.Level.info); } } return PatchPlayerAddKnownText.m_foundText; } public static bool GetButton(string keyAction, bool checkTakeInput = false, bool down = false) { if (checkTakeInput && !PlayerTakeInput()) { return false; } return (!down) ? (ZInput.GetButton(keyAction) || ZInput.GetButton("Joy" + keyAction)) : (ZInput.GetButtonDown(keyAction) || ZInput.GetButtonDown("Joy" + keyAction)); } public static ItemData GetInventoryItemData(string itemName, bool mustBeEquipped = false, int minQuality = 0, int maxStack = 999) { ItemData result = null; int num = 9999; int num2 = 9999; int num3 = minQuality; foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { if ((mustBeEquipped && !allItem.m_equipped) || allItem.m_quality < num3 || allItem.m_stack > maxStack || !(ItemName(allItem) == itemName)) { continue; } if (allItem.m_equipped) { return allItem; } if (allItem.m_gridPos.y < num2 || (allItem.m_gridPos.y == num2 && allItem.m_gridPos.x < num)) { num = allItem.m_gridPos.x; num2 = allItem.m_gridPos.y; result = allItem; if (minQuality < 0) { num3 = allItem.m_quality; } } } return result; } public static bool IsEmptySlot(string itemName, int leaveMin = 0, bool force = false, bool uncompressed = false) { if (itemName == "") { return false; } Inventory inventory = ((Humanoid)Player.m_localPlayer).GetInventory(); if (inventory.NrOfItems() < inventory.GetHeight() * inventory.GetWidth()) { return true; } if (uncompressed) { return false; } int num = 9999; int num2 = 9999; int num3 = 0; int num4 = -1; ItemData val = null; foreach (ItemData allItem in inventory.GetAllItems()) { if (ItemName(allItem) == itemName) { if (allItem.m_shared.m_maxStackSize <= 1) { return leaveMin == 1; } num4++; num3 += allItem.m_stack; if (allItem.m_equipped || allItem.m_gridPos.y < num2 || (allItem.m_gridPos.y == num2 && allItem.m_gridPos.x < num)) { num = allItem.m_gridPos.x; num2 = allItem.m_gridPos.y; val = allItem; } } } if (val == null || num3 - num4 * val.m_shared.m_maxStackSize > leaveMin) { return false; } if (force && num4 > 0) { int maxStackSize = val.m_shared.m_maxStackSize; int num5 = val.m_stack - leaveMin; val.m_stack = leaveMin; foreach (ItemData allItem2 in inventory.GetAllItems()) { if (allItem2 != val && ItemName(allItem2) == itemName && allItem2.m_stack < maxStackSize) { int num6 = Mathf.Min(maxStackSize - allItem2.m_stack, num5); allItem2.m_stack += num6; WDBUG.Log($"Transferred {num6}/{num5} from first {itemName} to another", WDBUG.Level.Crafting); if ((num5 -= num6) <= 0) { break; } } } } return true; } public static bool PlayerTakeInput() { if (GameCamera.InFreeFly()) { return false; } if ((!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !Menu.IsVisible() && !Console.IsVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && (!ZInput.IsGamepadActive() || !Minimap.IsOpen()) && (!ZInput.IsGamepadActive() || !InventoryGui.IsVisible()) && (!ZInput.IsGamepadActive() || !StoreGui.IsVisible())) { if (ZInput.IsGamepadActive()) { return !Hud.IsPieceSelectionVisible(); } return true; } return false; } public static string GetGUIText(Transform txtTran, string undef = "") { if ((Object)(object)txtTran == (Object)null) { return undef; } if ((Object)(object)((Component)txtTran).GetComponent() != (Object)null) { return ((Component)txtTran).GetComponent().text; } if ((Object)(object)((Component)txtTran).GetComponent() != (Object)null) { return ((Component)txtTran).GetComponent().text; } WDBUG.Log("Failed to get text for " + GameName(((Component)txtTran).gameObject)); return undef; } public static void SetGUIText(Transform txtTran, string text) { if ((Object)(object)txtTran == (Object)null) { WDBUG.Log("Failed to set GUI " + text + " for null txtTran"); return; } TMP_Text component = ((Component)txtTran).GetComponent(); if ((Object)(object)component != (Object)null) { component.text = text; return; } Text component2 = ((Component)txtTran).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.text = text; } else { WDBUG.Log("Failed to set Text.text to " + text); } } public static string NumberText(int num) { if (num <= 0) { num = 1; } int num2 = num % 10; return string.Format("{0}{1}", num, num2 switch { 3 => "rd", 2 => "nd", 1 => "st", _ => "th", }); } public static void UpdateTimers(float dt) { bool flag = WDBUG.IsLevelReported(WDBUG.Level.Timers); string[] array = m_timers.Keys.ToArray(); foreach (string text in array) { m_timers[text] -= dt; if (m_timers[text] <= 0f) { m_timers.Remove(text); if (flag) { WDBUG.Log("Timer " + text + " reset", WDBUG.Level.Timers); } } } } public static void TimerReset(string name, float time = 0f, bool allowLog = false) { if (m_timers.ContainsKey(name)) { if (time <= 0f) { m_timers.Remove(name); } else { m_timers[name] = time; } } else if (time > 0f) { m_timers.Add(name, time); } if (allowLog) { string text = ((time > 0f) ? $"reset to {time}" : "stopped"); WDBUG.Log("Timer " + name + " " + text, WDBUG.Level.Timers); } } public static float Timer(string name) { return (name != "" && m_timers.ContainsKey(name)) ? m_timers[name] : 0f; } public static bool TimeIsAlmost(float value, float floor = 0f, float tick = 0f) { return value > floor && value <= floor + ((tick <= 0f) ? Time.fixedDeltaTime : tick); } public static bool TimerIsAlmost(string timerName, float floor, float tick = 0f) { return TimeIsAlmost(Timer(timerName), floor, tick); } public static string GetDayPeriod() { float num = EnvMan.instance.GetDayFraction() * 24f; if (num > 23.5f && num <= 0.5f) { return "midnight"; } if ((double)num <= 3.0) { return "late night"; } if (num <= 5.5f) { return "before dawn"; } if (num <= 6.5f) { return "the dawn"; } if (num <= 9f) { return "early morning"; } if (num <= 11.5f) { return "late morning"; } if (num <= 12.5f) { return "midday"; } if (num <= 15f) { return "after midday"; } if (num <= 17.5f) { return "late in the day"; } if (num <= 18.5f) { return "eventide"; } if (num <= 21f) { return "late evening"; } return "the night"; } public static string ItemName(ItemData item, bool goName = true) { return (item == null) ? "" : (goName ? GameName(item.m_dropPrefab) : Localization.instance.Localize(item.m_shared.m_name)); } public static string ItemName(ItemDrop itemDrop, bool goName = false, bool withAmount = true) { return ((Object)(object)itemDrop == (Object)null) ? "" : (goName ? GameName(((Component)itemDrop).gameObject) : (Localization.instance.Localize(itemDrop.GetHoverName()) + ((withAmount && itemDrop.m_itemData.m_stack > 1) ? (" x" + itemDrop.m_itemData.m_stack) : ""))); } public static string ItemName(string goName) { GameObject prefab = GetPrefab(goName); if ((Object)(object)prefab == (Object)null) { WDBUG.Log("ItemName could not create instance for " + goName + "."); return ""; } if ((Object)(object)prefab.GetComponent() == (Object)null) { WDBUG.Log(goName + " is not an ItemDrop."); return ""; } return Localization.instance.Localize(prefab.GetComponent().GetHoverName()); } public static string ActorName(Character character) { return ((Object)(object)character == (Object)null) ? "" : GameName(((Component)character).gameObject); } public static string GameName(GameObject go) { return ((Object)(object)go == (Object)null) ? "" : GameName(((Object)go).name); } public static string GameName(Transform t) { if ((Object)(object)t == (Object)null) { return ""; } while ((Object)(object)t.parent != (Object)null) { t = t.parent; } return GameName(((Object)((Component)t).gameObject).name); } public static string GameName(string name) { int num = name.IndexOfAny(new char[2] { '(', ' ' }); return TrimWildlingTag((num >= 0) ? name.Remove(num) : name); } public static string TrimWildlingTag(string name) { return name.StartsWith("Wildling_") ? name.Substring("Wildling_".Length) : name; } public static bool IsWildlingObject(GameObject go) { return (Object)(object)go != (Object)null && ((Object)go).name.StartsWith("Wildling_"); } public static bool IsWildlingRecipe(string fullName) { return fullName != "" && WildlingMod.w_gameObjectRecipes.ContainsKey(fullName); } public static bool EnableWildlingRecipe(string shortName, bool enable = true) { string text = "Wildling_" + shortName; if (IsWildlingRecipe(text)) { WildlingMod.w_gameObjectRecipes[text].m_enabled = enable; return true; } return false; } public static string GetWildlingRecipe(string shortName) { return WildlingMod.w_gameRecipes.ContainsKey(shortName) ? WildlingMod.w_gameRecipes[shortName] : ""; } public static GameObject GetWildlingGO(string name) { return WildlingMod.w_gameObjects.ContainsKey(name) ? WildlingMod.w_gameObjects[name] : null; } public static int GetWildlingGOTypeCount(string type) { return WildlingMod.m_gameObjectTypeCounts.ContainsKey(type) ? WildlingMod.m_gameObjectTypeCounts[type] : 0; } public static bool FixItemPrefab(ItemData item, string src, string prefabName = "") { if (prefabName == "") { prefabName = item.m_shared.m_name; } item.m_dropPrefab = GetPrefab(prefabName); bool flag = (Object)(object)item.m_dropPrefab != (Object)null; WDBUG.Log($"{src}:FixItemPrefab {item.m_shared.m_name} fixed: {flag}", WDBUG.Level.NonFatal); return flag; } public static int DieRoll(int a = 6, int tmpRndSeed = 0) { if (a <= 1) { return 0; } if (tmpRndSeed != 0) { ResetRandomSeed(tmpRndSeed); int result = Random.Range(0, a); ResetRandomSeed(); return result; } return Random.Range(0, a); } public static Vector3 RandomDir() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) return OnCircle(Vector3.zero, 1f, 1, ground: false); } public static int RandomSign() { return (RandomSpin() < 0.5f) ? 1 : (-1); } public static bool TestLuck(float chance = 0.5f) { return RandomSpin() <= chance + Alignment.m_holdingRabbitFootLuck; } public static float RandomSpin(float min = 0f, float max = 1f, float roundTo = 0f, bool randomSign = false) { float num = ((!randomSign || !(Random.Range(0f, 1f) > 0.5f)) ? 1 : (-1)); if (roundTo == 0f) { return Random.Range(min, max) * num; } return roundTo * num * (float)(int)(Random.Range(min / roundTo, max / roundTo) + 0.5f); } public static float RandomAtPos(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) ResetRandomSeed(position); float result = RandomSpin(); ResetRandomSeed(); return result; } public static int HashMapPos(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) return ((int)position.x & 0x7FFF) + (((int)position.z & 0x7FFF) << 15); } public static void ResetRandomSeed(int seed = 0) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (seed > 0) { if (m_randomSeedStack.Count < 20) { m_randomSeedStack.Add(Random.state); } else { WDBUG.Log("Ignored ResetRandomSeed call as stack full!"); } Random.InitState(seed); } else if (m_randomSeedStack.Count > 0) { Random.state = m_randomSeedStack[m_randomSeedStack.Count - 1]; m_randomSeedStack.RemoveAt(m_randomSeedStack.Count - 1); } } public static void ResetRandomSeed(Vector3 vseed) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) ResetRandomSeed((int)vseed.x + 1000 * (int)vseed.z + 1000000 * (int)vseed.y); } public static int Floor(float v) { return (v < 0f) ? ((int)(v - 0.5f)) : ((int)(v + 0.5f)); } public static int CountBits(int int32, int maxBits = 32) { if (int32 == 0) { return 0; } int num = 0; int num2 = 0; while (num2 < Mathf.Min(maxBits, 32)) { if ((int32 & 1) > 0) { num++; } num2++; int32 >>= 1; } return num; } public static GameObject GetPrefab(string name, bool trimName = true) { if (name == "") { return null; } if (trimName) { name = GameName(name); } if (WildlingMod.w_gameObjects.ContainsKey(name)) { return WildlingMod.w_gameObjects[name]; } return ZNetScene.instance.GetPrefab(name); } public static Sprite GetIcon(GameObject go, int variant = 0) { if ((Object)(object)go != (Object)null) { ItemDrop component = go.GetComponent(); if ((Object)(object)component != (Object)null) { if (component.m_itemData.m_shared.m_icons.Length > variant) { return component.m_itemData.m_shared.m_icons[variant]; } } else if ((Object)(object)go.GetComponent() != (Object)null) { return go.GetComponent().m_icon; } } return null; } public static Sprite GetIcon(string name, int variant = 0) { return GetIcon(GetPrefab(name), variant); } public static Sprite GetIcon(Sprite sourceSprite, float scale = 0.6f) { //IL_0024: 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_007a: 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_0087: Expected O, but got Unknown //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) if (scale <= 0f || scale == 1f) { return sourceSprite; } Rect textureRect = sourceSprite.textureRect; int num = (Mathf.CeilToInt(((Rect)(ref textureRect)).width) + 3) / 4 * 4; int num2 = (Mathf.CeilToInt(((Rect)(ref textureRect)).height) + 3) / 4 * 4; int num3 = (Mathf.CeilToInt((float)num / scale) + 3) / 4 * 4; int num4 = (Mathf.CeilToInt((float)num2 / scale) + 3) / 4 * 4; Texture2D val = new Texture2D(num3, num4, ((Texture)sourceSprite.texture).graphicsFormat, (TextureCreationFlags)0); int num5 = 4; for (int i = 0; i < num4; i += num5) { for (int j = 0; j < num3; j += num5) { Graphics.CopyTexture((Texture)(object)sourceSprite.texture, 0, 0, 0, 0, num5, num5, (Texture)(object)val, 0, 0, j, i); } } int num6 = Mathf.FloorToInt(((Rect)(ref textureRect)).x) / 4 * 4; int num7 = Mathf.FloorToInt(((Rect)(ref textureRect)).y) / 4 * 4; int num8 = (num3 - num) / 2 / 4 * 4; int num9 = (num4 - num2) / 2 / 4 * 4; Graphics.CopyTexture((Texture)(object)sourceSprite.texture, 0, 0, num6, num7, num, num2, (Texture)(object)val, 0, 0, num8, num9); float num10 = (float)num8 + (float)num * 0.5f; float num11 = (float)num9 + (float)num2 * 0.5f; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(num10 / (float)num3, num11 / (float)num4); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(0f, 0f, (float)num3, (float)num4); return Sprite.Create(val, val3, val2, sourceSprite.pixelsPerUnit); } public static float GetLevelSize(Character character) { if ((Object)(object)character == (Object)null) { return 1f; } int num = character.GetLevel() - 1; if (num > 2) { num %= 3; } if (num > 0) { LevelEffects componentInChildren = ((Component)character).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.m_levelSetups.Count > 0) { num = Mathf.Min(componentInChildren.m_levelSetups.Count, num) - 1; return componentInChildren.m_levelSetups[num].m_scale; } } return 1f; } public static GameObject Spawn(string name, Vector3 position, Quaternion quaternion, int level = 1, float randomUpto = 0f, bool ground = false) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) GameObject prefab = GetPrefab(name); if ((Object)(object)prefab == (Object)null) { WDBUG.Log("PlaceObject could not get prefab for " + name + "."); return null; } if (ground) { position.y -= Flight.GetHeightAboveSolid(position); } GameObject val = Object.Instantiate(prefab, position, quaternion); if ((Object)(object)val != (Object)null) { if (Object.op_Implicit((Object)(object)val.GetComponent())) { ItemDrop component = val.GetComponent(); if (level <= 0) { level = component.m_itemData.m_shared.m_maxStackSize; } if (randomUpto > 0f) { level = 1 + DieRoll((int)(0.1f + (float)level * randomUpto)); } component.m_itemData.m_stack = Math.Min(component.m_itemData.m_shared.m_maxStackSize, level); } else if (Object.op_Implicit((Object)(object)val.GetComponent())) { if (level <= 0) { if (randomUpto <= 0f) { randomUpto = 1f; } level = 3; } if (level > 1) { if (randomUpto > 0f) { level = 1 + DieRoll((int)(0.1f + (float)level * randomUpto)); } val.GetComponent().SetLevel(level); } WDBUG.Log($"Spawned {name} level {level}", WDBUG.Level.Wildlife); } } return val; } public static void PlacePiece(string name, Vector3 position, Quaternion quaternion, bool ground = false) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) GameObject val = Spawn(name, position, quaternion, 1, 0f, ground); if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)val.GetComponent())) { val.GetComponent().SetCreator(Player.m_localPlayer.GetPlayerID()); } } public static GameObject PlaceObject(string name, Vector3 position, Vector3 facing, bool toHorizon = false) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref facing)).magnitude <= Mathf.Epsilon) { facing = Vector3.forward; } if (toHorizon) { facing.y = 0f; } return Spawn(name, position, Quaternion.LookRotation(((Vector3)(ref facing)).normalized)); } public static GameObject PlaceObject(string name, Vector3 position, float scale = 1f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) GameObject val = Spawn(name, position, Quaternion.identity); Transform transform = val.transform; transform.localScale *= scale; return val; } public static GameObject PlaceAoe(string name, Vector3 position, Character owner = null) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) GameObject val = Spawn(name, position, Quaternion.identity); Aoe val2 = (((Object)(object)val == (Object)null) ? null : val.GetComponent()); if ((Object)(object)val2 == (Object)null) { WDBUG.Log("PlaceAoe() used to create non-Aoe object: " + name); } else { val2.Setup(owner, Vector3.zero, -1f, (HitData)null, (ItemData)null, (ItemData)null); } return val; } public static ItemData CreateItemData(string name, int number = 1) { GameObject prefab = GetPrefab(name); if ((Object)(object)prefab == (Object)null) { WDBUG.Log("CreateItemData could not get instance for " + name + "."); return null; } if ((Object)(object)prefab.GetComponent() == (Object)null) { WDBUG.Log(name + " is not an ItemDrop."); return null; } ItemData itemData = prefab.GetComponent().m_itemData; ItemData val = ((itemData != null) ? itemData.Clone() : null); if (val == null) { WDBUG.Log("Clone for " + name + " failed - using World Drop backup"); GameObject val2 = Object.Instantiate(prefab); val = val2.GetComponent().m_itemData.Clone(); Object.Destroy((Object)(object)val2); } val.m_dropPrefab = prefab; if (number >= 1) { val.m_stack = Mathf.Min(number, val.m_shared.m_maxStackSize); } return val; } public static bool CompressInventory(Inventory inventory, int tofit = 1) { int num = inventory.NrOfItems(); int num2 = inventory.GetHeight() * inventory.GetWidth(); tofit -= num2 - num; if (tofit < 1) { return true; } List list = new List(); ItemData[] array = inventory.GetAllItems().ToArray(); foreach (ItemData val in array) { int num3 = val.m_stack; if (num3 < val.m_shared.m_maxStackSize) { foreach (ItemData item in list) { if (item.m_shared.m_name == val.m_shared.m_name && item.m_quality == val.m_quality) { int num4 = item.m_shared.m_maxStackSize - item.m_stack; item.m_stack += ((num3 <= num4) ? num3 : num4); num3 -= num4; if (num3 <= 0) { inventory.RemoveItem(val); break; } } } } if (num3 > 0) { list.Add(val); } else if (--tofit == 0) { return true; } } return false; } public static ItemData AddItemToInventory(Humanoid owner, string name, bool equip = false, int number = 1) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) ItemData val = null; if (((Character)owner).IsPlayer()) { val = CreateItemData(name, number); if (val != null) { if (owner.GetInventory().AddItem(val)) { if (equip) { owner.EquipItem(val, false); } } else { Transform transform = ((Component)((Component)owner).gameObject.GetComponent().m_rightHand).transform; GameObject go = Spawn(name, transform.position, transform.rotation, val.m_stack); name = ((val.m_stack > 1) ? $"{val.m_stack}x" : "") + ItemName(val, goName: false); Message("No room in inventory for " + name + ".", center: false, GetIcon(go)); } } else { WDBUG.Log("AddItemToInventory failed to create inventory stack: " + name); } } else if (owner.GetInventory().HaveEmptySlot()) { val = owner.PickupPrefab(GetPrefab(name), number, equip); } return val; } public static ItemData DropItemOutside(string name, Vector3 position, string sfx_name = "", int number = 1) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) GameObject val = Spawn(name, position, Quaternion.identity); if ((Object)(object)val == (Object)null) { return null; } ItemDrop component = val.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { WDBUG.Log("DropItemOutside " + name + " is not an ItemDrop."); return null; } component.m_itemData.m_stack = number; if (sfx_name != "") { PlaySfx(sfx_name, position); } return component.m_itemData; } public static GameObject CreateAttachedEffect(string name, Transform attach, float offsetRht = 0f, float offsetUp = 0f, float size = 1f) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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) //IL_0078: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //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) if ((Object)(object)attach == (Object)null) { return null; } GameObject val = Spawn(name, attach.position, attach.rotation); if ((Object)(object)val != (Object)null) { Transform transform = val.transform; transform.localScale *= size; Transform val2 = val.transform.Find("attach"); if ((Object)(object)val2 != (Object)null) { val2.position = val2.position + offsetRht * attach.right + offsetUp * attach.up; } val.transform.SetParent(attach); } return val; } public static GameObject CreateHeadEffect(string name, Character character, bool attach = true, float size = 1f) { //IL_0033: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) Transform headTransform = GetHeadTransform(character); GameObject val; if (attach && (Object)(object)headTransform != (Object)null) { val = CreateAttachedEffect(name, headTransform, 0f, 0f, size); } else { val = Spawn(name, character.GetHeadPoint(), ((Component)character).transform.rotation); val.transform.localScale = size * Vector3.one; } return val; } public static Transform HandTransform() { if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)((Character)Player.m_localPlayer).GetVisual() == (Object)null) { return null; } if ((Object)(object)m_handTransform == (Object)null) { m_handTransform = ((Character)Player.m_localPlayer).GetVisual().transform.Find("Armature/Hips/Spine/Spine1/Spine2/RightShoulder/RightArm/RightForeArm/RightHand/RightHand_Attach"); } if ((Object)(object)m_handTransform == (Object)null) { WDBUG.Log("HandTransform failed."); } return m_handTransform; } public static Transform HeadTransform() { if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)((Character)Player.m_localPlayer).GetVisual() == (Object)null) { return null; } if ((Object)(object)m_headTransform == (Object)null) { m_headTransform = ((Character)Player.m_localPlayer).GetVisual().transform.Find("Armature/Hips/Spine/Spine1/Spine2/Neck/Head"); } if ((Object)(object)m_headTransform == (Object)null) { WDBUG.Log("HeadTransform failed."); } return m_headTransform; } public static void PlaySfx(string sfx_name, Vector3 position, float delay = 0f) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) GameObject val = PlaceObject(sfx_name, position); if ((Object)(object)val != (Object)null) { ZSFX component = val.GetComponent(); if ((Object)(object)component == (Object)null) { WDBUG.Log("Could not modify sound play " + sfx_name); return; } component.m_minVol = 5f; component.m_maxVol = 8f; component.m_minDelay = delay; component.m_maxDelay = delay; } } public static void PlaySecretFoundSfx(int sound = 1) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (sound > 0) { WDBUG.Log("Playing secret found " + sound, WDBUG.Level.Progress); PlaySfx("sfx_secretfound", ((Component)Player.m_localPlayer).transform.position); } } public static void Destroy(GameObject go) { if ((Object)(object)go != (Object)null) { ZNetScene.instance.Destroy(go); } } public static Transform BaseTransform(Transform transform) { if (Object.op_Implicit((Object)(object)transform)) { while (Object.op_Implicit((Object)(object)transform.parent)) { transform = transform.parent; } } return transform; } public static Vector3 OnCircle(Vector3 point, float radius = 1f, int segments = 1, bool ground = true, float floorOffset = 100f) { //IL_0093: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (radius > 0f) { float num = ((segments > 1) ? ((float)DieRoll(segments) / (float)segments) : RandomSpin()); num *= (float)Math.PI * 2f; point.x += radius * Mathf.Sin(num); point.z += radius * Mathf.Cos(num); } if (ground) { point.y += floorOffset; point.y -= Flight.GetHeightAboveSolid(point); } return point; } public static float GroundDistance(Vector3 point1, Vector3 point2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) float num = point1.x - point2.x; float num2 = point1.z - point2.z; return Mathf.Sqrt(num * num + num2 * num2); } public static bool OverlapGrid(Vector3 point, Vector3 center, float halfWidth = 1f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) return Mathf.Abs(point.x - center.x) < halfWidth || Mathf.Abs(point.z - center.z) < halfWidth; } public static bool WithinCylinder(Vector3 point, Vector3 center, float radius = 1f, float halfHeight = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - center; if (halfHeight > 0f && (val.y < 0f - halfHeight || val.y > halfHeight)) { return false; } return val.x * val.x + val.z * val.z <= radius * radius; } public static bool WithinSameZone(Vector3 p1, Vector3 p2, float gridSize = 64f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) return (int)Mathf.Floor(p1.x / gridSize) == (int)Mathf.Floor(p2.x / gridSize) && (int)Mathf.Floor(p1.z / gridSize) == (int)Mathf.Floor(p2.z / gridSize); } public static bool BlockedAhead(Character character, Vector3 lookDir, int angleOffset = 0, float maxDist = 6f) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (angleOffset != 0) { lookDir = Quaternion.AngleAxis((float)angleOffset, Vector3.up) * lookDir; } return Physics.Raycast(character.GetEyePoint(), lookDir, maxDist, c_blockingRayMask); } public static bool EquipPermitted(ItemData item) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Invalid comparison between Unknown and I4 if ((Object)(object)item.m_dropPrefab == (Object)null && !FixItemPrefab(item, "EquipPermitted")) { return false; } if (WDBUG.AllowUseAllItems || (int)item.m_shared.m_skillType == 2 || (int)item.m_shared.m_itemType == 18) { return true; } string text = ItemName(item); if (Wildling.IsWildling) { if (IsWildlingObject(item.m_dropPrefab)) { return !text.EndsWith("Poisoned") || text == "ThrowstickPoisoned"; } return Quest.AchievementAwarded(text); } if (!IsWildlingObject(item.m_dropPrefab)) { return true; } if (text.EndsWith("Poisoned")) { return text != "ThrowstickPoisoned"; } if (text.StartsWith("FairyTale") || text.StartsWith("Letter") || text == "ElderScroll") { return true; } if ((int)item.m_shared.m_itemType == 5) { return text != "throwstickClutch"; } return item.IsWeapon() && text != "Digger"; } public static void UnequipAllTemporary(float recallAfter = 0.4f, bool temporary = true) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } m_equipedItems.Clear(); foreach (ItemData equippedItem in ((Humanoid)localPlayer).GetInventory().GetEquippedItems()) { string text = $"{equippedItem.m_gridPos.x},{equippedItem.m_gridPos.y}"; WDBUG.Log("Remember equiped " + equippedItem.m_shared.m_name + " at " + text, WDBUG.Level.GUI); ((Humanoid)localPlayer).UnequipItem(equippedItem, true); if (temporary) { m_equipedItems.Add(text); } } if (recallAfter > 0f) { m_updateLateStartup = true; TimerReset("auto_reequip", recallAfter); } } public static bool RecallEquiped(int maxRow = 0) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || m_equipedItems.Count == 0) { return false; } int height = ((Humanoid)localPlayer).GetInventory().GetHeight(); foreach (ItemData allItem in ((Humanoid)localPlayer).GetInventory().GetAllItems()) { if (allItem.m_gridPos.y < height) { string text = $"{allItem.m_gridPos.x},{allItem.m_gridPos.y}"; if (m_equipedItems.Contains(text) && EquipPermitted(allItem)) { WDBUG.Log("Re-equip " + allItem.m_shared.m_name + " at " + text, WDBUG.Level.GUI); ((Humanoid)localPlayer).EquipItem(allItem, true); } } } m_equipedItems.Clear(); return true; } public static void ForceAddItemToInventory(Inventory inventory, ItemData item) { Equipment.FlagAddItemDirect(); inventory.AddItem(item); } public static void UpdateInventoryRecipes(bool checkStation = false) { if ((!checkStation || !((Object)(object)Player.m_localPlayer.GetCurrentCraftingStation() == (Object)null)) && InventoryGui.IsVisible()) { WDBUG.Log($"UpdateInventoryRecipes(checkStation:{checkStation})", WDBUG.Level.RecipeUnlock); if (!((Selectable)InventoryGui.instance.m_tabCraft).interactable) { InventoryGui.instance.OnTabCraftPressed(); } else if (!((Selectable)InventoryGui.instance.m_tabUpgrade).interactable) { InventoryGui.instance.OnTabUpgradePressed(); } } } public static bool HaveStatusEffect(string name, Character character = null) { SEMan val = (((Object)(object)character == (Object)null) ? ((Character)Player.m_localPlayer).GetSEMan() : character.GetSEMan()); return val.HaveStatusEffect(StringExtensionMethods.GetStableHashCode(name)); } public static ItemData GetRightItem(Humanoid humanoid = null) { return WildlingMod.GetHandAction(1, humanoid); } public static ItemData GetLeftItem(Humanoid humanoid = null) { return WildlingMod.GetHandAction(2, humanoid); } public static void HideHandItems(Humanoid humanoid = null) { WildlingMod.GetHandAction(5, humanoid); } public static void ShowHandItems(Humanoid humanoid = null) { WildlingMod.GetHandAction(6, humanoid); } public static Transform GetHeadTransform(Character character) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) Animator componentInChildren = ((Component)character).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.isHuman) { return componentInChildren.GetBoneTransform((HumanBodyBones)10); } character.GetHeadPoint(); Transform characterHead = m_characterHead; m_characterHead = null; return characterHead; } }