Decompiled source of Turtles Gears and Stuff v1.0.1

mrturtgear.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using DM;
using Landfall.TABS;
using Landfall.TABS.AI.Components;
using Landfall.TABS.AI.Components.Tags;
using Landfall.TABS.AI.Systems;
using Landfall.TABS.GameMode;
using TFBGames;
using Unity.Entities;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Tabs Poof Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tabs Poof Mod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8aad4f38-2ad4-4206-bf0b-7d28fb6d5c2e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TraversalWeapons;

public class weapondef
{
	public string name;

	public int localid;

	public string whatweaponcloneee;

	public float cooldown = float.NaN;

	public float range = float.NaN;

	public float howhardhittt = float.NaN;

	public float howhardflingg = float.NaN;

	public float howfastshotttt = 1f;

	public int howmanyprojjj = -1;

	public Type dacompone;

	public Color? damuzcolourr;

	public float howbigmuzlpart = 1f;

	public float howfastaredamuzlef = 1f;

	public bool nukethehiteffectsss;

	public Type hiteffectcomp;

	public bool hitteammatesss;
}
public class dabulletsaeae
{
	public string name;

	public int localid;

	public string whatbullefromm;
}
public class deadunitshooterrr : MonoBehaviour
{
	private float howfastlaunchhh = 60f;

	private float howfarupppp = 8f;

	private float howfarinfronttt = 2.5f;

	private RangeWeapon myrangeee;

	private Transform myshootposss;

