Decompiled source of TrainersOfAurai v5.2.0
plugins/MadDelayedDamage.dll
Decompiled a year agousing System; 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 HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("MadDelayedDamage")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MadDelayedDamage")] [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] namespace MadDelayedDamage; [BepInPlugin("iggy.mad.delayeddamage", "Mad Delayed Damage", "2.0.0")] public class DelayedDamage : BaseUnityPlugin { [HarmonyPatch(typeof(ResourcesPrefabManager), "Load")] public class ResourcesPrefabManager_Load { [HarmonyPostfix] public static void Postfix() { ResourcesPrefabManager instance = ResourcesPrefabManager.Instance; if (instance != null && instance.Loaded) { MakeDelayedDamageStatusEffect(); } } } [HarmonyPatch(typeof(Character), "OnReceiveHit", new Type[] { typeof(Weapon), typeof(float), typeof(DamageList), typeof(Vector3), typeof(Vector3), typeof(float), typeof(float), typeof(Character), typeof(float) })] public class Character_ReceiveHit { [HarmonyPrefix] public static void Prefix(Character __instance, ref float _damage, Character _dealerChar, DamageList _damageList, float _knockBack) { DelaySomeDamage(__instance, _dealerChar, ref _damage, _damageList, _knockBack); } } public const string GUID = "iggy.mad.delayeddamage"; public const string VERSION = "2.0.0"; public const string NAME = "Mad Delayed Damage"; public static DelayedDamage Instance; public StatusEffect DelayedDamageInstance; public static Func<Character, Character, DamageList, float, float> GetDamageToDelay = (Character character, Character dealer, DamageList damageList, float damage) => 0f; public static Action<Character, Character, float> OnDelayedDamageTaken = delegate { }; internal void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Instance = this; new Harmony("iggy.mad.delayeddamage").PatchAll(); } private static void MakeDelayedDamageStatusEffect() { Instance.DelayedDamageInstance = MadHelper.MakeStatusEffectPrefab("Delayed Damage", "Delayed Damage", "Taking delayed damage over time.", DelayedDamageEffect.LifeSpan, DelayedDamageEffect.RefreshRate, (StackBehaviors)5, "Haunted", isMalusEffect: true, null, null, "iggy.mad.delayeddamage"); EffectSignature statusEffectSignature = Instance.DelayedDamageInstance.StatusEffectSignature; DelayedDamageEffect delayedDamageEffect = MadHelper.MakeFreshObject("Effects", setActive: true, dontDestroyOnLoad: true, ((Component)statusEffectSignature).transform).AddComponent<DelayedDamageEffect>(); ((Effect)delayedDamageEffect).UseOnce = false; statusEffectSignature.Effects = new List<Effect> { (Effect)(object)delayedDamageEffect }; } public static void DelaySomeDamage(Character character, Character dealer, ref float damage, DamageList damageList, float knockBack) { float num = Mathf.Clamp(GetDamageToDelay(character, dealer, damageList, knockBack), 0f, damage); if (num > 0f) { damage -= num; DealDelayedDamage(character, dealer, num); } } public static void DealDelayedDamage(Character character, Character dealer, float delayedDamage) { StatusEffect val = character.StatusEffectMngr.AddStatusEffect("Delayed Damage"); if ((Object)(object)dealer != (Object)null) { val.SetSourceCharacter(dealer); } ((EffectSynchronizer)val).SetPotency(delayedDamage); } public static float GetRemainingDelayedDamage(Character character) { float? num; if ((Object)(object)character == (Object)null) { num = null; } else { StatusEffectManager statusEffectMngr = character.StatusEffectMngr; num = (((Object)(object)statusEffectMngr == (Object)null) ? null : (from status in statusEffectMngr.Statuses?.Where((StatusEffect status) => status.IdentifierName == "Delayed Damage") select ((EffectSynchronizer)status).EffectPotency)?.Sum()); } float? num2 = num; return num2.GetValueOrDefault(); } } public class DelayedDamageEffect : Effect { public static int LifeSpan = 15; public static float RefreshRate = 1f; public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { StatusEffect parentStatusEffect = base.m_parentStatusEffect; float num = (0f - (((Object)(object)parentStatusEffect != (Object)null) ? ((EffectSynchronizer)parentStatusEffect).EffectPotency : 1f)) / ((float)LifeSpan / RefreshRate); _ = base.m_parentStatusEffect; Action<Character, Character, float> onDelayedDamageTaken = DelayedDamage.OnDelayedDamageTaken; StatusEffect parentStatusEffect2 = base.m_parentStatusEffect; onDelayedDamageTaken(_affectedCharacter, (((Object)(object)parentStatusEffect2 != (Object)null) ? ((EffectSynchronizer)parentStatusEffect2).OwnerCharacter : null) ?? null, num); _affectedCharacter.Stats.AffectHealth(num); } } internal class MadHelper { public static class At { public static BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static object Call(object obj, string method, params object[] args) { MethodInfo method2 = obj.GetType().GetMethod(method, flags); if (method2 != null) { return method2.Invoke(obj, args); } return null; } public static void SetValue<T>(T value, Type type, object obj, string field) { FieldInfo field2 = type.GetField(field, flags); if (field2 != null) { field2.SetValue(obj, value); } } public static object GetValue(Type type, object obj, string value) { FieldInfo field = type.GetField(value, flags); if (field != null) { return field.GetValue(obj); } return null; } public static void InheritBaseValues(object _derived, object _base) { FieldInfo[] fields = _base.GetType().GetFields(flags); foreach (FieldInfo fieldInfo in fields) { try { _derived.GetType().GetField(fieldInfo.Name).SetValue(_derived, fieldInfo.GetValue(_base)); } catch { } } } } public class CustomTexture { public enum SpriteBorderTypes { None, Item, TrainerSkill } public enum IconName { m_itemIcon, SkillTreeIcon } private static Dictionary<string, byte[]> m_loadedTextures; public static string PLUGIN_ROOT_PATH => Directory.GetCurrentDirectory() + "\\BepInEx\\plugins\\"; private static Dictionary<string, byte[]> LoadedTextures { get { if (m_loadedTextures == null) { m_loadedTextures = new Dictionary<string, byte[]>(); } return m_loadedTextures; } } public static Texture2D LoadTexture(string filePath, int mipCount, bool linear, FilterMode filterMode, float? mipMapBias = null) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) filePath = PLUGIN_ROOT_PATH + filePath; if (!LoadedTextures.ContainsKey(filePath)) { LoadedTextures[filePath] = File.ReadAllBytes(filePath); } Texture2D val = new Texture2D(4, 4, (TextureFormat)12, mipCount > 0, linear); ((Texture)val).filterMode = filterMode; ((Texture)val).mipMapBias = mipMapBias ?? ((Texture)val).mipMapBias; ImageConversion.LoadImage(val, LoadedTextures[filePath]); ((Texture)val).filterMode = (FilterMode)1; return val; } public static Sprite MakeSprite(Texture2D texture, SpriteBorderTypes spriteBorderType) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) float num; float num2; float num3; float num4; switch (spriteBorderType) { default: num = 0f; num2 = 0f; num3 = 0f; num4 = 0f; break; case SpriteBorderTypes.TrainerSkill: num = 1f; num2 = 1f; num3 = 1f; num4 = 2f; break; case SpriteBorderTypes.Item: num = 1f; num2 = 2f; num3 = 2f; num4 = 3f; break; } return Sprite.Create(texture, new Rect(num, num3, (float)((Texture)texture).width - num2, (float)((Texture)texture).height - num4), new Vector2(0f, 0f), 100f, 0u); } } public static StatusEffect MakeStatusEffectPrefab(string effectName, string familyName, string description, float lifespan, float refreshRate, StackBehaviors stackBehavior, string targetStatusName, bool isMalusEffect, string tagID = null, UID? uid = null, string modGUID = null, string iconFileName = null, string displayName = null) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_017b: Expected O, but got Unknown //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_023f: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, StatusEffect> obj = At.GetValue(typeof(ResourcesPrefabManager), null, "STATUSEFFECT_PREFABS") as Dictionary<string, StatusEffect>; StatusEffectFamily val = MakeStatusEffectFamiliy(familyName, stackBehavior, -1, (LengthTypes)0); GameObject val2 = InstantiateClone(((Component)obj[targetStatusName]).gameObject, effectName, setActive: false, dontDestroyOnLoad: true); StatusEffect obj2 = val2.GetComponent<StatusEffect>() ?? val2.AddComponent<StatusEffect>(); StatusEffect val3 = obj2; obj[effectName] = obj2; StatusEffect val4 = val3; At.SetValue(effectName, typeof(StatusEffect), val4, "m_identifierName"); At.SetValue<StatusEffectFamily>(val, typeof(StatusEffect), val4, "m_bindFamily"); At.SetValue(displayName ?? effectName, typeof(StatusEffect), val4, "m_nameLocKey"); At.SetValue(description, typeof(StatusEffect), val4, "m_descriptionLocKey"); val4.RefreshRate = refreshRate; val4.IsMalusEffect = isMalusEffect; At.SetValue<EffectSignatureModes>((EffectSignatureModes)1, typeof(StatusEffect), val4, "m_effectSignatureMode"); At.SetValue<FamilyModes>((FamilyModes)0, typeof(StatusEffect), val4, "m_familyMode"); val4.RequiredStatus = null; val4.RemoveRequiredStatus = false; if (iconFileName != null) { val4.OverrideIcon = CustomTexture.MakeSprite(CustomTexture.LoadTexture(iconFileName, 0, linear: false, (FilterMode)0), CustomTexture.SpriteBorderTypes.None); } At.SetValue<TagSourceSelector>((tagID != null) ? new TagSourceSelector(TagSourceManager.Instance.GetTag(UID.op_Implicit(tagID))) : new TagSourceSelector(), typeof(StatusEffect), val4, "m_effectType"); StatusData val5 = new StatusData(val4.StatusData); StatusData val6 = val5; val4.StatusData = val5; StatusData val7 = val6; val7.LifeSpan = lifespan; (At.GetValue(typeof(StatusEffect), val4, "m_statusStack") as List<StatusData>)[0] = val7; Object.Destroy((Object)(object)((Component)val2.GetComponentInChildren<EffectSignature>()).gameObject); EffectSignature val8 = MakeFreshObject("Signature", setActive: true, dontDestroyOnLoad: true).AddComponent<EffectSignature>(); ((Object)val8).name = "Signature"; val8.SignatureUID = (UID)(((??)uid) ?? ((modGUID != null) ? MakeUID(effectName, modGUID, "Status Effect") : UID.Generate())); EffectSignature effectSignature = (val7.EffectSignature = val8); val.EffectSignature = effectSignature; StatusEffectFamilySelector val10 = new StatusEffectFamilySelector(); ((UidSelector<StatusEffectFamily>)val10).Set(val); At.SetValue<StatusEffectFamilySelector>(val10, typeof(StatusEffect), val4, "m_stackingFamily"); return val4; } public static StatusEffectFamily MakeStatusEffectFamiliy(string familyName, StackBehaviors stackBehavior, int maxStackCount, LengthTypes lengthType, UID? uid = null, string modGUID = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0030: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) StatusEffectFamily val = new StatusEffectFamily(); uid = (UID)(((??)uid) ?? ((modGUID != null) ? MakeUID(familyName, modGUID, "Status Effect Family") : UID.Generate())); At.SetValue<UID>(uid.Value, typeof(StatusEffectFamily), val, "m_uid"); val.Name = familyName; val.StackBehavior = stackBehavior; val.MaxStackCount = maxStackCount; val.LengthType = lengthType; return val; } public static GameObject InstantiateClone(GameObject sourceGameObject, bool setActive, bool dontDestroyOnLoad) { return InstantiateClone(sourceGameObject, ((Object)sourceGameObject).name + "(Clone)", setActive, dontDestroyOnLoad); } public static GameObject InstantiateClone(GameObject sourceGameObject, string newGameObjectName, bool setActive, bool dontDestroyOnLoad) { GameObject val = Object.Instantiate<GameObject>(sourceGameObject); val.SetActive(setActive); ((Object)val).name = newGameObjectName; if (dontDestroyOnLoad) { Object.DontDestroyOnLoad((Object)(object)val); } return val; } public static UID MakeUID(string name, string modGUID, string category) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) return new UID((modGUID + "." + category + "." + name).Replace(" ", "").ToLower()); } public static GameObject MakeFreshObject(string newGameObjectName, bool setActive, bool dontDestroyOnLoad, Transform parent = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(newGameObjectName); val.SetActive(setActive); if ((Object)(object)parent != (Object)null) { val.transform.SetParent(parent); } if (dontDestroyOnLoad) { RecursiveDontDestroyOnLoad(val.transform); } return val; } public static void RecursiveDontDestroyOnLoad(Transform transform) { Transform val = transform; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } Object.DontDestroyOnLoad((Object)(object)((Component)val).gameObject); } }
plugins/TrainersOfAurai.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
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 AscendedClass; using AuraiTrainers; using AuraiTrainers.Apothecary; using AuraiUtility; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CustomAttributes; using HarmonyLib; using Lorewalker; using MadDelayedDamage; using NodeCanvas.DialogueTrees; using NodeCanvas.Framework; using NodeCanvas.Tasks.Actions; using PastSelf; using Photon; using Shinobi; using SideLoader; using SideLoader.Managers; using SideLoader.Model; using SideLoader.SLPacks.Categories; using UnityEngine; using WhispererClass; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TrainersOfAurai")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TrainersOfAurai")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("215c80fe-e43c-4f33-9d00-af448d901a86")] [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] [BepInPlugin("com.iggy.trainersofaurai", "Trainers of Aurai", "6.0.0")] public class Plugin : BaseUnityPlugin { private const string GUID = "com.iggy.trainersofaurai"; private const string NAME = "Trainers of Aurai"; private const string VERSION = "6.0.0"; public static Plugin Instance; internal static ManualLogSource _Log; public const string SL_VISUAL_TRANSFORM = "SLVISUALCONTAINER"; public static ConfigEntry<bool> AddTestItems; public static ConfigEntry<bool> ShowDebugLog; internal void Awake() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) Instance = this; Debug.Log((object)"Trainers of Aurai awake"); GameObject gameObject = ((Component)this).gameObject; _Log = ((BaseUnityPlugin)this).Logger; gameObject.AddComponent<LocalsManager>(); gameObject.AddComponent<DrinkManager>(); gameObject.AddComponent<FlowManager>(); gameObject.AddComponent<PastManager>(); gameObject.AddComponent<CraftManager>(); gameObject.AddComponent<HeavyManager>(); gameObject.AddComponent<DodgePlayerManager>(); gameObject.AddComponent<MadDamageManager>(); gameObject.AddComponent<MadExtrasManager>(); gameObject.AddComponent<MadQuestManager>(); gameObject.AddComponent<MagesDamageManager>(); gameObject.AddComponent<MagesExtrasManager>(); SL.OnPacksLoaded += SL_OnPacksLoaded; new Harmony("com.iggy.trainersofaurai").PatchAll(); setCustomAttributes(); } private void SL_OnPacksLoaded() { DialogueManager.Init(); TrainerSpawn.Init(); ShinobiStageManager.ChangeStages(); } internal void Start() { Debug.Log((object)"Trainers of Aurai - Loaded"); CustomAttSub(); } internal void CustomAttSub() { CustomAttributesBase instance = CustomAttributesBase.Instance; instance.OnCharacterAvoidEvent = (Action<Character, Character, float>)Delegate.Combine(instance.OnCharacterAvoidEvent, new Action<Character, Character, float>(TimeWalkerManager.avoidRewind)); } internal void setCustomAttributes() { CustomAttributeHelper.StatusAvoidanceStore(TimeWalkerIDs.timeline3Survival, (float)LoreWalkerBalance.survTAvoidChance); CustomAttributeHelper.PassiveCritRateStore(SpellslingerIDs.luckyStrikeID, (float)SpellslingerBalance.luckyStrikeCritChance); CustomAttributeHelper.StatusCritRateStore(SpellslingerIDs.streakBuffID, (float)SpellslingerBalance.streakBonusChance); CustomAttributeHelper.StatusCritCancelerStore(SpellslingerIDs.gunReloaderID, 0f); CustomAttributeHelper.PassiveSelfCritStore(SpellslingerIDs.luckyStrikeID, (float)SpellslingerBalance.luckyStrikeAIc); CustomAttributeHelper.PassiveCritScalingStore(SpellslingerIDs.critAdjustID, (float)SpellslingerBalance.critAdjustmentBonus); } } namespace PastSelf { public class PastManager : MonoBehaviour { [HarmonyPatch(typeof(CharacterInventory), "TryUnlockSkill")] public class CharacterInventory_TryUnlockSkill { [HarmonyPrefix] public static void Postfix(CharacterInventory __instance, Skill _skill) { if (SceneManagerHelper.ActiveSceneName != "CierzoTutorial") { return; } int[] pastSkills = Instance.pastSkills; for (int i = 0; i < pastSkills.Length; i++) { int num = pastSkills[i]; if (((Item)_skill).ItemID != num && ((CharacterKnowledge)__instance.SkillKnowledge).IsItemLearned(num)) { Debug.Log((object)("REMOVING " + num)); Item itemFromItemID = ((CharacterKnowledge)__instance.SkillKnowledge).GetItemFromItemID(num); ItemManager.Instance.DestroyItem(itemFromItemID.UID); ((CharacterKnowledge)__instance.SkillKnowledge).RemoveItem(num); } } } } public static PastManager Instance; private Character[] players; private int[] pastSkills; private int silverID = 9000010; internal void Awake() { Instance = this; players = (Character[])(object)new Character[2]; pastSkills = new int[8] { -2071, -2072, -2073, -2074, -2075, -2076, -2077, -2078 }; SL.OnGameplayResumedAfterLoading += Fixer; } private void Fixer() { players[0] = CharacterManager.Instance.GetFirstLocalCharacter(); if (Object.op_Implicit((Object)(object)players[0])) { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (item.IsLocalPlayer && (Object)(object)item != (Object)(object)players[0]) { players[1] = item.ControlledCharacter; } } Debug.Log((object)("Player2: " + (object)players[1])); } if (!(SceneManagerHelper.ActiveSceneName == "CierzoNewTerrain")) { return; } Character[] array = players; foreach (Character val in array) { if ((Object)(object)val != (Object)null && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2076)) { val.Inventory.ReceiveItemReward(silverID, 300, true); Item itemFromItemID = ((CharacterKnowledge)val.Inventory.SkillKnowledge).GetItemFromItemID(-2076); ItemManager.Instance.DestroyItem(itemFromItemID.UID); ((CharacterKnowledge)val.Inventory.SkillKnowledge).RemoveItem(-2076); } } } private void Update() { } } } namespace AuraiUtility { internal static class VFXManager { private static string madSLPack = SLPackIDs.madSLPack; private static string madBundle = SLPackIDs.madBundle; private static string madAstralMat = SLPackIDs.madAstralMatPurple; public static IEnumerator DelayedApplyMaterials(Character character) { yield return (object)new WaitForSeconds(1f); Material fromAssetBundle = VFXManager.GetFromAssetBundle<Material>(madSLPack, madBundle, madAstralMat); if (!((Object)(object)fromAssetBundle != (Object)null)) { yield break; } Renderer[] componentsInChildren = ((Component)character.VisualHolderTrans).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)((Component)val).gameObject.GetComponent<ParticleSystem>() != (Object)null) && !(((Object)((Component)val).transform).name == "Hair0_Bald")) { val.material = fromAssetBundle; } } } 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 enum WSkills { NONE = 0, Pathway = -2001, BreakDelay = -2002, BreakSpeed = -2003, SupressPain = -2004, Purify = -2007, applyMadness = -2010, upgraderQ = -2020 } public enum WUpgrades { painPlus = -2005, painEther = -2006, purShield = -2008, purCleanse = -2009, drainMadness = -2011, expellMadness = -2012, extremism = -2013, absorbStamina = -2014, shareMadness = -2017, desperation = -2018, secretEffect1 = -2015, secretEffect2 = -2016 } public enum WItems { WhisperSkull = -2049, SkullPassive = -2050 } public enum WEffects { EnemyHealing, Mortality } public static class SLPackIDs { public static string mainSLPack = "iggythemad TrainersOfAurai"; public static string madSLPack = "iggythemad TrainersOfAurai"; public static string apotSLPack = "iggythemad TrainersOfAurai"; public static string gossipSLPack = "iggythemad TrainersOfAurai"; public static string ascendSLPack = "iggythemad TrainersOfAurai"; public static string testSLPack = "iggythemad LoreTest"; public static string madBundle = "iggyvfx"; public static string madAstralMatPurple = "AstralMaterial"; public static string madAstralMatRed = "AstralMaterial2"; } public static class TrainerIDs { public static string grandCierzo = "iggy.trainer.cierzo.apothecary"; public static string grandBerg = "iggy.trainer.berg.apothecary"; public static string grandLevant = "iggy.trainer.levant.apothecary"; public static string grandMonsoon = "iggy.trainer.monsoon.apothecary"; public static string grandHarmattan = "iggy.trainer.harmattan.apothecary"; public static string gossipCierzo = "iggy.cierzo.gossip"; public static string gossipBerg = "iggy.berg.gossip"; public static string gossipLevant = "iggy.levant.gossip"; public static string gossipMonsoon = "iggy.monsoon.gossip"; public static string gossipHarmattan = "iggy.harmattan.gossip"; public static string whisperMystery = "iggy.madwhisper.mystery"; public static string whisperMain = "iggy.madwhisper.basic"; public static string whisperUpgrade1 = "iggy.madwhisper.upgrader.1"; public static string whisperUpgrade2 = "iggy.madwhisper.upgrader.2"; public static string whisperUpgrade3 = "iggy.madwhisper.upgrader.3"; public static string whisperUpgrade4 = "iggy.madwhisper.upgrader.4"; public static string whisperUpgrade5 = "iggy.madwhisper.upgrader.5"; public static string whisperSecret1 = "iggy.madwhisper.special.1"; public static string soulMage = "iggy.trainer.soulmage"; public static string spellslingLevant = "iggy.trainer.levant.spellslinger"; public static string spellslingHarmattan = "iggy.trainer.harmattan.spellslinger"; public static string spellslingMontcalm = "iggy.trainer.montcalm.gun"; public static string loreWalker = "iggy.trainer.lorewalker"; public static string loreWalkerIntro = "iggy.trainer.lorewalker.intro"; } public static class TreeIDs { public static string treeSoulMage = "iggy.tree.soulmage"; public static string treeLevantSpells = "iggy.tree.levant.spellslinger"; public static string treeHarmattanSpells = "iggy.tree.harmattan.spellslinger"; public static string treeMontcalmGun = "iggy.tree.montcalm.spellslinger"; public static string treeGrandCierzo = "iggy.tree.cierzo.apothecary"; public static string treeGrandBerg = "iggy.tree.berg.apothecary"; public static string treeGrandLevant = "iggy.tree.levant.apothecary"; public static string treeGrandMonsoon = "iggy.tree.monsoon.apothecary"; public static string treeGrandHarmattan = "iggy.tree.harmattan.apothecary"; public static string treeGossipCierzo = "iggy.tree.cierzo.selfdefence"; public static string treeGossipBerg = "iggy.tree.berg.selfdefence"; public static string treeGossipLevant = "iggy.tree.levant.selfdefence"; public static string treeGossipMonsoon = "iggy.tree.monsoon.selfdefence"; public static string treeGossipHarmattan = "iggy.tree.harmattan.selfdefence"; public static string treeWhispMystery = "iggy.tree.whisperer.mystery"; public static string treeWhispMain = "iggy.tree.whisperer.main"; public static string treeWhispUpgrade1 = "iggy.tree.whisperer.upgrade1"; public static string treeWhispUpgrade2 = "iggy.tree.whisperer.upgrade2"; public static string treeWhispUpgrade3 = "iggy.tree.whisperer.upgrade3"; public static string treeWhispUpgrade4 = "iggy.tree.whisperer.upgrade4"; public static string treeWhispUpgrade5 = "iggy.tree.whisperer.upgrade5"; public static string treeWhispSpecial1 = "iggy.tree.whisperer.special1"; public static string treeWhispSpecial2 = "iggy.tree.whisperer.special2"; public static string treeLoreWalker = "iggy.tree.lorewalker"; public static string treeLoreWalkerIntro = "iggy.tree.lorewalker.intro"; } public class LocalsManager : MonoBehaviour { public static LocalsManager Instance; public Character[] players; internal void Awake() { Instance = this; players = (Character[])(object)new Character[2]; SL.OnGameplayResumedAfterLoading += Fixer; } private void Fixer() { players[0] = CharacterManager.Instance.GetFirstLocalCharacter(); if (!Object.op_Implicit((Object)(object)players[0])) { return; } foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (item.IsLocalPlayer && (Object)(object)item != (Object)(object)players[0]) { players[1] = item.ControlledCharacter; } } } public int GetSlot(Character _character) { if ((Object)(object)_character == (Object)(object)players[0]) { return 0; } return 1; } } public static class DialogueManager { internal static SL_Character cierzoApothecary; internal static SL_Character bergApothecary; internal static SL_Character levantApothecary; internal static SL_Character harmattanApothecary; internal static SL_Character cierzoGossip; internal static SL_Character bergGossip; internal static SL_Character levantGossip; internal static SL_Character monsoonGossip; internal static SL_Character harmattanGossip; internal static SL_Character soulMageTrainer; internal static SL_Character whisperTrainerA; internal static SL_Character whisperTrainerB1; internal static SL_Character whisperTrainerB2; internal static SL_Character whisperTrainerB3; internal static SL_Character whisperTrainerB4; internal static SL_Character whisperTrainerB5; internal static SL_Character whisperTrainerC1; internal static SL_Character mysteryMan; internal static SL_Character loreWalkerTrainer; internal static SL_Character loreWalkerTrainerIntro; private static string teaserAsk = "Heard any new rumors lately?"; private static string teaserAnswer = "I heard rumors of some Kazite Shinobi that might be traveling to train in Aurai in the future. I heard they can cast some unusual kind of rune-like manaless magic called Ninjutsu! I should know more soon... \n\n >(v6.0 Update soon)<"; public static void Init() { SLPack sLPack = SL.GetSLPack(SLPackIDs.apotSLPack); cierzoApothecary = sLPack.CharacterTemplates[TrainerIDs.grandCierzo]; cierzoApothecary.OnSpawn += CierzoApothecarySetup; bergApothecary = sLPack.CharacterTemplates[TrainerIDs.grandBerg]; bergApothecary.OnSpawn += BergApothecarySetup; levantApothecary = sLPack.CharacterTemplates[TrainerIDs.grandLevant]; levantApothecary.OnSpawn += LevantApothecarySetup; harmattanApothecary = sLPack.CharacterTemplates[TrainerIDs.grandHarmattan]; harmattanApothecary.OnSpawn += HarmattanApothecarySetup; SL.GetSLPack(SLPackIDs.gossipSLPack); cierzoGossip = sLPack.CharacterTemplates[TrainerIDs.gossipCierzo]; cierzoGossip.OnSpawn += CierzoGossipSetup; bergGossip = sLPack.CharacterTemplates[TrainerIDs.gossipBerg]; bergGossip.OnSpawn += BergGossipSetup; levantGossip = sLPack.CharacterTemplates[TrainerIDs.gossipLevant]; levantGossip.OnSpawn += LevantGossipSetup; monsoonGossip = sLPack.CharacterTemplates[TrainerIDs.gossipMonsoon]; monsoonGossip.OnSpawn += MonsoonGossipSetup; harmattanGossip = sLPack.CharacterTemplates[TrainerIDs.gossipHarmattan]; harmattanGossip.OnSpawn += HarmattanGossipSetup; soulMageTrainer = SL.GetSLPack(SLPackIDs.ascendSLPack).CharacterTemplates[TrainerIDs.soulMage]; soulMageTrainer.OnSpawn += SoulMageTrainer_Setup; SLPack sLPack2 = SL.GetSLPack(SLPackIDs.madSLPack); whisperTrainerA = sLPack2.CharacterTemplates[TrainerIDs.whisperMain]; whisperTrainerA.OnSpawn += WhisperTrainerA_Setup; mysteryMan = sLPack2.CharacterTemplates[TrainerIDs.whisperMystery]; mysteryMan.OnSpawn += MysteryMan_Setup; whisperTrainerB1 = sLPack2.CharacterTemplates[TrainerIDs.whisperUpgrade1]; whisperTrainerB1.OnSpawn += GenericMaterialSetup; whisperTrainerB2 = sLPack2.CharacterTemplates[TrainerIDs.whisperUpgrade2]; whisperTrainerB2.OnSpawn += GenericMaterialSetup; whisperTrainerB3 = sLPack2.CharacterTemplates[TrainerIDs.whisperUpgrade3]; whisperTrainerB3.OnSpawn += GenericMaterialSetup; whisperTrainerB4 = sLPack2.CharacterTemplates[TrainerIDs.whisperUpgrade4]; whisperTrainerB4.OnSpawn += GenericMaterialSetup; whisperTrainerB5 = sLPack2.CharacterTemplates[TrainerIDs.whisperUpgrade5]; whisperTrainerB5.OnSpawn += GenericMaterialSetup; whisperTrainerC1 = sLPack2.CharacterTemplates[TrainerIDs.whisperSecret1]; whisperTrainerC1.OnSpawn += GenericMaterialSetup; SLPack sLPack3 = SL.GetSLPack(SLPackIDs.mainSLPack); loreWalkerTrainer = sLPack3.CharacterTemplates[TrainerIDs.loreWalker]; loreWalkerTrainer.OnSpawn += LoreWalkerTrainer_Setup; loreWalkerTrainerIntro = sLPack3.CharacterTemplates[TrainerIDs.loreWalkerIntro]; loreWalkerTrainerIntro.OnSpawn += LoreWalkerTrainerIntro_Setup; } public static void CierzoApothecarySetup(Character trainer, string _) { GenericTrainerSetup(trainer, cierzoApothecary, 4, TreeIDs.treeGrandCierzo, "Are you my new assistant?", "What can you teach me?", "You need an assistant?", "I... I guess? My old assistant died in that damned wreckage everyone is talking about. But I can't ask for a replacement yet...", "Is this all you can teach me?", "Sadly, yes. But other Apothecaries in each major city can teach you their own regional recipees.", "What's the difference with normal alchemy?", "We apothecaries focus on field experimentation. We don't require a workstation. We just need the right ingredients and the right amount. Anytime.", "Nothing", "Nothing"); } public static void BergApothecarySetup(Character trainer, string _) { GenericTrainerSetup(trainer, bergApothecary, 3, TreeIDs.treeGrandBerg, "I've just relocated. If you want to learn my unique recipes, come back another time. Right now I can only share chersoneese recipes.", "Can you teach me anything?", "What can you tell me about the region?", "The ghosts of emercar may seem like a threat to others... To me? They are perfect for experimentation.", "I want to learn more apothecary recipes.", "Well... Apothecaries in Levant or Harmattan have their unique regional recipes. I'm still not ready to share my own recipes. Perhaps in the future...", "Nothing", "Nothing", "Nothing", "Nothing"); } public static void LevantApothecarySetup(Character trainer, string _) { GenericTrainerSetup(trainer, levantApothecary, 3, TreeIDs.treeGrandLevant, "What is it you need, peasant?", "I want to learn your crafts", "What can you tell me about the region?", "The desert can be deadly for likes of you, but for people of stature, it's natural ingredients are perfect for owr needs.", "Who can teach me more?", "All civilized cities in Aurai have their own Grand Apothecary with unique regional recipes. However, I doubt they'd be as kind as me to treat with a lowlife as yourself.", "Nothing", "Nothing", "Nothing", "Nothing"); } public static void HarmattanApothecarySetup(Character trainer, string _) { GenericTrainerSetup(trainer, harmattanApothecary, 3, TreeIDs.treeGrandHarmattan, "Ah an adventurer! Need your wounds healed again?", "I wish to learn from you", "What can you tell me about the region?", "Automata are everywhere. The corruption is getting out of hand. But some materials out there are really worth it.", "Are there other Apothecaries like you?", "Grand Apothecaries? Most cities have one of us at their service. I heard even a fishing village has one nowadays. We all have our own unique recipes though.", "Nothing", "Nothing", "Nothing", "Nothing"); } public static void CierzoGossipSetup(Character trainer, string _) { GenericTrainerSetup(trainer, cierzoGossip, 7, TreeIDs.treeGossipBerg, "Yes? What do you need my friend? Interested in the latest gossip? Or are you here to learn some self defence?", "Self defence? I'm interested.", "Have you heard anything about some ''wizard gunslingers?''", "Oh you mean those three Spellslingers some lawmen where looking for? I don't know much, but I heard one of them joined the Montcalm Clan. No idea about the other two, but I saw one of them talk to the traders of Harmattan before leaving.", "A missing watcher who tapped into Soul-Magic... have you heard anything?", "Pffft... rumors. Those watchers spend their whole life secluded in the main Conflux Chambers up in conflux mountain. I'm sure she died of old age. Maybe a mana-user could Reveal Souls of the dead and find her there?", "Do you know anything about a Madman talking about Whispers?", "Oh no no. Stay away from him. The man seems to be living with in a hyenas den nearby. HYENAS! He's always alone, but he always seems to be talking to someone.. or something. Who knows what that Mad man is doing...", "What about the newly appointed Apothecaries?", "Grand Apothecary Emo is just settling in in Alchemist Helmi's study, near the fountain. His unique chersoneese recipes might come in handy for you.", "Do you believe in time travel?", "By Elatt! You too?... The kid at the docks near the purifier claims to know the future! THE FUTURE! Something about a book and time wizards and the end of the world! First we get the madman and now a doomsayer. Oh what has Cierzo turned into!", "Head anything new lately?", "I heard rumors that some Kazite Shinobi might be traveling to Chersonese in the future. I heard they can cast some unusual kind of manaless magic called Ninjutsu!\n\n [v6.0 Update soon]", teaserAsk, teaserAnswer); } public static void BergGossipSetup(Character trainer, string _) { GenericTrainerSetup(trainer, bergGossip, 7, TreeIDs.treeGossipBerg, "Hello there. Here for the latest gossip? Or do you want to learn about self defence?", "Self Defence sounds useful. Teach me!", "Know anything about some magical gunslingers?", "Oh you mean those Spellslingers who visited Cierzo? I heard they fleed to Levant and Harmattan. However, people of Cierzo say that another one of them joined the Montcalm Clan.", "Heard anything about the soul-watcher who died?", "Ah yes. They say a watcher delved too deep into Soul-Magic in the main Conflux Chambers up in conflux mountain. She died from it. Maybe a mana-user could Reveal her Soul as a summoning?.", "Anything about some people going Mad? Something about them hearing Whispers?", "Chersonese folk have been talking about a mysterious crazy man living in the hyenas den. Something about voices and the end times. If you go back to Chersonese, be careful. Please stay away from the hyenas.", "Is there a Grand Apothecary in Berg?", "Grand Apothecary Avrixel hasn't fully stablished himself in Berg. He won't share his unique recipes just yet, but he can gladly teach you Cierzo's. Vay the alchemist is helping him settle in.", "Did you hear about the time traveler?", "Gossip speaks of a new doomsayer claiming the end is coming to Cierzo. The craziest people always seem to come from there. It's probably the smell of fish everywhere. And don't get me started on their ceviche...", teaserAsk, teaserAnswer); } public static void LevantGossipSetup(Character trainer, string _) { GenericTrainerSetup(trainer, levantGossip, 7, TreeIDs.treeGossipBerg, "Yes? Did you bring me my drink? Ah not a servant? Then I'll assume you are here for gossip? Or to learn about self defence?", "I'd like to learn from you. Surviving here is tough.", "I'm looking for some magical gunslingers...", "Ah! You are looking for Mr Marston? Here is right over there. On the second floor.", "Heard anything about Soul-Magic?", "I know little about it. A dead watcher who abussed mana or something like the sort. I don't know much, but I'm sure someone in Berg's or Cierzo's Inn could know more.", "Seen anything strange lately? People going Mad?", "Actually yeah. Quite recently. They say a mysterious man in Chersonese went crazy. Talking about the end, the voices and other nonsense. My Inn friends at Berg or Cierzo might know more.", "Does Levant have its own Apothecaries?", "Grand Apothecary Faeryn can be quite rude, but he might just teach you some of his unique levantine recipes regardless. He is over by the local alchemy shop.", "Know anything about this supposted time traveler?", "Always those blue chamber people and their crazy talk. There's suppostedly a time traveling wizard among them. Can't you see? They only want to scare the people of Levant.", teaserAsk, teaserAnswer); } public static void MonsoonGossipSetup(Character trainer, string _) { GenericTrainerSetup(trainer, monsoonGossip, 7, TreeIDs.treeGossipBerg, "Hello there, traveler! Came here looking for Elatts wisdom too? Or here for the latest gossip? Maybe some teachings in self defence?", "I'd like to learn from you, actually.", "Have you heard about some gunslinger wizards?", "Oh I'm afraid I havent heard much about wizards. But rumors say some strange gunmen recently arrived to Levant and Harmattan.", "Heard about Soul-Magic? Where to learn about it?", "I've only heard the rumors of the watcher who abussed his powers to drain mana from captured souls. She died apparently. Maybe one of my friends at Berg's Inn or even Cierzo's will know more.", "Do you know anything about the rumors of people going Mad?", "Hopefully it's nothing but rumors. However, a personal friend of mine claimed to see some strange ghostly figures in Chersonese. You should ask someone in Berg or Cierzo. Perhaps at the Inn.", "Where can I find Monsoon's Grand Apothecary?", "I wish I knew. It seems he got lost in his way here or something. Maybe someday he will be available.", "Heard anything about a time traveler?", "I did hear something about a kid who found a book filled with time gibberish in the shores of Cierzo. Heresy I say. Do not pay attention to crazy talk.", teaserAsk, teaserAnswer); } public static void HarmattanGossipSetup(Character trainer, string _) { GenericTrainerSetup(trainer, harmattanGossip, 7, TreeIDs.treeGossipBerg, "Need something? Would you like to heard some gossip from all over Aurai? Oh! Or have you heard about my amazing self defence techniques?", "Self defence techniques eh? Show me!", "I'm looking for some wizardly gunmen. Know anything?", "Oh but your search just finished. Mr Morgan over there by the fire is probably who you are looking for.", "Know anything about the deseased Soul-Mage?", "Oh poor woman. Spending all her life studying mana just to be killed by it. Some say it's possible to speak to the dead in Conflux Mountain somehow. You should ask my friends back in Berg or Cierzo.", "Have you heard about people going mad? Some even taking their lives?", "Horrible stuff honestly. There were many cases of people claiming to find a talking skull in Chersonese. A TALKING SKULL! Can you believe it? I don't know much. But people in Cierzo or Berg could know more.", "I'm looking for the regional Grand Apothecary..", "Grand Apothecary Stormen is usually experimenting in the local market, next to the alchemist store. Robyn Garnet and him can usually be seen together.", "Know anything about the supposted time traveler?", "Not really, but I did hear an ancient book recently washed ashore in Cierzo. People say it is filled with doom propaganda and prophecies for the future. Those fisher folk sure are a superstitious bunch.", teaserAsk, teaserAnswer); } public static void SoulMageTrainer_Setup(Character trainer, string _) { AlternateTrainer_Setup(trainer, soulMageTrainer, 3, TreeIDs.treeSoulMage, "You... you summoned me. How? Could it be you have a strong mana connection? I am Mel, former watcher of the leylines.", "I know it's dangers. But I'm ready to tap into soul magic.", "What happened to you? How did you end up a ghost?", "I went too far. As I tapped into the leylines I couldnt never have enough. I needed more and more mana. That's how I started delving into an ancient kind of magic: Soul Magic.", "What is this Soul Magic? How is it connected to the leylines and your death?", "All living creatures posses mana living inside of them. Just not everyone opens the doors to manifest it. Soul Magic consists on using creatures mana to your advantage. But I tapped too far... I ended up turning my whole being into mana itself."); } public static void WhisperTrainerA_Setup(Character trainer, string _) { GenericTrainerSetup(trainer, whisperTrainerA, 4, TreeIDs.treeWhispMain, "You bring the skull... You have been chosen... Let me show you... True Whispers... True Madness... You will be a Mad Whisperer...", "Teach me. I am ready to serve.", "What is this skull?", "The skull of the first whisperer... You are now bound... She will guide you... Riddles she speaks...Listen well.", "What is a Mad Whisperer?", "Servants of the void... Bringers of truth... Catalyst of their will...", "Are there more of you?", "Eye of Servitude... it opens your eyes... to the other Whisperers... to the truth... all over Aurai..."); ((MonoBehaviour)Plugin.Instance).StartCoroutine(VFXManager.DelayedApplyMaterials(trainer)); } public static void MysteryMan_Setup(Character trainer, string _) { AlternateTrainer_Setup(trainer, mysteryMan, 3, TreeIDs.treeWhispMystery, "Ah! welcome! welcome! Here I have a gift for you. No takebacks! he he...", "A gift? What are you talking about?", "What? Who are you? What are you doing here", "Ah yes, yes... I am and I am here. Please take my gift. All yours. Take it.. he he...he...", "Are you ok? How did you end up in here?", "He he he... yes, yes, yes...yes... Please take it. Take it away from me... No returns... he he he..."); } public static void GenericMaterialSetup(Character trainer, string _) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(VFXManager.DelayedApplyMaterials(trainer)); } public static void LoreWalkerTrainerIntro_Setup(Character trainer, string _) { AlternateTrainer_Setup(trainer, loreWalkerTrainerIntro, 4, TreeIDs.treeLoreWalkerIntro, "Out of Time... Destiny... timelines... maybe if I use this for... What? Are you here to tell me I'm crazy too? I'm trying to understand my book in peace.", "Show me the book.", "Out of time? For what?", "The end of Cierzo. Conflict is suppostedly brewing in Chersonese and it may destroy us all. According to this book, it MUST happen. Something about the true timeline... whatever that means. I wonder if this has something to do with my friend recruiting for the Vendavel...", "What book?", "This... I found it while fishing. It seems to contain prophecies and incantations. It speaks about the true timeline and how events, good or bad, must be preserved intact. I have only decyphered part of it so far... it's... intriguing.", "Do you believe all this?", "It seems quite detailed... and it somehow all makes sense. Tell you what: If the prophecies come true; If something really bad happens in Cierzo... meet me outside by the gates. We can escape together. Deal?"); } public static void LoreWalkerTrainer_Setup(Character trainer, string _) { AlternateTrainer_Setup(trainer, loreWalkerTrainer, 5, TreeIDs.treeLoreWalker, "It seems my purpose in this time is complete. The True Timeline was preserved. Cierzo is no more. As it should be. You again? or have we not meet in this timeline?", "Teach me time magic!", "You did this to Cierzo?", "I only made sure everything happened how it was meant to happen. The true timeline must not be altered.", "Wheren't you a fisher?", "Ah so we met in this timeline. In another time, I was a fisher, yes. But the primal fall of Cierzo opened my eyes. I am now a lore-walker. I step through the eras, past and future, to preserve the true timeline.", "What is the true timeline?", "The scourge. The rise of Elatt. The fall of Cierzo. Events that need to happen, in order for the Nine Dot Sages to maintain reality. Sometimes, however, `anomalies` happen and we have to intervene.", "Can I become a Lore-Walker?", "That is not for me to decide. But since your actions or lack of them resulted in the foretold outcome: I can teach you some time magic."); } public static void GenericTrainerSetup(Character trainer, SL_Character currentCharacter, int quantity, string treeUID, string introDialogue, string askTrain, string ask2, string reply2, string ask3, string reply3, string ask4 = "", string reply4 = "", string ask5 = "", string reply5 = "", string ask6 = "", string reply6 = "", string ask7 = "", string reply7 = "", string ask8 = "", string reply8 = "") { //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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00bd: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e0: Expected O, but got Unknown //IL_00e5: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0108: Expected O, but got Unknown //IL_010d: Expected O, but got Unknown //IL_0118: 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) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_0135: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_015d: Expected O, but got Unknown //IL_0168: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Expected O, but got Unknown //IL_0185: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_01ad: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_01d5: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Expected O, but got Unknown //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Expected O, but got Unknown //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<CharacterStats>()); Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<StartingEquipment>()); DialogueActor componentInChildren = ((Component)trainer).GetComponentInChildren<DialogueActor>(); componentInChildren.SetName(currentCharacter.Name); Trainer componentInChildren2 = ((Component)trainer).GetComponentInChildren<Trainer>(); componentInChildren2.m_skillTreeUID = new UID(treeUID); Graph graph = ((GraphOwner)((Component)trainer).GetComponentInChildren<DialogueTreeController>()).graph; List<ActorParameter> actorParameters = ((DialogueTree)((graph is DialogueTree) ? graph : null))._actorParameters; actorParameters[0].actor = (IDialogueActor)(object)componentInChildren; actorParameters[0].name = componentInChildren.name; StatementNodeExt val = graph.AddNode<StatementNodeExt>(); val.statement = new Statement(introDialogue); val.SetActorName(componentInChildren.name); MultipleChoiceNodeExt val2 = graph.AddNode<MultipleChoiceNodeExt>(); val2.availableChoices.Add(new Choice { statement = new Statement { text = askTrain } }); if (quantity >= 2) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask2 } }); } if (quantity >= 3) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask3 } }); } if (quantity >= 4) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask4 } }); } if (quantity >= 5) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask5 } }); } if (quantity >= 6) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask6 } }); } if (quantity >= 7) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask7 } }); } if (quantity >= 8) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask8 } }); } Node obj = graph.allNodes[1]; ActionNode val3 = (ActionNode)(object)((obj is ActionNode) ? obj : null); ActionTask action = val3.action; ((TrainDialogueAction)((action is TrainDialogueAction) ? action : null)).Trainer = new BBParameter<Trainer>(componentInChildren2); StatementNodeExt val4 = null; StatementNodeExt val5 = null; StatementNodeExt val6 = null; StatementNodeExt val7 = null; StatementNodeExt val8 = null; StatementNodeExt val9 = null; StatementNodeExt val10 = null; if (quantity >= 2) { val4 = graph.AddNode<StatementNodeExt>(); val4.statement = new Statement(reply2); val4.SetActorName(componentInChildren.name); } if (quantity >= 3) { val5 = graph.AddNode<StatementNodeExt>(); val5.statement = new Statement(reply3); val5.SetActorName(componentInChildren.name); } if (quantity >= 4) { val6 = graph.AddNode<StatementNodeExt>(); val6.statement = new Statement(reply4); val6.SetActorName(componentInChildren.name); } if (quantity >= 5) { val7 = graph.AddNode<StatementNodeExt>(); val7.statement = new Statement(reply5); val7.SetActorName(componentInChildren.name); } if (quantity >= 6) { val8 = graph.AddNode<StatementNodeExt>(); val8.statement = new Statement(reply6); val8.SetActorName(componentInChildren.name); } if (quantity >= 7) { val9 = graph.AddNode<StatementNodeExt>(); val9.statement = new Statement(reply7); val9.SetActorName(componentInChildren.name); } if (quantity >= 8) { val10 = graph.AddNode<StatementNodeExt>(); val10.statement = new Statement(reply8); val10.SetActorName(componentInChildren.name); } graph.allNodes.Clear(); graph.allNodes.Add((Node)(object)val); graph.allNodes.Add((Node)(object)val2); graph.allNodes.Add((Node)(object)val3); if (quantity >= 2 && val4 != null) { graph.allNodes.Add((Node)(object)val4); } if (quantity >= 3 && val5 != null) { graph.allNodes.Add((Node)(object)val5); } if (quantity >= 4 && val6 != null) { graph.allNodes.Add((Node)(object)val6); } if (quantity >= 5 && val7 != null) { graph.allNodes.Add((Node)(object)val7); } if (quantity >= 6 && val8 != null) { graph.allNodes.Add((Node)(object)val8); } if (quantity >= 7 && val9 != null) { graph.allNodes.Add((Node)(object)val9); } if (quantity >= 8 && val10 != null) { graph.allNodes.Add((Node)(object)val10); } graph.primeNode = (Node)(object)val; graph.ConnectNodes((Node)(object)val, (Node)(object)val2, -1, -1); graph.ConnectNodes((Node)(object)val2, (Node)(object)val3, 0, -1); if (quantity >= 2 && val4 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val4, 1, -1); graph.ConnectNodes((Node)(object)val4, (Node)(object)val, -1, -1); } if (quantity >= 3 && val5 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val5, 2, -1); graph.ConnectNodes((Node)(object)val5, (Node)(object)val, -1, -1); } if (quantity >= 4 && val6 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val6, 3, -1); graph.ConnectNodes((Node)(object)val6, (Node)(object)val, -1, -1); } if (quantity >= 5 && val7 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val7, 4, -1); graph.ConnectNodes((Node)(object)val7, (Node)(object)val, -1, -1); } if (quantity >= 6 && val8 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val8, 5, -1); graph.ConnectNodes((Node)(object)val8, (Node)(object)val, -1, -1); } if (quantity >= 7 && val9 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val9, 6, -1); graph.ConnectNodes((Node)(object)val9, (Node)(object)val, -1, -1); } if (quantity >= 8 && val10 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val10, 7, -1); graph.ConnectNodes((Node)(object)val10, (Node)(object)val, -1, -1); } ((Component)trainer).gameObject.SetActive(true); } public static void AlternateTrainer_Setup(Character trainer, SL_Character currentCharacter, int quantity, string treeUID, string introDialogue, string askTrain, string ask2, string reply2, string ask3, string reply3, string ask4 = "", string reply4 = "", string ask5 = "", string reply5 = "") { //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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00c1: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00e9: Expected O, but got Unknown //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_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0111: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_015d: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0139: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<CharacterStats>()); Object.DestroyImmediate((Object)(object)((Component)trainer).GetComponent<StartingEquipment>()); DialogueActor componentInChildren = ((Component)trainer).GetComponentInChildren<DialogueActor>(); componentInChildren.SetName(currentCharacter.Name); Trainer componentInChildren2 = ((Component)trainer).GetComponentInChildren<Trainer>(); componentInChildren2.m_skillTreeUID = new UID(treeUID); Graph graph = ((GraphOwner)((Component)trainer).GetComponentInChildren<DialogueTreeController>()).graph; List<ActorParameter> actorParameters = ((DialogueTree)((graph is DialogueTree) ? graph : null))._actorParameters; actorParameters[0].actor = (IDialogueActor)(object)componentInChildren; actorParameters[0].name = componentInChildren.name; StatementNodeExt val = graph.AddNode<StatementNodeExt>(); val.statement = new Statement(introDialogue); val.SetActorName(componentInChildren.name); MultipleChoiceNodeExt val2 = graph.AddNode<MultipleChoiceNodeExt>(); if (quantity >= 2) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask2 } }); } if (quantity >= 3) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask3 } }); } if (quantity >= 4) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask4 } }); } if (quantity >= 5) { val2.availableChoices.Add(new Choice { statement = new Statement { text = ask5 } }); } val2.availableChoices.Add(new Choice { statement = new Statement { text = askTrain } }); Node obj = graph.allNodes[1]; ActionNode val3 = (ActionNode)(object)((obj is ActionNode) ? obj : null); ActionTask action = val3.action; ((TrainDialogueAction)((action is TrainDialogueAction) ? action : null)).Trainer = new BBParameter<Trainer>(componentInChildren2); StatementNodeExt val4 = null; StatementNodeExt val5 = null; StatementNodeExt val6 = null; StatementNodeExt val7 = null; if (quantity >= 2) { val4 = graph.AddNode<StatementNodeExt>(); val4.statement = new Statement(reply2); val4.SetActorName(componentInChildren.name); } if (quantity >= 3) { val5 = graph.AddNode<StatementNodeExt>(); val5.statement = new Statement(reply3); val5.SetActorName(componentInChildren.name); } if (quantity >= 4) { val6 = graph.AddNode<StatementNodeExt>(); val6.statement = new Statement(reply4); val6.SetActorName(componentInChildren.name); } if (quantity >= 5) { val7 = graph.AddNode<StatementNodeExt>(); val7.statement = new Statement(reply5); val7.SetActorName(componentInChildren.name); } graph.allNodes.Clear(); graph.allNodes.Add((Node)(object)val); graph.allNodes.Add((Node)(object)val2); if (quantity >= 2 && val4 != null) { graph.allNodes.Add((Node)(object)val4); } if (quantity >= 3 && val5 != null) { graph.allNodes.Add((Node)(object)val5); } if (quantity >= 4 && val6 != null) { graph.allNodes.Add((Node)(object)val6); } if (quantity >= 5 && val7 != null) { graph.allNodes.Add((Node)(object)val7); } graph.allNodes.Add((Node)(object)val3); graph.primeNode = (Node)(object)val; graph.ConnectNodes((Node)(object)val, (Node)(object)val2, -1, -1); if (quantity >= 2 && val4 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val4, 0, -1); graph.ConnectNodes((Node)(object)val4, (Node)(object)val, -1, -1); } if (quantity >= 3 && val5 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val5, 1, -1); graph.ConnectNodes((Node)(object)val5, (Node)(object)val, -1, -1); } if (quantity >= 4 && val6 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val6, 2, -1); graph.ConnectNodes((Node)(object)val6, (Node)(object)val, -1, -1); } if (quantity >= 5 && val7 != null) { graph.ConnectNodes((Node)(object)val2, (Node)(object)val7, 3, -1); graph.ConnectNodes((Node)(object)val7, (Node)(object)val, -1, -1); } graph.ConnectNodes((Node)(object)val2, (Node)(object)val3, quantity - 1, -1); ((Component)trainer).gameObject.SetActive(true); } } public static class TrainerSpawn { public static void Init() { SL.OnGameplayResumedAfterLoading += SpawnTrainers; } private static void SpawnTrainers() { if (CharacterManager.Instance.GetWorldHostCharacter().IsLocalPlayer) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(DelayedTrainerSpawn()); } } public static IEnumerator DelayedTrainerSpawn() { yield return (object)new WaitForSeconds(1f); string activeSceneName = SceneManagerHelper.ActiveSceneName; Vector3 trainerPos = default(Vector3); Vector3 trainerRot = default(Vector3); if (activeSceneName == "CierzoNewTerrain") { ((Vector3)(ref trainerPos))..ctor(1425.63f, 5.3f, 1802.29f); ((Vector3)(ref trainerRot))..ctor(0f, 266.78f, 0f); SpawnCharacter(TrainerIDs.loreWalkerIntro, trainerPos, trainerRot); } else if (activeSceneName == "ChersoneseNewTerrain") { string text = "lDHL_XMS7kKEs0uOqrLQjw"; if (QuestEventManager.Instance.HasQuestEvent(QuestEventDictionary.GetQuestEvent(text))) { ((Vector3)(ref trainerPos))..ctor(177.3f, 39.3f, 1472.1f); ((Vector3)(ref trainerRot))..ctor(0f, 166.5f, 0f); SpawnCharacter(TrainerIDs.loreWalker, trainerPos, trainerRot); } } } public static Character SpawnCharacter(string trainerID, Vector3 trainerPos, Vector3 trainerRot) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) return SL.GetSLPack(SLPackIDs.mainSLPack).CharacterTemplates[trainerID].Spawn(trainerPos, trainerRot, UID.op_Implicit(UID.Generate()), (string)null); } } } namespace Shinobi { public static class ShinobiStageManager { [HarmonyPatch(typeof(AttackSkill), "GetStaminaCost")] public class AttackSkill_GetStaminaCost { public static void Postfix(ref float __result, AttackSkill __instance) { if (((Item)__instance).ItemID == ShinobiIDs.ninjutsuID) { __result /= 4f; } } } private static SLPack slpack = SL.GetSLPack(SLPackIDs.mainSLPack); private static string pathForCategory = slpack.GetPathForCategory<Texture2DCategory>(); private static string jutsuIcon = "NinjutsuIcon"; public static Dictionary<int, Sprite> NinjaIcons = new Dictionary<int, Sprite> { { 1, null }, { 2, null }, { 3, null }, { 4, null }, { 5, null }, { 6, null }, { 7, null } }; public static Dictionary<int, SpellCastType> NinjaAnim = new Dictionary<int, SpellCastType> { { 1, (SpellCastType)44 }, { 2, (SpellCastType)51 }, { 3, (SpellCastType)60 }, { 4, (SpellCastType)25 }, { 5, (SpellCastType)61 }, { 6, (SpellCastType)64 }, { 7, (SpellCastType)15 } }; public static void ChangeStages() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(ShinobiIDs.ninjutsuID); LevelAttackSkill val = (LevelAttackSkill)(object)((itemPrefab is LevelAttackSkill) ? itemPrefab : null); Array.Resize(ref val.m_skillStages, 7); foreach (int key in NinjaAnim.Keys) { SkillStage val2 = new SkillStage(); val.m_skillStages[key - 1] = val2; val.m_skillStages[key - 1].StageIcon = LoadSprite(jutsuIcon + key + ".PNG"); val.m_skillStages[key - 1].StageAnim = NinjaAnim[key]; } } private static Sprite LoadSprite(string iconName) { return CustomTextures.CreateSprite(CustomTextures.LoadTexture(Path.Combine(pathForCategory, iconName), false, false)); } } public static class ShinobiMudraManager { [HarmonyPatch(typeof(StatusEffectManager), "AddStatusEffect", new Type[] { typeof(StatusEffect), typeof(Character), typeof(string[]) })] public class StatusEffectManager_AddStatusEffect { [HarmonyPostfix] public static void Postfix(StatusEffectManager __instance, StatusEffect _statusEffect, Character _dealer, string[] _loadData) { if (__instance.m_character.IsLocalPlayer && ShinobiIDs.Mudras.ContainsValue(_statusEffect.IdentifierName)) { CheckActiveMudras(__instance); } } } private static void CheckActiveMudras(StatusEffectManager effectManager) { bool flag = false; bool flag2 = false; bool flag3 = false; string text = ShinobiIDs.Mudras[ShinobiIDs.MudraTen]; string text2 = ShinobiIDs.Mudras[ShinobiIDs.MudraChi]; string text3 = ShinobiIDs.Mudras[ShinobiIDs.MudraJin]; foreach (StatusEffect status in effectManager.Statuses) { if (status.IdentifierName == text) { flag = true; } else if (status.IdentifierName == text2) { flag2 = true; } else if (status.IdentifierName == text3) { flag3 = true; } } if (flag || flag2 || flag3) { SetActiveJutsu(effectManager, flag, flag2, flag3); } } private static void SetActiveJutsu(StatusEffectManager effectManager, bool Ten, bool Chi, bool Jin) { if (!effectManager.HasStatusEffect(ShinobiIDs.activeJutsu)) { effectManager.AddStatusEffect(ShinobiIDs.activeJutsu); } StatusEffect statusEffectOfName = effectManager.GetStatusEffectOfName(ShinobiIDs.activeJutsu); LevelStatusEffect val = (LevelStatusEffect)(object)((statusEffectOfName is LevelStatusEffect) ? statusEffectOfName : null); if (Ten) { if (Chi) { if (Jin) { val.m_currentLevel = 7; } else { val.m_currentLevel = 4; } } else if (Jin) { val.m_currentLevel = 6; } else { val.m_currentLevel = 1; } } else if (Chi) { if (Jin) { val.m_currentLevel = 5; } else { val.m_currentLevel = 2; } } else if (Jin) { val.m_currentLevel = 3; } val.NotifiyParentManagerOfLevelChange(); val.OnLevelHasChanged(); } } public static class ShinobiIDs { public static int ninjutsuID = -2141; public static int MudraTen = -2142; public static int MudraChi = -2143; public static int MudraJin = -2144; public static int chakraLeech = -2145; public static string activeJutsu = "ActiveJutsu"; public static Dictionary<int, string> Mudras = new Dictionary<int, string> { { -2142, "MudraTenEffect" }, { -2143, "MudraChiEffect" }, { -2144, "MudraJinEffect" } }; } public static class ShinobiBalance { public static float chakraLeechBonus = 10f; } } namespace WhispererClass { internal static class MadIDs { public static int Pathway = -2001; public static int BreakDelay = -2002; public static int BreakSpeed = -2003; public static int SupressPain = -2004; public static int Purify = -2007; public static int applyMadness = -2010; public static int upgraderQ = -2020; public static string Insanity = "Insanity"; } public class MadQuestManager : MonoBehaviour { [HarmonyPatch(typeof(CharacterKnowledge), "AddItem")] public class CharacterKnowledge_AddItem { [HarmonyPostfix] public static void Postfix(CharacterKnowledge __instance, Item _item, ref Character ___m_character) { Character val = ___m_character; if ((Object)(object)val == (Object)null) { return; } Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (!val.IsLocalPlayer) { return; } Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(-2061); Quest val2 = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); if (!((Object)(object)val2 == (Object)null) && QuestEventManager.Instance.GetEventCurrentStack(QE_WhispererStart.EventUID) < 9) { CharacterSkillKnowledge skillKnowledge = val.Inventory.SkillKnowledge; if (_item.ItemID == -2020) { Instance.questTriger = 2; Instance.UpdateQuestProgress(val2); } else if (((CharacterKnowledge)skillKnowledge).IsItemLearned(-2020) && Instance.checkAllUpgrades(val)) { Instance.questTriger = 3; Instance.UpdateQuestProgress(val2); } } } } [HarmonyPatch(typeof(CharacterInventory), "GetMostRelevantContainer", new Type[] { typeof(Item) })] public class CharacterInventory_GetMostRelevantContainer { [HarmonyPrefix] public static void Postfix(CharacterInventory __instance, Item _item, ref Character ___m_character) { Character val = ___m_character; if (!((Object)(object)val == (Object)null) && val.IsLocalPlayer && _item.ItemID == -2049 && QuestEventManager.Instance.GetEventCurrentStack(QE_WhispererStart.EventUID) < 1) { Instance.GetOrGiveQuestToHost(); } } } [HarmonyPatch(typeof(InteractionTriggerBase), "TryActivateBasicAction", new Type[] { typeof(Character), typeof(int) })] public class InteractionTriggerBase_TryActivateBasicAction { [HarmonyPrefix] public static void Prefix(InteractionTriggerBase __instance, Character _character, int _toggleState) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!_character.IsWorldHost || SceneManagerHelper.ActiveSceneName != "Chersonese_Dungeon3" || !Object.op_Implicit((Object)/*isinst with value type is only supported in some contexts*/)) { return; } EventActivator currentTriggerManager = __instance.CurrentTriggerManager; InteractionActivator val = (InteractionActivator)(object)((currentTriggerManager is InteractionActivator) ? currentTriggerManager : null); if (val.BasicInteraction != null && val.BasicInteraction is InteractionTrainerDialogue && Vector3.Distance(_character.CenterPosition, Instance.madtrainer1Spawn) < 2f && !PhotonNetwork.isNonMasterClientInRoom) { Item itemFromItemID = ((CharacterKnowledge)_character.Inventory.QuestKnowledge).GetItemFromItemID(-2061); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); if (QuestEventManager.Instance.GetEventCurrentStack(QE_WhispererStart.EventUID) < 3) { Instance.questTriger = 1; Instance.UpdateQuestProgress(quest); } } } } [HarmonyPatch(typeof(QuestLogEntry), "CreateEntryFromNetworkData")] private static class ExceptionFix { [HarmonyFinalizer] private static Exception Finalizer() { return null; } } public static MadQuestManager Instance; private static int baseDelayID = -2001; private static int breakDelayID = -2002; private static int breakSpeedID = -2003; private static int ignorePainID = -2004; private static int ignorePlusID = -2005; private static int etherealSkinID = -2006; private static int halfDamageID = -2007; private static int purShieldID = -2008; private static int purCleanseID = -2009; private static int applyMadnessID = -2010; private static int drainMadnessID = -2011; private static int expellMadnessID = -2012; private static int extremismhp = -2013; private static int masochism = -2014; private static int desperation = -2018; private static int shareMadness = -2017; private static int secretEffect1ID = -2015; private static int secretEffect2ID = -2016; private static int upgraderID = -2020; private int questTriger; private const int QuestID = -2061; private const string QuestName = "Mad Calling"; public const string QUEST_EVENT_FAMILY_NAME = "A_Iggy_MadWhisperer"; private const string LogSignature_A = "whisperer.objective.a"; private const string LogSignature_B = "whisperer.objective.b"; private const string LogSignature_C = "whisperer.objective.c"; private const string LogSignature_D1 = "whisperer.objective.d1"; private const string LogSignature_D2 = "whisperer.objective.d2"; private const string LogSignature_D3 = "whisperer.objective.d3"; private const string LogSignature_D4 = "whisperer.objective.d4"; private const string LogSignature_D5 = "whisperer.objective.d5"; private const string LogSignature_E = "whisperer.objective.e"; private Vector3 madtrainer1Spawn = new Vector3(-6.7f, 0.03f, -74.6f); private static QuestEventSignature QE_WhispererStart; public static string QE_Scenario_UID => "iggythemad.scenarios.whisperer"; public SL_Quest QuestTemplate { get; private set; } public Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "whisperer.objective.a", "Decypher the whispering skull riddle: “Bring the skull home, so we may supply. Ghosts will Pass, yet whispers will rise.”" }, { "whisperer.objective.b", "At Ghosts Pass: The skull senses it's masters nearby." }, { "whisperer.objective.c", "Surrender to madness: Learn all the skills from Iggy The Mad." }, { "whisperer.objective.d1", "Riddle: “The masters already Rose from their prisons of Sand. The whispers usher their coming.”" }, { "whisperer.objective.d2", "Riddle: “Stand face to Face againts the Ancients. Embrace the cold. Surrender to its grasp.”" }, { "whisperer.objective.d3", "Riddle: “The Jade masters will not stand your Quarrels long, mortals. They are coming.”" }, { "whisperer.objective.d4", "Riddle: “The masters once brought the world to Ruins. Their legacy is ever Giant.”" }, { "whisperer.objective.d5", "Riddle: “Vigil of the scourge, whose purity taken by the Lair of depravity. Thy whispers shall set free.”" }, { "whisperer.objective.e", "Your duties are over, mortal... for now..." } }; internal void Awake() { Instance = this; SL.OnPacksLoaded += OnPacksLoaded; QE_WhispererStart = CustomQuests.CreateQuestEvent("iggythemad.whisperer.start", false, true, true, "A_Iggy_MadWhisperer", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } public void OnPacksLoaded() { PrepareSLQuest(); } private void SL_OnGameplayResumedAfterLoading() { if (!PhotonNetwork.isNonMasterClientInRoom) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned(-2061)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(-2061); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } } public void PrepareSLQuest() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown SL_Quest val = new SL_Quest(); ((SL_Item)val).Target_ItemID = 7011620; ((SL_Item)val).New_ItemID = -2061; ((SL_Item)val).Name = "Mad Calling"; val.IsSideQuest = false; ((SL_Item)val).ItemExtensions = (SL_ItemExtension[])(object)new SL_ItemExtension[1] { (SL_ItemExtension)new SL_QuestProgress() }; QuestTemplate = val; List<SL_QuestLogEntrySignature> list = new List<SL_QuestLogEntrySignature>(); foreach (KeyValuePair<string, string> questLogSignature in QuestLogSignatures) { list.Add(new SL_QuestLogEntrySignature { UID = questLogSignature.Key, Text = questLogSignature.Value, Type = (QuestLogEntrySignatureType)0 }); } SL_ItemExtension obj = ((SL_Item)QuestTemplate).ItemExtensions[0]; ((SL_QuestProgress)((obj is SL_QuestProgress) ? obj : null)).LogSignatures = list.ToArray(); ((ContentTemplate)QuestTemplate).ApplyTemplate(); QuestTemplate.OnQuestLoaded += UpdateQuestProgress; } public Quest GetOrGiveQuestToHost() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) QuestEventManager.Instance.AddEvent(QE_WhispererStart, 1); Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned(-2061)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID(-2061); return (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); } Item obj = ItemManager.Instance.GenerateItemNetwork(-2061); Quest val = (Quest)(object)((obj is Quest) ? obj : null); ((Component)val).transform.SetParent(((Component)worldHostCharacter.Inventory.QuestKnowledge).transform); ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).AddItem((Item)(object)val); ((Component)val).GetComponent<QuestProgress>().m_progressState = (ProgressState)1; UpdateQuestProgress(val); return val; } private bool checkAllUpgrades(Character player) { bool num = ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(ignorePlusID) || ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(etherealSkinID); bool flag = ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(desperation) || ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(masochism); bool flag2 = ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(purCleanseID) || ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(purShieldID); bool flag3 = ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(drainMadnessID) || ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(extremismhp); bool flag4 = ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(expellMadnessID) || ((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(shareMadness); if (num && flag && flag2 && flag3 && flag4) { return true; } return false; } public void UpdateQuestProgress(Quest quest) { //IL_004b: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.isNonMasterClientInRoom) { CharacterManager.Instance.GetWorldHostCharacter(); int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_WhispererStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_WhispererStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.a")), displayTime: false); ShowUIMessage("“Bring the skull home, so we may supply. Ghosts will Pass, yet whispers will rise.”"); } if (SceneManagerHelper.ActiveSceneName == "Chersonese_Dungeon3" && eventCurrentStack < 2) { QuestEventManager.Instance.AddEvent(QE_WhispererStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.b")), displayTime: false); ShowUIMessage("“The Mad Ones are here. Open your mind to the masters. Surrender to their will.”"); } else if (questTriger == 1 && eventCurrentStack < 3) { questTriger = 0; QuestEventManager.Instance.AddEvent(QE_WhispererStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.c")), displayTime: false); ShowUIMessage("“Surrender to madness... Let Iggy The Mad teach you everything about the whispers...”"); } else if (questTriger == 2 && eventCurrentStack < 4) { questTriger = 0; QuestEventManager.Instance.AddEvent(QE_WhispererStart, 5); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.d1")), displayTime: false); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.d2")), displayTime: false); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.d3")), displayTime: false); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.d4")), displayTime: false); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.d5")), displayTime: false); ShowUIMessage("“Your mind is overwhelmed with whispering riddles...”"); } else if (questTriger == 3 && eventCurrentStack < 9) { questTriger = 0; QuestEventManager.Instance.AddEvent(QE_WhispererStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("whisperer.objective.e")), displayTime: true); questProgress.DisableQuest((ProgressState)3); ShowUIMessage("“Your duties are over, mortal... for now...”"); } questProgress = quest.m_questProgress; ReloadLogs(eventCurrentStack, questProgress); } } public void ReloadLogs(int stack, QuestProgress progress) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) int num = 0; foreach (KeyValuePair<string, string> questLogSignature in QuestLogSignatures) { if (num < stack && questLogSignature.Key != null) { Debug.Log((object)("log: " + questLogSignature.Key)); progress.UpdateLogEntry(progress.GetLogSignature(UID.op_Implicit(questLogSignature.Key)), displayTime: false); num++; } } } public void ShowUIMessage(string message) { if (!((Object)(object)CharacterManager.Instance == (Object)null) && !string.IsNullOrEmpty(message)) { Character firstLocalCharacter = CharacterManager.Instance.GetFirstLocalCharacter(); if (Object.op_Implicit((Object)(object)firstLocalCharacter)) { firstLocalCharacter.CharacterUI.NotificationPanel.ShowNotification(message, 4f); } } } } internal static class QuestExtensions { internal static void UpdateLogEntry(this QuestProgress progress, QuestLogEntrySignature signature, bool displayTime) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) progress.UpdateLogEntry(signature.UID, displayTime, signature); } } public class MadDamageManager : MonoBehaviour { [HarmonyPatch(typeof(StatusEffectManager), "AddStatusEffect", new Type[] { typeof(StatusEffect), typeof(Character), typeof(string[]) })] public class StatusEffectManager_AddStatusEffect { [HarmonyPrefix] public static void Prefix(StatusEffectManager __instance, StatusEffect _statusEffect, Character _dealer, string[] _loadData) { if (!PhotonNetwork.isNonMasterClientInRoom && _statusEffect.IdentifierName == "IgnorePain" && ((CharacterKnowledge)__instance.m_character.Inventory.SkillKnowledge).IsItemLearned(etherealSkinID)) { __instance.m_character.StatusEffectMngr.AddStatusEffect("PainBuff"); } } } [HarmonyPatch(typeof(CharacterStats), "ReceiveDamage")] public class Character_ReceiveDamage { [HarmonyPrefix] public static void Prefix(CharacterStats __instance, ref float _damage, ref Character ___m_character) { if (!___m_character.IsLocalPlayer) { return; } int num = ((!((Object)(object)___m_character == (Object)(object)Instance.players[0])) ? 1 : 0); if (___m_character.StatusEffectMngr.HasStatusEffect("PurifyShield")) { if (_damage < Instance.purifyShieldPot[num]) { Instance.purifyShieldPot[num] -= _damage; _damage = 0f; } else { _damage -= Instance.purifyShieldPot[num]; ___m_character.StatusEffectMngr.RemoveStatusWithIdentifierName("PurifyShield"); _damage /= 2f; } } if (((CharacterKnowledge)__instance.m_character.Inventory.SkillKnowledge).IsItemLearned(-2018)) { int statusLevel = __instance.m_character.StatusEffectMngr.GetStatusLevel(Insanity); int num2 = 2; if (((CharacterKnowledge)__instance.m_character.Inventory.SkillKnowledge).IsItemLearned(-2002)) { num2 = 3; } if (statusLevel < num2 && Random.Range(0, 100) < (int)_damage) { __instance.m_character.StatusEffectMngr.AddStatusEffect(Insanity); } } } } [HarmonyPatch(typeof(Item), "Use", new Type[] { typeof(Character) })] public class Item_Usage { [HarmonyPrefix] public static void Prefix(Item __instance, Character _character) { _character.StatusEffectMngr.GetStatusEffectOfName("Insanity"); if (__instance.ItemID == halfDamageID) { ((MonoBehaviour)Instance).StartCoroutine(Instance.Purify(_character)); } else if (__instance.ItemID == ignorePainID) { Instance.ReduceInsanity(_character); if (((CharacterKnowledge)_character.Inventory.SkillKnowledge).IsItemLearned(ignorePlusID) && ((CharacterKnowledge)_character.Inventory.SkillKnowledge).IsItemLearned(breakSpeedID)) { _character.StatusEffectMngr.AddStatusEffect("PainSpeed"); } if (((CharacterKnowledge)_character.Inventory.SkillKnowledge).IsItemLearned(-2017)) { ((MonoBehaviour)Instance).StartCoroutine(Instance.ShareMadness(_character)); } } else if (__instance.ItemID == drainMadnessID) { Instance.ReduceInsanity(_character); ((MonoBehaviour)Instance).StartCoroutine(Instance.DrainMadness(_character)); } else if (__instance.ItemID == expellMadnessID) { Instance.ReduceInsanity(_character); Object.FindObjectsOfType<Character>(); ((MonoBehaviour)Instance).StartCoroutine(Instance.ExpellMadness(_character)); } } } [HarmonyPatch(typeof(Character), "VitalityHit")] public class Character_VitalityHit { [HarmonyPrefix] public static void Prefix(Character __instance, Character _dealerChar, float _damage, Vector3 _hitVector) { if (!((Object)(object)_dealerChar == (Object)null) && __instance.IsAI && _dealerChar.IsLocalPlayer && ((CharacterKnowledge)_dealerChar.Inventory.SkillKnowledge).IsItemLearned(applyMadnessID) && !Instance.madnessCD) { Instance.madnessCD = true; ((MonoBehaviour)Instance).StartCoroutine("ResetMadCD"); _dealerChar.StatusEffectMngr.AddStatusEffect("Madness"); } } } [HarmonyPatch(typeof(CharacterStats), "RestoreBurntHealth")] public class Character_RestoreBurntHealth { [HarmonyPrefix] public static void Prefix(CharacterStats __instance, ref float _value, bool _ratioFromMax, ref Character ___m_character) { if (___m_character.IsLocalPlayer && ((CharacterKnowledge)___m_character.Inventory.SkillKnowledge).IsItemLearned(secretEffect1ID)) { _value += _value; } } } public static MadDamageManager Instance; public float delayedTick; public int tickCounter; public float regenPurTimer = 20f; private static int baseDelayID = -2001; private static int breakDelayID = -2002; private static int breakSpeedID = -2003; private static int ignorePainID = -2004; private static int ignorePlusID = -2005; private static int etherealSkinID = -2006; private static int halfDamageID = -2007; private static int purShieldID = -2008; private static int purCleanseID = -2009; private static int applyMadnessID = -2010; private static int drainMadnessID = -2011; private static int expellMadnessID = -2012; private static int purHealID = -2013; private static int absorbStaminaID = -2014; private static int secretEffect1ID = -2015; private static int secretEffect2ID = -2016; private static int upgraderID = -2020; private static int whispHelm = -2033; private static string expellBoltID = "ExpellBolt"; private static string MadnessID = "Madness"; private static string ExtremismEffect = "ExtremismEffect"; private static string Insanity = "Insanity"; private static string delayedDamage = "Delayed Damage"; private static string ExpellFX = "ExpellFX"; public float delayPerStack = 0.1f; public float tickStaminaMult = 2f; public float baseDrainHeal = 0.5f; public float drainPowDiv = 0.5f; public float expellPowDiv = 2f; public float expellRange = 12f; public float ignoreStaggerMult = 0.8f; public float purifyStrenght = 0.4f; public float purShieldMult = 10f; public float purifyStrenghtPlus = 0.6f; public float expellBoltRate = 0.7f; public float shareImpact = 5f; public float shareRange = 8f; public float purifyHeal = 3f; public int localPlayers; public int[] regenInsanity; public bool[] Regenerating; public float[] purifyShieldPot; public int[] maxInsanity; public float[] baseMaxHP; public int[] madnessLv; public bool[] madReset; public Character[] players; public bool[] normalizeTrigger; public bool madnessCD; public Coroutine[] drainCo; internal void Awake() { Instance = this; players = (Character[])(object)new Character[2]; regenInsanity = new int[2]; Regenerating = new bool[2]; maxInsanity = new int[2]; purifyShieldPot = new float[2]; baseMaxHP = new float[2]; madnessLv = new int[2]; madReset = new bool[2]; normalizeTrigger = new bool[2]; drainCo = (Coroutine[])(object)new Coroutine[2]; players[0] = null; players[1] = null; regenInsanity[0] = 0; regenInsanity[1] = 0; Regenerating[0] = false; Regenerating[1] = false; maxInsanity[0] = 0; maxInsanity[1] = 0; purifyShieldPot[0] = 0f; purifyShieldPot[1] = 0f; DelayedDamage.GetDamageToDelay = (Func<Character, Character, DamageList, float, float>)Delegate.Combine(DelayedDamage.GetDamageToDelay, new Func<Character, Character, DamageList, float, float>(GetDelayedDamage)); DelayedDamage.OnDelayedDamageTaken = (Action<Character, Character, float>)Delegate.Combine(DelayedDamage.OnDelayedDamageTaken, new Action<Character, Character, float>(StaminaRegenOnDelay)); SL.OnGameplayResumedAfterLoading += Fixer; } private void Fixer() { players[0] = CharacterManager.Instance.GetFirstLocalCharacter(); if (!SplitScreenManager.Instance.IsSplitActive) { return; } Character[] array = Object.FindObjectsOfType<Character>(); foreach (Character val in array) { if ((!val.IsAI & ((Object)(object)val != (Object)(object)players[0])) && val.IsLocalPlayer) { players[1] = val; } } } private void Update() { if ((Object)(object)players[0] == (Object)null) { return; } if (SplitScreenManager.Instance.IsSplitActive) { localPlayers = 2; if ((Object)(object)players[1] == (Object)null) { Fixer(); } } else { localPlayers = 1; } for (int i = 0; i < localPlayers; i++) { if (!((Object)(object)players[i] != (Object)null)) { continue; } if (players[i].Inventory.HasEquipped(whispHelm) && !players[i].StatusEffectMngr.HasStatusEffect("skullDrain") && players[i].InCombat) { players[i].StatusEffectMngr.AddStatusEffect("skullDrain"); } else if ((!players[i].Inventory.HasEquipped(whispHelm) || !players[i].InCombat) && players[i].StatusEffectMngr.HasStatusEffect("skullDrain")) { players[i].StatusEffectMngr.RemoveStatusWithIdentifierName("skullDrain"); } if (!((CharacterKnowledge)players[i].Inventory.SkillKnowledge).IsItemLearned(baseDelayID)) { continue; } if (((CharacterKnowledge)players[i].Inventory.SkillKnowledge).IsItemLearned(breakDelayID)) { maxInsanity[i] = 3; } else if (((CharacterKnowledge)players[i].Inventory.SkillKnowledge).IsItemLearned(breakSpeedID)) { maxInsanity[i] = 2; } else { maxInsanity[i] = 1; } if (regenInsanity[i] < maxInsanity[i] && !Regenerating[i]) { ((MonoBehaviour)this).StartCoroutine(RegenInsanityStack(i)); } if (regenInsanity[i] > players[i].StatusEffectMngr.GetStatusLevel("Insanity") && regenInsanity[i] > 0) { players[i].StatusEffectMngr.AddStatusEffect("Insanity"); } else if (regenInsanity[i] < players[i].StatusEffectMngr.GetStatusLevel("Insanity") && players[i].StatusEffectMngr.HasStatusEffect("Insanity")) { regenInsanity[i]++; } if (players[i].StatusEffectMngr.GetStatusLevel("InsanitySpeed") != players[i].StatusEffectMngr.GetStatusLevel("Insanity") && ((CharacterKnowledge)players[i].Inventory.SkillKnowledge).IsItemLearned(breakSpeedID)) { if (players[i].StatusEffectMngr.GetStatusLevel("InsanitySpeed") > players[i].StatusEffectMngr.GetStatusLevel("Insanity")) { StatusEffect statusEffectOfName = players[i].StatusEffectMngr.GetStatusEffectOfName("InsanitySpeed"); players[i].StatusEffectMngr.ReduceStatusLevel(statusEffectOfName, 1); } else if (players[i].StatusEffectMngr.GetStatusLevel("InsanitySpeed") < players[i].StatusEffectMngr.GetStatusLevel("Insanity")) { players[i].StatusEffectMngr.AddStatusEffect("InsanitySpeed"); } } if (players[i].StatusEffectMngr.GetStatusLevel("Insanity") > maxInsanity[i]) { regenInsanity[i]--; players[i].StatusEffectMngr.ReduceStatusLevel(players[i].StatusEffectMngr.GetStatusEffectOfName("Insanity"), 1); } } } public IEnumerator RegenInsanityStack(int i) { while (regenInsanity[i] < maxInsanity[i]) { Regenerating[i] = true; yield return (object)new WaitForSeconds(regenPurTimer); regenInsanity[i]++; } Regenerating[i] = false; } private float GetDelayedDamage(Character character, Character dealer, DamageList damageList, float knockBack) { float totalDamage = damageList.TotalDamage; float num = 0f; if (knockBack > 0f && (Object)(object)dealer != (Object)null && ((CharacterKnowledge)character.Inventory.SkillKnowledge).IsItemLearned(baseDelayID) && !character.StatusEffectMngr.HasStatusEffect("PurifyShield")) { if (((CharacterKnowledge)character.Inventory.SkillKnowledge).IsItemLearned(breakDelayID)) { num = ((!character.StatusEffectMngr.HasStatusEffect("IgnorePain")) ? (num + totalDamage * (delayPerStack * 3f)) : ((!((CharacterKnowledge)character.Inventory.SkillKnowledge).IsItemLearned(ignorePlusID)) ? (num + totalDamage * (delayPerStack * 3f + 0.3f)) : (num + totalDamage * 0.9f))); } else if (((CharacterKnowledge)character.Inventory.SkillKnowledge).IsItemLearned(breakSpeedID)) { num = ((!character.StatusEffectMngr.HasStatusEffect("IgnorePain")) ? (num + totalDamage * ((float)character.StatusEffectMngr.GetStatusLevel("Insanity") * delayPerStack)) : (num + totalDamage * ((float)character.StatusEffectMngr.GetStatusLevel("Insanity") * delayPerStack + 0.3f))); } else if (character.StatusEffectMngr.HasStatusEffect("Insanity")) { num += totalDamage * delayPerStack; } } return num; } public void StaminaRegenOnDelay(Character receiver, Character dealer, float damage) { if (((CharacterKnowledge)receiver.Inventory.SkillKnowledge).IsItemLearned(absorbStaminaID)) { receiver.Stats.AffectStamina(Mathf.Abs(damage * tickStaminaMult)); } } public IEnumerator ShareMadness(Character _character) { List<Character> inRange = new List<Character>(); new List<Character>(); yield return (object)new WaitForSeconds(0.4f); CharacterManager.Instance.FindCharactersInRange(((Component)_character).transform.position, Instance.shareRange, ref inRange); foreach (Character item in inRange) { if (item.IsAI && !item.IsAlly(_character)) { int statusLevel = _character.StatusEffectMngr.GetStatusLevel(MadnessID); item.OnReceiveHit(_character.CurrentWeapon, 1f, new DamageList(), Vector3.forward, Vector3.forward, 0f, 0f, _character, 6f * (float)statusLevel); } } } public IEnumerator Purify(Character _character) { yield return (object)new WaitForSeconds(0.6f); float num = 0f; float num2 = 0f; float num3 = purifyStrenght; if (((CharacterKnowledge)_character.Inventory.SkillKnowledge).IsItemLearned(-2009)) { num3 = Instance.purifyStrenghtPlus; } Instance.ReduceInsanity(_character); foreach (StatusEffect status in _character.StatusEffectMngr.Statuses) { if (status.IdentifierName == delayedDamage) { num += ((EffectSynchronizer)status).EffectPotency; ((EffectSynchronizer)status).SetPotency(((EffectSynchronizer)status).EffectPotency * (1f - num3)); num2 += ((EffectSynchronizer)status).EffectPotency; } } if (((CharacterKnowledge)_character.Inventory.SkillKnowledge).IsItemLearned(purShieldID)) { int num4 = ((!((Object)(object)_character == (Object)(object)Instance.players[0])) ? 1 : 0); Instance.purifyShieldPot[num4] = (num - num2) * Instance.purShieldMult; _character.StatusEffectMngr.RemoveStatusWithIdentifierName("PurifyShield"); _character.StatusEffectMngr.AddStatusEffect("PurifyShield"); } else if (((CharacterKnowledge)_character.Inventory.SkillKnowledge).IsItemLearned(purCleanseID)) { _ = _character.StatusEffectMngr.Statuses.Count; foreach (string item in new List<string> { "Poisoned +", "Poisoned", "Possessed", "Curse", "Plague", "Hallowed Marsh Poison Lvl2", "Hallowed Marsh Poison Lvl1", "SulphurPoison", "Food Poisoned +", "Food Poisoned" }) { if (_character.StatusEffectMngr.HasStatusEffect(item)) { _character.StatusEffectMngr.RemoveStatusWithIdentifierName(item); break; } } } if (((CharacterKnowledge)_character.Inventory.SkillKnowledge).IsItemLearned(-2013)) { int statusLevel = _character.StatusEffectMngr.GetStatusLevel(MadnessID); _character.Stats.AffectHealth((float)statusLevel * purifyHeal); } } public void ReduceInsanity(Character _character) { _character.StatusEffectMngr.ReduceStatusLevel(Insanity, 1); if ((Object)(object)_character == (Object)(object)Instance.players[0]) { Instance.regenInsanity[0]--; } else { Instance.regenInsanity[1]--; } } public IEnumerator DrainMadness(Character playerChar) { yield return (object)new WaitForSeconds(0.5f); _ = baseDrainHeal; yield return (object)new WaitForSeconds(0.5f); StartDrainHOT(playerChar); } private void StartDrainHOT(Character playerChar) { int num = 0; num = ((!((Object)(object)playerChar == (Object)(object)players[0])) ? 1 : 0); if (drainCo[num] != null) { ((MonoBehaviour)Instance).StopCoroutine(drainCo[num]); } drainCo[num] = ((MonoBehaviour)Instance).StartCoroutine(DrainHOT(playerChar)); } private IEnumerator DrainHOT(Character playerChar) { float HPtoHeal = baseDrainHeal; playerChar.StatusEffectMngr.AddStatusEffect("DrainHOT"); while (playerChar.StatusEffectMngr.HasStatusEffect("Madness") && playerChar.Stats.CurrentHealth > 1f) { yield return (object)new WaitForSeconds(1f); if (playerChar.Stats.CurrentHealth > 1f) { playerChar.Stats.AffectHealth(HPtoHeal); } playerChar.StatusEffectMngr.ReduceStatusLevel("Madness", 1); if (HPtoHeal < baseDrainHeal * 10f) { HPtoHeal += baseDrainHeal; } } playerChar.StatusEffectMngr.CleanseStatusEffect("DrainHOT"); } public IEnumerator ExpellMadness(Character playerChar) { playerChar.Animator.speed = 1.5f; yield return (object)new WaitForSeconds(1f); playerChar.Animator.speed = 1f; playerChar.StatusEffectMngr.AddStatusEffect(ExpellFX); while (playerChar.StatusEffectMngr.GetStatusLevel(MadnessID) > 0 && playerChar.Stats.CurrentHealth > 1f) { playerChar.StatusEffectMngr.AddStatusEffect(expellBoltID); playerChar.StatusEffectMngr.ReduceStatusLevel(MadnessID, 1); yield return (object)new WaitForSeconds(expellBoltRate); } } private IEnumerator ResetMadCD() { yield return (object)new WaitForSeconds(0.1f); madnessCD = false; } } public class MadExtrasManager : MonoBehaviour { [HarmonyPatch(typeof(CharacterInventory), "DropItem", new Type[] { typeof(Item), typeof(Transform), typeof(bool) })] public class CharacterInventory_DropItem { [HarmonyPrefix] public static bool Prefix(CharacterInventory __instance, Item _item, Transform _newParent, bool _playAnim, ref Character ___m_character) { if (_item.ItemID == -2049 && ((EffectSynchronizer)_item).OwnerCharacter.IsLocalPlayer && ((CharacterKnowledge)((EffectSynchronizer)_item).OwnerCharacter.Inventory.SkillKnowledge).IsItemLearned(whispPassive)) { return false; } return true; } } [HarmonyPatch(typeof(ShopMenu), "OnConfirmTransaction")] public class ItemDisplay_OnConfirmSell { [HarmonyPrefix] public static void Prefix(ShopMenu __instance) { if (!((CharacterKnowledge)((UIElement)__instance).LocalCharacter.Inventory.SkillKnowledge).IsItemLearned(whispPassive)) { return; } foreach (ItemQuantity item in __instance.m_merchant.SellCart.ItemsInCart) { if (item.Item.ItemID == whispSkull) { Debug.Log((object)"IS SELLING SKULL-------------"); Item itemFromItemID = ((CharacterKnowledge)((UIElement)__instance).LocalCharacter.Inventory.SkillKnowledge).GetItemFromItemID(whispPassive); ItemManager.Instance.DestroyItem(itemFromItemID.UID); ((CharacterKnowledge)((UIElement)__instance).LocalCharacter.Inventory.SkillKnowledge).RemoveItem(whispPassive); ((UIElement)__instance).LocalCharacter.CharacterUI.ShowInfoNotification("The burden of the Whispering Skull has been passed..."); } } } } [HarmonyPatch(typeof(CharacterInventory), "EquipItem", new Type[] { typeof(Equipment), typeof(bool) })] public class CharacterInventory_EquipItem { [HarmonyPrefix] public static void Postfix(CharacterInventory __instance, Equipment _itemToEquip, bool _playAnim, ref Character ___m_character) { Character val = ___m_character; if (!((Object)(object)val == (Object)null) && val.IsLocalPlayer) { checkSkulls(val); } } } [HarmonyPatch(typeof(CharacterInventory), "UnequipItem", new Type[] { typeof(Equipment), typeof(bool) })] public class CharacterInventory_UnequipItem { [HarmonyPrefix] public static void Postfix(CharacterInventory __instance, Equipment _itemToUnequip, bool _playAnim, ref Character ___m_character) { Character val = ___m_character; if (!((Object)(object)val == (Object)null) && val.IsLocalPlayer) { checkSkulls(val); } } } [HarmonyPatch(typeof(CharacterUI), "ShowMenu", new Type[] { typeof(MenuScreens) })] public class CharacterUI_ShowMenu { [HarmonyPrefix] public static void Prefix(CharacterUI __instance, MenuScreens _menu) { Character targetCharacter = __instance.TargetCharacter; if (!((Object)(object)targetCharacter == (Object)null) && targetCharacter.IsLocalPlayer) { checkSkulls(targetCharacter); } } } [HarmonyPatch(typeof(CharacterKnowledge), "AddItem")] public class CharacterKnowledge_AddItem { [HarmonyPrefix] public static void Postfix(CharacterKnowledge __instance, Item _item) { if (_item.ItemID == -2050) { Character character = __instance.m_character; if (SceneManagerHelper.ActiveSceneName == "ChersoneseDungeonsSmall") { ((MonoBehaviour)Instance).StartCoroutine(Instance.Unfade(character)); } } } } public static MadExtrasManager Instance; private static int baseDelayID = -2001; private static int breakDelayID = -2002; private static int breakSpeedID = -2003; private static int ignorePainID = -2004; private static int ignorePlusID = -2005; private static int etherealSkinID = -2006; private static int halfDamageID = -2007; private static int purShieldID = -2008; private static int purCleanseID = -2009; private static int applyMadnessID = -2010; private static int drainMadnessID = -2011; private static int expellMadnessID = -2012; private static int extremismhp = -2013; private static int masochism = -2014; private static int desperation = -2018; private static int shareMadness = -2017; private static int secretEffect1ID = -2015; private static int secretEffect2ID = -2016; private static int upgraderID = -2020; private static int skullDropChance = 20; private bool blockNotifs; private static int whispSkull = -2049; private static int whispPassive = -2050; private string skullStart = "The skull whispers to you constantly. It slowly takes over your mind...“I will guide your path...”"; private string skullTalking = "The whispers fill your mind with lust and pain. “The voices here... They call your name... The Mad ones...”"; private string skullDrop = "The whispers are eternal..."; private string skullSilent = "The skull seems silent. For now. “...”"; private string skullTeasing = "The skull invades your mind: “The Mad Ones are here. Open your mind to the masters. Surrender to their will.”"; private string skullMadTalk = "The whispers fill your mind with thoughts of madness “A Mad one is here... find him. Madness take over.”"; private string skullPureTalk = "The whispers make you feel enraged. In need of cleansing the world: “A Mad One... He's watching you.”"; private string skullInsTalk = "The insanity fills your body, overpowering your thoughts: “Purge these fools. Claim your prize. Bow before the Mad One.”"; private string skullPainTalk = "The whispers overwhelm your body. The Pain is unbearable: “Embrace the Mad One in the cold. Enjoy the pain of mortality”"; private string skullSecret1Talk = "The skull fills your mind with doubt and confusion: “A Mad One? Here? I can hear its whispers. But where is it...”"; private string skullNearbyTalk = "The whispers become louder as you feel a presence nearby: “There's a Mad One nearby. One of these places. Find him.”"; private string skullFuture = "The whispers seem to be planning something. You are filled with lust of power. “Rest for now, whisperer. I will make use of you soon.”"; private string skullHarmTalk = "The whispers cloud your mind. Chills shiver your body: “Slaughter... Murder... Betrayal... and a Mad One. Here.”"; private List<Character> madGhosts; private int ghostTrigger; private SL_Character mysteryMan; private Vector3 hollowSmallPos = new Vector3(1810f, 0f, 30f); private Vector3 cherzSmallPos = new Vector3(1199f, 0f, -1f); private Vector3 chersNearby = new Vector3(1294f, 25f, 1207f); private Vector3 emercarNearby = new Vector3(1422f, -18f, 1715f); private Vector3 abrassarNearby = new Vector3(-732f, 100f, -715f); private Vector3 hallowNearbyJade = new Vector3(1675f, -61f, 575f); private Vector3 hallowNearbyGiant = new Vector3(890f, -50f, 1468f); private Vector3 antiqueNearby = new Vector3(964.6f, 48f, 460f); private Vector3 antiqueSmallPos = new Vector3(2100.2f, 0.1f, 13.5f); private bool stopNotify; private float notifyRange = 150f; private float smallNotifyRange = 50f; private float nearbyTimer; private Vector3 lastPos = new Vector3(8.3f, -3.8f, 4.4f); internal void Awake() { madGhosts = new List<Character>(); Instance = this; SL.OnGameplayResumedAfterLoading += TrainerSpawn; DescriptionHelper.OnDescriptionModified = (DescriptionHelper.DescriptionModifier)Delegate.Combine(DescriptionHelper.OnDescriptionModified, new DescriptionHelper.DescriptionModifier(SkullDescriptionModifier)); } private static void checkSkulls(Character player) { if (!((CharacterKnowledge)player.Inventory.SkillKnowledge).IsItemLearned(-2050)) { return; } bool flag = player.Inventory.OwnsOrHasEquipped(whispSkull); List<Item> ownedItems = player.Inventory.GetOwnedItems(whispSkull); int num = ownedItems.Count; if (num > 1 || flag) { foreach (Item item in ownedItems) { if (num > 1) { item.RemoveQuantity(1); num--; } } return; } if (num == 0 && !flag) { ((MonoBehaviour)Instance).StartCoroutine(Instance.BlockNotifs()); player.Inventory.ReceiveItemReward(whispSkull, 1, false); } } private IEnumerator BlockNotifs() { blockNotifs = true; yield return (object)new WaitForSeconds(1f); blockNotifs = false; } private IEnumerator Unfade(Character player) { yield return (object)new WaitForSeconds(0.5f); BlackFade.Instance.StartFade(true); yield return (object)new WaitForSeconds(2.5f); List<Character> list = new List<Character>(); CharacterManager.Instance.FindCharactersInRange(player.CenterPosition, 6f, ref list); foreach (Character item in list) { if (item.IsAI) { ((Component)item).gameObject.SetActive(false); } } player.AutoKnock(true, Vector3.back, player); yield return (object)new WaitForSeconds(0.5f); BlackFade.Instance.StartFade(false); } private void SkullDescriptionModifier(Item item, ref string description) { //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due