Decompiled source of OldFeatherCape v1.0.5

plugins/OldFeatherCape.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OldFeatherCape")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldFeatherCape")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace OldFeatherCape;

internal class ArmorConfig
{
	private string name;

	private string description;

	private int maxQuality = 0;

	private float weight = 0f;

	private StatusEffect equipStatusEffect = null;

	private string setName = null;

	private int setSize = 0;

	private StatusEffect setStatusEffect = null;

	private float movementModifier = 0f;

	private float armor = 0f;

	private float armorPerLvl = 0f;

	private float maxDurability = 0f;

	private float durabilityPerLvl = 0f;

	private float equipTime = 0f;

	public ArmorConfig(string _name, string _desc, int _maxQual, float _weight, StatusEffect _equipeSE, string _setName, int _setSize, StatusEffect _setSE, float _movementMod, float _armor, float _armorPerLvl, float _maxDura, float _duraPerLvl, float _equipTime)
	{
		name = _name;
		description = _desc;
		maxQuality = _maxQual;
		weight = _weight;
		equipStatusEffect = _equipeSE;
		setName = _setName;
		setSize = _setSize;
		setStatusEffect = _setSE;
		movementModifier = _movementMod;
		armor = _armor;
		armorPerLvl = _armorPerLvl;
		maxDurability = _maxDura;
		durabilityPerLvl = _duraPerLvl;
		equipTime = _equipTime;
	}

	public void ApplyConfig(ItemDrop item)
	{
		item.m_itemData.m_shared.m_name = name;
		item.m_itemData.m_shared.m_description = description;
		if (maxQuality > 0)
		{
			item.m_itemData.m_shared.m_maxQuality = maxQuality;
		}
		if (weight > 0f)
		{
			item.m_itemData.m_shared.m_weight = weight;
		}
		if ((Object)(object)equipStatusEffect != (Object)null)
		{
			item.m_itemData.m_shared.m_equipStatusEffect = equipStatusEffect;
		}
		if (setName != null)
		{
			item.m_itemData.m_shared.m_setName = setName;
		}
		if (setSize > 0)
		{
			item.m_itemData.m_shared.m_setSize = setSize;
		}
		if ((Object)(object)setStatusEffect != (Object)null)
		{
			item.m_itemData.m_shared.m_setStatusEffect = setStatusEffect;
		}
		if (movementModifier != 0f)
		{
			item.m_itemData.m_shared.m_movementModifier = movementModifier;
		}
		if (armor > 0f)
		{
			item.m_itemData.m_shared.m_armor = armor;
		}
		if (armorPerLvl > 0f)
		{
			item.m_itemData.m_shared.m_armorPerLevel = armorPerLvl;
		}
		if (maxDurability > 0f)
		{
			item.m_itemData.m_shared.m_maxDurability = maxDurability;
		}
		if (durabilityPerLvl > 0f)
		{
			item.m_itemData.m_shared.m_durabilityPerLevel = durabilityPerLvl;
		}
		if (equipTime != 0f)
		{
			item.m_itemData.m_shared.m_equipDuration = equipTime;
		}
	}
}
[BepInPlugin("com.jumb0frame.OldFeatherCape", "OldFeatherCape", "1.0.4")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class OldFeatherCape : BaseUnityPlugin
{
	public const string PluginGUID = "com.jumb0frame.OldFeatherCape";

	public const string PluginName = "OldFeatherCape";

	public const string PluginVersion = "1.0.4";

	private static StatusEffectsConfig capeSetEffects;

	private static ArmorConfig capeArmorConfig;

	private static RecipeConfig capeRecipeConfig;

	private void Awake()
	{
		Logger.LogInfo((object)"OldFeatherCape has landed");
		capeSetEffects = new StatusEffectsConfig("Old Feather Cape Set effects", "Jig Bump", "Just let me jump all the way to the top of Yggdrasil; and fly back down safely!");
		capeSetEffects.SEStaminaConfig(0f, 0f, 0f, 0f, -0.2f, 0f, 0f, 0f, 0f, 0f, 0f, 0f);
		PrefabManager.OnVanillaPrefabsAvailable += AddOldFeatherCape;
	}

	private void AddOldFeatherCape()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: 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_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Expected O, but got Unknown
		//IL_007f: Expected O, but got Unknown
		//IL_007f: Expected O, but got Unknown
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Expected O, but got Unknown
		SE_Stats setEffects = capeSetEffects.getSetEffects();
		setEffects.m_maxMaxFallSpeed = 5f;
		setEffects.m_fallDamageModifier = -1f;
		setEffects.m_jumpModifier = new Vector3(0f, 0.2f, 0f);
		capeRecipeConfig = new RecipeConfig("Old Feather Cape Config", "Old Feather Cape description config", "piece_magetable", "piece_magetable", 1, new RequirementConfig("Feathers", 10, 2, false), new RequirementConfig("ScaleHide", 5, 5, false), new RequirementConfig("Eitr", 20, 3, false));
		capeArmorConfig = new ArmorConfig("Old Feather Cape", "The feather cape, but when it used to be great!", 4, 4f, (StatusEffect)(object)setEffects, null, 0, null, 0f, 1f, 1f, 1200f, 50f, 0f);
		CustomItem val = new CustomItem("OldCapeFeather", "CapeFeather", capeRecipeConfig.GetRecipeConfig());
		ItemManager.Instance.AddItem(val);
		capeArmorConfig.ApplyConfig(val.ItemDrop);
		PrefabManager.OnVanillaPrefabsAvailable -= AddOldFeatherCape;
	}
}
internal class RecipeConfig
{
	private string name;

