Decompiled source of DragoDragonborn v1.0.4

plugins\DragoAmphib.dll

Decompiled 3 days ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DragoAmphib;

[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.blahbeany.dragoamphib", "Dragonforged Amphibious Gun-Buggy", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	private static AudioClip _gunClip;

	private void Awake()
	{
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		int num = 22050;
		_gunClip = AudioClip.Create("TurretShot", num / 8, 1, num, false);
		float[] array = new float[num / 8];
		for (int i = 0; i < array.Length; i++)
		{
			float num2 = (float)i / (float)num;
			array[i] = Mathf.Clamp(((Random.value * 2f - 1f) * 0.7f + Mathf.Sin((float)Math.PI * 260f * num2) * 0.4f) * Mathf.Exp((0f - num2) * 32f), -1f, 1f);
		}
		_gunClip.SetData(array, 0);
		PrefabManager.OnVanillaPrefabsAvailable += RegisterContent;
		new Harmony("com.blahbeany.dragoamphib").PatchAll();
	}

	private void RegisterContent()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Expected O, but got Unknown
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Expected O, but got Unknown
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Expected O, but got Unknown
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Expected O, but got Unknown
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Expected O, but got Unknown
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Expected O, but got Unknown
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Expected O, but got Unknown
		//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Expected O, but got Unknown
		//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d5: Expected O, but got Unknown
		//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Expected O, but got Unknown
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: Expected O, but got Unknown
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0385: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: Expected O, but got Unknown
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Expected O, but got Unknown
		//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03de: Expected O, but got Unknown
		//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0400: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Expected O, but got Unknown
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_045f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0473: Unknown result type (might be due to invalid IL or missing references)
		//IL_049d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04db: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_0519: Unknown result type (might be due to invalid IL or missing references)
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0668: Unknown result type (might be due to invalid IL or missing references)
		//IL_066f: Expected O, but got Unknown
		//IL_0699: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_072a: Unknown result type (might be due to invalid IL or missing references)
		//IL_073e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0772: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_061a: Unknown result type (might be due to invalid IL or missing references)
		ItemConfig val = new ItemConfig();
		val.Name = "Dragonforged 7.62mm Rounds";
		val.Description = "High-velocity belt-fed ammunition for the Amphibious Gun-Buggy.";
		val.Amount = 50;
		val.CraftingStation = CraftingStations.Forge;
		val.MinStationLevel = 1;
		RequirementConfig[] array = (RequirementConfig[])(object)new RequirementConfig[3];
		RequirementConfig[] array2 = array;
		RequirementConfig val2 = new RequirementConfig();
		val2.Item = "Iron";
		val2.Amount = 2;
		array2[0] = val2;
		RequirementConfig[] array3 = array;
		RequirementConfig val3 = new RequirementConfig();
		val3.Item = "Wood";
		val3.Amount = 2;
		array3[1] = val3;
		RequirementConfig[] array4 = array;
		RequirementConfig val4 = new RequirementConfig();
		val4.Item = "Coal";
		val4.Amount = 1;
		array4[2] = val4;
		val.Requirements = array;
		CustomItem val5 = new CustomItem("DragoTurretAmmo", "ArrowIron", val);
		val5.ItemDrop.m_itemData.m_shared.m_maxStackSize = 200;
		ItemManager.Instance.AddItem(val5);
		PieceConfig val6 = new PieceConfig();
		val6.Name = "Dragonforged Amphibious Buggy";
		val6.Description = "2-seater amphibious scout car with trunk storage, [B] ship mag-lock, and roof machine gun.";
		val6.PieceTable = "Hammer";
		val6.Category = "Misc";
		array = (RequirementConfig[])(object)new RequirementConfig[5];
		RequirementConfig[] array5 = array;
		RequirementConfig val7 = new RequirementConfig();
		val7.Item = "FineWood";
		val7.Amount = 20;
		val7.Recover = true;
		array5[0] = val7;
		RequirementConfig[] array6 = array;
		RequirementConfig val8 = new RequirementConfig();
		val8.Item = "Iron";
		val8.Amount = 15;
		val8.Recover = true;
		array6[1] = val8;
		RequirementConfig[] array7 = array;
		RequirementConfig val9 = new RequirementConfig();
		val9.Item = "Bronze";
		val9.Amount = 10;
		val9.Recover = true;
		array7[2] = val9;
		RequirementConfig[] array8 = array;
		RequirementConfig val10 = new RequirementConfig();
		val10.Item = "LoxPelt";
		val10.Amount = 6;
		val10.Recover = true;
		array8[3] = val10;
		RequirementConfig[] array9 = array;
		RequirementConfig val11 = new RequirementConfig();
		val11.Item = "SurtlingCore";
		val11.Amount = 4;
		val11.Recover = true;
		array9[4] = val11;
		val6.Requirements = array;
		CustomPiece val12 = new CustomPiece("DragoAmphibCar", "piece_chest_wood", val6);
		GameObject piecePrefab = val12.PiecePrefab;
		Renderer[] componentsInChildren = piecePrefab.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val13 in componentsInChildren)
		{
			val13.enabled = false;
		}
		Collider[] componentsInChildren2 = piecePrefab.GetComponentsInChildren<Collider>(true);
		foreach (Collider val14 in componentsInChildren2)
		{
			Object.DestroyImmediate((Object)(object)val14);
		}
		Container component = piecePrefab.GetComponent<Container>();
		if ((Object)(object)component != (Object)null)
		{
			component.m_name = "Buggy Rear Trunk";
			component.m_width = 4;
			component.m_height = 4;
		}
		Rigidbody val15 = piecePrefab.GetComponent<Rigidbody>() ?? piecePrefab.AddComponent<Rigidbody>();
		val15.mass = 650f;
		val15.drag = 0.4f;
		val15.angularDrag = 2.5f;
		val15.centerOfMass = new Vector3(0f, 0.35f, 0f);
		BoxCollider val16 = piecePrefab.AddComponent<BoxCollider>();
		val16.center = new Vector3(0f, 0.65f, 0f);
		val16.size = new Vector3(1.85f, 0.75f, 3.3f);
		Shader val17 = Shader.Find("Custom/Piece") ?? Shader.Find("Standard");
		Material val18 = new Material(val17);
		val18.color = new Color(0.18f, 0.22f, 0.19f);
		Material arg = val18;
		Material val19 = new Material(val17);
		val19.color = new Color(0.85f, 0.65f, 0.18f);
		Material arg2 = val19;
		Material val20 = new Material(val17);
		val20.color = new Color(0.08f, 0.08f, 0.09f);
		Material sharedMaterial = val20;
		Material val21 = new Material(val17);
		val21.color = new Color(0.25f, 0.27f, 0.3f);
		Material arg3 = val21;
		Action<string, PrimitiveType, Vector3, Vector3, Material, Transform> action = delegate(string nm, PrimitiveType pt, Vector3 pos, Vector3 sc, Material mat, Transform par)
		{
			//IL_0001: 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_003e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val24 = GameObject.CreatePrimitive(pt);
			((Object)val24).name = nm;
			Object.DestroyImmediate((Object)(object)val24.GetComponent<Collider>());
			val24.transform.SetParent(par, false);
			val24.transform.localPosition = pos;
			val24.transform.localScale = sc;
			val24.GetComponent<Renderer>().sharedMaterial = mat;
		};
		action("Hull", (PrimitiveType)3, new Vector3(0f, 0.58f, 0f), new Vector3(1.8f, 0.55f, 3.2f), arg, piecePrefab.transform);
		action("Hood", (PrimitiveType)3, new Vector3(0f, 0.85f, 1.05f), new Vector3(1.65f, 0.35f, 1.05f), arg, piecePrefab.transform);
		action("Trim", (PrimitiveType)3, new Vector3(0f, 0.87f, 0.2f), new Vector3(1.86f, 0.08f, 3.25f), arg2, piecePrefab.transform);
		action("TrunkBox", (PrimitiveType)3, new Vector3(0f, 0.98f, -1.15f), new Vector3(1.55f, 0.48f, 0.82f), arg2, piecePrefab.transform);
		float[] array10 = new float[2] { -0.98f, 0.98f };
		foreach (float num in array10)
		{
			float[] array11 = new float[2] { 1.15f, -1.15f };
			foreach (float num3 in array11)
			{
				GameObject val22 = GameObject.CreatePrimitive((PrimitiveType)2);
				Object.DestroyImmediate((Object)(object)val22.GetComponent<Collider>());
				val22.transform.SetParent(piecePrefab.transform, false);
				val22.transform.localPosition = new Vector3(num, 0.42f, num3);
				val22.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
				val22.transform.localScale = new Vector3(0.84f, 0.22f, 0.84f);
				val22.GetComponent<Renderer>().sharedMaterial = sharedMaterial;
			}
		}
		GameObject val23 = new GameObject("TurretPivot");
		val23.transform.SetParent(piecePrefab.transform, false);
		val23.transform.localPosition = new Vector3(0f, 1.25f, -0.35f);
		action("Mount", (PrimitiveType)2, Vector3.zero, new Vector3(0.28f, 0.35f, 0.28f), arg, val23.transform);
		action("Receiver", (PrimitiveType)3, new Vector3(0f, 0.35f, 0.1f), new Vector3(0.22f, 0.24f, 0.65f), arg3, val23.transform);
		action("Barrel", (PrimitiveType)2, new Vector3(0f, 0.37f, 0.78f), new Vector3(0.06f, 0.55f, 0.06f), arg3, val23.transform);
		val23.transform.Find("Barrel").localRotation = Quaternion.Euler(90f, 0f, 0f);
		piecePrefab.AddComponent<AmphibController>();
		PieceManager.Instance.AddPiece(val12);
		PrefabManager.OnVanillaPrefabsAvailable -= RegisterContent;
	}

	public static void PlayShot(Vector3 pos)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_gunClip != (Object)null)
		{
			AudioSource.PlayClipAtPoint(_gunClip, pos, 0.85f);
		}
	}
}
public class AmphibController : MonoBehaviour
{
	private Rigidbody _rb;

	private Transform _turret;

	private Container _trunk;

	private bool _isDriver = false;

	private bool _isGunner = false;

	private bool _magLocked = false;

	private Transform _lockedDeck;

	private Vector3 _lockLocalPos;

	private Quaternion _lockLocalRot;

	private float _fireTimer = 0f;

	private void Awake()
	{
		_rb = ((Component)this).GetComponent<Rigidbody>();
		_turret = ((Component)this).transform.Find("TurretPivot");
		_trunk = ((Component)this).GetComponent<Container>();
	}

	private bool ConsumeRound(Player p)
	{
		Inventory inventory = ((Humanoid)p).GetInventory();
		ItemData val = ((inventory != null) ? inventory.GetItem("Dragonforged 7.62mm Rounds", -1, false) : null);
		if (val != null)
		{
			inventory.RemoveOneItem(val);
			return true;
		}
		if ((Object)(object)_trunk != (Object)null && _trunk.GetInventory() != null)
		{
			ItemData item = _trunk.GetInventory().GetItem("Dragonforged 7.62mm Rounds", -1, false);
			if (item != null)
			{
				_trunk.GetInventory().RemoveOneItem(item);
				return true;
			}
		}
		return false;
	}

	private void Update()
	{
		//IL_009d: 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_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0338: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0342: Unknown result type (might be due to invalid IL or missing references)
		//IL_0409: Unknown result type (might be due to invalid IL or missing references)
		//IL_040e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0418: Unknown result type (might be due to invalid IL or missing references)
		//IL_041d: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0424: Unknown result type (might be due to invalid IL or missing references)
		//IL_042e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0433: 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_043b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0440: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Unknown result type (might be due to invalid IL or missing references)
		//IL_044a: Unknown result type (might be due to invalid IL or missing references)
		//IL_044c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0231: Unknown result type (might be due to invalid IL or missing references)
		//IL_023c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0241: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_0495: Unknown result type (might be due to invalid IL or missing references)
		//IL_049c: Expected O, but got Unknown
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			_isDriver = false;
			_isGunner = false;
			return;
		}
		if (_fireTimer > 0f)
		{
			_fireTimer -= Time.deltaTime;
		}
		bool flag = TextInput.IsVisible() || Minimap.InTextInput() || Console.IsVisible() || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || StoreGui.IsVisible();
		float num = Vector3.Distance(((Component)localPlayer).transform.position, ((Component)this).transform.position);
		RaycastHit val = default(RaycastHit);
		if (!flag && !InventoryGui.IsVisible() && !Menu.IsVisible())
		{
			if (num <= 3.6f && Input.GetKeyDown((KeyCode)102) && !_isGunner)
			{
				_isDriver = !_isDriver;
				if (_isDriver)
				{
					_magLocked = false;
				}
				((Character)localPlayer).Message((MessageType)1, _isDriver ? "Amphibious Buggy: Driver Seat [WASD Drive | B Mag-Lock | F Exit]" : "Exited Driver Seat", 0, (Sprite)null, false);
			}
			if (num <= 3.6f && Input.GetKeyDown((KeyCode)116) && !_isDriver)
			{
				_isGunner = !_isGunner;
				((Character)localPlayer).Message((MessageType)1, _isGunner ? "Amphibious Buggy: Gunner Turret [LMB Fire 7.62mm | T Exit]" : "Exited Gunner Turret", 0, (Sprite)null, false);
			}
			if (_isDriver && Input.GetKeyDown((KeyCode)98))
			{
				_magLocked = !_magLocked;
				if (_magLocked && Physics.Raycast(((Component)this).transform.position + Vector3.up, Vector3.down, ref val, 4f))
				{
					_lockedDeck = ((RaycastHit)(ref val)).transform;
					_lockLocalPos = _lockedDeck.InverseTransformPoint(((Component)this).transform.position);
					_lockLocalRot = Quaternion.Inverse(_lockedDeck.rotation) * ((Component)this).transform.rotation;
				}
				((Character)localPlayer).Message((MessageType)2, _magLocked ? "SHIP DECK MAG-LOCK ENGAGED" : "Mag-Lock Released", 0, (Sprite)null, false);
			}
		}
		if (_isDriver)
		{
			((Component)localPlayer).transform.position = ((Component)this).transform.TransformPoint(new Vector3(0f, 0.72f, 0.15f));
			((Component)localPlayer).transform.rotation = ((Component)this).transform.rotation;
		}
		else if (_isGunner)
		{
			((Component)localPlayer).transform.position = ((Component)this).transform.TransformPoint(new Vector3(0f, 1.05f, -0.45f));
			if ((Object)(object)_turret != (Object)null)
			{
				_turret.rotation = Quaternion.LookRotation(new Vector3(((Character)localPlayer).GetLookDir().x, 0f, ((Character)localPlayer).GetLookDir().z), Vector3.up);
			}
		}
		if (((!_isGunner || !Input.GetMouseButton(0)) && (!_isDriver || !Input.GetKey((KeyCode)104))) || !(_fireTimer <= 0f))
		{
			return;
		}
		_fireTimer = 0.11f;
		if (!ConsumeRound(localPlayer))
		{
			((Character)localPlayer).Message((MessageType)1, "Out of Dragonforged 7.62mm Rounds! (Check Inventory or Rear Trunk)", 0, (Sprite)null, false);
			_fireTimer = 0.6f;
			return;
		}
		Vector3 val2 = (((Object)(object)_turret != (Object)null) ? (_turret.position + Vector3.up * 0.37f) : (((Component)this).transform.position + Vector3.up * 1.6f)) + ((Character)localPlayer).GetLookDir() * 1.1f;
		Vector3 lookDir = ((Character)localPlayer).GetLookDir();
		Plugin.PlayShot(val2);
		if (Physics.Raycast(val2, lookDir, ref val, 140f))
		{
			Character componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Character>();
			if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent != (Object)(object)localPlayer)
			{
				HitData val3 = new HitData();
				val3.m_point = ((RaycastHit)(ref val)).point;
				val3.m_dir = lookDir;
				val3.m_pushForce = 12f;
				HitData val4 = val3;
				val4.m_damage.m_pierce = 28f;
				val4.m_damage.m_fire = 8f;
				val4.SetAttacker((Character)(object)localPlayer);
				componentInParent.Damage(val4);
			}
		}
	}

	private void FixedUpdate()
	{
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0112: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)_rb == (Object)null)
		{
			return;
		}
		if (_magLocked && (Object)(object)_lockedDeck != (Object)null)
		{
			_rb.isKinematic = true;
			((Component)this).transform.position = _lockedDeck.TransformPoint(_lockLocalPos);
			((Component)this).transform.rotation = _lockedDeck.rotation * _lockLocalRot;
			return;
		}
		_rb.isKinematic = false;
		float num = (((Object)(object)ZoneSystem.instance != (Object)null) ? ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position) : 0f);
		float num2 = 30f;
		float num3 = num2 - ((Component)this).transform.position.y;
		if (num3 > 0.15f)
		{
			_rb.AddForce(Vector3.up * Mathf.Clamp(num3 * 18f, 0f, 32f) * _rb.mass * Time.fixedDeltaTime * 15f);
			_rb.drag = 2.2f;
		}
		else
		{
			_rb.drag = 0.45f;
		}
		if (_isDriver)
		{
			float num4 = (Input.GetKey((KeyCode)119) ? 1f : 0f) - (Input.GetKey((KeyCode)115) ? 1f : 0f);
			float num5 = (Input.GetKey((KeyCode)100) ? 1f : 0f) - (Input.GetKey((KeyCode)97) ? 1f : 0f);
			_rb.AddForce(((Component)this).transform.forward * num4 * 14500f);
			_rb.AddTorque(Vector3.up * num5 * 3200f);
			if (Input.GetKey((KeyCode)32))
			{
				Rigidbody rb = _rb;
				rb.velocity *= 0.88f;
			}
		}
	}
}

plugins\DragoCrewNPC.dll

Decompiled 3 days ago
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DragoCrewNPC;

[BepInPlugin("com.blahbeany.dragocrewnpc", "Dragonborn 6-Crew Beds, Custom VRM & Equip Inventory", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public static readonly List<CrewBedLink> ActiveBeds = new List<CrewBedLink>();

	public static readonly string[] CrewNames = new string[6] { "Varek", "Kaelen", "Sora", "Drax", "Lyra", "Torin" };

	private void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		PrefabManager.OnVanillaPrefabsAvailable += RegisterBed;
		new Harmony("com.blahbeany.dragocrewnpc").PatchAll();
	}

	private void RegisterBed()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected O, but got Unknown
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Expected O, but got Unknown
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		PieceConfig val = new PieceConfig();
		val.Name = "Dragonborn Crew Bed";
		val.Description = "Spawns 1 persistent Dragonborn crewmate (max 6). [E] Open Gear Inventory | [H] Cycle Orders | [N] Fleet Recall.";
		val.PieceTable = "Hammer";
		val.Category = "Misc";
		RequirementConfig[] array = (RequirementConfig[])(object)new RequirementConfig[3];
		RequirementConfig val2 = new RequirementConfig();
		val2.Item = "FineWood";
		val2.Amount = 6;
		val2.Recover = true;
		array[0] = val2;
		RequirementConfig val3 = new RequirementConfig();
		val3.Item = "DeerHide";
		val3.Amount = 4;
		val3.Recover = true;
		array[1] = val3;
		RequirementConfig val4 = new RequirementConfig();
		val4.Item = "Iron";
		val4.Amount = 2;
		val4.Recover = true;
		array[2] = val4;
		val.Requirements = array;
		CustomPiece val5 = new CustomPiece("DragoCrewBed", "piece_bed02", val);
		GameObject piecePrefab = val5.PiecePrefab;
		Container val6 = piecePrefab.GetComponent<Container>() ?? piecePrefab.AddComponent<Container>();
		val6.m_name = "Crewmate Gear & Loot";
		val6.m_width = 4;
		val6.m_height = 3;
		piecePrefab.AddComponent<CrewBedLink>();
		PieceManager.Instance.AddPiece(val5);
		PrefabManager.OnVanillaPrefabsAvailable -= RegisterBed;
	}
}
public class CrewBedLink : MonoBehaviour
{
	public Humanoid CrewNpc;

	public int SlotIndex = 0;

	public int OrderMode = 0;

	private Container _gearBox;

	private float _aiTimer = 0f;

	private float _atkTimer = 0f;

	private void Start()
	{
		if (!Plugin.ActiveBeds.Contains(this))
		{
			if (Plugin.ActiveBeds.Count >= 6)
			{
				if ((Object)(object)Player.m_localPlayer != (Object)null)
				{
					((Character)Player.m_localPlayer).Message((MessageType)2, "Max 6 Crew Beds Reached!", 0, (Sprite)null, false);
				}
				return;
			}
			SlotIndex = Plugin.ActiveBeds.Count;
			Plugin.ActiveBeds.Add(this);
		}
		_gearBox = ((Component)this).GetComponent<Container>();
		SpawnCrewmate();
	}

	private void OnDestroy()
	{
		Plugin.ActiveBeds.Remove(this);
		if ((Object)(object)CrewNpc != (Object)null)
		{
			Object.Destroy((Object)(object)((Component)CrewNpc).gameObject);
		}
	}

	private void SpawnCrewmate()
	{
		//IL_004f: 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_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? (ZNetScene.instance.GetPrefab("Dverger") ?? ZNetScene.instance.GetPrefab("Player")) : null);
		if (!((Object)(object)val == (Object)null))
		{
			GameObject val2 = Object.Instantiate<GameObject>(val, ((Component)this).transform.position + ((Component)this).transform.right * 1.1f + Vector3.up * 0.2f, ((Component)this).transform.rotation);
			CrewNpc = val2.GetComponent<Humanoid>();
			if ((Object)(object)CrewNpc != (Object)null)
			{
				((Character)CrewNpc).m_name = Plugin.CrewNames[SlotIndex % Plugin.CrewNames.Length];
				((Character)CrewNpc).m_faction = (Faction)0;
				((Character)CrewNpc).SetTamed(true);
				((Character)CrewNpc).SetMaxHealth(450f);
				((Character)CrewNpc).Heal(450f, true);
			}
			CrewNpcTag crewNpcTag = val2.AddComponent<CrewNpcTag>();
			crewNpcTag.Bed = this;
		}
	}

	private void SyncEquipment()
	{
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Invalid comparison between Unknown and I4
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Invalid comparison between Unknown and I4
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Invalid comparison between Unknown and I4
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Invalid comparison between Unknown and I4
		//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Invalid comparison between Unknown and I4
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Invalid comparison between Unknown and I4
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cb: Invalid comparison between Unknown and I4
		//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Invalid comparison between Unknown and I4
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Invalid comparison between Unknown and I4
		if ((Object)(object)CrewNpc == (Object)null || (Object)(object)_gearBox == (Object)null || _gearBox.GetInventory() == null)
		{
			return;
		}
		Inventory inventory = CrewNpc.GetInventory();
		if (inventory == null)
		{
			return;
		}
		inventory.RemoveAll();
		foreach (ItemData allItem in _gearBox.GetInventory().GetAllItems())
		{
			if (allItem != null)
			{
				ItemData val = allItem.Clone();
				inventory.AddItem(val);
				ItemType itemType = val.m_shared.m_itemType;
				if ((int)itemType == 3 || (int)itemType == 14 || (int)itemType == 22 || (int)itemType == 4 || (int)itemType == 5 || (int)itemType == 6 || (int)itemType == 7 || (int)itemType == 11 || (int)itemType == 17)
				{
					CrewNpc.EquipItem(val, false);
				}
			}
		}
	}

	private void Update()
	{
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_035c: Unknown result type (might be due to invalid IL or missing references)
		//IL_036c: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0585: Unknown result type (might be due to invalid IL or missing references)
		//IL_0425: Unknown result type (might be due to invalid IL or missing references)
		//IL_042a: Unknown result type (might be due to invalid IL or missing references)
		//IL_042c: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06df: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_070d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0712: Unknown result type (might be due to invalid IL or missing references)
		//IL_0714: Unknown result type (might be due to invalid IL or missing references)
		//IL_0724: Unknown result type (might be due to invalid IL or missing references)
		//IL_073b: Unknown result type (might be due to invalid IL or missing references)
		//IL_074b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0755: Unknown result type (might be due to invalid IL or missing references)
		//IL_075f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0764: Unknown result type (might be due to invalid IL or missing references)
		//IL_0465: 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_047f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0489: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04da: Unknown result type (might be due to invalid IL or missing references)
		//IL_04df: Unknown result type (might be due to invalid IL or missing references)
		//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f2: Expected O, but got Unknown
		//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0500: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_050a: Unknown result type (might be due to invalid IL or missing references)
		//IL_051c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0521: Unknown result type (might be due to invalid IL or missing references)
		//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e3: Expected O, but got Unknown
		//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0650: Unknown result type (might be due to invalid IL or missing references)
		//IL_0657: Expected O, but got Unknown
		//IL_0660: Unknown result type (might be due to invalid IL or missing references)
		//IL_0665: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)CrewNpc == (Object)null || ((Character)CrewNpc).IsDead())
		{
			_aiTimer += Time.deltaTime;
			if (_aiTimer > 8f)
			{
				_aiTimer = 0f;
				SpawnCrewmate();
			}
			return;
		}
		_aiTimer += Time.deltaTime;
		_atkTimer = Mathf.Max(0f, _atkTimer - Time.deltaTime);
		if (_aiTimer >= 1.2f)
		{
			_aiTimer = 0f;
			SyncEquipment();
		}
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer != (Object)null && !TextInput.IsVisible() && !Minimap.InTextInput() && !Console.IsVisible())
		{
			if (Input.GetKeyDown((KeyCode)110) && SlotIndex == 0)
			{
				foreach (CrewBedLink activeBed in Plugin.ActiveBeds)
				{
					activeBed.OrderMode = 1;
					if ((Object)(object)activeBed.CrewNpc != (Object)null)
					{
						((Component)activeBed.CrewNpc).transform.position = ((Component)activeBed).transform.position + Vector3.up * 0.4f;
					}
				}
				((Character)localPlayer).Message((MessageType)2, "FLEET WHISTLE: All Crew Recalled to Ship Beds!", 0, (Sprite)null, false);
			}
			if (Vector3.Distance(((Component)localPlayer).transform.position, ((Component)CrewNpc).transform.position) <= 3.5f)
			{
				if (Input.GetKeyDown((KeyCode)101) && (Object)(object)_gearBox != (Object)null)
				{
					_gearBox.Interact((Humanoid)(object)localPlayer, false, false);
				}
				if (Input.GetKeyDown((KeyCode)104))
				{
					OrderMode = (OrderMode + 1) % 4;
					string[] array = new string[4] { "Follow & Fight", "Guard Ship Deck", "Man Buggy Turret", "Gather Wood & Ore" };
					((Character)localPlayer).Message((MessageType)2, ((Character)CrewNpc).m_name + ": " + array[OrderMode], 0, (Sprite)null, false);
				}
			}
		}
		Vector3 val = ((OrderMode == 0 && (Object)(object)localPlayer != (Object)null) ? ((Component)localPlayer).transform.position : ((Component)this).transform.position);
		if (Vector3.Distance(((Component)CrewNpc).transform.position, val) > 38f)
		{
			((Component)CrewNpc).transform.position = val + Vector3.up * 0.6f;
		}
		Character val2 = null;
		float num = 22f;
		foreach (Character allCharacter in Character.GetAllCharacters())
		{
			if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)CrewNpc) && !allCharacter.IsPlayer() && !allCharacter.IsTamed())
			{
				float num2 = Vector3.Distance(((Component)allCharacter).transform.position, ((Component)CrewNpc).transform.position);
				if (num2 < num)
				{
					num = num2;
					val2 = allCharacter;
				}
			}
		}
		if ((Object)(object)val2 != (Object)null)
		{
			Vector3 val3 = ((Component)val2).transform.position - ((Component)CrewNpc).transform.position;
			val3.y = 0f;
			if (((Vector3)(ref val3)).sqrMagnitude > 0.1f)
			{
				((Component)CrewNpc).transform.rotation = Quaternion.Slerp(((Component)CrewNpc).transform.rotation, Quaternion.LookRotation(val3), Time.deltaTime * 8f);
			}
			if (num > 3.2f)
			{
				Transform transform = ((Component)CrewNpc).transform;
				transform.position += ((Component)CrewNpc).transform.forward * 4.5f * Time.deltaTime;
			}
			else if (_atkTimer <= 0f)
			{
				_atkTimer = 1.4f;
				ItemData currentWeapon = CrewNpc.GetCurrentWeapon();
				float num3;
				if (currentWeapon == null)
				{
					num3 = 28f;
				}
				else
				{
					DamageTypes damage = currentWeapon.GetDamage();
					num3 = ((DamageTypes)(ref damage)).GetTotalDamage();
				}
				float slash = num3;
				HitData val4 = new HitData();
				val4.m_point = ((Component)val2).transform.position + Vector3.up;
				val4.m_dir = ((Component)CrewNpc).transform.forward;
				val4.m_pushForce = 12f;
				HitData val5 = val4;
				val5.m_damage.m_slash = slash;
				val5.SetAttacker((Character)(object)CrewNpc);
				val2.Damage(val5);
			}
		}
		else if (OrderMode == 3)
		{
			Collider[] array2 = Physics.OverlapSphere(((Component)CrewNpc).transform.position, 8f);
			foreach (Collider val6 in array2)
			{
				TreeBase componentInParent = ((Component)val6).GetComponentInParent<TreeBase>();
				if ((Object)(object)componentInParent != (Object)null && _atkTimer <= 0f)
				{
					_atkTimer = 1.2f;
					HitData val7 = new HitData();
					val7.m_point = ((Component)val6).transform.position;
					HitData val5 = val7;
					val5.m_damage.m_chop = 45f;
					componentInParent.Damage(val5);
					break;
				}
				Destructible componentInParent2 = ((Component)val6).GetComponentInParent<Destructible>();
				if ((Object)(object)componentInParent2 != (Object)null && _atkTimer <= 0f)
				{
					_atkTimer = 1.2f;
					HitData val8 = new HitData();
					val8.m_point = ((Component)val6).transform.position;
					HitData val5 = val8;
					val5.m_damage.m_pickaxe = 45f;
					componentInParent2.Damage(val5);
					break;
				}
			}
		}
		else if (Vector3.Distance(((Component)CrewNpc).transform.position, val) > 3.2f)
		{
			Vector3 val9 = val - ((Component)CrewNpc).transform.position;
			val9.y = 0f;
			((Component)CrewNpc).transform.rotation = Quaternion.Slerp(((Component)CrewNpc).transform.rotation, Quaternion.LookRotation(val9), Time.deltaTime * 6f);
			Transform transform2 = ((Component)CrewNpc).transform;
			transform2.position += ((Component)CrewNpc).transform.forward * 4.2f * Time.deltaTime;
		}
	}
}
public class CrewNpcTag : MonoBehaviour
{
	public CrewBedLink Bed;
}

plugins\DragoFirearm.dll

Decompiled 3 days ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DragoFirearm;

[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.blahbeany.dragofirearm", "Drago Marksman Rifle", "3.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	public const int MagCapacity = 10;

	public const float BaseReloadSeconds = 7f;

	public static SkillType FirearmsSkill;

	public static int CurrentMag = 10;

	public static bool IsReloading = false;

	public static float ReloadTimer = 0f;

	public static float ReloadDuration = 7f;

	public static bool IsScoped = false;

	public static float ScopeZoomFov = 20f;

	private static Texture2D _pixelTex;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Expected O, but got Unknown
		//IL_005a: 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)
		SkillManager instance = SkillManager.Instance;
		SkillConfig val = new SkillConfig();
		val.Identifier = "com.blahbeany.firearms";
		val.Name = "Firearms";
		val.Description = "Increases firearm damage and reload speed.";
		val.IncreaseStep = 1.2f;
		FirearmsSkill = instance.AddSkill(val);
		_pixelTex = new Texture2D(1, 1);
		_pixelTex.SetPixel(0, 0, Color.white);
		_pixelTex.Apply();
		PrefabManager.OnVanillaPrefabsAvailable += RegisterItems;
		new Harmony("com.blahbeany.dragofirearm").PatchAll();
	}

	private void RegisterItems()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Expected O, but got Unknown
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: Expected O, but got Unknown
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Expected O, but got Unknown
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Expected O, but got Unknown
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a3: Expected O, but got Unknown
		//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Expected O, but got Unknown
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Expected O, but got Unknown
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		ItemConfig val = new ItemConfig();
		val.Name = "Flint & Lead Shot";
		val.Description = "Ammo for Drago's Marksman Rifle.";
		val.CraftingStation = CraftingStations.Workbench;
		val.MinStationLevel = 1;
		val.Amount = 20;
		RequirementConfig[] array = (RequirementConfig[])(object)new RequirementConfig[2];
		RequirementConfig[] array2 = array;
		RequirementConfig val2 = new RequirementConfig();
		val2.Item = "Wood";
		val2.Amount = 2;
		array2[0] = val2;
		RequirementConfig[] array3 = array;
		RequirementConfig val3 = new RequirementConfig();
		val3.Item = "Flint";
		val3.Amount = 2;
		array3[1] = val3;
		val.Requirements = array;
		CustomItem val4 = new CustomItem("DragoLeadShot", "BoltBone", val);
		val4.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_drago_shot";
		val4.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 6f;
		val4.ItemDrop.m_itemData.m_shared.m_icons = PrefabManager.Instance.GetPrefab("BoltBone").GetComponent<ItemDrop>().m_itemData.m_shared.m_icons;
		ItemManager.Instance.AddItem(val4);
		ItemConfig val5 = new ItemConfig();
		val5.Name = "Dragonforged Marksman Rifle";
		val5.Description = "10-round Dragonborn sniper rifle with scope.";
		val5.CraftingStation = CraftingStations.Workbench;
		val5.MinStationLevel = 1;
		array = (RequirementConfig[])(object)new RequirementConfig[3];
		RequirementConfig[] array4 = array;
		RequirementConfig val6 = new RequirementConfig();
		val6.Item = "Wood";
		val6.Amount = 10;
		val6.Recover = true;
		array4[0] = val6;
		RequirementConfig[] array5 = array;
		RequirementConfig val7 = new RequirementConfig();
		val7.Item = "Flint";
		val7.Amount = 8;
		val7.Recover = true;
		array5[1] = val7;
		RequirementConfig[] array6 = array;
		RequirementConfig val8 = new RequirementConfig();
		val8.Item = "LeatherScraps";
		val8.Amount = 4;
		val8.Recover = true;
		array6[2] = val8;
		val5.Requirements = array;
		CustomItem val9 = new CustomItem("DragoFlintlockRifle", "CrossbowArbalest", val5);
		SharedData shared = val9.ItemDrop.m_itemData.m_shared;
		shared.m_skillType = FirearmsSkill;
		shared.m_ammoType = "$ammo_drago_shot";
		shared.m_maxQuality = 6;
		shared.m_damages.m_pierce = 16f;
		shared.m_damagesPerLevel.m_pierce = 10f;
		shared.m_damagesPerLevel.m_fire = 5f;
		shared.m_attack.m_bowDraw = false;
		shared.m_attack.m_requiresReload = false;
		shared.m_attack.m_projectileVel = 115f;
		shared.m_attack.m_projectileVelMin = 115f;
		shared.m_icons = PrefabManager.Instance.GetPrefab("CrossbowArbalest").GetComponent<ItemDrop>().m_itemData.m_shared.m_icons;
		ItemManager.Instance.AddItem(val9);
		PrefabManager.OnVanillaPrefabsAvailable -= RegisterItems;
	}

	private static void Part(Transform p, string n, PrimitiveType t, Vector3 pos, Vector3 sc, Material mat, Vector3 rot)
	{
		//IL_0001: 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_003d: 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)
		GameObject val = GameObject.CreatePrimitive(t);
		((Object)val).name = n;
		Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>());
		val.transform.SetParent(p, false);
		val.transform.localPosition = pos;
		val.transform.localScale = sc;
		val.transform.localEulerAngles = rot;
		val.GetComponent<Renderer>().sharedMaterial = mat;
	}

	private static void BuildUniqueRifle(Transform holder)
	{
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Expected O, but got Unknown
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: Expected O, but got Unknown
		//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_00f5: Expected O, but got Unknown
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Expected O, but got Unknown
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0233: 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_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0274: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02da: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_0315: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0351: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_041c: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)holder == (Object)null) && !((Object)(object)holder.Find("DragoRifleMesh") != (Object)null))
		{
			Renderer[] componentsInChildren = ((Component)holder).GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val in componentsInChildren)
			{
				val.enabled = false;
			}
			Shader val2 = Shader.Find("Custom/Piece") ?? Shader.Find("Standard");
			Material val3 = new Material(val2);
			val3.color = new Color(0.3f, 0.14f, 0.05f);
			Material mat = val3;
			Material val4 = new Material(val2);
			val4.color = new Color(0.14f, 0.15f, 0.18f);
			Material mat2 = val4;
			Material val5 = new Material(val2);
			val5.color = new Color(0.85f, 0.64f, 0.16f);
			Material mat3 = val5;
			Material val6 = new Material(val2);
			val6.color = new Color(0.1f, 0.78f, 0.95f);
			Material mat4 = val6;
			GameObject val7 = new GameObject("DragoRifleMesh");
			val7.transform.SetParent(holder, false);
			val7.transform.localPosition = new Vector3(0f, 0.02f, 0.12f);
			val7.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
			Part(val7.transform, "Stock", (PrimitiveType)3, new Vector3(0f, -0.045f, -0.38f), new Vector3(0.055f, 0.14f, 0.34f), mat, new Vector3(12f, 0f, 0f));
			Part(val7.transform, "Forend", (PrimitiveType)3, new Vector3(0f, -0.015f, 0.24f), new Vector3(0.052f, 0.068f, 0.48f), mat, Vector3.zero);
			Part(val7.transform, "Receiver", (PrimitiveType)3, new Vector3(0f, 0.025f, -0.04f), new Vector3(0.06f, 0.078f, 0.3f), mat2, Vector3.zero);
			Part(val7.transform, "Barrel", (PrimitiveType)2, new Vector3(0f, 0.036f, 0.54f), new Vector3(0.028f, 0.46f, 0.028f), mat2, new Vector3(90f, 0f, 0f));
			Part(val7.transform, "Muzzle", (PrimitiveType)2, new Vector3(0f, 0.036f, 1f), new Vector3(0.042f, 0.045f, 0.042f), mat3, new Vector3(90f, 0f, 0f));
			Part(val7.transform, "Mag10", (PrimitiveType)3, new Vector3(0f, -0.105f, 0.04f), new Vector3(0.044f, 0.18f, 0.1f), mat2, new Vector3(-14f, 0f, 0f));
			Part(val7.transform, "Scope", (PrimitiveType)2, new Vector3(0f, 0.115f, -0.02f), new Vector3(0.04f, 0.21f, 0.04f), mat2, new Vector3(90f, 0f, 0f));
			Part(val7.transform, "Bell", (PrimitiveType)2, new Vector3(0f, 0.115f, 0.2f), new Vector3(0.058f, 0.055f, 0.058f), mat3, new Vector3(90f, 0f, 0f));
			Part(val7.transform, "Lens", (PrimitiveType)2, new Vector3(0f, 0.115f, 0.256f), new Vector3(0.05f, 0.005f, 0.05f), mat4, new Vector3(90f, 0f, 0f));
		}
	}

	private void Update()
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			IsScoped = false;
			IsReloading = false;
			return;
		}
		ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon();
		if (currentWeapon == null || currentWeapon.m_shared.m_skillType != FirearmsSkill)
		{
			IsScoped = false;
			IsReloading = false;
			return;
		}
		Transform[] array = Object.FindObjectsOfType<Transform>();
		foreach (Transform val in array)
		{
			if ((Object)(object)val != (Object)null && ((Object)val).name.Contains("RightHand_Attach") && val.childCount > 0 && Vector3.Distance(val.position, ((Component)localPlayer).transform.position) < 2.2f)
			{
				BuildUniqueRifle(val.GetChild(0));
			}
		}
		if (Input.GetKeyDown((KeyCode)114) && !TextInput.IsVisible() && !Minimap.InTextInput() && !Console.IsVisible() && !IsReloading && CurrentMag < 10)
		{
			StartReload(localPlayer);
		}
		if (IsReloading)
		{
			IsScoped = false;
			ReloadTimer -= Time.deltaTime;
			if (ReloadTimer <= 0f)
			{
				IsReloading = false;
				CurrentMag = 10;
				((Character)localPlayer).Message((MessageType)1, "Rifle Reloaded (10/10)", 0, (Sprite)null, false);
			}
			return;
		}
		IsScoped = Input.GetMouseButton(1) && !InventoryGui.IsVisible() && !Menu.IsVisible();
		if (IsScoped)
		{
			float axis = Input.GetAxis("Mouse ScrollWheel");
			if (Mathf.Abs(axis) > 0.001f)
			{
				ScopeZoomFov = Mathf.Clamp(ScopeZoomFov - axis * 25f, 12f, 32f);
			}
		}
	}

	public static void StartReload(Player p)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		if (!IsReloading)
		{
			ReloadDuration = 7f / (1f + ((Character)p).GetSkillLevel(FirearmsSkill) / 100f);
			ReloadTimer = ReloadDuration;
			IsReloading = true;
			IsScoped = false;
			((Character)p).Message((MessageType)2, $"Reloading... ({ReloadDuration:0.0}s)", 0, (Sprite)null, false);
		}
	}

	private void OnGUI()
	{
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01be: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: Expected O, but got Unknown
		//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: 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_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		GUI.depth = -1000;
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			return;
		}
		ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon();
		if (currentWeapon != null && currentWeapon.m_shared.m_skillType == FirearmsSkill)
		{
			float num = Screen.width;
			float num2 = Screen.height;
			if (IsScoped && (Object)(object)_pixelTex != (Object)null)
			{
				GUI.color = new Color(0f, 0f, 0f, 0.72f);
				float num3 = num2 * 0.68f;
				float num4 = (num - num3) * 0.5f;
				float num5 = (num2 - num3) * 0.5f;
				GUI.DrawTexture(new Rect(0f, 0f, num4, num2), (Texture)(object)_pixelTex);
				GUI.DrawTexture(new Rect(num - num4, 0f, num4, num2), (Texture)(object)_pixelTex);
				GUI.DrawTexture(new Rect(num4, 0f, num3, num5), (Texture)(object)_pixelTex);
				GUI.DrawTexture(new Rect(num4, num2 - num5, num3, num5), (Texture)(object)_pixelTex);
				GUI.color = new Color(0.95f, 0.2f, 0.15f, 0.9f);
				GUI.DrawTexture(new Rect(num4, num2 * 0.5f - 1f, num3, 2f), (Texture)(object)_pixelTex);
				GUI.DrawTexture(new Rect(num * 0.5f - 1f, num5, 2f, num3), (Texture)(object)_pixelTex);
			}
			GUI.color = Color.white;
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.fontSize = 18;
			val.fontStyle = (FontStyle)1;
			val.alignment = (TextAnchor)5;
			GUIStyle val2 = val;
			GUI.Label(new Rect(num - 380f, num2 - 95f, 355f, 32f), IsReloading ? $"RELOADING: {ReloadTimer:0.0}s" : $"CLIP: {CurrentMag}/10 [RMB: Scope | R: Reload]", val2);
		}
	}
}
[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
public static class ScopeFov
{
	public static void Postfix(GameCamera __instance)
	{
		Camera component = ((Component)__instance).GetComponent<Camera>();
		if ((Object)(object)component != (Object)null)
		{
			component.fieldOfView = Mathf.Lerp(component.fieldOfView, Plugin.IsScoped ? Plugin.ScopeZoomFov : 65f, Time.deltaTime * 14f);
		}
	}
}
[HarmonyPatch(typeof(Attack), "Start")]
public static class NoFireReload
{
	public static bool Prefix(Humanoid character)
	{
		//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)
		Player val = (Player)(object)((character is Player) ? character : null);
		if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer)
		{
			return true;
		}
		ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon();
		if (currentWeapon == null || currentWeapon.m_shared.m_skillType != Plugin.FirearmsSkill)
		{
			return true;
		}
		if (Plugin.IsReloading)
		{
			return false;
		}
		if (Plugin.CurrentMag <= 0)
		{
			Plugin.StartReload(val);
			return false;
		}
		return true;
	}
}
[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
{
	typeof(int),
	typeof(float)
})]
public static class SkillDmg
{
	public static void Postfix(ItemData __instance, ref DamageTypes __result)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		if (__instance.m_shared.m_skillType != Plugin.FirearmsSkill)
		{
			return;
		}
		Player localPlayer = Player.m_localPlayer;
		if (!((Object)(object)localPlayer == (Object)null))
		{
			float skillLevel = ((Character)localPlayer).GetSkillLevel(Plugin.FirearmsSkill);
			((DamageTypes)(ref __result)).Modify(1f + skillLevel / 100f * 1.1f);
			if (skillLevel >= 50f)
			{
				__result.m_fire += 15f;
			}
		}
	}
}
[HarmonyPatch(typeof(Attack), "FireProjectileBurst")]
public static class ClipXp
{
	public static void Postfix(Humanoid ___m_character)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		Player val = (Player)(object)((___m_character is Player) ? ___m_character : null);
		if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer)
		{
			return;
		}
		ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon();
		if (currentWeapon != null && currentWeapon.m_shared.m_skillType == Plugin.FirearmsSkill)
		{
			((Character)val).RaiseSkill(Plugin.FirearmsSkill, 1.5f);
			Plugin.CurrentMag = Mathf.Max(0, Plugin.CurrentMag - 1);
			if (Plugin.CurrentMag == 0)
			{
				Plugin.StartReload(val);
			}
		}
	}
}

plugins\DragoLineage.dll

Decompiled 3 days ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DragoLineage;

[BepInPlugin("com.blahbeany.dragolineage", "Drago Era-Locked Bloodline Wheel", "1.0.3")]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PlayerController), "FixedUpdate")]
	public static class FreezeCam
	{
		public static bool Prefix()
		{
			return !WheelOpen;
		}
	}

	[HarmonyPatch(typeof(Player), "GetBodyArmor")]
	public static class FrmArm
	{
		public static void Postfix(ref float __result)
		{
			if (SelectedLineage == 2)
			{
				__result += 20f;
			}
		}
	}

	[HarmonyPatch(typeof(Character), "GetRunSpeedFactor")]
	public static class StmSpd
	{
		public static void Postfix(Character __instance, ref float __result)
		{
			if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && SelectedLineage == 1)
			{
				__result *= 1.15f;
			}
		}
	}

	[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
	{
		typeof(int),
		typeof(float)
	})]
	public static class LinDmg
	{
		public static void Postfix(ref DamageTypes __result)
		{
			if (SelectedLineage == 0)
			{
				__result.m_fire += ((DamageTypes)(ref __result)).GetTotalDamage() * 0.18f;
			}
			else if (SelectedLineage == 1)
			{
				__result.m_lightning += ((DamageTypes)(ref __result)).GetTotalDamage() * 0.15f;
			}
			else if (SelectedLineage == 3)
			{
				__result.m_poison += ((DamageTypes)(ref __result)).GetTotalDamage() * 0.25f;
			}
		}
	}

	public static bool WheelOpen = false;

	public static int SelectedLineage = -1;

	public static int LockedEra = -1;

	public static float SpecialCooldown = 0f;

	private static readonly string[] Names = new string[4] { "Crimson Flame", "Stormfang", "Frostscale", "Venomfang" };

	private static readonly string[] Descs = new string[4] { "+18% Fire Dmg | [V] Magma Breath", "+15% Speed & Lightning | [V] Chain Bolt", "+20 Armor & Frost Res | [V] Glacial Nova", "+25% Poison & Regen | [V] Acid Spit" };

	private static readonly Color[] Colors = (Color[])(object)new Color[4]
	{
		new Color(0.95f, 0.25f, 0.12f),
		new Color(0.25f, 0.72f, 1f),
		new Color(0.45f, 0.92f, 1f),
		new Color(0.32f, 0.92f, 0.28f)
	};

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("com.blahbeany.dragolineage").PatchAll();
	}

	private static int GetCurrentEra()
	{
		if ((Object)(object)ZoneSystem.instance == (Object)null)
		{
			return 0;
		}
		int result = 0;
		if (ZoneSystem.instance.GetGlobalKey("defeated_eikthyr"))
		{
			result = 1;
		}
		if (ZoneSystem.instance.GetGlobalKey("defeated_gdking"))
		{
			result = 2;
		}
		if (ZoneSystem.instance.GetGlobalKey("defeated_bonemass"))
		{
			result = 3;
		}
		if (ZoneSystem.instance.GetGlobalKey("defeated_dragon"))
		{
			result = 4;
		}
		if (ZoneSystem.instance.GetGlobalKey("defeated_goblinking"))
		{
			result = 5;
		}
		if (ZoneSystem.instance.GetGlobalKey("defeated_queen"))
		{
			result = 6;
		}
		return result;
	}

	private void Update()
	{
		//IL_0156: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Expected O, but got Unknown
		//IL_020f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0214: Unknown result type (might be due to invalid IL or missing references)
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			WheelOpen = false;
			return;
		}
		if (SpecialCooldown > 0f)
		{
			SpecialCooldown = Mathf.Max(0f, SpecialCooldown - Time.deltaTime);
		}
		if (!TextInput.IsVisible() && !Minimap.InTextInput() && !Console.IsVisible() && (!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && !StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible())
		{
			if (Input.GetKeyDown((KeyCode)107))
			{
				WheelOpen = !WheelOpen;
				if (!WheelOpen)
				{
					Cursor.lockState = (CursorLockMode)1;
					Cursor.visible = false;
				}
			}
			if (Input.GetKeyDown((KeyCode)118) && SelectedLineage >= 0)
			{
				if (SpecialCooldown > 0f)
				{
					((Character)localPlayer).Message((MessageType)1, $"Bloodline Recharging: {SpecialCooldown:0.0}s", 0, (Sprite)null, false);
				}
				else
				{
					SpecialCooldown = 12f;
					Vector3 val = ((Component)localPlayer).transform.position + Vector3.up;
					Vector3 lookDir = ((Character)localPlayer).GetLookDir();
					foreach (Character allCharacter in Character.GetAllCharacters())
					{
						if ((Object)(object)allCharacter == (Object)null || (Object)(object)allCharacter == (Object)(object)localPlayer || allCharacter.IsTamed())
						{
							continue;
						}
						Vector3 val2 = ((Component)allCharacter).transform.position + Vector3.up - val;
						if (((Vector3)(ref val2)).magnitude <= 10f && Vector3.Angle(lookDir, val2) <= 45f)
						{
							HitData val3 = new HitData();
							val3.m_point = ((Component)allCharacter).transform.position + Vector3.up;
							val3.m_dir = lookDir;
							val3.m_pushForce = 22f;
							HitData val4 = val3;
							if (SelectedLineage == 0)
							{
								val4.m_damage.m_fire = 35f;
							}
							else if (SelectedLineage == 1)
							{
								val4.m_damage.m_lightning = 35f;
							}
							else if (SelectedLineage == 2)
							{
								val4.m_damage.m_frost = 35f;
							}
							else
							{
								val4.m_damage.m_poison = 35f;
							}
							val4.SetAttacker((Character)(object)localPlayer);
							allCharacter.Damage(val4);
						}
					}
					((Character)localPlayer).Message((MessageType)2, Names[SelectedLineage].ToUpper() + " BREATH!", 0, (Sprite)null, false);
				}
			}
		}
		if (WheelOpen)
		{
			Cursor.lockState = (CursorLockMode)0;
			Cursor.visible = true;
		}
	}

	private void OnGUI()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_0206: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: 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_0128: Unknown result type (might be due to invalid IL or missing references)
		if (!WheelOpen)
		{
			return;
		}
		GUI.depth = -1000;
		int currentEra = GetCurrentEra();
		bool flag = SelectedLineage >= 0 && LockedEra == currentEra;
		float num = (float)Screen.width * 0.5f;
		float num2 = (float)Screen.height * 0.5f;
		GUI.Box(new Rect(num - 230f, num2 - 210f, 460f, 420f), flag ? ("DRAGONBORN BLOODLINE (LOCKED FOR ERA " + currentEra + ") [K] Close") : ("SELECT DRAGONBORN BLOODLINE (ERA " + currentEra + ") [K] Close"));
		Rect val = default(Rect);
		for (int i = 0; i < 4; i++)
		{
			float num3 = ((float)i * 90f - 90f) * ((float)Math.PI / 180f);
			((Rect)(ref val))..ctor(num + Mathf.Cos(num3) * 125f - 95f, num2 + Mathf.Sin(num3) * 110f - 34f, 190f, 68f);
			GUI.backgroundColor = ((SelectedLineage == i) ? Colors[i] : Color.gray);
			if (!GUI.Button(val, Names[i] + "\n" + Descs[i]))
			{
				continue;
			}
			if (flag && SelectedLineage != i)
			{
				if ((Object)(object)Player.m_localPlayer != (Object)null)
				{
					((Character)Player.m_localPlayer).Message((MessageType)2, "Bloodline Locked Until Next Boss Era!", 0, (Sprite)null, false);
				}
				continue;
			}
			SelectedLineage = i;
			LockedEra = currentEra;
			WheelOpen = false;
			Cursor.lockState = (CursorLockMode)1;
			Cursor.visible = false;
			if ((Object)(object)Player.m_localPlayer != (Object)null)
			{
				((Character)Player.m_localPlayer).Message((MessageType)2, "Bloodline Awakened: " + Names[i], 0, (Sprite)null, false);
			}
		}
		GUI.backgroundColor = Color.white;
	}
}

