Decompiled source of ModifiedAskSet v1.0.0

plugins/ModifiedAskSet.dll

Decompiled 2 months ago
using System;
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("ModifiedAskSet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ModifiedAskSet")]
[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 ModifiedAskSet;

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;
		}
	}
}
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;
	}
}
[BepInPlugin("com.jumb0frame.ModifiedAskSet", "ModifiedAskSet", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class ModifiedAskSet : BaseUnityPlugin
{
	public const string PluginGUID = "com.jumb0frame.ModifiedAskSet";

	public const string PluginName = "ModifiedAskSet";

	public const string PluginVersion = "1.0.0";

	public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

	private static StatusEffectsConfig setStatusEffects;

	private static StatusEffectsConfig hoodEquipEffects;

	private static StatusEffectsConfig chestEquipEffects;

	private static StatusEffectsConfig legsEquipEffects;

	private static ArmorConfig hoodArmorConfig;

	private static ArmorConfig chestArmorConfig;

	private static ArmorConfig legsArmorConfig;

	private static RecipeConfig hoodRecipeConfig;

	private static RecipeConfig chestRecipeConfig;

	private static RecipeConfig legsRecipeConfig;

	private void Awake()
	{
		Logger.LogInfo((object)"ModifiedAskSet has landed");
		try
		{
			setStatusEffects = new StatusEffectsConfig("Modified Ask Effect", "Better Ask's Endurance", "Better Ask's tooltip");
			setStatusEffects.SEAttackConfig(0f, 0.15f, 0.15f);
			setStatusEffects.SEStaminaConfig(0f, 0f, 0f, -0.1f, -0.1f, -0.2f, 0f, 0f, 0f, 0f, 0f, 0f);
			PrefabManager.OnVanillaPrefabsAvailable += AddModifiedAsksvinArmor;
		}
		catch (Exception ex)
		{
			Logger.LogInfo((object)ex);
		}
	}

	private void AddModifiedAsksvinArmor()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Expected O, but got Unknown
		//IL_005d: Expected O, but got Unknown
		//IL_005d: Expected O, but got Unknown
		//IL_005d: Expected O, but got Unknown
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Expected O, but got Unknown
		//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0105: 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_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Expected O, but got Unknown
		//IL_012a: Expected O, but got Unknown
		//IL_012a: Expected O, but got Unknown
		//IL_012a: Expected O, but got Unknown
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Expected O, but got Unknown
		//IL_01c3: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f7: Expected O, but got Unknown
		//IL_01f7: Expected O, but got Unknown
		//IL_01f7: Expected O, but got Unknown
		//IL_01f7: Expected O, but got Unknown
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Expected O, but got Unknown
		SE_Stats setEffects = setStatusEffects.getSetEffects();
		hoodRecipeConfig = new RecipeConfig("Better Ask Hood Config", "Better Ask Hood description config", "blackforge", "blackforge", 3, new RequirementConfig("MoltenCore", 2, 1, false), new RequirementConfig("LinenThread", 15, 10, false), new RequirementConfig("AskHide", 10, 5, false), new RequirementConfig("LoxPelt", 4, 2, false));
		hoodArmorConfig = new ArmorConfig("Better Ask Hood", "Better Ask Hood description", 4, 1f, null, "Modified Ask Set", 3, (StatusEffect)(object)setEffects, 0f, 28f, 2f, 1000f, 200f, 0f);
		CustomItem val = new CustomItem("ModifiedAskHood", "HelmetAshlandsMediumHood", hoodRecipeConfig.GetRecipeConfig());
		ItemManager.Instance.AddItem(val);
		hoodArmorConfig.ApplyConfig(val.ItemDrop);
		chestRecipeConfig = new RecipeConfig("Better Ask Chest Config", "Better Ask Chest description config", "blackforge", "blackforge", 3, new RequirementConfig("MoltenCore", 2, 1, false), new RequirementConfig("LinenThread", 15, 10, false), new RequirementConfig("AskHide", 10, 5, false), new RequirementConfig("LoxPelt", 4, 2, false));
		chestArmorConfig = new ArmorConfig("Better Ask Chest", "Better Ask Chest description", 4, 5f, null, "Modified Ask Set", 3, (StatusEffect)(object)setEffects, 0f, 28f, 2f, 1000f, 200f, 0f);
		CustomItem val2 = new CustomItem("ModifiedAskChest", "ArmorAshlandsMediumChest", chestRecipeConfig.GetRecipeConfig());
		ItemManager.Instance.AddItem(val2);
		chestArmorConfig.ApplyConfig(val2.ItemDrop);
		legsRecipeConfig = new RecipeConfig("Better Ask Legs Config", "Better Ask Legs description config", "blackforge", "blackforge", 3, new RequirementConfig("MoltenCore", 2, 1, false), new RequirementConfig("LinenThread", 15, 10, false), new RequirementConfig("AskHide", 10, 5, false), new RequirementConfig("LoxPelt", 4, 2, false));
		legsArmorConfig = new ArmorConfig("Better Ask Legs", "Better Ask Legs description", 4, 5f, null, "Modified Ask Set", 3, (StatusEffect)(object)setEffects, 0f, 28f, 2f, 1000f, 200f, 0f);
		CustomItem val3 = new CustomItem("ModifiedAskLegs", "ArmorAshlandsMediumlegs", legsRecipeConfig.GetRecipeConfig());
		ItemManager.Instance.AddItem(val3);
		legsArmorConfig.ApplyConfig(val3.ItemDrop);
		PrefabManager.OnVanillaPrefabsAvailable -= AddModifiedAsksvinArmor;
	}
}
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;
	}
}