Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NoobBallista v1.3.9
GsiX.NoobBallista.dll
Decompiled 2 years ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using NoobBallista; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("JotunnModStub")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("JotunnModStub")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] public class NoobText : MonoBehaviour { public enum Faction { Players, AnimalsVeg, ForestMonsters, Undead, Demon, MountainMonsters, SeaMonsters, PlainsMonsters, Boss, MistlandsMonsters, Dverger, PlayerSpawned, Skill } public class WorldTextInstance { public Vector3 m_worldPos; public GameObject m_gui; public float m_timer; public TMP_Text m_textField; } public static NoobText m_instance; public float m_textDuration = 1.5f; public float m_maxTextDistance = 30f; public int m_largeFontSize = 18; public int m_smallFontSize = 12; public float m_smallFontDistance = 10f; private float m_alpha = 0.5f; public GameObject m_worldTextBase; public DamageText m_body; public List<WorldTextInstance> m_worldTexts = new List<WorldTextInstance>(); public static NoobText instance => m_instance; public void Awake() { m_instance = this; ZRoutedRpc.instance.Register<ZPackage>("RPC_NoobText", (Action<long, ZPackage>)RPC_NoobText); } public void LateUpdate() { UpdateWorldTexts(Time.deltaTime); } public void UpdateWorldTexts(float dt) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) WorldTextInstance worldTextInstance = null; Camera mainCamera = Utils.GetMainCamera(); foreach (WorldTextInstance worldText in m_worldTexts) { worldText.m_timer += dt; if (worldText.m_timer > m_textDuration && worldTextInstance == null) { worldTextInstance = worldText; } worldText.m_worldPos.y += dt; float num = Mathf.Clamp01(worldText.m_timer / m_textDuration); Color color = ((Graphic)worldText.m_textField).color; color.a = 1f - Mathf.Pow(num, 3f); ((Graphic)worldText.m_textField).color = color; Vector3 val = Utils.WorldToScreenPointScaled(mainCamera, worldText.m_worldPos); if (val.x < 0f || val.x > (float)Screen.width || val.y < 0f || val.y > (float)Screen.height || val.z < 0f) { worldText.m_gui.SetActive(false); continue; } worldText.m_gui.SetActive(true); worldText.m_gui.transform.position = val; } if (worldTextInstance != null) { Object.Destroy((Object)(object)worldTextInstance.m_gui); m_worldTexts.Remove(worldTextInstance); } } public void AddInworldText(Faction type, Vector3 pos, float distance, string text) { //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_0097: Unknown result type (might be due to invalid IL or missing references) if (m_worldTexts.Count <= 200) { WorldTextInstance worldTextInstance = new WorldTextInstance(); worldTextInstance.m_worldPos = pos + Random.insideUnitSphere * 0.5f; worldTextInstance.m_gui = Object.Instantiate<GameObject>(m_worldTextBase, ((Component)this).transform); worldTextInstance.m_textField = worldTextInstance.m_gui.GetComponent<TMP_Text>(); worldTextInstance.m_timer = 0f; m_worldTexts.Add(worldTextInstance); Color color = Color.white; GetFactionColor(type, ref color); worldTextInstance.m_textField.text = text; ((Graphic)worldTextInstance.m_textField).color = color; if (distance > m_smallFontDistance) { worldTextInstance.m_textField.fontSize = m_smallFontSize; } else { worldTextInstance.m_textField.fontSize = m_largeFontSize; } } } private void GetFactionColor(Faction texttype, ref Color color) { //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_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) color = Color.white; switch (texttype) { case Faction.Players: color = new Color(0f, 1f, 0f, m_alpha); break; case Faction.AnimalsVeg: color = new Color(0.411f, 1f, 0.628f, m_alpha); break; case Faction.ForestMonsters: color = new Color(0f, 1f, 1f, m_alpha); break; case Faction.Undead: color = new Color(0.901f, 0f, 0.901f, m_alpha); break; case Faction.Demon: color = new Color(1f, 0.62f, 0.313f, m_alpha); break; case Faction.MountainMonsters: color = new Color(0.294f, 0.784f, 0.784f, m_alpha); break; case Faction.SeaMonsters: color = new Color(0.313f, 0.549f, 1f, m_alpha); break; case Faction.PlainsMonsters: color = new Color(0f, 0f, 1f, m_alpha); break; case Faction.Boss: color = new Color(1f, 0f, 0f, m_alpha); break; case Faction.MistlandsMonsters: color = new Color(1f, 0.313f, 0.921f, m_alpha); break; case Faction.Dverger: color = new Color(0.588f, 0f, 0.882f, m_alpha); break; case Faction.Skill: color = Color.yellow; break; default: color = Color.white; break; } } public void ShowText(Faction type, Vector3 pos, string num) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_000e: Unknown result type (might be due to invalid IL or missing references) ZPackage val = new ZPackage(); val.Write((int)type); val.Write(pos); val.Write(num); ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "RPC_NoobText", new object[1] { val }); } public void RPC_NoobText(long sender, ZPackage pkg) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_0049: Unknown result type (might be due to invalid IL or missing references) Camera mainCamera = Utils.GetMainCamera(); if (Object.op_Implicit((Object)(object)mainCamera) && !Hud.IsUserHidden()) { Faction type = (Faction)pkg.ReadInt(); Vector3 val = pkg.ReadVector3(); string text = pkg.ReadString(); float num = Vector3.Distance(((Component)mainCamera).transform.position, val); if (num < m_maxTextDistance) { AddInworldText(type, val, num, text); } } } } public class NoobAmmo : MonoBehaviour { public GameObject target; public ZDOID m_towerID; public Turret m_tower; public NoobTurret m_noob; public Projectile m_body; public ZNetView m_nview; public float m_ttl = 6f; private Character targetNew; private int tryCount; private bool hasHeight; public Vector3 pointA; public Vector3 pointB; public Vector3 posBuff; public Vector3 posAmmo; private Vector3 vecFwd; private Vector3 vecRay = Vector3.zero; private Vector3 enemyPos = Vector3.zero; private bool raycastHit; private float coverage; private float distance; private float deltaTime; private float e1; private Vector3 center; private Vector3 m1; private Vector3 m2; private Vector3 d1; private Vector3 d2; private Collider aimCollider; public void Awake() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) m_body = ((Component)this).GetComponent<Projectile>(); m_nview = ((Component)this).GetComponent<ZNetView>(); m_body.m_ttl = m_ttl; m_body.m_skill = (SkillType)8; m_body.m_raiseSkillAmount = 3f * ((float)Game.m_worldLevel + 1f); } public void FixedUpdate() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_nview == (Object)null || !m_nview.IsOwner()) { return; } if ((Object)(object)target == (Object)null && tryCount <= 2) { tryCount++; if ((Object)(object)m_tower != (Object)null) { targetNew = GetEnemyInRange(pointA, m_tower.m_viewDistance, new List<Character>()); if ((Object)(object)targetNew != (Object)null) { target = ((Component)targetNew).gameObject; } } } if ((Object)(object)target != (Object)null) { posBuff = GetCenterAim(target, posBuff); } else if (!hasHeight) { hasHeight = true; posBuff.y = ZoneSystem.instance.GetGroundHeight(posBuff); } pointB = posBuff; posAmmo = ((Component)m_body).transform.position; vecFwd = GetVecForward(pointA, posAmmo, pointB, 0.1f); m_body.m_vel = Vector3.RotateTowards(m_body.m_vel, vecFwd, 180f * Time.deltaTime * ((float)Math.PI / 180f), 0f); if (!m_body.m_didHit && m_body.m_ttl <= 0.1f) { m_body.OnHit((Collider)null, ((Component)m_body).transform.position, false, Vector3.zero); } } private Vector3 GetVecForward(Vector3 start, Vector3 ammo, Vector3 end, float targetOffsets) { //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_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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005d: 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_008b: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) e1 = DistanceVector2(ammo, end); center = start + (end - start) / 2f + Vector3.up * e1 * 0.5f; coverage = DistanceVector2(start, ammo) + targetOffsets; distance = DistanceVector2(start, end); if (coverage <= distance) { deltaTime = coverage / distance; } m1 = Vector3.Lerp(start, center, deltaTime); m2 = Vector3.Lerp(center, end, deltaTime); end = Vector3.Lerp(m1, m2, deltaTime); return end - ammo; float DistanceVector2(Vector3 startt, Vector3 endd) { //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_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_002f: 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) d1 = startt; d1.y = 0f; d2 = endd; d2.y = 0f; return Vector3.Distance(d1, d2); } } private Character GetEnemyInRange(Vector3 basePos, float range, List<Character> excludList, float targetHeight = 0f) { //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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) foreach (Character s_character in Character.s_characters) { if (!excludList.Contains(s_character) && !((Object)(object)s_character == (Object)null) && !(Vector3.Distance(((Component)s_character).transform.position, basePos) > NoobTurret.viewDistance) && !((Object)(object)((Component)s_character).GetComponent<Growup>() != (Object)null) && (!s_character.IsBoss() || NoobTurret.targetBoss)) { enemyPos = GetCenterAim(((Component)s_character).gameObject, ((Component)s_character).transform.position); if (!RaycastIsBlocked(basePos, enemyPos) && (int)s_character.m_faction != 0 && (!((Object)(object)((Component)s_character).GetComponent<Tameable>() != (Object)null) || !s_character.IsTamed()) && !s_character.IsDead()) { excludList.Add(s_character); return s_character; } } } return null; } private bool RaycastIsBlocked(Vector3 attacker, Vector3 victim) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) vecRay = victim - attacker; raycastHit = Physics.Raycast(attacker, ((Vector3)(ref vecRay)).normalized, ((Vector3)(ref vecRay)).magnitude, BaseAI.m_viewBlockMask, (QueryTriggerInteraction)0); _ = raycastHit; return raycastHit; } private Vector3 GetCenterAim(GameObject target, Vector3 oldAimCenter) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) aimCollider = target.GetComponent<Collider>(); if ((Object)(object)aimCollider != (Object)null) { Bounds bounds = aimCollider.bounds; return ((Bounds)(ref bounds)).center; } return oldAimCenter; } } public class NoobBolt : MonoBehaviour { public ItemDrop m_component; public ZNetView m_nview; public static readonly string boltName = "NoobBolt"; public static readonly string m_boltName = "$item_noobbolt"; public static readonly string m_boltDesc = "$item_noobbolt_desc"; public static readonly string m_ammoName = "$ammo_noobbolt"; public static int m_maxStackSize = 30; public static string boltRequirement1; public static string boltRequirement2; public static string boltRequirement3; public static float m_scale = 1f; public static float m_weight = 0.1f; public static float m_attackForce; public static float m_backstabBonus; public static float m_damage; public static float m_blunt; public static float m_slash; public static float m_pierce; public static float m_chop; public static float m_pickaxe; public static float m_fire; public static float m_frost; public static float m_lightning; public static float m_poison; public static float m_spirit; public static HitData hitData; public static DamageTypes damageType; public void Awake() { UpdateBolt(); } public void UpdateBolt() { //IL_0029: 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_013a: Unknown result type (might be due to invalid IL or missing references) m_component = ((Component)this).GetComponent<ItemDrop>(); m_nview = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)m_component != (Object)null) { GetDamageType(); ((Object)m_component).name = boltName; m_component.m_itemData.m_shared.m_name = m_boltName; m_component.m_itemData.m_shared.m_description = m_boltDesc; m_component.m_itemData.m_shared.m_ammoType = m_ammoName; m_component.m_itemData.m_shared.m_maxStackSize = m_maxStackSize; m_component.m_itemData.m_shared.m_weight = 0.1f; m_component.m_itemData.m_shared.m_attackForce = m_attackForce; m_component.m_itemData.m_shared.m_backstabBonus = m_backstabBonus; ZSyncTransform component = ((Component)m_component).GetComponent<ZSyncTransform>(); if ((Object)(object)component != (Object)null) { component.m_syncPosition = true; component.m_syncRotation = true; component.m_syncScale = true; } BoxCollider component2 = ((Component)m_component).GetComponent<BoxCollider>(); if ((Object)(object)component2 != (Object)null) { component2.size = NoobHelper.GetNewScale(m_scale); } } else { NoobHelper.DWarn(" Bolt Awake ItemDrop component is missing"); } if ((Object)(object)m_nview != (Object)null) { m_nview.m_syncInitialScale = false; m_nview.SetLocalScale(NoobHelper.GetNewScale(m_scale)); } else { NoobHelper.DWarn(" Bolt Awake ZnetView component is missing"); } } public static DamageTypes GetDamageType() { //IL_0005: 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) damageType = default(DamageTypes); damageType.m_damage = m_damage; damageType.m_blunt = m_blunt; damageType.m_slash = m_slash; damageType.m_pierce = m_pierce; damageType.m_chop = m_chop; damageType.m_pickaxe = m_pickaxe; damageType.m_fire = m_fire; damageType.m_frost = m_frost; damageType.m_lightning = m_lightning; damageType.m_poison = m_poison; damageType.m_spirit = m_spirit; return damageType; } public static HitData GetHitData(Turret turret) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00ff: 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_0130: Unknown result type (might be due to invalid IL or missing references) hitData = new HitData(); hitData.m_toolTier = (short)turret.m_lastAmmo.m_shared.m_toolTier; hitData.m_pushForce = turret.m_lastAmmo.m_shared.m_attackForce; hitData.m_backstabBonus = turret.m_lastAmmo.m_shared.m_backstabBonus; hitData.m_staggerMultiplier = turret.m_lastAmmo.m_shared.m_attack.m_staggerMultiplier; hitData.m_statusEffectHash = (Object.op_Implicit((Object)(object)turret.m_lastAmmo.m_shared.m_attackStatusEffect) ? turret.m_lastAmmo.m_shared.m_attackStatusEffect.NameHash() : 0); hitData.m_blockable = turret.m_lastAmmo.m_shared.m_blockable; hitData.m_dodgeable = turret.m_lastAmmo.m_shared.m_dodgeable; hitData.m_itemWorldLevel = (byte)Game.m_worldLevel; ((DamageTypes)(ref hitData.m_damage)).Add(damageType, 1); hitData.m_skillRaiseAmount = (Game.m_worldLevel + 1) * 3; hitData.m_skill = (SkillType)8; hitData.m_hitType = (HitType)16; hitData.m_healthReturn = 20f; return hitData; } public static bool IsNoobAmmo(Projectile projectile) { if (projectile.m_ammo != null) { return projectile.m_ammo.m_shared.m_name == m_boltName; } return false; } public static bool IsNoobBolt(string name) { return name.StartsWith(boltName); } } public class NoobTurret : MonoBehaviour { private enum AmType { wood, black, flame, len } public static readonly string turretName = "NoobBallista"; public static readonly string m_turretName = "$item_noobballista"; public static readonly string m_turretDesc = "$item_noobballista_desc"; public static float velocity = 20f; public static float m_scale = 1f; public static bool targetBoss; public static float viewDistance; public Turret m_turret; public ZDOID m_turretID; public ZNetView m_nview; private GameObject[] m_visual = (GameObject[])(object)new GameObject[3]; private List<AmmoType> allowedAmmo = new List<AmmoType>(); public bool isLoaded; public bool isUpdated; public bool isHomming; private int hitCount; private float pitch = 1f; private Vector3 forwardTarget; private Vector3 forwardAttack; public void Awake() { //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) m_turret = ((Component)this).GetComponent<Turret>(); m_nview = ((Component)this).GetComponent<ZNetView>(); isUpdated = false; m_turret.m_ammoType = NoobBolt.m_ammoName; m_turret.m_holdRepeatInterval = 0.05f; m_turret.m_attackWarmup = 0.5f; m_turret.m_shootWhenAimDiff = 1f; m_turret.m_updateTargetTimer = 0f; m_turret.m_updateTargetIntervalFar = m_turret.m_updateTargetIntervalNear * 2f; m_turret.m_predictionModifier = 1f; m_turret.m_turnRate = 1f; m_turret.m_scan = 0f; m_turret.m_noTargetScanRate = 1f; m_turret.m_horizontalAngle = 90f; if ((Object)(object)m_visual[0] == (Object)null) { allowedAmmo = m_turret.m_allowedAmmo; foreach (AmmoType item2 in allowedAmmo) { if (((Object)item2.m_ammo).name == "TurretBoltWood") { m_visual[0] = item2.m_visual; } else if (((Object)item2.m_ammo).name == "TurretBolt") { m_visual[1] = item2.m_visual; } else if (((Object)item2.m_ammo).name == "TurretBoltFlametal") { m_visual[2] = item2.m_visual; } } } GameObject prefab = ZNetScene.instance.GetPrefab(NoobBolt.boltName); if ((Object)(object)prefab != (Object)null) { ItemDrop component = prefab.GetComponent<ItemDrop>(); if ((Object)(object)component != (Object)null) { AmmoType item = default(AmmoType); item.m_ammo = component; item.m_visual = m_visual[1]; m_turret.m_allowedAmmo.Clear(); m_turret.m_allowedAmmo.Add(item); } } if ((Object)(object)m_nview != (Object)null && m_nview.GetZDO() != null) { m_nview.Register<bool, float, float>("RPC_NoobToggleHomming", (Action<long, bool, float, float>)RPC_NoobToggleHomming); m_nview.Register<float, float>("RPC_NoobSyncRotation", (Action<long, float, float>)RPC_NoobSyncRotation); m_nview.Register<int, float>("RPC_IncrementNoobSkill", (Action<long, int, float>)RPC_IncrementNoobSkill); m_turretID = m_nview.GetZDO().m_uid; } } public void Update() { if (!((Object)(object)m_turret == (Object)null) && !((Object)(object)m_nview == (Object)null) && m_nview.IsValid() && !Player.IsPlacementGhost(((Component)m_turret).gameObject) && !isUpdated) { isUpdated = true; hitCount = m_nview.GetZDO().GetInt(ZDOVars.s_legItem, 0); isHomming = m_nview.GetZDO().GetBool(ZDOVars.s_pickedUp, isHomming); } } public void InvokeToggleHomming() { isHomming = !isHomming; m_nview.InvokeRPC(ZRoutedRpc.Everybody, "RPC_NoobToggleHomming", new object[3] { isHomming, m_turret.m_scan, m_turret.m_noTargetScanRate }); } private void RPC_NoobToggleHomming(long sender, bool ishomming, float rot, float dir) { isHomming = ishomming; m_turret.m_scan = rot; m_turret.m_noTargetScanRate = dir; if ((Object)(object)m_nview != (Object)null && m_nview.IsOwner()) { m_nview.GetZDO().Set(ZDOVars.s_pickedUp, isHomming); } } public void RPC_IncrementNoobSkill(long sender, int skilltype, float amount) { //IL_0019: 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_0049: 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_007b: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_00b3: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.m_localPlayer == (Object)null) && Vector3.Distance(((Component)m_turret).transform.position, ((Component)Player.m_localPlayer).transform.position) <= m_turret.m_viewDistance) { string text = ""; SkillType val = (SkillType)0; if (((Character)Player.m_localPlayer).GetSkillFactor((SkillType)skilltype) < 1f) { val = (SkillType)skilltype; text = "Bow +"; } else if (((Character)Player.m_localPlayer).GetSkillFactor((SkillType)14) < 1f) { val = (SkillType)14; text = "Crossbows +"; } else if (((Character)Player.m_localPlayer).GetSkillFactor((SkillType)5) < 1f) { val = (SkillType)5; text = "Spears +"; } else if (((Character)Player.m_localPlayer).GetSkillFactor((SkillType)4) < 1f) { val = (SkillType)4; text = "Polearms +"; } if ((int)val != 0) { ((Character)Player.m_localPlayer).RaiseSkill(val, amount); Vector3 position = ((Component)Player.m_localPlayer).transform.position; position.y += 1f; float num = 1f; ((Character)Player.m_localPlayer).m_seman.ModifyRaiseSkill(val, ref num); text += num * amount; NoobText.instance.ShowText(NoobText.Faction.Skill, position, text); } } } public void ShowHitCount(string name, Faction faction, float turretScale, SkillType skilltype, float amount) { //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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: 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_00a4: Expected I4, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected I4, but got Unknown if (isUpdated) { hitCount++; if (m_nview.IsOwner()) { m_nview.GetZDO().Set(ZDOVars.s_legItem, hitCount, false); Vector3 position = m_turret.m_turretBody.transform.position; float y = position.y + 1.8f * turretScale; position += Random.insideUnitSphere * turretScale; position.y = y; NoobText.instance.ShowText((NoobText.Faction)faction, position, name + " " + hitCount); m_nview.InvokeRPC(ZRoutedRpc.Everybody, "RPC_IncrementNoobSkill", new object[2] { (int)skilltype, amount }); } } } public static bool IsBallista(string name) { return name.StartsWith(turretName); } private void InvokeSyncRotation(float rot, float dir) { if ((Object)(object)m_nview != (Object)null && m_nview.IsOwner()) { m_nview.InvokeRPC(ZRoutedRpc.Everybody, "RPC_NoobSyncRotation", new object[2] { rot, dir }); } } private void RPC_NoobSyncRotation(long sender, float rot, float dir) { if ((Object)(object)m_nview != (Object)null && !m_nview.IsOwner() && !Object.op_Implicit((Object)(object)m_turret.m_target) && m_turret.HasAmmo()) { m_turret.m_scan = rot; m_turret.m_noTargetScanRate = dir; } } public void UpdateTurretRotation() { //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cc: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) bool flag = Object.op_Implicit((Object)(object)m_turret.m_target) && m_turret.HasAmmo(); Vector3 val; Quaternion rotation; if (flag) { if (m_turret.m_lastAmmo == null) { m_turret.m_lastAmmo = m_turret.GetAmmoItem(); } if (m_turret.m_lastAmmo == null) { ZLog.LogWarning((object)"Turret had invalid ammo, resetting ammo"); m_turret.m_nview.GetZDO().Set(ZDOVars.s_ammo, 0, false); return; } if (isHomming) { Vector3 position = ((Component)m_turret.m_target).transform.position; Vector3 position2 = ((Component)m_turret).transform.position; float num = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(position2.x, position2.z)); position.y += num / 2f; val = position - m_turret.m_turretBody.transform.position; } else { float num2 = Vector2.Distance(Vector2.op_Implicit(((Component)m_turret.m_target).transform.position), Vector2.op_Implicit(m_turret.m_eye.transform.position)) / m_turret.m_lastAmmo.m_shared.m_attack.m_projectileVel; Vector3 val2 = m_turret.m_target.GetVelocity() * num2 * m_turret.m_predictionModifier; val = ((Component)m_turret.m_target).transform.position + val2 - m_turret.m_turretBody.transform.position; ref float y = ref val.y; float num3 = y; CapsuleCollider componentInChildren = ((Component)m_turret.m_target).GetComponentInChildren<CapsuleCollider>(); y = num3 + ((componentInChildren != null) ? (componentInChildren.height / 2f) : 1f); } } else if (!m_turret.HasAmmo()) { val = ((Component)m_turret).transform.forward + new Vector3(0f, -0.3f, 0f); } else { if (m_turret.m_noTargetScanRate > 0f) { if (m_turret.m_scan >= m_turret.m_horizontalAngle) { m_turret.m_noTargetScanRate = -1f; InvokeSyncRotation(m_turret.m_scan, m_turret.m_noTargetScanRate); } } else if (m_turret.m_scan <= -1f * m_turret.m_horizontalAngle) { m_turret.m_noTargetScanRate = 1f; InvokeSyncRotation(m_turret.m_scan, m_turret.m_noTargetScanRate); } Turret turret = m_turret; turret.m_scan += m_turret.m_noTargetScanRate * m_turret.m_turnRate; rotation = ((Component)m_turret).transform.rotation; val = Quaternion.Euler(0f, ((Quaternion)(ref rotation)).eulerAngles.y + m_turret.m_scan, 0f) * Vector3.forward; if (isHomming) { val += new Vector3(0f, 1f, 0f); } } ((Vector3)(ref val)).Normalize(); Quaternion val3 = Quaternion.LookRotation(val, Vector3.up); Quaternion val4 = Utils.RotateTorwardsSmooth(m_turret.m_turretBody.transform.rotation, val3, m_turret.m_lastRotation, m_turret.m_turnRate, m_turret.m_lookAcceleration, m_turret.m_lookDeacceleration, m_turret.m_lookMinDegreesDelta); m_turret.m_lastRotation = m_turret.m_turretBody.transform.rotation; m_turret.m_turretBody.transform.rotation = m_turret.m_baseBodyRotation * val4; Transform transform = m_turret.m_turretNeck.transform; Quaternion baseNeckRotation = m_turret.m_baseNeckRotation; rotation = m_turret.m_turretBody.transform.rotation; float y2 = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = m_turret.m_turretBody.transform.rotation; transform.rotation = baseNeckRotation * Quaternion.Euler(0f, y2, ((Quaternion)(ref rotation)).eulerAngles.z); m_turret.m_aimDiffToTarget = (flag ? Quaternion.Dot(val4, val3) : (-1f)); } public void UpdateTarget(float dt) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) Turret turret = m_turret; turret.m_updateTargetTimer -= dt; if (m_turret.m_updateTargetTimer <= 0f) { m_turret.m_updateTargetTimer = (Character.IsCharacterInRange(((Component)m_turret).transform.position, 40f) ? m_turret.m_updateTargetIntervalNear : m_turret.m_updateTargetIntervalFar); Character val = BaseAI.FindClosestCreature(((Component)m_turret).transform, m_turret.m_eye.transform.position, 0f, m_turret.m_viewDistance, m_turret.m_horizontalAngle, false, false, true, m_turret.m_targetPlayers, (m_turret.m_targetItems.Count > 0) ? m_turret.m_targetTamedConfig : m_turret.m_targetTamed, m_turret.m_targetEnemies, m_turret.m_targetCharacters); if ((Object)(object)val != (Object)(object)m_turret.m_target && IsAllowedTarget(val)) { m_turret.m_newTargetEffect.Create(((Component)m_turret).transform.position, ((Component)m_turret).transform.rotation, (Transform)null, 1f, -1); m_turret.m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetTarget", new object[1] { val.GetZDOID() }); } } if (m_turret.m_haveTarget && ((Object)(object)m_turret.m_target == (Object)null || m_turret.m_target.IsDead())) { m_turret.m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetTarget", new object[1] { ZDOID.None }); m_turret.m_lostTargetEffect.Create(((Component)m_turret).transform.position, ((Component)m_turret).transform.rotation, (Transform)null, 1f, -1); } static bool IsAllowedTarget(Character monster) { //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_0056: Expected I4, but got Unknown if ((Object)(object)monster == (Object)null) { return false; } if (monster.IsBoss()) { return targetBoss; } Faction faction = monster.m_faction; switch ((int)faction) { case 1: if (monster.m_name == "$enemy_hare") { return true; } break; case 2: return true; case 3: return true; case 4: return true; case 5: return true; case 6: return true; case 7: return true; case 8: return true; case 9: return true; case 10: { MonsterAI component = ((Component)monster).GetComponent<MonsterAI>(); if ((Object)(object)component != (Object)null && (Object)(object)component.m_targetCreature != (Object)null && component.m_targetCreature.IsPlayer()) { return true; } return false; } case 11: return false; default: return false; case 0: break; } return false; } } public void UpdateAttack() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)m_turret.m_target) || !m_turret.HasAmmo() || m_turret.IsCoolingDown()) { return; } if (isHomming) { forwardTarget = ((Component)m_turret.m_target).transform.position - m_turret.m_turretBody.transform.position; forwardTarget.y = 0f; forwardAttack = m_turret.m_eye.transform.forward; forwardAttack.y = 0f; float num = Vector3.Angle(forwardAttack, forwardTarget); if (num >= 0f - pitch && num <= pitch) { ShootProjectile(); } } else if (m_turret.m_aimDiffToTarget >= m_turret.m_shootWhenAimDiff) { ShootProjectile(); } } private void ShootProjectile() { //IL_001d: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) Transform transform = m_turret.m_eye.transform; m_turret.m_shootEffect.Create(transform.position, transform.rotation, (Transform)null, 1f, -1); m_turret.m_nview.GetZDO().Set(ZDOVars.s_lastAttack, (float)ZNet.instance.GetTimeSeconds()); m_turret.m_lastAmmo = m_turret.GetAmmoItem(); int @int = m_nview.GetZDO().GetInt(ZDOVars.s_ammo, 0); int num = Mathf.Min(1, (m_turret.m_maxAmmo == 0) ? m_turret.m_lastAmmo.m_shared.m_attack.m_projectiles : Mathf.Min(@int, m_turret.m_lastAmmo.m_shared.m_attack.m_projectiles)); if (m_turret.m_maxAmmo > 0) { m_nview.GetZDO().Set(ZDOVars.s_ammo, @int - num, false); } for (int i = 0; i < num; i++) { Vector3 forward = transform.forward; Vector3 val = Vector3.Cross(forward, Vector3.up); float projectileAccuracy = m_turret.m_lastAmmo.m_shared.m_attack.m_projectileAccuracy; Quaternion val2 = Quaternion.AngleAxis(Random.Range(0f - projectileAccuracy, projectileAccuracy), Vector3.up); forward = Quaternion.AngleAxis(Random.Range(0f - projectileAccuracy, projectileAccuracy), val) * forward; forward = val2 * forward; m_turret.m_lastProjectile = Object.Instantiate<GameObject>(m_turret.m_lastAmmo.m_shared.m_attack.m_attackProjectile, transform.position, transform.rotation); Projectile component = m_turret.m_lastProjectile.GetComponent<Projectile>(); if ((Object)(object)component == (Object)null) { break; } velocity = m_turret.m_lastAmmo.m_shared.m_attack.m_projectileVel; if (isHomming) { velocity /= 3f; NoobAmmo noobAmmo = ((Component)component).gameObject.AddComponent<NoobAmmo>(); noobAmmo.m_tower = m_turret; noobAmmo.m_noob = this; noobAmmo.m_towerID = m_turretID; noobAmmo.m_body = component; noobAmmo.target = ((Component)m_turret.m_target).gameObject; noobAmmo.pointA = m_turret.m_turretBody.transform.position; noobAmmo.pointB = ((Component)m_turret.m_target).transform.position; noobAmmo.posBuff = noobAmmo.pointB; } component.m_vel = forward * velocity; component.m_stayTTL = 0f; component.m_stayAfterHitStatic = false; component.m_stayAfterHitDynamic = false; HitData hitData = NoobBolt.GetHitData(m_turret); Piece component2 = ((Component)m_turret).GetComponent<Piece>(); if ((Object)(object)component2 != (Object)null) { long creator = component2.GetCreator(); component.m_owner = (Character)(object)Player.GetPlayer(creator); if ((Object)(object)component.m_owner != (Object)null) { hitData.m_attacker = component.m_owner.GetZDOID(); } } if ((Object)(object)component.m_owner == (Object)null) { component.m_owner = (Character)(object)Player.GetPlayer(m_turret.m_nview.GetZDO().GetOwner()); if ((Object)(object)component.m_owner != (Object)null) { hitData.m_attacker = component.m_owner.GetZDOID(); } } if ((Object)(object)m_turret.m_lastAmmo.m_shared.m_attackStatusEffect != (Object)null) { hitData.m_statusEffectHash = m_turret.m_lastAmmo.m_shared.m_attackStatusEffect.NameHash(); } IProjectile component3 = m_turret.m_lastProjectile.GetComponent<IProjectile>(); if (component3 != null) { component3.Setup(component.m_owner, component.m_vel, m_turret.m_hitNoise, hitData, (ItemData)null, m_turret.m_lastAmmo); } } } } namespace NoobBallista { internal class NoobHelper { public static ManualLogSource log; private static readonly Dictionary<string, Texture2D> cachedTextures = new Dictionary<string, Texture2D>(); public static void InitLogger(ManualLogSource manuallog) { log = manuallog; } public static void DInfo(string text) { log.LogInfo((object)text); } public static void DWarn(string text) { log.LogWarning((object)text); } public static Texture2D LoadTexture(string pluginNameSpace, string fileName) { //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_0057: Expected O, but got Unknown //IL_0059: Expected O, but got Unknown Texture2D val; if (cachedTextures.ContainsKey(fileName)) { val = cachedTextures[fileName]; } else { Stream? manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(pluginNameSpace + ".Package.Assets." + fileName); byte[] array = new byte[manifestResourceStream.Length]; manifestResourceStream.Read(array, 0, array.Length); Texture2D val2 = new Texture2D(0, 0); ImageConversion.LoadImage(val2, array); val = val2; cachedTextures.Add(fileName, val); } return val; } public static Vector3 GetNewScale(float initialScale) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(initialScale, 0.1f, 1f); return new Vector3(num, num, num); } public static void SetScale(ZNetView zview, float initialScale) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)zview != (Object)null) { zview.m_syncInitialScale = false; zview.SetLocalScale(GetNewScale(initialScale)); } } public static Requirement BuildRequirement(ItemDrop itemdrp, int num) { //IL_0000: 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_000c: 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 = itemdrp, m_amount = num, m_recover = true, m_amountPerLevel = 0, m_extraAmountOnlyOneIngredient = 0 }; } public static bool GetRequirement(string requirement, out ItemDrop item, out int amount) { item = null; amount = 0; if (string.IsNullOrEmpty(requirement)) { return false; } if (requirement.Length > 3) { string[] array = requirement.Split(new char[1] { '|' }); if (array.Length != 2) { DWarn("********** GetRequirement Vertical Pipe/Splitter Error **********"); return false; } array[0] = array[0].Replace(" ", ""); array[1] = array[1].Replace(" ", ""); GameObject prefab = ZNetScene.instance.GetPrefab(array[0]); if ((Object)(object)prefab == (Object)null) { DWarn("********** GetRequirement GameObject " + array[0] + " Error **********"); return false; } item = prefab.GetComponent<ItemDrop>(); if ((Object)(object)item == (Object)null) { DWarn("********** GetRequirement ItemDrop " + array[0] + " Error **********"); return false; } if (int.TryParse(array[1].Replace(" ", ""), out var result)) { amount = result; return true; } DWarn("********** GetRequirement Parse Amount Error **********"); } return false; } } [BepInPlugin("GsiX.NoobBallista", "GsiX Noob Ballista", "1.3.9")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class NoobBallistaPlugins : BaseUnityPlugin { [HarmonyPatch(typeof(Turret), "UpdateAttack")] private class NoobBallista_Turret_UpdateAttack_Patch { private static bool Prefix(Turret __instance, ref bool __runOriginal) { if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || !NoobTurret.IsBallista(((Object)__instance).name)) { return true; } NoobTurret component = ((Component)__instance).GetComponent<NoobTurret>(); if ((Object)(object)component != (Object)null && __instance.m_nview.IsValid()) { UpdateTurretSetting(__instance); component.UpdateAttack(); } __runOriginal = false; return __runOriginal; } } [HarmonyPatch(typeof(Turret), "GetHoverText")] private class NoobBallista_Turret_GetHoverText_Patch { private static bool Prefix(ref Turret __instance, ref string __result, ref bool __runOriginal) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || !NoobTurret.IsBallista(((Object)__instance).name)) { return true; } __runOriginal = false; if (!__instance.m_nview.IsValid()) { return false; } if (!PrivateArea.CheckAccess(((Component)__instance).transform.position, 0f, false, false)) { return false; } if (ZInput.GetKey((KeyCode)304, true) && ZInput.GetKeyDown(HommingKey.Value, true)) { ((Component)__instance).GetComponent<NoobTurret>()?.InvokeToggleHomming(); } int ammo = __instance.GetAmmo(); int maxAmmo = __instance.m_maxAmmo; WearNTear component = ((Component)__instance).gameObject.GetComponent<WearNTear>(); if ((Object)(object)component != (Object)null) { int num = (int)(component.GetHealthPercentage() * 100f); string text = ((num > 60) ? "green" : ((num <= 30 || num > 60) ? "red" : "orange")); if (IsRequiredAmmo.Value) { __result = $"{BallistaName.Value} ( {ammo} / {maxAmmo} )"; __result += $"\n<color={text}>Health {num}%</color>"; __result = __result + "\n[<color=yellow>$KEY_Use</color>] Add " + BoltName.Value; __result = __result + "\n[<color=yellow>Left Shift</color> + <color=yellow>$KEY_Use</color>] Add Max " + BoltName.Value; } else { __result = $"{BallistaName.Value}\n<color={text}>Health {num}%</color>"; } } else if (IsRequiredAmmo.Value) { __result = $"{BallistaName.Value} ( {ammo} / {maxAmmo} )"; __result = __result + "\n[<color=yellow>$KEY_Use</color>] Add " + BoltName.Value; __result = __result + "\n[<color=yellow>Left Shift</color> + <color=yellow>$KEY_Use</color>] Add Max " + BoltName.Value; } else { __result = BallistaName.Value; } string[] obj = new string[6] { __result, "\n[<color=yellow><b>", null, null, null, null }; KeyCode val = (KeyCode)304; obj[2] = ((object)(KeyCode)(ref val)).ToString(); obj[3] = "</b></color> + <color=yellow><b>"; val = HommingKey.Value; obj[4] = ((object)(KeyCode)(ref val)).ToString(); obj[5] = "</b></color>] Toggle Homming"; __result = string.Concat(obj); __result = Localization.instance.Localize(__result); return __runOriginal; } } [HarmonyPatch(typeof(Turret), "UseItem")] private class NoobBallista_UseItem_Patch { private static bool Prefix(ref Turret __instance, Humanoid user, ItemData item, ref bool __result, ref bool __runOriginal) { if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || (Object)(object)user == (Object)null || !NoobTurret.IsBallista(((Object)__instance).name)) { return true; } __runOriginal = false; if (!IsRequiredAmmo.Value) { ((Character)user).Message((MessageType)2, BallistaName.Value + " Infinity Ammo", 0, (Sprite)null); __result = false; return __result; } Inventory inventory = user.GetInventory(); if (inventory == null) { ((Character)user).Message((MessageType)2, "Player's Inventory Error", 0, (Sprite)null); __result = false; return __result; } if (item == null) { item = __instance.FindAmmoItem(inventory, true); if (item == null) { ((Character)user).Message((MessageType)2, "$msg_noturretammo", 0, (Sprite)null); __result = false; return __result; } if (__instance.GetAmmo() > 0) { ItemDrop component = ZNetScene.instance.GetPrefab(__instance.GetAmmoType()).GetComponent<ItemDrop>(); ((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_turretotherammo") + Localization.instance.Localize(component.m_itemData.m_shared.m_name), 0, (Sprite)null); __result = false; return __result; } } if (!__instance.IsItemAllowed(((Object)item.m_dropPrefab).name)) { ((Character)user).Message((MessageType)2, "$msg_wontwork", 0, (Sprite)null); __result = false; return __result; } int ammo = __instance.GetAmmo(); if (ammo > 0 && __instance.GetAmmoType() != ((Object)item.m_dropPrefab).name) { ItemDrop component2 = ZNetScene.instance.GetPrefab(__instance.GetAmmoType()).GetComponent<ItemDrop>(); ((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_turretotherammo") + Localization.instance.Localize(component2.m_itemData.m_shared.m_name), 0, (Sprite)null); __result = false; return __result; } if (ammo >= __instance.m_maxAmmo) { ((Character)user).Message((MessageType)2, "$msg_itsfull", 0, (Sprite)null); __result = false; return __result; } Game.instance.IncrementPlayerStat((PlayerStatType)78, 1f); if (ZInput.GetKey((KeyCode)304, true)) { int num = inventory.CountItems(item.m_shared.m_name, -1, false); int num2 = __instance.m_maxAmmo - ammo; int num3 = num - num2; if (num3 < 0) { num3 = num; } inventory.RemoveItem(item, num3); for (int i = 0; i < num3; i++) { __instance.m_nview.InvokeRPC("RPC_AddAmmo", new object[1] { ((Object)item.m_dropPrefab).name }); } ((Character)user).Message((MessageType)2, Localization.instance.Localize("$msg_added " + item.m_shared.m_name + " " + num3 + "pcs"), 0, (Sprite)null); } else { inventory.RemoveItem(item, 1); __instance.m_nview.InvokeRPC("RPC_AddAmmo", new object[1] { ((Object)item.m_dropPrefab).name }); } __result = true; return false; } } [HarmonyPatch(typeof(Turret), "RPC_AddAmmo")] private class NoobBallista_RPC_AddAmmo_Patch { private static bool Prefix(Turret __instance, long sender, string name, ref bool __runOriginal) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || !NoobTurret.IsBallista(((Object)__instance).name)) { return true; } if (__instance.m_nview.IsOwner() && __instance.IsItemAllowed(name)) { int @int = __instance.m_nview.GetZDO().GetInt(ZDOVars.s_ammo, 0); __instance.m_nview.GetZDO().Set(ZDOVars.s_ammo, @int + 1, false); __instance.m_nview.GetZDO().Set(ZDOVars.s_ammoType, name); __instance.m_addAmmoEffect.Create(__instance.m_turretBody.transform.position, __instance.m_turretBody.transform.rotation, (Transform)null, 1f, -1); __instance.UpdateVisualBolt(); } __runOriginal = false; return false; } } [HarmonyPatch(typeof(Turret), "ShootProjectile")] private class NoobBallista_Turret_ShootProjectile_Patch { private static bool Prefix(Turret __instance, ref bool __runOriginal) { if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || !NoobTurret.IsBallista(((Object)__instance).name)) { return true; } __runOriginal = false; return false; } } [HarmonyPatch(typeof(Turret), "UpdateTarget")] private class NoobBallista_Turret_UpdateTarget_Patch { private static bool Prefix(Turret __instance, float dt, ref bool __runOriginal) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || !NoobTurret.IsBallista(((Object)__instance).name)) { return true; } __runOriginal = false; NoobTurret component = ((Component)__instance).GetComponent<NoobTurret>(); if ((Object)(object)component != (Object)null && __instance.m_nview.IsValid()) { if (!__instance.HasAmmo()) { if (IsRequiredAmmo.Value) { if (__instance.m_haveTarget) { __instance.m_nview.InvokeRPC(ZNetView.Everybody, "RPC_SetTarget", new object[1] { ZDOID.None }); } return false; } if (__instance.GetAmmo() < 1) { __instance.m_nview.InvokeRPC("RPC_AddAmmo", new object[1] { NoobBolt.boltName }); } } component.UpdateTarget(dt); } return false; } } [HarmonyPatch(typeof(Turret), "UpdateTurretRotation")] private class NoobBallista_Turret_UpdateTurretRotation_Patch { private static bool Prefix(Turret __instance, ref bool __runOriginal) { if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || !NoobTurret.IsBallista(((Object)__instance).name)) { return true; } NoobTurret component = ((Component)__instance).GetComponent<NoobTurret>(); if ((Object)(object)component != (Object)null && !__instance.IsCoolingDown()) { __instance.m_turnRate = Mathf.Clamp(TurnRates.Value, 0f, 10f); __instance.m_horizontalAngle = Mathf.Clamp(TurnAngle.Value, 0f, 180f); component.UpdateTurretRotation(); } __runOriginal = false; return false; } } [HarmonyPatch(typeof(Projectile), "FixedUpdate")] private class NoobBallista_Projectile_FixedUpdate_Patch { private static void Postfix(Projectile __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (PluginEnabled.Value && !((Object)(object)__instance == (Object)null) && NoobBolt.IsNoobAmmo(__instance)) { NoobHelper.SetScale(__instance.m_nview, BallistaSize.Value); if (IsRequiredAmmo.Value && IsReturnAmmo.Value && __instance.m_ttl <= 0f) { Quaternion rotation = ((Component)__instance).transform.rotation; float x = ((Quaternion)(ref rotation)).eulerAngles.x; rotation = ((Component)__instance).transform.rotation; float num = ((Quaternion)(ref rotation)).eulerAngles.y + 180f; rotation = ((Component)__instance).transform.rotation; Quaternion val = Quaternion.Euler(x, num, ((Quaternion)(ref rotation)).eulerAngles.z); Vector3 val2 = ((Component)__instance).transform.position + ((Component)__instance).transform.TransformDirection(__instance.m_spawnOffset); ItemDrop.DropItem(__instance.m_ammo, 0, val2, val); } } } } [HarmonyPatch(typeof(Projectile), "OnHit")] private static class NoobBallista_Projectile_OnHit_Patch { private static bool Prefix(Projectile __instance, Collider collider, Vector3 hitPoint, bool water, ref bool __runOriginal) { //IL_0142: Unknown result type (might be due to invalid IL or missing references) if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || (Object)(object)collider == (Object)null || !NoobBolt.IsNoobAmmo(__instance)) { return true; } GameObject val = Projectile.FindHitObject(collider); if ((Object)(object)val != (Object)null) { IDestructible component = val.GetComponent<IDestructible>(); if (component != null && __instance.IsValidTarget(component)) { WearNTear component2 = val.GetComponent<WearNTear>(); if ((Object)(object)component2 != (Object)null && !IsDamageStructure.Value) { Collider component3 = ((Component)component2).gameObject.GetComponent<Collider>(); if ((Object)(object)component3 != (Object)null) { Physics.IgnoreCollision(collider, component3); } Collider[] componentsInChildren = ((Component)component2).GetComponentsInChildren<Collider>(true); if (componentsInChildren.Length != 0) { Collider[] array = componentsInChildren; foreach (Collider val2 in array) { Physics.IgnoreCollision(collider, val2); } } __runOriginal = false; return __runOriginal; } Character val3 = (Character)(object)((component is Character) ? component : null); if (Object.op_Implicit((Object)(object)val3)) { if ((Object)(object)((Component)val3).GetComponent<Growup>() != (Object)null) { Physics.IgnoreCollision(collider, ((Component)val3).GetComponent<Collider>()); __runOriginal = false; return __runOriginal; } if (!IsDamageTamed.Value && (Object)(object)((Component)val3).GetComponent<Tameable>() != (Object)null && val3.m_tamed) { Physics.IgnoreCollision(collider, ((Component)val3).GetComponent<Collider>()); __runOriginal = false; return __runOriginal; } if (!IsDamagePlayer.Value && (int)val3.m_faction == 0 && val3.IsPlayer()) { Physics.IgnoreCollision(collider, ((Component)val3).GetComponent<Collider>()); __runOriginal = false; return __runOriginal; } } } } __runOriginal = true; return __runOriginal; } private static void Postfix(Projectile __instance, Collider collider, Vector3 hitPoint, bool water) { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (!PluginEnabled.Value || (Object)(object)__instance == (Object)null || (Object)(object)collider == (Object)null || !__instance.m_didHit || !NoobBolt.IsNoobAmmo(__instance)) { return; } GameObject val = Projectile.FindHitObject(collider); if (!((Object)(object)val != (Object)null)) { return; } IDestructible component = val.GetComponent<IDestructible>(); if (component == null || !__instance.IsValidTarget(component)) { return; } Character val2 = (Character)(object)((component is Character) ? component : null); if (Object.op_Implicit((Object)(object)val2)) { NoobAmmo component2 = ((Component)__instance).GetComponent<NoobAmmo>(); if ((Object)(object)component2 != (Object)null) { component2.m_noob.ShowHitCount(((Object)val2).name.Replace("(Clone)", ""), val2.GetFaction(), BallistaSize.Value, __instance.m_skill, __instance.m_raiseSkillAmount); } } } } [HarmonyPatch(typeof(DamageText), "Awake")] private static class NoobBallista_DamageText_Awake_Patch { private static void Postfix(DamageText __instance) { if (PluginEnabled.Value && !((Object)(object)__instance == (Object)null) && (Object)(object)((Component)__instance).gameObject.GetComponent<NoobText>() == (Object)null) { NoobText noobText = ((Component)__instance).gameObject.AddComponent<NoobText>(); noobText.m_body = __instance; noobText.m_worldTextBase = __instance.m_worldTextBase; } } } [HarmonyPatch(typeof(ZSyncTransform), "OwnerSync")] private class NoobBallista_ZSyncTransform_OwnerSync_Patch { private static void Postfix(ref ZSyncTransform __instance) { if (PluginEnabled.Value && !((Object)(object)__instance == (Object)null) && NoobBolt.IsNoobBolt(((Object)__instance).name)) { NoobHelper.SetScale(__instance.m_nview, BallistaSize.Value); } } } [HarmonyPatch(typeof(ZSyncTransform), "ClientSync")] private class NoobBallista_ZSyncTransform_ClientSync_Patch { private static void Postfix(ZSyncTransform __instance) { if (PluginEnabled.Value && !((Object)(object)__instance == (Object)null) && NoobBolt.IsNoobBolt(((Object)__instance).name)) { NoobHelper.SetScale(__instance.m_nview, BallistaSize.Value); } } } [HarmonyPatch(typeof(ZNetScene), "Awake")] private static class NoobBallista_ZNetScene_Awake_Patch { private static void Postfix(ZNetScene __instance) { if (!((Object)(object)__instance == (Object)null)) { SetReadConfigDelayed(); ItemBolt = __instance.GetPrefab(NoobBolt.boltName); } } } [HarmonyPatch(typeof(ObjectDB), "Awake")] private static class NoobBallista_ObjectDB_Awake_Patch { private static void Postfix(ObjectDB __instance) { if ((Object)(object)__instance != (Object)null && (Object)(object)ItemBolt != (Object)null) { UpdateBoltRequirement(ItemBolt); } } } public const string PluginGUID = "GsiX.NoobBallista"; public const string PluginName = "GsiX Noob Ballista"; public const string PluginVersion = "1.3.9"; public const string PluginNamespace = "NoobBallista"; private readonly Harmony harmony = new Harmony("GsiX.NoobBallista"); public static ConfigEntry<bool> PluginEnabled; public static ConfigEntry<bool> IsRequiredAmmo; public static ConfigEntry<bool> IsReturnAmmo; public static ConfigEntry<bool> IsTargetTamed; public static ConfigEntry<bool> IsTargetPlayer; public static ConfigEntry<bool> IsTargetBoss; public static ConfigEntry<bool> IsDamagePlayer; public static ConfigEntry<bool> IsDamageTamed; public static ConfigEntry<bool> IsDamageStructure; public static ConfigEntry<string> BallistaName; public static ConfigEntry<float> BallistaSize; public static ConfigEntry<float> ViewDistance; public static ConfigEntry<int> MaximumAmmo; public static ConfigEntry<float> AttackCooldown; public static ConfigEntry<float> TurnRates; public static ConfigEntry<float> TurnAngle; public static ConfigEntry<KeyCode> HommingKey; public static ConfigEntry<bool> ReturnAmmoOnDestroy; public static ConfigEntry<string> TurretRequirement1; public static ConfigEntry<string> TurretRequirement2; public static ConfigEntry<string> TurretRequirement3; public static ConfigEntry<string> TurretRequirement4; public static ConfigEntry<string> TurretRequirement5; public static ConfigEntry<string> BoltName; public static ConfigEntry<int> BoltMaxStackSize; public static ConfigEntry<float> BoltAttackForce; public static ConfigEntry<float> BoltDamage; public static ConfigEntry<float> BoltBlunt; public static ConfigEntry<float> BoltSlash; public static ConfigEntry<float> BoltPierce; public static ConfigEntry<float> BoltChop; public static ConfigEntry<float> BoltPickAxe; public static ConfigEntry<float> BoltFire; public static ConfigEntry<float> BoltFrost; public static ConfigEntry<float> BoltLighting; public static ConfigEntry<float> BoltPoison; public static ConfigEntry<float> BoltSpirit; public static ConfigEntry<string> BoltRequirement1; public static ConfigEntry<string> BoltRequirement2; public static ConfigEntry<string> BoltRequirement3; private static float ReadConfigDelayed = -1f; private static int AutoDescriptionOrder = 0; private static GameObject ItemBolt; public void Awake() { NoobHelper.InitLogger(((BaseUnityPlugin)this).Logger); PluginEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("PLUGIN ENABLED", "PluginEnabled", true, SetDescription("Plugin Enabled/Disabled", isadmin: true)); IsRequiredAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsRequiredAmmo", false, SetDescription("Is the ballista required ammo to shoot.", isadmin: true)); IsReturnAmmo = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsReturnAmmo", true, SetDescription("Ballista return ammo upon hit target. Override by IsRequiredAmmo", isadmin: true)); IsTargetTamed = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsTargetTamed", false, SetDescription("Allow Ballista to target tamed animal.", isadmin: true)); IsTargetPlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsTargetPlayer", false, SetDescription("Allow Ballista to target human player.", isadmin: true)); IsTargetBoss = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsTargetBoss", false, SetDescription("Allow Ballista to target boss.", isadmin: true)); IsDamagePlayer = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsDamagePlayer", false, SetDescription("Allow Ballista to do damage to player.", isadmin: true)); IsDamageTamed = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsDamageTamed", false, SetDescription("Allow Ballista to do damage tammed animal.", isadmin: true)); IsDamageStructure = ((BaseUnityPlugin)this).Config.Bind<bool>("GENERAL SETUP", "IsDamageStructure", false, SetDescription("Allow Ballista to do damage to structure.", isadmin: true)); BallistaName = ((BaseUnityPlugin)this).Config.Bind<string>("TURRET SETUP", "BallistaName", "Noob Ballista", SetDescription("Rename your Ballista. Required game restart", isadmin: true)); BallistaSize = ((BaseUnityPlugin)this).Config.Bind<float>("TURRET SETUP", "BallistaSize", 0.3f, SetDescription("Ballista scale size. Valid value 0.1 ~ 1.0", isadmin: true)); ViewDistance = ((BaseUnityPlugin)this).Config.Bind<float>("TURRET SETUP", "ViewDistance", 30f, SetDescription("Distance Ballista can shoot.", isadmin: true)); MaximumAmmo = ((BaseUnityPlugin)this).Config.Bind<int>("TURRET SETUP", "MaximumAmmo", 100, SetDescription("Maximum ammo stored on Ballista", isadmin: true)); AttackCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("TURRET SETUP", "AttackCooldown", 1f, SetDescription("Ballista interval between shoot.", isadmin: true)); TurnRates = ((BaseUnityPlugin)this).Config.Bind<float>("TURRET SETUP", "TurnRates", 2f, SetDescription("Ballista turn speed. Max 10", isadmin: true)); TurnAngle = ((BaseUnityPlugin)this).Config.Bind<float>("TURRET SETUP", "TurnAngle", 179f, SetDescription("Ballista max turn angle to either side from forward. Max 180", isadmin: true)); HommingKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("TURRET SETUP", "HommingKey", (KeyCode)116, SetDescription("Ballista toggle homming key", isadmin: false)); ReturnAmmoOnDestroy = ((BaseUnityPlugin)this).Config.Bind<bool>("TURRET SETUP", "ReturnAmmoOnDestroy", true, SetDescription("Ballista respawn ammo on destroyed. Override by IsRequiredAmmo", isadmin: true)); TurretRequirement1 = ((BaseUnityPlugin)this).Config.Bind<string>("TURRET REQUIREMENT", "TurretRequirement1", "Wood|12", SetDescription("Ballista crafting requirement. Can be empty for none.", isadmin: true)); TurretRequirement2 = ((BaseUnityPlugin)this).Config.Bind<string>("TURRET REQUIREMENT", "TurretRequirement2", "Stone|4", SetDescription("Ballista crafting requirement. Can be empty for none.", isadmin: true)); TurretRequirement3 = ((BaseUnityPlugin)this).Config.Bind<string>("TURRET REQUIREMENT", "TurretRequirement3", "Resin|20", SetDescription("Ballista crafting requirement. Can be empty for none.", isadmin: true)); TurretRequirement4 = ((BaseUnityPlugin)this).Config.Bind<string>("TURRET REQUIREMENT", "TurretRequirement4", "DeerHide|14", SetDescription("Ballista crafting requirement. Can be empty for none.", isadmin: true)); TurretRequirement5 = ((BaseUnityPlugin)this).Config.Bind<string>("TURRET REQUIREMENT", "TurretRequirement5", "LeatherScraps|18", SetDescription("Ballista crafting requirement. Can be empty for none.", isadmin: true)); BoltName = ((BaseUnityPlugin)this).Config.Bind<string>("BOLT SETUP", "BoltName", "Noob Bolt", SetDescription("Rename your Ballista's Bolt. Required game restart.", isadmin: true)); BoltMaxStackSize = ((BaseUnityPlugin)this).Config.Bind<int>("BOLT SETUP", "BoltMaxStackSize", 300, SetDescription("Bolt stack size.", isadmin: true)); BoltAttackForce = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "AttackForce", 24f, SetDescription("Bolt attack force. Vanilla default 45", isadmin: true)); BoltDamage = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltDamage", 12f, SetDescription("Bolt damage. Vanilla default 45.", isadmin: true)); BoltPierce = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltPierce", 12f, SetDescription("Bolt Pierce damage Vanilla default 75.", isadmin: true)); BoltBlunt = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltBlunt", 12f, SetDescription("Bolt Blunt damage", isadmin: true)); BoltSlash = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltSlash", 12f, SetDescription("Bolt Slash damage", isadmin: true)); BoltChop = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltChop", 12f, SetDescription("Bolt Chop damage", isadmin: true)); BoltPickAxe = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltPickAxe", 12f, SetDescription("Bolt PickAxe damage", isadmin: true)); BoltFire = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltFire", 12f, SetDescription("Bolt Fire damage", isadmin: true)); BoltFrost = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltFrost", 12f, SetDescription("Bolt Frost damage", isadmin: true)); BoltLighting = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltLighting", 12f, SetDescription("Bolt Lighting damage", isadmin: true)); BoltPoison = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltPoison", 12f, SetDescription("Bolt Poison damage", isadmin: true)); BoltSpirit = ((BaseUnityPlugin)this).Config.Bind<float>("BOLT SETUP", "BoltSpirit", 12f, SetDescription("Bolt Spirit damage", isadmin: true)); BoltRequirement1 = ((BaseUnityPlugin)this).Config.Bind<string>("BOLT REQUIREMENT", "BoltRequirement1", "Wood|10", SetDescription("Bolt crafting requirement. Can be empty for none.", isadmin: true)); BoltRequirement2 = ((BaseUnityPlugin)this).Config.Bind<string>("BOLT REQUIREMENT", "BoltRequirement2", "Resin|5", SetDescription("Bolt crafting requirement. Can be empty for none.", isadmin: true)); BoltRequirement3 = ((BaseUnityPlugin)this).Config.Bind<string>("BOLT REQUIREMENT", "BoltRequirement3", "", SetDescription("Bolt crafting requirement. Can be empty for none.", isadmin: true)); IsRequiredAmmo.SettingChanged += delegate { SetReadConfigDelayed(); }; BallistaName.SettingChanged += delegate { SetReadConfigDelayed(); }; IsTargetBoss.SettingChanged += delegate { SetReadConfigDelayed(); }; ViewDistance.SettingChanged += delegate { SetReadConfigDelayed(); }; TurretRequirement1.SettingChanged += delegate { SetReadConfigDelayed(); }; TurretRequirement2.SettingChanged += delegate { SetReadConfigDelayed(); }; TurretRequirement3.SettingChanged += delegate { SetReadConfigDelayed(); }; TurretRequirement4.SettingChanged += delegate { SetReadConfigDelayed(); }; TurretRequirement5.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltRequirement1.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltRequirement1.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltRequirement2.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltRequirement3.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltName.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltMaxStackSize.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltAttackForce.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltDamage.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltPierce.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltBlunt.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltSlash.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltChop.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltPickAxe.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltFire.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltFrost.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltLighting.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltPoison.SettingChanged += delegate { SetReadConfigDelayed(); }; BoltSpirit.SettingChanged += delegate { SetReadConfigDelayed(); }; ReadConfigChanges(); AddLocalizations(); PrefabManager.OnVanillaPrefabsAvailable += SetupNoobBallista; SynchronizationManager.OnConfigurationSynchronized += delegate { SetReadConfigDelayed(); NoobHelper.DInfo("Config sync event received and updated"); }; harmony.PatchAll(); } private static ConfigDescription SetDescription(string description, bool isadmin) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown AutoDescriptionOrder++; return new ConfigDescription(description, (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = isadmin, Order = AutoDescriptionOrder } }); } private void AddLocalizations() { CustomLocalization localization = LocalizationManager.Instance.GetLocalization(); string text = "English"; localization.AddTranslation(ref text, new Dictionary<string, string> { { NoobTurret.m_turretName, BallistaName.Value }, { NoobTurret.m_turretDesc, "Defensive " + BallistaName.Value }, { NoobBolt.m_boltName, BoltName.Value }, { NoobBolt.m_boltDesc, BoltName.Value + " for turret " + BallistaName.Value }, { NoobBolt.m_ammoName, "Ammo " + BoltName.Value } }); } private void SetupNoobBallista() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_019a: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Expected O, but got Unknown SetReadConfigDelayed(); Texture2D styleTex = NoobHelper.LoadTexture("NoobBallista", "noobmissile_texture_red.png"); Texture2D val = NoobHelper.LoadTexture("NoobBallista", "noobmissile_icon_red.png"); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); ItemConfig val3 = new ItemConfig(); val3.Name = NoobBolt.m_boltName; val3.Description = NoobBolt.m_boltDesc; val3.CraftingStation = "piece_workbench"; val3.RepairStation = null; val3.Amount = 30; val3.Icons = (Sprite[])(object)new Sprite[1] { val2 }; val3.StyleTex = styleTex; ItemConfig val4 = val3; AddRequirement(BoltRequirement1.Value, null, val4); AddRequirement(BoltRequirement2.Value, null, val4); AddRequirement(BoltRequirement3.Value, null, val4); CustomItem val5 = new CustomItem(NoobBolt.boltName, "TurretBolt", val4); ((Component)val5.ItemDrop).gameObject.AddComponent<NoobBolt>(); ItemManager.Instance.AddItem(val5); SetReadConfigDelayed(); Texture2D val6 = NoobHelper.LoadTexture("NoobBallista", "noobballista_icon.png"); Sprite icon = Sprite.Create(val6, new Rect(0f, 0f, (float)((Texture)val6).width, (float)((Texture)val6).height), Vector2.zero); PieceConfig val7 = new PieceConfig { Name = NoobTurret.m_turretName, Description = NoobTurret.m_turretDesc, PieceTable = "Hammer", Category = "Misc", CraftingStation = "", Icon = icon, AllowedInDungeons = true }; AddRequirement(TurretRequirement1.Value, val7); AddRequirement(TurretRequirement2.Value, val7); AddRequirement(TurretRequirement3.Value, val7); AddRequirement(TurretRequirement4.Value, val7); AddRequirement(TurretRequirement5.Value, val7); CustomPiece val8 = new CustomPiece(NoobTurret.turretName, "piece_turret", val7); val8.Piece.m_name = NoobTurret.m_turretName; ((Component)val8.Piece).gameObject.AddComponent<NoobTurret>(); PieceManager.Instance.AddPiece(val8); PrefabManager.OnVanillaPrefabsAvailable -= SetupNoobBallista; static void AddRequirement(string requirement, PieceConfig piececonfig = null, ItemConfig itemconfig = null) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown if (requirement.Length > 3) { string[] array = requirement.Replace(" ", "").Split(new char[1] { '|' }); if (array.Length == 2) { if (int.TryParse(array[1].Replace(" ", ""), out var result)) { if (piececonfig != null) { piececonfig.AddRequirement(new RequirementConfig(array[0], result, 0, true)); } if (itemconfig != null) { itemconfig.AddRequirement(new RequirementConfig(array[0], result, 0, false)); } } } else { Logger.LogWarning((object)"********** AddRequirement Vertical Pipe/Splitter Error **********"); } } } } private static void ReadConfigChanges() { //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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_0319: Unknown result type (might be due to invalid IL or missing references) NoobBolt.boltRequirement1 = BoltRequirement1.Value; NoobBolt.boltRequirement2 = BoltRequirement2.Value; NoobBolt.boltRequirement3 = BoltRequirement3.Value; NoobBolt.m_scale = BallistaSize.Value; NoobBolt.m_maxStackSize = BoltMaxStackSize.Value; NoobBolt.m_attackForce = BoltAttackForce.Value; NoobBolt.m_backstabBonus = BoltDamage.Value; NoobBolt.m_damage = BoltDamage.Value; NoobBolt.m_blunt = BoltBlunt.Value; NoobBolt.m_slash = BoltSlash.Value; NoobBolt.m_pierce = BoltPierce.Value; NoobBolt.m_chop = BoltChop.Value; NoobBolt.m_pickaxe = BoltPickAxe.Value; NoobBolt.m_fire = BoltFire.Value; NoobBolt.m_frost = BoltFrost.Value; NoobBolt.m_lightning = BoltLighting.Value; NoobBolt.m_poison = BoltPoison.Value; NoobBolt.m_spirit = BoltSpirit.Value; NoobBolt.GetDamageType(); NoobTurret.targetBoss = IsTargetBoss.Value; NoobTurret.viewDistance = ViewDistance.Value; NoobTurret.m_scale = BallistaSize.Value; if ((Object)(object)ZNetScene.instance != (Object)null) { if ((Object)(object)ObjectDB.m_instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab(NoobBolt.boltName); if ((Object)(object)prefab != (Object)null) { Vector3 newScale = NoobHelper.GetNewScale(BallistaSize.Value); prefab.transform.localScale = newScale; NoobBolt component = prefab.GetComponent<NoobBolt>(); if ((Object)(object)component != (Object)null) { component.UpdateBolt(); } BoxCollider component2 = prefab.GetComponent<BoxCollider>(); if ((Object)(object)component2 != (Object)null) { component2.size = newScale; } UpdateBoltRequirement(prefab); } } if (ItemDrop.s_instances != null && ItemDrop.s_instances.Count() > 0) { foreach (ItemDrop s_instance in ItemDrop.s_instances) { if (!((Object)(object)s_instance == (Object)null) && !((Object)(object)s_instance.m_nview == (Object)null)) { NoobBolt component3 = ((Component)s_instance).GetComponent<NoobBolt>(); if (!((Object)(object)component3 == (Object)null)) { component3.UpdateBolt(); } } } } GameObject prefab2 = ZNetScene.instance.GetPrefab(NoobTurret.turretName); if ((Object)(object)prefab2 != (Object)null) { prefab2.transform.localScale = NoobHelper.GetNewScale(BallistaSize.Value); Turret component4 = prefab2.GetComponent<Turret>(); if ((Object)(object)component4 != (Object)null) { NoobHelper.SetScale(component4.m_nview, BallistaSize.Value); } BoxCollider component5 = prefab2.GetComponent<BoxCollider>(); if ((Object)(object)component5 != (Object)null) { float num = Mathf.Clamp(BallistaSize.Value, 0.1f, 1f); float num2 = 2.2f * num; float num3 = 1.8f * (1f - num); float num4 = num2; float num5 = num3 / 2f - 0.02f; component5.center = new Vector3(0f, num5, 0f); component5.size = new Vector3(num2, num3, num4); } Piece component6 = prefab2.GetComponent<Piece>(); if ((Object)(object)component6 != (Object)null) { NoobHelper.SetScale(component6.m_nview, BallistaSize.Value); List<Requirement> list = new List<Requirement>(); if (NoobHelper.GetRequirement(TurretRequirement1.Value, out var item, out var amount)) { list.Add(NoobHelper.BuildRequirement(item, amount)); } if (NoobHelper.GetRequirement(TurretRequirement2.Value, out var item2, out var amount2)) { list.Add(NoobHelper.BuildRequirement(item2, amount2)); } if (NoobHelper.GetRequirement(TurretRequirement3.Value, out var item3, out var amount3)) { list.Add(NoobHelper.BuildRequirement(item3, amount3)); } if (NoobHelper.GetRequirement(TurretRequirement4.Value, out var item4, out var amount4)) { list.Add(NoobHelper.BuildRequirement(item4, amount4)); } if (NoobHelper.GetRequirement(TurretRequirement5.Value, out var item5, out var amount5)) { list.Add(NoobHelper.BuildRequirement(item5, amount5)); } if (list.Count > 0) { component6.m_resources = list.ToArray(); NoobHelper.DInfo(" Turret requirement updated"); } } } } NoobHe