Decompiled source of SideLoader ExtendedEffects v1.3.2

plugins/SideLoader_ExtendedEffects.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using SideLoader;
using SideLoader.Model;
using SideLoader.Model.Status;
using SideLoader.SaveData;
using SideLoader_ExtendedEffects.Events;
using SideLoader_ExtendedEffects.Item_Context_Menu;
using SideLoader_ExtendedEffects.Released;
using TravelSpeed.Extensions;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SideLoader Custom Effects")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SideLoader Custom Effects")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class SL_OverridePlayerTemp : SL_Effect, ICustomModel
{
	public class OverridePlayerTemp : Effect, ICustomModel
	{
		public float Amount;

		public Type SLTemplateModel => typeof(SL_OverridePlayerTemp);

		public Type GameModel => typeof(OverridePlayerTemp);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			PlayerCharacterStats val = default(PlayerCharacterStats);
			if (((Component)_affectedCharacter).TryGetComponent<PlayerCharacterStats>(ref val))
			{
				val.m_overrideCharTemp = Amount;
			}
		}
	}

	public float Amount;

	public Type SLTemplateModel => typeof(SL_OverridePlayerTemp);

	public Type GameModel => typeof(OverridePlayerTemp);

	public override void ApplyToComponent<T>(T component)
	{
		OverridePlayerTemp overridePlayerTemp = component as OverridePlayerTemp;
		overridePlayerTemp.Amount = Amount;
	}

	public override void SerializeEffect<T>(T effect)
	{
		OverridePlayerTemp overridePlayerTemp = effect as OverridePlayerTemp;
		Amount = overridePlayerTemp.Amount;
	}
}
namespace TravelSpeed.Patches
{
	[HarmonyPatch(typeof(Effect))]
	public static class EffectPatches
	{
		[HarmonyPatch("TryActivateLocally")]
		[HarmonyPrefix]
		public static bool Effect_TryActivateLocally_Prefix(Effect __instance, Character _affectedCharacter, object[] _infos)
		{
			return (Object)(object)__instance.m_parentStatusEffect == (Object)null || !__instance.m_parentStatusEffect.IsEffectSuspended();
		}
	}
	[HarmonyPatch(typeof(StatusEffectDetailDisplay))]
	public static class StatusEffectDetailDisplayPatches
	{
		[HarmonyPatch("RefreshDisplay")]
		[HarmonyPostfix]
		public static void StatusEffectDetailDisplay_RefreshDisplay_Postfix(StatusEffectDetailDisplay __instance)
		{
			if ((Object)(object)__instance.m_statusEffect != (Object)null && __instance.m_statusEffect.IsTimerSuspended() && Object.op_Implicit((Object)(object)__instance.m_lblTimer))
			{
				__instance.m_lblTimer.text = "Suspended";
			}
		}
	}
	[HarmonyPatch(typeof(StatusEffect))]
	public static class StatusEffectPatches
	{
		[HarmonyPatch("UpdateTotalData")]
		[HarmonyPrefix]
		public static void StatusEffect_UpdateTotalData_Prefix(StatusEffect __instance, ref bool _updateDelta)
		{
			if (__instance.IsTimerSuspended())
			{
				_updateDelta = false;
			}
		}
	}
}
namespace TravelSpeed.Extensions
{
	public class StatusEffectExt
	{
		private bool timerSuspended = false;

		private bool effectSuspended = false;

		public bool TimerSuspended
		{
			get
			{
				return timerSuspended;
			}
			set
			{
				timerSuspended = value;
			}
		}

		public bool EffectSuspended
		{
			get
			{
				return effectSuspended;
			}
			set
			{
				effectSuspended = value;
			}
		}
	}
	public static class StatusEffectExtensions
	{
		private static ConditionalWeakTable<StatusEffect, StatusEffectExt> SuspendedEffects = new ConditionalWeakTable<StatusEffect, StatusEffectExt>();

		public static void SetTimerSuspended(this StatusEffect statusEffect, bool suspended)
		{
			StatusEffectExt value = SuspendedEffects.GetValue(statusEffect, (StatusEffect key) => new StatusEffectExt());
			value.TimerSuspended = suspended;
		}

		public static bool IsTimerSuspended(this StatusEffect statusEffect)
		{
			if (SuspendedEffects.TryGetValue(statusEffect, out var value))
			{
				return value.TimerSuspended;
			}
			return false;
		}

		public static void SetEffectSuspended(this StatusEffect statusEffect, bool suspended)
		{
			StatusEffectExt value = SuspendedEffects.GetValue(statusEffect, (StatusEffect key) => new StatusEffectExt());
			value.EffectSuspended = suspended;
		}

		public static bool IsEffectSuspended(this StatusEffect statusEffect)
		{
			if (SuspendedEffects.TryGetValue(statusEffect, out var value))
			{
				return value.EffectSuspended;
			}
			return false;
		}
	}
}
namespace SideLoader_ExtendedEffects
{
	public class CustomItemMenuManager
	{
		public Dictionary<int, CustomItemDisplayMenuOption> CustomItemOptions { get; private set; }

		public CustomItemMenuManager()
		{
			CustomItemOptions = new Dictionary<int, CustomItemDisplayMenuOption>();
		}

		public void RegisterCustomMenuOption(int NewActionID, string ActionString, Action<Character, Item, ItemDisplayOptionPanel, int> OnCustomActionPressed, Func<Character, Item, ItemDisplayOptionPanel, int, bool> ShouldAddAction)
		{
			ExtendedEffects.Instance?.DebugLogMessage($"Registering custom action with ID {NewActionID} String {ActionString}");
			if (!CustomItemOptions.ContainsKey(NewActionID))
			{
				CustomItemOptions.Add(NewActionID, new CustomItemDisplayMenuOption(NewActionID, ActionString, OnCustomActionPressed, ShouldAddAction));
			}
			else
			{
				ExtendedEffects.Instance?.DebugLogMessage($"Custom Action already exists with ID {NewActionID}");
			}
		}

		public void UnRegisterCustomMenuOption(int CustomActionID)
		{
			if (CustomItemOptions.ContainsKey(CustomActionID))
			{
				ExtendedEffects.Instance?.DebugLogMessage($"UnRegistering custom action ID {CustomActionID}");
				CustomItemOptions.Remove(CustomActionID);
			}
		}
	}
	[BepInPlugin("sideloaderextendedeffects.extendedeffects", "SideLoader Extended Effects", "1.3.0")]
	public class ExtendedEffects : BaseUnityPlugin
	{
		public const string GUID = "sideloaderextendedeffects.extendedeffects";

		public const string NAME = "SideLoader Extended Effects";

		public const string VERSION = "1.3.0";

		internal static ManualLogSource _Log;

		public const string SL_VISUAL_TRANSFORM = "SLVISUALCONTAINER";

		public Action OnLoaded;

		public static ConfigEntry<bool> AddTestItems;

		public static ConfigEntry<bool> AddItemDebug;

		public static ConfigEntry<bool> ShowDebugLog;

		private static Dictionary<string, string> _SkillTreeOverrides = new Dictionary<string, string>();

		public static ExtendedEffects Instance { get; private set; }

		public CustomItemMenuManager CustomItemMenuManager { get; private set; }

		public PortalManager PortalManager { get; private set; }

		public static Dictionary<string, string> SkillTreeOverrides => _SkillTreeOverrides;

		internal void Awake()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			_Log = ((BaseUnityPlugin)this).Logger;
			PortalManager = new PortalManager();
			Instance = this;
			CustomItemMenuManager = new CustomItemMenuManager();
			InitializeSL();
			InitializeConfig();
			new Harmony("sideloaderextendedeffects.extendedeffects").PatchAll();
		}

		private void OnDestroy()
		{
			if (PortalManager != null)
			{
				PortalManager.OnDestroy();
			}
		}

		private void Start()
		{
			OnLoaded?.Invoke();
		}

		private void InitializeSL()
		{
			SL.BeforePacksLoaded += SL_BeforePacksLoaded;
		}

		private void InitializeConfig()
		{
			AddItemDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("SideLoader Extended Effects", "Add Debug Menu options to Items", false, "Add Debug Menu options to Items.");
			AddTestItems = ((BaseUnityPlugin)this).Config.Bind<bool>("SideLoader Extended Effects", "Add Test Items", false, "Adds test items, spawnable using the debug mode menu (requires restart)");
			ShowDebugLog = ((BaseUnityPlugin)this).Config.Bind<bool>("SideLoader Extended Effects", "Show Debug Log", true, "Enables the Debug Log for SideLoader Extended Effects.");
		}

