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(); 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 _allowedMonsterCache; private void Awake() { CacheComponents(); BuildAllowedMonsterCache(); } private void CacheComponents() { if ((Object)(object)_door == (Object)null) { _door = ((Component)this).GetComponentInChildren(); } if ((Object)(object)_door == (Object)null) { _door = ((Component)this).GetComponent(); } if ((Object)(object)_door != (Object)null && (Object)(object)_doorView == (Object)null) { _doorView = ((Component)_door).GetComponent(); } if ((Object)(object)_door != (Object)null && (Object)(object)_piece == (Object)null) { _piece = ((Component)_door).GetComponent(); } if ((Object)(object)_piece == (Object)null) { _piece = ((Component)this).GetComponent(); } } private void BuildAllowedMonsterCache() { _allowedMonsterCache = new HashSet(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(); 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 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(); } if ((Object)(object)_piece == (Object)null) { _piece = ((Component)this).GetComponent(); } } if (!((Object)(object)_piece == (Object)null)) { ((StaticTarget)_piece).m_primaryTarget = true; ((StaticTarget)_piece).m_randomTarget = true; } } } public static class MonsterDoorSensorService { private static readonly List Rules = new List(); 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(); if (!((Object)(object)componentInChildren == (Object)null)) { MonsterDoorSensor monsterDoorSensor = prefab.GetComponent(); if ((Object)(object)monsterDoorSensor == (Object)null) { monsterDoorSensor = prefab.AddComponent(); } 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(); 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() == (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[1-8] \n" + m_useItemText) + " " + Localization.instance.Localize(((Component)m_requiredItem).GetComponent().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()); 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(m_aoePrefab, GetSpawnPosition(), Quaternion.identity).GetComponent(); component.m_statusEffect = m_statusEffectName; } if (m_spawnItem) { Object.Instantiate(((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 registrations = new List(); 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> translations = new Dictionary>(); public static Dictionary 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 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 CallGetAvailableEnvironments(EnvMan envMan, Biome biome) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) return (List)MI_EnvMan_GetAvailableEnvironments.Invoke(envMan, new object[1] { biome }); } private static EnvSetup CallSelectWeightedEnvironment(EnvMan envMan, List 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 ProcConfigs = new Dictionary { { (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 NextCheck = new Dictionary(); 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(); 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(); 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(); 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 buildPieces = new List(); private List items = new List(); private readonly Dictionary _buildPieceByName = new Dictionary(256); private readonly Dictionary _itemByName = new Dictionary(1024); private readonly Dictionary _itemDropByName = new Dictionary(1024); private readonly HashSet _missingItemWarned = new HashSet(); public static readonly List m_texts = new List(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 allPrefabs) { buildPieces = allPrefabs ?? new List(); items = allPrefabs ?? new List(); 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(); } } 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(); 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(); if ((Object)(object)component != (Object)null) { component.m_craftRequireRoof = requireRoof; } } private void SetBannerRecipe(GameObject piece) { Piece component = piece.GetComponent(); 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() : 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 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(); } if (!((Object)(object)leatherRack == (Object)null)) { if (leatherRack.m_conversion == null) { leatherRack.m_conversion = new List(); } 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(); } 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(); } if (!((Object)(object)composter == (Object)null)) { if (composter.m_conversion == null) { composter.m_conversion = new List(); } 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).gameObject, "TrophyWraith", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyTrollSkeleton_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyTrollAshlands_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyStag_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyLeechPrimal_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyStagGhost_bal", "EnrichedSoil_bal", ConversionType.smelter); stringBuilder.Append("\n $tag_rottenvegetable_bal_description"); stringBuilder.Append(addConversion(((Component)composter).gameObject, "RottenMeat", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "RottenVegetable_bal", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "Pukeberries", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "StrawBundle_bal", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "Cabbage_bal", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "Turnip", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "Carrot", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "Onion", "EnrichedSoil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)composter).gameObject, "Garlic_bal", "EnrichedSoil_bal", ConversionType.smelter)); buildConversionStationTutorialTag(((Component)composter).gameObject, stringBuilder.ToString()); } } public void editSmelter(Smelter smelter = null) { if ((Object)(object)smelter == (Object)null) { GameObject val = FindBuildPiece("smelter"); if ((Object)(object)val == (Object)null) { return; } smelter = val.GetComponent(); } if (!((Object)(object)smelter == (Object)null)) { if (smelter.m_maxFuel == 20) { smelter.m_maxFuel = 45; } if (smelter.m_maxOre == 10) { smelter.m_maxOre = 15; } if (smelter.m_secPerProduct == 30f) { smelter.m_secPerProduct = 40f; } if (smelter.m_fuelPerProduct == 2) { smelter.m_fuelPerProduct = 3; } if (smelter.m_conversion == null) { smelter.m_conversion = new List(); } removeConversionFromSmelter("IronScrap", smelter.m_conversion); removeConversionFromSmelter("CopperScrap", smelter.m_conversion); removeConversionFromSmelter("BronzeScrap", smelter.m_conversion); StringBuilder stringBuilder = new StringBuilder(256); stringBuilder.Append("\n Scrap does not go into Furnace/Smelter. Can be only converted on Forge/Ironworks/Artisan/Blackforge"); stringBuilder.Append(addConversion(((Component)smelter).gameObject, "SurtlingCoreCasing_bal", "SurtlingCore", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)smelter).gameObject, "CopperOre", "Copper", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)smelter).gameObject, "TinOre", "Tin", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)smelter).gameObject, "NickelOre_bal", "Nickel_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)smelter).gameObject, "IronOre", "Iron", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)smelter).gameObject, "SilverOre", "Silver", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)smelter).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter)); buildConversionStationTutorialTag(((Component)smelter).gameObject, stringBuilder.ToString(), "smelter"); } } public void editFurnace(Smelter furnace = null) { if ((Object)(object)furnace == (Object)null) { GameObject val = FindBuildPiece("blastfurnace"); if ((Object)(object)val == (Object)null) { return; } furnace = val.GetComponent(); } if (!((Object)(object)furnace == (Object)null)) { if (furnace.m_maxFuel == 20) { furnace.m_maxFuel = 60; } if (furnace.m_maxOre == 10) { furnace.m_maxOre = 30; } if (furnace.m_secPerProduct == 30f) { furnace.m_secPerProduct = 20f; } if (furnace.m_conversion == null) { furnace.m_conversion = new List(); } removeConversionFromSmelter("BlackMetalScrap", furnace.m_conversion); StringBuilder stringBuilder = new StringBuilder(512); stringBuilder.Append("\n Scrap does not go into Furnace/Smelter. Can be only converted on Forge/Ironworks/Artisan/Blackforge"); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "SurtlingCoreCasing_bal", "SurtlingCore", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "CopperOre", "Copper", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "TinOre", "Tin", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "NickelOre_bal", "Nickel_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "IronOre", "Iron", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "SilverOre", "Silver", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "BlackMetalOre_bal", "BlackMetal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "DarkIron_bal", "DarkSteel_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "CobaltOre_bal", "Cobalt_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "FlametalOre", "Flametal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)furnace).gameObject, "FlametalOreNew", "FlametalNew", ConversionType.smelter)); buildConversionStationTutorialTag(((Component)furnace).gameObject, stringBuilder.ToString(), "smelter"); } } public void editFermenter(Fermenter fermenter = null) { if ((Object)(object)fermenter == (Object)null) { GameObject val = FindBuildPiece("fermenter"); if ((Object)(object)val == (Object)null) { return; } fermenter = val.GetComponent(); } if (!((Object)(object)fermenter == (Object)null)) { fermenter.m_fermentationDuration = 2000f; StringBuilder stringBuilder = new StringBuilder(128); stringBuilder.Append(addConversion(((Component)fermenter).gameObject, "MeadBaseWhiteCheese_bal", "WhiteCheese_bal", ConversionType.fermenter, 2)); stringBuilder.Append(addConversion(((Component)fermenter).gameObject, "SurstrommingBase_bal", "Surstromming_bal", ConversionType.fermenter, 2)); buildConversionStationTutorialTag(((Component)fermenter).gameObject, stringBuilder.ToString()); } } public void editOven(CookingStation oven = null) { if ((Object)(object)oven == (Object)null) { GameObject val = FindBuildPiece("piece_oven"); if ((Object)(object)val == (Object)null) { return; } oven = val.GetComponent(); } if (!((Object)(object)oven == (Object)null)) { if (oven.m_conversion == null) { oven.m_conversion = new List(); } StringBuilder stringBuilder = new StringBuilder(128); stringBuilder.Append(addConversion(((Component)oven).gameObject, "FishWrapsUncooked_bal", "FishWraps", ConversionType.cooking, 50)); stringBuilder.Append(addConversion(((Component)oven).gameObject, "ApplePieUncooked_bal", "ApplePie_bal", ConversionType.cooking, 50)); stringBuilder.Append(addConversion(((Component)oven).gameObject, "BlueberryPieUncooked_bal", "BlueberryPie_bal", ConversionType.cooking, 50)); buildConversionStationTutorialTag(((Component)oven).gameObject, stringBuilder.ToString()); } } public void editCooking(CookingStation cookingStation = null) { if ((Object)(object)cookingStation == (Object)null) { GameObject val = FindBuildPiece("piece_cookingstation"); if ((Object)(object)val == (Object)null) { return; } cookingStation = val.GetComponent(); } if (!((Object)(object)cookingStation == (Object)null)) { StringBuilder stringBuilder = new StringBuilder(256); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 25)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 40)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking, 35)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60)); buildConversionStationTutorialTag(((Component)cookingStation).gameObject, stringBuilder.ToString()); } } public void editIronCooking(CookingStation cookingStation = null) { if ((Object)(object)cookingStation == (Object)null) { GameObject val = FindBuildPiece("piece_cookingstation_iron"); if ((Object)(object)val == (Object)null) { return; } cookingStation = val.GetComponent(); } if (!((Object)(object)cookingStation == (Object)null)) { StringBuilder stringBuilder = new StringBuilder(256); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking, 25)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "FenringMeat_bal", "FenringMeatCooked_bal", ConversionType.cooking, 60)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking, 20)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 20)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 35)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "DrakeMeat_bal", "DrakeMeatCooked_bal", ConversionType.cooking)); stringBuilder.Append(addConversion(((Component)cookingStation).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60)); buildConversionStationTutorialTag(((Component)cookingStation).gameObject, stringBuilder.ToString()); } } public void editWHeel(Smelter wheel = null) { if ((Object)(object)wheel == (Object)null) { GameObject val = FindBuildPiece("piece_spinningwheel"); if ((Object)(object)val == (Object)null) { return; } wheel = val.GetComponent(); } if (!((Object)(object)wheel == (Object)null)) { if (wheel.m_maxOre == 40) { wheel.m_maxOre = 80; } if (wheel.m_secPerProduct == 30f) { wheel.m_secPerProduct = 25f; } StringBuilder stringBuilder = new StringBuilder(128); stringBuilder.Append(addConversion(((Component)wheel).gameObject, "Straw_bal", "StrawThread_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)wheel).gameObject, "RawSilk_bal", "SilkReinforcedThread_bal", ConversionType.smelter)); buildConversionStationTutorialTag(((Component)wheel).gameObject, stringBuilder.ToString()); } } public void editSap(SapCollector sap = null) { if ((Object)(object)sap == (Object)null) { GameObject val = FindBuildPiece("piece_sapcollector"); if ((Object)(object)val == (Object)null) { return; } sap = val.GetComponent(); } if (!((Object)(object)sap == (Object)null)) { if (sap.m_secPerUnit == 60f) { sap.m_secPerUnit = 90f; } if (sap.m_maxLevel == 10) { sap.m_maxLevel = 30; } } } public void editKiln(Smelter kiln = null) { if ((Object)(object)kiln == (Object)null) { GameObject val = FindBuildPiece("charcoal_kiln"); if ((Object)(object)val == (Object)null) { return; } kiln = val.GetComponent(); } if (!((Object)(object)kiln == (Object)null)) { if (kiln.m_maxOre == 25) { kiln.m_maxOre = 50; } if (kiln.m_secPerProduct == 15f) { kiln.m_secPerProduct = 10f; } kiln.m_addOreTooltip = "$piece_smelter_add"; StringBuilder stringBuilder = new StringBuilder(256); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "TarBase_bal", "Tar", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "Moss_bal", "CoalPowder_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "ElderBark", "CoalPowder_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "YewBark_bal", "CoalPowder_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "WillowBark_bal", "CoalPowder_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "HardWood_bal", "Coal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "YggdrasilWood", "Coal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "Blackwood", "Coal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "ClayBrickMold_bal", "ClayBrick_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)kiln).gameObject, "CeramicMold_bal", "CeramicPlate", ConversionType.smelter)); buildConversionStationTutorialTag(((Component)kiln).gameObject, stringBuilder.ToString()); } } public void editPress(Smelter press = null) { if ((Object)(object)press == (Object)null) { GameObject val = FindBuildPiece("oilpress_bal"); if ((Object)(object)val == (Object)null) { return; } press = val.GetComponent(); } if (!((Object)(object)press == (Object)null)) { StringBuilder stringBuilder = new StringBuilder(256); stringBuilder.Append(addConversion(((Component)press).gameObject, "OilBase_bal", "Oil_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)press).gameObject, "BlackBerryJuiceBase_bal", "BlackBerryJuice_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)press).gameObject, "FruitPunchBase_bal", "FruitPunch_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)press).gameObject, "VineBerryJuiceBase_bal", "VineBerryJuice_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)press).gameObject, "MagmaCoctailBase_bal", "MagmaCoctail_bal", ConversionType.smelter)); stringBuilder.Append(addConversion(((Component)press).gameObject, "PaintBucket_bal", "DyeKit_bal", ConversionType.smelter)); buildConversionStationTutorialTag(((Component)press).gameObject, stringBuilder.ToString()); } } private void editBeehive() { GameObject val = FindBuildPiece("piece_beehive"); if (!((Object)(object)val == (Object)null)) { Beehive component = val.GetComponent(); if (!((Object)(object)component == (Object)null)) { component.m_maxHoney = 20; } } } private void editIncinerator(Incinerator incinerator = null) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Expected O, but got Unknown //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown if ((Object)(object)incinerator == (Object)null) { GameObject val = FindBuildPiece("incinerator"); if ((Object)(object)val == (Object)null) { return; } incinerator = val.GetComponent(); } if (!((Object)(object)incinerator == (Object)null)) { if (incinerator.m_conversions == null) { incinerator.m_conversions = new List(); } IncineratorConversion val2 = new IncineratorConversion { m_requireOnlyOneIngredient = true, m_priority = 2, m_requirements = new List(convertToBits.Length), m_result = FindItemDrop("CoalPowder_bal") }; for (int i = 0; i < convertToBits.Length; i++) { val2.m_requirements.Add(new Requirement { m_amount = 1, m_resItem = FindItemDrop(convertToBits[i]) }); } incinerator.m_conversions.Add(val2); IncineratorConversion val3 = new IncineratorConversion { m_requireOnlyOneIngredient = true, m_requirements = new List(convertToCoal.Length), m_result = FindItemDrop("Coal") }; for (int j = 0; j < convertToCoal.Length; j++) { val3.m_requirements.Add(new Requirement { m_amount = 1, m_resItem = FindItemDrop(convertToCoal[j]) }); } incinerator.m_conversions.Add(val3); IncineratorConversion val4 = new IncineratorConversion { m_requireOnlyOneIngredient = true, m_priority = 1, m_requirements = new List(arrowsNbolts.Length), m_result = FindItemDrop("Coal") }; for (int k = 0; k < arrowsNbolts.Length; k++) { val4.m_requirements.Add(new Requirement { m_amount = 20, m_resItem = FindItemDrop(arrowsNbolts[k]) }); } incinerator.m_conversions.Add(val4); } } private string addConversion(GameObject source, string nameIn, string nameOut, ConversionType type, int time = 30, int amount = 5) { if ((Object)(object)source == (Object)null) { return ""; } return type switch { ConversionType.smelter => SmelterConversion(source, nameIn, nameOut), ConversionType.fermenter => FermenterConversion(source, nameIn, nameOut, amount), ConversionType.cooking => CookingConversion(source, nameIn, nameOut, time), ConversionType.balrondConverter => BalrondConversion(source, nameIn, nameOut, amount), _ => "", }; } private void buildConversionStationTutorialTag(GameObject gameObject, string tutorialExtra, string tag = "workbench") { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0075: 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_008e: Expected O, but got Unknown if (!((Object)(object)gameObject == (Object)null)) { TutorialText item = new TutorialText { m_name = "BAN conversions:" + ((Object)gameObject).name, m_globalKeyTrigger = "AmazingNature" + ((Object)gameObject).name, m_tutorialTrigger = tag, m_topic = "BAN-" + ((Object)gameObject).name, m_label = "BAN-" + ((Object)gameObject).name, m_isMunin = true, m_text = "\n BALROND AMAZING NATURE: " + tutorialExtra }; m_texts.Add(item); } } private string createConversionSingleLine(ItemDrop m_from, ItemDrop m_to, int time = 0, int amount = 0) { if ((Object)(object)m_from == (Object)null || (Object)(object)m_to == (Object)null) { return ""; } string name = m_from.m_itemData.m_shared.m_name; string name2 = m_to.m_itemData.m_shared.m_name; if (time > 0 && amount == 0) { return "\n $tag_convers_bal " + name + " $tag_to_bal " + name2 + " $tag_in_bal " + time + " $tag_seconds_bal"; } if (time == 0 && amount > 0) { return "\n $tag_convers_bal " + name + " $tag_to_bal " + amount + " " + name2; } if (time > 0 && amount > 0) { return "\n $tag_convers_bal " + name + " $tag_to_bal " + amount + " " + name2 + " $tag_in_bal " + time + " $tag_seconds_bal"; } return "\n $tag_convers_bal " + name + " $tag_to_bal " + name2; } private bool HasFromPrefabName(List list, string nameIn, Func fromSelector) where T : class { if (list == null || list.Count == 0) { return false; } for (int i = 0; i < list.Count; i++) { T val = list[i]; if (val == null) { continue; } ItemDrop val2 = fromSelector(val); if ((Object)(object)val2 == (Object)null) { continue; } ItemData itemData = val2.m_itemData; if (itemData != null) { GameObject dropPrefab = itemData.m_dropPrefab; if (!((Object)(object)dropPrefab == (Object)null) && ((Object)dropPrefab).name == nameIn) { return true; } } } return false; } private string BalrondConversion(GameObject source, string nameIn, string nameOut, int amount = 1, List list = null) { BalrondConverter component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } if (HasFromPrefabName(component.m_conversion, nameIn, (BalrondConverter.ItemConversion x) => x.m_from)) { return ""; } ItemDrop from = FindItemDrop(nameIn); ItemDrop to = FindItemDrop(nameOut); BalrondConverter.ItemConversion item = new BalrondConverter.ItemConversion { m_from = from, m_to = to, m_count = amount }; component.m_conversion.Add(item); return createConversionSingleLine(from, to, 0, amount); } private string SmelterConversion(GameObject source, string nameIn, string nameOut) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown Smelter component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } if (HasFromPrefabName(component.m_conversion, nameIn, (ItemConversion x) => x.m_from)) { return ""; } ItemDrop from = FindItemDrop(nameIn); ItemDrop to = FindItemDrop(nameOut); component.m_conversion.Add(new ItemConversion { m_from = from, m_to = to }); return createConversionSingleLine(from, to); } private string FermenterConversion(GameObject source, string nameIn, string nameOut, int amount = 1) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown Fermenter component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } if (HasFromPrefabName(component.m_conversion, nameIn, (ItemConversion x) => x.m_from)) { return ""; } ItemDrop from = FindItemDrop(nameIn); ItemDrop to = FindItemDrop(nameOut); component.m_conversion.Add(new ItemConversion { m_from = from, m_to = to, m_producedItems = amount }); return createConversionSingleLine(from, to, 0, amount); } private string CookingConversion(GameObject source, string nameIn, string nameOut, int time = 25) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown CookingStation component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } if (HasFromPrefabName(component.m_conversion, nameIn, (ItemConversion x) => x.m_from)) { return ""; } ItemDrop from = FindItemDrop(nameIn); ItemDrop to = FindItemDrop(nameOut); component.m_conversion.Add(new ItemConversion { m_from = from, m_to = to, m_cookTime = time }); return createConversionSingleLine(from, to, time); } } public static class BoonManager { public static readonly List boons = new List(); private static Dictionary _itemCache = new Dictionary(); private const string BoonDataKey = "BalrondAnimalBoon"; public static void setup() { boons.Clear(); createboons(); } public static StatusEffect getStatusForBoon(string boonName) { return FindBoon(boonName)?.status; } public static string getMsgForBoon(string boonName) { BoonObject boonObject = FindBoon(boonName); return (boonObject != null) ? boonObject.msg : "Behold the Power"; } public static EffectList getVfxForBoon(string boonName) { return FindBoon(boonName)?.boonEffects; } public static GameObject getBoonItem(string boonName) { return FindBoon(boonName)?.item; } public static void SetBoon(string boonName) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null)) { RemoveBoon(localPlayer.m_customData["BalrondAnimalBoon"]); localPlayer.m_customData["BalrondAnimalBoon"] = boonName; Loadboonstatus(); } } public static void Loadboonstatus() { Player localPlayer = Player.m_localPlayer; if (HasBoon(localPlayer)) { string boonName = localPlayer.m_customData["BalrondAnimalBoon"]; StatusEffect statusForBoon = getStatusForBoon(boonName); if ((Object)(object)statusForBoon != (Object)null && (Object)(object)((Character)localPlayer).GetSEMan().GetStatusEffect(((object)statusForBoon).GetHashCode()) == (Object)null) { ((Character)localPlayer).GetSEMan().AddStatusEffect(statusForBoon, false, 0, 0f); } } } public static bool HasBoon(Player player) { if ((Object)(object)player == (Object)null || !player.m_customData.ContainsKey("BalrondAnimalBoon")) { Debug.Log((object)"Player has no boon assigned"); return false; } return true; } public static void RemoveBoon(string boonName) { Player localPlayer = Player.m_localPlayer; if (HasBoon(localPlayer)) { ((Character)localPlayer).GetSEMan().RemoveStatusEffect(boonName.GetHashCode(), false); } } private static void createboons() { AddBoon("Serpent", "TrophySerpent", "BuffSerpent_bal", "sfx_serpentBoonCall_bal", "$tag_clanserpent_bal_status"); AddBoon("Drake", "TrophyHatchling", "BuffDrake_bal", "sfx_drakeBoonCall_bal", "$tag_clandrake_bal_status"); AddBoon("Stag", "TrophyDeer", "BuffDeer_bal", "sfx_deerBoonCall_bal", "$tag_clandeer_bal_status"); AddBoon("Wolf", "TrophyWolf", "BuffWolf_bal", "sfx_wolfBoonCall_bal", "$tag_clanwolf_bal_status"); AddBoon("Lox", "TrophyLox", "BuffLox_bal", "sfx_loxBoonCall_bal", "$tag_clanlox_bal_status"); AddBoon("Leech", "TrophyLeech", "BuffLeech_bal", "sfx_leechBoonCall_bal", "$tag_clanleech_bal_status"); AddBoon("Crow", "TrophyCrow_bal", "BuffCrow_bal", "sfx_crowBoonCall_bal", "$tag_clancrow_bal_status"); AddBoon("Fox", "TrophyFox_bal", "BuffFox_bal", "sfx_foxBoonCall_bal", "$tag_clanfox_bal_status"); AddBoon("Bear", "TrophyBear_bal", "BuffBear_bal", "sfx_bearBoonCall_bal", "$tag_clanbear_bal_status"); AddBoon("Boar", "TrophyBoar", "BuffBoar_bal", "sfx_boarBoonCall_bal", "$tag_clanboar_bal_status"); } private static void AddBoon(string name, string itemName, string statusname, string effectName = "", string message = "Blessed by the Gods") { GameObject sfx = Launch.modResourceLoader.vfxPrefabs.Find((GameObject x) => ((Object)x).name == effectName); BoonObject item = new BoonObject { boonName = name, item = FindItem(itemName), status = FindStatus(statusname), sfx = sfx, msg = message }; boons.Add(item); } private static StatusEffect FindStatus(string name) { StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(name.GetHashCode()); if ((Object)(object)statusEffect == (Object)null) { Debug.LogWarning((object)("FindStatus: \"" + name + "\" not found, using fallback \"Wet\"")); statusEffect = ObjectDB.instance.GetStatusEffect("Wet".GetHashCode()); } return statusEffect; } private static GameObject FindItem(string name) { if (_itemCache.TryGetValue(name, out var value)) { return value; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name); if ((Object)(object)itemPrefab == (Object)null) { Debug.LogWarning((object)("FindItem: \"" + name + "\" not found, using fallback \"Wood\"")); itemPrefab = ObjectDB.instance.GetItemPrefab("Wood"); } if ((Object)(object)itemPrefab != (Object)null) { _itemCache[name] = itemPrefab; } return itemPrefab; } private static BoonObject FindBoon(string name) { return boons.Find((BoonObject x) => x.boonName == name); } private static EffectList createEffectListFromObject(GameObject gameObject) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown EffectList val = new EffectList(); List list = new List { new EffectData { m_prefab = gameObject } }; val.m_effectPrefabs = list.ToArray(); return val; } } public class BoonObject { public string boonName; public string msg; public StatusEffect status; public GameObject item; public GameObject sfx; public EffectList boonEffects = new EffectList(); } public class BoonTotem : MonoBehaviour, Interactable, Hoverable { private ZNetView m_nview; private string chosenBoon = string.Empty; private string m_name = "$tag_boon_totem_bal"; public MeshRenderer m_mesh; public Transform m_transformAttach; public int m_emissiveMaterialIndex; public Color m_activeEmissiveColor = Color.white; private bool m_active; public string m_completedMessage = ""; public List m_supportedTypes = new List(); public GameObject m_activeEffect; public EffectList m_activateStep1 = new EffectList(); public EffectList m_activateStep2 = new EffectList(); public EffectList m_activateStep3 = new EffectList(); private void Awake() { m_nview = ((Component)this).GetComponent(); if (!((Object)(object)m_nview == (Object)null) && m_nview.IsValid()) { WearNTear component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } m_supportedTypes.Clear(); m_supportedTypes.Add((ItemType)13); m_nview.Register("UseBuffTotem", (Action)UseBuffTotem); chosenBoon = m_nview.m_zdo.GetString("Boon", ""); SetVisuals(chosenBoon); } } private void OnDestroyed() { if (m_nview.IsOwner()) { } } private void Start() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (((Renderer)m_mesh).materials[m_emissiveMaterialIndex].HasProperty("_EmissionColor")) { ((Renderer)m_mesh).materials[m_emissiveMaterialIndex].SetColor("_EmissionColor", Color.black); } if (Object.op_Implicit((Object)(object)m_activeEffect)) { m_activeEffect.SetActive(false); } SetActivated(!string.IsNullOrEmpty(chosenBoon), triggerEffect: false); ((MonoBehaviour)this).InvokeRepeating("UpdateVisual", 1f, 2f); } private void SetActivated(bool active, bool triggerEffect) { if (active == m_active) { return; } m_active = active; if (triggerEffect && active) { ((MonoBehaviour)this).Invoke("DelayedAttachEffects_Step1", 1f); ((MonoBehaviour)this).Invoke("DelayedAttachEffects_Step2", 5f); ((MonoBehaviour)this).Invoke("DelayedAttachEffects_Step3", 11f); return; } if (Object.op_Implicit((Object)(object)m_activeEffect)) { m_activeEffect.SetActive(active); } ((MonoBehaviour)this).StopCoroutine("FadeEmission"); ((MonoBehaviour)this).StartCoroutine("FadeEmission"); } private void DelayedAttachEffects_Step1() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) m_activateStep1.Create(m_transformAttach.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } private void DelayedAttachEffects_Step2() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) m_activateStep2.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } private void DelayedAttachEffects_Step3() { //IL_0029: 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_0064: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)m_activeEffect)) { m_activeEffect.SetActive(true); } m_activateStep3.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); ((MonoBehaviour)this).StopCoroutine("FadeEmission"); ((MonoBehaviour)this).StartCoroutine("FadeEmission"); Player.MessageAllInRange(((Component)this).transform.position, 20f, (MessageType)2, m_completedMessage, (Sprite)null); } private IEnumerator FadeEmission() { if (Object.op_Implicit((Object)(object)m_mesh) && ((Renderer)m_mesh).materials[m_emissiveMaterialIndex].HasProperty("_EmissionColor")) { Color startColor = ((Renderer)m_mesh).materials[m_emissiveMaterialIndex].GetColor("_EmissionColor"); Color targetColor = (m_active ? m_activeEmissiveColor : Color.black); for (float t = 0f; (double)t < 1.0; t += Time.deltaTime) { ((Renderer)m_mesh).materials[m_emissiveMaterialIndex].SetColor("_EmissionColor", Color.Lerp(startColor, targetColor, t / 1f)); yield return null; } } ZLog.Log((object)"Done fading color"); } public bool IsActivated() { return m_active; } private void UseBuffTotem(long sender, string boonName) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!m_nview.IsOwner()) { SetVisuals(boonName); return; } Debug.Log((object)("Chosen boon: " + boonName)); chosenBoon = boonName; m_nview.m_zdo.Set("Boon", boonName); EffectList vfxForBoon = BoonManager.getVfxForBoon(boonName); if (vfxForBoon != null) { vfxForBoon.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } SetVisuals(boonName); } private void SetVisuals(string boon) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown if (string.IsNullOrEmpty(boon)) { return; } Transform val = ((Component)this).transform.Find("Items"); if ((Object)(object)val == (Object)null) { return; } foreach (Transform item in val) { Transform val2 = item; ((Component)val2).gameObject.SetActive(false); } Transform val3 = val.Find(boon); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(true); } } public bool Interact(Humanoid user, bool hold, bool alt) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(chosenBoon)) { chosenBoon = m_nview.m_zdo.GetString("Boon", ""); } if (!string.IsNullOrEmpty(chosenBoon)) { if (!m_nview.IsOwner()) { m_nview.InvokeRPC("RequestOwn", Array.Empty()); } string msgForBoon = BoonManager.getMsgForBoon(chosenBoon); MessageHud.instance.ShowMessage((MessageType)2, Localization.instance.Localize(msgForBoon), 0, (Sprite)null, false); BoonManager.SetBoon(chosenBoon); EffectList vfxForBoon = BoonManager.getVfxForBoon(chosenBoon); if (vfxForBoon != null) { vfxForBoon.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } return true; } MessageHud.instance.ShowMessage((MessageType)2, Localization.instance.Localize("$tag_totemnodiety_bal"), 0, (Sprite)null, false); return false; } private void RPC_RequestOwn(long sender) { if (m_nview.IsOwner()) { m_nview.GetZDO().SetOwner(sender); } } public bool UseItem(Humanoid user, ItemData item) { if (string.IsNullOrEmpty(chosenBoon)) { chosenBoon = m_nview.m_zdo.GetString("Boon", ""); } if (!string.IsNullOrEmpty(chosenBoon)) { return false; } if (!Player.m_debugMode && !Terminal.m_cheat) { return false; } if (!m_nview.IsOwner()) { m_nview.InvokeRPC("RequestOwn", Array.Empty()); } foreach (BoonObject boon in BoonManager.boons) { if (boon == null || (Object)(object)boon.item == (Object)null || item == null || (Object)(object)item.m_dropPrefab == (Object)null || !(((Object)boon.item).name == ((Object)item.m_dropPrefab).name)) { continue; } Debug.Log((object)("Found Boon: " + boon.boonName)); m_nview.InvokeRPC(ZNetView.Everybody, "UseBuffTotem", new object[1] { boon.boonName }); user.m_inventory.RemoveOneItem(item); return true; } return false; } public string GetHoverText() { string text = ((!string.IsNullOrEmpty(m_nview.m_zdo.GetString("Boon", ""))) ? "\n[$KEY_Use] $tag_usetotem_bal" : string.Empty); return Localization.instance.Localize("[1-8] $tag_setboon_bal") + text; } public string GetHoverName() { return Localization.instance.Localize(m_name + " [" + chosenBoon + "]"); } } internal class ClutterList { public static string[] clutter = new string[104] { "RedSeaweed1", "RedSeaweed2", "RedSeaweed3", "redGrass_bal", "small_rock1_deepnorth_bal", "small_rock2_deepnorth_bal", "small_rock1_bal", "small_rock2_bal", "ormbunke_bal", "magicGrass1", "magicGrass2", "DesertPlant6_1", "DesertPlant6_2", "DesertPlant6_3", "StalagmiteFloor_1", "StalagmiteFloor_2", "StalagmiteFloor_3", "StalagmiteFloor_4", "Mushroom_52", "Mushroom_51", "iceweed1", "iceweed2", "iceweed3", "iceweed4", "Mushroom_6G3", "Mushroom_6G2", "Mushroom_3G1", "Mushroom_3G2", "Mushroom_3G3", "Mushroom_31", "Mushroom_32", "Mushroom_33", "Mushroom_34", "Mushroom_35", "IvyLowerF1", "IvyLowerF2", "IvyLowerF3", "mistlandsBush6", "PlantG6", "PlantG7", "PlantG8", "seaBush10", "seaBush11", "seaBush6", "seaBush8", "seaBush9", "Seaweed2_1", "Seaweed2_2", "Seaweed2_3", "AshGrass1", "AshGrass2", "AshGrass3", "DeepNorthGrass", "DesertPlantsGrassCurl_1", "DesertPlantsGrassCurl_2", "DesertPlantsGrassCurl_3", "Coral1_Bowl_1", "Coral1_Bowl_2", "CoralTussocks1_1", "CoralTussocks1_2", "CoralTussocks1_G1", "SeaweedAshlands1", "SeaweedAshlands2", "SeaweedAshlands3", "Tentacles1", "Tentacles2", "Tentacles3", "plant_dn1", "plant_dn2", "plant_dn3", "plant_dn4", "plant_dn5", "plant_dn6", "Coral4_G1", "Coral4_G2", "Coral_dn1", "Coral_dn2", "Coral_dn3", "Coral_dn4", "PlantG17_1", "PlantG17_1_F", "PlantG17_2", "PlantG17_2_F", "PlantG_19", "PlantGS4_1", "PlantFlowerF7_1", "PlantFlowerF7_2", "PlantFlowerF7_3", "PlantFlowerS8_1", "PlantFlower2_1", "PlantFlower2_2", "PlantFlower2_3", "Swampy1", "Swampy2", "Swampy3", "Swampy4", "Swampy5", "Swampy6", "Swampy7", "Swampy8", "Swampy9", "Swampy10", "Swampy11", "Swampy12" }; } public class ConversionChanges { private enum ConversionType { smelter, fermenter, cooking, balrondConverter } private List buildPieces = new List(); private List items = new List(); public static List m_texts = new List(); public static List sawmillConverions = new List(); public static List stonekilnConverions = new List(); public static List tanneryConverions = new List(); public static List kilnConverions = new List(); public static List smelterConverions = new List(); public static List furnaceConverions = new List(); 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 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 string[] convertToCoal = new string[194] { "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", "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", "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 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 allPrefabs) { buildPieces = allPrefabs; items = allPrefabs; editFermenter(); editOven(); editKiln(); editStoneboundKiln(); editWHeel(); editSap(); editBeehive(); editSmelter(); editPress(); editComposter(); editFurnace(); editRefinery(); editCooking(); editIronCooking(); editSawMill(); editLeatherRack(); editIncinerator(); EditRecipes(); } private void EditRecipes() { string[] array = buildPieceNames; foreach (string name in array) { GameObject val = FindBuildPiece(name); if ((Object)(object)val != (Object)null) { ModifyBuildPiece(val); } } } private void ModifyBuildPiece(GameObject piece) { string name = ((Object)piece).name; string text = name; switch (text) { case "forge": case "piece_workbench": case "blackforge": case "piece_magetable": case "piece_artisanstation": case "piece_stonecutter": SetCraftingStationRequiresRoof(piece, requireRoof: false); return; } if (text.StartsWith("piece_banner")) { SetBannerRecipe(piece); } } private void SetCraftingStationRequiresRoof(GameObject piece, bool requireRoof) { CraftingStation component = piece.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_craftRequireRoof = requireRoof; } } private void SetBannerRecipe(GameObject piece) { Piece component = piece.GetComponent(); 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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown return new Requirement { m_resItem = FindItem(itemName).GetComponent(), m_amount = amount, m_amountPerLevel = 0, m_recover = true }; } private GameObject FindBuildPiece(string name) { return ((IEnumerable)buildPieces).FirstOrDefault((Func)((GameObject x) => ((Object)x).name == name)); } private GameObject FindItem(string name) { if (items == null) { items = ZNetScene.instance.m_prefabs; } GameObject val = items.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood")); return items.Find((GameObject x) => ((Object)x).name == "Wood"); } private void removeConversionFromSmelter(string fromItem, List list) { if (list != null && list.Count != 0) { list.RemoveAll((ItemConversion x) => x == null || (Object)(object)x.m_from == (Object)null || x.m_from.m_itemData == null || (Object)(object)x.m_from.m_itemData.m_dropPrefab == (Object)null || ((Object)x.m_from.m_itemData.m_dropPrefab).name == fromItem); } } private Requirement createReq(string name, int amount, int amountPerLevel) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Requirement val = new Requirement(); val.m_recover = true; ItemDrop component = FindItem(name).GetComponent(); val.m_resItem = component; val.m_amount = amount; val.m_amountPerLevel = amountPerLevel; return val; } public void editLeatherRack(BalrondConverter leatherRack = null) { if (buildPieces != null && (Object)(object)leatherRack == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_leatherRack_bal"); leatherRack = val.GetComponent(); } if (tanneryConverions.Count > 0) { leatherRack.m_conversion = tanneryConverions; return; } leatherRack.m_conversion = new List(); addConversion(((Component)leatherRack).gameObject, "NeckSkin_bal", "NeckSkin_bal", ConversionType.balrondConverter, 0, 2); addConversion(((Component)leatherRack).gameObject, "DeerHide", "DeerHide", ConversionType.balrondConverter, 0, 2, 2); addConversion(((Component)leatherRack).gameObject, "BoarHide_bal", "BoarHide_bal", ConversionType.balrondConverter, 0, 2, 2); addConversion(((Component)leatherRack).gameObject, "BjornHide", "BjornHide", ConversionType.balrondConverter, 0, 2, 3); addConversion(((Component)leatherRack).gameObject, "TrollHide", "TrollHide", ConversionType.balrondConverter, 0, 2, 3); addConversion(((Component)leatherRack).gameObject, "DrakeSkin_bal", "DrakeSkin_bal", ConversionType.balrondConverter, 0, 2, 4); addConversion(((Component)leatherRack).gameObject, "WolfPelt", "WolfPelt", ConversionType.balrondConverter, 0, 2, 4); addConversion(((Component)leatherRack).gameObject, "LoxPelt", "LoxPelt", ConversionType.balrondConverter, 0, 2, 5); addConversion(((Component)leatherRack).gameObject, "AskHide", "AskHide", ConversionType.balrondConverter, 0, 2, 5); } public void editRefinery(Smelter refinery = null) { string text = ""; if (buildPieces != null && (Object)(object)refinery == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "eitrrefinery"); refinery = val.GetComponent(); } 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; } text += addConversion(((Component)refinery).gameObject, "Oil_bal", "RefinedOil_bal", ConversionType.smelter); text += addConversion(((Component)refinery).gameObject, "BlackTissue_bal", "CorruptedEitr_bal", ConversionType.smelter); buildConversionStationTutorialTag(((Component)refinery).gameObject, text); } public void editComposter(Smelter composter = null) { string text = ""; if (buildPieces != null && (Object)(object)composter == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "composter_bal"); composter = val.GetComponent(); } if (composter.m_conversion == null) { composter.m_conversion = new List(); } 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, "TrophyBjorn", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyBjornUndead", "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).gameObject, "TrophyWraith", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyTrollSkeleton_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyTrollAshlands_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyStag_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyBattleHog_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyBear_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyForestTroll_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyPolarBear_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyLeechPrimal_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyStagGhost_bal", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyBonemawSerpent", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyCharredArcher", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyCharredMage", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyCharredMelee", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyCultist_Hildir", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyDraugrFem", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyFader", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyFallenValkyrie", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGhost", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGoblinBruteBrosBrute", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyGoblinBruteBrosShaman", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyKvastur", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyMorgen", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophySkeletonHildir", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyVolture", "EnrichedSoil_bal", ConversionType.smelter); addConversion(((Component)composter).gameObject, "TrophyAsksvin", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "RottenMeat", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "RottenVegetable_bal", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "Pukeberries", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "StrawBundle_bal", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "Cabbage_bal", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "Turnip", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "Carrot", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "Onion", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "Garlic_bal", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "BirdFeed_bal", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "Apple_bal", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "PoisonApple_bal", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "BoneFragments", "EnrichedSoil_bal", ConversionType.smelter); text += addConversion(((Component)composter).gameObject, "FishRaw", "EnrichedSoil_bal", ConversionType.smelter); buildConversionStationTutorialTag(((Component)composter).gameObject, text); } public void editSmelter(Smelter smelter = null) { string text = ""; if (buildPieces != null && (Object)(object)smelter == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "smelter"); smelter = val.GetComponent(); } if (smelter.m_maxFuel == 20) { smelter.m_maxFuel = 45; } if (smelter.m_maxOre == 10) { smelter.m_maxOre = 15; } if (smelter.m_secPerProduct == 30f) { smelter.m_secPerProduct = 40f; } if (smelter.m_fuelPerProduct == 2) { smelter.m_fuelPerProduct = 3; } if (smelterConverions.Count > 0) { smelter.m_conversion = smelterConverions; return; } if (smelter.m_conversion == null) { smelter.m_conversion = new List(); } removeConversionFromSmelter("IronScrap", smelter.m_conversion); removeConversionFromSmelter("CopperScrap", smelter.m_conversion); removeConversionFromSmelter("BronzeScrap", smelter.m_conversion); text += "\n Scrap does not go into Furnace/Smelter. Can be only converted in Smeltworks station"; text += addConversion(((Component)smelter).gameObject, "SurtlingCoreCasing_bal", "SurtlingCore", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "ZincOre_bal", "Zinc_bal", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "CopperOre", "Copper", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "LeadOre_bal", "Lead_bal", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "TinOre", "Tin", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "NickelOre_bal", "Nickel_bal", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "IronOre", "Iron", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "SilverOre", "Silver", ConversionType.smelter); text += addConversion(((Component)smelter).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter); buildConversionStationTutorialTag(((Component)smelter).gameObject, text, "smelter"); smelterConverions = smelter.m_conversion; } public void editFurnace(Smelter furnace = null) { string text = ""; if (buildPieces != null && (Object)(object)furnace == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "blastfurnace"); furnace = val.GetComponent(); } if (furnace.m_maxFuel == 20) { furnace.m_maxFuel = 60; } if (furnace.m_maxOre == 10) { furnace.m_maxOre = 30; } if (furnace.m_secPerProduct == 30f) { furnace.m_secPerProduct = 20f; } if (furnaceConverions.Count > 0) { furnace.m_conversion = furnaceConverions; return; } if (furnace.m_conversion == null) { furnace.m_conversion = new List(); } removeConversionFromSmelter("BlackMetalScrap", furnace.m_conversion); text += "\n Scrap does not go into Furnace/Smelter. Can be only converted in Smeltworks station"; text += addConversion(((Component)furnace).gameObject, "SurtlingCoreCasing_bal", "SurtlingCore", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "CopperOre", "Copper", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "ZincOre_bal", "Zinc_bal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "LeadOre_bal", "Lead_bal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "TinOre", "Tin", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "NickelOre_bal", "Nickel_bal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "IronOre", "Iron", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "SilverOre", "Silver", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "GoldOre_bal", "GoldBar_bal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "BlackMetalOre_bal", "BlackMetal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "DarkIron_bal", "Ferroboron_bal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "CobaltOre_bal", "Cobalt_bal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "FlametalOre", "Flametal", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "FlametalOreNew", "FlametalNew", ConversionType.smelter); text += addConversion(((Component)furnace).gameObject, "VanadiumOre_bal", "Vanadium_bal", ConversionType.smelter); buildConversionStationTutorialTag(((Component)furnace).gameObject, text, "smelter"); furnaceConverions = furnace.m_conversion; } public void editSawMill(BalrondConverter sawmill = null) { string text = ""; if (buildPieces != null && (Object)(object)sawmill == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_sawmill_bal"); sawmill = val.GetComponent(); } if (sawmillConverions.Count > 0) { sawmill.m_conversion = sawmillConverions; return; } sawmill.m_conversion.Clear(); sawmill.m_conversion = new List(); text += addConversion(((Component)sawmill).gameObject, "RoundLog", "Wood", ConversionType.balrondConverter, 0, 3); text += addConversion(((Component)sawmill).gameObject, "FineWood", "Wood", ConversionType.balrondConverter, 0, 4); text += addConversion(((Component)sawmill).gameObject, "ElderBark", "Wood", ConversionType.balrondConverter, 0, 2); text += addConversion(((Component)sawmill).gameObject, "YewBark_bal", "Wood", ConversionType.balrondConverter, 0, 2); text += addConversion(((Component)sawmill).gameObject, "WillowBark_bal", "Wood", ConversionType.balrondConverter, 0, 2); text += addConversion(((Component)sawmill).gameObject, "HardWood_bal", "FineWood", ConversionType.balrondConverter, 0, 3, 2); text += addConversion(((Component)sawmill).gameObject, "YggdrasilWood", "FineWood", ConversionType.balrondConverter, 0, 3); text += addConversion(((Component)sawmill).gameObject, "Blackwood", "FineWood", ConversionType.balrondConverter, 0, 4, 2); text += addConversion(((Component)sawmill).gameObject, "EmberWood_bal", "FineWood", ConversionType.balrondConverter, 0, 2, 2); text += addConversion(((Component)sawmill).gameObject, "CrystalWood_bal", "HardWood_bal", ConversionType.balrondConverter, 0, 2, 3); buildConversionStationTutorialTag(((Component)sawmill).gameObject, text); sawmillConverions = sawmill.m_conversion; } public void editStoneboundKiln(BalrondConverter kiln = null) { string text = ""; if (buildPieces != null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "StoneboundKiln_bal"); kiln = val.GetComponent(); } kiln.m_addOreTooltip = "$piece_smelter_add"; if (stonekilnConverions.Count > 0) { kiln.m_conversion = stonekilnConverions; return; } text += "\n Stonebound Kiln accepts all items that Kiln does but requires fuel"; text += addConversion(((Component)kiln).gameObject, "WoodBundle_bal", "Coal", ConversionType.balrondConverter, 60, 10, 2); text += addConversion(((Component)kiln).gameObject, "ClayMoldBundle_bal", "ClayBrick_bal", ConversionType.balrondConverter, 60, 10, 2); text += addConversion(((Component)kiln).gameObject, "CeramicMoldBundle_bal", "CeramicPlate", ConversionType.balrondConverter, 60, 40, 2); text += addConversion(((Component)kiln).gameObject, "Wood", "Coal", ConversionType.balrondConverter, 5, 1); text += addConversion(((Component)kiln).gameObject, "FineWood", "Coal", ConversionType.balrondConverter, 10, 1); text += addConversion(((Component)kiln).gameObject, "RoundLog", "Coal", ConversionType.balrondConverter, 10, 1); text += addConversion(((Component)kiln).gameObject, "TarBase_bal", "Tar", ConversionType.balrondConverter, 5, 1); text += addConversion(((Component)kiln).gameObject, "Moss_bal", "CoalPowder_bal", ConversionType.balrondConverter, 5, 1); text += addConversion(((Component)kiln).gameObject, "ElderBark", "CoalPowder_bal", ConversionType.balrondConverter, 5, 1); text += addConversion(((Component)kiln).gameObject, "YewBark_bal", "CoalPowder_bal", ConversionType.balrondConverter, 5, 1); text += addConversion(((Component)kiln).gameObject, "WillowBark_bal", "CoalPowder_bal", ConversionType.balrondConverter, 5, 1); text += addConversion(((Component)kiln).gameObject, "HardWood_bal", "Coal", ConversionType.balrondConverter, 10, 2); text += addConversion(((Component)kiln).gameObject, "YggdrasilWood", "Coal", ConversionType.balrondConverter, 10, 2); text += addConversion(((Component)kiln).gameObject, "Blackwood", "Coal", ConversionType.balrondConverter, 10, 2); text += addConversion(((Component)kiln).gameObject, "ClayBrickMold_bal", "ClayBrick_bal", ConversionType.balrondConverter, 5, 1); text += addConversion(((Component)kiln).gameObject, "CeramicMold_bal", "CeramicPlate", ConversionType.balrondConverter, 5, 1); buildConversionStationTutorialTag(((Component)kiln).gameObject, text); stonekilnConverions = kiln.m_conversion; } public void editFermenter(Fermenter fermenter = null) { string text = ""; if (buildPieces != null && (Object)(object)fermenter == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "fermenter"); fermenter = val.GetComponent(); } fermenter.m_fermentationDuration = 2000f; text += addConversion(((Component)fermenter).gameObject, "MeadBaseWhiteCheese_bal", "WhiteCheese_bal", ConversionType.fermenter, 2); text += addConversion(((Component)fermenter).gameObject, "SurstrommingBase_bal", "Surstromming_bal", ConversionType.fermenter, 2); buildConversionStationTutorialTag(((Component)fermenter).gameObject, text); } public void editOven(CookingStation oven = null) { string text = ""; if (buildPieces != null && (Object)(object)oven == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_oven"); oven = val.GetComponent(); } if (oven.m_conversion == null) { oven.m_conversion = new List(); } text += addConversion(((Component)oven).gameObject, "FishWrapsUncooked_bal", "FishWraps", ConversionType.cooking, 50); text += addConversion(((Component)oven).gameObject, "ApplePieUncooked_bal", "ApplePie_bal", ConversionType.cooking, 50); text += addConversion(((Component)oven).gameObject, "BlueberryPieUncooked_bal", "BlueberryPie_bal", ConversionType.cooking, 50); buildConversionStationTutorialTag(((Component)oven).gameObject, text); } public void editCooking(CookingStation cookingStation = null) { string text = ""; if (buildPieces != null && (Object)(object)cookingStation == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_cookingstation"); cookingStation = val.GetComponent(); } text += addConversion(((Component)cookingStation).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 40); text += addConversion(((Component)cookingStation).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking, 35); text += addConversion(((Component)cookingStation).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60); buildConversionStationTutorialTag(((Component)cookingStation).gameObject, text); } public void editIronCooking(CookingStation cookingStation = null) { string text = ""; if (buildPieces != null && (Object)(object)cookingStation == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_cookingstation_iron"); cookingStation = val.GetComponent(); } text += addConversion(((Component)cookingStation).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "FenringMeat_bal", "FenringMeatCooked_bal", ConversionType.cooking, 60); text += addConversion(((Component)cookingStation).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking, 20); text += addConversion(((Component)cookingStation).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 20); text += addConversion(((Component)cookingStation).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 35); text += addConversion(((Component)cookingStation).gameObject, "DrakeMeat_bal", "DrakeMeatCooked_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60); buildConversionStationTutorialTag(((Component)cookingStation).gameObject, text); } public void editSmallIronCooking(CookingStation cookingStation = null) { string text = ""; if (buildPieces != null && (Object)(object)cookingStation == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_singleIronRack_bal"); cookingStation = val.GetComponent(); } text += addConversion(((Component)cookingStation).gameObject, "RawMeat", "CookedMeat", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "NeckTail", "CookedNeckTail", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "FishRaw", "FishCooked", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "SerpentMeat", "SerpentMeatCooked", ConversionType.cooking, 60); text += addConversion(((Component)cookingStation).gameObject, "LoxMeat", "LoxMeatCooked", ConversionType.cooking, 60); text += addConversion(((Component)cookingStation).gameObject, "HareMeat", "HareMeatCooked", ConversionType.cooking, 60); text += addConversion(((Component)cookingStation).gameObject, "ChickenMeat", "ChickenCooked", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "AskvinMeat", "AskvinMeatCooked", ConversionType.cooking, 60); text += addConversion(((Component)cookingStation).gameObject, "VultureMeat", "VultureMeatCooked", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "CrabLegs_bal", "CrabLegsCooked_bal", ConversionType.cooking, 25); text += addConversion(((Component)cookingStation).gameObject, "SharkMeat_bal", "SharkMeatCooked_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "FenringMeat_bal", "FenringMeatCooked_bal", ConversionType.cooking, 60); text += addConversion(((Component)cookingStation).gameObject, "RawCrowMeat_bal", "CookedCrowMeat_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "RawSteak_bal", "SteakCooked_bal", ConversionType.cooking, 20); text += addConversion(((Component)cookingStation).gameObject, "BatWing_bal", "BatWingCooked_bal", ConversionType.cooking, 20); text += addConversion(((Component)cookingStation).gameObject, "GoatMeat_bal", "GoatMeatCooked_bal", ConversionType.cooking, 35); text += addConversion(((Component)cookingStation).gameObject, "DrakeMeat_bal", "DrakeMeatCooked_bal", ConversionType.cooking, 30); text += addConversion(((Component)cookingStation).gameObject, "TrollMeat_bal", "TrollMeatCooked_bal", ConversionType.cooking, 60); buildConversionStationTutorialTag(((Component)cookingStation).gameObject, text); } public void editWHeel(Smelter wheel = null) { string text = ""; if (buildPieces != null && (Object)(object)wheel == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_spinningwheel"); wheel = val.GetComponent(); } if (wheel.m_maxOre == 40) { wheel.m_maxOre = 80; } if (wheel.m_secPerProduct == 30f) { wheel.m_secPerProduct = 25f; } text += addConversion(((Component)wheel).gameObject, "Straw_bal", "StrawThread_bal", ConversionType.smelter); text += addConversion(((Component)wheel).gameObject, "RawSilk_bal", "SilkReinforcedThread_bal", ConversionType.smelter); buildConversionStationTutorialTag(((Component)wheel).gameObject, text); } public void editSap(SapCollector sap = null) { if (buildPieces != null && (Object)(object)sap == (Object)null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_sapcollector"); sap = val.GetComponent(); } if (sap.m_secPerUnit == 60f) { sap.m_secPerUnit = 90f; } if (sap.m_maxLevel == 10) { sap.m_maxLevel = 30; } } public void editWIndMIll(Smelter windmill = null) { string text = ""; if (buildPieces != null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "windmill"); windmill = val.GetComponent(); } if (windmill.m_maxOre == 50) { windmill.m_maxOre = 60; } if (windmill.m_secPerProduct == 10f) { windmill.m_secPerProduct = 15f; } } public void editKiln(Smelter kiln = null) { string text = ""; if (buildPieces != null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "charcoal_kiln"); kiln = val.GetComponent(); } if (kiln.m_maxOre == 25) { kiln.m_maxOre = 50; } if (kiln.m_secPerProduct == 15f) { kiln.m_secPerProduct = 10f; } kiln.m_addOreTooltip = "$piece_smelter_add"; if (kilnConverions.Count > 0) { kiln.m_conversion = kilnConverions; return; } text += addConversion(((Component)kiln).gameObject, "TarBase_bal", "Tar", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "Moss_bal", "CoalPowder_bal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "ElderBark", "CoalPowder_bal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "YewBark_bal", "CoalPowder_bal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "WillowBark_bal", "CoalPowder_bal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "HardWood_bal", "Coal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "YggdrasilWood", "Coal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "Blackwood", "Coal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "ClayBrickMold_bal", "ClayBrick_bal", ConversionType.smelter); text += addConversion(((Component)kiln).gameObject, "CeramicMold_bal", "CeramicPlate", ConversionType.smelter); buildConversionStationTutorialTag(((Component)kiln).gameObject, text); kilnConverions = kiln.m_conversion; } public void editPress(Smelter press = null) { string text = ""; if (buildPieces != null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "oilpress_bal"); press = val.GetComponent(); } text += addConversion(((Component)press).gameObject, "OilBase_bal", "Oil_bal", ConversionType.smelter); text += addConversion(((Component)press).gameObject, "BlackBerryJuiceBase_bal", "BlackBerryJuice_bal", ConversionType.smelter); text += addConversion(((Component)press).gameObject, "FruitPunchBase_bal", "FruitPunch_bal", ConversionType.smelter); text += addConversion(((Component)press).gameObject, "VineBerryJuiceBase_bal", "VineBerryJuice_bal", ConversionType.smelter); text += addConversion(((Component)press).gameObject, "MagmaCoctailBase_bal", "MagmaCoctail_bal", ConversionType.smelter); text += addConversion(((Component)press).gameObject, "PaintBucket_bal", "DyeKit_bal", ConversionType.smelter); buildConversionStationTutorialTag(((Component)press).gameObject, text); } private void editBeehive() { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "piece_beehive"); Beehive component = val.GetComponent(); component.m_maxHoney = 20; } private void editIncinerator(Incinerator incinerator = null) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown if (buildPieces != null) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == "incinerator"); incinerator = val.GetComponent(); } IncineratorConversion val2 = new IncineratorConversion(); val2.m_requireOnlyOneIngredient = true; val2.m_priority = 2; val2.m_requirements = new List(); string[] array = convertToBits; foreach (string name in array) { val2.m_requirements.Add(new Requirement { m_amount = 1, m_resItem = FindItem(name).GetComponent() }); } val2.m_result = FindItem("CoalPowder_bal").GetComponent(); incinerator.m_conversions.Add(val2); IncineratorConversion val3 = new IncineratorConversion(); val3.m_requireOnlyOneIngredient = true; val3.m_requirements = new List(); string[] array2 = convertToCoal; foreach (string name2 in array2) { val3.m_requirements.Add(new Requirement { m_amount = 1, m_resItem = FindItem(name2).GetComponent() }); } val3.m_result = FindItem("Coal").GetComponent(); incinerator.m_conversions.Add(val3); IncineratorConversion val4 = new IncineratorConversion(); val4.m_requireOnlyOneIngredient = true; val4.m_priority = 1; val4.m_requirements = new List(); string[] array3 = arrowsNbolts; foreach (string name3 in array3) { val4.m_requirements.Add(new Requirement { m_amount = 20, m_resItem = FindItem(name3).GetComponent() }); } val4.m_result = FindItem("Coal").GetComponent(); incinerator.m_conversions.Add(val4); } private string addConversion(GameObject source, string nameIn, string nameOut, ConversionType type, int time = 0, int amount = 5, int cost = 1) { string result = ""; switch (type) { case ConversionType.smelter: result = SmelterConversion(source, nameIn, nameOut); break; case ConversionType.fermenter: result = FermenterConversion(source, nameIn, nameOut, amount); break; case ConversionType.cooking: result = CookingConversion(source, nameIn, nameOut, time); break; case ConversionType.balrondConverter: result = BalrondConversion(source, nameIn, nameOut, amount, cost, time); break; } return result; } private void buildConversionStationTutorialTag(GameObject gameObject, string tutorialExtra, string tag = "workbench") { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown string text = "\n BALROND AMAZING NATURE: "; TutorialText val = new TutorialText(); val.m_name = "BAN conversions:" + ((Object)gameObject).name; val.m_globalKeyTrigger = "AmazingNature" + ((Object)gameObject).name; val.m_tutorialTrigger = tag; val.m_topic = "BAN-" + ((Object)gameObject).name; val.m_label = "BAN-" + ((Object)gameObject).name; val.m_isMunin = true; val.m_text = text + tutorialExtra; m_texts.Add(val); } private string createConversionSingleLine(ItemDrop m_from, ItemDrop m_to, int time = 0, int amount = 0) { string text = "\n $tag_convers_bal "; if (time > 0 && amount == 0) { return text + m_from.m_itemData.m_shared.m_name + " $tag_to_bal " + m_to.m_itemData.m_shared.m_name + " $tag_in_bal " + time + " $tag_seconds_bal"; } if (time == 0 && amount > 0) { return text + m_from.m_itemData.m_shared.m_name + " $tag_to_bal " + amount + " " + m_to.m_itemData.m_shared.m_name; } if (time > 0 && amount > 0) { return text + m_from.m_itemData.m_shared.m_name + " $tag_to_bal " + amount + " " + m_to.m_itemData.m_shared.m_name + " $tag_in_bal " + time + " $tag_seconds_bal"; } return text + m_from.m_itemData.m_shared.m_name + " $tag_to_bal " + m_to.m_itemData.m_shared.m_name; } private string BalrondConversion(GameObject source, string nameIn, string nameOut, int amount = 1, int cost = 1, int time = 0, List list = null) { BalrondConverter component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } bool flag = false; foreach (BalrondConverter.ItemConversion item2 in component.m_conversion) { if (item2 != null && (Object)(object)item2.m_from != (Object)null && item2.m_from.m_itemData != null && (Object)(object)item2.m_from.m_itemData.m_dropPrefab != (Object)null && ((Object)item2.m_from.m_itemData.m_dropPrefab).name == nameIn) { flag = true; break; } } if (!flag) { ItemDrop component2 = FindItem(nameIn).GetComponent(); ItemDrop component3 = FindItem(nameOut).GetComponent(); BalrondConverter.ItemConversion item = new BalrondConverter.ItemConversion { m_from = component2, m_to = component3, m_count = amount, m_fuelCost = cost, m_secPerProduct = time }; component.m_conversion.Add(item); return createConversionSingleLine(component2, component3, 0, amount); } return ""; } private string SmelterConversion(GameObject source, string nameIn, string nameOut) { //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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown Smelter component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } bool flag = false; foreach (ItemConversion item2 in component.m_conversion) { if (item2 != null && (Object)(object)item2.m_from != (Object)null && item2.m_from.m_itemData != null && (Object)(object)item2.m_from.m_itemData.m_dropPrefab != (Object)null && ((Object)item2.m_from.m_itemData.m_dropPrefab).name == nameIn) { flag = true; break; } } if (!flag) { ItemDrop component2 = FindItem(nameIn).GetComponent(); ItemDrop component3 = FindItem(nameOut).GetComponent(); ItemConversion item = new ItemConversion { m_from = component2, m_to = component3 }; component.m_conversion.Add(item); return createConversionSingleLine(component2, component3); } return ""; } private string FermenterConversion(GameObject source, string nameIn, string nameOut, int amount = 1) { //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_0109: 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_011b: Expected O, but got Unknown Fermenter component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } bool flag = false; foreach (ItemConversion item2 in component.m_conversion) { if (item2 != null && (Object)(object)item2.m_from != (Object)null && item2.m_from.m_itemData != null && (Object)(object)item2.m_from.m_itemData.m_dropPrefab != (Object)null && ((Object)item2.m_from.m_itemData.m_dropPrefab).name == nameIn) { flag = true; break; } } if (!flag) { ItemDrop component2 = FindItem(nameIn).GetComponent(); ItemDrop component3 = FindItem(nameOut).GetComponent(); ItemConversion item = new ItemConversion { m_from = component2, m_to = component3, m_producedItems = amount }; component.m_conversion.Add(item); return createConversionSingleLine(component2, component3, 0, amount); } return ""; } private string CookingConversion(GameObject source, string nameIn, string nameOut, int time = 25) { //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_0109: 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_011c: Expected O, but got Unknown CookingStation component = source.GetComponent(); if ((Object)(object)component == (Object)null) { return ""; } if (component.m_conversion == null) { component.m_conversion = new List(); } bool flag = false; foreach (ItemConversion item2 in component.m_conversion) { if (item2 != null && (Object)(object)item2.m_from != (Object)null && item2.m_from.m_itemData != null && (Object)(object)item2.m_from.m_itemData.m_dropPrefab != (Object)null && ((Object)item2.m_from.m_itemData.m_dropPrefab).name == nameIn) { flag = true; break; } } if (!flag) { ItemDrop component2 = FindItem(nameIn).GetComponent(); ItemDrop component3 = FindItem(nameOut).GetComponent(); ItemConversion item = new ItemConversion { m_from = component2, m_to = component3, m_cookTime = time }; component.m_conversion.Add(item); return createConversionSingleLine(component2, component3, time); } return ""; } } public class BalrondMonsterLoot : MonoBehaviour { public Character m_character; public string m_name; public int m_level; public bool isBoss; private void Awake() { m_character = ((Component)this).GetComponent(); m_name = ((Object)this).name; if ((Object)(object)m_character != (Object)null) { isBoss = m_character.IsBoss(); m_level = m_character.GetLevel(); } else { Debug.Log((object)"Character not found"); } } } [Serializable] public class BalrondConverter : MonoBehaviour { [Serializable] public class ItemConversion { public ItemDrop m_from; public ItemDrop m_to; [Tooltip("How many of m_to to produce per 1 input")] public int m_count = 1; [Tooltip("Fuel units consumed per 1 input processed. Sawmill: 1. Tanning: bundles needed per hide.")] public int m_fuelCost = 1; [Tooltip("Seconds per product for THIS conversion. If 0, station uses m_defaultSecPerProduct (default 60).")] public float m_secPerProduct = 0f; } public string m_name = "BalrondConverter"; public string prefabName = null; public string m_addOreTooltip = "$tag_sawmill_addWood"; public string m_emptyOreTooltip = "$tag_sawmill_pickupWood"; public Switch m_addWoodSwitch; public Switch m_addOreSwitch; public Switch m_emptyOreSwitch; public Transform m_outputPoint; public Transform m_roofCheckPoint; public GameObject m_enabledObject; public GameObject m_disabledObject; public GameObject m_haveFuelObject; public GameObject m_haveOreObject; public GameObject m_noOreObject; public Animator[] m_animators; [Header("Fuel")] public ItemDrop m_fuelItem; public int m_maxFuel = 1; public int m_usesPerBlade = 100; [Header("Input")] public int m_maxOre = 1; [Header("Timing")] public float m_defaultSecPerProduct = 60f; [Header("Output")] public bool m_spawnStack = true; public bool m_requiresRoof = false; public Windmill m_windmill; public SmokeSpawner m_smokeSpawner; public float m_addOreAnimationDuration; public List m_conversion = new List(); public EffectList m_oreAddedEffects = new EffectList(); public EffectList m_fuelAddedEffects = new EffectList(); public EffectList m_produceEffects = new EffectList(); private ZNetView m_nview; private float m_addedOreTime = -1000f; private readonly StringBuilder m_sb = new StringBuilder(); private static readonly int s_fuelUnitsHash = BalrondHashCompat.StableHash("balrond_fuelUnits"); private static readonly int s_currentOreHash = BalrondHashCompat.StableHash("balrond_currentOre"); private static readonly int s_currentAmountHash = BalrondHashCompat.StableHash("balrond_currentAmount"); private static readonly int s_jobOreHash = BalrondHashCompat.StableHash("balrond_jobOre"); private static readonly int s_reservedFuelHash = BalrondHashCompat.StableHash("balrond_reservedFuel"); private static readonly int s_startTimeHash = ZDOVars.s_startTime; private static readonly int s_accTimeHash = ZDOVars.s_accTime; private static readonly int s_bakeTimerHash = ZDOVars.s_bakeTimer; private static readonly int s_queuedHash = ZDOVars.s_queued; private void Awake() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown m_nview = ((Component)this).GetComponent(); if ((Object)(object)m_nview == (Object)null) { m_nview = ((Component)this).GetComponentInParent(); } EnsureConversionsLoaded(); if (!((Object)(object)m_nview == (Object)null) && m_nview.IsValid()) { if (Object.op_Implicit((Object)(object)m_addOreSwitch)) { Switch addOreSwitch = m_addOreSwitch; addOreSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)addOreSwitch.m_onUse, (Delegate?)new Callback(OnAddOre)); m_addOreSwitch.m_onHover = new TooltipCallback(OnHoverAddOre); } if (Object.op_Implicit((Object)(object)m_addWoodSwitch)) { Switch addWoodSwitch = m_addWoodSwitch; addWoodSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)addWoodSwitch.m_onUse, (Delegate?)new Callback(OnAddFuel)); m_addWoodSwitch.m_onHover = new TooltipCallback(OnHoverAddFuel); } if (Object.op_Implicit((Object)(object)m_emptyOreSwitch)) { Switch emptyOreSwitch = m_emptyOreSwitch; emptyOreSwitch.m_onUse = (Callback)Delegate.Combine((Delegate?)(object)emptyOreSwitch.m_onUse, (Delegate?)new Callback(OnEmpty)); Switch emptyOreSwitch2 = m_emptyOreSwitch; emptyOreSwitch2.m_onHover = (TooltipCallback)Delegate.Combine((Delegate?)(object)emptyOreSwitch2.m_onHover, (Delegate?)new TooltipCallback(OnHoverEmptyOre)); } m_nview.Register("AddOre", (Action)RPC_AddOre); m_nview.Register("AddFuel", (Action)RPC_AddFuel); m_nview.Register("ConverterEmptyProcessed", (Action)RPC_ConverterEmptyProcessed); WearNTear component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } ((MonoBehaviour)this).InvokeRepeating("UpdateBalrondConverter", 1f, 1f); } } private void EnsureConversionsLoaded() { if (m_conversion == null || m_conversion.Count <= 0) { if (prefabName == "piece_leatherRack_bal") { m_conversion = ConversionChanges.tanneryConverions; } else if (prefabName == "piece_sawmill_bal") { m_conversion = ConversionChanges.sawmillConverions; } else if (prefabName == "StoneboundKiln_bal") { m_conversion = ConversionChanges.stonekilnConverions; } if (m_conversion == null) { m_conversion = new List(); } } } private int GetFuelUnits() { return (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) ? m_nview.GetZDO().GetInt(s_fuelUnitsHash, 0) : 0; } private void SetFuelUnits(int units) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) { if (units < 0) { units = 0; } m_nview.GetZDO().Set(s_fuelUnitsHash, units, false); } } private int GetReservedFuelUnits() { return (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) ? m_nview.GetZDO().GetInt(s_reservedFuelHash, 0) : 0; } private void SetReservedFuelUnits(int units) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) { if (units < 0) { units = 0; } m_nview.GetZDO().Set(s_reservedFuelHash, units, false); } } private int GetFuelUnitsCapacity() { int num = Mathf.Max(0, m_maxFuel); int num2 = Mathf.Max(1, m_usesPerBlade); return num * num2; } private bool HasAnyFuel() { return m_maxFuel == 0 || GetFuelUnits() > 0; } private string GetJobOre() { return (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) ? "" : m_nview.GetZDO().GetString(s_jobOreHash, ""); } private void SetJobOre(string ore) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) { m_nview.GetZDO().Set(s_jobOreHash, ore ?? ""); } } private bool HasActiveJob() { return !string.IsNullOrEmpty(GetJobOre()); } private int GetFuelCostForOre(string orePrefabName) { ItemConversion itemConversion = GetItemConversion(orePrefabName); if (itemConversion == null) { return 1; } return Mathf.Max(1, itemConversion.m_fuelCost); } private bool TryStartJobIfPossible() { if (HasActiveJob()) { return true; } string queuedOre = GetQueuedOre(); if (string.IsNullOrEmpty(queuedOre)) { return false; } ItemConversion itemConversion = GetItemConversion(queuedOre); if (itemConversion == null) { ZLog.LogWarning((object)("[BalrondConverter] Missing conversion for '" + queuedOre + "', dropping it from queue.")); RemoveOneOre(); return false; } int num = Mathf.Max(1, itemConversion.m_fuelCost); if (m_maxFuel > 0 && GetFuelUnits() < num) { return false; } RemoveOneOre(); SetJobOre(queuedOre); SetBakeTimer(0f); if (m_maxFuel > 0) { int fuelUnits = GetFuelUnits(); SetFuelUnits(fuelUnits - num); SetReservedFuelUnits(GetReservedFuelUnits() + num); } return true; } private void CompleteJobAndSpawnOutput() { string jobOre = GetJobOre(); if (!string.IsNullOrEmpty(jobOre)) { SetReservedFuelUnits(0); QueueProcessed(jobOre); SetJobOre(""); SetBakeTimer(0f); } } private int GetQueueSize() { return (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) ? m_nview.GetZDO().GetInt(s_queuedHash, 0) : 0; } private float GetBakeTimer() { return (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(s_bakeTimerHash, 0f); } private void SetBakeTimer(float t) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) { m_nview.GetZDO().Set(s_bakeTimerHash, t); } } private float GetAccumulator() { return (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(s_accTimeHash, 0f); } private void SetAccumulator(float t) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) { m_nview.GetZDO().Set(s_accTimeHash, t); } } private void QueueOre(string prefabName) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) { int queueSize = GetQueueSize(); m_nview.GetZDO().Set("item" + queueSize, prefabName); m_nview.GetZDO().Set(s_queuedHash, queueSize + 1, false); } } private string GetQueuedOre() { return (GetQueueSize() == 0 || !Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) ? "" : m_nview.GetZDO().GetString(ZDOVars.s_item0, ""); } private string GetQueuedOreAt(int index) { if (index < 0 || !Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return ""; } return m_nview.GetZDO().GetString("item" + index, ""); } private void RemoveOneOre() { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return; } int queueSize = GetQueueSize(); if (queueSize > 0) { for (int i = 0; i < queueSize; i++) { string @string = m_nview.GetZDO().GetString("item" + (i + 1), ""); m_nview.GetZDO().Set("item" + i, @string); } m_nview.GetZDO().Set(s_queuedHash, queueSize - 1, false); } } private int GetProcessedQueueSize() { return (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) ? m_nview.GetZDO().GetInt(s_currentAmountHash, 0) : 0; } private void QueueProcessed(string fromOrePrefab) { ItemConversion itemConversion = GetItemConversion(fromOrePrefab); if (itemConversion == null) { ZLog.LogWarning((object)("[BalrondConverter] Missing conversion for '" + fromOrePrefab + "'")); } else if (!m_spawnStack) { Spawn(fromOrePrefab, itemConversion.m_count); } else { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return; } string @string = m_nview.GetZDO().GetString(s_currentOreHash, ""); int @int = m_nview.GetZDO().GetInt(s_currentAmountHash, 0); if (!string.IsNullOrEmpty(@string)) { if (@string != fromOrePrefab) { SpawnProcessed(); m_nview.GetZDO().Set(s_currentOreHash, fromOrePrefab); m_nview.GetZDO().Set(s_currentAmountHash, itemConversion.m_count, false); return; } int num = @int + itemConversion.m_count; int num2 = itemConversion.m_to?.m_itemData?.m_shared?.m_maxStackSize ?? 1; if (num >= num2) { Spawn(fromOrePrefab, @int); Spawn(fromOrePrefab, itemConversion.m_count); m_nview.GetZDO().Set(s_currentOreHash, ""); m_nview.GetZDO().Set(s_currentAmountHash, 0, false); } else { m_nview.GetZDO().Set(s_currentAmountHash, num, false); } } else { m_nview.GetZDO().Set(s_currentOreHash, fromOrePrefab); m_nview.GetZDO().Set(s_currentAmountHash, itemConversion.m_count, false); } } } private void SpawnProcessed() { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid()) { int @int = m_nview.GetZDO().GetInt(s_currentAmountHash, 0); if (@int > 0) { string @string = m_nview.GetZDO().GetString(s_currentOreHash, ""); Spawn(@string, @int); m_nview.GetZDO().Set(s_currentOreHash, ""); m_nview.GetZDO().Set(s_currentAmountHash, 0, false); } } } private void Spawn(string orePrefab, int stack) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) ItemConversion itemConversion = GetItemConversion(orePrefab); if (itemConversion != null && !((Object)(object)itemConversion.m_to == (Object)null)) { m_produceEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); GameObject val = Object.Instantiate(((Component)itemConversion.m_to).gameObject, m_outputPoint.position, m_outputPoint.rotation); ItemDrop component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_stack = Mathf.Max(1, stack); } } } private bool IsItemAllowed(ItemData item) { return item != null && IsItemAllowed(((Object)item.m_dropPrefab).name); } private bool IsItemAllowed(string itemPrefabName) { foreach (ItemConversion item in m_conversion) { if ((Object)(object)item?.m_from != (Object)null && ((Object)((Component)item.m_from).gameObject).name == itemPrefabName) { return true; } } return false; } private ItemData FindProcessableItem(Inventory inventory) { foreach (ItemConversion item2 in m_conversion) { if (!((Object)(object)item2?.m_from == (Object)null)) { ItemData item = inventory.GetItem(item2.m_from.m_itemData.m_shared.m_name, -1, false); if (item != null) { return item; } } } return null; } private ItemConversion GetItemConversion(string fromPrefabName) { foreach (ItemConversion item in m_conversion) { if ((Object)(object)item?.m_from != (Object)null && ((Object)((Component)item.m_from).gameObject).name == fromPrefabName) { return item; } } return null; } private float GetSecondsForConversion(string fromPrefabName) { float num = GetItemConversion(fromPrefabName)?.m_secPerProduct ?? 0f; if (num <= 0f) { num = m_defaultSecPerProduct; } if (num <= 0f) { num = 60f; } return num; } private bool OnAddOre(Switch sw, Humanoid user, ItemData item) { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return false; } if (GetQueueSize() >= m_maxOre) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } if (item != null && !IsItemAllowed(item)) { ((Character)user).Message((MessageType)2, "$msg_wontwork", 0, (Sprite)null); return false; } if (item == null) { item = FindProcessableItem(user.GetInventory()); if (item == null) { ((Character)user).Message((MessageType)2, "$msg_noprocessableitems", 0, (Sprite)null); return false; } } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(item, 1); m_nview.InvokeRPC("AddOre", new object[1] { ((Object)item.m_dropPrefab).name }); m_addedOreTime = Time.time; if (m_addOreAnimationDuration > 0f) { SetAnimation(active: true); } return true; } private void RPC_AddOre(long sender, string prefabNameToQueue) { //IL_006d: 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) if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid() && m_nview.IsOwner()) { if (!IsItemAllowed(prefabNameToQueue)) { ZLog.LogWarning((object)("[BalrondConverter] Item not allowed '" + prefabNameToQueue + "'")); return; } QueueOre(prefabNameToQueue); m_oreAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, (Transform)null, 1f, -1); } } private bool OnAddFuel(Switch sw, Humanoid user, ItemData item) { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return false; } if (m_maxFuel == 0) { return false; } if ((Object)(object)m_fuelItem == (Object)null) { return false; } string name = ((Object)((Component)m_fuelItem).gameObject).name; string name2 = m_fuelItem.m_itemData.m_shared.m_name; if (item != null && ((Object)item.m_dropPrefab).name != name) { ((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null); return false; } int fuelUnitsCapacity = GetFuelUnitsCapacity(); int fuelUnits = GetFuelUnits(); int num = Mathf.Max(1, m_usesPerBlade); if (fuelUnits > fuelUnitsCapacity - num) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } if (!user.GetInventory().HaveItem(name2, 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(name2, 1, -1, true); m_nview.InvokeRPC("AddFuel", Array.Empty()); return true; } private void RPC_AddFuel(long sender) { //IL_006b: 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.op_Implicit((Object)(object)m_nview) && m_nview.IsValid() && m_nview.IsOwner()) { int num = Mathf.Max(1, m_usesPerBlade); int fuelUnitsCapacity = GetFuelUnitsCapacity(); int fuelUnits = GetFuelUnits(); fuelUnits = Mathf.Min(fuelUnitsCapacity, fuelUnits + num); SetFuelUnits(fuelUnits); m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); } } private bool OnEmpty(Switch sw, Humanoid user, ItemData item) { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return false; } if (GetProcessedQueueSize() <= 0) { return false; } m_nview.InvokeRPC("ConverterEmptyProcessed", Array.Empty()); return true; } private void RPC_ConverterEmptyProcessed(long sender) { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid() && m_nview.IsOwner()) { SpawnProcessed(); } } private double GetDeltaTime() { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid() || (Object)(object)ZNet.instance == (Object)null) { return 0.0; } DateTime time = ZNet.instance.GetTime(); DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(s_startTimeHash, time.Ticks)); double totalSeconds = (time - dateTime).TotalSeconds; m_nview.GetZDO().Set(s_startTimeHash, time.Ticks); return totalSeconds; } private void UpdateBalrondConverter() { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return; } UpdateState(); if (!m_nview.IsOwner()) { return; } double deltaTime = GetDeltaTime(); float num = GetAccumulator() + (float)deltaTime; if (num > 3600f) { num = 3600f; } float num2 = (Object.op_Implicit((Object)(object)m_windmill) ? m_windmill.GetPowerOutput() : 1f); if (num2 <= 0f) { num2 = 0f; } while (num >= 1f) { num -= 1f; if (!HasActiveJob()) { TryStartJobIfPossible(); } string jobOre = GetJobOre(); if (string.IsNullOrEmpty(jobOre)) { continue; } float secondsForConversion = GetSecondsForConversion(jobOre); if (!(secondsForConversion <= 0f)) { float num3 = 1f * num2; float num4 = GetBakeTimer() + num3; if (num4 < secondsForConversion) { SetBakeTimer(num4); } else { CompleteJobAndSpawnOutput(); } } } if (GetQueuedOre() == "" && !HasActiveJob()) { SpawnProcessed(); } SetAccumulator(num); } private void UpdateState() { bool flag = IsActive(); if (Object.op_Implicit((Object)(object)m_enabledObject)) { 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(HasAnyFuel() && !flag); } if (Object.op_Implicit((Object)(object)m_haveOreObject)) { m_haveOreObject.SetActive(GetQueueSize() > 0 || HasActiveJob()); } if (Object.op_Implicit((Object)(object)m_noOreObject)) { m_noOreObject.SetActive(GetQueueSize() == 0 && !HasActiveJob()); } if (m_addOreAnimationDuration > 0f && Time.time - m_addedOreTime < m_addOreAnimationDuration) { flag = true; } SetAnimation(flag); } private void SetAnimation(bool active) { if (m_animators == null) { return; } Animator[] animators = m_animators; foreach (Animator val in animators) { if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy) { val.SetBool("active", active); val.SetFloat("activef", active ? 1f : 0f); } } } public bool IsActive() { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return false; } if (!HasActiveJob() && GetQueueSize() <= 0) { return false; } if (HasActiveJob()) { return true; } if (m_maxFuel == 0) { return true; } string queuedOre = GetQueuedOre(); if (string.IsNullOrEmpty(queuedOre)) { return false; } int fuelCostForOre = GetFuelCostForOre(queuedOre); return GetFuelUnits() >= fuelCostForOre; } private string OnHoverAddFuel() { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return Localization.instance.Localize(m_name); } string text = (Object.op_Implicit((Object)(object)m_fuelItem) ? m_fuelItem.m_itemData.m_shared.m_name : "Fuel"); int perFuelItemUnits = GetPerFuelItemUnits(); int fuelUnits = GetFuelUnits(); int fuelUnitsCapacity = GetFuelUnitsCapacity(); int queueSize = GetQueueSize(); m_sb.Clear(); m_sb.Append(m_name + "\n"); m_sb.Append($"Fuel: {fuelUnits}/{fuelUnitsCapacity} units (+{perFuelItemUnits} per {text})"); string queuedOre = GetQueuedOre(); if (!string.IsNullOrEmpty(queuedOre)) { string arg = GetItemConversion(queuedOre)?.m_from?.m_itemData?.m_shared?.m_name ?? queuedOre; int fuelCostForOre = GetFuelCostForOre(queuedOre); m_sb.Append($"\nNext: {arg} (cost {fuelCostForOre} units)"); if (m_maxFuel > 0 && fuelUnits < fuelCostForOre) { m_sb.Append($"\nNeed {fuelCostForOre - fuelUnits} more units to start"); } else if (queueSize > 0) { m_sb.Append("\nReady to start"); } } else if (HasActiveJob()) { string jobOre = GetJobOre(); string text2 = GetItemConversion(jobOre)?.m_from?.m_itemData?.m_shared?.m_name ?? jobOre; m_sb.Append("\nProcessing: " + text2); } else if (prefabName == "piece_leatherRack_bal") { m_sb.Append("\nAdd a hide to see cost"); } m_sb.Append("\n[$KEY_Use] Add " + text); return Localization.instance.Localize(m_sb.ToString()); } private string OnHoverEmptyOre() { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return Localization.instance.Localize(m_name); } return Localization.instance.Localize($"{m_name} ({GetProcessedQueueSize()} Ready)\n" + "[$KEY_Use] " + m_emptyOreTooltip); } private string OnHoverAddOre() { if (!Object.op_Implicit((Object)(object)m_nview) || !m_nview.IsValid()) { return Localization.instance.Localize(m_name); } int fuelUnits = GetFuelUnits(); int fuelUnitsCapacity = GetFuelUnitsCapacity(); int queueSize = GetQueueSize(); m_sb.Clear(); m_sb.Append($"{m_name} (Queue {queueSize}/{m_maxOre})"); if (m_maxFuel > 0) { m_sb.Append($"\nFuel: {fuelUnits}/{fuelUnitsCapacity} units"); } if (HasActiveJob()) { string jobOre = GetJobOre(); string arg = GetItemConversion(jobOre)?.m_from?.m_itemData?.m_shared?.m_name ?? jobOre; float secondsForConversion = GetSecondsForConversion(jobOre); m_sb.Append($"\nProcessing: {arg} ({Mathf.CeilToInt(secondsForConversion)}s)"); } else { string queuedOre = GetQueuedOre(); if (!string.IsNullOrEmpty(queuedOre)) { string arg2 = GetItemConversion(queuedOre)?.m_from?.m_itemData?.m_shared?.m_name ?? queuedOre; int fuelCostForOre = GetFuelCostForOre(queuedOre); float secondsForConversion2 = GetSecondsForConversion(queuedOre); m_sb.Append($"\nNext: {arg2} (cost {fuelCostForOre} units, {Mathf.CeilToInt(secondsForConversion2)}s)"); if (m_maxFuel > 0 && fuelUnits < fuelCostForOre) { m_sb.Append($"\nStatus: Need {fuelCostForOre - fuelUnits} more units"); } else { m_sb.Append("\nStatus: Ready"); } } else { m_sb.Append("\nStatus: " + m_addOreTooltip); } } m_sb.Append("\n[$KEY_Use] "); m_sb.Append(m_addOreTooltip); return Localization.instance.Localize(m_sb.ToString()); } private int GetPerFuelItemUnits() { return Mathf.Max(1, m_usesPerBlade); } private void OnDestroyed() { if (Object.op_Implicit((Object)(object)m_nview) && m_nview.IsValid() && m_nview.IsOwner()) { DropAllItems(); } } private void DropAllItems() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) SpawnProcessed(); string jobOre = GetJobOre(); if (!string.IsNullOrEmpty(jobOre)) { ItemConversion itemConversion = GetItemConversion(jobOre); if ((Object)(object)itemConversion?.m_from != (Object)null) { Vector3 val = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f; Quaternion val2 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); Object.Instantiate(((Component)itemConversion.m_from).gameObject, val, val2); } SetJobOre(""); SetBakeTimer(0f); } if ((Object)(object)m_fuelItem != (Object)null && m_maxFuel > 0) { int num = GetFuelUnits() + GetReservedFuelUnits(); SetFuelUnits(0); SetReservedFuelUnits(0); int num2 = Mathf.Max(1, m_usesPerBlade); int num3 = num / num2; for (int i = 0; i < num3; i++) { Vector3 val3 = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f; Quaternion val4 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); Object.Instantiate(((Component)m_fuelItem).gameObject, val3, val4); } } else { SetFuelUnits(0); SetReservedFuelUnits(0); } while (GetQueueSize() > 0) { string queuedOre = GetQueuedOre(); RemoveOneOre(); ItemConversion itemConversion2 = GetItemConversion(queuedOre); if ((Object)(object)itemConversion2?.m_from != (Object)null) { Vector3 val5 = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f; Quaternion val6 = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); Object.Instantiate(((Component)itemConversion2.m_from).gameObject, val5, val6); } } } } public class WaterWell : MonoBehaviour, Hoverable, Interactable { [Serializable] public class ItemConversion { public ItemDrop m_from; public int value; } public string m_name = "$tag_piece_waterwell_bal"; public Transform m_spawnPoint; public GameObject m_beeEffect; public bool m_effectOnlyInDaylight = true; [BitMask(typeof(Biome))] public Biome m_biome; public float m_secPerUnit = 5f; public int m_producedItemAmount = 5; public ItemDrop m_producedItem; public EffectList m_spawnEffect = new EffectList(); [Header("Texts")] public string m_extractText = "$tag_pickFeathers"; public string m_checkText = "$tag_birdAreBusy"; public string m_areaText = "$piece_beehive_area"; public string m_freespaceText = "$piece_beehive_freespace"; public string m_sleepText = "$tag_birdAreSleeping"; public string m_happyText = "$tag_birdAreHappy"; public string m_hungryText = "$tag_birdAreHungry"; public string m_notConnectedText; public string m_blockedText; public ZNetView m_nview; public Piece m_piece; public ItemDrop m_fuelItem; public List m_conversion = new List(); public EffectList m_fuelAddedEffects = new EffectList(); public int m_maxFuel = 5; public void Awake() { m_nview = ((Component)this).GetComponent(); m_piece = ((Component)this).GetComponent(); if (m_nview.GetZDO() != null) { if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, 0L) == 0) { m_nview.GetZDO().Set(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks); } m_nview.Register("RPC_ExtractWater", (Action)RPC_ExtractWater); m_nview.Register("RPC_AddBucket", (Action)RPC_AddBucket); WearNTear component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } ((MonoBehaviour)this).InvokeRepeating("UpdateWell", 0f, 5f); } } 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"); } int waterLevel = GetWaterLevel(); if (waterLevel <= 0) { return Localization.instance.Localize($"{m_name} ({m_fuelItem.m_itemData.m_shared.m_name} {Mathf.Ceil(GetFuel())}/{m_maxFuel})\n[1-8] $piece_smelter_add {m_fuelItem.m_itemData.m_shared.m_name}") + Localization.instance.Localize(" ( $piece_container_empty )\n[$KEY_Use] " + m_checkText); } return Localization.instance.Localize($"{m_name} ({m_fuelItem.m_itemData.m_shared.m_name} {Mathf.Ceil(GetFuel())}/{m_maxFuel})\n[1-8] $piece_smelter_add {m_fuelItem.m_itemData.m_shared.m_name}") + Localization.instance.Localize($" ( {m_producedItem.m_itemData.m_shared.m_name} x {waterLevel} )\n[$KEY_Use] {m_extractText}"); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool repeat, bool alt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (repeat) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (GetWaterLevel() > 0) { Extract(); Game.instance.IncrementPlayerStat((PlayerStatType)76, 1f); } else { if (!HaveFuel()) { ((Character)character).Message((MessageType)2, m_hungryText, 0, (Sprite)null); return true; } if (!EnvMan.IsDaylight() && m_effectOnlyInDaylight) { ((Character)character).Message((MessageType)2, m_sleepText, 0, (Sprite)null); return true; } ((Character)character).Message((MessageType)2, m_happyText, 0, (Sprite)null); } return true; } public bool UseItem(Humanoid user, ItemData item) { if (item != null && !IsItemAllowed(item)) { ((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null); return false; } if ((double)GetFuel() > (double)(m_maxFuel - 1)) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(item.m_shared.m_name, 1, -1, true); m_nview.InvokeRPC("RPC_AddBucket", Array.Empty()); return true; } public void Extract() { m_nview.InvokeRPC("RPC_ExtractWater", Array.Empty()); } public void RPC_ExtractWater(long caller) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) int waterLevel = GetWaterLevel(); if (waterLevel <= 0) { return; } m_spawnEffect.Create(m_spawnPoint.position, Quaternion.identity, (Transform)null, 1f, -1); for (int i = 0; i < waterLevel; i++) { Vector2 val = Random.insideUnitCircle * 0.5f; ItemDrop component = ((Component)Object.Instantiate(m_producedItem, m_spawnPoint.position + new Vector3(val.x, 0.25f * (float)i, val.y), Quaternion.identity)).GetComponent(); if (component != null) { component.SetStack(Game.instance.ScaleDrops(m_producedItem.m_itemData, 1)); } } ResetLevel(); } public float GetTimeSinceLastUpdate() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks)); DateTime time = ZNet.instance.GetTime(); TimeSpan timeSpan = time - dateTime; m_nview.GetZDO().Set(ZDOVars.s_lastTime, time.Ticks); double num = timeSpan.TotalSeconds; if (num < 0.0) { num = 0.0; } return (float)num; } public void ResetLevel() { m_nview.GetZDO().Set(ZDOVars.s_level, 0, false); } public void IncreseLevel(int i) { int num = Mathf.Clamp(GetWaterLevel() + i, 0, m_producedItemAmount); m_nview.GetZDO().Set(ZDOVars.s_level, num, false); } public int GetWaterLevel() { return m_nview.GetZDO().GetInt(ZDOVars.s_level, 0); } public void UpdateWell() { bool flag = HaveFuel(); if (m_nview.IsOwner() && flag) { float timeSinceLastUpdate = GetTimeSinceLastUpdate(); float num = m_nview.GetZDO().GetFloat(ZDOVars.s_product, 0f) + timeSinceLastUpdate; if ((double)num > (double)m_secPerUnit) { SetFuel(GetFuel() - 0.1f); IncreseLevel((int)((double)num / (double)m_secPerUnit)); num = 0f; } m_nview.GetZDO().Set(ZDOVars.s_product, num); } } private void OnDestroyed() { if (m_nview.IsOwner()) { DropAllItems(); } } private void DropAllItems() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0092: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_fuelItem != (Object)null) { float num = ((m_nview.GetZDO() == null) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f)); for (int i = 0; i < (int)num; i++) { ItemDrop.OnCreateNew(Object.Instantiate(((Component)m_fuelItem).gameObject, ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f))); } } } private float GetFuel() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } private bool HaveFuel() { return GetFuel() > 0f; } private void SetFuel(float fuel) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel); } } private void RPC_AddBucket(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 bool IsItemAllowed(ItemData item) { return IsItemAllowed(((Object)item.m_dropPrefab).name); } private bool IsItemAllowed(string itemName) { return ((Object)m_fuelItem).name == itemName; } } public class FueledHive : MonoBehaviour, Hoverable, Interactable { [Serializable] public class ItemConversion { public ItemDrop m_from; public int value; } [Header("General")] public string m_name = "$tag_piece_birdhouse"; public Transform m_spawnPoint; public GameObject m_beeEffect; public bool m_effectOnlyInDaylight = true; [BitMask(typeof(Biome))] public Biome m_biome; [Header("Production")] public float m_secPerUnit = 12f; public int m_producedItemAmount = 20; public ItemDrop m_producedItem; public EffectList m_spawnEffect = new EffectList(); [Header("Texts")] public string m_extractText = "$tag_pickFeathers"; public string m_checkText = "$tag_birdAreBusy"; public string m_areaText = "$piece_beehive_area"; public string m_freespaceText = "$piece_beehive_freespace"; public string m_sleepText = "$tag_birdAreSleeping"; public string m_happyText = "$tag_birdAreHappy"; public string m_hungryText = "$tag_birdAreHungry"; public string m_notConnectedText; public string m_blockedText; [Header("Network / Piece")] public ZNetView m_nview; public Piece m_piece; [Header("Fuel")] public ItemDrop m_fuelItem; public List m_conversion = new List(); public EffectList m_fuelAddedEffects = new EffectList(); public int m_maxFuel = 10; private const float FuelPerBatch = 0.1f; public void Awake() { m_nview = ((Component)this).GetComponent(); m_piece = ((Component)this).GetComponent(); if (m_nview.GetZDO() != null) { if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(ZDOVars.s_lastTime, 0L) == 0) { m_nview.GetZDO().Set(ZDOVars.s_lastTime, ZNet.instance.GetTime().Ticks); } m_nview.Register("RPC_ExtractFeathers", (Action)RPC_ExtractFeathers); m_nview.Register("RPC_AddFuel", (Action)RPC_AddFuel); WearNTear component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } ((MonoBehaviour)this).InvokeRepeating("UpdateBirds", 0f, 10f); } } 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"); } int featherAmount = GetFeatherAmount(); float num = Mathf.Ceil(GetFuel()); string name = m_fuelItem.m_itemData.m_shared.m_name; string text = $"{m_name} ({name} {num}/{m_maxFuel})\n[1-8] $piece_smelter_add {name}"; if (featherAmount <= 0) { return Localization.instance.Localize(text + Localization.instance.Localize(" ( $piece_container_empty )\n[$KEY_Use] " + m_checkText)); } string name2 = m_producedItem.m_itemData.m_shared.m_name; string text2 = $" ( {name2} x {featherAmount} )\n[$KEY_Use] {m_extractText}"; return Localization.instance.Localize(text + Localization.instance.Localize(text2)); } public string GetHoverName() { return m_name; } public bool Interact(Humanoid character, bool repeat, bool alt) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (repeat) { return false; } if (!PrivateArea.CheckAccess(((Component)this).transform.position, 0f, true, false)) { return true; } if (GetFeatherAmount() > 0) { Extract(); Game.instance.IncrementPlayerStat((PlayerStatType)76, 1f); } else { if (!HaveFuel()) { ((Character)character).Message((MessageType)2, m_hungryText, 0, (Sprite)null); return true; } if (!EnvMan.IsDaylight() && m_effectOnlyInDaylight) { ((Character)character).Message((MessageType)2, m_sleepText, 0, (Sprite)null); return true; } ((Character)character).Message((MessageType)2, m_happyText, 0, (Sprite)null); } return true; } public bool UseItem(Humanoid user, ItemData item) { if (item == null) { return false; } if (!IsItemAllowed(item)) { ((Character)user).Message((MessageType)2, "$msg_wrongitem", 0, (Sprite)null); return false; } if (GetFuel() > (float)(m_maxFuel - 1)) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); user.GetInventory().RemoveItem(item.m_shared.m_name, 1, -1, true); m_nview.InvokeRPC("RPC_AddFuel", Array.Empty()); return true; } public void Extract() { m_nview.InvokeRPC("RPC_ExtractFeathers", Array.Empty()); } public void RPC_ExtractFeathers(long caller) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) int featherAmount = GetFeatherAmount(); if (featherAmount <= 0) { return; } m_spawnEffect.Create(m_spawnPoint.position, Quaternion.identity, (Transform)null, 1f, -1); for (int i = 0; i < featherAmount; i++) { Vector2 val = Random.insideUnitCircle * 0.5f; Vector3 val2 = m_spawnPoint.position + new Vector3(val.x, 0.25f * (float)i, val.y); ItemDrop component = ((Component)Object.Instantiate(m_producedItem, val2, Quaternion.identity)).GetComponent(); if (component != null) { component.SetStack(Game.instance.ScaleDrops(m_producedItem.m_itemData, 1)); } } ResetLevel(); } public float GetTimeSinceLastUpdate() { if (!m_nview.IsValid()) { return 0f; } ZDO zDO = m_nview.GetZDO(); if (zDO == null) { return 0f; } DateTime time = ZNet.instance.GetTime(); long @long = zDO.GetLong(ZDOVars.s_lastTime, time.Ticks); DateTime dateTime = new DateTime(@long); TimeSpan timeSpan = time - dateTime; zDO.Set(ZDOVars.s_lastTime, time.Ticks); double num = timeSpan.TotalSeconds; if (num < 0.0) { num = 0.0; } return (float)num; } public void ResetLevel() { m_nview.GetZDO().Set(ZDOVars.s_level, 0, false); } public void IncreseLevel(int amount) { int featherAmount = GetFeatherAmount(); int num = Mathf.Clamp(featherAmount + amount, 0, m_producedItemAmount); m_nview.GetZDO().Set(ZDOVars.s_level, num, false); } public int GetFeatherAmount() { return m_nview.GetZDO().GetInt(ZDOVars.s_level, 0); } public void UpdateBirds() { if (!m_nview.IsOwner() || !HaveFuel()) { return; } float timeSinceLastUpdate = GetTimeSinceLastUpdate(); ZDO zDO = m_nview.GetZDO(); if (zDO == null) { return; } float num = zDO.GetFloat(ZDOVars.s_product, 0f) + timeSinceLastUpdate; if (num > m_secPerUnit) { int num2 = Mathf.FloorToInt(num / m_secPerUnit); if (num2 > 0) { ConsumeFuel(0.1f); IncreseLevel(num2); num %= m_secPerUnit; } } zDO.Set(ZDOVars.s_product, num); } private void OnDestroyed() { if (m_nview.IsOwner()) { DropAllItems(); } } private void DropAllItems() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_fuelItem == (Object)null)) { float num = 0f; if (m_nview.GetZDO() != null) { num = m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } int num2 = Mathf.FloorToInt(num); for (int i = 0; i < num2; i++) { Vector3 val = ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f; GameObject val2 = Object.Instantiate(((Component)m_fuelItem).gameObject, val, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f)); ItemDrop.OnCreateNew(val2); } } } private float GetFuel() { if (!m_nview.IsValid()) { return 0f; } return m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } private bool HaveFuel() { return GetFuel() > 0f; } private void SetFuel(float fuel) { if (m_nview.IsValid()) { float num = Mathf.Clamp(fuel, 0f, (float)m_maxFuel); m_nview.GetZDO().Set(ZDOVars.s_fuel, num); } } private void ConsumeFuel(float amount) { SetFuel(GetFuel() - amount); } private void ResetProductionProgress() { if (m_nview.IsValid()) { ZDO zDO = m_nview.GetZDO(); if (zDO != null) { DateTime time = ZNet.instance.GetTime(); zDO.Set(ZDOVars.s_lastTime, time.Ticks); zDO.Set(ZDOVars.s_product, 0f); } } } private void RPC_AddFuel(long sender) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (m_nview.IsOwner()) { float fuel = GetFuel(); if (!(fuel >= (float)m_maxFuel)) { SetFuel(fuel + 1f); ResetProductionProgress(); m_fuelAddedEffects.Create(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform, 1f, -1); } } } private bool IsItemAllowed(ItemData item) { return IsItemAllowed(((Object)item.m_dropPrefab).name); } private bool IsItemAllowed(string itemName) { return (Object)(object)m_fuelItem != (Object)null && ((Object)m_fuelItem).name == itemName; } } public class HerbPlanter : MonoBehaviour, Hoverable, Interactable { public enum Status { Empty, Growing, Blocked, Inactive, Ready } public bool m_requireDay = true; public bool m_requireNight = false; public Biome m_notInBiome = (Biome)68; public string m_name = "HerbPlanter"; public float m_fuelPerProduct = 1f; public float m_secPerUnit = 50f; public ItemDrop m_fuel; public int m_amount = 1; public List m_spawnItems = new List(); public Transform m_spawnPoint; public float m_tick = 5f; public float m_maxCover = 0.25f; public Transform m_coverPoint; public bool m_requiresRoof; public bool m_requireExpose; public EffectList m_fuelAddedEffects = new EffectList(); public EffectList m_produceEffects = new EffectList(); public GameObject m_enabledObject; public GameObject m_disabledObject; public GameObject m_haveFuelObject; public string m_wrongBiome = "$tag_wrong_biome_bal"; public string m_wrongTime = "$tag_wrong_time_bal"; public string m_missingRoof = "$tag_missing_roof_bal"; public string m_dontNeedRoof = "$tag_dont_need_roof_bal"; public string m_notEnoughCover = "$tag_wrongBiome_bal"; public string m_toMuchCover = "$tag_to_much_cover_bal"; public string m_growing = "$tag_growing_bal"; public string m_sproutSoon = "$tag_sproutSoon_bal"; public string m_missingFuel = "$tag_missingFuel_bal"; private Status status = Status.Empty; private bool m_exposed; private bool m_hasRoof; private ZNetView m_nview; private void Awake() { m_nview = ((Component)this).GetComponent(); if ((Object)(object)m_nview == (Object)null) { m_nview = ((Component)this).GetComponentInParent(); } if (!((Object)(object)m_nview == (Object)null) && m_nview.GetZDO() != null) { m_nview.Register("RPC_AddFuel", (Action)RPC_AddFuel); WearNTear component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.m_onDestroyed = (Action)Delegate.Combine(component.m_onDestroyed, new Action(OnDestroyed)); } if (m_tick < 1f) { m_tick = 1f; } ((MonoBehaviour)this).InvokeRepeating("UpdatePlanter", m_tick, m_tick); } } public string GetHoverText() { throw new NotImplementedException(); } public string GetHoverName() { throw new NotImplementedException(); } public bool UseItem(Humanoid user, ItemData item) { if (item == null) { item = FindCookableItem(user.GetInventory()); if (item == null) { ((Character)user).Message((MessageType)2, "$msg_noprocessableitems", 0, (Sprite)null); return false; } } if (((Object)item.m_dropPrefab).name != ((Object)m_fuel).name) { ((Character)user).Message((MessageType)2, "$msg_noprocessableitems", 0, (Sprite)null); return false; } ((Character)user).Message((MessageType)2, "$msg_added " + item.m_shared.m_name, 0, (Sprite)null); m_nview.InvokeRPC("RPC_AddFuel", Array.Empty()); user.GetInventory().RemoveItem(item, 1); return true; } private ItemData FindCookableItem(Inventory inventory) { ItemData item = inventory.GetItem(m_fuel.m_itemData.m_shared.m_name, -1, false); if (item != null) { return item; } return null; } public bool Interact(Humanoid user, bool hold, bool alt) { string text = CheckCover(); if (WillSpawnSoon()) { ((Character)user).Message((MessageType)2, m_sproutSoon, 0, (Sprite)null); } ((Character)user).Message((MessageType)2, text, 0, (Sprite)null); return true; } private bool WillSpawnSoon() { return GetStatus() == Status.Growing && m_nview.GetZDO().GetFloat(ZDOVars.s_product, 0f) + m_tick * 4f >= m_secPerUnit; } public void UpdatePlanter() { bool flag = CheckBiome(); bool flag2 = checkDayNightTime(); bool flag3 = UpdateCover(); if (flag3 || flag) { status = Status.Blocked; m_disabledObject.SetActive(true); m_enabledObject.SetActive(false); return; } m_disabledObject.SetActive(false); if (!HasFuel()) { status = Status.Empty; m_haveFuelObject.SetActive(false); m_enabledObject.SetActive(false); return; } m_haveFuelObject.SetActive(true); if (!flag2) { status = Status.Inactive; return; } m_enabledObject.SetActive(true); status = Status.Growing; float num = m_nview.GetZDO().GetFloat(ZDOVars.s_product, 0f) + m_tick; m_nview.GetZDO().Set(ZDOVars.s_product, num); if (Sprout()) { status = Status.Ready; SpawnItem(); } } private bool Sprout() { if (GetStatus() != Status.Growing) { return false; } float @float = m_nview.GetZDO().GetFloat(ZDOVars.s_product, 0f); if (@float >= m_secPerUnit) { return true; } return false; } private void SpawnItem() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (GetStatus() == Status.Ready) { m_produceEffects.Create(((Component)m_spawnPoint).transform.position, Quaternion.identity, (Transform)null, 1f, -1); ItemDrop randomItem = getRandomItem(); Vector3 val = m_spawnPoint.position + Vector3.up; for (int i = 1; i < m_amount; i++) { ItemDrop.OnCreateNew(Object.Instantiate(randomItem, val, Quaternion.identity)); } SetFuel(GetFuel() - m_fuelPerProduct); m_nview.GetZDO().Set(ZDOVars.s_product, 0, false); status = Status.Growing; } } 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 bool HasFuel() { return GetFuel() > 0f; } private float GetFuel() { return (!m_nview.IsValid()) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); } private void SetFuel(float fuel) { if (m_nview.IsValid()) { m_nview.GetZDO().Set(ZDOVars.s_fuel, fuel); } } private bool UpdateCover() { string text = CheckCover(); if (text != "OK") { return false; } return true; } private string CheckCover() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) float num = default(float); bool hasRoof = default(bool); Cover.GetCoverForPoint(m_coverPoint.position, ref num, ref hasRoof, 0.5f); m_exposed = (double)num < (double)m_maxCover; m_hasRoof = hasRoof; if (CheckBiome()) { return "Wont grow in this biome"; } if (m_requiresRoof && !m_hasRoof) { return "Require Roof"; } if (!m_requiresRoof && m_hasRoof) { return "Can't be covered"; } if (!m_requireExpose && m_exposed) { return "Require Cover"; } if (m_requireExpose && !m_exposed) { return "Require Exposure"; } return "OK"; } public Status GetStatus() { return status; } private ItemDrop getRandomItem() { int index = Random.Range(0, m_spawnItems.Count - 1); return m_spawnItems[index]; } private bool CheckBiome() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Heightmap.FindBiome(((Component)this).transform.position) == m_notInBiome; } private bool checkDayNightTime() { if (EnvMan.IsDaylight() && m_requireDay) { return true; } if (!EnvMan.IsDaylight() && !m_requireNight) { return true; } return false; } private void OnDestroyed() { if (m_nview.IsOwner()) { DropAllItems(); } } private void DropAllItems() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0092: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_fuel != (Object)null) { float num = ((m_nview.GetZDO() == null) ? 0f : m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f)); for (int i = 0; i < (int)num; i++) { ItemDrop.OnCreateNew(Object.Instantiate(((Component)m_fuel).gameObject, ((Component)this).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f))); } } } } public class NatureSpawner : MonoBehaviour { public static List plantSeeders = new List(); public const float dt = 2f; public GameObject m_prefab; public float m_spawnIntervalSec = 600f; public float m_triggerDistance = 200f; public float m_spawnRadius = 80f; public float m_nearRadius = 25f; public float m_farRadius = 100f; public int m_maxNear = 2; public int m_maxTotal = 6; public bool m_onGroundOnly = true; public EffectList m_spawnEffects = new EffectList(); public ZNetView m_nview; public float m_spawnTimer; public void Awake() { m_nview = ((Component)this).GetComponent(); m_spawnIntervalSec = Random.Range(300, 600); m_triggerDistance = Random.Range(300, 600); m_spawnRadius = m_triggerDistance * 0.8f; m_farRadius = m_triggerDistance; m_nearRadius = m_triggerDistance / 4f; ((MonoBehaviour)this).InvokeRepeating("UpdateSpawn", 10f, 10f); } public double TimeSincePlanted() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks)); return (ZNet.instance.GetTime() - dateTime).TotalSeconds; } public void UpdateSpawn() { //IL_0019: 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) if (m_nview.IsOwner() && !ZNetScene.instance.OutsideActiveArea(((Component)this).transform.position) && Player.IsPlayerInRange(((Component)this).transform.position, m_triggerDistance)) { m_spawnTimer += 10f; if (!((double)m_spawnTimer <= (double)m_spawnIntervalSec)) { m_spawnTimer = 0f; SpawnOne(); } } } public bool SpawnOne() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_prefab == (Object)null) { Debug.Log((object)("Prefab is null on tree: " + ((Object)((Component)this).gameObject).name)); return false; } GetInstances(out var near, out var total); if (near >= m_maxNear || total >= m_maxTotal) { return false; } if ((Object)(object)m_prefab == (Object)null || !FindSpawnPoint(m_prefab, out var point)) { return false; } GameObject val = Object.Instantiate(m_prefab, point, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f)); plantSeeders = plantSeeders.FindAll((PlantSeeder x) => (Object)(object)x != (Object)null); return true; } public bool FindSpawnPoint(GameObject prefab, out Vector3 point) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) prefab.GetComponent(); float num = default(float); for (int i = 0; i < 10; i++) { Vector3 val = ((Component)this).transform.position + Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f) * Vector3.forward * Random.Range(0f, m_spawnRadius); if (ZoneSystem.instance.FindFloor(val, ref num) && (!m_onGroundOnly || !ZoneSystem.instance.IsBlocked(val))) { val.y = num + 0.1f; point = val; return true; } } point = Vector3.zero; return false; } public void GetInstances(out int near, out int total) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) near = 0; total = 0; Vector3 position = ((Component)this).transform.position; foreach (PlantSeeder plantSeeder in plantSeeders) { if (!((Object)(object)plantSeeder == (Object)null) && IsSpawnPrefab(plantSeeder)) { double num = Utils.DistanceXZ(((Component)plantSeeder).transform.position, position); if (num < (double)m_nearRadius) { near++; } if (num < (double)m_farRadius) { total++; } } } } public bool IsSpawnPrefab(PlantSeeder go) { if ((Object)(object)go == (Object)null) { return false; } string name = ((Object)go).name; if (Utils.CustomStartsWith(name, ((Object)m_prefab).name)) { return true; } return false; } public void OnDrawGizmosSelected() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position, m_spawnRadius); Gizmos.color = Color.yellow; Gizmos.DrawWireSphere(((Component)this).transform.position, m_nearRadius); } } public class PlantSeeder : SlowUpdate { public GameObject m_prefabToGrow; public float m_growTime = 3600f; public float m_growTimeMax = 6000f; public float m_minScale = 0.75f; public float m_maxScale = 1.25f; public float m_growRadius = 0.5f; public ZNetView m_nview; public float m_updateTime; public float m_spawnTime; public int m_seed; public string m_name = "PlantSeeder"; public bool m_destroyIfCantGrow; public EffectList m_growEffect = new EffectList(); public override void Awake() { ((SlowUpdate)this).Awake(); m_nview = ((Component)this).gameObject.GetComponent(); if (m_nview.GetZDO() != null) { m_seed = m_nview.GetZDO().GetInt(ZDOVars.s_seed, 0); if (m_seed == 0) { m_seed = (int)(((ZDOID)(ref m_nview.GetZDO().m_uid)).ID + ((ZDOID)(ref m_nview.GetZDO().m_uid)).UserID); m_nview.GetZDO().Set(ZDOVars.s_seed, m_seed, true); } if (m_nview.IsOwner() && m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, 0L) == 0) { m_nview.GetZDO().Set(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks); } m_spawnTime = Time.time; NatureSpawner.plantSeeders.Add(this); } } public double TimeSincePlanted() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks)); return (ZNet.instance.GetTime() - dateTime).TotalSeconds; } public GameObject Grow() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) GameObject prefabToGrow = m_prefabToGrow; Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; Vector3 val = position; Quaternion val2 = rotation; GameObject val3 = Object.Instantiate(prefabToGrow, val, val2); Plant component = val3.GetComponent(); component.m_destroyIfCantGrow = true; component.m_growRadius = 1f; ZLog.Log((object)("Starting to grow plant- " + ((Object)prefabToGrow).name + " -with rotation: " + ((object)(Quaternion)(ref rotation)).ToString())); ZNetView component2 = val3.GetComponent(); float num = Random.Range(m_minScale, m_maxScale); Vector3 localScale = default(Vector3); ((Vector3)(ref localScale))..ctor(num, num, num); component2.SetLocalScale(localScale); if (Object.op_Implicit((Object)(object)m_nview)) { NatureSpawner.plantSeeders.Remove(this); m_growEffect.Create(((Component)this).transform.position, rotation, (Transform)null, num, -1); m_nview.Destroy(); } return val3; } public float GetGrowTime() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) State state = Random.state; Random.InitState(m_seed); float value = Random.value; Random.state = state; return Mathf.Lerp(m_growTime, m_growTimeMax, value); } } public class TerrainMover : MonoBehaviour { private void Awake() { Transform parent = ((Component)this).transform.parent; if ((Object)(object)parent != (Object)null) { Transform parent2 = parent.parent; ((Component)this).transform.parent = parent2; } Object.DestroyImmediate((Object)(object)this); } } public class TreeBeeSpawner : MonoBehaviour { public GameObject m_prefab; public TreeBase m_treeBase; public ZNetView m_nview; public int m_chance = 90; public int m_spawnIntervalSec = 20; public float offsetX = 0f; public float offsetY = 0f; public float offsetZ = 0f; public float m_spawnTimer; public GameObject m_spawnOnDamage; private GameObject m_hive; private EffectData m_effectData; public bool m_hasFollen = false; public void Awake() { m_nview = ((Component)this).GetComponent(); m_treeBase = ((Component)this).GetComponent(); ((MonoBehaviour)this).InvokeRepeating("UpdateSpawn", 10f, 10f); m_spawnIntervalSec = Random.Range(120, 240); if ((Object)(object)m_prefab != (Object)null) { SpawnOnDamaged component = m_prefab.GetComponent(); if ((Object)(object)component != (Object)null) { m_spawnOnDamage = component.m_spawnOnDamage; } } AddBeeAoEToHit(); } public double TimeSincePlanted() { DateTime dateTime = new DateTime(m_nview.GetZDO().GetLong(ZDOVars.s_plantTime, ZNet.instance.GetTime().Ticks)); return (ZNet.instance.GetTime() - dateTime).TotalSeconds; } public void Damage(HitData hit) { m_nview.InvokeRPC("RPC_Damage", new object[1] { hit }); } public void UpdateSpawn() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_hive == (Object)null) { toggleActive(active: false); } if (m_nview.IsOwner() && !ZNetScene.instance.OutsideActiveArea(((Component)this).transform.position)) { m_spawnTimer += 10f; if (!((double)m_spawnTimer <= (double)m_spawnIntervalSec)) { m_spawnTimer = 0f; SpawnOne(); } } } public bool SpawnOne() { if ((Object)(object)m_prefab == (Object)null || (Object)(object)m_hive != (Object)null) { return false; } int num = Random.Range(1, 100); if (num <= m_chance) { spawnHive(); } return true; } public void hiveFall() { if ((Object)(object)m_hive != (Object)null && !m_hasFollen) { m_hive.GetComponent().m_fall = true; m_hive.GetComponent().m_noSupportWear = false; m_hasFollen = true; } } public bool HasHive() { return (Object)(object)m_hive != (Object)null; } private void spawnHive() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate(m_prefab, m_treeBase.m_logSpawnPoint.position, Quaternion.Euler(0f, 90f, 0f)); StaticPhysics val2 = val.AddComponent(); val2.m_fall = false; val2.m_pushUp = true; toggleActive(active: true); m_hive = val; } private void toggleActive(bool active) { if (m_effectData != null) { m_effectData.m_enabled = active; } } private void AddBeeAoEToHit() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown if ((Object)(object)m_spawnOnDamage != (Object)null) { m_effectData = new EffectData(); m_effectData.m_prefab = m_spawnOnDamage; m_effectData.m_enabled = true; m_effectData.m_variant = -1; CollectionExtensions.AddItem((IEnumerable)m_treeBase.m_hitEffect.m_effectPrefabs, m_effectData); } } } public static class BalrondConverterInstaller { public const string SAWMILL_PREFAB = "piece_sawmill_bal"; public const string TANNING_PREFAB = "piece_leatherRack_bal"; public const string STONEKILN_PREFAB = "StoneboundKiln_bal"; public const string SAWMILL_FUEL_PREFAB = "SawBlade_bal"; public const string TANNING_FUEL_PREFAB = "PatchworkBundle_bal"; public const string STONEKILN_FUEL_PREFAB = "SurtlingCore"; public const string STONEKILN_WOOD_PREFAB = "WoodBundle_bal"; public const string STONEKILN_CLAY_PREFAB = "ClayBundle_bal"; private const int SAWMILL_MAX_FUEL_ITEMS = 1; private const int SAWMILL_USES_PER_FUEL_ITEM = 100; private const int SAWMILL_MAX_ORE = 10; private const float SAWMILL_DEFAULT_SECONDS = 60f; private const int STONEKILN_MAX_FUEL_ITEMS = 0; private const int STONEKILN_USES_PER_FUEL_ITEM = 100; private const int STONEKILN_MAX_ORE = 40; private const float STONEKILN_DEFAULT_SECONDS = 60f; private const int TANNING_MAX_FUEL_ITEMS = 25; private const int TANNING_USES_PER_FUEL_ITEM = 1; private const int TANNING_MAX_ORE = 5; private const float TANNING_DEFAULT_SECONDS = 60f; public static void SetBalrondConverter(ZNetScene zNetScene) { if ((Object)(object)zNetScene == (Object)null || zNetScene.m_prefabs == null) { Debug.LogWarning((object)"[Balrond] ZNetScene or prefabs list is null; cannot set up converters."); return; } GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "SawBlade_bal"); GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "PatchworkBundle_bal"); Dictionary prefabsByName = BuildPrefabMap(zNetScene.m_prefabs); SetupOneConverter(prefabsByName, zNetScene, "piece_sawmill_bal", ApplySawmillDefaults); SetupOneConverter(prefabsByName, zNetScene, "piece_leatherRack_bal", ApplyTanningDefaults); SetupOneConverter(prefabsByName, zNetScene, "StoneboundKiln_bal", ApplyStoneboudnKilnlDefaults); } private static Dictionary BuildPrefabMap(List prefabs) { Dictionary dictionary = new Dictionary(StringComparer.Ordinal); for (int i = 0; i < prefabs.Count; i++) { GameObject val = prefabs[i]; if (!((Object)(object)val == (Object)null) && !dictionary.ContainsKey(((Object)val).name)) { dictionary.Add(((Object)val).name, val); } } return dictionary; } private static void SetupOneConverter(Dictionary prefabsByName, ZNetScene zNetScene, string stationPrefabName, Action> applyDefaults) { if (!prefabsByName.TryGetValue(stationPrefabName, out var value) || (Object)(object)value == (Object)null) { Debug.LogWarning((object)("[Balrond] Station prefab '" + stationPrefabName + "' not found in ZNetScene.m_prefabs.")); return; } if ((Object)(object)value.GetComponent() != (Object)null) { Debug.Log((object)("[Balrond] BalrondConverter already present on '" + stationPrefabName + "', skipping.")); return; } Smelter component = value.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("[Balrond] Station prefab '" + stationPrefabName + "' has no Smelter component to transfer from.")); return; } Debug.Log((object)("[Balrond] Installing BalrondConverter on '" + stationPrefabName + "'")); TransferSmelterToBalrondConverter(value, component, prefabsByName, stationPrefabName, zNetScene, applyDefaults); } private static void TransferSmelterToBalrondConverter(GameObject stationPrefab, Smelter smelter, Dictionary prefabsByName, string stationPrefabName, ZNetScene zNetScene, Action> applyDefaults) { BalrondConverter balrondConverter = stationPrefab.AddComponent(); GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "SawBlade_bal"); GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "SurtlingCore"); GameObject val3 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "PatchworkBundle_bal"); if (stationPrefabName == "piece_leatherRack_bal") { balrondConverter.m_fuelItem = val3.GetComponent(); } if (stationPrefabName == "piece_sawmill_bal") { balrondConverter.m_fuelItem = val.GetComponent(); } if (stationPrefabName == "StoneboundKiln_bal") { balrondConverter.m_fuelItem = val2.GetComponent(); } balrondConverter.m_addOreAnimationDuration = 0f; balrondConverter.m_addOreSwitch = smelter.m_addOreSwitch; balrondConverter.m_addOreTooltip = smelter.m_addOreTooltip; balrondConverter.m_addWoodSwitch = smelter.m_addWoodSwitch; balrondConverter.m_emptyOreSwitch = smelter.m_emptyOreSwitch; balrondConverter.m_emptyOreTooltip = smelter.m_emptyOreTooltip; balrondConverter.m_animators = smelter.m_animators; balrondConverter.m_enabledObject = smelter.m_enabledObject; balrondConverter.m_disabledObject = smelter.m_disabledObject; balrondConverter.m_haveFuelObject = smelter.m_haveFuelObject; balrondConverter.m_haveOreObject = smelter.m_haveOreObject; balrondConverter.m_noOreObject = smelter.m_noOreObject; balrondConverter.m_outputPoint = smelter.m_outputPoint; balrondConverter.m_roofCheckPoint = smelter.m_roofCheckPoint; balrondConverter.m_requiresRoof = smelter.m_requiresRoof; balrondConverter.m_windmill = smelter.m_windmill; balrondConverter.m_smokeSpawner = smelter.m_smokeSpawner; balrondConverter.m_spawnStack = smelter.m_spawnStack; balrondConverter.m_oreAddedEffects = smelter.m_oreAddedEffects; balrondConverter.m_fuelAddedEffects = smelter.m_fuelAddedEffects; balrondConverter.m_produceEffects = smelter.m_produceEffects; balrondConverter.m_name = smelter.m_name; balrondConverter.m_defaultSecPerProduct = ((smelter.m_secPerProduct > 0f) ? smelter.m_secPerProduct : 60f); Object.DestroyImmediate((Object)(object)smelter); applyDefaults?.Invoke(balrondConverter, prefabsByName); balrondConverter.prefabName = stationPrefabName; } private static void DebugFuel(BalrondConverter conv, string fuelItem) { if (conv.m_maxFuel > 0 && (Object)(object)conv.m_fuelItem == (Object)null) { Debug.LogWarning((object)("[Balrond] " + fuelItem + " fuel item not found." + conv.m_name + " will not accept fuel.")); } } private static void ApplySawmillDefaults(BalrondConverter conv, Dictionary prefabsByName) { conv.m_maxFuel = 1; conv.m_usesPerBlade = 100; conv.m_maxOre = 10; conv.m_defaultSecPerProduct = 60f; conv.m_addOreTooltip = "$tag_sawmill_addWood"; conv.m_emptyOreTooltip = "$tag_sawmill_pickupWood"; DebugFuel(conv, "SawBlade_bal"); } private static void ApplyStoneboudnKilnlDefaults(BalrondConverter conv, Dictionary prefabsByName) { conv.m_maxFuel = 0; conv.m_usesPerBlade = 100; conv.m_maxOre = 40; conv.m_defaultSecPerProduct = 60f; DebugFuel(conv, "SurtlingCore"); } private static void ApplyTanningDefaults(BalrondConverter conv, Dictionary prefabsByName) { conv.m_maxFuel = 25; conv.m_usesPerBlade = 1; conv.m_maxOre = 5; conv.m_defaultSecPerProduct = 60f; conv.m_addOreTooltip = "$tag_leatherrack_addLeather"; conv.m_emptyOreTooltip = "$tag_leatherrack_pickupLeather"; DebugFuel(conv, "PatchworkBundle_bal"); } } public class DatabaseAddMethods { public void AddItems(List items) { foreach (GameObject item in items) { AddItem(item); } } public void AddRecipes(List recipes) { foreach (Recipe recipe in recipes) { AddRecipe(recipe); } } public void AddStatuseffects(List statusEffects) { foreach (StatusEffect statusEffect in statusEffects) { AddStatus(statusEffect); } } private bool IsObjectDBValid() { return (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items.Count != 0 && ObjectDB.instance.m_recipes.Count != 0 && (Object)(object)ObjectDB.instance.GetItemPrefab("Amber") != (Object)null; } private void AddStatus(StatusEffect status) { if (!IsObjectDBValid()) { return; } if ((Object)(object)status != (Object)null) { if ((Object)(object)ObjectDB.instance.GetStatusEffect(status.m_nameHash) == (Object)null) { ObjectDB.instance.m_StatusEffects.Add(status); } } else { Debug.LogError((object)(Launch.projectName + ": " + ((Object)status).name + " - Status not found")); } } private void AddRecipe(Recipe recipe) { if (!IsObjectDBValid()) { return; } if ((Object)(object)recipe != (Object)null) { if ((Object)(object)ObjectDB.instance.m_recipes.Find((Recipe x) => ((Object)x).name == ((Object)recipe).name) == (Object)null && (Object)(object)recipe.m_item != (Object)null) { ObjectDB.instance.m_recipes.Add(recipe); } } else { Debug.LogError((object)(Launch.projectName + ": " + ((Object)recipe).name + " - Recipe not found")); } } private void AddItem(GameObject newPrefab) { if (!IsObjectDBValid() || (Object)(object)newPrefab == (Object)null) { return; } ItemDrop component = newPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemDrop not found on prefab")); return; } if (component.m_itemData == null || component.m_itemData.m_shared == null) { Debug.LogError((object)(Launch.projectName + ": " + ((Object)newPrefab).name + " - ItemData or SharedData is null")); return; } ObjectDB instance = ObjectDB.instance; if (!instance.m_items.Contains(newPrefab)) { instance.m_items.Add(newPrefab); } instance.m_itemByHash[StringExtensionMethods.GetStableHashCode(((Object)newPrefab).name)] = newPrefab; instance.m_itemByData[component.m_itemData.m_shared] = newPrefab; } } public class FxReplacment { public void ReplaceOnObject(GameObject gameObject, ZNetScene zNetScene) { if ((Object)(object)gameObject == (Object)null) { return; } SpawnArea component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { EffectList spawnEffects = component.m_spawnEffects; if (spawnEffects != null) { findEffectsAndChange(spawnEffects.m_effectPrefabs, zNetScene); } } Destructible component2 = gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { EffectList hitEffect = component2.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = component2.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } Projectile component3 = gameObject.GetComponent(); if ((Object)(object)component3 != (Object)null) { EffectList hitEffects = component3.m_hitEffects; if (hitEffects != null) { findEffectsAndChange(hitEffects.m_effectPrefabs, zNetScene); } EffectList hitWaterEffects = component3.m_hitWaterEffects; if (hitWaterEffects != null) { findEffectsAndChange(hitWaterEffects.m_effectPrefabs, zNetScene); } EffectList spawnOnHitEffects = component3.m_spawnOnHitEffects; if (spawnOnHitEffects != null) { findEffectsAndChange(spawnOnHitEffects.m_effectPrefabs, zNetScene); } } } public void ReplaceOnVegetation(GameObject gameObject, ZNetScene zNetScene) { Pickable component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { fixPlant(component, zNetScene); } Destructible component2 = gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { fixPDestructable(component2, zNetScene); } MineRock5 component3 = gameObject.GetComponent(); if ((Object)(object)component3 != (Object)null) { fixMineRock5(component3, zNetScene); } MineRock component4 = gameObject.GetComponent(); if ((Object)(object)component4 != (Object)null) { fixMineRock(component4, zNetScene); } } private void fixPlant(Pickable pickable, ZNetScene zNetScene) { EffectList pickEffector = pickable.m_pickEffector; if (pickEffector != null) { findEffectsAndChange(pickEffector.m_effectPrefabs, zNetScene); } } private void fixPDestructable(Destructible minerock5, ZNetScene zNetScene) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } private void fixMineRock5(MineRock5 minerock5, ZNetScene zNetScene) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } private void fixMineRock(MineRock minerock5, ZNetScene zNetScene) { EffectList hitEffect = minerock5.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList destroyedEffect = minerock5.m_destroyedEffect; if (destroyedEffect != null) { findEffectsAndChange(destroyedEffect.m_effectPrefabs, zNetScene); } } public void ReplaceOnMonster(GameObject gameObject, ZNetScene zNetScene) { if ((Object)(object)gameObject == (Object)null) { Debug.LogWarning((object)(Launch.projectName + ":: GameObject not found")); return; } Humanoid component = gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)(Launch.projectName + ":: GameObject not found")); return; } EffectList dropEffects = component.m_dropEffects; if (dropEffects != null) { findEffectsAndChange(dropEffects.m_effectPrefabs, zNetScene); } EffectList backstabHitEffects = ((Character)component).m_backstabHitEffects; if (backstabHitEffects != null) { findEffectsAndChange(backstabHitEffects.m_effectPrefabs, zNetScene); } EffectList consumeItemEffects = component.m_consumeItemEffects; if (consumeItemEffects != null) { findEffectsAndChange(consumeItemEffects.m_effectPrefabs, zNetScene); } EffectList critHitEffects = ((Character)component).m_critHitEffects; if (critHitEffects != null) { findEffectsAndChange(critHitEffects.m_effectPrefabs, zNetScene); } EffectList deathEffects = ((Character)component).m_deathEffects; if (deathEffects != null) { findEffectsAndChange(deathEffects.m_effectPrefabs, zNetScene); } EffectList hitEffects = ((Character)component).m_hitEffects; if (hitEffects != null) { findEffectsAndChange(hitEffects.m_effectPrefabs, zNetScene); } EffectList jumpEffects = ((Character)component).m_jumpEffects; if (jumpEffects != null) { findEffectsAndChange(jumpEffects.m_effectPrefabs, zNetScene); } EffectList perfectBlockEffect = component.m_perfectBlockEffect; if (perfectBlockEffect != null) { findEffectsAndChange(perfectBlockEffect.m_effectPrefabs, zNetScene); } EffectList pickupEffects = component.m_pickupEffects; if (pickupEffects != null) { findEffectsAndChange(pickupEffects.m_effectPrefabs, zNetScene); } EffectList slideEffects = ((Character)component).m_slideEffects; if (slideEffects != null) { findEffectsAndChange(slideEffects.m_effectPrefabs, zNetScene); } EffectList tarEffects = ((Character)component).m_tarEffects; if (tarEffects != null) { findEffectsAndChange(tarEffects.m_effectPrefabs, zNetScene); } EffectList waterEffects = ((Character)component).m_waterEffects; if (waterEffects != null) { findEffectsAndChange(waterEffects.m_effectPrefabs, zNetScene); } FootStep component2 = gameObject.GetComponent(); if (!((Object)(object)component2 != (Object)null)) { return; } List effects = component2.m_effects; foreach (StepEffect item in effects) { GameObject[] effectPrefabs = item.m_effectPrefabs; List list = new List(); list.AddRange(effectPrefabs); for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] != (Object)null) { string name = ((Object)list[i]).name; GameObject val = ZNetScene.instance.m_prefabs.Find((GameObject x) => ((Object)x).name == name); if (!((Object)(object)val == (Object)null)) { list[i] = val; } } } } } public void ReplaceOnItem(GameObject gameObject, ZNetScene zNetScene) { if ((Object)(object)gameObject == (Object)null) { return; } ItemDrop component = gameObject.GetComponent(); if (!((Object)(object)component == (Object)null)) { EffectList hitEffect = component.m_itemData.m_shared.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } EffectList hitTerrainEffect = component.m_itemData.m_shared.m_hitTerrainEffect; if (hitTerrainEffect != null) { findEffectsAndChange(hitTerrainEffect.m_effectPrefabs, zNetScene); } EffectList holdStartEffect = component.m_itemData.m_shared.m_holdStartEffect; if (holdStartEffect != null) { findEffectsAndChange(holdStartEffect.m_effectPrefabs, zNetScene); } EffectList trailStartEffect = component.m_itemData.m_shared.m_trailStartEffect; if (trailStartEffect != null) { findEffectsAndChange(trailStartEffect.m_effectPrefabs, zNetScene); } EffectList blockEffect = component.m_itemData.m_shared.m_blockEffect; if (blockEffect != null) { findEffectsAndChange(blockEffect.m_effectPrefabs, zNetScene); } } } public void ReplaceFxOnPiece(GameObject gameObject, ZNetScene zNetScene) { if ((Object)(object)gameObject == (Object)null) { return; } Piece component = gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { EffectList placeEffect = component.m_placeEffect; if (placeEffect != null) { findEffectsAndChange(placeEffect.m_effectPrefabs, zNetScene); } } WearNTear component2 = gameObject.GetComponent(); if ((Object)(object)component2 != (Object)null) { EffectList hitEffect = component2.m_hitEffect; if (hitEffect != null) { findEffectsAndChange(hitEffect.m_effectPrefabs, zNetScene); } } } private void findEffectsAndChange(EffectData[] effects, ZNetScene zNetScene) { if (effects == null || effects.Length == 0) { return; } foreach (EffectData val in effects) { if ((Object)(object)val.m_prefab != (Object)null) { string name = ((Object)val.m_prefab).name; GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => (Object)(object)x != (Object)null && ((Object)x).name == name); if ((Object)(object)val2 != (Object)null) { val.m_prefab = val2; } else { Debug.LogWarning((object)("Coulnt not find in Znet fx name:" + name)); } } } } } public class ModResourceLoader { public AssetBundle assetBundle; public List buildPrefabs = new List(); public List plantPrefabs = new List(); public List itemPrefabs = new List(); public List monsterPrefabs = new List(); public List vegetationPrefabs = new List(); public List clutterPrefabs = new List(); public List locationPrefabs = new List(); public List roomPrefabs = new List(); public List vfxPrefabs = new List(); public List backgrounds = new List(); public List minimapIcons = new List(); public FxReplacment fxReplacment = new FxReplacment(); public List recipes = new List(); public List statusEffects = new List(); public VegetationDropFix vegetationDropFix = new VegetationDropFix(); public StatusEffect newBarleyStatus = null; public ShaderReplacment shaderReplacment = new ShaderReplacment(); public StatusEffect waterproof; public Sprite newLogo = null; public static Sprite scrapCopper; public static Sprite ironNails; public void loadAssets() { assetBundle = GetAssetBundleFromResources("balrondnature"); string text = "Assets/Custom/BalrondNature/"; string text2 = ".png"; string text3 = text + "icons/"; scrapCopper = assetBundle.LoadAsset(text3 + "scrapCopperIco_bal" + text2); ironNails = assetBundle.LoadAsset(text3 + "ironNailsIco_bal" + text2); StatusEffectFactory.waterProofIco = assetBundle.LoadAsset(text3 + "wateproof_ico" + text2); StatusEffectFactory.tiredIcon = assetBundle.LoadAsset(text3 + "resting_ico" + text2); StatusEffectFactory.awakeIcon = assetBundle.LoadAsset(text3 + "resting_ico1" + text2); StatusEffectFactory.ScorchedIcon = assetBundle.LoadAsset(text3 + "status_scorched_ico" + text2); StatusEffectFactory.ChilledIcon = assetBundle.LoadAsset(text3 + "status_chilled_ico" + text2); StatusEffectFactory.EnfeebledIcon = assetBundle.LoadAsset(text3 + "status_enfeebled_ico" + text2); StatusEffectFactory.StaticChargeIcon = assetBundle.LoadAsset(text3 + "status_staticcharged_ico" + text2); StatusEffectFactory.SoulSappedIcon = assetBundle.LoadAsset(text3 + "status_soulsapped_ico" + text2); StatusEffectFactory.FracturedIcon = assetBundle.LoadAsset(text3 + "status_fractured_ico" + text2); StatusEffectFactory.LaceratedIcon = assetBundle.LoadAsset(text3 + "status_lancerate_ico" + text2); StatusEffectFactory.PuncturedIcon = assetBundle.LoadAsset(text3 + "status_punctured_ico" + text2); StatusEffectFactory.FirstAidKitIcon = assetBundle.LoadAsset(text3 + "status_firstaid_ico" + text2); StatusEffectFactory.BleedingIcon = assetBundle.LoadAsset(text3 + "status_bleeding_ico" + text2); StatusEffectFactory.SickIcon = assetBundle.LoadAsset(text3 + "status_sick_ico" + text2); StatusEffectFactory.FreezingWaterIcon = StatusEffectFactory.ChilledIcon; loadPieces(text); loadPlants(text); loadItems(text); loadVegetation(text); loadLocations(text); loadClutter(text); loadOther(text); loadBackground(text); prepareOtherEffects(text); } public void AddPrefabsToZnetScene(ZNetScene zNetScene) { List> list = new List> { itemPrefabs, plantPrefabs, vfxPrefabs, buildPrefabs, locationPrefabs, vegetationPrefabs, clutterPrefabs, monsterPrefabs }; foreach (List item in list) { validateAddedPrefabs(item, zNetScene); } zNetScene.m_prefabs.RemoveAll((GameObject x) => (Object)(object)x == (Object)null); } private void prepareOtherEffects(string mainPath) { string[] array = new string[26] { "BeltSailor", "BeltAssasin", "BeltVidar", "BeltForester", "BetlMountain", "MythicHammer", "BuffBear_bal", "BuffBoar_bal", "BuffCrow_bal", "BuffDeer_bal", "BuffSerpent_bal", "BuffDrake_bal", "BuffWolf_bal", "BuffLeech_bal", "BuffLox_bal", "BuffFox_bal", "SE_WellFed_bal", "SE_JustFed_bal", "SE_Fed_bal", "SE_Hungry_bal", "SE_FoodPoison_bal", "SE_WellSlept_bal", "SE_NoSleep_bal", "SE_ColdDay_bal", "SE_Soaked_bal", "SE_Shivering_bal" }; string[] array2 = array; foreach (string text in array2) { StatusEffect val = (StatusEffect)(object)assetBundle.LoadAsset(mainPath + "Status/" + text + ".asset"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Status not found: " + text)); } else { statusEffects.Add(val); } } StatusEffect item = (StatusEffect)(object)ScriptableObject.CreateInstance(); statusEffects.Add(item); SE_SpawnItemDropOnConsume sE_SpawnItemDropOnConsume = ScriptableObject.CreateInstance(); ((Object)sE_SpawnItemDropOnConsume).name = "EmptyJugDrop"; ((StatusEffect)sE_SpawnItemDropOnConsume).m_name = "$tag_emptyJugSpawnStatus"; ((StatusEffect)sE_SpawnItemDropOnConsume).m_ttl = 1f; statusEffects.Add((StatusEffect)(object)sE_SpawnItemDropOnConsume); StatusEffectFactory.initAllStatus(statusEffects); } public void setSpawnStatusOnItem(GameObject gameObject, StatusEffect statusEffect) { if ((Object)(object)gameObject == (Object)null) { Debug.LogWarning((object)"Item Not Found on list!"); } else { gameObject.GetComponent().m_itemData.m_shared.m_consumeStatusEffect = statusEffect; } } private void validateAddedPrefabs(List list, ZNetScene zNetScene) { foreach (GameObject item in list) { if (zNetScene.m_namedPrefabs.ContainsKey(BalrondHashCompat.StableHash(((Object)item).name))) { Debug.LogWarning((object)("DUPLICATE: " + ((Object)item).name)); } else { zNetScene.m_prefabs.Add(item); } } } private void loadBackground(string mainPath) { string[] array = new string[5] { "ashlands1.jpg", "ashlands2.png", "blackforest.png", "mistlands.jpg", "meadows.png" }; string[] array2 = array; foreach (string text in array2) { Sprite val = assetBundle.LoadAsset(mainPath + "screens/" + text); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find background with name: " + text)); } else { backgrounds.Add(val); } } } private GameObject FindPrefabInZnet(string name, ZNetScene zNetScene) { GameObject value = null; zNetScene.m_namedPrefabs.TryGetValue(BalrondHashCompat.StableHash(name), out value); if ((Object)(object)value == (Object)null) { value = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name); } return value; } public void setupBuildPiecesList(ZNetScene zNetScene) { string[] array = new string[5] { "Hammer", "HammerIron_bal", "HammerDverger_bal", "HammerBlackmetal_bal", "HammerMythic_bal" }; GameObject val = FindPrefabInZnet("Hammer", zNetScene); PieceTable buildPieces = val.GetComponent().m_itemData.m_shared.m_buildPieces; string[] array2 = array; foreach (string name in array2) { addTableToTool(name, buildPieces, zNetScene); } List pieces = buildPieces.m_pieces; foreach (GameObject buildPrefab in buildPrefabs) { setupRavenGuide(buildPrefab, zNetScene); AddToBuildList(buildPrefab, pieces); } GameObject val2 = FindPrefabInZnet("Hoe", zNetScene); PieceTable buildPieces2 = val2.GetComponent().m_itemData.m_shared.m_buildPieces; addTableToTool("BlackMetalHoe_bal", buildPieces2, zNetScene); GameObject val3 = FindPrefabInZnet("Cultivator", zNetScene); PieceTable buildPieces3 = val3.GetComponent().m_itemData.m_shared.m_buildPieces; addTableToTool("BlackMetalCultivator_bal", buildPieces3, zNetScene); } private void addTableToTool(string name, PieceTable pieceTable, ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name); if (!((Object)(object)val == (Object)null)) { val.GetComponent().m_itemData.m_shared.m_buildPieces = pieceTable; } } private GameObject getRavenGuidePrefab(ZNetScene zNetScene) { GameObject val = FindPrefabInZnet("Ravens", zNetScene); if ((Object)(object)val != (Object)null) { return val; } GameObject val2 = FindPrefabInZnet("piece_workbench", zNetScene); if ((Object)(object)val2 != (Object)null) { Transform val3 = val2.transform.Find("GuidePoint"); if ((Object)(object)val3 != (Object)null) { GuidePoint component = ((Component)val3).GetComponent(); if ((Object)(object)component != (Object)null) { return component.m_ravenPrefab; } } } return null; } public void setupRavenGuide(GameObject gameObject, ZNetScene zNetScene) { Transform val = gameObject.transform.Find("GuidePoint"); if (!((Object)(object)val == (Object)null)) { GameObject ravenGuidePrefab = getRavenGuidePrefab(zNetScene); if ((Object)(object)ravenGuidePrefab == (Object)null) { Debug.LogWarning((object)"Ravens not found"); } else { ((Component)val).GetComponent().m_ravenPrefab = ravenGuidePrefab; } } } public void setupBuildPiecesListDB() { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Hammer"); List pieces = itemPrefab.GetComponent().m_itemData.m_shared.m_buildPieces.m_pieces; foreach (GameObject buildPrefab in buildPrefabs) { AddToBuildList(buildPrefab, pieces); } } private void AddToBuildList(GameObject prefab, List buildPieces) { if ((Object)(object)buildPieces.Find((GameObject x) => ((Object)x).name == ((Object)prefab).name) == (Object)null) { buildPieces.Add(prefab); } } public void addPlantstoCultivator(ZNetScene zNetScene) { GameObject val = FindPrefabInZnet("Cultivator", zNetScene); PieceTable buildPieces = val.GetComponent().m_itemData.m_shared.m_buildPieces; List pieces = buildPieces.m_pieces; foreach (GameObject gameObject in plantPrefabs) { if ((Object)(object)pieces.Find((GameObject x) => ((Object)x).name == ((Object)gameObject).name) == (Object)null) { pieces.Add(gameObject); } } } private AssetBundle GetAssetBundleFromResources(string filename) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text2 in manifestResourceNames) { if (text2.EndsWith(filename)) { text = text2; break; } } if (text == null) { return null; } using Stream stream = executingAssembly.GetManifestResourceStream(text); return AssetBundle.LoadFromStream(stream); } private void addNewPrefabToCollection(string[] nameList, string mainPath, List prefabList, string typeName) { foreach (string text in nameList) { GameObject val = assetBundle.LoadAsset(mainPath + text + ".prefab"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find " + typeName + " with name: " + text)); } else if (Object.op_Implicit((Object)(object)val.GetComponent()) || typeName == "clutter") { ShaderReplacment.Replace(val); prefabList.Add(val); } else { Debug.LogWarning((object)("Prefab with name has no ZNetView could not been removed: " + text)); } } } private void loadPlants(string basePath) { string mainPath = basePath + "Plants/"; string[] nameList = new string[30] { "sapling_TentaRoot_bal", "sapling_AppleTree_bal", "sapling_Straw_bal", "sapling_Cabbage_bal", "sapling_garlic_bal", "sapling_seedgarlic_bal", "sapling_CabbageSeed_bal", "sapling_Swamp_bal", "sapling_Willow_bal", "sapling_BirchAtumn_bal", "sapling_Poplar_bal", "sapling_Maple_bal", "sapling_Cypress_bal", "sapling_AcaiTree_bal", "sapling_waterlily_bal", "sapling_bush_bal", "sapling_bushPlains_bal", "sapling_bushPlains2_bal", "sapling_bush_blackberry_bal", "sapling_bush_blueberry_bal", "sapling_bush_raspberry_bal", "sapling_MushroomBlue_bal", "sapling_MushroomGray_bal", "sapling_MushroomRed_bal", "sapling_MushroomYellow_bal", "sapling_Thistle_bal", "sapling_Dandelion_bal", "sapling_Ygg_bal", "sapling_mycelium_bal", "sapling_MushroomRandom_bal" }; addNewPrefabToCollection(nameList, mainPath, plantPrefabs, "plant"); } private void loadPieces(string basePath) { string mainPath = basePath + "Pieces/"; string[] buildPieces = BuildPieceList.buildPieces; addNewPrefabToCollection(buildPieces, mainPath, buildPrefabs, "piece"); } private void loadItems(string basePath) { string mainPath = basePath + "Items/"; string[] items = ItemList.items; addNewPrefabToCollection(items, mainPath, itemPrefabs, "item"); } private void loadVegetation(string basePath) { string mainPath = basePath + "Vegetation/"; string[] vegetation = VegetationList.vegetation; addNewPrefabToCollection(vegetation, mainPath, vegetationPrefabs, "vegetation"); string[] array = new string[5] { "MineRock_Blackmetal_bal", "MineRock_Borax_bal", "MineRock_MeteoriteNew_bal", "ClayDeposit_bal", "ChitinDeposit_bal" }; string[] array2 = array; foreach (string vegeName in array2) { GameObject val = vegetationPrefabs.Find((GameObject x) => ((Object)x).name == vegeName); TerrainModifier componentInChildren = val.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { Object.DestroyImmediate((Object)(object)componentInChildren); } } } private void loadClutter(string basePath) { string mainPath = basePath + "Clutter/"; string[] clutter = ClutterList.clutter; addNewPrefabToCollection(clutter, mainPath, clutterPrefabs, "clutter"); } private void loadLocations(string basePath) { string text = basePath + "Location/"; string[] array = new string[0]; string[] array2 = array; foreach (string text2 in array2) { GameObject val = assetBundle.LoadAsset(text + text2 + ".prefab"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Could not find location with name: " + text2)); continue; } ShaderReplacment.Replace(val); locationPrefabs.Add(val); } } private void loadOther(string basePath) { string mainPath = basePath + "Other/"; string[] vfx = VfxList.vfx; addNewPrefabToCollection(vfx, mainPath, vfxPrefabs, "vfx"); } public void setupBirdHouse(ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "piece_birdhouse_bal"); if ((Object)(object)val == (Object)null) { Debug.Log((object)"Birdhouse not found!"); } else if ((Object)(object)val.GetComponent() == (Object)null) { Debug.Log((object)"Setting up Birdhouse"); addFuelHive(val, zNetScene); } } public void addFuelHive(GameObject gameObject, ZNetScene zNetScene) { Beehive component = gameObject.GetComponent(); FueledHive fueledHive = gameObject.AddComponent(); fueledHive.m_fuelItem = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "BirdFeed_bal").GetComponent(); fueledHive.m_producedItem = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Feathers").GetComponent(); fueledHive.m_spawnPoint = component.m_spawnPoint; fueledHive.m_spawnEffect = component.m_spawnEffect; Object.DestroyImmediate((Object)(object)component); } } public class ShaderReplacment { public static List prefabsToReplaceShader = new List(); public static List materialsInPrefabs = new List(); public static List shaders = new List(); private static readonly HashSet CachedShaders = new HashSet(); public static bool debug = true; public static Shader GetShaderByName(string name) { return shaders.Find((Shader s) => (Object)(object)s != (Object)null && ((Object)s).name.Trim() == name.Trim()); } public static void Replace(GameObject gameObject) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (!new ZNet().IsDedicated()) { prefabsToReplaceShader.Add(gameObject); CollectMaterialsFromPrefab(gameObject); } } private static void CollectMaterialsFromPrefab(GameObject gameObject) { Renderer[] componentsInChildren = gameObject.GetComponentsInChildren(true); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials == null) { continue; } Material[] array2 = sharedMaterials; foreach (Material val2 in array2) { if ((Object)(object)val2 != (Object)null && !materialsInPrefabs.Contains(val2)) { materialsInPrefabs.Add(val2); } } } } public static void LoadShadersFromBundles() { AssetBundle[] array = Resources.FindObjectsOfTypeAll(); AssetBundle[] array2 = array; foreach (AssetBundle val in array2) { try { Shader[] array3 = (val.isStreamedSceneAssetBundle ? (from s in ((IEnumerable)val.GetAllAssetNames()).Select((Func)val.LoadAsset) where (Object)(object)s != (Object)null select s).ToArray() : val.LoadAllAssets()); Shader[] array4 = array3; foreach (Shader item in array4) { CachedShaders.Add(item); } } catch { } } } public static void RunMaterialFix() { LoadShadersFromBundles(); shaders.AddRange(CachedShaders); foreach (Material materialsInPrefab in materialsInPrefabs) { if (!((Object)(object)materialsInPrefab == (Object)null) && !((Object)(object)materialsInPrefab.shader == (Object)null)) { string name = ((Object)materialsInPrefab.shader).name; if (!(name == "Standard") && !name.Contains("ScrollingTex") && name.Contains("Balrond")) { ReplaceShader(materialsInPrefab, name); } } } } private static void ReplaceShader(Material material, string oldShaderName) { string name = AdjustShaderName(oldShaderName.Replace("Balrond", "Custom")); Shader shaderByName = GetShaderByName(name); if (!((Object)(object)shaderByName == (Object)null)) { material.shader = shaderByName; } } private static string AdjustShaderName(string name) { string result = name; if (name.Contains("Tess Bumped") || name.Contains("Bumped")) { result = name.Replace("Custom", "Lux Lit Particles"); } if (name.Contains("Standard Surface")) { result = name.Replace("Custom", "Particles"); result = result.Replace("Standard Surface2", "Standard Surface"); } if (name.Contains("Standard Unlit")) { result = name.Replace("Custom", "Particles").Replace("Standard Unlit22", "Standard Unlit2").Replace("Standard Unlit", "Standard Unlit2"); } return result; } } [HarmonyPatch] internal static class ConversionPatches { [HarmonyPatch(typeof(BalrondConverter), "Awake")] private class Patch_BalrondConverter_Awake { private static void Postfix(BalrondConverter __instance) { string prefabName = __instance.prefabName; if (prefabName != null) { if (prefabName.Contains("piece_sawmill_bal") && __instance.m_conversion.Count < 2) { Launch.conversionEdits.editSawMill(__instance); } else if (prefabName.Contains("piece_leatherRack_bal") && __instance.m_conversion.Count < 2) { Launch.conversionEdits.editLeatherRack(__instance); } else if (prefabName.Contains("StoneboundKiln_bal") && __instance.m_conversion.Count < 2) { Launch.conversionEdits.editStoneboundKiln(__instance); } } } } [HarmonyPatch(typeof(CookingStation), "Awake")] private class Patch_CookingStation_Awake { private static void Postfix(CookingStation __instance) { if (__instance.m_conversion == null || __instance.m_conversion.Count <= 0) { string name = ((Object)__instance).name; if (name.Contains("piece_oven")) { Launch.conversionEdits.editOven(__instance); } else if (name.Contains("piece_cookingstation")) { Launch.conversionEdits.editCooking(__instance); } else if (name.Contains("piece_cookingstation_iron")) { Launch.conversionEdits.editIronCooking(__instance); } } } } [HarmonyPatch(typeof(Fermenter), "Awake")] private class Patch_Fermenter_Awake { private static void Postfix(Fermenter __instance) { if (((Object)__instance).name != null && ((Object)__instance).name.Contains("fermenter")) { Launch.conversionEdits.editFermenter(__instance); } } } } [HarmonyPatch] internal static class DeepNorthEnvironmentPatch { private const string EnvName = "DeepNorth_Freezing"; private const string OceanSetupName = "BalrondNature_Ocean_DeepNorthOverride"; private const string DeepNorthSetupName = "BalrondNature_DeepNorth_Freezing"; private const string LeviathanMaterialName = "DeepNorth_Leviathan_Crystal"; private static bool _registered; private static Material _crystalLeviathanMat; private static readonly MethodInfo IsDeepnorthMethod = AccessTools.Method(typeof(WorldGenerator), "IsDeepnorth", new Type[2] { typeof(float), typeof(float) }, (Type[])null); private static readonly MethodInfo Vector3GetZ = AccessTools.PropertyGetter(typeof(Vector3), "z"); [HarmonyPatch(typeof(EnvMan), "Awake")] [HarmonyPostfix] private static void EnvMan_Awake_Postfix(EnvMan __instance) { if ((Object)(object)__instance == (Object)null) { Debug.LogWarning((object)"[BalrondNature] EnvMan instance was null in Awake postfix."); return; } try { RegisterEnvironment(__instance); } catch (Exception ex) { Debug.LogError((object)("[BalrondNature] Failed to register Deep North environment.\n" + ex)); } } [HarmonyPatch(typeof(Leviathan), "Awake")] [HarmonyPostfix] private static void Leviathan_Awake_Postfix(Leviathan __instance) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null) { return; } try { Vector3 position = ((Component)__instance).transform.position; if (IsDeepNorthWorldArea(position)) { ApplyCrystalLeviathan(((Component)__instance).gameObject); } } catch (Exception ex) { Debug.LogError((object)("[BalrondNature] Failed to apply Leviathan crystal material.\n" + ex)); } } private static void RegisterEnvironment(EnvMan envMan) { if (_registered) { EnsureEnvReferences(envMan); return; } EnvSetup val = FindEnvironment(envMan, "DeepNorth_Freezing"); if (val == null) { val = BuildFreezingEnvironment(); envMan.AppendEnvironment(val); Debug.Log((object)"[BalrondNature] Added environment: DeepNorth_Freezing"); } AddOceanDeepNorthOverride(envMan, val); AddDeepNorthEnvironment(envMan, val); EnsureEnvReferences(envMan); _registered = true; Debug.Log((object)"[BalrondNature] Deep North environment registration complete."); } private static void AddOceanDeepNorthOverride(EnvMan envMan, EnvSetup env) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown BiomeEnvSetup val = FindBiomeSetup(envMan, (Biome)256); if (val == null) { val = new BiomeEnvSetup { m_name = "BalrondNature_Ocean_DeepNorthOverride", m_biome = (Biome)256, m_environments = new List() }; envMan.AppendBiomeSetup(val); val = FindBiomeSetup(envMan, (Biome)256) ?? val; } if (val.m_environments == null) { val.m_environments = new List(); } if (!HasEnvironmentEntry(val.m_environments, "DeepNorth_Freezing", deepNorthOverride: true, ashlandsOverride: false)) { val.m_environments.Add(new EnvEntry { m_environment = "DeepNorth_Freezing", m_weight = 0.1f, m_ashlandsOverride = false, m_deepnorthOverride = true, m_env = env }); Debug.Log((object)"[BalrondNature] Added Ocean deepnorth override environment entry."); } } private static void AddDeepNorthEnvironment(EnvMan envMan, EnvSetup env) { //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown BiomeEnvSetup val = FindBiomeSetup(envMan, (Biome)64); if (val == null) { val = new BiomeEnvSetup { m_name = "BalrondNature_DeepNorth_Freezing", m_biome = (Biome)64, m_environments = new List() }; envMan.AppendBiomeSetup(val); val = FindBiomeSetup(envMan, (Biome)64) ?? val; } if (val.m_environments == null) { val.m_environments = new List(); } if (!HasEnvironmentEntryByName(val.m_environments, "DeepNorth_Freezing")) { val.m_environments.Add(new EnvEntry { m_environment = "DeepNorth_Freezing", m_weight = 0.1f, m_ashlandsOverride = false, m_deepnorthOverride = true, m_env = env }); Debug.Log((object)"[BalrondNature] Added Deep North biome environment entry."); } } private static void EnsureEnvReferences(EnvMan envMan) { if ((Object)(object)envMan == (Object)null || envMan.m_biomes == null) { return; } EnvSetup val = FindEnvironment(envMan, "DeepNorth_Freezing"); if (val == null) { return; } for (int i = 0; i < envMan.m_biomes.Count; i++) { BiomeEnvSetup val2 = envMan.m_biomes[i]; if (val2 == null || val2.m_environments == null) { continue; } for (int j = 0; j < val2.m_environments.Count; j++) { EnvEntry val3 = val2.m_environments[j]; if (val3 != null && string.Equals(val3.m_environment, "DeepNorth_Freezing", StringComparison.Ordinal)) { val3.m_env = val; } } } } private static EnvSetup FindEnvironment(EnvMan envMan, string envName) { if ((Object)(object)envMan == (Object)null || envMan.m_environments == null) { return null; } for (int i = 0; i < envMan.m_environments.Count; i++) { EnvSetup val = envMan.m_environments[i]; if (val != null && string.Equals(val.m_name, envName, StringComparison.Ordinal)) { return val; } } return null; } private static BiomeEnvSetup FindBiomeSetup(EnvMan envMan, Biome biome) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)envMan == (Object)null || envMan.m_biomes == null) { return null; } for (int i = 0; i < envMan.m_biomes.Count; i++) { BiomeEnvSetup val = envMan.m_biomes[i]; if (val != null && val.m_biome == biome) { return val; } } return null; } private static bool HasEnvironmentEntry(List entries, string envName, bool deepNorthOverride, bool ashlandsOverride) { if (entries == null) { return false; } for (int i = 0; i < entries.Count; i++) { EnvEntry val = entries[i]; if (val != null && string.Equals(val.m_environment, envName, StringComparison.Ordinal) && val.m_deepnorthOverride == deepNorthOverride && val.m_ashlandsOverride == ashlandsOverride) { return true; } } return false; } private static bool HasEnvironmentEntryByName(List entries, string envName) { if (entries == null) { return false; } for (int i = 0; i < entries.Count; i++) { EnvEntry val = entries[i]; if (val != null && string.Equals(val.m_environment, envName, StringComparison.Ordinal)) { return true; } } return false; } private static bool IsDeepNorthWorldArea(Vector3 position) { //IL_0002: 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) try { return WorldGenerator.IsDeepnorth(position.x, position.z); } catch (Exception ex) { Debug.LogWarning((object)("[BalrondNature] Deep North area check failed.\n" + ex)); return false; } } private static void ApplyCrystalLeviathan(GameObject root) { if ((Object)(object)root == (Object)null) { return; } if ((Object)(object)_crystalLeviathanMat == (Object)null) { _crystalLeviathanMat = CreateCrystalMaterial(root); } if ((Object)(object)_crystalLeviathanMat == (Object)null) { return; } Renderer[] componentsInChildren = root.GetComponentsInChildren(true); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } foreach (Renderer val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } Material[] sharedMaterials = val.sharedMaterials; if (sharedMaterials != null && sharedMaterials.Length != 0) { for (int j = 0; j < sharedMaterials.Length; j++) { sharedMaterials[j] = _crystalLeviathanMat; } val.sharedMaterials = sharedMaterials; } } } private static Material CreateCrystalMaterial(GameObject root) { //IL_00b1: 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_00b7: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = root.GetComponentsInChildren(true); Material val = null; if (componentsInChildren != null) { foreach (Renderer val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMaterial != (Object)null) { val = val2.sharedMaterial; break; } } } Shader val3 = (((Object)(object)val != (Object)null) ? val.shader : Shader.Find("Standard")); if ((Object)(object)val3 == (Object)null) { Debug.LogWarning((object)"[BalrondNature] Could not find a shader for Leviathan crystal material."); return null; } Material val4 = (((Object)(object)val != (Object)null) ? new Material(val) : new Material(val3)); ((Object)val4).name = "DeepNorth_Leviathan_Crystal"; if (val4.HasProperty("_Color")) { val4.color = new Color(0.72f, 0.88f, 1f, 1f); } if (val4.HasProperty("_EmissionColor")) { val4.SetColor("_EmissionColor", new Color(0.18f, 0.35f, 0.5f, 1f)); val4.EnableKeyword("_EMISSION"); } if (val4.HasProperty("_Glossiness")) { val4.SetFloat("_Glossiness", 0.75f); } if (val4.HasProperty("_Metallic")) { val4.SetFloat("_Metallic", 0.12f); } return val4; } private static EnvSetup BuildFreezingEnvironment() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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) EnvSetup val = new EnvSetup(); val.m_name = "DeepNorth_Freezing"; val.m_default = false; val.m_isWet = true; val.m_isFreezing = true; val.m_isFreezingAtNight = true; val.m_isCold = true; val.m_isColdAtNight = true; val.m_alwaysDark = false; val.m_ambColorDay = new Color(0.45f, 0.55f, 0.65f); val.m_ambColorNight = new Color(0.18f, 0.22f, 0.28f); val.m_fogColorDay = new Color(0.6f, 0.7f, 0.8f); val.m_fogColorNight = new Color(0.2f, 0.25f, 0.32f); val.m_fogColorMorning = new Color(0.55f, 0.65f, 0.75f); val.m_fogColorEvening = new Color(0.5f, 0.6f, 0.7f); val.m_fogColorSunDay = new Color(0.7f, 0.8f, 0.9f); val.m_fogColorSunNight = new Color(0.25f, 0.3f, 0.4f); val.m_fogColorSunMorning = new Color(0.6f, 0.7f, 0.8f); val.m_fogColorSunEvening = new Color(0.55f, 0.65f, 0.75f); val.m_fogDensityDay = 0.025f; val.m_fogDensityNight = 0.04f; val.m_fogDensityMorning = 0.03f; val.m_fogDensityEvening = 0.032f; val.m_sunColorDay = new Color(0.9f, 0.95f, 1f); val.m_sunColorNight = new Color(0.35f, 0.4f, 0.5f); val.m_sunColorMorning = new Color(0.8f, 0.85f, 0.95f); val.m_sunColorEvening = new Color(0.75f, 0.8f, 0.9f); val.m_lightIntensityDay = 0.8f; val.m_lightIntensityNight = 0.15f; val.m_sunAngle = 12f; val.m_windMin = 0.5f; val.m_windMax = 1f; val.m_rainCloudAlpha = 0.7f; val.m_ambientVol = 0.35f; val.m_musicDay = "MountainDay"; val.m_musicNight = "MountainNight"; val.m_musicMorning = "MountainMorning"; val.m_musicEvening = "MountainEvening"; val.m_psystems = (GameObject[])(object)new GameObject[0]; val.m_psystemsOutsideOnly = false; val.m_envObject = null; return val; } } public class DungeonNameGenList { public static string[] burialChamberTags = new string[104] { "$tag_sigurdsson_barrow_bal", "$tag_bjornsson_tomb_bal", "$tag_eiriksson_sepulcher_bal", "$tag_leifrsson_rest_bal", "$tag_ragnvald_vault_bal", "$tag_ulfgrim_mausoleum_bal", "$tag_gunnarrson_grave_bal", "$tag_hakonsen_sanctum_bal", "$tag_svendsen_hold_bal", "$tag_ivarsson_shrine_bal", "$tag_olafsson_keep_bal", "$tag_eriksson_chamber_bal", "$tag_magnusson_passage_bal", "$tag_lokison_memorial_bal", "$tag_vidarsson_altar_bal", "$tag_skadison_coffin_bal", "$tag_tyrsson_monument_bal", "$tag_astridsson_burial_bal", "$tag_freyason_relic_bal", "$tag_sigridsson_shroud_bal", "$tag_gudrunsson_abyss_bal", "$tag_ingridsson_dome_bal", "$tag_runason_circle_bal", "$tag_bodilsson_spire_bal", "$tag_svenjasson_pillar_bal", "$tag_bjarkison_barrow_bal", "$tag_einarsson_tomb_bal", "$tag_arneson_sepulcher_bal", "$tag_trygveson_rest_bal", "$tag_halvardsson_vault_bal", "$tag_gislison_mausoleum_bal", "$tag_ketilsson_grave_bal", "$tag_njordsson_sanctum_bal", "$tag_karisson_hold_bal", "$tag_ulfsson_shrine_bal", "$tag_ragnarsdottir_keep_bal", "$tag_sigridardottir_hall_bal", "$tag_aslaugsson_chamber_bal", "$tag_gudmundsson_passage_bal", "$tag_jarnskeggi_catacomb_bal", "$tag_freyjadottir_memorial_bal", "$tag_helmirsdottir_altar_bal", "$tag_thorsdottir_coffin_bal", "$tag_eiriksson_monument_bal", "$tag_hallbjornsson_crypta_bal", "$tag_svanhildr_burial_bal", "$tag_brynhildr_relic_bal", "$tag_vigdis_shroud_bal", "$tag_gunnhildr_abyss_bal", "$tag_hrolfr_dome_bal", "$tag_ragnheidr_circle_bal", "$tag_storr_spire_bal", "$tag_haraldsson_pillar_bal", "$tag_eilifsson_cryptic_bal", "$tag_ormsson_barrow_bal", "$tag_erlandsson_sepulcher_bal", "$tag_thorvaldsson_rest_bal", "$tag_gunnvaldsson_vault_bal", "$tag_ingvarsson_mausoleum_bal", "$tag_stigandsson_grave_bal", "$tag_ulfhildr_sanctum_bal", "$tag_frodehold_hold_bal", "$tag_ingibjorg_shrine_bal", "$tag_haldorsson_hall_bal", "$tag_bjornhildr_chamber_bal", "$tag_olfsson_passage_bal", "$tag_sverrirsson_catacomb_bal", "$tag_gerd_memorial_bal", "$tag_freyjaskeggi_altar_bal", "$tag_helgi_coffin_bal", "$tag_sigurdr_monument_bal", "$tag_hrafn_burial_bal", "$tag_sigrun_relic_bal", "$tag_egil_shroud_bal", "$tag_asgeirr_abyss_bal", "$tag_thord_dome_bal", "$tag_valdis_circle_bal", "$tag_jarl_spire_bal", "$tag_ketill_pillar_bal", "$tag_ulf_cryptic_bal", "$tag_einar_barrow_bal", "$tag_rune_crypt_bal", "$tag_olv_tomb_bal", "$tag_arin_sepulcher_bal", "$tag_sten_rest_bal", "$tag_olrik_vault_bal", "$tag_ulfgeirr_mausoleum_bal", "$tag_thorgrim_grave_bal", "$tag_bjornwulf_sanctum_bal", "$tag_ingrid_hold_bal", "$tag_jon_shrine_bal", "$tag_helga_keep_bal", "$tag_valdimar_hall_bal", "$tag_karlsdottir_chamber_bal", "$tag_eiriksson_passage_bal", "$tag_gudrun_memorial_bal", "$tag_hagen_tomb_bal", "$tag_jorund_burial_bal", "$tag_kelda_mausoleum_bal", "$tag_loki_spire_bal", "$tag_asger_dome_bal", "$tag_eran_altar_bal", "$tag_runa_barrow_bal", "$tag_torvald_keep_bal" }; public static readonly Dictionary dungeonNameList = new Dictionary { { "WoodFarm1", new string[20] { "$tag_fjellholt_bal", "$tag_birkheim_bal", "$tag_thorslund_bal", "$tag_eikstad_bal", "$tag_hogdale_bal", "$tag_grovra_bal", "$tag_vangr_bal", "$tag_sjoholt_bal", "$tag_vaestgard_bal", "$tag_rodhaug_bal", "$tag_myrheim_bal", "$tag_skogtun_bal", "$tag_havnby_bal", "$tag_rostvik_bal", "$tag_skjoldrud_bal", "$tag_dalenes_bal", "$tag_bjornholt_bal", "$tag_breidvoll_bal", "$tag_kveldrud_bal", "$tag_strandheim_bal" } }, { "WoodVillage1", new string[20] { "$tag_draugrholt_bal", "$tag_skulldal_bal", "$tag_nattvik_bal", "$tag_morkheim_bal", "$tag_gravfjell_bal", "$tag_svartdal_bal", "$tag_vargstad_bal", "$tag_haellvik_bal", "$tag_dokkhus_bal", "$tag_frostheim_bal", "$tag_skuggaborg_bal", "$tag_kuldeholt_bal", "$tag_dokkalund_bal", "$tag_blodheim_bal", "$tag_trollhaugen_bal", "$tag_kaosvik_bal", "$tag_spokestad_bal", "$tag_demonfjord_bal", "$tag_gjallardal_bal", "$tag_niflungstad_bal" } }, { "GoblinCamp2", new string[20] { "$tag_skarrfang_bal", "$tag_drakthar_bal", "$tag_gorakmar_bal", "$tag_bloodgrot_bal", "$tag_kragtooth_bal", "$tag_narzug_bal", "$tag_razgrin_bal", "$tag_venomclaw_bal", "$tag_darkmire_bal", "$tag_skulkrag_bal", "$tag_ghulraz_bal", "$tag_fangrim_bal", "$tag_ravenskull_bal", "$tag_wargfell_bal", "$tag_ironfang_bal", "$tag_doomscar_bal", "$tag_bonegrin_bal", "$tag_morglash_bal", "$tag_ragefen_bal", "$tag_snarltusk_bal" } }, { "MountainCave02", new string[23] { "$tag_arnulfsson_keep_bal", "$tag_frostvein_bal", "$tag_icecrypt_bal", "$tag_glacierhold_bal", "$tag_winterfang_bal", "$tag_cryoshroud_bal", "$tag_snowmire_bal", "$tag_shardfell_bal", "$tag_chillspire_bal", "$tag_thorvaldsson_hall_bal", "$tag_permafrost_bal", "$tag_fenringscar_bal", "$tag_icevein_bal", "$tag_frostbane_bal", "$tag_glacialrift_bal", "$tag_hailreach_bal", "$tag_blizzardhall_bal", "$tag_shiverpeak_bal", "$tag_fenringcrypt_bal", "$tag_sleetgarde_bal", "$tag_icebound_bal", "$tag_frozenfang_bal", "$tag_ullr_hall_bal" } }, { "Crypt2", burialChamberTags }, { "Crypt3", burialChamberTags }, { "Crypt4", burialChamberTags }, { "SunkenCrypt4", new string[47] { "$tag_borg_catacomb_bal", "$tag_drownedhall_bal", "$tag_shademire_bal", "$tag_ghostreef_bal", "$tag_bonewater_bal", "$tag_haraldsson_crypt_bal", "$tag_fathomkeep_bal", "$tag_dreadspire_bal", "$tag_siltgrave_bal", "$tag_wraithhold_bal", "$tag_deepshade_bal", "$tag_sigfridsson_crypt_bal", "$tag_bloodmarsh_bal", "$tag_phantomrest_bal", "$tag_tidewrath_bal", "$tag_skullgrove_bal", "$tag_mirelair_bal", "$tag_shadowfen_bal", "$tag_floodspire_bal", "$tag_cryptreach_bal", "$tag_fenrirsson_catacomb_bal", "$tag_echograve_bal", "$tag_mistmarsh_bal", "$tag_hollowreef_bal", "$tag_carrionhold_bal", "$tag_torsteinsson_cryptic_bal", "$tag_helgason_crypta_bal", "$tag_gravehollow_bal", "$tag_phasespire_bal", "$tag_sunkenfrost_bal", "$tag_blightharbor_bal", "$tag_frostmire_bal", "$tag_hakonsson_crypt_bal", "$tag_seaspire_bal", "$tag_deathfen_bal", "$tag_nightshroud_bal", "$tag_spinecrypt_bal", "$tag_darkwater_bal", "$tag_grimgulf_bal", "$tag_shadowmarsh_bal", "$tag_cryptfall_bal", "$tag_fogmoor_bal", "$tag_blightreef_bal", "$tag_harrowdeep_bal", "$tag_deepwraith_bal", "$tag_ashenreef_bal", "$tag_styrbjornsson_crypta_bal" } } }; } [HarmonyPatch] internal static class DoorPatches { [HarmonyPatch(typeof(Door), "Open")] public static class Door_Interact_Patch { public static void Postfix(Door __instance) { if (Compatibility.IsLoaded() || !((Object)((Component)__instance).gameObject).name.Contains("sunken_crypt_gate")) { return; } Player localPlayer = Player.m_localPlayer; Inventory val = ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null); if (val == null) { return; } string text = __instance.m_keyItem?.m_itemData?.m_shared?.m_name; if (!string.IsNullOrEmpty(text)) { ItemData item = val.GetItem(text, -1, false); if (item != null) { val.RemoveOneItem(item); } } } } [HarmonyPatch(typeof(Door))] public class DoorPatch { [HarmonyPrefix] [HarmonyPatch("Interact")] private static void InteractPrefix(Humanoid character, bool hold, bool alt, Door __instance) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!PlayerInitiated || !Object.op_Implicit((Object)(object)character) || !Object.op_Implicit((Object)(object)__instance) || !Object.op_Implicit((Object)(object)__instance.m_nview)) { return; } Doors = new List(); Piece.GetAllPiecesInRadius(((Component)character).transform.position, 10f, Doors); __instance.m_nview.ClaimOwnership(); PlayerInitiated = false; Door val = default(Door); foreach (Piece door in Doors) { if (!Object.op_Implicit((Object)(object)door) || !Object.op_Implicit((Object)(object)door.m_nview) || !Object.op_Implicit((Object)(object)((Component)door.m_nview).gameObject)) { PlayerInitiated = true; return; } if (((Component)door.m_nview).gameObject.TryGetComponent(ref val) && DoubleDoorCheck(__instance, val)) { val.m_nview.ClaimOwnership(); val.Interact(character, hold, alt); } } Doors.Clear(); PlayerInitiated = true; } } public static List Doors = new List(); public static bool PlayerInitiated = true; public static bool DoubleDoorCheck(Door point, Door next) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)point).transform.position, ((Component)next).transform.position) <= 5f && ((Component)point).transform.position != ((Component)next).transform.position && ((Component)point).transform.position.y == ((Component)next).transform.position.y && Math.Abs(Math.Abs(Vector3.SignedAngle(((Component)point).transform.position - ((Component)next).transform.position, ((Component)point).transform.forward, Vector3.up)) - 90f) <= 0.1f && Math.Abs(Quaternion.Angle(((Component)point).transform.rotation, ((Component)next).transform.rotation) - 180f) <= 0.5f && (float)(point.m_nview.GetZDO().GetInt(ZDOVars.s_state, 0) + next.m_nview.GetZDO().GetInt(ZDOVars.s_state, 0)) == 0f) { return true; } return false; } } [HarmonyPatch] internal static class LootDropPatches { [HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")] private class CharacterDrop_Limit_DropItems { private static void Postfix(CharacterDrop __instance, ref List> __result) { if ((Object)(object)__instance == (Object)null) { return; } Character component = ((Component)__instance).GetComponent(); if (!((Object)(object)component == (Object)null) && !component.IsBoss()) { int num = 2; num += component.m_level; string value = WorldGenPatches.editZnetName(((Object)__instance).name); if (eliteMonsters.Contains(value)) { num++; } if (bigMonsters.Contains(value)) { num += 2; } Debug.Log((object)("Loot drop size: " + num)); List> limitedDrops = GetLimitedDrops(__result, num); __result = limitedDrops; } } } public static string[] bigMonsters = new string[20] { "Serpent", "Troll", "Morgen", "BonemawSerpent", "TrollOutcast_bal", "TrollBrute_bal", "Abomination", "AshlandsGolem_bal", "StoneGolem", "TrollUndead_bal", "TrollAshlands", "FallenValkyrie", "Gjall", "GoblinBruteBros", "Skeleton_Hildir", "GoblinShaman_Hildir", "Fenring_Cultist_Hildir", "GoblinCheftain_bal", "Bjorn", "Unbjorn" }; public static string[] eliteMonsters = new string[23] { "Shark_bal", "DraugrElite", "CorpseCollector_bal", "Bear_bal", "PolarBear_bal", "Stormdrake_bal", "Fenring_Brute_bal", "Frostbjorn_bal", "Lox", "GoblinBrute", "Skeleton_Hildir_nochest", "GoblinBruteBros_nochest", "GoblinShaman_Hildir_nochest", "GoblinBrute_Hildir", "Fenring_Cultist_Hildir_nochest", "CorpseCollector_bal", "Frostbjorn_bal", "FrostbjornBrown_bal", "Greydwarf_Crusher_bal", "GreylingElite_bal", "LeechPrimal_bal", "NeckBrute_bal", "Moth_bal" }; private static List> GetLimitedDrops(List> drops, int limit = 3) { if (drops.Count <= limit || drops.Count == limit + 1) { return drops; } List> list = new List>(); for (int i = 0; i < limit; i++) { int index = Random.Range(0, drops.Count); while (list.Contains(drops[index])) { index = Random.Range(0, drops.Count); } list.Add(drops[index]); } return list; } } [HarmonyPatch] internal static class SickStatusPatches { [HarmonyPatch(typeof(Player), "Update")] private static class PlayerUpdateSickCheck { private static void Postfix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !((Object)(object)__instance == (Object)null) && ((Character)__instance).m_seman != null) { _sickCheckTimer += Time.deltaTime; if (!(_sickCheckTimer < 0.5f)) { _sickCheckTimer = 0f; TryApplySick(__instance); } } } } private static readonly int Sick = BalrondHashCompat.StableHash("SE_Sick_bal"); private static readonly int Lacerated = BalrondHashCompat.StableHash("SE_Lacerated_bal"); private static readonly int Punctured = BalrondHashCompat.StableHash("SE_Punctured_bal"); private static readonly int Wet = BalrondHashCompat.StableHash("Wet"); private static readonly int Soaked = BalrondHashCompat.StableHash("SE_Soaked_bal"); private static readonly int Poison = BalrondHashCompat.StableHash("Poison"); private static readonly int Enfeebled = BalrondHashCompat.StableHash("SE_Enfeebled_bal"); private static float _sickCheckTimer = 0f; private static void TryApplySick(Player player) { SEMan seman = ((Character)player).m_seman; if (seman != null && !seman.HaveStatusEffect(Sick) && !seman.HaveStatusEffect(Enfeebled)) { bool flag = seman.HaveStatusEffect(Lacerated) || seman.HaveStatusEffect(Punctured); bool flag2 = seman.HaveStatusEffect(Wet) || seman.HaveStatusEffect(Soaked); bool flag3 = seman.HaveStatusEffect(Poison); if (flag && flag2 && flag3) { seman.AddStatusEffect(Sick, false, 0, 0f); } } } } [HarmonyPatch] internal static class SleepEatPatches { [HarmonyPatch(typeof(Player), "SetSleeping")] public static class UpdateSleepBonus { private static void Postfix(Player __instance) { SEMan seman = ((Character)__instance).m_seman; seman.RemoveStatusEffect(BalrondHashCompat.StableHash("SE_Tired_bal"), false); seman.RemoveStatusEffect(BalrondHashCompat.StableHash("SE_NotTired_bal"), false); seman.RemoveStatusEffect(BalrondHashCompat.StableHash("SE_NoSleep_bal"), false); seman.AddStatusEffect(BalrondHashCompat.StableHash("SE_WellSlept_bal"), false, 0, 0f); } } [HarmonyPatch(typeof(Player), "OnSpawned")] public static class InitSleepOnSpawn { private static void Postfix(Player __instance) { EnsureSleepState(__instance); } } [HarmonyPatch(typeof(Player), "OnRespawn")] public static class InitSleepOnRespawn { private static void Postfix(Player __instance) { EnsureSleepState(__instance); } } [HarmonyPatch(typeof(Player), "Update")] public static class PlayerUpdateSleepCheck { private static void Postfix(Player __instance) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { _sleepCheckTimer += Time.deltaTime; if (!(_sleepCheckTimer < 1f)) { _sleepCheckTimer = 0f; EnsureSleepState(__instance); } } } } [HarmonyPatch(typeof(Player), "UpdateFood")] public static class UpdateFood_Bonus { private static readonly int FoodPoison = BalrondHashCompat.StableHash("SE_FoodPoison_bal"); private static readonly int Hungry = BalrondHashCompat.StableHash("SE_Hungry_bal"); private static readonly int JustFed = BalrondHashCompat.StableHash("SE_JustFed_bal"); private static readonly int Fed = BalrondHashCompat.StableHash("SE_Fed_bal"); private static readonly int WellFed = BalrondHashCompat.StableHash("SE_WellFed_bal"); private static readonly int Cold = BalrondHashCompat.StableHash("Cold"); private static readonly int ColdDay = BalrondHashCompat.StableHash("SE_ColdDay_bal"); private static readonly int Wet = BalrondHashCompat.StableHash("Wet"); private static void Postfix(Player __instance) { List foods = __instance.m_foods; int num = foods?.Count ?? 0; SEMan seman = ((Character)__instance).m_seman; if (seman.HaveStatusEffect(BalrondHashCompat.StableHash("Rested"))) { seman.RemoveStatusEffect(BalrondHashCompat.StableHash("SE_NotTired_bal"), false); seman.RemoveStatusEffect(BalrondHashCompat.StableHash("SE_Tired_bal"), false); } if (!AtePoisonFood(foods)) { switch (num) { case 0: seman.RemoveStatusEffect(FoodPoison, false); seman.RemoveStatusEffect(JustFed, false); seman.RemoveStatusEffect(Fed, false); seman.RemoveStatusEffect(WellFed, false); seman.AddStatusEffect(Hungry, false, 0, 0f); break; case 1: seman.RemoveStatusEffect(FoodPoison, false); seman.RemoveStatusEffect(Hungry, false); seman.RemoveStatusEffect(Fed, false); seman.RemoveStatusEffect(WellFed, false); seman.AddStatusEffect(JustFed, false, 0, 0f); break; case 2: seman.RemoveStatusEffect(FoodPoison, false); seman.RemoveStatusEffect(Hungry, false); seman.RemoveStatusEffect(JustFed, false); seman.RemoveStatusEffect(WellFed, false); seman.AddStatusEffect(Fed, false, 0, 0f); break; case 3: case 4: case 5: seman.RemoveStatusEffect(FoodPoison, false); seman.RemoveStatusEffect(Hungry, false); seman.RemoveStatusEffect(JustFed, false); seman.RemoveStatusEffect(Fed, false); seman.AddStatusEffect(WellFed, false, 0, 0f); break; } } else { seman.RemoveStatusEffect(Hungry, false); seman.RemoveStatusEffect(WellFed, false); seman.RemoveStatusEffect(Fed, false); if (num > 0) { seman.AddStatusEffect(JustFed, false, 0, 0f); } else { seman.RemoveStatusEffect(JustFed, false); } seman.AddStatusEffect(FoodPoison, false, 0, 0f); } if (num > 0 && Object.op_Implicit((Object)(object)seman.GetStatusEffect(Cold)) && !Object.op_Implicit((Object)(object)seman.GetStatusEffect(Wet))) { } } private static bool AtePoisonFood(List foods) { if (foods == null || foods.Count == 0) { return false; } string[] source = new string[8] { "RottenMeat", "RottenVegetable_bal", "PoisonApple_bal", "MushroomInkcap_bal", "Larva_bal", "ChumBucket_bal", "SurstrommingBase_bal", "SurstrommingBase_bal" }; foreach (Food food in foods) { if ((Object)(object)food?.m_item?.m_dropPrefab != (Object)null && source.Contains(((Object)food.m_item.m_dropPrefab).name)) { return true; } } return false; } } private static float _sleepCheckTimer; public static void EnsureSleepState(Player player) { SEMan seman = ((Character)player).m_seman; bool flag = seman.HaveStatusEffect(BalrondHashCompat.StableHash("Rested")); bool flag2 = seman.HaveStatusEffect(BalrondHashCompat.StableHash("SE_NotTired_bal")); bool flag3 = seman.HaveStatusEffect(BalrondHashCompat.StableHash("SE_Tired_bal")); bool flag4 = seman.HaveStatusEffect(BalrondHashCompat.StableHash("SE_NoSleep_bal")); if (!(flag || flag3 || flag4 || flag2)) { seman.AddStatusEffect(BalrondHashCompat.StableHash("SE_NotTired_bal"), false, 0, 0f); if (flag) { seman.RemoveStatusEffect(BalrondHashCompat.StableHash("SE_NotTired_bal"), false); seman.RemoveStatusEffect(BalrondHashCompat.StableHash("SE_Tired_bal"), false); } } } } [HarmonyPatch] internal static class TranslationPatches { [HarmonyPatch(typeof(FejdStartup), "SetupGui")] private class FejdStartup_SetupGUI { private static void Postfix() { string selectedLanguage = Localization.instance.GetSelectedLanguage(); Dictionary translations = GetTranslations(selectedLanguage); AddTranslations(translations); } } [HarmonyPriority(800)] [HarmonyPatch(typeof(Localization), "SetupLanguage")] private class Translation_SetupLanguage { private static void Prefix(Localization __instance, string language) { Dictionary translations = GetTranslations(language); AddTranslations(translations, __instance); } } [HarmonyPriority(800)] [HarmonyPatch(typeof(Localization), "LoadCSV")] private class Translation_LoadCSV { private static void Prefix(Localization __instance, string language) { Dictionary translations = GetTranslations(language); AddTranslations(translations, __instance); } } private static Dictionary GetTranslations(string language) { Dictionary result = BalrondTranslator.getLanguage("English"); if (!string.Equals(language, "English", StringComparison.OrdinalIgnoreCase)) { Dictionary language2 = BalrondTranslator.getLanguage(language); if (language2 != null) { result = language2; } else { Debug.Log((object)("BalrondAmazingNature: Did not find translation file for '" + language + "', loading English")); } } return result; } private static void AddTranslations(Dictionary translations, Localization localizationInstance = null) { if (translations == null) { Debug.LogWarning((object)"BalrondAmazingNature: No translation file found!"); return; } if (localizationInstance != null) { foreach (KeyValuePair translation in translations) { localizationInstance.AddWord(translation.Key, translation.Value); } return; } foreach (KeyValuePair translation2 in translations) { Localization.instance.AddWord(translation2.Key, translation2.Value); } } } [HarmonyPatch] internal static class WetColdRegenPatches { [HarmonyPatch(typeof(ItemData), "GetTooltip", new Type[] { typeof(ItemData), typeof(int), typeof(bool), typeof(float), typeof(int) })] public static class ItemData_GetTooltip_Patch { private static void Postfix(ItemData item, ref string __result) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 if (item != null && item.m_shared != null && (int)item.m_shared.m_itemType == 17) { StatusEffect val = Launch.modResourceLoader.waterproof; if ((Object)(object)val == (Object)null) { val = GetWaterproofStatusEffect(); } if (!((Object)(object)val == (Object)null)) { __result += $"\n{val.m_name}: {val.m_tooltip}"; } } } private static StatusEffect GetWaterproofStatusEffect() { return ((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetStatusEffect(BalrondHashCompat.StableHash("Waterproof")) : null; } } [HarmonyPatch(typeof(Player), "UpdateStats", new Type[] { typeof(float) })] public static class Player_UpdateStats_Patch { public static void Postfix(Player __instance, ref float dt) { if (!((Object)(object)__instance == (Object)null) && !(((Character)__instance).GetHealth() >= ((Character)__instance).GetMaxHealth())) { SE_SitHeal sE_SitHeal = ScriptableObject.CreateInstance(); if (((Character)__instance).IsSitting()) { ((Character)__instance).GetSEMan().AddStatusEffect((StatusEffect)(object)sE_SitHeal, true, 0, 0f); } else { ((Character)__instance).GetSEMan().RemoveStatusEffect((StatusEffect)(object)sE_SitHeal, false); } } } } [HarmonyPatch(typeof(EnvMan), "IsCold")] public static class Patch_EnvMan_IsCold { private static void Postfix(ref bool __result) { //IL_0047: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!__result) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } ItemData rightItem = ((Humanoid)localPlayer).m_rightItem; if (rightItem == null || rightItem.m_shared?.m_itemType != (ItemType?)15) { ItemData leftItem = ((Humanoid)localPlayer).m_leftItem; if (leftItem == null || leftItem.m_shared?.m_itemType != (ItemType?)15) { return; } } __result = false; } } [HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[] { typeof(int), typeof(bool), typeof(int), typeof(float) })] public static class SEMan_AddStatusEffect_BlockWet { private static readonly int WaterproofHash = BalrondHashCompat.StableHash("Waterproof"); private static readonly int WetHash = BalrondHashCompat.StableHash("Wet"); private static readonly int SoakedHash = BalrondHashCompat.StableHash("SE_Soaked_bal"); private static bool Prefix(SEMan __instance, ref int nameHash) { if (nameHash != WetHash) { return true; } if (__instance == null) { return true; } if (__instance.HaveStatusEffect(WaterproofHash)) { return false; } if (__instance.HaveStatusEffect(SoakedHash)) { return false; } Character character = __instance.m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && WaterStateHelper.IsWaterWet(val)) { return false; } return true; } } [HarmonyPatch(typeof(Player), "UpdateEnvStatusEffects")] internal static class Player_UpdateEnvStatusEffects_AllRules { private static readonly int WetHash = BalrondHashCompat.StableHash("Wet"); private static readonly int ColdHash = BalrondHashCompat.StableHash("Cold"); private static readonly int FreezingHash = BalrondHashCompat.StableHash("Freezing"); private static readonly int ColdDayHash = BalrondHashCompat.StableHash("SE_ColdDay_bal"); private static readonly int SoakedHash = BalrondHashCompat.StableHash("SE_Soaked_bal"); private static readonly int ShiveringHash = BalrondHashCompat.StableHash("SE_Shivering_bal"); private static readonly int WaterproofHash = BalrondHashCompat.StableHash("Waterproof"); private static readonly int FrostMeadHash = BalrondHashCompat.StableHash("Potion_frostresist"); private const float ArmorThreshold = 10f; private const bool UseArmorThresholdInsteadOfSlots = false; private static void Postfix(Player __instance, float dt) { if ((Object)(object)__instance == (Object)null || ((Character)__instance).IsDead()) { return; } SEMan sEMan = ((Character)__instance).GetSEMan(); if (sEMan == null) { return; } bool flag = sEMan.HaveStatusEffect(WetHash); bool flag2 = IsWearingCape(__instance); bool flag3 = sEMan.HaveStatusEffect(WaterproofHash); if (flag2) { if (!flag3 && !flag) { sEMan.AddStatusEffect(WaterproofHash, false, 0, 0f); } } else if (flag3) { sEMan.RemoveStatusEffect(WaterproofHash, false); } bool flag4 = WaterStateHelper.IsWaterWet(__instance); bool flag5 = sEMan.HaveStatusEffect(SoakedHash); flag = sEMan.HaveStatusEffect(WetHash); if (flag4) { sEMan.AddStatusEffect(SoakedHash, true, 0, 0f); if (flag) { sEMan.RemoveStatusEffect(WetHash, false); flag = false; } flag5 = true; } if (flag5 && flag) { sEMan.RemoveStatusEffect(WetHash, false); flag = false; } flag = sEMan.HaveStatusEffect(WetHash); bool flag6 = sEMan.HaveStatusEffect(SoakedHash); bool flag7 = sEMan.HaveStatusEffect(FreezingHash); if (HasAnyFrostResistance(__instance, sEMan)) { if (sEMan.HaveStatusEffect(ColdHash)) { sEMan.RemoveStatusEffect(ColdHash, false); } if (sEMan.HaveStatusEffect(ColdDayHash)) { sEMan.RemoveStatusEffect(ColdDayHash, false); } if (sEMan.HaveStatusEffect(ShiveringHash)) { sEMan.RemoveStatusEffect(ShiveringHash, false); } return; } bool flag8 = (Object)(object)EnvMan.instance != (Object)null && EnvMan.IsDay(); bool flag9 = IsUnderdressed(__instance); bool flag10 = NearHeatSource(sEMan); bool flag11 = flag8 && flag9 && !flag10 && !flag7; bool flag12 = sEMan.HaveStatusEffect(ColdDayHash); if (flag11 && !flag12 && !sEMan.HaveStatusEffect(ColdHash)) { sEMan.AddStatusEffect(ColdDayHash, false, 0, 0f); } else if ((!flag11 && flag12) || sEMan.HaveStatusEffect(ColdHash)) { sEMan.RemoveStatusEffect(ColdDayHash, false); } bool flag13 = sEMan.HaveStatusEffect(ColdHash); bool flag14 = sEMan.HaveStatusEffect(ColdDayHash); bool flag15 = flag; bool flag16 = !flag7 && (flag13 || flag14) && (flag15 || flag6); bool flag17 = sEMan.HaveStatusEffect(ShiveringHash); if (flag16 != flag17) { if (flag16) { sEMan.AddStatusEffect(ShiveringHash, false, 0, 0f); } else { sEMan.RemoveStatusEffect(ShiveringHash, false); } } } private static bool IsWearingCape(Player p) { return ((Humanoid)p).m_shoulderItem != null; } private static bool HasAnyFrostResistance(Player p, SEMan seMan) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0025: 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_002b: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 if (seMan.HaveStatusEffect(FrostMeadHash)) { return true; } DamageModifier damageModifier = ((Character)p).GetDamageModifier((DamageType)64); return (int)damageModifier == 7 || (int)damageModifier == 1 || (int)damageModifier == 5 || (int)damageModifier == 4 || (int)damageModifier == 3; } private static bool IsUnderdressed(Player p) { bool flag = false; ItemData chestItem = ((Humanoid)p).m_chestItem; ItemData legItem = ((Humanoid)p).m_legItem; return chestItem == null || legItem == null; } private static bool NearHeatSource(SEMan seMan) { int num = BalrondHashCompat.StableHash("Warm"); int num2 = BalrondHashCompat.StableHash("Burning"); int num3 = BalrondHashCompat.StableHash("CampFire"); return seMan.HaveStatusEffect(num) || seMan.HaveStatusEffect(num2) || seMan.HaveStatusEffect(num3); } } [HarmonyPatch(typeof(Bed), "CheckWet")] internal static class Bed_CheckWet_Patch { private static readonly int SoakedHash = BalrondHashCompat.StableHash("SE_Soaked_bal"); private static bool Prefix(Player human, ref bool __result) { if ((Object)(object)human == (Object)null) { __result = true; return false; } SEMan sEMan = ((Character)human).GetSEMan(); if (sEMan == null) { __result = true; return false; } bool flag = sEMan.HaveStatusEffect(SEMan.s_statusEffectWet); bool flag2 = sEMan.HaveStatusEffect(SoakedHash); if (!flag && !flag2) { __result = true; return false; } ((Character)human).Message((MessageType)2, "$msg_bedwet", 0, (Sprite)null); __result = false; return false; } } internal static class WaterStateHelper { internal static bool IsWaterWet(Player p) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return false; } try { float liquidLevel = ((Character)p).GetLiquidLevel(); float y = ((Component)p).transform.position.y; float num = liquidLevel - y; if (num > 0.75f) { return true; } } catch { } try { if (((Character)p).IsSwimming()) { return true; } } catch { } return false; } } internal static class WetTuning { private const float LesserWet_HealthRegenMult = 0.9f; private const float LesserWet_StaminaRegenMult = 0.95f; private const float LesserWet_EitrRegenMult = 0.95f; private const bool KeepFireResist = true; private const bool KeepFrostWeak = false; private const bool KeepLightningWeak = true; public static void Apply(ObjectDB odb) { if (!((Object)(object)odb == (Object)null)) { StatusEffect statusEffect = odb.GetStatusEffect(BalrondHashCompat.StableHash("Wet")); SE_Stats val = (SE_Stats)(object)((statusEffect is SE_Stats) ? statusEffect : null); if (!((Object)(object)val == (Object)null)) { val.m_healthRegenMultiplier = 0.9f; val.m_staminaRegenMultiplier = 0.95f; val.m_eitrRegenMultiplier = 0.95f; bool flag = false; bool flag2 = true; SetDamageMod(val, (DamageType)64, (DamageModifier)0); bool flag3 = false; } } } private static void SetDamageMod(SE_Stats se, DamageType type, DamageModifier mod) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < se.m_mods.Count; i++) { if (se.m_mods[i].m_type == type) { DamageModPair value = se.m_mods[i]; value.m_modifier = mod; se.m_mods[i] = value; return; } } se.m_mods.Add(new DamageModPair { m_type = type, m_modifier = mod }); } } } [HarmonyPatch] internal static class WorldGenPatches { [HarmonyPatch(typeof(ZoneSystem), "SetupLocations")] private class ZoneSystem_SetupLocations { private static void Prefix(ZoneSystem __instance) { ChangeSurtlingSpawner(__instance); Debug.Log((object)string.Format("{0} Loaded Vegetation: {1}", "BalrondAmazingNature", VegetationBuilder.ZoneVegetations.Count)); List vegetation = __instance.m_vegetation; foreach (ZoneVegetation veg in VegetationBuilder.ZoneVegetations) { if (!vegetation.Exists((ZoneVegetation x) => x.m_name == veg.m_name && x.m_biome == veg.m_biome)) { vegetation.Add(veg); } } vegetation.RemoveAll((ZoneVegetation x) => (Object)(object)x.m_prefab == (Object)null); __instance.m_locations.AddRange(LocationBuilder.zoneLocations); Object.DestroyImmediate((Object)(object)__instance.m_locationProxyPrefab.GetComponent()); __instance.m_locationProxyPrefab.AddComponent(); } private static void Postfix(ZoneSystem __instance) { Launch.locationBuilder.editLocations(__instance.m_locations); Launch.vegetationBuilder.editVege(__instance.m_vegetation); __instance.m_vegetation.RemoveAll((ZoneVegetation x) => (Object)(object)x.m_prefab == (Object)null); } private static void ChangeSurtlingSpawner(ZoneSystem __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) __instance.m_locations.RemoveAll((ZoneLocation x) => x.m_prefabName == "Meteorite"); ZoneLocation val = __instance.m_locations.Find((ZoneLocation x) => x.m_prefabName == "FireHole"); if (val != null) { val.m_biome = (Biome)32; val.m_quantity *= 2; } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class Patch_ZNetScene_Awake_MonsterDoorSensors { private static void Postfix() { MonsterDoorSensorService.RegisterDefaultRules(); MonsterDoorSensorService.ApplyToZNetScene(); } } [HarmonyPatch(typeof(MessageHud), "UpdateBiomeFound")] private class MessageHud_UpdateBiomeFound_Awake { private static void Postfix(MessageHud __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.m_biomeMsgInstance != (Object)null) { sizeDelta = ((Component)__instance.m_biomeMsgInstance.transform.Find("UnlockMessage/Title")).GetComponent().sizeDelta; sizeDelta += new Vector2(200f, 0f); addedWidth = true; ((Component)__instance.m_biomeMsgInstance.transform.Find("UnlockMessage/Title")).GetComponent().sizeDelta = sizeDelta; } } } [HarmonyPatch(typeof(ClutterSystem), "Awake")] private class ClutterSystem_Awake { private static void Postfix(ClutterSystem __instance) { foreach (ClutterSettings clutterObject in Launch.clutterBuilder.clutterObjects) { Clutter item = CreateClutterObject(clutterObject); __instance.m_clutter.Add(item); } } private static Clutter CreateClutterObject(ClutterSettings settings) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown return new Clutter { m_name = settings.name, m_biome = settings.biome, m_minOceanDepth = settings.minOceanDepth, m_maxOceanDepth = settings.maxOceanDepth, m_minAlt = settings.minAlt, m_maxAlt = settings.maxAlt, m_snapToWater = settings.snapToWater, m_instanced = settings.instanced, m_prefab = settings.prefab, m_amount = settings.amount, m_fractalOffset = settings.fractalOffset, m_fractalScale = settings.fractalScale, m_fractalTresholdMax = settings.fractalTresholdMax, m_fractalTresholdMin = settings.fractalTresholdMin, m_scaleMin = settings.scaleMin, m_scaleMax = settings.scaleMax, m_inForest = false, m_forestTresholdMin = 0.1f, m_forestTresholdMax = 99f, m_enabled = true, m_maxTilt = 22f, m_maxVegetation = 666f, m_onUncleared = true, m_onCleared = false }; } } [HarmonyPatch(typeof(Location), "Awake")] private static class Location_Awake_Patch { private static void Postfix(Location __instance) { DisableBuildZoneForLocation(__instance); } } public static float timer = 500f; public static float counter = 1000f; public static bool removeTag = false; public static string[] dungName = new string[8] { "WoodFarm1", "WoodVillage1", "GoblinCamp2", "MountainCave02", "Crypt2", "Crypt3", "Crypt4", "SunkenCrypt4" }; public static Random rnd = new Random(); private static HashSet takenNamesCache = new HashSet(); public static Vector2 sizeDelta; public static bool addedWidth = false; private static readonly Dictionary DisableLocationRange = new Dictionary { { "StartTemple", 25 }, { "Eikthyrnir", 14 }, { "GDKing", 25 }, { "Bonemass", 20 }, { "Dragonqueen", 16 }, { "GoblinKing", 34 }, { "FaderLocation", 34 }, { "CharredFortress", 34 } }; private static void TryAssignRandomName(Location location, LocationProxy locationProxy = null) { if ((Object)(object)location == (Object)null) { return; } string key = editZnetName(((Object)((Component)location).gameObject).name); if (!DungeonNameGenList.dungeonNameList.TryGetValue(key, out var value) || value == null || value.Length == 0) { return; } string text = ""; bool flag = false; if ((Object)(object)locationProxy != (Object)null) { ZDO val = ((Component)locationProxy).GetComponent()?.m_zdo; if (val != null) { text = val.GetString("BalrondLocationName", ""); if (text != null && text != "") { takenNamesCache.Add(text); flag = true; } } } if (string.IsNullOrEmpty(text) || !flag) { string text2 = ""; for (int i = 0; i < 10; i++) { string text3 = value[rnd.Next(value.Length)]; if (!takenNamesCache.Contains(text3)) { text = text3; text2 = text3; takenNamesCache.Add(text3); break; } } if (string.IsNullOrEmpty(text)) { text = value[rnd.Next(value.Length)]; } Debug.Log((object)("Set Location name: " + text)); location.m_discoverLabel = text; Transform val2 = ((Component)location).transform.Find("Gateway"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.GetComponent().m_enterText = text; } } if ((Object)(object)locationProxy != (Object)null && !flag) { ZDO val3 = ((Component)locationProxy).GetComponent()?.m_zdo; if (val3 != null) { val3.Set("BalrondLocationName", text); } } } public static string editZnetName(string name) { name = name.Replace("(Clone)", ""); int num = name.IndexOf("("); if (num >= 0) { name = name.Substring(0, num); } return name.Trim(); } public static void DisableBuildZoneForLocation(Location location) { if (!((Object)(object)location == (Object)null) && !((Object)(object)((Component)location).gameObject == (Object)null)) { string prefabName = Utils.GetPrefabName(((Component)location).gameObject); if (DisableLocationRange.TryGetValue(prefabName, out var value) && value > 0) { location.m_noBuild = true; location.m_noBuildRadiusOverride = value; } } } } public class CommonItemReferences { public static GameObject wood; public static GameObject fineWood; public static GameObject stone; public static GameObject flint; public static GameObject iron; public static GameObject copper; public static GameObject coal; public static GameObject leatherScraps; } public class RecipeEdits { private List items; private List buildPieces; private readonly Dictionary _itemCache = new Dictionary(); private GameObject FindItem(List list, string name) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name); if ((Object)(object)itemPrefab != (Object)null) { return itemPrefab; } return FindInDatabase("Wood"); } private GameObject FindItem(string name) { if (_itemCache.TryGetValue(name, out var value)) { return value; } GameObject val = FindInDatabase(name); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)(Launch.projectName + ": Item Not Found - " + name + ", Replaced With Wood")); val = FindInDatabase("Wood"); } if ((Object)(object)val != (Object)null) { _itemCache[name] = val; } return val; } private GameObject FindInDatabase(string name) { return ObjectDB.instance.GetItemPrefab(name); } public void editRecipes(List recipes, List list) { if (recipes == null || recipes.Count == 0) { Debug.LogWarning((object)"There are no recipes!"); return; } if (list == null || list.Count == 0) { Debug.LogWarning((object)"There are no items!"); return; } items = list; buildPieces = ObjectDB.instance.GetItemPrefab("Hammer").GetComponent().m_itemData.m_shared.m_buildPieces.m_pieces; TableMapper.setupTables(null, buildPieces); foreach (Recipe recipe in recipes) { if (!((Object)(object)recipe.m_item == (Object)null)) { CheckRecipe(recipe); } } } private void CheckRecipe(Recipe recipe) { List list = new List(); switch (((Object)((Component)recipe.m_item).gameObject).name) { case "HelmetBerserkerHood": recipe.m_amount = 1; list.Add(createReq("BjornHide", 4, 2)); list.Add(createReq("TrophyBjorn", 1, 0)); list.Add(createReq("StrawThread_bal", 4, 2)); list.Add(createReq("BoneFragments", 10, 5)); recipe.m_resources = list.ToArray(); break; case "ArmorBerserkerChest": recipe.m_amount = 1; list.Add(createReq("BjornHide", 6, 3)); list.Add(createReq("Blueberries", 6, 3)); list.Add(createReq("StrawThread_bal", 10, 5)); list.Add(createReq("BjornPaw", 2, 0)); recipe.m_resources = list.ToArray(); break; case "ArmorBerserkerLegs": recipe.m_amount = 1; list.Add(createReq("BjornHide", 4, 2)); list.Add(createReq("Blueberries", 6, 3)); list.Add(createReq("StrawThread_bal", 6, 2)); list.Add(createReq("LeatherScraps", 8, 4)); recipe.m_resources = list.ToArray(); break; case "Bronze": if (((Object)recipe).name == "Recipe_Bronze") { recipe.m_amount = 2; list.Add(createReq("Tin", 1, 0)); list.Add(createReq("Copper", 2, 0)); list.Add(createReq("Coal", 2, 0)); recipe.m_resources = list.ToArray(); } if (((Object)recipe).name == "Recipe_Bronze5") { recipe.m_amount = 10; list.Add(createReq("Tin", 4, 0)); list.Add(createReq("Copper", 9, 0)); list.Add(createReq("Coal", 7, 0)); recipe.m_resources = list.ToArray(); } break; case "ShocklateSmoothie": recipe.m_amount = 2; list.Add(createReq("Ooze", 3, 0)); list.Add(createReq("WaterJug_bal", 1, 0)); list.Add(createReq("Raspberry", 3, 0)); list.Add(createReq("Blueberries", 3, 0)); recipe.m_resources = list.ToArray(); break; case "ScorchingMedley": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.grill; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 3; recipe.m_amount = 3; list.Add(createReq("MushroomJotunPuffs", 3, 0)); list.Add(createReq("SpiceSet_bal", 1, 0)); list.Add(createReq("Fiddleheadfern", 3, 0)); list.Add(createReq("Ignicap_bal", 2, 0)); recipe.m_resources = list.ToArray(); break; case "MashedMeat": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.grill; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 3; recipe.m_amount = 2; list.Add(createReq("AsksvinMeat", 2, 0)); list.Add(createReq("VoltureMeat", 1, 0)); list.Add(createReq("Fiddleheadfern", 2, 0)); list.Add(createReq("MeatScrap_bal", 5, 0)); recipe.m_resources = list.ToArray(); break; case "WolfMeatSkewer": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.grill; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; recipe.m_amount = 2; list.Add(createReq("WolfMeat", 2, 0)); list.Add(createReq("Mushroom", 5, 0)); list.Add(createReq("Onion", 3, 0)); recipe.m_resources = list.ToArray(); break; case "Wolfjerky": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.grill; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; recipe.m_amount = 2; list.Add(createReq("WolfMeat", 1, 0)); list.Add(createReq("Honey", 1, 0)); recipe.m_resources = list.ToArray(); break; case "Sausages": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.grill; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; recipe.m_amount = 3; list.Add(createReq("Entrails", 4, 0)); list.Add(createReq("RawMeat", 1, 0)); list.Add(createReq("Thistle", 1, 0)); recipe.m_resources = list.ToArray(); break; case "SizzlingBerryBroth": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.cauldron; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 5; recipe.m_amount = 2; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Sap", 4, 0)); list.Add(createReq("Fiddleheadfern", 3, 0)); list.Add(createReq("Vineberry", 3, 0)); recipe.m_resources = list.ToArray(); break; case "CarrotSoup": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.cauldron; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; recipe.m_amount = 2; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Carrot", 4, 0)); recipe.m_resources = list.ToArray(); break; case "TurnipStew": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.cauldron; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 2; recipe.m_amount = 2; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Turnip", 5, 0)); recipe.m_resources = list.ToArray(); break; case "BlackSoup": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.cauldron; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 2; recipe.m_amount = 2; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Bloodbag", 1, 0)); list.Add(createReq("Honey", 1, 0)); recipe.m_resources = list.ToArray(); break; case "FierySvinstew": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.cauldron; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 5; recipe.m_amount = 2; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Vineberry", 3, 0)); list.Add(createReq("AsksvinMeat", 1, 0)); list.Add(createReq("MushroomSmokePuff", 2, 0)); recipe.m_resources = list.ToArray(); break; case "OnionSoup": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.cauldron; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 2; recipe.m_amount = 2; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Onion", 2, 0)); recipe.m_resources = list.ToArray(); break; case "SerpentStew": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.cauldron; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; recipe.m_amount = 2; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Honey", 2, 0)); list.Add(createReq("Mushroom", 3, 0)); list.Add(createReq("SerpentMeatCooked", 2, 0)); recipe.m_resources = list.ToArray(); break; case "Feaster": recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.forge; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; list.Add(createReq("Tin", 6, 0)); list.Add(createReq("ClayPot_bal", 2, 0)); list.Add(createReq("CarvedWood_bal", 6, 0)); list.Add(createReq("WaterJug_bal", 1, 0)); recipe.m_resources = list.ToArray(); break; case "SwordNiedhogg": case "SwordNiedhoggBlood": case "SwordNiedhoggLightning": case "SwordNiedhoggNature": case "SwordDyrnwyn": case "THSwordSlayer": case "THSwordSlayerBlood": case "THSwordSlayerLightning": case "THSwordSlayerNature": case "AxeBerzerkr": case "AxeBerzerkrBlood": case "AxeBerzerkrLightning": case "AxeBerzerkrNature": case "MaceEldner": case "MaceEldnerBlood": case "MaceEldnerLightning": case "MaceEldnerNature": case "CrossbowRipper": case "CrossbowRipperBlood": case "CrossbowRipperLightning": case "CrossbowRipperNature": case "BowAshlands": case "BowAshlandsBlood": case "BowAshlandsRoot": case "BowAshlandsStorm": case "ShieldFlametal": case "ShieldFlametalTower": recipe.m_craftingStation = TableMapper.blackforge; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; break; case "ArmorRootChest": list.Add(createReq("Root", 10, 5)); list.Add(createReq("ElderBark", 16, 8)); list.Add(createReq("DeerHide", 4, 2)); list.Add(createReq("NeckSkin_bal", 6, 3)); recipe.m_craftingStation = TableMapper.heavyWorkbench; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; break; case "ArmorRootLegs": list.Add(createReq("Root", 8, 4)); list.Add(createReq("ElderBark", 12, 6)); list.Add(createReq("BoarHide_bal", 4, 2)); list.Add(createReq("NeckSkin_bal", 4, 2)); recipe.m_craftingStation = TableMapper.heavyWorkbench; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; break; case "HelmetRoot": list.Add(createReq("Root", 6, 3)); list.Add(createReq("ElderBark", 12, 6)); list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("NeckSkin_bal", 2, 1)); recipe.m_craftingStation = TableMapper.heavyWorkbench; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; break; case "Lantern": list.Add(createReq("BellMetal_bal", 2, 1)); list.Add(createReq("SurtlingCore", 1, 0)); list.Add(createReq("Crystal", 1, 0)); list.Add(createReq("HardWood_bal", 2, 1)); recipe.m_craftingStation = TableMapper.ironworks; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 3; recipe.m_resources = list.ToArray(); break; case "CeramicPlate": recipe.m_enabled = false; break; case "StaffSkeleton": list.Add(createReq("TrophySkeletonPoison", 1, 1)); list.Add(createReq("CursedBone_bal", 4, 2)); list.Add(createReq("CorruptedEitr_bal", 8, 4)); list.Add(createReq("Ruby", 3, 1)); recipe.m_craftingStation = TableMapper.shamantable; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 1; recipe.m_resources = list.ToArray(); break; case "FishWraps": recipe.m_enabled = false; break; case "THSwordKrom": list.Add(createReq("HardWood_bal", 2, 1)); list.Add(createReq("ScaleHide", 4, 2)); list.Add(createReq("BellMetal_bal", 8, 4)); list.Add(createReq("DarkSteel_bal", 20, 10)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "SwordMistwalker": list.Add(createReq("YggdrasilWood", 4, 2)); list.Add(createReq("Eitr", 8, 4)); list.Add(createReq("Wisp", 4, 2)); list.Add(createReq("DarkSteel_bal", 10, 5)); recipe.m_resources = list.ToArray(); break; case "SwordSilver": list.Add(createReq("HardWood_bal", 4, 2)); list.Add(createReq("LeatherScraps", 8, 4)); list.Add(createReq("DarkSteel_bal", 4, 2)); list.Add(createReq("Silver", 30, 15)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "AxeJotunBane": list.Add(createReq("YggdrasilWood", 4, 2)); list.Add(createReq("Bilebag", 4, 2)); list.Add(createReq("Eitr", 10, 2)); list.Add(createReq("DarkSteel_bal", 10, 5)); recipe.m_resources = list.ToArray(); break; case "KnifeSkollAndHati": list.Add(createReq("BlackMetal", 10, 5)); list.Add(createReq("FineWood", 6, 3)); list.Add(createReq("BellMetal_bal", 10, 5)); list.Add(createReq("StrawThread_bal", 6, 3)); recipe.m_resources = list.ToArray(); break; case "PickaxeStone": recipe.m_enabled = true; recipe.m_minStationLevel = 2; list.Add(createReq("Wood", 6, 2)); list.Add(createReq("LeatherScraps", 6, 2)); list.Add(createReq("Flint", 10, 5)); recipe.m_resources = list.ToArray(); break; case "ArmorMageLegs": list.Add(createReq("Eitr", 20, 10)); list.Add(createReq("LinenThread", 12, 6)); list.Add(createReq("JuteRed", 2, 1)); list.Add(createReq("FreezeGland", 4, 2)); recipe.m_resources = list.ToArray(); break; case "ArmorMageChest": list.Add(createReq("Eitr", 20, 10)); list.Add(createReq("LinenThread", 12, 6)); list.Add(createReq("Feathers", 4, 2)); list.Add(createReq("ScaleHide", 4, 2)); recipe.m_resources = list.ToArray(); break; case "StaffIceShards": list.Add(createReq("YggdrasilWood", 20, 10)); list.Add(createReq("Eitr", 12, 6)); list.Add(createReq("Crystal", 4, 2)); list.Add(createReq("FreezeGland", 4, 2)); recipe.m_resources = list.ToArray(); break; case "StaffShield": list.Add(createReq("YggdrasilWood", 20, 10)); list.Add(createReq("Eitr", 12, 6)); list.Add(createReq("GiantBloodSack", 4, 2)); list.Add(createReq("Bloodbag", 6, 3)); recipe.m_resources = list.ToArray(); break; case "StaffFireball": list.Add(createReq("YggdrasilWood", 20, 10)); list.Add(createReq("Eitr", 12, 6)); list.Add(createReq("SurtlingCore", 4, 2)); list.Add(createReq("Resin", 20, 10)); recipe.m_resources = list.ToArray(); break; case "QueensJam": list.Add(createReq("Honey", 1, 0)); list.Add(createReq("ClayPot_bal", 1, 0)); list.Add(createReq("Raspberry", 2, 0)); list.Add(createReq("Blueberries", 2, 0)); recipe.m_amount = 1; recipe.m_resources = list.ToArray(); break; case "LoxPieUncooked": list.Add(createReq("BarleyFlour", 4, 0)); list.Add(createReq("Thistle", 2, 0)); list.Add(createReq("Dandelion", 2, 0)); list.Add(createReq("LoxMeat", 2, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseEitrMinor": list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Sap", 4, 0)); list.Add(createReq("MushroomJotunPuffs", 3, 0)); list.Add(createReq("MushroomMagecap", 5, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseFrostResist": list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Thistle", 4, 0)); list.Add(createReq("Bloodbag", 2, 0)); list.Add(createReq("GreydwarfEye", 3, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseHealthMajor": list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Sap", 4, 0)); list.Add(createReq("GiantBloodSack", 4, 0)); list.Add(createReq("RoyalJelly", 5, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseHealthMedium": list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Bloodbag", 5, 0)); list.Add(createReq("Blackberries_bal", 10, 0)); list.Add(createReq("Thistle", 3, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseHealthMinor": list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Thistle", 3, 0)); list.Add(createReq("Apple_bal", 2, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBasePoisonResist": list.Add(createReq("TrophySkeleton", 2, 0)); list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Coal", 8, 0)); list.Add(createReq("NeckTail", 3, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseStaminaLingering": list.Add(createReq("Sap", 6, 0)); list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("MushroomJotunPuffs", 8, 0)); list.Add(createReq("Cloudberry", 12, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseStaminaMedium": list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("MushroomYellow", 8, 0)); list.Add(createReq("Cloudberry", 12, 0)); list.Add(createReq("Darkbul_bal", 6, 0)); recipe.m_resources = list.ToArray(); break; case "MeadBaseStaminaMinor": list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("MushroomYellow", 6, 0)); list.Add(createReq("Blackberries_bal", 4, 0)); list.Add(createReq("Straw_bal", 10, 0)); recipe.m_resources = list.ToArray(); break; case "Hammer": list.Add(createReq("Wood", 4, 1)); list.Add(createReq("Flint", 0, 1)); list.Add(createReq("LeatherScraps", 0, 1)); list.Add(createReq("Stone", 2, 0)); recipe.m_resources = list.ToArray(); break; case "Hoe": list.Add(createReq("Wood", 6, 0)); list.Add(createReq("Flint", 0, 1)); list.Add(createReq("LeatherScraps", 0, 2)); list.Add(createReq("Stone", 2, 0)); recipe.m_resources = list.ToArray(); break; case "HelmetFenring": list.Add(createReq("WolfHairBundle", 18, 6)); list.Add(createReq("WolfPelt", 3, 4)); list.Add(createReq("TrophyCultist", 1, 0)); list.Add(createReq("StrawThread_bal", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "ArmorFenringChest": case "ArmorFenringLegs": list.Add(createReq("WolfHairBundle", 18, 6)); list.Add(createReq("WolfPelt", 6, 4)); list.Add(createReq("BoarHide_bal", 6, 2)); list.Add(createReq("StrawThread_bal", 8, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "AtgeirBronze": list.Add(createReq("Bronze", 8, 4)); list.Add(createReq("Wood", 12, 3)); list.Add(createReq("LeatherScraps", 6, 2)); list.Add(createReq("StrawThread_bal", 4, 2)); recipe.m_resources = list.ToArray(); break; case "AtgeirIron": list.Add(createReq("Iron", 28, 12)); list.Add(createReq("HardWood_bal", 5, 2)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("StrawThread_bal", 6, 3)); recipe.m_resources = list.ToArray(); break; case "AtgeirBlackmetal": list.Add(createReq("BlackMetal", 28, 12)); list.Add(createReq("HardWood_bal", 8, 4)); list.Add(createReq("LeatherScraps", 10, 4)); list.Add(createReq("LinenThread", 6, 4)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "ArmorWolfLegs": list.Add(createReq("Silver", 16, 8)); list.Add(createReq("WolfPelt", 6, 3)); list.Add(createReq("WolfFang", 6, 0)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "ArmorWolfChest": list.Add(createReq("Silver", 18, 9)); list.Add(createReq("WolfPelt", 4, 2)); list.Add(createReq("LeatherScraps", 8, 4)); list.Add(createReq("Chain", 2, 0)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "PickaxeBronze": list.Add(createReq("RoundLog", 4, 2)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("Bronze", 10, 5)); list.Add(createReq("StrawThread_bal", 4, 2)); recipe.m_resources = list.ToArray(); break; case "MaceBronze": list.Add(createReq("RoundLog", 2, 1)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("Bronze", 8, 4)); list.Add(createReq("StrawThread_bal", 4, 2)); recipe.m_resources = list.ToArray(); break; case "MaceIron": list.Add(createReq("FineWood", 4, 2)); list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("Iron", 18, 9)); list.Add(createReq("StrawThread_bal", 4, 2)); recipe.m_resources = list.ToArray(); break; case "MaceNeedle": list.Add(createReq("FineWood", 6, 3)); list.Add(createReq("BlackMetal", 10, 5)); list.Add(createReq("Needle", 4, 2)); list.Add(createReq("JuteRed", 2, 1)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "MaceSilver": list.Add(createReq("ElderBark", 20, 10)); list.Add(createReq("Silver", 24, 12)); list.Add(createReq("FreezeGland", 6, 3)); list.Add(createReq("YmirRemains", 6, 0)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "KnifeButcher": list.Add(createReq("Tin", 4, 0)); list.Add(createReq("FineWood", 4, 2)); list.Add(createReq("LeatherScraps", 2, 0)); list.Add(createReq("StrawThread_bal", 2, 0)); recipe.m_craftingStation = TableMapper.heavyWorkbench; recipe.m_resources = list.ToArray(); break; case "KnifeChitin": list.Add(createReq("Chitin", 20, 10)); list.Add(createReq("FineWood", 4, 2)); list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("StrawThread_bal", 2, 1)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.heavyWorkbench; break; case "PickaxeIron": list.Add(createReq("StrawThread_bal", 4, 2)); list.Add(createReq("HardWood_bal", 4, 2)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("Iron", 18, 9)); recipe.m_resources = list.ToArray(); break; case "PickaxeBlackMetal": list.Add(createReq("LinenThread", 4, 2)); list.Add(createReq("HardWood_bal", 8, 4)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("BlackMetal", 22, 11)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "AxeIron": list.Add(createReq("RoundLog", 4, 2)); list.Add(createReq("BoarHide_bal", 1, 0)); list.Add(createReq("LeatherScraps", 2, 1)); list.Add(createReq("Iron", 18, 10)); recipe.m_resources = list.ToArray(); break; case "AxeBlackMetal": list.Add(createReq("HardWood_bal", 4, 2)); list.Add(createReq("JuteRed", 2, 1)); list.Add(createReq("LinenThread", 4, 2)); list.Add(createReq("BlackMetal", 16, 8)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "SwordIron": list.Add(createReq("HardWood_bal", 3, 1)); list.Add(createReq("BoarHide_bal", 1, 0)); list.Add(createReq("LeatherScraps", 2, 1)); list.Add(createReq("Iron", 18, 10)); recipe.m_resources = list.ToArray(); break; case "SwordBronze": list.Add(createReq("Wood", 4, 2)); list.Add(createReq("StrawThread_bal", 2, 1)); list.Add(createReq("LeatherScraps", 2, 1)); list.Add(createReq("Bronze", 8, 4)); recipe.m_resources = list.ToArray(); break; case "SwordBlackmetal": list.Add(createReq("HardWood_bal", 4, 2)); list.Add(createReq("JuteRed", 2, 1)); list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("BlackMetal", 20, 10)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "AxeBronze": list.Add(createReq("RoundLog", 4, 2)); list.Add(createReq("BoarHide_bal", 1, 0)); list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("Bronze", 6, 3)); recipe.m_resources = list.ToArray(); break; case "AxeFlint": list.Add(createReq("Wood", 4, 2)); list.Add(createReq("BoarHide_bal", 1, 0)); list.Add(createReq("LeatherScraps", 2, 1)); list.Add(createReq("Flint", 6, 3)); recipe.m_resources = list.ToArray(); break; case "HelmetPadded": list.Add(createReq("LeatherScraps", 10, 5)); list.Add(createReq("LinenThread", 12, 6)); list.Add(createReq("BlackMetal", 6, 3)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "ArmorPaddedCuirass": list.Add(createReq("LoxPelt", 4, 2)); list.Add(createReq("LinenThread", 14, 7)); list.Add(createReq("BlackMetal", 6, 3)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "ArmorPaddedGreaves": list.Add(createReq("BoarHide_bal", 6, 3)); list.Add(createReq("LinenThread", 20, 10)); list.Add(createReq("BlackMetal", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "HelmetIron": list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("Iron", 14, 7)); recipe.m_resources = list.ToArray(); break; case "ArmorIronChest": list.Add(createReq("TrollHide", 4, 2)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("Iron", 18, 9)); recipe.m_resources = list.ToArray(); break; case "ArmorIronLegs": list.Add(createReq("TrollHide", 6, 3)); list.Add(createReq("LeatherScraps", 8, 4)); list.Add(createReq("Iron", 16, 8)); recipe.m_resources = list.ToArray(); break; case "HelmetBronze": list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("StrawThread_bal", 4, 2)); list.Add(createReq("Bronze", 6, 3)); recipe.m_resources = list.ToArray(); break; case "ArmorBronzeChest": list.Add(createReq("DeerHide", 2, 1)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("Bronze", 8, 4)); recipe.m_resources = list.ToArray(); break; case "ArmorBronzeLegs": list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("DeerHide", 2, 1)); list.Add(createReq("Bronze", 6, 3)); recipe.m_resources = list.ToArray(); break; case "HelmetTrollLeather": list.Add(createReq("StrawThread_bal", 2, 1)); list.Add(createReq("TrollHide", 4, 2)); list.Add(createReq("BoneFragments", 4, 2)); recipe.m_craftingStation = TableMapper.heavyWorkbench; recipe.m_repairStation = TableMapper.heavyWorkbench; break; case "CapeTrollHide": recipe.m_minStationLevel = 1; list.Add(createReq("StrawThread_bal", 4, 2)); list.Add(createReq("TrollHide", 8, 4)); list.Add(createReq("BoneFragments", 4, 2)); recipe.m_craftingStation = TableMapper.heavyWorkbench; recipe.m_repairStation = TableMapper.heavyWorkbench; break; case "ArmorTrollLeatherChest": case "ArmorTrollLeatherLegs": list.Add(createReq("BoneFragments", 3, 2)); list.Add(createReq("TrollHide", 4, 3)); list.Add(createReq("StrawThread_bal", 3, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.heavyWorkbench; recipe.m_repairStation = TableMapper.heavyWorkbench; break; case "CapeDeer": recipe.m_minStationLevel = 1; list.Add(createReq("DeerHide", 4, 3)); list.Add(createReq("StrawThread_bal", 3, 2)); list.Add(createReq("LeatherScraps", 5, 2)); recipe.m_resources = list.ToArray(); recipe.m_repairStation = TableMapper.heavyWorkbench; break; case "ArmorLeatherChest": list.Add(createReq("DeerHide", 4, 3)); list.Add(createReq("StrawThread_bal", 3, 2)); list.Add(createReq("LeatherScraps", 5, 2)); recipe.m_resources = list.ToArray(); break; case "ArmorLeatherLegs": list.Add(createReq("DeerHide", 3, 2)); list.Add(createReq("StrawThread_bal", 5, 4)); list.Add(createReq("LeatherScraps", 7, 3)); recipe.m_resources = list.ToArray(); break; case "SpearChitin": list.Add(createReq("FineWood", 16, 8)); list.Add(createReq("BoarHide_bal", 4, 2)); list.Add(createReq("Chitin", 24, 12)); list.Add(createReq("Resin", 8, 4)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.heavyWorkbench; break; case "SpearBronze": list.Add(createReq("RoundLog", 4, 2)); list.Add(createReq("DeerHide", 2, 1)); list.Add(createReq("Bronze", 6, 3)); list.Add(createReq("Resin", 4, 2)); recipe.m_resources = list.ToArray(); break; case "SpearCarapace": list.Add(createReq("YggdrasilWood", 8, 4)); list.Add(createReq("Carapace", 6, 3)); list.Add(createReq("Mandible", 2, 1)); list.Add(createReq("JuteRed", 2, 1)); recipe.m_resources = list.ToArray(); break; case "SpearElderbark": list.Add(createReq("ElderBark", 12, 6)); list.Add(createReq("TrollHide", 4, 2)); list.Add(createReq("Iron", 10, 5)); list.Add(createReq("Root", 1, 0)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.forge; break; case "SpearFlint": list.Add(createReq("Wood", 6, 3)); list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("Flint", 10, 5)); list.Add(createReq("StrawThread_bal", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.workbench; break; case "ShieldWood": list.Add(createReq("Wood", 12, 6)); list.Add(createReq("BoarHide_bal", 1, 0)); list.Add(createReq("Resin", 4, 2)); list.Add(createReq("LeatherScraps", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.workbench; break; case "ShieldWoodTower": list.Add(createReq("Wood", 14, 6)); list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("Resin", 8, 0)); list.Add(createReq("LeatherScraps", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.workbench; break; case "SaddleLox": list.Add(createReq("LinenThread", 22, 0)); list.Add(createReq("BlackMetal", 14, 0)); list.Add(createReq("BoarHide_bal", 5, 0)); list.Add(createReq("Resin", 6, 0)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.workbench; break; case "KnifeSilver": list.Add(createReq("Silver", 10, 5)); list.Add(createReq("ElderBark", 8, 4)); list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("Resin", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "KnifeCopper": list.Add(createReq("Copper", 10, 5)); list.Add(createReq("Wood", 4, 2)); list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("GreydwarfEye", 8, 4)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.heavyWorkbench; break; case "BombOoze": list.Add(createReq("Ooze", 5, 0)); list.Add(createReq("Resin", 5, 0)); list.Add(createReq("BoarHide_bal", 2, 0)); recipe.m_resources = list.ToArray(); break; case "Bow": list.Add(createReq("Wood", 10, 5)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("BoarHide_bal", 2, 1)); list.Add(createReq("StrawThread_bal", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.workbench; break; case "CrossbowArbalest": list.Add(createReq("StrawThread_bal", 10, 5)); list.Add(createReq("DarkSteel_bal", 12, 6)); list.Add(createReq("HardWood_bal", 14, 7)); list.Add(createReq("Root", 10, 5)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.fletcher; break; case "BowSpineSnap": list.Add(createReq("Eitr", 10, 5)); list.Add(createReq("BoneFragments", 30, 15)); list.Add(createReq("YggdrasilWood", 4, 2)); list.Add(createReq("LinenThread", 8, 4)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.fletcher; break; case "BowHuntsman": list.Add(createReq("Feathers", 12, 6)); list.Add(createReq("DeerHide", 4, 2)); list.Add(createReq("HardWood_bal", 6, 3)); list.Add(createReq("Iron", 18, 9)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.fletcher; break; case "BowFineWood": list.Add(createReq("FineWood", 16, 8)); list.Add(createReq("Bronze", 6, 3)); list.Add(createReq("BoarHide_bal", 6, 3)); list.Add(createReq("StrawThread_bal", 10, 5)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.fletcher; break; case "BowDraugrFang": list.Add(createReq("ElderBark", 16, 8)); list.Add(createReq("Silver", 18, 9)); list.Add(createReq("WolfPelt", 4, 2)); list.Add(createReq("Guck", 8, 4)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.fletcher; break; case "Battleaxe": list.Add(createReq("ElderBark", 20, 10)); list.Add(createReq("Iron", 30, 15)); list.Add(createReq("BoarHide_bal", 4, 2)); list.Add(createReq("FineWood", 4, 2)); recipe.m_resources = list.ToArray(); break; case "BattleaxeCrystal": list.Add(createReq("ElderBark", 30, 15)); list.Add(createReq("Silver", 30, 15)); list.Add(createReq("Crystal", 10, 5)); list.Add(createReq("JuteRed", 4, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.ironworks; break; case "SledgeStagbreaker": list.Add(createReq("TrophyDeer", 2, 1)); list.Add(createReq("RoundLog", 6, 3)); list.Add(createReq("LeatherScraps", 6, 3)); list.Add(createReq("BoarHide_bal", 3, 2)); recipe.m_resources = list.ToArray(); recipe.m_craftingStation = TableMapper.heavyWorkbench; break; case "ArmorRagsChest": list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("BoarHide_bal", 2, 1)); recipe.m_resources = list.ToArray(); break; case "ArmorRagsLegs": list.Add(createReq("LeatherScraps", 4, 2)); list.Add(createReq("BoarHide_bal", 2, 1)); recipe.m_resources = list.ToArray(); break; } } private Requirement createReq(string name, int amount, int amountPerLevel) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Requirement val = new Requirement(); val.m_recover = true; ItemDrop component = FindItem(name).GetComponent(); val.m_resItem = component; val.m_amount = amount; val.m_amountPerLevel = amountPerLevel; return val; } } public sealed class ServingTrayBuilder { private struct Entry { public readonly string PrefabName; public readonly PieceCategory Category; public Entry(string prefabName, PieceCategory category) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) PrefabName = prefabName; Category = category; } } private List _prefabs; private static readonly Entry[] Entries = BuildEntries(); private static Entry[] BuildEntries() { List list = new List(128); Register(list, (PieceCategory)7, "OilBase_bal", "Bulion_bal", "Oil_bal", "RefinedOil_bal", "Milk_bal", "MagmaCoctail_bal", "KingsJam_bal", "FruitPunch_bal", "BloodyVial_bal", "BlackBerryJuice_bal", "AppleVinegar_bal"); Register(list, (PieceCategory)6, "HoneyGlazedApple_bal", "IceBerryPancake_bal", "Liverwurst_bal", "SpicyBurger_bal", "SpiecedDrakeChop_bal", "Surstromming_bal", "SwampSkause_bal", "VegetablePuree_bal", "VegetableSoup_bal", "WhiteCheese_bal", "WinterStew_bal", "CarrotFries_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", "SharkMeatCooked_bal", "TrollMeatCooked_bal", "NumbMeal_bal", "MincedMeat_bal", "GrilledCheese_bal", "GoatMeatCooked_bal", "FenringMeatCooked_bal", "DrakeMeatCooked_bal", "CrabLegsCooked_bal", "CookedCrowMeat_bal", "Cheese_bal", "ClamMeat_bal", "BatWingCooked_bal", "FishSkewer_bal", "Burger_bal", "ChickenMarsala_bal", "ChickenNuggets_bal", "FruitSalad_bal", "GrilledShrooms_bal", "BlueberryPie_bal", "ApplePie_bal", "AshlandCurry_bal", "BloodfruitSoup_bal", "BloodyBearJerky_bal", "BloodyCreamPie_bal", "SteakCooked_bal", "ApplePie_bal", "AppleVinegar_bal", "AppleVinegar_bal"); Register(list, (PieceCategory)5, "CookedDragonRibs_bal", "RostedTrollBits_bal", "HappyMeal_bal", "SeaFoodPlatter_bal", "DragonfireBarbecue_bal", "Breakfast_bal"); return Deduplicate(list); } private static void Register(List list, PieceCategory category, params string[] prefabNames) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) foreach (string text in prefabNames) { if (!string.IsNullOrEmpty(text)) { list.Add(new Entry(text, category)); } } } private static Entry[] Deduplicate(List list) { HashSet hashSet = new HashSet(StringComparer.Ordinal); List list2 = new List(list.Count); for (int i = 0; i < list.Count; i++) { Entry item = list[i]; if (!string.IsNullOrEmpty(item.PrefabName) && hashSet.Add(item.PrefabName)) { list2.Add(item); } } return list2.ToArray(); } public void SetupBuildPieces(List prefabs) { //IL_01a3: Unknown result type (might be due to invalid IL or missing references) _prefabs = prefabs; if (_prefabs == null || _prefabs.Count == 0) { Debug.LogWarning((object)"ServingTrayBuilder: Prefab list is null/empty."); return; } GameObject val = FindPrefab("Feaster"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"ServingTrayBuilder: Could not find Serving Tray prefab 'Feaster'."); return; } ItemDrop component = val.GetComponent(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { Debug.LogWarning((object)"ServingTrayBuilder: 'Feaster' ItemDrop/shared data missing."); return; } PieceTable buildPieces = component.m_itemData.m_shared.m_buildPieces; if ((Object)(object)buildPieces == (Object)null) { Debug.LogWarning((object)"ServingTrayBuilder: 'Feaster' has no build piece table."); return; } GameObject val2 = FindPrefab("FierySvinstew"); if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)"ServingTrayBuilder: Template prefab 'FierySvinstew' not found."); return; } Piece component2 = val2.GetComponent(); if ((Object)(object)component2 == (Object)null) { Debug.LogWarning((object)"ServingTrayBuilder: Template 'FierySvinstew' has no Piece component."); return; } WearNTear component3 = val2.GetComponent(); if ((Object)(object)component3 == (Object)null) { Debug.LogWarning((object)"ServingTrayBuilder: Template 'FierySvinstew' has no WearNTear component."); return; } int num = 0; for (int i = 0; i < Entries.Length; i++) { Entry entry = Entries[i]; GameObject val3 = FindPrefab(entry.PrefabName); if ((Object)(object)val3 == (Object)null) { Debug.LogWarning((object)("ServingTrayBuilder: Cant find item with name: " + entry.PrefabName)); } else if (!TryPrepareAsBuildPiece(val3, component2, component3, entry.Category)) { Debug.LogWarning((object)("ServingTrayBuilder: Cant prepare build piece for: " + entry.PrefabName)); } else if (EnsureInPieceTable(buildPieces, val3)) { num++; } } } private bool EnsureInPieceTable(PieceTable pieceTable, GameObject prefab) { if ((Object)(object)pieceTable == (Object)null || (Object)(object)prefab == (Object)null) { return false; } if (pieceTable.m_pieces == null) { pieceTable.m_pieces = new List(); } for (int i = 0; i < pieceTable.m_pieces.Count; i++) { GameObject val = pieceTable.m_pieces[i]; if ((Object)(object)val != (Object)null && ((Object)val).name == ((Object)prefab).name) { return false; } } pieceTable.m_pieces.Add(prefab); return true; } private bool TryPrepareAsBuildPiece(GameObject prefab, Piece templatePiece, WearNTear templateWnt, PieceCategory category) { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null || (Object)(object)templatePiece == (Object)null || (Object)(object)templateWnt == (Object)null) { return false; } Transform val = prefab.transform.Find("attach"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("ServingTrayBuilder: Attach not present on: " + ((Object)prefab).name)); return false; } ItemDrop component = prefab.GetComponent(); if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null) { Debug.LogWarning((object)("ServingTrayBuilder: ItemDrop/shared not present on: " + ((Object)prefab).name)); return false; } Piece val2 = prefab.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = prefab.AddComponent(); } CopyPieceSettings(val2, templatePiece); val2.m_category = category; val2.m_icon = SafeFirstIcon(component); val2.m_name = component.m_itemData.m_shared.m_name; val2.m_description = component.m_itemData.m_shared.m_description; SetSingleRequirement(val2, ((Object)prefab).name, 1, 0, recover: true); WearNTear val3 = prefab.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = prefab.AddComponent(); } CopyWearNTearSettings(val3, templateWnt); val3.m_broken = (val3.m_worn = (val3.m_new = ((Component)val).gameObject)); return true; } private static Sprite SafeFirstIcon(ItemDrop itemDrop) { try { Sprite[] icons = itemDrop.m_itemData.m_shared.m_icons; if (icons != null && icons.Length != 0) { return icons[0]; } } catch { } return null; } private static void CopyPieceSettings(Piece dst, Piece src) { //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) dst.m_allowAltGroundPlacement = src.m_allowAltGroundPlacement; dst.m_allowedInDungeons = src.m_allowedInDungeons; dst.m_allowRotatedOverlap = src.m_allowRotatedOverlap; dst.m_blockingPieces = src.m_blockingPieces; dst.m_blockRadius = src.m_blockRadius; dst.m_canBeRemoved = src.m_canBeRemoved; dst.m_canRotate = src.m_canRotate; dst.m_clipEverything = src.m_clipEverything; dst.m_clipGround = src.m_clipGround; dst.m_comfort = src.m_comfort; dst.m_comfortGroup = src.m_comfortGroup; dst.m_comfortObject = src.m_comfortObject; dst.m_connectRadius = src.m_connectRadius; dst.m_craftingStation = src.m_craftingStation; dst.m_cultivatedGroundOnly = src.m_cultivatedGroundOnly; dst.m_groundOnly = src.m_groundOnly; dst.m_groundPiece = src.m_groundPiece; ((StaticTarget)dst).m_haveCenter = ((StaticTarget)src).m_haveCenter; dst.m_inCeilingOnly = src.m_inCeilingOnly; dst.m_isUpgrade = src.m_isUpgrade; dst.m_mustBeAboveConnected = src.m_mustBeAboveConnected; dst.m_mustConnectTo = src.m_mustConnectTo; dst.m_waterPiece = src.m_waterPiece; dst.m_vegetationGroundOnly = src.m_vegetationGroundOnly; dst.m_targetNonPlayerBuilt = src.m_targetNonPlayerBuilt; dst.m_spaceRequirement = src.m_spaceRequirement; dst.m_placeEffect = src.m_placeEffect; dst.m_returnResourceHeightOffset = src.m_returnResourceHeightOffset; } private static void CopyWearNTearSettings(WearNTear dst, WearNTear src) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) dst.m_ashDamageImmune = src.m_ashDamageImmune; dst.m_ashDamageResist = src.m_ashDamageResist; dst.m_ashMaterialValue = src.m_ashMaterialValue; dst.m_ashDamageTime = src.m_ashDamageTime; dst.m_ashroof = src.m_ashroof; dst.m_autoCreateFragments = src.m_autoCreateFragments; dst.m_biome = src.m_biome; dst.m_health = src.m_health; dst.m_hitEffect = src.m_hitEffect; dst.m_hitNoise = src.m_hitNoise; dst.m_minToolTier = src.m_minToolTier; dst.m_burnable = src.m_burnable; dst.m_destroyedEffect = src.m_destroyedEffect; dst.m_switchEffect = src.m_switchEffect; dst.m_damages = src.m_damages; dst.m_destroyNoise = src.m_destroyNoise; dst.m_support = src.m_support; dst.m_staticPosition = src.m_staticPosition; dst.m_noSupportWear = src.m_noSupportWear; dst.m_noRoofWear = src.m_noRoofWear; } private void SetSingleRequirement(Piece piece, string resPrefabName, int amount, int amountPerLevel, bool recover) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (!((Object)(object)piece == (Object)null)) { Requirement val = new Requirement(); GameObject val2 = FindPrefabOrWood(resPrefabName); val.m_resItem = (((Object)(object)val2 != (Object)null) ? val2.GetComponent() : null); val.m_amount = amount; val.m_amountPerLevel = amountPerLevel; val.m_recover = recover; piece.m_resources = (Requirement[])(object)new Requirement[1] { val }; } } private GameObject FindPrefab(string name) { if (_prefabs == null || string.IsNullOrEmpty(name)) { return null; } for (int i = 0; i < _prefabs.Count; i++) { GameObject val = _prefabs[i]; if ((Object)(object)val != (Object)null && ((Object)val).name == name) { return val; } } return null; } private GameObject FindPrefabOrWood(string name) { GameObject val = FindPrefab(name); if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)(Launch.projectName + ": Item Not Found - " + name + ", Replaced With Wood")); return FindPrefab("Wood"); } } public class CraftingStationEdits { private GameObject connectorVfx; private GameObject connectorMageVfx; private List buildPieces = new List(); public void Setup(List list) { buildPieces = list; GameObject val = list.Find((GameObject x) => ((Object)x).name == "forge_ext1"); if ((Object)(object)val != (Object)null) { StationExtension component = val.GetComponent(); connectorVfx = (((Object)(object)component != (Object)null) ? component.m_connectionPrefab : null); } GameObject val2 = list.Find((GameObject x) => ((Object)x).name == "piece_magetable_ext"); if ((Object)(object)val2 != (Object)null) { StationExtension component2 = val2.GetComponent(); connectorMageVfx = (((Object)(object)component2 != (Object)null) ? component2.m_connectionPrefab : null); } EditTableExtension(); } private void EditTableExtension() { UpdateExtensionDistance(); string[] array = new string[28] { "fletcher_ext1_bal|piece_fletcher_bal", "fletcher_ext2_bal|piece_fletcher_bal", "fletcher_ext3_bal|piece_fletcher_bal", "fletcher_ext4_bal|piece_fletcher_bal", "heavyworkbench_ext1_bal|piece_heavy_workbench_bal", "heavyworkbench_ext2_bal|piece_heavy_workbench_bal", "heavyworkbench_ext3_bal|piece_heavy_workbench_bal", "heavyworkbench_ext4_bal|piece_heavy_workbench_bal", "ironworks_ext1_bal|piece_metalworks_bal", "ironworks_ext2_bal|piece_metalworks_bal", "ironworks_ext3_bal|piece_metalworks_bal", "ironworks_ext4_bal|piece_metalworks_bal", "runeforge_ext1_bal|piece_runeforge_bal", "runeforge_ext2_bal|piece_runeforge_bal", "runeforge_ext3_bal|piece_runeforge_bal", "runeforge_ext4_bal|piece_runeforge_bal", "artisan_ext2_bal|piece_artisanstation", "artisan_ext3_bal|piece_artisanstation", "magetable_ext4_bal|piece_magetable", "magetable_ext5_bal|piece_magetable", "shamantable_ext1_bal|piece_shamantable_bal", "shamantable_ext2_bal|piece_shamantable_bal", "shamantable_ext3_bal|piece_shamantable_bal", "shamantable_ext4_bal|piece_shamantable_bal", "grill_ext1_bal|piece_grill_bal", "grill_ext2_bal|piece_grill_bal", "grill_ext3_bal|piece_preptable", "workbench_ext5_bal|piece_workbench" }; string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(new char[1] { '|' }); string name = array3[0]; string text2 = array3[1]; GameObject connector = ((text2.Contains("runeforge") || text2.Contains("magetable") || text2.Contains("shamantable") || text2.Contains("grill")) ? connectorMageVfx : connectorVfx); UpdateTableExtension(name, text2, connector); } } private void UpdateExtensionDistance() { List list = buildPieces.FindAll((GameObject x) => (Object)(object)x.GetComponent() != (Object)null); foreach (GameObject item in list) { StationExtension component = item.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_maxStationDistance = 20f; Piece component2 = item.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.m_spaceRequirement = 1f; } } } } private void UpdateTableExtension(string name, string targetName, GameObject connector, int range = 20) { GameObject val = buildPieces.Find((GameObject x) => ((Object)x).name == targetName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Target Table not found: " + targetName)); return; } GameObject val2 = buildPieces.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)("Target Extension not found: " + name)); return; } Piece component = val2.GetComponent(); if (!((Object)(object)component != (Object)null)) { return; } CraftingStation component2 = val.GetComponent(); StationExtension val3 = val2.GetComponent(); if ((Object)(object)component2 != (Object)null) { if ((Object)(object)val3 == (Object)null) { val3 = val2.AddComponent(); } component.m_craftingStation = component2; val3.m_craftingStation = component2; val3.m_connectionPrefab = connector; val3.m_maxStationDistance = range; component.m_isUpgrade = true; } } } public sealed class RecipeRetarget { private readonly List _gameObjects = new List(); private readonly List _buildPieces = new List(); private readonly List _recipes = new List(); private static readonly string[] FletcherLv1 = new string[2] { "ArrowFlint", "ArrowFire" }; private static readonly string[] FletcherLv2 = new string[4] { "BoltBone", "ArrowIron", "ArrowBronze", "ArrowObsidian" }; private static readonly string[] FletcherLv3 = new string[4] { "BoltIron", "ArrowSilver", "ArrowFrost", "ArrowPoison" }; private static readonly string[] FletcherLv4 = new string[5] { "ArrowNeedle", "BoltBlackmetal", "BoltCarapace", "BoltFlametal", "ArrowCarapace" }; private static readonly string[] FletcherLv5 = new string[7] { "CharredBoneBolt", "ArrowCharred", "BoltCharred", "TurretBolt", "TurretBoltBone", "TurretBoltFlametal", "TurretBoltWood" }; public void Setup(List gameObjects, List recipes) { _gameObjects.Clear(); _recipes.Clear(); _buildPieces.Clear(); if (gameObjects != null) { _gameObjects.AddRange(gameObjects); } if (recipes != null) { _recipes.AddRange(recipes); } if (_gameObjects.Count == 0) { Debug.LogWarning((object)"RecipeRetarget: Missing gameObjects."); } else if (_recipes.Count == 0) { Debug.LogWarning((object)"RecipeRetarget: Missing recipes."); } else if (TryInitBuildPiecesFromHammer(_gameObjects, _buildPieces)) { TableMapper.setupTables(null, _buildPieces); if (_buildPieces.Count == 0) { Debug.LogWarning((object)"RecipeRetarget: NO BUILD PIECES (hammer build table empty)."); } EditRecipes(_recipes); } } private static bool TryInitBuildPiecesFromHammer(List objects, List outPieces) { if (objects == null || outPieces == null) { return false; } GameObject val = objects.Find((GameObject x) => (Object)(object)x != (Object)null && ((Object)x).name == "Hammer"); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"RecipeRetarget: Hammer not found in provided game objects."); return false; } ItemDrop component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)"RecipeRetarget: Hammer ItemDrop component missing."); return false; } PieceTable val2 = (component.m_itemData?.m_shared)?.m_buildPieces; List list = (((Object)(object)val2 != (Object)null) ? val2.m_pieces : null); if (list == null) { Debug.LogWarning((object)"RecipeRetarget: Hammer build pieces list is null (invalid hammer configuration)."); return false; } for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] != (Object)null) { outPieces.Add(list[i]); } } return true; } private static void EditRecipes(List recipes) { //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Invalid comparison between Unknown and I4 if (recipes == null) { return; } if ((Object)(object)TableMapper.workbench == (Object)null || (Object)(object)TableMapper.forge == (Object)null || (Object)(object)TableMapper.blackforge == (Object)null || (Object)(object)TableMapper.fletcher == (Object)null || (Object)(object)TableMapper.heavyWorkbench == (Object)null || (Object)(object)TableMapper.ironworks == (Object)null || (Object)(object)TableMapper.runeforge == (Object)null) { Debug.LogWarning((object)"RecipeRetarget: One or more TableMapper stations are null. Skipping retarget."); return; } for (int i = 0; i < recipes.Count; i++) { Recipe val = recipes[i]; if (IsValidRecipe(val)) { string text = (((Object)(object)val.m_item != (Object)null) ? ((Object)val.m_item).name : string.Empty); ItemData itemData = val.m_item.m_itemData; SharedData shared = itemData.m_shared; if (IsEquipableHighQuality(val, ((Object)TableMapper.workbench).name)) { RetargetStation(val, TableMapper.heavyWorkbench, -2); } if (IsEquipableHighQuality(val, ((Object)TableMapper.forge).name)) { RetargetStation(val, TableMapper.ironworks, -2); } if (IsEquipableHighQuality(val, ((Object)TableMapper.blackforge).name, 3)) { RetargetStation(val, TableMapper.runeforge, -2); } if (MatchesAnyOrdinal(text, FletcherLv1)) { AssignToFletcher(val, 1); } else if (MatchesAnyOrdinal(text, FletcherLv2)) { AssignToFletcher(val, 2); } else if (MatchesAnyOrdinal(text, FletcherLv3)) { AssignToFletcher(val, 3); } else if (MatchesAnyOrdinal(text, FletcherLv4)) { AssignToFletcher(val, 4); } else if (MatchesAnyOrdinal(text, FletcherLv5)) { AssignToFletcher(val, 5); } else if (!string.IsNullOrEmpty(text) && ContainsOrdinal(text, "ArrowWood")) { val.m_minStationLevel = 1; val.m_craftingStation = null; } if ((int)shared.m_itemType == 4 || ContainsOrdinal(text, "Bow")) { val.m_craftingStation = TableMapper.fletcher; val.m_minStationLevel = 1; } if (text == "Bow") { val.m_craftingStation = TableMapper.workbench; val.m_minStationLevel = 2; } if (text == "AxeStone" || text == "CLub" || text == "Hammer") { val.m_craftingStation = null; val.m_repairStation = TableMapper.workbench; val.m_minStationLevel = 1; } if ((Object)(object)val.m_craftingStation == (Object)null) { val.m_repairStation = TableMapper.workbench; val.m_minStationLevel = 1; } else { val.m_repairStation = val.m_repairStation ?? val.m_craftingStation; val.m_minStationLevel = Mathf.Max(1, val.m_minStationLevel); } } } } private static bool IsValidRecipe(Recipe recipe) { if ((Object)(object)recipe == (Object)null) { return false; } if ((Object)(object)recipe.m_item == (Object)null) { return false; } if (recipe.m_item.m_itemData == null) { return false; } if (recipe.m_item.m_itemData.m_shared == null) { return false; } return true; } private static bool IsEquipableHighQuality(Recipe recipe, string stationName, int minLevel = 2) { if ((Object)(object)recipe == (Object)null) { return false; } if ((Object)(object)recipe.m_craftingStation == (Object)null) { return false; } if ((Object)(object)recipe.m_item == (Object)null || recipe.m_item.m_itemData == null) { return false; } ItemData itemData = recipe.m_item.m_itemData; SharedData shared = itemData.m_shared; if (shared == null) { return false; } return recipe.m_minStationLevel > minLevel && ((Object)recipe.m_craftingStation).name == stationName && itemData.IsEquipable() && shared.m_maxQuality != 1; } private static void RetargetStation(Recipe recipe, CraftingStation newStation, int levelAdjust) { if (!((Object)(object)recipe == (Object)null) && !((Object)(object)newStation == (Object)null)) { recipe.m_craftingStation = newStation; recipe.m_repairStation = newStation; int num = recipe.m_minStationLevel + levelAdjust; recipe.m_minStationLevel = ((num < 1) ? 1 : num); } } private static void AssignToFletcher(Recipe recipe, int level) { if (!((Object)(object)recipe == (Object)null) && !((Object)(object)TableMapper.fletcher == (Object)null)) { recipe.m_minStationLevel = ((level < 1) ? 1 : level); recipe.m_craftingStation = TableMapper.fletcher; } } private static bool ContainsOrdinal(string text, string value) { if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(value)) { return false; } return text.IndexOf(value, StringComparison.Ordinal) >= 0; } private static bool MatchesAnyOrdinal(string itemName, string[] keywords) { if (string.IsNullOrEmpty(itemName) || keywords == null || keywords.Length == 0) { return false; } foreach (string value in keywords) { if (!string.IsNullOrEmpty(value) && itemName.IndexOf(value, StringComparison.Ordinal) >= 0) { return true; } } return false; } } public class TableMapper { public static CraftingStation cauldron; public static CraftingStation workbench; public static CraftingStation heavyWorkbench; public static CraftingStation forge; public static CraftingStation ironworks; public static CraftingStation blackforge; public static CraftingStation stoneCutter; public static CraftingStation artisian; public static CraftingStation magetable; public static CraftingStation runeforge; public static CraftingStation tannery; public static CraftingStation fletcher; public static CraftingStation grill; public static CraftingStation alchemylab; public static CraftingStation shamantable; public static CraftingStation foodtable; public static CraftingStation smeltworks; public static ZNetScene zNetScene; public static List list = new List(); public static void setupTables(ZNetScene zNetScene = null, List list = null) { TableMapper.zNetScene = zNetScene; TableMapper.list = list; prepareTables(); } private static GameObject FindPrefabInZnet(string name, ZNetScene zNetScene) { GameObject value = null; zNetScene.m_namedPrefabs.TryGetValue(BalrondHashCompat.StableHash(name), out value); if ((Object)(object)value == (Object)null) { value = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name); } return value; } private static CraftingStation FindStation(string name) { GameObject val = null; val = (GameObject)((!((Object)(object)zNetScene != (Object)null)) ? ((object)list.Find((GameObject x) => ((Object)x).name == name)) : ((object)FindPrefabInZnet(name, zNetScene))); if ((Object)(object)val != (Object)null) { return val.GetComponent(); } Debug.LogWarning((object)("TableMapper - Station not found: " + name)); return null; } private static void prepareTables() { cauldron = FindStation("piece_cauldron"); workbench = FindStation("piece_workbench"); heavyWorkbench = FindStation("piece_heavy_workbench_bal"); forge = FindStation("forge"); ironworks = FindStation("piece_metalworks_bal"); blackforge = FindStation("blackforge"); stoneCutter = FindStation("piece_stonecutter"); artisian = FindStation("piece_artisanstation"); runeforge = FindStation("piece_runeforge_bal"); magetable = FindStation("piece_magetable"); fletcher = FindStation("piece_fletcher_bal"); shamantable = FindStation("piece_shamantable_bal"); foodtable = FindStation("piece_preptable"); grill = FindStation("piece_grill_bal"); alchemylab = FindStation("piece_MeadCauldron"); smeltworks = FindStation("piece_scrapsmelter_bal"); } } internal class BuildPieceList { public static string[] buildPieces = new string[122] { "lead_ore_pile_bal", "lead_stack_bal", "bcopper_ore_pile_bal", "bellmetal_stack_bal", "biron_ore_pile_bal", "blueBasalt_pile_bal", "bmetal_ore_pile_bal", "zinc_ore_pile_bal", "bmetal_stack_bal", "bronze_stack_bal", "charredbone_stack_bal", "clay_pile_bal", "clay_stack_bal", "cobalt_stack_bal", "copper_stack_bal", "zinc_stack_bal", "cupronickel_stack_bal", "darkiron_ore_pile_bal", "darksteel_stack_bal", "ferroboron_stack_bal", "flametal_ore_pile_bal", "flametal_stack_bal", "frosteel_stack_bal", "gabro_pile_bal", "goldbar_stack_bal", "guck_pile_bal", "ifrytium_ore_pile_bal", "ifrytium_stack_bal", "iron_stack_bal", "moltensteel_stack_bal", "nickel_stack_bal", "ooze_pile_bal", "silver_ore_pile_bal", "silver_stack_bal", "skull_pile_bal", "tin_stack_bal", "treasure_pile_peningar_bal", "treasure_stack_peningar_bal", "whitemetal_stack_bal", "wood_ember_stack_bal", "wood_hard_stack_bal", "waymarker1_bal", "waymarker2_bal", "cupronickel_lantern_standing_bal", "workbench_ext5_bal", "piece_heavy_workbench_bal", "heavyworkbench_ext1_bal", "heavyworkbench_ext2_bal", "heavyworkbench_ext3_bal", "heavyworkbench_ext4_bal", "piece_waterwell_bal", "composter_bal", "piece_birdhouse_bal", "piece_fletcher_bal", "fletcher_ext1_bal", "fletcher_ext2_bal", "fletcher_ext3_bal", "fletcher_ext4_bal", "piece_scrapsmelter_bal", "scrapsmelter_ext1_bal", "piece_shamantable_bal", "shamantable_ext1_bal", "shamantable_ext2_bal", "shamantable_ext3_bal", "shamantable_ext4_bal", "oilpress_bal", "piece_leatherRack_bal", "piece_grill_bal", "grill_ext1_bal", "grill_ext2_bal", "grill_ext3_bal", "piece_metalworks_bal", "ironworks_ext1_bal", "ironworks_ext2_bal", "ironworks_ext3_bal", "ironworks_ext4_bal", "StoneboundKiln_bal", "piece_sawmill_bal", "artisan_ext2_bal", "artisan_ext3_bal", "magetable_ext4_bal", "magetable_ext5_bal", "piece_silknest_bal", "piece_runeforge_bal", "runeforge_ext1_bal", "runeforge_ext2_bal", "runeforge_ext3_bal", "runeforge_ext4_bal", "piece_swamphut_bal", "magmastone_floor_2x2", "piece_chest_raw_wood_bal", "piece_torch_wall_bal", "rawood_bed_bal", "rug_straw_bal", "raw_wood_beam_26_bal", "raw_wood_beam_45_bal", "raw_wood_beam_bal", "raw_wood_door_bal", "raw_wood_fence_bal", "raw_wood_floor_bal", "raw_wood_pole_bal", "raw_wood_roof_45d_bal", "raw_wood_roof_45d_corner_bal", "raw_wood_roof_45d_icorner_bal", "raw_wood_roof_45d_top_bal", "raw_wood_roof_45d_top_cap_bal", "raw_wood_roof_45d_top_cap2_bal", "raw_wood_roof_top_bal", "raw_wood_stair_bal", "raw_wood_wallroof_45_bal", "raw_woodwall_1m_bal", "raw_woodwall_2m_bal", "rawstone_beam_bal", "rawstone_big_beam_bal", "rawstone_big_pole_bal", "rawstone_cube_bal", "rawstone_floor_2x2_bal", "rawstone_pole_bal", "rawstone_Wall_2x2_bal", "rawstone_Wall_2x4_bal", "straw_floor_2x2_bal", "wood_roof_flat_bal" }; } public interface IReducibleDebuff { void ReduceDuration(float seconds); } public class SE_AttackTaunt : StatusEffect { private Character m_attacker = null; public override void Setup(Character character) { ((StatusEffect)this).Setup(character); } public override void SetAttacker(Character attacker) { m_attacker = attacker; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if ((Object)(object)m_attacker != (Object)null && (Object)(object)base.m_character != (Object)null) { MonsterAI component = ((Component)base.m_character).GetComponent(); if (!((Object)(object)component == (Object)null)) { component.m_targetCreature = m_attacker; } } } } public class SE_BalrondAcceleratedDebuff : SE_Stats, IReducibleDebuff { [Header("Acceleration Conditions")] public string m_statusAName = "SE_SitHeal"; public string m_statusBName = "CampFire"; [Header("Acceleration Multipliers")] public float m_accelerationIfOnlyA = 3f; public float m_accelerationIfOnlyB = 6f; public float m_accelerationIfAAndB = 9f; public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); float accelerationMultiplier = GetAccelerationMultiplier(); if (!(accelerationMultiplier <= 1f)) { ((StatusEffect)this).m_time = ((StatusEffect)this).m_time + dt * (accelerationMultiplier - 1f); } } protected virtual float GetAccelerationMultiplier() { if ((Object)(object)((StatusEffect)this).m_character == (Object)null) { return 1f; } SEMan sEMan = ((StatusEffect)this).m_character.GetSEMan(); if (sEMan == null) { return 1f; } bool flag = HasRequiredStatus(sEMan, m_statusAName); bool flag2 = HasRequiredStatus(sEMan, m_statusBName); if (flag && flag2) { return m_accelerationIfAAndB; } if (flag) { return m_accelerationIfOnlyA; } if (flag2) { return m_accelerationIfOnlyB; } return 1f; } protected virtual bool HasRequiredStatus(SEMan seMan, string statusName) { if (string.IsNullOrEmpty(statusName)) { return false; } return seMan.HaveStatusEffect(BalrondHashCompat.StableHash(statusName)); } public void ReduceDuration(float seconds) { if (seconds <= 0f) { return; } ((StatusEffect)this).m_time = Mathf.Min(((StatusEffect)this).m_ttl, ((StatusEffect)this).m_time + seconds); if (((StatusEffect)this).m_time >= ((StatusEffect)this).m_ttl && (Object)(object)((StatusEffect)this).m_character != (Object)null) { SEMan sEMan = ((StatusEffect)this).m_character.GetSEMan(); if (sEMan != null) { sEMan.RemoveStatusEffect(((StatusEffect)this).NameHash(), false); } } } } public class SE_FirstAidKit : StatusEffect { [Header("First Aid Kit")] public float m_tickInterval = 1f; public float m_secondsRemovedPerTick = 4f; private float m_tickTimer; private static readonly int ScorchedHash = BalrondHashCompat.StableHash("SE_Scorched_bal"); private static readonly int ChilledHash = BalrondHashCompat.StableHash("SE_Chilled_bal"); private static readonly int EnfeebledHash = BalrondHashCompat.StableHash("SE_Enfeebled_bal"); private static readonly int StaticChargeHash = BalrondHashCompat.StableHash("SE_StaticCharge_bal"); private static readonly int SoulSappedHash = BalrondHashCompat.StableHash("SE_SoulSapped_bal"); private static readonly int BleedingHash = BalrondHashCompat.StableHash("SE_Bleeding_bal"); private static readonly int FracturedHash = BalrondHashCompat.StableHash("SE_Fractured_bal"); private static readonly int LaceratedHash = BalrondHashCompat.StableHash("SE_Lacerated_bal"); private static readonly int PuncturedHash = BalrondHashCompat.StableHash("SE_Punctured_bal"); private static readonly int Sickhash = BalrondHashCompat.StableHash("SE_Sick_bal"); private static readonly List DebuffHashes = new List { ScorchedHash, ChilledHash, EnfeebledHash, StaticChargeHash, SoulSappedHash, BleedingHash, FracturedHash, LaceratedHash, PuncturedHash, Sickhash }; public override void Setup(Character character) { ((StatusEffect)this).Setup(character); m_tickTimer = m_tickInterval; } public override void ResetTime() { ((StatusEffect)this).ResetTime(); m_tickTimer = m_tickInterval; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (!((Object)(object)base.m_character == (Object)null) && !base.m_character.IsDead()) { m_tickTimer -= dt; if (!(m_tickTimer > 0f)) { m_tickTimer = m_tickInterval; ReduceTrackedDebuffs(); } } } private void ReduceTrackedDebuffs() { Character character = base.m_character; SEMan val = ((character != null) ? character.GetSEMan() : null); if (val == null) { return; } for (int i = 0; i < DebuffHashes.Count; i++) { StatusEffect statusEffect = val.GetStatusEffect(DebuffHashes[i]); if (!((Object)(object)statusEffect == (Object)null) && statusEffect is IReducibleDebuff reducibleDebuff) { reducibleDebuff.ReduceDuration(m_secondsRemovedPerTick); } } } public override string GetTooltipString() { string tooltipString = ((StatusEffect)this).GetTooltipString(); tooltipString += $"\nTreatment duration: {base.m_ttl:0}s"; tooltipString += $"\nTick interval: {m_tickInterval:0.#}s"; return tooltipString + $"\nRemoves {m_secondsRemovedPerTick:0.#}s from injuries per tick"; } } public class SE_ProgressiveDamageOverTime : StatusEffect, IReducibleDebuff { [Header("Progressive DoT")] public DamageType m_damageType = (DamageType)64; public float m_damageInterval = 1f; public float m_baseDamage = 4f; public float m_damageIncreasePerStage = 2f; public int m_ticksPerStage = 3; public bool m_useMovingAcceleration = false; public int m_ticksPerStageMoving = 2; public int m_maxStage = 6; public bool m_neverExpire = true; public bool m_showDamageText = true; public bool m_triggerHitEffects = false; protected float m_tickTimer; protected int m_totalTicks; protected int m_stage; public override void Setup(Character character) { ((StatusEffect)this).Setup(character); m_tickTimer = 0f; m_totalTicks = 0; m_stage = 0; } public override bool IsDone() { return !m_neverExpire && ((StatusEffect)this).IsDone(); } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if ((Object)(object)base.m_character == (Object)null || base.m_character.IsDead()) { return; } m_tickTimer -= dt; if (!(m_tickTimer > 0f)) { m_tickTimer = m_damageInterval; m_totalTicks++; int ticksPerStage = GetTicksPerStage(); if (ticksPerStage > 0 && m_totalTicks % ticksPerStage == 0) { m_stage = Mathf.Min(m_stage + 1, m_maxStage); } ApplyTickDamage(GetCurrentDamage()); } } protected virtual int GetTicksPerStage() { if (m_useMovingAcceleration && IsCharacterMoving()) { return m_ticksPerStageMoving; } return m_ticksPerStage; } protected virtual bool IsCharacterMoving() { //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 ((Object)(object)base.m_character == (Object)null) { return false; } Vector3 velocity = base.m_character.GetVelocity(); return ((Vector3)(ref velocity)).magnitude > 0.1f; } public virtual float GetCurrentDamage() { return m_baseDamage + (float)m_stage * m_damageIncreasePerStage; } public virtual int GetCurrentStage() { return m_stage; } protected virtual void ApplyTickDamage(float damage) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)base.m_character == (Object)null) && !(damage <= 0f)) { HitData hit = new HitData(); hit.m_point = base.m_character.GetCenterPoint(); hit.m_dir = Vector3.up; hit.m_hitType = GetHitTypeForDamageType(m_damageType); SetDamageByType(ref hit, m_damageType, damage); base.m_character.ApplyDamage(hit, m_showDamageText, m_triggerHitEffects, (DamageModifier)0); } } protected virtual HitType GetHitTypeForDamageType(DamageType damageType) { //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_0008: Invalid comparison between Unknown and I4 //IL_001e: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Invalid comparison between Unknown and I4 //IL_0022: 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_0019: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) if ((int)damageType != 32) { if ((int)damageType != 64) { if ((int)damageType == 256) { return (HitType)7; } return (HitType)0; } return (HitType)6; } return (HitType)5; } protected virtual void SetDamageByType(ref HitData hit, DamageType damageType, float damage) { //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_0008: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected I4, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Invalid comparison between Unknown and I4 if ((int)damageType <= 32) { if ((int)damageType <= 8) { switch (damageType - 1) { default: if ((int)damageType != 8) { break; } hit.m_damage.m_chop = damage; return; case 0: hit.m_damage.m_blunt = damage; return; case 1: hit.m_damage.m_slash = damage; return; case 3: hit.m_damage.m_pierce = damage; return; case 2: break; } } else { if ((int)damageType == 16) { hit.m_damage.m_pickaxe = damage; return; } if ((int)damageType == 32) { hit.m_damage.m_fire = damage; return; } } } else if ((int)damageType <= 128) { if ((int)damageType == 64) { hit.m_damage.m_frost = damage; return; } if ((int)damageType == 128) { hit.m_damage.m_lightning = damage; return; } } else { if ((int)damageType == 256) { hit.m_damage.m_poison = damage; return; } if ((int)damageType == 512) { hit.m_damage.m_spirit = damage; return; } if ((int)damageType == 1024) { hit.m_damage.m_damage = damage; return; } } hit.m_damage.m_damage = damage; } public override string GetTooltipString() { string tooltipString = ((StatusEffect)this).GetTooltipString(); tooltipString += $"\nCurrent damage: {GetCurrentDamage():0.##}"; return tooltipString + $"\nStage: {m_stage}"; } public void ReduceDuration(float seconds) { if (seconds <= 0f || m_neverExpire) { return; } base.m_time = Mathf.Min(base.m_ttl, base.m_time + seconds); if (base.m_time >= base.m_ttl && (Object)(object)base.m_character != (Object)null) { SEMan sEMan = base.m_character.GetSEMan(); if (sEMan != null) { sEMan.RemoveStatusEffect(((StatusEffect)this).NameHash(), false); } } } } public class SE_RepairKit : StatusEffect { private class RepairCandidate { public readonly ItemData Item; public readonly float MaxDurability; public bool WasTouched; public RepairCandidate(ItemData item, float maxDurability, float missingFraction) { Item = item; MaxDurability = maxDurability; WasTouched = false; } public float GetMissingRemaining() { if (Item == null || MaxDurability <= 0f) { return 0f; } return Mathf.Clamp01((MaxDurability - Item.m_durability) / MaxDurability); } } public float m_baseRepairFraction = 0.5f; public bool m_requireVanillaRepairRules = false; public bool m_showMessage = true; public override void Setup(Character character) { ((StatusEffect)this).Setup(character); Player val = (Player)(object)((character is Player) ? character : null); if (!((Object)(object)val == (Object)null)) { ApplyRepair(val); base.m_time = base.m_ttl; } } private void ApplyRepair(Player player) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return; } List allItems = inventory.GetAllItems(); List list = new List(); List list2 = new List(); List list3 = new List(); for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (!CanRepairItem(player, val)) { continue; } float maxDurability = val.GetMaxDurability(); float num = (maxDurability - val.m_durability) / maxDurability; if (!(num <= 0f)) { RepairCandidate item = new RepairCandidate(val, maxDurability, num); if (val.m_durability <= 0f) { list.Add(item); } else if (val.m_equipped) { list2.Add(item); } else { list3.Add(item); } } } if (list.Count == 0 && list2.Count == 0 && list3.Count == 0) { if (m_showMessage) { ((Character)player).Message((MessageType)2, "No damaged items to repair.", 0, (Sprite)null); } return; } float availableBudget = Mathf.Max(0f, m_baseRepairFraction); int repairedCount = 0; bool changed = false; availableBudget = RepairGroup(list, availableBudget, ref repairedCount, ref changed); availableBudget = RepairGroup(list2, availableBudget, ref repairedCount, ref changed); availableBudget = RepairGroup(list3, availableBudget, ref repairedCount, ref changed); if (changed) { inventory.Changed(); } if (m_showMessage) { ((Character)player).Message((MessageType)2, $"Repair kit restored durability on {repairedCount} item(s).", 0, (Sprite)null); } } private float RepairGroup(List group, float availableBudget, ref int repairedCount, ref bool changed) { if (group == null || group.Count == 0 || availableBudget <= 0.0001f) { return availableBudget; } List list = new List(); for (int i = 0; i < group.Count; i++) { list.Add(i); } float num = availableBudget; while (num > 0.0001f && list.Count > 0) { float num2 = num / (float)list.Count; bool flag = false; for (int num3 = list.Count - 1; num3 >= 0; num3--) { int index = list[num3]; RepairCandidate repairCandidate = group[index]; float missingRemaining = repairCandidate.GetMissingRemaining(); if (missingRemaining <= 0.0001f) { list.RemoveAt(num3); } else if (num2 >= missingRemaining) { float num4 = ApplyRepairFraction(repairCandidate, missingRemaining, ref repairedCount, ref changed); num -= num4; list.RemoveAt(num3); flag = true; } } if (!flag) { for (int j = 0; j < list.Count; j++) { int index2 = list[j]; float num5 = ApplyRepairFraction(group[index2], num2, ref repairedCount, ref changed); num -= num5; } break; } } if (num < 0f) { num = 0f; } return num; } private float ApplyRepairFraction(RepairCandidate candidate, float repairFraction, ref int repairedCount, ref bool changed) { if (candidate == null || repairFraction <= 0f) { return 0f; } float maxDurability = candidate.MaxDurability; float num = repairFraction * maxDurability; float durability = candidate.Item.m_durability; float num2 = Mathf.Min(durability + num, maxDurability); if (num2 <= durability) { return 0f; } candidate.Item.m_durability = num2; if (!candidate.WasTouched) { candidate.WasTouched = true; repairedCount++; } changed = true; return (num2 - durability) / maxDurability; } private bool CanRepairItem(Player player, ItemData item) { if ((Object)(object)player == (Object)null || item == null || item.m_shared == null) { return false; } if (!item.m_shared.m_useDurability) { return false; } if (!item.m_shared.m_canBeReparied) { return false; } float maxDurability = item.GetMaxDurability(); if (maxDurability <= 0f) { return false; } if (item.m_durability >= maxDurability) { return false; } if (!m_requireVanillaRepairRules) { return true; } return CheckVanillaRepairRules(player, item); } private bool CheckVanillaRepairRules(Player player, ItemData item) { if (player.NoCostCheat()) { return true; } CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); if ((Object)(object)currentCraftingStation == (Object)null) { return false; } Recipe recipe = ObjectDB.instance.GetRecipe(item); if ((Object)(object)recipe == (Object)null) { return false; } if ((!((Object)(object)recipe.m_repairStation != (Object)null) || !(recipe.m_repairStation.m_name == currentCraftingStation.m_name)) && (!((Object)(object)recipe.m_craftingStation != (Object)null) || !(recipe.m_craftingStation.m_name == currentCraftingStation.m_name)) && item.m_worldLevel >= Game.m_worldLevel) { return false; } return Mathf.Min(currentCraftingStation.GetLevel(true), 4) >= recipe.m_minStationLevel; } } public class SE_ShowBarber : StatusEffect { public int m_amount = 1; public override void Setup(Character character) { InventoryGui.instance.Hide(); ((StatusEffect)this).Setup(character); ShowGui(); } private void ShowGui() { if (!PlayerCustomizaton.IsBarberGuiVisible() && Object.op_Implicit((Object)(object)Player.m_localPlayer) && !InventoryGui.IsVisible() && !Minimap.IsOpen() && !Game.IsPaused()) { PlayerCustomizaton.ShowBarberGui(); } } } public class SE_TimedStatusChange : StatusEffect { public string nextStatusName = string.Empty; public float regenvalue = 0.05f; public override void Setup(Character character) { ((StatusEffect)this).Setup(character); } public override void ModifyHealthRegen(ref float regenMultiplier) { regenMultiplier -= regenvalue; } public override void ModifyStaminaRegen(ref float staminaMultiplier) { staminaMultiplier -= regenvalue; } public override void ModifyEitrRegen(ref float eitrMultiplier) { eitrMultiplier -= regenvalue; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (base.m_ttl > 0f && base.m_time + dt >= base.m_ttl) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { ((Character)localPlayer).m_seman.AddStatusEffect(BalrondHashCompat.StableHash(nextStatusName), false, 0, 0f); } } } } public class SE_SpawnItemDropOnConsume : StatusEffect { public int m_amount = 1; public GameObject m_prefab = null; private ItemDrop itemDrop = null; public override void Setup(Character character) { ((StatusEffect)this).Setup(character); if ((Object)(object)m_prefab == (Object)null) { Debug.LogWarning((object)"SpawnOnConsume prefab is empty"); return; } itemDrop = m_prefab.GetComponent(); if ((Object)(object)itemDrop == (Object)null) { Debug.LogWarning((object)"SpawnOnConsume prefab is not an item"); return; } base.m_tooltip = "$tag_giveItemOnConsumeStatus_bal " + itemDrop.m_itemData.m_shared.m_name; Spawn(character); } private void Spawn(Character character) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) for (int i = 0; i < m_amount; i++) { ItemDrop.OnCreateNew(Object.Instantiate(m_prefab, ((Component)character).transform.position + Vector3.up + Random.insideUnitSphere * 0.3f, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f))); } } } public class SE_SitHeal : StatusEffect { public float m_healthOverTime = 100f; public float m_healthOverTimeInterval = 1.5f; public float m_healthOverTimeDuration = 300f; public float m_campFireHealBonus = 0.3f; public float m_healthOverTimeTimer; public float m_healthOverTimeTicks; public float m_healthOverTimeTickHp; public void SetHealthOverTime(float value) { m_healthOverTime = value; } public void SetHealthOverTimeInterval(float value) { m_healthOverTimeInterval = value; } public void SetCampFireHealBonus(float value) { m_campFireHealBonus = value; } public override void Setup(Character character) { ((StatusEffect)this).Setup(character); if (!((double)m_healthOverTime <= 0.0) && !((double)m_healthOverTimeInterval <= 0.0)) { if ((double)m_healthOverTimeDuration <= 0.0) { m_healthOverTimeDuration = base.m_ttl; } m_healthOverTimeTicks = m_healthOverTimeDuration / m_healthOverTimeInterval; m_healthOverTimeTickHp = m_healthOverTime / m_healthOverTimeTicks; } } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if ((double)m_healthOverTimeTicks <= 0.0) { return; } m_healthOverTimeTimer += dt; if (!((double)m_healthOverTimeTimer <= (double)m_healthOverTimeInterval)) { m_healthOverTimeTimer = 0f; m_healthOverTimeTicks -= 1f; if (base.m_character.GetSEMan().HaveStatusEffect(BalrondHashCompat.StableHash("CampFire"))) { base.m_character.Heal(m_healthOverTimeTickHp + m_campFireHealBonus, true); } else { base.m_character.Heal(m_healthOverTimeTickHp, true); } } } } public class BalrondSnowMelter : MonoBehaviour { private ZNetView m_nview; public List OriginalMaterials = new List(); public Fireplace _OwningFireplace; private Dictionary keyValuePairs = new Dictionary(); private GameObject warmerOrb = null; public float m_radius = 2f; public float m_currentRadius = 0f; public SphereCollider collider; private void Awake() { m_nview = ((Component)this).gameObject.GetComponent(); warmerOrb = CreateOrbCollider(m_radius); m_currentRadius = m_radius; ((Component)this).tag = "roof"; _OwningFireplace = ((Component)this).GetComponent(); } private GameObject CreateOrbCollider(float radius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("OrbCollider"); val.transform.parent = ((Component)this).transform; val.transform.position = new Vector3(0f, 0f, 0f); val.transform.rotation = Quaternion.identity; val.transform.localScale = Vector3.one; val.tag = "roof"; val.layer = 16; collider = val.AddComponent(); ((Collider)collider).isTrigger = true; collider.radius = radius; val.SetActive(false); return val; } private void Update() { if ((Object)(object)_OwningFireplace != (Object)null || _OwningFireplace.IsBurning()) { warmerOrb.SetActive(true); m_currentRadius = calculateNewRadius(); } else { warmerOrb.SetActive(false); } } private void UpdateRadius() { collider.radius = calculateNewRadius(); } private float calculateNewRadius() { float @float = m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f); float maxFuel = _OwningFireplace.m_maxFuel; float num = @float / maxFuel; return m_radius * num; } } public class SE_WetImmunity : StatusEffect { public void Awake() { base.m_name = "Waterproof"; ((Object)this).name = "Waterproof"; base.m_tooltip = "Immune to wet effect"; } public override void UpdateStatusEffect(float dt) { ((StatusEffect)this).UpdateStatusEffect(dt); if (base.m_character.GetSEMan().HaveStatusEffect("Wet".GetHashCode())) { base.m_character.GetSEMan().RemoveStatusEffect("Wet".GetHashCode(), false); } } } public static class StatusEffectVisualFactory { public static bool TryAssignStartEffect(ZNetScene zNetScene, StatusEffect statusEffect, string prefabName, bool attach = true, int variant = -1) { if ((Object)(object)zNetScene == (Object)null) { Debug.LogWarning((object)"[BalrondNature] TryAssignStartEffect failed: zNetScene is null."); return false; } if ((Object)(object)statusEffect == (Object)null) { Debug.LogWarning((object)"[BalrondNature] TryAssignStartEffect failed: statusEffect is null."); return false; } GameObject val = FindPrefab(zNetScene, prefabName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("[BalrondNature] TryAssignStartEffect failed: prefab not found: " + prefabName)); return false; } statusEffect.m_startEffects = CreateEffectList(val, attach, variant); return true; } public static bool TryAssignStartEffectByName(ZNetScene zNetScene, List statusEffects, string statusName, string prefabName, bool attach = true, int variant = -1) { if (statusEffects == null) { Debug.LogWarning((object)"[BalrondNature] TryAssignStartEffectByName failed: statusEffects is null."); return false; } StatusEffect val = statusEffects.Find((StatusEffect x) => ((Object)x).name == statusName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("[BalrondNature] TryAssignStartEffectByName failed: status effect not found: " + statusName)); return false; } return TryAssignStartEffect(zNetScene, val, prefabName, attach, variant); } public static void AssignStartEffects(ZNetScene zNetScene, List statusEffects, Dictionary mappings, bool attach = true, int variant = -1) { if ((Object)(object)zNetScene == (Object)null || statusEffects == null || mappings == null) { return; } foreach (KeyValuePair pair in mappings) { StatusEffect val = statusEffects.Find((StatusEffect x) => ((Object)x).name == pair.Key); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("[BalrondNature] Status effect not found: " + pair.Key)); continue; } GameObject val2 = FindPrefab(zNetScene, pair.Value); if ((Object)(object)val2 == (Object)null) { Debug.LogWarning((object)("[BalrondNature] VFX prefab not found: " + pair.Value)); } else { val.m_startEffects = CreateEffectList(val2, attach, variant); } } } private static GameObject FindPrefab(ZNetScene zNetScene, string prefabName) { if ((Object)(object)zNetScene == (Object)null || string.IsNullOrEmpty(prefabName)) { return null; } return zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == prefabName); } private static EffectList CreateEffectList(GameObject prefab, bool attach, int variant) { //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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown EffectData val = new EffectData { m_attach = attach, m_variant = variant, m_enabled = true, m_prefab = prefab }; EffectList val2 = new EffectList(); val2.m_effectPrefabs = (EffectData[])(object)new EffectData[1] { val }; return val2; } } public static class StatusEffectFactory { public const string SE_SCORCHED = "SE_Scorched_bal"; public const string SE_CHILLED = "SE_Chilled_bal"; public const string SE_ENFEEBLED = "SE_Enfeebled_bal"; public const string SE_STATIC_CHARGE = "SE_StaticCharge_bal"; public const string SE_SOUL_SAPPED = "SE_SoulSapped_bal"; public const string SE_FRACTURED = "SE_Fractured_bal"; public const string SE_LACERATED = "SE_Lacerated_bal"; public const string SE_PUNCTURED = "SE_Punctured_bal"; public const string SE_FIRST_AID_KIT = "SE_FirstAidKit_T1_bal"; public const string SE_FIRST_AID_KIT2 = "SE_FirstAidKit_T2_bal"; public const string SE_FIRST_AID_KIT3 = "SE_FirstAidKit_T3_bal"; public const string SE_REPAIR_KIT = "SE_RepairKit_T1_bal"; public const string SE_REPAIR_KIT2 = "SE_RepairKit_T2_bal"; public const string SE_REPAIR_KIT3 = "SE_RepairKit_T3_bal"; public const string SE_WATERPROOF = "Waterproof"; public const string SE_TAUNT_ATTACK = "TauntAttack"; public const string SE_NOT_TIRED = "SE_NotTired_bal"; public const string SE_TIRED = "SE_Tired_bal"; public const string SE_FREEZING_WATER = "SE_FreezingWater_bal"; public const string SE_BLEEDING = "SE_Bleeding_bal"; public const string SE_SICK = "SE_Sick_bal"; public const string VFX_SCORCHED = "vfx_Scorched_bal"; public const string VFX_CHILLED = "vfx_Chilled_bal"; public const string VFX_ENFEEBLED = "vfx_Enfeebled_bal"; public const string VFX_STATIC_CHARGE = "vfx_Staticcharge_bal"; public const string VFX_SOUL_SAPPED = "vfx_Soulsapped_bal"; public const string VFX_FRACTURED = "vfx_Fractured_bal"; public const string VFX_LACERATED = "vfx_Lacerated_bal"; public const string VFX_PUNCTURED = "vfx_Punctured_bal"; public const string VFX_FIRST_AID = "vfx_Firstaidkit_bal"; public const string VFX_WATERPROOF = "vfx_Waterproof_bal"; public const string VFX_TAUNT = "vfx_Taunted_bal"; public const string VFX_FREEZING_WATER = "vfx_FreezingWater_bal"; public const string VFX_BLEEDING = "vfx_Bleeding_bal"; public const string VFX_SICK = "vfx_Sick_bal"; public const string VFX_REPAIR = "sfx_gui_repairitem_forge"; public static Sprite ScorchedIcon; public static Sprite ChilledIcon; public static Sprite EnfeebledIcon; public static Sprite StaticChargeIcon; public static Sprite SoulSappedIcon; public static Sprite FracturedIcon; public static Sprite LaceratedIcon; public static Sprite PuncturedIcon; public static Sprite FirstAidKitIcon; public static Sprite waterProofIco; public static Sprite awakeIcon; public static Sprite tiredIcon; public static Sprite FreezingWaterIcon; public static Sprite BleedingIcon; public static Sprite SickIcon; public static Sprite RepairKitIcon; public static void initAllStatus(List statusEffects) { statusEffects.Add((StatusEffect)(object)CreateScorchedStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateChilledStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateEnfeebledStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateStaticChargeStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateSoulSappedStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateFracturedStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateLaceratedStatusEffect()); statusEffects.Add((StatusEffect)(object)CreatePuncturedStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateFirstAidKitStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateFirstAidKitStatusEffect2()); statusEffects.Add((StatusEffect)(object)CreateFirstAidKitStatusEffect3()); statusEffects.Add((StatusEffect)(object)createWateproofStatusEffect()); statusEffects.Add((StatusEffect)(object)createTauntStatusEffect()); statusEffects.Add((StatusEffect)(object)createNotTiredStatusEffect()); statusEffects.Add((StatusEffect)(object)createTiredStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateFreezingWaterStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateBleedingStatusEffect()); statusEffects.Add((StatusEffect)(object)CreateSicknessStatusEffect()); statusEffects.Add(CreateRepairKitT1()); statusEffects.Add(CreateRepairKitT2()); statusEffects.Add(CreateRepairKitT3()); } public static void InitVisuals(ZNetScene zNetScene) { if (!((Object)(object)zNetScene == (Object)null) && Launch.modResourceLoader != null && Launch.modResourceLoader.statusEffects != null) { StatusEffectVisualFactory.AssignStartEffects(zNetScene, Launch.modResourceLoader.statusEffects, new Dictionary { { "SE_Scorched_bal", "vfx_Scorched_bal" }, { "SE_Chilled_bal", "vfx_Chilled_bal" }, { "SE_Enfeebled_bal", "vfx_Enfeebled_bal" }, { "SE_StaticCharge_bal", "vfx_Staticcharge_bal" }, { "SE_SoulSapped_bal", "vfx_Soulsapped_bal" }, { "SE_Fractured_bal", "vfx_Fractured_bal" }, { "SE_Lacerated_bal", "vfx_Lacerated_bal" }, { "SE_Punctured_bal", "vfx_Punctured_bal" }, { "SE_FirstAidKit_T1_bal", "vfx_Firstaidkit_bal" }, { "SE_FirstAidKit_T2_bal", "vfx_Firstaidkit_bal" }, { "SE_FirstAidKit_T3_bal", "vfx_Firstaidkit_bal" }, { "SE_FreezingWater_bal", "vfx_FreezingWater_bal" }, { "SE_Bleeding_bal", "vfx_Bleeding_bal" }, { "SE_Sick_bal", "vfx_Sick_bal" }, { "SE_RepairKit_T1_bal", "sfx_gui_repairitem_forge" }, { "SE_RepairKit_T2_bal", "sfx_gui_repairitem_forge" }, { "SE_RepairKit_T3_bal", "sfx_gui_repairitem_forge" } }); } } public static StatusEffect CreateRepairKitT1() { return (StatusEffect)(object)CreateRepairKitEffect(0.2f, "SE_RepairKit_T1_bal", "$tag_status_repairkit_bal", "$tag_status_repairkit_tooltip"); } public static StatusEffect CreateRepairKitT2() { return (StatusEffect)(object)CreateRepairKitEffect(0.5f, "SE_RepairKit_T2_bal", "$tag_status_repairkit_bal", "$tag_status_repairkit_tooltip"); } public static StatusEffect CreateRepairKitT3() { return (StatusEffect)(object)CreateRepairKitEffect(0.75f, "SE_RepairKit_T3_bal", "$tag_status_repairkit_bal", "$tag_status_repairkit_tooltip"); } private static SE_RepairKit CreateRepairKitEffect(float baseRepairFraction, string seName, string displayName, string displayTooltip) { SE_RepairKit sE_RepairKit = ScriptableObject.CreateInstance(); ((StatusEffect)sE_RepairKit).m_icon = RepairKitIcon; ((Object)sE_RepairKit).name = seName; ((StatusEffect)sE_RepairKit).m_name = displayName; ((StatusEffect)sE_RepairKit).m_tooltip = displayTooltip; sE_RepairKit.m_baseRepairFraction = baseRepairFraction; sE_RepairKit.m_requireVanillaRepairRules = false; sE_RepairKit.m_showMessage = true; return sE_RepairKit; } public static SE_BalrondAcceleratedDebuff CreateScorchedStatusEffect() { SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_Scorched_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_Scorched_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_Scorched_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = ScorchedIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_healthRegenMultiplier = 0.75f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staminaRegenMultiplier = 0.85f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_armorMultiplier = -0.2f; return sE_BalrondAcceleratedDebuff; } public static SE_BalrondAcceleratedDebuff CreateChilledStatusEffect() { SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_Chilled_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_Chilled_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_Chilled_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = ChilledIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staminaRegenMultiplier = 0.75f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_eitrRegenMultiplier = 0.85f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_runStaminaDrainModifier = 0.15f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_jumpStaminaUseModifier = 0.2f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_swimStaminaUseModifier = 0.2f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_sneakStaminaUseModifier = 0.15f; return sE_BalrondAcceleratedDebuff; } public static SE_BalrondAcceleratedDebuff CreateEnfeebledStatusEffect() { SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_Enfeebled_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_Enfeebled_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_Enfeebled_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = EnfeebledIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_healthRegenMultiplier = 0.7f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staminaRegenMultiplier = 0.85f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_speedModifier = -0.1f; return sE_BalrondAcceleratedDebuff; } public static SE_BalrondAcceleratedDebuff CreateStaticChargeStatusEffect() { SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_StaticCharge_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_StaticCharge_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_StaticCharge_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = StaticChargeIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staminaRegenMultiplier = 0.8f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_eitrRegenMultiplier = 0.8f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staggerModifier = 0.2f; return sE_BalrondAcceleratedDebuff; } public static SE_BalrondAcceleratedDebuff CreateSoulSappedStatusEffect() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_SoulSapped_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_SoulSapped_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_SoulSapped_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = SoulSappedIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_healthRegenMultiplier = 0.85f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_eitrRegenMultiplier = 0.7f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_skillLevel = (SkillType)999; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_skillLevelModifier = -10f; return sE_BalrondAcceleratedDebuff; } public static SE_BalrondAcceleratedDebuff CreateFracturedStatusEffect() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_Fractured_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_Fractured_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_Fractured_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = FracturedIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staminaRegenMultiplier = 0.8f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_speedModifier = -0.1f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_jumpModifier = new Vector3(0f, -0.5f, 0f); return sE_BalrondAcceleratedDebuff; } public static SE_BalrondAcceleratedDebuff CreateLaceratedStatusEffect() { SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_Lacerated_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_Lacerated_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_Lacerated_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = LaceratedIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_healthRegenMultiplier = 0.7f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staminaRegenMultiplier = 0.85f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_armorMultiplier = -0.2f; return sE_BalrondAcceleratedDebuff; } public static SE_BalrondAcceleratedDebuff CreatePuncturedStatusEffect() { SE_BalrondAcceleratedDebuff sE_BalrondAcceleratedDebuff = ScriptableObject.CreateInstance(); ((Object)sE_BalrondAcceleratedDebuff).name = "SE_Punctured_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_name = "$tag_status_Punctured_bal"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_tooltip = "$tag_status_Punctured_bal_tooltip"; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_icon = PuncturedIcon; ((StatusEffect)sE_BalrondAcceleratedDebuff).m_ttl = 120f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_healthRegenMultiplier = 0.85f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_staminaRegenMultiplier = 0.85f; ((SE_Stats)sE_BalrondAcceleratedDebuff).m_eitrRegenMultiplier = 0.85f; return sE_BalrondAcceleratedDebuff; } public static SE_FirstAidKit CreateFirstAidKitStatusEffect() { SE_FirstAidKit sE_FirstAidKit = ScriptableObject.CreateInstance(); ((Object)sE_FirstAidKit).name = "SE_FirstAidKit_T1_bal"; ((StatusEffect)sE_FirstAidKit).m_name = "$tag_status_FirstAidKit_bal"; ((StatusEffect)sE_FirstAidKit).m_tooltip = "$tag_status_FirstAidKit_bal_tooltip"; ((StatusEffect)sE_FirstAidKit).m_icon = FirstAidKitIcon; ((StatusEffect)sE_FirstAidKit).m_ttl = 10f; sE_FirstAidKit.m_tickInterval = 1f; sE_FirstAidKit.m_secondsRemovedPerTick = 4f; return sE_FirstAidKit; } public static SE_FirstAidKit CreateFirstAidKitStatusEffect2() { SE_FirstAidKit sE_FirstAidKit = ScriptableObject.CreateInstance(); ((Object)sE_FirstAidKit).name = "SE_FirstAidKit_T2_bal"; ((StatusEffect)sE_FirstAidKit).m_name = "$tag_status_FirstAidKit_bal"; ((StatusEffect)sE_FirstAidKit).m_tooltip = "$tag_status_FirstAidKit_bal_tooltip"; ((StatusEffect)sE_FirstAidKit).m_icon = FirstAidKitIcon; ((StatusEffect)sE_FirstAidKit).m_ttl = 10f; sE_FirstAidKit.m_tickInterval = 1f; sE_FirstAidKit.m_secondsRemovedPerTick = 8f; return sE_FirstAidKit; } public static SE_FirstAidKit CreateFirstAidKitStatusEffect3() { SE_FirstAidKit sE_FirstAidKit = ScriptableObject.CreateInstance(); ((Object)sE_FirstAidKit).name = "SE_FirstAidKit_T3_bal"; ((StatusEffect)sE_FirstAidKit).m_name = "$tag_status_FirstAidKit_bal"; ((StatusEffect)sE_FirstAidKit).m_tooltip = "$tag_status_FirstAidKit_bal_tooltip"; ((StatusEffect)sE_FirstAidKit).m_icon = FirstAidKitIcon; ((StatusEffect)sE_FirstAidKit).m_ttl = 10f; sE_FirstAidKit.m_tickInterval = 1f; sE_FirstAidKit.m_secondsRemovedPerTick = 12f; return sE_FirstAidKit; } public static SE_WetImmunity createWateproofStatusEffect() { SE_WetImmunity sE_WetImmunity = ScriptableObject.CreateInstance(); ((Object)sE_WetImmunity).name = "Waterproof"; ((StatusEffect)sE_WetImmunity).m_name = "Raincoat"; ((StatusEffect)sE_WetImmunity).m_tooltip = "Protects against Wet but not Soaked"; ((StatusEffect)sE_WetImmunity).m_icon = waterProofIco; return sE_WetImmunity; } public static SE_AttackTaunt createTauntStatusEffect() { SE_AttackTaunt sE_AttackTaunt = ScriptableObject.CreateInstance(); ((Object)sE_AttackTaunt).name = "TauntAttack"; ((StatusEffect)sE_AttackTaunt).m_name = "TauntAttack"; ((StatusEffect)sE_AttackTaunt).m_tooltip = "Taunts the Monster setting it target to caster"; ((StatusEffect)sE_AttackTaunt).m_ttl = 5f; return sE_AttackTaunt; } public static SE_TimedStatusChange createNotTiredStatusEffect() { SE_TimedStatusChange sE_TimedStatusChange = ScriptableObject.CreateInstance(); ((Object)sE_TimedStatusChange).name = "SE_NotTired_bal"; ((StatusEffect)sE_TimedStatusChange).m_name = "$tag_nottired_bal"; ((StatusEffect)sE_TimedStatusChange).m_tooltip = "$tag_nottired_bal_status"; ((StatusEffect)sE_TimedStatusChange).m_ttl = 1800f; sE_TimedStatusChange.nextStatusName = "SE_Tired_bal"; ((StatusEffect)sE_TimedStatusChange).m_icon = awakeIcon; sE_TimedStatusChange.regenvalue = 0f; return sE_TimedStatusChange; } public static SE_TimedStatusChange createTiredStatusEffect() { SE_TimedStatusChange sE_TimedStatusChange = ScriptableObject.CreateInstance(); ((Object)sE_TimedStatusChange).name = "SE_Tired_bal"; ((StatusEffect)sE_TimedStatusChange).m_name = "$tag_tired_bal"; ((StatusEffect)sE_TimedStatusChange).m_tooltip = "$tag_tired_bal_status"; ((StatusEffect)sE_TimedStatusChange).m_ttl = 1800f; sE_TimedStatusChange.nextStatusName = "SE_NoSleep_bal"; ((StatusEffect)sE_TimedStatusChange).m_icon = tiredIcon; sE_TimedStatusChange.regenvalue = 0.02f; return sE_TimedStatusChange; } public static SE_ProgressiveDamageOverTime CreateFreezingWaterStatusEffect() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) SE_ProgressiveDamageOverTime sE_ProgressiveDamageOverTime = ScriptableObject.CreateInstance(); ((Object)sE_ProgressiveDamageOverTime).name = "SE_FreezingWater_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_name = "$tag_status_FreezingWater_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_tooltip = "$tag_status_FreezingWater_bal_tooltip"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_icon = FreezingWaterIcon; ((StatusEffect)sE_ProgressiveDamageOverTime).m_ttl = 0f; sE_ProgressiveDamageOverTime.m_neverExpire = true; ((StatusEffect)sE_ProgressiveDamageOverTime).m_startMessage = "$msg_freezingwater_enter_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_startMessageType = (MessageType)1; sE_ProgressiveDamageOverTime.m_damageType = (DamageType)64; sE_ProgressiveDamageOverTime.m_damageInterval = 2f; sE_ProgressiveDamageOverTime.m_baseDamage = 1f; sE_ProgressiveDamageOverTime.m_damageIncreasePerStage = 2f; sE_ProgressiveDamageOverTime.m_ticksPerStage = 3; sE_ProgressiveDamageOverTime.m_useMovingAcceleration = false; sE_ProgressiveDamageOverTime.m_maxStage = 6; sE_ProgressiveDamageOverTime.m_showDamageText = true; sE_ProgressiveDamageOverTime.m_triggerHitEffects = false; return sE_ProgressiveDamageOverTime; } public static SE_ProgressiveDamageOverTime CreateBleedingStatusEffect() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) SE_ProgressiveDamageOverTime sE_ProgressiveDamageOverTime = ScriptableObject.CreateInstance(); ((Object)sE_ProgressiveDamageOverTime).name = "SE_Bleeding_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_name = "$tag_status_Bleeding_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_tooltip = "$tag_status_Bleeding_bal_tooltip"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_icon = BleedingIcon; ((StatusEffect)sE_ProgressiveDamageOverTime).m_ttl = 30f; sE_ProgressiveDamageOverTime.m_neverExpire = false; ((StatusEffect)sE_ProgressiveDamageOverTime).m_startMessage = "$msg_bleeding_enter_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_startMessageType = (MessageType)1; sE_ProgressiveDamageOverTime.m_damageType = (DamageType)2; sE_ProgressiveDamageOverTime.m_damageInterval = 2f; sE_ProgressiveDamageOverTime.m_baseDamage = 2f; sE_ProgressiveDamageOverTime.m_damageIncreasePerStage = 1f; sE_ProgressiveDamageOverTime.m_ticksPerStage = 5; sE_ProgressiveDamageOverTime.m_useMovingAcceleration = false; sE_ProgressiveDamageOverTime.m_ticksPerStageMoving = 5; sE_ProgressiveDamageOverTime.m_maxStage = 3; sE_ProgressiveDamageOverTime.m_showDamageText = true; sE_ProgressiveDamageOverTime.m_triggerHitEffects = false; return sE_ProgressiveDamageOverTime; } public static SE_ProgressiveDamageOverTime CreateSicknessStatusEffect() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) SE_ProgressiveDamageOverTime sE_ProgressiveDamageOverTime = ScriptableObject.CreateInstance(); ((Object)sE_ProgressiveDamageOverTime).name = "SE_Sick_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_name = "$tag_status_sick_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_tooltip = "$tag_status_sick_bal_tooltip"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_icon = SickIcon; ((StatusEffect)sE_ProgressiveDamageOverTime).m_ttl = 30f; sE_ProgressiveDamageOverTime.m_neverExpire = false; ((StatusEffect)sE_ProgressiveDamageOverTime).m_startMessage = "$msg_sick_enter_bal"; ((StatusEffect)sE_ProgressiveDamageOverTime).m_startMessageType = (MessageType)1; sE_ProgressiveDamageOverTime.m_damageType = (DamageType)256; sE_ProgressiveDamageOverTime.m_damageInterval = 2f; sE_ProgressiveDamageOverTime.m_baseDamage = 2f; sE_ProgressiveDamageOverTime.m_damageIncreasePerStage = 1f; sE_ProgressiveDamageOverTime.m_ticksPerStage = 5; sE_ProgressiveDamageOverTime.m_useMovingAcceleration = false; sE_ProgressiveDamageOverTime.m_ticksPerStageMoving = 8; sE_ProgressiveDamageOverTime.m_maxStage = 3; sE_ProgressiveDamageOverTime.m_showDamageText = true; sE_ProgressiveDamageOverTime.m_triggerHitEffects = false; return sE_ProgressiveDamageOverTime; } } public class LocationBuilder { private sealed class LocationPatch { public bool? Enable; public Biome? SetBiome; public Biome? AddBiomeFlags; public int? SetQuantity; public float? MultiplyQuantity; public float? MinDistance; public float? MaxDistance; public float? MinDistanceFromCenter; public float? MaxDistanceFromCenter; public float? MinDistanceFromSimilar; public float? MinAltitude; public float? MaxAltitude; public BiomeArea? BiomeArea; public bool? Prioritized; public bool? Unique; public string Group; public void Apply(ZoneLocation loc) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) if (loc != null) { if (Enable.HasValue) { loc.m_enable = Enable.Value; } if (SetBiome.HasValue) { loc.m_biome = SetBiome.Value; } if (AddBiomeFlags.HasValue) { loc.m_biome |= AddBiomeFlags.Value; } if (BiomeArea.HasValue) { loc.m_biomeArea = BiomeArea.Value; } if (SetQuantity.HasValue) { loc.m_quantity = SetQuantity.Value; } if (MultiplyQuantity.HasValue) { loc.m_quantity = Mathf.RoundToInt((float)loc.m_quantity * MultiplyQuantity.Value); } if (MinDistance.HasValue) { loc.m_minDistance = MinDistance.Value; } if (MaxDistance.HasValue) { loc.m_maxDistance = MaxDistance.Value; } if (MinDistanceFromCenter.HasValue) { loc.m_minDistanceFromCenter = MinDistanceFromCenter.Value; } if (MaxDistanceFromCenter.HasValue) { loc.m_maxDistanceFromCenter = MaxDistanceFromCenter.Value; } if (MinDistanceFromSimilar.HasValue) { loc.m_minDistanceFromSimilar = MinDistanceFromSimilar.Value; } if (MinAltitude.HasValue) { loc.m_minAltitude = MinAltitude.Value; } if (MaxAltitude.HasValue) { loc.m_maxAltitude = MaxAltitude.Value; } if (Prioritized.HasValue) { loc.m_prioritized = Prioritized.Value; } if (Unique.HasValue) { loc.m_unique = Unique.Value; } if (Group != null) { loc.m_group = Group; } } } } private sealed class CloneRequest { public string SourcePrefabName; public string Alias; } private static readonly Dictionary> softReferences = new Dictionary>(); public static readonly List zoneLocations = new List(); public static readonly List workingLocations = new List(); public static List vanillaLocationsYouEdit = new List { "Ruin1", "Ruin2", "StoneTower1", "StoneTower3", "Ruin3", "MountainWell1", "StoneHenge6", "ShipWreck01", "ShipWreck02", "ShipWreck03", "ShipWreck04", "CharredTowerRuins1_dvergr", "VoltureNest", "PlaceofMystery1", "PlaceofMystery2", "PlaceofMystery3", "StoneCircle", "StoneHouse5_heath", "DrakeNest01", "MountainCave02", "Dolmen01", "Dolmen02", "Dolmen03", "Mistlands_Swords1", "Mistlands_Swords2", "Mistlands_Swords3", "Mistlands_Viaduct1", "Mistlands_Viaduct2", "Mistlands_Lighthouse1_new", "Mistlands_Swords3", "Mistlands_GuardTower1_new", "Mistlands_GuardTower2_new", "Mistlands_GuardTower3_new", "Mistlands_RockSpire1", "Mistlands_RoadPost1", "Mistlands_Giant1", "Mistlands_Giant2", "Mistlands_Harbour1", "Waymarker01", "Waymarker02", "TrollCave02", "AbandonedLogCabin02", "AbandonedLogCabin03", "AbandonedLogCabin04", "TarPit1", "TarPit2", "TarPit3", "SwampWell1", "ShipSetting01", "MountainGrave01", "InfestedTree01", "StoneTowerRuins03", "StoneTowerRuins04", "StoneTowerRuins05", "StoneTowerRuins07", "StoneTowerRuins08", "StoneTowerRuins09", "StoneTowerRuins10", "SwampRuin1", "SwampRuin2", "WoodHouse1", "WoodHouse2", "WoodHouse3", "WoodHouse4", "WoodHouse5", "WoodHouse6", "WoodHouse7", "WoodHouse8", "WoodHouse9", "WoodHouse10", "WoodHouse11", "WoodHouse12", "WoodHouse13", "StoneHenge6", "StoneHouse3", "StoneHouse4", "SwampHut1", "SwampHut2", "SwampHut3", "SwampHut4", "SwampHut5", "StoneHouse5_heath", "WoodFarm1", "WoodVillage1", "GoblinCamp2", "Crypt2", "Crypt3", "Crypt4" }; public readonly HashSet deepNorthNames = new HashSet(StringComparer.Ordinal) { "MountainWell1", "StoneHenge6", "ShipWreck01", "ShipWreck02", "ShipWreck03", "ShipWreck04", "CharredTowerRuins1_dvergr", "StoneCircle", "DrakeNest01", "Dolmen01", "Dolmen02", "Dolmen03", "Mistlands_Swords1", "Mistlands_Swords2", "Mistlands_Swords3", "Mistlands_Viaduct1", "Mistlands_Viaduct2", "Mistlands_Lighthouse1_new", "Mistlands_GuardTower1_new", "Mistlands_GuardTower2_new", "Mistlands_GuardTower3_new", "Mistlands_RockSpire1", "Mistlands_RoadPost1", "Mistlands_Giant2", "Waymarker01", "Waymarker02", "TrollCave02" }; private readonly Dictionary patches = new Dictionary(StringComparer.Ordinal); private readonly Dictionary> custom = new Dictionary>(StringComparer.Ordinal); private readonly List cloneRequests = new List(); private readonly Dictionary aliasLocations = new Dictionary(StringComparer.Ordinal); public void CloneLocation(string sourcePrefabName, string alias) { if (string.IsNullOrEmpty(sourcePrefabName)) { throw new ArgumentException("sourcePrefabName"); } if (string.IsNullOrEmpty(alias)) { throw new ArgumentException("alias"); } cloneRequests.Add(new CloneRequest { SourcePrefabName = sourcePrefabName, Alias = alias }); } private LocationPatch Edit(string name) { if (!patches.TryGetValue(name, out var value)) { value = new LocationPatch(); patches[name] = value; } return value; } public void ChangeBiome(string name, Biome biome, bool enable = true) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) LocationPatch locationPatch = Edit(name); locationPatch.Enable = enable; locationPatch.SetBiome = biome; } public void AddBiome(string name, Biome flags, bool enable = true) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) LocationPatch locationPatch = Edit(name); locationPatch.Enable = enable; Biome val = (Biome)(locationPatch.AddBiomeFlags.HasValue ? ((int)locationPatch.AddBiomeFlags.Value) : 0); locationPatch.AddBiomeFlags = (Biome)(val | flags); } public void ChangeSpawnDistance(string name, float? min = null, float? max = null) { LocationPatch locationPatch = Edit(name); if (min.HasValue) { locationPatch.MinDistance = min.Value; } if (max.HasValue) { locationPatch.MaxDistance = max.Value; } } public void ChangeCenterDistance(string name, float? min = null, float? max = null) { LocationPatch locationPatch = Edit(name); if (min.HasValue) { locationPatch.MinDistanceFromCenter = min.Value; } if (max.HasValue) { locationPatch.MaxDistanceFromCenter = max.Value; } } public void ChangeAltitude(string name, float? min = null, float? max = null) { LocationPatch locationPatch = Edit(name); if (min.HasValue) { locationPatch.MinAltitude = min.Value; } if (max.HasValue) { locationPatch.MaxAltitude = max.Value; } } public void MultiplyQuantity(string name, float mult) { LocationPatch locationPatch = Edit(name); locationPatch.MultiplyQuantity = mult; } public void SetBiomeArea(string name, BiomeArea area) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Edit(name).BiomeArea = area; } public void Custom(string name, Action action) { if (custom.TryGetValue(name, out var value)) { custom[name] = (Action)Delegate.Combine(value, action); } else { custom[name] = action; } } public void editLocations(List locationList) { if (locationList == null || locationList.Count == 0) { Debug.LogWarning((object)"LOCATION LIST IS EMPTY!"); return; } patches.Clear(); custom.Clear(); cloneRequests.Clear(); aliasLocations.Clear(); ConfigureRules(); Dictionary dictionary = IndexByName(locationList); ApplyCloneRequests(locationList, dictionary); foreach (string item in EnumerateUnique(vanillaLocationsYouEdit)) { if (!dictionary.TryGetValue(item, out var value)) { Debug.LogWarning((object)("Location not found: " + item)); continue; } if (patches.TryGetValue(item, out var value2)) { value2.Apply(value); } if (custom.TryGetValue(item, out var value3)) { value3(value); } } ApplyEditsToAliases(); } private void ConfigureRules() { foreach (string deepNorthName in deepNorthNames) { AddBiome(deepNorthName, (Biome)64); MultiplyQuantity(deepNorthName, 2f); ChangeSpawnDistance(deepNorthName, 0f, 0f); } Custom("Mistlands_RoadPost1", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)(loc.m_biome | 0x60); loc.m_minDistance = 0f; loc.m_maxDistance = 0f; }); Custom("Mistlands_RockSpire1", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)(loc.m_biome | 0x60); loc.m_minDistance = 0f; loc.m_maxDistance = 0f; }); ChangeBiome("Mistlands_Harbour1", (Biome)608); float? max = 3000f; ChangeAltitude("Mistlands_Harbour1", null, max); ChangeBiome("MountainWell1", (Biome)68); ChangeAltitude("MountainWell1", 0f, 3000f); CloneLocation("GoblinCamp2", "GoblinCamp2@VariantA"); CloneLocation("GoblinCamp2", "GoblinCamp2@VariantB"); CloneLocation("StoneTower1", "StoneTower1@VariantA"); CloneLocation("StoneTower1", "StoneTower1@VariantB"); CloneLocation("StoneTower3", "StoneTower3@VariantA"); CloneLocation("StoneTower3", "StoneTower3@VariantB"); Custom("GoblinCamp2", delegate(ZoneLocation loc) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)528; loc.m_minDistanceFromCenter = 1000f; loc.m_quantity = Mathf.Max(1, loc.m_quantity); }); Custom("GoblinCamp2@VariantA", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)8; loc.m_minDistanceFromCenter = 3000f; loc.m_minDistanceFromSimilar = 500f; loc.m_quantity *= 2; loc.m_prioritized = true; loc.m_unique = false; }); Custom("GoblinCamp2@VariantB", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)1; loc.m_minDistanceFromCenter = 5000f; loc.m_minDistanceFromSimilar = 800f; loc.m_quantity = loc.m_quantity; loc.m_prioritized = false; loc.m_unique = false; }); Custom("StoneTower1", delegate(ZoneLocation loc) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)528; loc.m_minDistanceFromCenter = 1000f; loc.m_quantity = Mathf.Max(1, loc.m_quantity); }); Custom("StoneTower1@VariantA", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)8; loc.m_minDistanceFromCenter = 3000f; loc.m_minDistanceFromSimilar = 500f; loc.m_quantity *= 2; loc.m_prioritized = true; loc.m_unique = false; }); Custom("StoneTower1@VariantB", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)1; loc.m_minDistanceFromCenter = 5000f; loc.m_minDistanceFromSimilar = 800f; loc.m_quantity = loc.m_quantity; loc.m_prioritized = false; loc.m_unique = false; }); Custom("StoneTower3", delegate(ZoneLocation loc) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)528; loc.m_minDistanceFromCenter = 1000f; loc.m_quantity = Mathf.Max(1, loc.m_quantity); }); Custom("StoneTower3@VariantA", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)8; loc.m_minDistanceFromCenter = 3000f; loc.m_minDistanceFromSimilar = 500f; loc.m_quantity *= 2; loc.m_prioritized = true; loc.m_unique = false; }); Custom("StoneTower3@VariantB", delegate(ZoneLocation loc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) loc.m_biome = (Biome)1; loc.m_minDistanceFromCenter = 5000f; loc.m_minDistanceFromSimilar = 800f; loc.m_quantity = loc.m_quantity; loc.m_prioritized = false; loc.m_unique = false; }); ApplyBiomeSwapRules(); ApplySpecialRules(); } private void ApplyBiomeSwapRules() { //IL_0003: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) Biome val = (Biome)9; Biome biome = (Biome)10; Biome val2 = (Biome)18; Biome val3 = (Biome)24; Biome val4 = (Biome)(val2 | val); Biome biome2 = (Biome)48; Biome val5 = (Biome)580; Biome val6 = (Biome)514; Biome val7 = (Biome)68; Biome biome3 = (Biome)(val5 | val4); Biome biome4 = (Biome)(val7 | val2); Biome biome5 = (Biome)(val2 | val5); Biome biome6 = (Biome)(val3 | val6); ChangeBiome("Ruin1", val); ChangeAltitude("Ruin1", 5f, 150f); ChangeBiome("Ruin2", val); ChangeAltitude("Ruin2", 5f, 150f); string[] array = new string[3] { "TarPit1", "TarPit2", "TarPit3" }; foreach (string name in array) { ChangeBiome(name, biome2); ChangeAltitude(name, 5f, 70f); } ChangeBiome("SwampWell1", biome4); ChangeBiome("ShipSetting01", biome3); ChangeAltitude("ShipSetting01", -5f, 25f); ChangeBiome("MountainGrave01", val4); ChangeBiome("InfestedTree01", val6); string[] array2 = new string[3] { "AbandonedLogCabin02", "AbandonedLogCabin03", "AbandonedLogCabin04" }; foreach (string name2 in array2) { ChangeBiome(name2, val7); ChangeSpawnDistance(name2, 500f, 0f); } ChangeBiome("StoneTowerRuins03", biome); string[] array3 = new string[16] { "WoodHouse1", "WoodHouse2", "WoodHouse3", "WoodHouse4", "WoodHouse5", "WoodHouse6", "WoodHouse7", "WoodHouse8", "WoodHouse9", "WoodHouse10", "WoodHouse11", "WoodHouse12", "WoodHouse13", "StoneHouse3", "StoneHouse4", "StoneHenge6" }; foreach (string name3 in array3) { ChangeBiome(name3, biome3); ChangeSpawnDistance(name3, 100f, 0f); MultiplyQuantity(name3, 2f); } string[] array4 = new string[3] { "SwampRuin1", "SwampRuin2", "StoneTowerRuins04" }; foreach (string name4 in array4) { ChangeBiome(name4, biome5); } ChangeBiome("StoneTowerRuins05", biome5); ChangeSpawnDistance("StoneTowerRuins05", 500f, 0f); string[] array5 = new string[4] { "StoneTowerRuins07", "StoneTowerRuins08", "StoneTowerRuins09", "StoneTowerRuins10" }; foreach (string name5 in array5) { ChangeBiome(name5, val4); ChangeSpawnDistance(name5, 1000f, 0f); } ChangeBiome("StoneHouse5_heath", biome2); ChangeSpawnDistance("StoneHouse5_heath", 500f, 0f); string[] array6 = new string[4] { "SwampHut1", "SwampHut2", "SwampHut3", "SwampHut5" }; foreach (string name6 in array6) { ChangeBiome(name6, biome5); ChangeSpawnDistance(name6, 1000f, 0f); } ChangeBiome("SwampHut4", biome6); ChangeSpawnDistance("SwampHut4", 500f, 0f); } private void ApplySpecialRules() { Custom("SunkenCrypt4", delegate(ZoneLocation loc) { //IL_0003: 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) loc.m_biome = (Biome)2; loc.m_minDistance = 300f; loc.m_minDistanceFromCenter = 600f; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 0f; loc.m_maxAltitude = 100000f; loc.m_iconPlaced = true; loc.m_quantity *= 2; loc.m_prioritized = true; loc.m_biomeArea = (BiomeArea)3; loc.m_minDistanceFromSimilar = 44f; }); } private void ApplyCloneRequests(List locationList, Dictionary byName) { for (int i = 0; i < cloneRequests.Count; i++) { CloneRequest cloneRequest = cloneRequests[i]; if (aliasLocations.ContainsKey(cloneRequest.Alias)) { Debug.LogWarning((object)("Clone alias already exists: " + cloneRequest.Alias)); continue; } if (!byName.TryGetValue(cloneRequest.SourcePrefabName, out var value) || value == null) { Debug.LogWarning((object)("Clone source location not found: " + cloneRequest.SourcePrefabName)); continue; } ZoneLocation val = value.Clone(); if (val == null) { Debug.LogWarning((object)("Clone() returned null for: " + cloneRequest.SourcePrefabName)); continue; } val.m_prefabName = value.m_prefabName; locationList.Add(val); aliasLocations[cloneRequest.Alias] = val; } } private void ApplyEditsToAliases() { foreach (KeyValuePair patch in patches) { if (aliasLocations.TryGetValue(patch.Key, out var value)) { patch.Value.Apply(value); } } foreach (KeyValuePair> item in custom) { if (aliasLocations.TryGetValue(item.Key, out var value2)) { item.Value(value2); } } } private static Dictionary IndexByName(List locationList) { Dictionary dictionary = new Dictionary(StringComparer.Ordinal); for (int i = 0; i < locationList.Count; i++) { ZoneLocation val = locationList[i]; if (val != null && !string.IsNullOrEmpty(val.m_prefabName)) { if (dictionary.TryGetValue(val.m_prefabName, out var _)) { Debug.LogWarning((object)("Duplicate ZoneLocation prefabName: " + val.m_prefabName)); } else { dictionary.Add(val.m_prefabName, val); } } } return dictionary; } private static IEnumerable EnumerateUnique(List list) { HashSet seen = new HashSet(StringComparer.Ordinal); for (int i = 0; i < list.Count; i++) { string j = list[i]; if (!string.IsNullOrEmpty(j) && seen.Add(j)) { yield return j; } } } } public class LocationConstructor { public static readonly List workingLocations = new List(); private static readonly Dictionary> softReferences = new Dictionary>(); public static readonly List zoneLocations = new List(); private const string GroupSuffix = "_GRBAL"; private const string RandSuffix = "_RANDBAL"; private static readonly Regex UnityCopySuffix = new Regex("\\s*\\(\\d+\\)\\s*$", RegexOptions.Compiled); private static readonly Regex RandAtEnd = new Regex("_RANDBAL(\\d{1,4})$", RegexOptions.Compiled); private static readonly Dictionary prefabCache = new Dictionary(StringComparer.Ordinal); private static readonly HashSet processedInstanceIds = new HashSet(); public static GameObject GenerateLocationStructure(GameObject root) { if ((Object)(object)root == (Object)null) { return null; } int instanceID = ((Object)root).GetInstanceID(); if (processedInstanceIds.Contains(instanceID)) { return root; } processedInstanceIds.Add(instanceID); if ((Object)(object)ZNetScene.instance == (Object)null) { Debug.LogWarning((object)"LocationConstructor: ZNetScene.instance is null (too early)."); return root; } prefabCache.Clear(); List list = new List(512); CollectMarkers(root.transform, list); int cloneCounter = 0; for (int i = 0; i < list.Count; i++) { ReplaceMarker(list[i], ref cloneCounter); } return root; } private static void CollectMarkers(Transform root, List markers) { Stack stack = new Stack(); stack.Push(root); while (stack.Count > 0) { Transform val = stack.Pop(); if (!((Object)(object)val == (Object)null)) { for (int i = 0; i < val.childCount; i++) { stack.Push(val.GetChild(i)); } if (!((Object)(object)val == (Object)(object)root) && !IsGroupNode(((Object)val).name)) { markers.Add(val); } } } } private static bool IsGroupNode(string name) { if (string.IsNullOrEmpty(name)) { return false; } return name.EndsWith("_GRBAL", StringComparison.Ordinal); } private static void ReplaceMarker(Transform marker, ref int cloneCounter) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00eb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)marker == (Object)null || (Object)(object)((Component)marker).gameObject == (Object)null) { return; } string name = ((Object)marker).name; int? chance; string text = ExtractBasePrefabName(name, out chance); if (string.IsNullOrEmpty(text)) { return; } GameObject prefabCached = GetPrefabCached(text); if ((Object)(object)prefabCached == (Object)null) { return; } Transform parent = marker.parent; Vector3 localPosition = marker.localPosition; Quaternion localRotation = marker.localRotation; Vector3 localScale = marker.localScale; GameObject val = Object.Instantiate(prefabCached); ((Object)val).name = text + " (" + cloneCounter++ + ")"; val.transform.SetParent(parent, false); val.transform.localPosition = localPosition; val.transform.localRotation = localRotation; val.transform.localScale = localScale; if (chance.HasValue) { RandomSpawn val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent(); } val2.m_chanceToSpawn = chance.Value; } Object.Destroy((Object)(object)((Component)marker).gameObject); } private static string ExtractBasePrefabName(string markerName, out int? chance) { chance = null; if (string.IsNullOrEmpty(markerName)) { return null; } string text = markerName; Match match = RandAtEnd.Match(text); if (match.Success) { if (int.TryParse(match.Groups[1].Value, out var result)) { chance = result; } text = text.Substring(0, match.Index); } text = UnityCopySuffix.Replace(text, "").Trim(); if (text.EndsWith("_GRBAL", StringComparison.Ordinal)) { text = text.Substring(0, text.Length - "_GRBAL".Length); } return text.Trim(); } private static GameObject GetPrefabCached(string baseName) { if (string.IsNullOrEmpty(baseName)) { return null; } if (prefabCache.TryGetValue(baseName, out var value)) { return value; } ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null) { prefabCache[baseName] = null; return null; } value = instance.GetPrefab(baseName); if ((Object)(object)value == (Object)null && instance.m_prefabs != null) { for (int i = 0; i < instance.m_prefabs.Count; i++) { GameObject val = instance.m_prefabs[i]; if ((Object)(object)val != (Object)null && string.Equals(((Object)val).name, baseName, StringComparison.Ordinal)) { value = val; break; } } if ((Object)(object)value != (Object)null) { int key = BalrondHashCompat.StableHash(baseName); if (!instance.m_namedPrefabs.ContainsKey(key)) { instance.m_namedPrefabs[key] = value; } } } prefabCache[baseName] = value; return value; } public static AssetID AssetIDFromObject(Object obj) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) int instanceID = obj.GetInstanceID(); return new AssetID(1u, 1u, 1u, (uint)instanceID); } public static SoftReference AddLoadedSoftReferenceAsset(T obj) where T : Object { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) AssetBundleLoader instance = AssetBundleLoader.Instance; instance.m_bundleNameToLoaderIndex[""] = 0; AssetID val = AssetIDFromObject((Object)(object)obj); AssetLoader val2 = default(AssetLoader); ((AssetLoader)(ref val2))..ctor(val, new AssetLocation("", "")); val2.m_asset = (Object)(object)obj; val2.m_referenceCounter = new ReferenceCounter(2u); val2.m_shouldBeLoaded = true; AssetLoader val3 = val2; int count = instance.m_assetIDToLoaderIndex.Count; if (count >= instance.m_assetLoaders.Length) { Array.Resize(ref instance.m_assetLoaders, count + 256); } instance.m_assetLoaders[count] = val3; instance.m_assetIDToLoaderIndex[val] = count; SoftReference result = default(SoftReference); result..ctor(val); result.m_name = ((Object)obj).name; return result; } public static void CreateNewZoneLocations(List gameObjects, ZoneSystem __instance) { for (int i = 0; i < gameObjects.Count; i++) { CreateNewZoneLocationForLocationPrefab(gameObjects[i], __instance); } } private static void CreateNewZoneLocationForLocationPrefab(GameObject gameObject, ZoneSystem __instance) { if (!((Object)(object)gameObject == (Object)null)) { string name = ((Object)gameObject).name; string text = name; if (text == "Test1") { BuildLocation(gameObject, enabled: true, prioritize: true, unique: true, inForest: true, "TestBal", 150f, showIcon: true, placeIcon: false, randomRotation: true, slopeRotation: false, snapToWater: false, clearArea: true, centerFirst: false, 0.5f, 3.5f, 0.2f, 0.8f, 500f, 8000f, 10f, 200f, 5, (BiomeArea)2, (Biome)8); } } } private static void BuildLocation(GameObject gameObject, bool enabled = true, bool prioritize = true, bool unique = false, bool inForest = true, string groupName = "", float minDistanceFromSimilar = 100f, bool showIcon = false, bool placeIcon = false, bool randomRotation = false, bool slopeRotation = false, bool snapToWater = false, bool clearArea = true, bool centerFirst = false, float minDelta = 1f, float maxDelta = 99f, float forestMin = 0f, float forestMax = 99f, float minDistance = 0f, float maxDistance = 10000f, float minAlt = 0f, float maxAlt = 9999f, int quantity = 1, BiomeArea biomeArea = 3, Biome biome = 1) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) gameObject = GenerateLocationStructure(gameObject); Location component = gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogError((object)("BuildLocation: prefab missing Location component: " + ((Object)gameObject).name)); return; } workingLocations.Add(component); if (!softReferences.TryGetValue(component, out var value)) { value = LocationConstructor.AddLoadedSoftReferenceAsset(((Component)component).gameObject); softReferences[component] = value; } ZoneLocation item = new ZoneLocation { m_prefabName = ((Object)component).name, m_prefab = value, m_enable = enabled, m_biome = biome, m_biomeArea = biomeArea, m_quantity = quantity, m_prioritized = prioritize, m_centerFirst = centerFirst, m_unique = unique, m_group = groupName, m_minDistanceFromSimilar = minDistanceFromSimilar, m_iconAlways = showIcon, m_iconPlaced = placeIcon, m_randomRotation = randomRotation, m_slopeRotation = slopeRotation, m_snapToWater = snapToWater, m_minTerrainDelta = minDelta, m_maxTerrainDelta = maxDelta, m_inForest = inForest, m_forestTresholdMin = forestMin, m_forestTresholdMax = forestMax, m_minDistance = minDistance, m_maxDistance = maxDistance, m_minAltitude = minAlt, m_maxAltitude = maxAlt, m_clearArea = clearArea, m_exteriorRadius = component.m_exteriorRadius, m_interiorRadius = component.m_interiorRadius }; zoneLocations.Add(item); } } public class MonsterFeeding { private static string[] names = new string[0]; public void setMonsters(List list) { List list2 = list.FindAll((GameObject x) => (Object)(object)x.GetComponent() != (Object)null); foreach (GameObject item in list2) { setFood(item, list); } } private static void setFood(GameObject monster, List items) { MonsterAI component = monster.GetComponent(); component.m_consumeRange = 3f; component.m_consumeSearchInterval = 5f; component.m_consumeSearchRange = 100f; if ((((Object)monster).name.Contains("Draugr") || ((Object)monster).name == "AbominationNew") && ((Object)monster).name != "EnemyShip") { meatList(component, items); } if (((Object)monster).name.Contains("golem") || ((Object)monster).name.Contains("Golem") || ((Object)monster).name.Contains("IcePanther")) { golemFeed(component, items); return; } if (isGraydwarfish(((Object)monster).name)) { greyDwarfsFeed(component, items); return; } switch (((Object)monster).name) { case "Leech": fishBaitList(component, items); bloodyList(component, items); break; case "Deathsquito": case "Deathsquito_New": case "Tick": bloodyList(component, items); break; case "Hen": case "Chick": case "GiantCrow": plantList(component, items); seedList(component, items); break; case "Goat": plantList(component, items); vegetablesList(component, items); break; case "CrabSea": case "Neck": case "NeckBrute": case "CrabLeaf": case "CrabStone": plantList(component, items); smallMeatList(component, items); fishBaitList(component, items); break; case "Boar": case "Lox": case "Bear": case "Hog": fruitList(component, items); vegetablesList(component, items); plantList(component, items); meatList(component, items); mushroomList(component, items); break; case "Asksvin_hatchling": case "Asksvin": case "Volture": meatList(component, items); break; case "Wolf": case "Ulv": case "Fenring": case "Frostbjorn": case "Hatchling": meatList(component, items); break; case "Troll": case "Yotun": case "Serpent": bigMeatList(component, items); component.m_consumeItems.Add(GetItem(items, "FishRaw")); break; case "Serpentling": fishBaitList(component, items); meatList(component, items); break; default: component.m_consumeItems = new List(); break; } } private static ItemDrop GetItem(List items, string name) { GameObject val = items.Find((GameObject x) => ((Object)x).name == name); ItemDrop result = null; if ((Object)(object)val != (Object)null) { result = val.GetComponent(); } else { Debug.LogWarning((object)("Food item not found: " + name)); val = items.Find((GameObject x) => ((Object)x).name == "Carrot"); } return result; } private static bool isGraydwarfish(string name) { return name.Contains("Greyling") || name.Contains("Greyd") || name == "Abomination"; } private static void greyDwarfsFeed(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "Wood")); monsterAI.m_consumeItems.Add(GetItem(items, "WoodNails_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Stone")); monsterAI.m_consumeItems.Add(GetItem(items, "RoundLog")); monsterAI.m_consumeItems.Add(GetItem(items, "FineWood")); monsterAI.m_consumeItems.Add(GetItem(items, "HardWood_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Dandelion")); monsterAI.m_consumeItems.Add(GetItem(items, "Straw_bal")); } private static void golemFeed(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "Stone")); monsterAI.m_consumeItems.Add(GetItem(items, "CopperOre")); monsterAI.m_consumeItems.Add(GetItem(items, "IronOre")); monsterAI.m_consumeItems.Add(GetItem(items, "TinOre")); monsterAI.m_consumeItems.Add(GetItem(items, "SilverOre")); monsterAI.m_consumeItems.Add(GetItem(items, "Crystal")); } private static void fruitList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "Blackberries_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Blueberries")); monsterAI.m_consumeItems.Add(GetItem(items, "Cloudberry")); monsterAI.m_consumeItems.Add(GetItem(items, "Raspberry")); monsterAI.m_consumeItems.Add(GetItem(items, "Pukeberries")); monsterAI.m_consumeItems.Add(GetItem(items, "Apple_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Iceberry_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Bloodfruit_bal")); } private static void vegetablesList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "Carrot")); monsterAI.m_consumeItems.Add(GetItem(items, "Turnip")); monsterAI.m_consumeItems.Add(GetItem(items, "Onion")); monsterAI.m_consumeItems.Add(GetItem(items, "Garlic_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Cabbage_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "CabbageLeaf_bal")); } private static void bloodyList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "Bloodbag")); monsterAI.m_consumeItems.Add(GetItem(items, "GiantBloodSack")); monsterAI.m_consumeItems.Add(GetItem(items, "Bloodfruit_bal")); } private static void mushroomList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "Darkbul_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "MushroomBlue")); monsterAI.m_consumeItems.Add(GetItem(items, "Mushroom")); monsterAI.m_consumeItems.Add(GetItem(items, "MushroomYellow")); monsterAI.m_consumeItems.Add(GetItem(items, "Ignicap_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "MushroomMagecap")); monsterAI.m_consumeItems.Add(GetItem(items, "MushroomJotunPuffs")); monsterAI.m_consumeItems.Add(GetItem(items, "MushroomSmokePuff")); } private static void plantList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "RedKelp_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Thistle")); monsterAI.m_consumeItems.Add(GetItem(items, "Dandelion")); monsterAI.m_consumeItems.Add(GetItem(items, "Honey")); monsterAI.m_consumeItems.Add(GetItem(items, "Barley")); monsterAI.m_consumeItems.Add(GetItem(items, "Flax")); monsterAI.m_consumeItems.Add(GetItem(items, "Snowleaf_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "Straw_bal")); } private static void seedList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "BirdFeed_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "BirchSeeds")); monsterAI.m_consumeItems.Add(GetItem(items, "AppleSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "OnionSeeds")); monsterAI.m_consumeItems.Add(GetItem(items, "TurnipSeeds")); monsterAI.m_consumeItems.Add(GetItem(items, "CarrotSeeds")); monsterAI.m_consumeItems.Add(GetItem(items, "Acorn")); monsterAI.m_consumeItems.Add(GetItem(items, "AcaiSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "CabbageSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "CypressSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "GarlicSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "PoplarSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "StrawSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "SwampTreeSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "VineberrySeeds")); monsterAI.m_consumeItems.Add(GetItem(items, "WillowSeeds_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "BeechSeeds")); } private static void bigMeatList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "SerpentMeat")); monsterAI.m_consumeItems.Add(GetItem(items, "TrollMeat_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "FenringMeat_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "DrakeMeat_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "LoxMeat")); monsterAI.m_consumeItems.Add(GetItem(items, "SharkMeat_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "RawDragonRibs_bal")); } private static void fishBaitList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "FishingBait")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitSwamp")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitPlains")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitOcean")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitMistlands")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitForest")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitDeepNorth")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitCave")); monsterAI.m_consumeItems.Add(GetItem(items, "FishingBaitAshlands")); } private static void meatList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "RottenMeat")); monsterAI.m_consumeItems.Add(GetItem(items, "HareMeat")); monsterAI.m_consumeItems.Add(GetItem(items, "RawMeat")); monsterAI.m_consumeItems.Add(GetItem(items, "DeerMeat")); monsterAI.m_consumeItems.Add(GetItem(items, "WolfMeat")); monsterAI.m_consumeItems.Add(GetItem(items, "Entrails")); monsterAI.m_consumeItems.Add(GetItem(items, "GoatMeat_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "RawCrowMeat_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "RawSteak_bal")); } private static void smallMeatList(MonsterAI monsterAI, List items) { monsterAI.m_consumeItems.Add(GetItem(items, "CrabLegs_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "FishRaw")); monsterAI.m_consumeItems.Add(GetItem(items, "BatWing_bal")); monsterAI.m_consumeItems.Add(GetItem(items, "ChickenMeat")); } } public class DungeonFactory { private struct DungeonConfig { public int MinRooms; public int MaxRooms; public int MinRequiredRooms; public float? CampRadiusMin; public float? CampRadiusMax; public DungeonConfig(int min, int max, int minRequired = 10, float? campMin = null, float? campMax = null) { MinRooms = min; MaxRooms = max; MinRequiredRooms = minRequired; CampRadiusMin = campMin; CampRadiusMax = campMax; } } private readonly Dictionary _dungeonConfigs = new Dictionary { { "DG_Cave", new DungeonConfig(15, 60) }, { "DG_AshlandRuins", new DungeonConfig(20, 40) }, { "DG_SunkenCrypt", new DungeonConfig(20, 80, 10, 20f, 40f) }, { "DG_Crypt", new DungeonConfig(15, 60) }, { "DG_MeadowsFarm", new DungeonConfig(10, 40, 10, 10f, 50f) }, { "DG_MeadowsVillage", new DungeonConfig(10, 40, 10, 10f, 50f) }, { "DG_GoblinCamp", new DungeonConfig(5, 50, 5, 10f, 50f) }, { "DG_FortressRuins", new DungeonConfig(30, 40, 10, 30f, 45f) }, { "DG_ForestCrypt", new DungeonConfig(15, 60) }, { "DG_DvergrTown", new DungeonConfig(30, 120, 10, 10f, 50f) } }; public void EditDungeons(List dungeons) { if (dungeons == null || dungeons.Count == 0) { return; } foreach (GameObject dungeon in dungeons) { DungeonGenerator val = (((Object)(object)dungeon != (Object)null) ? dungeon.GetComponent() : null); if ((Object)(object)val != (Object)null) { ApplyDungeonSettings(val); } } } private void ApplyDungeonSettings(DungeonGenerator dungeon) { if (_dungeonConfigs.TryGetValue(((Object)dungeon).name, out var value)) { SetRoomLimits(dungeon, value.MinRooms, value.MaxRooms, value.MinRequiredRooms); if (value.CampRadiusMin.HasValue && value.CampRadiusMax.HasValue) { SetCampRadius(dungeon, value.CampRadiusMin.Value, value.CampRadiusMax.Value); } } } private void SetRoomLimits(DungeonGenerator dungeon, int min, int max, int minRequired) { dungeon.m_minRooms = min; dungeon.m_maxRooms = max; dungeon.m_minRequiredRooms = minRequired; } private void SetCampRadius(DungeonGenerator dungeon, float min, float max) { dungeon.m_campRadiusMin = min; dungeon.m_campRadiusMax = max; } } internal class ItemList { public static readonly string[] items = new string[347] { "Zinc_bal", "ZincOre_bal", "ZincScrap_bal", "Cupronickel_bal", "Vanadium_bal", "VanadiumOre_bal", "Bandages_bal", "CupronickelPlate_bal", "LeadOre_bal", "Lead_bal", "FirstAidKit_bal", "BundleBlackforgeBench_bal", "BundleConstructionBench_bal", "BundleForgeBench_bal", "BundleIronworksBench_bal", "BundleRuneforgeBench_bal", "BundleStoncutterBench_bal", "BundleArtisanBench_bal", "WoodBundle_bal", "ClayMoldBundle_bal", "CeramicMoldBundle_bal", "StrawBundle_bal", "AxeCopper_bal", "Gabro_bal", "ClayBrickMold_bal", "AcaiSeeds_bal", "AcidSludge_bal", "Amethysteel_bal", "Amethyst_bal", "AncientRelic_bal", "AppleSeeds_bal", "AppleVinegar_bal", "Apple_bal", "ArrowBlizzard_bal", "ArrowBlunt_bal", "ArrowBone_bal", "ArrowChitin_bal", "ArrowFlametal_bal", "BasicSeed_bal", "BatWingCooked_bal", "BatWing_bal", "HabrokHide_bal", "BellMetal_bal", "BeltForester_bal", "BeltMountaineer_bal", "BeltSailor_bal", "BirdFeed_bal", "Blackberries_bal", "BlackMetalCultivator_bal", "BlackMetalHoe_bal", "BlackMetalOre_bal", "BlackSkin_bal", "BlackTissue_bal", "Bloodfruit_bal", "Bloodshard_bal", "BlueBasalt_bal", "BoarHide_bal", "BoltBlunt_bal", "BoltChitin_bal", "BoltFire_bal", "BoltSilver_bal", "BoltThunder_bal", "BoraxCrystal_bal", "BundleHut_bal", "CabbageLeaf_bal", "CabbageSeeds_bal", "Cabbage_bal", "CarvedCarcass_bal", "CarvedDeerSkull_bal", "CeramicMold_bal", "Cheese_bal", "CabbageSoup_bal", "ClamMeat_bal", "ClayBrick_bal", "ClayPot_bal", "Clay_bal", "CoalPowder_bal", "CobaltOre_bal", "Cobalt_bal", "EitrPills_bal", "CookedCrowMeat_bal", "CookedDragonRibs_bal", "CorruptedEitr_bal", "CrabLegsCooked_bal", "CrabLegs_bal", "CrystalWood_bal", "CultInsignia_bal", "CursedBone_bal", "CypressSeeds_bal", "Darkbul_bal", "DarkIron_bal", "DarkSteel_bal", "DeadEgo_bal", "Diamond_bal", "DragonSoul_bal", "DrakeMeatCooked_bal", "DrakeMeat_bal", "DrakeSkin_bal", "DyeKit_bal", "Electrum_bal", "EmberWood_bal", "EnrichedEitr_bal", "Emerald_bal", "EnrichedSoil_bal", "FenringInsygnia_bal", "FenringMeatCooked_bal", "FenringMeat_bal", "Ferroboron_bal", "FireGland_bal", "FishWrapsUncooked_bal", "FlametalScrap_bal", "ForsakenHeart_bal", "FoxFur_bal", "Frosteel_bal", "GarlicSeeds_bal", "Garlic_bal", "GemChunks_bal", "CarvedWood_bal", "WispCore_bal", "SwordTaunt_bal", "GoatMeatCooked_bal", "GoatMeat_bal", "GoldBar_bal", "GoldOre_bal", "GoldScrap_bal", "GrayMushroom_bal", "GrilledCheese_bal", "HammerBlackmetal_bal", "HammerDverger_bal", "HammerIron_bal", "HammerMythic_bal", "HardWood_bal", "HelmetCrown_bal", "Iceberry_bal", "IceShard_bal", "Ignicap_bal", "InfusedCarapace_bal", "JotunFinger_bal", "JuteThread_bal", "KingMug_bal", "LimeStone_bal", "MagmaBrokenSword_bal", "MagmaStone_bal", "MapleSeeds_bal", "MeadBase_bal", "MedPack_bal", "Milk_bal", "MincedMeat_bal", "MoltenSteel_bal", "Moss_bal", "Mugwort_bal", "MushroomIcecap_bal", "MushroomInkcap_bal", "BrassChain_bal", "MythicEye_bal", "NeckSkin_bal", "TeaMint_bal", "Nettle_bal", "NickelOre_bal", "Nickel_bal", "NorthernFur_bal", "NumbMeal_bal", "Sage_bal", "Lavender_bal", "Mint_bal", "OilBase_bal", "Oil_bal", "Onyx_bal", "Opal_bal", "PatchworkBundle_bal", "Peningar_bal", "PickaxeFlametal_bal", "Plantain_bal", "PoplarSeeds_bal", "PowderedSpiritShard_bal", "RawCrowMeat_bal", "RawDragonRibs_bal", "RawSilkScrap_bal", "RawSilk_bal", "RawSteak_bal", "Lingonberry_bal", "RedKelp_bal", "RefinedOil_bal", "RustedScrap_bal", "RustyBrokenSword_bal", "Sapphire_bal", "SawBlade_bal", "Seaberries_bal", "SeaPearl_bal", "SeekerBrain_bal", "SerpentEgg_bal", "SharkMeatCooked_bal", "SharkMeat_bal", "SilkReinforcedThread_bal", "SilverPouch_bal", "SilverScrap_bal", "SmallBloodSack_bal", "Snowleaf_bal", "YggTreeSeed_bal", "SoulCore_bal", "SpiceSet_bal", "SpiritShard_bal", "SteakCooked_bal", "StormScale_bal", "StrawSeeds_bal", "StrawThread_bal", "Straw_bal", "RedwoodSeeds_bal", "DarksteelNails_bal", "SurtrAmulet_bal", "SwampTreeSeeds_bal", "RottenVegetable_bal", "TarBase_bal", "ThornHeart_bal", "ThunderGland_bal", "TormentedSoul_bal", "TrollMeatCooked_bal", "TrollMeat_bal", "VikingTalisman_bal", "WatcherHeart_bal", "WaterLilySeeds_bal", "WaterLily_bal", "WhiteMetal_bal", "WillowSeeds_bal", "WillowBark_bal", "YewBark_bal", "WoodNails_bal", "Yarrow_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", "MeatScrap_bal", "CookedMeatScrap_bal", "WoodBucket_bal", "WoodBucketWater_bal", "WaterJug_bal", "BeltVidar_bal", "BeltAssasin_bal", "TrophyBattleHog_bal", "TrophyBear_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", "TrophyPolarBear_bal", "TrophyLeechPrimal_bal", "TrophyStagGhost_bal", "Larva_bal", "WaterJugEmpty_bal", "TinScrap_bal", "CobaltScrap_bal", "FrosteelScrap_bal", "NickelScrap_bal", "DarksteelScrap_bal", "BrassScrap_bal", "WhiteMetalScrap_bal", "AmethysteelScrap_bal", "ElectrumScrap_bal", "FerroboronScrap_bal", "MoltenSteelScrap_bal", "IfrytiumScrap_bal", "TernarySilver_bal", "SwordFakeSilver_Bal", "MaceFakeSilver_bal", "TrophyCrow_bal", "HabrokLiver_bal", "TrophyHabrok_bal", "TrophyHabrokBirb_bal", "TrophyFox_bal", "TrophyForestTroll_bal", "Silkworms_bal", "Mycelium_bal", "MaceCopper_bal", "PaintBucket_bal", "ChumBucket_bal", "PoisonApple_bal", "BundleCart_bal" }; } public class JsonLoader { public string defaultPath = string.Empty; public void loadJson() { LoadTranslations(); justDefaultPath(); } public void justDefaultPath() { string configPath = Paths.ConfigPath; string text = Path.Combine(configPath, "BalrondAmazingNature-translation/"); defaultPath = text; } public void createDefaultPath() { string configPath = Paths.ConfigPath; string path = Path.Combine(configPath, "BalrondAmazingNature-translation/"); if (!Directory.Exists(path)) { CreateFolder(path); } defaultPath = path; } private string[] jsonFilePath(string folderName, string extension) { string configPath = Paths.ConfigPath; string path = Path.Combine(configPath, "BalrondAmazingNature-translation/"); if (!Directory.Exists(path)) { CreateFolder(path); } return Directory.GetFiles(path, extension); } private static void CreateFolder(string path) { try { Directory.CreateDirectory(path); Debug.Log((object)"BalrondAmazingNature: Folder created successfully."); } catch (Exception ex) { Debug.Log((object)("BalrondAmazingNature: Error creating folder: " + ex.Message)); } } private void LoadTranslations() { int num = 0; string[] array = jsonFilePath("Translation", "*.json"); foreach (string text in array) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text); string json = File.ReadAllText(text); JsonData jsonData = JsonMapper.ToObject(json); Dictionary dictionary = new Dictionary(); foreach (string key in jsonData.Keys) { dictionary[key] = jsonData[key].ToString(); } if (dictionary != null) { BalrondTranslator.translations.Add(fileNameWithoutExtension, dictionary); num++; } else { Debug.LogError((object)("BalrondAmazingNature: Loading FAILED file: " + text)); } } } } [BepInPlugin("balrond.astafaraios.BalrondAmazingNature", "BalrondAmazingNature", "1.2.3")] public class Launch : BaseUnityPlugin { [HarmonyPatch(typeof(Player), "UseStamina")] private class Player_UseStamina { private static bool Prefix() { return !Player.m_debugMode || !((Terminal)Console.instance).IsCheatsEnabled(); } } [HarmonyPatch(typeof(Player), "UseEitr")] private class Player_UseEitr { private static bool Prefix() { return !Player.m_debugMode || !((Terminal)Console.instance).IsCheatsEnabled(); } } [HarmonyPatch(typeof(AudioMan), "Awake")] private static class AudioMan_Awake_Patch { private static void Postfix(AudioMan __instance) { List> list = new List> { modResourceLoader.itemPrefabs, modResourceLoader.buildPrefabs, modResourceLoader.monsterPrefabs, modResourceLoader.vfxPrefabs, modResourceLoader.vegetationPrefabs }; foreach (List item in list) { foreach (GameObject item2 in item) { AudioSource[] componentsInChildren = item2.GetComponentsInChildren(true); foreach (AudioSource val in componentsInChildren) { val.outputAudioMixerGroup = __instance.m_masterMixer.outputAudioMixerGroup; } } } } } [HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")] public static class Object_CopyOtherDB_Patch { public static void Postfix() { if (IsObjectDBValid()) { modResourceLoader.setupBuildPiecesListDB(); databaseAddMethods.AddItems(modResourceLoader.itemPrefabs); } } } [HarmonyPatch(typeof(ObjectDB), "Awake")] public static class ObjectDB_Awake_Patch { public static void Postfix() { if (IsObjectDBValid()) { modResourceLoader.setupBuildPiecesListDB(); databaseAddMethods.AddItems(modResourceLoader.itemPrefabs); databaseAddMethods.AddStatuseffects(modResourceLoader.statusEffects); itemEdits.editItems(ObjectDB.instance.m_items); recipeFactory.createRecipes(ObjectDB.instance.m_items, modResourceLoader.itemPrefabs); modResourceLoader.recipes.AddRange(recipeFactory.recipes); databaseAddMethods.AddRecipes(modResourceLoader.recipes); recipeEdits.editRecipes(ObjectDB.instance.m_recipes, ObjectDB.instance.m_items); recipeRetarget.Setup(ObjectDB.instance.m_items, ObjectDB.instance.m_recipes); ObjectDB.instance.m_recipes.Sort(SortByScore); StatusEffect val = ObjectDB.instance.m_StatusEffects.Find((StatusEffect x) => ((Object)x).name == "Cold"); val.m_name = "$tag_coldnight_status_bal"; WetColdRegenPatches.WetTuning.Apply(ObjectDB.instance); SE_SpawnItemDropOnConsume sE_SpawnItemDropOnConsume = modResourceLoader.statusEffects.Find((StatusEffect x) => ((Object)x).name == "EmptyJugDrop") as SE_SpawnItemDropOnConsume; sE_SpawnItemDropOnConsume.m_prefab = modResourceLoader.itemPrefabs.Find((GameObject x) => ((Object)x).name == "WaterJugEmpty_bal"); modResourceLoader.setSpawnStatusOnItem(modResourceLoader.itemPrefabs.Find((GameObject x) => ((Object)x).name == "WaterJug_bal"), (StatusEffect)(object)sE_SpawnItemDropOnConsume); modResourceLoader.setSpawnStatusOnItem(modResourceLoader.itemPrefabs.Find((GameObject x) => ((Object)x).name == "WaterJugEnchanted_bal"), (StatusEffect)(object)sE_SpawnItemDropOnConsume); } } private static int SortByScore(Recipe p1, Recipe p2) { if ((Object)(object)p1.m_item == (Object)null) { return 0; } if ((Object)(object)p2.m_item == (Object)null) { return 1; } return string.Compare(((Object)p1.m_item).name, ((Object)p2.m_item).name, StringComparison.Ordinal); } } [HarmonyPatch(typeof(Tutorial), "Awake")] public static class Tutorial_Awake_Patch { public static void Postfix(Tutorial __instance) { __instance.m_texts.AddRange(ConversionChanges.m_texts); } } [HarmonyPatch(typeof(Player), "GetTotalFoodValue")] public static class HealthIncreasePatches { public static void Postfix(Player __instance, ref float hp, ref float stamina, ref float eitr) { int num = 15; if (num > 0) { eitr += num; } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] public static class ZNetScene_Awake_Patch { private static bool _sessionInitialized; public static void Prefix(ZNetScene __instance) { if ((Object)(object)__instance == (Object)null) { Debug.LogWarning((object)(projectName + ": No ZNetScene found")); return; } TryAddRuntimePrefabs(__instance); if (_sessionInitialized) { return; } try { RunOneTimeSceneSetup(__instance); _sessionInitialized = true; Debug.Log((object)(projectName + ": ZNetScene one-time setup completed.")); } catch (Exception arg) { Debug.LogError((object)$"{projectName}: ZNetScene one-time setup failed: {arg}"); } } } [HarmonyPatch(typeof(OfferingBowl), "Awake")] public static class OfferingBowl_Awake_Patch { private static bool IsEikthyrAltar(OfferingBowl bowl) { return ((Object)((Component)bowl).gameObject).name == "offeraltar_deer" && (Object)(object)bowl.m_bossPrefab != (Object)null && ((Object)bowl.m_bossPrefab).name == "Eikthyr"; } private static bool IsQueenAltar(OfferingBowl bowl) { return ((Object)((Component)bowl).gameObject).name == "offeraltar_queen" && (Object)(object)bowl.m_bossPrefab != (Object)null && ((Object)bowl.m_bossPrefab).name == "SeekerQueen"; } public static void Prefix(OfferingBowl __instance) { if ((Object)(object)ObjectDB.instance == (Object)null) { return; } if (IsEikthyrAltar(__instance)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("CarvedDeerSkull_bal"); if ((Object)(object)itemPrefab != (Object)null) { __instance.m_bossItem = itemPrefab.GetComponent(); __instance.m_bossItems = 3; } } if (IsQueenAltar(__instance)) { GameObject itemPrefab2 = ObjectDB.instance.GetItemPrefab("SeekerBrain_bal"); if ((Object)(object)itemPrefab2 != (Object)null) { __instance.m_bossItem = itemPrefab2.GetComponent(); __instance.m_bossItems = 5; } } } } [HarmonyPatch(typeof(InventoryGui), "Awake")] public static class RepairAllItems { private static void Postfix(ref InventoryGui __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown ((UnityEvent)__instance.m_repairButton.onClick).AddListener(new UnityAction(RepairAll)); } private static bool canRepair(ItemData item) { Recipe recipe = ObjectDB.instance.GetRecipe(item); CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); bool result = true; if ((Object)(object)recipe == (Object)null || (Object)(object)currentCraftingStation == (Object)null || ((Object)(object)recipe.m_craftingStation == (Object)null && (Object)(object)recipe.m_repairStation == (Object)null)) { return false; } return result; } private static void RepairAll() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) int num = 0; CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); foreach (ItemData allItem in ((Humanoid)Player.m_localPlayer).GetInventory().GetAllItems()) { if (canRepair(allItem) && (double)allItem.m_durability < (double)allItem.GetMaxDurability()) { num++; allItem.m_durability = allItem.GetMaxDurability(); } } if (Object.op_Implicit((Object)(object)currentCraftingStation)) { currentCraftingStation.m_repairItemDoneEffects.Create(((Component)currentCraftingStation).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } ((Character)Player.m_localPlayer).Message((MessageType)2, num + 1 + " item" + ((num + 1 > 1) ? "s" : "") + " repaired!", 0, (Sprite)null); } } private readonly Harmony harmony = new Harmony("balrond.astafaraios.BalrondAmazingNature"); public const string PluginGUID = "balrond.astafaraios.BalrondAmazingNature"; public const string PluginName = "BalrondAmazingNature"; public const string PluginVersion = "1.2.3"; public static ModResourceLoader modResourceLoader = new ModResourceLoader(); public static DatabaseAddMethods databaseAddMethods = new DatabaseAddMethods(); public static MonsterManager monsterManager = new MonsterManager(); public static MonsterFeeding monsterFeeding = new MonsterFeeding(); public static ConversionChanges conversionEdits = new ConversionChanges(); public static BuildPieceBuilder buildPieceBuilder = new BuildPieceBuilder(); public static ClutterBuilder clutterBuilder = new ClutterBuilder(); public static VegetationBuilder vegetationBuilder = new VegetationBuilder(); public static RecipeFactory recipeFactory = new RecipeFactory(); public static RecipeRetarget recipeRetarget = new RecipeRetarget(); public static ServingTrayBuilder servingTrayBuilder = new ServingTrayBuilder(); public static CraftingStationEdits craftingStationEdits = new CraftingStationEdits(); public static ItemEdits itemEdits = new ItemEdits(); public static RecipeEdits recipeEdits = new RecipeEdits(); public static VegetationDropFix vegetationDropFix = new VegetationDropFix(); public static string projectName = "BalrondAmazingNature"; public static JsonLoader jsonLoader = new JsonLoader(); public static GameObject RootObject; public static GameObject PrefabContainer; public static bool hasSpawned = false; public static VendorBuilder vendorBuilder = new VendorBuilder(); public static LocationBuilder locationBuilder = new LocationBuilder(); public static DungeonFactory dungeonFactory = new DungeonFactory(); public static TreasureChestBuilder treasureChestBuilder = new TreasureChestBuilder(); public static float biomeCounter = 1000f; public static NatureGrowth natureGrowth = new NatureGrowth(); public static List loadingScreens = new List(); public static Dictionary loadingScreens2 = new Dictionary(); public static Dictionary fileWriteTimes = new Dictionary(); public static List screensToLoad = new List(); public static string[] loadingTips = new string[0]; public static Dictionary cachedScreens = new Dictionary(); private void Awake() { jsonLoader.loadJson(); CreatePrefabContainer(); modResourceLoader.loadAssets(); clutterBuilder.createClutterObjects(modResourceLoader.clutterPrefabs); vegetationBuilder.createVegetationObjects(modResourceLoader.vegetationPrefabs); vegetationBuilder.createVegetationObjects(modResourceLoader.plantPrefabs); harmony.PatchAll(); } public void Start() { RegisterUpgrade("vegetation_add", "Adds vegetations of mod BalrondAmazingNature.", modResourceLoader.vegetationPrefabs.Select((GameObject p) => ((Object)p).name), "vegetation_reset"); RegisterUpgrade("vegetation_update", "Modify vanilla vegetations changed by mod BalrondAmazingNature.", VegetationBuilder.vegNames, "vegetation_reset"); RegisterUpgrade("locations", "Modify vanilla Locations changed by mod BalrondAmazingNature.", LocationBuilder.vanillaLocationsYouEdit, "locations_add"); } private void RegisterUpgrade(string keySuffix, string description, IEnumerable names, string lineName) { string name = "BalrondAmazingNature_" + keySuffix; string text = string.Format("{0} {1} start", lineName, string.Join(",", names)); Upgrade.Register(name, description, text); } public void CreatePrefabContainer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown RootObject = new GameObject("_ValheimReforgedRoot"); Object.DontDestroyOnLoad((Object)(object)RootObject); PrefabContainer = new GameObject("Prefabs"); PrefabContainer.transform.parent = RootObject.transform; PrefabContainer.SetActive(false); } public static GameObject CloneMe(GameObject source, string name) { GameObject val = Object.Instantiate(source, PrefabContainer.transform); ((Object)val).name = name; FixMaterials(val, source); val.SetActive(true); return val; } public static GameObject FixMaterials(GameObject clone, GameObject source) { MeshRenderer[] componentsInChildren = source.GetComponentsInChildren(); MeshRenderer[] componentsInChildren2 = clone.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { string name = ((Object)componentsInChildren[i]).name; for (int j = 0; j < componentsInChildren2.Length; j++) { if (((Object)componentsInChildren2[j]).name == name) { ((Renderer)componentsInChildren2[j]).materials = ((Renderer)componentsInChildren[i]).sharedMaterials; ((Renderer)componentsInChildren2[j]).sharedMaterials = ((Renderer)componentsInChildren[i]).sharedMaterials; break; } } } return clone; } private void OnDestroy() { harmony.UnpatchSelf(); } private static bool IsObjectDBValid() { ObjectDB instance = ObjectDB.instance; return (Object)(object)instance != (Object)null && instance.m_items.Count != 0 && instance.m_recipes.Count != 0 && (Object)(object)instance.GetItemPrefab("Amber") != (Object)null; } private static void TryAddRuntimePrefabs(ZNetScene zNetScene) { GameObject val = CreateTentacleMinion(zNetScene); if ((Object)(object)val != (Object)null && !zNetScene.m_prefabs.Contains(val)) { zNetScene.m_prefabs.Add(val); } modResourceLoader.AddPrefabsToZnetScene(zNetScene); } private static void RunOneTimeSceneSetup(ZNetScene zNetScene) { vegetationDropFix.items = zNetScene.m_prefabs; vegetationDropFix.fixDrops(zNetScene.m_prefabs, zNetScene); modResourceLoader.addPlantstoCultivator(zNetScene); modResourceLoader.setupBuildPiecesList(zNetScene); modResourceLoader.setupBirdHouse(zNetScene); BalrondConverterInstaller.SetBalrondConverter(zNetScene); EditCart(zNetScene); AddHoverToHearthRocks(zNetScene); EditLeviathans(zNetScene); List dungeons = zNetScene.m_prefabs.FindAll((GameObject x) => (Object)(object)x.GetComponent() != (Object)null); dungeonFactory.EditDungeons(dungeons); vendorBuilder.EditVendors(zNetScene.m_prefabs); monsterManager.setupMonsterList(zNetScene.m_prefabs); monsterManager.changeMonsterResistance(); buildPieceBuilder.SetupBuildPieces(zNetScene); servingTrayBuilder.SetupBuildPieces(zNetScene.m_prefabs); conversionEdits.editBuidlPieces(zNetScene.m_prefabs); monsterManager.setupSpawners(zNetScene.m_prefabs); treasureChestBuilder.editTreasureChests(zNetScene.m_prefabs); natureGrowth.setupNewSaplings(zNetScene); PicaxeFix.fix(zNetScene); craftingStationEdits.Setup(zNetScene.m_prefabs); SetupSeekers(zNetScene); StatusEffectFactory.InitVisuals(zNetScene); if (!IsDedicatedServer()) { ShaderReplacment.RunMaterialFix(); } } private static bool IsDedicatedServer() { return (Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsDedicated(); } public static void SetupSeekers(ZNetScene scene) { GameObject val = FindPrefabInZnet("SeekerBrood", scene); if ((Object)(object)val == (Object)null) { return; } Growup val2 = val.GetComponent() ?? val.AddComponent(); val2.m_growTime = 4500f; val2.m_grownPrefab = FindPrefabInZnet("Seeker", scene); GameObject val3 = FindPrefabInZnet("SeekerEgg_bal", scene); if ((Object)(object)val3 != (Object)null) { EggHatch component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_spawnPrefab = val; } } GameObject val4 = FindPrefabInZnet("Larva_bal", scene); if ((Object)(object)val4 != (Object)null) { EggGrow component2 = val4.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.m_grownPrefab = val; } } } public static GameObject FindPrefabInZnet(string name, ZNetScene zNetScene) { if (!zNetScene.m_namedPrefabs.TryGetValue(BalrondHashCompat.StableHash(name), out var value)) { return zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == name); } return value; } public static void SetRunestonesDestructible(List runestones, List prefabs) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) GameObject val = prefabs.Find((GameObject x) => ((Object)x).name == "Rock_4"); if ((Object)(object)val == (Object)null) { return; } Destructible component = val.GetComponent(); DropOnDestroyed component2 = val.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null) { return; } foreach (GameObject runestone in runestones) { Destructible val2 = runestone.GetComponent() ?? runestone.AddComponent(); val2.m_autoCreateFragments = component.m_autoCreateFragments; val2.m_damages = component.m_damages; val2.m_destroyed = component.m_destroyed; val2.m_destroyNoise = component.m_destroyNoise; val2.m_destructibleType = component.m_destructibleType; val2.m_health = component.m_health; val2.m_hitEffect = component.m_hitEffect; val2.m_hitNoise = component.m_hitNoise; val2.m_minDamageTreshold = component.m_minDamageTreshold; val2.m_minToolTier = 1; DropOnDestroyed val3 = runestone.GetComponent() ?? runestone.AddComponent(); val3.m_dropWhenDestroyed = component2.m_dropWhenDestroyed; val3.m_spawnYOffset = component2.m_spawnYOffset; val3.m_spawnYStep = component2.m_spawnYStep; } } public static GameObject CreateTentacleMinion(ZNetScene scene) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) GameObject val = FindPrefabInZnet("TentaRoot", scene); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = CloneMe(val, "tentacle_plant_bal"); Humanoid component = val2.GetComponent(); ((Character)component).m_name = "$tag_tentaroot_bal"; ((Character)component).m_faction = (Faction)0; ((Character)component).m_health = 33f; CharacterTimedDestruction component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } GameObject val3 = FindPrefabInZnet("Skeleton_Friendly", scene); Tameable component3 = val3.GetComponent(); Tameable val4 = val2.AddComponent(); val4.m_commandable = true; val4.m_startsTamed = true; val4.m_fedDuration = component3.m_fedDuration; val4.m_petEffect = component3.m_petEffect; val4.m_sootheEffect = component3.m_sootheEffect; val4.m_tamedEffect = component3.m_tamedEffect; val4.m_unsummonDistance = component3.m_unsummonDistance; val4.m_unSummonEffect = component3.m_unSummonEffect; val4.m_tamingTime = component3.m_tamingTime; val4.m_unsummonOnOwnerLogoutSeconds = component3.m_unsummonOnOwnerLogoutSeconds; val4.m_levelUpOwnerSkill = component3.m_levelUpOwnerSkill; val4.m_levelUpFactor = component3.m_levelUpFactor; val4.m_randomStartingName = component3.m_randomStartingName; return val2; } public static void EditCart(ZNetScene scene) { GameObject val = FindPrefabInZnet("Cart", scene); if (!((Object)(object)val == (Object)null)) { Vagon component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_itemWeightMassFactor = 0.02f; } } } public static void AddHoverToHearthRocks(ZNetScene scene) { AddHover(FindPrefabInZnet("rock2_heath", scene), "$tag_limeStone_deposit_bal"); AddHover(FindPrefabInZnet("rock4_heath", scene), "$tag_limeStone_deposit_bal"); } public static void AddHover(GameObject obj, string text) { if (!((Object)(object)obj == (Object)null)) { HoverText val = obj.GetComponent() ?? obj.AddComponent(); val.m_text = text; } } public static void EditLeviathans(ZNetScene scene) { GameObject val = FindPrefabInZnet("Leviathan", scene); if ((Object)(object)val != (Object)null) { Leviathan component = val.GetComponent(); component.m_leaveDelay = 25; } GameObject val2 = FindPrefabInZnet("LeviathanLava", scene); if ((Object)(object)val2 != (Object)null) { Leviathan component2 = val2.GetComponent(); component2.m_leaveDelay = 40; } } } public class PicaxeFix { public static void fix(ZNetScene zNetScene) { Dictionary dictionary = new Dictionary(); dictionary.Add("PickaxeBlackMetal", 5); dictionary.Add("PickaxeBronze", 3); dictionary.Add("PickaxeIron", 4); dictionary.Add("PickaxeAntler", 2); dictionary.Add("PickaxeStone", 1); foreach (KeyValuePair kvp in dictionary) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == kvp.Key); if ((Object)(object)val != (Object)null) { val.GetComponent().m_itemData.m_shared.m_toolTier = kvp.Value; } } } } public class TreasureChestBuilder { private string[] chestNames = new string[20] { "TreasureChest_ashland_stone", "TreasureChest_Ashlands", "TreasureChest_blackforest", "TreasureChest_charredfortress", "TreasureChest_dvergr_loose_stone", "TreasureChest_dvergrtower", "TreasureChest_dvergrtown", "TreasureChest_fCrypt", "TreasureChest_forestcrypt", "TreasureChest_heath", "TreasureChest_heath_hildir", "TreasureChest_meadows", "TreasureChest_meadows_buried", "TreasureChest_mountaincave", "TreasureChest_mountains", "TreasureChest_plains_stone", "TreasureChest_sunkencrypt", "TreasureChest_swamp", "TreasureChest_trollcave", "FloatingDebris_bal" }; private List chestList = new List(); private List allObjects = new List(); public void editTreasureChests(List gameObjects) { allObjects = gameObjects; chestList = gameObjects.FindAll((GameObject x) => ((Object)x).name.Contains("TreasureChest")); string[] array = chestNames; foreach (string chestName in array) { GameObject val = gameObjects.Find((GameObject x) => ((Object)x).name == chestName); if ((Object)(object)val != (Object)null) { EditChest(val); } } } private void addGems(GameObject chest) { addToChest(chest, "Amethyst_bal", 1, 1, 0.01f); addToChest(chest, "Sapphire_bal", 1, 1, 0.02f); addToChest(chest, "Emerald_bal", 1, 1, 0.03f); addToChest(chest, "Opal_bal", 1, 1, 0.04f); addToChest(chest, "Onyx_bal", 1, 1, 0.05f); } private void EditChest(GameObject chest) { addToChest(chest, "RustyBrokenSword_bal"); switch (((Object)chest).name) { case "FloatingDebris_bal": editDropAmount(chest, 3, 5); addToChest(chest, "RustedScrap_bal", 1, 1, 0.2f); addToChest(chest, "Peningar_bal", 2, 6, 0.33f); addToChest(chest, "Coins", 2, 6, 0.33f); addToChest(chest, "Amber", 1, 1, 0.2f); addToChest(chest, "AmberPearl", 1, 1, 0.2f); addToChest(chest, "Ruby", 1, 1, 0.2f); addToChest(chest, "SilverNecklace", 1, 1, 0.2f); addToChest(chest, "BasicSeed_bal", 1, 3, 0.2f); addToChest(chest, "RottenMeat"); addToChest(chest, "RottenVegetable_bal"); addToChest(chest, "BoneFragments", 2, 3, 0.6f); addToChest(chest, "Wood", 2, 4, 1f); addToChest(chest, "LeatherScraps", 2, 3, 0.8f); addToChest(chest, "FineWood", 2, 4, 0.9f); addToChest(chest, "Straw_bal", 3, 5, 1f); addToChest(chest, "DyeKit_bal", 1, 1, 0.1f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.3f); addToChest(chest, "FishingBait", 5, 10, 0.7f); addToChest(chest, "Moss_bal", 3, 5, 0.7f); addToChest(chest, "Oil_bal", 1, 1, 0.2f); addToChest(chest, "RustyBrokenSword_bal", 1, 1, 0.1f); addToChest(chest, "SeaPearl_bal", 1, 1, 0.2f); addToChest(chest, "SpiceSet_bal", 1, 1, 0.1f); break; case "TreasureChest_ashland_stone": addToChest(chest, "CorruptedEitr_bal", 2, 5, 0.1f); break; case "TreasureChest_Ashlands": addToChest(chest, "CorruptedEitr_bal", 2, 5, 0.1f); break; case "TreasureChest_blackforest": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "StrawSeeds_bal", 1, 3, 0.2f); addToChest(chest, "AppleSeeds_bal", 1, 3, 0.2f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); break; case "TreasureChest_charredfortress": addToChest(chest, "FlametalScrap_bal", 4, 8, 0.1f); addToChest(chest, "SurtrAmulet_bal", 1, 1, 0.1f); break; case "TreasureChest_dvergr_loose_stone": editDropAmount(chest, 2, 3); addGems(chest); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "BoraxCrystal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); addToChest(chest, "MedPack_bal", 1, 2, 0.1f); addToChest(chest, "RustedScrap_bal", 2, 3, 0.1f); break; case "TreasureChest_dvergrtower": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "BoraxCrystal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); addToChest(chest, "MedPack_bal", 1, 2, 0.1f); addToChest(chest, "RustedScrap_bal", 2, 3, 0.1f); break; case "TreasureChest_dvergrtown": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "BoraxCrystal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); addToChest(chest, "MedPack_bal", 1, 2, 0.1f); addToChest(chest, "RustedScrap_bal", 2, 3, 0.1f); break; case "TreasureChest_fCrypt": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "AppleSeeds_bal", 1, 3, 0.2f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); break; case "TreasureChest_forestcrypt": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "AppleSeeds_bal", 1, 3, 0.2f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); break; case "TreasureChest_heath": editDropAmount(chest, 3, 4); addGems(chest); addToChest(chest, "SilverScrap_bal", 1, 2, 0.1f); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "AppleSeeds_bal", 1, 3, 0.2f); addToChest(chest, "GarlicSeeds_bal", 1, 3, 0.2f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); addToChest(chest, "MedPack_bal", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 2, 3, 0.1f); break; case "TreasureChest_heath_hildir": editDropAmount(chest, 4, 7); addGems(chest); addToChest(chest, "SilverScrap_bal", 1, 2, 0.1f); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "CorruptedEitr_bal", 1, 3, 0.1f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "GarlicSeeds_bal", 1, 3, 0.2f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.1f); addToChest(chest, "MedPack_bal", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 2, 3, 0.1f); addToChest(chest, "RottenVegetable_bal", 1, 1, 0.2f); break; case "TreasureChest_meadows": addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 1, 1, 0.1f); addToChest(chest, "RottenVegetable_bal", 1, 1, 0.2f); break; case "TreasureChest_meadows_buried": addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.3f); addToChest(chest, "RustedScrap_bal", 1, 1, 0.1f); addToChest(chest, "RottenVegetable_bal", 1, 1, 0.2f); break; case "TreasureChest_mountaincave": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "SilverScrap_bal", 1, 2, 0.1f); addToChest(chest, "IronScrap", 1, 2, 0.1f); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "CorruptedEitr_bal", 1, 2, 0.1f); addToChest(chest, "CabbageSeeds_bal", 1, 1, 0.01f); addToChest(chest, "NumbMeal_bal", 1, 2, 0.1f); addToChest(chest, "RottenMeat", 1, 2, 0.3f); addToChest(chest, "RottenVegetable_bal", 1, 2, 0.2f); addToChest(chest, "MedPack_bal", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); break; case "TreasureChest_mountains": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "ArrowBronze", 5, 10, 0.33f); addToChest(chest, "ArrowIron", 5, 10, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "CabbageSeeds_bal", 1, 1, 0.01f); addToChest(chest, "RottenMeat", 1, 1, 0.3f); addToChest(chest, "RottenVegetable_bal", 1, 2, 0.2f); addToChest(chest, "MedPack_bal", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); break; case "TreasureChest_plains_stone": editDropAmount(chest, 3, 5); addGems(chest); addToChest(chest, "SilverScrap_bal", 1, 2, 0.1f); addToChest(chest, "IronScrap", 1, 2, 0.1f); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "ArrowIron", 5, 10, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "CabbageSeeds_bal", 1, 1, 0.01f); addToChest(chest, "GarlicSeeds_bal", 1, 3, 0.2f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.3f); addToChest(chest, "MedPack_bal", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); break; case "TreasureChest_sunkencrypt": editDropAmount(chest, 5, 8); addGems(chest); addToChest(chest, "SilverScrap_bal", 1, 2); addToChest(chest, "IronScrap", 1, 2, 0.1f); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "ArrowBronze", 5, 10, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.3f); addToChest(chest, "RottenVegetable_bal", 1, 2, 0.2f); addToChest(chest, "MedPack_bal", 1, 1, 0.1f); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); addToChest(chest, "SwampTreeSeeds_bal", 1, 3, 0.1f); break; case "TreasureChest_swamp": editDropAmount(chest, 3, 4); addGems(chest); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); addToChest(chest, "SilverScrap_bal", 1, 2, 0.1f); addToChest(chest, "IronScrap", 1, 2, 0.1f); addToChest(chest, "Peningar_bal", 10, 20, 0.33f); addToChest(chest, "ArrowBronze", 5, 10, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.01f); addToChest(chest, "NumbMeal_bal", 1, 1, 0.1f); addToChest(chest, "RottenMeat", 1, 1, 0.3f); addToChest(chest, "MedPack_bal", 1, 1, 0.1f); addToChest(chest, "SwampTreeSeeds_bal", 1, 3, 0.1f); addToChest(chest, "RottenVegetable_bal", 1, 2, 0.2f); break; case "TreasureChest_trollcave": editDropAmount(chest, 4, 6); addGems(chest); addToChest(chest, "Peningar_bal", 10, 20, 0.44f); addToChest(chest, "ArrowBronze", 5, 10, 0.33f); addToChest(chest, "SilverPouch_bal", 1, 1, 0.1f); addToChest(chest, "NumbMeal_bal", 1, 2, 0.22f); addToChest(chest, "RottenMeat", 1, 2, 0.3f); addToChest(chest, "RustedScrap_bal", 1, 2, 0.1f); addToChest(chest, "RottenVegetable_bal", 1, 2, 0.2f); break; } } private void editDropAmount(GameObject chest, int min, int max) { Container component = chest.GetComponent(); component.m_defaultItems.m_dropMin = min; component.m_defaultItems.m_dropMax = max; } private GameObject GetItem(string name) { GameObject val = allObjects.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Item not found in chest: " + name)); val = allObjects.Find((GameObject x) => ((Object)x).name == "Wood"); } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"I did not found the item"); } return val; } private void addToChest(GameObject chest, string item, int min = 1, int max = 1, float chance = 0.5f) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) GameObject item2 = GetItem(item); Container component = chest.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_defaultItems.m_drops.Add(createDropData(item2, min, max, chance)); } } private DropData createDropData(GameObject item, int min, int max, float chance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) DropData result = default(DropData); result.m_stackMin = min; result.m_stackMax = max; result.m_weight = chance; result.m_item = item; return result; } } internal class VegetationList { public static string[] vegetation = new string[204] { "MineRock_Coal_bal", "MineRock_CoalSnow_bal", "MineRock_Zinc_bal", "MineRock_Lead_bal", "Pickable_Mushroom_Random_bal", "AshlandsDryBush_bal", "AcaiTree_New_bal", "AcaiTree_Stub_bal", "Acai_Dead_bal", "Acai_Dead_Stub_bal", "AncientSkullRock_bal", "AshRock1_bal", "AshRock1_frac_bal", "AshRockPillar_bal", "AshRockPillar_frac_bal", "basaltCliff_bal", "basaltCliff_frac_bal", "Pickable_RottenVegetable_bal", "Lingonberry_shrub_bal", "icePlate_bal", "BigShootStump_bal", "BirchAutStub_bal", "BlackberryBush2_bal", "BlackberryBush_bal", "bloodshard_deposit_bal", "BlueberryBush_bal", "caverockIce_bal", "caverock_magma_stalagmite_broken_bal", "ChitinDeposit_bal", "clamChest_bal", "clamChestSmall_bal", "ClayDeposit_bal", "cliff_deepnorth2_bal", "cliff_deepnorth2_frac_bal", "cliff_deepnorth_bal", "cliff_deepnorth_frac_bal", "cliff_mistlands_Arch_bal", "cliff_mistlands_Arch_frac_bal", "cliff_mistlands_rock_bal", "cliff_mistlands_rock_frac_bal", "coal_rock1_bal", "coal_rock1_frac_bal", "Cypress_bal", "Cypress_Stub_bal", "DeathsquitoHive_bal", "deposit_jotunfinger_bal", "DragonRibcage_bal", "DragonSkull2_bal", "DragonSkull_bal", "DryBush1_bal", "DryBush2_bal", "DrakeSpawner_bal", "ElderMushroom_bal", "ElderMushroom_Stub_bal", "ElderTreeStump_bal", "ElderTree_bal", "gold_Rock_bal", "gold_Rock_frac_bal", "IceberryBush_bal", "iceblock_rock_bal", "iceblock_rock_frac_bal", "IceCliff1_bal", "IceCliff1_frac_bal", "IceCliff2_bal", "IceCliff2_frac_bal", "IcedTree_bal", "IcedTree_Stub_bal", "LinedSwampTreeLarge2_bal", "LinedSwampTreeLarge_bal", "MammothRibcage_bal", "MammothSkull_bal", "MammothSpine_bal", "Maple_bal", "Maple_Stub_bal", "MineRock_Blackmetal_bal", "MineRock_Borax_bal", "MineRock_Cobalt_bal", "MineRock_DarkIron_bal", "MineRock_IronNew_bal", "MineRock_IronSnow_bal", "MineRock_MeteoriteNew_bal", "Oak2_bal", "Oak2_Stub_bal", "Oak3_bal", "Oak_Swamp_bal", "offeraltar_mythic_bal", "Pickable_AppleTree_bal", "Pickable_Bloodvine_bal", "Pickable_Cabbage_bal", "Pickable_Clay_bal", "Pickable_Garlic_bal", "Pickable_Ignicap_bal", "Pickable_Kelp_bal", "Pickable_MagmaStone_bal", "Pickable_MeadowsMeatPile01_bal", "Pickable_MeadowsMeatPile02_bal", "Pickable_MeteoriteNew_bal", "Pickable_Mint_bal", "Pickable_Sage_bal", "Pickable_Lavender_bal", "Pickable_MountainCaveCrystal_bal", "Pickable_Mugwort_bal", "Pickable_Mushroom_grayNew_bal", "Pickable_Mushroom_blueNew_bal", "Pickable_Mushroom_Darkbul_bal", "Pickable_Mushroom_Icecap_bal", "Pickable_Mushroom_Inkcap_bal", "Pickable_Nettle_bal", "Pickable_Plantain_bal", "Pickable_Seaberry_bal", "Pickable_SeedCabbage_bal", "Pickable_SeedGarlic_bal", "Pickable_Snowleaf_bal", "Pickable_StrawPlant_bal", "Pickable_Straw_bal", "Pickable_TinNew_bal", "Pickable_waterlily_bal", "Pickable_Yarrow_bal", "Poplar_bal", "Poplar_Stub_bal", "RaspberryBush_bal", "RockDolmenAshlands_1_bal", "RockDolmenAshlands_2_bal", "RockDolmenAshlands_3_bal", "RockDolmenIce1_bal", "RockDolmenIce2_bal", "RockDolmenIce3_bal", "RockDolmenIce4_bal", "RockDolmenLava1_bal", "RockDolmenLava2_bal", "RockDolmenLava3_bal", "RockDolmenLava4_bal", "RockDolmenSnow2_bal", "RockDolmenSnow3_bal", "RockDolmenSnow4_bal", "RockDolmenSnow_bal", "rock_ashlands_bal", "rock_ashlands_frac_bal", "rock_nickel_bal", "rock_nickel_frac_bal", "RuneTablet_Mythic_bal", "SeekerEgg_bal", "SeekerBroodSpawner_bal", "SurtlingSpawner_bal", "web_horizontal_bal", "web_tunnel_bal", "web_vertical_bal", "WetTree1_bal", "WetTree2_bal", "WetTree3_bal", "WetTree_Stub_bal", "WhaleRibs_bal", "WhaleSkeleton_bal", "WhaleSkull_bal", "WhaleSpine_bal", "Willow_bal", "Willow_Stub_bal", "YewTree_bal", "YewTree_Stub_bal", "YggaBigShoot_bal", "cliff_deepnorth_Arch_bal", "cliff_deepnorth_Arch_frac_bal", "coal_rock_nomoss_bal", "coal_rock_nomoss_frac_bal", "cliff_deepnorth_rock_bal", "cliff_deepnorth_rock_frac_bal", "shrub_bal", "BushDark_bal", "TwistedTree_small_bal", "iceLump_bal", "iceLump_frac_bal", "loxSkeleton_bal", "rock_nickel_nomoss_bal", "rock_nickel_nomoss_frac_bal", "IceCliff3_bal", "IceCliff3_frac_bal", "FallenTreeDeepNorth_bal", "HugeRoot1_bal", "Waystone_bal", "RockGolemSpawn_bal", "rock2_ice_bal", "rock2_ice_frac_bal", "rock3_ice_bal", "rock3_ice_frac_bal", "Pickable_Straw_DeepNorth_bal", "stalagmite_ice_bal", "stalagmite_ash_bal", "flowstone_bal", "flowstone_ice_bal", "MineRock_Copper_bal", "MineRock_Nickel_bal", "rock_silver_small_bal", "rock_silver_small_frac_bal", "Pickable_Mushroom_blueFarm_bal", "Pickable_Mushroom_yellowFarm_bal", "Pickable_MushroomFarm_bal", "Pickable_Mushroom_grayFarm_bal", "Pickable_ThistleFarm_bal", "Pickable_DandelionFarm_bal", "Pickable_Mycelium_bal", "SnowyRockPillar_bal", "SnowyRockPillar_frac_bal", "widestone_bal", "widestone_frac_bal" }; } public class LocationBuilder2 { public static List zoneLocations = new List(); public static List workingLocations = new List(); public static List vanillaLocationsYouEdit = new List { "Ruin1", "Ruin2", "StoneTower1", "StoneTower3", "Ruin3", "MountainWell1", "StoneHenge6", "ShipWreck01", "ShipWreck02", "ShipWreck03", "ShipWreck04", "CharredTowerRuins1_dvergr", "VoltureNest", "PlaceofMystery1", "PlaceofMystery2", "PlaceofMystery3", "StoneCircle", "StoneHouse5_heath", "DrakeNest01", "MountainCave02", "Dolmen01", "Dolmen02", "Dolmen03", "Mistlands_Swords1", "Mistlands_Swords2", "Mistlands_Swords3", "Mistlands_Viaduct1", "Mistlands_Viaduct2", "Mistlands_Lighthouse1_new", "Mistlands_Swords3", "Mistlands_GuardTower1_new", "Mistlands_GuardTower2_new", "Mistlands_GuardTower3_new", "Mistlands_RockSpire1", "Mistlands_RoadPost1", "Mistlands_Giant1", "Mistlands_Giant2", "Mistlands_Harbour1", "Waymarker01", "Waymarker02", "TrollCave02", "AbandonedLogCabin02", "AbandonedLogCabin03", "AbandonedLogCabin04", "TarPit1", "TarPit2", "TarPit3", "SwampWell1", "ShipSetting01", "MountainGrave01", "InfestedTree01", "StoneTowerRuins03", "StoneTowerRuins04", "StoneTowerRuins05", "StoneTowerRuins07", "StoneTowerRuins08", "StoneTowerRuins09", "StoneTowerRuins10", "SwampRuin1", "SwampRuin2", "WoodHouse1", "WoodHouse2", "WoodHouse3", "WoodHouse4", "WoodHouse5", "WoodHouse6", "WoodHouse7", "WoodHouse8", "WoodHouse9", "WoodHouse10", "WoodHouse11", "WoodHouse12", "WoodHouse13", "StoneHenge6", "StoneHouse3", "StoneHouse4", "SwampHut1", "SwampHut2", "SwampHut3", "SwampHut4", "SwampHut5", "StoneHouse5_heath", "WoodFarm1", "WoodVillage1", "GoblinCamp2", "Crypt2", "Crypt3", "Crypt4" }; public HashSet deepNorthNames = new HashSet { "MountainWell1", "StoneHenge6", "ShipWreck01", "ShipWreck02", "ShipWreck03", "ShipWreck04", "CharredTowerRuins1_dvergr", "StoneCircle", "DrakeNest01", "Dolmen01", "Dolmen02", "Dolmen03", "Mistlands_Swords1", "Mistlands_Swords2", "Mistlands_Swords3", "Mistlands_Viaduct1", "Mistlands_Viaduct2", "Mistlands_Lighthouse1_new", "Mistlands_GuardTower1_new", "Mistlands_GuardTower2_new", "Mistlands_GuardTower3_new", "Mistlands_RockSpire1", "Mistlands_RoadPost1", "Mistlands_Giant2", "Waymarker01", "Waymarker02", "TrollCave02" }; public List locations = new List(); public void editLocations(List locationList) { if (locationList == null || locationList.Count == 0) { Debug.LogWarning((object)"LOCATION LIST IS EMPTY!"); } else { changeBiomeSetup(locationList); } } private ZoneLocation FindLocation(List locationList, string name) { return locationList.Find((ZoneLocation x) => x.m_prefabName == name); } private bool isForDeepNorth(string name) { return deepNorthNames.Contains(name); } private void editLocation(ZoneLocation zoneLocation) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) _ = zoneLocation.m_prefab; if (0 == 0) { zoneLocation.m_biome = (Biome)(zoneLocation.m_biome | 0x40); zoneLocation.m_quantity *= 2; zoneLocation.m_minDistance = 0f; zoneLocation.m_maxDistance = 0f; string prefabName = zoneLocation.m_prefabName; zoneLocation.m_biome = (Biome)(zoneLocation.m_biome | 0x60); } } private void changeBiomeSetup(List locationList) { Debug.Log((object)(Launch.projectName + ": Editing Locations for world spawn")); ApplyToLocations(locationList, new string[68] { "TarPit1", "TarPit2", "TarPit3", "SwampWell1", "ShipSetting01", "MountainGrave01", "InfestedTree01", "StoneTowerRuins03", "StoneTowerRuins04", "StoneTowerRuins05", "StoneTowerRuins07", "StoneTowerRuins08", "StoneTowerRuins09", "StoneTowerRuins10", "SwampRuin1", "SwampRuin2", "WoodHouse1", "WoodHouse2", "WoodHouse3", "WoodHouse4", "WoodHouse5", "WoodHouse6", "WoodHouse7", "WoodHouse8", "WoodHouse9", "WoodHouse10", "WoodHouse11", "WoodHouse12", "WoodHouse13", "StoneHenge6", "StoneHouse3", "StoneHouse4", "SwampHut1", "SwampHut2", "SwampHut3", "SwampHut4", "SwampHut5", "StoneHouse5_heath", "Ruin1", "Ruin2", "Mistlands_Giant2", "Mistlands_Harbour1", "Waymarker01", "Waymarker02", "TrollCave02", "Mistlands_RockSpire1", "Mistlands_RoadPost1", "DrakeNest01", "Dolmen01", "Dolmen02", "Dolmen03", "Mistlands_Swords1", "Mistlands_Swords2", "Mistlands_Swords3", "Mistlands_Viaduct1", "Mistlands_Viaduct2", "StoneCircle", "MountainWell1", "StoneHenge6", "ShipWreck01", "ShipWreck02", "ShipWreck03", "ShipWreck04", "CharredTowerRuins1_dvergr", "Mistlands_Lighthouse1_new", "Mistlands_GuardTower1_new", "Mistlands_GuardTower2_new", "Mistlands_GuardTower3_new" }, biomeSwap); ApplyToLocations(locationList, new string[18] { "WoodFarm1", "WoodVillage1", "GoblinCamp2", "MountainCave02", "Crypt2", "Crypt3", "Crypt4", "SunkenCrypt4", "StoneTower1", "StoneTower3", "Ruin3", "GoblinKing", "Eikthyrnir", "Dragonqueen", "GDKing", "Bonemass", "Mistlands_DvergrBossEntrance1", "FaderLocation" }, locationEditSpecial); } private void ApplyToLocations(List locationList, string[] names, Action action) { for (int i = 0; i < names.Length; i++) { ZoneLocation val = FindLocation(locationList, names[i]); if (val != null) { action(val); } else { Debug.LogWarning((object)("Location not found: " + names[i])); } } } private void locationEditSpecial(ZoneLocation loc) { //IL_002c: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) string prefabName = loc.m_prefabName; if (IsIn(prefabName, "SunkenCrypt", "SunkenCrypt4")) { loc.m_biome = (Biome)2; loc.m_minDistance = 600f; loc.m_minDistanceFromCenter = 600f; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 0f; loc.m_maxAltitude = 100000f; loc.m_iconPlaced = true; loc.m_quantity *= 2; loc.m_prioritized = true; loc.m_biomeArea = (BiomeArea)3; loc.m_minDistanceFromSimilar = 44f; return; } switch (prefabName) { case "MountainCave02": loc.m_biome = (Biome)68; loc.m_minAltitude = 20f; loc.m_maxAltitude = 100000f; loc.m_minDistance = 600f; loc.m_minDistanceFromCenter = 600f; loc.m_quantity *= 3; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minDistanceFromSimilar = 44f; return; case "Crypt2": loc.m_biome = (Biome)522; loc.m_minDistanceFromCenter = 300f; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 15f; loc.m_maxAltitude = 100000f; loc.m_minDistanceFromSimilar = 44f; loc.m_quantity *= 2; return; case "Crypt3": loc.m_biome = (Biome)524; loc.m_minDistanceFromCenter = 300f; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 15f; loc.m_maxAltitude = 100000f; loc.m_minDistanceFromSimilar = 44f; loc.m_quantity *= 2; return; case "Crypt4": loc.m_biome = (Biome)81; loc.m_minDistanceFromCenter = 600f; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 15f; loc.m_maxAltitude = 100000f; loc.m_minDistanceFromSimilar = 44f; loc.m_quantity *= 2; return; case "WoodFarm1": loc.m_biome = (Biome)95; loc.m_minDistanceFromCenter = 300f; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 10f; loc.m_maxAltitude = 10000f; loc.m_quantity *= 2; return; case "WoodVillage1": loc.m_biome = (Biome)95; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 10f; loc.m_maxAltitude = 10000f; loc.m_minDistanceFromCenter = 1500f; loc.m_quantity *= 2; return; } if (IsIn(prefabName, "GoblinCamp2", "StoneTower1", "StoneTower3", "Ruin3")) { loc.m_biome = (Biome)25; loc.m_maxDistance = 10500f; loc.m_maxDistanceFromCenter = 10500f; loc.m_minAltitude = 10f; loc.m_maxAltitude = 100000f; loc.m_minDistanceFromCenter = 2900f; return; } switch (prefabName) { case "Eikthyrnir": loc.m_group = "bossarena"; loc.m_minDistance = 300f; loc.m_minDistanceFromCenter = 300f; loc.m_maxDistanceFromCenter = 1000f; loc.m_maxDistance = 800f; loc.m_quantity = 15; loc.m_unique = true; break; case "GDKing": loc.m_group = "bossarena"; loc.m_minDistanceFromSimilar = 500f; loc.m_minDistance = 1000f; loc.m_minDistanceFromCenter = 1000f; loc.m_maxDistanceFromCenter = 2500f; loc.m_maxDistance = 2500f; loc.m_quantity = 10; loc.m_unique = true; break; case "Bonemass": loc.m_group = "bossarena"; loc.m_minDistanceFromSimilar = 500f; loc.m_minDistance = 1500f; loc.m_minDistanceFromCenter = 1500f; loc.m_maxDistanceFromCenter = 3500f; loc.m_maxDistance = 3500f; loc.m_quantity = 10; loc.m_unique = true; break; case "Dragonqueen": loc.m_group = "bossarena"; loc.m_minDistanceFromSimilar = 50f; loc.m_minDistance = 300f; loc.m_minDistanceFromCenter = 100f; loc.m_maxDistanceFromCenter = 7000f; loc.m_maxDistance = 7000f; loc.m_quantity = 15; loc.m_unique = true; break; case "GoblinKing": loc.m_group = "bossarena"; loc.m_minDistanceFromSimilar = 500f; loc.m_minDistance = 3000f; loc.m_minDistanceFromCenter = 3000f; loc.m_maxDistance = 7000f; loc.m_maxDistanceFromCenter = 7000f; loc.m_quantity = 10; loc.m_unique = true; break; case "Mistlands_DvergrBossEntrance1": loc.m_group = "bossarena"; loc.m_minDistanceFromSimilar = 500f; loc.m_minDistance = 4000f; loc.m_minDistanceFromCenter = 5500f; loc.m_maxDistanceFromCenter = 8500f; loc.m_maxDistance = 8500f; loc.m_quantity = 10; loc.m_unique = true; break; case "FaderLocation": loc.m_group = "bossarena"; loc.m_quantity = 10; loc.m_unique = true; break; } } private void biomeSwap(ZoneLocation zoneLocation) { //IL_000a: 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_0010: 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) string prefabName = zoneLocation.m_prefabName; Biome val = (Biome)9; Biome val2 = (Biome)11; Biome biome = (Biome)10; Biome val3 = (Biome)17; Biome val4 = (Biome)18; Biome val5 = (Biome)24; Biome val6 = (Biome)(val4 | val); Biome biome2 = (Biome)48; Biome val7 = (Biome)580; Biome val8 = (Biome)516; Biome val9 = (Biome)514; Biome val10 = (Biome)68; Biome biome3 = (Biome)(val7 | val6); Biome val11 = (Biome)(val10 | val4); Biome biome4 = (Biome)(val4 | val7); Biome biome5 = (Biome)(val5 | val9); Biome biome6 = (Biome)608; Biome biome7 = (Biome)25; if (isForDeepNorth(prefabName)) { if (prefabName == "Mistlands_RoadPost1" || prefabName == "Mistlands_RockSpire1") { zoneLocation.m_biome = (Biome)(zoneLocation.m_biome | 0x60); zoneLocation.m_minDistance = 0f; zoneLocation.m_maxDistance = 0f; } else { editLocationParams(zoneLocation, (Biome)(zoneLocation.m_biome | 0x40), 0); } } if (prefabName == "Mistlands_Harbour1") { editLocationParams(zoneLocation, biome6); zoneLocation.m_maxAltitude = 3000f; } if (prefabName == "MountainWell1") { editLocationParams(zoneLocation, val10); zoneLocation.m_minAltitude = 0f; zoneLocation.m_maxAltitude = 3000f; } else if (IsIn(prefabName, "ShipWreck01", "ShipWreck02", "ShipWreck03", "ShipWreck04")) { zoneLocation.m_biome = (Biome)91; zoneLocation.m_quantity *= 2; zoneLocation.m_maxDistance = 10500f; zoneLocation.m_maxDistanceFromCenter = 10500f; zoneLocation.m_minAltitude = -6f; zoneLocation.m_maxAltitude = 100000f; zoneLocation.m_minDistanceFromCenter = 200f; } if (IsIn(prefabName, "Ruin1", "Ruin2")) { editLocationParams(zoneLocation, val, 600); zoneLocation.m_minAltitude = 5f; zoneLocation.m_maxAltitude = 150f; } if (IsIn(prefabName, "TarPit1", "TarPit2", "TarPit3")) { editLocationParams(zoneLocation, biome2); zoneLocation.m_minAltitude = 5f; zoneLocation.m_maxAltitude = 70f; return; } switch (prefabName) { case "SwampWell1": editLocationParams(zoneLocation, biome3, 1200); return; case "ShipSetting01": editLocationParams(zoneLocation, biome3); zoneLocation.m_minAltitude = -5f; zoneLocation.m_maxAltitude = 25f; return; case "MountainGrave01": editLocationParams(zoneLocation, biome3); zoneLocation.m_minAltitude = -1f; zoneLocation.m_maxAltitude = 30000f; zoneLocation.m_biomeArea = (BiomeArea)3; zoneLocation.m_quantity *= 2; return; case "InfestedTree01": editLocationParams(zoneLocation, val9); return; } if (IsIn(prefabName, "AbandonedLogCabin02", "AbandonedLogCabin03", "AbandonedLogCabin04")) { editLocationParams(zoneLocation, val7); } else if (prefabName == "StoneTowerRuins03") { editLocationParams(zoneLocation, biome, 400); } else if (IsIn(prefabName, "Waymarker01", "Waymarker02")) { editLocationParams(zoneLocation, val7); zoneLocation.m_minAltitude = -1f; } else if (IsIn(prefabName, "WoodHouse3", "WoodHouse4", "WoodHouse5")) { editLocationParams(zoneLocation, biome7); zoneLocation.m_maxAltitude = 30000f; } else if (IsIn(prefabName, "WoodHouse1", "WoodHouse13", "WoodHouse6", "WoodHouse7")) { editLocationParams(zoneLocation, val); zoneLocation.m_maxAltitude = 30000f; } else if (IsIn(prefabName, "WoodHouse2", "WoodHouse9", "WoodHouse11")) { editLocationParams(zoneLocation, val6); zoneLocation.m_maxAltitude = 30000f; } else if (IsIn(prefabName, "WoodHouse8", "WoodHouse9", "WoodHouse10", "WoodHouse12", "StoneHouse3", "StoneHouse4", "StoneHenge6")) { editLocationParams(zoneLocation, biome3); zoneLocation.m_maxAltitude = 30000f; } else if (IsIn(prefabName, "SwampRuin1", "SwampRuin2", "StoneTowerRuins04")) { editLocationParams(zoneLocation, biome3, 1500); zoneLocation.m_maxAltitude = 30000f; } else if (prefabName == "StoneTowerRuins05") { editLocationParams(zoneLocation, biome4); zoneLocation.m_minAltitude = -1f; zoneLocation.m_maxAltitude = 30000f; } else if (IsIn(prefabName, "StoneTowerRuins06", "StoneTowerRuins07", "StoneTowerRuins08", "StoneTowerRuins09", "StoneTowerRuins10", "StoneWall1", "StoneWall2")) { editLocationParams(zoneLocation, val6, 750); } else if (prefabName == "StoneHouse5_heath") { editLocationParams(zoneLocation, biome2); } else if (IsIn(prefabName, "SwampHut1", "SwampHut2", "SwampHut3", "SwampHut5")) { editLocationParams(zoneLocation, biome4, 1000); } else if (prefabName == "SwampHut4") { editLocationParams(zoneLocation, biome5, 500); } } private void editLocationParams(ZoneLocation zoneLocation, Biome biome, int minDistance = 200) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) zoneLocation.m_enable = true; zoneLocation.m_biome = biome; zoneLocation.m_quantity *= 2; zoneLocation.m_minAltitude = ((zoneLocation.m_minAltitude == 0f) ? 10f : zoneLocation.m_minAltitude); zoneLocation.m_maxAltitude = ((zoneLocation.m_maxAltitude == 0f) ? 3000f : zoneLocation.m_maxAltitude); zoneLocation.m_minDistance = minDistance; zoneLocation.m_maxDistance = 0f; } private bool IsIn(string name, params string[] options) { for (int i = 0; i < options.Length; i++) { if (name == options[i]) { return true; } } return false; } } public class MonsterManager { private List monsters; private List list; public void setupMonsterList(List list) { if (list == null) { Debug.LogWarning((object)"I DID NOT FOUND PREFAB LIST!"); return; } this.list = list; List list2 = list.FindAll((GameObject x) => Object.op_Implicit((Object)(object)x.GetComponent()) || Object.op_Implicit((Object)(object)x.GetComponent()) || Object.op_Implicit((Object)(object)x.GetComponent())); monsters = list2; } public void changeMonsterResistance() { if (monsters == null) { Debug.LogWarning((object)"I DID NOT FOUND ANY MONSTERS!"); return; } foreach (GameObject monster in monsters) { Humanoid component = monster.GetComponent(); if ((Object)(object)component != (Object)null) { changeSpiritResistance(component); } } changeMonsterDrops(); } public void setupSpawners(List list) { doSpawnerChanges("SeekerBroodSpawner_bal"); doSpawnerChanges("BonePileSpawner"); doSpawnerChanges("Spawner_DraugrPile"); doSpawnerChanges("Spawner_GreydwarfNest"); doSpawnerChanges("SurtlingSpawner_bal"); doSpawnerChanges("DrakeSpawner_bal"); doSpawnerChanges("DeathsquitoHive_bal"); doSpawnerChanges("RockGolemSpawn_bal"); } private void doSpawnerChanges(string name) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Expected O, but got Unknown GameObject val = list.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { CreateSpanwerDropList(val); if (name == "SeekerBroodSpawner_bal") { SpawnArea component = val.GetComponent(); SpawnData val2 = new SpawnData(); val2.m_maxLevel = 4; val2.m_weight = 1f; val2.m_minLevel = 1; GameObject val3 = list.Find((GameObject x) => ((Object)x).name == "SeekerBrood"); if ((Object)(object)val3 != (Object)null) { val2.m_prefab = val3; } else { val2.m_prefab = list.Find((GameObject x) => ((Object)x).name == "SeekerBrood"); } component.m_prefabs.Add(val2); } if (name == "DeathsquitoHive_bal") { SpawnArea component2 = val.GetComponent(); SpawnData val4 = new SpawnData(); val4.m_maxLevel = 3; val4.m_weight = 1f; val4.m_minLevel = 1; GameObject val5 = list.Find((GameObject x) => ((Object)x).name == "Deathsquito"); if ((Object)(object)val5 != (Object)null) { val4.m_prefab = val5; } else { val4.m_prefab = list.Find((GameObject x) => ((Object)x).name == "Deathsquito"); } component2.m_prefabs.Add(val4); } if (name == "RockGolemSpawn_bal") { SpawnArea component3 = val.GetComponent(); SpawnData val6 = new SpawnData(); val6.m_maxLevel = 3; val6.m_weight = 1f; val6.m_minLevel = 1; GameObject val7 = list.Find((GameObject x) => ((Object)x).name == "StoneGolem"); if ((Object)(object)val7 != (Object)null) { val6.m_prefab = val7; } else { val6.m_prefab = list.Find((GameObject x) => ((Object)x).name == "StoneGolem"); } component3.m_prefabs.Add(val6); } if (name == "DrakeSpawner_bal") { SpawnArea component4 = val.GetComponent(); SpawnData val8 = new SpawnData(); val8.m_maxLevel = 3; val8.m_weight = 1f; val8.m_minLevel = 1; val8.m_prefab = list.Find((GameObject x) => ((Object)x).name == "Hatchling"); component4.m_prefabs.Add(val8); } if (name == "SurtlingSpawner_bal") { SpawnArea component5 = val.GetComponent(); SpawnData val9 = new SpawnData(); val9.m_maxLevel = 3; val9.m_weight = 1f; val9.m_minLevel = 1; val9.m_prefab = list.Find((GameObject x) => ((Object)x).name == "Surtling"); component5.m_prefabs.Add(val9); } } else { Debug.LogWarning((object)("spawner not found: " + name)); } } private DropData prepareDrop(GameObject item, int min, int max, float chance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) DropData result = default(DropData); result.m_item = item; result.m_stackMin = min; result.m_stackMax = max; result.m_weight = chance; return result; } private void CreateSpanwerDropList(GameObject gameObject) { //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: Unknown result type (might be due to invalid IL or missing references) //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_080d: Unknown result type (might be due to invalid IL or missing references) //IL_0836: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08da: Unknown result type (might be due to invalid IL or missing references) //IL_0c98: Unknown result type (might be due to invalid IL or missing references) //IL_0cc1: Unknown result type (might be due to invalid IL or missing references) //IL_0cea: Unknown result type (might be due to invalid IL or missing references) //IL_0d13: Unknown result type (might be due to invalid IL or missing references) //IL_0d3c: Unknown result type (might be due to invalid IL or missing references) //IL_0d65: Unknown result type (might be due to invalid IL or missing references) //IL_0d8e: Unknown result type (might be due to invalid IL or missing references) //IL_0db7: Unknown result type (might be due to invalid IL or missing references) //IL_0de0: Unknown result type (might be due to invalid IL or missing references) //IL_0e09: Unknown result type (might be due to invalid IL or missing references) //IL_0e32: Unknown result type (might be due to invalid IL or missing references) //IL_0e5b: Unknown result type (might be due to invalid IL or missing references) //IL_0ad0: Unknown result type (might be due to invalid IL or missing references) //IL_0af9: Unknown result type (might be due to invalid IL or missing references) //IL_0b22: Unknown result type (might be due to invalid IL or missing references) //IL_0b4b: Unknown result type (might be due to invalid IL or missing references) //IL_0b74: Unknown result type (might be due to invalid IL or missing references) //IL_0b9d: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) //IL_0bef: Unknown result type (might be due to invalid IL or missing references) //IL_0c18: Unknown result type (might be due to invalid IL or missing references) //IL_0c41: Unknown result type (might be due to invalid IL or missing references) //IL_0c6a: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_0908: Unknown result type (might be due to invalid IL or missing references) //IL_0931: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_09ac: Unknown result type (might be due to invalid IL or missing references) //IL_09d5: Unknown result type (might be due to invalid IL or missing references) //IL_09fe: Unknown result type (might be due to invalid IL or missing references) //IL_0a27: Unknown result type (might be due to invalid IL or missing references) //IL_0a50: Unknown result type (might be due to invalid IL or missing references) //IL_0a79: Unknown result type (might be due to invalid IL or missing references) //IL_0aa2: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) DropOnDestroyed val = gameObject.GetComponent(); if ((Object)(object)val == (Object)null) { val = gameObject.AddComponent(); val.m_dropWhenDestroyed.m_dropMin = 2; val.m_dropWhenDestroyed.m_dropMax = 3; val.m_spawnYOffset = 0.5f; val.m_spawnYStep = 0.3f; } val.m_dropWhenDestroyed.m_drops.Clear(); switch (((Object)gameObject).name) { case "SeekerBroodSpawner_bal": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("BoneFragments"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("RawSilkScrap_bal"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Mycelium_bal"), 1, 2, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Root"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Dandelion"), 2, 4, 1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Thistle"), 2, 4, 0.95f)); break; case "BonePileSpawner": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("BoneFragments"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TrophySkeleton"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("RustyBrokenSword_bal"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("BronzeScrap"), 1, 2, 0.22f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("CopperScrap"), 1, 2, 0.33f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("WitheredBone"), 1, 1, 0.5f)); break; case "Spawner_DraugrPile": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("BoneFragments"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Entrails"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TrophyDraugr"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TrophySkeleton"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("RustyBrokenSword_bal"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("SilverNecklace"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("IronScrap"), 1, 2, 0.1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("BronzeScrap"), 1, 2, 0.25f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("CopperScrap"), 1, 2, 0.33f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("CultInsignia_bal"), 1, 2, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Mycelium_bal"), 1, 2, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("SwampTreeSeeds_bal"), 1, 2, 0.5f)); break; case "Spawner_GreydwarfNest": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Wood"), 2, 4, 1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("RoundLog"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("FineWood"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Root"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("AncientSeed"), 1, 2, 1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Dandelion"), 2, 4, 1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Thistle"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TrophyGreydwarf"), 2, 4, 0.95f)); break; case "SurtlingSpawner_bal": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("FlametalOre"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("IronOre"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Stone"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("BlackMarble"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("MagmaStone_bal"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Obsidian"), 1, 1, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TinOre"), 2, 4, 0.9f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Ruby"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Amethyst_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Emerald_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Opal_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Onyx_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Sapphire_bal"), 1, 1, 0.01f)); break; case "DeathsquitoHive_bal": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Wood"), 2, 4, 1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("RoundLog"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("FineWood"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Root"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("AncientSeed"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Dandelion"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Straw_bal"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Needle"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Thistle"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("BoneFragments"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TrophyDeathsquito"), 1, 1, 0.95f)); break; case "RockGolemSpawn_bal": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TrophySGolem"), 1, 1, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Onyx_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Sapphire_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Stone"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("LimeStone_bal"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Obsidian"), 1, 1, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("IronOre"), 1, 1, 0.1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Flint"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Crystal"), 2, 4, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("SilverOre"), 1, 1, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TinOre"), 1, 1, 0.5f)); break; case "DrakeSpawner_bal": val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TrophyHatchling"), 1, 1, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Onyx_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Sapphire_bal"), 1, 1, 0.01f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Stone"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("LimeStone_bal"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Obsidian"), 1, 1, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("DragonEgg"), 1, 1, 0.1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("FreezeGland"), 1, 1, 0.1f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("FreezeGland"), 2, 4, 0.95f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("Crystal"), 2, 4, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("SilverOre"), 1, 1, 0.5f)); val.m_dropWhenDestroyed.m_drops.Add(prepareDrop(FindItem("TinOre"), 1, 1, 0.5f)); break; } } private void changeSpiritResistance(Humanoid humanoid) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected I4, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_009d: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) Faction faction = ((Character)humanoid).m_faction; Faction val = faction; switch (val - 1) { case 7: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)1; break; case 0: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)5; break; case 1: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)1; break; case 5: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)5; break; case 2: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)2; break; case 3: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)2; break; case 6: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)1; break; case 4: ((Character)humanoid).m_damageModifiers.m_spirit = (DamageModifier)1; break; } } private void changeMonsterDrops() { foreach (GameObject monster in monsters) { monsterLootChange(monster); } } private void monsterLootChange(GameObject monster) { CharacterDrop val = monster.GetComponent(); if ((Object)(object)val == (Object)null) { val = monster.AddComponent(); } switch (((Object)monster).name) { case "Skeleton_Hildir": case "GoblinShaman_Hildir": case "Fenring_Cultist_Hildir": case "Skeleton_Hildir_nochest": case "GoblinBruteBros_nochest": case "GoblinShaman_Hildir_nochest": case "GoblinBrute_Hildir": case "Fenring_Cultist_Hildir_nochest": addItemToLootTable(val, "SeaPearl_bal", 1, 2, 0.2f); addItemToLootTable(val, "Amber", 1, 2, 0.3f); addItemToLootTable(val, "Ruby", 2, 3, 0.4f); addItemToLootTable(val, "Coins", 20, 40, 0.5f); addItemToLootTable(val, "CorruptedEitr_bal", 3, 5, 0.6f); addItemToLootTable(val, "Peningar_bal", 30, 40, 0.7f); addItemToLootTable(val, "RustedScrap_bal", 3, 6, 0.1f, multiplier: false); break; case "Abomination": editDrop(val, "Root", 4, 8, 1f); editMonsterHealth(monster, 1000); addItemToLootTable(val, "CorruptedEitr_bal", 1, 3, 0.3f); addItemToLootTable(val, "AncientSeed", 1, 1, 0.1f); addItemToLootTable(val, "SwampTreeSeeds_bal", 1, 1, 0.1f); addItemToLootTable(val, "HardWood_bal", 1, 3, 0.5f); addItemToLootTable(val, "FineWood", 1, 3, 0.5f); break; case "Hare": editMonsterHealth(monster, 25); addItemToLootTable(val, "LeatherScraps", 1, 3, 0.5f); addItemToLootTable(val, "AcaiSeeds_bal", 1, 1, 0.1f); addItemToLootTable(val, "Straw_bal", 1, 2, 0.2f); break; case "Leech": addItemToLootTable(val, "SmallBloodSack_bal", 1, 1, 0.5f); addItemToLootTable(val, "SwampTreeSeeds_bal", 1, 1, 0.1f); addItemToLootTable(val, "RottenMeat", 1, 1, 0.4f); break; case "Troll_ru": case "Troll": editDrop(val, "TrollHide", 2, 3, 1f); editDrop(val, "Coins", 10, 20, 0.5f); addItemToLootTable(val, "TrollMeat_bal", 1, 1, 0.75f); addItemToLootTable(val, "LeatherScraps", 1, 3, 0.5f); addItemToLootTable(val, "Clay_bal", 1, 3, 0.3f); addItemToLootTable(val, "RottenMeat", 1, 1, 0.4f); addItemToLootTable(val, "RustyBrokenSword_bal", 1, 1, 0.02f, multiplier: false); addItemToLootTable(val, "Peningar_bal", 40, 50, 0.5f); addItemToLootTable(val, "RustedScrap_bal", 1, 2, 0.1f, multiplier: false); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); break; case "Charred_Archer": case "Charred_Melee": case "Charred_Mage": case "Charred_Twitcher": addItemToLootTable(val, "CorruptedEitr_bal", 1, 1, 0.3f); addItemToLootTable(val, "MagmaStone_bal", 1, 2, 0.1f); addItemToLootTable(val, "FlametalScrap_bal", 1, 2, 0.1f, multiplier: false); addItemToLootTable(val, "Ruby", 0, 1, 0.05f); addItemToLootTable(val, "Amethyst_bal", 0, 1, 0.05f); addItemToLootTable(val, "Emerald_bal", 0, 1, 0.05f); addItemToLootTable(val, "Opal_bal", 0, 1, 0.05f); addItemToLootTable(val, "Onyx_bal", 0, 1, 0.05f); addItemToLootTable(val, "Sapphire_bal", 0, 1, 0.05f); addItemToLootTable(val, "VikingTalisman_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "LeatherScraps", 1, 3, 0.1f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.5f, multiplier: false); addItemToLootTable(val, "SilverNecklace", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); break; case "Surtling": addItemToLootTable(val, "CorruptedEitr_bal", 1, 2, 0.1f); addItemToLootTable(val, "MagmaStone_bal", 1, 2, 0.1f); addItemToLootTable(val, "SurtrAmulet_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "Ruby", 0, 1, 0.05f); addItemToLootTable(val, "Opal_bal", 0, 1, 0.05f); addItemToLootTable(val, "Onyx_bal", 0, 1, 0.05f); editMonsterHealth(monster, 50); break; case "Dragon": addItemToLootTable(val, "CorruptedEitr_bal", 4, 8, 0.8f); addItemToLootTable(val, "LeatherScraps", 1, 2, 0.7f); addItemToLootTable(val, "Onyx_bal", 1, 1, 0.05f); addItemToLootTable(val, "Sapphire_bal", 1, 1, 0.05f); addItemToLootTable(val, "Peningar_bal", 50, 200, 0.5f); addItemToLootTable(val, "DrakeMeat_bal", 2, 4, 0.33f); addItemToLootTable(val, "DrakeSkin_bal", 3, 6, 0.33f); break; case "GoblinKing": addItemToLootTable(val, "CorruptedEitr_bal", 5, 10, 0.9f, multiplier: false); addItemToLootTable(val, "JuteRed", 2, 4, 0.7f); addItemToLootTable(val, "CursedBone_bal", 6, 12, 0.8f, multiplier: true, perPlayer: true); addItemToLootTable(val, "SilverScrap_bal", 3, 5, 0.1f, multiplier: false); addItemToLootTable(val, "IronScrap", 3, 5, 0.2f); addItemToLootTable(val, "BronzeScrap", 3, 5, 0.3f, multiplier: false); addItemToLootTable(val, "CopperScrap", 3, 5, 0.4f, multiplier: false); addItemToLootTable(val, "Amethyst_bal", 1, 1, 0.5f); addItemToLootTable(val, "Emerald_bal", 1, 1, 0.5f); addItemToLootTable(val, "Opal_bal", 1, 1, 0.5f); addItemToLootTable(val, "Onyx_bal", 1, 1, 0.5f); addItemToLootTable(val, "Sapphire_bal", 1, 1, 0.5f); addItemToLootTable(val, "Coins", 25, 100, 0.5f); addItemToLootTable(val, "Peningar_bal", 50, 200, 0.5f); addItemToLootTable(val, "RustedScrap_bal", 5, 8, 0.5f, multiplier: false); break; case "GoblinBrute": editDrop(val, "GoblinTotem", 1, 1, 0.33f, multiplier: false); addItemToLootTable(val, "SilverScrap_bal", 1, 1, 0.06f, multiplier: false); addItemToLootTable(val, "Peningar_bal", 10, 20, 0.5f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.5f, multiplier: false); addItemToLootTable(val, "SilverNecklace", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); addItemToLootTable(val, "IronScrap", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.15f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.2f, multiplier: false); break; case "GoblinShaman": addItemToLootTable(val, "CorruptedEitr_bal", 2, 4, 0.7f); addItemToLootTable(val, "Ectoplasm", 1, 1, 0.5f); addItemToLootTable(val, "SilverScrap_bal", 1, 1, 0.06f, multiplier: false); addItemToLootTable(val, "Peningar_bal", 10, 20, 0.5f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.5f, multiplier: false); addItemToLootTable(val, "SilverNecklace", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); addItemToLootTable(val, "IronScrap", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.15f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.2f, multiplier: false); addItemToLootTable(val, "GoblinTotem", 1, 1, 0.55f, multiplier: false); break; case "Goblin": addItemToLootTable(val, "GoblinTotem", 1, 1, 0.01f, multiplier: false); addItemToLootTable(val, "RustyBrokenSword_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "Peningar_bal", 10, 20, 0.25f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.25f, multiplier: false); break; case "Draugr_Elite": addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.5f, multiplier: false); addItemToLootTable(val, "RustyBrokenSword_bal", 1, 1, 0.2f, multiplier: false); addItemToLootTable(val, "CorruptedEitr_bal", 1, 1, 0.2f); addItemToLootTable(val, "Ectoplasm", 1, 1, 0.75f); addItemToLootTable(val, "ArrowFlint", 1, 3, 0.5f); addItemToLootTable(val, "SilverScrap_bal", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "IronScrap", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.15f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.2f, multiplier: false); addItemToLootTable(val, "Peningar_bal", 10, 20, 0.5f); if (!Compatibility.IsLoaded()) { addItemToLootTable(val, "CryptKey", 1, 1, 0.5f, multiplier: false); } addItemToLootTable(val, "CultInsignia_bal", 1, 1, 0.8f, multiplier: false); addItemToLootTable(val, "Mycelium_bal", 1, 2, 0.8f); addItemToLootTable(val, "SilverNecklace", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "VikingTalisman_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); editMonsterHealth(monster, 350); break; case "Greydwarf_Elite": addItemToLootTable(val, "CorruptedEitr_bal", 1, 1, 0.02f); addItemToLootTable(val, "StrawSeeds_bal", 1, 1, 0.3f); addItemToLootTable(val, "AppleSeeds_bal", 1, 1, 0.25f); addItemToLootTable(val, "Thistle", 1, 1, 0.1f); addItemToLootTable(val, "Dandelion", 1, 1, 0.1f); addItemToLootTable(val, "Moss_bal", 1, 1, 0.4f); addItemToLootTable(val, "CopperScrap", 1, 1, 0.01f, multiplier: false); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.01f, multiplier: false); addItemToLootTable(val, "BasicSeed_bal", 1, 1, 0.5f); addItemToLootTable(val, "RottenVegetable_bal", 1, 1, 0.55f); editMonsterHealth(monster, 250); break; case "Skeleton_Poison": addItemToLootTable(val, "CorruptedEitr_bal", 1, 1, 0.05f); addItemToLootTable(val, "RustyBrokenSword_bal", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.25f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "IronScrap", 1, 1, 0.005f, multiplier: false); addItemToLootTable(val, "BrassScrap_bal", 1, 1, 0.01f, multiplier: false); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.01f); editMonsterHealth(monster, 150); break; case "Skeleton": case "Skeleton_NoArcher": addItemToLootTable(val, "RustyBrokenSword_bal", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.005f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.01f, multiplier: false); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "SilverNecklace", 1, 1, 0.01f, multiplier: false); break; case "DraugrRanged": case "DraugrArcher": case "Draugr": addItemToLootTable(val, "CorruptedEitr_bal", 1, 1, 0.02f); addItemToLootTable(val, "RustyBrokenSword_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "ArrowFlint", 1, 3, 0.1f); addItemToLootTable(val, "Ectoplasm", 1, 1, 0.03f); addItemToLootTable(val, "IronScrap", 1, 1, 0.01f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "Peningar_bal", 5, 10, 0.5f); if (!Compatibility.IsLoaded()) { addItemToLootTable(val, "CryptKey", 0, 1, 0.005f, multiplier: false); } addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.15f); addItemToLootTable(val, "CultInsignia_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "Mycelium_bal", 1, 1, 0.1f); addItemToLootTable(val, "VikingTalisman_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "SilverNecklace", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); break; case "gd_king": addItemToLootTable(val, "WatcherHeart_bal", 1, 1, 1f, multiplier: false, perPlayer: true); addItemToLootTable(val, "CorruptedEitr_bal", 2, 4, 0.1f, multiplier: false); addItemToLootTable(val, "Amethyst_bal", 1, 2, 0.1f); addItemToLootTable(val, "FineWood", 2, 4, 0.7f); addItemToLootTable(val, "RoundLog", 4, 6, 0.8f); addItemToLootTable(val, "Wood", 8, 10, 0.9f); addItemToLootTable(val, "ElderBark", 1, 2, 0.6f); addItemToLootTable(val, "Root", 1, 3, 0.6f); addItemToLootTable(val, "AppleSeeds_bal", 4, 8, 0.75f); addItemToLootTable(val, "Thistle", 2, 4, 0.5f); editMonsterHealth(monster, 3300); break; case "Deer": editDrop(val, "TrophyDeer", 1, 1, 0.25f, multiplier: false); editDrop(val, "DeerHide", 1, 1, 0.75f); editDrop(val, "DeerMeat", 1, 1, 1f); addItemToLootTable(val, "LeatherScraps", 1, 1, 0.33f); break; case "Hatchling": editDrop(val, "FreezeGland", 1, 2, 0.75f); addItemToLootTable(val, "DrakeSkin_bal", 1, 1, 0.15f); addItemToLootTable(val, "LeatherScraps", 0, 2, 0.5f); addItemToLootTable(val, "BoneFragments", 1, 2, 0.1f); addItemToLootTable(val, "DrakeMeat_bal", 1, 1, 0.55f); break; case "BlobElite": editDrop(val, "IronScrap", 1, 1, 0.11f); addItemToLootTable(val, "LeatherScraps", 1, 2, 0.5f); addItemToLootTable(val, "BoneFragments", 2, 4, 0.5f); addItemToLootTable(val, "Guck", 1, 1, 0.5f); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.22f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.33f, multiplier: false); addItemToLootTable(val, "RustedScrap_bal", 1, 2, 0.44f, multiplier: false); break; case "Blob": addItemToLootTable(val, "LeatherScraps", 1, 2, 0.5f); addItemToLootTable(val, "BoneFragments", 1, 2, 0.5f); addItemToLootTable(val, "Guck", 1, 1, 0.1f); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.25f, multiplier: false); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.8f, multiplier: false); break; case "BlobLava": addItemToLootTable(val, "Tar", 1, 1, 0.4f); addItemToLootTable(val, "MagmaStone_bal", 1, 1, 0.3f); addItemToLootTable(val, "Obsidian", 1, 1, 0.1f); addItemToLootTable(val, "Coal", 1, 1, 0.7f); addItemToLootTable(val, "SulfurStone", 1, 1, 0.3f); addItemToLootTable(val, "FlametalScrap_bal", 1, 1, 0.25f, multiplier: false); addItemToLootTable(val, "DarksteelScrap_bal", 1, 1, 0.35f, multiplier: false); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.5f, multiplier: false); addItemToLootTable(val, "Opal_bal", 0, 1, 0.05f); addItemToLootTable(val, "Onyx_bal", 0, 1, 0.05f); break; case "DvergerMage": case "DvergerMageFire": case "DvergerMageIce": case "DvergerMageSupport": case "Dverger": addItemToLootTable(val, "BoraxCrystal_bal", 0, 1, 0.05f); addItemToLootTable(val, "Ruby", 0, 1, 0.05f); addItemToLootTable(val, "Amethyst_bal", 0, 1, 0.05f); addItemToLootTable(val, "Emerald_bal", 0, 1, 0.05f); addItemToLootTable(val, "Opal_bal", 0, 1, 0.05f); addItemToLootTable(val, "Onyx_bal", 0, 1, 0.05f); addItemToLootTable(val, "Sapphire_bal", 0, 1, 0.05f); addItemToLootTable(val, "SilverScrap_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "IronScrap", 1, 1, 0.25f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 1, 1, 0.35f, multiplier: false); addItemToLootTable(val, "CopperScrap", 1, 1, 0.4f, multiplier: false); addItemToLootTable(val, "Peningar_bal", 10, 20, 0.5f); addItemToLootTable(val, "JuteRed", 1, 1, 0.5f); addItemToLootTable(val, "JuteBlue", 1, 1, 0.5f); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); addGlobalKey(monster, "killedDverger"); break; case "Tick": addItemToLootTable(val, "SmallBloodSack_bal", 1, 1, 0.5f); addItemToLootTable(val, "Bloodbag", 1, 1, 0.15f); addGlobalKey(monster, "killedInsecto"); break; case "StoneGolem": addItemToLootTable(val, "LeadOre_bal", 1, 1, 0.1f); addItemToLootTable(val, "CopperOre", 1, 1, 0.15f); addItemToLootTable(val, "TinOre", 1, 1, 0.2f); addItemToLootTable(val, "IronOre", 1, 1, 0.1f); addItemToLootTable(val, "SilverOre", 1, 1, 0.05f); addItemToLootTable(val, "Ruby", 0, 1, 0.05f); addItemToLootTable(val, "Amethyst_bal", 0, 1, 0.05f); addItemToLootTable(val, "Emerald_bal", 0, 1, 0.05f); addItemToLootTable(val, "Opal_bal", 0, 1, 0.05f); addItemToLootTable(val, "Onyx_bal", 0, 1, 0.05f); addItemToLootTable(val, "Sapphire_bal", 0, 1, 0.05f); addItemToLootTable(val, "LimeStone_bal", 1, 3, 0.45f); addItemToLootTable(val, "GemChunks_bal", 1, 1, 0.1f); addGlobalKey(monster, "killedStoneGolem"); break; case "Bonemass": editMonsterHealth(monster, 6500); addItemToLootTable(val, "SoulCore_bal", 1, 1, 1f, multiplier: false, perPlayer: true); addItemToLootTable(val, "CursedBone_bal", 6, 12, 1f, multiplier: true, perPlayer: true); addItemToLootTable(val, "Ectoplasm", 2, 4, 0.2f); addItemToLootTable(val, "CorruptedEitr_bal", 6, 12, 0.6f); addItemToLootTable(val, "BoneFragments", 5, 20, 0.2f); addItemToLootTable(val, "Ooze", 3, 6, 0.2f); addItemToLootTable(val, "Guck", 3, 6, 0.2f); addItemToLootTable(val, "RustedScrap_bal", 8, 16, 0.8f, multiplier: false); addItemToLootTable(val, "IronScrap", 2, 4, 0.25f, multiplier: false); addItemToLootTable(val, "BronzeScrap", 4, 8, 0.35f, multiplier: false); addItemToLootTable(val, "CopperScrap", 6, 12, 0.4f, multiplier: false); addItemToLootTable(val, "Mycelium_bal", 3, 6, 0.2f); break; case "Greyling": editMonsterHealth(monster, 30); addItemToLootTable(val, "Straw_bal", 1, 1, 0.9f); addItemToLootTable(val, "Dandelion", 1, 1, 0.1f); addItemToLootTable(val, "Mushroom", 1, 1, 0.1f); addItemToLootTable(val, "Raspberry", 1, 1, 0.1f); addItemToLootTable(val, "Blueberries", 1, 1, 0.1f); addItemToLootTable(val, "BasicSeed_bal", 1, 1, 0.1f); break; case "Greydwarf": addItemToLootTable(val, "StrawSeeds_bal", 1, 1, 0.44f); addItemToLootTable(val, "AppleSeeds_bal", 1, 1, 0.22f); addItemToLootTable(val, "Moss_bal", 1, 1, 0.5f); addItemToLootTable(val, "BasicSeed_bal", 1, 1, 0.33f); addItemToLootTable(val, "RottenVegetable_bal", 1, 1, 0.11f); break; case "Greydwarf_Shaman": addItemToLootTable(val, "Apple_bal", 1, 1, 0.33f); addItemToLootTable(val, "Thistle", 1, 1, 0.5f); addItemToLootTable(val, "EnrichedSoil_bal", 1, 1, 0.2f); addItemToLootTable(val, "Moss_bal", 1, 1, 0.7f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "RottenVegetable_bal", 1, 1, 0.55f); addItemToLootTable(val, "CorruptedEitr_bal", 1, 1, 0.05f, multiplier: false); editMonsterHealth(monster, 100); break; case "SeekerBrood": addItemToLootTable(val, "RawSilkScrap_bal", 1, 1, 0.25f); addItemToLootTable(val, "Resin", 1, 1, 0.25f); addItemToLootTable(val, "Ooze", 1, 1, 0.25f); break; case "SeekerBrute": addItemToLootTable(val, "SeekerBrain_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "RawSilk_bal", 1, 1, 0.4f); addItemToLootTable(val, "RawSilkScrap_bal", 1, 2, 0.8f); addItemToLootTable(val, "Larva_bal", 1, 1, 0.3f); addGlobalKey(monster, "killedSeeker"); break; case "Seeker": addItemToLootTable(val, "SeekerBrain_bal", 1, 1, 0.01f, multiplier: false); addItemToLootTable(val, "RawSilk_bal", 1, 1, 0.25f); addItemToLootTable(val, "RawSilkScrap_bal", 1, 2, 0.5f); addGlobalKey(monster, "killedSeeker"); break; case "SeekerQueen": editDrop(val, "QueenDrop", 10, 20, 1f, multiplier: true, perPlayer: true); addItemToLootTable(val, "RawSilk_bal", 4, 8, 1f); addItemToLootTable(val, "RawSilkScrap_bal", 8, 16, 1f); addItemToLootTable(val, "BugMeat", 3, 6, 0.8f); addItemToLootTable(val, "GiantBloodSack", 1, 3, 0.8f); addItemToLootTable(val, "Mandible", 1, 3, 0.8f); addItemToLootTable(val, "CorruptedEitr_bal", 5, 10, 0.9f); addItemToLootTable(val, "Chitin", 4, 8, 0.4f); addItemToLootTable(val, "Bilebag", 1, 3, 0.3f); addItemToLootTable(val, "Carapace", 3, 6, 0.3f); addItemToLootTable(val, "Bloodbag", 4, 8, 0.3f); addItemToLootTable(val, "AcidSludge_bal", 3, 6, 0.3f); break; case "Eikthyr": editDrop(val, "HardAntler", 5, 5, 1f); addItemToLootTable(val, "LeatherScraps", 5, 10, 0.5f); addItemToLootTable(val, "DeerHide", 2, 4, 0.9f); addItemToLootTable(val, "BasicSeed_bal", 3, 5, 0.75f); addItemToLootTable(val, "StrawSeeds_bal", 2, 4, 0.33f); addItemToLootTable(val, "Clay_bal", 2, 4, 0.1f); addItemToLootTable(val, "AppleSeeds_bal", 1, 2, 0.11f); addItemToLootTable(val, "DeerMeat", 2, 4, 0.9f); addItemToLootTable(val, "RottenMeat", 1, 2, 0.5f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.1f, multiplier: false); editMonsterHealth(monster, 800); break; case "Neck": editDrop(val, "TrophyNeck", 1, 1, 0.2f, multiplier: false); editDrop(val, "NeckTail", 1, 1, 1f); addItemToLootTable(val, "NeckSkin_bal", 1, 1, 0.33f); addItemToLootTable(val, "LeatherScraps", 1, 1, 0.5f); addItemToLootTable(val, "Clay_bal", 1, 1, 0.1f); editMonsterHealth(monster, 10); break; case "Boar": editDrop(val, "TrophyBoar", 1, 1, 0.2f, multiplier: false); editDrop(val, "LeatherScraps", 1, 3, 0.5f); editDrop(val, "RawMeat", 1, 1, 1f); addItemToLootTable(val, "BoarHide_bal", 1, 1, 0.75f); editMonsterHealth(monster, 15); break; case "Ghost": addItemToLootTable(val, "RottenMeat", 1, 1, 0.5f); addItemToLootTable(val, "ArrowFlint", 1, 3, 0.5f); addItemToLootTable(val, "SilverNecklace", 1, 1, 0.1f); addItemToLootTable(val, "CopperScrap", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "CorruptedEitr_bal", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.1f, multiplier: false); addItemToLootTable(val, "Amber", 1, 1, 0.1f); addItemToLootTable(val, "Peningar_bal", 1, 1, 0.2f); addItemToLootTable(val, "Coins", 1, 1, 0.1f); break; case "Ulv": addItemToLootTable(val, "LeatherScraps", 1, 2, 0.5f); addItemToLootTable(val, "WolfMeat", 1, 1, 0.5f); addItemToLootTable(val, "WolfHairBundle", 1, 1, 0.1f); addItemToLootTable(val, "Bloodbag", 1, 1, 0.1f); addItemToLootTable(val, "BoneFragments", 1, 2, 0.5f); addItemToLootTable(val, "FenringMeat_bal", 1, 1, 0.15f); addItemToLootTable(val, "WolfClaw", 1, 1, 0.15f); break; case "Fenring": addItemToLootTable(val, "FenringMeat_bal", 1, 1, 0.33f); addItemToLootTable(val, "SilverScrap_bal", 1, 1, 0.3f, multiplier: false); addItemToLootTable(val, "LeatherScraps", 1, 2, 0.5f); addItemToLootTable(val, "CorruptedEitr_bal", 1, 2, 0.3f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.33f, multiplier: false); addItemToLootTable(val, "FenringInsygnia_bal", 1, 1, 0.05f, multiplier: false); addItemToLootTable(val, "WolfHairBundle", 1, 1, 0.2f); addItemToLootTable(val, "WolfClaw", 1, 1, 0.2f); break; case "Fenring_Cultist": addItemToLootTable(val, "SilverScrap_bal", 1, 1, 0.6f, multiplier: false); addItemToLootTable(val, "LeatherScraps", 1, 2, 0.5f); addItemToLootTable(val, "FenringMeat_bal", 1, 1, 0.33f); addItemToLootTable(val, "CorruptedEitr_bal", 2, 5, 0.6f); addItemToLootTable(val, "RustedScrap_bal", 1, 1, 0.5f, multiplier: false); addItemToLootTable(val, "JuteRed", 1, 1, 0.5f); addItemToLootTable(val, "FenringInsygnia_bal", 1, 2, 0.1f, multiplier: false); addItemToLootTable(val, "WolfHairBundle", 1, 1, 0.2f); break; case "Bat": addItemToLootTable(val, "SmallBloodSack_bal", 1, 1, 0.5f); addItemToLootTable(val, "EnrichedSoil_bal", 1, 1, 0.1f); addItemToLootTable(val, "BoneFragments", 1, 1, 0.2f); addItemToLootTable(val, "LeatherScraps", 1, 2, 0.5f); addItemToLootTable(val, "BatWing_bal", 1, 1, 0.5f); break; case "Serpent": addItemToLootTable(val, "LeatherScraps", 4, 8, 0.5f); addItemToLootTable(val, "SerpentEgg_bal", 1, 1, 0.15f, multiplier: false); addItemToLootTable(val, "SeaPearl_bal", 1, 1, 0.15f); addItemToLootTable(val, "FreshSeaweed", 1, 1, 0.75f); addItemToLootTable(val, "RottenMeat", 1, 1, 0.4f); addItemToLootTable(val, "Bloodbag", 1, 1, 0.3f); addItemToLootTable(val, "FishRaw", 1, 2, 0.9f); editMonsterHealth(monster, 600); break; case "BonemawSerpent": addItemToLootTable(val, "LeatherScraps", 4, 8, 0.5f); addItemToLootTable(val, "BoneFragments", 3, 6, 0.15f); addItemToLootTable(val, "BonemawSerpentScale", 3, 6, 0.65f); addItemToLootTable(val, "Bloodbag", 1, 2, 0.5f); addItemToLootTable(val, "CorruptedEitr_bal", 2, 3, 0.1f, multiplier: false); editMonsterHealth(monster, 1200); break; } } private void addAttack(GameObject gameObject, string name) { Humanoid component = gameObject.GetComponent(); List list = new List(); list.AddRange(component.m_defaultItems); list.Add(FindItem(name)); component.m_defaultItems = list.ToArray(); } private void editMonsterHealth(GameObject gameObject, int health) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) Humanoid component = gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { Character component2 = gameObject.GetComponent(); component2.m_health = health; } else { ((Character)component).m_health = health; ((Character)component).m_damageModifiers.m_fire = (DamageModifier)1; } } private void editDrop(CharacterDrop drops, string itemName, int amountMin, int amountMax, float chance, bool multiplier = true, bool perPlayer = false) { foreach (Drop drop in drops.m_drops) { if (((Object)drop.m_prefab).name == itemName) { drop.m_amountMin = amountMin; drop.m_amountMax = amountMax; drop.m_chance = chance; drop.m_levelMultiplier = multiplier; drop.m_onePerPlayer = perPlayer; } } } private void setBoss(GameObject gameObject, bool isBoss = false) { Humanoid component = gameObject.GetComponent(); if (!((Object)(object)component == (Object)null)) { ((Character)component).m_boss = isBoss; } } private void addItemToLootTable(CharacterDrop drops, string itemName, int amountMin, int amountMax, float chance, bool multiplier = true, bool perPlayer = false) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown GameObject val = FindItem(itemName); if ((Object)(object)val != (Object)null) { List list = drops.m_drops.FindAll((Drop x) => ((Object)x.m_prefab).name == itemName); if (list.Count <= 0) { Drop val2 = new Drop(); val2.m_amountMin = amountMin; val2.m_amountMax = amountMax; val2.m_chance = chance; val2.m_levelMultiplier = multiplier; val2.m_prefab = val; val2.m_onePerPlayer = perPlayer; drops.m_drops.Add(val2); } } } private void addGlobalKey(GameObject monster, string key) { Humanoid component = monster.GetComponent(); ((Character)component).m_defeatSetGlobalKey = key; } private GameObject FindItem(string name) { GameObject val = list.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val == (Object)null) { val = list.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood")); return list.Find((GameObject x) => ((Object)x).name == "Wood"); } if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("Item Not Found At All - " + name + ", Replaced With Wood")); return list.Find((GameObject x) => ((Object)x).name == "Wood"); } } public class BuildPieceBuilder { private List list; private readonly Dictionary _itemCache = new Dictionary(); public void SetupBuildPieces(ZNetScene zNetScene) { TableMapper.setupTables(zNetScene); list = zNetScene.m_prefabs; foreach (GameObject prefab in zNetScene.m_prefabs) { EditBuildPiece(prefab); } } private void EditBuildPiece(GameObject gameObject) { //IL_2c13: Unknown result type (might be due to invalid IL or missing references) //IL_4fad: Unknown result type (might be due to invalid IL or missing references) //IL_4e4f: Unknown result type (might be due to invalid IL or missing references) //IL_36ce: Unknown result type (might be due to invalid IL or missing references) //IL_5d3c: Unknown result type (might be due to invalid IL or missing references) //IL_5075: Unknown result type (might be due to invalid IL or missing references) //IL_50a7: Unknown result type (might be due to invalid IL or missing references) //IL_4fdf: Unknown result type (might be due to invalid IL or missing references) //IL_3350: Unknown result type (might be due to invalid IL or missing references) //IL_4f7b: Unknown result type (might be due to invalid IL or missing references) //IL_516e: Unknown result type (might be due to invalid IL or missing references) //IL_33a5: Unknown result type (might be due to invalid IL or missing references) //IL_4eb3: Unknown result type (might be due to invalid IL or missing references) //IL_2980: Unknown result type (might be due to invalid IL or missing references) //IL_2abe: Unknown result type (might be due to invalid IL or missing references) //IL_3112: Unknown result type (might be due to invalid IL or missing references) //IL_3189: Unknown result type (might be due to invalid IL or missing references) //IL_2d6b: Unknown result type (might be due to invalid IL or missing references) //IL_4cf1: Unknown result type (might be due to invalid IL or missing references) //IL_4f17: Unknown result type (might be due to invalid IL or missing references) //IL_4b0a: Unknown result type (might be due to invalid IL or missing references) //IL_2c7a: Unknown result type (might be due to invalid IL or missing references) //IL_34a4: Unknown result type (might be due to invalid IL or missing references) //IL_3920: Unknown result type (might be due to invalid IL or missing references) //IL_3044: Unknown result type (might be due to invalid IL or missing references) //IL_53c2: Unknown result type (might be due to invalid IL or missing references) //IL_4f49: Unknown result type (might be due to invalid IL or missing references) //IL_2fdc: Unknown result type (might be due to invalid IL or missing references) //IL_2ed2: Unknown result type (might be due to invalid IL or missing references) //IL_2e1e: Unknown result type (might be due to invalid IL or missing references) //IL_519f: Unknown result type (might be due to invalid IL or missing references) //IL_5011: Unknown result type (might be due to invalid IL or missing references) //IL_33fa: Unknown result type (might be due to invalid IL or missing references) //IL_4cbf: Unknown result type (might be due to invalid IL or missing references) //IL_5e09: Unknown result type (might be due to invalid IL or missing references) //IL_4db9: Unknown result type (might be due to invalid IL or missing references) //IL_4d23: Unknown result type (might be due to invalid IL or missing references) //IL_4d55: Unknown result type (might be due to invalid IL or missing references) //IL_2d22: Unknown result type (might be due to invalid IL or missing references) //IL_32e9: Unknown result type (might be due to invalid IL or missing references) //IL_2dc4: Unknown result type (might be due to invalid IL or missing references) //IL_5e6c: Unknown result type (might be due to invalid IL or missing references) //IL_5da4: Unknown result type (might be due to invalid IL or missing references) //IL_3284: Unknown result type (might be due to invalid IL or missing references) //IL_4e1d: Unknown result type (might be due to invalid IL or missing references) //IL_5214: Unknown result type (might be due to invalid IL or missing references) //IL_3201: Unknown result type (might be due to invalid IL or missing references) //IL_50d9: Unknown result type (might be due to invalid IL or missing references) //IL_344f: Unknown result type (might be due to invalid IL or missing references) //IL_4e81: Unknown result type (might be due to invalid IL or missing references) //IL_510b: Unknown result type (might be due to invalid IL or missing references) //IL_3861: Unknown result type (might be due to invalid IL or missing references) //IL_5043: Unknown result type (might be due to invalid IL or missing references) //IL_29c1: Unknown result type (might be due to invalid IL or missing references) //IL_513d: Unknown result type (might be due to invalid IL or missing references) //IL_2cf1: Unknown result type (might be due to invalid IL or missing references) //IL_2f84: Unknown result type (might be due to invalid IL or missing references) //IL_4deb: Unknown result type (might be due to invalid IL or missing references) //IL_2e79: Unknown result type (might be due to invalid IL or missing references) //IL_30ac: Unknown result type (might be due to invalid IL or missing references) //IL_4d87: Unknown result type (might be due to invalid IL or missing references) //IL_4ee5: Unknown result type (might be due to invalid IL or missing references) //IL_364b: Unknown result type (might be due to invalid IL or missing references) //IL_2f2b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)gameObject == (Object)null) { return; } Piece component = gameObject.gameObject.GetComponent(); if (!((Object)(object)component == (Object)null)) { if ((Object)(object)component.m_craftingStation != (Object)null && ((Object)component.m_craftingStation).name == ((Object)TableMapper.workbench).name) { SetStation(component, TableMapper.heavyWorkbench); } switch (((Object)gameObject).name) { case "waymarker1_bal": case "waymarker2_bal": SetStation(component, TableMapper.stoneCutter); component.m_category = (PieceCategory)0; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 7); break; case "cupronickel_lantern_standing_bal": SetStation(component, TableMapper.forge); component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_category = (PieceCategory)4; AddResources(component, "CupronickelPlate_bal", 12); AddResources(component, "GreydwarfEye", 6); AddResources(component, "Thunderstone", 1); AddResources(component, "BronzeNails", 16); break; case "guard_stone": SetStation(component, TableMapper.forge); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Cupronickel_bal", 2); AddResources(component, "FineWood", 4); AddResources(component, "Amber", 1); break; case "forge": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BundleForgeBench_bal", 1); break; case "piece_stonecutter": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BundleStoncutterBench_bal", 1); break; case "piece_silknest_bal": SetStation(component, TableMapper.heavyWorkbench); component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "DarkSteel_bal", 5); AddResources(component, "Stone", 10); AddResources(component, "Root", 10); AddResources(component, "Silkworms_bal", 1); AddResources(component, "Seaberries_bal", 10); break; case "piece_brazierceiling01": SetStation(component, TableMapper.forge); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Bronze", 3); AddResources(component, "BrassChain_bal", 1); AddResources(component, "Coal", 2); break; case "piece_dvergr_lantern": SetStation(component, TableMapper.blackforge); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Lantern", 1); AddResources(component, "BrassChain_bal", 1); AddResources(component, "Copper", 2); break; case "piece_dvergr_lantern_pole": SetStation(component, TableMapper.blackforge); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Lantern", 1); AddResources(component, "BrassChain_bal", 1); AddResources(component, "Copper", 3); break; case "piece_scrapsmelter_bal": component.m_category = (PieceCategory)1; SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "SurtlingCore", 2); AddResources(component, "Stone", 10); AddResources(component, "Copper", 2); AddResources(component, "Clay_bal", 10); break; case "scrapsmelter_ext1_bal": component.m_category = (PieceCategory)1; SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Gabro_bal", 16); AddResources(component, "DarkSteel_bal", 10); AddResources(component, "DragonTear", 1); AddResources(component, "Oil_bal", 5); AddResources(component, "SurtlingCore", 3); break; case "Cart": component.m_category = (PieceCategory)0; SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BundleCart_bal", 1); break; case "piece_waterwell_bal": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "CarvedWood_bal", 8); AddResources(component, "Stone", 18); AddResources(component, "StrawThread_bal", 6); break; case "piece_bathtub": component.m_category = (PieceCategory)4; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "WoodBucketWater_bal", 6); AddResources(component, "Tar", 5); AddResources(component, "CarvedWood_bal", 20); AddResources(component, "Iron", 5); break; case "piece_spinningwheel": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "LeatherScraps", 4); AddResources(component, "CarvedWood_bal", 12); AddResources(component, "Cupronickel_bal", 2); AddResources(component, "IronNails", 14); break; case "windmill": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Cupronickel_bal", 4); AddResources(component, "Stone", 15); AddResources(component, "Wood", 25); AddResources(component, "IronNails", 33); break; case "smelter": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 12); AddResources(component, "Clay_bal", 5); AddResources(component, "RoundLog", 5); AddResources(component, "SurtlingCore", 4); break; case "charcoal_kiln": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 12); AddResources(component, "Clay_bal", 5); AddResources(component, "RoundLog", 5); AddResources(component, "SurtlingCore", 4); break; case "piece_cauldron": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "WoodBucketWater_bal", 3); AddResources(component, "Tin", 9); AddResources(component, "WoodNails_bal", 6); AddResources(component, "StrawThread_bal", 3); break; case "piece_MeadCauldron": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "WoodBucketWater_bal", 2); AddResources(component, "Cupronickel_bal", 3); AddResources(component, "Bronze", 3); AddResources(component, "LeatherScraps", 4); break; case "piece_shamantable_bal": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); AddResources(component, "FineWood", 16); AddResources(component, "WatcherHeart_bal", 1); AddResources(component, "GreydwarfEye", 10); AddResources(component, "Nickel_bal", 12); break; case "shamantable_ext1_bal": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); AddResources(component, "Feathers", 10); AddResources(component, "Thistle", 3); AddResources(component, "StrawThread_bal", 10); AddResources(component, "BoneFragments", 10); break; case "shamantable_ext2_bal": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); AddResources(component, "BellMetal_bal", 10); AddResources(component, "ClayPot_bal", 3); AddResources(component, "RoundLog", 5); AddResources(component, "MeadBase_bal", 2); break; case "shamantable_ext3_bal": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); AddResources(component, "Iron", 5); AddResources(component, "FineWood", 10); AddResources(component, "CarvedDeerSkull_bal", 1); AddResources(component, "CorruptedEitr_bal", 2); AddResources(component, "LeatherScraps", 15); break; case "shamantable_ext4_bal": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); AddResources(component, "Iron", 5); AddResources(component, "ElderBark", 20); AddResources(component, "Root", 10); AddResources(component, "SoulCore_bal", 1); AddResources(component, "Ectoplasm", 10); break; case "piece_preptable": component.m_category = (PieceCategory)1; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Feaster", 1); AddResources(component, "Nickel_bal", 8); AddResources(component, "LeatherScraps", 10); AddResources(component, "RoundLog", 10); break; case "magmastone_floor_2x2": SetStation(component, TableMapper.stoneCutter); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "MagmaStone_bal", 5); component.m_category = (PieceCategory)3; break; case "piece_torch_wall_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Torch", 1); AddResources(component, "Resin", 2); AddResources(component, "Flint", 1); AddResources(component, "Wood", 2); component.m_category = (PieceCategory)4; break; case "piece_groundtorch_wood": SetStation(component, TableMapper.workbench); break; case "rawstone_cube_bal": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 3); AddResources(component, "Clay_bal", 1); AddResources(component, "Flint", 3); component.m_category = (PieceCategory)3; break; case "rawstone_floor_2x2_bal": case "rawstone_Wall_2x2_bal": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 4); AddResources(component, "Flint", 4); AddResources(component, "Clay_bal", 4); component.m_category = (PieceCategory)3; break; case "rawstone_Wall_2x4_bal": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 7); AddResources(component, "Flint", 7); AddResources(component, "Clay_bal", 4); component.m_category = (PieceCategory)3; break; case "rawstone_big_beam_bal": case "rawstone_big_pole_bal": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 3); AddResources(component, "Flint", 3); AddResources(component, "Clay_bal", 2); component.m_category = (PieceCategory)3; break; case "rawstone_beam_bal": case "rawstone_pole_bal": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Stone", 2); AddResources(component, "Flint", 2); AddResources(component, "Clay_bal", 2); component.m_category = (PieceCategory)3; break; case "piece_magetable": SetStation(component, TableMapper.shamantable); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlackMetal", 5); AddResources(component, "YggdrasilWood", 20); AddResources(component, "WispCore_bal", 6); AddResources(component, "Eitr", 5); AddResources(component, "Lead_bal", 5); break; case "piece_magetable_ext": SetStation(component, TableMapper.shamantable); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlackMarble", 10); AddResources(component, "YggdrasilWood", 5); AddResources(component, "BlackCore", 3); AddResources(component, "Eitr", 5); break; case "eitrrefinery": SetStation(component, TableMapper.ironworks); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlackMetal", 5); AddResources(component, "YggdrasilWood", 10); AddResources(component, "BlackMarble", 10); AddResources(component, "DragonTear", 1); AddResources(component, "Lead_bal", 10); break; case "oilpress_bal": SetStation(component, TableMapper.forge); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 10); AddResources(component, "Nickel_bal", 4); AddResources(component, "BronzeNails", 33); AddResources(component, "CarvedWood_bal", 10); component.m_category = (PieceCategory)1; break; case "piece_workbench_ext5": case "piece_workbench_ext1": case "piece_workbench_ext3": case "piece_workbench_ext2": SetStation(component, TableMapper.workbench); break; case "workbench_ext5_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_description = "$tag_workbench_ext5_bal_description"; AddResources(component, "HardAntler", 2); AddResources(component, "Wood", 4); AddResources(component, "WoodNails_bal", 22); AddResources(component, "StrawThread_bal", 4); component.m_category = (PieceCategory)1; break; case "piece_dvergr_sharpstakes": case "piece_dvergr_stake_wall": SetStation(component, TableMapper.heavyWorkbench); break; case "piece_leatherRack_bal": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 14); AddResources(component, "BronzeNails", 16); AddResources(component, "LeatherScraps", 10); AddResources(component, "StrawThread_bal", 8); break; case "piece_sawmill_bal": SetStation(component, TableMapper.ironworks); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "HardWood_bal", 12); AddResources(component, "BronzeNails", 34); AddResources(component, "Iron", 6); AddResources(component, "StrawThread_bal", 6); break; case "piece_chest_wood": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 8); AddResources(component, "WoodNails_bal", 16); break; case "piece_chest_raw_wood_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 5); break; case "raw_wood_beam_bal": case "raw_wood_beam_26_bal": case "raw_wood_beam_45_bal": case "raw_wood_pole_bal": case "raw_woodwall_1m_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 1); break; case "raw_wood_door_bal": case "raw_wood_stair_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_category = (PieceCategory)2; AddResources(component, "Wood", 3); break; case "raw_wood_fence_bal": case "raw_woodwall_2m_bal": case "raw_wood_floor_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 2); break; case "raw_wood_roof_top_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 2); break; case "raw_wood_wallroof_45_bal": case "raw_wood_roof_45d_top_cap_bal": case "raw_wood_roof_45d_top_cap2_bal": case "raw_wood_roof_45d_icorner_bal": case "raw_wood_roof_45d_top_bal": case "raw_wood_roof_45d_bal": case "raw_wood_roof_45d_corner_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 2); break; case "rawood_bed_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_category = (PieceCategory)4; AddResources(component, "Straw_bal", 5); break; case "piece_chair02": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 3); AddResources(component, "WoodNails_bal", 18); break; case "piece_chair": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 2); AddResources(component, "WoodNails_bal", 8); break; case "piece_chair03": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 3); AddResources(component, "Tar", 1); AddResources(component, "WoodNails_bal", 8); break; case "piece_bench01": case "piece_table": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 5); AddResources(component, "WoodNails_bal", 8); break; case "wood_door": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 5); AddResources(component, "WoodNails_bal", 4); break; case "wood_gate": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 10); AddResources(component, "WoodNails_bal", 8); break; case "piece_workbench_ext4": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 6); AddResources(component, "Iron", 4); AddResources(component, "CarvedWood_bal", 4); AddResources(component, "BronzeNails", 12); break; case "wood_stair": case "wood_stepladder": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 3); AddResources(component, "WoodNails_bal", 8); break; case "itemstand": case "itemstandh": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "CarvedWood_bal", 2); AddResources(component, "WoodNails_bal", 2); break; case "skull_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "TrophySkeleton", 10); break; case "gabro_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Gabro_bal", 30); break; case "charredbone_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "CharredBone", 30); break; case "guck_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Guck", 30); break; case "darkwood_raven": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 5); AddResources(component, "Tar", 1); break; case "wood_dragon1": SetStation(component, TableMapper.heavyWorkbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 5); break; case "ooze_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Ooze", 30); break; case "piece_artisanstation": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BundleArtisanBench_bal", 1); break; case "piece_wisplure": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "YagluthDrop", 1); AddResources(component, "Stone", 5); AddResources(component, "Flint", 5); AddResources(component, "Ectoplasm", 5); break; case "piece_oven": SetStation(component, TableMapper.forge); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BronzeNails", 12); AddResources(component, "Nickel_bal", 10); AddResources(component, "FineWood", 10); AddResources(component, "Stone", 15); AddResources(component, "SurtlingCore", 2); break; case "blastfurnace": SetStation(component, TableMapper.ironworks); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "DragonTear", 1); AddResources(component, "Iron", 10); AddResources(component, "Lead_bal", 5); AddResources(component, "Stone", 15); AddResources(component, "SurtlingCore", 4); break; case "Karve": case "Raft": case "Trailership": case "VikingShip": case "VikingShip_Ashlands": SetStation(component, TableMapper.workbench); break; case "artisan_ext1": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "DarkSteel_bal", 4); AddResources(component, "BronzeNails", 16); AddResources(component, "HardWood_bal", 6); AddResources(component, "BlackMarble", 6); break; case "blackforge": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BundleBlackforgeBench_bal", 1); break; case "blackforge_ext2_vise": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "IronNails", 24); AddResources(component, "BellMetal_bal", 5); AddResources(component, "BlackMetal", 3); AddResources(component, "MechanicalSpring", 2); break; case "fermenter": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); AddResources(component, "WoodNails_bal", 16); AddResources(component, "FineWood", 20); AddResources(component, "BellMetal_bal", 4); AddResources(component, "Resin", 15); AddResources(component, "LeatherScraps", 8); break; case "forge_ext1": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "RoundLog", 6); AddResources(component, "BronzeNails", 24); AddResources(component, "BrassChain_bal", 4); AddResources(component, "DeerHide", 6); break; case "forge_ext2": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Nickel_bal", 3); AddResources(component, "RoundLog", 3); AddResources(component, "BronzeNails", 8); break; case "forge_ext4": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BronzeNails", 8); AddResources(component, "RoundLog", 4); AddResources(component, "Iron", 16); AddResources(component, "Resin", 5); break; case "forge_ext6": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "HardWood_bal", 4); AddResources(component, "Iron", 4); AddResources(component, "BellMetal_bal", 4); AddResources(component, "WoodNails_bal", 16); break; case "piece_chest_blackmetal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "HardWood_bal", 4); AddResources(component, "IronNails", 12); AddResources(component, "BlackMetal", 4); AddResources(component, "Tar", 2); break; case "piece_chest": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "HardWood_bal", 5); AddResources(component, "Iron", 2); AddResources(component, "BronzeNails", 8); break; case "piece_cookingstation_iron": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Nickel_bal", 2); AddResources(component, "Chain", 2); AddResources(component, "Iron", 2); AddResources(component, "BronzeNails", 8); break; case "cauldron_ext3_butchertable": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "HardWood_bal", 3); AddResources(component, "ElderBark", 3); AddResources(component, "FineWood", 3); AddResources(component, "Silver", 3); AddResources(component, "Iron", 3); break; case "cauldron_ext4_pots": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "HardWood_bal", 6); AddResources(component, "Cupronickel_bal", 4); AddResources(component, "BlackMetal", 4); AddResources(component, "BellMetal_bal", 4); break; case "cauldron_ext5_mortarandpestle": component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "HardWood_bal", 6); AddResources(component, "BlackMarble", 6); AddResources(component, "Silver", 3); break; case "piece_workbench": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 6); AddResources(component, "Stone", 3); break; case "sapling_Ygg_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "YggdrasilWood", 2); AddResources(component, "AncientSeed", 1); AddResources(component, "Eitr", 2); AddResources(component, "EnrichedSoil_bal", 2); break; case "sapling_barley": case "sapling_flax": { Plant component2 = ((Component)component).GetComponent(); component2.m_growTime = 5500f; component2.m_growTimeMax = 7500f; break; } case "sapling_bush_blackberry_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BasicSeed_bal", 2); AddResources(component, "Blackberries_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_MushroomBlue_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "MushroomBlue", 1); AddResources(component, "Mycelium_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_MushroomGray_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "GrayMushroom_bal", 1); AddResources(component, "Mycelium_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_MushroomRandom_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "Mycelium_bal", 2); AddResources(component, "EnrichedSoil_bal", 4); break; case "sapling_mycelium_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "Mycelium_bal", 1); AddResources(component, "EnrichedSoil_bal", 3); break; case "sapling_MushroomRed_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "Mushroom", 1); AddResources(component, "Mycelium_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_MushroomYellow_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "MushroomYellow", 1); AddResources(component, "Mycelium_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_seedonion": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "Onion", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_seedturnip": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "Turnip", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_seedcarrot": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "Carrot", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Thistle_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BasicSeed_bal", 1); AddResources(component, "Thistle", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Dandelion_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BasicSeed_bal", 1); AddResources(component, "Dandelion", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_bush_blueberry_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BasicSeed_bal", 2); AddResources(component, "EnrichedSoil_bal", 1); AddResources(component, "Blueberries", 1); break; case "sapling_bush_raspberry_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BasicSeed_bal", 2); AddResources(component, "EnrichedSoil_bal", 1); AddResources(component, "Raspberry", 1); break; case "sapling_bush_bal": case "sapling_bushPlains_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BasicSeed_bal", 1); break; case "sapling_bushPlains2_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BasicSeed_bal", 2); break; case "sapling_TentaRoot_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "AncientSeed", 1); AddResources(component, "EnrichedSoil_bal", 3); AddResources(component, "TrophyGreydwarf", 1); break; case "sapling_AcaiTree_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "AcaiSeeds_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Swamp_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "SwampTreeSeeds_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Willow_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "WillowSeeds_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_BirchAtumn_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BirchSeeds", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Poplar_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "PoplarSeeds_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Maple_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "MapleSeeds_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Cypress_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "CypressSeeds_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_AppleTree_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "AppleSeeds_bal", 3); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Straw_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "StrawSeeds_bal", 1); break; case "sapling_garlic_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "GarlicSeeds_bal", 1); break; case "sapling_seedgarlic_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "Garlic_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "sapling_Cabbage_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "CabbageSeeds_bal", 1); break; case "sapling_CabbageSeed_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "CabbageLeaf_bal", 1); AddResources(component, "EnrichedSoil_bal", 1); break; case "treasure_stack_peningar_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Peningar_bal", 99); break; case "piece_birdhouse_bal": SetStation(component, TableMapper.workbench); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Straw_bal", 10); AddResources(component, "Dandelion", 6); AddResources(component, "WoodNails_bal", 22); AddResources(component, "FineWood", 10); component.m_category = (PieceCategory)1; break; case "zinc_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Zinc_bal", 30); break; case "cupronickel_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Cupronickel_bal", 30); break; case "iron_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Iron", 30); break; case "nickel_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "NickelOre_bal", 30); break; case "zinc_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "ZincOre_bal", 30); break; case "flametal_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FlametalOreNew", 30); break; case "flametal_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FlametalNew", 30); break; case "bmetal_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlackMetal", 30); break; case "bmetal_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlackMetalOre_bal", 30); break; case "bcopper_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "CopperOre", 30); component.m_category = (PieceCategory)0; break; case "biron_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "IronOre", 30); component.m_category = (PieceCategory)0; break; case "silver_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "SilverOre", 30); component.m_category = (PieceCategory)0; break; case "silver_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Silver", 30); component.m_category = (PieceCategory)0; break; case "cobalt_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Cobalt_bal", 30); component.m_category = (PieceCategory)0; break; case "frosteel_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Frosteel_bal", 30); component.m_category = (PieceCategory)0; break; case "darksteel_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "DarkSteel_bal", 30); component.m_category = (PieceCategory)0; break; case "bellmetal_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BellMetal_bal", 30); component.m_category = (PieceCategory)0; break; case "moltensteel_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "MoltenSteel_bal", 30); component.m_category = (PieceCategory)0; break; case "ferroboron_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Ferroboron_bal", 30); component.m_category = (PieceCategory)0; break; case "nickel_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Nickel_bal", 30); component.m_category = (PieceCategory)0; break; case "whitemetal_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "WhiteMetal_bal", 30); component.m_category = (PieceCategory)0; break; case "tin_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Tin", 30); component.m_category = (PieceCategory)0; break; case "copper_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Copper", 30); component.m_category = (PieceCategory)0; break; case "bronze_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Bronze", 30); component.m_category = (PieceCategory)0; break; case "goldbar_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "GoldBar_bal", 30); component.m_category = (PieceCategory)0; break; case "darkiron_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "DarkIron_bal", 30); component.m_category = (PieceCategory)0; break; case "blueBasalt_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlueBasalt_bal", 30); component.m_category = (PieceCategory)0; break; case "ifrytium_ore_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FlametalOre", 30); component.m_category = (PieceCategory)0; break; case "ifrytium_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Flametal", 30); component.m_category = (PieceCategory)0; break; case "wood_ember_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "EmberWood_bal", 25); component.m_category = (PieceCategory)0; break; case "wood_hard_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "HardWood_bal", 50); component.m_category = (PieceCategory)0; break; case "clay_pile_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Clay_bal", 50); component.m_category = (PieceCategory)0; break; case "clay_stack_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "ClayBrick_bal", 30); component.m_category = (PieceCategory)0; break; case "rug_straw_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Straw_bal", 5); component.m_category = (PieceCategory)4; break; case "straw_floor_2x2_bal": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "StrawBundle_bal", 1); component.m_category = (PieceCategory)2; break; case "bed": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 3); AddResources(component, "WoodNails_bal", 12); AddResources(component, "Straw_bal", 3); AddResources(component, "LeatherScraps", 2); break; case "treasure_pile_peningar_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_category = (PieceCategory)0; AddResources(component, "Peningar_bal", 999); break; case "piece_sapcollector": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_blockRadius = 6f; AddResources(component, "YggdrasilWood", 12); AddResources(component, "BlackMetal", 7); AddResources(component, "DvergrNeedle", 1); AddResources(component, "DrakeSkin_bal", 2); break; case "wood_beam_1": case "wood_pole": case "wood_floor_1x1": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 1); break; case "wood_wall_quarter": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 1); break; case "wood_window": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 4); AddResources(component, "WoodNails_bal", 4); break; case "wood_beam": case "wood_beam_26": case "wood_beam_45": case "wood_pole2": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 2); break; case "wood_wall_roof_upsidedown": case "wood_wall_roof_top_45": case "wood_wall_roof_top": case "wood_wall_roof_45_upsidedown": case "wood_wall_roof_45": case "wood_wall_roof": case "wood_wall_half": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 2); break; case "woodwall": case "wood_floor": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 3); break; case "piece_swamphut_bal": SetStation(component, null); AddResources(component, "BundleHut_bal", 1); component.m_category = (PieceCategory)0; break; case "wood_roof": case "wood_roof_45": case "wood_roof_icorner": case "wood_roof_icorner_45": case "wood_roof_ocorner": case "wood_roof_ocorner_45": case "wood_roof_top": case "wood_roof_top_45": case "wood_roof_flat_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 3); AddResources(component, "Straw_bal", 1); break; case "piece_fletcher_bal": component.m_craftingStation = TableMapper.workbench; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 6); AddResources(component, "StrawThread_bal", 2); AddResources(component, "Flint", 4); AddResources(component, "TrophyBoar", 2); break; case "fletcher_ext1_bal": component.m_craftingStation = TableMapper.fletcher; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Wood", 10); AddResources(component, "WoodNails_bal", 10); AddResources(component, "BoarHide_bal", 5); AddResources(component, "Raspberry", 4); break; case "fletcher_ext2_bal": component.m_craftingStation = TableMapper.fletcher; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "ArrowWood", 100); AddResources(component, "CarvedWood_bal", 10); AddResources(component, "Copper", 5); break; case "fletcher_ext3_bal": component.m_craftingStation = TableMapper.fletcher; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "CarvedWood_bal", 12); AddResources(component, "SharpeningStone", 1); AddResources(component, "BronzeNails", 8); AddResources(component, "Iron", 4); break; case "fletcher_ext4_bal": component.m_craftingStation = TableMapper.workbench; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 10); AddResources(component, "LeatherScraps", 10); AddResources(component, "Flint", 6); AddResources(component, "Resin", 12); break; case "piece_heavy_workbench_bal": component.m_craftingStation = null; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BundleConstructionBench_bal", 1); break; case "heavyworkbench_ext1_bal": component.m_craftingStation = TableMapper.workbench; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FineWood", 10); AddResources(component, "CarvedWood_bal", 10); AddResources(component, "Copper", 5); AddResources(component, "BronzeNails", 24); break; case "heavyworkbench_ext2_bal": component.m_craftingStation = TableMapper.workbench; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "RoundLog", 6); AddResources(component, "Bronze", 2); AddResources(component, "WoodNails_bal", 4); break; case "heavyworkbench_ext3_bal": component.m_craftingStation = TableMapper.workbench; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "RoundLog", 10); AddResources(component, "CarvedWood_bal", 4); AddResources(component, "BellMetal_bal", 2); AddResources(component, "BronzeNails", 4); break; case "heavyworkbench_ext4_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.heavyWorkbench; AddResources(component, "Wood", 8); AddResources(component, "WoodNails_bal", 12); AddResources(component, "StrawThread_bal", 4); AddResources(component, "LeatherScraps", 4); break; case "piece_metalworks_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BundleIronworksBench_bal", 1); break; case "ironworks_ext1_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.forge; AddResources(component, "Resin", 10); AddResources(component, "IronNails", 16); AddResources(component, "DarkSteel_bal", 12); break; case "ironworks_ext2_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.forge; AddResources(component, "Chain", 2); AddResources(component, "HardWood_bal", 10); AddResources(component, "DarkSteel_bal", 6); break; case "ironworks_ext3_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.forge; AddResources(component, "BellMetal_bal", 5); AddResources(component, "Moss_bal", 20); AddResources(component, "HardWood_bal", 5); AddResources(component, "DarkSteel_bal", 5); break; case "ironworks_ext4_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; component.m_craftingStation = TableMapper.forge; AddResources(component, "SurtlingCore", 3); AddResources(component, "IronNails", 12); AddResources(component, "Cupronickel_bal", 3); AddResources(component, "DarkSteel_bal", 6); break; case "artisan_ext2_bal": component.m_craftingStation = TableMapper.forge; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "YggdrasilWood", 10); AddResources(component, "BlackMetal", 4); AddResources(component, "Bronze", 10); AddResources(component, "Blackwood", 5); break; case "artisan_ext3_bal": component.m_craftingStation = TableMapper.forge; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FlametalNew", 10); AddResources(component, "SulfurStone", 10); AddResources(component, "MagmaStone_bal", 4); AddResources(component, "Blackwood", 5); break; case "magetable_ext4_bal": component.m_craftingStation = TableMapper.magetable; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "FlametalNew", 4, 6); AddResources(component, "MagmaStone_bal", 5); AddResources(component, "Bloodbag", 6); AddResources(component, "GiantBloodSack", 4); AddResources(component, "BlackCore", 2); break; case "magetable_ext5_bal": component.m_craftingStation = TableMapper.magetable; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Blackwood", 14); AddResources(component, "Chain", 4); AddResources(component, "BlackTissue_bal", 6); AddResources(component, "TrophySurtling", 4); AddResources(component, "BlackCore", 2); break; case "piece_runeforge_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BundleRuneforgeBench_bal", 1); break; case "runeforge_ext1_bal": component.m_craftingStation = TableMapper.blackforge; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "JotunFinger_bal", 5); AddResources(component, "Cobalt_bal", 10); AddResources(component, "Ferroboron_bal", 10); AddResources(component, "Sapphire_bal", 2); break; case "runeforge_ext2_bal": component.m_craftingStation = TableMapper.blackforge; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "Diamond_bal", 5); AddResources(component, "Cobalt_bal", 5); AddResources(component, "BlueBasalt_bal", 20); AddResources(component, "DarkSteel_bal", 5); break; case "runeforge_ext3_bal": component.m_craftingStation = TableMapper.blackforge; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlackMarble", 40); AddResources(component, "Cobalt_bal", 8); AddResources(component, "Cupronickel_bal", 5); AddResources(component, "Amethysteel_bal", 3); break; case "runeforge_ext4_bal": component.m_craftingStation = TableMapper.blackforge; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BlueBasalt_bal", 20); AddResources(component, "MagmaStone_bal", 10); AddResources(component, "BlackCore", 5); AddResources(component, "Lead_bal", 10); break; case "composter_bal": component.m_craftingStation = TableMapper.heavyWorkbench; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "CarvedWood_bal", 14); AddResources(component, "Bronze", 2); AddResources(component, "Straw_bal", 10); AddResources(component, "Moss_bal", 10); break; case "StoneboundKiln_bal": component.m_craftingStation = TableMapper.forge; component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "SurtlingCore", 10); AddResources(component, "Iron", 6); AddResources(component, "Wood", 10); AddResources(component, "Gabro_bal", 20); break; case "portal_wood": SetStation(component, null); component.m_resources = (Requirement[])(object)new Requirement[0]; AddResources(component, "BundlePortal_bal", 1); break; case "portal_stone": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, null); AddResources(component, "BundlePortalStone_bal", 1); break; case "piece_grill_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.stoneCutter); component.m_category = (PieceCategory)1; AddResources(component, "Clay_bal", 10); AddResources(component, "IronNails", 14); AddResources(component, "Stone", 20); AddResources(component, "Iron", 4); break; case "grill_ext1_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); component.m_category = (PieceCategory)1; AddResources(component, "CarvedWood_bal", 8); AddResources(component, "Nickel_bal", 4); AddResources(component, "Bronze", 4); AddResources(component, "Iron", 4); break; case "grill_ext2_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); component.m_category = (PieceCategory)1; AddResources(component, "FishRaw", 6); AddResources(component, "FineWood", 8); AddResources(component, "StrawThread_bal", 10); AddResources(component, "IronNails", 8); break; case "grill_ext3_bal": component.m_resources = (Requirement[])(object)new Requirement[0]; SetStation(component, TableMapper.heavyWorkbench); component.m_category = (PieceCategory)1; AddResources(component, "HardWood_bal", 10); AddResources(component, "Bread", 3); AddResources(component, "RawMeat", 4); AddResources(component, "Garlic_bal", 2); AddResources(component, "Carrot", 6); break; } } } private void SetupBundleInChest(Piece piece) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown switch (((Object)((Component)piece).gameObject).name) { case "BaseBundleCrate_bal": { Container component2 = ((Component)piece).GetComponent(); if (!((Object)(object)component2 == (Object)null)) { DropTable val2 = new DropTable(); val2.m_dropChance = 1f; PrepareForSpecificChest(val2, "Straw_bal", 50); PrepareForSpecificChest(val2, "Stone", 50); PrepareForSpecificChest(val2, "Wood", 50); component2.m_defaultItems = val2; component2.m_defaultItems.m_dropMin = 3; component2.m_defaultItems.m_dropMax = 3; component2.m_defaultItems.m_oneOfEach = true; component2.m_defaultItems.m_dropChance = 10f; } break; } case "PortalBundleCrate_bal": { Container component3 = ((Component)piece).GetComponent(); if (!((Object)(object)component3 == (Object)null)) { DropTable val3 = new DropTable(); val3.m_dropChance = 1f; PrepareForSpecificChest(val3, "GreydwarfEye", 12); PrepareForSpecificChest(val3, "FineWood", 16); PrepareForSpecificChest(val3, "SurtlingCore", 2); PrepareForSpecificChest(val3, "CarvedWood_bal", 6); component3.m_defaultItems = val3; component3.m_defaultItems.m_dropMin = 4; component3.m_defaultItems.m_dropMax = 4; component3.m_defaultItems.m_oneOfEach = true; component3.m_defaultItems.m_dropChance = 10f; } break; } case "PortalStoneBundleCrate_bal": { Container component = ((Component)piece).GetComponent(); if (!((Object)(object)component == (Object)null)) { DropTable val = new DropTable(); val.m_dropChance = 1f; PrepareForSpecificChest(val, "GreydwarfEye", 10); PrepareForSpecificChest(val, "Grausten", 30); PrepareForSpecificChest(val, "MoltenCore", 2); PrepareForSpecificChest(val, "Iron", 5); component.m_defaultItems = val; component.m_defaultItems.m_dropMin = 4; component.m_defaultItems.m_dropMax = 4; component.m_defaultItems.m_oneOfEach = true; component.m_defaultItems.m_dropChance = 10f; } break; } } } private void PrepareForSpecificChest(DropTable dropTable, string name, int amount) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (dropTable == null) { Debug.LogWarning((object)"DropTable is null in PrepareForSpecificChest"); return; } GameObject val = FindItem(name); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("PrepareForSpecificChest: Could not find item " + name)); return; } DropData val2 = default(DropData); val2.m_stackMin = amount; val2.m_stackMax = amount; val2.m_dontScale = true; val2.m_weight = 10f; val2.m_item = val; DropData item = val2; dropTable.m_drops.Add(item); } private DropData createBundleDefaultItem(string name, int amount) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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) DropData result = default(DropData); result.m_stackMin = amount; result.m_stackMax = amount; result.m_dontScale = false; result.m_weight = 10f; result.m_item = FindItem(name); return result; } private void SetCampfire(Piece piece, string itemName, int startFuel, int maxFuel, float secPerFuel) { if ((Object)(object)piece == (Object)null) { Debug.LogWarning((object)"SetCampfire: Piece is null"); return; } Fireplace component = ((Component)piece).GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("SetCampfire: Fireplace component not found on " + ((Object)((Component)piece).gameObject).name)); return; } GameObject val = FindItem(itemName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("SetCampfire: Fuel item not found: " + itemName)); return; } component.m_fuelItem = val.GetComponent(); component.m_startFuel = startFuel; component.m_maxFuel = maxFuel; component.m_secPerFuel = secPerFuel; } private void SetStation(Piece piece, CraftingStation station) { if ((Object)(object)piece == (Object)null) { Debug.LogWarning((object)"SetStation: Piece is null"); } else { piece.m_craftingStation = station; } } private void AddResources(Piece piece, string itemName, int amount, int amountPerLevel = 0, bool recover = true) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown List list = new List(); if (piece.m_resources != null) { list.AddRange(piece.m_resources); } GameObject val = FindItem(itemName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("AddResources: Could not find item prefab for " + itemName)); return; } ItemDrop component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("AddResources: Missing ItemDrop on " + itemName)); return; } list.Add(new Requirement { m_resItem = component, m_amount = amount, m_amountPerLevel = amountPerLevel, m_recover = recover }); piece.m_resources = list.ToArray(); } private GameObject FindPrefabInZnet(string name, ZNetScene zNetScene) { if (!zNetScene.m_namedPrefabs.TryGetValue(BalrondHashCompat.StableHash(name), out var value)) { return zNetScene.m_prefabs.Find((GameObject x) => (Object)(object)x != (Object)null && ((Object)x).name == name); } return value; } private GameObject FindItem(string name) { if (_itemCache.TryGetValue(name, out var value)) { return value; } GameObject val = FindPrefabInZnet(name, TableMapper.zNetScene); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)(Launch.projectName + ": Item Not Found - " + name + ", Replaced With Wood")); val = FindPrefabInZnet("Wood", TableMapper.zNetScene); } if ((Object)(object)val != (Object)null) { _itemCache[name] = val; } return val; } } public class ItemEdits { private List items; private List buildPieces; public string[] addFloatTo = new string[6] { "LeatherScraps", "DeerHide", "LoxPelt", "WolfPelt", "BoarHide", "AskHide" }; private GameObject FindItem(List list, string name) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name); if ((Object)(object)itemPrefab != (Object)null) { return itemPrefab; } Debug.LogWarning((object)("BalrondAmazingNature: Item Not Found: " + name)); return null; } private bool statment(GameObject item) { return ((Object)item).name.Contains("Sword") || ((Object)item).name.Contains("Mace") || ((Object)item).name.Contains("Armor") || ((Object)item).name.Contains("Bow") || ((Object)item).name.Contains("Knife") || ((Object)item).name.Contains("Armor") || ((Object)item).name.Contains("Helmet") || ((Object)item).name.Contains("Axe") || ((Object)item).name.Contains("Spear") || ((Object)item).name.Contains("Atgeir") || ((Object)item).name.Contains("Nails") || ((Object)item).name.Contains("Shield") || ((Object)item).name.Contains("Meat"); } public void editItems(List list) { GameObject val = FindItem(list, "Wood"); Floating component = val.GetComponent(); foreach (GameObject item in list) { if ((Object)(object)item.GetComponent() == (Object)null && addFloatTo.Contains(((Object)item).name)) { Floating val2 = item.AddComponent(); val2.m_waterLevelOffset = component.m_waterLevelOffset; val2.m_forceDistance = component.m_forceDistance; val2.m_force = component.m_force; val2.m_balanceForceFraction = component.m_balanceForceFraction; val2.m_damping = component.m_damping; } if (!((Object)item).name.Contains("Arrow") && !((Object)item).name.Contains("Trophy")) { CheckStats(item); } } List list2 = list.FindAll((GameObject x) => ((Object)x).name.Contains("Arrow")); foreach (GameObject item2 in list2) { editStackAndWeight(item2, 0.05f, 500); } List list3 = list.FindAll((GameObject x) => ((Object)x).name.Contains("Trophy")); foreach (GameObject item3 in list3) { editStackAndWeight(item3, -1f, 50); eidtTrophyValue(item3); } } private void CheckStats(GameObject gameObject) { //IL_20c8: Unknown result type (might be due to invalid IL or missing references) editLvevel(gameObject, 5, hasUpgrade: true); switch (((Object)gameObject).name) { case "RepairKitCrude_bal": addConsumeStatusEffect(gameObject, "SE_RepairKit_T1_bal"); break; case "RepairKitFien_bal": addConsumeStatusEffect(gameObject, "SE_RepairKit_T2_bal"); break; case "RepairKitAdvance_bal": addConsumeStatusEffect(gameObject, "SE_RepairKit_T3_bal"); break; case "blob_attack_aoe": case "blobelite_attack_aoe": case "blobLava_attack_aoe": addAttackStatusEffect(gameObject, "SE_ArmorCorrosion_bal"); break; case "MedPack_bal": addConsumeStatusEffect(gameObject, "SE_FirstAidKit_T2_bal"); editFoodStat(gameObject, 0, 0, 0, 0, 0f); break; case "Bandages_bal": addConsumeStatusEffect(gameObject, "SE_FirstAidKit_T1_bal"); break; case "FirstAidKit_bal": addConsumeStatusEffect(gameObject, "SE_FirstAidKit_T3_bal"); break; case "Ironpit": editValueAndTeleport(gameObject, 75); break; case "QueensJam": editFoodStat(gameObject, 15, 45, 0, 1200, 3f); break; case "SizzlingBerryBroth": editFoodStat(gameObject, 30, 20, 80, 1600, 4f); break; case "CarrotSoup": editFoodStat(gameObject, 20, 40, 0, 1700, 3f); break; case "TurnipStew": editFoodStat(gameObject, 20, 60, 0, 1500, 2f); break; case "Turnip": gameObject.GetComponent().m_itemData.m_shared.m_itemType = (ItemType)2; editFoodStat(gameObject, 12, 38, 0, 800, 1f); break; case "BlackSoup": editFoodStat(gameObject, 50, 15, 15, 1200, 3f); break; case "FierySvinstew": editFoodStat(gameObject, 90, 30, 20, 1500, 6f); break; case "OnionSoup": editFoodStat(gameObject, 25, 65, 0, 1300, 1f); break; case "SerpentStew": editFoodStat(gameObject, 80, 30, 0, 1900, 4f); break; case "SwordTaunt_bal": addAttackStatusEffect(gameObject, "TauntAttack"); break; case "StaffSkeleton": editSkeletonStaff(gameObject); break; case "RottenMeat": editFoodStat(gameObject, 15, 5, 0, 2400, -4f); editRemoveStatusEffect(gameObject); break; case "WitheredBone": case "GoblinTotem": case "AncientSeed": case "Bell": case "DvergrKey": editValueAndTeleport(gameObject, 0, teleportable: false); break; case "RustyBrokenSword_bal": editValueAndTeleport(gameObject, 15); break; case "Moss_bal": editStackAndWeight(gameObject, 0.05f, 300); break; case "imp_fireball_attack": editSurtlingDamageStat(gameObject, 15); break; case "PickaxeBlackMetal": editTool(gameObject, 5); editLvevel(gameObject, 4); break; case "PickaxeIron": editTool(gameObject, 4); editLvevel(gameObject, 4); break; case "PickaxeBronze": editTool(gameObject, 3); editLvevel(gameObject, 4); break; case "PickaxeAntler": editTool(gameObject, 2); editLvevel(gameObject, 4); break; case "PickaxeStone": editTool(gameObject, 1); editLvevel(gameObject, 4); editPickaxeStone(gameObject, 70, "Flint Pickaxe"); break; case "Hammer": editQualityValues(gameObject, 0f, 5, 1f, 0.01f); editDurability(gameObject, 300f, 150f, 1f); break; case "HammerIron": editQualityValues(gameObject, 0f, 5, 1f, 0.02f); editDurability(gameObject, 400f, 200f, 1f); break; case "HammerBlackmetal": editQualityValues(gameObject, 0f, 5, 1f, 0.03f); editDurability(gameObject, 500f, 250f, 1f); break; case "HammerDverger": editQualityValues(gameObject, 0f, 5, 1f, 0.04f); editDurability(gameObject, 600f, 300f, 1f); break; case "SpearElderbark": editSpiritDamageStat(gameObject, 5); break; case "BowSpineSnap": editSpiritDamageStat(gameObject, 10); break; case "KnifeCopper": editSpiritDamageStat(gameObject, 5); break; case "THSwordKrom": editSpiritDamageStat(gameObject, 10); editDurability(gameObject, 200f, 50f); editDefense(gameObject, 50f, 10f, 50f, 10f, 2f); editArmor(gameObject, 40f, 20f); break; case "Coins": editStackAndWeight(gameObject, 0.01f, 999); break; case "BoltBlackmetal": case "BoltBone": case "BoltCarapace": case "BoltIron": editStackAndWeight(gameObject, 0.1f, 666); break; case "Feathers": editStackAndWeight(gameObject, 0.01f, 999); break; case "LeatherScraps": case "ChickenEgg": case "LinenThread": case "BoneFragments": editStackAndWeight(gameObject, 0.1f, 200); break; case "Sap": editStackAndWeight(gameObject, 0.1f, 100); break; case "SurtlingCore": editStackAndWeight(gameObject, 3f, 100); break; case "Wood": editStackAndWeight(gameObject, 1.25f, 200); break; case "RoundLog": case "FineWood": editStackAndWeight(gameObject, 1.5f, 100); break; case "HardWood_bal": editStackAndWeight(gameObject, 1.75f, 100); break; case "Straw_bal": editStackAndWeight(gameObject, 0.05f, 500); break; case "YggdrasilWood": case "Stone": case "Obsidian": case "Flint": case "Gabro_bal": case "LimeStone_bal": case "BlackMarble": editStackAndWeight(gameObject, 1.75f, 150); break; case "MushroomBzerker": case "Darkbul_bal": case "MushroomIcecap_bal": case "MushroomInkcap_bal": case "GrayMushroom_bal": case "MushroomBlueNew_bal": case "MushroomBlue_bal": case "MushroomBlue": case "MushroomYellow": case "Mushroom": case "MushroomJotunPuffs": editStackAndWeight(gameObject, 0.1f, 100); break; case "Resin": editStackAndWeight(gameObject, 0.2f, 300); break; case "Ooze": case "Guck": editStackAndWeight(gameObject, 0.25f, 300); break; case "Tar": editStackAndWeight(gameObject, 1f, 300); break; case "Tin": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 5f, 50); break; case "TinOre": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 6f, 50); break; case "Copper": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 50); break; case "GoldOre_bal": editValueAndTeleport(gameObject, 75, teleportable: false); editStackAndWeight(gameObject, 8f, 50); break; case "CopperOre": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 8f, 50); break; case "CopperScrap": gameObject.GetComponent().m_itemData.m_shared.m_icons[0] = ModResourceLoader.scrapCopper; editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 6f, 100); break; case "Bronze": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 8f, 50); break; case "BronzeScrap": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 100); break; case "Iron": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 8f, 50); break; case "IronScrap": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 100); break; case "IronOre": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 9f, 50); break; case "Nickel_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 50); break; case "NickelOre_bal": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 8f, 50); break; case "NickelScrap_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 6f, 100); break; case "SilverOre": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 7f, 50); break; case "SilverScrap_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 6f, 100); break; case "SilverPouch_bal": editValueAndTeleport(gameObject, 20); break; case "GoldBar_bal": editValueAndTeleport(gameObject, 150); break; case "Silver": editValueAndTeleport(gameObject, 30); editStackAndWeight(gameObject, 6f, 50); break; case "BlackMetal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 8f, 50); break; case "BlackMetalOre_bal": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 9f, 50); break; case "BlackMetalScrap": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 100); break; case "GoldScrap_bal": editValueAndTeleport(gameObject, 50); editStackAndWeight(gameObject, 5f, 100); break; case "FlametalScrap_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 100); break; case "BrassScrap_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 100); break; case "Flametal": editValueAndTeleport(gameObject, 0); editItemName(gameObject, "$tag_ifrytium_bal"); editStackAndWeight(gameObject, 7f, 50); break; case "FlametalNew": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 9f, 50); break; case "FlametalOre": editValueAndTeleport(gameObject, 0, teleportable: false); editItemName(gameObject, "$tag_ifrytium_ore_bal"); editStackAndWeight(gameObject, 8f, 50); break; case "FlametalOreNew": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 10f, 50); break; case "WhiteMetal_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 9f, 50); break; case "Electrum_bal": editValueAndTeleport(gameObject, 150); editStackAndWeight(gameObject, 9f, 50); break; case "BellMetal_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 9f, 50); break; case "Ferroboron_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 10f, 50); break; case "DarkSteel_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 9f, 50); break; case "DarkIron_bal": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 10f, 50); break; case "BoraxCrysta_ball": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 6f, 50); break; case "MoltenSteel_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 11f, 50); break; case "TernarySilver_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 6f, 100); break; case "MoltenSteelScrap_bal": case "IfrytiumScrap_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 7f, 100); break; case "VineberrySeeds": case "FirCone": case "PineCone": case "OnionSeeds": case "BirchSeeds": case "BeechSeeds": case "Acorn": case "VineGreenSeeds": case "CarrotSeeds": case "TurnipSeeds": case "YggTreeSeed_bal": case "StrawSeeds_bal": case "RedwoodSeeds_bal": case "SwampTreeSeeds_bal": case "WaterLilySeeds_bal": case "WillowSeeds_bal": case "AcaiSeeds_bal": case "AppleSeeds_bal": case "BasicSeed_bal": case "CabbageSeeds_bal": case "CypressSeeds_bal": case "GarlicSeeds_bal": case "MapleSeeds_bal": case "PoplarSeeds_bal": editStackAndWeight(gameObject, 0.01f, 200); break; case "Cobalt_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 9f, 50); break; case "CobaltOre_bal": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 10f, 50); break; case "Frosteel_bal": editValueAndTeleport(gameObject, 0); editStackAndWeight(gameObject, 11f, 50); break; case "Coal": editStackAndWeight(gameObject, 1f, 200); break; case "DragonEgg": editValueAndTeleport(gameObject, 0, teleportable: false); editStackAndWeight(gameObject, 75f, 10); break; case "Honey": editStackAndWeight(gameObject, 0.2f, 100); break; case "Lingonberry_bal": case "Seaberries_bal": case "Cloudberry": case "Blueberries": case "Raspberry": editStackAndWeight(gameObject, 0.1f, 200); break; case "CryptKey": if (!Compatibility.IsLoaded()) { editStackAndWeight(gameObject, 0.25f, 50); } break; case "WoodNails_bal": editStackAndWeight(gameObject, 0.01f, 999); break; case "IronNails": gameObject.GetComponent().m_itemData.m_shared.m_icons[0] = ModResourceLoader.ironNails; editStackAndWeight(gameObject, 0.2f, 666); break; case "CorruptedEitr_bal": case "EnrichedEitr_bal": case "Eitr": editStackAndWeight(gameObject, 1f, 100); editValueAndTeleport(gameObject, 0, teleportable: false); break; case "TinNails_bal": case "CopperNails_bal": case "BronzeNails": case "SilverNails_bal": case "GoldNails_bal": case "FlametalNails_bal": case "BlackMetalNails_bal": case "DarksteelNails_bal": editStackAndWeight(gameObject, 0.2f, 666); break; case "TrollMeat_bal": case "DrakeMeat_bal": case "FenringMeat_bal": editStackAndWeight(gameObject, 2f, 50); break; case "SharkMeat_bal": case "RawSteak_bal": case "SteakCooked_bal": case "GoatMeat_bal": case "BearMeat": editStackAndWeight(gameObject, 1.25f, 50); break; case "BugMeat": case "HareMeat": editStackAndWeight(gameObject, 1.25f, 50); break; case "WolfMeat": editStackAndWeight(gameObject, 1.25f, 50); break; case "DeerMeat": editStackAndWeight(gameObject, 1.25f, 50); break; case "RawMeat": editStackAndWeight(gameObject, 1.25f, 50); break; case "DrakeSkin_bal": editStackAndWeight(gameObject, 1f, 100); break; case "NeckSkin_bal": editStackAndWeight(gameObject, 0.5f, 100); break; case "BoarHide_bal": case "DeerHide": editStackAndWeight(gameObject, 0.75f, 100); break; case "TrollHide": editStackAndWeight(gameObject, 1.5f, 100); break; case "WolfPelt": editStackAndWeight(gameObject, 1f, 100); break; case "LoxPelt": editStackAndWeight(gameObject, 1.25f, 100); break; case "BoneMawSerpentMeat": case "SerpentMeat": editStackAndWeight(gameObject, 5f, 50); break; case "CookedBoneMawSerpentMeat": case "SerpentMeatCooked": editStackAndWeight(gameObject, 4f, 50); break; case "RawCrowMeat_bal": case "ChickenMeat": editStackAndWeight(gameObject, 1f, 50); break; case "CookedBearMeat": editStackAndWeight(gameObject, 1f, 50); break; case "TrollMeatCooked_bal": case "DrakeMeatCooked_bal": case "FenringMeatCooked_bal": editStackAndWeight(gameObject, 1.5f, 50); break; case "SharkMeatCooked_bal": case "GoatMeatCooked_bal": case "CookedBugMeat": case "CookedHareMeat": editStackAndWeight(gameObject, 1f, 50); break; case "CookedWolfMeat": editStackAndWeight(gameObject, 1f, 50); break; case "CookedDeerMeat": editStackAndWeight(gameObject, 1f, 50); break; case "CookedRawMeat": editStackAndWeight(gameObject, 1f, 50); break; case "CookedCrowMeat_bal": case "CookedChickenMeat": editStackAndWeight(gameObject, 0.75f, 50); break; } } private void addAttackStatusEffect(GameObject gameObject, string name) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_attackStatusEffect = ObjectDB.instance.GetStatusEffect(BalrondHashCompat.StableHash(name)); } private void editSkeletonStaff(GameObject gameObject) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_attack.m_attackEitr = 44f; } private void editItemName(GameObject gameObject, string name) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_name = name; } private void editSpiritDamageStat(GameObject gameObject, int spiritDamage) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_damages.m_spirit = spiritDamage; if (((Object)gameObject).name == "skeleton_mace" || ((Object)gameObject).name == "imp_fireball_attack") { component.m_itemData.m_shared.m_damages.m_blunt += spiritDamage; } } private void editSurtlingDamageStat(GameObject gameObject, int fireDamage) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_damages.m_fire = fireDamage; component.m_itemData.m_shared.m_damages.m_blunt += fireDamage; } private void editTool(GameObject gameObject, int lvl) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_toolTier = lvl; } private void editLvevel(GameObject gameObject, int lvl, bool hasUpgrade = false) { if (hasUpgrade) { ItemDrop component = gameObject.GetComponent(); if (component.m_itemData.m_shared.m_maxQuality > 1) { component.m_itemData.m_shared.m_maxQuality = lvl; } } else { ItemDrop component2 = gameObject.GetComponent(); component2.m_itemData.m_shared.m_maxQuality = lvl; } } private void editPickaxeStone(GameObject gameObject, int durability, string name = "") { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_name = "Flint Pickaxe"; component.m_itemData.m_shared.m_maxDurability = 70f; component.m_itemData.m_shared.m_weight = 4f; } private void addConsumeStatusEffect(GameObject gameObject, string statusName) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_consumeStatusEffect = ObjectDB.m_instance.m_StatusEffects.Find((StatusEffect x) => ((Object)x).name == statusName); } private void editRemoveStatusEffect(GameObject gameObject) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_consumeStatusEffect = null; } private void editFoodStat(GameObject gameObject, int hp = -99, int stam = -99, int eitr = -99, int time = -99, float regen = -99f) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_food = ((hp == -99) ? component.m_itemData.m_shared.m_food : ((float)hp)); component.m_itemData.m_shared.m_foodStamina = ((stam == -99) ? component.m_itemData.m_shared.m_foodStamina : ((float)stam)); component.m_itemData.m_shared.m_foodEitr = ((eitr == -99) ? component.m_itemData.m_shared.m_foodEitr : ((float)eitr)); component.m_itemData.m_shared.m_foodRegen = ((regen == -99f) ? component.m_itemData.m_shared.m_foodRegen : regen); component.m_itemData.m_shared.m_foodBurnTime = ((time == -99) ? component.m_itemData.m_shared.m_foodBurnTime : ((float)time)); } private void editStackAndWeight(GameObject gameObject, float weight = -1f, int stack = 1) { ItemDrop component = gameObject.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("missing itemdrop on:" + ((Object)gameObject).name)); return; } component.m_itemData.m_shared.m_weight = ((weight == -1f) ? component.m_itemData.m_shared.m_weight : weight); component.m_itemData.m_shared.m_autoStack = true; component.m_itemData.m_shared.m_maxStackSize = stack; } private void editArmorSetEffect(GameObject gameObject, int setSize, string statusName, string setName) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_setName = setName; component.m_itemData.m_shared.m_setSize = setSize; component.m_itemData.m_shared.m_setStatusEffect = ObjectDB.instance.m_StatusEffects.Find((StatusEffect x) => ((Object)x).name == statusName); } private void editQualityValues(GameObject gameObject, float weightRatio = 0f, int quality = 4, float weight = -1f, float sppedDebuff = 0f, float equipeSpeed = -1f) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_weight = ((weight == -1f) ? ((float)component.m_itemData.m_shared.m_maxQuality) : weight); component.m_itemData.m_shared.m_scaleWeightByQuality = ((weightRatio == 0f) ? component.m_itemData.m_shared.m_scaleWeightByQuality : weightRatio); component.m_itemData.m_shared.m_equipDuration = ((equipeSpeed == -1f) ? component.m_itemData.m_shared.m_equipDuration : equipeSpeed); component.m_itemData.m_shared.m_movementModifier = sppedDebuff; component.m_itemData.m_shared.m_maxQuality = quality; } private void editDefense(GameObject gameObject, float blockPower = -1f, float blockPowerPerLevel = -1f, float deflectionForce = -1f, float deflectionForcePerLevel = 0f, float blockBonus = -1f) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_blockPower = ((blockPower == -1f) ? component.m_itemData.m_shared.m_blockPower : blockPower); component.m_itemData.m_shared.m_blockPowerPerLevel = ((blockPowerPerLevel == -1f) ? component.m_itemData.m_shared.m_blockPowerPerLevel : blockPowerPerLevel); component.m_itemData.m_shared.m_deflectionForce = ((deflectionForce == -1f) ? component.m_itemData.m_shared.m_deflectionForce : deflectionForce); component.m_itemData.m_shared.m_deflectionForcePerLevel = ((deflectionForcePerLevel == -1f) ? component.m_itemData.m_shared.m_deflectionForcePerLevel : deflectionForcePerLevel); component.m_itemData.m_shared.m_timedBlockBonus = ((blockBonus == -1f) ? component.m_itemData.m_shared.m_timedBlockBonus : blockBonus); } private void editArmor(GameObject gameObject, float armor = -1f, float armorPerLevel = -1f) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_shared.m_armor = ((armor == -1f) ? component.m_itemData.m_shared.m_armor : armor); component.m_itemData.m_shared.m_armorPerLevel = ((armorPerLevel == -1f) ? component.m_itemData.m_shared.m_armorPerLevel : armorPerLevel); } private void editDurability(GameObject gameObject, float durability = -1f, float durabilityPerLevel = -1f, float useDrain = -1f) { ItemDrop component = gameObject.GetComponent(); component.m_itemData.m_durability = ((durability == -1f) ? component.m_itemData.m_durability : durability); component.m_itemData.m_shared.m_durabilityPerLevel = ((durabilityPerLevel == -1f) ? component.m_itemData.m_shared.m_durabilityPerLevel : durabilityPerLevel); component.m_itemData.m_shared.m_useDurabilityDrain = ((useDrain == -1f) ? component.m_itemData.m_shared.m_useDurabilityDrain : useDrain); } private void editValueAndTeleport(GameObject gameObject, int newValue = -1, bool teleportable = true) { ItemDrop component = gameObject.GetComponent(); int value = component.m_itemData.m_shared.m_value; component.m_itemData.m_shared.m_value = ((newValue != -1) ? newValue : value); component.m_itemData.m_shared.m_teleportable = teleportable; } private void eidtTrophyValue(GameObject gameObject) { ItemDrop component = gameObject.GetComponent(); switch (((Object)gameObject).name) { case "TrophyKelpie_bal": component.m_itemData.m_shared.m_value = 5; break; case "TrophyAbomination": component.m_itemData.m_shared.m_value = 12; break; case "TrophyAbominationNew_bal": component.m_itemData.m_shared.m_value = 12; break; case "TrophyBearNew_bal": component.m_itemData.m_shared.m_value = 5; break; case "TrophyBlob": component.m_itemData.m_shared.m_value = 6; break; case "TrophyBoar": component.m_itemData.m_shared.m_value = 2; break; case "TrophyBonemass": component.m_itemData.m_shared.m_value = 60; break; case "TrophyCultist": component.m_itemData.m_shared.m_value = 10; break; case "TrophyDeathsquito": component.m_itemData.m_shared.m_value = 10; break; case "TrophyDeer": component.m_itemData.m_shared.m_value = 2; break; case "TrophyDevilWasp_bal": component.m_itemData.m_shared.m_value = 5; break; case "TrophyDragonQueen": component.m_itemData.m_shared.m_value = 80; break; case "TrophyDraugr": component.m_itemData.m_shared.m_value = 6; break; case "TrophyDraugrElite": component.m_itemData.m_shared.m_value = 8; break; case "TrophyDvergr": component.m_itemData.m_shared.m_value = 10; break; case "TrophyEikthyr": component.m_itemData.m_shared.m_value = 20; break; case "TrophyFenring": component.m_itemData.m_shared.m_value = 10; break; case "TrophyForsake_baln": component.m_itemData.m_shared.m_value = 5; break; case "TrophyFrostTroll": component.m_itemData.m_shared.m_value = 5; break; case "TrophyGjall": component.m_itemData.m_shared.m_value = 20; break; case "TrophyGoat_bal": component.m_itemData.m_shared.m_value = 5; break; case "TrophyGoblin": component.m_itemData.m_shared.m_value = 10; break; case "TrophyGoblinBrute": component.m_itemData.m_shared.m_value = 15; break; case "TrophyGoblinKing": component.m_itemData.m_shared.m_value = 100; break; case "TrophyGoblinShaman": component.m_itemData.m_shared.m_value = 15; break; case "TrophyGreydwarf": component.m_itemData.m_shared.m_value = 4; break; case "TrophyGreydwarfBrute": component.m_itemData.m_shared.m_value = 6; break; case "TrophyGreydwarfShaman": component.m_itemData.m_shared.m_value = 5; break; case "TrophyGreywatcher_bal": component.m_itemData.m_shared.m_value = 8; break; case "TrophyGrowth": component.m_itemData.m_shared.m_value = 8; break; case "TrophyHare": component.m_itemData.m_shared.m_value = 5; break; case "TrophyHatchling": component.m_itemData.m_shared.m_value = 9; break; case "TrophyHaugbui_bal": component.m_itemData.m_shared.m_value = 10; break; case "TrophyLeech": component.m_itemData.m_shared.m_value = 7; break; case "TrophyLox": component.m_itemData.m_shared.m_value = 9; break; case "TrophyNeck": component.m_itemData.m_shared.m_value = 2; break; case "TrophyNeckBrute": component.m_itemData.m_shared.m_value = 3; break; case "TrophyObsidianCrab_bal": component.m_itemData.m_shared.m_value = 6; break; case "TrophySeeker": component.m_itemData.m_shared.m_value = 10; break; case "TrophySeekerBrute": component.m_itemData.m_shared.m_value = 15; break; case "TrophySeekerQueen": component.m_itemData.m_shared.m_value = 120; break; case "TrophySerpent": component.m_itemData.m_shared.m_value = 20; break; case "TrophySGolem": component.m_itemData.m_shared.m_value = 20; break; case "TrophyShark_bal": component.m_itemData.m_shared.m_value = 7; break; case "TrophySkeleton": component.m_itemData.m_shared.m_value = 4; break; case "TrophySkeletonPoison": component.m_itemData.m_shared.m_value = 6; break; case "TrophySouling": component.m_itemData.m_shared.m_value = 5; break; case "TrophySpectre_bal": component.m_itemData.m_shared.m_value = 12; break; case "TrophyStormdrake_bal": component.m_itemData.m_shared.m_value = 11; break; case "TrophySurtling": component.m_itemData.m_shared.m_value = 5; break; case "TrophyTheElder": component.m_itemData.m_shared.m_value = 40; break; case "TrophyTick": component.m_itemData.m_shared.m_value = 4; break; case "TrophyUlv": component.m_itemData.m_shared.m_value = 5; break; case "TrophyVarsvin_bal": component.m_itemData.m_shared.m_value = 10; break; case "TrophyVarsvinBrute_bal": component.m_itemData.m_shared.m_value = 15; break; case "TrophyVarsvinHunter_bal": component.m_itemData.m_shared.m_value = 12; break; case "TrophyWolf": component.m_itemData.m_shared.m_value = 5; break; case "TrophyWraith": component.m_itemData.m_shared.m_value = 10; break; } } } public class RecipeFactory { private class RustedRecipeData { public string NameSuffix; public CraftingStation Station; public int StationLevel; public int Amount; public bool RequireOne = false; public List> Ingredients; } private class MincedMeatRecipeData { public string GroupName; public List> Ingredients; } private class CookedMeatRecipeData { public string ResultItemName; public int Amount; public int StationLevel; public List> Ingredients; } private class ScrapMetalRecipeData { public string MetalName; public string ScrapName; public int ScrapAmount; public int CoalAmount; public int CharredBoneAmount; public int EitrAmount; public CraftingStation Station; public int StationLevel = 1; } private class ShredLeatherRecipeData { public string RecipeName; public int StationLevel; public int OutputAmount; public List> Ingredients; } private List pieces; private List items; private List newItems; public List recipes = new List(); private Dictionary _itemCache = new Dictionary(); private readonly string[] toRecipe = new string[165] { "CorruptedEitr_bal", "Cupronickel_bal", "CupronickelPlate_bal", "BundleBlackforgeBench_bal", "BundleConstructionBench_bal", "BundleForgeBench_bal", "BundleIronworksBench_bal", "BundleRuneforgeBench_bal", "BundleStoncutterBench_bal", "BundleArtisanBench_bal", "WoodBundle_bal", "CeramicMoldBundle_bal", "ClayMoldBundle_bal", "Bandages_bal", "FirstAidKit_bal", "TeaMint_bal", "StrawBundle_bal", "AxeCopper_bal", "MaceCopper_bal", "HammerMythic_bal", "DarksteelNails_bal", "BloodyVial_bal", "Amethyst_bal", "Sapphire_bal", "Emerald_bal", "Opal_bal", "SilverScrap_bal", "Onyx_bal", "GemChunks_bal", "WispCore_bal", "WaterJugEmpty_bal", "EnrichedEitr_bal", "VineBerryJuiceBase_bal", "FruitPunchBase_bal", "BlackBerryJuiceBase_bal", "CabbageSoup_bal", "ArrowBlunt_bal", "BoltBlunt_bal", "BoltSilver_bal", "BoltFire_bal", "BoltThunder_bal", "BoltChitin_bal", "NorthernFur_bal", "SpiceSet_bal", "RustedScrap_bal", "BrassChain_bal", "BeltForester_bal", "BeltVidar_bal", "BeltAssasin_bal", "BeltMountaineer_bal", "BeltSailor_bal", "HelmetCrown_bal", "KingMug_bal", "StrawThread_bal", "PaintBucket_bal", "PickaxeFlametal_bal", "HammerBlackmetal_bal", "BlackMetalCultivator_bal", "BlackMetalHoe_bal", "AppleVinegar_bal", "FishWrapsUncooked_bal", "HammerIron_bal", "HammerDverger_bal", "GoldBar_bal", "Peningar_bal", "SilverPouch_bal", "CarvedDeerSkull_bal", "MedPack_bal", "RawSilk_bal", "DragonSoul_bal", "ThornHeart_bal", "TormentedSoul_bal", "DeadEgo_bal", "BellMetal_bal", "Frosteel_bal", "MoltenSteel_bal", "Amethysteel_bal", "DarkSteel_bal", "WhiteMetal_bal", "Electrum_bal", "EmberWood_bal", "InfusedCarapace_bal", "CarvedCarcass_bal", "FenringInsygnia_bal", "CabbageLeaf_bal", "CarvedWood_bal", "PowderedSpiritShard_bal", "SawBlade_bal", "PatchworkBundle_bal", "WoodNails_bal", "BirdFeed_bal", "AppleSeeds_bal", "TarBase_bal", "OilBase_bal", "CeramicMold_bal", "ArrowChitin_bal", "ArrowBone_bal", "ArrowBlizzard_bal", "ArrowFlametal_bal", "StuffedDeerBody_bal", "NumbMeal_bal", "MeadBase_bal", "ClayPot_bal", "WaterJug_bal", "WaterJugEnchanted_bal", "ApplePieUncooked_bal", "AshlandCurry_bal", "BloodfruitSoup_bal", "BloodyBearJerky_bal", "BloodyCreamPie_bal", "BlueberryPieUncooked_bal", "Breakfast_bal", "Burger_bal", "ChickenMarsala_bal", "ChickenNuggets_bal", "DragonfireBarbecue_bal", "FishSkewer_bal", "EitrPills_bal", "FruitSalad_bal", "GrilledShrooms_bal", "HappyMeal_bal", "HoneyGlazedApple_bal", "IceBerryPancake_bal", "KingsJam_bal", "Liverwurst_bal", "MagmaCoctailBase_bal", "MeadBaseWhiteCheese_bal", "SeaFoodPlatter_bal", "SpicedBreadedBatwingsUncooked_bal", "SpicyBurger_bal", "SpiecedDrakeChop_bal", "SurstrommingBase_bal", "SwampSkause_bal", "VegetablePuree_bal", "VegetableSoup_bal", "WinterStew_bal", "CarrotFries_bal", "RostedTrollBits_bal", "SurtlingCoreCasing_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", "CookedMeatScrap_bal", "Bulion_bal", "HelmetLeatherCap_bal", "HelmetBronzeHorned_bal", "BundlePortal_bal", "BundlePortalStone_bal", "ClayBrickMold_bal", "WoodBucket_bal", "BundleHut_bal", "TernarySilver_bal", "SwordFakeSilver_Bal", "MaceFakeSilver_bal", "BundleCart_bal", "BlackSkin_bal" }; public List createRecipes(List items, List newItems) { this.items = items; this.newItems = newItems; pieces = ObjectDB.instance.GetItemPrefab("Hammer").GetComponent().m_itemData.m_shared.m_buildPieces.m_pieces; TableMapper.setupTables(null, pieces); CraftingStation forge = TableMapper.forge; int minStationLevel = 3; foreach (GameObject newItem in newItems) { if (toRecipe.Contains(((Object)newItem).name)) { if (((Object)newItem).name == "SledgeStagbreakerNEW") { Debug.LogWarning((object)"I found new Stagbreaker"); } Recipe val = ScriptableObject.CreateInstance(); val.m_craftingStation = forge; val.m_repairStation = forge; val.m_minStationLevel = minStationLevel; val = createResources(newItem, val); recipes.Add(val); } } meatScraps1(); createCookedMeatRecipes(); createMincedMeatRecipes(); shredLeatherRecipes(); CreateScrapMetalRecipes(isFiveVersion: false); CreateScrapMetalRecipes(isFiveVersion: true); createRustedRecipes(); createCorruptedEitrRecipe(); createCorruptedSilverRecipe(); return recipes; } private void createTutorialInfoForRecipes() { string text = ""; foreach (Recipe recipe in recipes) { string text2 = "\nName: " + ((Component)recipe.m_item).GetComponent().m_itemData.m_shared.m_name; string text3 = "\nAmount: " + recipe.m_amount + "x"; string text4 = "\nCost: "; Requirement[] resources = recipe.m_resources; foreach (Requirement val in resources) { string name = ((Component)val.m_resItem).GetComponent().m_itemData.m_shared.m_name; string text5 = val.m_amount + "x"; string text6 = ((val.m_amountPerLevel > 0) ? (" / " + val.m_amountPerLevel + "x") : ""); string text7 = "\n" + name + ":" + text5 + text6; text4 += text7; } string text8 = text2 + text3 + text4 + "\n"; text += text8; } buildRecipeStationTutorialTag(text); } private void buildRecipeStationTutorialTag(string tutorialExtra, string tag = "workbench") { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown string text = "\n BALROND AMAZING NATURE: "; TutorialText val = new TutorialText(); val.m_name = "BAN Recipes"; val.m_globalKeyTrigger = "AmazingNature Recipes"; val.m_tutorialTrigger = tag; val.m_topic = "BAN-Recipes"; val.m_label = "BAN-Recipes"; val.m_isMunin = true; val.m_text = text + tutorialExtra; ConversionChanges.m_texts.Add(val); } private Recipe createCorruptedEitrRecipe() { Recipe val = ScriptableObject.CreateInstance(); val.m_craftingStation = TableMapper.magetable; ((Object)val).name = "Recipe_CorruptedEitr_bal"; val.m_repairStation = val.m_craftingStation; val.m_enabled = true; val.m_amount = 5; val.m_minStationLevel = 1; val.m_item = FindItem("Eitr").GetComponent(); List list = new List(); list.Add(createReq("Thistle", 3, 0)); list.Add(createReq("DragonTear", 1, 0)); list.Add(createReq("CorruptedEitr_bal", 10, 0)); val.m_resources = list.ToArray(); recipes.Add(val); return val; } private Recipe createCorruptedSilverRecipe() { Recipe val = ScriptableObject.CreateInstance(); val.m_craftingStation = TableMapper.artisian; ((Object)val).name = "Recipe_CorruptedSilver_bal"; val.m_repairStation = val.m_craftingStation; val.m_enabled = true; val.m_amount = 2; val.m_minStationLevel = 1; val.m_item = FindItem("Silver").GetComponent(); List list = new List(); list.Add(createReq("TernarySilver_bal", 2, 0)); list.Add(createReq("SilverScrap_bal", 1, 0)); val.m_resources = list.ToArray(); recipes.Add(val); return val; } private void createRustedRecipes() { string[] array = new string[19] { "Lead_bal", "Nickel_bal", "Tin", "Iron", "Copper", "Silver", "Coins", "JuteRed", "JuteBlue", "DarksteelScrap_bal", "BrassScrap_bal", "Chain", "Stone", "Coal", "Bloodbag", "CarvedDeerSkull_bal", "CarvedWood_bal", "Ruby", "BeltStrength" }; Dictionary dictionary = new Dictionary { { "BeltStrength", new RustedRecipeData { NameSuffix = "Recipe_BeltStrength", Station = TableMapper.workbench, StationLevel = 2, Amount = 1, Ingredients = new List> { Tuple.Create("DeerHide", 10), Tuple.Create("MeadStrength", 2), Tuple.Create("BellMetal_bal", 6), Tuple.Create("BjornHide", 6) } } }, { "CarvedWood_bal", new RustedRecipeData { NameSuffix = "Recipe_CarvedWoodAlt", Station = TableMapper.heavyWorkbench, StationLevel = 1, Amount = 6, Ingredients = new List> { Tuple.Create("Wood", 7), Tuple.Create("Flint", 2) } } }, { "CarvedDeerSkull_bal", new RustedRecipeData { NameSuffix = "Recipe_CarvedStagSkull", Station = TableMapper.workbench, StationLevel = 2, Amount = 1, Ingredients = new List> { Tuple.Create("TrophyStag_bal", 1), Tuple.Create("LeatherScraps", 1), Tuple.Create("Raspberry", 1), Tuple.Create("Flint", 1) } } }, { "Ruby", new RustedRecipeData { NameSuffix = "Recipe_CrushedLimeStone", Station = TableMapper.artisian, StationLevel = 1, Amount = 1, RequireOne = false, Ingredients = new List> { Tuple.Create("GemChunks_bal", 7) } } }, { "Coal", new RustedRecipeData { NameSuffix = "Recipe_CrushedCoalCoal", Station = TableMapper.workbench, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("CoalPowder_bal", 4), Tuple.Create("Resin", 1) } } }, { "Stone", new RustedRecipeData { NameSuffix = "Recipe_CrushedLimeStone", Station = TableMapper.stoneCutter, StationLevel = 1, Amount = 3, RequireOne = true, Ingredients = new List> { Tuple.Create("Gabro_bal", 2), Tuple.Create("LimeStone_bal", 2), Tuple.Create("Flint", 3) } } }, { "Bloodbag", new RustedRecipeData { NameSuffix = "Recipe_SmallSackBloodbag", Station = TableMapper.cauldron, StationLevel = 2, Amount = 1, Ingredients = new List> { Tuple.Create("SmallBloodSack_bal", 5), Tuple.Create("WaterJug_bal", 1) } } }, { "JuteRed", new RustedRecipeData { NameSuffix = "Recipe_WovenJuteRed", Station = TableMapper.artisian, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("JuteThread_bal", 1), Tuple.Create("Wood", 1), Tuple.Create("WolfHairBundle", 1), Tuple.Create("Raspberry", 3) } } }, { "JuteBlue", new RustedRecipeData { NameSuffix = "Recipe_WovenJuteBlue", Station = TableMapper.artisian, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("JuteThread_bal", 1), Tuple.Create("WolfHairBundle", 1), Tuple.Create("Wood", 1), Tuple.Create("Blueberries", 3) } } }, { "Iron", new RustedRecipeData { NameSuffix = "Recipe_RustedIron", Station = TableMapper.smeltworks, StationLevel = 2, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 10), Tuple.Create("Coal", 8) } } }, { "Lead_bal", new RustedRecipeData { NameSuffix = "Recipe_RustedLead", Station = TableMapper.smeltworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 4), Tuple.Create("Coal", 2) } } }, { "Nickel_bal", new RustedRecipeData { NameSuffix = "Recipe_RustedNickel", Station = TableMapper.smeltworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 8), Tuple.Create("Coal", 7) } } }, { "Zinc_bal", new RustedRecipeData { NameSuffix = "Recipe_RustedZinc", Station = TableMapper.smeltworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 6), Tuple.Create("Coal", 5) } } }, { "Copper", new RustedRecipeData { NameSuffix = "Recipe_RustedCopper", Station = TableMapper.smeltworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 5), Tuple.Create("Coal", 4) } } }, { "Tin", new RustedRecipeData { NameSuffix = "Recipe_RustedTin", Station = TableMapper.smeltworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 4), Tuple.Create("Coal", 3) } } }, { "Coins", new RustedRecipeData { NameSuffix = "Recipe_GoldCoinsCoins", Station = TableMapper.artisian, StationLevel = 1, Amount = 100, Ingredients = new List> { Tuple.Create("GoldBar_bal", 1), Tuple.Create("Coal", 3) } } }, { "Chain", new RustedRecipeData { NameSuffix = "Recipe_DarksteelChain", Station = TableMapper.ironworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("DarkSteel_bal", 2), Tuple.Create("Coal", 3) } } }, { "Silver", new RustedRecipeData { NameSuffix = "Recipe_SilverBarBogSilver", Station = TableMapper.smeltworks, StationLevel = 2, Amount = 2, Ingredients = new List> { Tuple.Create("TernarySilver_bal", 3), Tuple.Create("Coal", 6) } } }, { "DarksteelScrap_bal", new RustedRecipeData { NameSuffix = "Recipe_RustedBDarksteelScrap", Station = TableMapper.smeltworks, StationLevel = 2, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 11), Tuple.Create("Coal", 9) } } }, { "BrassScrap_bal", new RustedRecipeData { NameSuffix = "Recipe_RustedBrassScrap", Station = TableMapper.smeltworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 7), Tuple.Create("Coal", 6) } } }, { "BronzeScrap", new RustedRecipeData { NameSuffix = "Recipe_RustedBronzeScrap", Station = TableMapper.smeltworks, StationLevel = 1, Amount = 1, Ingredients = new List> { Tuple.Create("RustedScrap_bal", 5), Tuple.Create("Coal", 4) } } } }; string[] array2 = array; foreach (string text in array2) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(BalrondHashCompat.StableHash(text)); if ((Object)(object)itemPrefab == (Object)null) { Debug.LogWarning((object)("Item not found: " + text)); continue; } ItemDrop component = itemPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("ItemDrop missing for: " + text)); continue; } if (!dictionary.TryGetValue(text, out var value)) { Debug.LogWarning((object)("No recipe data for item: " + text)); continue; } Recipe val = ScriptableObject.CreateInstance(); ((Object)val).name = value.NameSuffix; val.m_item = component; val.m_enabled = true; val.m_amount = value.Amount; val.m_minStationLevel = value.StationLevel; val.m_craftingStation = value.Station; val.m_repairStation = value.Station; val.m_requireOnlyOneIngredient = value.RequireOne; List list = new List(); for (int j = 0; j < value.Ingredients.Count; j++) { Tuple tuple = value.Ingredients[j]; Requirement val2 = createReq(tuple.Item1, tuple.Item2, 0); if (val2 != null) { list.Add(val2); } } val.m_resources = list.ToArray(); recipes.Add(val); } } private void createMincedMeatRecipes() { List list = new List { new MincedMeatRecipeData { GroupName = "Animal", Ingredients = new List> { Tuple.Create("RawMeat", 2), Tuple.Create("WolfMeat", 2), Tuple.Create("DeerMeat", 2), Tuple.Create("GoatMeat_bal", 2) } }, new MincedMeatRecipeData { GroupName = "Lizard", Ingredients = new List> { Tuple.Create("NeckTail", 2), Tuple.Create("AsksvinMeat", 2), Tuple.Create("DrakeMeat_bal", 2), Tuple.Create("LoxMeat", 2) } }, new MincedMeatRecipeData { GroupName = "Bird", Ingredients = new List> { Tuple.Create("RawCrowMeat_bal", 2), Tuple.Create("ChickenMeat", 2), Tuple.Create("VoltureMeat", 2), Tuple.Create("HareMeat", 2) } } }; GameObject? obj = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == "MincedMeat_bal"); ItemDrop val = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"MincedMeat_bal not found in ObjectDB."); return; } foreach (MincedMeatRecipeData item in list) { Recipe val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "Recipe_ScrapForge" + item.GroupName; val2.m_item = val; val2.m_enabled = true; val2.m_amount = 5; val2.m_minStationLevel = 1; val2.m_craftingStation = TableMapper.foodtable; val2.m_repairStation = TableMapper.foodtable; List list2 = new List(); for (int i = 0; i < item.Ingredients.Count; i++) { Tuple tuple = item.Ingredients[i]; Requirement val3 = createReq(tuple.Item1, tuple.Item2, 0); if (val3 != null) { list2.Add(val3); } } if (list2.Count > 0) { val2.m_resources = list2.ToArray(); recipes.Add(val2); } else { Debug.LogWarning((object)("Skipped recipe due to missing ingredients: " + ((Object)val2).name)); } } } private void createCookedMeatRecipes() { List list = new List { new CookedMeatRecipeData { ResultItemName = "SteakCooked_bal", Amount = 3, StationLevel = 1, Ingredients = new List> { Tuple.Create("RawSteak_bal", 3), Tuple.Create("WaterJug_bal", 1), Tuple.Create("Coal", 5) } }, new CookedMeatRecipeData { ResultItemName = "FishCooked", Amount = 5, StationLevel = 1, Ingredients = new List> { Tuple.Create("FishRaw", 5), Tuple.Create("WaterJug_bal", 1), Tuple.Create("Coal", 5) } }, new CookedMeatRecipeData { ResultItemName = "NeckTailGrilled", Amount = 5, StationLevel = 1, Ingredients = new List> { Tuple.Create("NeckTail", 5), Tuple.Create("WaterJug_bal", 1), Tuple.Create("Coal", 6) } }, new CookedMeatRecipeData { ResultItemName = "CookedMeat", Amount = 4, StationLevel = 1, Ingredients = new List> { Tuple.Create("RawMeat", 4), Tuple.Create("WaterJug_bal", 1), Tuple.Create("Coal", 7) } }, new CookedMeatRecipeData { ResultItemName = "CookedWolfMeat", Amount = 3, StationLevel = 2, Ingredients = new List> { Tuple.Create("WolfMeat", 3), Tuple.Create("Coal", 7) } }, new CookedMeatRecipeData { ResultItemName = "CookedDeerMeat", Amount = 3, StationLevel = 1, Ingredients = new List> { Tuple.Create("DeerMeat", 3), Tuple.Create("WaterJug_bal", 1), Tuple.Create("Coal", 5) } }, new CookedMeatRecipeData { ResultItemName = "GoatMeatCooked_bal", Amount = 2, StationLevel = 2, Ingredients = new List> { Tuple.Create("GoatMeat_bal", 2), Tuple.Create("WaterJug_bal", 1), Tuple.Create("Coal", 4) } } }; foreach (CookedMeatRecipeData data in list) { GameObject val = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == data.ResultItemName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Skipping invalid cooked meat item: " + data.ResultItemName)); continue; } ItemDrop component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("ItemDrop missing on prefab: " + data.ResultItemName)); continue; } Recipe val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "Recipe_Grill" + data.ResultItemName; val2.m_item = component; val2.m_enabled = true; val2.m_amount = data.Amount; val2.m_minStationLevel = data.StationLevel; val2.m_craftingStation = TableMapper.grill; val2.m_repairStation = TableMapper.grill; List list2 = new List(); HashSet hashSet = new HashSet(); foreach (Tuple ingredient in data.Ingredients) { Requirement val3 = createReq(ingredient.Item1, ingredient.Item2, 0); if (val3 != null && hashSet.Add(val3.m_resItem)) { list2.Add(val3); } } if (list2.Count > 0) { val2.m_resources = list2.ToArray(); recipes.Add(val2); } else { Debug.LogWarning((object)("Recipe skipped due to missing requirements: " + ((Object)val2).name)); } } } private List GetScrapMetalRecipes(bool isFiveVersion) { int num = ((!isFiveVersion) ? 1 : 5); CraftingStation smeltworks = TableMapper.smeltworks; return new List { new ScrapMetalRecipeData { MetalName = "Copper", ScrapName = "CopperScrap", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "Zinc_bal", ScrapName = "ZincScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "Bronze", ScrapName = "BronzeScrap", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "Iron", ScrapName = "IronScrap", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "Silver", ScrapName = "SilverScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "BlackMetal", ScrapName = "BlackMetalScrap", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "GoldBar_bal", ScrapName = "GoldScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "Electrum_bal", ScrapName = "ElectrumScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 43), Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "Tin", ScrapName = "TinScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 12 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "Nickel_bal", ScrapName = "NickelScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "BellMetal_bal", ScrapName = "BrassScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "DarkSteel_bal", ScrapName = "DarksteelScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), Station = smeltworks, StationLevel = 1 }, new ScrapMetalRecipeData { MetalName = "Amethysteel_bal", ScrapName = "AmethysteelScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 12 : 3), EitrAmount = ((!isFiveVersion) ? 1 : 2), Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "Cobalt_bal", ScrapName = "CobaltScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 12 : 3), Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "Frosteel_bal", ScrapName = "FrosteelScrap_bal", ScrapAmount = 2 * num, CoalAmount = 4 * num, Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "WhiteMetal_bal", ScrapName = "WhiteMetalScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 12 : 3), Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "Ferroboron_bal", ScrapName = "FerroboronScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 12 : 3), Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "Flametal", ScrapName = "IfrytiumScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 12 : 3), CharredBoneAmount = 2 * num, Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "FlametalNew", ScrapName = "FlametalScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 12 : 3), CharredBoneAmount = 2 * num, Station = smeltworks, StationLevel = 2 }, new ScrapMetalRecipeData { MetalName = "MoltenSteel_bal", ScrapName = "MoltenSteelScrap_bal", ScrapAmount = 2 * num, CoalAmount = (isFiveVersion ? 13 : 3), CharredBoneAmount = 2 * num, Station = smeltworks, StationLevel = 2 } }; } private void CreateScrapMetalRecipes(bool isFiveVersion) { List scrapMetalRecipes = GetScrapMetalRecipes(isFiveVersion); int amount = ((!isFiveVersion) ? 1 : 5); foreach (ScrapMetalRecipeData data in scrapMetalRecipes) { GameObject val = ObjectDB.instance.m_items.Find((GameObject x) => ((Object)x).name == data.MetalName); if ((Object)(object)val == (Object)null) { continue; } ItemDrop component = val.GetComponent(); if (!((Object)(object)component == (Object)null)) { Recipe val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = "Recipe_ScrapForge" + (isFiveVersion ? "5" : "") + data.MetalName; val2.m_item = component; val2.m_enabled = true; val2.m_amount = amount; val2.m_minStationLevel = data.StationLevel; val2.m_craftingStation = data.Station; val2.m_repairStation = data.Station; List list = new List(); Requirement val3 = createReq(data.ScrapName, data.ScrapAmount, 0); Requirement val4 = createReq("Coal", data.CoalAmount, 0, CommonItemReferences.coal); if (val3 != null) { list.Add(val3); } if (val4 != null) { list.Add(val4); } if (data.CharredBoneAmount > 0) { list.Add(createReq("CharredBone", data.CharredBoneAmount, 0)); } if (data.EitrAmount > 0) { list.Add(createReq("Eitr", data.EitrAmount, 0)); } val2.m_resources = list.ToArray(); recipes.Add(val2); } } } private void meatScraps1() { Recipe val = ScriptableObject.CreateInstance(); val.m_item = items.Find((GameObject x) => ((Object)x).name == "MeatScrap_bal").GetComponent(); ((Object)val).name = "Recipe_ShredMeatA"; val.m_craftingStation = TableMapper.workbench; val.m_repairStation = TableMapper.workbench; val.m_minStationLevel = 2; val.m_amount = 5; List list = new List(); list.Add(createReq("NeckTail", 4, 0)); list.Add(createReq("DeerMeat", 4, 0)); list.Add(createReq("RawMeat", 4, 0)); list.Add(createReq("WolfMeat", 3, 0)); list.Add(createReq("GoatMeat_bal", 3, 0)); list.Add(createReq("HareMeat", 3, 0)); list.Add(createReq("AsksvinMeat", 2, 0)); list.Add(createReq("DrakeMeat_bal", 2, 0)); list.Add(createReq("LoxMeat", 2, 0)); list.Add(createReq("RawSteak_bal", 3, 0)); val.m_resources = list.ToArray(); val.m_requireOnlyOneIngredient = true; recipes.Add(val); } private void shredLeatherRecipes() { List list = new List { new ShredLeatherRecipeData { RecipeName = "Recipe_ShredLeatherBalA", StationLevel = 2, OutputAmount = 5, Ingredients = new List> { Tuple.Create("NeckSkin_bal", 3), Tuple.Create("BoarHide_bal", 2), Tuple.Create("DeerHide", 2) } }, new ShredLeatherRecipeData { RecipeName = "Recipe_ShredLeatherBalB", StationLevel = 2, OutputAmount = 6, Ingredients = new List> { Tuple.Create("WolfPelt", 2), Tuple.Create("ScaleHide", 2) } }, new ShredLeatherRecipeData { RecipeName = "Recipe_ShredLeatherBalC", StationLevel = 2, OutputAmount = 7, Ingredients = new List> { Tuple.Create("TrollHide", 2), Tuple.Create("LoxPelt", 2), Tuple.Create("AskHide", 1) } } }; GameObject? obj = items.Find((GameObject x) => ((Object)x).name == "LeatherScraps"); ItemDrop val = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)"LeatherScraps item not found."); return; } foreach (ShredLeatherRecipeData item in list) { Recipe val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = item.RecipeName; val2.m_item = val; val2.m_enabled = true; val2.m_craftingStation = TableMapper.workbench; val2.m_repairStation = TableMapper.workbench; val2.m_minStationLevel = item.StationLevel; val2.m_amount = item.OutputAmount; val2.m_requireOnlyOneIngredient = true; List list2 = new List(); for (int i = 0; i < item.Ingredients.Count; i++) { Tuple tuple = item.Ingredients[i]; Requirement val3 = createReq(tuple.Item1, tuple.Item2, 0); if (val3 != null) { list2.Add(val3); } } val2.m_resources = list2.ToArray(); recipes.Add(val2); } } private Recipe createResources(GameObject item, Recipe newRecipe) { ((Object)newRecipe).name = "Recipe_" + ((Object)item).name; newRecipe.m_item = item.GetComponent(); newRecipe.m_amount = 1; newRecipe.m_enabled = true; List list = new List(); switch (((Object)item).name) { case "CorruptedEitr_bal": newRecipe.m_craftingStation = TableMapper.magetable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("Bloodbag", 1, 0)); list.Add(createReq("Eitr", 1, 0)); list.Add(createReq("Wisp", 2, 0)); break; case "BundleBlackforgeBench_bal": newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 1; list.Add(createReq("BlackMarble", 10, 0)); list.Add(createReq("BellMetal_bal", 10, 0)); list.Add(createReq("YggdrasilWood", 10, 0)); list.Add(createReq("WispCore_bal", 3, 0)); break; case "BundleConstructionBench_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 1; list.Add(createReq("LeatherScraps", 6, 0)); list.Add(createReq("CarvedWood_bal", 10, 0)); list.Add(createReq("StrawThread_bal", 8, 0)); list.Add(createReq("WoodNails_bal", 16, 0)); break; case "BundleForgeBench_bal": newRecipe.m_craftingStation = TableMapper.heavyWorkbench; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("RoundLog", 10, 0)); list.Add(createReq("Copper", 6, 0)); list.Add(createReq("Coal", 6, 0)); list.Add(createReq("Stone", 10, 0)); break; case "BundleIronworksBench_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("EmberWood_bal", 6, 0)); list.Add(createReq("IronNails", 66, 0)); list.Add(createReq("Stone", 14, 0)); list.Add(createReq("BellMetal_bal", 6, 0)); break; case "BundleRuneforgeBench_bal": newRecipe.m_craftingStation = TableMapper.blackforge; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 1; list.Add(createReq("Cobalt_bal", 10, 0)); list.Add(createReq("Crystal", 10, 0)); list.Add(createReq("FaderDrop", 1, 0)); list.Add(createReq("Grausten", 20, 0)); list.Add(createReq("Lead_bal", 5, 0)); break; case "BundleStoncutterBench_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Cupronickel_bal", 4, 0)); list.Add(createReq("Stone", 10, 0)); list.Add(createReq("RoundLog", 10, 0)); list.Add(createReq("BronzeNails", 22, 0)); break; case "BundleArtisanBench_bal": newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Chain", 3, 0)); list.Add(createReq("Crystal", 6, 0)); list.Add(createReq("FineWood", 10, 0)); list.Add(createReq("DragonTear", 1, 0)); list.Add(createReq("Lead_bal", 5, 0)); break; case "BundleCart_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("WoodNails_bal", 32, 0)); list.Add(createReq("CarvedWood_bal", 8, 0)); list.Add(createReq("StrawThread_bal", 2, 0)); break; case "BloodyVial_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("CorruptedEitr_bal", 3, 0)); list.Add(createReq("GemChunks_bal", 3, 0)); list.Add(createReq("SmallBloodSack_bal", 3, 0)); list.Add(createReq("Sage_bal", 1, 0)); break; case "EitrPills_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 1; list.Add(createReq("Eitr", 2, 0)); list.Add(createReq("GemChunks_bal", 1, 0)); list.Add(createReq("Mint_bal", 1, 0)); list.Add(createReq("GreydwarfEye", 7, 0)); break; case "Amethyst_bal": case "Sapphire_bal": case "Emerald_bal": case "Opal_bal": case "Onyx_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("GemChunks_bal", 7, 0)); break; case "GemChunks_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 36; list.Add(createReq("Amethyst_bal", 1, 0)); list.Add(createReq("Sapphire_bal", 1, 0)); list.Add(createReq("Emerald_bal", 1, 0)); list.Add(createReq("Opal_bal", 1, 0)); list.Add(createReq("Onyx_bal", 1, 0)); list.Add(createReq("Ruby", 1, 0)); break; case "SurtlingCoreCasing_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 3; list.Add(createReq("Coal", 6, 0, CommonItemReferences.coal)); list.Add(createReq("Lead_bal", 1, 0, CommonItemReferences.flint)); list.Add(createReq("CorruptedEitr_bal", 1, 0)); list.Add(createReq("Nickel_bal", 2, 0)); break; case "HelmetLeatherCap_bal": newRecipe.m_craftingStation = TableMapper.heavyWorkbench; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("LeatherScraps", 4, 2, CommonItemReferences.leatherScraps)); list.Add(createReq("DeerHide", 2, 1)); break; case "HelmetBronzeHorned_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Copper", 6, 3)); list.Add(createReq("BoneFragments", 4, 2)); list.Add(createReq("LeatherScraps", 6, 3, CommonItemReferences.leatherScraps)); break; case "MeadBase_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 3; list.Add(createReq("Honey", 8, 0)); list.Add(createReq("Blueberries", 7, 0)); list.Add(createReq("Raspberry", 5, 0)); list.Add(createReq("WaterJug_bal", 2, 0)); break; case "NumbMeal_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("TrophyNeck", 1, 0)); list.Add(createReq("Mushroom", 1, 0)); list.Add(createReq("BoneFragments", 1, 0)); list.Add(createReq("Dandelion", 1, 0)); break; case "RustedScrap_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 2; list.Add(createReq("RustyBrokenSword_bal", 1, 0)); list.Add(createReq("Coal", 3, 0)); break; case "PortalBundleItem_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("FineWood", 20, 0, CommonItemReferences.fineWood)); list.Add(createReq("GreydwarfEye", 10, 0)); list.Add(createReq("SurtlingCore", 5, 0)); break; case "BundleHut_bal": newRecipe.m_craftingStation = TableMapper.heavyWorkbench; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 1; list.Add(createReq("Stone", 22, 0)); list.Add(createReq("RoundLog", 33, 0)); list.Add(createReq("LeatherScraps", 22, 0, CommonItemReferences.leatherScraps)); list.Add(createReq("IronNails", 88, 0)); break; case "ClayMoldBundle_bal": newRecipe.m_craftingStation = TableMapper.stoneCutter; newRecipe.m_amount = 1; newRecipe.m_minStationLevel = 1; list.Add(createReq("Clay_bal", 5, 0)); list.Add(createReq("Wood", 4, 0, CommonItemReferences.wood)); list.Add(createReq("WaterJug_bal", 1, 0)); break; case "CeramicMoldBundle_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; list.Add(createReq("BlackMarble", 40, 0)); list.Add(createReq("QueenDrop", 8, 0)); list.Add(createReq("Resin", 10, 0)); list.Add(createReq("IronNails", 8, 0)); break; case "WoodBundle_bal": newRecipe.m_craftingStation = TableMapper.heavyWorkbench; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; newRecipe.m_requireOnlyOneIngredient = true; list.Add(createReq("Wood", 10, 0)); list.Add(createReq("FineWood", 8, 0)); list.Add(createReq("RoundLog", 9, 0)); list.Add(createReq("HardWood_bal", 7, 0)); list.Add(createReq("YggdrasilWood", 7, 0)); list.Add(createReq("Blackwood", 7, 0)); break; case "BeltAssasin_bal": newRecipe.m_craftingStation = TableMapper.magetable; newRecipe.m_minStationLevel = 2; list.Add(createReq("YagluthDrop", 1, 0)); list.Add(createReq("BeltStrength", 2, 0)); list.Add(createReq("GoldBar_bal", 5, 0)); list.Add(createReq("BlackTissue_bal", 5, 0)); break; case "BeltVidar_bal": newRecipe.m_craftingStation = TableMapper.magetable; newRecipe.m_minStationLevel = 2; list.Add(createReq("YagluthDrop", 1, 0)); list.Add(createReq("BeltStrength", 2, 0)); list.Add(createReq("Eitr", 20, 0)); list.Add(createReq("ScaleHide", 15, 0)); break; case "BeltForester_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 2; list.Add(createReq("BjornHide", 3, 0)); list.Add(createReq("StrawThread_bal", 10, 0)); list.Add(createReq("WatcherHeart_bal", 1, 0)); list.Add(createReq("Lead_bal", 5, 0)); break; case "BeltMountaineer_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 2; list.Add(createReq("BjornHide", 3, 0)); list.Add(createReq("StrawThread_bal", 10, 0)); list.Add(createReq("WatcherHeart_bal", 1, 0)); list.Add(createReq("Lead_bal", 5, 0)); break; case "BeltSailor_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 2; list.Add(createReq("BjornHide", 3, 0)); list.Add(createReq("StrawThread_bal", 10, 0)); list.Add(createReq("WatcherHeart_bal", 1, 0)); list.Add(createReq("Lead_bal", 5, 0)); break; case "SilverScrap_bal": newRecipe.m_craftingStation = TableMapper.smeltworks; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("SilverNecklace", 3, 0)); break; case "CeramicMold_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 5; list.Add(createReq("BlackMarble", 5, 0)); list.Add(createReq("QueenDrop", 1, 0)); list.Add(createReq("Resin", 1, 0)); list.Add(createReq("IronNails", 2, 0)); break; case "EmberWood_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 3; list.Add(createReq("ElderBark", 3, 0)); list.Add(createReq("CursedBone_bal", 1, 0)); list.Add(createReq("SurtlingCore", 1, 0)); list.Add(createReq("HardWood_bal", 2, 0)); break; case "Electrum_bal": newRecipe.m_craftingStation = TableMapper.smeltworks; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 2; list.Add(createReq("Silver", 1, 0)); list.Add(createReq("GoldBar_bal", 1, 0)); list.Add(createReq("Thunderstone", 1, 0)); list.Add(createReq("Coal", 3, 0, CommonItemReferences.coal)); break; case "WhiteMetal_bal": newRecipe.m_craftingStation = TableMapper.smeltworks; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("BlackMetal", 2, 0)); list.Add(createReq("Tin", 3, 0)); list.Add(createReq("Zinc_bal", 1, 0)); list.Add(createReq("Coal", 5, 0, CommonItemReferences.coal)); break; case "BellMetal_bal": list.Add(createReq("Copper", 3, 0)); list.Add(createReq("Zinc_bal", 2, 0)); list.Add(createReq("Coal", 3, 0, CommonItemReferences.coal)); newRecipe.m_craftingStation = TableMapper.smeltworks; newRecipe.m_amount = 2; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "Cupronickel_bal": list.Add(createReq("Copper", 5, 0)); list.Add(createReq("Nickel_bal", 2, 0)); list.Add(createReq("Coal", 4, 0, CommonItemReferences.coal)); newRecipe.m_craftingStation = TableMapper.smeltworks; newRecipe.m_amount = 2; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "CupronickelPlate_bal": list.Add(createReq("Cupronickel_bal", 1, 0)); newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_amount = 12; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "Frosteel_bal": newRecipe.m_amount = 2; newRecipe.m_minStationLevel = 2; newRecipe.m_craftingStation = TableMapper.smeltworks; list.Add(createReq("Cobalt_bal", 3, 0)); list.Add(createReq("IceShard_bal", 8, 0)); list.Add(createReq("YmirRemains", 1, 0)); list.Add(createReq("Tin", 8, 0)); newRecipe.m_resources = list.ToArray(); break; case "Amethysteel_bal": newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 2; newRecipe.m_craftingStation = TableMapper.smeltworks; list.Add(createReq("Amethyst_bal", 2, 0)); list.Add(createReq("Ferroboron_bal", 2, 0)); list.Add(createReq("Zinc_bal", 5, 0)); list.Add(createReq("BlackCore", 1, 0)); newRecipe.m_resources = list.ToArray(); break; case "TernarySilver_bal": newRecipe.m_amount = 3; newRecipe.m_craftingStation = TableMapper.smeltworks; newRecipe.m_minStationLevel = 1; list.Add(createReq("SilverScrap_bal", 3, 0)); list.Add(createReq("Nickel_bal", 3, 0)); list.Add(createReq("Zinc_bal", 2, 0)); list.Add(createReq("Coal", 6, 0)); break; case "SwordFakeSilver_Bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 3; list.Add(createReq("TernarySilver_bal", 16, 8)); list.Add(createReq("HardWood_bal", 4, 2)); list.Add(createReq("LeatherScraps", 4, 2, CommonItemReferences.leatherScraps)); list.Add(createReq("Ectoplasm", 8, 4)); break; case "MaceFakeSilver_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 3; list.Add(createReq("TernarySilver_bal", 16, 8)); list.Add(createReq("HardWood_bal", 6, 3)); list.Add(createReq("LeatherScraps", 6, 3, CommonItemReferences.leatherScraps)); list.Add(createReq("Ectoplasm", 8, 4)); break; case "HammerMythic_bal": newRecipe.m_amount = 1; newRecipe.m_craftingStation = TableMapper.runeforge; newRecipe.m_minStationLevel = 3; list.Add(createReq("AncientRelic_bal", 6, 3)); list.Add(createReq("MythicEye_bal", 1, 0)); list.Add(createReq("Amethysteel_bal", 8, 4)); list.Add(createReq("CrystalWood_bal", 8, 4)); newRecipe.m_resources = list.ToArray(); break; case "DarkSteel_bal": newRecipe.m_amount = 3; newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 1; list.Add(createReq("Iron", 5, 0, CommonItemReferences.iron)); list.Add(createReq("Nickel_bal", 2, 0)); list.Add(createReq("Obsidian", 2, 0)); list.Add(createReq("Coal", 5, 0, CommonItemReferences.coal)); newRecipe.m_resources = list.ToArray(); break; case "DarksteelNails_bal": newRecipe.m_amount = 10; newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 1; list.Add(createReq("DarkSteel_bal", 1, 0)); newRecipe.m_resources = list.ToArray(); break; case "StrawBundle_bal": newRecipe.m_amount = 1; newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 1; list.Add(createReq("Straw_bal", 10, 0)); newRecipe.m_resources = list.ToArray(); break; case "MoltenSteel_bal": newRecipe.m_amount = 3; newRecipe.m_minStationLevel = 3; newRecipe.m_craftingStation = TableMapper.blackforge; list.Add(createReq("FlametalNew", 2, 0)); list.Add(createReq("Flametal", 2, 0)); list.Add(createReq("EmberWood_bal", 3, 0)); list.Add(createReq("BoraxCrystal_bal", 3, 0)); newRecipe.m_resources = list.ToArray(); break; case "DeadEgo_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 1; list.Add(createReq("YagluthDrop", 1, 0)); list.Add(createReq("CorruptedEitr_bal", 5, 0)); list.Add(createReq("WatcherHeart_bal", 1, 0)); list.Add(createReq("SoulCore_bal", 1, 0)); break; case "DragonSoul_bal": list.Add(createReq("HardAntler", 3, 0)); list.Add(createReq("DragonTear", 1, 0)); list.Add(createReq("SoulCore_bal", 1, 0)); list.Add(createReq("CorruptedEitr_bal", 2, 0)); newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_amount = 1; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "TormentedSoul_bal": list.Add(createReq("HardAntler", 3, 0)); list.Add(createReq("WatcherHeart_bal", 1, 0)); list.Add(createReq("SoulCore_bal", 1, 0)); list.Add(createReq("TrophyGreydwarfShaman", 1, 0)); newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_amount = 1; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "ThornHeart_bal": list.Add(createReq("HardAntler", 2, 0)); list.Add(createReq("WatcherHeart_bal", 1, 0)); list.Add(createReq("TrophyGreydwarfShaman", 1, 0)); newRecipe.m_craftingStation = TableMapper.heavyWorkbench; newRecipe.m_amount = 1; newRecipe.m_minStationLevel = 2; newRecipe.m_resources = list.ToArray(); break; case "InfusedCarapace_bal": list.Add(createReq("HardAntler", 2, 0)); list.Add(createReq("WatcherHeart_bal", 1, 0)); list.Add(createReq("QueenDrop", 4, 0)); list.Add(createReq("DragonTear", 1, 0)); newRecipe.m_craftingStation = TableMapper.blackforge; newRecipe.m_amount = 1; newRecipe.m_minStationLevel = 2; newRecipe.m_resources = list.ToArray(); break; case "AppleSeeds_bal": list.Add(createReq("Apple_bal", 1, 0)); newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_amount = 2; newRecipe.m_minStationLevel = 2; newRecipe.m_resources = list.ToArray(); break; case "OilBase_bal": newRecipe.m_craftingStation = TableMapper.cauldron; list.Add(createReq("BirdFeed_bal", 3, 0)); list.Add(createReq("FishRaw", 7, 0)); newRecipe.m_requireOnlyOneIngredient = true; newRecipe.m_amount = 2; newRecipe.m_enabled = true; newRecipe.m_minStationLevel = 2; newRecipe.m_resources = list.ToArray(); break; case "BirdFeed_bal": newRecipe.m_craftingStation = TableMapper.cauldron; list.Add(createReq("BeechSeeds", 4, 0)); list.Add(createReq("BirchSeeds", 2, 0)); list.Add(createReq("Acorn", 2, 0)); list.Add(createReq("AcaiSeeds_bal", 2, 0)); list.Add(createReq("CabbageSeeds_bal", 2, 0)); list.Add(createReq("AppleSeeds_bal", 3, 0)); list.Add(createReq("CarrotSeeds", 4, 0)); list.Add(createReq("CypressSeeds_bal", 2, 0)); list.Add(createReq("GarlicSeeds_bal", 3, 0)); list.Add(createReq("OnionSeeds", 3, 0)); list.Add(createReq("PoplarSeeds_bal", 2, 0)); list.Add(createReq("StrawSeeds_bal", 4, 0)); list.Add(createReq("SwampTreeSeeds_bal", 2, 0)); list.Add(createReq("TurnipSeeds", 3, 0)); list.Add(createReq("VineberrySeeds", 2, 0)); list.Add(createReq("WillowSeeds_bal", 2, 0)); list.Add(createReq("BasicSeed_bal", 4, 0)); newRecipe.m_requireOnlyOneIngredient = true; newRecipe.m_amount = 1; newRecipe.m_enabled = true; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "SawBlade_bal": newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 1; list.Add(createReq("Iron", 3, 0)); break; case "PatchworkBundle_bal": newRecipe.m_craftingStation = TableMapper.heavyWorkbench; newRecipe.m_minStationLevel = 1; list.Add(createReq("LeatherScraps", 2, 0, CommonItemReferences.leatherScraps)); list.Add(createReq("StrawThread_bal", 2, 0)); list.Add(createReq("BoneFragments", 1, 0)); break; case "TarBase_bal": newRecipe.m_craftingStation = TableMapper.shamantable; list.Add(createReq("Coal", 6, 0)); list.Add(createReq("CharcoalResin", 2, 0)); list.Add(createReq("Sap", 1, 0)); list.Add(createReq("WaterJug_bal", 1, 0)); newRecipe.m_amount = 2; newRecipe.m_minStationLevel = 3; newRecipe.m_resources = list.ToArray(); break; case "ClayPot_bal": newRecipe.m_craftingStation = TableMapper.heavyWorkbench; newRecipe.m_amount = 2; newRecipe.m_minStationLevel = 1; list.Add(createReq("Clay_bal", 3, 0)); list.Add(createReq("WaterJug_bal", 2, 0)); newRecipe.m_resources = list.ToArray(); break; case "ClayBrickMold_bal": newRecipe.m_craftingStation = TableMapper.stoneCutter; newRecipe.m_amount = 5; newRecipe.m_minStationLevel = 1; list.Add(createReq("Clay_bal", 3, 0)); list.Add(createReq("Wood", 2, 0, CommonItemReferences.wood)); list.Add(createReq("WaterJug_bal", 1, 0)); newRecipe.m_resources = list.ToArray(); break; case "WoodBucket_bal": newRecipe.m_craftingStation = TableMapper.workbench; list.Add(createReq("Wood", 3, 0, CommonItemReferences.wood)); newRecipe.m_amount = 3; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "WoodNails_bal": newRecipe.m_craftingStation = TableMapper.workbench; list.Add(createReq("Wood", 3, 0, CommonItemReferences.wood)); newRecipe.m_amount = 33; newRecipe.m_minStationLevel = 1; newRecipe.m_resources = list.ToArray(); break; case "CarvedCarcass_bal": list.Add(createReq("CharredBone", 5, 0)); list.Add(createReq("FaderDrop", 1, 0)); list.Add(createReq("QueenDrop", 4, 0)); list.Add(createReq("DragonSoul_bal", 1, 0)); newRecipe.m_craftingStation = TableMapper.blackforge; newRecipe.m_amount = 1; newRecipe.m_minStationLevel = 3; newRecipe.m_resources = list.ToArray(); break; case "FenringInsygnia_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 1; list.Add(createReq("WolfClaw", 2, 0)); list.Add(createReq("WolfFang", 2, 0)); list.Add(createReq("Iron", 1, 0, CommonItemReferences.iron)); list.Add(createReq("CultInsignia_bal", 1, 0)); break; case "RawSilk_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("RawSilkScrap_bal", 2, 0)); list.Add(createReq("LinenThread", 1, 0)); break; case "MedPack_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 2; list.Add(createReq("Bandages_bal", 1, 0)); list.Add(createReq("WaterJug_bal", 1, 0)); list.Add(createReq("Sage_bal", 3, 0)); list.Add(createReq("YewBark_bal", 2, 0)); break; case "Bandages_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("StrawThread_bal", 5, 0)); list.Add(createReq("LeatherScraps", 5, 0, CommonItemReferences.leatherScraps)); list.Add(createReq("Thistle", 2, 0)); list.Add(createReq("Dandelion", 4, 0)); break; case "FirstAidKit_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 5; newRecipe.m_amount = 2; list.Add(createReq("MedPack_bal", 1, 0)); list.Add(createReq("Nettle_bal", 3, 0)); list.Add(createReq("MushroomInkcap_bal", 3, 0)); list.Add(createReq("MeadHealthMinor", 2, 0)); break; case "CarvedDeerSkull_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("TrophyDeer", 1, 0)); list.Add(createReq("LeatherScraps", 1, 0, CommonItemReferences.leatherScraps)); list.Add(createReq("Raspberry", 1, 0)); list.Add(createReq("Flint", 1, 0)); break; case "CabbageLeaf_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 2; list.Add(createReq("Cabbage_bal", 1, 0)); break; case "Peningar_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 100; list.Add(createReq("Silver", 1, 0)); list.Add(createReq("Coal", 3, 0, CommonItemReferences.coal)); break; case "SilverPouch_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Peningar_bal", 100, 0)); list.Add(createReq("LeatherScraps", 2, 0, CommonItemReferences.leatherScraps)); break; case "GoldBar_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Coins", 120, 0)); list.Add(createReq("Coal", 4, 0, CommonItemReferences.coal)); break; case "FishWrapsUncooked_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("FishCooked", 4, 0)); list.Add(createReq("BarleyFlour", 5, 0)); list.Add(createReq("Garlic_bal", 2, 0)); break; case "AppleVinegar_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; list.Add(createReq("Apple_bal", 3, 0)); list.Add(createReq("WaterJug_bal", 2, 0)); list.Add(createReq("Dandelion", 2, 0)); break; case "PaintBucket_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 3; newRecipe.m_resources = (Requirement[])(object)new Requirement[0]; list.Add(createReq("Blueberries", 7, 0)); list.Add(createReq("Onion", 4, 0)); list.Add(createReq("Blackberries_bal", 5, 0)); list.Add(createReq("MushroomInkcap_bal", 4, 0)); list.Add(createReq("Cloudberry", 5, 0)); list.Add(createReq("Seaberries_bal", 3, 0)); list.Add(createReq("Iceberry_bal", 3, 0)); list.Add(createReq("Raspberry", 7, 0)); list.Add(createReq("Lavender_bal", 4, 0)); list.Add(createReq("Coal", 6, 0, CommonItemReferences.coal)); list.Add(createReq("Carrot", 6, 0)); list.Add(createReq("Bloodbag", 3, 0)); list.Add(createReq("Guck", 4, 0)); list.Add(createReq("GiantBloodSack", 2, 0)); list.Add(createReq("CharredBone", 2, 0)); list.Add(createReq("SmallBloodSack_bal", 9, 0)); newRecipe.m_requireOnlyOneIngredient = true; break; case "TeaMint_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 3; list.Add(createReq("WaterJug_bal", 1, 0)); list.Add(createReq("Dandelion", 5, 0)); list.Add(createReq("Mint_bal", 5, 0)); break; case "HammerIron_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 2; list.Add(createReq("Iron", 2, 1, CommonItemReferences.iron)); list.Add(createReq("ElderBark", 4, 1, CommonItemReferences.fineWood)); list.Add(createReq("LeatherScraps", 2, 1, CommonItemReferences.leatherScraps)); list.Add(createReq("Resin", 2, 1)); break; case "HammerBlackmetal_bal": newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 2; list.Add(createReq("BlackMetal", 2, 1)); list.Add(createReq("HardWood_bal", 2, 1)); list.Add(createReq("LeatherScraps", 3, 1, CommonItemReferences.leatherScraps)); list.Add(createReq("Tar", 1, 0)); break; case "BlackMetalCultivator_bal": newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 2; list.Add(createReq("BlackMetal", 2, 1)); list.Add(createReq("HardWood_bal", 2, 1)); list.Add(createReq("LeatherScraps", 3, 1, CommonItemReferences.leatherScraps)); list.Add(createReq("Tar", 1, 0)); break; case "BlackMetalHoe_bal": newRecipe.m_craftingStation = TableMapper.ironworks; newRecipe.m_minStationLevel = 2; list.Add(createReq("BlackMetal", 2, 1)); list.Add(createReq("HardWood_bal", 2, 1)); list.Add(createReq("LeatherScraps", 3, 1, CommonItemReferences.leatherScraps)); list.Add(createReq("Tar", 1, 0)); break; case "HammerDverger_bal": newRecipe.m_craftingStation = TableMapper.blackforge; newRecipe.m_minStationLevel = 1; list.Add(createReq("BoraxCrystal_bal", 2, 1)); list.Add(createReq("YggdrasilWood", 2, 1)); list.Add(createReq("DarkSteel_bal", 2, 1)); list.Add(createReq("LeatherScraps", 4, 2, CommonItemReferences.leatherScraps)); break; case "StrawThread_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("Straw_bal", 4, 0)); break; case "PickaxeFlametal_bal": newRecipe.m_craftingStation = TableMapper.blackforge; newRecipe.m_minStationLevel = 2; list.Add(createReq("FlametalNew", 20, 10)); list.Add(createReq("AskHide", 1, 0)); list.Add(createReq("Blackwood", 5, 2)); list.Add(createReq("Tar", 1, 0)); break; case "ArrowChitin_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("Chitin", 7, 0)); list.Add(createReq("LeatherScraps", 1, 0, CommonItemReferences.leatherScraps)); break; case "ArrowFlametal_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 5; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("FlametalNew", 1, 0)); list.Add(createReq("LeatherScraps", 1, 0, CommonItemReferences.leatherScraps)); break; case "ArrowBlizzard_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 5; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("Frosteel_bal", 1, 0)); list.Add(createReq("LeatherScraps", 1, 0, CommonItemReferences.leatherScraps)); break; case "ArrowBone_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("BoneFragments", 5, 0)); list.Add(createReq("LeatherScraps", 1, 0, CommonItemReferences.leatherScraps)); break; case "ArrowBlunt_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("Stone", 4, 0)); list.Add(createReq("Lead_bal", 1, 0, CommonItemReferences.stone)); break; case "BoltChitin_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("Chitin", 6, 0)); list.Add(createReq("BoneFragments", 10, 0)); break; case "BoltBlunt_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("Copper", 1, 0)); list.Add(createReq("Lead_bal", 1, 0, CommonItemReferences.stone)); break; case "BoltSilver_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("Silver", 1, 0)); list.Add(createReq("LeatherScraps", 1, 0, CommonItemReferences.leatherScraps)); break; case "BoltFire_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("SurtlingCore", 4, 0)); list.Add(createReq("Resin", 10, 0)); break; case "BoltThunder_bal": newRecipe.m_craftingStation = TableMapper.fletcher; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 20; list.Add(createReq("Wood", 8, 0, CommonItemReferences.wood)); list.Add(createReq("Feathers", 2, 0)); list.Add(createReq("Electrum_bal", 1, 0)); list.Add(createReq("LeatherScraps", 1, 0, CommonItemReferences.leatherScraps)); break; case "NorthernFur_bal": newRecipe.m_craftingStation = TableMapper.runeforge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 3; list.Add(createReq("TrollHide", 3, 0)); list.Add(createReq("JotunFinger_bal", 4, 0)); list.Add(createReq("WolfPelt", 5, 0)); list.Add(createReq("BjornHide", 2, 0)); break; case "BlackSkin_bal": newRecipe.m_craftingStation = TableMapper.blackforge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("NeckSkin_bal", 3, 0)); list.Add(createReq("BlackTissue_bal", 2, 0)); list.Add(createReq("CharredBone", 2, 0)); list.Add(createReq("AskHide", 1, 0)); break; case "BrassChain_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("BellMetal_bal", 3, 0)); list.Add(createReq("Coal", 5, 0)); break; case "HelmetCrown_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; list.Add(createReq("GoldBar_bal", 4, 1)); list.Add(createReq("Ruby", 3, 0)); list.Add(createReq("LeatherScraps", 4, 2, CommonItemReferences.leatherScraps)); break; case "KingMug_bal": newRecipe.m_craftingStation = TableMapper.artisian; newRecipe.m_minStationLevel = 1; list.Add(createReq("GoldBar_bal", 3, 0)); list.Add(createReq("Ruby", 2, 0)); list.Add(createReq("FineWood", 2, 0, CommonItemReferences.fineWood)); list.Add(createReq("BronzeNails", 33, 0)); break; case "ApplePieUncooked_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Apple_bal", 3, 0)); list.Add(createReq("BarleyFlour", 2, 0)); list.Add(createReq("Mugwort_bal", 2, 0)); break; case "AshlandCurry_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 2; list.Add(createReq("VoltureMeat", 3, 0)); list.Add(createReq("SpiceSet_bal", 2, 0)); list.Add(createReq("Turnip", 3, 0)); list.Add(createReq("Carrot", 5, 0)); break; case "BlackBerryJuiceBase_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 4; list.Add(createReq("Blackberries_bal", 7, 0)); list.Add(createReq("Blueberries", 3, 0)); list.Add(createReq("Mugwort_bal", 1, 0)); list.Add(createReq("Honey", 3, 0)); break; case "VineBerryJuiceBase_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 4; list.Add(createReq("Vineberry", 7, 0)); list.Add(createReq("Thistle", 3, 0)); list.Add(createReq("Mint_bal", 1, 0)); list.Add(createReq("Honey", 3, 0)); break; case "BloodfruitSoup_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 3; list.Add(createReq("Bloodfruit_bal", 5, 0)); list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("Bloodbag", 1, 0)); break; case "BloodyBearJerky_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 5; list.Add(createReq("BjornMeat", 3, 0)); list.Add(createReq("Thistle", 2, 0)); list.Add(createReq("Bloodbag", 1, 0)); break; case "BloodyCreamPie_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 3; list.Add(createReq("Bloodbag", 3, 0)); list.Add(createReq("BarleyFlour", 3, 0)); list.Add(createReq("Bloodfruit_bal", 5, 0)); list.Add(createReq("Eyescream", 2, 0)); break; case "BlueberryPieUncooked_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Blueberries", 6, 0)); list.Add(createReq("Lingonberry_bal", 4, 0)); list.Add(createReq("BarleyFlour", 3, 0)); list.Add(createReq("Mugwort_bal", 2, 0)); break; case "Breakfast_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Oil_bal", 1, 0)); list.Add(createReq("CookedEgg", 2, 0)); list.Add(createReq("Sausages", 2, 0)); list.Add(createReq("Bread", 1, 0)); break; case "Burger_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("Cheese_bal", 1, 0)); list.Add(createReq("SpicyBurger_bal", 3, 0)); list.Add(createReq("BarleyFlour", 3, 0)); list.Add(createReq("CabbageLeaf_bal", 5, 0)); break; case "ChickenMarsala_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 1; list.Add(createReq("ChickenMeat", 3, 0)); list.Add(createReq("SpiceSet_bal", 2, 0)); list.Add(createReq("BarleyWine", 1, 0)); list.Add(createReq("MushroomInkcap_bal", 4, 0)); break; case "ChickenNuggets_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Oil_bal", 2, 0)); list.Add(createReq("ChickenMeat", 2, 0)); list.Add(createReq("ChickenEgg", 2, 0)); list.Add(createReq("SpiceSet_bal", 2, 0)); break; case "DragonfireBarbecue_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 2; list.Add(createReq("Oil_bal", 2, 0)); list.Add(createReq("RawDragonRibs_bal", 1, 0)); list.Add(createReq("Bread", 2, 0)); list.Add(createReq("SpiceSet_bal", 2, 0)); break; case "FishSkewer_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("FishRaw", 2, 0)); list.Add(createReq("CabbageLeaf_bal", 2, 0)); list.Add(createReq("MushroomYellow", 2, 0)); break; case "FruitPunchBase_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 4; list.Add(createReq("Apple_bal", 2, 0)); list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Blackberries_bal", 4, 0)); list.Add(createReq("Mint_bal", 1, 0)); break; case "FruitSalad_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Apple_bal", 1, 0)); list.Add(createReq("Blackberries_bal", 2, 0)); list.Add(createReq("Blueberries", 3, 0)); list.Add(createReq("Raspberry", 4, 0)); break; case "GrilledShrooms_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("Darkbul_bal", 4, 0)); list.Add(createReq("Dandelion", 1, 0)); list.Add(createReq("Mushroom", 4, 0)); list.Add(createReq("Oil_bal", 1, 0)); break; case "HappyMeal_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Burger_bal", 1, 0)); list.Add(createReq("CarrotFries_bal", 1, 0)); list.Add(createReq("ShocklateSmoothie", 1, 0)); list.Add(createReq("Apple_bal", 1, 0)); break; case "CarrotFries_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Carrot", 5, 0)); list.Add(createReq("CabbageLeaf_bal", 2, 0)); list.Add(createReq("Oil_bal", 2, 0)); break; case "HoneyGlazedApple_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("Apple_bal", 2, 0)); list.Add(createReq("WoodNails_bal", 2, 0)); list.Add(createReq("Honey", 3, 0)); break; case "IceBerryPancake_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Iceberry_bal", 2, 0)); list.Add(createReq("Nettle_bal", 2, 0)); list.Add(createReq("WaterJug_bal", 1, 0)); list.Add(createReq("Milk_bal", 2, 0)); break; case "KingsJam_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Apple_bal", 2, 0)); list.Add(createReq("Blackberries_bal", 2, 0)); list.Add(createReq("Seaberries_bal", 2, 0)); list.Add(createReq("Lingonberry_bal", 2, 0)); break; case "Liverwurst_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 3; list.Add(createReq("TrollMeat_bal", 3, 0)); list.Add(createReq("Entrails", 2, 0)); list.Add(createReq("Dandelion", 2, 0)); list.Add(createReq("PowderedPepper_bal", 1, 0)); break; case "MagmaCoctailBase_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 4; list.Add(createReq("PowderedPepper_bal", 2, 0)); list.Add(createReq("SurtlingCore", 2, 0)); list.Add(createReq("MeadBase_bal", 1, 0)); list.Add(createReq("Nettle_bal", 2, 0)); break; case "MeadBaseWhiteCheese_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("Milk_bal", 3, 0)); list.Add(createReq("AppleVinegar_bal", 2, 0)); list.Add(createReq("Thistle", 1, 0)); break; case "GrilledCheese_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 4; list.Add(createReq("Cheese_bal", 1, 0)); list.Add(createReq("PowderedSalt_bal", 1, 0)); list.Add(createReq("PowderedPepper_bal", 1, 0)); break; case "RoastedFish_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 3; list.Add(createReq("SharkMeat_bal", 2, 0)); list.Add(createReq("Turnip", 2, 0)); list.Add(createReq("Darkbul_bal", 2, 0)); list.Add(createReq("RedKelp_bal", 1, 0)); break; case "CabbageWrapDrake_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("DrakeMeat_bal", 1, 0)); list.Add(createReq("Onion", 1, 0)); list.Add(createReq("Cabbage_bal", 1, 0)); list.Add(createReq("PowderedSalt_bal", 1, 0)); break; case "Cotlet_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 3; list.Add(createReq("GoatMeat_bal", 3, 0)); list.Add(createReq("Turnip", 2, 0)); list.Add(createReq("Darkbul_bal", 2, 0)); list.Add(createReq("Carrot", 3, 0)); break; case "RedStew_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 2; list.Add(createReq("CrabLegs_bal", 5, 0)); list.Add(createReq("Mushroom", 3, 0)); list.Add(createReq("Turnip", 2, 0)); list.Add(createReq("RedKelp_bal", 1, 0)); break; case "GoatStew_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("GoatMeat_bal", 1, 0)); list.Add(createReq("Onion", 2, 0)); list.Add(createReq("GrayMushroom_bal", 2, 0)); list.Add(createReq("Lingonberry_bal", 1, 0)); break; case "CrustedMeat_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("BarleyFlour", 1, 0)); list.Add(createReq("RawCrowMeat_bal", 1, 0)); list.Add(createReq("Garlic_bal", 1, 0)); break; case "MeatBalls_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("MincedMeat_bal", 1, 0)); list.Add(createReq("Onion", 1, 0)); list.Add(createReq("Darkbul_bal", 1, 0)); list.Add(createReq("RedKelp_bal", 1, 0)); break; case "MeatRoll_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 2; list.Add(createReq("BatWing_bal", 5, 0)); list.Add(createReq("Cloudberry", 4, 0)); list.Add(createReq("SpiceSet_bal", 1, 0)); list.Add(createReq("GrilledCheese_bal", 1, 0)); break; case "MagnaTarta_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("BarleyFlour", 4, 0)); list.Add(createReq("Seaberries_bal", 5, 0)); list.Add(createReq("Raspberry", 4, 0)); list.Add(createReq("Honey", 3, 0)); break; case "ShrededMeat_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Carrot", 1, 0)); list.Add(createReq("ChickenMeat", 1, 0)); list.Add(createReq("Turnip", 1, 0)); list.Add(createReq("Onion", 1, 0)); break; case "MincedFenringStew_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("FenringMeat_bal", 1, 0)); list.Add(createReq("MushroomYellow", 1, 0)); list.Add(createReq("Carrot", 1, 0)); list.Add(createReq("Moss_bal", 1, 0)); break; case "CarrotCrowSalad_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("RawCrowMeat_bal", 1, 0)); list.Add(createReq("Turnip", 1, 0)); list.Add(createReq("Carrot", 1, 0)); list.Add(createReq("Moss_bal", 1, 0)); break; case "RostedTrollBits_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("TrollMeat_bal", 3, 0)); list.Add(createReq("Mushroom", 7, 0)); break; case "SeaFoodPlatter_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("ClamMeat_bal", 3, 0)); list.Add(createReq("CrabLegs_bal", 2, 0)); list.Add(createReq("SerpentMeat", 1, 0)); list.Add(createReq("FishRaw", 2, 0)); break; case "SpicyBurger_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 8; list.Add(createReq("Oil_bal", 3, 0)); list.Add(createReq("PowderedPepper_bal", 1, 0)); list.Add(createReq("PowderedSalt_bal", 1, 0)); list.Add(createReq("MincedMeat_bal", 3, 0)); break; case "SpiecedDrakeChop_bal": newRecipe.m_craftingStation = TableMapper.grill; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("DrakeMeat_bal", 1, 0)); list.Add(createReq("Onion", 1, 0)); list.Add(createReq("Mugwort_bal", 1, 0)); list.Add(createReq("Oil_bal", 2, 0)); break; case "SurstrommingBase_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("FishRaw", 5, 0)); list.Add(createReq("Thistle", 3, 0)); list.Add(createReq("Guck", 1, 0)); list.Add(createReq("Oil_bal", 1, 0)); break; case "SwampSkause_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("FishCooked", 4, 0)); list.Add(createReq("Darkbul_bal", 3, 0)); list.Add(createReq("Thistle", 3, 0)); list.Add(createReq("WaterJug_bal", 2, 0)); break; case "VegetablePuree_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 2; list.Add(createReq("Carrot", 9, 0)); list.Add(createReq("Turnip", 3, 0)); list.Add(createReq("SpiceSet_bal", 1, 0)); list.Add(createReq("WaterJug_bal", 2, 0)); break; case "CabbageSoup_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 4; list.Add(createReq("Bulion_bal", 2, 0)); list.Add(createReq("Cabbage_bal", 3, 0)); list.Add(createReq("Thistle", 1, 0)); break; case "WaterJugEmpty_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 3; list.Add(createReq("LeatherScraps", 3, 0, CommonItemReferences.leatherScraps)); list.Add(createReq("StrawThread_bal", 1, 0)); break; case "WaterJug_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 3; list.Add(createReq("WoodBucketWater_bal", 1, 0)); list.Add(createReq("WaterJugEmpty_bal", 3, 0)); break; case "WaterJugEnchanted_bal": newRecipe.m_craftingStation = TableMapper.magetable; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 4; list.Add(createReq("WaterJug_bal", 4, 0)); list.Add(createReq("Eitr", 1, 0)); list.Add(createReq("Wisp", 1, 0)); break; case "AxeCopper_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Copper", 6, 3)); list.Add(createReq("Wood", 2, 1)); list.Add(createReq("Club", 1, 0)); list.Add(createReq("Resin", 2, 1)); break; case "MaceCopper_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("Copper", 6, 3)); list.Add(createReq("Wood", 2, 1)); list.Add(createReq("Club", 1, 0)); list.Add(createReq("LeatherScraps", 2, 1)); break; case "WispCore_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 5; newRecipe.m_amount = 2; list.Add(createReq("Wisp", 4, 0)); list.Add(createReq("BlackCore", 1, 0)); list.Add(createReq("Crystal", 5, 0)); list.Add(createReq("Ectoplasm", 3, 0)); break; case "CarvedWood_bal": newRecipe.m_craftingStation = TableMapper.workbench; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 3; list.Add(createReq("Wood", 4, 0)); list.Add(createReq("Flint", 2, 0)); break; case "VegetableSoup_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 2; newRecipe.m_amount = 1; list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("MushroomYellow", 2, 0)); list.Add(createReq("Mushroom", 2, 0)); list.Add(createReq("GrayMushroom_bal", 2, 0)); break; case "WinterStew_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 3; newRecipe.m_amount = 2; list.Add(createReq("Bread", 4, 0)); list.Add(createReq("Bulion_bal", 1, 0)); list.Add(createReq("BoneMawSerpentMeat", 2, 0)); list.Add(createReq("SpiceAshlands", 1, 0)); break; case "Bulion_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 4; list.Add(createReq("WaterJug_bal", 2, 0)); list.Add(createReq("MeatScrap_bal", 4, 0)); list.Add(createReq("Carrot", 2, 0)); list.Add(createReq("Dandelion", 2, 0)); break; case "SpiceSet_bal": newRecipe.m_craftingStation = TableMapper.foodtable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 5; list.Add(createReq("Thistle", 3, 0)); list.Add(createReq("Onion", 2, 0)); list.Add(createReq("Barley", 1, 0)); list.Add(createReq("Garlic_bal", 3, 0)); break; case "CookedMeatScrap_bal": newRecipe.m_craftingStation = TableMapper.cauldron; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 2; list.Add(createReq("MeatScrap_bal", 3, 0)); list.Add(createReq("BoneFragments", 1, 0)); list.Add(createReq("WaterJug_bal", 1, 0)); break; case "BundlePortal_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("GreydwarfEye", 12, 0)); list.Add(createReq("FineWood", 16, 0, CommonItemReferences.fineWood)); list.Add(createReq("SurtlingCore", 2, 0)); list.Add(createReq("CarvedWood_bal", 6, 0)); break; case "BundlePortalStone_bal": newRecipe.m_craftingStation = TableMapper.forge; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 1; list.Add(createReq("GreydwarfEye", 10, 0)); list.Add(createReq("Grausten", 30, 0)); list.Add(createReq("MoltenCore", 2, 0)); list.Add(createReq("Iron", 5, 0)); break; case "PowderedSpiritShard_bal": newRecipe.m_craftingStation = TableMapper.shamantable; newRecipe.m_minStationLevel = 1; newRecipe.m_amount = 3; list.Add(createReq("Stone", 1, 0)); list.Add(createReq("Ectoplasm", 5, 0)); list.Add(createReq("Sage_bal", 1, 0)); list.Add(createReq("GemChunks_bal", 1, 0)); break; case "EnrichedEitr_bal": newRecipe.m_craftingStation = TableMapper.magetable; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 5; list.Add(createReq("Eitr", 15, 0)); list.Add(createReq("BoraxCrystal_bal", 5, 0)); list.Add(createReq("MoltenCore", 2, 0)); list.Add(createReq("GoldBar_bal", 5, 0)); break; case "Bloodshard_bal": newRecipe.m_craftingStation = TableMapper.magetable; newRecipe.m_minStationLevel = 4; newRecipe.m_amount = 2; list.Add(createReq("Eitr", 8, 0)); list.Add(createReq("Crystal", 11, 0)); list.Add(createReq("Bloodbag", 5, 0)); break; } newRecipe.m_repairStation = newRecipe.m_craftingStation; if (list.Count == 0) { } newRecipe.m_resources = list.ToArray(); return newRecipe; } private Requirement createReq(string name, int amount, int amountPerLevel, GameObject commonReference = null) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown object obj2; if (!((Object)(object)commonReference != (Object)null)) { GameObject obj = FindItem(name); obj2 = ((obj != null) ? obj.GetComponent() : null); } else { obj2 = commonReference.GetComponent(); } ItemDrop val = (ItemDrop)obj2; if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("createReq failed: ItemDrop missing for \"" + name + "\"")); return null; } return new Requirement { m_resItem = val, m_amount = amount, m_amountPerLevel = amountPerLevel, m_recover = true }; } private GameObject FindItem(string name) { if (_itemCache.TryGetValue(name, out var value)) { return value; } GameObject val = ObjectDB.instance.GetItemPrefab(name); if ((Object)(object)val == (Object)null && newItems != null) { val = newItems.Find((GameObject x) => ((Object)x).name == name); } if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("FindItem: \"" + name + "\" not found, using fallback \"Wood\"")); val = ObjectDB.instance.GetItemPrefab("Wood"); } if ((Object)(object)val != (Object)null) { _itemCache[name] = val; } return val; } private Recipe AddRecipe(Recipe newRecipe, int amount, CraftingStation station, int stationLevel, List> ingredients) { newRecipe.m_craftingStation = station; newRecipe.m_minStationLevel = stationLevel; newRecipe.m_amount = amount; List list = new List(); HashSet hashSet = new HashSet(); foreach (Tuple ingredient in ingredients) { Requirement val = createReq(ingredient.Item1, ingredient.Item2, ingredient.Item3); if (val == null) { Debug.LogWarning((object)("Requirement skipped: " + ingredient.Item1 + " is null or invalid.")); continue; } if (hashSet.Contains(val.m_resItem)) { Debug.LogWarning((object)("Duplicate ingredient skipped: " + ((Object)val.m_resItem).name)); continue; } list.Add(val); hashSet.Add(val.m_resItem); } newRecipe.m_resources = list.ToArray(); if (list.Count == 0) { Debug.LogWarning((object)("No valid requirements found for recipe: " + ((Object)newRecipe).name)); return null; } return newRecipe; } } public class Resource { public int amount = 1; public int amountPerLevel = 0; public bool recovery = true; public ItemDrop itemDrop; public Requirement pieceConfig; public string item = "Wood"; public Resource() { } public Resource(string item, int amount, int amountPerLevel = 0, bool recovery = true) { this.item = item; this.amount = amount; this.amountPerLevel = amountPerLevel; this.recovery = recovery; } public void setItemDrop(GameObject prefab) { if ((Object)(object)prefab.GetComponent() != (Object)null) { itemDrop = prefab.GetComponent(); } else { Debug.LogWarning((object)("DVERGER FURNITURE: NO ITEM DROP FOUND on prefab name: " + ((Object)prefab).name)); } } public Requirement getPieceConfig() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_003e: Expected O, but got Unknown Requirement val = new Requirement { m_resItem = itemDrop, m_amount = amount, m_amountPerLevel = amountPerLevel, m_recover = recovery }; Requirement result = val; pieceConfig = val; return result; } } public class VegetationBiomeSettings { public Biome Biome = (Biome)1; public BiomeArea BiomeArea = (BiomeArea)3; } public class VegetationLandHeight { public float MinOceanDepth = 0f; public float MaxOceanDepth = 0f; public float MinAltitude = -1000f; public float MaxAltitude = 1000f; } public class VendorBuilder { private List _prefabs; public void EditVendors(List prefabList) { _prefabs = prefabList; EditTrader("Haldor", GetHaldorItems()); EditTrader("Hildir", GetHildirItems()); EditTrader("BogWitch", GetBogwitchItems()); } private void EditTrader(string traderName, List itemsToAdd) { GameObject val = _prefabs.Find((GameObject x) => ((Object)x).name == traderName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Trader '" + traderName + "' not found.")); return; } Trader component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("Trader component missing on '" + traderName + "'.")); return; } component.m_items.AddRange(itemsToAdd); component.m_items.RemoveAll((TradeItem x) => x == null); } private List GetBogwitchItems() { return new List { CreateTradeItem("PoisonApple_bal", 50, 1, "defeated_gdking") }; } private List GetHaldorItems() { return new List { CreateTradeItem("JuteThread_bal", 300, 1, "defeated_dragon"), CreateTradeItem("Apple_bal", 150, 1, "defeated_gdking"), CreateTradeItem("Cheese_bal", 300, 1, "defeated_dragon"), CreateTradeItem("PowderedSalt_bal", 333, 1, "defeated_gdking"), CreateTradeItem("PowderedPepper_bal", 444, 1, "defeated_bonemass"), CreateTradeItem("RawDragonRibs_bal", 666, 1, "defeated_fader") }; } private List GetHildirItems() { return new List { CreateTradeItem("MythicEye_bal", 6666, 1, "defeated_fader") }; } private void EditTradeItem(string traderName, string itemName, int price = 100, int amount = 1, string globalKey = "", string checkObject = "") { GameObject val = _prefabs.Find((GameObject x) => ((Object)x).name == traderName); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Trader '" + traderName + "' not found.")); return; } Trader component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Debug.LogWarning((object)("Trader component missing on '" + traderName + "'.")); return; } TradeItem val2 = component.m_items.Find((TradeItem x) => ((Object)x.m_prefab).name == itemName); val2.m_stack = amount; val2.m_price = price; val2.m_requiredGlobalKey = globalKey; } private TradeItem CreateTradeItem(string itemName, int price = 100, int amount = 1, string globalKey = "", string checkObject = "") { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown if (checkObject != "") { GameObject val = FindItem(checkObject); if ((Object)(object)val != (Object)null && ((Object)val).name != "Wood") { return null; } } GameObject val2 = FindItem(itemName); if ((Object)(object)val2 == (Object)null) { return null; } return new TradeItem { m_price = price, m_stack = amount, m_requiredGlobalKey = globalKey, m_prefab = val2.GetComponent() }; } private GameObject FindItem(string name) { GameObject val = _prefabs.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("Item Not Found - " + name + ", Replaced With Wood")); return _prefabs.Find((GameObject x) => ((Object)x).name == "Wood"); } } public class ClutterBuilder { public List clutterObjects = new List(); public void createClutterObjects(List gameObjects) { foreach (GameObject gameObject in gameObjects) { generateClutterObjects(gameObject); } } private void generateClutterObjects(GameObject gameObject) { switch (((Object)gameObject).name) { case "PlantFlower2_1": case "PlantFlower2_2": case "PlantFlower2_3": createClutter(gameObject, 10f, 50f, 10f, 500f, (Biome)576); break; case "StalagmiteFloor_1": case "StalagmiteFloor_2": case "StalagmiteFloor_3": case "StalagmiteFloor_4": case "Mushroom_52": case "Mushroom_51": createClutter(gameObject, 5f, 15f, -150f, -1f, (Biome)606); break; case "Seaweed2_1": case "Seaweed2_2": case "Seaweed2_3": case "seaBush8": case "seaBush9": case "seaBush10": case "seaBush11": createClutter(gameObject, 2f, 10f, -150f, -2.5f, (Biome)537); createClutter(gameObject, 1f, 10f, -200f, -2.5f, (Biome)16); break; case "DesertPlant6_1": case "DesertPlant6_2": case "DesertPlant6_3": createClutter(gameObject, 10f, 20f, -1f, 1000f, (Biome)16); break; case "DeepNorthGrass": case "IvyHangingF1": case "IvyHangingF2": case "IvyHangingF3": createClutter(gameObject, 22f, 44f, 1f, 500f, (Biome)1); break; case "IvyGrass1": createClutter(gameObject, 30f, 60f, 1f, 500f, (Biome)16); break; case "small_rock1_deepnorth_bal": case "small_rock2_deepnorth_bal": createClutter(gameObject, 40f, 60f, 1f, 500f, (Biome)16); break; case "small_rock1_bal": case "small_rock2_bal": createClutter(gameObject, 40f, 60f, 1f, 500f, (Biome)16); break; case "PlantG19": case "PlantGS4_1": createClutter(gameObject, 10f, 20f, 1f, 500f, (Biome)536); break; case "PlantG17_1": case "PlantG17_1_F": case "PlantG17_2": case "PlantG17_2_F": case "PlantFlowerF7_1": case "PlantFlowerF7_2": case "PlantFlowerF7_3": case "PlantFlowerS8_1": createClutter(gameObject, 10f, 40f, 1f, 500f, (Biome)520); break; case "IvyLowerF1": case "IvyLowerF2": case "IvyLowerF3": createClutter(gameObject, 22f, 44f, 0f, 500f, (Biome)9); break; case "PlantG6": case "PlantG8": case "PlantG7": case "mistlandsBush6": createClutter(gameObject, 20f, 60f, 1f, 500f, (Biome)520); break; case "SeaweedAshlands1": case "SeaweedAshlands2": case "SeaweedAshlands3": createClutter(gameObject, 10f, 50f, -50f, 1000f, (Biome)32); break; case "AshGrass1": case "AshGrass2": case "AshGrass3": createClutter(gameObject, 50f, 100f, 1f, 500f, (Biome)42); break; case "Tentacles1": case "Tentacles2": case "Tentacles3": createClutter(gameObject, 20f, 50f, 1f, 1000f, (Biome)32); break; case "DesertPlantsGrassCurl_1": case "DesertPlantsGrassCurl_2": case "DesertPlantsGrassCurl_3": createClutter(gameObject, 50f, 100f, 1f, 1000f, (Biome)554); createClutter(gameObject, 2f, 10f, -150f, 5f, (Biome)34); break; case "RedSeaweed1": case "RedSeaweed2": case "RedSeaweed3": createClutter(gameObject, 10f, 20f, -150f, -3f, (Biome)32); break; case "Coral1_Bowl_1": case "Coral1_Bowl_2": case "CoralTussocks1_1": case "CoralTussocks1_2": case "CoralTussocks1_G1": createClutter(gameObject, 10f, 20f, -150f, 15f, (Biome)32); break; case "plant_dn1": case "plant_dn2": case "plant_dn3": case "plant_dn4": case "plant_dn5": case "plant_dn6": case "Coral4_G1": case "Coral4_G2": case "Coral_dn1": case "Coral_dn2": case "Coral_dn3": case "Coral_dn4": createClutter(gameObject, 10f, 30f, -150f, 5f, (Biome)578); break; case "iceweed1": case "iceweed2": case "iceweed3": case "iceweed4": createClutter(gameObject, 10f, 30f, -100f, -1f, (Biome)68); break; case "magicGrass1": case "magicGrass2": createClutter(gameObject, 10f, 30f, -5f, 1000f, (Biome)520); break; case "Mushroom_6G3": case "Mushroom_6G2": case "Mushroom_3G1": case "Mushroom_3G2": case "Mushroom_3G3": case "Mushroom_31": case "Mushroom_32": case "Mushroom_33": case "Mushroom_34": case "Mushroom_35": createClutter(gameObject, 10f, 30f, -50f, 10f, (Biome)512); break; case "ormbunke_bal": createClutter(gameObject, 5f, 10f, -3f, 1000f, (Biome)523); break; case "Swampy1": case "Swampy2": case "Swampy3": case "Swampy4": case "Swampy5": case "Swampy6": case "Swampy7": case "Swampy8": case "Swampy9": case "Swampy10": case "Swampy11": case "Swampy12": createClutter(gameObject, 11f, 22f, -150f, 1000f, (Biome)10); break; } } private void createClutter(GameObject gameObject, float min = 0f, float max = 0f, float altMin = 0f, float altMax = 0f, Biome biome = 1, int amountMin = 10, int amountMax = 50) { //IL_000f: 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) ClutterSettings clutterSettings = new ClutterSettings(); clutterSettings.prefab = gameObject; clutterSettings.biome = biome; clutterSettings.minOceanDepth = min; clutterSettings.maxOceanDepth = max; clutterSettings.minAlt = altMin; clutterSettings.maxAlt = altMax; clutterSettings = aditionalParameters(clutterSettings, snap: false, instanced: false, 10); clutterObjects.Add(clutterSettings); } private ClutterSettings aditionalParameters(ClutterSettings clutterObject, bool snap = false, bool instanced = false, int amountMin = 25, int amountMax = 60) { clutterObject.scaleMin = 0.5f; clutterObject.scaleMax = 1f; clutterObject.snapToWater = snap; clutterObject.instanced = instanced; clutterObject.fractalScale = 1f; clutterObject.fractalTresholdMin = 0.2f; clutterObject.fractalTresholdMax = 1f; clutterObject.amount = amountMin; clutterObject.fractalOffset = 0.2f; return clutterObject; } } public class ClutterSettings { public string name; public Biome biome; public float minOceanDepth; public float maxOceanDepth; public float minAlt; public float maxAlt; public bool snapToWater; public bool instanced; public int amount; public float fractalScale; public float fractalOffset; public float fractalTresholdMin; public float fractalTresholdMax; public float scaleMin; public float scaleMax; public GameObject prefab; } public class ClutterObject { public string name; public bool isPrefab = false; public bool snapToWater; public string biome; public string prefabName = null; public int amount = 1; public int minOceanDepth; public int maxOceanDepth; public int minAlt; public int maxAlt; public float fractalScale = 1f; public float fractalTresholdMin = 0.9f; public float fractalTresholdMax = 1f; public float scaleMin = 0.8f; public float scaleMax = 1.1f; } public class NatureGrowth { public void setupNatureSpawnerOnObjects(ZNetScene zNetScene) { Dictionary dictionary = new Dictionary(); dictionary.Add("Willow_bal", "Willow_Seedling_bal"); dictionary.Add("Poplar_bal", "Poplar_Seedling_bal"); dictionary.Add("Oak2_bal", "Oak_Seedling_bal"); dictionary.Add("Maple_bal", "Maple_Seedling_bal"); dictionary.Add("Beech1", "Beech_Seedling_bal"); dictionary.Add("Birch1", "Birch_Seedling_bal"); dictionary.Add("Birch2", "Birch_Seedling_bal"); dictionary.Add("Birch1_aut", "BirchAut_Seedling_bal"); dictionary.Add("Birch2_aut", "BirchAut_Seedling_bal"); dictionary.Add("SwampTree1", "sapling_Swamp_bal"); dictionary.Add("FirTree", "FirTree_Seedling_bal"); dictionary.Add("Oak1", "Oak_Seedling_bal"); dictionary.Add("Pinetree_01", "PineTree_Seedling_bal"); foreach (KeyValuePair kvp in dictionary) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == kvp.Key); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Tree not found: " + kvp.Key)); continue; } NatureSpawner natureSpawner = val.GetComponent(); if ((Object)(object)natureSpawner == (Object)null) { natureSpawner = val.AddComponent(); } natureSpawner.m_prefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == kvp.Value); } } public void setupNewSaplings(ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "sapling_BirchAtumn_bal"); GameObject item = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Birch1_aut"); GameObject item2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Birch2_aut"); GameObject val2 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "sapling_TentaRoot_bal"); GameObject val3 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "tentacle_plant_bal"); GameObject val4 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "sapling_bush_bal"); GameObject val5 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "sapling_bushPlains_bal"); GameObject val6 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "sapling_bushPlains2_bal"); GameObject val7 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "sapling_Ygg_bal"); GameObject item3 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "YggaShoot1"); GameObject item4 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "YggaShoot2"); GameObject item5 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "YggaShoot3"); List list = new List(); list.Add(item3); list.Add(item4); list.Add(item5); val7.GetComponent().m_grownPrefabs = list.ToArray(); GameObject item6 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Bush01"); List list2 = new List(); list2.Add(item6); val4.GetComponent().m_grownPrefabs = list2.ToArray(); GameObject item7 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Bush01_heath"); List list3 = new List(); list3.Add(item7); val5.GetComponent().m_grownPrefabs = list3.ToArray(); GameObject item8 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Bush02_en"); List list4 = new List(); list4.Add(item8); val6.GetComponent().m_grownPrefabs = list4.ToArray(); CharacterTimedDestruction component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Plant component2 = val.GetComponent(); List list5 = new List(); list5.Add(item); list5.Add(item2); component2.m_grownPrefabs = list5.ToArray(); Plant component3 = val2.GetComponent(); List list6 = new List(); list6.Add(val3); component3.m_grownPrefabs = list6.ToArray(); GameObject val8 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "sapling_Swamp_bal"); Plant component4 = val8.GetComponent(); GameObject item9 = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "SwampTree1"); List list7 = new List(); list7.Add(item9); component4.m_grownPrefabs = list7.ToArray(); } public void setupSeedlings(ZNetScene zNetScene) { Dictionary dictionary = new Dictionary(); dictionary.Add("Willow_Seedling_bal", "sapling_Willow_bal"); dictionary.Add("Cypress_Seedling_bal", "sapling_Cypress_bal"); dictionary.Add("Poplar_Seedling_bal", "sapling_Poplar_bal"); dictionary.Add("Birch_Seedling_bal", "Birch_Sapling"); dictionary.Add("BirchAut_Seedling_bal", "sapling_BirchAtumn_bal"); dictionary.Add("Oak_Seedling_bal", "Oak_Sapling"); dictionary.Add("Maple_Seedling_bal", "sapling_Maple_bal"); dictionary.Add("Beech_Seedling_bal", "Beech_Sapling"); dictionary.Add("PineTree_Seedling_bal", "PineTree_Sapling"); dictionary.Add("FirTree_Seedling_bal", "FirTree_Sapling"); dictionary.Add("Swamp_Seedling_bal", "sapling_Swamp_bal"); foreach (KeyValuePair kvp in dictionary) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == kvp.Key); if ((Object)(object)val == (Object)null) { Debug.LogWarning((object)("Seedling not found: " + kvp.Key)); continue; } PlantSeeder plantSeeder = val.GetComponent(); if ((Object)(object)plantSeeder == (Object)null) { plantSeeder = val.AddComponent(); } plantSeeder.m_prefabToGrow = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == kvp.Value); plantSeeder.m_growTime = 3600f; plantSeeder.m_growTimeMax = 6000f; } } public void setStubReGrowth(ZNetScene zNetScene) { Dictionary dictionary = new Dictionary(); dictionary.Add("Willow_Stub_bal", "Willow_Seedling_bal"); dictionary.Add("Poplar_Stub_bal", "Poplar_Seedling_bal"); dictionary.Add("Oak2_Stub_bal", "Oak_Seedling_bal"); dictionary.Add("Cypress_Stub_bal", "Cypress_Seedling_bal"); dictionary.Add("Maple_Stub_bal", "Maple_Seedling_bal"); dictionary.Add("Beech_Stub", "Beech_Seedling_bal"); dictionary.Add("BirchStub", "Birch_Seedling_bal"); dictionary.Add("BirchAutStub_bal", "BirchAut_Seedling_bal"); dictionary.Add("FirTree_Stub", "FirTree_Seedling_bal"); dictionary.Add("OakStub", "Oak_Seedling_bal"); dictionary.Add("Pinetree_01_Stub", "PineTree_Seedling_bal"); dictionary.Add("SwampTree1_Stub", "Swamp_Seedling_bal"); foreach (KeyValuePair item in dictionary) { checkForPlantScript(item, zNetScene); } } private void checkForPlantScript(KeyValuePair kvp, ZNetScene zNetScene) { GameObject val = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == kvp.Key); Destructible component = val.GetComponent(); GameObject spawnWhenDestroyed = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == kvp.Value); component.m_spawnWhenDestroyed = spawnWhenDestroyed; } } public class VegetationBuilder { public static List ZoneVegetations = new List(); public static List vegNames = new List { "HeathRockPillar", "AshCrow", "MineRock_Obsidian", "MineRock_Tin", "ice1", "ice1_0", "FirTree", "FirTree_small", "Pinetree_01", "Pinetree", "Birch1", "Birch2", "Oak1", "Bush01", "Bush02_en", "rock4_coast", "SwampTree1", "SwampTree2", "Rock_7", "Rock_3", "rock1_mountain", "rock2_mountain", "rock3_mountain", "Dolmen01", "Dolmen02", "Dolmen03", "ShipSetting01", "Crow", "Pickable_BogIronOre", "YggdrasilRoot" }; public Destructible fromRoot = null; private string[] exceptionList = new string[2] { "BirchAutStub_bal", "BlackberryBush2_bal" }; public static void setupVegetation() { VegetationSpawnSetter.CreateSpawnSettings(); VegetationBiomeSettter.CreateBiomeSettings(); VegetationForestSettter.CreateForestSettings(); VegetationLandHeightSetter.CreateLandSettings(); VegetationRotationSetter.CreateRotationSettings(); VegetationSurroundingSetter.CreateSurroudingSettings(); VegetationTerrainSetter.CreateTerrainSettings(); } public void createVegetationObjects(List vegetationList) { foreach (GameObject vegetation in vegetationList) { prepareVegetation(vegetation); } } public void editVege(List vegs) { foreach (string vegName in vegNames) { List list = vegs.FindAll((ZoneVegetation x) => ((Object)x.m_prefab).name == vegName); foreach (ZoneVegetation item in list) { if (item != null && (Object)(object)item.m_prefab.GetComponent() != (Object)null) { EditVegetation(item); } } } string[] array = new string[6] { "FirTree_Sapling", "Oak_Sapling", "PineTree_Sapling", "Beech_Sapling", "Birch_Sapling", "Pickable_MountainCaveObsidian" }; ZNetScene instance = ZNetScene.instance; if (instance == null || !(instance.m_namedPrefabs?.Count > 0)) { return; } string[] array2 = array; foreach (string name in array2) { GameObject val = ZNetScene.instance?.m_prefabs.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { CreateNewVegetationFromVanillaPrefab(val); } } } private void EditVegetation(ZoneVegetation veg) { //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_073f: Unknown result type (might be due to invalid IL or missing references) //IL_0746: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_0779: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) switch (((Object)veg.m_prefab).name) { case "HeathRockPillar": veg.m_biome = (Biome)16; veg.m_groundOffset = -2.5f; break; case "MineRock_Obsidian": veg.m_biome = (Biome)612; veg.m_minAltitude = 50f; veg.m_maxAltitude = 1000f; veg.m_groundOffset = -0.5f; break; case "MineRock_Tin": veg.m_biome = (Biome)76; veg.m_minAltitude = -1.5f; veg.m_maxAltitude = 10f; veg.m_groundOffset = -0.75f; break; case "rock3_ice": veg.m_enable = true; veg.m_biome = (Biome)64; veg.m_min *= 1.25f; veg.m_max *= 1.25f; break; case "ice1": case "ice1_0": if (Object.op_Implicit((Object)(object)veg.m_prefab.GetComponent())) { DropOnDestroyed val = veg.m_prefab.AddComponent(); } veg.m_biome = (Biome)68; veg.m_min *= 2f; veg.m_max *= 2f; veg.m_groupRadius = 100f; veg.m_groupSizeMax = 4; veg.m_groupSizeMin = 1; veg.m_scaleMin = 0.5f; veg.m_scaleMax = 2f; break; case "SwampTree2": case "SwampTree1": veg.m_min *= 0.75f; veg.m_max *= 0.75f; veg.m_enable = true; break; case "YggdrasilRoot": { ResourceRoot component = veg.m_prefab.GetComponent(); component.m_regenPerSec = 5f; break; } case "FirTree": case "FirTree_small": case "Pinetree_01": case "Pinetree": case "Birch1": case "Birch2": veg.m_min *= 0.75f; veg.m_max *= 0.75f; veg.m_enable = true; break; case "Pickable_BogIronOre": veg.m_enable = true; veg.m_biome = (Biome)534; break; case "Oak1": veg.m_min *= 1.5f; veg.m_max *= 1.5f; veg.m_groupSizeMin = 3; veg.m_groupSizeMax = 6; veg.m_minAltitude = 20f; veg.m_biome = (Biome)5; break; case "Bush01": case "Bush02_en": veg.m_biome = (Biome)(veg.m_biome | 4); break; case "Rock_3": veg.m_enable = true; veg.m_biome = (Biome)27; veg.m_minAltitude = -1f; veg.m_maxAltitude = 1000f; veg.m_groundOffset = -1f; veg.m_groupSizeMin = 1; veg.m_groupSizeMax = 1; veg.m_min = 1f; veg.m_max = 1f; veg.m_minOceanDepth = 0f; veg.m_maxOceanDepth = 3f; break; case "rock4_coast": case "Rock_7": case "rock1_mountain": case "rock2_mountain": case "rock3_mountain": veg.m_enable = true; veg.m_biome = (Biome)(veg.m_biome | 0x40); break; case "rock3_silver": veg.m_enable = true; veg.m_min = 0.01f; veg.m_max = 0.15f; veg.m_groundOffset = -2.5f; veg.m_biome = (Biome)64; break; case "Dolmen01": case "Dolmen02": case "Dolmen03": case "ShipSetting01": veg.m_enable = true; veg.m_biome = (Biome)64; break; } } private void CreateNewVegetationFromVanillaPrefab(GameObject obj) { switch (((Object)obj).name) { case "Pickable_Obsidian": setupVegetation(obj, 1f, 3f, 1, 2, 0f, 10f, 0f, 0f, 75f, 1000f, (Biome)100, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "Pickable_MountainCaveObsidian": setupVegetation(obj, 1f, 3f, 1, 2, 0f, 10f, 0f, 0f, 75f, 1000f, (Biome)36, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "Oak_Sapling": setupVegetation(obj, 1f, 1f, 1, 1, 0f, 10f, 0f, 5f, 0f, 1000f, (Biome)1, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "FirTree_Sapling": case "PineTree_Sapling": setupVegetation(obj, 1f, 1f, 1, 1, 0f, 10f, 0f, 5f, 0f, 1000f, (Biome)12, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "Birch_Sapling": setupVegetation(obj, 1f, 1f, 1, 1, 0f, 10f, 0f, 5f, 0f, 1000f, (Biome)1, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "Beech_Sapling": setupVegetation(obj, 1f, 1f, 1, 1, 0f, 10f, 0f, 5f, 0f, 1000f, (Biome)1, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; } } private void prepareVegetation(GameObject obj) { switch (((Object)obj).name) { case "coal_rock1_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -3f, 0f, 0f, 0f, 20f, 1000f, (Biome)528, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "coal_rock_nomoss_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -3.5f, 0f, 0f, 0f, 20f, 1000f, (Biome)96, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "YewTree_bal": setupVegetation(obj, 0.05f, 0.25f, 1, 2, -2f, 300f, 0f, 5f, 10f, 1000f, (Biome)528, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "gold_Rock_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -3.5f, 200f, 0f, 30f, -50f, 1000f, (Biome)96, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "ChitinDeposit_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 2, -1f, 50f, 0f, 0f, -5f, 10f, (Biome)578, isScaled: false, inForest: false, 33f, 33f, (BiomeArea)3); break; case "Waystone_bal": setupVegetation(obj, 0.001f, 0.01f, 1, 1, -0.5f, 100f, 0f, 0f, 15f, 1000f, (Biome)112, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "clamChestSmall_bal": case "clamChest_bal": setupVegetation(obj, 0.75f, 1.25f, 1, 1, -1f, 50f, 0.1f, 0f, -5f, 2f, (Biome)850, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; case "Pickable_Clay_bal": setupVegetation(obj, 5f, 10f, 2, 5, 0f, 20f, 1f, 3f, -1f, 25f, (Biome)539, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; case "Poplar_bal": setupVegetation(obj, 0.75f, 1.5f, 4, 8, -2f, 100f, 0f, 5f, 0f, 1000f, (Biome)12, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "sapling_Poplar_bal": setupVegetation(obj, 0.5f, 0.75f, 3, 6, -2f, 100f, 0f, 5f, 50f, 1000f, (Biome)12, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": setupVegetation(obj, 0.75f, 2f, 1, 1, 0f, 0f, 0f, 5f, -2f, 1000f, (Biome)2, isScaled: true, inForest: true, 15f, 15f, (BiomeArea)3); break; case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": setupVegetation(obj, 1f, 1f, 1, 1, 0f, 0f, 0f, 5f, 0f, 1000f, (Biome)2, isScaled: true, inForest: true, 11f, 22f, (BiomeArea)3); break; case "SeekerBroodSpawner_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -0.5f, 0f, 0f, 0f, 10f, 100f, (Biome)512, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "DeathsquitoHive_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -0.5f, 0f, 0f, 0f, -2f, 10f, (Biome)16, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_MeadowsMeatPile01_bal": setupVegetation(obj, 0.05f, 0.1f, 0, 1, 0f, 100f, 0f, 0f, -2f, 10000f, (Biome)11, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_MeadowsMeatPile02_bal": setupVegetation(obj, 0.05f, 0.1f, 0, 1, 0f, 100f, 0f, 0f, -2f, 10000f, (Biome)20, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; case "Pickable_Straw_bal": setupVegetation(obj, 2f, 6f, 2, 4, -0.5f, 90f, 0f, 0f, 5f, 1000f, (Biome)17, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; case "Pickable_Straw_DeepNorth_bal": setupVegetation(obj, 2f, 6f, 2, 4, -0.5f, 30f, 0f, 0f, 5f, 1000f, (Biome)64, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; case "Pickable_Mushroom_Inkcap_bal": setupVegetation(obj, 0.05f, 0.25f, 2, 4, 0f, 10f, 0f, 0f, 5f, 60f, (Biome)16, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; case "icePlate_bal": case "Pickable_Mushroom_Icecap_bal": setupVegetation(obj, 0.25f, 0.75f, 1, 3, 0f, 100f, 0f, 0f, 1f, 1000f, (Biome)64, isScaled: true, inForest: false, 0f, 0f, (BiomeArea)3); break; case "IceberryBush_bal": setupVegetation(obj, 0.5f, 1f, 1, 3, 0f, 100f, 0f, 0f, 1f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 33f, (BiomeArea)3); break; case "BlackberryBush_bal": setupVegetation(obj, 1f, 2f, 1, 3, 0f, 50f, 0f, 0f, 1f, 1000f, (Biome)10, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Lingonberry_shrub_bal": setupVegetation(obj, 1f, 2f, 1, 3, 0f, 50f, 0f, 0f, 1f, 1000f, (Biome)68, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_SeedGarlic_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, 0f, 10f, 0f, 0f, 1f, 1000f, (Biome)16, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_SeedCabbage_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, 0f, 10f, 0f, 0f, 1f, 1000f, (Biome)4, isScaled: true, inForest: false, 33f, 33f, (BiomeArea)2); break; case "ElderMushroom_bal": setupVegetation(obj, 2f, 4f, 1, 2, -1f, 10f, 0f, 5f, 5f, 100f, (Biome)512, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "SeekerEgg_bal": setupVegetation(obj, 2f, 4f, 3, 9, -0.1f, 5f, 0f, 0f, 15f, 500f, (Biome)512, isScaled: true, inForest: true, 11f, 22f, (BiomeArea)3); break; case "AshlandsDryBush_bal": setupVegetation(obj, 1f, 3f, 1, 2, -0.25f, 10f, 0f, 5f, 10f, 1000f, (Biome)32, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "DryBush1_bal": case "DryBush2_bal": setupVegetation(obj, 1f, 3f, 1, 2, -0.25f, 10f, 0f, 5f, 0f, 1000f, (Biome)64, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "shrub_bal": case "BushDark_bal": setupVegetation(obj, 1f, 2f, 1, 2, -0.25f, 10f, 0f, 5f, 0f, 1000f, (Biome)522, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); setupVegetation(obj, 5f, 10f, 2, 4, -0.25f, 10f, 0f, 5f, 0f, 1000f, (Biome)64, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "AcaiTree_New_bal": setupVegetation(obj, 1f, 2f, 4, 8, -2f, 10f, 0f, 5f, 0f, 1000f, (Biome)512, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "sapling_Willow_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, 0f, 10f, 0f, 5f, -1f, 40f, (Biome)1, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "sapling_BirchAtumn_bal": setupVegetation(obj, 1f, 1f, 1, 3, 0f, 10f, 0f, 5f, 0f, 1000f, (Biome)16, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "sapling_AcaiTree_bal": setupVegetation(obj, 1f, 1f, 1, 1, -2f, 0f, 0f, 5f, 0f, 1000f, (Biome)512, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "Acai_Dead_bal": setupVegetation(obj, 1f, 2f, 1, 1, -2f, 0f, 0f, 5f, 0f, 1000f, (Biome)2, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); break; case "Oak_Swamp_bal": setupVegetation(obj, 1f, 2f, 1, 3, -1f, 0f, 0f, 5f, 0f, 1000f, (Biome)2, isScaled: true, inForest: true, 11f, 30f, (BiomeArea)3); setupVegetation(obj, 0.01f, 0.05f, 1, 2, -2.5f, 0f, 0f, 0f, 10f, 1000f, (Biome)68, isScaled: true, inForest: true, 33f, 66f, (BiomeArea)3); break; case "widestone_bal": setupVegetation(obj, 0.1f, 0.2f, 1, 2, -2.5f, 0f, 0f, 0f, 10f, 1000f, (Biome)68, isScaled: true, inForest: true, 33f, 66f, (BiomeArea)3); break; case "Willow_bal": setupVegetation(obj, 1f, 2f, 1, 2, -1.5f, 50f, 0f, 5f, 0f, 40f, (Biome)1, isScaled: true, inForest: false, 11f, 22f, (BiomeArea)3); break; case "Cypress_bal": setupVegetation(obj, 0.05f, 0.25f, 3, 9, -2f, 10f, 0f, 0f, 20f, 1000f, (Biome)8, isScaled: true, inForest: true, 11f, 15f, (BiomeArea)3); setupVegetation(obj, 0.05f, 0.1f, 6, 24, -2f, 5f, 0f, 0f, 10f, 1000f, (Biome)64, isScaled: true, inForest: true, 11f, 15f, (BiomeArea)3); break; case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": setupVegetation(obj, 0.5f, 1f, 2, 4, -2f, 100f, 0f, 5f, 20f, 1000f, (Biome)16, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "sapling_bush_blackberry_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -2f, 100f, 0f, 5f, 20f, 1000f, (Biome)10, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -2f, 100f, 0f, 5f, 20f, 1000f, (Biome)9, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "sapling_bush_bal": setupVegetation(obj, 0.5f, 1f, 2, 4, -2f, 100f, 0f, 5f, 20f, 1000f, (Biome)25, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "sapling_Swamp_bal": setupVegetation(obj, 0.25f, 0.5f, 2, 4, -2f, 100f, 0f, 5f, 20f, 1000f, (Biome)2, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "sapling_Cypress_bal": setupVegetation(obj, 0.5f, 1f, 2, 4, -2f, 100f, 0f, 5f, 20f, 1000f, (Biome)8, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)3); break; case "ElderTreeStump_bal": case "ElderTree_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 3, -1.5f, 0f, 0f, 10f, 5f, 1000f, (Biome)64, isScaled: true, inForest: true, 22f, 30f, (BiomeArea)2); break; case "HugeRoot1_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -1.5f, 100f, 0f, 0f, 2f, 1000f, (Biome)586, isScaled: true, inForest: true, 20f, 35f, (BiomeArea)3); break; case "FallenTreeDeepNorth_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -1.5f, 100f, 0f, 0f, -10f, 1000f, (Biome)64, isScaled: true, inForest: true, 20f, 35f, (BiomeArea)3); break; case "IcedTree_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 1, -1.5f, 0f, 0f, 0f, 5f, 1000f, (Biome)64, isScaled: true, inForest: false, 5f, 11f, (BiomeArea)2); break; case "AncientSkullRock_bal": setupVegetation(obj, 0.01f, 0.03f, 1, 1, -1f, 100f, 0f, 0f, -1000f, 1000f, (Biome)626, isScaled: false, inForest: false, 75f, 90f, (BiomeArea)3); break; case "loxSkeleton_bal": setupVegetation(obj, 0.1f, 0.25f, 1, 1, -1.5f, 100f, 0f, 0f, -1000f, 20f, (Biome)86, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); setupVegetation(obj, 0.5f, 1f, 1, 3, -1f, 100f, 0f, 0f, -1000f, 20f, (Biome)80, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -2.5f, 500f, 0f, 0f, -1000f, 30f, (Biome)630, isScaled: false, inForest: false, 99f, 99f, (BiomeArea)3); break; case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": setupVegetation(obj, 0.005f, 0.02f, 1, 1, -2f, 100f, 0f, 0f, -50f, 1000f, (Biome)630, isScaled: false, inForest: false, 75f, 90f, (BiomeArea)3); break; case "DrakeSpawner_bal": setupVegetation(obj, 0.05f, 0.1f, 0, 1, -0.5f, 50f, 0f, 0f, 20f, 1000f, (Biome)4, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "RockGolemSpawn_bal": setupVegetation(obj, 0.001f, 0.01f, 0, 1, -0.5f, 50f, 0f, 0f, 20f, 1000f, (Biome)4, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); setupVegetation(obj, 0.01f, 0.05f, 1, 1, -0.5f, 50f, 0f, 0f, 20f, 1000f, (Biome)64, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "SurtlingSpawner_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -0.5f, 50f, 0f, 0f, 15f, 1000f, (Biome)32, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "bloodshard_deposit_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -0.2f, 50f, 0f, 0f, -10f, 1000f, (Biome)32, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "MineRock_MeteoriteNew_bal": setupVegetation(obj, 0.1f, 0.1f, 1, 1, -0.5f, 50f, 0f, 0f, -10f, 1000f, (Biome)32, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "MineRock_Lead_bal": setupVegetation(obj, 0.75f, 1f, 1, 2, -1f, 50f, 0f, 0f, 25f, 1000f, (Biome)84, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "MineRock_Zinc_bal": setupVegetation(obj, 0.75f, 1f, 1, 2, -1f, 50f, 0f, 0f, 25f, 1000f, (Biome)589, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "rock_silver_small_bal": setupVegetation(obj, 0.75f, 1f, 1, 2, -3f, 80f, 0f, 0f, 75f, 1000f, (Biome)68, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "MineRock_DarkIron_bal": setupVegetation(obj, 0.75f, 1f, 1, 1, -1f, 80f, 0f, 0f, 0f, 1000f, (Biome)512, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "MineRock_Borax_bal": setupVegetation(obj, 0.75f, 1f, 1, 1, -0.5f, 80f, 0f, 0f, 5f, 1000f, (Biome)512, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "MineRock_Blackmetal_bal": setupVegetation(obj, 0.75f, 1f, 1, 1, -1f, 50f, 0f, 0f, 15f, 1000f, (Biome)528, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "flowstone_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -0.35f, 50f, 0f, 0f, 10f, 1000f, (Biome)18, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "flowstone_ice_bal": setupVegetation(obj, 0.25f, 0.75f, 1, 1, -0.5f, 50f, 0f, 0f, 10f, 1000f, (Biome)64, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "stalagmite_ice_bal": setupVegetation(obj, 0.25f, 0.5f, 2, 4, -1f, 50f, 0f, 0f, 10f, 1000f, (Biome)64, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "stalagmite_ash_bal": setupVegetation(obj, 0.25f, 0.5f, 2, 4, -1f, 50f, 0f, 0f, 10f, 1000f, (Biome)32, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "MineRock_Cobalt_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -0.25f, 50f, 0f, 0f, 10f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "MineRock_CoalSnow_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -1f, 50f, 0f, 0f, 30f, 1000f, (Biome)68, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "MineRock_Coal_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -1f, 50f, 0f, 0f, 40f, 1000f, (Biome)520, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); setupVegetation(obj, 0.25f, 0.5f, 1, 2, -1f, 50f, 0f, 0f, 10f, 1000f, (Biome)34, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "MineRock_Nickel_bal": setupVegetation(obj, 0.1f, 0.25f, 1, 1, -3f, 50f, 0f, 0f, 40f, 1000f, (Biome)16, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); setupVegetation(obj, 0.1f, 0.2f, 1, 1, -3.5f, 50f, 0f, 0f, 40f, 1000f, (Biome)9, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); setupVegetation(obj, 0.1f, 0.2f, 1, 2, -3f, 50f, 0f, 0f, 60f, 1000f, (Biome)68, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "MineRock_Copper_bal": setupVegetation(obj, 0.1f, 0.25f, 1, 2, -1.25f, 50f, 0f, 0f, 20f, 1000f, (Biome)24, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); setupVegetation(obj, 0.5f, 0.75f, 1, 2, -2f, 50f, 0f, 0f, 20f, 1000f, (Biome)68, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "MineRock_IronSnow_bal": setupVegetation(obj, 0.1f, 0.25f, 1, 1, -4f, 50f, 0f, 0f, 66f, 1000f, (Biome)68, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "MineRock_IronNew_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -2.5f, 50f, 0f, 0f, 0f, 1000f, (Biome)2, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); setupVegetation(obj, 0.15f, 0.25f, 1, 1, -3f, 50f, 0f, 0f, 33f, 1000f, (Biome)16, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "FloatingDebris_bal": setupVegetation(obj, 0.05f, 0.05f, 1, 1, -1f, 100f, 0f, 0f, -1000f, -3f, (Biome)256, isScaled: false, inForest: false, 11f, 22f, (BiomeArea)2); break; case "rock_nickel_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 1, -4f, 100f, 0f, 0f, 45f, 1000f, (Biome)513, isScaled: true, inForest: false, 22f, 99f, (BiomeArea)3); break; case "rock_nickel_nomoss_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -4f, 100f, 0f, 0f, 45f, 1000f, (Biome)68, isScaled: true, inForest: false, 22f, 99f, (BiomeArea)3); break; case "iceLump_bal": setupVegetation(obj, 0.1f, 0.3f, 1, 3, -1f, 10f, 2f, 30f, -2f, -0.5f, (Biome)64, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "Pickable_TinNew_bal": setupVegetation(obj, 0.5f, 1f, 3, 6, -0.25f, 2f, 0f, 5f, -10f, 1000f, (Biome)68, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "Pickable_MeteoriteNew_bal": setupVegetation(obj, 0.5f, 1f, 1, 3, -0.25f, 10f, 0f, 0f, -3f, 1000f, (Biome)32, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "Pickable_MagmaStone_bal": setupVegetation(obj, 1f, 2f, 1, 3, -0.25f, 10f, 0f, 0f, -3f, 1000f, (Biome)32, isScaled: false, inForest: false, 0f, 90f, (BiomeArea)3); break; case "deposit_jotunfinger_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, 0f, 10f, 0f, 10f, 1f, 1000f, (Biome)64, isScaled: true, inForest: false, 15f, 33f, (BiomeArea)2); break; case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, 0f, 10f, 0f, 0f, 1f, 1000f, (Biome)64, isScaled: true, inForest: false, 5f, 15f, (BiomeArea)2); break; case "cliff_mistlands_Arch_bal": setupVegetation(obj, 0.05f, 0.25f, 1, 1, -1f, 10f, 0f, 0f, -500f, 1000f, (Biome)512, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)3); break; case "cliff_deepnorth_Arch_bal": setupVegetation(obj, 0.05f, 0.25f, 1, 3, -2f, 10f, 0f, 0f, -500f, 1000f, (Biome)64, isScaled: true, inForest: true, 5f, 15f, (BiomeArea)1); break; case "cliff_deepnorth_bal": setupVegetation(obj, 0.001f, 0.01f, 1, 1, -3f, 0f, 0f, 0f, -500f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)3); break; case "basaltCliff_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -2f, 0f, 0f, 0f, -500f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 66f, (BiomeArea)2); break; case "iceblock_rock_bal": setupVegetation(obj, 0.05f, 0.25f, 1, 1, -1f, 0f, 0f, 20f, -500f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 33f, (BiomeArea)2); break; case "rock2_ice_bal": case "rock3_ice_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -2f, 0f, 0f, 50f, -500f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)2); break; case "SnowyRockPillar_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 2, -2.5f, 0f, 0f, 50f, -500f, 1000f, (Biome)68, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)3); break; case "IceCliff1_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -3f, 0f, 0f, 50f, -500f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)3); break; case "IceCliff2_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -3f, 0f, 0f, 50f, -500f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)1); break; case "IceCliff3_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -3f, 0f, 0f, 50f, -500f, 1000f, (Biome)64, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)1); break; case "ClayDeposit_bal": setupVegetation(obj, 1.25f, 1.75f, 1, 2, -1f, 50f, 0f, 4f, -3.5f, 15f, (Biome)19, isScaled: true, inForest: false, 33f, 99f, (BiomeArea)3); break; case "cliff_deepnorth2_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -3.5f, 0f, 0f, 20f, -500f, 1000f, (Biome)64, isScaled: true, inForest: true, 11f, 33f, (BiomeArea)1); break; case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "RockDolmenSnow4_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 3, -0.25f, 0f, 0f, 0f, -500f, 1000f, (Biome)68, isScaled: true, inForest: true, 77f, 77f, (BiomeArea)3); break; case "AshRock1_bal": case "AshRockPillar_bal": setupVegetation(obj, 0.25f, 0.5f, 1, 2, -2f, 0f, 0f, 5f, -10f, 1000f, (Biome)32, isScaled: true, inForest: true, 0f, 90f, (BiomeArea)3); break; case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": setupVegetation(obj, 2f, 4f, 1, 3, -0.25f, 0f, 0f, 30f, -50f, 1000f, (Biome)32, isScaled: true, inForest: true, 77f, 77f, (BiomeArea)3); break; case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": setupVegetation(obj, 1f, 2f, 1, 3, -0.25f, 0f, 0f, 30f, -50f, 1000f, (Biome)64, isScaled: true, inForest: true, 77f, 77f, (BiomeArea)3); break; case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": setupVegetation(obj, 1f, 2f, 1, 3, -0.25f, 0f, 0f, 30f, -50f, 1000f, (Biome)96, isScaled: true, inForest: true, 0f, 90f, (BiomeArea)3); break; case "cliff_deepnorth_rock_bal": setupVegetation(obj, 1f, 2f, 1, 1, -0.5f, 10f, 0f, 30f, -5f, 200f, (Biome)64, isScaled: true, inForest: true, 33f, 90f, (BiomeArea)3); break; case "cliff_mistlands_rock_bal": setupVegetation(obj, 1f, 2f, 1, 1, -0.5f, 10f, 0f, 30f, -5f, 200f, (Biome)512, isScaled: true, inForest: true, 0f, 90f, (BiomeArea)3); break; case "caverock_magma_stalagmite_broken_bal": setupVegetation(obj, 0.1f, 0.2f, 1, 3, -0.2f, 0f, 0f, 30f, -50f, 1000f, (Biome)32, isScaled: true, inForest: true, 0f, 90f, (BiomeArea)3); break; case "DragonSkull2_bal": case "DragonSkull_bal": setupVegetation(obj, 0.01f, 0.03f, 0, 1, -1.5f, 500f, 0f, 0f, -1000f, 1000f, (Biome)32, isScaled: true, inForest: true, 77f, 77f, (BiomeArea)3); break; case "MammothSkull_bal": setupVegetation(obj, 0.05f, 0.1f, 1, 1, -2f, 10f, 0f, 0f, -1000f, 1000f, (Biome)64, isScaled: true, inForest: true, 11f, 33f, (BiomeArea)3); break; case "rock_ashlands_bal": setupVegetation(obj, 1f, 2f, 1, 3, -0.25f, 0f, 0f, 30f, -50f, 1000f, (Biome)32, isScaled: true, inForest: true, 0f, 90f, (BiomeArea)3); break; case "Pickable_Mushroom_grayNew_bal": setupVegetation(obj, 1f, 2f, 1, 2, -0.05f, 90f, 0f, 0f, 25f, 1000f, (Biome)520, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Mushroom_blue_bal": setupVegetation(obj, 1f, 2f, 1, 2, -0.05f, 90f, 0f, 0f, 50f, 1000f, (Biome)4, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Mycelium_bal": setupVegetation(obj, 1f, 1f, 1, 1, -0.1f, 90f, 0f, 0f, -1f, 1000f, (Biome)2, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Mushroom_Darkbul_bal": setupVegetation(obj, 1.5f, 1.75f, 2, 3, -0.05f, 90f, 0f, 0f, -1f, 55f, (Biome)2, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Mushroom_blueNew_bal": setupVegetation(obj, 1f, 2f, 1, 2, -0.05f, 90f, 0f, 0f, 50f, 1000f, (Biome)4, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Nettle_bal": setupVegetation(obj, 1f, 2f, 1, 2, -0.5f, 90f, 0f, 0f, 15f, 1000f, (Biome)512, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Sage_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, -0.5f, 90f, 0f, 0f, 5f, 1000f, (Biome)8, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Lavender_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, -0.5f, 90f, 0f, 0f, 5f, 1000f, (Biome)16, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_RottenVegetable_bal": setupVegetation(obj, 0.5f, 1f, 1, 1, -0.5f, 90f, 0f, 0f, 5f, 1000f, (Biome)542, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Mint_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, -0.5f, 90f, 0f, 0f, 5f, 1000f, (Biome)1, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Plantain_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, -0.5f, 90f, 0f, 0f, 0f, 1000f, (Biome)2, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Mugwort_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, -0.5f, 90f, 0f, 0f, -1f, 1000f, (Biome)2, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Seaberry_bal": setupVegetation(obj, 1f, 3f, 1, 2, -0.5f, 90f, 0f, 0f, 15f, 1000f, (Biome)512, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Bloodvine_bal": setupVegetation(obj, 1f, 2f, 1, 2, -0.5f, 90f, 0f, 0f, 5f, 1000f, (Biome)32, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Snowleaf_bal": setupVegetation(obj, 1f, 2f, 1, 2, -0.5f, 90f, 0f, 0f, 5f, 1000f, (Biome)64, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_Ignicap_bal": setupVegetation(obj, 1f, 1.5f, 1, 2, 0f, 10f, 0f, 0f, 10f, 1000f, (Biome)32, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)2); break; case "Pickable_waterlily_bal": setupVegetation(obj, 0.5f, 1f, 1, 2, 0f, 10f, 1f, 5f, -50f, 1f, (Biome)531, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; case "Pickable_Kelp_bal": setupVegetation(obj, 1.25f, 1.75f, 1, 2, 0f, 10f, 3f, 5f, -50f, -4f, (Biome)562, isScaled: true, inForest: false, 0f, 90f, (BiomeArea)3); break; } } public static void CreateZoneVegetationWithGroups(string name, GameObject prefab, bool enable, bool forcePlacement, VegetationSpawnSettings spawnSettings, VegetationLandHeight landHeight, VegetationBiomeSettings biomeSettings, bool blockCheck, bool snapToStaticSolid, VegetationSurroundingSetting vegetationSettings, VegetationRotationSetting rotationSetting, VegetationTerrainSettings terrainSettings, VegetationForestSettings forestSettings) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) CreateZoneVegetation(name, prefab, enable, spawnSettings.Min, spawnSettings.Max, forcePlacement, 1f, 1f, rotationSetting.RandTilt, rotationSetting.ChanceToUseGroundTilt, biomeSettings.Biome, biomeSettings.BiomeArea, blockCheck, snapToStaticSolid, landHeight.MinAltitude, landHeight.MaxAltitude, vegetationSettings.MinVegetation, vegetationSettings.MaxVegetation, vegetationSettings.SurroundCheckVegetation, vegetationSettings.SurroundCheckDistance, vegetationSettings.SurroundCheckLayers, vegetationSettings.SurroundBetterThanAverage, landHeight.MinOceanDepth, landHeight.MaxOceanDepth, rotationSetting.MinTilt, rotationSetting.MaxTilt, terrainSettings.TerrainDeltaRadius, terrainSettings.MaxTerrainDelta, terrainSettings.MinTerrainDelta, terrainSettings.SnapToWater, spawnSettings.GroundOffset, spawnSettings.GroupSizeMin, spawnSettings.GroupSizeMax, spawnSettings.GroupRadius, forestSettings.InForest, forestSettings.ForestThresholdMin, forestSettings.ForestThresholdMax); } public static void CreateZoneVegetation(string name = "balrond-vegetation", GameObject prefab = null, bool enable = true, float min = 0f, float max = 10f, bool forcePlacement = false, float scaleMin = 1f, float scaleMax = 1f, float randTilt = 0f, float chanceToUseGroundTilt = 0f, Biome biome = 0, BiomeArea biomeArea = 3, bool blockCheck = true, bool snapToStaticSolid = false, float minAltitude = -1000f, float maxAltitude = 1000f, float minVegetation = 0f, float maxVegetation = 0f, bool surroundCheckVegetation = false, float surroundCheckDistance = 20f, int surroundCheckLayers = 2, float surroundBetterThanAverage = 0f, float minOceanDepth = 0f, float maxOceanDepth = 0f, float minTilt = 0f, float maxTilt = 90f, float terrainDeltaRadius = 0f, float maxTerrainDelta = 2f, float minTerrainDelta = 0f, bool snapToWater = false, float groundOffset = 0f, int groupSizeMin = 1, int groupSizeMax = 1, float groupRadius = 0f, bool inForest = false, float forestTresholdMin = 0f, float forestTresholdMax = 1f) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a1: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown ZoneVegetation vegetation = new ZoneVegetation { m_name = name, m_prefab = prefab, m_enable = enable, m_min = min, m_max = max, m_forcePlacement = forcePlacement, m_scaleMin = scaleMin, m_scaleMax = scaleMax, m_randTilt = randTilt, m_chanceToUseGroundTilt = chanceToUseGroundTilt, m_biome = biome, m_biomeArea = biomeArea, m_blockCheck = blockCheck, m_snapToStaticSolid = snapToStaticSolid, m_minAltitude = minAltitude, m_maxAltitude = maxAltitude, m_minVegetation = minVegetation, m_maxVegetation = maxVegetation, m_surroundCheckVegetation = surroundCheckVegetation, m_surroundCheckDistance = surroundCheckDistance, m_surroundCheckLayers = surroundCheckLayers, m_surroundBetterThanAverage = surroundBetterThanAverage, m_minOceanDepth = minOceanDepth, m_maxOceanDepth = maxOceanDepth, m_minTilt = minTilt, m_maxTilt = maxTilt, m_terrainDeltaRadius = terrainDeltaRadius, m_maxTerrainDelta = maxTerrainDelta, m_minTerrainDelta = minTerrainDelta, m_snapToWater = snapToWater, m_groundOffset = groundOffset, m_groupSizeMin = groupSizeMin, m_groupSizeMax = groupSizeMax, m_groupRadius = groupRadius, m_inForest = inForest, m_forestTresholdMin = forestTresholdMin, m_forestTresholdMax = forestTresholdMax }; ZoneVegetation val = ZoneVegetations.Find((ZoneVegetation x) => x.m_name == vegetation.m_name && x.m_biome == vegetation.m_biome); if (val != null) { Debug.LogWarning((object)(Launch.projectName + ": Vegetation already exists: " + name)); } else { ZoneVegetations.Add(vegetation); } } private void setupVegetation(GameObject obj, float min, float max, int groupMin, int groupMax, float groundOffset, float groupRadius, float minOcean, float maxOcean, float minAlt, float maxAlt, Biome biome = 1, bool isScaled = true, bool inForest = false, float randTilt = 0f, float maxTilt = 90f, BiomeArea area = 3, bool forceplacment = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) ZoneVegetation val = new ZoneVegetation(); val.m_prefab = obj; val.m_name = ((Object)obj).name; val.m_enable = true; val.m_min = min; val.m_max = max; val.m_groundOffset = groundOffset; val.m_groupSizeMin = groupMin; val.m_groupSizeMax = groupMax; val.m_groupRadius = groupRadius; val.m_scaleMin = (isScaled ? 0.75f : 0.9f); val.m_scaleMax = (isScaled ? 1.5f : 1.1f); val.m_minOceanDepth = minOcean; val.m_maxOceanDepth = maxOcean; val.m_minAltitude = minAlt; val.m_maxAltitude = maxAlt; val.m_minTilt = 0f; val.m_maxTilt = maxTilt; val.m_randTilt = randTilt; if (maxTilt > 0f) { val.m_chanceToUseGroundTilt = 0.3f; } else { val.m_chanceToUseGroundTilt = 0f; } val.m_terrainDeltaRadius = 0f; val.m_minTerrainDelta = 0.1f; val.m_maxTerrainDelta = 2f; val.m_forestTresholdMin = (inForest ? 0 : 0); val.m_forestTresholdMax = (inForest ? 50 : 2); val.m_foldout = true; val.m_blockCheck = true; val.m_snapToWater = false; val.m_inForest = inForest; val.m_forcePlacement = forceplacment; val.m_surroundCheckDistance = 3f; val.m_surroundCheckVegetation = true; val.m_biome = biome; val.m_biomeArea = (BiomeArea)3; ZoneVegetations.Add(val); } public string PrepareVegetationName(string prefabName, string note) { return prefabName + "-" + note; } } public class VegetationDropFix { public List items; private readonly Dictionary _itemCache = new Dictionary(); public void fixDrops(List list, ZNetScene zNetScene) { items = list; _itemCache.Clear(); foreach (GameObject item in list) { Pickable component = item.GetComponent(); if ((Object)(object)component != (Object)null) { fixPlant(component); } DropOnDestroyed component2 = item.GetComponent(); if ((Object)(object)component2 != (Object)null) { fixPDestructable(component2); } TreeLog component3 = item.GetComponent(); if ((Object)(object)component3 != (Object)null) { fixTreeLog(component3); } TreeBase component4 = item.GetComponent(); if ((Object)(object)component4 != (Object)null) { fixTreeBase(component4, zNetScene); } MineRock5 component5 = item.GetComponent(); if ((Object)(object)component5 != (Object)null) { fixMineRock5(component5); } } } private GameObject FindItem(List list, string name) { GameObject val = list.Find((GameObject x) => ((Object)x).name == name); if ((Object)(object)val != (Object)null) { return val; } Debug.LogWarning((object)("BalrondAmazingNature: Item Not Found:" + name)); return null; } public string editZnetName(string name) { name = name.Replace("(Clone)", ""); int num = name.IndexOf("("); if (num >= 0) { name = name.Substring(0, num); } return name.Trim(); } private void AddDrop(List dropList, string itemName, int min, int max, float weight, bool dontScale = false) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!_itemCache.TryGetValue(itemName, out var value)) { value = FindItem(items, itemName); if ((Object)(object)value != (Object)null) { _itemCache[itemName] = value; } } if ((Object)(object)value != (Object)null) { dropList.Add(new DropData { m_item = value, m_stackMin = min, m_stackMax = max, m_weight = weight, m_dontScale = dontScale }); } } private void AddDropsToList(List dropList, params (string itemName, int min, int max, float weight, bool dontScale)[] drops) { for (int i = 0; i < drops.Length; i++) { var (itemName, min, max, weight, dontScale) = drops[i]; AddDrop(dropList, itemName, min, max, weight, dontScale); } } private void AddDropToDropOnDestroyed(TreeLog treeLog, string itemName, int min, int max, float weight, bool dontScale = false) { AddDrop(treeLog.m_dropWhenDestroyed.m_drops, itemName, min, max, weight, dontScale); } private void InitDropOnDestroyed(TreeLog treeLog, int dropMin, int dropMax) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (!((Object)(object)treeLog == (Object)null)) { if (treeLog.m_dropWhenDestroyed == null) { treeLog.m_dropWhenDestroyed = new DropTable(); } if (treeLog.m_dropWhenDestroyed.m_drops == null) { treeLog.m_dropWhenDestroyed.m_drops = new List(); } treeLog.m_dropWhenDestroyed.m_oneOfEach = true; treeLog.m_dropWhenDestroyed.m_dropMin = dropMin; treeLog.m_dropWhenDestroyed.m_dropMax = dropMax; treeLog.m_dropWhenDestroyed.m_drops.Clear(); } } private void AddDropToDropOnDestroyed(MineRock5 rock, string itemName, int min, int max, float weight, bool dontScale = false) { AddDrop(rock.m_dropItems.m_drops, itemName, min, max, weight, dontScale); } private void InitDropOnDestroyed(MineRock5 rock, int dropMin, int dropMax) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if ((Object)(object)rock == (Object)null) { Debug.LogWarning((object)"BalrondAmazingNature: MineRock5 is null"); return; } if (rock.m_dropItems == null) { Debug.LogWarning((object)("BalrondAmazingNature: MineRock5.m_dropItems was null on " + ((Object)((Component)rock).gameObject).name)); rock.m_dropItems = new DropTable(); } if (rock.m_dropItems.m_drops == null) { Debug.LogWarning((object)("BalrondAmazingNature: MineRock5.m_dropItems.m_drops was null on " + ((Object)((Component)rock).gameObject).name)); rock.m_dropItems.m_drops = new List(); } rock.m_dropItems.m_oneOfEach = true; rock.m_dropItems.m_dropMin = dropMin; rock.m_dropItems.m_dropMax = dropMax; rock.m_dropItems.m_drops.Clear(); } private void AddGemDrops(MineRock5 minerock5) { AddDropToDropOnDestroyed(minerock5, "Amethyst_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Sapphire_bal", 0, 1, 0.02f); AddDropToDropOnDestroyed(minerock5, "Emerald_bal", 0, 1, 0.03f); AddDropToDropOnDestroyed(minerock5, "Opal_bal", 0, 1, 0.04f); AddDropToDropOnDestroyed(minerock5, "Onyx_bal", 0, 1, 0.05f); AddDropToDropOnDestroyed(minerock5, "Ruby", 0, 1, 0.06f); } private void AddDropToPickable(Pickable pickable, string itemName, int min, int max, float weight, bool dontScale = false) { AddDrop(pickable.m_extraDrops.m_drops, itemName, min, max, weight, dontScale); } private void AddDropToDropOnDestroyed(DropOnDestroyed dropable, string itemName, int min, int max, float weight, bool dontScale = false) { AddDrop(dropable.m_dropWhenDestroyed.m_drops, itemName, min, max, weight, dontScale); } private void InitDropOnDestroyed(DropOnDestroyed dropable, int dropMin, int dropMax) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if ((Object)(object)dropable == (Object)null) { Debug.LogWarning((object)"BalrondAmazingNature: DropOnDestroyed is null"); return; } if (dropable.m_dropWhenDestroyed == null) { Debug.LogWarning((object)("BalrondAmazingNature: DropOnDestroyed.m_dropWhenDestroyed was null on " + ((Object)((Component)dropable).gameObject).name)); dropable.m_dropWhenDestroyed = new DropTable(); } if (dropable.m_dropWhenDestroyed.m_drops == null) { Debug.LogWarning((object)("BalrondAmazingNature: DropOnDestroyed.m_dropWhenDestroyed.m_drops was null on " + ((Object)((Component)dropable).gameObject).name)); dropable.m_dropWhenDestroyed.m_drops = new List(); } dropable.m_dropWhenDestroyed.m_oneOfEach = true; dropable.m_dropWhenDestroyed.m_dropMin = dropMin; dropable.m_dropWhenDestroyed.m_dropMax = dropMax; dropable.m_dropWhenDestroyed.m_drops.Clear(); } private void AddGemDrops(DropOnDestroyed dropOnDestroyed) { AddDropToDropOnDestroyed(dropOnDestroyed, "Amethyst_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(dropOnDestroyed, "Sapphire_bal", 0, 1, 0.02f); AddDropToDropOnDestroyed(dropOnDestroyed, "Emerald_bal", 0, 1, 0.03f); AddDropToDropOnDestroyed(dropOnDestroyed, "Opal_bal", 0, 1, 0.04f); AddDropToDropOnDestroyed(dropOnDestroyed, "Onyx_bal", 0, 1, 0.05f); AddDropToDropOnDestroyed(dropOnDestroyed, "Ruby", 0, 1, 0.06f); AddDropToDropOnDestroyed(dropOnDestroyed, "GemChunks_bal", 0, 1, 0.07f); } private void AddDropToDropOnDestroyed(TreeBase treeBase, string itemName, int min, int max, float weight, bool dontScale = false) { AddDrop(treeBase.m_dropWhenDestroyed.m_drops, itemName, min, max, weight, dontScale); } private void InitDropOnDestroyed(TreeBase treeBase, int dropMin, int dropMax) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown if ((Object)(object)treeBase == (Object)null) { Debug.LogWarning((object)"BalrondAmazingNature: TreeBase is null"); return; } if (treeBase.m_dropWhenDestroyed == null) { Debug.LogWarning((object)("BalrondAmazingNature: TreeBase.m_dropWhenDestroyed was null on " + ((Object)((Component)treeBase).gameObject).name)); treeBase.m_dropWhenDestroyed = new DropTable(); } if (treeBase.m_dropWhenDestroyed.m_drops == null) { Debug.LogWarning((object)("BalrondAmazingNature: TreeBase.m_dropWhenDestroyed.m_drops was null on " + ((Object)((Component)treeBase).gameObject).name)); treeBase.m_dropWhenDestroyed.m_drops = new List(); } treeBase.m_dropWhenDestroyed.m_oneOfEach = true; treeBase.m_dropWhenDestroyed.m_dropMin = dropMin; treeBase.m_dropWhenDestroyed.m_dropMax = dropMax; treeBase.m_dropWhenDestroyed.m_drops.Clear(); } public void fixPlant(Pickable pickable) { switch (editZnetName(((Object)pickable).name)) { case "Pickable_Mint_bal": pickable.m_itemPrefab = FindItem(items, "Mint_bal"); break; case "Pickable_Sage_bal": pickable.m_itemPrefab = FindItem(items, "Sage_bal"); break; case "Pickable_Mushroom_blue_bal": pickable.m_itemPrefab = FindItem(items, "MushroomBlue"); break; case "Pickable_Lavender_bal": pickable.m_itemPrefab = FindItem(items, "Lavender_bal"); break; case "BlueberryBush_bal": pickable.m_itemPrefab = FindItem(items, "Blueberries"); break; case "RaspberryBush_bal": pickable.m_itemPrefab = FindItem(items, "Raspberry"); break; case "Pickable_MountainCaveCrystal_bal": pickable.m_itemPrefab = FindItem(items, "Crystal"); break; case "Pickable_Snowleaf_bal": pickable.m_itemPrefab = FindItem(items, "Snowleaf_bal"); break; case "Pickable_AppleTree_bal": pickable.m_itemPrefab = FindItem(items, "Apple_bal"); break; case "Pickable_Clay_bal": pickable.m_itemPrefab = FindItem(items, "Clay_bal"); break; case "Pickable_Potato_bal": pickable.m_itemPrefab = FindItem(items, "Potato_bal"); break; case "Pickable_Straw_DeepNorth_bal": case "Pickable_Straw_bal": pickable.m_itemPrefab = FindItem(items, "Straw_bal"); makeAditionalDropForPickup(pickable); break; case "Pickable_StrawPlant_bal": pickable.m_itemPrefab = FindItem(items, "Straw_bal"); makeAditionalDropForPickup(pickable); break; case "Pickable_Kelp_bal": pickable.m_itemPrefab = FindItem(items, "RedKelp_bal"); break; case "Pickable_Mushroom_Darkbul_bal": pickable.m_itemPrefab = FindItem(items, "Darkbul_bal"); break; case "Pickable_Nettle_bal": pickable.m_itemPrefab = FindItem(items, "Nettle_bal"); break; case "Pickable_Plantain_bal": pickable.m_itemPrefab = FindItem(items, "Plantain_bal"); break; case "Pickable_Mugwort_bal": pickable.m_itemPrefab = FindItem(items, "Mugwort_bal"); break; case "Pickable_Seaberry_bal": pickable.m_itemPrefab = FindItem(items, "Seaberries_bal"); break; case "Pickable_Yarrow_bal": pickable.m_itemPrefab = FindItem(items, "Yarrow_bal"); break; case "Pickable_Bloodvine_bal": pickable.m_itemPrefab = FindItem(items, "Bloodfruit_bal"); break; case "Pickable_MeteoriteNew_bal": pickable.m_itemPrefab = FindItem(items, "FlametalOre"); break; case "Pickable_Mycelium_bal": pickable.m_itemPrefab = FindItem(items, "Mycelium_bal"); break; case "Pickable_Ignicap_bal": pickable.m_itemPrefab = FindItem(items, "Ignicap_bal"); break; case "Pickable_MagmaStone_bal": pickable.m_itemPrefab = FindItem(items, "MagmaStone_bal"); break; case "Pickable_Lija_bal": pickable.m_itemPrefab = FindItem(items, "Lija_bal"); break; case "Pickable_Mushroom_yellow_bal": pickable.m_itemPrefab = FindItem(items, "MushroomYellow"); break; case "Pickable_Mushroom_grayNew_bal": pickable.m_itemPrefab = FindItem(items, "GrayMushroom_bal"); break; case "Pickable_Mushroom_blueNew_bal": pickable.m_itemPrefab = FindItem(items, "MushroomBlue"); break; case "Pickable_TinNew_bal": pickable.m_itemPrefab = FindItem(items, "TinOre"); break; case "Lingonberry_shrub_bal": pickable.m_itemPrefab = FindItem(items, "Lingonberry_bal"); break; case "BlackberryBush2_bal": case "BlackberryBush_bal": pickable.m_itemPrefab = FindItem(items, "Blackberries_bal"); break; case "IceberryBush_bal": pickable.m_itemPrefab = FindItem(items, "Iceberry_bal"); break; case "Pickable_Mushroom_yellowFarm_bal": pickable.m_itemPrefab = FindItem(items, "MushroomYellow"); break; case "Pickable_Mushroom_blueFarm_bal": pickable.m_itemPrefab = FindItem(items, "MushroomBlue"); break; case "Pickable_MushroomFarm_bal": pickable.m_itemPrefab = FindItem(items, "Mushroom"); break; case "Pickable_Mushroom_grayFarm_bal": pickable.m_itemPrefab = FindItem(items, "GrayMushroom_bal"); break; case "Pickable_DandelionFarm_bal": pickable.m_itemPrefab = FindItem(items, "Dandelion"); break; case "Pickable_ThistleFarm_bal": pickable.m_itemPrefab = FindItem(items, "Thistle"); break; case "BlueberryBush": case "Pickable_BlueberryBush_bal": pickable.m_itemPrefab = FindItem(items, "Blueberries"); break; case "RaspberryBush": case "Pickable_RaspberryBush_bal": pickable.m_itemPrefab = FindItem(items, "Raspberry"); makeAditionalDropForPickup(pickable); break; case "Pickable_MeadowsMeatPile01_bal": pickable.m_itemPrefab = FindItem(items, "RottenMeat"); makeAditionalDropForPickup(pickable); break; case "Pickable_MeadowsMeatPile02_bal": pickable.m_itemPrefab = FindItem(items, "RottenMeat"); makeAditionalDropForPickup(pickable); break; case "Pickable_Mushroom_Random_bal": pickable.m_itemPrefab = FindItem(items, "Moss_bal"); pickable.m_amount = 1; makeAditionalDropForPickup(pickable); break; case "Pickable_SeedGarlic_bal": pickable.m_itemPrefab = FindItem(items, "GarlicSeeds_bal"); pickable.m_amount = 2; makeAditionalDropForPickup(pickable); break; case "Pickable_Garlic_bal": pickable.m_amount = 1; pickable.m_itemPrefab = FindItem(items, "Garlic_bal"); break; case "Pickable_SeedCabbage_bal": pickable.m_itemPrefab = FindItem(items, "CabbageSeeds_bal"); makeAditionalDropForPickup(pickable); pickable.m_amount = 2; break; case "Pickable_Cabbage_bal": pickable.m_amount = 1; pickable.m_itemPrefab = FindItem(items, "Cabbage_bal"); break; } } private void makeAditionalDropForPickup(Pickable pickable) { pickable.m_extraDrops.m_drops.Clear(); addItemToPickable(pickable); } private void setPickableSeedSetup(Pickable pickable) { pickable.m_extraDrops.m_dropMin = 1; pickable.m_extraDrops.m_dropMax = 1; pickable.m_extraDrops.m_dropChance = 1f; pickable.m_extraDrops.m_oneOfEach = true; pickable.m_extraDrops.m_dropChance = 0.8f; } private void setPickablPlantSetup(Pickable pickable) { pickable.m_extraDrops.m_dropMin = 1; pickable.m_extraDrops.m_dropMax = 1; pickable.m_extraDrops.m_dropChance = 1f; pickable.m_extraDrops.m_oneOfEach = true; } private void addItemToPickable(Pickable pickable) { switch (editZnetName(((Object)pickable).name)) { case "Pickable_Flax": setPickableSeedSetup(pickable); AddDropToPickable(pickable, "Straw_bal", 1, 1, 0.2f); AddDropToPickable(pickable, "Flax", 1, 2, 0.8f); break; case "Pickable_Barley": setPickableSeedSetup(pickable); AddDropToPickable(pickable, "Straw_bal", 1, 1, 0.2f); AddDropToPickable(pickable, "Barley", 1, 2, 0.8f); break; case "Pickable_Straw_DeepNorth_bal": case "Pickable_Straw_bal": case "Pickable_StrawPlant_bal": setPickablPlantSetup(pickable); pickable.m_extraDrops.m_dropChance = 0.75f; AddDropToPickable(pickable, "BasicSeed_bal", 1, 1, 0.1f); AddDropToPickable(pickable, "StrawSeeds_bal", 1, 1, 0.25f); AddDropToPickable(pickable, "Straw_bal", 1, 1, 0.65f); break; case "Pickable_Mushroom_Random_bal": setPickablPlantSetup(pickable); AddDropToPickable(pickable, "MushroomBlue", 2, 3, 1f); AddDropToPickable(pickable, "MushroomYellow", 2, 3, 1f); AddDropToPickable(pickable, "Mushroom", 2, 3, 1f); AddDropToPickable(pickable, "GrayMushroom_bal", 2, 3, 1f); break; case "Pickable_SeedCarrot": setPickableSeedSetup(pickable); AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "CarrotSeeds", 1, 2, 0.95f); break; case "Pickable_SeedTurnip": setPickableSeedSetup(pickable); AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "TurnipSeeds", 1, 2, 0.95f); break; case "Pickable_SeedOnion": setPickableSeedSetup(pickable); AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "OnionSeeds", 1, 2, 0.95f); break; case "Pickable_SeedCabbage_bal": setPickableSeedSetup(pickable); AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "CabbageSeeds_bal", 1, 2, 0.95f); break; case "Pickable_SeedGarlic_bal": setPickableSeedSetup(pickable); AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "GarlicSeeds_bal", 1, 2, 0.95f); break; case "Pickable_Onion": setPickablPlantSetup(pickable); pickable.m_overrideName = "$item_onion"; AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "Onion", 1, 1, 0.95f); break; case "Pickable_Garlic_bal": setPickablPlantSetup(pickable); pickable.m_overrideName = "$tag_garlic_bal"; AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "Garlic_bal", 1, 1, 0.95f); break; case "Pickable_Carrot": setPickablPlantSetup(pickable); pickable.m_overrideName = "$item_carrot"; AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "Carrot", 1, 1, 0.95f); break; case "Pickable_Turnip": setPickablPlantSetup(pickable); pickable.m_overrideName = "$item_turnip"; AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "Turnip", 1, 1, 0.95f); break; case "Pickable_Cabbage_bal": setPickablPlantSetup(pickable); pickable.m_overrideName = "$tag_cabbage_bal"; AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.05f); AddDropToPickable(pickable, "Cabbage_bal", 1, 1, 0.95f); break; case "BlackberryBush_bal": case "BlackberryBush2_bal": case "BlueberryBush": case "RaspberryBush": case "Pickable_BlueberryBush_bal": case "Pickable_RaspberryBush_bal": case "RaspberryBush_bal": case "BlueberryBush_bal": pickable.m_extraDrops.m_dropMin = 1; pickable.m_extraDrops.m_dropMax = 1; pickable.m_extraDrops.m_dropChance = 0.5f; pickable.m_extraDrops.m_oneOfEach = true; AddDropToPickable(pickable, "BasicSeed_bal", 1, 1, 0.7f); AddDropToPickable(pickable, "Moss_bal", 1, 1, 0.3f); break; case "Pickable_MeadowsMeatPile01_bal": pickable.m_extraDrops.m_dropMin = 1; pickable.m_extraDrops.m_dropMax = 2; pickable.m_extraDrops.m_oneOfEach = true; AddDropToPickable(pickable, "DeerMeat", 1, 1, 0.1f); AddDropToPickable(pickable, "RawMeat", 1, 1, 0.12f); AddDropToPickable(pickable, "LeatherScraps", 1, 2, 0.25f); AddDropToPickable(pickable, "RottenMeat", 1, 1, 0.25f); AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.25f); AddDropToPickable(pickable, "Feathers", 1, 2, 0.3f); AddDropToPickable(pickable, "BoneFragments", 1, 2, 0.4f); break; case "Pickable_MeadowsMeatPile02_bal": pickable.m_extraDrops.m_dropMin = 1; pickable.m_extraDrops.m_dropMax = 3; pickable.m_extraDrops.m_oneOfEach = true; AddDropToPickable(pickable, "RustyBrokenSword_bal", 1, 1, 0.1f); AddDropToPickable(pickable, "WolfMeat", 1, 1, 0.12f); AddDropToPickable(pickable, "WitheredBone", 1, 1, 0.14f); AddDropToPickable(pickable, "Bloodbag", 1, 1, 0.2f); AddDropToPickable(pickable, "Entrails", 1, 1, 0.22f); AddDropToPickable(pickable, "RottenVegetable_bal", 1, 1, 0.25f); AddDropToPickable(pickable, "RottenMeat", 1, 2, 0.25f); AddDropToPickable(pickable, "RawMeat", 1, 1, 0.3f); AddDropToPickable(pickable, "BoneFragments", 1, 2, 0.32f); AddDropToPickable(pickable, "LeatherScraps", 1, 2, 0.34f); AddDropToPickable(pickable, "Feathers", 1, 2, 0.36f); AddDropToPickable(pickable, "Coins", 10, 30, 0.48f); AddDropToPickable(pickable, "Mycelium_bal", 1, 1, 0.12f); break; } } public void fixPDestructable(DropOnDestroyed dropable = null) { if ((Object)(object)dropable == (Object)null) { return; } Destructible component = ((Component)dropable).GetComponent(); switch (editZnetName(((Object)dropable).name)) { case "SnowyRockPillar_bal": component.m_minToolTier = 2; break; case "coal_rock1_bal": case "coal_rock_nomoss_bal": component.m_minToolTier = 2; AddDropToDropOnDestroyed(dropable, "Coal", 2, 3, 1f); break; case "MineRock_Obsidian": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 1, 3); AddDropToDropOnDestroyed(dropable, "Onyx_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Coal", 1, 1, 0.3f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 1, 0.5f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 2, 0.8f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 2, 0.9f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 2, 1f); break; case "DryBush1_bal": case "DryBush2_bal": case "AshlandsDryBush_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Blackwood", 1, 1, 0.25f); AddDropToDropOnDestroyed(dropable, "ElderBark", 1, 1, 0.35f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 2, 0.5f); break; case "stalagmite_ice_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 2, 0.35f); AddDropToDropOnDestroyed(dropable, "IceShard_bal", 1, 2, 0.7f); break; case "stalagmite_ash_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Grausten", 1, 1, 0.35f); AddDropToDropOnDestroyed(dropable, "MagmaStone_bal", 2, 4, 0.45f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.7f); break; case "flowstone_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Flint", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.65f); break; case "iceLump_bal": component.m_minToolTier = 3; dropable.m_dropWhenDestroyed.m_drops.Clear(); break; case "flowstone_ice_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "IceShard_bal", 1, 2, 0.7f); break; case "BigShootStump_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "Sap", 1, 2, 0.3f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.45f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.75f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 2, 0.9f); break; case "Pickable_Lavender_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Lavender_bal", 1, 2, 1f); break; case "Pickable_Mint_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Mint_bal", 1, 2, 1f); break; case "Pickable_Sage_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Sage_bal", 1, 2, 1f); break; case "Pickable_MountainCaveCrystal_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 1, 0.4f); AddDropToDropOnDestroyed(dropable, "IceShard_bal", 1, 2, 0.7f); break; case "ice1": case "ice1_0": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "IceShard_bal", 1, 2, 1f); break; case "ShootStump": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "YggdrasilWood", 1, 1, 0.3f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.45f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.75f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 0.9f); break; case "HugeRoot1_bal": case "HugeRoot1": InitDropOnDestroyed(dropable, 1, 3); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "ElderBark", 1, 1, 0.25f); AddDropToDropOnDestroyed(dropable, "RoundLog", 1, 1, 0.4f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.6f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 0.8f); break; case "Pickable_Mushroom_grayNew_bal": case "GlowingMushroom": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "GrayMushroom_bal", 1, 1, 1f); break; case "web_vertical_bal": case "web_horizontal_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "RawSilkScrap_bal", 1, 2, 0.1f); AddDropToDropOnDestroyed(dropable, "BoneFragments", 1, 2, 0.2f); AddDropToDropOnDestroyed(dropable, "LeatherScraps", 1, 2, 0.3f); break; case "BlueberryBush_bal": case "BlueberryBush": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "BasicSeed_bal", 1, 2, 0.1f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.25f); AddDropToDropOnDestroyed(dropable, "Straw_bal", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "Blueberries", 1, 1, 0.7f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 0.9f); break; case "RaspberryBush": case "RaspberryBush_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "BasicSeed_bal", 1, 2, 0.1f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.25f); AddDropToDropOnDestroyed(dropable, "Straw_bal", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "Raspberry", 1, 1, 0.7f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 0.9f); break; case "BushDark_bal": case "Bush01_heath": case "Bush02_en": case "Bush01": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "BasicSeed_bal", 1, 2, 0.1f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.25f); AddDropToDropOnDestroyed(dropable, "Straw_bal", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 0.6f); break; case "loxSkeleton_bal": case "WhaleSkeleton_bal": case "monsterSpine_bal": case "DragonRibcage_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonSkull_bal": case "DragonSkull2_bal": InitDropOnDestroyed(dropable, 1, 3); AddDropToDropOnDestroyed(dropable, "WitheredBone", 1, 1, 0.05f); AddDropToDropOnDestroyed(dropable, "RottenMeat", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "LeatherScraps", 1, 3, 0.2f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "BoneFragments", 2, 3, 0.6f); break; case "caverockIce_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 2, 0.25f); AddDropToDropOnDestroyed(dropable, "Grausten", 1, 1, 0.4f); AddDropToDropOnDestroyed(dropable, "IceShard_bal", 1, 1, 0.65f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 1, 0.9f); break; case "deposit_jotunfinger_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Diamond_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 3, 0.3f); AddDropToDropOnDestroyed(dropable, "Grausten", 1, 2, 0.45f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.65f); AddDropToDropOnDestroyed(dropable, "JotunFinger_bal", 1, 5, 0.9f); break; case "caverock_magma_stalagmite_broken_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Grausten", 1, 1, 0.4f); AddDropToDropOnDestroyed(dropable, "MagmaStone_bal", 2, 4, 0.6f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.9f); break; case "MineRock_MeteoriteNew_bal": component.m_minToolTier = 5; InitDropOnDestroyed(dropable, 2, 3); AddGemDrops(dropable); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 2, 0.1f); AddDropToDropOnDestroyed(dropable, "BlackMarble", 1, 2, 0.2f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 0.3f); AddDropToDropOnDestroyed(dropable, "MagmaStone_bal", 2, 4, 0.4f); AddDropToDropOnDestroyed(dropable, "FlametalOre", 1, 3, 0.6f); AddDropToDropOnDestroyed(dropable, "Grausten", 1, 2, 0.8f); AddDropToDropOnDestroyed(dropable, "FlametalOre", 1, 1, 1f); break; case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Diamond_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Sapphire_bal", 1, 1, 0.02f); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 1, 0.2f); AddDropToDropOnDestroyed(dropable, "IceShard_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 0.9f); AddDropToDropOnDestroyed(dropable, "Grausten", 1, 2, 1f); break; case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "RockDolmenSnow4_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Sapphire_bal", 1, 1, 0.02f); AddDropToDropOnDestroyed(dropable, "SilverOre", 1, 1, 0.03f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 2, 1f); break; case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Ruby", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Opal_bal", 1, 1, 0.02f); AddDropToDropOnDestroyed(dropable, "Onyx_bal", 1, 1, 0.03f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "BlackMarble", 1, 2, 0.25f); AddDropToDropOnDestroyed(dropable, "Grausten", 1, 2, 0.4f); AddDropToDropOnDestroyed(dropable, "MagmaStone_bal", 1, 2, 0.6f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 0.9f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 2, 1f); break; case "RockDolmen_1": case "RockDolmen_2": case "RockDolmen_3": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 1f); break; case "rock2_heath": case "rock4_heath": { HoverText val = ((Component)component).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)component).gameObject.AddComponent(); } val.m_text = "$tag_limeStone_deposit_bal"; ((Component)component).GetComponent(); component.m_minToolTier = 2; break; } case "rock1_mountain": case "rock4_coast": case "rock2_mountain": case "rock3_mountain": case "rock2_ice_bal": case "rock3_ice_bal": case "rock4_forest": component.m_minToolTier = 1; break; case "rock_silver_small_bal": case "silvervein": case "rock3_silver": component.m_minToolTier = 4; break; case "rock4_copper": component.m_minToolTier = 1; break; case "mudpile2": case "mudpile_beacon": case "mudpile": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "IronScrap", 1, 1, 1f); break; case "FallenTreeDeepNorth_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 3, 6); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.2f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "cliff_mistlands_Arch_bal": case "cliff_mistlands_Arch_frac_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_rock_frac_bal": component.m_minToolTier = 2; break; case "cliff_deepnorth_rock_bal": case "cliff_deepnorth_rock_frac_bal": case "cliff_deepnorth_bal": case "cliff_deepnorth_frac_bal": case "basaltCliff_bal1": case "iceblock_rock_bal": case "basaltCliff_frac_bal": case "iceblock_rock_frac_bal": component.m_minToolTier = 4; break; case "widestone_frac_bal": component.m_minToolTier = 1; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Flint", 1, 1, 0.3f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 1, 0.9f); break; case "IceCliff1_bal": case "IceCliff2_bal": case "IceCliff3_bal": case "cliff_deepnorth2_bal": case "IceCliff1_frac_bal": case "IceCliff2_frac_bal": case "IceCliff3_frac_bal": case "cliff_deepnorth2_frac_bal": component.m_minToolTier = 3; break; case "MineRock_Lead_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "CopperOre", 1, 1, 0.08f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.8f); AddDropToDropOnDestroyed(dropable, "LeadOre_bal", 2, 2, 1f); break; case "MineRock_Zinc_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "CopperOre", 1, 1, 0.08f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.8f); AddDropToDropOnDestroyed(dropable, "ZincOre_bal", 2, 2, 1f); break; case "MineRock_Nickel_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "CopperOre", 1, 1, 0.08f); AddDropToDropOnDestroyed(dropable, "Coal", 1, 1, 0.09f); AddDropToDropOnDestroyed(dropable, "NickelOre_bal", 2, 2, 1f); AddDropToDropOnDestroyed(dropable, "Stone", 2, 2, 0.8f); break; case "MineRock_Copper_bal": component.m_minToolTier = 2; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "NickelOre_bal", 1, 1, 0.08f); AddDropToDropOnDestroyed(dropable, "Coal", 1, 1, 0.15f); AddDropToDropOnDestroyed(dropable, "CopperOre", 1, 1, 0.95f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 1f); break; case "MineRock_CoalSnow_bal": case "MineRock_Coal_bal": component.m_minToolTier = 1; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "Coal", 3, 5, 0.9f); AddDropToDropOnDestroyed(dropable, "Coal", 2, 4, 1f); AddDropToDropOnDestroyed(dropable, "Flint", 1, 1, 0.7f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 0.8f); break; case "MineRock_Tin": component.m_minToolTier = 1; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "TinOre", 1, 3, 0.9f); AddDropToDropOnDestroyed(dropable, "TinOre", 1, 1, 0.95f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 1f); break; case "ClayDeposit_bal": component.m_minToolTier = 1; InitDropOnDestroyed(dropable, 3, 5); AddDropToDropOnDestroyed(dropable, "Flint", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 1, 0.2f); AddDropToDropOnDestroyed(dropable, "Clay_bal", 3, 4, 0.5f); AddDropToDropOnDestroyed(dropable, "Clay_bal", 2, 2, 0.75f); AddDropToDropOnDestroyed(dropable, "Clay_bal", 1, 2, 1f); break; case "MineRock_Blackmetal_bal": component.m_minToolTier = 4; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 3, 0.4f); AddDropToDropOnDestroyed(dropable, "BlackMetalOre_bal", 1, 3, 0.9f); AddDropToDropOnDestroyed(dropable, "BlackMetalOre_bal", 1, 1, 0.95f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 1f); break; case "MineRock_Borax_bal": component.m_minToolTier = 5; InitDropOnDestroyed(dropable, 1, 3); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.02f); AddDropToDropOnDestroyed(dropable, "Opal_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 2, 0.75f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 3, 0.4f); AddDropToDropOnDestroyed(dropable, "BlackMarble", 1, 3, 0.5f); AddDropToDropOnDestroyed(dropable, "BoraxCrystal_bal", 1, 2, 0.9f); AddDropToDropOnDestroyed(dropable, "BoraxCrystal_bal", 1, 1, 0.95f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 1f); break; case "MineRock_Cobalt_bal": component.m_minToolTier = 5; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "Diamond_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "AncientRelic_bal", 1, 1, 0.02f); AddDropToDropOnDestroyed(dropable, "Amethyst_bal", 1, 1, 0.03f); AddDropToDropOnDestroyed(dropable, "Emerald_bal", 1, 1, 0.04f); AddDropToDropOnDestroyed(dropable, "Onyx_bal", 1, 1, 0.05f); AddDropToDropOnDestroyed(dropable, "Sapphire_bal", 1, 1, 0.06f); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 3, 0.5f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 3, 0.6f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 2, 0.75f); AddDropToDropOnDestroyed(dropable, "CobaltOre_bal", 1, 3, 0.95f); AddDropToDropOnDestroyed(dropable, "CobaltOre_bal", 1, 1, 0.97f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 1f); break; case "MineRock_IronSnow_bal": case "MineRock_IronNew_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 2, 0.66f); AddDropToDropOnDestroyed(dropable, "IronOre", 1, 3, 0.8f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 1, 0.85f); AddDropToDropOnDestroyed(dropable, "IronOre", 2, 3, 0.95f); AddDropToDropOnDestroyed(dropable, "IronOre", 2, 3, 0.97f); break; case "MineRock_DarkIron_bal": component.m_minToolTier = 5; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "GemChunks_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "BlackMarble", 1, 3, 0.6f); AddDropToDropOnDestroyed(dropable, "Gabro_bal", 1, 2, 0.66f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 3, 0.7f); AddDropToDropOnDestroyed(dropable, "Obsidian", 1, 2, 0.8f); AddDropToDropOnDestroyed(dropable, "DarkIron_bal", 2, 3, 0.85f); AddDropToDropOnDestroyed(dropable, "DarkIron_bal", 2, 3, 1f); break; case "AncientSkullRock_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 4); AddDropToDropOnDestroyed(dropable, "BoneFragments", 1, 3, 0.9f); AddDropToDropOnDestroyed(dropable, "Stone", 1, 2, 1f); break; case "ChitinDeposit_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Stone", 1, 1, 0.5f); AddDropToDropOnDestroyed(dropable, "Chitin", 3, 6, 1f); break; case "ElderMushroom_Stub_bal": component.m_minToolTier = 4; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Bloodbag", 1, 1, 0.91f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.92f); AddDropToDropOnDestroyed(dropable, "Mushroom", 1, 1, 0.93f); AddDropToDropOnDestroyed(dropable, "BlackTissue_bal", 1, 1, 1f); break; case "IcedTree_Stub_bal": component.m_minToolTier = 4; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Diamond_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(dropable, "AncientRelic_bal", 0, 1, 0.02f); AddDropToDropOnDestroyed(dropable, "Crystal", 1, 1, 0.5f); AddDropToDropOnDestroyed(dropable, "IceShard_bal", 1, 1, 0.51f); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.52f); AddDropToDropOnDestroyed(dropable, "CrystalWood_bal", 1, 1, 0.9f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "WetTree_Stub_bal": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "Mycelium_bal", 1, 1, 0.11f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 0.7f); AddDropToDropOnDestroyed(dropable, "ElderBark", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 2, 1f); break; case "AcaiTree_Stub_bal": component.m_minToolTier = 2; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "HardWood_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.9f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "AshlandsTreeStump1": case "AshlandsTreeStump2": case "AshlandsTreeStump3": component.m_minToolTier = 3; break; case "Acai_Dead_Stub_bal": component.m_minToolTier = 2; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "HardWood_bal", 1, 1, 0.3f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "Lingonberry_shrub_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "BasicSeed_bal", 1, 2, 0.25f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.5f); AddDropToDropOnDestroyed(dropable, "Straw_bal", 1, 2, 0.9f); AddDropToDropOnDestroyed(dropable, "Lingonberry_bal", 1, 2, 1f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "BlackberryBush_bal": case "BlackberryBush2_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "BasicSeed_bal", 1, 2, 0.25f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.5f); AddDropToDropOnDestroyed(dropable, "Straw_bal", 1, 2, 0.9f); AddDropToDropOnDestroyed(dropable, "Blackberries_bal", 1, 1, 1f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "Pickable_SeedGarlic_bal": InitDropOnDestroyed(dropable, 1, 2); AddDropToDropOnDestroyed(dropable, "GarlicSeeds_bal", 1, 2, 1f); break; case "Pickable_Garlic_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Garlic_bal", 1, 1, 1f); break; case "Pickable_Cabbage_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Cabbage_bal", 1, 1, 1f); break; case "Pickable_SeedCabbage_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "CabbageSeeds_bal", 1, 1, 1f); break; case "Pickable_Ignicap_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Ignicap_bal", 1, 1, 1f); break; case "Pickable_Bloodvine_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Bloodfruit_bal", 1, 1, 1f); break; case "Pickable_Mushroom_Darkbul_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Darkbul_bal", 1, 1, 1f); break; case "Pickable_Plantain_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Plantain_bal", 1, 1, 1f); break; case "Pickable_Mugwort_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Mugwort_bal", 1, 1, 1f); break; case "Pickable_Seaberry_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Seaberries_bal", 1, 1, 1f); break; case "Pickable_Yarrow_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Yarrow_bal", 1, 1, 1f); break; case "Pickable_StrawPlant_bal": case "Pickable_Straw_bal": InitDropOnDestroyed(dropable, 2, 2); AddDropToDropOnDestroyed(dropable, "Straw_bal", 2, 2, 1f); break; case "Pickable_Clay_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Clay_bal", 1, 1, 1f); break; case "Pickable_MagmaStone_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "MagmaStone_bal", 1, 1, 1f); break; case "Pickable_MeteoriteNew_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "FlametalOre", 1, 1, 1f); break; case "Pickable_TinNew_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "TinOre", 1, 1, 1f); break; case "Pickable_Kelp_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "RedKelp_bal", 1, 1, 1f); break; case "Pickable_Snowleaf_bal": InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Snowleaf_bal", 1, 1, 1f); break; case "root07": case "root08": case "root11": case "root12": component.m_minToolTier = 2; InitDropOnDestroyed(dropable, 1, 1); AddDropToDropOnDestroyed(dropable, "Acorn", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "BirchSeeds", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "BeechSeeds", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "Root", 1, 3, 0.3f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.6f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 3, 0.8f); break; case "BirchAutStub_bal": component.m_minToolTier = 2; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "BirchStub": component.m_minToolTier = 2; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; case "OakStub": component.m_minToolTier = 3; InitDropOnDestroyed(dropable, 2, 3); AddDropToDropOnDestroyed(dropable, "Root", 1, 1, 0.1f); AddDropToDropOnDestroyed(dropable, "FineWood", 1, 1, 0.7f); AddDropToDropOnDestroyed(dropable, "Moss_bal", 1, 1, 0.8f); AddDropToDropOnDestroyed(dropable, "HardWood_bal", 1, 1, 0.9f); AddDropToDropOnDestroyed(dropable, "Wood", 1, 1, 1f); break; } } public void fixTreeBase(TreeBase treeBase, ZNetScene zNetScene) { switch (editZnetName(((Object)treeBase).name)) { case "YggaBigShoot_bal": treeBase.m_minToolTier = 4; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "Sap", 1, 1, 0.05f); AddDropToDropOnDestroyed(treeBase, "AncientSeed", 1, 1, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.3f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "ElderMushroom_bal": treeBase.m_minToolTier = 3; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "Ooze", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Mushroom", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeBase, "Guck", 1, 3, 1f); break; case "YggaShoot1": case "YggaShoot2": case "YggaShoot3": treeBase.m_minToolTier = 4; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "Sap", 1, 1, 0.05f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "AshlandsTree1_0": case "AshlandsTree3": case "AshlandsTree4": case "AshlandsTree5": case "AshlandsTree6_0": case "AshlandsTree6_big": treeBase.m_minToolTier = 4; break; case "IcedTree_bal": treeBase.m_minToolTier = 4; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "ElderBark", 1, 2, 1f); break; case "AcaiTree_New_bal": treeBase.m_minToolTier = 2; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "AcaiSeeds_bal", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.5f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "Willow_bal": treeBase.m_minToolTier = 2; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "WillowSeeds_bal", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.5f); AddDropToDropOnDestroyed(treeBase, "WillowBark_bal", 1, 1, 0.8f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "Poplar_bal": treeBase.m_minToolTier = 2; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "PoplarSeeds_bal", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.5f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "Cypress_bal": treeBase.m_minToolTier = 2; InitDropOnDestroyed(treeBase, 1, 3); AddDropToDropOnDestroyed(treeBase, "CypressSeeds_bal", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.5f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "Maple_bal": treeBase.m_minToolTier = 2; InitDropOnDestroyed(treeBase, 1, 3); AddDropToDropOnDestroyed(treeBase, "MapleSeeds_bal", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.5f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "Acai_Dead_bal": treeBase.m_minToolTier = 2; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.5f); AddDropToDropOnDestroyed(treeBase, "ElderBark", 1, 2, 1f); break; case "SwampTree1": treeBase.m_minToolTier = 2; InitDropOnDestroyed(treeBase, 1, 3); AddDropToDropOnDestroyed(treeBase, "SwampTreeSeeds_bal", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.5f); AddDropToDropOnDestroyed(treeBase, "ElderBark", 1, 1, 1f); break; case "Oak_Swamp_bal": treeBase.m_minToolTier = 3; treeBase.m_stubPrefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "OakStub"); treeBase.m_logPrefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Oak_log"); InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "ElderBark", 1, 2, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 1f); break; case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": treeBase.m_minToolTier = 3; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "ElderBark", 1, 2, 0.2f); AddDropToDropOnDestroyed(treeBase, "Wood", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.8f); AddDropToDropOnDestroyed(treeBase, "Moss_bal", 1, 2, 1f); break; case "Birch1_aut": case "Birch2_aut": treeBase.m_stubPrefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "BirchAutStub_bal"); break; case "Oak2_bal": treeBase.m_minToolTier = 3; InitDropOnDestroyed(treeBase, 1, 2); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Acorn", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "Oak3_bal": treeBase.m_minToolTier = 3; treeBase.m_stubPrefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "OakStub"); treeBase.m_logPrefab = zNetScene.m_prefabs.Find((GameObject x) => ((Object)x).name == "Oak_log"); InitDropOnDestroyed(treeBase, 1, 3); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Acorn", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "Oak1": treeBase.m_health = 350f; treeBase.m_minToolTier = 3; InitDropOnDestroyed(treeBase, 1, 3); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "Acorn", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeBase, "Resin", 1, 3, 1f); break; case "ElderTree_bal": treeBase.m_minToolTier = 3; InitDropOnDestroyed(treeBase, 1, 3); AddDropToDropOnDestroyed(treeBase, "Guck", 1, 2, 0.2f); AddDropToDropOnDestroyed(treeBase, "Feathers", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeBase, "ElderBark", 1, 1, 1f); break; } } public void fixMineRock5(MineRock5 minerock5) { switch (editZnetName(((Object)minerock5).name)) { case "iceLump_frac_bal": minerock5.m_minToolTier = 3; InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "Sapphire_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Crystal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "IceShard_bal", 1, 1, 1f); break; case "SnowyRockPillar_frac_bal": minerock5.m_minToolTier = 1; InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "Crystal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Flint", 1, 1, 0.3f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 1, 0.9f); break; case "rock2_ice_frac_bal": case "rock3_ice_frac_bal": case "ice_rock1_frac": minerock5.m_minToolTier = 1; InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "Crystal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Flint", 1, 1, 0.3f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 1, 0.9f); AddDropToDropOnDestroyed(minerock5, "IceShard_bal", 1, 1, 1f); break; case "rock_nickel_frac_bal": minerock5.m_minToolTier = 3; InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "Ruby", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Onyx_bal", 0, 1, 0.02f); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.03f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.1f); AddDropToDropOnDestroyed(minerock5, "Flint", 1, 1, 0.3f); AddDropToDropOnDestroyed(minerock5, "NickelOre_bal", 1, 1, 0.95f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 1, 1f); break; case "cliff_mistlands_rock_frac_bal": case "cliff_mistlands_Arch_frac_bal": InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "Onyx_bal", 1, 1, 0.001f); AddDropToDropOnDestroyed(minerock5, "Sapphire_bal", 1, 1, 0.002f); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Obsidian", 1, 1, 0.6f); AddDropToDropOnDestroyed(minerock5, "BlackMarble", 1, 1, 1f); break; case "cliff_deepnorth_rock_frac_bal": case "cliff_deepnorth_frac_bal": case "basaltCliff_frac_bal": case "iceblock_rock_frac_bal": InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "Sapphire_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Onyx_bal", 0, 1, 0.02f); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.03f); AddDropToDropOnDestroyed(minerock5, "Crystal", 1, 1, 0.02f); AddDropToDropOnDestroyed(minerock5, "AncientRelic_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "BlueBasalt_bal", 1, 1, 0.4f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(minerock5, "Obsidian", 1, 1, 0.9f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 1, 0.9f); AddDropToDropOnDestroyed(minerock5, "IceShard_bal", 1, 2, 1f); break; case "giant_helmet1_destruction": case "giant_helmet2_destruction": case "giant_sword1_destruction": case "giant_sword2_destruction": InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "SilverScrap_bal", 1, 1, 0.2f); AddDropToDropOnDestroyed(minerock5, "BlackMetalScrap", 1, 1, 0.3f); AddDropToDropOnDestroyed(minerock5, "IronScrap", 1, 1, 0.4f); AddDropToDropOnDestroyed(minerock5, "BronzeScrap", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "CopperScrap", 1, 1, 0.6f); AddDropToDropOnDestroyed(minerock5, "RustedScrap_bal", 1, 1, 1f); break; case "IceCliff1_frac_bal": case "IceCliff2_frac_bal": case "IceCliff3_frac_bal": case "cliff_deepnorth2_frac_bal": InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "AncientRelic_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Diamond_bal", 0, 1, 0.02f); AddDropToDropOnDestroyed(minerock5, "Sapphire_bal", 1, 1, 0.02f); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.05f); AddDropToDropOnDestroyed(minerock5, "Crystal", 1, 1, 0.1f); AddDropToDropOnDestroyed(minerock5, "JotunFinger_bal", 1, 1, 0.05f); AddDropToDropOnDestroyed(minerock5, "FreezeGland", 1, 1, 0.1f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 1, 0.9f); AddDropToDropOnDestroyed(minerock5, "IceShard_bal", 1, 2, 1f); break; case "rock4_heath_frac": case "rock2_heath_frac": InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_name = "$tag_limeStone_deposit_bal"; AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 1, 1, 0.1f); AddDropToDropOnDestroyed(minerock5, "Flint", 1, 1, 0.25f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 0.8f); AddDropToDropOnDestroyed(minerock5, "LimeStone_bal", 1, 2, 1f); break; case "rock4_coast_frac": case "rock4_forest_frac": InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "NickelOre_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Flint", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 1f); break; case "Rock_3_frac": InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "Flint", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 1f); break; case "rock1_mountain_frac": case "rock2_mountain_frac": case "rock3_mountain_frac": InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "TinOre", 1, 1, 0.05f); AddDropToDropOnDestroyed(minerock5, "CopperOre", 1, 1, 0.05f); AddDropToDropOnDestroyed(minerock5, "NickelOre_bal", 1, 1, 0.05f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 1, 1, 0.05f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 1f); AddDropToDropOnDestroyed(minerock5, "LimeStone_bal", 1, 2, 0.15f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 0.75f); break; case "silvervein_frac": case "rock3_silver_frac": minerock5.m_minToolTier = 4; InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_dropItems.m_oneOfEach = true; AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "LimeStone_bal", 1, 2, 0.33f); AddDropToDropOnDestroyed(minerock5, "TinOre", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.6f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 2, 2, 0.7f); AddDropToDropOnDestroyed(minerock5, "SilverOre", 1, 2, 0.8f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 0.9f); AddDropToDropOnDestroyed(minerock5, "SilverOre", 1, 1, 1f); break; case "blackmetal_rock_frac_bal": minerock5.m_minToolTier = 4; InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_dropItems.m_oneOfEach = true; AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(minerock5, "IronOre", 1, 1, 0.6f); AddDropToDropOnDestroyed(minerock5, "BlackMetalOre_bal", 1, 2, 0.7f); AddDropToDropOnDestroyed(minerock5, "Coal", 1, 1, 0.8f); AddDropToDropOnDestroyed(minerock5, "BlackMetalOre_bal", 1, 1, 0.9f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 1f); break; case "AshRock1_frac_bal": case "AshRockPillar_frac_bal": case "rock_ashlands_frac_bal": InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_dropItems.m_dropChance = 1f; AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(minerock5, "Grausten", 1, 3, 0.7f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 1, 1, 0.22f); AddDropToDropOnDestroyed(minerock5, "Coal", 3, 5, 0.85f); AddDropToDropOnDestroyed(minerock5, "BlackMarble", 1, 3, 0.7f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 3, 1f); break; case "coal_rock_nomoss_frac_bal": minerock5.m_dropItems.m_dropChance = 1f; InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_dropItems.m_oneOfEach = true; AddDropToDropOnDestroyed(minerock5, "Diamond_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.02f); AddDropToDropOnDestroyed(minerock5, "Obsidian", 1, 1, 0.25f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "Coal", 3, 5, 0.85f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 0.95f); AddDropToDropOnDestroyed(minerock5, "Coal", 2, 4, 1f); break; case "coal_rock1_frac_bal": minerock5.m_minToolTier = 1; minerock5.m_dropItems.m_dropChance = 1f; InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_dropItems.m_oneOfEach = true; AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "Obsidian", 1, 1, 0.25f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "Coal", 3, 5, 0.85f); AddDropToDropOnDestroyed(minerock5, "Coal", 2, 4, 0.85f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 1f); break; case "magma_Rock_frac_bal": minerock5.m_minToolTier = 3; minerock5.m_dropItems.m_dropChance = 1f; InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "BlackMarble", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.6f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 1, 1, 0.22f); AddDropToDropOnDestroyed(minerock5, "MagmaStone_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(minerock5, "Grausten", 1, 2, 0.9f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 1, 1f); break; case "gold_Rock_frac_bal": minerock5.m_minToolTier = 3; minerock5.m_dropItems.m_dropChance = 1f; InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_dropItems.m_oneOfEach = true; AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "GoldOre_bal", 1, 1, 0.5f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 1, 0.75f); AddDropToDropOnDestroyed(minerock5, "Coal", 1, 2, 0.95f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 1, 1f); break; case "rock_silver_small_frac_bal": minerock5.m_minToolTier = 4; minerock5.m_dropItems.m_dropChance = 1f; minerock5.m_dropItems.m_oneOfEach = true; InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 2, 2, 0.75f); AddDropToDropOnDestroyed(minerock5, "SilverOre", 1, 2, 0.95f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 1f); break; case "rock4_copper_frac": minerock5.m_minToolTier = 2; InitDropOnDestroyed(minerock5, 1, 2); minerock5.m_dropItems.m_oneOfEach = true; AddDropToDropOnDestroyed(minerock5, "GemChunks_bal", 0, 1, 0.01f); AddDropToDropOnDestroyed(minerock5, "NickelOre_bal", 1, 1, 0.66f); AddDropToDropOnDestroyed(minerock5, "LeadOre_bal", 2, 2, 0.77f); AddDropToDropOnDestroyed(minerock5, "Coal", 1, 1, 0.1f); AddDropToDropOnDestroyed(minerock5, "CopperOre", 1, 1, 0.9f); AddDropToDropOnDestroyed(minerock5, "Stone", 1, 2, 1f); break; case "mudpile2": case "mudpile_beacon": case "mudpile": minerock5.m_minToolTier = 3; break; case "mudpile2_frac": case "mudpile_frac": minerock5.m_minToolTier = 3; InitDropOnDestroyed(minerock5, 1, 2); AddDropToDropOnDestroyed(minerock5, "SilverScrap_bal", 1, 1, 0.1f); AddDropToDropOnDestroyed(minerock5, "BoneFragments", 1, 2, 0.4f); AddDropToDropOnDestroyed(minerock5, "Gabro_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(minerock5, "NickelScrap_bal", 1, 2, 0.6f); AddDropToDropOnDestroyed(minerock5, "BrassScrap_bal", 1, 2, 0.7f); AddDropToDropOnDestroyed(minerock5, "IronScrap", 1, 2, 0.8f); AddDropToDropOnDestroyed(minerock5, "IronScrap", 1, 1, 0.9f); AddDropToDropOnDestroyed(minerock5, "RustedScrap_bal", 2, 3, 1f); break; } } public void fixTreeLog(TreeLog treeLog) { switch (editZnetName(((Object)treeLog).name)) { case "ElderMushroomCap_bal": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 1, 2); AddDropToDropOnDestroyed(treeLog, "BlackTissue_bal", 1, 1, 0.1f); AddDropToDropOnDestroyed(treeLog, "Guck", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeLog, "Sap", 1, 1, 0.6f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(treeLog, "Ooze", 1, 1, 0.8f); break; case "bigyggashoot_log_bal": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 1, 2); AddDropToDropOnDestroyed(treeLog, "BlackTissue_bal", 1, 1, 0.1f); AddDropToDropOnDestroyed(treeLog, "Guck", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeLog, "Sap", 1, 1, 0.6f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(treeLog, "Ooze", 1, 1, 0.8f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 1, 1f); break; case "bigyggashoot_log_half_bal": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 2, 4); AddDropToDropOnDestroyed(treeLog, "BlackTissue_bal", 1, 1, 0.1f); AddDropToDropOnDestroyed(treeLog, "Ooze", 1, 1, 0.4f); AddDropToDropOnDestroyed(treeLog, "Guck", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeLog, "Sap", 1, 1, 0.6f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 1, 0.8f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 1, 1f); break; case "bigyggashoot_log_quarter_bal": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 6, 6); AddDropToDropOnDestroyed(treeLog, "BlackTissue_bal", 1, 1, 0.1f); AddDropToDropOnDestroyed(treeLog, "Ooze", 1, 1, 0.4f); AddDropToDropOnDestroyed(treeLog, "Guck", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeLog, "Sap", 1, 1, 0.6f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 1, 0.8f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 1, 1f); break; case "ElderMushroomLog_bal": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 6, 6); AddDropToDropOnDestroyed(treeLog, "Mushroom", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeLog, "Bloodbag", 1, 1, 0.6f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(treeLog, "Ooze", 1, 1, 0.8f); AddDropToDropOnDestroyed(treeLog, "BlackTissue_bal", 1, 1, 1f); break; case "yggashoot_log": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 1, 2); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 0.9f); AddDropToDropOnDestroyed(treeLog, "YggdrasilWood", 1, 2, 1f); break; case "yggashoot_log_half": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 9, 9); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 0.9f); AddDropToDropOnDestroyed(treeLog, "YggdrasilWood", 1, 2, 1f); break; case "AshlandsTreeLog1": case "AshlandsTreeLog2": case "AshlandsTreeLogHalf1": case "AshlandsTreeLogHalf2": treeLog.m_minToolTier = 3; break; case "IcedTree_log_bal": treeLog.m_minToolTier = 4; InitDropOnDestroyed(treeLog, 9, 10); AddDropToDropOnDestroyed(treeLog, "AncientRelic_bal", 1, 1, 0.01f); AddDropToDropOnDestroyed(treeLog, "Blackwood", 1, 2, 0.4f); AddDropToDropOnDestroyed(treeLog, "HardWood_bal", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeLog, "Crystal", 1, 2, 0.7f); AddDropToDropOnDestroyed(treeLog, "CrystalWood_bal", 1, 1, 0.9f); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 1f); break; case "Acai_log_bal": treeLog.m_minToolTier = 2; InitDropOnDestroyed(treeLog, 1, 2); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 2, 1f); break; case "Maple_log_bal": treeLog.m_minToolTier = 2; InitDropOnDestroyed(treeLog, 7, 8); AddDropToDropOnDestroyed(treeLog, "Resin", 4, 8, 0.5f); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 0.7f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 2, 0.9f); break; case "Cypress_log_bal": treeLog.m_minToolTier = 2; InitDropOnDestroyed(treeLog, 7, 8); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 0.6f); AddDropToDropOnDestroyed(treeLog, "RoundLog", 1, 2, 0.8f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 2, 1f); break; case "Poplar_log_bal": treeLog.m_minToolTier = 2; InitDropOnDestroyed(treeLog, 8, 9); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 2, 1f); break; case "Willow_log_bal": treeLog.m_minToolTier = 2; InitDropOnDestroyed(treeLog, 7, 8); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 1, 0.4f); AddDropToDropOnDestroyed(treeLog, "WillowBark_bal", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 1, 0.5f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 2, 1f); break; case "Acai_log_half_bal": treeLog.m_minToolTier = 2; InitDropOnDestroyed(treeLog, 7, 8); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 2, 0.5f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 2, 1f); break; case "Wet_log_bal": treeLog.m_minToolTier = 3; InitDropOnDestroyed(treeLog, 1, 1); AddDropToDropOnDestroyed(treeLog, "ElderBark", 1, 2, 0.2f); AddDropToDropOnDestroyed(treeLog, "RoundLog", 1, 2, 0.4f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 3, 0.8f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 3, 1f); break; case "Wet_log_half_bal": treeLog.m_minToolTier = 3; InitDropOnDestroyed(treeLog, 5, 6); AddDropToDropOnDestroyed(treeLog, "ElderBark", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeLog, "RoundLog", 1, 2, 0.4f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 1, 2, 0.8f); AddDropToDropOnDestroyed(treeLog, "Wood", 1, 3, 1f); break; case "YewTreeLog_bal": treeLog.m_minToolTier = 3; InitDropOnDestroyed(treeLog, 7, 8); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeLog, "ElderBark", 1, 3, 0.3f); AddDropToDropOnDestroyed(treeLog, "RoundLog", 2, 4, 0.6f); AddDropToDropOnDestroyed(treeLog, "YewBark_bal", 1, 1, 0.7f); AddDropToDropOnDestroyed(treeLog, "Moss_bal", 2, 4, 0.8f); AddDropToDropOnDestroyed(treeLog, "HardWood_bal", 1, 2, 1f); break; case "Oak2_log_bal": case "Oak_log": treeLog.m_minToolTier = 3; InitDropOnDestroyed(treeLog, 1, 2); AddDropToDropOnDestroyed(treeLog, "FineWood", 1, 3, 0.2f); AddDropToDropOnDestroyed(treeLog, "RoundLog", 2, 4, 0.4f); AddDropToDropOnDestroyed(treeLog, "HardWood_bal", 1, 2, 1f); break; case "Oak2_log_half_bal": case "Oak_log_half": treeLog.m_minToolTier = 3; InitDropOnDestroyed(treeLog, 7, 8); AddDropToDropOnDestroyed(treeLog, "Wood", 2, 4, 0.3f); AddDropToDropOnDestroyed(treeLog, "RoundLog", 1, 3, 0.4f); AddDropToDropOnDestroyed(treeLog, "FineWood", 2, 4, 0.5f); AddDropToDropOnDestroyed(treeLog, "HardWood_bal", 2, 4, 1f); break; } } } } namespace BalrondNature.WorldEdit { public class VegetationSpawnSettings { public float Min = 1f; public float Max = 1f; public int GroupSizeMin = 1; public int GroupSizeMax = 1; public float GroupRadius = 0f; public float GroundOffset = 0f; } } namespace BalrondNature.WorldEdit.Vegetation { public class VegetationLandHeightSetter { public static Dictionary landSettings = new Dictionary(); public static void CreateLandSettings() { List vegetationPrefabs = Launch.modResourceLoader.vegetationPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item in vegetationPrefabs) { VegetationLandHeight biomeSetupForPrefab = GetBiomeSetupForPrefab(((Object)item).name); if (biomeSetupForPrefab != null) { landSettings[((Object)item).name] = biomeSetupForPrefab; } } vegetationPrefabs = Launch.modResourceLoader.plantPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item2 in vegetationPrefabs) { VegetationLandHeight biomeSetupForPrefab2 = GetBiomeSetupForPrefab(((Object)item2).name); if (biomeSetupForPrefab2 != null) { landSettings[((Object)item2).name] = biomeSetupForPrefab2; } } } private static VegetationLandHeight GetBiomeSetupForPrefab(string prefabName) { switch (prefabName) { case "Willow_bal": case "sapling_Willow_bal": return new VegetationLandHeight { MinOceanDepth = 0f, MaxOceanDepth = 1f, MinAltitude = 1f, MaxAltitude = 70f }; case "Pickable_Clay_bal": return new VegetationLandHeight { MinOceanDepth = 0f, MaxOceanDepth = 3f, MinAltitude = -1f, MaxAltitude = 30f }; case "ClayDeposit_bal": return new VegetationLandHeight { MinOceanDepth = 0f, MaxOceanDepth = 3f, MinAltitude = -1f, MaxAltitude = 10f }; case "DeathsquitoHive_bal": case "SeekerBroodSpawner_bal": return new VegetationLandHeight { MinOceanDepth = 0f, MaxOceanDepth = 0f, MinAltitude = 10f, MaxAltitude = 1000f }; case "clamChestSmall_bal": case "clamChest_bal": case "ChitinDeposit_bal": return new VegetationLandHeight { MinOceanDepth = 0f, MaxOceanDepth = 3f, MinAltitude = -5f, MaxAltitude = 10f }; case "Pickable_waterlily_bal": case "Pickable_Kelp_bal": return new VegetationLandHeight { MinOceanDepth = 2.75f, MaxOceanDepth = 9f, MinAltitude = -10f, MaxAltitude = 10f }; case "iceLump_bal": return new VegetationLandHeight { MinOceanDepth = 2f, MaxOceanDepth = 30f, MinAltitude = -2f, MaxAltitude = 10f }; case "shrub_bal": case "BushDark_bal": case "sapling_bush_bal": case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": case "BlackberryBush_bal": case "sapling_bush_blackberry_bal": case "FirTree_Sapling": case "PineTree_Sapling": case "Poplar_bal": case "sapling_Poplar_bal": case "Pickable_Straw_bal": case "Pickable_Mushroom_grayNew_bal": case "Beech_Sapling": case "Birch_Sapling": case "Oak_Sapling": case "Pickable_Mint_bal": case "Pickable_Lavender_bal": case "Cypress_bal": case "sapling_Cypress_bal": case "Pickable_Mushroom_Darkbul_bal": case "Pickable_Plantain_bal": case "Pickable_Mugwort_bal": case "Pickable_Sage_bal": case "Pickable_Mushroom_Inkcap_bal": case "Pickable_SeedGarlic_bal": case "sapling_BirchAtumn_bal": case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": case "Pickable_Yarrow_bal": case "Pickable_Mushroom_blue_bal": case "Pickable_SeedCabbage_bal": case "Pickable_Bloodvine_bal": case "Pickable_Ignicap_bal": case "Pickable_Nettle_bal": case "Pickable_Seaberry_bal": case "Pickable_Straw_DeepNorth_bal": case "flowstone_bal": case "YewTree_bal": case "Pickable_MeadowsMeatPile02_bal": case "Pickable_MeadowsMeatPile01_bal": case "AncientSkullRock_bal": case "loxSkeleton_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": case "MineRock_Nickel_bal": case "MineRock_Copper_bal": case "MineRock_IronNew_bal": case "HugeRoot1_bal": case "RockGolemSpawn_bal": case "rock_silver_small_bal": case "rock_nickel_nomoss_bal": case "Pickable_TinNew_bal": case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "MineRock_Blackmetal_bal": case "coal_rock1_bal": case "RockDolmenSnow4_bal": case "rock_nickel_bal": case "Acai_Dead_bal": case "Oak_Swamp_bal": case "sapling_Swamp_bal": case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": case "DrakeSpawner_bal": case "bloodshard_deposit_bal": case "SurtlingSpawner_bal": case "AshlandsDryBush_bal": case "AcaiTree_Stub_bal": case "Acai_Dead_Stub_bal": case "MineRock_MeteoriteNew_bal": case "stalagmite_ash_bal": case "Pickable_MagmaStone_bal": case "AshRock1_bal": case "AshRockPillar_bal": case "caverock_magma_stalagmite_broken_bal": case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "DragonSkull2_bal": case "DragonSkull_bal": case "rock_ashlands_bal": case "coal_rock_nomoss_bal": case "gold_Rock_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": case "ElderMushroom_bal": case "SeekerEgg_bal": case "AcaiTree_New_bal": case "sapling_AcaiTree_bal": case "MineRock_DarkIron_bal": case "MineRock_Borax_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_Arch_bal": case "Pickable_MeteoriteNew_bal": case "Pickable_Mushroom_Icecap_bal": case "IceberryBush_bal": case "DryBush1_bal": case "DryBush2_bal": case "FallenTreeDeepNorth_bal": case "flowstone_ice_bal": case "stalagmite_ice_bal": case "cliff_deepnorth_bal": case "IceCliff1_bal": case "cliff_deepnorth_rock_bal": case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": case "MammothSkull_bal": case "Pickable_Snowleaf_bal": case "IceCliff3_bal": case "IceCliff2_bal": case "cliff_deepnorth_Arch_bal": case "cliff_deepnorth2_bal": case "ElderTreeStump_bal": case "ElderTree_bal": case "IcedTree_bal": case "deposit_jotunfinger_bal": case "MineRock_Cobalt_bal": case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": case "basaltCliff_bal": case "iceblock_rock_bal": case "rock2_ice_bal": case "rock3_ice_bal": case "Maple_bal": case "YggaBigShoot_bal": case "TwistedTree_small_bal": return new VegetationLandHeight { MinOceanDepth = 0f, MaxOceanDepth = 0f, MinAltitude = 1f, MaxAltitude = 1000f }; default: return null; } } } public class VegetationSpawnSetter { public static Dictionary spawnSettings = new Dictionary(); public static void CreateSpawnSettings() { List vegetationPrefabs = Launch.modResourceLoader.vegetationPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item in vegetationPrefabs) { VegetationSpawnSettings biomeSetupForPrefab = GetBiomeSetupForPrefab(((Object)item).name); if (biomeSetupForPrefab != null) { spawnSettings[((Object)item).name] = biomeSetupForPrefab; } } vegetationPrefabs = Launch.modResourceLoader.plantPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item2 in vegetationPrefabs) { VegetationSpawnSettings biomeSetupForPrefab2 = GetBiomeSetupForPrefab(((Object)item2).name); if (biomeSetupForPrefab2 != null) { spawnSettings[((Object)item2).name] = biomeSetupForPrefab2; } } } private static VegetationSpawnSettings GetBiomeSetupForPrefab(string prefabName) { switch (prefabName) { case "shrub_bal": case "BushDark_bal": case "DryBush1_bal": case "DryBush2_bal": case "Pickable_Mint_bal": case "Pickable_Lavender_bal": case "Pickable_SeedGarlic_bal": case "sapling_BirchAtumn_bal": case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": case "Pickable_Yarrow_bal": case "Pickable_SeedCabbage_bal": case "Pickable_Bloodvine_bal": case "Pickable_Mushroom_Darkbul_bal": case "Pickable_Plantain_bal": case "Pickable_Mugwort_bal": case "Pickable_Sage_bal": case "Pickable_Mushroom_Inkcap_bal": case "Pickable_Nettle_bal": case "Pickable_Ignicap_bal": return new VegetationSpawnSettings { Min = 3f, Max = 6f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 10f, GroundOffset = -0.1f }; case "Pickable_Kelp_bal": return new VegetationSpawnSettings { Min = 3f, Max = 6f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 10f, GroundOffset = -0.2f }; case "Pickable_Straw_DeepNorth_bal": return new VegetationSpawnSettings { Min = 0.5f, Max = 1f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 15f, GroundOffset = -0.2f }; case "Pickable_MagmaStone_bal": return new VegetationSpawnSettings { Min = 1f, Max = 2f, GroupSizeMin = 2, GroupSizeMax = 4, GroupRadius = 20f, GroundOffset = 0f }; case "Pickable_Straw_bal": return new VegetationSpawnSettings { Min = 1f, Max = 2f, GroupSizeMin = 2, GroupSizeMax = 4, GroupRadius = 20f, GroundOffset = -0.2f }; case "sapling_Willow_bal": case "sapling_Cypress_bal": case "sapling_Poplar_bal": case "sapling_AcaiTree_bal": case "sapling_Swamp_bal": case "DrakeSpawner_bal": case "RockGolemSpawn_bal": case "sapling_bush_blackberry_bal": case "sapling_bush_bal": case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": case "clamChestSmall_bal": case "clamChest_bal": case "Pickable_MeadowsMeatPile02_bal": case "Pickable_MeadowsMeatPile01_bal": case "DeathsquitoHive_bal": case "SeekerBroodSpawner_bal": return new VegetationSpawnSettings { Min = 0.1f, Max = 0.2f, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 10f, GroundOffset = -1f }; case "Pickable_Mushroom_blue_bal": case "Pickable_Seaberry_bal": case "Pickable_Snowleaf_bal": case "BlackberryBush_bal": return new VegetationSpawnSettings { Min = 1f, Max = 2f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 25f, GroundOffset = -0.25f }; case "Pickable_TinNew_bal": case "Pickable_Mushroom_grayNew_bal": case "Pickable_waterlily_bal": case "ClayDeposit_bal": return new VegetationSpawnSettings { Min = 1f, Max = 2f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 25f, GroundOffset = -1f }; case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "RockDolmenSnow4_bal": case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": case "IceberryBush_bal": case "Pickable_MeteoriteNew_bal": case "Pickable_Mushroom_Icecap_bal": case "ChitinDeposit_bal": return new VegetationSpawnSettings { Min = 0.5f, Max = 1f, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 10f, GroundOffset = -1f }; case "Pickable_Clay_bal": return new VegetationSpawnSettings { Min = 10f, Max = 20f, GroupSizeMin = 3, GroupSizeMax = 5, GroupRadius = 5f, GroundOffset = 0f }; case "SeekerEgg_bal": return new VegetationSpawnSettings { Min = 2f, Max = 4f, GroupSizeMin = 3, GroupSizeMax = 5, GroupRadius = 10f, GroundOffset = 0f }; case "DragonSkull2_bal": case "DragonSkull_bal": case "MammothSkull_bal": case "AncientSkullRock_bal": case "loxSkeleton_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": return new VegetationSpawnSettings { Min = 0.05f, Max = 0.1f, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 25f, GroundOffset = -2f }; case "MineRock_Nickel_bal": case "MineRock_Copper_bal": return new VegetationSpawnSettings { Min = 0.1f, Max = 0.25f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 25f, GroundOffset = -3f }; case "MineRock_Cobalt_bal": case "MineRock_IronNew_bal": case "MineRock_Blackmetal_bal": case "MineRock_MeteoriteNew_bal": case "MineRock_DarkIron_bal": case "MineRock_Borax_bal": return new VegetationSpawnSettings { Min = 0.1f, Max = 0.25f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 25f, GroundOffset = -2f }; case "AcaiTree_Stub_bal": case "Acai_Dead_Stub_bal": case "Willow_bal": return new VegetationSpawnSettings { Min = 0.5f, Max = 1f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 25f, GroundOffset = -1.5f }; case "Poplar_bal": return new VegetationSpawnSettings { Min = 1f, Max = 1f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 25f, GroundOffset = -2f }; case "Maple_bal": case "YggaBigShoot_bal": case "TwistedTree_small_bal": case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": return new VegetationSpawnSettings { Min = 2f, Max = 3f, GroupSizeMin = 1, GroupSizeMax = 3, GroupRadius = 25f, GroundOffset = -1.5f }; case "ElderTree_bal": case "IcedTree_bal": case "AcaiTree_New_bal": case "ElderMushroom_bal": case "Cypress_bal": case "YewTree_bal": case "Acai_Dead_bal": case "Oak_Swamp_bal": case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": return new VegetationSpawnSettings { Min = 1f, Max = 2f, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 25f, GroundOffset = -1.5f }; case "rock_silver_small_bal": return new VegetationSpawnSettings { Min = 0.5f, Max = 1f, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 25f, GroundOffset = -3f }; case "rock_nickel_nomoss_bal": case "rock_nickel_bal": case "coal_rock1_bal": case "rock_ashlands_bal": case "coal_rock_nomoss_bal": case "gold_Rock_bal": return new VegetationSpawnSettings { Min = 0.5f, Max = 1f, GroupSizeMin = 1, GroupSizeMax = 1, GroupRadius = 25f, GroundOffset = -1.5f }; case "flowstone_bal": case "HugeRoot1_bal": case "bloodshard_deposit_bal": case "SurtlingSpawner_bal": case "AshlandsDryBush_bal": case "stalagmite_ash_bal": case "AshRock1_bal": case "AshRockPillar_bal": case "caverock_magma_stalagmite_broken_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_Arch_bal": case "FallenTreeDeepNorth_bal": case "flowstone_ice_bal": case "stalagmite_ice_bal": case "iceLump_bal": case "cliff_deepnorth_bal": case "IceCliff1_bal": case "cliff_deepnorth_rock_bal": case "IceCliff3_bal": case "IceCliff2_bal": case "cliff_deepnorth_Arch_bal": case "cliff_deepnorth2_bal": case "ElderTreeStump_bal": case "deposit_jotunfinger_bal": case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": case "basaltCliff_bal": case "iceblock_rock_bal": case "rock2_ice_bal": case "rock3_ice_bal": return new VegetationSpawnSettings { Min = 1f, Max = 2f, GroupSizeMin = 1, GroupSizeMax = 2, GroupRadius = 10f, GroundOffset = -0.5f }; default: return null; } } } public class VegetationRotationSetter { public static Dictionary rotationSettings = new Dictionary(); public static void CreateRotationSettings() { List vegetationPrefabs = Launch.modResourceLoader.vegetationPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item in vegetationPrefabs) { VegetationRotationSetting biomeSetupForPrefab = GetBiomeSetupForPrefab(((Object)item).name); if (biomeSetupForPrefab != null) { rotationSettings[((Object)item).name] = biomeSetupForPrefab; } } vegetationPrefabs = Launch.modResourceLoader.plantPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item2 in vegetationPrefabs) { VegetationRotationSetting biomeSetupForPrefab2 = GetBiomeSetupForPrefab(((Object)item2).name); if (biomeSetupForPrefab2 != null) { rotationSettings[((Object)item2).name] = biomeSetupForPrefab2; } } } private static VegetationRotationSetting GetBiomeSetupForPrefab(string prefabName) { switch (prefabName) { case "Maple_bal": case "YggaBigShoot_bal": case "TwistedTree_small_bal": case "Acai_Dead_Stub_bal": case "AcaiTree_Stub_bal": case "shrub_bal": case "BushDark_bal": case "sapling_bush_bal": case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": case "BlackberryBush_bal": case "sapling_bush_blackberry_bal": case "FirTree_Sapling": case "PineTree_Sapling": case "Poplar_bal": case "sapling_Poplar_bal": case "Pickable_Straw_bal": case "Pickable_Mushroom_grayNew_bal": case "Beech_Sapling": case "Birch_Sapling": case "Oak_Sapling": case "Willow_bal": case "sapling_Willow_bal": case "Pickable_Mint_bal": case "Pickable_Lavender_bal": case "Cypress_bal": case "sapling_Cypress_bal": case "Pickable_Mushroom_Darkbul_bal": case "Pickable_Plantain_bal": case "Pickable_Mugwort_bal": case "Pickable_Sage_bal": case "Pickable_Mushroom_Inkcap_bal": case "Pickable_SeedGarlic_bal": case "sapling_BirchAtumn_bal": case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": case "Pickable_Yarrow_bal": case "Pickable_Mushroom_blue_bal": case "Pickable_SeedCabbage_bal": case "Pickable_Bloodvine_bal": case "Pickable_Ignicap_bal": case "Pickable_Nettle_bal": case "Pickable_Seaberry_bal": case "Pickable_Straw_DeepNorth_bal": case "Pickable_Snowleaf_bal": return new VegetationRotationSetting { MinTilt = 0f, MaxTilt = 45f, RandTilt = 10f, ChanceToUseGroundTilt = 0.5f }; case "flowstone_bal": case "YewTree_bal": case "Pickable_MeadowsMeatPile02_bal": case "ClayDeposit_bal": case "Pickable_Clay_bal": case "Pickable_MeadowsMeatPile01_bal": case "ChitinDeposit_bal": case "clamChestSmall_bal": case "clamChest_bal": case "AncientSkullRock_bal": case "loxSkeleton_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": case "MineRock_Nickel_bal": case "MineRock_Copper_bal": case "MineRock_IronNew_bal": case "Pickable_Kelp_bal": case "HugeRoot1_bal": case "Pickable_waterlily_bal": case "RockGolemSpawn_bal": case "rock_silver_small_bal": case "rock_nickel_nomoss_bal": case "Pickable_TinNew_bal": case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "MineRock_Blackmetal_bal": case "coal_rock1_bal": case "RockDolmenSnow4_bal": case "rock_nickel_bal": case "Acai_Dead_bal": case "Oak_Swamp_bal": case "sapling_Swamp_bal": case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": case "DrakeSpawner_bal": case "DeathsquitoHive_bal": case "bloodshard_deposit_bal": case "SurtlingSpawner_bal": case "AshlandsDryBush_bal": case "MineRock_MeteoriteNew_bal": case "stalagmite_ash_bal": case "Pickable_MagmaStone_bal": case "AshRock1_bal": case "AshRockPillar_bal": case "caverock_magma_stalagmite_broken_bal": case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "DragonSkull2_bal": case "DragonSkull_bal": case "rock_ashlands_bal": case "coal_rock_nomoss_bal": case "gold_Rock_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": case "ElderMushroom_bal": case "SeekerBroodSpawner_bal": case "SeekerEgg_bal": case "AcaiTree_New_bal": case "sapling_AcaiTree_bal": case "MineRock_DarkIron_bal": case "MineRock_Borax_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_Arch_bal": case "Pickable_MeteoriteNew_bal": case "Pickable_Mushroom_Icecap_bal": case "IceberryBush_bal": case "DryBush1_bal": case "DryBush2_bal": case "FallenTreeDeepNorth_bal": case "flowstone_ice_bal": case "stalagmite_ice_bal": case "iceLump_bal": case "cliff_deepnorth_bal": case "IceCliff1_bal": case "cliff_deepnorth_rock_bal": case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": case "MammothSkull_bal": case "IceCliff3_bal": case "IceCliff2_bal": case "cliff_deepnorth_Arch_bal": case "cliff_deepnorth2_bal": case "ElderTreeStump_bal": case "ElderTree_bal": case "IcedTree_bal": case "deposit_jotunfinger_bal": case "MineRock_Cobalt_bal": case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": case "basaltCliff_bal": case "iceblock_rock_bal": case "rock2_ice_bal": case "rock3_ice_bal": return new VegetationRotationSetting { MinTilt = 0f, MaxTilt = 45f, RandTilt = 10f, ChanceToUseGroundTilt = 0.5f }; default: return null; } } } public class VegetationForestSettter { public static Dictionary forestSettings = new Dictionary(); public static void CreateForestSettings() { List vegetationPrefabs = Launch.modResourceLoader.vegetationPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item in vegetationPrefabs) { VegetationForestSettings biomeSetupForPrefab = GetBiomeSetupForPrefab(((Object)item).name); if (biomeSetupForPrefab != null) { forestSettings[((Object)item).name] = biomeSetupForPrefab; } } vegetationPrefabs = Launch.modResourceLoader.plantPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item2 in vegetationPrefabs) { VegetationForestSettings biomeSetupForPrefab2 = GetBiomeSetupForPrefab(((Object)item2).name); if (biomeSetupForPrefab2 != null) { forestSettings[((Object)item2).name] = biomeSetupForPrefab2; } } } private static VegetationForestSettings GetBiomeSetupForPrefab(string prefabName) { switch (prefabName) { case "shrub_bal": case "BushDark_bal": case "sapling_bush_bal": case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": case "BlackberryBush_bal": case "sapling_bush_blackberry_bal": case "FirTree_Sapling": case "PineTree_Sapling": case "Poplar_bal": case "sapling_Poplar_bal": case "Pickable_Straw_bal": case "Pickable_Mushroom_grayNew_bal": case "Beech_Sapling": case "Birch_Sapling": case "Oak_Sapling": case "Willow_bal": case "sapling_Willow_bal": case "Pickable_Mint_bal": case "Pickable_Lavender_bal": case "Cypress_bal": case "sapling_Cypress_bal": case "Pickable_Mushroom_Darkbul_bal": case "Pickable_Plantain_bal": case "Pickable_Mugwort_bal": case "Pickable_Sage_bal": case "Pickable_Mushroom_Inkcap_bal": case "Pickable_SeedGarlic_bal": case "sapling_BirchAtumn_bal": case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": case "Pickable_Yarrow_bal": case "Pickable_Mushroom_blue_bal": case "Pickable_SeedCabbage_bal": case "Pickable_Bloodvine_bal": case "Pickable_Ignicap_bal": case "Pickable_Nettle_bal": case "Pickable_Seaberry_bal": case "Pickable_Straw_DeepNorth_bal": return new VegetationForestSettings { InForest = true, ForestThresholdMin = 0.1f, ForestThresholdMax = 99f }; case "Maple_bal": case "YggaBigShoot_bal": case "TwistedTree_small_bal": case "flowstone_bal": case "YewTree_bal": case "Pickable_MeadowsMeatPile02_bal": case "ClayDeposit_bal": case "Pickable_Clay_bal": case "Pickable_MeadowsMeatPile01_bal": case "ChitinDeposit_bal": case "clamChestSmall_bal": case "clamChest_bal": case "AncientSkullRock_bal": case "loxSkeleton_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": case "MineRock_Nickel_bal": case "MineRock_Copper_bal": case "MineRock_IronNew_bal": case "Pickable_Kelp_bal": case "HugeRoot1_bal": case "Pickable_waterlily_bal": case "RockGolemSpawn_bal": case "rock_silver_small_bal": case "rock_nickel_nomoss_bal": case "Pickable_TinNew_bal": case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "MineRock_Blackmetal_bal": case "coal_rock1_bal": case "RockDolmenSnow4_bal": case "rock_nickel_bal": case "Acai_Dead_bal": case "Oak_Swamp_bal": case "sapling_Swamp_bal": case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": case "DrakeSpawner_bal": case "DeathsquitoHive_bal": case "bloodshard_deposit_bal": case "SurtlingSpawner_bal": case "AshlandsDryBush_bal": case "AcaiTree_Stub_bal": case "Acai_Dead_Stub_bal": case "MineRock_MeteoriteNew_bal": case "stalagmite_ash_bal": case "Pickable_MagmaStone_bal": case "AshRock1_bal": case "AshRockPillar_bal": case "caverock_magma_stalagmite_broken_bal": case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "DragonSkull2_bal": case "DragonSkull_bal": case "rock_ashlands_bal": case "coal_rock_nomoss_bal": case "gold_Rock_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": case "ElderMushroom_bal": case "SeekerBroodSpawner_bal": case "SeekerEgg_bal": case "AcaiTree_New_bal": case "sapling_AcaiTree_bal": case "MineRock_DarkIron_bal": case "MineRock_Borax_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_Arch_bal": case "Pickable_MeteoriteNew_bal": case "Pickable_Mushroom_Icecap_bal": case "IceberryBush_bal": case "DryBush1_bal": case "DryBush2_bal": case "FallenTreeDeepNorth_bal": case "flowstone_ice_bal": case "stalagmite_ice_bal": case "iceLump_bal": case "cliff_deepnorth_bal": case "IceCliff1_bal": case "cliff_deepnorth_rock_bal": case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": case "MammothSkull_bal": case "Pickable_Snowleaf_bal": case "IceCliff3_bal": case "IceCliff2_bal": case "cliff_deepnorth_Arch_bal": case "cliff_deepnorth2_bal": case "ElderTreeStump_bal": case "ElderTree_bal": case "IcedTree_bal": case "deposit_jotunfinger_bal": case "MineRock_Cobalt_bal": case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": case "basaltCliff_bal": case "iceblock_rock_bal": case "rock2_ice_bal": case "rock3_ice_bal": return new VegetationForestSettings { InForest = true, ForestThresholdMin = 0f, ForestThresholdMax = 9999f }; default: return null; } } } public class VegetationBiomeSettter { public static Dictionary biomeSettings = new Dictionary(); public static void CreateBiomeSettings() { List vegetationPrefabs = Launch.modResourceLoader.vegetationPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item in vegetationPrefabs) { VegetationBiomeSettings biomeSetupForPrefab = GetBiomeSetupForPrefab(((Object)item).name); if (biomeSetupForPrefab != null) { biomeSettings[((Object)item).name] = biomeSetupForPrefab; } } vegetationPrefabs = Launch.modResourceLoader.plantPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item2 in vegetationPrefabs) { VegetationBiomeSettings biomeSetupForPrefab2 = GetBiomeSetupForPrefab(((Object)item2).name); if (biomeSetupForPrefab2 != null) { biomeSettings[((Object)item2).name] = biomeSetupForPrefab2; } } } private static VegetationBiomeSettings GetBiomeSetupForPrefab(string prefabName) { //IL_19a5: Unknown result type (might be due to invalid IL or missing references) //IL_19ac: Unknown result type (might be due to invalid IL or missing references) //IL_1792: Unknown result type (might be due to invalid IL or missing references) //IL_1799: Unknown result type (might be due to invalid IL or missing references) //IL_1a21: Unknown result type (might be due to invalid IL or missing references) //IL_1a28: Unknown result type (might be due to invalid IL or missing references) //IL_1a4f: Unknown result type (might be due to invalid IL or missing references) //IL_1a56: Unknown result type (might be due to invalid IL or missing references) //IL_19f3: Unknown result type (might be due to invalid IL or missing references) //IL_19fa: Unknown result type (might be due to invalid IL or missing references) //IL_18d0: Unknown result type (might be due to invalid IL or missing references) //IL_18d7: Unknown result type (might be due to invalid IL or missing references) //IL_1a38: Unknown result type (might be due to invalid IL or missing references) //IL_1a3f: Unknown result type (might be due to invalid IL or missing references) //IL_18b6: Unknown result type (might be due to invalid IL or missing references) //IL_18bd: Unknown result type (might be due to invalid IL or missing references) //IL_17af: Unknown result type (might be due to invalid IL or missing references) //IL_17b6: Unknown result type (might be due to invalid IL or missing references) //IL_1972: Unknown result type (might be due to invalid IL or missing references) //IL_1979: Unknown result type (might be due to invalid IL or missing references) //IL_190a: Unknown result type (might be due to invalid IL or missing references) //IL_1911: Unknown result type (might be due to invalid IL or missing references) //IL_1940: Unknown result type (might be due to invalid IL or missing references) //IL_1947: Unknown result type (might be due to invalid IL or missing references) //IL_1882: Unknown result type (might be due to invalid IL or missing references) //IL_1889: Unknown result type (might be due to invalid IL or missing references) //IL_198b: Unknown result type (might be due to invalid IL or missing references) //IL_1992: Unknown result type (might be due to invalid IL or missing references) //IL_1959: Unknown result type (might be due to invalid IL or missing references) //IL_1960: Unknown result type (might be due to invalid IL or missing references) //IL_1724: Unknown result type (might be due to invalid IL or missing references) //IL_172b: Unknown result type (might be due to invalid IL or missing references) //IL_19c2: Unknown result type (might be due to invalid IL or missing references) //IL_19c9: Unknown result type (might be due to invalid IL or missing references) //IL_170a: Unknown result type (might be due to invalid IL or missing references) //IL_1711: Unknown result type (might be due to invalid IL or missing references) //IL_1831: Unknown result type (might be due to invalid IL or missing references) //IL_1838: Unknown result type (might be due to invalid IL or missing references) //IL_1775: Unknown result type (might be due to invalid IL or missing references) //IL_177c: Unknown result type (might be due to invalid IL or missing references) //IL_1865: Unknown result type (might be due to invalid IL or missing references) //IL_186c: Unknown result type (might be due to invalid IL or missing references) //IL_17e3: Unknown result type (might be due to invalid IL or missing references) //IL_17ea: Unknown result type (might be due to invalid IL or missing references) //IL_17c9: Unknown result type (might be due to invalid IL or missing references) //IL_17d0: Unknown result type (might be due to invalid IL or missing references) //IL_19dc: Unknown result type (might be due to invalid IL or missing references) //IL_19e3: Unknown result type (might be due to invalid IL or missing references) //IL_1741: Unknown result type (might be due to invalid IL or missing references) //IL_1748: Unknown result type (might be due to invalid IL or missing references) //IL_18ed: Unknown result type (might be due to invalid IL or missing references) //IL_18f4: Unknown result type (might be due to invalid IL or missing references) //IL_1a0a: Unknown result type (might be due to invalid IL or missing references) //IL_1a11: Unknown result type (might be due to invalid IL or missing references) //IL_17fd: Unknown result type (might be due to invalid IL or missing references) //IL_1804: Unknown result type (might be due to invalid IL or missing references) //IL_1927: Unknown result type (might be due to invalid IL or missing references) //IL_192e: Unknown result type (might be due to invalid IL or missing references) //IL_189c: Unknown result type (might be due to invalid IL or missing references) //IL_18a3: Unknown result type (might be due to invalid IL or missing references) //IL_1817: Unknown result type (might be due to invalid IL or missing references) //IL_181e: Unknown result type (might be due to invalid IL or missing references) //IL_175b: Unknown result type (might be due to invalid IL or missing references) //IL_1762: Unknown result type (might be due to invalid IL or missing references) //IL_184b: Unknown result type (might be due to invalid IL or missing references) //IL_1852: Unknown result type (might be due to invalid IL or missing references) switch (prefabName) { case "ChitinDeposit_bal": return new VegetationBiomeSettings { Biome = (Biome)578, BiomeArea = (BiomeArea)3 }; case "Pickable_MeadowsMeatPile01_bal": return new VegetationBiomeSettings { Biome = (Biome)11, BiomeArea = (BiomeArea)3 }; case "ClayDeposit_bal": case "Pickable_Clay_bal": return new VegetationBiomeSettings { Biome = (Biome)539, BiomeArea = (BiomeArea)3 }; case "Pickable_Straw_bal": return new VegetationBiomeSettings { Biome = (Biome)17, BiomeArea = (BiomeArea)2 }; case "Pickable_MeadowsMeatPile02_bal": return new VegetationBiomeSettings { Biome = (Biome)20, BiomeArea = (BiomeArea)2 }; case "clamChestSmall_bal": case "clamChest_bal": return new VegetationBiomeSettings { Biome = (Biome)890, BiomeArea = (BiomeArea)3 }; case "AncientSkullRock_bal": case "loxSkeleton_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": return new VegetationBiomeSettings { Biome = (Biome)886, BiomeArea = (BiomeArea)3 }; case "FirTree_Sapling": case "PineTree_Sapling": case "Poplar_bal": case "sapling_Poplar_bal": return new VegetationBiomeSettings { Biome = (Biome)12, BiomeArea = (BiomeArea)2 }; case "BlackberryBush_bal": case "sapling_bush_blackberry_bal": return new VegetationBiomeSettings { Biome = (Biome)10, BiomeArea = (BiomeArea)2 }; case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": return new VegetationBiomeSettings { Biome = (Biome)9, BiomeArea = (BiomeArea)2 }; case "sapling_bush_bal": return new VegetationBiomeSettings { Biome = (Biome)25, BiomeArea = (BiomeArea)2 }; case "MineRock_Nickel_bal": return new VegetationBiomeSettings { Biome = (Biome)21, BiomeArea = (BiomeArea)2 }; case "MineRock_Copper_bal": return new VegetationBiomeSettings { Biome = (Biome)28, BiomeArea = (BiomeArea)2 }; case "MineRock_IronNew_bal": return new VegetationBiomeSettings { Biome = (Biome)22, BiomeArea = (BiomeArea)2 }; case "shrub_bal": case "BushDark_bal": return new VegetationBiomeSettings { Biome = (Biome)586, BiomeArea = (BiomeArea)3 }; case "Pickable_Kelp_bal": return new VegetationBiomeSettings { Biome = (Biome)50, BiomeArea = (BiomeArea)3 }; case "HugeRoot1_bal": case "Pickable_waterlily_bal": return new VegetationBiomeSettings { Biome = (Biome)25, BiomeArea = (BiomeArea)3 }; case "RockGolemSpawn_bal": case "rock_silver_small_bal": case "rock_nickel_nomoss_bal": case "Pickable_TinNew_bal": case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "RockDolmenSnow4_bal": return new VegetationBiomeSettings { Biome = (Biome)68, BiomeArea = (BiomeArea)3 }; case "YewTree_bal": case "MineRock_Blackmetal_bal": case "coal_rock1_bal": return new VegetationBiomeSettings { Biome = (Biome)528, BiomeArea = (BiomeArea)3 }; case "rock_nickel_bal": return new VegetationBiomeSettings { Biome = (Biome)513, BiomeArea = (BiomeArea)3 }; case "Pickable_Mushroom_grayNew_bal": return new VegetationBiomeSettings { Biome = (Biome)520, BiomeArea = (BiomeArea)3 }; case "Beech_Sapling": case "Birch_Sapling": case "Oak_Sapling": case "Willow_bal": case "sapling_Willow_bal": case "Pickable_Mint_bal": case "Pickable_Lavender_bal": return new VegetationBiomeSettings { Biome = (Biome)1, BiomeArea = (BiomeArea)3 }; case "Cypress_bal": case "sapling_Cypress_bal": case "Pickable_Sage_bal": return new VegetationBiomeSettings { Biome = (Biome)8, BiomeArea = (BiomeArea)3 }; case "Acai_Dead_Stub_bal": case "Acai_Dead_bal": case "Oak_Swamp_bal": case "sapling_Swamp_bal": case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": case "Pickable_Mushroom_Darkbul_bal": case "Pickable_Plantain_bal": case "Pickable_Mugwort_bal": return new VegetationBiomeSettings { Biome = (Biome)2, BiomeArea = (BiomeArea)3 }; case "Pickable_SeedCabbage_bal": case "DrakeSpawner_bal": case "Pickable_Mushroom_blue_bal": return new VegetationBiomeSettings { Biome = (Biome)4, BiomeArea = (BiomeArea)3 }; case "Maple_bal": case "YggaBigShoot_bal": case "TwistedTree_small_bal": case "DeathsquitoHive_bal": case "Pickable_Mushroom_Inkcap_bal": case "Pickable_SeedGarlic_bal": case "sapling_BirchAtumn_bal": case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": case "flowstone_bal": case "Pickable_Yarrow_bal": return new VegetationBiomeSettings { Biome = (Biome)16, BiomeArea = (BiomeArea)3 }; case "AcaiTree_Stub_bal": case "ElderMushroom_bal": case "SeekerBroodSpawner_bal": case "SeekerEgg_bal": case "AcaiTree_New_bal": case "sapling_AcaiTree_bal": case "MineRock_DarkIron_bal": case "MineRock_Borax_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_Arch_bal": case "Pickable_Nettle_bal": case "Pickable_Seaberry_bal": return new VegetationBiomeSettings { Biome = (Biome)512, BiomeArea = (BiomeArea)3 }; case "coal_rock_nomoss_bal": case "gold_Rock_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": return new VegetationBiomeSettings { Biome = (Biome)96, BiomeArea = (BiomeArea)3 }; case "bloodshard_deposit_bal": case "SurtlingSpawner_bal": case "AshlandsDryBush_bal": case "MineRock_MeteoriteNew_bal": case "stalagmite_ash_bal": case "Pickable_MagmaStone_bal": case "AshRock1_bal": case "AshRockPillar_bal": case "caverock_magma_stalagmite_broken_bal": case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "DragonSkull2_bal": case "DragonSkull_bal": case "rock_ashlands_bal": case "Pickable_Bloodvine_bal": case "Pickable_Ignicap_bal": return new VegetationBiomeSettings { Biome = (Biome)32, BiomeArea = (BiomeArea)3 }; case "Pickable_MeteoriteNew_bal": return new VegetationBiomeSettings { Biome = (Biome)32, BiomeArea = (BiomeArea)2 }; case "Pickable_Mushroom_Icecap_bal": case "IceberryBush_bal": case "DryBush1_bal": case "DryBush2_bal": case "FallenTreeDeepNorth_bal": case "flowstone_ice_bal": case "stalagmite_ice_bal": case "iceLump_bal": case "cliff_deepnorth_bal": case "IceCliff1_bal": case "cliff_deepnorth_rock_bal": case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": case "MammothSkull_bal": case "Pickable_Snowleaf_bal": return new VegetationBiomeSettings { Biome = (Biome)64, BiomeArea = (BiomeArea)3 }; case "Pickable_Straw_DeepNorth_bal": case "IceCliff3_bal": case "IceCliff2_bal": case "cliff_deepnorth_Arch_bal": case "cliff_deepnorth2_bal": return new VegetationBiomeSettings { Biome = (Biome)64, BiomeArea = (BiomeArea)1 }; case "ElderTreeStump_bal": case "ElderTree_bal": case "IcedTree_bal": case "deposit_jotunfinger_bal": case "MineRock_Cobalt_bal": case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": case "basaltCliff_bal": case "iceblock_rock_bal": case "rock2_ice_bal": case "rock3_ice_bal": return new VegetationBiomeSettings { Biome = (Biome)64, BiomeArea = (BiomeArea)2 }; default: return null; } } } public class VegetationForestSettings { public bool InForest = true; public float ForestThresholdMin = 0.2f; public float ForestThresholdMax = 0.8f; } public class VegetationRotationSetting { public float MinTilt = 0f; public float MaxTilt = 45f; public float RandTilt = 10f; public float ChanceToUseGroundTilt = 0.5f; } public class VegetationTerrainSetter { public static Dictionary terrainSettings = new Dictionary(); public static void CreateTerrainSettings() { List vegetationPrefabs = Launch.modResourceLoader.vegetationPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item in vegetationPrefabs) { VegetationTerrainSettings biomeSetupForPrefab = GetBiomeSetupForPrefab(((Object)item).name); if (biomeSetupForPrefab != null) { terrainSettings[((Object)item).name] = biomeSetupForPrefab; } } vegetationPrefabs = Launch.modResourceLoader.plantPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item2 in vegetationPrefabs) { VegetationTerrainSettings biomeSetupForPrefab2 = GetBiomeSetupForPrefab(((Object)item2).name); if (biomeSetupForPrefab2 != null) { terrainSettings[((Object)item2).name] = biomeSetupForPrefab2; } } } private static VegetationTerrainSettings GetBiomeSetupForPrefab(string prefabName) { switch (prefabName) { case "iceLump_bal": case "Pickable_waterlily_bal": case "Pickable_Kelp_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 0f, MaxTerrainDelta = 2f, MinTerrainDelta = 0.1f, SnapToWater = true }; case "sapling_Swamp_bal": case "IceberryBush_bal": case "DryBush1_bal": case "DryBush2_bal": case "Acai_Dead_Stub_bal": case "sapling_AcaiTree_bal": case "sapling_BirchAtumn_bal": case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": case "AcaiTree_Stub_bal": case "shrub_bal": case "BushDark_bal": case "sapling_bush_bal": case "BlackberryBush_bal": case "sapling_bush_blackberry_bal": case "FirTree_Sapling": case "PineTree_Sapling": case "sapling_Poplar_bal": case "Pickable_Straw_bal": case "Pickable_Mushroom_grayNew_bal": case "Beech_Sapling": case "Birch_Sapling": case "Oak_Sapling": case "sapling_Willow_bal": case "Pickable_Mint_bal": case "Pickable_Lavender_bal": case "sapling_Cypress_bal": case "Pickable_Mushroom_Darkbul_bal": case "Pickable_Plantain_bal": case "Pickable_Mugwort_bal": case "Pickable_Sage_bal": case "Pickable_Mushroom_Inkcap_bal": case "Pickable_SeedGarlic_bal": case "Pickable_Yarrow_bal": case "Pickable_Mushroom_blue_bal": case "Pickable_SeedCabbage_bal": case "Pickable_Bloodvine_bal": case "Pickable_Ignicap_bal": case "Pickable_Nettle_bal": case "Pickable_Seaberry_bal": case "Pickable_Straw_DeepNorth_bal": case "Pickable_Snowleaf_bal": case "Pickable_MeadowsMeatPile01_bal": case "Pickable_MeadowsMeatPile02_bal": case "Pickable_Clay_bal": case "Pickable_MeteoriteNew_bal": case "Pickable_Mushroom_Icecap_bal": case "Pickable_TinNew_bal": case "Pickable_MagmaStone_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 0f, MaxTerrainDelta = 2f, MinTerrainDelta = 0f, SnapToWater = false }; case "AcaiTree_New_bal": case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": case "Acai_Dead_bal": case "Oak_Swamp_bal": case "Poplar_bal": case "YewTree_bal": case "Maple_bal": case "YggaBigShoot_bal": case "TwistedTree_small_bal": case "Cypress_bal": case "Willow_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 0f, MaxTerrainDelta = 2f, MinTerrainDelta = 0.1f, SnapToWater = false }; case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "RockDolmenSnow4_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 0.1f, MaxTerrainDelta = 2f, MinTerrainDelta = 0.1f, SnapToWater = false }; case "MineRock_MeteoriteNew_bal": case "MineRock_DarkIron_bal": case "MineRock_Borax_bal": case "MineRock_Nickel_bal": case "MineRock_Copper_bal": case "MineRock_IronNew_bal": case "MineRock_Blackmetal_bal": case "MineRock_Cobalt_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 1f, MaxTerrainDelta = 2f, MinTerrainDelta = 0.1f, SnapToWater = false }; case "DragonSkull2_bal": case "DragonSkull_bal": case "AncientSkullRock_bal": case "loxSkeleton_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": case "MammothSkull_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 1f, MaxTerrainDelta = 3f, MinTerrainDelta = 1f, SnapToWater = false }; case "flowstone_bal": case "ClayDeposit_bal": case "ChitinDeposit_bal": case "clamChestSmall_bal": case "clamChest_bal": case "HugeRoot1_bal": case "RockGolemSpawn_bal": case "DrakeSpawner_bal": case "DeathsquitoHive_bal": case "bloodshard_deposit_bal": case "SurtlingSpawner_bal": case "AshlandsDryBush_bal": case "stalagmite_ash_bal": case "caverock_magma_stalagmite_broken_bal": case "rock_ashlands_bal": case "gold_Rock_bal": case "ElderMushroom_bal": case "SeekerBroodSpawner_bal": case "SeekerEgg_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_Arch_bal": case "FallenTreeDeepNorth_bal": case "flowstone_ice_bal": case "stalagmite_ice_bal": case "cliff_deepnorth_Arch_bal": case "ElderTreeStump_bal": case "ElderTree_bal": case "IcedTree_bal": case "deposit_jotunfinger_bal": case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 0.1f, MaxTerrainDelta = 2f, MinTerrainDelta = 0.1f, SnapToWater = false }; case "cliff_deepnorth2_bal": case "cliff_deepnorth_bal": case "IceCliff1_bal": case "cliff_deepnorth_rock_bal": case "IceCliff3_bal": case "IceCliff2_bal": case "basaltCliff_bal": case "iceblock_rock_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 3f, MaxTerrainDelta = 60f, MinTerrainDelta = 3f, SnapToWater = false }; case "AshRock1_bal": case "AshRockPillar_bal": case "rock_silver_small_bal": case "rock_nickel_nomoss_bal": case "rock_nickel_bal": case "coal_rock1_bal": case "rock2_ice_bal": case "rock3_ice_bal": case "coal_rock_nomoss_bal": return new VegetationTerrainSettings { TerrainDeltaRadius = 1.5f, MaxTerrainDelta = 3f, MinTerrainDelta = 0.1f, SnapToWater = false }; default: return null; } } } public class VegetationSurroundingSetter { public static Dictionary surroundingSettings = new Dictionary(); public static void CreateSurroudingSettings() { List vegetationPrefabs = Launch.modResourceLoader.vegetationPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item in vegetationPrefabs) { VegetationSurroundingSetting biomeSetupForPrefab = GetBiomeSetupForPrefab(((Object)item).name); if (biomeSetupForPrefab != null) { surroundingSettings[((Object)item).name] = biomeSetupForPrefab; } } vegetationPrefabs = Launch.modResourceLoader.plantPrefabs; if (vegetationPrefabs == null) { return; } foreach (GameObject item2 in vegetationPrefabs) { VegetationSurroundingSetting biomeSetupForPrefab2 = GetBiomeSetupForPrefab(((Object)item2).name); if (biomeSetupForPrefab2 != null) { surroundingSettings[((Object)item2).name] = biomeSetupForPrefab2; } } } private static VegetationSurroundingSetting GetBiomeSetupForPrefab(string prefabName) { switch (prefabName) { case "shrub_bal": case "BushDark_bal": case "sapling_bush_bal": case "sapling_bush_blueberry_bal": case "sapling_bush_raspberry_bal": case "BlackberryBush_bal": case "sapling_bush_blackberry_bal": case "FirTree_Sapling": case "PineTree_Sapling": case "Poplar_bal": case "sapling_Poplar_bal": case "Pickable_Straw_bal": case "Pickable_Mushroom_grayNew_bal": case "Beech_Sapling": case "Birch_Sapling": case "Oak_Sapling": case "Willow_bal": case "sapling_Willow_bal": case "Pickable_Mint_bal": case "Pickable_Lavender_bal": case "Cypress_bal": case "sapling_Cypress_bal": case "Pickable_Mushroom_Darkbul_bal": case "Pickable_Plantain_bal": case "Pickable_Mugwort_bal": case "Pickable_Sage_bal": case "Pickable_Mushroom_Inkcap_bal": case "Pickable_SeedGarlic_bal": case "sapling_BirchAtumn_bal": case "sapling_bushPlains2_bal": case "sapling_bushPlains_bal": case "Pickable_Yarrow_bal": case "Pickable_Mushroom_blue_bal": case "Pickable_SeedCabbage_bal": case "Pickable_Bloodvine_bal": case "Pickable_Ignicap_bal": case "Pickable_Nettle_bal": case "Pickable_Seaberry_bal": case "Pickable_Straw_DeepNorth_bal": case "Pickable_Snowleaf_bal": return new VegetationSurroundingSetting { MinVegetation = 0f, MaxVegetation = 0.9f, SurroundCheckVegetation = true, SurroundCheckDistance = 5f, SurroundCheckLayers = 2, SurroundBetterThanAverage = 0.1f }; case "flowstone_bal": case "YewTree_bal": case "Pickable_MeadowsMeatPile02_bal": case "ClayDeposit_bal": case "Pickable_Clay_bal": case "Pickable_MeadowsMeatPile01_bal": case "ChitinDeposit_bal": case "clamChestSmall_bal": case "clamChest_bal": case "AncientSkullRock_bal": case "loxSkeleton_bal": case "MammothRibcage_bal": case "MammothSpine_bal": case "DragonRibcage_bal": case "WhaleSkull_bal": case "WhaleRibs_bal": case "WhaleSpine_bal": case "MineRock_Nickel_bal": case "MineRock_Copper_bal": case "MineRock_IronNew_bal": case "Pickable_Kelp_bal": case "HugeRoot1_bal": case "Pickable_waterlily_bal": case "RockGolemSpawn_bal": case "rock_silver_small_bal": case "rock_nickel_nomoss_bal": case "Pickable_TinNew_bal": case "RockDolmenSnow_bal": case "RockDolmenSnow2_bal": case "RockDolmenSnow3_bal": case "MineRock_Blackmetal_bal": case "coal_rock1_bal": case "RockDolmenSnow4_bal": case "rock_nickel_bal": case "Acai_Dead_bal": case "Oak_Swamp_bal": case "sapling_Swamp_bal": case "LinedSwampTreeLarge_bal": case "LinedSwampTreeLarge2_bal": case "WetTree1_bal": case "WetTree2_bal": case "WetTree3_bal": case "DrakeSpawner_bal": case "DeathsquitoHive_bal": case "bloodshard_deposit_bal": case "SurtlingSpawner_bal": case "AshlandsDryBush_bal": case "AcaiTree_Stub_bal": case "Acai_Dead_Stub_bal": case "Maple_bal": case "YggaBigShoot_bal": case "TwistedTree_small_bal": case "MineRock_MeteoriteNew_bal": case "stalagmite_ash_bal": case "Pickable_MagmaStone_bal": case "AshRock1_bal": case "AshRockPillar_bal": case "caverock_magma_stalagmite_broken_bal": case "RockDolmenLava1_bal": case "RockDolmenLava2_bal": case "RockDolmenLava3_bal": case "RockDolmenLava4_bal": case "DragonSkull2_bal": case "DragonSkull_bal": case "rock_ashlands_bal": case "coal_rock_nomoss_bal": case "gold_Rock_bal": case "RockDolmenAshlands_1_bal": case "RockDolmenAshlands_2_bal": case "RockDolmenAshlands_3_bal": case "ElderMushroom_bal": case "SeekerBroodSpawner_bal": case "SeekerEgg_bal": case "AcaiTree_New_bal": case "sapling_AcaiTree_bal": case "MineRock_DarkIron_bal": case "MineRock_Borax_bal": case "cliff_mistlands_rock_bal": case "cliff_mistlands_Arch_bal": case "Pickable_MeteoriteNew_bal": case "Pickable_Mushroom_Icecap_bal": case "IceberryBush_bal": case "DryBush1_bal": case "DryBush2_bal": case "FallenTreeDeepNorth_bal": case "flowstone_ice_bal": case "stalagmite_ice_bal": case "iceLump_bal": case "cliff_deepnorth_bal": case "IceCliff1_bal": case "cliff_deepnorth_rock_bal": case "RockDolmenIce1_bal": case "RockDolmenIce2_bal": case "RockDolmenIce3_bal": case "RockDolmenIce4_bal": case "MammothSkull_bal": case "IceCliff3_bal": case "IceCliff2_bal": case "cliff_deepnorth_Arch_bal": case "cliff_deepnorth2_bal": case "ElderTreeStump_bal": case "ElderTree_bal": case "IcedTree_bal": case "deposit_jotunfinger_bal": case "MineRock_Cobalt_bal": case "Pickable_MountainCaveCrystal_bal": case "caverockIce_bal": case "basaltCliff_bal": case "iceblock_rock_bal": case "rock2_ice_bal": case "rock3_ice_bal": return new VegetationSurroundingSetting { MinVegetation = 0f, MaxVegetation = 0.9f, SurroundCheckVegetation = true, SurroundCheckDistance = 15f, SurroundCheckLayers = 2, SurroundBetterThanAverage = 0.3f }; default: return null; } } } public class VegetationSurroundingSetting { public float MinVegetation = 0.1f; public float MaxVegetation = 0.9f; public bool SurroundCheckVegetation = true; public float SurroundCheckDistance = 25f; public int SurroundCheckLayers = 3; public float SurroundBetterThanAverage = 0.3f; } public class VegetationTerrainSettings { public float TerrainDeltaRadius = 1f; public float MaxTerrainDelta = 3f; public float MinTerrainDelta = 0.5f; public bool SnapToWater = false; } } namespace BalrondNature.Services { public class EditRegistry { public Dictionary>> RecipeHandlers { get; private set; } public Dictionary> ItemHandlers { get; private set; } public EditRegistry() { RecipeHandlers = new Dictionary>>(StringComparer.Ordinal); ItemHandlers = new Dictionary>(StringComparer.Ordinal); RegisterDefaultRecipes(); RegisterFoodItems(); } private void RegisterDefaultRecipes() { RecipeHandlers["Bronze"] = delegate(Recipe recipe, List items) { List list = new List { RequirementFactory.Create(items, "Tin", 1), RequirementFactory.Create(items, "Copper", 2), RequirementFactory.Create(items, "Coal", 2) }; recipe.m_amount = 2; recipe.m_resources = list.ToArray(); }; RecipeHandlers["ScorchingMedley"] = delegate(Recipe recipe, List items) { recipe.m_enabled = true; recipe.m_craftingStation = TableMapper.grill; recipe.m_repairStation = recipe.m_craftingStation; recipe.m_minStationLevel = 3; recipe.m_amount = 3; recipe.m_resources = (Requirement[])(object)new Requirement[4] { RequirementFactory.Create(items, "MushroomJotunPuffs", 3), RequirementFactory.Create(items, "SpiceSet_bal", 1), RequirementFactory.Create(items, "Fiddleheadfern", 3), RequirementFactory.Create(items, "Ignicap_bal", 2) }; }; } private void RegisterFoodItems() { ItemHandlers["QueensJam"] = delegate(GameObject go) { ItemDrop component10 = go.GetComponent(); if (!((Object)(object)component10 == (Object)null)) { SharedData shared10 = component10.m_itemData.m_shared; shared10.m_food = 15f; shared10.m_foodStamina = 45f; shared10.m_foodEitr = 0f; shared10.m_foodBurnTime = 1200f; shared10.m_foodRegen = 3f; } }; ItemHandlers["SizzlingBerryBroth"] = delegate(GameObject go) { ItemDrop component9 = go.GetComponent(); if (!((Object)(object)component9 == (Object)null)) { SharedData shared9 = component9.m_itemData.m_shared; shared9.m_food = 30f; shared9.m_foodStamina = 20f; shared9.m_foodEitr = 80f; shared9.m_foodBurnTime = 1600f; shared9.m_foodRegen = 4f; } }; ItemHandlers["CarrotSoup"] = delegate(GameObject go) { ItemDrop component8 = go.GetComponent(); if (!((Object)(object)component8 == (Object)null)) { SharedData shared8 = component8.m_itemData.m_shared; shared8.m_food = 20f; shared8.m_foodStamina = 40f; shared8.m_foodEitr = 0f; shared8.m_foodBurnTime = 1700f; shared8.m_foodRegen = 3f; } }; ItemHandlers["TurnipStew"] = delegate(GameObject go) { ItemDrop component7 = go.GetComponent(); if (!((Object)(object)component7 == (Object)null)) { SharedData shared7 = component7.m_itemData.m_shared; shared7.m_food = 20f; shared7.m_foodStamina = 60f; shared7.m_foodEitr = 0f; shared7.m_foodBurnTime = 1500f; shared7.m_foodRegen = 2f; } }; ItemHandlers["Turnip"] = delegate(GameObject go) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) ItemDrop component6 = go.GetComponent(); if (!((Object)(object)component6 == (Object)null)) { component6.m_itemData.m_shared.m_itemType = (ItemType)2; SharedData shared6 = component6.m_itemData.m_shared; shared6.m_food = 12f; shared6.m_foodStamina = 38f; shared6.m_foodEitr = 0f; shared6.m_foodBurnTime = 800f; shared6.m_foodRegen = 1f; } }; ItemHandlers["BlackSoup"] = delegate(GameObject go) { ItemDrop component5 = go.GetComponent(); if (!((Object)(object)component5 == (Object)null)) { SharedData shared5 = component5.m_itemData.m_shared; shared5.m_food = 50f; shared5.m_foodStamina = 15f; shared5.m_foodEitr = 15f; shared5.m_foodBurnTime = 1200f; shared5.m_foodRegen = 3f; } }; ItemHandlers["FierySvinstew"] = delegate(GameObject go) { ItemDrop component4 = go.GetComponent(); if (!((Object)(object)component4 == (Object)null)) { SharedData shared4 = component4.m_itemData.m_shared; shared4.m_food = 90f; shared4.m_foodStamina = 30f; shared4.m_foodEitr = 20f; shared4.m_foodBurnTime = 1500f; shared4.m_foodRegen = 6f; } }; ItemHandlers["OnionSoup"] = delegate(GameObject go) { ItemDrop component3 = go.GetComponent(); if (!((Object)(object)component3 == (Object)null)) { SharedData shared3 = component3.m_itemData.m_shared; shared3.m_food = 25f; shared3.m_foodStamina = 65f; shared3.m_foodEitr = 0f; shared3.m_foodBurnTime = 1300f; shared3.m_foodRegen = 1f; } }; ItemHandlers["SerpentStew"] = delegate(GameObject go) { ItemDrop component2 = go.GetComponent(); if (!((Object)(object)component2 == (Object)null)) { SharedData shared2 = component2.m_itemData.m_shared; shared2.m_food = 80f; shared2.m_foodStamina = 30f; shared2.m_foodEitr = 0f; shared2.m_foodBurnTime = 1900f; shared2.m_foodRegen = 4f; } }; ItemHandlers["RottenMeat"] = delegate(GameObject go) { ItemDrop component = go.GetComponent(); if (!((Object)(object)component == (Object)null)) { SharedData shared = component.m_itemData.m_shared; shared.m_food = 15f; shared.m_foodStamina = 5f; shared.m_foodEitr = 0f; shared.m_foodBurnTime = 2400f; shared.m_foodRegen = -4f; shared.m_consumeStatusEffect = null; } }; } } public static class ItemUtils { public static GameObject FindItem(List list, string name) { if (string.IsNullOrEmpty(name)) { return null; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name); if ((Object)(object)itemPrefab != (Object)null) { return itemPrefab; } Debug.LogWarning((object)("[ItemUtils] Missing prefab: " + name)); return null; } public static void EditKey(ItemDrop item) { if (!((Object)(object)item == (Object)null)) { item.m_itemData.m_shared.m_maxStackSize = 20; } } public static void AddAttackStatusEffect(ItemDrop item, string effectName) { if (!((Object)(object)item == (Object)null) && !string.IsNullOrEmpty(effectName)) { StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(BalrondHashCompat.StableHash(effectName)); if ((Object)(object)statusEffect == (Object)null) { Debug.LogWarning((object)("[ItemUtils] Missing StatusEffect: " + effectName)); } else { item.m_itemData.m_shared.m_attackStatusEffect = statusEffect; } } } public static void EditSkeletonStaff(ItemDrop item) { if (!((Object)(object)item == (Object)null)) { item.m_itemData.m_shared.m_attack.m_attackEitr = 44f; } } public static void EditItemName(ItemDrop item, string newName) { if (!((Object)(object)item == (Object)null)) { item.m_itemData.m_shared.m_name = newName; } } public static void EditSpiritDamage(ItemDrop item, int spiritDamage) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; shared.m_damages.m_spirit = spiritDamage; string name = ((Object)((Component)item).gameObject).name; if (name == "skeleton_mace" || name == "imp_fireball_attack") { shared.m_damages.m_blunt += spiritDamage; } } } public static void EditSurtlingDamage(ItemDrop item, int fireDamage) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; shared.m_damages.m_fire = fireDamage; shared.m_damages.m_blunt += fireDamage; } } public static void EditToolTier(ItemDrop item, int level) { if (!((Object)(object)item == (Object)null)) { item.m_itemData.m_shared.m_toolTier = level; } } public static void EditWolfCapeResistance(ItemDrop item) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)item == (Object)null)) { item.m_itemData.m_shared.m_damageModifiers.Clear(); DamageModPair val = default(DamageModPair); val.m_type = (DamageType)64; val.m_modifier = (DamageModifier)0; DamageModPair item2 = val; item.m_itemData.m_shared.m_damageModifiers.Add(item2); } } public static void EditLoxCapeResistance(ItemDrop item) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)item == (Object)null)) { item.m_itemData.m_shared.m_damageModifiers.Clear(); DamageModPair val = default(DamageModPair); val.m_type = (DamageType)64; val.m_modifier = (DamageModifier)0; DamageModPair item2 = val; val = default(DamageModPair); val.m_type = (DamageType)32; val.m_modifier = (DamageModifier)0; DamageModPair item3 = val; item.m_itemData.m_shared.m_damageModifiers.Add(item2); item.m_itemData.m_shared.m_damageModifiers.Add(item3); } } public static void EditLevel(ItemDrop item, int level, bool hasUpgrade) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (hasUpgrade && shared.m_maxQuality > 1) { shared.m_maxQuality = level; } else { shared.m_maxQuality = level; } } } public static void EditPickaxeStone(ItemDrop item) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; shared.m_name = "Flint Pickaxe"; shared.m_maxDurability = 70f; shared.m_weight = 4f; } } public static void EditWolfFang(ItemDrop item) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; shared.m_name = "Bone Spear"; shared.m_description = "A clever usage of boar tusk"; shared.m_damages.m_pierce = 26f; } } public static void EditRemoveStatusEffect(ItemDrop item) { if (!((Object)(object)item == (Object)null)) { item.m_itemData.m_shared.m_consumeStatusEffect = null; } } public static void EditFoodStats(ItemDrop item, int hp = -99, int stam = -99, int eitr = -99, int time = -99, float regen = -99f) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (hp != -99) { shared.m_food = hp; } if (stam != -99) { shared.m_foodStamina = stam; } if (eitr != -99) { shared.m_foodEitr = eitr; } if (time != -99) { shared.m_foodBurnTime = time; } if (regen != -99f) { shared.m_foodRegen = regen; } } } public static void EditStackAndWeight(ItemDrop item, float weight = -1f, int stack = 1) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (weight != -1f) { shared.m_weight = weight; } shared.m_autoStack = true; shared.m_maxStackSize = stack; } } public static void EditArmorSetEffect(ItemDrop item, int setSize, string statusName, string setName) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; shared.m_setName = setName; shared.m_setSize = setSize; shared.m_setStatusEffect = ObjectDB.instance.m_StatusEffects.Find((StatusEffect x) => ((Object)x).name == statusName); } } public static void EditQualityValues(ItemDrop item, float weightRatio = 0f, int quality = 4, float weight = -1f, float speedDebuff = 0f, float equipSpeed = -1f) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (weight != -1f) { shared.m_weight = weight; } if (weightRatio != 0f) { shared.m_scaleWeightByQuality = weightRatio; } if (equipSpeed != -1f) { shared.m_equipDuration = equipSpeed; } shared.m_movementModifier = speedDebuff; shared.m_maxQuality = quality; } } public static void EditDefense(ItemDrop item, float blockPower = -1f, float blockPowerPerLevel = -1f, float deflectionForce = -1f, float deflectionForcePerLevel = -1f, float blockBonus = -1f) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (blockPower != -1f) { shared.m_blockPower = blockPower; } if (blockPowerPerLevel != -1f) { shared.m_blockPowerPerLevel = blockPowerPerLevel; } if (deflectionForce != -1f) { shared.m_deflectionForce = deflectionForce; } if (deflectionForcePerLevel != -1f) { shared.m_deflectionForcePerLevel = deflectionForcePerLevel; } if (blockBonus != -1f) { shared.m_timedBlockBonus = blockBonus; } } } public static void EditArmor(ItemDrop item, float armor = -1f, float armorPerLevel = -1f) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (armor != -1f) { shared.m_armor = armor; } if (armorPerLevel != -1f) { shared.m_armorPerLevel = armorPerLevel; } } } public static void EditDurability(ItemDrop item, float durability = -1f, float durabilityPerLevel = -1f, float useDrain = -1f) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (durability != -1f) { item.m_itemData.m_durability = durability; } if (durabilityPerLevel != -1f) { shared.m_durabilityPerLevel = durabilityPerLevel; } if (useDrain != -1f) { shared.m_useDurabilityDrain = useDrain; } } } public static void EditValueAndTeleport(ItemDrop item, int newValue = -1, bool teleportable = true) { if (!((Object)(object)item == (Object)null)) { SharedData shared = item.m_itemData.m_shared; if (newValue != -1) { shared.m_value = newValue; } shared.m_teleportable = teleportable; } } } public class RecipeEditor { public void ApplyRecipeChanges(Recipe recipe, EditRegistry registry, List items) { string name = ((Object)((Component)recipe.m_item).gameObject).name; if (!registry.RecipeHandlers.ContainsKey(name)) { return; } try { registry.RecipeHandlers[name](recipe, items); } catch (Exception ex) { Debug.LogError((object)("[RecipeEditor] Error editing recipe '" + name + "': " + ex.Message)); } } } public static class RequirementFactory { private static readonly Dictionary _cache = new Dictionary(); private static readonly HashSet _missing = new HashSet(); public static Requirement Create(List items, string name, int amount, int perLevel = 0) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown if (string.IsNullOrEmpty(name)) { return new Requirement(); } if (_cache.TryGetValue(name, out var value)) { return BuildRequirement(value, amount, perLevel); } if (_missing.Contains(name)) { return new Requirement(); } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(name); if ((Object)(object)itemPrefab == (Object)null) { Debug.LogWarning((object)("[RequirementFactory] Missing prefab: " + name)); _missing.Add(name); return new Requirement(); } value = itemPrefab.GetComponent(); if ((Object)(object)value == (Object)null) { Debug.LogWarning((object)("[RequirementFactory] Missing ItemDrop on prefab: " + name)); _missing.Add(name); return new Requirement(); } _cache[name] = value; return BuildRequirement(value, amount, perLevel); } private static Requirement BuildRequirement(ItemDrop item, int amount, int perLevel) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown if ((Object)(object)item == (Object)null) { return new Requirement(); } return new Requirement { m_resItem = item, m_amount = amount, m_amountPerLevel = perLevel, m_recover = true }; } public static void ClearCache() { _cache.Clear(); _missing.Clear(); } } } namespace LitJson2 { internal enum JsonType { None, Object, Array, String, Int, Long, Double, Boolean } internal interface IJsonWrapper : IList, IOrderedDictionary, IDictionary, ICollection, IEnumerable { bool IsArray { get; } bool IsBoolean { get; } bool IsDouble { get; } bool IsInt { get; } bool IsLong { get; } bool IsObject { get; } bool IsString { get; } bool GetBoolean(); double GetDouble(); int GetInt(); JsonType GetJsonType(); long GetLong(); string GetString(); void SetBoolean(bool val); void SetDouble(double val); void SetInt(int val); void SetJsonType(JsonType type); void SetLong(long val); void SetString(string val); string ToJson(); void ToJson(JsonWriter writer); } internal class JsonData : IJsonWrapper, IList, IOrderedDictionary, IDictionary, ICollection, IEnumerable, IEquatable { private IList inst_array; private bool inst_boolean; private double inst_double; private int inst_int; private long inst_long; private IDictionary inst_object; private string inst_string; private string json; private JsonType type; private IList> object_list; public int Count => EnsureCollection().Count; public bool IsArray => type == JsonType.Array; public bool IsBoolean => type == JsonType.Boolean; public bool IsDouble => type == JsonType.Double; public bool IsInt => type == JsonType.Int; public bool IsLong => type == JsonType.Long; public bool IsObject => type == JsonType.Object; public bool IsString => type == JsonType.String; public ICollection Keys { get { EnsureDictionary(); return inst_object.Keys; } } int ICollection.Count => Count; bool ICollection.IsSynchronized => EnsureCollection().IsSynchronized; object ICollection.SyncRoot => EnsureCollection().SyncRoot; bool IDictionary.IsFixedSize => EnsureDictionary().IsFixedSize; bool IDictionary.IsReadOnly => EnsureDictionary().IsReadOnly; ICollection IDictionary.Keys { get { EnsureDictionary(); IList list = new List(); foreach (KeyValuePair item in object_list) { list.Add(item.Key); } return (ICollection)list; } } ICollection IDictionary.Values { get { EnsureDictionary(); IList list = new List(); foreach (KeyValuePair item in object_list) { list.Add(item.Value); } return (ICollection)list; } } bool IJsonWrapper.IsArray => IsArray; bool IJsonWrapper.IsBoolean => IsBoolean; bool IJsonWrapper.IsDouble => IsDouble; bool IJsonWrapper.IsInt => IsInt; bool IJsonWrapper.IsLong => IsLong; bool IJsonWrapper.IsObject => IsObject; bool IJsonWrapper.IsString => IsString; bool IList.IsFixedSize => EnsureList().IsFixedSize; bool IList.IsReadOnly => EnsureList().IsReadOnly; object IDictionary.this[object key] { get { return EnsureDictionary()[key]; } set { if (!(key is string)) { throw new ArgumentException("The key has to be a string"); } JsonData value2 = ToJsonData(value); this[(string)key] = value2; } } object IOrderedDictionary.this[int idx] { get { EnsureDictionary(); return object_list[idx].Value; } set { EnsureDictionary(); JsonData value2 = ToJsonData(value); KeyValuePair keyValuePair = object_list[idx]; inst_object[keyValuePair.Key] = value2; KeyValuePair value3 = new KeyValuePair(keyValuePair.Key, value2); object_list[idx] = value3; } } object IList.this[int index] { get { return EnsureList()[index]; } set { EnsureList(); JsonData value2 = ToJsonData(value); this[index] = value2; } } public JsonData this[string prop_name] { get { EnsureDictionary(); return inst_object[prop_name]; } set { EnsureDictionary(); KeyValuePair keyValuePair = new KeyValuePair(prop_name, value); if (inst_object.ContainsKey(prop_name)) { for (int i = 0; i < object_list.Count; i++) { if (object_list[i].Key == prop_name) { object_list[i] = keyValuePair; break; } } } else { object_list.Add(keyValuePair); } inst_object[prop_name] = value; json = null; } } public JsonData this[int index] { get { EnsureCollection(); if (type == JsonType.Array) { return inst_array[index]; } return object_list[index].Value; } set { EnsureCollection(); if (type == JsonType.Array) { inst_array[index] = value; } else { KeyValuePair keyValuePair = object_list[index]; KeyValuePair value2 = new KeyValuePair(keyValuePair.Key, value); object_list[index] = value2; inst_object[keyValuePair.Key] = value; } json = null; } } public JsonData() { } public JsonData(bool boolean) { type = JsonType.Boolean; inst_boolean = boolean; } public JsonData(double number) { type = JsonType.Double; inst_double = number; } public JsonData(int number) { type = JsonType.Int; inst_int = number; } public JsonData(long number) { type = JsonType.Long; inst_long = number; } public JsonData(object obj) { if (obj is bool) { type = JsonType.Boolean; inst_boolean = (bool)obj; return; } if (obj is double) { type = JsonType.Double; inst_double = (double)obj; return; } if (obj is int) { type = JsonType.Int; inst_int = (int)obj; return; } if (obj is long) { type = JsonType.Long; inst_long = (long)obj; return; } if (obj is string) { type = JsonType.String; inst_string = (string)obj; return; } throw new ArgumentException("Unable to wrap the given object with JsonData"); } public JsonData(string str) { type = JsonType.String; inst_string = str; } public static implicit operator JsonData(bool data) { return new JsonData(data); } public static implicit operator JsonData(double data) { return new JsonData(data); } public static implicit operator JsonData(int data) { return new JsonData(data); } public static implicit operator JsonData(long data) { return new JsonData(data); } public static implicit operator JsonData(string data) { return new JsonData(data); } public static explicit operator bool(JsonData data) { if (data.type != JsonType.Boolean) { throw new InvalidCastException("Instance of JsonData doesn't hold a double"); } return data.inst_boolean; } public static explicit operator double(JsonData data) { if (data.type != JsonType.Double) { throw new InvalidCastException("Instance of JsonData doesn't hold a double"); } return data.inst_double; } public static explicit operator int(JsonData data) { if (data.type != JsonType.Int) { throw new InvalidCastException("Instance of JsonData doesn't hold an int"); } return data.inst_int; } public static explicit operator long(JsonData data) { if (data.type != JsonType.Long) { throw new InvalidCastException("Instance of JsonData doesn't hold an int"); } return data.inst_long; } public static explicit operator string(JsonData data) { if (data.type != JsonType.String) { throw new InvalidCastException("Instance of JsonData doesn't hold a string"); } return data.inst_string; } void ICollection.CopyTo(Array array, int index) { EnsureCollection().CopyTo(array, index); } void IDictionary.Add(object key, object value) { JsonData value2 = ToJsonData(value); EnsureDictionary().Add(key, value2); KeyValuePair item = new KeyValuePair((string)key, value2); object_list.Add(item); json = null; } void IDictionary.Clear() { EnsureDictionary().Clear(); object_list.Clear(); json = null; } bool IDictionary.Contains(object key) { return EnsureDictionary().Contains(key); } IDictionaryEnumerator IDictionary.GetEnumerator() { return ((IOrderedDictionary)this).GetEnumerator(); } void IDictionary.Remove(object key) { EnsureDictionary().Remove(key); for (int i = 0; i < object_list.Count; i++) { if (object_list[i].Key == (string)key) { object_list.RemoveAt(i); break; } } json = null; } IEnumerator IEnumerable.GetEnumerator() { return EnsureCollection().GetEnumerator(); } bool IJsonWrapper.GetBoolean() { if (type != JsonType.Boolean) { throw new InvalidOperationException("JsonData instance doesn't hold a boolean"); } return inst_boolean; } double IJsonWrapper.GetDouble() { if (type != JsonType.Double) { throw new InvalidOperationException("JsonData instance doesn't hold a double"); } return inst_double; } int IJsonWrapper.GetInt() { if (type != JsonType.Int) { throw new InvalidOperationException("JsonData instance doesn't hold an int"); } return inst_int; } long IJsonWrapper.GetLong() { if (type != JsonType.Long) { throw new InvalidOperationException("JsonData instance doesn't hold a long"); } return inst_long; } string IJsonWrapper.GetString() { if (type != JsonType.String) { throw new InvalidOperationException("JsonData instance doesn't hold a string"); } return inst_string; } void IJsonWrapper.SetBoolean(bool val) { type = JsonType.Boolean; inst_boolean = val; json = null; } void IJsonWrapper.SetDouble(double val) { type = JsonType.Double; inst_double = val; json = null; } void IJsonWrapper.SetInt(int val) { type = JsonType.Int; inst_int = val; json = null; } void IJsonWrapper.SetLong(long val) { type = JsonType.Long; inst_long = val; json = null; } void IJsonWrapper.SetString(string val) { type = JsonType.String; inst_string = val; json = null; } string IJsonWrapper.ToJson() { return ToJson(); } void IJsonWrapper.ToJson(JsonWriter writer) { ToJson(writer); } int IList.Add(object value) { return Add(value); } void IList.Clear() { EnsureList().Clear(); json = null; } bool IList.Contains(object value) { return EnsureList().Contains(value); } int IList.IndexOf(object value) { return EnsureList().IndexOf(value); } void IList.Insert(int index, object value) { EnsureList().Insert(index, value); json = null; } void IList.Remove(object value) { EnsureList().Remove(value); json = null; } void IList.RemoveAt(int index) { EnsureList().RemoveAt(index); json = null; } IDictionaryEnumerator IOrderedDictionary.GetEnumerator() { EnsureDictionary(); return new OrderedDictionaryEnumerator(object_list.GetEnumerator()); } void IOrderedDictionary.Insert(int idx, object key, object value) { string text = (string)key; JsonData value2 = (this[text] = ToJsonData(value)); KeyValuePair item = new KeyValuePair(text, value2); object_list.Insert(idx, item); } void IOrderedDictionary.RemoveAt(int idx) { EnsureDictionary(); inst_object.Remove(object_list[idx].Key); object_list.RemoveAt(idx); } private ICollection EnsureCollection() { if (type == JsonType.Array) { return (ICollection)inst_array; } if (type == JsonType.Object) { return (ICollection)inst_object; } throw new InvalidOperationException("The JsonData instance has to be initialized first"); } private IDictionary EnsureDictionary() { if (type == JsonType.Object) { return (IDictionary)inst_object; } if (type != 0) { throw new InvalidOperationException("Instance of JsonData is not a dictionary"); } type = JsonType.Object; inst_object = new Dictionary(); object_list = new List>(); return (IDictionary)inst_object; } private IList EnsureList() { if (type == JsonType.Array) { return (IList)inst_array; } if (type != 0) { throw new InvalidOperationException("Instance of JsonData is not a list"); } type = JsonType.Array; inst_array = new List(); return (IList)inst_array; } private JsonData ToJsonData(object obj) { if (obj == null) { return null; } if (obj is JsonData) { return (JsonData)obj; } return new JsonData(obj); } private static void WriteJson(IJsonWrapper obj, JsonWriter writer) { if (obj == null) { writer.Write(null); } else if (obj.IsString) { writer.Write(obj.GetString()); } else if (obj.IsBoolean) { writer.Write(obj.GetBoolean()); } else if (obj.IsDouble) { writer.Write(obj.GetDouble()); } else if (obj.IsInt) { writer.Write(obj.GetInt()); } else if (obj.IsLong) { writer.Write(obj.GetLong()); } else if (obj.IsArray) { writer.WriteArrayStart(); foreach (object item in (IEnumerable)obj) { WriteJson((JsonData)item, writer); } writer.WriteArrayEnd(); } else { if (!obj.IsObject) { return; } writer.WriteObjectStart(); foreach (DictionaryEntry item2 in (IDictionary)obj) { writer.WritePropertyName((string)item2.Key); WriteJson((JsonData)item2.Value, writer); } writer.WriteObjectEnd(); } } public int Add(object value) { JsonData value2 = ToJsonData(value); json = null; return EnsureList().Add(value2); } public void Clear() { if (IsObject) { ((IDictionary)this).Clear(); } else if (IsArray) { ((IList)this).Clear(); } } public bool Equals(JsonData x) { if (x == null) { return false; } if (x.type != type) { return false; } return type switch { JsonType.None => true, JsonType.Object => inst_object.Equals(x.inst_object), JsonType.Array => inst_array.Equals(x.inst_array), JsonType.String => inst_string.Equals(x.inst_string), JsonType.Int => inst_int.Equals(x.inst_int), JsonType.Long => inst_long.Equals(x.inst_long), JsonType.Double => inst_double.Equals(x.inst_double), JsonType.Boolean => inst_boolean.Equals(x.inst_boolean), _ => false, }; } public JsonType GetJsonType() { return type; } public void SetJsonType(JsonType type) { if (this.type != type) { switch (type) { case JsonType.Object: inst_object = new Dictionary(); object_list = new List>(); break; case JsonType.Array: inst_array = new List(); break; case JsonType.String: inst_string = null; break; case JsonType.Int: inst_int = 0; break; case JsonType.Long: inst_long = 0L; break; case JsonType.Double: inst_double = 0.0; break; case JsonType.Boolean: inst_boolean = false; break; } this.type = type; } } public string ToJson() { if (json != null) { return json; } StringWriter stringWriter = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(stringWriter); jsonWriter.Validate = false; WriteJson(this, jsonWriter); json = stringWriter.ToString(); return json; } public void ToJson(JsonWriter writer) { bool validate = writer.Validate; writer.Validate = false; WriteJson(this, writer); writer.Validate = validate; } public override string ToString() { return type switch { JsonType.Array => "JsonData array", JsonType.Boolean => inst_boolean.ToString(), JsonType.Double => inst_double.ToString(), JsonType.Int => inst_int.ToString(), JsonType.Long => inst_long.ToString(), JsonType.Object => "JsonData object", JsonType.String => inst_string, _ => "Uninitialized JsonData", }; } } internal class OrderedDictionaryEnumerator : IDictionaryEnumerator, IEnumerator { private IEnumerator> list_enumerator; public object Current => Entry; public DictionaryEntry Entry { get { KeyValuePair current = list_enumerator.Current; return new DictionaryEntry(current.Key, current.Value); } } public object Key => list_enumerator.Current.Key; public object Value => list_enumerator.Current.Value; public OrderedDictionaryEnumerator(IEnumerator> enumerator) { list_enumerator = enumerator; } public bool MoveNext() { return list_enumerator.MoveNext(); } public void Reset() { list_enumerator.Reset(); } } internal class JsonException : ApplicationException { public JsonException() { } internal JsonException(ParserToken token) : base($"Invalid token '{token}' in input string") { } internal JsonException(ParserToken token, Exception inner_exception) : base($"Invalid token '{token}' in input string", inner_exception) { } internal JsonException(int c) : base($"Invalid character '{(char)c}' in input string") { } internal JsonException(int c, Exception inner_exception) : base($"Invalid character '{(char)c}' in input string", inner_exception) { } public JsonException(string message) : base(message) { } public JsonException(string message, Exception inner_exception) : base(message, inner_exception) { } } internal struct PropertyMetadata { public MemberInfo Info; public bool IsField; public Type Type; } internal struct ArrayMetadata { private Type element_type; private bool is_array; private bool is_list; public Type ElementType { get { if (element_type == null) { return typeof(JsonData); } return element_type; } set { element_type = value; } } public bool IsArray { get { return is_array; } set { is_array = value; } } public bool IsList { get { return is_list; } set { is_list = value; } } } internal struct ObjectMetadata { private Type element_type; private bool is_dictionary; private IDictionary properties; public Type ElementType { get { if (element_type == null) { return typeof(JsonData); } return element_type; } set { element_type = value; } } public bool IsDictionary { get { return is_dictionary; } set { is_dictionary = value; } } public IDictionary Properties { get { return properties; } set { properties = value; } } } internal delegate void ExporterFunc(object obj, JsonWriter writer); internal delegate void ExporterFunc(T obj, JsonWriter writer); internal delegate object ImporterFunc(object input); internal delegate TValue ImporterFunc(TJson input); internal delegate IJsonWrapper WrapperFactory(); internal class JsonMapper { private static int max_nesting_depth; private static IFormatProvider datetime_format; private static IDictionary base_exporters_table; private static IDictionary custom_exporters_table; private static IDictionary> base_importers_table; private static IDictionary> custom_importers_table; private static IDictionary array_metadata; private static readonly object array_metadata_lock; private static IDictionary> conv_ops; private static readonly object conv_ops_lock; private static IDictionary object_metadata; private static readonly object object_metadata_lock; private static IDictionary> type_properties; private static readonly object type_properties_lock; private static JsonWriter static_writer; private static readonly object static_writer_lock; static JsonMapper() { array_metadata_lock = new object(); conv_ops_lock = new object(); object_metadata_lock = new object(); type_properties_lock = new object(); static_writer_lock = new object(); max_nesting_depth = 100; array_metadata = new Dictionary(); conv_ops = new Dictionary>(); object_metadata = new Dictionary(); type_properties = new Dictionary>(); static_writer = new JsonWriter(); datetime_format = DateTimeFormatInfo.InvariantInfo; base_exporters_table = new Dictionary(); custom_exporters_table = new Dictionary(); base_importers_table = new Dictionary>(); custom_importers_table = new Dictionary>(); RegisterBaseExporters(); RegisterBaseImporters(); } private static void AddArrayMetadata(Type type) { if (array_metadata.ContainsKey(type)) { return; } ArrayMetadata value = default(ArrayMetadata); value.IsArray = type.IsArray; if (type.GetInterface("System.Collections.IList") != null) { value.IsList = true; } PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (!(propertyInfo.Name != "Item")) { ParameterInfo[] indexParameters = propertyInfo.GetIndexParameters(); if (indexParameters.Length == 1 && indexParameters[0].ParameterType == typeof(int)) { value.ElementType = propertyInfo.PropertyType; } } } lock (array_metadata_lock) { try { array_metadata.Add(type, value); } catch (ArgumentException) { } } } private static void AddObjectMetadata(Type type) { if (object_metadata.ContainsKey(type)) { return; } ObjectMetadata value = default(ObjectMetadata); if (type.GetInterface("System.Collections.IDictionary") != null) { value.IsDictionary = true; } value.Properties = new Dictionary(); PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.Name == "Item") { ParameterInfo[] indexParameters = propertyInfo.GetIndexParameters(); if (indexParameters.Length == 1 && indexParameters[0].ParameterType == typeof(string)) { value.ElementType = propertyInfo.PropertyType; } } else { PropertyMetadata value2 = default(PropertyMetadata); value2.Info = propertyInfo; value2.Type = propertyInfo.PropertyType; value.Properties.Add(propertyInfo.Name, value2); } } FieldInfo[] fields = type.GetFields(); foreach (FieldInfo fieldInfo in fields) { PropertyMetadata value3 = default(PropertyMetadata); value3.Info = fieldInfo; value3.IsField = true; value3.Type = fieldInfo.FieldType; value.Properties.Add(fieldInfo.Name, value3); } lock (object_metadata_lock) { try { object_metadata.Add(type, value); } catch (ArgumentException) { } } } private static void AddTypeProperties(Type type) { if (type_properties.ContainsKey(type)) { return; } IList list = new List(); PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (!(propertyInfo.Name == "Item")) { PropertyMetadata item = default(PropertyMetadata); item.Info = propertyInfo; item.IsField = false; list.Add(item); } } FieldInfo[] fields = type.GetFields(); foreach (FieldInfo info in fields) { PropertyMetadata item2 = default(PropertyMetadata); item2.Info = info; item2.IsField = true; list.Add(item2); } lock (type_properties_lock) { try { type_properties.Add(type, list); } catch (ArgumentException) { } } } private static MethodInfo GetConvOp(Type t1, Type t2) { lock (conv_ops_lock) { if (!conv_ops.ContainsKey(t1)) { conv_ops.Add(t1, new Dictionary()); } } if (conv_ops[t1].ContainsKey(t2)) { return conv_ops[t1][t2]; } MethodInfo method = t1.GetMethod("op_Implicit", new Type[1] { t2 }); lock (conv_ops_lock) { try { conv_ops[t1].Add(t2, method); return method; } catch (ArgumentException) { return conv_ops[t1][t2]; } } } private static object ReadValue(Type inst_type, JsonReader reader) { reader.Read(); if (reader.Token == JsonToken.ArrayEnd) { return null; } Type underlyingType = Nullable.GetUnderlyingType(inst_type); Type type = underlyingType ?? inst_type; if (reader.Token == JsonToken.Null) { if (inst_type.IsClass || underlyingType != null) { return null; } throw new JsonException($"Can't assign null to an instance of type {inst_type}"); } if (reader.Token == JsonToken.Double || reader.Token == JsonToken.Int || reader.Token == JsonToken.Long || reader.Token == JsonToken.String || reader.Token == JsonToken.Boolean) { Type type2 = reader.Value.GetType(); if (type.IsAssignableFrom(type2)) { return reader.Value; } if (custom_importers_table.ContainsKey(type2) && custom_importers_table[type2].ContainsKey(type)) { ImporterFunc importerFunc = custom_importers_table[type2][type]; return importerFunc(reader.Value); } if (base_importers_table.ContainsKey(type2) && base_importers_table[type2].ContainsKey(type)) { ImporterFunc importerFunc2 = base_importers_table[type2][type]; return importerFunc2(reader.Value); } if (type.IsEnum) { return Enum.ToObject(type, reader.Value); } MethodInfo convOp = GetConvOp(type, type2); if (convOp != null) { return convOp.Invoke(null, new object[1] { reader.Value }); } throw new JsonException($"Can't assign value '{reader.Value}' (type {type2}) to type {inst_type}"); } object obj = null; if (reader.Token == JsonToken.ArrayStart) { AddArrayMetadata(inst_type); ArrayMetadata arrayMetadata = array_metadata[inst_type]; if (!arrayMetadata.IsArray && !arrayMetadata.IsList) { throw new JsonException($"Type {inst_type} can't act as an array"); } IList list; Type elementType; if (!arrayMetadata.IsArray) { list = (IList)Activator.CreateInstance(inst_type); elementType = arrayMetadata.ElementType; } else { list = new ArrayList(); elementType = inst_type.GetElementType(); } while (true) { object obj2 = ReadValue(elementType, reader); if (obj2 == null && reader.Token == JsonToken.ArrayEnd) { break; } list.Add(obj2); } if (arrayMetadata.IsArray) { int count = list.Count; obj = Array.CreateInstance(elementType, count); for (int i = 0; i < count; i++) { ((Array)obj).SetValue(list[i], i); } } else { obj = list; } } else if (reader.Token == JsonToken.ObjectStart) { AddObjectMetadata(type); ObjectMetadata objectMetadata = object_metadata[type]; obj = Activator.CreateInstance(type); while (true) { reader.Read(); if (reader.Token == JsonToken.ObjectEnd) { break; } string text = (string)reader.Value; if (objectMetadata.Properties.ContainsKey(text)) { PropertyMetadata propertyMetadata = objectMetadata.Properties[text]; if (propertyMetadata.IsField) { ((FieldInfo)propertyMetadata.Info).SetValue(obj, ReadValue(propertyMetadata.Type, reader)); continue; } PropertyInfo propertyInfo = (PropertyInfo)propertyMetadata.Info; if (propertyInfo.CanWrite) { propertyInfo.SetValue(obj, ReadValue(propertyMetadata.Type, reader), null); } else { ReadValue(propertyMetadata.Type, reader); } } else if (!objectMetadata.IsDictionary) { if (!reader.SkipNonMembers) { throw new JsonException($"The type {inst_type} doesn't have the property '{text}'"); } ReadSkip(reader); } else { ((IDictionary)obj).Add(text, ReadValue(objectMetadata.ElementType, reader)); } } } return obj; } private static IJsonWrapper ReadValue(WrapperFactory factory, JsonReader reader) { reader.Read(); if (reader.Token == JsonToken.ArrayEnd || reader.Token == JsonToken.Null) { return null; } IJsonWrapper jsonWrapper = factory(); if (reader.Token == JsonToken.String) { jsonWrapper.SetString((string)reader.Value); return jsonWrapper; } if (reader.Token == JsonToken.Double) { jsonWrapper.SetDouble((double)reader.Value); return jsonWrapper; } if (reader.Token == JsonToken.Int) { jsonWrapper.SetInt((int)reader.Value); return jsonWrapper; } if (reader.Token == JsonToken.Long) { jsonWrapper.SetLong((long)reader.Value); return jsonWrapper; } if (reader.Token == JsonToken.Boolean) { jsonWrapper.SetBoolean((bool)reader.Value); return jsonWrapper; } if (reader.Token == JsonToken.ArrayStart) { jsonWrapper.SetJsonType(JsonType.Array); while (true) { IJsonWrapper jsonWrapper2 = ReadValue(factory, reader); if (jsonWrapper2 == null && reader.Token == JsonToken.ArrayEnd) { break; } jsonWrapper.Add(jsonWrapper2); } } else if (reader.Token == JsonToken.ObjectStart) { jsonWrapper.SetJsonType(JsonType.Object); while (true) { reader.Read(); if (reader.Token == JsonToken.ObjectEnd) { break; } string key = (string)reader.Value; jsonWrapper[key] = ReadValue(factory, reader); } } return jsonWrapper; } private static void ReadSkip(JsonReader reader) { ToWrapper(() => new JsonMockWrapper(), reader); } private static void RegisterBaseExporters() { base_exporters_table[typeof(byte)] = delegate(object obj, JsonWriter writer) { writer.Write(Convert.ToInt32((byte)obj)); }; base_exporters_table[typeof(char)] = delegate(object obj, JsonWriter writer) { writer.Write(Convert.ToString((char)obj)); }; base_exporters_table[typeof(DateTime)] = delegate(object obj, JsonWriter writer) { writer.Write(Convert.ToString((DateTime)obj, datetime_format)); }; base_exporters_table[typeof(decimal)] = delegate(object obj, JsonWriter writer) { writer.Write((decimal)obj); }; base_exporters_table[typeof(sbyte)] = delegate(object obj, JsonWriter writer) { writer.Write(Convert.ToInt32((sbyte)obj)); }; base_exporters_table[typeof(short)] = delegate(object obj, JsonWriter writer) { writer.Write(Convert.ToInt32((short)obj)); }; base_exporters_table[typeof(ushort)] = delegate(object obj, JsonWriter writer) { writer.Write(Convert.ToInt32((ushort)obj)); }; base_exporters_table[typeof(uint)] = delegate(object obj, JsonWriter writer) { writer.Write(Convert.ToUInt64((uint)obj)); }; base_exporters_table[typeof(ulong)] = delegate(object obj, JsonWriter writer) { writer.Write((ulong)obj); }; } private static void RegisterBaseImporters() { ImporterFunc importer = (object input) => Convert.ToByte((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(byte), importer); importer = (object input) => Convert.ToUInt64((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(ulong), importer); importer = (object input) => Convert.ToSByte((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(sbyte), importer); importer = (object input) => Convert.ToInt16((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(short), importer); importer = (object input) => Convert.ToUInt16((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(ushort), importer); importer = (object input) => Convert.ToUInt32((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(uint), importer); importer = (object input) => Convert.ToSingle((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(float), importer); importer = (object input) => Convert.ToDouble((int)input); RegisterImporter(base_importers_table, typeof(int), typeof(double), importer); importer = (object input) => Convert.ToDecimal((double)input); RegisterImporter(base_importers_table, typeof(double), typeof(decimal), importer); importer = (object input) => Convert.ToUInt32((long)input); RegisterImporter(base_importers_table, typeof(long), typeof(uint), importer); importer = (object input) => Convert.ToChar((string)input); RegisterImporter(base_importers_table, typeof(string), typeof(char), importer); importer = (object input) => Convert.ToDateTime((string)input, datetime_format); RegisterImporter(base_importers_table, typeof(string), typeof(DateTime), importer); } private static void RegisterImporter(IDictionary> table, Type json_type, Type value_type, ImporterFunc importer) { if (!table.ContainsKey(json_type)) { table.Add(json_type, new Dictionary()); } table[json_type][value_type] = importer; } private static void WriteValue(object obj, JsonWriter writer, bool writer_is_private, int depth) { if (depth > max_nesting_depth) { throw new JsonException($"Max allowed object depth reached while trying to export from type {obj.GetType()}"); } if (obj == null) { writer.Write(null); return; } if (obj is IJsonWrapper) { if (writer_is_private) { writer.TextWriter.Write(((IJsonWrapper)obj).ToJson()); } else { ((IJsonWrapper)obj).ToJson(writer); } return; } if (obj is string) { writer.Write((string)obj); return; } if (obj is double) { writer.Write((double)obj); return; } if (obj is int) { writer.Write((int)obj); return; } if (obj is bool) { writer.Write((bool)obj); return; } if (obj is long) { writer.Write((long)obj); return; } if (obj is Array) { writer.WriteArrayStart(); foreach (object item in (Array)obj) { WriteValue(item, writer, writer_is_private, depth + 1); } writer.WriteArrayEnd(); return; } if (obj is IList) { writer.WriteArrayStart(); foreach (object item2 in (IList)obj) { WriteValue(item2, writer, writer_is_private, depth + 1); } writer.WriteArrayEnd(); return; } if (obj is IDictionary) { writer.WriteObjectStart(); foreach (DictionaryEntry item3 in (IDictionary)obj) { writer.WritePropertyName((string)item3.Key); WriteValue(item3.Value, writer, writer_is_private, depth + 1); } writer.WriteObjectEnd(); return; } Type type = obj.GetType(); if (custom_exporters_table.ContainsKey(type)) { ExporterFunc exporterFunc = custom_exporters_table[type]; exporterFunc(obj, writer); return; } if (base_exporters_table.ContainsKey(type)) { ExporterFunc exporterFunc2 = base_exporters_table[type]; exporterFunc2(obj, writer); return; } if (obj is Enum) { Type underlyingType = Enum.GetUnderlyingType(type); if (underlyingType == typeof(long) || underlyingType == typeof(uint) || underlyingType == typeof(ulong)) { writer.Write((ulong)obj); } else { writer.Write((int)obj); } return; } AddTypeProperties(type); IList list = type_properties[type]; writer.WriteObjectStart(); foreach (PropertyMetadata item4 in list) { if (item4.IsField) { writer.WritePropertyName(item4.Info.Name); WriteValue(((FieldInfo)item4.Info).GetValue(obj), writer, writer_is_private, depth + 1); continue; } PropertyInfo propertyInfo = (PropertyInfo)item4.Info; if (propertyInfo.CanRead) { writer.WritePropertyName(item4.Info.Name); WriteValue(propertyInfo.GetValue(obj, null), writer, writer_is_private, depth + 1); } } writer.WriteObjectEnd(); } public static string ToJson(object obj) { lock (static_writer_lock) { static_writer.Reset(); WriteValue(obj, static_writer, writer_is_private: true, 0); return static_writer.ToString(); } } public static void ToJson(object obj, JsonWriter writer) { WriteValue(obj, writer, writer_is_private: false, 0); } public static JsonData ToObject(JsonReader reader) { return (JsonData)ToWrapper(() => new JsonData(), reader); } public static JsonData ToObject(TextReader reader) { JsonReader reader2 = new JsonReader(reader); return (JsonData)ToWrapper(() => new JsonData(), reader2); } public static JsonData ToObject(string json) { return (JsonData)ToWrapper(() => new JsonData(), json); } public static T ToObject(JsonReader reader) { return (T)ReadValue(typeof(T), reader); } public static T ToObject(TextReader reader) { JsonReader reader2 = new JsonReader(reader); return (T)ReadValue(typeof(T), reader2); } public static T ToObject(string json) { JsonReader reader = new JsonReader(json); return (T)ReadValue(typeof(T), reader); } public static IJsonWrapper ToWrapper(WrapperFactory factory, JsonReader reader) { return ReadValue(factory, reader); } public static IJsonWrapper ToWrapper(WrapperFactory factory, string json) { JsonReader reader = new JsonReader(json); return ReadValue(factory, reader); } public static void RegisterExporter(ExporterFunc exporter) { ExporterFunc value = delegate(object obj, JsonWriter writer) { exporter((T)obj, writer); }; custom_exporters_table[typeof(T)] = value; } public static void RegisterImporter(ImporterFunc importer) { ImporterFunc importer2 = (object input) => importer((TJson)input); RegisterImporter(custom_importers_table, typeof(TJson), typeof(TValue), importer2); } public static void UnregisterExporters() { custom_exporters_table.Clear(); } public static void UnregisterImporters() { custom_importers_table.Clear(); } } internal class JsonMockWrapper : IJsonWrapper, IList, IOrderedDictionary, IDictionary, ICollection, IEnumerable { public bool IsArray => false; public bool IsBoolean => false; public bool IsDouble => false; public bool IsInt => false; public bool IsLong => false; public bool IsObject => false; public bool IsString => false; bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; object IList.this[int index] { get { return null; } set { } } int ICollection.Count => 0; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => null; bool IDictionary.IsFixedSize => true; bool IDictionary.IsReadOnly => true; ICollection IDictionary.Keys => null; ICollection IDictionary.Values => null; object IDictionary.this[object key] { get { return null; } set { } } object IOrderedDictionary.this[int idx] { get { return null; } set { } } public bool GetBoolean() { return false; } public double GetDouble() { return 0.0; } public int GetInt() { return 0; } public JsonType GetJsonType() { return JsonType.None; } public long GetLong() { return 0L; } public string GetString() { return ""; } public void SetBoolean(bool val) { } public void SetDouble(double val) { } public void SetInt(int val) { } public void SetJsonType(JsonType type) { } public void SetLong(long val) { } public void SetString(string val) { } public string ToJson() { return ""; } public void ToJson(JsonWriter writer) { } int IList.Add(object value) { return 0; } void IList.Clear() { } bool IList.Contains(object value) { return false; } int IList.IndexOf(object value) { return -1; } void IList.Insert(int i, object v) { } void IList.Remove(object value) { } void IList.RemoveAt(int index) { } void ICollection.CopyTo(Array array, int index) { } IEnumerator IEnumerable.GetEnumerator() { return null; } void IDictionary.Add(object k, object v) { } void IDictionary.Clear() { } bool IDictionary.Contains(object key) { return false; } void IDictionary.Remove(object key) { } IDictionaryEnumerator IDictionary.GetEnumerator() { return null; } IDictionaryEnumerator IOrderedDictionary.GetEnumerator() { return null; } void IOrderedDictionary.Insert(int i, object k, object v) { } void IOrderedDictionary.RemoveAt(int i) { } } internal enum JsonToken { None, ObjectStart, PropertyName, ObjectEnd, ArrayStart, ArrayEnd, Int, Long, Double, String, Boolean, Null } internal class JsonReader { private static IDictionary> parse_table; private Stack automaton_stack; private int current_input; private int current_symbol; private bool end_of_json; private bool end_of_input; private Lexer lexer; private bool parser_in_string; private bool parser_return; private bool read_started; private TextReader reader; private bool reader_is_owned; private bool skip_non_members; private object token_value; private JsonToken token; public bool AllowComments { get { return lexer.AllowComments; } set { lexer.AllowComments = value; } } public bool AllowSingleQuotedStrings { get { return lexer.AllowSingleQuotedStrings; } set { lexer.AllowSingleQuotedStrings = value; } } public bool SkipNonMembers { get { return skip_non_members; } set { skip_non_members = value; } } public bool EndOfInput => end_of_input; public bool EndOfJson => end_of_json; public JsonToken Token => token; public object Value => token_value; static JsonReader() { PopulateParseTable(); } public JsonReader(string json_text) : this(new StringReader(json_text), owned: true) { } public JsonReader(TextReader reader) : this(reader, owned: false) { } private JsonReader(TextReader reader, bool owned) { if (reader == null) { throw new ArgumentNullException("reader"); } parser_in_string = false; parser_return = false; read_started = false; automaton_stack = new Stack(); automaton_stack.Push(65553); automaton_stack.Push(65543); lexer = new Lexer(reader); end_of_input = false; end_of_json = false; skip_non_members = true; this.reader = reader; reader_is_owned = owned; } private static void PopulateParseTable() { parse_table = new Dictionary>(); TableAddRow(ParserToken.Array); TableAddCol(ParserToken.Array, 91, 91, 65549); TableAddRow(ParserToken.ArrayPrime); TableAddCol(ParserToken.ArrayPrime, 34, 65550, 65551, 93); TableAddCol(ParserToken.ArrayPrime, 91, 65550, 65551, 93); TableAddCol(ParserToken.ArrayPrime, 93, 93); TableAddCol(ParserToken.ArrayPrime, 123, 65550, 65551, 93); TableAddCol(ParserToken.ArrayPrime, 65537, 65550, 65551, 93); TableAddCol(ParserToken.ArrayPrime, 65538, 65550, 65551, 93); TableAddCol(ParserToken.ArrayPrime, 65539, 65550, 65551, 93); TableAddCol(ParserToken.ArrayPrime, 65540, 65550, 65551, 93); TableAddRow(ParserToken.Object); TableAddCol(ParserToken.Object, 123, 123, 65545); TableAddRow(ParserToken.ObjectPrime); TableAddCol(ParserToken.ObjectPrime, 34, 65546, 65547, 125); TableAddCol(ParserToken.ObjectPrime, 125, 125); TableAddRow(ParserToken.Pair); TableAddCol(ParserToken.Pair, 34, 65552, 58, 65550); TableAddRow(ParserToken.PairRest); TableAddCol(ParserToken.PairRest, 44, 44, 65546, 65547); TableAddCol(ParserToken.PairRest, 125, 65554); TableAddRow(ParserToken.String); TableAddCol(ParserToken.String, 34, 34, 65541, 34); TableAddRow(ParserToken.Text); TableAddCol(ParserToken.Text, 91, 65548); TableAddCol(ParserToken.Text, 123, 65544); TableAddRow(ParserToken.Value); TableAddCol(ParserToken.Value, 34, 65552); TableAddCol(ParserToken.Value, 91, 65548); TableAddCol(ParserToken.Value, 123, 65544); TableAddCol(ParserToken.Value, 65537, 65537); TableAddCol(ParserToken.Value, 65538, 65538); TableAddCol(ParserToken.Value, 65539, 65539); TableAddCol(ParserToken.Value, 65540, 65540); TableAddRow(ParserToken.ValueRest); TableAddCol(ParserToken.ValueRest, 44, 44, 65550, 65551); TableAddCol(ParserToken.ValueRest, 93, 65554); } private static void TableAddCol(ParserToken row, int col, params int[] symbols) { parse_table[(int)row].Add(col, symbols); } private static void TableAddRow(ParserToken rule) { parse_table.Add((int)rule, new Dictionary()); } private void ProcessNumber(string number) { int result2; long result3; ulong result4; if ((number.IndexOf('.') != -1 || number.IndexOf('e') != -1 || number.IndexOf('E') != -1) && double.TryParse(number, out var result)) { token = JsonToken.Double; token_value = result; } else if (int.TryParse(number, out result2)) { token = JsonToken.Int; token_value = result2; } else if (long.TryParse(number, out result3)) { token = JsonToken.Long; token_value = result3; } else if (ulong.TryParse(number, out result4)) { token = JsonToken.Long; token_value = result4; } else { token = JsonToken.Int; token_value = 0; } } private void ProcessSymbol() { if (current_symbol == 91) { token = JsonToken.ArrayStart; parser_return = true; } else if (current_symbol == 93) { token = JsonToken.ArrayEnd; parser_return = true; } else if (current_symbol == 123) { token = JsonToken.ObjectStart; parser_return = true; } else if (current_symbol == 125) { token = JsonToken.ObjectEnd; parser_return = true; } else if (current_symbol == 34) { if (parser_in_string) { parser_in_string = false; parser_return = true; return; } if (token == JsonToken.None) { token = JsonToken.String; } parser_in_string = true; } else if (current_symbol == 65541) { token_value = lexer.StringValue; } else if (current_symbol == 65539) { token = JsonToken.Boolean; token_value = false; parser_return = true; } else if (current_symbol == 65540) { token = JsonToken.Null; parser_return = true; } else if (current_symbol == 65537) { ProcessNumber(lexer.StringValue); parser_return = true; } else if (current_symbol == 65546) { token = JsonToken.PropertyName; } else if (current_symbol == 65538) { token = JsonToken.Boolean; token_value = true; parser_return = true; } } private bool ReadToken() { if (end_of_input) { return false; } lexer.NextToken(); if (lexer.EndOfInput) { Close(); return false; } current_input = lexer.Token; return true; } public void Close() { if (!end_of_input) { end_of_input = true; end_of_json = true; if (reader_is_owned) { reader.Close(); } reader = null; } } public bool Read() { if (end_of_input) { return false; } if (end_of_json) { end_of_json = false; automaton_stack.Clear(); automaton_stack.Push(65553); automaton_stack.Push(65543); } parser_in_string = false; parser_return = false; token = JsonToken.None; token_value = null; if (!read_started) { read_started = true; if (!ReadToken()) { return false; } } while (true) { if (parser_return) { if (automaton_stack.Peek() == 65553) { end_of_json = true; } return true; } current_symbol = automaton_stack.Pop(); ProcessSymbol(); if (current_symbol == current_input) { if (!ReadToken()) { break; } continue; } int[] array; try { array = parse_table[current_symbol][current_input]; } catch (KeyNotFoundException inner_exception) { throw new JsonException((ParserToken)current_input, inner_exception); } if (array[0] != 65554) { for (int num = array.Length - 1; num >= 0; num--) { automaton_stack.Push(array[num]); } } } if (automaton_stack.Peek() != 65553) { throw new JsonException("Input doesn't evaluate to proper JSON text"); } if (parser_return) { return true; } return false; } } internal enum Condition { InArray, InObject, NotAProperty, Property, Value } internal class WriterContext { public int Count; public bool InArray; public bool InObject; public bool ExpectingValue; public int Padding; } internal class JsonWriter { private static NumberFormatInfo number_format; private WriterContext context; private Stack ctx_stack; private bool has_reached_end; private char[] hex_seq; private int indentation; private int indent_value; private StringBuilder inst_string_builder; private bool pretty_print; private bool validate; private TextWriter writer; public int IndentValue { get { return indent_value; } set { indentation = indentation / indent_value * value; indent_value = value; } } public bool PrettyPrint { get { return pretty_print; } set { pretty_print = value; } } public TextWriter TextWriter => writer; public bool Validate { get { return validate; } set { validate = value; } } static JsonWriter() { number_format = NumberFormatInfo.InvariantInfo; } public JsonWriter() { inst_string_builder = new StringBuilder(); writer = new StringWriter(inst_string_builder); Init(); } public JsonWriter(StringBuilder sb) : this(new StringWriter(sb)) { } public JsonWriter(TextWriter writer) { if (writer == null) { throw new ArgumentNullException("writer"); } this.writer = writer; Init(); } private void DoValidation(Condition cond) { if (!context.ExpectingValue) { context.Count++; } if (!validate) { return; } if (has_reached_end) { throw new JsonException("A complete JSON symbol has already been written"); } switch (cond) { case Condition.InArray: if (!context.InArray) { throw new JsonException("Can't close an array here"); } break; case Condition.InObject: if (!context.InObject || context.ExpectingValue) { throw new JsonException("Can't close an object here"); } break; case Condition.NotAProperty: if (context.InObject && !context.ExpectingValue) { throw new JsonException("Expected a property"); } break; case Condition.Property: if (!context.InObject || context.ExpectingValue) { throw new JsonException("Can't add a property here"); } break; case Condition.Value: if (!context.InArray && (!context.InObject || !context.ExpectingValue)) { throw new JsonException("Can't add a value here"); } break; } } private void Init() { has_reached_end = false; hex_seq = new char[4]; indentation = 0; indent_value = 4; pretty_print = false; validate = true; ctx_stack = new Stack(); context = new WriterContext(); ctx_stack.Push(context); } private static void IntToHex(int n, char[] hex) { for (int i = 0; i < 4; i++) { int num = n % 16; if (num < 10) { hex[3 - i] = (char)(48 + num); } else { hex[3 - i] = (char)(65 + (num - 10)); } n >>= 4; } } private void Indent() { if (pretty_print) { indentation += indent_value; } } private void Put(string str) { if (pretty_print && !context.ExpectingValue) { for (int i = 0; i < indentation; i++) { writer.Write(' '); } } writer.Write(str); } private void PutNewline() { PutNewline(add_comma: true); } private void PutNewline(bool add_comma) { if (add_comma && !context.ExpectingValue && context.Count > 1) { writer.Write(','); } if (pretty_print && !context.ExpectingValue) { writer.Write('\n'); } } private void PutString(string str) { Put(string.Empty); writer.Write('"'); int length = str.Length; for (int i = 0; i < length; i++) { switch (str[i]) { case '\n': writer.Write("\\n"); continue; case '\r': writer.Write("\\r"); continue; case '\t': writer.Write("\\t"); continue; case '"': case '\\': writer.Write('\\'); writer.Write(str[i]); continue; case '\f': writer.Write("\\f"); continue; case '\b': writer.Write("\\b"); continue; } if (str[i] >= ' ' && str[i] <= '~') { writer.Write(str[i]); continue; } IntToHex(str[i], hex_seq); writer.Write("\\u"); writer.Write(hex_seq); } writer.Write('"'); } private void Unindent() { if (pretty_print) { indentation -= indent_value; } } public override string ToString() { if (inst_string_builder == null) { return string.Empty; } return inst_string_builder.ToString(); } public void Reset() { has_reached_end = false; ctx_stack.Clear(); context = new WriterContext(); ctx_stack.Push(context); if (inst_string_builder != null) { inst_string_builder.Remove(0, inst_string_builder.Length); } } public void Write(bool boolean) { DoValidation(Condition.Value); PutNewline(); Put(boolean ? "true" : "false"); context.ExpectingValue = false; } public void Write(decimal number) { DoValidation(Condition.Value); PutNewline(); Put(Convert.ToString(number, number_format)); context.ExpectingValue = false; } public void Write(double number) { DoValidation(Condition.Value); PutNewline(); string text = Convert.ToString(number, number_format); Put(text); if (text.IndexOf('.') == -1 && text.IndexOf('E') == -1) { writer.Write(".0"); } context.ExpectingValue = false; } public void Write(int number) { DoValidation(Condition.Value); PutNewline(); Put(Convert.ToString(number, number_format)); context.ExpectingValue = false; } public void Write(long number) { DoValidation(Condition.Value); PutNewline(); Put(Convert.ToString(number, number_format)); context.ExpectingValue = false; } public void Write(string str) { DoValidation(Condition.Value); PutNewline(); if (str == null) { Put("null"); } else { PutString(str); } context.ExpectingValue = false; } [CLSCompliant(false)] public void Write(ulong number) { DoValidation(Condition.Value); PutNewline(); Put(Convert.ToString(number, number_format)); context.ExpectingValue = false; } public void WriteArrayEnd() { DoValidation(Condition.InArray); PutNewline(add_comma: false); ctx_stack.Pop(); if (ctx_stack.Count == 1) { has_reached_end = true; } else { context = ctx_stack.Peek(); context.ExpectingValue = false; } Unindent(); Put("]"); } public void WriteArrayStart() { DoValidation(Condition.NotAProperty); PutNewline(); Put("["); context = new WriterContext(); context.InArray = true; ctx_stack.Push(context); Indent(); } public void WriteObjectEnd() { DoValidation(Condition.InObject); PutNewline(add_comma: false); ctx_stack.Pop(); if (ctx_stack.Count == 1) { has_reached_end = true; } else { context = ctx_stack.Peek(); context.ExpectingValue = false; } Unindent(); Put("}"); } public void WriteObjectStart() { DoValidation(Condition.NotAProperty); PutNewline(); Put("{"); context = new WriterContext(); context.InObject = true; ctx_stack.Push(context); Indent(); } public void WritePropertyName(string property_name) { DoValidation(Condition.Property); PutNewline(); PutString(property_name); if (pretty_print) { if (property_name.Length > context.Padding) { context.Padding = property_name.Length; } for (int num = context.Padding - property_name.Length; num >= 0; num--) { writer.Write(' '); } writer.Write(": "); } else { writer.Write(':'); } context.ExpectingValue = true; } } internal class FsmContext { public bool Return; public int NextState; public Lexer L; public int StateStack; } internal class Lexer { private delegate bool StateHandler(FsmContext ctx); private static int[] fsm_return_table; private static StateHandler[] fsm_handler_table; private bool allow_comments; private bool allow_single_quoted_strings; private bool end_of_input; private FsmContext fsm_context; private int input_buffer; private int input_char; private TextReader reader; private int state; private StringBuilder string_buffer; private string string_value; private int token; private int unichar; public bool AllowComments { get { return allow_comments; } set { allow_comments = value; } } public bool AllowSingleQuotedStrings { get { return allow_single_quoted_strings; } set { allow_single_quoted_strings = value; } } public bool EndOfInput => end_of_input; public int Token => token; public string StringValue => string_value; static Lexer() { PopulateFsmTables(); } public Lexer(TextReader reader) { allow_comments = true; allow_single_quoted_strings = true; input_buffer = 0; string_buffer = new StringBuilder(128); state = 1; end_of_input = false; this.reader = reader; fsm_context = new FsmContext(); fsm_context.L = this; } private static int HexValue(int digit) { switch (digit) { case 65: case 97: return 10; case 66: case 98: return 11; case 67: case 99: return 12; case 68: case 100: return 13; case 69: case 101: return 14; case 70: case 102: return 15; default: return digit - 48; } } private static void PopulateFsmTables() { fsm_handler_table = new StateHandler[28] { State1, State2, State3, State4, State5, State6, State7, State8, State9, State10, State11, State12, State13, State14, State15, State16, State17, State18, State19, State20, State21, State22, State23, State24, State25, State26, State27, State28 }; fsm_return_table = new int[28] { 65542, 0, 65537, 65537, 0, 65537, 0, 65537, 0, 0, 65538, 0, 0, 0, 65539, 0, 0, 65540, 65541, 65542, 0, 0, 65541, 65542, 0, 0, 0, 0 }; } private static char ProcessEscChar(int esc_char) { switch (esc_char) { case 34: case 39: case 47: case 92: return Convert.ToChar(esc_char); case 110: return '\n'; case 116: return '\t'; case 114: return '\r'; case 98: return '\b'; case 102: return '\f'; default: return '?'; } } private static bool State1(FsmContext ctx) { while (ctx.L.GetChar()) { if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) { continue; } if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57) { ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 3; return true; } switch (ctx.L.input_char) { case 34: ctx.NextState = 19; ctx.Return = true; return true; case 44: case 58: case 91: case 93: case 123: case 125: ctx.NextState = 1; ctx.Return = true; return true; case 45: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 2; return true; case 48: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 4; return true; case 102: ctx.NextState = 12; return true; case 110: ctx.NextState = 16; return true; case 116: ctx.NextState = 9; return true; case 39: if (!ctx.L.allow_single_quoted_strings) { return false; } ctx.L.input_char = 34; ctx.NextState = 23; ctx.Return = true; return true; case 47: if (!ctx.L.allow_comments) { return false; } ctx.NextState = 25; return true; default: return false; } } return true; } private static bool State2(FsmContext ctx) { ctx.L.GetChar(); if (ctx.L.input_char >= 49 && ctx.L.input_char <= 57) { ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 3; return true; } int num = ctx.L.input_char; if (num == 48) { ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 4; return true; } return false; } private static bool State3(FsmContext ctx) { while (ctx.L.GetChar()) { if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) { ctx.L.string_buffer.Append((char)ctx.L.input_char); continue; } if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) { ctx.Return = true; ctx.NextState = 1; return true; } switch (ctx.L.input_char) { case 44: case 93: case 125: ctx.L.UngetChar(); ctx.Return = true; ctx.NextState = 1; return true; case 46: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 5; return true; case 69: case 101: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 7; return true; default: return false; } } return true; } private static bool State4(FsmContext ctx) { ctx.L.GetChar(); if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) { ctx.Return = true; ctx.NextState = 1; return true; } switch (ctx.L.input_char) { case 44: case 93: case 125: ctx.L.UngetChar(); ctx.Return = true; ctx.NextState = 1; return true; case 46: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 5; return true; case 69: case 101: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 7; return true; default: return false; } } private static bool State5(FsmContext ctx) { ctx.L.GetChar(); if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) { ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 6; return true; } return false; } private static bool State6(FsmContext ctx) { while (ctx.L.GetChar()) { if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) { ctx.L.string_buffer.Append((char)ctx.L.input_char); continue; } if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) { ctx.Return = true; ctx.NextState = 1; return true; } switch (ctx.L.input_char) { case 44: case 93: case 125: ctx.L.UngetChar(); ctx.Return = true; ctx.NextState = 1; return true; case 69: case 101: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 7; return true; default: return false; } } return true; } private static bool State7(FsmContext ctx) { ctx.L.GetChar(); if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) { ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 8; return true; } switch (ctx.L.input_char) { case 43: case 45: ctx.L.string_buffer.Append((char)ctx.L.input_char); ctx.NextState = 8; return true; default: return false; } } private static bool State8(FsmContext ctx) { while (ctx.L.GetChar()) { if (ctx.L.input_char >= 48 && ctx.L.input_char <= 57) { ctx.L.string_buffer.Append((char)ctx.L.input_char); continue; } if (ctx.L.input_char == 32 || (ctx.L.input_char >= 9 && ctx.L.input_char <= 13)) { ctx.Return = true; ctx.NextState = 1; return true; } int num = ctx.L.input_char; if (num == 44 || num == 93 || num == 125) { ctx.L.UngetChar(); ctx.Return = true; ctx.NextState = 1; return true; } return false; } return true; } private static bool State9(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 114) { ctx.NextState = 10; return true; } return false; } private static bool State10(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 117) { ctx.NextState = 11; return true; } return false; } private static bool State11(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 101) { ctx.Return = true; ctx.NextState = 1; return true; } return false; } private static bool State12(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 97) { ctx.NextState = 13; return true; } return false; } private static bool State13(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 108) { ctx.NextState = 14; return true; } return false; } private static bool State14(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 115) { ctx.NextState = 15; return true; } return false; } private static bool State15(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 101) { ctx.Return = true; ctx.NextState = 1; return true; } return false; } private static bool State16(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 117) { ctx.NextState = 17; return true; } return false; } private static bool State17(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 108) { ctx.NextState = 18; return true; } return false; } private static bool State18(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 108) { ctx.Return = true; ctx.NextState = 1; return true; } return false; } private static bool State19(FsmContext ctx) { while (ctx.L.GetChar()) { switch (ctx.L.input_char) { case 34: ctx.L.UngetChar(); ctx.Return = true; ctx.NextState = 20; return true; case 92: ctx.StateStack = 19; ctx.NextState = 21; return true; } ctx.L.string_buffer.Append((char)ctx.L.input_char); } return true; } private static bool State20(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 34) { ctx.Return = true; ctx.NextState = 1; return true; } return false; } private static bool State21(FsmContext ctx) { ctx.L.GetChar(); switch (ctx.L.input_char) { case 117: ctx.NextState = 22; return true; case 34: case 39: case 47: case 92: case 98: case 102: case 110: case 114: case 116: ctx.L.string_buffer.Append(ProcessEscChar(ctx.L.input_char)); ctx.NextState = ctx.StateStack; return true; default: return false; } } private static bool State22(FsmContext ctx) { int num = 0; int num2 = 4096; ctx.L.unichar = 0; while (ctx.L.GetChar()) { if ((ctx.L.input_char >= 48 && ctx.L.input_char <= 57) || (ctx.L.input_char >= 65 && ctx.L.input_char <= 70) || (ctx.L.input_char >= 97 && ctx.L.input_char <= 102)) { ctx.L.unichar += HexValue(ctx.L.input_char) * num2; num++; num2 /= 16; if (num == 4) { ctx.L.string_buffer.Append(Convert.ToChar(ctx.L.unichar)); ctx.NextState = ctx.StateStack; return true; } continue; } return false; } return true; } private static bool State23(FsmContext ctx) { while (ctx.L.GetChar()) { switch (ctx.L.input_char) { case 39: ctx.L.UngetChar(); ctx.Return = true; ctx.NextState = 24; return true; case 92: ctx.StateStack = 23; ctx.NextState = 21; return true; } ctx.L.string_buffer.Append((char)ctx.L.input_char); } return true; } private static bool State24(FsmContext ctx) { ctx.L.GetChar(); int num = ctx.L.input_char; if (num == 39) { ctx.L.input_char = 34; ctx.Return = true; ctx.NextState = 1; return true; } return false; } private static bool State25(FsmContext ctx) { ctx.L.GetChar(); switch (ctx.L.input_char) { case 42: ctx.NextState = 27; return true; case 47: ctx.NextState = 26; return true; default: return false; } } private static bool State26(FsmContext ctx) { while (ctx.L.GetChar()) { if (ctx.L.input_char == 10) { ctx.NextState = 1; return true; } } return true; } private static bool State27(FsmContext ctx) { while (ctx.L.GetChar()) { if (ctx.L.input_char == 42) { ctx.NextState = 28; return true; } } return true; } private static bool State28(FsmContext ctx) { while (ctx.L.GetChar()) { if (ctx.L.input_char != 42) { if (ctx.L.input_char == 47) { ctx.NextState = 1; return true; } ctx.NextState = 27; return true; } } return true; } private bool GetChar() { if ((input_char = NextChar()) != -1) { return true; } end_of_input = true; return false; } private int NextChar() { if (input_buffer != 0) { int result = input_buffer; input_buffer = 0; return result; } return reader.Read(); } public bool NextToken() { fsm_context.Return = false; while (true) { StateHandler stateHandler = fsm_handler_table[state - 1]; if (!stateHandler(fsm_context)) { throw new JsonException(input_char); } if (end_of_input) { return false; } if (fsm_context.Return) { break; } state = fsm_context.NextState; } string_value = string_buffer.ToString(); string_buffer.Remove(0, string_buffer.Length); token = fsm_return_table[state - 1]; if (token == 65542) { token = input_char; } state = fsm_context.NextState; return true; } private void UngetChar() { input_buffer = input_char; } } internal enum ParserToken { None = 65536, Number, True, False, Null, CharSeq, Char, Text, Object, ObjectPrime, Pair, PairRest, Array, ArrayPrime, Value, ValueRest, String, End, Epsilon } }