Decompiled source of HUNKVariants v1.0.0

HunkVariants.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HunkMod.Modules;
using HunkMod.Modules.Components;
using HunkMod.Modules.Survivors;
using HunkMod.Modules.Weapons;
using R2API;
using RoR2;
using Survariants;
using UnityEngine;

[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.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("HunkVariants")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HunkVariants")]
[assembly: AssemblyTitle("HunkVariants")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HunkVariants;

[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.rob.HunkVariants", "HunkVariants", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string MODUID = "com.rob.HunkVariants";

	public static GameObject jacketBodyPrefab;

	public static GameObject jacketDisplayPrefab;

	public static GameObject jacketMasterPrefab;

	public static SurvivorDef jacketSurvivorDef;

	private void Awake()
	{
		CreateJacketBody();
		CreateJacketSurvivor();
	}

	private void CreateJacketBody()
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		jacketBodyPrefab = PrefabAPI.InstantiateClone(Hunk.characterPrefab, "RobJacketBody", true);
		CharacterBody component = jacketBodyPrefab.GetComponent<CharacterBody>();
		component.baseNameToken = "Jacket";
		component.portraitIcon = Assets.mainAssetBundle.LoadAsset<Texture>("texJacketIcon");
		component.bodyColor = new Color(29f / 51f, 0f, 1f);
		GameObject gameObject = ((Component)jacketBodyPrefab.GetComponentInChildren<ModelLocator>().modelTransform).gameObject;
		ModelSkinController component2 = gameObject.GetComponent<ModelSkinController>();
		component2.skins = (SkinDef[])(object)new SkinDef[1] { Hunk.jacketSkinDef };
		SkillLocator component3 = jacketBodyPrefab.GetComponent<SkillLocator>();
		component3.passiveSkill.enabled = false;
		GenericSkill[] components = jacketBodyPrefab.GetComponents<GenericSkill>();
		Object.Destroy((Object)(object)components[0]);
		Object.Destroy((Object)(object)components[5]);
		jacketBodyPrefab.AddComponent<HunkVariantHandler>().loadout = (ItemDef[])(object)new ItemDef[9]
		{
			((BaseWeapon)BaseWeapon<Shotgun>.instance).itemDef,
			((BaseWeapon)BaseWeapon<Slugger>.instance).itemDef,
			((BaseWeapon)BaseWeapon<MUP>.instance).itemDef,
			((BaseWeapon)BaseWeapon<M19>.instance).itemDef,
			((BaseWeapon)BaseWeapon<Magnum>.instance).itemDef,
			((BaseWeapon)BaseWeapon<SMG>.instance).itemDef,
			((BaseWeapon)BaseWeapon<AssaultRifle>.instance).itemDef,
			((BaseWeapon)BaseWeapon<Flamethrower>.instance).itemDef,
			MUP.gunStock
		};
		ContentAddition.AddBody(jacketBodyPrefab);
		jacketDisplayPrefab = PrefabAPI.InstantiateClone(Hunk.displayPrefab, "RobJacketDisplay", true);
		jacketDisplayPrefab.GetComponentInChildren<Animator>().runtimeAnimatorController = Assets.mainAssetBundle.LoadAsset<RuntimeAnimatorController>("animJacketCSS");
		((Component)jacketDisplayPrefab.GetComponentInChildren<ChildLocator>().FindChild("KnifeModel")).gameObject.SetActive(true);
		jacketMasterPrefab = PrefabAPI.InstantiateClone(Hunk.umbraMaster, "RobJacketMonsterMaster", true);
		CharacterMaster component4 = jacketMasterPrefab.GetComponent<CharacterMaster>();
		component4.bodyPrefab = jacketBodyPrefab;
		ContentAddition.AddMaster(jacketMasterPrefab);
	}

	private void CreateJacketSurvivor()
	{
		//IL_00a3: 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)
		jacketSurvivorDef = ScriptableObject.CreateInstance<SurvivorDef>();
		jacketSurvivorDef.bodyPrefab = jacketBodyPrefab;
		jacketSurvivorDef.displayPrefab = jacketDisplayPrefab;
		jacketSurvivorDef.displayNameToken = "Jacket";
		jacketSurvivorDef.descriptionToken = "";
		jacketSurvivorDef.outroFlavorToken = "..and so he left, buried behind the mask";
		jacketSurvivorDef.mainEndingEscapeFailureFlavorToken = "..and so he vanished doo doo fart";
		jacketSurvivorDef.desiredSortPosition = 3.99f;
		jacketSurvivorDef.unlockableDef = null;
		jacketSurvivorDef.cachedName = "Jacket";
		jacketSurvivorDef.primaryColor = new Color(29f / 51f, 0f, 1f);
		jacketSurvivorDef.hidden = true;
		ContentAddition.AddSurvivorDef(jacketSurvivorDef);
		SurvivorVariantDef val = ScriptableObject.CreateInstance<SurvivorVariantDef>();
		((Object)val).name = "Jacket";
		val.DisplayName = "Jacket";
		val.VariantSurvivor = jacketSurvivorDef;
		val.TargetSurvivor = Hunk.survivorDef;
		val.RequiredUnlock = null;
		val.Description = "From the hit game Payday 2!";
		SurvivorVariantCatalog.AddSurvivorVariant(val);
	}
}