	private string description;

	private string craftStation;

	private string repairStation;

	private int stationLvl;

	private RequirementConfig requirementConfig1 = null;

	private RequirementConfig requirementConfig2 = null;

	private RequirementConfig requirementConfig3 = null;

	private RequirementConfig requirementConfig4 = null;

	public RecipeConfig(string _name, string _desc, string _craft, string _repair, int _stationLvl, RequirementConfig _req1)
	{
		name = _name;
		description = _desc;
		craftStation = _craft;
		repairStation = _repair;
		stationLvl = _stationLvl;
		requirementConfig1 = _req1;
	}

	public RecipeConfig(string _name, string _desc, string _craft, string _repair, int _stationLvl, RequirementConfig _req1, RequirementConfig _req2)
	{
		name = _name;
		description = _desc;
		craftStation = _craft;
		repairStation = _repair;
		stationLvl = _stationLvl;
		requirementConfig1 = _req1;
		requirementConfig2 = _req2;
	}

	public RecipeConfig(string _name, string _desc, string _craft, string _repair, int _stationLvl, RequirementConfig _req1, RequirementConfig _req2, RequirementConfig _req3)
	{
		name = _name;
		description = _desc;
		craftStation = _craft;
		repairStation = _repair;
		stationLvl = _stationLvl;
		requirementConfig1 = _req1;
		requirementConfig2 = _req2;
		requirementConfig3 = _req3;
	}

	public RecipeConfig(string _name, string _desc, string _craft, string _repair, int _stationLvl, RequirementConfig _req1, RequirementConfig _req2, RequirementConfig _req3, RequirementConfig _req4)
	{
		name = _name;
		description = _desc;
		craftStation = _craft;
		repairStation = _repair;
		stationLvl = _stationLvl;
		requirementConfig1 = _req1;
		requirementConfig2 = _req2;
		requirementConfig3 = _req3;
		requirementConfig4 = _req4;
	}

	public ItemConfig GetRecipeConfig()
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		ItemConfig val = new ItemConfig();
		val.Name = name;
		val.Description = description;
		val.CraftingStation = craftStation;
		val.RepairStation = repairStation;
		val.MinStationLevel = stationLvl;
		val.AddRequirement(requirementConfig1);
		if (requirementConfig2 != null)
		{
			val.AddRequirement(requirementConfig2);
		}
		if (requirementConfig3 != null)
		{
			val.AddRequirement(requirementConfig3);
		}
		if (requirementConfig4 != null)
		{
			val.AddRequirement(requirementConfig4);
		}
		return val;
	}
}
internal class StatusEffectsConfig
{
	private string unityEffectsName;

	private string name;

	private string tooltip;

	private SkillType raiseSkill;

	private float raiseSkillModifier = 0f;

	private DamageTypes percentDamageModifier;

	private float staminaOverTime = 0f;

	private float staminaOverTimeDuration = 0f;

	private float staminaDrainPerSec = 0f;

	private float runStaminaDrainModifier = 0f;

	private float jumpStaminaUseModifier = 0f;

	private float attackStaminaUseModifier = 0f;

	private float blockStaminaUseModifier = 0f;

	private float dodgeStaminaUseModifier = 0f;

	private float swimStaminaUseModifier = 0f;

	private float homeItemStaminaUseModifier = 0f;

	private float sneakStaminaUseModifier = 0f;

	private float runStaminaUseModifier = 0f;

	private float healthRegenMultiplier = 1f;

	private float staminaRegenMultiplier = 1f;

	private float eitrRegenMultiplier = 1f;

	public StatusEffectsConfig(string _unityEffectsName, string _name, string _tooltip)
	{
		unityEffectsName = _unityEffectsName;
		name = _name;
		tooltip = _tooltip;
	}

