Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of balrond amazing nature v1.2.3
plugins/BalrondAmazingNature.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BalrondNature.WorldEdit; using BalrondNature.WorldEdit.Vegetation; using BepInEx; using BepInEx.Bootstrap; using HarmonyLib; using LitJson2; using SoftReferenceableAssets; using UnityEngine; using UnityEngine.Events; using UpgradeWorld; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BalrondNature")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BalrondNature")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("cde312a0-cf19-4264-8616-e1c74774beed")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public static class BalrondHashCompat { private static readonly MethodInfo _getStableHashCodeStringBool; private static readonly MethodInfo _getStableHashCodeString; private static readonly bool _initialized; static BalrondHashCompat() { try { Type typeFromHandle = typeof(StringExtensionMethods); _getStableHashCodeStringBool = typeFromHandle.GetMethod("GetStableHashCode", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(string), typeof(bool) }, null); _getStableHashCodeString = typeFromHandle.GetMethod("GetStableHashCode", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null); _initialized = true; } catch { _initialized = false; } } public static int StableHash(string value) { if (value == null) { return 0; } try { if (_getStableHashCodeStringBool != null) { return (int)_getStableHashCodeStringBool.Invoke(null, new object[2] { value, false }); } if (_getStableHashCodeString != null) { return (int)_getStableHashCodeString.Invoke(null, new object[1] { value }); } } catch { } return FallbackStableHash(value); } private static int FallbackStableHash(string value) { int num = 5381; int num2 = num; for (int i = 0; i < value.Length; i += 2) { num = ((num << 5) + num) ^ value[i]; if (i == value.Length - 1) { break; } num2 = ((num2 << 5) + num2) ^ value[i + 1]; } return num + num2 * 1566083941; } } public class MonsterDoorSensor : MonoBehaviour { private static readonly Collider[] Hits = (Collider[])(object)new Collider[32]; private static readonly int CharacterMask = LayerMask.GetMask(new string[3] { "character", "character_net", "character_noenv" }); [Header("Monster Door Sensor")] public string[] AllowedMonsterPrefabNames = Array.Empty<string>(); public float DetectRadius = 2.8f; public float CheckInterval = 0.35f; public bool AllowOpening = true; public bool RespectPrivateArea = true; public bool MakeAttackTargetIfBlockedByWard = true; public bool IgnoreKeyedDoors = true; public bool RequireMonsterTarget = true; public bool RequireMovingOrFacingDoor = true; public float MinFacingDot = 0.35f; private Door _door; private ZNetView _doorView; private Piece _piece; private float _nextCheck; private HashSet<string> _allowedMonsterCache; private void Awake() { CacheComponents(); BuildAllowedMonsterCache(); } private void CacheComponents() { if ((Object)(object)_door == (Object)null) { _door = ((Component)this).GetComponentInChildren<Door>(); } if ((Object)(object)_door == (Object)null) { _door = ((Component)this).GetComponent<Door>(); } if ((Object)(object)_door != (Object)null && (Object)(object)_doorView == (Object)null) { _doorView = ((Component)_door).GetComponent<ZNetView>(); } if ((Object)(object)_door != (Object)null && (Object)(object)_piece == (Object)null) { _piece = ((Component)_door).GetComponent<Piece>(); } if ((Object)(object)_piece == (Object)null) { _piece = ((Component)this).GetComponent<Piece>(); } } private void BuildAllowedMonsterCache() { _allowedMonsterCache = new HashSet<string>(StringComparer.OrdinalIgnoreCase); if (AllowedMonsterPrefabNames == null) { return; } for (int i = 0; i < AllowedMonsterPrefabNames.Length; i++) { string text = AllowedMonsterPrefabNames[i]; if (!string.IsNullOrEmpty(text)) { _allowedMonsterCache.Add(text); } } } private void Update() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _nextCheck) { return; } _nextCheck = Time.time + Mathf.Max(0.1f, CheckInterval); if ((Object)(object)_door == (Object)null || (Object)(object)_doorView == (Object)null) { CacheComponents(); } if ((Object)(object)_door == (Object)null || (Object)(object)_doorView == (Object)null || !_doorView.IsValid() || !_doorView.IsOwner()) { return; } int num = Physics.OverlapSphereNonAlloc(((Component)_door).transform.position, Mathf.Max(0.5f, DetectRadius), Hits, CharacterMask, (QueryTriggerInteraction)1); if (num <= 0) { return; } for (int i = 0; i < num; i++) { Collider val = Hits[i]; if (!((Object)(object)val == (Object)null)) { Character componentInParent = ((Component)val).GetComponentInParent<Character>(); if (IsValidMonster(componentInParent) && ShouldReactToMonster(componentInParent)) { HandleMonster(componentInParent); break; } } } } private bool IsValidMonster(Character character) { if ((Object)(object)character == (Object)null) { return false; } if (character.IsPlayer() || character.IsDead() || character.IsFlying()) { return false; } BaseAI baseAI = character.GetBaseAI(); if ((Object)(object)baseAI == (Object)null || baseAI.IsSleeping()) { return false; } if (_allowedMonsterCache == null || _allowedMonsterCache.Count == 0) { return false; } string prefabName = Utils.GetPrefabName(((Component)character).gameObject); return _allowedMonsterCache.Contains(prefabName); } private bool ShouldReactToMonster(Character character) { //IL_0062: 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_0077: 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_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_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_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) BaseAI baseAI = character.GetBaseAI(); if (RequireMonsterTarget) { Character targetCreature = baseAI.GetTargetCreature(); if ((Object)(object)targetCreature == (Object)null || targetCreature.IsDead()) { return false; } } if (!RequireMovingOrFacingDoor) { return true; } Vector3 val = ((Component)_door).transform.position - ((Component)character).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { return true; } ((Vector3)(ref val)).Normalize(); Vector3 moveDir = character.GetMoveDir(); moveDir.y = 0f; if (((Vector3)(ref moveDir)).sqrMagnitude > 0.01f) { ((Vector3)(ref moveDir)).Normalize(); if (Vector3.Dot(moveDir, val) >= MinFacingDot) { return true; } } Vector3 forward = ((Component)character).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { return false; } ((Vector3)(ref forward)).Normalize(); return Vector3.Dot(forward, val) >= MinFacingDot; } private static bool IsDoorProtectedByPrivateArea(Vector3 point) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) List<PrivateArea> allAreas = PrivateArea.m_allAreas; if (allAreas == null) { return false; } for (int i = 0; i < allAreas.Count; i++) { PrivateArea val = allAreas[i]; if (!((Object)(object)val == (Object)null) && (int)val.m_ownerFaction <= 0 && val.IsEnabled() && val.IsInside(point, 0f)) { return true; } } return false; } private void NotifyNearbyPlayer(Character monster) { //IL_001a: 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) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !(Vector3.Distance(((Component)localPlayer).transform.position, ((Component)_door).transform.position) > 18f)) { string name = monster.m_name; ((Character)localPlayer).Message((MessageType)1, name + " forced the door open!", 0, (Sprite)null); } } private void HandleMonster(Character character) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (IgnoreKeyedDoors && (Object)(object)_door.m_keyItem != (Object)null) { return; } if (RespectPrivateArea && _door.m_checkGuardStone && IsDoorProtectedByPrivateArea(((Component)_door).transform.position)) { if (MakeAttackTargetIfBlockedByWard) { MakeDoorAttackTarget(); } } else if (AllowOpening) { OpenDoor(character); } } private void OpenDoor(Character character) { //IL_0068: 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_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_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_00ac: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_doorView == (Object)null || !_doorView.IsValid()) { return; } ZDO zDO = _doorView.GetZDO(); if (zDO != null && zDO.GetInt(ZDOVars.s_state, 0) == 0) { Vector3 val = ((Component)character).transform.position - ((Component)_door).transform.position; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = -((Component)_door).transform.forward; } ((Vector3)(ref val)).Normalize(); bool flag = Vector3.Dot(((Component)_door).transform.forward, val) < 0f; _doorView.InvokeRPC("UseDoor", new object[1] { flag }); NotifyNearbyPlayer(character); } } private void MakeDoorAttackTarget() { if ((Object)(object)_piece == (Object)null) { if ((Object)(object)_door != (Object)null) { _piece = ((Component)_door).GetComponent<Piece>(); } if ((Object)(object)_piece == (Object)null) { _piece = ((Component)this).GetComponent<Piece>(); } } if (!((Object)(object)_piece == (Object)null)) { ((StaticTarget)_piece).m_primaryTarget = true; ((StaticTarget)_piece).m_randomTarget = true; } } } public static class MonsterDoorSensorService { private static readonly List<MonsterDoorSensorRule> Rules = new List<MonsterDoorSensorRule>(); public static void RegisterDefaultRules() { Rules.Clear(); Rules.Add(new MonsterDoorSensorRule { DoorPrefabNames = new string[8] { "raw_wood_door_bal", "wood_door", "darkwood_gate", "wood_gate", "ashwood_door", "hardwood_door_bal", "wood_gate_cage_bal", "wood_plot_gate_bal" }, AllowedMonsterPrefabNames = new string[39] { "Goblin", "GoblinShaman", "Draugr", "Draugr_Elite", "Skeleton_Poison", "Skeleton", "Surtling", "Ghost", "Skeleton_NoArcher", "Draugr_Ranged", "Greydwarf", "Greydwarf_Shaman", "Greydwarf_Elite", "Dverger", "DvergerMage", "DvergerMageFire", "DvergerMageIce", "DvergerMageSupport", "Dverger_event", "DvergerMage_event", "DvergerMageFire_event", "DvergerMageIce_event", "DvergerMageSupport_event", "Fenring", "Fenring_Cultist", "Fenring_Brute_bal", "LostSoul_bal", "Frostbjorn_bal", "GhostYagluth_bal", "Greydwarf_Crusher_bal", "Greydwarf_Frozen_bal", "Greydwarf_Moss_bal", "Greydwarf_Scorched_bal", "Charred_Mage", "Charred_Melee", "Charred_Melee_Dyrnwyn", "Charred_Melee_Fader", "Charred_Twitcher", "Charred_Archer" }, DetectRadius = 2.8f, CheckInterval = 0.35f, AllowOpening = true, RespectPrivateArea = true, MakeAttackTargetIfBlockedByWard = true, IgnoreKeyedDoors = true, RequireMonsterTarget = true, RequireMovingOrFacingDoor = true, MinFacingDot = 0.35f }); Rules.Add(new MonsterDoorSensorRule { DoorPrefabNames = new string[10] { "iron_gate", "wood_iron_gate_large_bal", "wood_gate_large_bal", "plate_gate_bal", "flametal_gate", "dverger_gate_bal", "corewood_gate_large_bal", "copper_dropgate_large_bal", "bronze_gate_left_bal", "bronze_gate_right_bal" }, AllowedMonsterPrefabNames = new string[7] { "Troll", "GoblinBrute", "Fenring", "Fenring_Cultist", "Fenring_Brute_bal", "Greydwarf_Crusher_bal", "Frostbjorn_bal" }, DetectRadius = 3.2f, CheckInterval = 0.4f, AllowOpening = true, RespectPrivateArea = true, MakeAttackTargetIfBlockedByWard = true, IgnoreKeyedDoors = true, RequireMonsterTarget = true, RequireMovingOrFacingDoor = true, MinFacingDot = 0.25f }); } public static void ApplyToZNetScene() { if ((Object)(object)ZNetScene.instance == (Object)null || ZNetScene.instance.m_prefabs == null) { return; } foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { if ((Object)(object)prefab == (Object)null) { continue; } MonsterDoorSensorRule monsterDoorSensorRule = FindRuleForPrefab(((Object)prefab).name); if (monsterDoorSensorRule == null) { continue; } Door componentInChildren = prefab.GetComponentInChildren<Door>(); if (!((Object)(object)componentInChildren == (Object)null)) { MonsterDoorSensor monsterDoorSensor = prefab.GetComponent<MonsterDoorSensor>(); if ((Object)(object)monsterDoorSensor == (Object)null) { monsterDoorSensor = prefab.AddComponent<MonsterDoorSensor>(); } monsterDoorSensor.AllowedMonsterPrefabNames = monsterDoorSensorRule.AllowedMonsterPrefabNames; monsterDoorSensor.DetectRadius = monsterDoorSensorRule.DetectRadius; monsterDoorSensor.CheckInterval = monsterDoorSensorRule.CheckInterval; monsterDoorSensor.AllowOpening = monsterDoorSensorRule.AllowOpening; monsterDoorSensor.RespectPrivateArea = monsterDoorSensorRule.RespectPrivateArea; monsterDoorSensor.MakeAttackTargetIfBlockedByWard = monsterDoorSensorRule.MakeAttackTargetIfBlockedByWard; monsterDoorSensor.IgnoreKeyedDoors = monsterDoorSensorRule.IgnoreKeyedDoors; monsterDoorSensor.RequireMonsterTarget = monsterDoorSensorRule.RequireMonsterTarget; monsterDoorSensor.RequireMovingOrFacingDoor = monsterDoorSensorRule.RequireMovingOrFacingDoor; monsterDoorSensor.MinFacingDot = monsterDoorSensorRule.MinFacingDot; Debug.Log((object)("[MonsterDoorSensor] Applied to prefab: " + ((Object)prefab).name)); } } } private static MonsterDoorSensorRule FindRuleForPrefab(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return null; } foreach (MonsterDoorSensorRule rule in Rules) { if (rule == null || rule.DoorPrefabNames == null) { continue; } for (int i = 0; i < rule.DoorPrefabNames.Length; i++) { if (string.Equals(rule.DoorPrefabNames[i], prefabName, StringComparison.OrdinalIgnoreCase)) { return rule; } } } return null; } } public sealed class MonsterDoorSensorRule { public string[] DoorPrefabNames; public string[] AllowedMonsterPrefabNames; public float DetectRadius = 2f; public float CheckInterval = 0.35f; public bool AllowOpening = true; public bool RespectPrivateArea = true; public bool MakeAttackTargetIfBlockedByWard = true; public bool IgnoreKeyedDoors = true; public bool RequireMonsterTarget = true; public bool RequireMovingOrFacingDoor = true; public float MinFacingDot = 0.35f; } internal static class Compatibility { private const string AlienID = "ZenDragon.ZenWorldSettings"; private static bool _isLoaded; private static bool _Check; public static bool IsLoaded() { if (!_Check) { _isLoaded = Chainloader.PluginInfos.ContainsKey("ZenDragon.ZenWorldSettings"); if (_isLoaded) { Debug.Log((object)"Amazing Nature: Using ZenWorldSettings, Disabled Crypt Key consume"); } _Check = true; } return _isLoaded; } } internal static class Compatibility2 { public const string AlienID = "ZenDragon.ZenCombat"; private static bool _isLoaded; private static bool _Check; public static bool IsLoaded() { if (!_Check) { _isLoaded = Chainloader.PluginInfos.ContainsKey("ZenDragon.ZenCombat"); if (_isLoaded) { Debug.Log((object)"Amazing Nature: Using ZenDragon.ZenCombat, Disabled Parry/Block changes"); } _Check = true; } return _isLoaded; } } public class OfferingStation : MonoBehaviour, Hoverable, Interactable { public string m_name = "Offer station"; public string m_useItemText = "Use"; public ItemDrop m_requiredItem; public int m_requiredItemAmount = 1; public string m_statusEffectName = ""; public bool m_spawnStatusEffect = true; public GameObject m_aoePrefab; public GameObject m_spawnPoint = null; public bool m_spawnItem = false; public ItemDrop m_itemPrefab; public Transform m_itemSpawnPoint; public string m_setGlobalKey = ""; public float m_SpawnDelay = 2f; public float m_spawnOffset = 0f; [Header("Effects")] public EffectList m_fuelAddedEffects = new EffectList(); public EffectList m_spawnStartEffects = new EffectList(); public EffectList m_spawnFinishEffects = new EffectList(); public GameObject m_enabledObject; public GameObject m_disabledObject; public GameObject m_haveFuelObject; public Transform m_roofCheckPoint; public bool m_requiresRoof = false; public bool m_canBeOutside = true; public Switch m_addWoodSwitch; public bool m_useFuel = false; public ItemDrop m_fuelItem; public int m_maxFuel = 0; public float m_secPerFuel = 2000f; public bool m_requireFire = false; public Transform[] m_fireCheckPoints; public float m_fireCheckRadius = 0.25f; private bool m_blockedSmoke; public SmokeSpawner m_smokeSpawner; public Animator[] m_animators; private ZNetView m_nview; private string m_requiredItemName; private void Awake() { m_nview = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)m_nview == (Object)null || m_nview.GetZDO() == null) { ZLog.Log((object)"Missing ZnetView Component"); return; } validateAoe(); m_requiredItemName = m_requiredItem.m_itemData.m_shared.m_name; if (Object.op_Implicit((Object)(object)m_addWoodSwitch)) { } ((MonoBehaviour)this).InvokeRepeating("UpdateOfferingStation", 1f, 1f); } private bool validateAoe() { if ((Object)(object)m_aoePrefab.GetComponent<Aoe>() == (Object)null) { ZLog.Log((object)"m_aoePrefab Missing Aoe Component"); return false; } return true; } public string GetHoverText() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, false, false)) { return Localization.instance.Localize(m_name + "\n$piece_noaccess"); } return Localization.instance.Localize(m_name + "\n[<color=yellow><b>1-8</b></color>] \n" + m_useItemText) + " " + Localization.instance.Localize(((Component)m_requiredItem).GetComponent<ItemDrop>().m_itemData.m_shared.m_name) + " amount: " + m_requiredItemAmount; } public string GetHoverName() { return m_name; } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_001e: 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_00ae: 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) if (hold || IsSpawnQueued()) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (m_blockedSmoke) { ((Character)user).Message((MessageType)2, "Smoke blocked", 0, (Sprite)null); return false; } if (!IsActive()) { return false; } if (Spawn(GetSpawnPosition())) { ((Character)user).Message((MessageType)2, "$msg_offerdone", 0, (Sprite)null); if (Object.op_Implicit((Object)(object)m_itemSpawnPoint)) { m_fuelAddedEffects.Create(m_itemSpawnPoint.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } } return true; } public bool UseItem(Humanoid user, ItemData item) { //IL_0018: 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_0245: 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) if (IsSpawnQueued()) { return true; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (m_blockedSmoke) { ((Character)user).Message((MessageType)2, "Smoke blocked", 0, (Sprite)null); return false; } if (!IsActive()) { return false; } if ((Object)(object)m_requiredItem == (Object)null) { return false; } if (item.m_shared.m_name == m_requiredItemName) { int num = user.GetInventory().CountItems(m_requiredItemName, -1, true); if (num < m_requiredItemAmount) { ((Character)user).Message((MessageType)2, "$msg_incompleteoffering: " + Localization.instance.Localize(m_requiredItemName) + " " + num + " / " + m_requiredItemAmount, 0, (Sprite)null); return true; } if (m_spawnStatusEffect && (Object)(object)m_aoePrefab == (Object)null) { Debug.LogWarning((object)"Missing Status Effect Prefab[AoE]"); return true; } if (m_spawnItem && (Object)(object)m_itemPrefab == (Object)null) { Debug.LogWarning((object)"Missing ItemDrop Prefab"); return true; } bool flag = false; if (((Object)(object)m_aoePrefab != (Object)null && m_spawnStatusEffect) || ((Object)(object)m_itemPrefab != (Object)null && m_spawnItem)) { flag = Spawn(GetSpawnPosition()); } if (flag) { user.GetInventory().RemoveItem(item.m_shared.m_name, m_requiredItemAmount, -1, true); ((Character)user).ShowRemovedMessage(m_requiredItem.m_itemData, m_requiredItemAmount); ((Character)user).Message((MessageType)2, "$msg_offerdone", 0, (Sprite)null); if (Object.op_Implicit((Object)(object)m_itemSpawnPoint)) { m_fuelAddedEffects.Create(m_itemSpawnPoint.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } if (!string.IsNullOrEmpty(m_setGlobalKey)) { ZoneSystem.instance.SetGlobalKey(m_setGlobalKey); } } return flag; } ((Character)user).Message((MessageType)2, "$msg_offerwrong", 0, (Sprite)null); return true; } public bool IsActive() { return (m_maxFuel == 0 || (double)GetFuel() > 0.0) && !m_blockedSmoke; } private void UpdateGameObjectState() { bool flag = IsActive(); m_enabledObject.SetActive(flag); if (Object.op_Implicit((Object)(object)m_disabledObject)) { m_disabledObject.SetActive(!flag); } if (Object.op_Implicit((Object)(object)m_haveFuelObject)) { m_haveFuelObject.SetActive((double)GetFuel() > 0.0); } SetAnimation(flag); } private void SetAnimation(bool active) { Animator[] animators = m_animators; foreach (Animator val in animators) { if (((Component)val).gameObject.activeInHierarchy) { val.SetBool("active", active); val.SetFloat("activef", active ? 1f : 0f); } } } private float GetDeltaTime() { DateTime time = ZNet.instance.GetTime(); DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong("StartTime", time.Ticks)); double totalSeconds = (time - dateTime).TotalSeconds; m_nview.GetZDO().Set("StartTime", time.Ticks); return (float)totalSeconds; } private void UpdateFuel(float dt) { if (m_useFuel) { float num = dt / m_secPerFuel; float num2 = GetFuel() - num; if ((double)num2 < 0.0) { num2 = 0f; } SetFuel(num2); } } private void RPC_AddFuel(long sender) { //IL_0034: 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 (m_nview.IsOwner()) { SetFuel(GetFuel() + 1f); m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); } } private void UpdateOfferingStation() { if (m_nview.IsValid()) { } } private Vector3 GetSpawnPosition() { //IL_0026: 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) return ((Object)(object)m_spawnPoint != (Object)null) ? m_spawnPoint.transform.position : ((Component)this).transform.position; } private bool Spawn(Vector3 point) { //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) m_spawnStartEffects.Create(point, Quaternion.identity, (Transform)null, 1f, -1); ((MonoBehaviour)this).Invoke("DelayedSpawn", m_SpawnDelay); return true; } private void UpdateSmoke() { if ((Object)(object)m_smokeSpawner != (Object)null) { m_blockedSmoke = m_smokeSpawner.IsBlocked(); } else { m_blockedSmoke = false; } } private float GetFuel() { return m_nview.GetZDO().GetFloat("fuel", 0f); } private void SetFuel(float fuel) { m_nview.GetZDO().Set("fuel", fuel); } private bool OnAddFuel(Switch sw, Humanoid user, ItemData item) { if (!m_useFuel) { ((Character)user).Message((MessageType)2, "No fuel required", 0, (Sprite)null); return false; } if (item != null && item.m_shared.m_name != m_fuelItem.m_itemData.m_shared.m_name) { ((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null); return false; } if (!user.GetInventory().HaveItem(m_fuelItem.m_itemData.m_shared.m_name, true)) { ((Character)user).Message((MessageType)2, "$msg_donthaveany " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + m_fuelItem.m_itemData.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(m_fuelItem.m_itemData.m_shared.m_name, 1, -1, true); m_nview.InvokeRPC("AddFuel", Array.Empty<object>()); return true; } private bool IsSpawnQueued() { return ((MonoBehaviour)this).IsInvoking("DelayedSpawn"); } private void DelayedSpawn() { //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_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_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) if (m_spawnStatusEffect) { Aoe component = Object.Instantiate<GameObject>(m_aoePrefab, GetSpawnPosition(), Quaternion.identity).GetComponent<Aoe>(); component.m_statusEffect = m_statusEffectName; } if (m_spawnItem) { Object.Instantiate<GameObject>(((Component)m_itemPrefab).gameObject, GetSpawnPosition(), Quaternion.identity); } m_spawnFinishEffects.Create(GetSpawnPosition(), Quaternion.identity, (Transform)null, 1f, -1); } } namespace UpgradeWorld { public class CommandRegistration { public string name = ""; public string description = ""; public string[] commands = new string[0]; public void AddCommand() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) new ConsoleCommand(name, description, (ConsoleEvent)delegate(ConsoleEventArgs args) { string[] array = commands; foreach (string text in array) { args.Context.TryRunCommand(text, false, false); } }, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class Upgrade { private static List<CommandRegistration> registrations = new List<CommandRegistration>(); public const string GUID = "upgrade_world"; public static void Register(string name, string description, params string[] commands) { if (Chainloader.PluginInfos.ContainsKey("upgrade_world")) { registrations.Add(new CommandRegistration { name = name, description = description, commands = commands }); } } private static void Postfix() { foreach (CommandRegistration registration in registrations) { registration.AddCommand(); } } } } namespace BalrondNature { public class BalrondTranslator { public static Dictionary<string, Dictionary<string, string>> translations = new Dictionary<string, Dictionary<string, string>>(); public static Dictionary<string, string> getLanguage(string language) { if (string.IsNullOrEmpty(language)) { return null; } if (translations.TryGetValue(language, out var value)) { return value; } return null; } } [HarmonyPatch] public static class DeepNorthRegion { [HarmonyPatch(typeof(EnvMan), "GetBiome")] private static class EnvMan_GetBiome_Patch { private static bool Prefix(EnvMan __instance, ref Biome __result) { //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_003d: 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_007d: 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_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_009f: Expected I4, but got Unknown Camera mainCamera = Utils.GetMainCamera(); if ((Object)(object)mainCamera == (Object)null) { __result = (Biome)0; return false; } Vector3 position = ((Component)mainCamera).transform.position; Heightmap val = GetCachedHeightmap(__instance); if ((Object)(object)val == (Object)null || !val.IsPointInside(position, 0f)) { val = Heightmap.FindHeightmap(position); SetCachedHeightmap(__instance, val); } if (!Object.op_Implicit((Object)(object)val)) { __result = (Biome)0; return false; } bool flag = DeepNorthZone.IsAshlandsOrDeepNorthArea(position.x, position.z); __result = (Biome)(int)val.GetBiome(position, __instance.m_oceanLevelEnvCheckAshlandsDeepnorth, flag); return false; } } [HarmonyPatch(typeof(EnvMan), "UpdateEnvironment")] private static class EnvMan_UpdateEnvironment_Patch { private static bool Prefix(EnvMan __instance, long sec, Biome biome) { //IL_0023: 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_006e: 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_0081: 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_008d: 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_00fb: 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_011b: 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) string text = CallGetEnvironmentOverride(__instance); if (!string.IsNullOrEmpty(text)) { SetEnvironmentPeriod(__instance, -1L); SetCurrentBiomeField(__instance, __instance.GetCurrentBiome()); CallQueueEnvironment(__instance, text); return false; } Camera mainCamera = Utils.GetMainCamera(); if ((Object)(object)mainCamera == (Object)null) { return false; } long num = sec / __instance.m_environmentDuration; Vector3 position = ((Component)mainCamera).transform.position; bool flag = WorldGenerator.IsAshlands(position.x, position.z); bool flag2 = DeepNorthZone.ShouldUseOverrideEnvironment(position.x, position.z, biome); bool flag3 = flag || flag2; __instance.m_dirLight.renderMode = (LightRenderMode)((!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !((Character)Player.m_localPlayer).InInterior()) ? 1 : 2); if (GetEnvironmentPeriod(__instance) == num && GetCurrentBiomeField(__instance) == biome && flag3 == GetInAshlandsOrDeepnorth(__instance)) { return false; } SetEnvironmentPeriod(__instance, num); SetCurrentBiomeField(__instance, biome); SetInAshlandsOrDeepnorth(__instance, flag3); State state = Random.state; Random.InitState((int)num); List<EnvEntry> list = CallGetAvailableEnvironments(__instance, biome); if (list != null && list.Count > 0) { EnvSetup val = CallSelectWeightedEnvironment(__instance, list); foreach (EnvEntry item in list) { if (item.m_ashlandsOverride && flag) { val = item.m_env; } if (item.m_deepnorthOverride && flag2) { val = item.m_env; } } if (val != null) { CallQueueEnvironment(__instance, val); } } Random.state = state; return false; } } [HarmonyPatch(typeof(Minimap), "GetMaskColor")] private static class Minimap_GetMaskColor_Patch { private static void Postfix(float wx, float wy, float height, Biome biome, ref Color __result) { //IL_0005: 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_0013: Unknown result type (might be due to invalid IL or missing references) __result = ApplyDeepNorthOceanMask(__result, wx, wy, height, biome); } } [HarmonyPatch(typeof(Minimap), "GetPixelColor")] private static class Minimap_GetPixelColor_Patch { private static void Postfix(Biome biome, ref Color __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //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) if ((int)biome == 64) { __result = DeepNorthMapColor; } } } [HarmonyPatch(typeof(Minimap), "GenerateWorldMap")] private static class Minimap_GenerateWorldMap_Patch { private static void Postfix(Minimap __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //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_0098: 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_00b7: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Invalid comparison between Unknown and I4 //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_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_00fc: 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) Texture2D val = (Texture2D)FI_Minimap_m_mapTexture.GetValue(__instance); if ((Object)(object)val == (Object)null || WorldGenerator.instance == null) { return; } int textureSize = __instance.m_textureSize; int num = textureSize / 2; float pixelSize = __instance.m_pixelSize; float num2 = pixelSize / 2f; Color[] pixels = val.GetPixels(); for (int i = 0; i < textureSize; i++) { for (int j = 0; j < textureSize; j++) { float num3 = (float)(j - num) * pixelSize + num2; float num4 = (float)(i - num) * pixelSize + num2; Biome biome = WorldGenerator.instance.GetBiome(num3, num4, 0.02f, false); if (DeepNorthZone.IsAreaOrNearbyOcean(num3, num4, biome)) { int num5 = i * textureSize + j; if ((int)biome == 64) { pixels[num5] = Color.Lerp(pixels[num5], DeepNorthMapColor, 0.55f); } else if ((int)biome == 256) { pixels[num5] = GetDeepNorthOceanTintedColor(pixels[num5], num3, num4); } } } } val.SetPixels(pixels); val.Apply(); } } public static readonly Color DeepNorthMapColor = new Color(0.82f, 0.9f, 1f, 1f); public static readonly Color DeepNorthOceanColor = new Color(0.56f, 0.72f, 0.96f, 1f); public static readonly Color DeepNorthIceColor = new Color(0.82f, 0.92f, 1f, 1f); private static readonly BindingFlags InstNonPublic = BindingFlags.Instance | BindingFlags.NonPublic; private static readonly FieldInfo FI_EnvMan_m_cachedHeightmap = typeof(EnvMan).GetField("m_cachedHeightmap", InstNonPublic); private static readonly FieldInfo FI_EnvMan_m_currentBiome = typeof(EnvMan).GetField("m_currentBiome", InstNonPublic); private static readonly FieldInfo FI_EnvMan_m_inAshlandsOrDeepnorth = typeof(EnvMan).GetField("m_inAshlandsOrDeepnorth", InstNonPublic); private static readonly FieldInfo FI_EnvMan_m_environmentPeriod = typeof(EnvMan).GetField("m_environmentPeriod", InstNonPublic); private static readonly MethodInfo MI_EnvMan_GetEnvironmentOverride = typeof(EnvMan).GetMethod("GetEnvironmentOverride", InstNonPublic); private static readonly MethodInfo MI_EnvMan_GetAvailableEnvironments = typeof(EnvMan).GetMethod("GetAvailableEnvironments", InstNonPublic); private static readonly MethodInfo MI_EnvMan_SelectWeightedEnvironment = typeof(EnvMan).GetMethod("SelectWeightedEnvironment", InstNonPublic); private static readonly MethodInfo MI_EnvMan_QueueEnvironment_String = typeof(EnvMan).GetMethod("QueueEnvironment", InstNonPublic, null, new Type[1] { typeof(string) }, null); private static readonly MethodInfo MI_EnvMan_QueueEnvironment_EnvSetup = typeof(EnvMan).GetMethod("QueueEnvironment", InstNonPublic, null, new Type[1] { typeof(EnvSetup) }, null); private static readonly FieldInfo FI_Minimap_m_mapTexture = typeof(Minimap).GetField("m_mapTexture", InstNonPublic); public static Color GetDeepNorthOceanTintedColor(Color baseColor, float x, float z) { //IL_001d: 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_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_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_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_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_0061: Unknown result type (might be due to invalid IL or missing references) float oceanBlend = DeepNorthZone.GetOceanBlend(x, z); if (oceanBlend <= 0f) { return baseColor; } Color val = Color.Lerp(baseColor, DeepNorthOceanColor, Mathf.Clamp01(oceanBlend * 1.15f)); float num = Mathf.Clamp01(Mathf.InverseLerp(0.35f, 1f, oceanBlend)); return Color.Lerp(val, DeepNorthIceColor, num * 0.55f); } public static Color ApplyDeepNorthOceanMask(Color originalMask, float x, float z, float height, Biome biome) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0084: 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_0050: 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_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) //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) if (height >= 30f) { return originalMask; } if ((int)biome != 256 && (int)biome != 64) { return originalMask; } float oceanBlend = DeepNorthZone.GetOceanBlend(x, z); if (oceanBlend <= 0f) { return originalMask; } originalMask.b = Mathf.Max(originalMask.b, oceanBlend * 0.45f); originalMask.a = Mathf.Max(originalMask.a, oceanBlend * 0.15f); return originalMask; } private static Heightmap GetCachedHeightmap(EnvMan envMan) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return (Heightmap)FI_EnvMan_m_cachedHeightmap.GetValue(envMan); } private static void SetCachedHeightmap(EnvMan envMan, Heightmap heightmap) { FI_EnvMan_m_cachedHeightmap.SetValue(envMan, heightmap); } private static Biome GetCurrentBiomeField(EnvMan envMan) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) return (Biome)FI_EnvMan_m_currentBiome.GetValue(envMan); } private static void SetCurrentBiomeField(EnvMan envMan, Biome biome) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) FI_EnvMan_m_currentBiome.SetValue(envMan, biome); } private static bool GetInAshlandsOrDeepnorth(EnvMan envMan) { return (bool)FI_EnvMan_m_inAshlandsOrDeepnorth.GetValue(envMan); } private static void SetInAshlandsOrDeepnorth(EnvMan envMan, bool value) { FI_EnvMan_m_inAshlandsOrDeepnorth.SetValue(envMan, value); } private static long GetEnvironmentPeriod(EnvMan envMan) { return (long)FI_EnvMan_m_environmentPeriod.GetValue(envMan); } private static void SetEnvironmentPeriod(EnvMan envMan, long value) { FI_EnvMan_m_environmentPeriod.SetValue(envMan, value); } private static string CallGetEnvironmentOverride(EnvMan envMan) { return (string)MI_EnvMan_GetEnvironmentOverride.Invoke(envMan, null); } private static List<EnvEntry> CallGetAvailableEnvironments(EnvMan envMan, Biome biome) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) return (List<EnvEntry>)MI_EnvMan_GetAvailableEnvironments.Invoke(envMan, new object[1] { biome }); } private static EnvSetup CallSelectWeightedEnvironment(EnvMan envMan, List<EnvEntry> environments) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return (EnvSetup)MI_EnvMan_SelectWeightedEnvironment.Invoke(envMan, new object[1] { environments }); } private static void CallQueueEnvironment(EnvMan envMan, string name) { MI_EnvMan_QueueEnvironment_String.Invoke(envMan, new object[1] { name }); } private static void CallQueueEnvironment(EnvMan envMan, EnvSetup env) { MI_EnvMan_QueueEnvironment_EnvSetup.Invoke(envMan, new object[1] { env }); } } internal static class DeepNorthTuning { public static float MinDistance = 12000f; public static float YOffset = 4000f; public static float OceanGradientRange = 170f; public static float GapRange = 1000f; public static float NearbyOceanMargin = 0.75f; public static float MainMaskDistance = 1750f; public static float SideTaper = 7800f; public static float OceanFadeStart = 9750f; public static float OceanFadeRange = 1150f; public static float CellularLargeStartScale = 0.28f; public static int CellularLargeOctaves = 6; public static float CellularLargeGain = 0.55f; public static float CellularSharpStartScale = 7f; public static int CellularSharpOctaves = 4; public static float CellularSharpGain = 0.55f; public static float CellularSharpPow = 3.5f; public static float CellularSharpMul = 2.35f; public static float ShelfTarget = 0.2f; public static float ShelfBlend = 0.8f; public static float MainHeightMul = 1.2f; public static float Perlin1 = 0.009f; public static float Perlin2 = 0.019f; public static float Perlin3 = 0.048f; public static float Perlin4 = 0.095f; public static float SimplexScale = 0.065f; public static float SimplexPow = 1.35f; public static float CrackBaseHeight = 0.16f; public static float CrackThresholdMin = 0.009f; public static float CrackThresholdMax = 0.038f; public static float CrackNoiseScale = 0.045f; public static float CrackNoiseOffsetX = 5124f; public static float CrackNoiseOffsetY = 5000f; public static float FbmScale = 0.012f; public static int FbmOctaves = 4; public static float FbmLacunarity = 2.1f; public static float FbmGain = 0.55f; public static float BlendMaskMin = 0.62f; public static float BlendMaskMax = 1f; public static float HeightGateMin = 0.13f; public static float HeightGateRange = 0.03f; public static float DetailScale1 = 0.09f; public static float DetailStrength1 = 0.018f; public static float DetailScale2 = 0.35f; public static float DetailStrength2 = 0.007f; } internal static class DeepNorthZone { public static bool IsCore(float x, float z) { return WorldGenerator.IsDeepnorth(x, z); } public static bool IsCore(Vector3 position) { //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) return IsCore(position.x, position.z); } public static double GetAngleOffset(float x, float z) { return (double)WorldGenerator.WorldAngle(x, z + DeepNorthTuning.YOffset) * 100.0; } public static double GetShiftedDistance(float x, float z) { return DUtils.Length(x, z + DeepNorthTuning.YOffset); } public static float GetOceanGradient(float x, float z) { double shiftedDistance = GetShiftedDistance(x, z); double angleOffset = GetAngleOffset(x, z); return (float)((shiftedDistance - ((double)DeepNorthTuning.MinDistance + angleOffset)) / (double)DeepNorthTuning.OceanGradientRange); } public static bool IsNearbyOcean(float x, float z) { return GetOceanGradient(x, z) > 0f - DeepNorthTuning.NearbyOceanMargin; } public static bool IsNearbyOcean(float x, float z, Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 return (int)biome == 256 && IsNearbyOcean(x, z); } public static bool IsAreaOrNearbyOcean(float x, float z, Biome biome) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) return (int)biome == 64 || IsNearbyOcean(x, z, biome); } public static bool ShouldUseOverrideEnvironment(float x, float z, Biome biome) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return IsAreaOrNearbyOcean(x, z, biome); } public static bool IsAshlandsOrDeepNorthArea(float x, float z) { return WorldGenerator.IsAshlands(x, z) || IsCore(x, z) || IsNearbyOcean(x, z); } public static float GetOceanBlend(float x, float z) { float oceanGradient = GetOceanGradient(x, z); return Mathf.Clamp01(Mathf.InverseLerp(0f - DeepNorthTuning.NearbyOceanMargin, 0.75f, oceanGradient)); } public static double CreateGap(float x, float z) { double shiftedDistance = GetShiftedDistance(x, z); double angleOffset = GetAngleOffset(x, z); return DUtils.MathfLikeSmoothStep(0.0, 1.0, DUtils.Clamp01(Math.Abs(shiftedDistance - ((double)DeepNorthTuning.MinDistance + angleOffset)) / (double)DeepNorthTuning.GapRange)); } public static bool ShouldApplyFreezingWater(float x, float z, Biome biome) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return IsAreaOrNearbyOcean(x, z, biome); } public static bool ShouldApplyFreezingWater(Character character) { //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_004b: 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_007d: 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_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_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) if ((Object)(object)character == (Object)null) { return false; } if (!character.InWater() && !character.IsSwimming()) { return false; } if (character.IsDead()) { return false; } Vector3 position = ((Component)character).transform.position; Biome biome = (Biome)0; if (WorldGenerator.instance != null) { biome = WorldGenerator.instance.GetBiome(position.x, position.z, 0.02f, false); } return ShouldApplyFreezingWater(position.x, position.z, biome); } } internal class VfxList { public static readonly string[] vfx = new string[49] { "waterbucket_projectile_bal", "vfx_mammothhead_destruction", "vfx_dragonhead_destruction", "ElderMushroomCap_bal", "ElderMushroomLog_bal", "Acai_log_bal", "IcedTree_log_bal", "ElderTreeLog_bal", "ElderTreeLogHalf_bal", "vfx_MeteoriteDestroyed_bal", "vfx_MeteoriteDestroyed_large_bal", "radiation1_bal", "radiation2_bal", "vfx_wood_ember_stack_destroyed_bal", "Acai_log_half_bal", "Wet_log_bal", "Wet_log_half_bal", "Cypress_log_bal", "Willow_log_bal", "Maple_log_bal", "Oak2_log_bal", "Oak2_log_half_bal", "Poplar_log_bal", "YewTreeLog_bal", "vfx_coin_silver_pile_destroyed_bal", "vfx_coin_silver_stack_destroyed_bal", "bow_projectile_blizzard_bal", "bow_projectile_chitin_bal", "bow_projectile_flametal_bal", "bigyggashoot_log_bal", "bigyggashoot_log_half_bal", "bigyggashoot_log_quarter_bal", "stalagmite_ash_destruction_bal", "waterSplashAoe_bal", "vfx_taunted_bal", "vfx_Bleeding_bal", "vfx_FreezingWater_bal", "vfx_Sick_bal", "vfx_Fractured_bal", "vfx_Lacerated_bal", "vfx_Punctured_bal", "vfx_Scorched_bal", "vfx_Chilled_bal", "vfx_Staticcharge_bal", "vfx_Soulsapped_bal", "vfx_Enfeebled_bal", "vfx_Firstaidkit_bal", "vfx_basalt_hit_bal", "vfx_basalt_destroyed_bal" }; } [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class DamageConditionsPatch { private class DebuffProcConfig { public DamageType DamageType; public float DamageThreshold; public float BaseProcChance; public string StatusEffectName; public int StatusEffectHash; } private const string BleedingStatusName = "SE_Bleeding_bal"; private static readonly int BleedingStatusHash = BalrondHashCompat.StableHash("SE_Bleeding_bal"); private static readonly int FracturedStatusHash = BalrondHashCompat.StableHash("SE_Fractured_bal"); private static readonly int LaceratedStatusHash = BalrondHashCompat.StableHash("SE_Lacerated_bal"); private static readonly int PuncturedStatusHash = BalrondHashCompat.StableHash("SE_Punctured_bal"); private static readonly Dictionary<DamageType, DebuffProcConfig> ProcConfigs = new Dictionary<DamageType, DebuffProcConfig> { { (DamageType)32, new DebuffProcConfig { DamageType = (DamageType)32, DamageThreshold = 12f, BaseProcChance = 0.05f, StatusEffectName = "SE_Scorched_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_Scorched_bal") } }, { (DamageType)64, new DebuffProcConfig { DamageType = (DamageType)64, DamageThreshold = 12f, BaseProcChance = 0.05f, StatusEffectName = "SE_Chilled_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_Chilled_bal") } }, { (DamageType)256, new DebuffProcConfig { DamageType = (DamageType)256, DamageThreshold = 10f, BaseProcChance = 0.05f, StatusEffectName = "SE_Enfeebled_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_Enfeebled_bal") } }, { (DamageType)128, new DebuffProcConfig { DamageType = (DamageType)128, DamageThreshold = 14f, BaseProcChance = 0.05f, StatusEffectName = "SE_StaticCharge_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_StaticCharge_bal") } }, { (DamageType)512, new DebuffProcConfig { DamageType = (DamageType)512, DamageThreshold = 10f, BaseProcChance = 0.05f, StatusEffectName = "SE_SoulSapped_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_SoulSapped_bal") } }, { (DamageType)1, new DebuffProcConfig { DamageType = (DamageType)1, DamageThreshold = 10f, BaseProcChance = 0.05f, StatusEffectName = "SE_Fractured_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_Fractured_bal") } }, { (DamageType)2, new DebuffProcConfig { DamageType = (DamageType)2, DamageThreshold = 10f, BaseProcChance = 0.05f, StatusEffectName = "SE_Lacerated_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_Lacerated_bal") } }, { (DamageType)4, new DebuffProcConfig { DamageType = (DamageType)4, DamageThreshold = 10f, BaseProcChance = 0.05f, StatusEffectName = "SE_Punctured_bal", StatusEffectHash = BalrondHashCompat.StableHash("SE_Punctured_bal") } } }; private static readonly MethodInfo GetWeakSpotMethod = AccessTools.Method(typeof(Character), "GetWeakSpot", new Type[1] { typeof(short) }, (Type[])null); private static readonly FieldInfo BackstabTimeField = AccessTools.Field(typeof(Character), "m_backstabTime"); private static void Prefix(Character __instance, HitData hit) { if (!((Object)(object)__instance == (Object)null) && hit != null && __instance.IsOwner() && !(__instance.GetHealth() <= 0f) && !__instance.IsDead() && !__instance.IsTeleporting() && !__instance.InCutscene() && (!hit.m_dodgeable || !__instance.IsDodgeInvincible())) { HitData val = CreateSimulatedHit(__instance, hit); if (val != null) { TryApplyMajorityDamageDebuff(__instance, val); } } } private static HitData CreateSimulatedHit(Character target, HitData originalHit) { //IL_0048: 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_0114: Unknown result type (might be due to invalid IL or missing references) HitData val = CloneHit(originalHit); if (val == null) { return null; } Character attacker = originalHit.GetAttacker(); if ((Object)(object)attacker != (Object)null && !attacker.IsPlayer()) { float difficultyDamageScalePlayer = Game.instance.GetDifficultyDamageScalePlayer(((Component)target).transform.position); val.ApplyModifier(difficultyDamageScalePlayer); val.ApplyModifier(Game.m_enemyDamageRate); } BaseAI baseAI = target.GetBaseAI(); if ((Object)(object)baseAI != (Object)null && !baseAI.IsAlerted() && val.m_backstabBonus > 1f && Time.time - GetBackstabTime(target) > 300f && (!ZoneSystem.instance.GetGlobalKey((GlobalKeys)25) || !baseAI.CanSeeTarget(attacker))) { val.ApplyModifier(val.m_backstabBonus); } if (target.IsStaggering() && !target.IsPlayer()) { val.ApplyModifier(2f); } WeakSpot weakSpot = GetWeakSpot(target, val.m_weakSpot); DamageModifiers damageModifiers = target.GetDamageModifiers(weakSpot); DamageModifier val2 = default(DamageModifier); val.ApplyResistance(damageModifiers, ref val2); if (target.IsPlayer()) { float bodyArmor = target.GetBodyArmor(); val.ApplyArmor(bodyArmor); } else if (Game.m_worldLevel > 0) { val.ApplyArmor((float)(Game.m_worldLevel * Game.instance.m_worldLevelEnemyBaseAC)); } return val; } private static void TryApplyMajorityDamageDebuff(Character target, HitData simulatedHit) { //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_0047: 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_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_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_00a0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null || simulatedHit == null) { return; } SEMan sEMan = target.GetSEMan(); if (sEMan == null) { return; } float num = default(float); DamageType majorityDamageType = ((DamageTypes)(ref simulatedHit.m_damage)).GetMajorityDamageType(ref num); bool appliedPrimaryDebuff = false; if (ProcConfigs.TryGetValue(majorityDamageType, out var value) && num >= value.DamageThreshold) { DamageModifiers damageModifiers = target.GetDamageModifiers((WeakSpot)null); DamageModifier modifier = ((DamageModifiers)(ref damageModifiers)).GetModifier(majorityDamageType); float num2 = (target.IsPlayer() ? 1f : 0.75f); float num3 = value.BaseProcChance * GetResistanceChanceMultiplier(modifier) * num2; num3 = Mathf.Clamp01(num3); if (num3 > 0f && Random.value <= num3 && !sEMan.HaveStatusEffect(value.StatusEffectHash)) { sEMan.AddStatusEffect(value.StatusEffectHash, true, 0, 0f); appliedPrimaryDebuff = true; } } TryApplyBleeding(target, simulatedHit, sEMan, majorityDamageType, num, appliedPrimaryDebuff); } private static float GetBleedChanceFromWounds(int woundCount) { return woundCount switch { 1 => 0.05f, 2 => 0.25f, 3 => 0.75f, _ => 0f, }; } private static void TryApplyBleeding(Character target, HitData simulatedHit, SEMan seMan, DamageType majorityType, float majorityDamage, bool appliedPrimaryDebuff) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 if ((Object)(object)target == (Object)null || simulatedHit == null || seMan == null || ((int)majorityType != 2 && (int)majorityType != 4) || seMan.HaveStatusEffect(BleedingStatusHash)) { return; } bool flag = seMan.HaveStatusEffect(LaceratedStatusHash); bool flag2 = seMan.HaveStatusEffect(PuncturedStatusHash); bool flag3 = seMan.HaveStatusEffect(FracturedStatusHash); int num = 0; if (flag) { num++; } if (flag2) { num++; } if (flag3) { num++; } if (num != 0 && !(majorityDamage < 12f)) { float bleedChanceFromWounds = GetBleedChanceFromWounds(num); if (!(Random.value > bleedChanceFromWounds)) { seMan.AddStatusEffect(BleedingStatusHash, true, 0, 0f); } } } private static HitData CloneHit(HitData original) { //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) if (original == null) { return null; } HitData val = original.Clone(); val.m_damage = ((DamageTypes)(ref original.m_damage)).Clone(); return val; } private static WeakSpot GetWeakSpot(Character character, short weakSpotIndex) { if ((Object)(object)character == (Object)null || GetWeakSpotMethod == null) { return null; } try { object? obj = GetWeakSpotMethod.Invoke(character, new object[1] { weakSpotIndex }); return (WeakSpot)((obj is WeakSpot) ? obj : null); } catch { return null; } } private static float GetBackstabTime(Character character) { if ((Object)(object)character == (Object)null || BackstabTimeField == null) { return -99999f; } try { return (float)BackstabTimeField.GetValue(character); } catch { return -99999f; } } private static float GetResistanceChanceMultiplier(DamageModifier modifier) { //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_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_002f: Expected I4, but got Unknown switch ((int)modifier) { case 3: case 4: return 0f; case 5: return 0.11f; case 1: return 0.33f; case 7: return 0.66f; case 0: return 1f; case 8: return 1.33f; case 2: return 1.66f; case 6: return 2f; default: return 1f; } } } [HarmonyPatch] internal static class CombatPatches { [HarmonyPatch(typeof(Character), "CustomFixedUpdate")] public static class MonsterClimbPatch { private static readonly Dictionary<Character, float> NextCheck = new Dictionary<Character, float>(); private static readonly int GroundMask = LayerMask.GetMask(new string[6] { "Default", "static_solid", "vehicle", "Default_small", "piece", "terrain" }); private const float CheckInterval = 0.02f; private const float BaseUpBoost = 10f; private const float BaseForwardBoost = 4.5f; private const float ReferenceHeight = 1.5f; private const float MaxSizeMultiplier = 4.5f; private const float MinTargetHeightDifference = 0.45f; private const float TargetClimbXZRange = 10f; private static void Postfix(Character __instance, float dt) { //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_00db: 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_00f2: 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_01d6: 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_01f5: 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_02a6: 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_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_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_02e2: 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_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_02f5: 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_02f9: 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_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_033e: 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_0354: 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_0144: 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_0389: 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_038b: 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_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_03b4: 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_03dc: 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_03ea: 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_03fb: 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) //IL_0407: 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) if ((Object)(object)__instance == (Object)null || __instance.IsPlayer() || __instance.IsFlying() || !__instance.IsOwner() || __instance.IsDead() || !__instance.IsOnGround()) { return; } BaseAI baseAI = __instance.GetBaseAI(); if ((Object)(object)baseAI == (Object)null || baseAI.IsSleeping()) { return; } Vector3 val = __instance.GetMoveDir(); val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude >= 0.01f)) { Character targetCreature = baseAI.GetTargetCreature(); if ((Object)(object)targetCreature == (Object)null || targetCreature.IsDead()) { return; } Vector3 val2 = ((Component)targetCreature).transform.position - ((Component)__instance).transform.position; float y = val2.y; val2.y = 0f; float magnitude = ((Vector3)(ref val2)).magnitude; if (y < 0.45f || magnitude > 10f || magnitude < 0.05f) { return; } val = val2 / magnitude; } else { ((Vector3)(ref val)).Normalize(); } float time = Time.time; if (NextCheck.TryGetValue(__instance, out var value) && time < value) { return; } NextCheck[__instance] = time + 0.02f; Rigidbody component = ((Component)__instance).GetComponent<Rigidbody>(); CapsuleCollider collider = __instance.GetCollider(); if ((Object)(object)component == (Object)null || (Object)(object)collider == (Object)null) { return; } Bounds bounds = ((Collider)collider).bounds; float num = Mathf.Max(0.5f, ((Bounds)(ref bounds)).size.y); float num2 = Mathf.Max(((Bounds)(ref bounds)).extents.x, ((Bounds)(ref bounds)).extents.z); float num3 = Mathf.Clamp(num / 1.5f, 0.75f, 4.5f); float num4 = Mathf.InverseLerp(1f, 4.5f, num3); float num5 = 10f * Mathf.Lerp(0.85f, 1.65f, num4); float num6 = 4.5f * Mathf.Lerp(0.9f, 1.65f, num4); float num7 = Mathf.Clamp(num * 0.08f, 0.1f, 0.45f); float num8 = Mathf.Clamp(num * 0.28f, 0.25f, 1.6f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).center.z); Vector3 val4 = val3 + val * Mathf.Max(0.15f, num2 * 0.65f); Vector3 val5 = val4 + Vector3.up * num7; Vector3 val6 = val4 + Vector3.up * num8; float num9 = Mathf.Clamp(num2 * 0.22f, 0.14f, 0.65f); float num10 = Mathf.Clamp(num2 * 0.75f, 0.45f, 1.8f); RaycastHit val7 = default(RaycastHit); bool flag = Physics.SphereCast(val5, num9, val, ref val7, num10, GroundMask, (QueryTriggerInteraction)1); RaycastHit val8 = default(RaycastHit); bool flag2 = Physics.SphereCast(val6, num9, val, ref val8, num10, GroundMask, (QueryTriggerInteraction)1); if (!flag && !flag2) { return; } RaycastHit val9 = (flag2 ? val8 : val7); if (!(((RaycastHit)(ref val9)).normal.y > 0.58f)) { Vector3 linearVelocity = component.linearVelocity; if (linearVelocity.y < num5) { linearVelocity.y = num5; } Vector3 val10 = default(Vector3); ((Vector3)(ref val10))..ctor(linearVelocity.x, 0f, linearVelocity.z); if (Vector3.Dot(val10, val) < num6) { Vector3 val11 = val * num6; linearVelocity.x = val11.x; linearVelocity.z = val11.z; } component.linearVelocity = linearVelocity; __instance.TimeoutGroundForce(0.06f); } } public static void Remove(Character character) { if ((Object)(object)character != (Object)null) { NextCheck.Remove(character); } } } [HarmonyPatch(typeof(Character), "OnDestroy")] public static class MonsterClimbCleanupPatch { private static void Prefix(Character __instance) { MonsterClimbPatch.Remove(__instance); } } [HarmonyPatch(typeof(Attack), "OnAttackTrigger")] internal static class ResetLoaded { private static void Prefix(Attack __instance) { if (__instance == null || (Object)(object)__instance.m_character == (Object)null || (Object)(object)__instance.m_character != (Object)(object)Player.m_localPlayer) { return; } ItemData currentWeapon = __instance.m_character.GetCurrentWeapon(); if (IsCrossbowItem(currentWeapon)) { currentWeapon.m_customData["bal_cbow_loaded"] = "false"; if (currentWeapon.m_customData.ContainsKey("bal_cbow_loaded_changed")) { currentWeapon.m_customData.Remove("bal_cbow_loaded_changed"); currentWeapon.m_shared.m_attack.m_requiresReload = true; } } } } [HarmonyPatch(typeof(Humanoid), "UnequipItem")] internal static class CheckIfCrossbowWasUnequipped { private static void Prefix(Humanoid __instance, ItemData item, bool triggerEquipEffects = true) { if (!((Object)(object)__instance == (Object)null) && item != null && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Player.m_localPlayer.m_isLoading && IsCrossbowItem(item) && __instance.IsWeaponLoaded()) { item.m_customData["bal_cbow_loaded"] = "true"; if (item.m_shared.m_attack.m_requiresReload) { item.m_customData["bal_cbow_loaded_changed"] = "1"; item.m_shared.m_attack.m_requiresReload = false; } } } } [HarmonyPatch(typeof(Character), "CustomFixedUpdate")] public static class Patch_Player_StaminaRegenSmoothCurve { private const float MinRegenMultiplier = 0.75f; private const float MaxRegenMultiplier = 1.5f; private const float CurveExponent = 1.35f; private static void Prefix(Character __instance, ref float __state) { Player val = (Player)(object)((__instance is Player) ? __instance : null); __state = (((Object)(object)val != (Object)null) ? val.GetStamina() : (-1f)); } private static void Postfix(Character __instance, float __state) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if ((Object)(object)val == (Object)null || ((Character)val).IsDead() || __state < 0f) { return; } float stamina = val.GetStamina(); if (stamina <= __state) { return; } float maxStamina = ((Character)val).GetMaxStamina(); if (!(maxStamina <= 0f)) { float num = stamina - __state; float num2 = Mathf.Clamp01((maxStamina - stamina) / maxStamina); float num3 = Mathf.Pow(num2, 1.35f); float num4 = Mathf.Lerp(1.5f, 0.75f, num3); float num5 = num * num4; float num6 = Mathf.Clamp(__state + num5, 0f, maxStamina); float num7 = num6 - stamina; if (Mathf.Abs(num7) > 0.001f) { ((Character)val).AddStamina(num7); } } } } private const string CbowLoadedKey = "bal_cbow_loaded"; private const string CbowLoadedChangedKey = "bal_cbow_loaded_changed"; [HarmonyPrefix] [HarmonyPatch(typeof(Attack), "DoMeleeAttack")] private static void Attack_DoMeleeAttack(Attack __instance) { if (!Compatibility2.IsLoaded()) { Player component = ((Component)__instance.m_character).GetComponent<Player>(); if (Object.op_Implicit((Object)(object)component) && !((Object)(object)component != (Object)(object)Player.m_localPlayer)) { __instance.m_maxYAngle = 180f; __instance.m_attackHeight = 1f; } } } [HarmonyPostfix] [HarmonyPatch(typeof(Player), "AlwaysRotateCamera")] private static void Player_AlwaysRotateCamera(Character __instance, ref bool __result) { if (!Compatibility2.IsLoaded()) { Player component = ((Component)__instance).GetComponent<Player>(); if (Object.op_Implicit((Object)(object)component) && !((Object)(object)component != (Object)(object)Player.m_localPlayer) && ((Character)component).IsBlocking() && component.m_attackTowardsPlayerLookDir) { __result = false; } } } public static bool IsCrossbowItem(ItemData item) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 if (item == null || item.m_shared == null) { return false; } SkillType skillType = item.m_shared.m_skillType; return (int)skillType == 14 || (int)skillType == 9 || (int)skillType == 10; } } public class ConversionChanges2 { private enum ConversionType { smelter, fermenter, cooking, balrondConverter } private List<GameObject> buildPieces = new List<GameObject>(); private List<GameObject> items = new List<GameObject>(); private readonly Dictionary<string, GameObject> _buildPieceByName = new Dictionary<string, GameObject>(256); private readonly Dictionary<string, GameObject> _itemByName = new Dictionary<string, GameObject>(1024); private readonly Dictionary<string, ItemDrop> _itemDropByName = new Dictionary<string, ItemDrop>(1024); private readonly HashSet<string> _missingItemWarned = new HashSet<string>(); public static readonly List<TutorialText> m_texts = new List<TutorialText>(64); private static readonly string[] buildPieceNames = new string[18] { "portal_wood", "piece_workbench", "forge", "blackforge", "piece_magetable", "piece_artisanstation", "piece_stonecutter", "piece_banner01", "piece_banner02", "piece_banner03", "piece_banner04", "piece_banner05", "piece_banner06", "piece_banner07", "piece_banner08", "piece_banner09", "piece_banner10", "piece_banner11" }; private readonly string[] convertToBits = new string[41] { "WillowSeeds_bal", "WillowBark_bal", "YewBark_bal", "WoodNails_bal", "WaterLilySeeds_bal", "SwampTreeSeeds_bal", "Straw_bal", "StrawSeeds_bal", "Snowleaf_bal", "StrawThread_bal", "RedwoodSeeds_bal", "Plantain_bal", "PoplarSeeds_bal", "Peningar_bal", "Sage_bal", "Lavender_bal", "Mint_bal", "OilBase_bal", "Oil_bal", "Nettle_bal", "Moss_bal", "Mugwort_bal", "MushroomIcecap_bal", "MushroomInkcap_bal", "Iceberry_bal", "Ignicap_bal", "GarlicSeeds_bal", "Garlic_bal", "CypressSeeds_bal", "CabbageLeaf_bal", "CabbageSeeds_bal", "Cabbage_bal", "BirdFeed_bal", "Blackberries_bal", "AppleSeeds_bal", "BasicSeed_bal", "AcaiSeeds_bal", "MapleSeeds_bal", "WaterLily_bal", "Yarrow_bal", "MeatScrap_bal" }; private readonly string[] convertToCoal = new string[201] { "ClayBrickMold_bal", "AcidSludge_bal", "AncientRelic_bal", "AppleVinegar_bal", "Apple_bal", "BatWingCooked_bal", "BatWing_bal", "BeltForester_bal", "BeltMountaineer_bal", "BeltSailor_bal", "BlackMetalCultivator_bal", "BlackMetalHoe_bal", "BlackSkin_bal", "BlackTissue_bal", "Bloodfruit_bal", "Bloodshard_bal", "BoarHide_bal", "BoraxCrystal_bal", "BundleBaseItem_bal", "BundleHut_bal", "CarvedCarcass_bal", "CarvedDeerSkull_bal", "CeramicMold_bal", "Cheese_bal", "CabbageSoup_bal", "ClamMeat_bal", "ClayBrick_bal", "ClayPot_bal", "Clay_bal", "CoalPowder_bal", "CookedCrowMeat_bal", "CookedDragonRibs_bal", "CorruptedEitr_bal", "CrabLegsCooked_bal", "CrabLegs_bal", "CrystalWood_bal", "CultInsignia_bal", "CursedBone_bal", "Darkbul_bal", "DeadEgo_bal", "DragonSoul_bal", "DrakeMeatCooked_bal", "DrakeMeat_bal", "DrakeSkin_bal", "DyeKit_bal", "EmberWood_bal", "EnrichedEitr_bal", "EnrichedSoil_bal", "FenringInsygnia_bal", "FenringMeatCooked_bal", "FenringMeat_bal", "FireGland_bal", "FishWrapsUncooked_bal", "ForsakenHeart_bal", "FoxFur_bal", "CarvedWood_bal", "WispCore_bal", "GoatMeatCooked_bal", "GoatMeat_bal", "GrayMushroom_bal", "GrilledCheese_bal", "HammerBlackmetal_bal", "HammerDverger_bal", "HammerIron_bal", "HammerMythic_bal", "HardWood_bal", "HelmetCrown_bal", "InfusedCarapace_bal", "JotunFinger_bal", "JuteThread_bal", "KingMug_bal", "MagmaStone_bal", "MeadBase_bal", "MedPack_bal", "MincedMeat_bal", "NeckSkin_bal", "NorthernFur_bal", "NumbMeal_bal", "PatchworkAsk_bal", "PatchworkBoar_bal", "PatchworkDeer_bal", "PatchworkLox_bal", "PatchworkTroll_bal", "PatchworkWolf_bal", "PickaxeFlametal_bal", "RawCrowMeat_bal", "RawDragonRibs_bal", "RawSilkScrap_bal", "RawSilk_bal", "RawSteak_bal", "RedKelp_bal", "RefinedOil_bal", "Sapphire_bal", "SawBlade_bal", "Seaberries_bal", "SeekerBrain_bal", "SerpentEgg_bal", "SharkMeatCooked_bal", "SharkMeat_bal", "SilkReinforcedThread_bal", "SmallBloodSack_bal", "SoulCore_bal", "SpiceSet_bal", "SpiritShard_bal", "SteakCooked_bal", "StormScale_bal", "TarBase_bal", "ThornHeart_bal", "ThunderGland_bal", "TormentedSoul_bal", "TrollMeatCooked_bal", "TrollMeat_bal", "WatcherHeart_bal", "SurtlingCoreCasing_bal", "ApplePieUncooked_bal", "ApplePie_bal", "AshlandCurry_bal", "BlackBerryJuice_bal", "BloodfruitSoup_bal", "BloodyBearJerky_bal", "BloodyCreamPie_bal", "BloodyVial_bal", "BlueberryPieUncooked_bal", "BlueberryPie_bal", "Breakfast_bal", "Burger_bal", "ChickenMarsala_bal", "ChickenNuggets_bal", "DragonfireBarbecue_bal", "FishSkewer_bal", "FruitPunch_bal", "FruitSalad_bal", "GrilledShrooms_bal", "HappyMeal_bal", "HoneyGlazedApple_bal", "IceBerryPancake_bal", "KingsJam_bal", "Liverwurst_bal", "MagmaCoctail_bal", "MeadBaseWhiteCheese_bal", "SeaFoodPlatter_bal", "SpicyBurger_bal", "SpiecedDrakeChop_bal", "SurstrommingBase_bal", "Surstromming_bal", "SwampSkause_bal", "VegetablePuree_bal", "VegetableSoup_bal", "WhiteCheese_bal", "WinterStew_bal", "CarrotFries_bal", "PowderedSalt_bal", "PowderedPepper_bal", "BundlePortal_bal", "BundlePortalStone_bal", "HelmetLeatherCap_bal", "HelmetBronzeHorned_bal", "BlackBerryJuiceBase_bal", "MagmaCoctailBase_bal", "FruitPunchBase_bal", "VineBerryJuice_bal", "VineBerryJuiceBase_bal", "RostedTrollBits_bal", "RoastedFish_bal", "CabbageWrapDrake_bal", "Cotlet_bal", "RedStew_bal", "GoatStew_bal", "CrustedMeat_bal", "MeatBalls_bal", "MeatRoll_bal", "MagnaTarta_bal", "ShrededMeat_bal", "MincedFenringStew_bal", "CarrotCrowSalad_bal", "Bulion_bal", "CookedMeatScrap_bal", "WoodBucket_bal", "BeltVidar_bal", "BeltAssasin_bal", "TrophyBattleHog_bal", "TrophyGoat_bal", "TrophyNeckBrute_bal", "TrophyObsidianCrab_bal", "TrophyShark_bal", "TrophySouling_bal", "TrophyCorpseCollector_bal", "TrophyForsaken_bal", "TrophyGreywatcher_bal", "TrophyHaugbui_bal", "TrophySpectre_bal", "TrophyStormdrake_bal", "TrophyTrollAshlands_bal", "TrophyTrollSkeleton_bal", "TrophyStag_bal", "TrophyLeechPrimal_bal", "TrophyStagGhost_bal", "Larva_bal", "WaterJugEmpty_bal", "SwordFakeSilver_Bal", "MaceFakeSilver_bal" }; private readonly string[] arrowsNbolts = new string[10] { "BoltBlunt_bal", "BoltChitin_bal", "BoltFire_bal", "BoltSilver_bal", "BoltThunder_bal", "ArrowBlizzard_bal", "ArrowBlunt_bal", "ArrowBone_bal", "ArrowChitin_bal", "ArrowFlametal_bal" }; public void editBuidlPieces(List<GameObject> allPrefabs) { buildPieces = allPrefabs ?? new List<GameObject>(); items = allPrefabs ?? new List<GameObject>(); RebuildCaches(); editFermenter(); editOven(); editKiln(); editWHeel(); editSap(); editBeehive(); editSmelter(); editPress(); editComposter(); editFurnace(); editRefinery(); editCooking(); editIronCooking(); editIncinerator(); EditRecipes(); } private void RebuildCaches() { _buildPieceByName.Clear(); _itemByName.Clear(); _itemDropByName.Clear(); _missingItemWarned.Clear(); for (int i = 0; i < buildPieces.Count; i++) { GameObject val = buildPieces[i]; if (!((Object)(object)val == (Object)null)) { _buildPieceByName[((Object)val).name] = val; } } if (items == null || items.Count == 0) { if ((Object)(object)ZNetScene.instance != (Object)null && ZNetScene.instance.m_prefabs != null) { items = ZNetScene.instance.m_prefabs; } else { items = new List<GameObject>(); } } for (int j = 0; j < items.Count; j++) { GameObject val2 = items[j]; if (!((Object)(object)val2 == (Object)null)) { _itemByName[((Object)val2).name] = val2; ItemDrop component = val2.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { _itemDropByName[((Object)val2).name] = component; } } } } private void EditRecipes() { for (int i = 0; i < buildPieceNames.Length; i++) { GameObject val = FindBuildPiece(buildPieceNames[i]); if ((Object)(object)val != (Object)null) { ModifyBuildPiece(val); } } } private void ModifyBuildPiece(GameObject piece) { if ((Object)(object)piece == (Object)null) { return; } string name = ((Object)piece).name; switch (name) { case "forge": case "piece_workbench": case "blackforge": case "piece_magetable": case "piece_artisanstation": case "piece_stonecutter": SetCraftingStationRequiresRoof(piece, requireRoof: false); return; } if (name.StartsWith("piece_banner", StringComparison.Ordinal)) { SetBannerRecipe(piece); } } private void SetCraftingStationRequiresRoof(GameObject piece, bool requireRoof) { CraftingStation component = piece.GetComponent<CraftingStation>(); if ((Object)(object)component != (Object)null) { component.m_craftRequireRoof = requireRoof; } } private void SetBannerRecipe(GameObject piece) { Piece component = piece.GetComponent<Piece>(); if (!((Object)(object)component == (Object)null)) { component.m_resources = (Requirement[])(object)new Requirement[4] { CreateRequirement("DyeKit_bal", 1), CreateRequirement("FineWood", 2), CreateRequirement("LeatherScraps", 3), CreateRequirement("StrawThread_bal", 3) }; } } private Requirement CreateRequirement(string itemName, int amount) { //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_0013: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown return new Requirement { m_resItem = FindItemDrop(itemName), m_amount = amount, m_amountPerLevel = 0, m_recover = true }; } private Requirement createReq(string name, int amount, int amountPerLevel) { //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_000d: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown return new Requirement { m_recover = true, m_resItem = FindItemDrop(name), m_amount = amount, m_amountPerLevel = amountPerLevel }; } private GameObject FindBuildPiece(string name) { if (string.IsNullOrEmpty(name)) { return null; } GameObject value; return _buildPieceByName.TryGetValue(name, out value) ? value : null; } private GameObject FindItem(string name) { if (string.IsNullOrEmpty(name)) { return null; } if (_itemByName.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { return value; } if (_missingItemWarned.Add(name)) { Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood")); } _itemByName.TryGetValue("Wood", out value); return value; } private ItemDrop FindItemDrop(string name) { if (string.IsNullOrEmpty(name)) { return null; } if (_itemDropByName.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { return value; } GameObject val = FindItem(name); value = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); if ((Object)(object)value != (Object)null) { _itemDropByName[name] = value; } if ((Object)(object)value == (Object)null && name != "Wood") { return FindItemDrop("Wood"); } return value; } private void removeConversionFromSmelter(string fromItem, List<ItemConversion> list) { if (list == null || list.Count == 0 || string.IsNullOrEmpty(fromItem)) { return; } list.RemoveAll(delegate(ItemConversion x) { if (x == null) { return true; } ItemDrop from = x.m_from; if ((Object)(object)from == (Object)null) { return true; } ItemData itemData = from.m_itemData; if (itemData == null) { return true; } GameObject dropPrefab = itemData.m_dropPrefab; return (Object)(object)dropPrefab == (Object)null || ((Object)dropPrefab).name == fromItem; }); } public void editLeatherRack(BalrondConverter leatherRack = null) { if ((Object)(object)leatherRack == (Object)null) { GameObject val = FindBuildPiece("piece_leatherRack_bal"); if ((Object)(object)val == (Object)null) { return; } leatherRack = val.GetComponent<BalrondConverter>(); } if (!((Object)(object)leatherRack == (Object)null)) { if (leatherRack.m_conversion == null) { leatherRack.m_conversion = new List<BalrondConverter.ItemConversion>(); } else { leatherRack.m_conversion.Clear(); } addConversion(((Component)leatherRack).gameObject, "PatchworkDeer_bal", "DeerHide", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkBoar_bal", "BoarHide_bal", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkTroll_bal", "TrollHide", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkWolf_bal", "WolfPelt", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkLox_bal", "LoxPelt", ConversionType.balrondConverter, 30, 2); addConversion(((Component)leatherRack).gameObject, "PatchworkAsk_bal", "AskHide", ConversionType.balrondConverter, 30, 2); } } public void editRefinery(Smelter refinery = null) { if ((Object)(object)refinery == (Object)null) { GameObject val = FindBuildPiece("eitrrefinery"); if ((Object)(object)val == (Object)null) { return; } refinery = val.GetComponent<Smelter>(); } if (!((Object)(object)refinery == (Object)null)) { if (refinery.m_maxFuel == 20) { refinery.m_maxFuel = 60; } if (refinery.m_maxOre == 20) { refinery.m_maxOre = 60; } if (refinery.m_secPerProduct == 40f) { refinery.m_secPerProduct = 60f; } StringBuilder stringBuilder = new StringBuilder(128); stringBuilder.Append(addConversion(((Component)refinery).gameObject, "Oil_bal", "RefinedOil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)refinery).gameObject, "BlackTissue_bal", "CorruptedEitr_bal", ConversionType.smelter)); buildConversionStationTutorialTag(((Component)refinery).gameObject, stringBuilder.ToString()); } } public void editComposter(Smelter composter = null) { if ((Object)(object)composter == (Object)null) { GameObject val = FindBuildPiece("composter_bal"); if ((Object)(object)val == (Object)null) { return; } composter = val.GetComponent<Smelter>(); } if (!((Object)(object)composter == (Object)null)) { if (composter.m_conversion == null) { composter.m_conversion = new List<ItemConversion>(); } StringBuilder stringBuilder = new StringBuilder(1024); addConversion(((Component)composter).gameObject, "TrophyFox_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyHabrok_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyHabrokBirb_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyCrow_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGreywatcher_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySouling_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyCorpseCollector_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyForsaken_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGoat_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyHaugbui_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyNeckBrute_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyObsidianCrab_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySpectre_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyStormdrake_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyShark_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyAbomination", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyBlob", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyBoar", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyBonemass", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyCultist", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyDeathsquito", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyDeer", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyDragonQueen", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyDraugr", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyDraugrElite", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyDvergr", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyEikthyr", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyFenring", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyFrostTroll", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGjall", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGoblin", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGoblinBrute", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGoblinKing", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGoblinShaman", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGreydwarf", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGreydwarfBrute", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGreydwarfShaman", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGrowth", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyHare", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyHatchling", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyLeech", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyLox", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyNeck", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySeeker", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySeekerBrute", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySeekerQueen", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySerpent", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySGolem", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySkeleton", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySkeletonPoison", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySurtling", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyTheElder", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyTick", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyUlv", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyWolf", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObjec