Decompiled source of PlayableScavenger v1.2.0

PlayableScavenger.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.ScavMonster;
using KinematicCharacterController;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Skills;
using SimpleJSON;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("PlayableScavenger")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PlayableScavenger")]
[assembly: AssemblyTitle("PlayableScavenger")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PlayableScavenger;

internal class Hook
{
	internal static void Hooks()
	{
		Run.onRunStartGlobal += Run_onRunStartGlobal;
	}

	private static void Run_onRunStartGlobal(Run obj)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: 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_0134: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < Run.instance.availableTier1DropList.Count; i++)
		{
			MainPlugin.tier1.Add(Run.instance.availableTier1DropList[i]);
		}
		for (int j = 0; j < Run.instance.availableTier2DropList.Count; j++)
		{
			MainPlugin.tier2.Add(Run.instance.availableTier2DropList[j]);
		}
		for (int k = 0; k < Run.instance.availableTier3DropList.Count; k++)
		{
			MainPlugin.tier3.Add(Run.instance.availableTier3DropList[k]);
		}
		for (int l = 0; l < MainPlugin.itemBlacklist.Count; l++)
		{
			PickupIndex item = PickupCatalog.FindPickupIndex(ItemCatalog.FindItemIndex(MainPlugin.itemBlacklist[l]));
			if (MainPlugin.tier1.Contains(item))
			{
				MainPlugin.tier1.Remove(item);
			}
			if (MainPlugin.tier2.Contains(item))
			{
				MainPlugin.tier2.Remove(item);
			}
			if (MainPlugin.tier3.Contains(item))
			{
				MainPlugin.tier3.Remove(item);
			}
		}
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Dragonyck.PlayableScavenger", "PlayableScavenger", "1.2.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.Dragonyck.PlayableScavenger";

	public const string MODNAME = "PlayableScavenger";

	public const string VERSION = "1.2.0";

	public const string SURVIVORNAME = "DragonScavenger";

	public const string SURVIVORNAMEKEY = "DRAGONSCAVENGER";

	public static GameObject characterPrefab;

	public GameObject characterDisplay;

	public GameObject doppelganger;

	public static Color characterColor;

	protected internal static ConfigEntry<int> baseJumpCount;

	protected internal static ConfigEntry<float> mainRootSpeed;

	protected internal static ConfigEntry<float> baseMaxHealth;

	protected internal static ConfigEntry<float> levelMaxHealth;

	protected internal static ConfigEntry<float> baseRegen;

	protected internal static ConfigEntry<float> levelRegen;

	protected internal static ConfigEntry<float> baseMaxShield;

	protected internal static ConfigEntry<float> levelMaxShield;

	protected internal static ConfigEntry<float> baseMoveSpeed;

	protected internal static ConfigEntry<float> levelMoveSpeed;

	protected internal static ConfigEntry<float> baseAcceleration;

	protected internal static ConfigEntry<float> baseJumpPower;

	protected internal static ConfigEntry<float> levelJumpPower;

	protected internal static ConfigEntry<float> baseDamage;

	protected internal static ConfigEntry<float> levelDamage;

	protected internal static ConfigEntry<float> baseAttackSpeed;

	protected internal static ConfigEntry<float> levelAttackSpeed;

	protected internal static ConfigEntry<float> baseCrit;

	protected internal static ConfigEntry<float> levelCrit;

	protected internal static ConfigEntry<float> baseArmor;

	protected internal static ConfigEntry<float> levelArmor;

	protected internal static List<string> itemBlacklist = new List<string>();

	protected internal static List<PickupIndex> tier1 = new List<PickupIndex>();

	protected internal static List<PickupIndex> tier2 = new List<PickupIndex>();

	protected internal static List<PickupIndex> tier3 = new List<PickupIndex>();

	private void Awake()
	{
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Expected O, but got Unknown
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Expected O, but got Unknown
		//IL_0153: Expected O, but got Unknown
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Expected O, but got Unknown
		//IL_0187: Expected O, but got Unknown
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bb: Expected O, but got Unknown
		//IL_01bb: Expected O, but got Unknown
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Expected O, but got Unknown
		//IL_01ef: Expected O, but got Unknown
		//IL_0204: 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_0223: Expected O, but got Unknown
		//IL_0223: Expected O, but got Unknown
		//IL_0238: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Expected O, but got Unknown
		//IL_0257: Expected O, but got Unknown
		//IL_026c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Unknown result type (might be due to invalid IL or missing references)
		//IL_028b: Expected O, but got Unknown
		//IL_028b: Expected O, but got Unknown
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bf: Expected O, but got Unknown
		//IL_02bf: Expected O, but got Unknown
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f3: Expected O, but got Unknown
		//IL_02f3: Expected O, but got Unknown
		//IL_0308: Unknown result type (might be due to invalid IL or missing references)
		//IL_031d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: Expected O, but got Unknown
		//IL_0327: Expected O, but got Unknown
		//IL_033c: 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_035b: Expected O, but got Unknown
		//IL_035b: Expected O, but got Unknown
		//IL_0370: 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_038f: Expected O, but got Unknown
		//IL_038f: Expected O, but got Unknown
		//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c3: Expected O, but got Unknown
		//IL_03c3: Expected O, but got Unknown
		//IL_03d8: 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: Expected O, but got Unknown
		//IL_03f7: Expected O, but got Unknown
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		//IL_042b: Expected O, but got Unknown
		//IL_042b: Expected O, but got Unknown
		//IL_0440: Unknown result type (might be due to invalid IL or missing references)
		//IL_0455: Unknown result type (might be due to invalid IL or missing references)
		//IL_045f: Expected O, but got Unknown
		//IL_045f: Expected O, but got Unknown
		//IL_0474: 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_0493: Expected O, but got Unknown
		//IL_0493: Expected O, but got Unknown
		//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c7: Expected O, but got Unknown
		//IL_04c7: Expected O, but got Unknown
		//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04fb: Expected O, but got Unknown
		//IL_04fb: Expected O, but got Unknown
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_0525: Unknown result type (might be due to invalid IL or missing references)
		//IL_052f: Expected O, but got Unknown
		//IL_052f: Expected O, but got Unknown
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_0559: Unknown result type (might be due to invalid IL or missing references)
		//IL_0563: Expected O, but got Unknown
		//IL_0563: Expected O, but got Unknown
		string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Config.ConfigFilePath), "PlayableScavenger-ItemBlacklist.json");
		string text = "";
		bool flag = true;
		bool flag2 = true;
		if (File.Exists(path))
		{
			text = File.ReadAllText(path);
			try
			{
				JSONNode.Parse(text);
			}
			catch
			{
				Debug.LogWarning((object)"[PlayableScavenger] blacklist config file malformed! using defaults");
				flag = false;
			}
		}
		else
		{
			Debug.LogWarning((object)"[PlayableScavenger] blacklist config file not found! using defaults");
			flag = false;
			flag2 = false;
		}
		if (!flag)
		{
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PlayableScavenger.PlayableScavenger-ItemBlacklist.json"))
			{
				text = new StreamReader(stream).ReadToEnd();
			}
			if (!flag2)
			{
				File.WriteAllText(path, text);
			}
		}
		JSONNode val = JSONNode.Parse(text);
		foreach (object item in val["itemCodeNames"].AsArray)
		{
			JSONNode val2 = (JSONNode)item;
			itemBlacklist.Add(JSONNode.op_Implicit(val2["codeName"]));
		}
		baseJumpCount = ((BaseUnityPlugin)this).Config.Bind<int>(new ConfigDefinition("Base Jump Count", "Value"), 1, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		mainRootSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Main Root Speed", "Value"), 33f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseMaxHealth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Max Health", "Value"), 3800f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelMaxHealth = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Max Health", "Value"), 1140f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseRegen = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Regen", "Value"), 2f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelRegen = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Regen", "Value"), 0.4f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseMaxShield = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Max Shield", "Value"), 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelMaxShield = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Max Shield", "Value"), 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseMoveSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Move Speed", "Value"), 3f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelMoveSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Move Speed", "Value"), 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseAcceleration = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Acceleration", "Value"), 10f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseJumpPower = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Jump Power", "Value"), 20f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelJumpPower = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Jump Power", "Value"), 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Damage", "Value"), 4f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelDamage = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Damage", "Value"), 0.8f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseAttackSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Attack Speed", "Value"), 1f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelAttackSpeed = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Attack Speed", "Value"), 1f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseCrit = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Crit", "Value"), 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelCrit = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Crit", "Value"), 0f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		baseArmor = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Base Armor", "Value"), 20f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		levelArmor = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Level Armor", "Value"), 1f, new ConfigDescription("", (AcceptableValueBase)null, Array.Empty<object>()));
		CreatePrefab();
		RegisterStates();
		RegisterCharacter();
		CreateDoppelganger();
		Hook.Hooks();
	}

	internal static void CreatePrefab()
	{
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a9: 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_03b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_049e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c2: Expected O, but got Unknown
		//IL_04c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
		characterPrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/ScavBody"), "DragonScavengerBody", true);
		characterPrefab.GetComponent<NetworkIdentity>().localPlayerAuthority = true;
		characterPrefab.GetComponent<KinematicCharacterMotor>().playerCharacter = true;
		CharacterBody component = characterPrefab.GetComponent<CharacterBody>();
		((Object)component).name = "DragonScavengerBody";
		component.bodyFlags = (BodyFlags)16;
		component.mainRootSpeed = mainRootSpeed.Value;
		component.baseMaxHealth = baseMaxHealth.Value;
		component.levelMaxHealth = levelMaxHealth.Value;
		component.baseRegen = baseRegen.Value;
		component.levelRegen = levelRegen.Value;
		component.baseMaxShield = baseMaxShield.Value;
		component.levelMaxShield = levelMaxShield.Value;
		component.baseMoveSpeed = baseMoveSpeed.Value;
		component.levelMoveSpeed = levelMoveSpeed.Value;
		component.baseAcceleration = baseAcceleration.Value;
		component.baseJumpPower = baseJumpPower.Value;
		component.levelJumpPower = levelJumpPower.Value;
		component.baseDamage = baseDamage.Value;
		component.levelDamage = levelDamage.Value;
		component.baseAttackSpeed = baseAttackSpeed.Value;
		component.levelAttackSpeed = levelAttackSpeed.Value;
		component.baseCrit = baseCrit.Value;
		component.levelCrit = levelCrit.Value;
		component.baseArmor = baseArmor.Value;
		component.levelArmor = levelArmor.Value;
		component.baseJumpCount = baseJumpCount.Value;
		component.hideCrosshair = false;
		component.portraitIcon = (Texture)(object)LegacyResourcesAPI.Load<Texture2D>("textures/bodyicons/scavbody");
		component.preferredPodPrefab = LegacyResourcesAPI.Load<GameObject>("prefabs/networkedobjects/robocratepod");
		characterColor = component.bodyColor;
		HealthComponent component2 = characterPrefab.GetComponent<HealthComponent>();
		component2.health = baseMaxHealth.Value;
		component2.shield = baseMaxShield.Value;
		component2.barrier = 0f;
		component2.magnetiCharge = 0f;
		component2.body = null;
		component2.dontShowHealthbar = false;
		component2.globalDeathEventChanceCoefficient = 1f;
		characterPrefab.GetComponent<Interactor>().maxInteractionDistance = 14f;
		characterPrefab.GetComponent<InteractionDriver>().highlightInteractor = true;
		SfxLocator component3 = characterPrefab.GetComponent<SfxLocator>();
		component3.deathSound = "Play_ui_player_death";
		component3.barkSound = "";
		component3.openSound = "";
		component3.landingSound = "Play_gravekeeper_land";
		component3.fallDamageSound = "Play_char_land_fall_damage";
		component3.aliveLoopStart = "";
		component3.aliveLoopStop = "";
		LanguageAPI.Add("MONSTER_PICKUP_2P", "<style=cWorldEvent>You picked up {1}{2}</color>");
		LanguageAPI.Add("DRAGONSCAVENGERPRIMARY_NAME", "Heavy Shotgun");
		LanguageAPI.Add("DRAGONSCAVENGERPRIMARY_DESCRIPTION", "The Scavenger readies its weapon and shoots 3 shotgun blasts with 4 projectiles. Each projectile deals <style=cIsDamage>300% damage</style>.");
		LanguageAPI.Add("DRAGONSCAVENGERSECONDARY_NAME", "Thqwibs");
		LanguageAPI.Add("DRAGONSCAVENGERSECONDARY_DESCRIPTION", "Throw 10 exploding Thqwibs, each deals <style=cIsDamage>400% damage</style>. Upon landing, they <style=cIsDamage>trigger On-Kill</style> effects.");
		LanguageAPI.Add("DRAGONSCAVENGERUTILITY_NAME", "Scavenge Item");
		LanguageAPI.Add("DRAGONSCAVENGERUTILITY_DESCRIPTION", "Sit down and search for new items, temporarily gaining <style=cIsDamage>200 armor</style>. The rarity is equivalent to a <style=cIsDamage>Small Chest</style>. Quantity is based on rarity: 5 <color=#ffffff>common</color>, 2 <style=cIsHealing>uncommon</style>, 1 <style=cDeath>legendary</style>.");
		SkillLocator component4 = characterPrefab.GetComponent<SkillLocator>();
		component4.primary.skillFamily.defaultSkillDef.skillNameToken = "DRAGONSCAVENGERPRIMARY_NAME";
		component4.primary.skillFamily.defaultSkillDef.skillDescriptionToken = "DRAGONSCAVENGERPRIMARY_DESCRIPTION";
		component4.secondary.skillFamily.defaultSkillDef.skillNameToken = "DRAGONSCAVENGERSECONDARY_NAME";
		component4.secondary.skillFamily.defaultSkillDef.skillDescriptionToken = "DRAGONSCAVENGERSECONDARY_DESCRIPTION";
		SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
		val.activationState = new SerializableEntityStateType(typeof(UtilitySit));
		val.interruptPriority = (InterruptPriority)1;
		val.activationStateMachineName = "Body";
		val.baseMaxStock = 1;
		val.baseRechargeInterval = 19f;
		val.beginSkillCooldownOnSkillEnd = false;
		val.canceledFromSprinting = false;
		val.fullRestockOnAssign = true;
		val.isCombatSkill = true;
		val.mustKeyPress = false;
		val.cancelSprintingOnActivation = true;
		val.rechargeStock = 1;
		val.requiredStock = 1;
		val.stockToConsume = 1;
		val.icon = LegacyResourcesAPI.Load<Sprite>("textures/miscicons/texinventoryiconoutlined");
		val.skillDescriptionToken = "DRAGONSCAVENGERUTILITY_DESCRIPTION";
		val.skillName = "DRAGONSCAVENGERUTILITY_NAME";
		val.skillNameToken = "DRAGONSCAVENGERUTILITY_NAME";
		ContentAddition.AddSkillDef(val);
		SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
		val2.variants = (Variant[])(object)new Variant[1];
		Reflection.SetFieldValue<SkillFamily>((object)component4.utility, "_skillFamily", val2);
		SkillFamily skillFamily = component4.utility.skillFamily;
		Variant[] variants = skillFamily.variants;
		Variant val3 = new Variant
		{
			skillDef = val
		};
		((Variant)(ref val3)).viewableNode = new Node(val.skillNameToken, false, (Node)null);
		variants[0] = val3;
		ContentAddition.AddSkillFamily(skillFamily);
		ContentAddition.AddBody(characterPrefab);
	}

	private void RegisterStates()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		bool flag = false;
		ContentAddition.AddEntityState<UtilitySit>(ref flag);
		ContentAddition.AddEntityState<Utility>(ref flag);
	}

	private void RegisterCharacter()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0182: Unknown result type (might be due to invalid IL or missing references)
		characterDisplay = PrefabAPI.InstantiateClone(((Component)characterPrefab.GetComponent<ModelLocator>().modelBaseTransform).gameObject, "DragonScavengerDisplay", true);
		characterDisplay.transform.localScale = Vector3.one * 0.25f;
		characterDisplay.AddComponent<NetworkIdentity>();
		RendererInfo[] baseRendererInfos = characterDisplay.GetComponentInChildren<CharacterModel>().baseRendererInfos;
		for (int i = 0; i < baseRendererInfos.Length; i++)
		{
			Material val = Object.Instantiate<Material>(baseRendererInfos[i].defaultMaterial);
			val.shaderKeywords = null;
			baseRendererInfos[i].defaultMaterial = val;
		}
		string text = "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > " + Environment.NewLine + "<style=cSub>\r\n\r\n< ! > ";
		string text2 = "..and so he left, seeking more loot.";
		string text3 = "..and so he vanished, his valuable items forever lost.";
		LanguageAPI.Add("DRAGONSCAVENGER_NAME", "Scavenger");
		LanguageAPI.Add("DRAGONSCAVENGER_DESCRIPTION", text);
		LanguageAPI.Add("DRAGONSCAVENGER_SUBTITLE", "Item Hoarder");
		LanguageAPI.Add("DRAGONSCAVENGER_OUTRO", text2);
		LanguageAPI.Add("DRAGONSCAVENGER_FAIL", text3);
		LanguageAPI.Add("DRAGONSCAVENGER_LORE", Language.GetString("SCAV_BODY_LORE"));
		SurvivorDef val2 = ScriptableObject.CreateInstance<SurvivorDef>();
		val2.cachedName = "DRAGONSCAVENGER_NAME";
		val2.unlockableDef = null;
		val2.descriptionToken = "DRAGONSCAVENGER_DESCRIPTION";
		val2.primaryColor = characterColor;
		val2.bodyPrefab = characterPrefab;
		val2.displayPrefab = characterDisplay;
		val2.outroFlavorToken = "DRAGONSCAVENGER_OUTRO";
		val2.desiredSortPosition = 32f;
		val2.mainEndingEscapeFailureFlavorToken = "DRAGONSCAVENGER_FAIL";
		ContentAddition.AddSurvivorDef(val2);
	}

	private void CreateDoppelganger()
	{
		doppelganger = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/ScavMaster"), "DragonScavengerMaster", true);
		ContentAddition.AddMaster(doppelganger);
		CharacterMaster component = doppelganger.GetComponent<CharacterMaster>();
		component.bodyPrefab = characterPrefab;
	}
}
internal class UtilitySit : EnterSit
{
	public override void FixedUpdate()
	{
		if (((EntityState)this).fixedAge >= 1.9f * ((BaseState)this).attackSpeedStat)
		{
			((EntityState)this).outer.SetNextState((EntityState)(object)new Utility());
		}
		((EnterSit)this).FixedUpdate();
	}
}
internal class Utility : FindItem
{
	public override void OnEnter()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0100: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Expected I4, but got Unknown
		((FindItem)this).OnEnter();
		if (!((EntityState)this).isAuthority)
		{
			return;
		}
		int num = Random.Range(0, 100);
		if ((float)num <= FindItem.tier1Chance)
		{
			base.dropPickup = MainPlugin.tier1.ElementAt(Random.Range(0, MainPlugin.tier1.Count));
		}
		else if ((float)num <= FindItem.tier2Chance)
		{
			base.dropPickup = MainPlugin.tier2.ElementAt(Random.Range(0, MainPlugin.tier2.Count));
		}
		else if ((float)num <= FindItem.tier3Chance)
		{
			base.dropPickup = MainPlugin.tier3.ElementAt(Random.Range(0, MainPlugin.tier3.Count));
		}
		PickupDef pickupDef = PickupCatalog.GetPickupDef(base.dropPickup);
		if (pickupDef != null)
		{
			ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);
			if ((Object)(object)itemDef != (Object)null)
			{
				base.itemsToGrant = 0;
				ItemTier tier = itemDef.tier;
				ItemTier val = tier;
				switch ((int)val)
				{
				case 0:
					base.itemsToGrant = FindItem.tier1Count;
					break;
				case 1:
					base.itemsToGrant = FindItem.tier2Count;
					break;
				case 2:
					base.itemsToGrant = FindItem.tier3Count;
					break;
				default:
					base.itemsToGrant = 1;
					break;
				}
			}
		}
		if (Object.op_Implicit((Object)(object)base.pickupDisplay))
		{
			base.pickupDisplay.SetPickupIndex(base.dropPickup, false);
		}
	}
}