		private void SL_BeforePacksLoaded()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_002a: 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_003e: Expected O, but got Unknown
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: 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_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Expected O, but got Unknown
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Expected O, but got Unknown
			//IL_01de: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Expected O, but got Unknown
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Expected O, but got Unknown
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026a: Expected O, but got Unknown
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Expected O, but got Unknown
			SL_Skill val = new SL_Skill();
			((SL_Item)val).Target_ItemID = 8100120;
			((SL_Item)val).New_ItemID = -269045;
			((SL_Item)val).Name = "Emo Portal Skill";
			((SL_Item)val).EffectBehaviour = (EditBehaviours)1;
			SL_Skill obj = val;
			SL_EffectTransform[] array = new SL_EffectTransform[1];
			SL_EffectTransform val2 = new SL_EffectTransform();
			val2.TransformName = "Activation";
			val2.Effects = (SL_Effect[])(object)new SL_Effect[1]
			{
				new SL_PortalEffect()
			};
			array[0] = val2;
			((SL_Item)obj).EffectTransforms = (SL_EffectTransform[])(object)array;
			SL_Skill val3 = val;
			((ContentTemplate)val3).ApplyTemplate();
			val = new SL_Skill();
			((SL_Item)val).Target_ItemID = 8100120;
			((SL_Item)val).New_ItemID = -269046;
			((SL_Item)val).Name = "Emo Berg Portal Skill";
			((SL_Item)val).EffectBehaviour = (EditBehaviours)1;
			SL_Skill obj2 = val;
			SL_EffectTransform[] array2 = new SL_EffectTransform[1];
			val2 = new SL_EffectTransform();
			val2.TransformName = "Activation";
			val2.Effects = (SL_Effect[])(object)new SL_Effect[1]
			{
				new SL_AreaPortalEffect
				{
					Area = (AreaEnum)500,
					PositionOffset = new Vector3(1201.4f, -13.7222f, 1407.109f),
					RotationOffset = Vector3.zero,
					PortalLifeTime = 30f
				}
			};
			array2[0] = val2;
			((SL_Item)obj2).EffectTransforms = (SL_EffectTransform[])(object)array2;
			SL_Skill val4 = val;
			((ContentTemplate)val4).ApplyTemplate();
			if (AddTestItems.Value)
			{
				SL_MeleeWeapon val5 = new SL_MeleeWeapon();
				((SL_Item)val5).Target_ItemID = 2000031;
				((SL_Item)val5).New_ItemID = -26999;
				((SL_Item)val5).Name = "Emo Test Blade of Testing";
				((SL_Item)val5).Description = "WHACK";
				((SL_Item)val5).StatsHolder = (SL_ItemStats)new SL_WeaponStats
				{
					BaseDamage = new List<SL_Damage>
					{
						new SL_Damage
						{
							Damage = 25f,
							Type = (Types)0
						}
					},
					AttackSpeed = 0.9f
				};
				SL_EffectTransform[] array3 = new SL_EffectTransform[1];
				val2 = new SL_EffectTransform();
				val2.TransformName = "Activation";
				val2.Effects = (SL_Effect[])(object)new SL_Effect[0];
				array3[0] = val2;
				((SL_Item)val5).EffectTransforms = (SL_EffectTransform[])(object)array3;
				SL_MeleeWeapon val6 = val5;
				((ContentTemplate)val6).ApplyTemplate();
				SL_Item val7 = new SL_Item();
				val7.Target_ItemID = 4300130;
				val7.New_ItemID = -26987;
				val7.Name = "Emo Test Potion";
				val7.Description = "Test Potion";
				val7.EffectBehaviour = (EditBehaviours)2;
				val7.QtyRemovedOnUse = 0;
				SL_EffectTransform[] array4 = new SL_EffectTransform[1];
				val2 = new SL_EffectTransform();
				val2.TransformName = "Effects";
				val2.Effects = (SL_Effect[])(object)new SL_Effect[0];
				array4[0] = val2;
				val7.EffectTransforms = (SL_EffectTransform[])(object)array4;
				SL_Item val8 = val7;
				((ContentTemplate)val8).ApplyTemplate();
				val = new SL_Skill();
				((SL_Item)val).Target_ItemID = 8100120;
				((SL_Item)val).New_ItemID = -26986;
				((SL_Item)val).Name = "Emo Test Skill";
				((SL_Item)val).EffectBehaviour = (EditBehaviours)1;
				SL_Skill obj3 = val;
				SL_EffectTransform[] array5 = new SL_EffectTransform[1];
				val2 = new SL_EffectTransform();
				val2.TransformName = "Activation";
				val2.Effects = (SL_Effect[])(object)new SL_Effect[2]
				{
					new SL_RemoveItemFromInventory
					{
						ItemID = 4000010,
						ItemQuantity = 5
					},
					new SL_RemoveItemFromInventory
					{
						ItemID = 2000010,
						ItemQuantity = 2
					}
				};
				array5[0] = val2;
				((SL_Item)obj3).EffectTransforms = (SL_EffectTransform[])(object)array5;
				SL_Skill val9 = val;
				((ContentTemplate)val9).ApplyTemplate();
			}
		}

		public static void AddSkillTreeOverride(string trainerUID, string customTreeUID)
		{
			if (!SkillTreeOverrides.ContainsKey(trainerUID))
			{
				SkillTreeOverrides.Add(trainerUID, customTreeUID);
			}
			else
			{
				_Log.LogMessage((object)"Override already found for this Trainer! Not sure how to handle this!");
			}
		}

		public static bool HasSkillTreeOverride(string trainerUID)
		{
			_Log.LogMessage((object)("HasSkillTreeOverride UID " + trainerUID));
			return SkillTreeOverrides.ContainsKey(trainerUID);
		}

		public void DebugLogMessage(object logMessage)
		{
			if (ShowDebugLog.Value && _Log != null)
			{
				_Log.LogMessage(logMessage);
			}
		}
	}
	public class InstancedEvent<TInstance, TEvent> where TEvent : Delegate
	{
		private readonly Dictionary<TInstance, TEvent> dictionary = new Dictionary<TInstance, TEvent>();

		public void AddListener(TInstance instance, TEvent listener)
		{
			if (!dictionary.ContainsKey(instance))
			{
				dictionary.Add(instance, listener);
				return;
			}
			TEvent a = dictionary[instance];
			a = Delegate.Combine(a, listener) as TEvent;
			dictionary[instance] = a;
		}

		public void RemoveListener(TInstance instance, TEvent listener)
		{
			if (dictionary.TryGetValue(instance, out var value))
			{
				value = Delegate.Remove(value, listener) as TEvent;
				if (!value.GetInvocationList().Any())
				{
					dictionary.Remove(instance);
				}
				else
				{
					dictionary[instance] = value;
				}
			}
		}

		internal void InvokeForInstance(TInstance instance, params object[] args)
		{
			if (dictionary.TryGetValue(instance, out var value))
			{
				value.DynamicInvoke(args);
			}
		}
	}
	public static class OutwardEvents
	{
		public static InstancedEvent<Character, Action<Character, CharacterDamageEvent>> OnCharacterRecievedHit;
	}
	public static class OutwardHelpers
	{
		public static string Emission_Property_Value = "_EmissionColor";

		public static void UpdateWeaponDamage(Weapon WeaponInstance, DamageList newDamageList)
		{
			WeaponInstance.Damage.Clear();
			WeaponInstance.Stats.BaseDamage = newDamageList;
			WeaponInstance.m_baseDamage = WeaponInstance.Stats.BaseDamage.Clone();
			WeaponInstance.m_activeBaseDamage = WeaponInstance.Stats.BaseDamage.Clone();
			WeaponInstance.baseDamage = WeaponInstance.Stats.BaseDamage.Clone();
			WeaponInstance.Stats.Attacks = SL_WeaponStats.GetScaledAttackData(WeaponInstance);
		}

		public static T TryGetFromEquipmentItemVisual<T>(ItemVisual itemVisual)
		{
			BoxCollider[] componentsInChildren = ((Component)itemVisual).GetComponentsInChildren<BoxCollider>(false);
			int num = 0;
			if (num < componentsInChildren.Length)
			{
				BoxCollider val = componentsInChildren[num];
				return ((Component)val).GetComponentInChildren<T>();
			}
			ExtendedEffects._Log.LogMessage((object)$"Failed to find {typeof(T)} on ItemVisual {itemVisual.m_item.DisplayName}");
			return default(T);
		}

		public static bool DoesWeaponUseSkinnedMesh(Equipment weaponGameObject)
		{
			SkinnedMeshRenderer componentInChildren = ((Component)((Item)weaponGameObject).GetItemVisual()).GetComponentInChildren<SkinnedMeshRenderer>();
			return (Object)(object)componentInChildren != (Object)null;
		}

		public static Transform TryGetHumanBone(Character character, HumanBodyBones bone)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			return ((Object)(object)character.Animator != (Object)null) ? character.Animator.GetBoneTransform(bone) : null;
		}

		public static T GetFromAssetBundle<T>(string SLPackName, string AssetBundle, string key) where T : Object
		{
			if (!SL.PacksLoaded)
			{
				return default(T);
			}
			return SL.GetSLPack(SLPackName).AssetBundles[AssetBundle].LoadAsset<T>(key);
		}

		public static List<T> GetTypeFromColliders<T>(Collider[] colliders) where T : Component
		{
			List<T> list = new List<T>();
			foreach (Collider val in colliders)
			{
				T componentInChildren = ((Component)val).GetComponentInChildren<T>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					list.Add(componentInChildren);
				}
			}
			return list;
		}

		public static Tag GetTagFromName(string tagName)
		{
			//IL_0013: 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)
			//IL_001a: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			Tag[] tags = TagSourceManager.Instance.m_tags;
			foreach (Tag val in tags)
			{
				if (val.TagName == tagName)
				{
					return val;
				}
			}
			return default(Tag);
		}

		public static Tag[] GetParentTags(this Effect effect)
		{
			Tag[] result = (Tag[])(object)new Tag[0];
			EffectSynchronizer sourceSynchronizer = effect.m_parentSynchronizer.SourceSynchronizer;
			if (sourceSynchronizer is Item)
			{
				result = ((Item)((sourceSynchronizer is Item) ? sourceSynchronizer : null)).Tags.ToArray();
			}
			if (sourceSynchronizer is StatusEffect)
			{
				result = ((StatusEffect)((sourceSynchronizer is StatusEffect) ? sourceSynchronizer : null)).InheritedTags.ToArray();
			}
			return result;
		}

		public static Tag[] GetParentTags(this EffectCondition condition)
		{
			Tag[] result = (Tag[])(object)new Tag[0];
			EffectSynchronizer sourceSynchronizer = condition.m_parentSynchronizer.SourceSynchronizer;
			if (sourceSynchronizer is Item)
			{
				result = ((Item)((sourceSynchronizer is Item) ? sourceSynchronizer : null)).Tags.ToArray();
			}
			if (sourceSynchronizer is StatusEffect)
			{
				result = ((StatusEffect)((sourceSynchronizer is StatusEffect) ? sourceSynchronizer : null)).InheritedTags.ToArray();
			}
			return result;
		}

		public static float GetTaggedStat(this Character character, Tag stat, Tag[] tags)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return character.Stats.GetStat(stat).GetValue((IList<Tag>)tags);
		}

		public static float GetTaggedStatModifier(this Character character, Tag stat, Tag[] tags)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return (character.Stats.GetStat(stat).GetModifier((IList<Tag>)tags, 1) - 1f) * 100f;
		}

		public static void DelayDo(Action OnAfterDelay, float DelayTime)
		{
			((MonoBehaviour)ExtendedEffects.Instance).StartCoroutine(DoAfterDelay(OnAfterDelay, DelayTime));
		}

		public static IEnumerator DoAfterDelay(Action OnAfterDelay, float DelayTime)
		{
			yield return (object)new WaitForSeconds(DelayTime);
			OnAfterDelay();
		}
	}
	public enum Attributes
	{
		HEALTH,
		MANA,
		STAMINA,
		BURNT_HEALTH,
		BURNT_MANA,
		BURNT_STAMINA
	}
	public enum DamageSourceType
	{
		ANY,
		WEAPON,
		NON_WEAPON
	}
	public struct CharacterDamageEvent
	{
		public Character DamageTarget;

		public object DamageSource;

		public float TotalDamage;

		public DamageList DamageDone;

		public Vector3 DamageDirection;

		public Vector3 DamagePosition;

		public float HitAngle;

		public float HitAngleDirection;

		public Character DamageSourceCharacter;

		public float KnocksBack;

		public bool DamageInventory;
	}
	public struct BagEventData
	{
		public Bag Bag;

		public Character CharacterOwner;
	}
	public class SL_AffectCooldown : SL_Effect, ICustomModel
	{
		public float Amount;

		public bool IsModifier;

		public bool OnOwner;

		public int[] AllowedSkills;

		public Type SLTemplateModel => typeof(SL_AffectCooldown);

		public Type GameModel => typeof(AffectCooldown);

		public override void ApplyToComponent<T>(T component)
		{
			AffectCooldown affectCooldown = component as AffectCooldown;
			affectCooldown.Amount = Amount;
			affectCooldown.IsModifier = IsModifier;
			affectCooldown.OnOwner = OnOwner;
			affectCooldown.AllowedSkills = AllowedSkills;
		}

		public override void SerializeEffect<T>(T effect)
		{
			AffectCooldown affectCooldown = effect as AffectCooldown;
			Amount = affectCooldown.Amount;
			IsModifier = affectCooldown.IsModifier;
			OnOwner = affectCooldown.OnOwner;
			AllowedSkills = affectCooldown.AllowedSkills;
		}
	}
	public class AffectCooldown : Effect, ICustomModel
	{
		public float Amount;

		public bool IsModifier;

		public bool OnOwner;

		public int[] AllowedSkills;

		public Type SLTemplateModel => typeof(SL_AffectCooldown);

		public Type GameModel => typeof(AffectCooldown);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Character val = (OnOwner ? ((Effect)this).OwnerCharacter : _affectedCharacter);
			IList<string> learnedActiveSkillUIDs = val.Inventory.SkillKnowledge.GetLearnedActiveSkillUIDs();
			foreach (string item2 in learnedActiveSkillUIDs)
			{
				Item item = ItemManager.Instance.GetItem(item2);
				Skill val2 = (Skill)(object)((item is Skill) ? item : null);
				if (AllowedSkills == null || AllowedSkills.Length == 0 || Extensions.Contains(AllowedSkills, ((Item)val2).ItemID))
				{
					float num = (IsModifier ? (val2.RealCooldown * Amount / 100f) : Amount);
					num *= base.m_totalPotency;
					val2.m_remainingCooldownTime -= num;
					val2.UpdateCooldownRatio();
				}
			}
		}
	}
	public class SL_ApplyEnchantment : SL_Effect, ICustomModel
	{
		public EquipmentSlotIDs EquipmentSlot;

		public int EnchantmentID;

		public bool ApplyPermanently;

		public Type SLTemplateModel => typeof(SL_ApplyEnchantment);

		public Type GameModel => typeof(ApplyEnchantment);

		public override void ApplyToComponent<T>(T component)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			ApplyEnchantment applyEnchantment = component as ApplyEnchantment;
			applyEnchantment.EquipmentSlot = EquipmentSlot;
			applyEnchantment.EnchantmentId = EnchantmentID;
			applyEnchantment.ApplyPermanently = ApplyPermanently;
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			ApplyEnchantment applyEnchantment = effect as ApplyEnchantment;
			EnchantmentID = applyEnchantment.EnchantmentId;
			EquipmentSlot = applyEnchantment.EquipmentSlot;
			ApplyPermanently = applyEnchantment.ApplyPermanently;
		}
	}
	public class ApplyEnchantment : Effect, ICustomModel
	{
		public EquipmentSlotIDs EquipmentSlot;

		public int EnchantmentId;

		public bool ApplyPermanently;

		[SerializeField]
		private UID affectedItem = UID.Empty;

		public Type SLTemplateModel => typeof(SL_ApplyEnchantment);

		public Type GameModel => typeof(ApplyEnchantment);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_affectedCharacter == (Object)null)
			{
				ExtendedEffects.Instance.DebugLogMessage("Affected Character null");
			}
			else if (_affectedCharacter.Inventory.Equipment.EquipmentSlots[EquipmentSlot].HasItemEquipped)
			{
				Equipment equippedItem = _affectedCharacter.Inventory.Equipment.EquipmentSlots[EquipmentSlot].EquippedItem;
				if (UID.op_Implicit(((Item)equippedItem).UID) != affectedItem)
				{
					ExtendedEffects.Instance.DebugLogMessage("Item has Changed");
					if (!((UID)(ref affectedItem)).IsNull)
					{
						ExtendedEffects.Instance.DebugLogMessage("Cleaning Affected Item");
						CleanAffectedItem();
					}
					affectedItem = UID.op_Implicit(((Item)equippedItem).UID);
					if (!equippedItem.m_enchantmentIDs.Contains(EnchantmentId))
					{
						ExtendedEffects.Instance.DebugLogMessage($"Adding Enchant {EnchantmentId} to {((Item)equippedItem).Name}");
						equippedItem.AddEnchantment(EnchantmentId, false);
					}
				}
			}
			else if (!((UID)(ref affectedItem)).IsNull)
			{
				CleanAffectedItem();
			}
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			if (!((UID)(ref affectedItem)).IsNull)
			{
				CleanAffectedItem();
			}
			((Effect)this).StopAffectLocally(_affectedCharacter);
		}

		private void CleanAffectedItem()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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)
			if (ApplyPermanently)
			{
				return;
			}
			Item item = ItemManager.Instance.GetItem(UID.op_Implicit(affectedItem));
			Equipment val = (Equipment)(object)((item is Equipment) ? item : null);
			val.m_enchantmentIDs.Remove(EnchantmentId);
			foreach (Enchantment activeEnchantment in val.m_activeEnchantments)
			{
				if (((EffectPreset)activeEnchantment).PresetID == EnchantmentId)
				{
					val.m_activeEnchantments.Remove(activeEnchantment);
					activeEnchantment.UnapplyEnchantment();
					float durabilityRatio = ((Item)val).DurabilityRatio;
					val.RefreshEnchantmentModifiers();
					if (durabilityRatio != ((Item)val).DurabilityRatio)
					{
						((Item)val).SetDurabilityRatio(durabilityRatio);
					}
					break;
				}
			}
			affectedItem = UID.Empty;
		}
	}
	public class SL_ChangeMaterialTimed : SL_Effect, ICustomModel
	{
		public string SLPackName;

		public string AssetBundleName;

		public string PrefabName;

		public float ChangeTime;

		public Type SLTemplateModel => typeof(SL_ChangeMaterialTimed);

		public Type GameModel => typeof(ChangeMaterialTimed);

		public override void ApplyToComponent<T>(T component)
		{
			ChangeMaterialTimed changeMaterialTimed = component as ChangeMaterialTimed;
			changeMaterialTimed.ChangeTime = ChangeTime;
			changeMaterialTimed.SLPackName = SLPackName;
			changeMaterialTimed.AssetBundleName = AssetBundleName;
			changeMaterialTimed.PrefabName = PrefabName;
		}

		public override void SerializeEffect<T>(T effect)
		{
			ChangeMaterialTimed changeMaterialTimed = effect as ChangeMaterialTimed;
			ChangeTime = changeMaterialTimed.ChangeTime;
			SLPackName = changeMaterialTimed.SLPackName;
			AssetBundleName = changeMaterialTimed.AssetBundleName;
			PrefabName = changeMaterialTimed.PrefabName;
		}
	}
	public class ChangeMaterialTimed : Effect, ICustomModel
	{
		public string SLPackName;

		public string AssetBundleName;

		public string PrefabName;

		public float ChangeTime;

		private bool IsChanged;

		private Dictionary<Renderer, Material> CurrentRenderers = new Dictionary<Renderer, Material>();

		public Type SLTemplateModel => typeof(SL_ChangeMaterialTimed);

		public Type GameModel => typeof(ChangeMaterialTimed);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			if (IsChanged)
			{
				return;
			}
			Material fromAssetBundle = OutwardHelpers.GetFromAssetBundle<Material>(SLPackName, AssetBundleName, PrefabName);
			if ((Object)(object)fromAssetBundle != (Object)null)
			{
				CacheOriginalMaterials(_affectedCharacter);
				ChangeMaterialForRenderers(fromAssetBundle);
				if (ChangeTime > 0f)
				{
					((MonoBehaviour)this).StartCoroutine(DelayRevert(_affectedCharacter));
				}
				IsChanged = true;
			}
		}

		private IEnumerator DelayRevert(Character _affectedCharacter)
		{
			yield return (object)new WaitForSeconds(ChangeTime);
			ReturnToOriginalMaterials();
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			((Effect)this).StopAffectLocally(_affectedCharacter);
			if (ChangeTime <= 0f)
			{
				ReturnToOriginalMaterials();
			}
		}

		private void CacheOriginalMaterials(Character _affectedCharacter)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			if ((Object)(object)_affectedCharacter == (Object)null)
			{
				return;
			}
			if (CurrentRenderers.Count > 0)
			{
				ReturnToOriginalMaterials();
			}
			CurrentRenderers.Clear();
			ExtendedEffects.Instance.DebugLogMessage("Caching Original Materials");
			Renderer[] renderers = GetRenderers(_affectedCharacter.VisualHolderTrans, IncludeInActive: false);
			Renderer[] array = renderers;
			foreach (Renderer val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					ExtendedEffects.Instance.DebugLogMessage("Cached " + ((Object)((Component)val).transform).name + " " + ((Object)val.material).name);
					CurrentRenderers.Add(val, new Material(val.material));
				}
			}
		}

		private void ChangeMaterialForRenderers(Material NewMaterial)
		{
			foreach (KeyValuePair<Renderer, Material> currentRenderer in CurrentRenderers)
			{
				if (!((Object)(object)currentRenderer.Key == (Object)null) && !((Object)(object)currentRenderer.Value == (Object)null) && CurrentRenderers.TryGetValue(currentRenderer.Key, out var _))
				{
					ExtendedEffects.Instance.DebugLogMessage($"Changing {((Object)((Component)currentRenderer.Key).transform).name} to {NewMaterial}");
					currentRenderer.Key.material = NewMaterial;
				}
			}
		}

		private void ReturnToOriginalMaterials()
		{
			foreach (KeyValuePair<Renderer, Material> currentRenderer in CurrentRenderers)
			{
				if (!((Object)(object)currentRenderer.Key == (Object)null) && !((Object)(object)currentRenderer.Value == (Object)null) && CurrentRenderers.TryGetValue(currentRenderer.Key, out var value))
				{
					ExtendedEffects.Instance.DebugLogMessage($"Reverting {((Object)((Component)currentRenderer.Key).transform).name} to {currentRenderer.Value}");
					currentRenderer.Key.material = value;
				}
			}
			IsChanged = false;
		}

		private Renderer[] GetRenderers(Transform transform, bool IncludeInActive)
		{
			return ((Component)transform).GetComponentsInChildren<Renderer>(IncludeInActive);
		}
	}
	public class SL_CustomImbueVFX : SL_Effect, ICustomModel
	{
		public string SLPackName;

		public string AssetBundleName;

		public string PrefabName;

		public Vector3 PositionOffset;

		public Vector3 RotationOffset;

		public bool IsMainHand = true;

		public Type SLTemplateModel => typeof(SL_CustomImbueVFX);

		public Type GameModel => typeof(SLEx_CustomImbueVFX);

		public override void ApplyToComponent<T>(T component)
		{
			//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			SLEx_CustomImbueVFX sLEx_CustomImbueVFX = component as SLEx_CustomImbueVFX;
			sLEx_CustomImbueVFX.SLPackName = SLPackName;
			sLEx_CustomImbueVFX.AssetBundleName = AssetBundleName;
			sLEx_CustomImbueVFX.PrefabName = PrefabName;
			sLEx_CustomImbueVFX.PositionOffset = PositionOffset;
			sLEx_CustomImbueVFX.RotationOffset = RotationOffset;
			sLEx_CustomImbueVFX.IsMainHand = IsMainHand;
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			SLEx_CustomImbueVFX sLEx_CustomImbueVFX = effect as SLEx_CustomImbueVFX;
			SLPackName = sLEx_CustomImbueVFX.SLPackName;
			AssetBundleName = sLEx_CustomImbueVFX.AssetBundleName;
			PrefabName = sLEx_CustomImbueVFX.PrefabName;
			PositionOffset = sLEx_CustomImbueVFX.PositionOffset;
			RotationOffset = sLEx_CustomImbueVFX.RotationOffset;
			IsMainHand = sLEx_CustomImbueVFX.IsMainHand;
		}
	}
	public class SLEx_CustomImbueVFX : Effect, ICustomModel
	{
		public string SLPackName;

		public string AssetBundleName;

		public string PrefabName;

		public Vector3 PositionOffset;

		public Vector3 RotationOffset;

		public bool IsMainHand;

		private GameObject Instance;

		private Equipment LastEquipmentInstance = null;

		public Type SLTemplateModel => typeof(SL_CustomImbueVFX);

		public Type GameModel => typeof(SLEx_CustomImbueVFX);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			if ((Object)(object)_affectedCharacter == (Object)null)
			{
				return;
			}
			if ((Object)(object)LastEquipmentInstance != (Object)null && (Object)(object)_affectedCharacter.CurrentWeapon != (Object)(object)LastEquipmentInstance)
			{
				if ((Object)(object)Instance != (Object)null)
				{
					Object.Destroy((Object)(object)Instance);
				}
				LastEquipmentInstance = null;
			}
			Equipment val = FindCurrentWeapon(_affectedCharacter);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			GameObject fromAssetBundle = OutwardHelpers.GetFromAssetBundle<GameObject>(SLPackName, AssetBundleName, PrefabName);
			if ((Object)(object)fromAssetBundle != (Object)null)
			{
				if ((Object)(object)Instance == (Object)null)
				{
					Instance = Object.Instantiate<GameObject>(fromAssetBundle);
				}
				ParticleSystem[] componentsInChildren = fromAssetBundle.GetComponentsInChildren<ParticleSystem>();
				if (componentsInChildren.Length == 0)
				{
					ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX prefab " + PrefabName + " and its children do not contain a particle system.");
					return;
				}
				if (OutwardHelpers.DoesWeaponUseSkinnedMesh(val))
				{
					ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX Weapon is SkinnedMeshRenderer");
					SkinnedMeshRenderer val2 = OutwardHelpers.TryGetFromEquipmentItemVisual<SkinnedMeshRenderer>(val.EquippedVisuals);
					if ((Object)(object)val2 == (Object)null)
					{
						ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX skinnedMeshRenderer For " + ((Item)val).Name + " cant be found.");
						return;
					}
				}
				else
				{
					ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX Weapon is Static Mesh");
					MeshFilter val3 = OutwardHelpers.TryGetFromEquipmentItemVisual<MeshFilter>(val.EquippedVisuals);
					if ((Object)(object)val3 == (Object)null)
					{
						ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX Mesh Filter For  " + ((Item)val).Name + " cant be found.");
						return;
					}
					UpdateParticleSystemMesh(Instance, val, val3);
				}
				LastEquipmentInstance = val;
			}
			else
			{
				ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX Prefab from AssetBundle " + AssetBundleName + " was null.");
			}
		}

		private void UpdateParticleSystemMesh(GameObject Instance, Equipment CurrentWeapon, MeshFilter meshFilter)
		{
			//IL_00d0: 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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Invalid comparison between Unknown and I4
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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_0053: Invalid comparison between Unknown and I4
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] componentsInChildren = Instance.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				if (!((Object)(object)val != (Object)null))
				{
					continue;
				}
				ShapeModule shape = val.shape;
				ShapeModule shape2 = val.shape;
				if ((int)((ShapeModule)(ref shape2)).shapeType != 13)
				{
					shape2 = val.shape;
					if ((int)((ShapeModule)(ref shape2)).shapeType != 6)
					{
						continue;
					}
				}
				((ShapeModule)(ref shape)).mesh = meshFilter.sharedMesh;
				((ShapeModule)(ref shape)).meshRenderer = ((Component)meshFilter).GetComponent<MeshRenderer>();
				((ShapeModule)(ref shape)).scale = ((Component)CurrentWeapon).transform.localScale;
				((ShapeModule)(ref shape)).position = Vector3.zero;
				((ShapeModule)(ref shape)).rotation = Vector3.zero;
			}
			Instance.transform.parent = ((Component)((Item)CurrentWeapon).LoadedVisual).transform;
			if (RotationOffset == Vector3.zero)
			{
				Instance.transform.localEulerAngles = new Vector3(90f, 270f, 0f);
			}
			else
			{
				Instance.transform.localEulerAngles = RotationOffset;
			}
			Instance.transform.localPosition = PositionOffset;
		}

		private void UpdateParticleSystemMesh(GameObject Instance, Equipment CurrentWeapon, SkinnedMeshRenderer skinnedMeshRenderer)
		{
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] componentsInChildren = Instance.GetComponentsInChildren<ParticleSystem>();
			ParticleSystem[] array = componentsInChildren;
			foreach (ParticleSystem val in array)
			{
				if ((Object)(object)val != (Object)null)
				{
					ShapeModule shape = val.shape;
					ShapeModule shape2 = val.shape;
					if ((int)((ShapeModule)(ref shape2)).shapeType == 14)
					{
						((ShapeModule)(ref shape)).skinnedMeshRenderer = skinnedMeshRenderer;
						((ShapeModule)(ref shape)).scale = ((Component)CurrentWeapon).transform.localScale;
						((ShapeModule)(ref shape)).position = Vector3.zero;
						((ShapeModule)(ref shape)).rotation = Vector3.zero;
					}
				}
			}
			Instance.transform.parent = ((Component)((Item)CurrentWeapon).LoadedVisual).transform;
			if (RotationOffset == Vector3.zero)
			{
				Instance.transform.localEulerAngles = new Vector3(90f, 270f, 0f);
			}
			else
			{
				Instance.transform.localEulerAngles = RotationOffset;
			}
			Instance.transform.localPosition = PositionOffset;
		}

		private Equipment FindCurrentWeapon(Character _affectedCharacter)
		{
			Equipment val = null;
			EquipmentSlot matchingSlot = _affectedCharacter.Inventory.Equipment.GetMatchingSlot((EquipmentSlotIDs)6);
			if (IsMainHand)
			{
				if ((Object)(object)_affectedCharacter.CurrentWeapon == (Object)null)
				{
					ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX Current Weapon is null");
					return null;
				}
				val = (Equipment)(object)_affectedCharacter.CurrentWeapon;
			}
			else
			{
				if ((Object)(object)matchingSlot == (Object)null)
				{
					ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX OffHand EquipmentSlot cannot be found");
					return null;
				}
				if (!matchingSlot.HasItemEquipped)
				{
					ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX OffHand EquipmentSlotitem is null");
					return null;
				}
				val = matchingSlot.EquippedItem;
			}
			return val;
		}

		public override void CleanUpOnDestroy()
		{
			((Effect)this).CleanUpOnDestroy();
			if (Object.op_Implicit((Object)(object)Instance))
			{
				ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX Cleaning up Instance");
				Object.Destroy((Object)(object)Instance);
			}
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			if (Object.op_Implicit((Object)(object)Instance))
			{
				ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX destroying Instance");
				Object.Destroy((Object)(object)Instance);
			}
		}
	}
	public class SL_ForceAIState : SL_Effect, ICustomModel
	{
		public int AIState;

		public Type SLTemplateModel => typeof(SL_ForceAIState);

		public Type GameModel => typeof(SLEx_ForceAIStateForTime);

		public override void ApplyToComponent<T>(T component)
		{
			SLEx_ForceAIStateForTime sLEx_ForceAIStateForTime = component as SLEx_ForceAIStateForTime;
			sLEx_ForceAIStateForTime.AIState = AIState;
		}

		public override void SerializeEffect<T>(T effect)
		{
			SLEx_ForceAIStateForTime sLEx_ForceAIStateForTime = effect as SLEx_ForceAIStateForTime;
			AIState = sLEx_ForceAIStateForTime.AIState;
		}
	}
	public class SLEx_ForceAIStateForTime : Effect, ICustomModel
	{
		public int AIState;

		public Type SLTemplateModel => typeof(SL_ForceAIState);

		public Type GameModel => typeof(SLEx_ForceAIStateForTime);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			if (AIState <= 3)
			{
				CharacterAI component = ((Component)_affectedCharacter).GetComponent<CharacterAI>();
				if (Object.op_Implicit((Object)(object)component))
				{
					ForceCharacterAIState(component, AIState);
				}
			}
		}

		private void ForceCharacterAIState(CharacterAI CharacterAI, int state)
		{
			CharacterAI.SwitchAiState(state);
		}
	}
	public class SL_HidePlayer : SL_Effect, ICustomModel
	{
		public float HideTime;

		public Type SLTemplateModel => typeof(SL_HidePlayer);

		public Type GameModel => typeof(SLEx_HidePlayer);

		public override void ApplyToComponent<T>(T component)
		{
			SLEx_HidePlayer sLEx_HidePlayer = component as SLEx_HidePlayer;
			sLEx_HidePlayer.HideTime = HideTime;
		}

		public override void SerializeEffect<T>(T effect)
		{
			SLEx_HidePlayer sLEx_HidePlayer = effect as SLEx_HidePlayer;
			HideTime = sLEx_HidePlayer.HideTime;
		}
	}
	public class SLEx_HidePlayer : Effect, ICustomModel
	{
		public float HideTime;

		private bool IsRunning = false;

		public Type SLTemplateModel => typeof(SL_HidePlayer);

		public Type GameModel => typeof(SLEx_HidePlayer);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			SL.Log("Activating Locally");
			if (!IsRunning)
			{
				((MonoBehaviour)this).StartCoroutine(ToggleCharacterVisual(((Effect)this).OwnerCharacter));
			}
		}

		private IEnumerator ToggleCharacterVisual(Character _affectedCharacter)
		{
			IsRunning = true;
			((Component)_affectedCharacter.VisualHolderTrans).gameObject.SetActive(false);
			yield return (object)new WaitForSeconds(HideTime);
			((Component)_affectedCharacter.VisualHolderTrans).gameObject.SetActive(true);
			IsRunning = false;
		}
	}
	public class SL_PlayAssetBundleVFX : SL_Effect, ICustomModel
	{
		public string SLPackName;

		public string AssetBundleName;

		public string PrefabName;

		public Vector3 PositionOffset;

		public Vector3 RotationOffset;

		public bool ParentToAffected;

		public bool PositionOffsetAsRelativeDirection;

		public bool RotateToPlayerDirection;

		public float LifeTime;

		public virtual Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX);

		public virtual Type GameModel => typeof(SLEx_PlayAssetBundleVFX);

		public override void ApplyToComponent<T>(T component)
		{
			//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			SLEx_PlayAssetBundleVFX sLEx_PlayAssetBundleVFX = component as SLEx_PlayAssetBundleVFX;
			sLEx_PlayAssetBundleVFX.SLPackName = SLPackName;
			sLEx_PlayAssetBundleVFX.AssetBundleName = AssetBundleName;
			sLEx_PlayAssetBundleVFX.PrefabName = PrefabName;
			sLEx_PlayAssetBundleVFX.PositionOffset = PositionOffset;
			sLEx_PlayAssetBundleVFX.RotationOffset = RotationOffset;
			sLEx_PlayAssetBundleVFX.ParentToAffected = ParentToAffected;
			sLEx_PlayAssetBundleVFX.PositionOffsetAsRelativeDirection = PositionOffsetAsRelativeDirection;
			sLEx_PlayAssetBundleVFX.RotateToPlayerDirection = RotateToPlayerDirection;
			sLEx_PlayAssetBundleVFX.LifeTime = LifeTime;
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			SLEx_PlayAssetBundleVFX sLEx_PlayAssetBundleVFX = effect as SLEx_PlayAssetBundleVFX;
			SLPackName = sLEx_PlayAssetBundleVFX.SLPackName;
			AssetBundleName = sLEx_PlayAssetBundleVFX.AssetBundleName;
			PrefabName = sLEx_PlayAssetBundleVFX.PrefabName;
			PositionOffset = sLEx_PlayAssetBundleVFX.PositionOffset;
			RotationOffset = sLEx_PlayAssetBundleVFX.RotationOffset;
			ParentToAffected = sLEx_PlayAssetBundleVFX.ParentToAffected;
			RotateToPlayerDirection = sLEx_PlayAssetBundleVFX.RotateToPlayerDirection;
			LifeTime = sLEx_PlayAssetBundleVFX.LifeTime;
		}
	}
	public class SLEx_PlayAssetBundleVFX : Effect, ICustomModel
	{
		public string SLPackName;

		public string AssetBundleName;

		public string PrefabName;

		public Vector3 PositionOffset;

		public Vector3 RotationOffset;

		public bool ParentToAffected;

		public bool PositionOffsetAsRelativeDirection;

		public bool RotateToPlayerDirection;

		public float LifeTime;

		private GameObject Instance;

		public virtual Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX);

		public virtual Type GameModel => typeof(SLEx_PlayAssetBundleVFX);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			GameObject fromAssetBundle = OutwardHelpers.GetFromAssetBundle<GameObject>(SLPackName, AssetBundleName, PrefabName);
			if ((Object)(object)fromAssetBundle != (Object)null)
			{
				if ((Object)(object)Instance == (Object)null)
				{
					Instance = Object.Instantiate<GameObject>(fromAssetBundle);
				}
				if (ParentToAffected)
				{
					Instance.transform.parent = _affectedCharacter.VisualHolderTrans;
					Instance.transform.localPosition = PositionOffset;
					Instance.transform.localEulerAngles = (RotateToPlayerDirection ? Vector3.zero : RotationOffset);
				}
				else
				{
					Instance.transform.position = ((Component)_affectedCharacter).transform.position + (PositionOffsetAsRelativeDirection ? (((Component)_affectedCharacter).transform.forward + ((Component)_affectedCharacter).transform.TransformVector(PositionOffset)) : PositionOffset);
					Instance.transform.eulerAngles = (RotateToPlayerDirection ? ((Component)_affectedCharacter).transform.eulerAngles : RotationOffset);
				}
				if (LifeTime > 0f)
				{
					ExtendedEffects.Instance.DebugLogMessage($"SLEx_PlayAssetBundleVFX LIFETIME IS {LifeTime}");
					Object.Destroy((Object)(object)Instance, LifeTime);
				}
			}
			else
			{
				ExtendedEffects.Instance.DebugLogMessage("SLEx_PlayAssetBundleVFX Prefab from AssetBundle " + AssetBundleName + " was null.");
			}
		}

		public override void CleanUpOnDestroy()
		{
			((Effect)this).CleanUpOnDestroy();
			if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance))
			{
				Object.Destroy((Object)(object)Instance);
			}
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance))
			{
				Object.Destroy((Object)(object)Instance);
			}
		}
	}
	public class SL_PlayAssetBundleVFX_Bones : SL_PlayAssetBundleVFX
	{
		public int BoneID;

		public override Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX_Bones);

		public override Type GameModel => typeof(SLEx_PlayAssetBundleVFX_Bones);

		public override void ApplyToComponent<T>(T component)
		{
			//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			SLEx_PlayAssetBundleVFX_Bones sLEx_PlayAssetBundleVFX_Bones = component as SLEx_PlayAssetBundleVFX_Bones;
			sLEx_PlayAssetBundleVFX_Bones.SLPackName = SLPackName;
			sLEx_PlayAssetBundleVFX_Bones.AssetBundleName = AssetBundleName;
			sLEx_PlayAssetBundleVFX_Bones.PrefabName = PrefabName;
			sLEx_PlayAssetBundleVFX_Bones.PositionOffset = PositionOffset;
			sLEx_PlayAssetBundleVFX_Bones.RotationOffset = RotationOffset;
			sLEx_PlayAssetBundleVFX_Bones.ParentToAffected = ParentToAffected;
			sLEx_PlayAssetBundleVFX_Bones.PositionOffsetAsRelativeDirection = PositionOffsetAsRelativeDirection;
			sLEx_PlayAssetBundleVFX_Bones.LifeTime = LifeTime;
			sLEx_PlayAssetBundleVFX_Bones.RotateToPlayerDirection = RotateToPlayerDirection;
			sLEx_PlayAssetBundleVFX_Bones.BoneID = BoneID;
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			SLEx_PlayAssetBundleVFX_Bones sLEx_PlayAssetBundleVFX_Bones = effect as SLEx_PlayAssetBundleVFX_Bones;
			SLPackName = sLEx_PlayAssetBundleVFX_Bones.SLPackName;
			AssetBundleName = sLEx_PlayAssetBundleVFX_Bones.AssetBundleName;
			PrefabName = sLEx_PlayAssetBundleVFX_Bones.PrefabName;
			PositionOffset = sLEx_PlayAssetBundleVFX_Bones.PositionOffset;
			RotationOffset = sLEx_PlayAssetBundleVFX_Bones.RotationOffset;
			ParentToAffected = sLEx_PlayAssetBundleVFX_Bones.ParentToAffected;
			PositionOffsetAsRelativeDirection = sLEx_PlayAssetBundleVFX_Bones.PositionOffsetAsRelativeDirection;
			LifeTime = sLEx_PlayAssetBundleVFX_Bones.LifeTime;
			BoneID = sLEx_PlayAssetBundleVFX_Bones.BoneID;
		}
	}
	public class SLEx_PlayAssetBundleVFX_Bones : SLEx_PlayAssetBundleVFX
	{
		public int BoneID;

		private GameObject Instance;

		public override Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX_Bones);

		public override Type GameModel => typeof(SLEx_PlayAssetBundleVFX_Bones);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: 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_00e6: 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_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			GameObject fromAssetBundle = OutwardHelpers.GetFromAssetBundle<GameObject>(SLPackName, AssetBundleName, PrefabName);
			if ((Object)(object)fromAssetBundle != (Object)null)
			{
				Transform val = OutwardHelpers.TryGetHumanBone(_affectedCharacter, (HumanBodyBones)BoneID);
				if ((Object)(object)val == (Object)null)
				{
					ExtendedEffects.Instance.DebugLogMessage("SLEx_PlayAssetBundleVFX_Bone cannot find target bone");
					return;
				}
				if ((Object)(object)Instance == (Object)null)
				{
					Instance = Object.Instantiate<GameObject>(fromAssetBundle);
				}
				if (ParentToAffected)
				{
					Instance.transform.parent = val;
					Instance.transform.localPosition = PositionOffset;
					Instance.transform.localEulerAngles = RotationOffset;
				}
				else
				{
					Instance.transform.position = ((Component)val).transform.position + (PositionOffsetAsRelativeDirection ? ((Component)_affectedCharacter).transform.TransformPoint(PositionOffset) : PositionOffset);
					Instance.transform.eulerAngles = (RotateToPlayerDirection ? ((Component)_affectedCharacter).transform.eulerAngles : RotationOffset);
				}
				if (LifeTime > 0f)
				{
					ExtendedEffects.Instance.DebugLogMessage($"SLEx_PlayAssetBundleVFX_Bones LIFETIME IS {LifeTime}");
					Object.Destroy((Object)(object)Instance, LifeTime);
				}
			}
			else
			{
				ExtendedEffects.Instance.DebugLogMessage("SLEx_PlayAssetBundleVFX_Bones Prefab from AssetBundle " + AssetBundleName + " was null.");
			}
		}

		public override void CleanUpOnDestroy()
		{
			base.CleanUpOnDestroy();
			if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance))
			{
				Object.Destroy((Object)(object)Instance);
			}
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance))
			{
				Object.Destroy((Object)(object)Instance);
			}
		}
	}
	public class SL_SetWeaponEmission : SL_Effect, ICustomModel
	{
		public Vector3 Color;

		public float ColorIntensity = 4f;

		public float ColorLerpTime = 0.5f;

		public Type SLTemplateModel => typeof(SL_SetWeaponEmission);

		public Type GameModel => typeof(SLEx_SetWeaponEmission);

		public override void ApplyToComponent<T>(T component)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			SLEx_SetWeaponEmission sLEx_SetWeaponEmission = component as SLEx_SetWeaponEmission;
			sLEx_SetWeaponEmission.ColorIntensity = ColorIntensity;
			sLEx_SetWeaponEmission.NewColor = Color;
			sLEx_SetWeaponEmission.ColorLerpTime = ColorLerpTime;
		}

		public override void SerializeEffect<T>(T component)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			SLEx_SetWeaponEmission sLEx_SetWeaponEmission = component as SLEx_SetWeaponEmission;
			Color = sLEx_SetWeaponEmission.NewColor;
			ColorIntensity = sLEx_SetWeaponEmission.ColorIntensity;
			ColorLerpTime = sLEx_SetWeaponEmission.ColorLerpTime;
		}
	}
	public class SLEx_SetWeaponEmission : Effect, ICustomModel
	{
		public Vector3 NewColor;

		public float ColorIntensity;

		public float ColorLerpTime;

		private bool IsRunning = false;

		public Type SLTemplateModel => typeof(SL_SetWeaponEmission);

		public Type GameModel => typeof(SLEx_SetWeaponEmission);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			Weapon currentWeapon = ((Effect)this).OwnerCharacter.CurrentWeapon;
			if ((Object)(object)currentWeapon != (Object)null)
			{
				Renderer component = ((Component)((Component)((Item)currentWeapon).LoadedVisual).GetComponentInChildren<BoxCollider>()).GetComponent<Renderer>();
				if ((Object)(object)component != (Object)null && !IsRunning)
				{
					((MonoBehaviour)this).StartCoroutine(LerpMaterialEmissionColor(component, ColorLerpTime, new Color(NewColor.x, NewColor.y, NewColor.z, 1f), ColorIntensity));
				}
			}
		}

		private IEnumerator LerpMaterialEmissionColor(Renderer Renderer, float lerpTime, Color newColor, float Intensity)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			IsRunning = true;
			Color OriginalColor = Renderer.material.GetColor("_EmissionColor");
			float timer = 0f;
			while (timer < lerpTime)
			{
				float currentPercent = timer / lerpTime;
				Renderer.material.SetColor("_EmissionColor", Color.Lerp(OriginalColor, newColor * Intensity, currentPercent));
				timer += Time.deltaTime;
				yield return null;
			}
			IsRunning = false;
		}
	}
	public class SL_SummonExtension : SL_Effect, ICustomModel
	{
		public Vector3 NewBaseColor;

		public Vector3 NewParticlesColor;

		public SL_Damage NewWeaponDamage;

		public string StatusEffectOnSpawn;

		public Type SLTemplateModel => typeof(SL_SummonExtension);

		public Type GameModel => typeof(SummonExtension);

		public override void ApplyToComponent<T>(T component)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			SummonExtension summonExtension = component as SummonExtension;
			summonExtension.NewBaseColor = NewBaseColor;
			summonExtension.NewParticlesColor = NewParticlesColor;
			summonExtension.NewWeaponDamage = new DamageType(NewWeaponDamage.Type, NewWeaponDamage.Damage);
			summonExtension.StatusEffectOnSpawn = StatusEffectOnSpawn;
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			SummonExtension summonExtension = effect as SummonExtension;
			NewBaseColor = summonExtension.NewBaseColor;
			NewParticlesColor = summonExtension.NewParticlesColor;
			StatusEffectOnSpawn = summonExtension.StatusEffectOnSpawn;
			NewWeaponDamage = new SL_Damage
			{
				Damage = summonExtension.NewWeaponDamage.Damage,
				Type = summonExtension.NewWeaponDamage.Type
			};
		}
	}
	public class SummonExtension : Effect
	{
		public Vector3 NewBaseColor;

		public Vector3 NewParticlesColor;

		public DamageType NewWeaponDamage;

		public string StatusEffectOnSpawn;

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			if ((Object)(object)_affectedCharacter.CurrentSummon != (Object)null)
			{
				UpdateSummonBaseColor(_affectedCharacter);
				UpdateSummonParticles(_affectedCharacter);
				if (!string.IsNullOrEmpty(StatusEffectOnSpawn))
				{
					AddSummonStatusEffects(_affectedCharacter.CurrentSummon);
				}
				if (NewWeaponDamage != null)
				{
					OverrideSummonWeaponDamage(_affectedCharacter.CurrentSummon);
				}
			}
		}

		private void UpdateSummonBaseColor(Character _affectedCharacter)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			Renderer[] componentsInChildren = ((Component)((Effect)this).OwnerCharacter.CurrentSummon).GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				val.material.SetColor("_Color", new Color(NewBaseColor.x, NewBaseColor.y, NewBaseColor.z));
			}
		}

		private void UpdateSummonParticles(Character _affectedCharacter)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			ParticleSystem[] componentsInChildren = ((Component)((Effect)this).OwnerCharacter.CurrentSummon).GetComponentsInChildren<ParticleSystem>();
			foreach (ParticleSystem val in componentsInChildren)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					MainModule main = val.main;
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(NewParticlesColor.x, NewParticlesColor.y, NewParticlesColor.z));
				}
			}
		}

		private void AddSummonStatusEffects(Character _summonCharacter)
		{
			StatusEffect statusEffectPrefab = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(StatusEffectOnSpawn);
			if ((Object)(object)statusEffectPrefab != (Object)null)
			{
				_summonCharacter.StatusEffectMngr.AddStatusEffect(statusEffectPrefab.StatusName);
			}
			else
			{
				ExtendedEffects._Log.LogMessage((object)("SL_SummonExtension : Could not find Status by name " + StatusEffectOnSpawn));
			}
		}

		private void OverrideSummonWeaponDamage(Character _summonCharacter)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			if ((Object)(object)_summonCharacter.CurrentWeapon != (Object)null && NewWeaponDamage != null)
			{
				OutwardHelpers.UpdateWeaponDamage(_summonCharacter.CurrentWeapon, new DamageList(NewWeaponDamage));
			}
		}
	}
	public class SL_SuspendStatusEffect : SL_Effect, ICustomModel
	{
		public string[] StatusEffectIdentifiers;

		public Type SLTemplateModel => typeof(SL_SuspendStatusEffect);

		public Type GameModel => typeof(SLEx_SuspendStatusEffect);

		public override void ApplyToComponent<T>(T component)
		{
			SLEx_SuspendStatusEffect sLEx_SuspendStatusEffect = component as SLEx_SuspendStatusEffect;
			sLEx_SuspendStatusEffect.StatusEffectIdentifiers = StatusEffectIdentifiers;
		}

		public override void SerializeEffect<T>(T effect)
		{
			SLEx_SuspendStatusEffect sLEx_SuspendStatusEffect = effect as SLEx_SuspendStatusEffect;
			StatusEffectIdentifiers = sLEx_SuspendStatusEffect.StatusEffectIdentifiers;
		}
	}
	public class SLEx_SuspendStatusEffect : Effect, ICustomModel
	{
		public string[] StatusEffectIdentifiers;

		public Type SLTemplateModel => typeof(SL_SuspendStatusEffect);

		public Type GameModel => typeof(SLEx_SuspendStatusEffect);

		private void SetSuspendedEffects(Character _affectedCharacter, bool suspended)
		{
			if (StatusEffectIdentifiers == null || StatusEffectIdentifiers.Length == 0)
			{
				ExtendedEffects._Log.LogDebug((object)"SLEx_SuspendStatusEffect defined without effects. Please specify the StatusEffectIdentifiers to suspend.");
				return;
			}
			foreach (StatusEffect status in _affectedCharacter.StatusEffectMngr.Statuses)
			{
				if (UnityEngineExtensions.Contains<string>(StatusEffectIdentifiers, status.IdentifierName) && status.IsEffectSuspended() != suspended)
				{
					ExtendedEffects._Log.LogDebug((object)$"Suspending effect of {status.IdentifierName} = {suspended}");
					status.SetEffectSuspended(suspended);
				}
			}
		}

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			SetSuspendedEffects(_affectedCharacter, suspended: true);
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			SetSuspendedEffects(_affectedCharacter, suspended: false);
		}
	}
	public class SL_SuspendStatusTimer : SL_Effect, ICustomModel
	{
		public string[] StatusEffectIdentifiers;

		public Type SLTemplateModel => typeof(SL_SuspendStatusTimer);

		public Type GameModel => typeof(SLEx_SuspendStatusTimer);

		public override void ApplyToComponent<T>(T component)
		{
			SLEx_SuspendStatusTimer sLEx_SuspendStatusTimer = component as SLEx_SuspendStatusTimer;
			sLEx_SuspendStatusTimer.StatusEffectIdentifiers = StatusEffectIdentifiers;
		}

		public override void SerializeEffect<T>(T effect)
		{
			SLEx_SuspendStatusTimer sLEx_SuspendStatusTimer = effect as SLEx_SuspendStatusTimer;
			StatusEffectIdentifiers = sLEx_SuspendStatusTimer.StatusEffectIdentifiers;
		}
	}
	public class SLEx_SuspendStatusTimer : Effect, ICustomModel
	{
		public string[] StatusEffectIdentifiers;

		public Type SLTemplateModel => typeof(SL_SuspendStatusTimer);

		public Type GameModel => typeof(SLEx_SuspendStatusTimer);

		private void SetSuspendedTimers(Character _affectedCharacter, bool suspended)
		{
			if (StatusEffectIdentifiers == null || StatusEffectIdentifiers.Length == 0)
			{
				ExtendedEffects._Log.LogDebug((object)"SLEx_SuspendStatusTimer defined without effects. Please specify the StatusEffectIdentifiers to suspend.");
				return;
			}
			foreach (StatusEffect status in _affectedCharacter.StatusEffectMngr.Statuses)
			{
				if (UnityEngineExtensions.Contains<string>(StatusEffectIdentifiers, status.IdentifierName) && status.IsTimerSuspended() != suspended)
				{
					ExtendedEffects._Log.LogDebug((object)$"Suspending timer of {status.IdentifierName} = {suspended}");
					status.SetTimerSuspended(suspended);
				}
			}
		}

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			SetSuspendedTimers(_affectedCharacter, suspended: true);
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			SetSuspendedTimers(_affectedCharacter, suspended: false);
		}
	}
	[Serializable]
	public class SkillTreeOverride
	{
		public string OriginalSkillTreeUID;

		public string NewSkillTreeUID;

		public SkillTreeOverride(string originalSkillTreeUID, string newSkillTreeUID)
		{
			OriginalSkillTreeUID = originalSkillTreeUID;
			NewSkillTreeUID = newSkillTreeUID;
		}
	}
}
namespace SideLoader_ExtendedEffects.Containers
{
	public class SL_CurrentAttributeScalingEffect : SL_ParentEffect
	{
		public float BaselineValue;