	private void Start()
	{
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		myrangeee = ((Component)this).GetComponentInChildren<RangeWeapon>(true);
		ShootPosition componentInChildren = ((Component)this).GetComponentInChildren<ShootPosition>(true);
		myshootposss = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).transform : ((Component)this).transform);
		if ((Object)(object)myrangeee != (Object)null)
		{
			myrangeee.getAttackCallEvent.AddListener(new UnityAction(fliiiiiing));
		}
	}

	private void fliiiiiing()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		DataHandler connectedData = ((Weapon)myrangeee).connectedData;
		if ((Object)(object)connectedData == (Object)null || (Object)(object)connectedData.mainRig == (Object)null)
		{
			return;
		}
		Team team = connectedData.team;
		List<UnitBlueprint> list = new List<UnitBlueprint>();
		foreach (UnitBlueprint unitBlueprint in ContentDatabase.Instance().LandfallContentDatabase.GetUnitBlueprints())
		{
			if ((Object)(object)unitBlueprint != (Object)null)
			{
				list.Add(unitBlueprint);
			}
		}
		if (list.Count != 0)
		{
			UnitBlueprint obj = list[Random.Range(0, list.Count)];
			Vector3 val = ((Component)connectedData.mainRig).transform.forward;
			if ((Object)(object)connectedData.targetMainRig != (Object)null)
			{
				val = connectedData.targetMainRig.position - connectedData.mainRig.position;
			}
			val.y = 0f;
			if (((Vector3)(ref val)).sqrMagnitude < 0.0001f)
			{
				val = ((Component)connectedData.mainRig).transform.forward;
			}
			((Vector3)(ref val)).Normalize();
			Vector3 val2 = myshootposss.position + val * howfarinfronttt;
			Unit val3 = default(Unit);
			obj.Spawn(val2, Quaternion.LookRotation(val), team, ref val3, 1f, false, true, 0, (UnitPoolInfo?)null);
			if ((Object)(object)val3 != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(killandlaunchhh(val3, val));
			}
		}
	}

	private IEnumerator killandlaunchhh(Unit deadguyyy, Vector3 wheretoooo)
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		yield return null;
		if ((Object)(object)deadguyyy == (Object)null || (Object)(object)deadguyyy.data == (Object)null || (Object)(object)deadguyyy.data.healthHandler == (Object)null)
		{
			yield break;
		}
		deadguyyy.data.healthHandler.Die((Unit)null);
		yield return (object)new WaitForFixedUpdate();
		if ((Object)(object)deadguyyy == (Object)null)
		{
			yield break;
		}
		RigidbodyHolder componentInChildren = ((Component)deadguyyy).GetComponentInChildren<RigidbodyHolder>();
		Vector3 velocity = wheretoooo * howfastlaunchhh + Vector3.up * howfarupppp;
		if (!((Object)(object)componentInChildren != (Object)null) || componentInChildren.AllRigs == null)
		{
			yield break;
		}
		Rigidbody[] allRigs = componentInChildren.AllRigs;
		foreach (Rigidbody val in allRigs)
		{
			if ((Object)(object)val != (Object)null && !val.isKinematic)
			{
				val.velocity = velocity;
				val.angularVelocity = Random.insideUnitSphere * 5f;
			}
		}
	}
}
public class daflipeffec : ProjectileHitEffect
{
	public override bool DoEffect(HitData hit)
	{
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Invalid comparison between Unknown and I4
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0135: 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_0144: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Expected I4, but got Unknown
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: 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_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: 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_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0208: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		if (hit == null || (Object)(object)hit.transform == (Object)null)
		{
			return false;
		}
		Unit componentInChildren = ((Component)hit.transform.root).GetComponentInChildren<Unit>();
		if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren.data == (Object)null || componentInChildren.data.Dead)
		{
			return false;
		}
		Team team = componentInChildren.Team;
		if ((int)team != 0 && (int)team != 1)
		{
			return false;
		}
		Team val = (Team)((int)team == 0);
		TeamSystem orCreateManager = World.Active.GetOrCreateManager<TeamSystem>();
		List<Unit> winConditionTeamUnits = orCreateManager.GetWinConditionTeamUnits(team);
		bool flag = winConditionTeamUnits?.Contains(componentInChildren) ?? false;
		BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
		Type typeFromHandle = typeof(TeamSystem);
		typeFromHandle.GetMethod("RemoveUnitFromTeam", bindingAttr).Invoke(orCreateManager, new object[2] { componentInChildren, team });
		typeFromHandle.GetMethod("AddUnitToTeam", bindingAttr).Invoke(orCreateManager, new object[3]
		{
			componentInChildren,
			val,
			!flag
		});
		componentInChildren.Team = val;
		componentInChildren.data.team = val;
		GameObjectEntity component = ((Component)componentInChildren).GetComponent<GameObjectEntity>();
		if ((Object)(object)component != (Object)null && component.EntityManager != null)
		{
			EntityManager entityManager = component.EntityManager;
			entityManager.SetSharedComponentData<Team>(component.Entity, new Team
			{
				Value = (int)val
			});
			if (entityManager.HasComponent<HasTargetTag>(component.Entity))
			{
				entityManager.SetComponentData<HasTargetTag>(component.Entity, new HasTargetTag
				{
					Target = Entity.Null
				});
			}
			foreach (Unit item in new List<Unit>(orCreateManager.GetAllUnits()))
			{
				if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)componentInChildren))
				{
					GameObjectEntity component2 = ((Component)item).GetComponent<GameObjectEntity>();
					if (!((Object)(object)component2 == (Object)null) && entityManager.HasComponent<HasTargetTag>(component2.Entity) && entityManager.GetComponentData<HasTargetTag>(component2.Entity).Target == component.Entity)
					{
						entityManager.SetComponentData<HasTargetTag>(component2.Entity, new HasTargetTag
						{
							Target = Entity.Null
						});
					}
				}
			}
		}
		Transform root = ((Component)componentInChildren).transform.root;
		TeamHolder[] componentsInChildren = ((Component)root).GetComponentsInChildren<TeamHolder>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			componentsInChildren[i].team = val;
		}
		TeamColor[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<TeamColor>();
		for (int i = 0; i < componentsInChildren2.Length; i++)
		{
			componentsInChildren2[i].SetTeamColor(val);
		}
		if (flag && winConditionTeamUnits.Count == 0)
		{
			BaseGameMode currentGameMode = ServiceLocator.GetService<GameModeService>().CurrentGameMode;
			if (currentGameMode != null && currentGameMode.WinConditionPropagator != null)
			{
				currentGameMode.WinConditionPropagator.OnUnitDied(componentInChildren);
			}
		}
		return false;
	}
}
public class daswapeffec : ProjectileHitEffect
{
	public override bool DoEffect(HitData hit)
	{
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		if (hit == null || (Object)(object)hit.transform == (Object)null)
		{
			return false;
		}
		TeamHolder componentInParent = ((Component)this).GetComponentInParent<TeamHolder>();
		if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent.spawner == (Object)null)
		{
			return false;
		}
		Unit componentInChildren = ((Component)componentInParent.spawner.transform.root).GetComponentInChildren<Unit>();
		Unit componentInChildren2 = ((Component)hit.transform.root).GetComponentInChildren<Unit>();
		if ((Object)(object)componentInChildren == (Object)null || (Object)(object)componentInChildren2 == (Object)null || (Object)(object)componentInChildren == (Object)(object)componentInChildren2 || (Object)(object)componentInChildren.data == (Object)null || (Object)(object)componentInChildren2.data == (Object)null || componentInChildren.data.Dead || componentInChildren2.data.Dead || (Object)(object)componentInChildren.data.mainRig == (Object)null || (Object)(object)componentInChildren2.data.mainRig == (Object)null)
		{
			return false;
		}
		Vector3 val = componentInChildren2.data.mainRig.position - componentInChildren.data.mainRig.position;
		moveunitttt(componentInChildren, val);
		moveunitttt(componentInChildren2, -val);
		return false;
	}

	private static void moveunitttt(Unit theunitttt, Vector3 deltaaa)
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		RigidbodyHolder componentInChildren = ((Component)theunitttt).GetComponentInChildren<RigidbodyHolder>();
		if ((Object)(object)componentInChildren == (Object)null || componentInChildren.AllRigs == null)
		{
			return;
		}
		Rigidbody[] allRigs = componentInChildren.AllRigs;
		foreach (Rigidbody val in allRigs)
		{
			if ((Object)(object)val != (Object)null)
			{
				val.position += deltaaa;
			}
		}
	}
}
[BepInPlugin("bayturtleking.turtlegear", "Turtle's Gear", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class theweaponmod : BaseUnityPlugin
{
	private GameObject thepoolll;

	private List<weapondef> weapondefs = new List<weapondef>
	{
		new weapondef
		{
			name = "Unit Shooter",
			localid = 1,
			whatweaponcloneee = "Neon Tesla Torrent",
			cooldown = 1.5f,
			range = 30f,
			howmanyprojjj = 0,
			dacompone = typeof(deadunitshooterrr)
		},
		new weapondef
		{
			name = "Gravity Gun",
			localid = 2,
			whatweaponcloneee = "Neon Plasma Pulses",
			cooldown = 2f,
			range = 25f,
			howhardhittt = 5f,
			howhardflingg = 90000f,
			howfastshotttt = 2f,
			damuzcolourr = new Color(1f, 0.5f, 0f),
			howbigmuzlpart = 2f,
			nukethehiteffectsss = true
		},
		new weapondef
		{
			name = "Color Flipper",
			localid = 3,
			whatweaponcloneee = "Neon Annihilation Apex 01",
			cooldown = 1.5f,
			range = 25f,
			howhardhittt = 0f,
			howhardflingg = 0f,
			howfastshotttt = 2f,
			damuzcolourr = new Color(0.5f, 0f, 1f),
			howbigmuzlpart = 2f,
			nukethehiteffectsss = true,
			hitteammatesss = true,
			hiteffectcomp = typeof(daflipeffec)
		},
		new weapondef
		{
			name = "Swap Gun",
			localid = 4,
			whatweaponcloneee = "Neon Break Blaster",
			cooldown = 2f,
			range = 30f,
			howhardhittt = 0f,
			howhardflingg = 0f,
			howfastshotttt = 2f,
			damuzcolourr = new Color(0f, 1f, 1f),
			howbigmuzlpart = 2f,
			nukethehiteffectsss = true,
			hiteffectcomp = typeof(daswapeffec)
		}
	};

	private List<dabulletsaeae> dastuffofbullet = new List<dabulletsaeae>
	{
		new dabulletsaeae
		{
			name = "M1911 Bullet (no drop) (TG&S)",
			localid = 1,
			whatbullefromm = "M1911 Bullet"
		},
		new dabulletsaeae
		{
			name = "PPSh Bullet (no drop) (TG&S)",
			localid = 2,
			whatbullefromm = "PPSh Bullet"
		},
		new dabulletsaeae
		{
			name = "M16 Bullet (no drop) (TG&S)",
			localid = 3,
			whatbullefromm = "M16 Bullet"
		},
		new dabulletsaeae
		{
			name = "M2 Bullet (no drop) (TG&S)",
			localid = 4,
			whatbullefromm = "M2 Bullet"
		}
	};

	private void Awake()
	{
		((MonoBehaviour)this).StartCoroutine(addwhenre());
	}

	private IEnumerator addwhenre()
	{
		while (ContentDatabase.Instance() == null)
		{
			yield return null;
		}
		thepoolll = new GameObject("daturtweaponpoe");
		thepoolll.SetActive(false);
		Object.DontDestroyOnLoad((Object)(object)thepoolll);
		((Object)thepoolll).hideFlags = (HideFlags)52;
		foreach (weapondef weapondef in weapondefs)
		{
			addweaponnn(weapondef);
		}
		foreach (dabulletsaeae item in dastuffofbullet)
		{
			addbulletttt(item);
		}
	}

	private void addbulletttt(dabulletsaeae def)
	{
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = findthebulletttt(def.whatbullefromm);
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("couldnt find " + def.whatbullefromm + " so " + def.name + " is not happening :("));
			return;
		}
		GameObject val2 = Object.Instantiate<GameObject>(val, thepoolll.transform);
		((Object)val2).name = def.name;
		ProjectileEntity componentInChildren = val2.GetComponentInChildren<ProjectileEntity>(true);
		if ((Object)(object)componentInChildren == (Object)null)
		{
			Object.Destroy((Object)(object)val2);
			return;
		}
		componentInChildren.Entity.Name = def.name;
		componentInChildren.Entity.GUID = new DatabaseID(738201500, 2000 + def.localid);
		MoveTransform[] componentsInChildren = val2.GetComponentsInChildren<MoveTransform>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			componentsInChildren[i].gravity = 0f;
		}
		getprivatefield<Dictionary<DatabaseID, Object>>(ContentDatabase.Instance().AssetLoader, "m_nonStreamableAssets")[componentInChildren.Entity.GUID] = (Object)(object)val2;
		getprivatefield<Dictionary<DatabaseID, GameObject>>(ContentDatabase.Instance().LandfallContentDatabase, "m_projectiles")[componentInChildren.Entity.GUID] = val2;
		((BaseUnityPlugin)this).Logger.LogInfo((object)(def.name + " is now a bullet that doesnt fall cuz of turtle's weapons mod"));
	}

	private GameObject findthebulletttt(string namehassss)
	{
		string text = squishitttt(namehassss);
		string text2 = squishitttt(namehassss.Split(new char[1] { ' ' })[0]);
		Dictionary<string, string> language = Localizer.GetLanguage((Language)0);
		GameObject val = null;
		List<string> list = new List<string>();
		foreach (GameObject projectile in ContentDatabase.Instance().LandfallContentDatabase.GetProjectiles())
		{
			if ((Object)(object)projectile == (Object)null)
			{
				continue;
			}
			List<string> list2 = new List<string>();
			list2.Add(((Object)projectile).name);
			ProjectileEntity componentInChildren = projectile.GetComponentInChildren<ProjectileEntity>(true);
			if ((Object)(object)componentInChildren != (Object)null && componentInChildren.Entity != null)
			{
				list2.Add(componentInChildren.DisplayName);
				list2.Add(componentInChildren.Entity.Name);
				if (!string.IsNullOrEmpty(componentInChildren.Entity.Name) && language.TryGetValue(componentInChildren.Entity.Name, out var value))
				{
					list2.Add(value);
				}
			}
			foreach (string item in list2)
			{
				string text3 = squishitttt(item);
				if (text3.Length != 0)
				{
					if (text3 == text)
					{
						return projectile;
					}
					if ((Object)(object)val == (Object)null && text3.Contains(text))
					{
						val = projectile;
					}
					if (list.Count < 20 && text3.Contains(text2))
					{
						list.Add(item);
					}
				}
			}
		}
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		((BaseUnityPlugin)this).Logger.LogWarning((object)("projectile names with " + text2 + " in them: " + string.Join(" | ", list.ToArray())));
		return null;
	}

	private static string squishitttt(string thestringgg)
	{
		if (string.IsNullOrEmpty(thestringgg))
		{
			return "";
		}
		StringBuilder stringBuilder = new StringBuilder();
		foreach (char c in thestringgg)
		{
			if (char.IsLetterOrDigit(c))
			{
				stringBuilder.Append(char.ToLowerInvariant(c));
			}
		}
		return stringBuilder.ToString();
	}

	private void addweaponnn(weapondef def)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0430: Unknown result type (might be due to invalid IL or missing references)
		//IL_0443: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0328: Unknown result type (might be due to invalid IL or missing references)
		//IL_032d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0381: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(findtheweaponnn(def.whatweaponcloneee), thepoolll.transform);
		((Object)val).name = def.name;
		WeaponItem componentInChildren = val.GetComponentInChildren<WeaponItem>(true);
		Weapon componentInChildren2 = val.GetComponentInChildren<Weapon>(true);
		((CharacterItem)componentInChildren).tags = new List<Tag>
		{
			new Tag
			{
				tagType = (TagType)0,
				value = "Turtle's Gear & Stuff"
			}
		};
		((CharacterItem)componentInChildren).Entity.Name = def.name;
		((CharacterItem)componentInChildren).Entity.GUID = new DatabaseID(738201500, def.localid);
		if (!float.IsNaN(def.cooldown))
		{
			componentInChildren2.internalCooldown = def.cooldown;
		}
		if (!float.IsNaN(def.range))
		{
			componentInChildren2.maxRange = def.range;
		}
		RangeWeapon val2 = (RangeWeapon)(object)((componentInChildren2 is RangeWeapon) ? componentInChildren2 : null);
		if ((Object)(object)val2 != (Object)null)
		{
			if (def.howmanyprojjj >= 0)
			{
				val2.numberOfObjects = def.howmanyprojjj;
			}
			if ((Object)(object)val2.ObjectToSpawn != (Object)null)
			{
				GameObject val3 = Object.Instantiate<GameObject>(val2.ObjectToSpawn, thepoolll.transform);
				((Object)val3).name = def.name + " Shoot";
				ProjectileEntity componentInChildren3 = val3.GetComponentInChildren<ProjectileEntity>(true);
				if ((Object)(object)componentInChildren3 != (Object)null)
				{
					componentInChildren3.Entity.Name = def.name + " Shoot";
					componentInChildren3.Entity.GenerateNewID();
				}
				ProjectileHit[] componentsInChildren = val3.GetComponentsInChildren<ProjectileHit>(true);
				foreach (ProjectileHit val4 in componentsInChildren)
				{
					if (!float.IsNaN(def.howhardhittt))
					{
						val4.damage = def.howhardhittt;
					}
					if (!float.IsNaN(def.howhardflingg))
					{
						val4.force = def.howhardflingg;
					}
					if (def.hitteammatesss)
					{
						val4.alwaysHitTeamMates = true;
						val4.ignoreTeamMates = false;
					}
					if (def.nukethehiteffectsss)
					{
						val4.objectsToSpawn = (ObjectToSpawn[])(object)new ObjectToSpawn[0];
						val4.hitEvents = (HitEvents[])(object)new HitEvents[0];
						val4.onUnitsEvent = (HitEvents[])(object)new HitEvents[0];
					}
				}
				CollisionWeapon[] componentsInChildren2 = val3.GetComponentsInChildren<CollisionWeapon>(true);
				foreach (CollisionWeapon val5 in componentsInChildren2)
				{
					if (!float.IsNaN(def.howhardhittt))
					{
						val5.damage = def.howhardhittt;
					}
					if (!float.IsNaN(def.howhardflingg))
					{
						val5.onImpactForce = def.howhardflingg;
					}
				}
				if (def.nukethehiteffectsss)
				{
					ProjectileHitEffect[] componentsInChildren3 = val3.GetComponentsInChildren<ProjectileHitEffect>(true);
					foreach (ProjectileHitEffect val6 in componentsInChildren3)
					{
						if (!(val6 is ProjectileSound) && !(val6 is ProjectileBounce))
						{
							Object.DestroyImmediate((Object)(object)val6);
						}
					}
					CollisionWeaponEffect[] componentsInChildren4 = val3.GetComponentsInChildren<CollisionWeaponEffect>(true);
					for (int i = 0; i < componentsInChildren4.Length; i++)
					{
						Object.DestroyImmediate((Object)(object)componentsInChildren4[i]);
					}
				}
				if (def.hiteffectcomp != null)
				{
					ProjectileHit componentInChildren4 = val3.GetComponentInChildren<ProjectileHit>(true);
					if ((Object)(object)componentInChildren4 != (Object)null)
					{
						((Component)componentInChildren4).gameObject.AddComponent(def.hiteffectcomp);
					}
				}
				MoveTransform[] componentsInChildren5 = val3.GetComponentsInChildren<MoveTransform>(true);
				foreach (MoveTransform obj in componentsInChildren5)
				{
					obj.selfImpulse *= def.howfastshotttt;
				}
				makdamuzeffebetterr(val3, def);
				val2.ObjectToSpawn = val3;
				if (def.dacompone == null && (Object)(object)componentInChildren3 != (Object)null)
				{
					componentInChildren3.Entity.GUID = new DatabaseID(738201500, 1000 + def.localid);
					getprivatefield<Dictionary<DatabaseID, Object>>(ContentDatabase.Instance().AssetLoader, "m_nonStreamableAssets")[componentInChildren3.Entity.GUID] = (Object)(object)val3;
					getprivatefield<Dictionary<DatabaseID, GameObject>>(ContentDatabase.Instance().LandfallContentDatabase, "m_projectiles")[componentInChildren3.Entity.GUID] = val3;
				}
			}
		}
		makdamuzeffebetterr(val, def);
		if (def.dacompone != null)
		{
			val.AddComponent(def.dacompone);
		}
		LandfallContentDatabase landfallContentDatabase = ContentDatabase.Instance().LandfallContentDatabase;
		Dictionary<DatabaseID, Object> dictionary = getprivatefield<Dictionary<DatabaseID, Object>>(ContentDatabase.Instance().AssetLoader, "m_nonStreamableAssets");
		Dictionary<DatabaseID, GameObject> dictionary2 = getprivatefield<Dictionary<DatabaseID, GameObject>>(landfallContentDatabase, "m_weapons");
		dictionary[((CharacterItem)componentInChildren).Entity.GUID] = (Object)(object)val;
		dictionary2[((CharacterItem)componentInChildren).Entity.GUID] = val;
		((BaseUnityPlugin)this).Logger.LogInfo((object)(def.name + " is now a weapon cuz of turtle's weapons mod yayyyyyyy"));
	}

	private void makdamuzeffebetterr(GameObject thethinggg, weapondef def)
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		ParticleSystem[] componentsInChildren = thethinggg.GetComponentsInChildren<ParticleSystem>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			MainModule main = componentsInChildren[i].main;
			if (def.damuzcolourr.HasValue)
			{
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(def.damuzcolourr.Value);
			}
			((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * def.howbigmuzlpart;
			((MainModule)(ref main)).startSpeedMultiplier = ((MainModule)(ref main)).startSpeedMultiplier * def.howfastaredamuzlef;
		}
		if (def.damuzcolourr.HasValue)
		{
			Color value = def.damuzcolourr.Value;
			TrailRenderer[] componentsInChildren2 = thethinggg.GetComponentsInChildren<TrailRenderer>(true);
			foreach (TrailRenderer obj in componentsInChildren2)
			{
				obj.startColor = value;
				obj.endColor = new Color(value.r, value.g, value.b, 0f);
			}
		}
	}

	private GameObject findtheweaponnn(string namehassss)
	{
		Dictionary<string, string> language = Localizer.GetLanguage((Language)0);
		foreach (GameObject weapon in ContentDatabase.Instance().LandfallContentDatabase.GetWeapons())
		{
			if (!((Object)(object)weapon == (Object)null))
			{
				WeaponItem componentInChildren = weapon.GetComponentInChildren<WeaponItem>(true);
				string text = (((Object)(object)componentInChildren != (Object)null) ? ((CharacterItem)componentInChildren).Entity.Name : ((Object)weapon).name);
				if (!language.TryGetValue(text, out var value))
				{
					value = text;
				}
				if (value.ToLowerInvariant() == namehassss.ToLowerInvariant())
				{
					return weapon;
				}
			}
		}
		return null;
	}

	private static T getprivatefield<T>(object obj, string fieldname)
	{
		FieldInfo fieldInfo = getanyfieldd(obj.GetType(), fieldname);
		if (fieldInfo == null)
		{
			return default(T);
		}
		return (T)fieldInfo.GetValue(obj);
	}

	private static FieldInfo getanyfieldd(Type t, string fieldname)
	{
		while (t != null)
		{
			FieldInfo field = t.GetField(fieldname, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			if (field != null)
			{
				return field;
			}
			t = t.BaseType;
		}
		return null;
	}
}