	public void SESkillConfig(SkillType _raiseSkill, float _raiseSkillModifier)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		raiseSkill = _raiseSkill;
		raiseSkillModifier = _raiseSkillModifier;
	}

	public void SEAttackConfig(float _bluntModifier = 0f, float _slashModifier = 0f, float _pierceModifier = 0f, float _chopModifier = 0f, float _pickaxeModifier = 0f, float _fireModifier = 0f, float _frostModifier = 0f, float _lightningModifier = 0f, float _poisonModifier = 0f, float _spiritModifier = 0f)
	{
		if (_bluntModifier != 0f)
		{
			percentDamageModifier.m_blunt = _bluntModifier;
		}
		if (_slashModifier != 0f)
		{
			percentDamageModifier.m_slash = _slashModifier;
		}
		if (_pierceModifier != 0f)
		{
			percentDamageModifier.m_pierce = _pierceModifier;
		}
		if (_chopModifier != 0f)
		{
			percentDamageModifier.m_chop = _chopModifier;
		}
		if (_pickaxeModifier != 0f)
		{
			percentDamageModifier.m_pickaxe = _pickaxeModifier;
		}
		if (_fireModifier != 0f)
		{
			percentDamageModifier.m_fire = _fireModifier;
		}
		if (_frostModifier != 0f)
		{
			percentDamageModifier.m_frost = _frostModifier;
		}
		if (_lightningModifier != 0f)
		{
			percentDamageModifier.m_lightning = _lightningModifier;
		}
		if (_poisonModifier != 0f)
		{
			percentDamageModifier.m_poison = _poisonModifier;
		}
		if (_spiritModifier != 0f)
		{
			percentDamageModifier.m_spirit = _spiritModifier;
		}
	}

	public void SEStaminaConfig(float _staminaOverTime, float _staminaOverTimeDuration, float _staminaDrainPerSec, float _runStaminaDrainModifier, float _jumpStaminaUseModifier, float _attackStaminaUseModifier, float _blockStaminaUseModifier, float _dodgeStaminaUseModifier, float _swimStaminaUseModifier, float _homeItemStaminaUseModifier, float _sneakStaminaUseModifier, float _runStaminaUseModifier)
	{
		staminaOverTime = _staminaOverTime;
		staminaOverTimeDuration = _staminaOverTimeDuration;
		staminaDrainPerSec = _staminaDrainPerSec;
		runStaminaDrainModifier = _runStaminaDrainModifier;
		jumpStaminaUseModifier = _jumpStaminaUseModifier;
		attackStaminaUseModifier = _attackStaminaUseModifier;
		blockStaminaUseModifier = _blockStaminaUseModifier;
		dodgeStaminaUseModifier = _dodgeStaminaUseModifier;
		swimStaminaUseModifier = _swimStaminaUseModifier;
		homeItemStaminaUseModifier = _homeItemStaminaUseModifier;
		sneakStaminaUseModifier = _sneakStaminaUseModifier;
		runStaminaUseModifier = _runStaminaUseModifier;
	}

	public void SERegenConfig(float _healthRegenMultiplier, float _staminaRegenMultiplier, float _eitrRegenMultiplier)
	{
		healthRegenMultiplier += _healthRegenMultiplier;
		staminaRegenMultiplier += _staminaRegenMultiplier;
		eitrRegenMultiplier += _eitrRegenMultiplier;
	}

	public SE_Stats getSetEffects()
	{
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>();
		((Object)val).name = unityEffectsName;
		((StatusEffect)val).m_name = name;
		((StatusEffect)val).m_tooltip = tooltip;
		if (raiseSkillModifier != 0f)
		{
			val.m_raiseSkill = raiseSkill;
			val.m_raiseSkillModifier = raiseSkillModifier;
		}
		val.m_percentigeDamageModifiers = percentDamageModifier;
		if (staminaOverTime != 0f)
		{
			val.m_staminaOverTime = staminaOverTime;
		}
		if (staminaOverTimeDuration != 0f)
		{
			val.m_staminaOverTimeDuration = staminaOverTimeDuration;
		}
		if (staminaDrainPerSec != 0f)
		{
			val.m_staminaDrainPerSec = staminaDrainPerSec;
		}
		if (runStaminaDrainModifier != 0f)
		{
			val.m_runStaminaDrainModifier = runStaminaDrainModifier;
		}
		if (jumpStaminaUseModifier != 0f)
		{
			val.m_jumpStaminaUseModifier = jumpStaminaUseModifier;
		}
		if (attackStaminaUseModifier != 0f)
		{
			val.m_attackStaminaUseModifier = attackStaminaUseModifier;
		}
		if (blockStaminaUseModifier != 0f)
		{
			val.m_blockStaminaUseModifier = blockStaminaUseModifier;
		}
		if (dodgeStaminaUseModifier != 0f)
		{
			val.m_dodgeStaminaUseModifier = dodgeStaminaUseModifier;
		}
		if (swimStaminaUseModifier != 0f)
		{
			val.m_swimStaminaUseModifier = swimStaminaUseModifier;
		}
		if (homeItemStaminaUseModifier != 0f)
		{
			val.m_homeItemStaminaUseModifier = homeItemStaminaUseModifier;
		}
		if (sneakStaminaUseModifier != 0f)
		{
			val.m_sneakStaminaUseModifier = sneakStaminaUseModifier;
		}
		if (runStaminaUseModifier != 0f)
		{
			val.m_runStaminaUseModifier = runStaminaUseModifier;
		}
		if (healthRegenMultiplier != 1f)
		{
			val.m_healthRegenMultiplier = healthRegenMultiplier;
		}
		if (staminaRegenMultiplier != 1f)
		{
			val.m_staminaRegenMultiplier = staminaRegenMultiplier;
		}
		if (eitrRegenMultiplier != 1f)
		{
			val.m_eitrRegenMultiplier = eitrRegenMultiplier;
		}
		return val;
	}
}