		public bool Round;

		public Attributes Attr;

		public bool Owner;

		public bool Relative;

		public bool BurnedMax;

		public override void ApplyToComponent<T>(T component)
		{
			base.ApplyToComponent(component);
			CurrentAttributeScalingEffect currentAttributeScalingEffect = component as CurrentAttributeScalingEffect;
			currentAttributeScalingEffect.Attr = Attr;
			currentAttributeScalingEffect.Owner = Owner;
			currentAttributeScalingEffect.Relative = Relative;
			currentAttributeScalingEffect.BurnedMax = BurnedMax;
			currentAttributeScalingEffect.Round = Round;
			currentAttributeScalingEffect.BaselineValue = BaselineValue;
		}

		public override void SerializeEffect<T>(T effect)
		{
			base.SerializeEffect(effect);
			CurrentAttributeScalingEffect currentAttributeScalingEffect = effect as CurrentAttributeScalingEffect;
			Attr = currentAttributeScalingEffect.Attr;
			Owner = currentAttributeScalingEffect.Owner;
			Relative = currentAttributeScalingEffect.Relative;
			BurnedMax = currentAttributeScalingEffect.BurnedMax;
			Round = currentAttributeScalingEffect.Round;
			BaselineValue = currentAttributeScalingEffect.BaselineValue;
		}
	}
	public class CurrentAttributeScalingEffect : ParentEffect, ICustomModel
	{
		public float BaselineValue;

