Decompiled source of ExtendedStatusEffects v0.0.1

plugins/ValkyrieStatusEffects.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using HarmonyLib;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using SimpleJson;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ValkyrieStatusEffects")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ValkyrieStatusEffects")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("58b2d542-66ac-4436-a3db-8844bb0c7991")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ValkyrieStatusEffects;

public class ExtendedStatusEffect : SE_Stats
{
	public float m_maxHealth;

	public float m_maxStamina;

	public float m_maxEitr;

	public float m_damageReduction;

	public Dictionary<SkillType, float> m_weaponDamageModifiers = new Dictionary<SkillType, float>();

	public float m_healingMultiplier;

	public string GetWeaponDamageModifiersTooltip()
	{
		//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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected I4, but got Unknown
		if (m_weaponDamageModifiers.Count == 0)
		{
			return "";
		}
		string text = "";
		foreach (KeyValuePair<SkillType, float> weaponDamageModifier in m_weaponDamageModifiers)
		{
			if (weaponDamageModifier.Value != 0f)
			{
				SkillType key = weaponDamageModifier.Key;
				switch (key - 1)
				{
				case 6:
					text += "\n$skill_axes: ";
					break;
				case 9:
					text += "\n$skill_bloodmagic: ";
					break;
				case 7:
					text += "\n$skill_bows: ";
					break;
				case 2:
					text += "\n$skill_clubs: ";
					break;
				case 13:
					text += "\n$skill_crossbows: ";
					break;
				case 8:
					text += "\n$skill_elementalmagic: ";
					break;
				case 1:
					text += "\n$skill_knives: ";
					break;
				case 11:
					text += "\n$skill_pickaxes: ";
					break;
				case 3:
					text += "\n$skill_polearms: ";
					break;
				case 4:
					text += "\n$skill_spears: ";
					break;
				case 0:
					text += "\n$skill_swords: ";
					break;
				case 10:
					text += "\n$skill_unarmed: ";
					break;
				}
				text += $"<color=orange>{((weaponDamageModifier.Value > 0f) ? '+' : '-')}{weaponDamageModifier.Value * 100f}% DMG</color>";
			}
		}
		return text;
	}