plugins\DragoPassives.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DragoPassives;

[BepInPlugin("com.blahbeany.dragopassives", "Drago Passives, First-Person & Awakening", "1.6.0")]
public class Plugin : BaseUnityPlugin
{
	public static bool AwakeningActive = false;

	public static bool FirstPersonMode = false;

	public static float AwakeningTimer = 0f;

	public static float CooldownTimer = 0f;

	private static float _sizeBlend = 1f;

	private static float _stompTick = 0f;

	private static readonly Dictionary<Transform, Vector3> _baseScales = new Dictionary<Transform, Vector3>();

	public static int BossesDefeated()
	{
		if ((Object)(object)ZoneSystem.instance == (Object)null)
		{
			return 0;
		}
		string[] array = new string[7] { "defeated_eikthyr", "defeated_gdking", "defeated_bonemass", "defeated_dragon", "defeated_goblinking", "defeated_queen", "defeated_fader" };
		int num = 0;
		string[] array2 = array;
		foreach (string text in array2)
		{
			if (ZoneSystem.instance.GetGlobalKey(text))
			{
				num++;
			}
		}
		return num;
	}

	private void Awake()
	{
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			string directoryName = Path.GetDirectoryName(Paths.BepInExRootPath);
			string[] array = new string[2]
			{
				directoryName,
				Paths.GameRootPath
			};
			foreach (string path in array)
			{
				string text = Path.Combine(path, "EnhancedValheimVRM");
				Directory.CreateDirectory(text);
				string[] array2 = new string[4] { "Drago.vrm", "settings_Drago.txt", "dwagom.vrm", "settings_dwagom.txt" };
				foreach (string text2 in array2)
				{
					string[] files = Directory.GetFiles(Paths.PluginPath, text2, SearchOption.AllDirectories);
					foreach (string sourceFileName in files)
					{
						File.Copy(sourceFileName, Path.Combine(text, text2), overwrite: true);
					}
				}
			}
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)("VRM deploy: " + ex.Message));
		}
		new Harmony("com.blahbeany.dragopassives").PatchAll();
	}

	private void Update()
	{
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			AwakeningActive = false;
			return;
		}
		if (CooldownTimer > 0f)
		{
			CooldownTimer = Mathf.Max(0f, CooldownTimer - Time.deltaTime);
		}
		if (!TextInput.IsVisible() && !Minimap.InTextInput() && !Console.IsVisible() && (!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && !StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible())
		{
			if (Input.GetKeyDown((KeyCode)102))
			{
				FirstPersonMode = !FirstPersonMode;
				((Character)localPlayer).Message((MessageType)1, FirstPersonMode ? "Camera: First-Person [F]" : "Camera: Third-Person [F]", 0, (Sprite)null, false);
			}
			if (Input.GetKeyDown((KeyCode)103))
			{
				if (!AwakeningActive && CooldownTimer <= 0f)
				{
					int num = BossesDefeated();
					AwakeningActive = true;
					AwakeningTimer = 30f + (float)num * 5f;
					CooldownTimer = 120f;
					((Character)localPlayer).Message((MessageType)2, $"COLOSSAL AWAKENING! ({AwakeningTimer:0}s | {2.8f + (float)num * 0.35f:0.0}x Size)", 0, (Sprite)null, false);
				}
				else if (!AwakeningActive)
				{
					((Character)localPlayer).Message((MessageType)1, $"Awakening Recharging: {CooldownTimer:0}s", 0, (Sprite)null, false);
				}
			}
		}
		if (!AwakeningActive)
		{
			return;
		}
		AwakeningTimer -= Time.deltaTime;
		_stompTick -= Time.deltaTime;
		if (_stompTick <= 0f)
		{
			Vector3 velocity = ((Character)localPlayer).GetVelocity();
			if (((Vector3)(ref velocity)).magnitude > 0.5f)
			{
				_stompTick = 0.25f;
				CrushBeneathFeet(localPlayer);
			}
		}
		if (AwakeningTimer <= 0f)
		{
			AwakeningActive = false;
			((Character)localPlayer).Message((MessageType)1, "Colossal Dragon Awakening Ended", 0, (Sprite)null, false);
		}
	}

	private static void CrushBeneathFeet(Player p)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: 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_00c7: Expected O, but got Unknown
		//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		Vector3 position = ((Component)p).transform.position;
		int num = BossesDefeated();
		Collider[] array = Physics.OverlapSphere(position, 5f + (float)num * 0.75f);
		foreach (Collider val in array)
		{
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			GameObject gameObject = ((Component)((Component)val).transform.root).gameObject;
			if ((Object)(object)gameObject == (Object)(object)((Component)p).gameObject || (Object)(object)((Component)val).GetComponentInParent<Piece>() != (Object)null || (Object)(object)gameObject.GetComponentInParent<Piece>() != (Object)null || ((Object)gameObject).name.IndexOf("Vehicle", StringComparison.OrdinalIgnoreCase) >= 0 || ((Object)gameObject).name.IndexOf("Raft", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				continue;
			}
			HitData val2 = new HitData();
			val2.m_toolTier = 5;
			val2.m_point = val.ClosestPoint(position);
			Vector3 val3 = ((Component)val).transform.position - position;
			val2.m_dir = ((Vector3)(ref val3)).normalized;
			HitData val4 = val2;
			val4.m_damage.m_blunt = 200f + (float)num * 50f;
			val4.m_damage.m_fire = 90f + (float)num * 25f;
			val4.m_damage.m_chop = 200f;
			val4.m_damage.m_pickaxe = 200f;
			val4.SetAttacker((Character)(object)p);
			IDestructible componentInParent = ((Component)val).GetComponentInParent<IDestructible>();
			if (componentInParent != null)
			{
				Character val5 = (Character)(object)((componentInParent is Character) ? componentInParent : null);
				if (!((Object)(object)val5 != (Object)null) || (!((Object)(object)val5 == (Object)(object)p) && !val5.IsTamed()))
				{
					componentInParent.Damage(val4);
				}
			}
		}
	}

	private void LateUpdate()
	{
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			return;
		}
		float num = (AwakeningActive ? (2.8f + (float)BossesDefeated() * 0.35f) : 1f);
		Transform[] array = Object.FindObjectsOfType<Transform>();
		foreach (Transform val in array)
		{
			if (((Object)val).name.Contains("RightHand_Attach"))
			{
				val.localRotation = Quaternion.Euler(0f, 0f, -90f);
			}
			else if (((Object)val).name.Contains("LeftHand_Attach"))
			{
				val.localRotation = Quaternion.Euler(0f, 0f, 90f);
			}
		}
		_sizeBlend = Mathf.Lerp(_sizeBlend, num, Time.deltaTime * 4f);
		SkinnedMeshRenderer[] array2 = Object.FindObjectsOfType<SkinnedMeshRenderer>();
		foreach (SkinnedMeshRenderer val2 in array2)
		{
			if ((Object)(object)val2 == (Object)null)
			{
				continue;
			}
			Transform root = ((Component)val2).transform.root;
			if (!((Object)(object)root != (Object)(object)((Component)localPlayer).transform) || !(Vector3.Distance(root.position, ((Component)localPlayer).transform.position) > 1.5f))
			{
				Transform val3 = (((Object)(object)root == (Object)(object)((Component)localPlayer).transform && (Object)(object)((Component)val2).transform.parent != (Object)null && (Object)(object)((Component)val2).transform.parent != (Object)(object)((Component)localPlayer).transform) ? ((Component)val2).transform.parent : root);
				if (!_baseScales.ContainsKey(val3))
				{
					_baseScales[val3] = val3.localScale;
				}
				val3.localScale = _baseScales[val3] * _sizeBlend;
			}
		}
	}

	private void OnGUI()
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Expected O, but got Unknown
		//IL_007d: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		GUI.depth = -1000;
		Player localPlayer = Player.m_localPlayer;
		if (!((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead())
		{
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.fontSize = 18;
			val.fontStyle = (FontStyle)1;
			val.alignment = (TextAnchor)4;
			GUIStyle val2 = val;
			if (AwakeningActive)
			{
				GUI.color = new Color(1f, 0.45f, 0.1f, 1f);
				GUI.Label(new Rect((float)Screen.width * 0.5f - 220f, 38f, 440f, 32f), $"COLOSSAL AWAKENING: {AwakeningTimer:0.0}s", val2);
			}
			else if (CooldownTimer > 0f)
			{
				GUI.color = new Color(0.8f, 0.8f, 0.8f, 0.85f);
				GUI.Label(new Rect((float)Screen.width * 0.5f - 220f, 38f, 440f, 32f), $"Awakening Cooldown: {CooldownTimer:0}s", val2);
			}
		}
	}
}
[HarmonyPatch(typeof(Player), "GetMaxCarryWeight")]
public static class CarryP
{
	public static void Postfix(Player __instance, ref float __result)
	{
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer)
		{
			__result += (Plugin.AwakeningActive ? 900f : 300f);
		}
	}
}
[HarmonyPatch(typeof(Player), "GetBodyArmor")]
public static class ArmorP
{
	public static void Postfix(Player __instance, ref float __result)
	{
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer)
		{
			__result += (Plugin.AwakeningActive ? 80f : 20f);
		}
	}
}
[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
public static class HpP
{
	public static void Postfix(Player __instance, ref float hp)
	{
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer)
		{
			hp += 50f;
		}
	}
}
[HarmonyPatch(typeof(Player), "GetJogSpeedFactor")]
public static class JogP
{
	public static void Postfix(Player __instance, ref float __result)
	{
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer)
		{
			__result *= (Plugin.AwakeningActive ? 1.45f : 1.2f);
		}
	}
}
[HarmonyPatch(typeof(Player), "GetRunSpeedFactor")]
public static class RunP
{
	public static void Postfix(Player __instance, ref float __result)
	{
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer)
		{
			__result *= (Plugin.AwakeningActive ? 1.45f : 1.2f);
		}
	}
}
[HarmonyPatch(typeof(Character), "Jump")]
public static class JumpP
{
	public static void Postfix(Character __instance)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer)
		{
			Rigidbody component = ((Component)__instance).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				Vector3 velocity = component.velocity;
				velocity.y *= (Plugin.AwakeningActive ? 1.5f : 1.2f);
				component.velocity = velocity;
			}
		}
	}
}
[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
{
	typeof(int),
	typeof(float)
})]
public static class DmgP
{
	public static void Postfix(ItemData __instance, ref DamageTypes __result)
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Invalid comparison between Unknown and I4
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Invalid comparison between Unknown and I4
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Invalid comparison between Unknown and I4
		Player localPlayer = Player.m_localPlayer;
		if (!((Object)(object)localPlayer == (Object)null) && ((Humanoid)localPlayer).GetInventory().ContainsItem(__instance))
		{
			SkillType skillType = __instance.m_shared.m_skillType;
			if ((int)skillType == 8 || (int)skillType == 14)
			{
				((DamageTypes)(ref __result)).Modify(1.1f);
			}
			else if ((int)skillType != 0)
			{
				((DamageTypes)(ref __result)).Modify(1.25f);
			}
			if (Plugin.AwakeningActive)
			{
				((DamageTypes)(ref __result)).Modify(2.5f + (float)Plugin.BossesDefeated() * 0.2f);
			}
		}
	}
}
[HarmonyPatch(typeof(Character), "Damage")]
public static class ResP
{
	public static void Prefix(Character __instance, HitData hit)
	{
		if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && hit != null)
		{
			ref DamageTypes damage = ref hit.m_damage;
			damage.m_fire *= 0.5f;
			ref DamageTypes damage2 = ref hit.m_damage;
			damage2.m_frost *= 0.5f;
			ref DamageTypes damage3 = ref hit.m_damage;
			damage3.m_lightning *= 0.5f;
			ref DamageTypes damage4 = ref hit.m_damage;
			damage4.m_poison *= 0.5f;
		}
	}
}
[HarmonyPatch(typeof(GameCamera), "UpdateCamera")]
public static class FirstPersonCamP
{
	public static void Postfix(GameCamera __instance)
	{
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if (!((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead() && Plugin.FirstPersonMode)
		{
			float num = (Plugin.AwakeningActive ? (2.8f + (float)Plugin.BossesDefeated() * 0.35f) : 1f);
			((Component)__instance).transform.position = ((Component)localPlayer).transform.position + Vector3.up * (2.15f * num) + ((Character)localPlayer).GetLookDir() * (0.38f * num);
			((Component)__instance).transform.rotation = Quaternion.LookRotation(((Character)localPlayer).GetLookDir(), Vector3.up);
		}
	}
}
[HarmonyPatch(typeof(GameCamera), "Awake")]
public static class CamP
{
	public static void Postfix(GameCamera __instance)
	{
		__instance.m_minDistance = 1.4f;
		__instance.m_maxDistance = 8.5f;
	}
}

plugins\DwagomSaber.dll

Decompiled 3 days ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DwagomSaber;

[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.blahbeany.dwagomsaber", "Dwagom Purple Lightsaber & Power Kick", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Attack), "Start")]
	public static class SwP
	{
		public static void Postfix(Humanoid character)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			Player val = (Player)(object)((character is Player) ? character : null);
			if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)Player.m_localPlayer && BladeIgnited)
			{
				ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon();
				if (currentWeapon != null && currentWeapon.m_shared.m_skillType == SaberSkill && (Object)(object)_humSource != (Object)null)
				{
					_humSource.PlayOneShot(_swingClip, 0.7f);
				}
			}
		}
	}

	[HarmonyPatch(typeof(ItemData), "GetDamage", new Type[]
	{
		typeof(int),
		typeof(float)
	})]
	public static class DmP
	{
		public static void Postfix(ItemData __instance, ref DamageTypes __result)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.m_shared.m_skillType != SaberSkill)
			{
				return;
			}
			Player localPlayer = Player.m_localPlayer;
			if ((Object)(object)localPlayer == (Object)null)
			{
				return;
			}
			if (!BladeIgnited)
			{
				__result.m_slash = 0f;
				__result.m_lightning = 0f;
				__result.m_blunt = 2f;
				return;
			}
			float skillLevel = ((Character)localPlayer).GetSkillLevel(SaberSkill);
			((DamageTypes)(ref __result)).Modify(1f + skillLevel / 100f * 1.1f);
			if (skillLevel >= 50f)
			{
				__result.m_fire += 15f;
			}
		}
	}

	[HarmonyPatch(typeof(Character), "Damage")]
	public static class XpP
	{
		public static void Postfix(Character __instance, HitData hit)
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			if (hit == null || (Object)(object)__instance == (Object)(object)Player.m_localPlayer)
			{
				return;
			}
			Character attacker = hit.GetAttacker();
			Player val = (Player)(object)((attacker is Player) ? attacker : null);
			if ((Object)(object)val != (Object)null && (Object)(object)val == (Object)(object)Player.m_localPlayer && BladeIgnited)
			{
				ItemData currentWeapon = ((Humanoid)val).GetCurrentWeapon();
				if (currentWeapon != null && currentWeapon.m_shared.m_skillType == SaberSkill)
				{
					((Character)val).RaiseSkill(SaberSkill, 1.5f);
				}
			}
		}
	}

	public static SkillType SaberSkill;

	public static bool BladeIgnited = true;

	public static float BladeLength = 1f;

	public static float KickCooldown = 0f;

	private static AudioClip _igniteClip;

	private static AudioClip _retractClip;

	private static AudioClip _humClip;

	private static AudioClip _swingClip;

	private static AudioSource _humSource;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
		SkillManager instance = SkillManager.Instance;
		SkillConfig val = new SkillConfig();
		val.Identifier = "com.blahbeany.lightsaber";
		val.Name = "Lightsaber";
		val.Description = "Increases purple lightsaber damage and plasma heat.";
		val.IncreaseStep = 1.3f;
		SaberSkill = instance.AddSkill(val);
		int num = 22050;
		_igniteClip = AudioClip.Create("SaberIgnite", num / 2, 1, num, false);
		float[] array = new float[num / 2];
		for (int i = 0; i < array.Length; i++)
		{
			float num2 = (float)i / (float)num;
			float num3 = Mathf.Sin(Mathf.Min(1f, num2 * 8f) * (float)Math.PI * 0.5f) * (1f - num2 * 1.8f);
			array[i] = Mathf.Clamp(Mathf.Sin((float)Math.PI * 2f * Mathf.Lerp(95f, 340f, num2 * 2f) * num2) * 0.55f + (Random.value * 2f - 1f) * 0.25f * Mathf.Exp((0f - num2) * 9f), -1f, 1f) * Mathf.Max(0f, num3);
		}
		_igniteClip.SetData(array, 0);
		_retractClip = AudioClip.Create("SaberRetract", num / 2, 1, num, false);
		float[] array2 = new float[num / 2];
		for (int i = 0; i < array2.Length; i++)
		{
			float num2 = (float)i / (float)num;
			array2[i] = Mathf.Sin((float)Math.PI * 2f * Mathf.Lerp(320f, 75f, num2 * 2f) * num2) * 0.5f * Mathf.Max(0f, 1f - num2 * 2f);
		}
		_retractClip.SetData(array2, 0);
		_humClip = AudioClip.Create("SaberHum", num, 1, num, false);
		float[] array3 = new float[num];
		for (int i = 0; i < array3.Length; i++)
		{
			float num2 = (float)i / (float)num;
			array3[i] = Mathf.Sin((float)Math.PI * 220f * num2) * 0.14f + Mathf.Sin((float)Math.PI * 330f * num2) * 0.06f;
		}
		_humClip.SetData(array3, 0);
		_swingClip = AudioClip.Create("SaberSwing", num / 3, 1, num, false);
		float[] array4 = new float[num / 3];
		for (int i = 0; i < array4.Length; i++)
		{
			float num2 = (float)i / (float)num;
			float num3 = Mathf.Sin(num2 * 3f * (float)Math.PI);
			array4[i] = Mathf.Sin((float)Math.PI * 2f * (140f + 95f * num3) * num2) * 0.45f * Mathf.Max(0f, num3);
		}
		_swingClip.SetData(array4, 0);
		PrefabManager.OnVanillaPrefabsAvailable += RegisterSaber;
		new Harmony("com.blahbeany.dwagomsaber").PatchAll();
	}

	private void RegisterSaber()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: Expected O, but got Unknown
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Expected O, but got Unknown
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		ItemConfig val = new ItemConfig();
		val.Name = "Amethyst Plasma Saber";
		val.Description = "Retractable purple plasma blade. Press [C] to ignite/retract. Upgrades every age.";
		val.CraftingStation = CraftingStations.Workbench;
		val.MinStationLevel = 1;
		RequirementConfig[] array = (RequirementConfig[])(object)new RequirementConfig[3];
		RequirementConfig val2 = new RequirementConfig();
		val2.Item = "Wood";
		val2.Amount = 4;
		val2.Recover = true;
		array[0] = val2;
		RequirementConfig val3 = new RequirementConfig();
		val3.Item = "Flint";
		val3.Amount = 4;
		val3.Recover = true;
		array[1] = val3;
		RequirementConfig val4 = new RequirementConfig();
		val4.Item = "Resin";
		val4.Amount = 2;
		val4.Recover = true;
		array[2] = val4;
		val.Requirements = array;
		CustomItem val5 = new CustomItem("DwagomPurpleSaber", "SwordBronze", val);
		SharedData shared = val5.ItemDrop.m_itemData.m_shared;
		shared.m_skillType = SaberSkill;
		shared.m_maxQuality = 6;
		shared.m_damages.m_slash = 10f;
		shared.m_damages.m_lightning = 2f;
		shared.m_damagesPerLevel.m_slash = 10f;
		shared.m_damagesPerLevel.m_lightning = 5f;
		shared.m_icons = PrefabManager.Instance.GetPrefab("SwordBronze").GetComponent<ItemDrop>().m_itemData.m_shared.m_icons;
		ItemManager.Instance.AddItem(val5);
		PrefabManager.OnVanillaPrefabsAvailable -= RegisterSaber;
	}

	private static Transform BuildSaber(Transform h)
	{
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected O, but got Unknown
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		//IL_00d1: 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_00e8: Expected O, but got Unknown
		//IL_00f9: 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_0110: Expected O, but got Unknown
		//IL_0121: 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: Expected O, but got Unknown
		//IL_018b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_0224: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Expected O, but got Unknown
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)h == (Object)null)
		{
			return null;
		}
		Transform val = h.Find("DwagomSaberMesh");
		if ((Object)(object)val != (Object)null)
		{
			return val.Find("BladePivot");
		}
		Renderer[] componentsInChildren = ((Component)h).GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val2 in componentsInChildren)
		{
			val2.enabled = false;
		}
		Shader val3 = Shader.Find("Custom/Piece") ?? Shader.Find("Standard");
		Material val4 = new Material(val3);
		val4.color = new Color(0.75f, 0.78f, 0.82f);
		Material sharedMaterial = val4;
		Material val5 = new Material(val3);
		val5.color = new Color(0.88f, 0.68f, 0.18f);
		Material sharedMaterial2 = val5;
		Material val6 = new Material(val3);
		val6.color = new Color(0.96f, 0.85f, 1f);
		Material sharedMaterial3 = val6;
		Material val7 = new Material(val3);
		val7.color = new Color(0.62f, 0.12f, 0.98f);
		Material sharedMaterial4 = val7;
		GameObject val8 = new GameObject("DwagomSaberMesh");
		val8.transform.SetParent(h, false);
		GameObject val9 = GameObject.CreatePrimitive((PrimitiveType)2);
		Object.DestroyImmediate((Object)(object)val9.GetComponent<Collider>());
		val9.transform.SetParent(val8.transform, false);
		val9.transform.localScale = new Vector3(0.036f, 0.14f, 0.036f);
		val9.GetComponent<Renderer>().sharedMaterial = sharedMaterial;
		GameObject val10 = GameObject.CreatePrimitive((PrimitiveType)2);
		Object.DestroyImmediate((Object)(object)val10.GetComponent<Collider>());
		val10.transform.SetParent(val8.transform, false);
		val10.transform.localPosition = new Vector3(0f, 0.13f, 0f);
		val10.transform.localScale = new Vector3(0.044f, 0.02f, 0.044f);
		val10.GetComponent<Renderer>().sharedMaterial = sharedMaterial2;
		GameObject val11 = new GameObject("BladePivot");
		val11.transform.SetParent(val8.transform, false);
		val11.transform.localPosition = new Vector3(0f, 0.14f, 0f);
		GameObject val12 = GameObject.CreatePrimitive((PrimitiveType)2);
		Object.DestroyImmediate((Object)(object)val12.GetComponent<Collider>());
		val12.transform.SetParent(val11.transform, false);
		val12.transform.localPosition = new Vector3(0f, 0.56f, 0f);
		val12.transform.localScale = new Vector3(0.018f, 0.56f, 0.018f);
		val12.GetComponent<Renderer>().sharedMaterial = sharedMaterial3;
		GameObject val13 = GameObject.CreatePrimitive((PrimitiveType)2);
		Object.DestroyImmediate((Object)(object)val13.GetComponent<Collider>());
		val13.transform.SetParent(val11.transform, false);
		val13.transform.localPosition = new Vector3(0f, 0.56f, 0f);
		val13.transform.localScale = new Vector3(0.034f, 0.57f, 0.034f);
		val13.GetComponent<Renderer>().sharedMaterial = sharedMaterial4;
		return val11.transform;
	}

	private void Update()
	{
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Expected O, but got Unknown
		//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c5: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_04df: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead())
		{
			return;
		}
		if (KickCooldown > 0f)
		{
			KickCooldown = Mathf.Max(0f, KickCooldown - Time.deltaTime);
		}
		bool flag = TextInput.IsVisible() || Minimap.InTextInput() || Console.IsVisible() || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || StoreGui.IsVisible();
		if (!flag && !InventoryGui.IsVisible() && !Menu.IsVisible() && Input.GetKeyDown((KeyCode)120))
		{
			if (KickCooldown > 0f)
			{
				((Character)localPlayer).Message((MessageType)1, $"Dragon Kick Recharging: {KickCooldown:0.0}s", 0, (Sprite)null, false);
			}
			else
			{
				KickCooldown = 8f;
				Vector3 val = ((Component)localPlayer).transform.position + Vector3.up;
				Vector3 lookDir = ((Character)localPlayer).GetLookDir();
				foreach (Character allCharacter in Character.GetAllCharacters())
				{
					if ((Object)(object)allCharacter == (Object)null || (Object)(object)allCharacter == (Object)(object)localPlayer || allCharacter.IsTamed())
					{
						continue;
					}
					Vector3 val2 = ((Component)allCharacter).transform.position + Vector3.up - val;
					if (((Vector3)(ref val2)).magnitude <= 4.2f && Vector3.Angle(lookDir, val2) <= 55f)
					{
						HitData val3 = new HitData();
						val3.m_point = ((Component)allCharacter).transform.position + Vector3.up;
						val3.m_dir = lookDir;
						val3.m_pushForce = 65f;
						val3.m_staggerMultiplier = 4f;
						HitData val4 = val3;
						val4.m_damage.m_blunt = 25f;
						val4.SetAttacker((Character)(object)localPlayer);
						allCharacter.Damage(val4);
						Rigidbody component = ((Component)allCharacter).GetComponent<Rigidbody>();
						if ((Object)(object)component != (Object)null)
						{
							component.velocity = ((Vector3)(ref lookDir)).normalized * 42f + Vector3.up * 18f;
						}
					}
				}
				((Character)localPlayer).Message((MessageType)2, "DRAGON POWER KICK!", 0, (Sprite)null, false);
			}
		}
		ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon();
		bool flag2 = currentWeapon != null && currentWeapon.m_shared.m_skillType == SaberSkill;
		if ((Object)(object)_humSource == (Object)null)
		{
			_humSource = ((Component)localPlayer).gameObject.AddComponent<AudioSource>();
			_humSource.clip = _humClip;
			_humSource.loop = true;
			_humSource.volume = 0.28f;
			_humSource.spatialBlend = 0f;
		}
		if (flag2)
		{
			if (!flag && !InventoryGui.IsVisible() && !Menu.IsVisible() && Input.GetKeyDown((KeyCode)99))
			{
				BladeIgnited = !BladeIgnited;
				_humSource.PlayOneShot(BladeIgnited ? _igniteClip : _retractClip, 0.85f);
				((Character)localPlayer).Message((MessageType)1, BladeIgnited ? "Lightsaber: Ignited [C]" : "Lightsaber: Retracted [C]", 0, (Sprite)null, false);
			}
			if (BladeIgnited && !_humSource.isPlaying)
			{
				_humSource.Play();
			}
			else if (!BladeIgnited && _humSource.isPlaying)
			{
				_humSource.Stop();
			}
			BladeLength = Mathf.MoveTowards(BladeLength, BladeIgnited ? 1f : 0f, Time.deltaTime * 6f);
			Transform[] array = Object.FindObjectsOfType<Transform>();
			foreach (Transform val5 in array)
			{
				if ((Object)(object)val5 != (Object)null && ((Object)val5).name.Contains("RightHand_Attach") && val5.childCount > 0 && Vector3.Distance(val5.position, ((Component)localPlayer).transform.position) < 2.2f)
				{
					Transform val6 = BuildSaber(val5.GetChild(0));
					if ((Object)(object)val6 != (Object)null)
					{
						((Component)val6).gameObject.SetActive(BladeLength > 0.02f);
						val6.localScale = new Vector3(1f, Mathf.Max(0.01f, BladeLength), 1f);
					}
				}
			}
		}
		else if (_humSource.isPlaying)
		{
			_humSource.Stop();
		}
	}
}