		public bool Round;

		public Attributes Attr;

		public bool Owner;

		public bool Relative;

		public bool BurnedMax;

		public Type SLTemplateModel => typeof(SL_CurrentAttributeScalingEffect);

		public Type GameModel => typeof(CurrentAttributeScalingEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Character val = (Owner ? ((Effect)this).m_parentSynchronizer.OwnerCharacter : _affectedCharacter);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.Stats))
			{
				return;
			}
			float num;
			switch (Attr)
			{
			default:
				return;
			case Attributes.HEALTH:
				num = val.Stats.CurrentHealth;
				if (Relative)
				{
					num /= (BurnedMax ? val.Stats.ActiveMaxHealth : val.Stats.MaxHealth);
				}
				break;
			case Attributes.MANA:
				num = val.Stats.CurrentMana;
				if (Relative)
				{
					num /= (BurnedMax ? val.Stats.ActiveMaxMana : val.Stats.MaxMana);
				}
				break;
			case Attributes.STAMINA:
				num = val.Stats.CurrentStamina;
				if (Relative)
				{
					num /= (BurnedMax ? val.Stats.ActiveMaxStamina : val.Stats.MaxStamina);
				}
				break;
			case Attributes.BURNT_HEALTH:
				num = val.Stats.BurntHealth;
				if (Relative)
				{
					num /= val.Stats.MaxHealth;
				}
				break;
			case Attributes.BURNT_MANA:
				num = val.Stats.BurntMana;
				if (Relative)
				{
					num /= val.Stats.MaxMana;
				}
				break;
			case Attributes.BURNT_STAMINA:
				num = val.Stats.BurntStamina;
				if (Relative)
				{
					num /= val.Stats.MaxStamina;
				}
				break;
			}
			num /= (Relative ? (BaselineValue / 100f) : BaselineValue);
			if (Round)
			{
				num = (float)Math.Floor(num);
			}
			((EffectSynchronizer)((Effect)this).m_subEffects[0]).EffectPotency = num;
			foreach (EffectReference value in ((EffectSynchronizer)((Effect)this).m_subEffects[0]).m_effects.Values)
			{
				value.Effect.RefreshPotency();
			}
			StartApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)1 }, _affectedCharacter);
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			Character affectedCharacter = (Owner ? ((Effect)this).m_parentSynchronizer.OwnerCharacter : _affectedCharacter);
			StopApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)1 }, _affectedCharacter);
			base.StopAffectLocally(affectedCharacter);
		}
	}
	public class SL_EffectLifecycleEffect : SL_ParentEffect
	{
	}
	public class EffectLifecycleEffect : ParentEffect, ICustomModel
	{
		private bool activated = false;

		public Type SLTemplateModel => typeof(SL_EffectLifecycleEffect);

		public Type GameModel => typeof(EffectLifecycleEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			if (!activated)
			{
				StartApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)2 }, ((Effect)this).OwnerCharacter);
				activated = true;
			}
			StartApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)1 }, ((Effect)this).OwnerCharacter);
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			StartApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)5 }, ((Effect)this).OwnerCharacter);
			activated = false;
			StopApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)5 }, ((Effect)this).OwnerCharacter);
			StopApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)2 }, ((Effect)this).OwnerCharacter);
			StopApply((EffectCategories[])(object)new EffectCategories[1] { (EffectCategories)1 }, ((Effect)this).OwnerCharacter);
			base.StopAffectLocally(_affectedCharacter);
		}
	}
	public abstract class SL_ParentEffect : SL_Shooter
	{
		public EditBehaviours EffectBehavior = (EditBehaviours)2;

		public SL_EffectTransform[] ChildEffects;

		public int ActivationLimit;

		public override void ApplyToComponent<T>(T component)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			((SL_Shooter)this).ApplyToComponent<T>(component);
			try
			{
				ParentEffect parentEffect = component as ParentEffect;
				GameObject val = new GameObject();
				Object.DontDestroyOnLoad((Object)(object)val);
				val.SetActive(false);
				parentEffect.ActivationLimit = ActivationLimit;
				parentEffect.ChildEffects = val.gameObject.AddComponent<SubEffect>();
				SL_EffectTransform.ApplyTransformList(((Component)parentEffect.ChildEffects).transform, ChildEffects, EffectBehavior);
			}
			catch (Exception ex)
			{
				SL.Log((object)ex);
			}
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Expected O, but got Unknown
			((SL_Shooter)this).SerializeEffect<T>(effect);
			try
			{
				ParentEffect parentEffect = effect as ParentEffect;
				if (((Component)parentEffect.ChildEffects).transform.childCount > 0)
				{
					List<SL_EffectTransform> list = new List<SL_EffectTransform>();
					foreach (Transform item in ((Component)parentEffect.ChildEffects).transform)
					{
						Transform val = item;
						SL_EffectTransform val2 = SL_EffectTransform.ParseTransform(val);
						if (val2.HasContent)
						{
							list.Add(val2);
						}
					}
					ChildEffects = list.ToArray();
				}
				ActivationLimit = parentEffect.ActivationLimit;
			}
			catch (Exception ex)
			{
				SL.Log((object)ex);
			}
		}
	}
	public abstract class ParentEffect : Shooter
	{
		public SubEffect ChildEffects;

		public int ActivationLimit;

		public float Value = 0f;

		private float lastApplyTime = 0f;

		private Dictionary<Character, int> affectedThisInterval;

		public override void Setup(Factions[] _targetFactions, Transform _parent)
		{
			try
			{
				((Shooter)this).Setup(_targetFactions, _parent);
				if (((Effect)this).m_subEffects == null)
				{
					((Effect)this).m_subEffects = (SubEffect[])(object)new SubEffect[1] { Object.Instantiate<SubEffect>(ChildEffects) };
				}
				((Component)((Effect)this).m_subEffects[0]).gameObject.SetActive(true);
				((Effect)this).m_subEffects[0].Setup((Effect)(object)this, 0, _targetFactions, ((Component)this).transform);
				Shooter[] componentsInChildren = ((Component)((Effect)this).m_subEffects[0]).GetComponentsInChildren<Shooter>(true);
				foreach (Shooter val in componentsInChildren)
				{
					val.Setup(_targetFactions, _parent);
				}
			}
			catch (Exception ex)
			{
				SL.Log("=========Setup Error!===========");
				SL.Log((object)ex);
			}
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			foreach (EffectCategories value in Enum.GetValues(typeof(EffectCategories)))
			{
				((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects(value, _affectedCharacter);
			}
			((Effect)this).StopAffectLocally(_affectedCharacter);
		}

		public virtual void StartApply(EffectCategories[] categories, Character affectedCharacter, Vector3 pos, Vector3 dir)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
			if (Time.time - lastApplyTime > 0f)
			{
				lastApplyTime = Time.time;
				if (affectedThisInterval == null)
				{
					affectedThisInterval = new Dictionary<Character, int>();
				}
				else
				{
					affectedThisInterval.Clear();
				}
			}
			int value = 0;
			if (!affectedThisInterval.TryGetValue(affectedCharacter, out value))
			{
				affectedThisInterval.Add(affectedCharacter, 0);
			}
			if (ActivationLimit == 0 || value < ActivationLimit)
			{
				affectedThisInterval[affectedCharacter]++;
				foreach (EffectCategories val in categories)
				{
					((EffectSynchronizer)((Effect)this).m_subEffects[0]).SynchronizeEffects(val, affectedCharacter, pos, dir);
				}
			}
		}

		public virtual void StopApply(EffectCategories[] categories, Character affectedCharacter)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			foreach (EffectCategories val in categories)
			{
				((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects(val, affectedCharacter);
			}
		}

		public virtual void StartApply(EffectCategories[] categories, Character affectedCharacter)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 zero = Vector3.zero;
			Vector3 zero2 = Vector3.zero;
			((Shooter)this).GetActivationInfos(affectedCharacter, ref zero, ref zero2);
			StartApply(categories, affectedCharacter, zero, zero2);
		}

		public virtual void Apply(EffectCategories[] categories, Character affectedCharacter, Vector3 pos, Vector3 dir)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			StartApply(categories, affectedCharacter, pos, dir);
			StopApply(categories, affectedCharacter);
		}

		public virtual void Apply(EffectCategories[] categories, Character affectedCharacter)
		{
			StartApply(categories, affectedCharacter);
			StopApply(categories, affectedCharacter);
		}
	}
	public class SL_StatScalingEffect : SL_ParentEffect
	{
		public string Stat;

		public float BaselineValue;

		public bool Round;

		public bool Owner;

		public bool Modifier;

		public override void ApplyToComponent<T>(T component)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			base.ApplyToComponent(component);
			StatScalingEffect statScalingEffect = component as StatScalingEffect;
			statScalingEffect.Stat = OutwardHelpers.GetTagFromName(Stat);
			statScalingEffect.BaselineValue = BaselineValue;
			statScalingEffect.Round = Round;
			statScalingEffect.Owner = Owner;
			statScalingEffect.Modifier = Modifier;
		}

		public override void SerializeEffect<T>(T effect)
		{
			base.SerializeEffect(effect);
			StatScalingEffect statScalingEffect = effect as StatScalingEffect;
			Stat = statScalingEffect.Stat.TagName;
			BaselineValue = statScalingEffect.BaselineValue;
			Round = statScalingEffect.Round;
			Owner = statScalingEffect.Owner;
			Modifier = statScalingEffect.Modifier;
		}
	}
	public class StatScalingEffect : ParentEffect, ICustomModel
	{
		public Tag Stat;

		public float BaselineValue;

		public bool Round;

		public bool Owner;

		public bool Modifier;

		public Type SLTemplateModel => typeof(SL_StatScalingEffect);

		public Type GameModel => typeof(StatScalingEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			Character val = (Owner ? ((Effect)this).m_parentSynchronizer.OwnerCharacter : _affectedCharacter);
			Tag[] parentTags = ((Effect)(object)this).GetParentTags();
			float num = (Modifier ? val.GetTaggedStatModifier(Stat, parentTags) : val.GetTaggedStat(Stat, parentTags));
			num /= BaselineValue;
			if (Round)
			{
				num = (float)Math.Floor(num);
			}
			((EffectSynchronizer)((Effect)this).m_subEffects[0]).EffectPotency = num;
			foreach (EffectReference value in ((EffectSynchronizer)((Effect)this).m_subEffects[0]).m_effects.Values)
			{
				value.Effect.RefreshPotency();
			}
			((EffectSynchronizer)((Effect)this).m_subEffects[0]).SynchronizeEffects((EffectCategories)1, val);
		}

		public override void StopAffectLocally(Character _affectedCharacter)
		{
			Character val = (Owner ? ((Effect)this).m_parentSynchronizer.OwnerCharacter : _affectedCharacter);
			((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects((EffectCategories)1, val);
			base.StopAffectLocally(val);
		}
	}
	public class SL_BlinkEffect : SL_Effect
	{
		public float BlinkDistance = 5f;

		public float HeightOffset = 1f;

		public LayerMask BlockingLayers;

		public float NavMeshRadius = 0.5f;

		public override void ApplyToComponent<T>(T component)
		{
			//IL_0027: 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)
			BlinkEffect blinkEffect = component as BlinkEffect;
			blinkEffect.BlinkDistance = BlinkDistance;
			blinkEffect.HeightOffset = HeightOffset;
			blinkEffect.BlockingLayers = BlockingLayers;
			blinkEffect.NavMeshRadius = NavMeshRadius;
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_0027: 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)
			BlinkEffect blinkEffect = effect as BlinkEffect;
			BlinkDistance = blinkEffect.BlinkDistance;
			HeightOffset = blinkEffect.HeightOffset;
			BlockingLayers = blinkEffect.BlockingLayers;
			NavMeshRadius = blinkEffect.NavMeshRadius;
		}
	}
	public class BlinkEffect : Effect, ICustomModel
	{
		public float BlinkDistance = 5f;

		public float HeightOffset = 1f;

		public LayerMask BlockingLayers;

		public float NavMeshRadius = 0.5f;

		public Type SLTemplateModel => typeof(SL_BlinkEffect);

		public Type GameModel => typeof(BlinkEffect);

		private Vector3? GetValidBlinkPosition(Character character)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = ((Component)character).transform.position + Vector3.up * HeightOffset;
			Vector3 forward = ((Component)character).transform.forward;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, forward, ref val2, BlinkDistance, LayerMask.op_Implicit(BlockingLayers)))
			{
				BlinkDistance = ((RaycastHit)(ref val2)).distance - 0.5f;
				if (BlinkDistance <= 0.5f)
				{
					return null;
				}
			}
			Vector3 val3 = ((Component)character).transform.position + forward * BlinkDistance;
			NavMeshHit val4 = default(NavMeshHit);
			if (NavMesh.SamplePosition(val3, ref val4, NavMeshRadius, -1))
			{
				if (!Physics.Raycast(((NavMeshHit)(ref val4)).position + Vector3.up * 10f, Vector3.down, ref val2, 20f, LayerMask.op_Implicit(BlockingLayers)))
				{
					return null;
				}
				return ((RaycastHit)(ref val2)).point;
			}
			return null;
		}

		public override void ActivateLocally(Character affectedCharacter, object[] infos)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)affectedCharacter == (Object)null))
			{
				Vector3? validBlinkPosition = GetValidBlinkPosition(affectedCharacter);
				if (validBlinkPosition.HasValue)
				{
					affectedCharacter.Teleport(validBlinkPosition.Value, ((Component)affectedCharacter).transform.rotation);
				}
			}
		}

		public override void CleanUpOnDestroy()
		{
			((Effect)this).CleanUpOnDestroy();
		}
	}
	public class SL_ForgetRecipeEffect : SL_Effect
	{
		public List<string> recipeIDs;

		public override void ApplyToComponent<T>(T component)
		{
			ForgetRecipeEffect forgetRecipeEffect = component as ForgetRecipeEffect;
			forgetRecipeEffect.recipeIDs = recipeIDs;
		}

		public override void SerializeEffect<T>(T effect)
		{
			ForgetRecipeEffect forgetRecipeEffect = effect as ForgetRecipeEffect;
			recipeIDs = forgetRecipeEffect.recipeIDs;
		}
	}
	public class ForgetRecipeEffect : Effect, ICustomModel
	{
		public List<string> recipeIDs;

		public Type SLTemplateModel => typeof(SL_ForgetRecipeEffect);

		public Type GameModel => typeof(ForgetRecipeEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Character ownerCharacter = base.m_parentSynchronizer.OwnerCharacter;
			if ((Object)(object)ownerCharacter == (Object)null)
			{
				return;
			}
			foreach (string recipeID in recipeIDs)
			{
				if (ownerCharacter.Inventory.RecipeKnowledge.IsRecipeLearned(recipeID))
				{
					Item recipeFromUID = GetRecipeFromUID(ownerCharacter, recipeID);
					((CharacterKnowledge)ownerCharacter.Inventory.SkillKnowledge).RemoveItem(recipeFromUID);
					int num = ((CharacterKnowledge)ownerCharacter.Inventory.RecipeKnowledge).m_learnedItemUIDs.IndexOf(recipeID);
					if (num >= 0)
					{
						((CharacterKnowledge)ownerCharacter.Inventory.RecipeKnowledge).m_learnedItemUIDs.RemoveAt(num);
					}
				}
				else
				{
					ExtendedEffects._Log.LogMessage((object)(ownerCharacter.Name + " does not know  Recipe UID " + recipeID + " cannot unlearn."));
				}
			}
		}

		private Item GetRecipeFromUID(Character character, string recipeUID)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			foreach (Item learnedItem in ((CharacterKnowledge)character.Inventory.RecipeKnowledge).m_learnedItems)
			{
				if (learnedItem.UID == recipeUID)
				{
					return learnedItem;
				}
			}
			ExtendedEffects._Log.LogMessage((object)$"Cannot find recipe with UID {recipeUID} on {character.Name} {character.UID}");
			return null;
		}
	}
	public class SL_ForgetSkillEffect : SL_Effect
	{
		public List<int> skillIDs;

		public override void ApplyToComponent<T>(T component)
		{
			ForgetSkillEffect forgetSkillEffect = component as ForgetSkillEffect;
			forgetSkillEffect.skillIDs = skillIDs;
		}

		public override void SerializeEffect<T>(T effect)
		{
			ForgetSkillEffect forgetSkillEffect = effect as ForgetSkillEffect;
			skillIDs = forgetSkillEffect.skillIDs;
		}
	}
	public class ForgetSkillEffect : Effect, ICustomModel
	{
		public List<int> skillIDs;

		public Type SLTemplateModel => typeof(SL_ForgetSkillEffect);

		public Type GameModel => typeof(ForgetSkillEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Character ownerCharacter = base.m_parentSynchronizer.OwnerCharacter;
			if ((Object)(object)ownerCharacter == (Object)null)
			{
				return;
			}
			foreach (int skillID in skillIDs)
			{
				if (((CharacterKnowledge)ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(skillID))
				{
					((CharacterKnowledge)ownerCharacter.Inventory.SkillKnowledge).RemoveItem(skillID);
				}
			}
		}
	}
	public class SL_SpendAttributeEffect : SL_Effect
	{
		public float Value;

		public Attributes Attr;

		public bool Relative;

		public bool BurnedMax;

		public override void ApplyToComponent<T>(T component)
		{
			SpendAttributeEffect spendAttributeEffect = component as SpendAttributeEffect;
			spendAttributeEffect.Attr = Attr;
			spendAttributeEffect.Relative = Relative;
			spendAttributeEffect.BurnedMax = BurnedMax;
			spendAttributeEffect.Value = Value;
		}

		public override void SerializeEffect<T>(T effect)
		{
			SpendAttributeEffect spendAttributeEffect = effect as SpendAttributeEffect;
			Attr = spendAttributeEffect.Attr;
			Relative = spendAttributeEffect.Relative;
			BurnedMax = spendAttributeEffect.BurnedMax;
			Value = spendAttributeEffect.Value;
		}
	}
	public class SpendAttributeEffect : Effect, ICustomModel
	{
		public float Value;

		public Attributes Attr;

		public bool Relative;

		public bool BurnedMax;

		public Type SLTemplateModel => typeof(SL_SpendAttributeEffect);

		public Type GameModel => typeof(SpendAttributeEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Character ownerCharacter = base.m_parentSynchronizer.OwnerCharacter;
			if (!Object.op_Implicit((Object)(object)ownerCharacter) || !Object.op_Implicit((Object)(object)ownerCharacter.Stats))
			{
				return;
			}
			float num = Value * base.m_totalPotency;
			switch (Attr)
			{
			case Attributes.HEALTH:
				if (Relative)
				{
					num *= (BurnedMax ? ownerCharacter.Stats.ActiveMaxHealth : ownerCharacter.Stats.MaxHealth);
				}
				ownerCharacter.Stats.ReceiveDamage(num);
				break;
			case Attributes.MANA:
				if (Relative)
				{
					num *= (BurnedMax ? ownerCharacter.Stats.ActiveMaxMana : ownerCharacter.Stats.MaxMana);
				}
				ownerCharacter.Stats.UseMana(((Effect)(object)this).GetParentTags(), num);
				break;
			case Attributes.STAMINA:
				if (Relative)
				{
					num *= (BurnedMax ? ownerCharacter.Stats.ActiveMaxStamina : ownerCharacter.Stats.MaxStamina);
				}
				ownerCharacter.Stats.UseStamina(((Effect)(object)this).GetParentTags(), num, 1f);
				break;
			case Attributes.BURNT_HEALTH:
				if (Relative)
				{
					num *= (BurnedMax ? ownerCharacter.Stats.ActiveMaxHealth : ownerCharacter.Stats.MaxHealth);
				}
				ownerCharacter.Stats.IncreaseBurntHealth(num, 1f);
				break;
			case Attributes.BURNT_MANA:
				if (Relative)
				{
					num *= (BurnedMax ? ownerCharacter.Stats.ActiveMaxMana : ownerCharacter.Stats.MaxMana);
				}
				ownerCharacter.Stats.IncreaseBurntMana(num);
				break;
			case Attributes.BURNT_STAMINA:
				if (Relative)
				{
					num *= (BurnedMax ? ownerCharacter.Stats.ActiveMaxStamina : ownerCharacter.Stats.MaxStamina);
				}
				ownerCharacter.Stats.IncreaseBurntStamina(num, 1f);
				break;
			}
		}
	}
	public class SL_StartQuestEffect : SL_Effect
	{
		public List<int> questUIDs;

		public override void ApplyToComponent<T>(T component)
		{
			StartQuestEffect startQuestEffect = component as StartQuestEffect;
			startQuestEffect.questUIDs = questUIDs;
		}

		public override void SerializeEffect<T>(T effect)
		{
			StartQuestEffect startQuestEffect = effect as StartQuestEffect;
			questUIDs = startQuestEffect.questUIDs;
		}
	}
	public class StartQuestEffect : Effect, ICustomModel
	{
		public List<int> questUIDs;

		public Type SLTemplateModel => typeof(SL_StartQuestEffect);

		public Type GameModel => typeof(StartQuestEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			Character ownerCharacter = base.m_parentSynchronizer.OwnerCharacter;
			if ((Object)(object)ownerCharacter == (Object)null)
			{
				return;
			}
			foreach (int questUID in questUIDs)
			{
				GenerateQuestItemForCharacter(ownerCharacter, questUID);
			}
		}

		public Quest GenerateQuestItemForCharacter(Character character, int QuestItemID)
		{
			Item obj = ItemManager.Instance.GenerateItemNetwork(QuestItemID);
			Quest val = (Quest)(object)((obj is Quest) ? obj : null);
			((Component)val).transform.SetParent(((Component)character.Inventory.QuestKnowledge).transform);
			((CharacterKnowledge)character.Inventory.QuestKnowledge).AddItem((Item)(object)val);
			return val;
		}
	}
	public class SL_TeleportToEffect : SL_Effect
	{
		public AreaEnum targetArea;

		public bool OnlyWorldHost = true;

		public bool MoveBag = true;

		public int SpawnPoint = 0;

		public override void ApplyToComponent<T>(T component)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			TeleportToEffect teleportToEffect = component as TeleportToEffect;
			teleportToEffect.targetArea = targetArea;
			teleportToEffect.OnlyWorldHost = OnlyWorldHost;
			teleportToEffect.MoveBag = MoveBag;
			teleportToEffect.SpawnPoint = SpawnPoint;
		}

		public override void SerializeEffect<T>(T effect)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			TeleportToEffect teleportToEffect = effect as TeleportToEffect;
			targetArea = teleportToEffect.targetArea;
			targetArea = teleportToEffect.targetArea;
			OnlyWorldHost = teleportToEffect.OnlyWorldHost;
			MoveBag = teleportToEffect.MoveBag;
			SpawnPoint = teleportToEffect.SpawnPoint;
		}
	}
	public class TeleportToEffect : Effect, ICustomModel
	{
		public AreaEnum targetArea;

		public bool OnlyWorldHost = true;

		public bool MoveBag = true;

		public int SpawnPoint = 0;

		public virtual Type SLTemplateModel => typeof(SL_TeleportToEffect);

		public virtual Type GameModel => typeof(TeleportToEffect);

		public override void ActivateLocally(Character _affectedCharacter, object[] _infos)
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			Character ownerCharacter = base.m_parentSynchronizer.OwnerCharacter;
			if (!((Object)(object)ownerCharacter == (Object)null) && (!((Object)(object)ownerCharacter != (Object)null) || !ownerCharacter.IsAI))
			{
				if (ownerCharacter.IsWorldHost && OnlyWorldHost)
				{
					ExtendedEffects.Instance.PortalManager.StartAreaSwitch(ownerCharacter, targetArea, SpawnPoint);
				}
				else if (!ownerCharacter.IsAI && !OnlyWorldHost)
				{
					ExtendedEffects.Instance.PortalManager.StartAreaSwitch(ownerCharacter, targetArea, SpawnPoint);
				}
			}
		}
	}
	public class SL_TeleportToPositionEffect : SL_TeleportToEffect
	{
		public Vector3 TargetPosition;

		public bool ForceSafe = true;

		public float NavMeshSampleRadius = 10f;

		public override void ApplyToComponent<T>(T component)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			base.ApplyToComponent(component);
			TeleportToPositionEffect teleportToPos