	public override string GetTooltipString()
	{
		//IL_054e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
		StringBuilder stringBuilder = new StringBuilder(256);
		if (((StatusEffect)this).m_tooltip.Length > 0)
		{
			stringBuilder.AppendFormat("{0}\n", ((StatusEffect)this).m_tooltip);
		}
		if (base.m_runStaminaDrainModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_runstamina: <color=orange>{0}%</color>\n", (base.m_runStaminaDrainModifier * 100f).ToString("+0;-0"));
		}
		if (m_maxHealth != 0f)
		{
			stringBuilder.AppendFormat("HP: <color=orange>{0}</color>\n", m_maxHealth.ToString());
		}
		if (base.m_healthOverTime != 0f)
		{
			stringBuilder.AppendFormat("$se_health: <color=orange>{0}</color>\n", base.m_healthOverTime.ToString());
		}
		if (m_maxStamina != 0f)
		{
			stringBuilder.AppendFormat("Stamina: <color=orange>{0}</color>\n", m_maxStamina.ToString());
		}
		if (base.m_staminaOverTime != 0f)
		{
			stringBuilder.AppendFormat("$se_stamina: <color=orange>{0}</color>\n", base.m_staminaOverTime.ToString());
		}
		if (m_maxEitr != 0f)
		{
			stringBuilder.AppendFormat("Eitr: <color=orange>{0}</color>\n", m_maxEitr.ToString());
		}
		if (base.m_eitrOverTime != 0f)
		{
			stringBuilder.AppendFormat("$se_eitr: <color=orange>{0}</color>\n", base.m_eitrOverTime.ToString());
		}
		if (base.m_healthRegenMultiplier != 1f)
		{
			stringBuilder.AppendFormat("$se_healthregen: <color=orange>{0}%</color>\n", ((base.m_healthRegenMultiplier - 1f) * 100f).ToString("+0;-0"));
		}
		if (base.m_staminaRegenMultiplier != 1f)
		{
			stringBuilder.AppendFormat("$se_staminaregen: <color=orange>{0}%</color>\n", ((base.m_staminaRegenMultiplier - 1f) * 100f).ToString("+0;-0"));
		}
		if (base.m_eitrRegenMultiplier != 1f)
		{
			stringBuilder.AppendFormat("$se_eitrregen: <color=orange>{0}%</color>\n", ((base.m_eitrRegenMultiplier - 1f) * 100f).ToString("+0;-0"));
		}
		if (base.m_addMaxCarryWeight != 0f)
		{
			stringBuilder.AppendFormat("$se_max_carryweight: <color=orange>{0}</color>\n", base.m_addMaxCarryWeight.ToString("+0;-0"));
		}
		if (base.m_mods.Count > 0)
		{
			stringBuilder.Append(SE_Stats.GetDamageModifiersTooltipString(base.m_mods));
			stringBuilder.Append("\n");
		}
		if (base.m_noiseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_noisemod: <color=orange>{0}%</color>\n", (base.m_noiseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_stealthModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_sneakmod: <color=orange>{0}%</color>\n", (base.m_stealthModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_speedModifier != 0f)
		{
			stringBuilder.AppendFormat("$item_movement_modifier: <color=orange>{0}%</color>\n", (base.m_speedModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_maxMaxFallSpeed != 0f)
		{
			stringBuilder.AppendFormat("$item_limitfallspeed: <color=orange>{0}m/s</color>\n", base.m_maxMaxFallSpeed.ToString("0"));
		}
		if (base.m_fallDamageModifier != 0f)
		{
			stringBuilder.AppendFormat("$item_falldamage: <color=orange>{0}%</color>\n", (base.m_fallDamageModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_jumpModifier.y != 0f)
		{
			stringBuilder.AppendFormat("$se_jumpheight: <color=orange>{0}%</color>\n", (base.m_jumpModifier.y * 100f).ToString("+0;-0"));
		}
		if (base.m_jumpModifier.x != 0f || base.m_jumpModifier.z != 0f)
		{
			stringBuilder.AppendFormat("$se_jumplength: <color=orange>{0}%</color>\n", (Mathf.Max(base.m_jumpModifier.x, base.m_jumpModifier.z) * 100f).ToString("+0;-0"));
		}
		if (base.m_jumpStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_jumpstamina: <color=orange>{0}%</color>\n", (base.m_jumpStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_attackStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_attackstamina: <color=orange>{0}%</color>\n", (base.m_attackStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_blockStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_blockstamina: <color=orange>{0}%</color>\n", (base.m_blockStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_dodgeStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_dodgestamina: <color=orange>{0}%</color>\n", (base.m_dodgeStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_swimStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_swimstamina: <color=orange>{0}%</color>\n", (base.m_dodgeStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_homeItemStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$base_item_modifier: <color=orange>{0}%</color>\n", (base.m_homeItemStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_sneakStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_sneakstamina: <color=orange>{0}%</color>\n", (base.m_sneakStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if (base.m_runStaminaUseModifier != 0f)
		{
			stringBuilder.AppendFormat("$se_runstamina: <color=orange>{0}%</color>\n", (base.m_runStaminaUseModifier * 100f).ToString("+0;-0"));
		}
		if ((int)base.m_skillLevel != 0 && base.m_skillLevelModifier != 0f)
		{
			stringBuilder.AppendFormat("{0} <color=orange>{1}</color>\n", Localization.instance.Localize("$skill_" + ((object)(SkillType)(ref base.m_skillLevel)).ToString().ToLower()), base.m_skillLevelModifier.ToString("+0;-0"));
		}
		if ((int)base.m_skillLevel2 != 0 && base.m_skillLevelModifier2 != 0f)
		{
			stringBuilder.AppendFormat("{0} <color=orange>{1}</color>\n", Localization.instance.Localize("$skill_" + ((object)(SkillType)(ref base.m_skillLevel2)).ToString().ToLower()), base.m_skillLevelModifier2.ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_blunt != 0f)
		{
			stringBuilder.AppendFormat("$inventory_blunt: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_blunt * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_slash != 0f)
		{
			stringBuilder.AppendFormat("$inventory_slash: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_slash * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_pierce != 0f)
		{
			stringBuilder.AppendFormat("$inventory_pierce: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_pierce * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_chop != 0f)
		{
			stringBuilder.AppendFormat("$inventory_chop: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_chop * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_pickaxe != 0f)
		{
			stringBuilder.AppendFormat("$inventory_pickaxe: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_pickaxe * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_fire != 0f)
		{
			stringBuilder.AppendFormat("$inventory_fire: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_fire * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_frost != 0f)
		{
			stringBuilder.AppendFormat("$inventory_frost: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_frost * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_lightning != 0f)
		{
			stringBuilder.AppendFormat("$inventory_lightning: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_lightning * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_poison != 0f)
		{
			stringBuilder.AppendFormat("$inventory_poison: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_poison * 100f).ToString("+0;-0"));
		}
		if (base.m_percentigeDamageModifiers.m_spirit != 0f)
		{
			stringBuilder.AppendFormat("$inventory_spirit: <color=orange>{0}%</color>\n", (base.m_percentigeDamageModifiers.m_spirit * 100f).ToString("+0;-0"));
		}
		if (m_damageReduction != 0f)
		{
			stringBuilder.AppendFormat("Reducción de daño: <color=orange>{0}%</color>\n", (m_damageReduction * 100f).ToString("+0;-0"));
		}
		if (m_weaponDamageModifiers.Count > 0)
		{
			stringBuilder.Append(GetWeaponDamageModifiersTooltip());
			stringBuilder.Append("\n");
		}
		return stringBuilder.ToString();
	}
}
[BepInPlugin("com.valkyrie.statuseffects", "Valkyrie's Status Effects", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin
{
	[HarmonyPatch]
	private class Patches
	{
		private static readonly Converter<StatusEffect, ExtendedStatusEffect> SEtoESEConverter = (StatusEffect se) => (ExtendedStatusEffect)(object)se;

		private static List<ExtendedStatusEffect> GetExtendedSEs(SEMan seman)
		{
			return seman.GetStatusEffects().FindAll((StatusEffect se) => ((object)se).GetType() == typeof(ExtendedStatusEffect)).ConvertAll(SEtoESEConverter);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(Attack), "ModifyDamage")]
		private static void Attack_ModifyDamagePatch(ref HitData hitData, ref float damageFactor)
		{
			//IL_0037: 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)
			foreach (ExtendedStatusEffect extendedSE in GetExtendedSEs(hitData.GetAttacker().GetSEMan()))
			{
				foreach (KeyValuePair<SkillType, float> weaponDamageModifier in extendedSE.m_weaponDamageModifiers)
				{
					if (hitData.m_skill == weaponDamageModifier.Key)
					{
						((DamageTypes)(ref hitData.m_damage)).Modify(1f + weaponDamageModifier.Value);
					}
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Character), "RPC_Damage")]
		private static void Character_RPC_DamagePatch(Character __instance, long sender, ref HitData hit)
		{
			List<ExtendedStatusEffect> extendedSEs = GetExtendedSEs(__instance.GetSEMan());
			float num = 0f;
			foreach (ExtendedStatusEffect item in extendedSEs)
			{
				num += item.m_damageReduction;
			}
			float num2 = 1f - num;
			((DamageTypes)(ref hit.m_damage)).Modify(num2);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Player), "GetTotalFoodValue")]
		private static bool Player_UpdateStatsPatch(Player __instance, out float hp, out float stamina, out float eitr)
		{
			hp = __instance.m_baseHP;
			stamina = __instance.m_baseStamina;
			eitr = 0f;
			foreach (Food food in __instance.GetFoods())
			{
				hp += food.m_health;
				stamina += food.m_stamina;
				eitr += food.m_eitr;
			}
			foreach (ExtendedStatusEffect extendedSE in GetExtendedSEs(((Character)__instance).GetSEMan()))
			{
				hp += extendedSE.m_maxHealth;
				stamina += extendedSE.m_maxStamina;
				eitr += extendedSE.m_maxEitr;
			}
			return false;
		}
	}

	public const string PluginGUID = "com.valkyrie.statuseffects";

	public const string PluginName = "Valkyrie's Status Effects";

	public const string PluginVersion = "0.0.1";

	public static Dictionary<int, StatusEffect> statusEffects = new Dictionary<int, StatusEffect>();

	private static readonly string pluginPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

	private static readonly string configPath = Paths.ConfigPath;

	private static readonly string seFolderPath = Path.Combine(configPath, "ValkyrieStatusEffects");

	private static readonly string iconsPath = Path.Combine(seFolderPath, "Icons");

	private static Harmony harm = new Harmony("ValkyrieStatusEffects");

	private void Awake()
	{
		SetupFiles();
		DefaultJSON();
		PrefabManager.OnVanillaPrefabsAvailable += delegate
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			CustomItem val = new CustomItem("KerekMegChest", "ArmorBronzeChest");
			val.ItemDrop.m_itemData.m_shared.m_equipStatusEffect = GeneralExtensions.GetValueSafe<int, StatusEffect>(statusEffects, StringExtensionMethods.GetStableHashCode("Kerek Meg"));
			ItemManager.Instance.AddItem(val);
		};
		harm.PatchAll();
	}

	private void SetupFiles()
	{
		if (!Directory.Exists(seFolderPath))
		{
			Directory.CreateDirectory(seFolderPath);
		}
	}

	private void LoadAllSE()
	{
		string[] directories = Directory.GetDirectories(seFolderPath);
		for (int i = 0; i < directories.Length; i++)
		{
			string[] files = Directory.GetFiles(directories[i]);
			foreach (string path in files)
			{
				LoadSE(path);
			}
		}
		directories = Directory.GetFiles(seFolderPath);
		foreach (string path2 in directories)
		{
			LoadSE(path2);
		}
	}

	private void LoadSE(string path)
	{
		File.Exists(path);
	}

	private void DefaultJSON()
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: 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_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: 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_00f4: Expected O, but got Unknown
		ExtendedStatusEffect extendedStatusEffect = ScriptableObject.CreateInstance<ExtendedStatusEffect>();
		((Object)extendedStatusEffect).name = "Test Extended SE";
		((StatusEffect)extendedStatusEffect).m_name = "Test Extended SE";
		((StatusEffect)extendedStatusEffect).m_attributes = (StatusAttribute)2;
		((SE_Stats)extendedStatusEffect).m_mods = new List<DamageModPair>
		{
			new DamageModPair
			{
				m_modifier = (DamageModifier)3,
				m_type = (DamageType)1
			},
			new DamageModPair
			{
				m_modifier = (DamageModifier)6,
				m_type = (DamageType)224
			},
			new DamageModPair
			{
				m_modifier = (DamageModifier)1,
				m_type = (DamageType)8
			}
		};
		((SE_Stats)extendedStatusEffect).m_raiseSkill = (SkillType)10;
		extendedStatusEffect.m_maxEitr = 50f;
		extendedStatusEffect.m_maxStamina = 75f;
		extendedStatusEffect.m_maxHealth = 100f;
		string contents = SimpleJson.SerializeObject((object)SerializeSE(extendedStatusEffect));
		string path = Path.Combine(seFolderPath, "SE_Default.json");
		File.WriteAllText(path, contents);
		DeserializeSE(File.ReadAllText(path));
		CustomStatusEffect val = new CustomStatusEffect((StatusEffect)(object)extendedStatusEffect, false);
		statusEffects.Add(StringExtensionMethods.GetStableHashCode(((Object)extendedStatusEffect).name), val.StatusEffect);
		ItemManager.Instance.AddStatusEffect(val);
	}

	private ExtendedStatusEffect DeserializeSE(Dictionary<string, object> sse)
	{
		//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_00a0: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cd: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_024a: Unknown result type (might be due to invalid IL or missing references)
		//IL_024f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0272: Unknown result type (might be due to invalid IL or missing references)
		//IL_0277: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: 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_0321: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
		ExtendedStatusEffect extendedStatusEffect = new ExtendedStatusEffect();
		((Object)extendedStatusEffect).name = GeneralExtensions.GetTypedValue<string>(sse, "name");
		((StatusEffect)extendedStatusEffect).m_name = GeneralExtensions.GetTypedValue<string>(sse, "m_name");
		((StatusEffect)extendedStatusEffect).m_activationAnimation = GeneralExtensions.GetTypedValue<string>(sse, "m_activationAnimation");
		((StatusEffect)extendedStatusEffect).m_attributes = DeserializeEnum<StatusAttribute>(GeneralExtensions.GetTypedValue<string>(sse, "m_attributes"));
		((StatusEffect)extendedStatusEffect).m_category = GeneralExtensions.GetTypedValue<string>(sse, "m_category");
		((StatusEffect)extendedStatusEffect).m_cooldown = GeneralExtensions.GetTypedValue<float>(sse, "m_cooldown");
		((StatusEffect)extendedStatusEffect).m_repeatInterval = GeneralExtensions.GetTypedValue<float>(sse, "m_repeatInterval");
		((StatusEffect)extendedStatusEffect).m_repeatMessage = GeneralExtensions.GetTypedValue<string>(sse, "m_repeatMessage");
		((StatusEffect)extendedStatusEffect).m_repeatMessageType = DeserializeEnum<MessageType>(GeneralExtensions.GetTypedValue<string>(sse, "m_repeatMessageType"));
		((StatusEffect)extendedStatusEffect).m_startMessage = GeneralExtensions.GetTypedValue<string>(sse, "m_startMessage");
		((StatusEffect)extendedStatusEffect).m_startMessageType = DeserializeEnum<MessageType>(GeneralExtensions.GetTypedValue<string>(sse, "m_startMessageType"));
		((StatusEffect)extendedStatusEffect).m_stopMessage = GeneralExtensions.GetTypedValue<string>(sse, "m_stopMessage");
		((StatusEffect)extendedStatusEffect).m_stopMessageType = DeserializeEnum<MessageType>(GeneralExtensions.GetTypedValue<string>(sse, "m_stopMessageType"));
		((StatusEffect)extendedStatusEffect).m_tooltip = GeneralExtensions.GetTypedValue<string>(sse, "m_tooltip");
		((StatusEffect)extendedStatusEffect).m_ttl = GeneralExtensions.GetTypedValue<float>(sse, "m_ttl");
		((SE_Stats)extendedStatusEffect).m_tickInterval = GeneralExtensions.GetTypedValue<float>(sse, "m_tickInterval");
		extendedStatusEffect.m_maxHealth = GeneralExtensions.GetTypedValue<float>(sse, "m_maxHealth");
		extendedStatusEffect.m_maxStamina = GeneralExtensions.GetTypedValue<float>(sse, "m_maxStamina");
		extendedStatusEffect.m_maxEitr = GeneralExtensions.GetTypedValue<float>(sse, "m_maxEitr");
		((SE_Stats)extendedStatusEffect).m_maxMaxFallSpeed = GeneralExtensions.GetTypedValue<float>(sse, "m_maxMaxFallSpeed");
		((SE_Stats)extendedStatusEffect).m_addMaxCarryWeight = GeneralExtensions.GetTypedValue<float>(sse, "m_addMaxCarryWeight");
		((SE_Stats)extendedStatusEffect).m_damageModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_damageModifier");
		((SE_Stats)extendedStatusEffect).m_eitrOverTime = GeneralExtensions.GetTypedValue<float>(sse, "m_eitrOverTime");
		((SE_Stats)extendedStatusEffect).m_eitrOverTimeDuration = GeneralExtensions.GetTypedValue<float>(sse, "m_eitrOverTimeDuration");
		((SE_Stats)extendedStatusEffect).m_eitrRegenMultiplier = GeneralExtensions.GetTypedValue<float>(sse, "m_eitrRegenMultiplier");
		((SE_Stats)extendedStatusEffect).m_fallDamageModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_fallDamageModifier");
		((SE_Stats)extendedStatusEffect).m_healthOverTime = GeneralExtensions.GetTypedValue<float>(sse, "m_healthOverTime");
		((SE_Stats)extendedStatusEffect).m_healthOverTimeDuration = GeneralExtensions.GetTypedValue<float>(sse, "m_healthOverTimeDuration");
		((SE_Stats)extendedStatusEffect).m_healthOverTimeInterval = GeneralExtensions.GetTypedValue<float>(sse, "m_healthOverTimeInterval");
		((SE_Stats)extendedStatusEffect).m_healthPerTick = GeneralExtensions.GetTypedValue<float>(sse, "m_healthPerTick");
		((SE_Stats)extendedStatusEffect).m_healthPerTickMinHealthPercentage = GeneralExtensions.GetTypedValue<float>(sse, "m_healthPerTickMinHealthPercentage");
		((SE_Stats)extendedStatusEffect).m_healthRegenMultiplier = GeneralExtensions.GetTypedValue<float>(sse, "m_healthRegenMultiplier");
		((SE_Stats)extendedStatusEffect).m_jumpModifier = ParseVector3(GeneralExtensions.GetTypedValue<string>(sse, "m_jumpModifier"));
		((SE_Stats)extendedStatusEffect).m_jumpStaminaUseModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_jumpStaminaUseModifier");
		((SE_Stats)extendedStatusEffect).m_modifyAttackSkill = DeserializeEnum<SkillType>(GeneralExtensions.GetTypedValue<string>(sse, "m_modifyAttackSkill"));
		((SE_Stats)extendedStatusEffect).m_mods = DeserializeDamageModifiers((Dictionary<string, string>)SimpleJson.DeserializeObject(GeneralExtensions.GetTypedValue<string>(sse, "m_mods")));
		((SE_Stats)extendedStatusEffect).m_noiseModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_noiseModifier");
		((SE_Stats)extendedStatusEffect).m_raiseSkill = DeserializeEnum<SkillType>(GeneralExtensions.GetTypedValue<string>(sse, "m_raiseSkill"));
		((SE_Stats)extendedStatusEffect).m_raiseSkillModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_raiseSkillModifier");
		((SE_Stats)extendedStatusEffect).m_runStaminaDrainModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_runStaminaDrainModifier");
		((SE_Stats)extendedStatusEffect).m_skillLevel = DeserializeEnum<SkillType>(GeneralExtensions.GetTypedValue<string>(sse, "m_skillLevel"));
		((SE_Stats)extendedStatusEffect).m_skillLevelModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_skillLevelModifier");
		((SE_Stats)extendedStatusEffect).m_skillLevel2 = DeserializeEnum<SkillType>(GeneralExtensions.GetTypedValue<string>(sse, "m_skillLevel2"));
		((SE_Stats)extendedStatusEffect).m_skillLevelModifier2 = GeneralExtensions.GetTypedValue<float>(sse, "m_skillLevelModifier2");
		((SE_Stats)extendedStatusEffect).m_speedModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_speedModifier");
		((SE_Stats)extendedStatusEffect).m_staminaDrainPerSec = GeneralExtensions.GetTypedValue<float>(sse, "m_staminaDrainPerSec");
		((SE_Stats)extendedStatusEffect).m_staminaOverTime = GeneralExtensions.GetTypedValue<float>(sse, "m_staminaOverTime");
		((SE_Stats)extendedStatusEffect).m_staminaOverTimeDuration = GeneralExtensions.GetTypedValue<float>(sse, "m_staminaOverTimeDuration");
		((SE_Stats)extendedStatusEffect).m_staminaRegenMultiplier = GeneralExtensions.GetTypedValue<float>(sse, "m_staminaRegenMultiplier");
		((SE_Stats)extendedStatusEffect).m_stealthModifier = GeneralExtensions.GetTypedValue<float>(sse, "m_stealthModifier");
		((StatusEffect)extendedStatusEffect).m_icon = Sprite.Create(LoadTexture(GeneralExtensions.GetTypedValue<string>(sse, "m_icon")), new Rect(Vector2.zero, new Vector2(48f, 48f)), new Vector2(24f, 24f));
		return extendedStatusEffect;
	}

	private string SerializeSE(ExtendedStatusEffect se)
	{
		//IL_0040: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0303: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<string, object> obj = new Dictionary<string, object>
		{
			{
				"name",
				((Object)se).name
			},
			{
				"m_name",
				((StatusEffect)se).m_name
			},
			{
				"m_activationAnimation",
				((StatusEffect)se).m_activationAnimation
			},
			{
				"m_attributes",
				SerializeEnum<StatusAttribute>(((StatusEffect)se).m_attributes)
			},
			{
				"m_category",
				((StatusEffect)se).m_category
			},
			{
				"m_cooldown",
				((StatusEffect)se).m_cooldown
			},
			{
				"m_repeatInterval",
				((StatusEffect)se).m_repeatInterval
			},
			{
				"m_repeatMessage",
				((StatusEffect)se).m_repeatMessage
			},
			{
				"m_repeatMessageType",
				SerializeEnum<MessageType>(((StatusEffect)se).m_repeatMessageType)
			},
			{
				"m_startMessage",
				((StatusEffect)se).m_startMessage
			},
			{
				"m_startMessageType",
				SerializeEnum<MessageType>(((StatusEffect)se).m_startMessageType)
			},
			{
				"m_stopMessage",
				((StatusEffect)se).m_stopMessage
			},
			{
				"m_stopMessageType",
				SerializeEnum<MessageType>(((StatusEffect)se).m_stopMessageType)
			},
			{
				"m_tooltip",
				((StatusEffect)se).m_tooltip
			},
			{
				"m_ttl",
				((StatusEffect)se).m_ttl
			},
			{
				"m_tickInterval",
				((SE_Stats)se).m_tickInterval
			},
			{ "m_maxHealth", se.m_maxHealth },
			{ "m_maxStamina", se.m_maxStamina },
			{ "m_maxEitr", se.m_maxEitr },
			{
				"m_maxMaxFallSpeed",
				((SE_Stats)se).m_maxMaxFallSpeed
			},
			{
				"m_addMaxCarryWeight",
				((SE_Stats)se).m_addMaxCarryWeight
			},
			{
				"m_damageModifier",
				((SE_Stats)se).m_damageModifier
			},
			{
				"m_eitrOverTime",
				((SE_Stats)se).m_eitrOverTime
			},
			{
				"m_eitrOverTimeDuration",
				((SE_Stats)se).m_eitrOverTimeDuration
			},
			{
				"m_eitrRegenMultiplier",
				((SE_Stats)se).m_eitrRegenMultiplier
			},
			{
				"m_fallDamageModifier",
				((SE_Stats)se).m_fallDamageModifier
			},
			{
				"m_healthOverTime",
				((SE_Stats)se).m_healthOverTime
			},
			{
				"m_healthOverTimeDuration",
				((SE_Stats)se).m_healthOverTimeDuration
			},
			{
				"m_healthOverTimeInterval",
				((SE_Stats)se).m_healthOverTimeInterval
			},
			{
				"m_healthPerTick",
				((SE_Stats)se).m_healthPerTick
			},
			{
				"m_healthPerTickMinHealthPercentage",
				((SE_Stats)se).m_healthPerTickMinHealthPercentage
			},
			{
				"m_healthRegenMultiplier",
				((SE_Stats)se).m_healthRegenMultiplier
			},
			{
				"m_jumpModifier",
				$"{((SE_Stats)se).m_jumpModifier.x},{((SE_Stats)se).m_jumpModifier.y},{((SE_Stats)se).m_jumpModifier.z}"
			},
			{
				"m_jumpStaminaUseModifier",
				((SE_Stats)se).m_jumpStaminaUseModifier
			},
			{
				"m_modifyAttackSkill",
				((SE_Stats)se).m_modifyAttackSkill
			},
			{
				"m_mods",
				SimpleJson.SerializeObject((object)SerializeDamageModifiers(((SE_Stats)se).m_mods))
			},
			{
				"m_noiseModifier",
				((SE_Stats)se).m_noiseModifier
			},
			{
				"m_raiseSkill",
				SerializeEnum<SkillType>(((SE_Stats)se).m_raiseSkill)
			},
			{
				"m_raiseSkillModifier",
				((SE_Stats)se).m_raiseSkillModifier
			},
			{
				"m_runStaminaDrainModifier",
				((SE_Stats)se).m_runStaminaDrainModifier
			},
			{
				"m_skillLevel",
				SerializeEnum<SkillType>(((SE_Stats)se).m_skillLevel)
			},
			{
				"m_skillLevelModifier",
				((SE_Stats)se).m_skillLevelModifier
			},
			{
				"m_skillLevel2",
				SerializeEnum<SkillType>(((SE_Stats)se).m_skillLevel2)
			},
			{
				"m_skillLevelModifier2",
				((SE_Stats)se).m_skillLevelModifier2
			},
			{
				"m_speedModifier",
				((SE_Stats)se).m_speedModifier
			},
			{
				"m_staminaDrainPerSec",
				((SE_Stats)se).m_staminaDrainPerSec
			},
			{
				"m_staminaOverTime",
				((SE_Stats)se).m_staminaOverTime
			},
			{
				"m_staminaOverTimeDuration",
				((SE_Stats)se).m_staminaOverTimeDuration
			},
			{
				"m_staminaRegenMultiplier",
				((SE_Stats)se).m_staminaRegenMultiplier
			},
			{
				"m_stealthModifier",
				((SE_Stats)se).m_stealthModifier
			}
		};
		Sprite icon = ((StatusEffect)se).m_icon;
		obj.Add("m_icon", (icon != null) ? ((Object)icon).name : null);
		return SimpleJson.SerializeObject((object)obj);
	}

	private Dictionary<string, string> SerializeDamageModifiers(List<DamageModPair> dmps)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		Dictionary<string, string> dictionary = new Dictionary<string, string>();
		foreach (DamageModPair dmp in dmps)
		{
			dictionary.Add(SerializeEnum<DamageType>(dmp.m_type), SerializeEnum<DamageModifier>(dmp.m_modifier));
		}
		return dictionary;
	}

	private List<DamageModPair> DeserializeDamageModifiers(Dictionary<string, string> dmps)
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: 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_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)
		List<DamageModPair> list = new List<DamageModPair>();
		foreach (KeyValuePair<string, string> dmp in dmps)
		{
			list.Add(new DamageModPair
			{
				m_type = DeserializeEnum<DamageType>(dmp.Key),
				m_modifier = DeserializeEnum<DamageModifier>(dmp.Value)
			});
		}
		return list;
	}

	public T DeserializeEnum<T>(string e)
	{
		return (T)Enum.Parse(typeof(T), e);
	}

	public string SerializeEnum<T>(T e)
	{
		return Enum.GetName(typeof(T), e);
	}

	private Vector3 ParseVector3(string v)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		string[] array = v.Split(new char[1] { ',' });
		if (array.Length != 3)
		{
			return Vector3.zero;
		}
		return new Vector3(float.Parse(array[0]), float.Parse(array[1]), float.Parse(array[2]));
	}

	private Texture2D LoadTexture(string path, int w = 48, int h = 48)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Expected O, but got Unknown
		Texture2D val = new Texture2D(w, h);
		if (!File.Exists(path))
		{
			return val;
		}
		ImageConversion.LoadImage(val, File.ReadAllBytes(path));
		return val;
	}

	private StatusEffect DeserializeSE(string json)
	{
		return null;
	}
}