Decompiled source of OuthardAdditionalContent v0.0.3
BepInEx/plugins/exp111-SkilledAtMeditation/SkilledAtMeditation.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using SideLoader; using SideLoader.Model; using SideLoader.Model.Status; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("SkilledAtMeditation")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SkilledAtMeditation")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f58ba851-9161-4c37-a53a-8b7160761b1f")] [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 SkilledAtMeditation; public class SL_Meditation : SL_Effect, ICustomModel { public Type SLTemplateModel => typeof(SL_Meditation); public Type GameModel => typeof(Meditation); public override void ApplyToComponent<T>(T component) { } public override void SerializeEffect<T>(T effect) { } } public class Meditation : Effect, ICustomModel { public Type SLTemplateModel => typeof(SL_Meditation); public Type GameModel => typeof(Meditation); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 try { if ((int)_affectedCharacter.CurrentSpellCast != 41) { _affectedCharacter.StatusEffectMngr.CleanseStatusEffect("Meditation"); return; } CharacterStats stats = _affectedCharacter.Stats; if (SkilledAtMeditation.EnableBurntRegen.Value) { Update(ref stats.m_burntStamina, 0f - SkilledAtMeditation.BurntStaminaRegen.Value, stats.MaxStamina); Update(ref stats.m_burntHealth, 0f - SkilledAtMeditation.BurntHealthRegen.Value, stats.MaxHealth); Update(ref stats.m_burntMana, 0f - SkilledAtMeditation.BurntManaRegen.Value, stats.MaxMana); } if (SkilledAtMeditation.EnableActiveRegen.Value) { Update(ref stats.m_stamina, SkilledAtMeditation.ActiveStaminaRegen.Value, stats.ActiveMaxStamina); Update(ref stats.m_health, SkilledAtMeditation.ActiveHealthRegen.Value, stats.ActiveMaxHealth); Update(ref stats.m_mana, SkilledAtMeditation.ActiveManaRegen.Value, stats.ActiveMaxMana); } } catch (Exception arg) { SkilledAtMeditation.Log.LogMessage((object)$"Exception during Meditation.ActivateLocally: {arg}"); } static void Update(ref float cur, float delta, float max) { cur = Mathf.Clamp(cur + delta, 0f, max); } } } [BepInPlugin("com.exp111.SkilledAtMeditation", "SkilledAtMeditation", "1.0")] public class SkilledAtMeditation : BaseUnityPlugin { public const string ID = "com.exp111.SkilledAtMeditation"; public const string NAME = "SkilledAtMeditation"; public const string VERSION = "1.0"; public static ManualLogSource Log; public const int MeditationSkillID = -46000; public const int MeditationStatusID = -46001; public const string MeditationStatusIdentifier = "Meditation"; public Skill MeditationSkill; public static ConfigEntry<bool> EnableBurntRegen; public static ConfigEntry<bool> EnableActiveRegen; public static ConfigEntry<float> BurntStaminaRegen; public static ConfigEntry<float> BurntHealthRegen; public static ConfigEntry<float> BurntManaRegen; public static ConfigEntry<float> ActiveStaminaRegen; public static ConfigEntry<float> ActiveHealthRegen; public static ConfigEntry<float> ActiveManaRegen; public void Awake() { try { Log = ((BaseUnityPlugin)this).Logger; Log.LogMessage((object)"Awake"); CreateConfig(); CreateSkill(); CreateStatusEffect(); if (SL.PacksLoaded) { OnPackLoaded(); } SL.OnPacksLoaded += OnPackLoaded; SL.OnSceneLoaded += OnSceneLoaded; } catch (Exception arg) { Log.LogMessage((object)$"Exception during SkilledAtMeditation.Awake: {arg}"); } } private void CreateConfig() { EnableBurntRegen = ((BaseUnityPlugin)this).Config.Bind<bool>("Burnt Stat Regen", "Enable Burnt Stat Regeneration", true, "Enable or disable the regeneration of burnt stats while meditating"); EnableActiveRegen = ((BaseUnityPlugin)this).Config.Bind<bool>("Active Stat Regen", "Enable Active Stat Regeneration", true, "Enable or disable the regeneration of active (non-burnt) stats while meditating"); BurntStaminaRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Burnt Stat Regen", "Burnt Stamina Regeneration Rate", 0.25f, "How quickly burnt stamina will regen while meditating."); BurntHealthRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Burnt Stat Regen", "Burnt Health Regeneration Rate", 0.25f, "How quickly burnt health will regen while meditating."); BurntManaRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Burnt Stat Regen", "Burnt Mana Regeneration Rate", 0.25f, "How quickly burnt Mana will regen while meditating."); ActiveStaminaRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Active Stat Regen", "Active Stamina Regeneration", 0.5f, "How quickly stamina will regen while meditating."); ActiveHealthRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Active Stat Regen", "Active Health Regeneration", 0.75f, "How quickly health will regen while meditating."); ActiveManaRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Active Stat Regen", "Active Mana Regeneration", 0.5f, "How quickly mana will regen while meditating."); } public void OnDestroy() { } private void OnSceneLoaded() { try { foreach (Character value in CharacterManager.Instance.Characters.Values) { if (!value.IsAI && (Object)(object)value.Inventory != (Object)null && !value.Inventory.LearnedSkill((Item)(object)MeditationSkill)) { value.Inventory.ReceiveSkillReward(((Item)MeditationSkill).ItemID); } } } catch (Exception arg) { Log.LogMessage((object)$"Exception during SkilledAtMeditation.OnSceneLoaded: {arg}"); } } private void OnPackLoaded() { try { ref Skill meditationSkill = ref MeditationSkill; Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(-46000); meditationSkill = (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); MeditationSkill.IgnoreLearnNotification = true; } catch (Exception arg) { Log.LogMessage((object)$"Exception during SkilledAtMeditation.OnPackLoaded: {arg}"); } } private void CreateStatusEffect() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown SL_StatusEffect val = new SL_StatusEffect(); val.TargetStatusIdentifier = "Burning"; val.EffectBehaviour = (EditBehaviours)2; val.StatusIdentifier = "Meditation"; val.NewStatusID = -46001; val.Name = "Resting"; val.Description = "Slowly restore stats while you rest."; ((SL_StatusBase)val).SLPackName = "com.exp111.SkilledAtMeditation"; ((SL_StatusBase)val).SubfolderName = "Meditation"; val.Lifespan = -1f; val.RefreshRate = 1f; val.DisplayedInHUD = true; val.IsMalusEffect = false; val.Purgeable = false; val.VFXInstantiationType = (FXInstantiationTypes)0; val.VFXPrefab = null; SL_EffectTransform[] array = new SL_EffectTransform[1]; SL_EffectTransform val2 = new SL_EffectTransform(); val2.TransformName = "Effects"; val2.Effects = (SL_Effect[])(object)new SL_Effect[1] { new SL_Meditation() }; array[0] = val2; val.Effects = (SL_EffectTransform[])(object)array; ((ContentTemplate)val).ApplyTemplate(); } private void CreateSkill() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown SL_Skill val = new SL_Skill(); ((SL_Item)val).Name = "Resting"; ((SL_Item)val).EffectBehaviour = (EditBehaviours)2; ((SL_Item)val).Target_ItemID = 8100120; ((SL_Item)val).New_ItemID = -46000; ((SL_Item)val).SLPackName = "com.exp111.SkilledAtMeditation"; ((SL_Item)val).SubfolderName = "Meditate"; ((SL_Item)val).Description = "Enter a Resting state, slowly regenerating your vigor and injuries. When near a lit fire, your rest is enhanced and your body begins to recover."; ((SL_Item)val).CastType = (SpellCastType)41; ((SL_Item)val).CastModifier = (SpellCastModifier)0; ((SL_Item)val).CastLocomotionEnabled = true; ((SL_Item)val).MobileCastMovementMult = -1f; SL_EffectTransform[] array = new SL_EffectTransform[1]; SL_EffectTransform val2 = new SL_EffectTransform(); val2.TransformName = "Effects"; val2.Effects = (SL_Effect[])(object)new SL_Effect[1] { (SL_Effect)new SL_AddStatusEffect { StatusEffect = "Meditation", ChanceToContract = 100, Delay = 1f } }; array[0] = val2; ((SL_Item)val).EffectTransforms = (SL_EffectTransform[])(object)array; val.Cooldown = 1f; val.StaminaCost = 0f; val.HealthCost = 0f; val.ManaCost = 0f; ((ContentTemplate)val).ApplyTemplate(); } [Conditional("DEBUG")] public static void DebugLog(string message) { Log.LogMessage((object)message); } [Conditional("TRACE")] public static void DebugTrace(string message) { Log.LogMessage((object)message); } }
BepInEx/plugins/gothiska-APP/APP.dll
Decompiled a day agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using NodeCanvas.DialogueTrees; using NodeCanvas.Framework; using SideLoader; using SideLoader.Model; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("OutwardModTemplate")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OutwardModTemplate")] [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 APP; [BepInPlugin("APP", "Advanced Picks & 'Poons", "0.9.6")] public class Plugin : BaseUnityPlugin { public const string GUID = "APP"; public const string NAME = "Advanced Picks & 'Poons"; public const string VERSION = "0.9.6"; public static ManualLogSource Log; public const int DEFPICK_ID = 2120050; public const int DEFPOON_ID = 2130130; public const int DEFSICK_ID = 2000060; public const int APICK_ID = -31000; public const int APOON_ID = -31001; public const int EPICK_ID = -31002; public const int EPOON_ID = -31003; public const int MPICK_ID = -31004; public const int MPOON_ID = -31005; public const int ASICK_ID = -31006; public const int ESICK_ID = -31007; public const int MSICK_ID = -31008; public const int APICK_DURABILITY = 350; public const int APOON_DURABILITY = 250; public const int EPICK_DURABILITY = 400; public const int EPOON_DURABILITY = 300; public const int APICK_VALUE = 40; public const int APOON_VALUE = 40; public const int EPICK_VALUE = 75; public const int EPOON_VALUE = 75; public const int ASICK_VALUE = 40; public const int ESICK_VALUE = 75; internal void Awake() { Log = ((BaseUnityPlugin)this).Logger; Log.LogMessage((object)"Advanced Picks & 'Poons 0.9.6 successfully loaded!"); SL.OnPacksLoaded += SL_OnPacksLoaded; Harmony.CreateAndPatchAll(typeof(Harmonize), (string)null); } private void SL_OnPacksLoaded() { SetUpPicks(); SetUpPoons(); SetUpSickles(); AddToolsToDictionary(); Recipes.CreateRecipes(); Recipes.CreateRecipeScrolls(); Recipes.AddRecipesToMerchants(); } private void AddToolsToDictionary() { ItemUtilities.instance.m_gatherableToolEquivalences[2120050] = ItemUtilities.instance.m_gatherableToolEquivalences[2120050].Append(-31000).ToArray(); ItemUtilities.instance.m_gatherableToolEquivalences[2120050] = ItemUtilities.instance.m_gatherableToolEquivalences[2120050].Append(-31002).ToArray(); ItemUtilities.instance.m_gatherableToolEquivalences[2130130] = ItemUtilities.instance.m_gatherableToolEquivalences[2130130].Append(-31001).ToArray(); ItemUtilities.instance.m_gatherableToolEquivalences[2130130] = ItemUtilities.instance.m_gatherableToolEquivalences[2130130].Append(-31003).ToArray(); } private void SetUpSickles() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Expected O, but got Unknown //IL_0175: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01cd: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) ((ContentTemplate)new SL_Weapon { Target_ItemID = 2000060, New_ItemID = -316, Name = "Advanced Sickle", Description = "A quality sickle used to gather items more efficiently.", StatsHolder = (SL_ItemStats)new SL_WeaponStats { BaseDamage = new List<SL_Damage> { new SL_Damage { Damage = 17f, Type = (Types)0 } }, MaxDurability = 350, BaseValue = 40 }, ItemVisuals = new SL_ItemVisual { Prefab_SLPack = "APP", Prefab_AssetBundle = "sickle-a", Prefab_Name = "sickle-a" }, SpecialItemVisuals = new SL_ItemVisual { Prefab_SLPack = "APP", Prefab_AssetBundle = "ssickle-a", Prefab_Name = "ssickle-a" }, SLPackName = "APP", SubfolderName = "AdvancedSickle" }).ApplyTemplate(); ((ContentTemplate)new SL_Weapon { Target_ItemID = 2000060, New_ItemID = -317, Name = "Expert Sickle", Description = "A quality sickle used to gather items more efficiently.", StatsHolder = (SL_ItemStats)new SL_WeaponStats { BaseDamage = new List<SL_Damage> { new SL_Damage { Damage = 20f, Type = (Types)0 } }, MaxDurability = 400, BaseValue = 75 }, ItemVisuals = new SL_ItemVisual { Prefab_SLPack = "APP", Prefab_AssetBundle = "sickle-a", Prefab_Name = "sickle-a" }, SpecialItemVisuals = new SL_ItemVisual { Prefab_SLPack = "APP", Prefab_AssetBundle = "ssickle-a", Prefab_Name = "ssickle-a" }, SLPackName = "APP", SubfolderName = "ExpertSickle" }).ApplyTemplate(); } private void SetUpPicks() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0081: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00da: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) ((ContentTemplate)new SL_MeleeWeapon { Target_ItemID = 2120050, New_ItemID = -310, Name = "Advanced Mining Pick", Description = "A mining pick of greater quality that is capable of mining more efficiently.", StatsHolder = (SL_ItemStats)new SL_WeaponStats { BaseDamage = new List<SL_Damage> { new SL_Damage { Damage = 20f, Type = (Types)0 } }, MaxDurability = 350, BaseValue = 40 }, SLPackName = "APP", SubfolderName = "AdvancedPick" }).ApplyTemplate(); ((ContentTemplate)new SL_MeleeWeapon { Target_ItemID = 2120050, New_ItemID = -312, Name = "Expert Mining Pick", Description = "A mining pick of exceptional quality that is capable of mining a great deal more efficiently.", StatsHolder = (SL_ItemStats)new SL_WeaponStats { BaseDamage = new List<SL_Damage> { new SL_Damage { Damage = 26f, Type = (Types)0 } }, MaxDurability = 400, BaseValue = 75 }, SLPackName = "APP", SubfolderName = "ExpertPick" }).ApplyTemplate(); } private void SetUpPoons() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0081: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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_00da: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) ((ContentTemplate)new SL_MeleeWeapon { Target_ItemID = 2130130, New_ItemID = -311, Name = "Advanced Fishing Harpoon", Description = "A harpoon of greater quality that is capable of fishing more effectively.", StatsHolder = (SL_ItemStats)new SL_WeaponStats { BaseDamage = new List<SL_Damage> { new SL_Damage { Damage = 20f, Type = (Types)0 } }, MaxDurability = 250, BaseValue = 40 }, SLPackName = "APP", SubfolderName = "AdvancedPoon" }).ApplyTemplate(); ((ContentTemplate)new SL_MeleeWeapon { Target_ItemID = 2130130, New_ItemID = -313, Name = "Expert Fishing Harpoon", Description = "A harpoon of exceptional quality that is capable of fishing a great deal more effectively.", StatsHolder = (SL_ItemStats)new SL_WeaponStats { BaseDamage = new List<SL_Damage> { new SL_Damage { Damage = 26f, Type = (Types)0 } }, MaxDurability = 300, BaseValue = 75 }, SLPackName = "APP", SubfolderName = "ExpertPoon" }).ApplyTemplate(); } } public class Harmonize { private static bool isMining; private static bool isFishing; private static bool isDialoguePatched; private static bool firstTime; public static Harmonize Instance { get; private set; } internal void Awake() { Instance = this; } [HarmonyPrefix] [HarmonyPatch(typeof(Gatherable), "OnGatherInteraction")] private static void GatherPatch(Character _gatherer, Gatherable __instance) { if (!firstTime) { if (isMining) { if (_gatherer.Inventory.OwnsItem(-31000) && !_gatherer.Inventory.OwnsItem(-31002)) { if (Random.Range(1, 100) < 16) { MethodInfo method = typeof(Gatherable).GetMethod("StartInit", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { method.Invoke(__instance, null); } } } else if (_gatherer.Inventory.OwnsItem(-31002) && Random.Range(1, 100) < 26) { MethodInfo method2 = typeof(Gatherable).GetMethod("StartInit", BindingFlags.Instance | BindingFlags.NonPublic); if (method2 != null) { method2.Invoke(__instance, null); } } isMining = false; return; } if (isFishing) { if (_gatherer.Inventory.OwnsItem(-31001) && !_gatherer.Inventory.OwnsItem(-31003)) { if (Random.Range(1, 100) < 16) { MethodInfo method3 = typeof(Gatherable).GetMethod("StartInit", BindingFlags.Instance | BindingFlags.NonPublic); if (method3 != null) { method3.Invoke(__instance, null); } } } else if (_gatherer.Inventory.OwnsItem(-31003) && Random.Range(1, 100) < 26) { MethodInfo method4 = typeof(Gatherable).GetMethod("StartInit", BindingFlags.Instance | BindingFlags.NonPublic); if (method4 != null) { method4.Invoke(__instance, null); } } isFishing = false; return; } new List<Item>(); if (_gatherer.Inventory.OwnsItem(-31006) && !_gatherer.Inventory.OwnsItem(-31007)) { Item obj = _gatherer.Inventory.GetOwnedItems(-31006)[0]; float num = obj.MaxDurability / 100; obj.ReduceDurability(num); if (Random.Range(1, 100) < 16) { MethodInfo method5 = typeof(Gatherable).GetMethod("StartInit", BindingFlags.Instance | BindingFlags.NonPublic); if (method5 != null) { method5.Invoke(__instance, null); } } } else { if (!_gatherer.Inventory.OwnsItem(-31007)) { return; } Item obj2 = _gatherer.Inventory.GetOwnedItems(-31007)[0]; float num2 = obj2.MaxDurability / 100; obj2.ReduceDurability(num2); if (Random.Range(1, 100) < 26) { MethodInfo method6 = typeof(Gatherable).GetMethod("StartInit", BindingFlags.Instance | BindingFlags.NonPublic); if (method6 != null) { method6.Invoke(__instance, null); } } } } else { firstTime = false; } } [HarmonyPostfix] [HarmonyPatch(typeof(CharacterInventory), "GetCompatibleGatherableTool")] private static void GetToolPatch(int _sourceToolID) { switch (_sourceToolID) { case 2120050: isMining = true; isFishing = false; break; case 2130130: isMining = false; isFishing = true; break; default: isMining = false; isFishing = false; break; } } [HarmonyPrefix] [HarmonyPatch(typeof(NPCInteraction), "OnActivate")] private static void NPCInteractionPatch(NPCInteraction __instance) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0057: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown if (__instance.DialogueActor.name == "Loud-Hammer" && !isDialoguePatched) { Graph graph = ((GraphOwner)((Component)__instance.DialogueActor).GetComponentInChildren<DialogueTreeController>()).graph; MultipleChoiceNodeExt val = graph.GetAllNodesOfType<MultipleChoiceNodeExt>()[0]; Choice item = new Choice { statement = new Statement("Is there anything else you can teach me?") }; val.availableChoices.Add(item); StatementNodeExt val2 = graph.AddNode<StatementNodeExt>(); val2.statement = new Statement("If you are interested in discovering the secrets of more efficient gathering tools, seek out other blacksmiths in far away cities!"); val2.SetActorName("Loud-Hammer"); graph.allNodes.Add((Node)(object)val2); graph.ConnectNodes((Node)(object)val, (Node)(object)val2, 6, -1); isDialoguePatched = true; } } static Harmonize() { isMining = false; isFishing = false; isDialoguePatched = false; firstTime = true; } } public class Recipes { public const string APICK_REC = "app.advpick"; public const string EPICK_REC = "app.exppick"; public const string APOON_REC = "app.advpoon"; public const string EPOON_REC = "app.expoon"; public const string MPICK_REC = "app.maspick"; public const string MPOON_REC = "app.maspoon"; public const string ASICK_REC = "app.advsick"; public const string ESICK_REC = "app.expsick"; public const string MSICK_REC = "app.massick"; public const int APICK_REC_ID = -31010; public const int APOON_REC_ID = -31011; public const int EPICK_REC_ID = -31012; public const int EPOON_REC_ID = -31013; public const int MPICK_REC_ID = -31014; public const int MPOON_REC_ID = -31015; public const int ASICK_REC_ID = -31016; public const int ESICK_REC_ID = -31017; public const int MSICK_REC_ID = -31018; public const int ADVTOOLCOST = 75; public const int EXPTOOLCOST = 125; public const int MASTOOLCOST = 200; public const string ING_MININGPICK = "2120050"; public const string ING_PALLADIUM = "6400070"; public const string ING_AMMOLITE = "6200050"; public const string ING_BEASTGOLEMSCRAPS = "6600130"; public const string ING_GOLDINGOT = "6300030"; public const string ING_AMETHYSTGEODE = "6000370"; public const string ING_CHROMIUMSHARDS = "6000340"; public const string ING_FISHINGHARPOON = "2130130"; public const string ING_BLUESAND = "6400110"; public const string ING_SHARKCARTILAGE = "6600170"; public const string ING_PETRIFIEDORGANS = "6000440"; public const string ING_DIGESTEDMANASTONE = "6000450"; public const string ING_MACHETE = "2000060"; public const string ING_WOOLSHROOM = "4000240"; public const string ING_PETRIFIEDWOOD = "6400080"; public const string ING_VOLTAICVINES = "6000410"; public const string ING_BLOODROOT = "6000400"; public static void CreateRecipes() { CreatePickRecipes(); CreatePoonRecipes(); CreateSickleRecipes(); CreateMasterRecipes(); } private static void CreatePickRecipes() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c5: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_010e: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_0198: Expected O, but got Unknown SL_Recipe val = new SL_Recipe { UID = "app.advpick", StationType = (CraftingType)2, Ingredients = new List<Ingredient> { new Ingredient { Type = (ActionTypes)1, SelectorValue = "2120050" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6400070" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6200050" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6600130" } }, Results = new List<ItemQty> { new ItemQty { ItemID = -31000, Quantity = 1 } } }; ((ContentTemplate)val).ApplyTemplate(); SL_Recipe val2 = new SL_Recipe { UID = "app.exppick", StationType = (CraftingType)2, Ingredients = new List<Ingredient> { new Ingredient { Type = (ActionTypes)1, SelectorValue = (-31000).ToString() }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6300030" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6000370" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6000350" } }, Results = new List<ItemQty> { new ItemQty { ItemID = -31002, Quantity = 1 } } }; ((ContentTemplate)val2).ApplyTemplate(); } private static void CreatePoonRecipes() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c5: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_010e: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_0198: Expected O, but got Unknown SL_Recipe val = new SL_Recipe { UID = "app.advpoon", StationType = (CraftingType)2, Ingredients = new List<Ingredient> { new Ingredient { Type = (ActionTypes)1, SelectorValue = "2130130" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6400070" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6400110" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6600170" } }, Results = new List<ItemQty> { new ItemQty { ItemID = -31001, Quantity = 1 } } }; ((ContentTemplate)val).ApplyTemplate(); SL_Recipe val2 = new SL_Recipe { UID = "app.expoon", StationType = (CraftingType)2, Ingredients = new List<Ingredient> { new Ingredient { Type = (ActionTypes)1, SelectorValue = (-31001).ToString() }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6300030" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6000440" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6000450" } }, Results = new List<ItemQty> { new ItemQty { ItemID = -31003, Quantity = 1 } } }; ((ContentTemplate)val2).ApplyTemplate(); } private static void CreateSickleRecipes() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00c5: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_010e: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_0198: Expected O, but got Unknown SL_Recipe val = new SL_Recipe { UID = "app.advsick", StationType = (CraftingType)2, Ingredients = new List<Ingredient> { new Ingredient { Type = (ActionTypes)1, SelectorValue = "2000060" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6400070" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "4000240" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6400080" } }, Results = new List<ItemQty> { new ItemQty { ItemID = -31006, Quantity = 1 } } }; ((ContentTemplate)val).ApplyTemplate(); SL_Recipe val2 = new SL_Recipe { UID = "app.expsick", StationType = (CraftingType)2, Ingredients = new List<Ingredient> { new Ingredient { Type = (ActionTypes)1, SelectorValue = (-31006).ToString() }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6300030" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6000410" }, new Ingredient { Type = (ActionTypes)1, SelectorValue = "6000400" } }, Results = new List<ItemQty> { new ItemQty { ItemID = -31007, Quantity = 1 } } }; ((ContentTemplate)val2).ApplyTemplate(); } public static void CreateMasterRecipes() { } public static void CreateRecipeScrolls() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0056: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b2: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00ea: 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_010d: Expected O, but got Unknown //IL_010e: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Expected O, but got Unknown //IL_016a: Expected O, but got Unknown //IL_0171: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01c7: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0225: Expected O, but got Unknown SL_RecipeItem val = new SL_RecipeItem { RecipeUID = "app.advpick", Target_ItemID = 5700187, New_ItemID = -31010, Name = "Crafting: Advanced Mining Pick", Description = "Schematic that teaches the user how to craft an Advanced Mining Pick", StatsHolder = new SL_ItemStats { BaseValue = 75 } }; ((ContentTemplate)val).ApplyTemplate(); SL_RecipeItem val2 = new SL_RecipeItem { RecipeUID = "app.exppick", Target_ItemID = 5700187, New_ItemID = -31012, Name = "Crafting: Expert Mining Pick", Description = "Schematic that teaches the user how to craft an Expert Mining Pick", StatsHolder = new SL_ItemStats { BaseValue = 125 } }; ((ContentTemplate)val2).ApplyTemplate(); SL_RecipeItem val3 = new SL_RecipeItem { RecipeUID = "app.advpoon", Target_ItemID = 5700187, New_ItemID = -31011, Name = "Crafting: Advanced Fishing Harpoon", Description = "Schematic that teaches the user how to craft an Advanced Fishing Harpoon", StatsHolder = new SL_ItemStats { BaseValue = 75 } }; ((ContentTemplate)val3).ApplyTemplate(); SL_RecipeItem val4 = new SL_RecipeItem { RecipeUID = "app.expoon", Target_ItemID = 5700187, New_ItemID = -31013, Name = "Crafting: Expert Fishing Harpoon", Description = "Schematic that teaches the user how to craft an Expert Fishing Harpoon", StatsHolder = new SL_ItemStats { BaseValue = 125 } }; ((ContentTemplate)val4).ApplyTemplate(); SL_RecipeItem val5 = new SL_RecipeItem { RecipeUID = "app.advsick", Target_ItemID = 5700187, New_ItemID = -31016, Name = "Crafting: Advanced Sickle", Description = "Schematic that teaches the user how to craft an Advanced Harvesting Sickle", StatsHolder = new SL_ItemStats { BaseValue = 75 } }; ((ContentTemplate)val5).ApplyTemplate(); SL_RecipeItem val6 = new SL_RecipeItem { RecipeUID = "app.expsick", Target_ItemID = 5700187, New_ItemID = -31017, Name = "Crafting: Expert Sickle", Description = "Schematic that teaches the user how to craft an Expert Harvesting Sickle", StatsHolder = new SL_ItemStats { BaseValue = 125 } }; ((ContentTemplate)val6).ApplyTemplate(); } public static void AddRecipesToMerchants() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0088: Expected O, but got Unknown //IL_008e: 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_009e: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0116: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) SL_DropTable val = new SL_DropTable { UID = "gothiska.advtools", GuaranteedDrops = new List<SL_ItemDrop> { new SL_ItemDrop { DroppedItemID = -31010, MinQty = 1, MaxQty = 1 }, new SL_ItemDrop { DroppedItemID = -31011, MinQty = 1, MaxQty = 1 }, new SL_ItemDrop { DroppedItemID = -31016, MinQty = 1, MaxQty = 1 } } }; ((ContentTemplate)val).ApplyTemplate(); SL_DropTable val2 = new SL_DropTable { UID = "gothiska.exptools", GuaranteedDrops = new List<SL_ItemDrop> { new SL_ItemDrop { DroppedItemID = -31012, MinQty = 1, MaxQty = 1 }, new SL_ItemDrop { DroppedItemID = -31013, MinQty = 1, MaxQty = 1 }, new SL_ItemDrop { DroppedItemID = -31017, MinQty = 1, MaxQty = 1 } } }; ((ContentTemplate)val2).ApplyTemplate(); ((ContentTemplate)new SL_DropTableAddition { DropTableUIDsToAdd = { val.UID } }).ApplyTemplate(); ((ContentTemplate)new SL_DropTableAddition { DropTableUIDsToAdd = { val2.UID } }).ApplyTemplate(); } }
BepInEx/plugins/IggyTheMad-AlternateStart/AlternateStart.dll
Decompiled a day 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 System.Threading; using AlternateStart.Characters; using AlternateStart.StartScenarios; using BepInEx; using HarmonyLib; using NodeCanvas.DialogueTrees; using NodeCanvas.Framework; using NodeCanvas.Tasks.Actions; using SideLoader; using SideLoader.Managers; using SideLoader.Model; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("OutwardModTemplate")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OutwardModTemplate")] [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 AlternateStart { public enum ScenarioPassives { NONE = 0, Random = -2200, Vanilla = -2201, VanillaAlt = -2202, VanillaBerg = -2203, VanillaLevant = -2204, VanillaMonsoon = -2205, VanillaHarmattan = -2206, LevantSlums = -2207, EnmerkarHunter = -2208, PriestElatt = -2209, Claustrophobic = -2210, VendavelSlave = -2211, GiantRisen = -2212, ConfluxWatcher = -2213, Veteran = -2214, WolfgangMercenary = -2215, RobbedTrader = -2216, Survivor = -2217, CorruptedSoul = -2218, ChosenOne = -2219, Unbound = -2220, Cannibal = -2221, SandBandit = -2222, Nightmare = -2223 } public enum ScenarioQuest { Quest_Test = -2300, Quest_Vanilla = -2301, Quest_VanillaAlt = -2302, Quest_VanillaBerg = -2303, Quest_VanillaLevant = -2304, Quest_VanillaMonsoon = -2305, Quest_VanillaHarmattan = -2306, Quest_LevantSlums = -2307, Quest_EmercarHunter = -2308, Quest_PriestElatt = -2309, Quest_Claustro = -2310, Quest_VendavelSlave = -2311, Quest_GiantRisen = -2312, Quest_ConfluxWatcher = -2313, Quest_Veteran = -2314, Quest_WolfgangMercenary = -2315, Quest_RobbedTrader = -2316, Quest_Survivor = -2317, Quest_CorruptedSoul = -2318, Quest_ChosenOne = -2319, Quest_Unbound = -2320, Quest_Cannibal = -2321, Quest_SandBandit = -2322 } public enum ScenarioTheme { None, Magic, Stamina, Tanky, Freeform } public enum ScenarioType { WIPtest = 0, VanillaLike = -2207, Normal = -2208, Outlaw = -2209 } 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 ExtrasManager : MonoBehaviour { public static ExtrasManager Instance; private Vector3 spawn = new Vector3(1284.4f, -3.7f, 1622.2f); private Vector3 spawnRot = new Vector3(0f, 203f, 0f); public List<Character> allPlayers; internal void Awake() { Instance = this; allPlayers = new List<Character>(); } } public static class GearManager { internal static void Init() { } public static void StartingGear() { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { Character controlledCharacter = item.ControlledCharacter; CharacterSkillKnowledge skillKnowledge = controlledCharacter.Inventory.SkillKnowledge; foreach (Scenario value in ScenarioManager.startScenarios.Values) { if (((CharacterKnowledge)skillKnowledge).IsItemLearned((int)value.Passive)) { Debug.Log((object)"adding scenario gear"); value.Gear(controlledCharacter); break; } } } } public static void RandomPassive() { } } [BepInPlugin("com.iggy.altstart", "Alternate Start", "1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { private const string GUID = "com.iggy.altstart"; private const string NAME = "Alternate Start"; private const string VERSION = "1.0"; public static Plugin Instance; public const string SL_PACK_NAME = "iggythemad AlternateStart"; public const string QUEST_EVENT_FAMILY_NAME = "A_Iggy_AlternateStart"; internal void Awake() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) Instance = this; ((BaseUnityPlugin)this).Logger.LogMessage((object)"Alternate Start Awake()"); ((Component)this).gameObject.AddComponent<ExtrasManager>(); ScenarioManager.Init(); GearManager.Init(); SL.OnPacksLoaded += SL_OnPacksLoaded; new Harmony("com.iggy.altstart").PatchAll(); } internal void OnGUI() { } private void SL_OnPacksLoaded() { TrainerManager.Init(); } internal static void Log(object log) { ((BaseUnityPlugin)Instance).Logger.LogMessage((object)(log?.ToString() ?? string.Empty)); } internal static void LogWarning(object log) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)(log?.ToString() ?? string.Empty)); } internal static void LogError(object log) { ((BaseUnityPlugin)Instance).Logger.LogError((object)(log?.ToString() ?? string.Empty)); } } public static class ScenarioManager { [HarmonyPatch(typeof(NetworkLevelLoader), "LoadLevel", new Type[] { typeof(int), typeof(int), typeof(float), typeof(bool) })] public class NetworkLevelLoader_LoadLevel { internal static void Prefix(ref int _buildIndex) { try { CharacterSave chosenSave = SplitScreenManager.Instance.LocalPlayers[0].ChosenSave; if (!((CharacterSaveData)chosenSave.PSave).NewSave && !string.IsNullOrEmpty(chosenSave.PSave.AreaName)) { return; } for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i)); if (fileNameWithoutExtension != null && fileNameWithoutExtension == "DreamWorld") { _buildIndex = i; break; } } } catch { } } } [HarmonyPatch(typeof(CharacterSkillKnowledge), "AddItem", new Type[] { typeof(Item) })] private static class CharacterSkillKnowledge_AddItem { internal static void Postfix(Item _item) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)((EffectSynchronizer)_item).OwnerCharacter == (Object)null) && ((EffectSynchronizer)_item).OwnerCharacter.IsLocalPlayer && !QuestEventManager.Instance.HasQuestEvent("iggythemad.altstart.destinyChosen") && _item.ItemID <= 0 && !(SceneManagerHelper.ActiveSceneName != "DreamWorld")) { ((EffectSynchronizer)_item).OwnerCharacter.StatusEffectMngr.AddStatusEffect("StartTag"); ((EffectSynchronizer)_item).OwnerCharacter.AutoKnock(true, Vector3.back, ((EffectSynchronizer)_item).OwnerCharacter); if ((Object)(object)CharacterManager.Instance.GetWorldHostCharacter() == (Object)(object)((EffectSynchronizer)_item).OwnerCharacter) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(CheckStartPassives(((EffectSynchronizer)_item).OwnerCharacter, _item)); } } } } [HarmonyPatch(typeof(InteractionTriggerBase), "TryActivateBasicAction", new Type[] { typeof(Character), typeof(int) })] public class InteractionTriggerBase_TryActivateBasicAction { [HarmonyPrefix] public static bool Prefix(InteractionTriggerBase __instance, Character _character, int _toggleState) { if (!_character.IsLocalPlayer || SceneManagerHelper.ActiveSceneName != "DreamWorld") { return true; } if (_character.StatusEffectMngr.HasStatusEffect("StartTag")) { return false; } return true; } } public static readonly Dictionary<ScenarioPassives, Scenario> startScenarios = new Dictionary<ScenarioPassives, Scenario>(); internal static QuestEventSignature QE_DestinyChosen; private const string QE_DESTINY_CHOSEN_UID = "iggythemad.altstart.destinyChosen"; private const string FULL_STOP_STATUS_IDENTIFIER = "fullstop"; private const string startTag = "StartTag"; internal static void Init() { QE_DestinyChosen = CustomQuests.CreateQuestEvent("iggythemad.altstart.destinyChosen", false, false, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; Type[] types = typeof(Scenario).Assembly.GetTypes(); foreach (Type type in types) { if (type.IsSubclassOf(typeof(Scenario))) { Scenario scenario = Activator.CreateInstance(type) as Scenario; scenario.Init(); startScenarios.Add(scenario.Passive, scenario); } } } private static void SL_OnGameplayResumedAfterLoading() { if (!(SceneManagerHelper.ActiveSceneName == "DreamWorld") || QuestEventManager.Instance.HasQuestEvent(QE_DestinyChosen)) { return; } foreach (Item learnedItem in ((CharacterKnowledge)CharacterManager.Instance.GetWorldHostCharacter().Inventory.SkillKnowledge).m_learnedItems) { if (Enum.IsDefined(typeof(ScenarioPassives), learnedItem.ItemID)) { Debug.Log((object)"HAS START SCENARIO"); return; } } foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { item.ControlledCharacter.Inventory.RemoveMoney(27, true); } ((MonoBehaviour)Plugin.Instance).StartCoroutine(DreamworldStopper()); } private static IEnumerator DreamworldStopper() { yield return (object)new WaitForSeconds(0.2f); Vector3 spawn = new Vector3(-12.2f, 0.2f, -0.6f); Vector3 spawnRot = new Vector3(0f, 75.2f, 0f); while (SceneManagerHelper.ActiveSceneName == "DreamWorld") { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (item.IsLocalPlayer && Vector3.Distance(((Component)item.ControlledCharacter).transform.position, spawn) > 3f) { item.ControlledCharacter.Teleport(spawn, spawnRot); } } yield return (object)new WaitForSeconds(0.5f); } } internal static void SetFullStop(bool add) { if (PhotonNetwork.isNonMasterClientInRoom) { return; } foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (add) { item.ControlledCharacter.StatusEffectMngr.AddStatusEffect("fullstop"); } else { item.ControlledCharacter.StatusEffectMngr.RemoveStatusWithIdentifierName("fullstop"); } } } private static IEnumerator CheckStartPassives(Character character, Item _item) { yield return (object)new WaitForSeconds(0.2f); List<Character> characterList = new List<Character>(); while (true) { LobbySystem lobby = Global.Lobby; if (((lobby != null) ? lobby.PlayersInLobby : null) == null) { yield return null; continue; } break; } while (characterList.Count < Global.Lobby.PlayersInLobby.Count) { yield return (object)new WaitForSeconds(1f); foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (item.ControlledCharacter.StatusEffectMngr.HasStatusEffect("StartTag") && !characterList.Contains(item.ControlledCharacter)) { characterList.Add(item.ControlledCharacter); } } } if (((CharacterKnowledge)character.Inventory.SkillKnowledge).IsItemLearned(-2200)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(PickAndStartScenario()); } else if (IsAnyChosen<ScenarioPassives>(character)) { ScenarioPassives itemID = (ScenarioPassives)_item.ItemID; ((MonoBehaviour)Plugin.Instance).StartCoroutine(startScenarios[itemID].StartScenario()); } foreach (PlayerSystem item2 in Global.Lobby.PlayersInLobby) { if (item2.ControlledCharacter.StatusEffectMngr.HasStatusEffect("StartTag")) { item2.ControlledCharacter.StatusEffectMngr.RemoveStatusWithIdentifierName("StartTag"); } } } private static bool IsAnyChosen<T>(Character character) where T : Enum { T choice; return TryGetChoice<T>(character, out choice); } private static bool TryGetChoice<T>(Character character, out T choice) where T : Enum { foreach (object value in Enum.GetValues(typeof(T))) { if (((CharacterKnowledge)character.Inventory.SkillKnowledge).IsItemLearned((int)value)) { choice = (T)value; return true; } } choice = default(T); return false; } private static IEnumerator PickAndStartScenario() { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); _ = worldHostCharacter.Inventory.SkillKnowledge; TryGetChoice<ScenarioPassives>(worldHostCharacter, out var choice); List<Scenario> list = new List<Scenario>(); foreach (Scenario value in startScenarios.Values) { if (value.Difficulty != 0 && value.Difficulty != ScenarioType.Outlaw) { list.Add(value); } } if (!list.Any()) { CharacterManager.Instance.GetWorldHostCharacter().CharacterUI.NotificationPanel.ShowNotification($"Sorry, there are no {choice} scenarios!"); yield break; } Plugin.Log("Eligable scenarios: " + string.Join(",", list.Select((Scenario it) => it.GetType().Name))); Scenario scenario = list[Random.Range(0, list.Count)]; Plugin.Log("Chosen scenario: " + scenario.GetType().Name); ((MonoBehaviour)Plugin.Instance).StartCoroutine(scenario.StartScenario()); foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (((CharacterKnowledge)item.ControlledCharacter.Inventory.SkillKnowledge).IsItemLearned(-2200)) { if ((Object)(object)worldHostCharacter == (Object)(object)item.ControlledCharacter) { item.ControlledCharacter.Inventory.ReceiveSkillReward((int)scenario.Passive); continue; } Scenario scenario2 = list[Random.Range(0, list.Count)]; item.ControlledCharacter.Inventory.ReceiveSkillReward((int)scenario2.Passive); } } } } public static class TrainerManager { internal static SL_Character bergSpellblade; private static SLPack pack; public static void Init() { pack = SL.GetSLPack("iggythemad AlternateStart"); bergSpellblade = pack.CharacterTemplates["com.iggy.berg.spellblade.trainer"]; bergSpellblade.OnSpawn += SpellbladeSetup; SL.OnGameplayResumedAfterLoading += spawnSpellblade; } private static void spawnSpellblade() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (SceneManagerHelper.ActiveSceneName == "Berg" && CharacterManager.Instance.GetWorldHostCharacter().IsLocalPlayer && QuestEventManager.Instance.HasQuestEvent(QuestEventDictionary.GetQuestEvent("lDHL_XMS7kKEs0uOqrLQjw"))) { Vector3 trainerPos = default(Vector3); ((Vector3)(ref trainerPos))..ctor(1284.4f, -3.7f, 1622.2f); Vector3 trainerRot = default(Vector3); ((Vector3)(ref trainerRot))..ctor(0f, 203f, 0f); SpawnCharacter("com.iggy.berg.spellblade.trainer", trainerPos, trainerRot); } } public static Character SpawnCharacter(string trainerID, Vector3 trainerPos, Vector3 trainerRot) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) return pack.CharacterTemplates[trainerID].Spawn(trainerPos, trainerRot, UID.op_Implicit(UID.Generate()), (string)null); } public static void SpellbladeSetup(Character trainer, string _) { GenericTrainerSetup(trainer, bergSpellblade, "com.iggy.bergspellblade", "You are alive! It's good to see a familiar face.", "What can you teach me?", "What happened to Cierzo?", "What should I do now?", "The Vendavel Scum. We were not prepared for an attack. I tried to fight back, but it was too late.", "Move on. Join a faction. Rissa is here, but you are free to do as you like."); } public static void GenericTrainerSetup(Character trainer, SL_Character currentCharacter, string treeUID, string introDialogue, string ask1, string ask2, string ask3, string reply2, string reply3) { //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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00b9: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00dc: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_00ff: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: 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 = ask1 } }); val2.availableChoices.Add(new Choice { statement = new Statement { text = ask2 } }); val2.availableChoices.Add(new Choice { statement = new Statement { text = ask3 } }); 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 = graph.AddNode<StatementNodeExt>(); val4.statement = new Statement(reply2); val4.SetActorName(componentInChildren.name); StatementNodeExt val5 = graph.AddNode<StatementNodeExt>(); val5.statement = new Statement(reply3); val5.SetActorName(componentInChildren.name); graph.allNodes.Clear(); graph.allNodes.Add((Node)(object)val); graph.allNodes.Add((Node)(object)val2); graph.allNodes.Add((Node)(object)val3); graph.allNodes.Add((Node)(object)val4); graph.allNodes.Add((Node)(object)val5); 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); graph.ConnectNodes((Node)(object)val2, (Node)(object)val4, 1, -1); graph.ConnectNodes((Node)(object)val4, (Node)(object)val, -1, -1); graph.ConnectNodes((Node)(object)val2, (Node)(object)val5, 2, -1); graph.ConnectNodes((Node)(object)val5, (Node)(object)val, -1, -1); ((Component)trainer).gameObject.SetActive(true); } } public static class VanillaQuestsHelper { public const int lookingToTheFutureQ = 7011002; public const int callToAdventureQ = 7011001; public const int enrollmentQ = 7011400; public const string playerInCierzo = "sm812Cio9ki5ssbsiPr3Fw"; public const string tutorialIntroFinished = "HteYicnCK0atCgd4j5TV1Q"; public const string introPlayerHouse = "z23QoIdtkU6cUPoUOfDn6w"; public const string grandmother = "YQD53MKgwke6juWiSWI7jQ"; public const string rissaBegExtension = "nt9KhXoJtkOalZ-wtfueDA"; public const string rissaTalk = "n_3w-BcFfEW52Ht4Q3ZCjw"; public const string debtPAID = "8GvHUbDz90OOJWurd-RZlg"; public const string callToAdventureENDa = "g3EX5w1mwUaYW1o0cpj0SQ"; public const string notLighthouseOwner = "-Ku9dHjTl0KeUPxWk0ZWWQ"; public const string lostLightHouse = "qPEx275DTUSPbnv-PnFn7w"; public const string debtNOTpaid = "sAc2Dj-T_kysKXFV48Hp0A"; public const string callToAdventureENDb = "8iAJYhhqj02ODuwZ9VvXMw"; public const string bergHouse = "g403vlCU6EG0s1mI6t_rFA"; public const string harmattanHouse = "0r087PIxTUqoj6N7z2HFNw"; public const string levantHouse = "LpVUuoxfhkaWOgh6XLbarA"; public const string monsoonHouse = "shhCMFa-lUqbIYS9hRcsdg"; public const int vendavelQ = 7011004; public const string cierzoDestroy = "lDHL_XMS7kKEs0uOqrLQjw"; public const string cierzoWarning = "-vFSY-MNoUuLH1XXBkcqvQ"; public const string cierzoTimer = "bm3rB3abI0KFok2x5P0lrg"; public const string cierzoFail = "WvGjemEntk6quLjy4rLrJQ"; public const string factionCommit = "bjVloYMQxk6KXx0gph2A1Q"; public const string directionRISA = "seEIFfM9SkeZxc4CpR40oQ"; public const string directionOLIELE = "Bo4-Xvq4_kudPDnOgkI3VA"; public const string directionYSAN = "gAJAjuzl7ESFpMooq1oOCg"; public const string olieleMonsoon = "3_soGcNagk-KcYSeqpEgMg"; public const string yzanLevant = "BgpOoGQF10O7IQyiB9HODw"; public const string rissaBerg = "1a6Zs9A_gEmScBetAraQaw"; public const string readyToChoose = "jNfNsLGBpk2iMRts9kkerw"; public const string BCproposition = "fo2uI7yiw0WSRE7MsbYFyw"; public const string HKproposition = "JlFMC_51RUalSa8yLkhTmg"; public const string HMproposition = "JqL0_JD55US2gL0-GbOBow"; public const string argensonMet = "QMe_j2TIWEKpssXkLHMMZA"; public const string argensonStash = "h8jI-dDsfkStb3XkCjqMPw"; public const string YzanFriendship = "nr9KDCbQzUae1Gwf-6yOIQ"; public const string callAdventureExpired = "zoKR1_bqiUiAetJ3uxw-Ug"; public const string callAdventureCompleted = "ZYzrMi1skUiJ4BgXXQ3sfw"; public const string ashAllyFail = "nDy01eTHlUa_BPDlbIhZPQ"; public const string ashCompleteFail = "f1JVZyhg2UiBA8xmC-w6Hw"; public const string ashFight = "XqlcpbTJC0aTDZfjD4xCTg"; public const string ashWarp = "oGkuUgWvfkej_El-rhz2gw"; internal static void SkipHostToFactionChoice(bool keepHouse, bool complete) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); worldHostCharacter.Inventory.QuestKnowledge.ReceiveQuest(7011001); worldHostCharacter.Inventory.QuestKnowledge.ReceiveQuest(7011002); ((MonoBehaviour)Plugin.Instance).StartCoroutine(AddPrefactionEvents(keepHouse, complete)); } internal static void DestroyCierzo(bool instant, bool receiveQ) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); AddQuestEvent("-vFSY-MNoUuLH1XXBkcqvQ"); AddQuestEvent("bm3rB3abI0KFok2x5P0lrg"); if (receiveQ) { worldHostCharacter.Inventory.QuestKnowledge.ReceiveQuest(7011004); } if (instant) { AddQuestEvent("lDHL_XMS7kKEs0uOqrLQjw"); AddQuestEvent("WvGjemEntk6quLjy4rLrJQ"); } } internal static void AddQuestEvent(string questUID) { QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent(questUID), 1); } internal static void RemoveEvent(string questUID) { QuestEventManager.Instance.RemoveEvent(questUID, true); } internal static IEnumerator AddPrefactionEvents(bool keepHouse, bool complete) { Character host = CharacterManager.Instance.GetWorldHostCharacter(); yield return (object)new WaitForSeconds(0.1f); AddQuestEvent("sm812Cio9ki5ssbsiPr3Fw"); AddQuestEvent("HteYicnCK0atCgd4j5TV1Q"); AddQuestEvent("z23QoIdtkU6cUPoUOfDn6w"); AddQuestEvent("nt9KhXoJtkOalZ-wtfueDA"); AddQuestEvent("YQD53MKgwke6juWiSWI7jQ"); AddQuestEvent("n_3w-BcFfEW52Ht4Q3ZCjw"); if (keepHouse) { AddQuestEvent("8GvHUbDz90OOJWurd-RZlg"); AddQuestEvent("g3EX5w1mwUaYW1o0cpj0SQ"); } else { AddQuestEvent("-Ku9dHjTl0KeUPxWk0ZWWQ"); AddQuestEvent("qPEx275DTUSPbnv-PnFn7w"); AddQuestEvent("sAc2Dj-T_kysKXFV48Hp0A"); AddQuestEvent("8iAJYhhqj02ODuwZ9VvXMw"); } AddQuestEvent("seEIFfM9SkeZxc4CpR40oQ"); AddQuestEvent("jNfNsLGBpk2iMRts9kkerw"); AddQuestEvent("3_soGcNagk-KcYSeqpEgMg"); AddQuestEvent("Bo4-Xvq4_kudPDnOgkI3VA"); AddQuestEvent("JqL0_JD55US2gL0-GbOBow"); AddQuestEvent("JlFMC_51RUalSa8yLkhTmg"); AddQuestEvent("BgpOoGQF10O7IQyiB9HODw"); AddQuestEvent("gAJAjuzl7ESFpMooq1oOCg"); AddQuestEvent("QMe_j2TIWEKpssXkLHMMZA"); AddQuestEvent("h8jI-dDsfkStb3XkCjqMPw"); AddQuestEvent("nr9KDCbQzUae1Gwf-6yOIQ"); AddQuestEvent("zoKR1_bqiUiAetJ3uxw-Ug"); AddQuestEvent("ZYzrMi1skUiJ4BgXXQ3sfw"); if (complete) { AddQuestEvent("fo2uI7yiw0WSRE7MsbYFyw"); AddQuestEvent("1a6Zs9A_gEmScBetAraQaw"); host.Inventory.QuestKnowledge.ReceiveQuest(7011400); } } internal static void StartHouseTimer() { CharacterManager.Instance.GetWorldHostCharacter().Inventory.QuestKnowledge.ReceiveQuest(7011001); ((MonoBehaviour)Plugin.Instance).StartCoroutine(AddHouseTimerEvents()); } private static IEnumerator AddHouseTimerEvents() { yield return (object)new WaitForSeconds(0.5f); AddQuestEvent("sm812Cio9ki5ssbsiPr3Fw"); AddQuestEvent("HteYicnCK0atCgd4j5TV1Q"); AddQuestEvent("z23QoIdtkU6cUPoUOfDn6w"); AddQuestEvent("n_3w-BcFfEW52Ht4Q3ZCjw"); AddQuestEvent("zoKR1_bqiUiAetJ3uxw-Ug"); } } } namespace AlternateStart.StartScenarios { public class ChosenOneScenario : Scenario { [HarmonyPatch(typeof(PlayerCharacterStats), "get_RemainingBreakthrough")] private class PlayerCharacterStats_RemainingBreakthrough { public static bool Prefix(ref int __result, PlayerCharacterStats __instance) { if (((CharacterStats)__instance).m_character.IsLocalPlayer && ((CharacterKnowledge)((CharacterStats)__instance).m_character.Inventory.SkillKnowledge).IsItemLearned(-2219)) { __result = Mathf.Clamp(maxBreakthroughs - __instance.m_usedBreakthroughCount, 0, 20); return false; } return true; } } [HarmonyPatch(typeof(SkillUnlockRequirementDisplay), "RefreshDisplay", new Type[] { typeof(SkillTreeSlotDisplay) })] public class SkillUnlockRequirementDisplay_RefreshDisplay { [HarmonyPostfix] public static void Postfix(SkillUnlockRequirementDisplay __instance, SkillTreeSlotDisplay _display) { if (!((Object)(object)_display == (Object)null) && ((UIElement)_display).LocalCharacter.IsLocalPlayer && ((CharacterKnowledge)((UIElement)_display).LocalCharacter.Inventory.SkillKnowledge).IsItemLearned(-2219)) { if (!StoredCosts.Keys.Contains(((Item)_display.FocusedSkillSlot.Skill).ItemID)) { StoredCosts.Add(((Item)_display.FocusedSkillSlot.Skill).ItemID, _display.FocusedSkillSlot.RequiredMoney); } StoredCosts.TryGetValue(((Item)_display.FocusedSkillSlot.Skill).ItemID, out var value); value = (int)Math.Round((float)value * 1.25f); _display.FocusedSkillSlot.m_requiredMoney = value; } } } private const string LogSignature_A = "chosen.objective.a"; private const string LogSignature_B = "chosen.objective.b"; private const string LogSignature_C = "chosen.objective.c"; private QuestEventSignature QE_FixedLimitlessStart; private static int maxBreakthroughs = 4; public static Dictionary<int, int> StoredCosts = new Dictionary<int, int>(); public override ScenarioQuest Type => ScenarioQuest.Quest_ChosenOne; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.ChosenOne; public override AreaEnum SpawnScene => (AreaEnum)101; public override Vector3 SpawnPosition => new Vector3(865.8f, 212.7f, 880.1f); public override Vector3 SpawnRotation => new Vector3(0f, 225.7f, 0f); public override bool HasQuest => true; public override string QuestName => "Angelic Descend"; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "chosen.objective.a", "Visit any city. Learn about the factions and their conflicts. Save Aurai." }, { "chosen.objective.b", "You've learned about the factions." }, { "chosen.objective.c", "You are ready to join a faction." } }; public override void Gear(Character character) { character.Inventory.ReceiveItemReward(4100550, 5, false); character.Inventory.ReceiveItemReward(3000009, 1, true); character.Inventory.ReceiveItemReward(3000002, 1, true); character.Inventory.ReceiveItemReward(2010050, 1, false); character.Inventory.ReceiveItemReward(5100500, 1, true); character.Inventory.ReceiveItemReward(5300040, 1, true); } public override void Init() { base.Init(); QE_FixedLimitlessStart = CustomQuests.CreateQuestEvent("iggythemad.chosenone.fixedstart", false, true, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } private void SL_OnGameplayResumedAfterLoading() { if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } } public override void UpdateQuestProgress(Quest quest) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { CharacterManager.Instance.GetWorldHostCharacter(); int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedLimitlessStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_FixedLimitlessStart, 1); eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedLimitlessStart.EventUID); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("chosen.objective.a")), displayTime: true); ShowUIMessage("The world needs me. I should find about the troubles of Aurai..."); } else if (eventCurrentStack < 2 && AreaManager.Instance.GetIsCurrentAreaTownOrCity()) { QuestEventManager.Instance.AddEvent(QE_FixedLimitlessStart, 2); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("chosen.objective.b")), displayTime: true); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("chosen.objective.c")), displayTime: true); questProgress.DisableQuest((ProgressState)3); VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); ShowUIMessage("Time to learn about the people of Aurai. I will join them!"); } } } public override void OnScenarioChosen() { } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { GetOrGiveQuestToHost(); } public override void OnStartSpawn(Character character) { character.SpellCastAnim((SpellCastType)41, (SpellCastModifier)0, 0); } } public class ClaustroScenario : Scenario { [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)___m_character == (Object)null) && ___m_character.IsLocalPlayer && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2210)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.checkHelmet(val)); } } } [HarmonyPatch(typeof(CharacterInventory), "TakeItem", new Type[] { typeof(Item), typeof(bool) })] public class CharacterInventory_TakeItem { [HarmonyPrefix] public static void Prefix(CharacterInventory __instance, Item takenItem, ref bool _tryToEquip, ref Character ___m_character) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) Character val = ___m_character; if (!((Object)(object)val == (Object)null) && val.IsLocalPlayer) { Equipment val2 = (Equipment)(object)((!(takenItem is Equipment)) ? null : ((takenItem is Equipment) ? takenItem : null)); if (((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2210) && val2 != null && (int)val2.EquipSlot == 0) { _tryToEquip = false; } } } } [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)___m_character == (Object)null) && ___m_character.IsLocalPlayer && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2210)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.checkHelmet(val)); } } } [HarmonyPatch(typeof(CharacterKnowledge), "AddItem")] public class CharacterKnowledge_AddItem { [HarmonyPrefix] public static void Prefix(CharacterKnowledge __instance, Item _item, ref Character ___m_character) { Character val = ___m_character; if (!((Object)(object)val == (Object)null) && val.IsLocalPlayer && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2210)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.checkHelmet(val)); } } } private const string LogSignature_A = "claustro.objective.a"; private const string LogSignature_B = "claustro.objective.b"; private const string LogSignature_C = "claustro.objective.c"; private QuestEventSignature QE_FixedClaustroStart; private string claustroEffectID = "claustroEffect"; public override ScenarioQuest Type => ScenarioQuest.Quest_Claustro; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.Claustrophobic; public override AreaEnum SpawnScene => (AreaEnum)550; public override Vector3 SpawnPosition => new Vector3(1499.7f, -8.9f, 54.7f); public override Vector3 SpawnRotation => new Vector3(0f, 99.8f, 0f); public override bool HasQuest => true; public override string QuestName => "Kidnap Miracle"; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "claustro.objective.a", "Escape before your kidnappers return." }, { "claustro.objective.b", "Reach somewhere safe. A city perhaps." }, { "claustro.objective.c", "You are ready to join a faction." } }; internal static ClaustroScenario Instance { get; private set; } public override void Gear(Character character) { character.Stats.FullStamina(); character.Inventory.ReceiveItemReward(3000081, 1, true); character.Inventory.ReceiveItemReward(3000083, 1, true); character.Inventory.ReceiveItemReward(3000086, 1, true); } public override void Init() { base.Init(); QE_FixedClaustroStart = CustomQuests.CreateQuestEvent("iggythemad.claustro.fixedstart", false, true, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } private void SL_OnGameplayResumedAfterLoading() { if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } } public override void UpdateQuestProgress(Quest quest) { //IL_006e: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.isNonMasterClientInRoom || !base.IsActiveScenario) { return; } int num = 3; int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedClaustroStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack >= num) { questProgress.DisableQuest((ProgressState)3); return; } if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_FixedClaustroStart, 1); eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedClaustroStart.EventUID); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("claustro.objective.a")), displayTime: true); ShowUIMessage("Something happened... this is my chance to escape."); } else if (eventCurrentStack < 2) { QuestEventManager.Instance.AddEvent(QE_FixedClaustroStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("claustro.objective.b")), displayTime: false); ShowUIMessage("I should go somewhere safe..."); } if (eventCurrentStack < 3 && AreaManager.Instance.GetIsCurrentAreaTownOrCity()) { QuestEventManager.Instance.AddEvent(QE_FixedClaustroStart, 2); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("claustro.objective.b")), displayTime: true); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("claustro.objective.c")), displayTime: true); questProgress.DisableQuest((ProgressState)3); VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); ShowUIMessage("It would be safer to join a faction..."); } 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 override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { GetOrGiveQuestToHost(); } public override void OnStartSpawn(Character character) { } public ClaustroScenario() { Instance = this; } private IEnumerator checkHelmet(Character player) { player.StatusEffectMngr.RemoveStatusWithIdentifierName(claustroEffectID); yield return (object)new WaitForSeconds(0.5f); player.StatusEffectMngr.AddStatusEffect(claustroEffectID); } } public class ConfluxWatcherScenario : Scenario { private const string LogSignature_A = "watcher.objective.a"; private const string LogSignature_B = "watcher.objective.b"; private const string LogSignature_C = "watcher.objective.c"; private QuestEventSignature QE_FixedWatcherStart; public override ScenarioQuest Type => ScenarioQuest.Quest_ConfluxWatcher; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.ConfluxWatcher; public override AreaEnum SpawnScene => (AreaEnum)106; public override Vector3 SpawnPosition => new Vector3(-435.2f, -19.1f, -96.5f); public override Vector3 SpawnRotation => new Vector3(0f, 172.4f, 0f); public override bool HasQuest => true; public override string QuestName => "Thy watch has ended"; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "watcher.objective.a", "Get out into the world." }, { "watcher.objective.b", "Visit the nearby village of Cierzo." }, { "watcher.objective.c", "You are again part of the world." } }; public override void Gear(Character character) { character.Inventory.ReceiveSkillReward(8200040); character.Inventory.ReceiveSkillReward(8100220); character.Inventory.ReceiveSkillReward(8100230); character.Stats.SetManaPoint(3); character.Inventory.ReceiveItemReward(3000134, 1, true); character.Inventory.ReceiveItemReward(3000131, 1, true); character.Inventory.ReceiveItemReward(3000136, 1, true); character.Inventory.ReceiveItemReward(5100500, 1, true); } public override void Init() { base.Init(); QE_FixedWatcherStart = CustomQuests.CreateQuestEvent("iggythemad.watcher.fixedstart", false, true, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } private void SL_OnGameplayResumedAfterLoading() { if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } } public override void UpdateQuestProgress(Quest quest) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.isNonMasterClientInRoom || !base.IsActiveScenario) { return; } int num = 3; int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedWatcherStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack >= num) { questProgress.DisableQuest((ProgressState)3); return; } if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_FixedWatcherStart, 1); eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedWatcherStart.EventUID); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("watcher.objective.a")), displayTime: true); ShowUIMessage("My watch is over. The world might need me."); } else if (eventCurrentStack < 2 && SceneManagerHelper.ActiveSceneName == "ChersoneseNewTerrain") { QuestEventManager.Instance.AddEvent(QE_FixedWatcherStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("watcher.objective.b")), displayTime: false); ShowUIMessage("There used to be a village nearby...Cierzo, is it?"); } if (eventCurrentStack < 3 && SceneManagerHelper.ActiveSceneName == "CierzoNewTerrain") { QuestEventManager.Instance.AddEvent(QE_FixedWatcherStart, 2); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("watcher.objective.b")), displayTime: true); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("watcher.objective.c")), displayTime: true); questProgress.DisableQuest((ProgressState)3); VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: false); ShowUIMessage("I should ask around..."); } 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 override void OnScenarioChosen() { } public override void OnStartSpawn() { GetOrGiveQuestToHost(); } public override void OnStartSpawn(Character character) { } public override void OnScenarioChosen(Character character) { } } public class CorruptedScenario : Scenario { private const string LogSignature_A = "corrupted.objective.a"; private const string LogSignature_B = "corrupted.objective.b"; private const string LogSignature_C = "corrupted.objective.c"; private QuestEventSignature QE_FixedCorruptedStart; public override ScenarioQuest Type => ScenarioQuest.Quest_CorruptedSoul; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.CorruptedSoul; public override AreaEnum SpawnScene => (AreaEnum)108; public override Vector3 SpawnPosition => new Vector3(-37.3f, -7f, -126.4f); public override Vector3 SpawnRotation => new Vector3(0f, 222.9f, 0f); public override bool HasQuest => true; public override string QuestName => "Corruption Reborn"; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "corrupted.objective.a", "Whatever happend to you. Find a way out. " }, { "corrupted.objective.b", "Head to a nearby settlement" }, { "corrupted.objective.c", "You are ready to join a faction." } }; internal static CorruptedScenario Instance { get; private set; } public override void Gear(Character character) { character.Inventory.ReceiveItemReward(3000044, 1, true); character.Inventory.ReceiveItemReward(3000046, 1, true); character.Inventory.ReceiveItemReward(2150001, 1, false); character.Inventory.ReceiveItemReward(5100060, 1, true); character.Inventory.ReceiveSkillReward(8201029); character.Stats.SetManaPoint(2); character.Inventory.ReceiveSkillReward(8200040); character.Inventory.ReceiveItemReward(6400130, 5, true); character.Inventory.ReceiveItemReward(4400010, 5, true); } public override void Init() { base.Init(); QE_FixedCorruptedStart = CustomQuests.CreateQuestEvent("iggythemad.corrupted.fixedstart", false, true, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } private void SL_OnGameplayResumedAfterLoading() { foreach (Character value in CharacterManager.Instance.Characters.Values) { if (value.IsLocalPlayer && ((CharacterKnowledge)value.Inventory.SkillKnowledge).IsItemLearned(-2218) && value.PlayerStats.Corruption < 0f) { value.PlayerStats.AffectCorruptionLevel(0f, false); } } Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } public override void UpdateQuestProgress(Quest quest) { //IL_006e: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.isNonMasterClientInRoom || !base.IsActiveScenario) { return; } int num = 3; int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedCorruptedStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack >= num) { questProgress.DisableQuest((ProgressState)3); return; } if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_FixedCorruptedStart, 1); eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedCorruptedStart.EventUID); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("corrupted.objective.a")), displayTime: true); ShowUIMessage("What... Where am I?"); } else if (eventCurrentStack < 2) { QuestEventManager.Instance.AddEvent(QE_FixedCorruptedStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("corrupted.objective.b")), displayTime: false); ShowUIMessage("I should find others... Living, preferably."); } if (eventCurrentStack < 3 && AreaManager.Instance.GetIsCurrentAreaTownOrCity()) { QuestEventManager.Instance.AddEvent(QE_FixedCorruptedStart, 2); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("corrupted.objective.b")), displayTime: true); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("corrupted.objective.c")), displayTime: true); questProgress.DisableQuest((ProgressState)3); VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); ShowUIMessage("I'm somehow back to life. I should do something with it."); } 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 override void OnScenarioChosen() { } public override void OnStartSpawn() { GetOrGiveQuestToHost(); } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn(Character character) { } public CorruptedScenario() { Instance = this; } } public class EnmerkarHunterScenario : Scenario { [HarmonyPatch(typeof(LocalCharacterControl), "DetectMovementInputs")] public class LocalCharacterControl_DetectMovementInputs { [HarmonyPostfix] public static void Postfix(LocalCharacterControl __instance, ref Character ___m_character) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null) && ((CharacterControl)__instance).Character.IsLocalPlayer && ((CharacterKnowledge)((CharacterControl)__instance).Character.Inventory.SkillKnowledge).IsItemLearned(-2208) && ((CharacterControl)__instance).Character.CurrentlyChargingAttack) { ((CharacterControl)__instance).m_moveInput = ((CharacterControl)__instance).m_moveInput * new Vector2(0.3f, 0.3f); __instance.m_modifMoveInput = Vector2.op_Implicit(Vector2.op_Implicit(__instance.m_modifMoveInput) * new Vector2(0.6f, 0.6f)); ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.checkBowDraw(((CharacterControl)__instance).Character)); } } } [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 && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2208)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.checkBow(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 && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2208)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.checkBow(val)); } } } [HarmonyPatch(typeof(CharacterKnowledge), "AddItem")] public class CharacterKnowledge_AddItem { [HarmonyPrefix] public static void Prefix(CharacterKnowledge __instance, Item _item, ref Character ___m_character) { Character val = ___m_character; if (!((Object)(object)val == (Object)null) && val.IsLocalPlayer && ((CharacterKnowledge)val.Inventory.SkillKnowledge).IsItemLearned(-2208)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.checkBow(val)); } } } private const string LogSignature_A = "hunter.objective.a"; private const string LogSignature_B = "hunter.objective.b"; private const string LogSignature_C = "hunter.objective.c"; private QuestEventSignature QE_FixedHunterStart; private string bowmanEffect = "bowmanEffect"; public override ScenarioQuest Type => ScenarioQuest.Quest_EmercarHunter; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.EnmerkarHunter; public override AreaEnum SpawnScene => (AreaEnum)550; public override Vector3 SpawnPosition => new Vector3(600.6f, 0.8f, 8.1f); public override Vector3 SpawnRotation => new Vector3(0f, 29.3f, 0f); public override bool HasQuest => true; public override string QuestName => "A Good Hunt"; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "hunter.objective.a", "Leave your hut." }, { "hunter.objective.b", "Go to any city to sell your goods." }, { "hunter.objective.c", "You are ready to join a faction." } }; internal static EnmerkarHunterScenario Instance { get; private set; } public override void Gear(Character character) { character.Inventory.ReceiveItemReward(9000010, 13, false); character.Inventory.ReceiveItemReward(3000020, 1, true); character.Inventory.ReceiveItemReward(3000022, 1, true); character.Inventory.ReceiveItemReward(2200000, 1, false); character.Inventory.ReceiveItemReward(5200001, 30, true); character.Inventory.ReceiveItemReward(4000060, 4, false); } public override void Init() { base.Init(); QE_FixedHunterStart = CustomQuests.CreateQuestEvent("iggythemad.hunter.fixedstart", false, true, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } private void SL_OnGameplayResumedAfterLoading() { if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } } public override void UpdateQuestProgress(Quest quest) { //IL_006e: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.isNonMasterClientInRoom || !base.IsActiveScenario) { return; } int num = 3; int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedHunterStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack >= num) { questProgress.DisableQuest((ProgressState)3); return; } if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_FixedHunterStart, 1); eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedHunterStart.EventUID); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("hunter.objective.a")), displayTime: true); ShowUIMessage("Today's was a good hunt..."); } else if (eventCurrentStack < 2) { QuestEventManager.Instance.AddEvent(QE_FixedHunterStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("hunter.objective.b")), displayTime: false); ShowUIMessage("I should sell my goods in the city..."); } if (eventCurrentStack < 3 && AreaManager.Instance.GetIsCurrentAreaTownOrCity()) { QuestEventManager.Instance.AddEvent(QE_FixedHunterStart, 2); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("hunter.objective.b")), displayTime: true); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("hunter.objective.c")), displayTime: true); questProgress.DisableQuest((ProgressState)3); VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); ShowUIMessage("Huh... Should I join a faction?"); } 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 override void OnScenarioChosen() { } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { GetOrGiveQuestToHost(); } public override void OnStartSpawn(Character character) { character.Inventory.ReceiveSkillReward(8205160); } public EnmerkarHunterScenario() { Instance = this; } private IEnumerator checkBowDraw(Character player) { player.Animator.speed = 2.2f; while (player.CurrentlyChargingAttack) { yield return (object)new WaitForSeconds(0.1f); } player.Animator.speed = 1f; } private IEnumerator checkBow(Character player) { player.StatusEffectMngr.RemoveStatusWithIdentifierName(bowmanEffect); yield return (object)new WaitForSeconds(0.5f); if ((int)player.CurrentWeapon.Type != 200) { player.StatusEffectMngr.AddStatusEffect(bowmanEffect); } } } public class GiantRisenScenario : Scenario { [HarmonyPatch(typeof(Character), "DodgeInput", new Type[] { typeof(Vector3) })] public class Character_DodgeInput { [HarmonyPostfix] public static void Postfix(Character __instance, Vector3 _direction) { if (__instance.IsLocalPlayer && ((CharacterKnowledge)__instance.Inventory.SkillKnowledge).IsItemLearned(-2212) && !__instance.DodgeRestricted) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.DodgeSlower(__instance)); } } } private const string LogSignature_A = "giant.objective.a"; private const string LogSignature_B = "giant.objective.b"; private const string LogSignature_C = "giant.objective.c"; private QuestEventSignature QE_FixedGiantRisenStart; public override ScenarioQuest Type => ScenarioQuest.Quest_GiantRisen; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.GiantRisen; public override AreaEnum SpawnScene => (AreaEnum)203; public override Vector3 SpawnPosition => default(Vector3); public override bool HasQuest => true; public override string QuestName => "Giant Mistake"; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "giant.objective.a", "The giants have disowned you! Run for your life!" }, { "giant.objective.b", "Find a new home..." }, { "giant.objective.c", "You are ready to join a faction." } }; internal static GiantRisenScenario Instance { get; private set; } public override void Gear(Character character) { character.Inventory.ReceiveItemReward(3000221, 1, true); character.Inventory.ReceiveItemReward(3000220, 1, true); character.Inventory.ReceiveItemReward(3000222, 1, true); character.Inventory.ReceiveItemReward(2110000, 1, true); } public override void Init() { base.Init(); QE_FixedGiantRisenStart = CustomQuests.CreateQuestEvent("iggythemad.giantrisen.fixedstart", false, true, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } public override void OnScenarioChosen() { } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { GetOrGiveQuestToHost(); VanillaQuestsHelper.AddQuestEvent("XqlcpbTJC0aTDZfjD4xCTg"); } public override void OnStartSpawn(Character character) { } private void SL_OnGameplayResumedAfterLoading() { if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } } public override void UpdateQuestProgress(Quest quest) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.isNonMasterClientInRoom || !base.IsActiveScenario) { return; } int num = 3; int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedGiantRisenStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack >= num) { questProgress.DisableQuest((ProgressState)3); return; } if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_FixedGiantRisenStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("giant.objective.a")), displayTime: true); ShowUIMessage("I've been exiled! I should flee!"); } else if (eventCurrentStack < 2) { QuestEventManager.Instance.AddEvent(QE_FixedGiantRisenStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("giant.objective.b")), displayTime: false); ShowUIMessage("I need to find a new home..."); } else if (eventCurrentStack < 3 && AreaManager.Instance.GetIsCurrentAreaTownOrCity()) { QuestEventManager.Instance.AddEvent(QE_FixedGiantRisenStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("giant.objective.b")), displayTime: true); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("giant.objective.c")), displayTime: true); questProgress.DisableQuest((ProgressState)3); VanillaQuestsHelper.RemoveEvent("oGkuUgWvfkej_El-rhz2gw"); VanillaQuestsHelper.RemoveEvent("XqlcpbTJC0aTDZfjD4xCTg"); VanillaQuestsHelper.RemoveEvent("nDy01eTHlUa_BPDlbIhZPQ"); VanillaQuestsHelper.RemoveEvent("f1JVZyhg2UiBA8xmC-w6Hw"); VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); ShowUIMessage("Maybe I should join a new faction..."); } 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 GiantRisenScenario() { Instance = this; } public IEnumerator DodgeSlower(Character _character) { if (_character.Dodging) { _character.Animator.speed = 0.6f; while (_character.Dodging) { yield return (object)new WaitForSeconds(0.2f); } yield return (object)new WaitForSeconds(0.2f); _character.Animator.speed = 1f; } } } public class LimitlessScenario : Scenario { private const string LogSignature_A = "unbound.objective.a"; private const string LogSignature_B = "unbound.objective.b"; private const string LogSignature_C = "unbound.objective.c"; private QuestEventSignature QE_FixedUnboundStart; public int questTrigger; public override ScenarioQuest Type => ScenarioQuest.Quest_Unbound; public override ScenarioType Difficulty => ScenarioType.WIPtest; public override ScenarioPassives Passive => ScenarioPassives.Unbound; public override AreaEnum SpawnScene => (AreaEnum)501; public override Vector3 SpawnPosition => new Vector3(1053.8f, -32f, 1155.6f); public override Vector3 SpawnRotation => new Vector3(0f, 230.2f, 0f); public override bool HasQuest => true; public override string QuestName => "Unbound. Unlimited."; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "unbound.objective.a", "You've unlocked your true potential. You are unbound. Find any trainer to learn from." }, { "unbound.objective.b", "Purchase your first skill. No restrictions. Choose wisely." }, { "unbound.objective.c", "You are ready to face the world. You are ready to join a faction." } }; public override void Gear(Character character) { character.Inventory.AddMoney(37); character.Inventory.ReceiveItemReward(4100550, 3, false); character.Inventory.ReceiveItemReward(3000091, 1, true); character.Inventory.ReceiveItemReward(3000282, 1, true); character.Inventory.ReceiveItemReward(2160020, 1, false); character.Inventory.ReceiveItemReward(5110030, 1, false); } public override void Init() { base.Init(); QE_FixedUnboundStart = CustomQuests.CreateQuestEvent("iggythemad.unbound.fixedstart", false, true, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } private void SL_OnGameplayResumedAfterLoading() { if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } } } public override void UpdateQuestProgress(Quest quest) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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) if (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { CharacterManager.Instance.GetWorldHostCharacter(); int eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedUnboundStart.EventUID); QuestProgress questProgress = quest.m_questProgress; if (eventCurrentStack < 1) { QuestEventManager.Instance.AddEvent(QE_FixedUnboundStart, 1); eventCurrentStack = QuestEventManager.Instance.GetEventCurrentStack(QE_FixedUnboundStart.EventUID); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("unbound.objective.a")), displayTime: true); ShowUIMessage("I feel... free. Unbound. I need power!"); } else if (eventCurrentStack < 2 && AreaManager.Instance.GetIsCurrentAreaTownOrCity()) { QuestEventManager.Instance.AddEvent(QE_FixedUnboundStart, 1); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("unbound.objective.b")), displayTime: true); ShowUIMessage("So many choices... I gotta choose wisely."); } else if (eventCurrentStack < 3 && questTrigger == 1) { QuestEventManager.Instance.AddEvent(QE_FixedUnboundStart, 2); questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("unbound.objective.c")), displayTime: true); questProgress.DisableQuest((ProgressState)3); VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); } 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 override void OnScenarioChosen() { } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { GetOrGiveQuestToHost(); } public override void OnStartSpawn(Character character) { } } public class PriestElattScenario : Scenario { public override ScenarioQuest Type => ScenarioQuest.Quest_PriestElatt; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.PriestElatt; public override AreaEnum SpawnScene => (AreaEnum)200; public override Vector3 SpawnPosition => new Vector3(-175.2f, -1514.6f, 751.9f); public override Vector3 SpawnRotation => new Vector3(0f, 359f, 0f); public override bool HasQuest => false; public override string QuestName => ""; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string>(); internal static PriestElattScenario Instance { get; private set; } public override void Gear(Character character) { character.Inventory.ReceiveItemReward(9000010, 32, true); character.Inventory.ReceiveItemReward(3000071, 1, true); character.Inventory.ReceiveItemReward(3000070, 1, true); character.Stats.SetManaPoint(2); character.Inventory.ReceiveItemReward(3000174, 1, true); character.Inventory.ReceiveItemReward(2020010, 1, true); character.Inventory.ReceiveSkillReward(8200040); } public override void OnScenarioChosen() { } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); } public override void OnStartSpawn(Character character) { } public override void UpdateQuestProgress(Quest quest) { } public PriestElattScenario() { Instance = this; } } public class RobbedTraderScenario : Scenario { [HarmonyPatch(typeof(DefeatScenariosManager), "StartDefeat")] public class DefeatScenariosManager_StartDefeat { [HarmonyPrefix] public static bool Prefix(DefeatScenariosManager __instance) { if (!Instance.IsActiveScenario || PhotonNetwork.isNonMasterClientInRoom) { return true; } if (QuestEventManager.Instance.HasQuestEvent(QuestEventDictionary.GetQuestEvent("jNfNsLGBpk2iMRts9kkerw"))) { return true; } foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { item.ControlledCharacter.Resurrect(); } NetworkLevelLoader.Instance.RequestSwitchArea(AreaManager.Instance.GetArea((AreaEnum)101).SceneName, 0, 1.5f, false); return false; } } [HarmonyPatch(typeof(InteractionTriggerBase), "TryActivateBasicAction", new Type[] { typeof(Character), typeof(int) })] public class InteractionTriggerBase_TryActivateBasicAction { [HarmonyPrefix] public static bool Prefix(InteractionTriggerBase __instance, Character _character, int _toggleState) { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) if (!Instance.IsActiveScenario || PhotonNetwork.isNonMasterClientInRoom || !Object.op_Implicit((Object)(object)_character)) { return true; } if (!_character.IsLocalPlayer) { return true; } if (QuestEventManager.Instance.HasQuestEvent(QuestEventDictionary.GetQuestEvent("jNfNsLGBpk2iMRts9kkerw"))) { return true; } EventActivator currentTriggerManager = __instance.CurrentTriggerManager; if (Object.op_Implicit((Object)(object)((currentTriggerManager is InteractionActivator) ? currentTriggerManager : null))) { EventActivator currentTriggerManager2 = __instance.CurrentTriggerManager; InteractionActivator val = (InteractionActivator)(object)((currentTriggerManager2 is InteractionActivator) ? currentTriggerManager2 : null); if (val.BasicInteraction != null) { IInteraction basicInteraction = val.BasicInteraction; if (SceneManagerHelper.ActiveSceneName == "CierzoNewTerrain") { if (basicInteraction is InteractionMerchantDialogue && Vector3.Distance(((Component)_character).transform.position, Instance.traderPosition) < 5f) { if (_character.Inventory.OwnsOrHasEquipped(-2353)) { Instance.ShowUIMessage("I need to sell the goods before leaving.", instant: true); } else { VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); NetworkLevelLoader.Instance.RequestSwitchArea(AreaManager.Instance.GetArea((AreaEnum)400).SceneName, 0, 1.5f, false); } return false; } if (basicInteraction is InteractionMerchantDialogue && Vector3.Distance(((Component)_character).transform.position, Instance.alchemistPosition) < 5f) { return true; } if (_character.Inventory.OwnsOrHasEquipped(-2353)) { Instance.ShowUIMessage("I have no time for this...", instant: true); } else { Instance.ShowUIMessage("I should go back to harmattan...", instant: true); } return false; } if (SceneManagerHelper.ActiveSceneName == "ChersoneseNewTerrain") { if (Vector3.Distance(((Component)_character).transform.position, Instance.cierzoEntrance) < 5f) { return true; } Instance.ShowUIMessage("There is no time for this.", instant: true); return false; } } } return true; } } public string enemyID = "com.iggy.banditgeneric"; public Vector3 traderPosition = new Vector3(1408.7f, 5.9f, 1663.8f); public Vector3 alchemistPosition = new Vector3(1384.9f, 7.8f, 1649.1f); public Vector3 chersoneseFailSpawn = new Vector3(181.5f, 32.6f, 1444.4f); public Vector3 cierzoEntrance = new Vector3(131.9f, 34.9f, 1461.7f); internal static RobbedTraderScenario Instance { get; private set; } public override ScenarioQuest Type => ScenarioQuest.Quest_RobbedTrader; public override ScenarioType Difficulty => ScenarioType.Normal; public override ScenarioPassives Passive => ScenarioPassives.RobbedTrader; public override AreaEnum SpawnScene => (AreaEnum)101; public override Vector3 SpawnPosition => new Vector3(300.3f, 37.3f, 1423.9f); public override Vector3 SpawnRotation => new Vector3(0f, 285.7f, 0f); public override bool HasQuest => false; public override string QuestName => ""; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string>(); public override void Gear(Character character) { character.Inventory.ReceiveItemReward(9000010, 56, false); character.Inventory.ReceiveItemReward(3000190, 1, true); character.Inventory.ReceiveItemReward(3000004, 1, true); character.Inventory.ReceiveItemReward(-2353, 1, true); } public override void Init() { base.Init(); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; } public RobbedTraderScenario() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) Instance = this; } public override void OnScenarioChosen() { } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { } public override void OnStartSpawn(Character character) { ShowUIMessage("I can see the lighthouse! Got to sell the goods in Cierzo!"); } private void SL_OnGameplayResumedAfterLoading() { if (Instance.IsActiveScenario) { _ = PhotonNetwork.isNonMasterClientInRoom; } } public override void UpdateQuestProgress(Quest quest) { } } public class SandBanditScenario : Scenario { [HarmonyPatch(typeof(CharacterStats), "ReceiveDamage")] public class Character_ReceiveDamage { [HarmonyPostfix] public static void Postfix(CharacterStats __instance, ref float _damage, ref Character ___m_character) { if (Instance.IsActiveScenario && ___m_character.IsAI && !(SceneManagerHelper.ActiveSceneName != "Abrassar_Dungeon6") && _damage > __instance.CurrentHealth) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Instance.LeftAlive()); } } } [HarmonyPatch(typeof(CharacterManager), "RequestAreaSwitch")] public class CharacterManager_RequestAreaSwitch { [HarmonyPrefix] public static bool Prefix(CharacterManager __instance, Character _character, Area _areaToSwitchTo, int _longTravelTime, int _spawnPoint, float _offset, string _overrideLocKey) { if (!Instance.IsActiveScenario) { return true; } if (PhotonNetwork.isNonMasterClientInRoom) { return true; } if (_areaToSwitchTo.SceneName == "Levant") { _character.CharacterUI.ShowInfoNotification("You are not welcome here"); return false; } return true; } } private const float GRACE_PERIOD_INGAMETIME = 0.3f; private const string LogSignature_A = "sandbandits.objective.a"; private const string LogSignature_B = "sandbandits.objective.b"; private static QuestEventSignature QE_StartTimer; private Coroutine delayedQuestUpdate; internal static DialogueCharacter levantGuard; public override ScenarioQuest Type => ScenarioQuest.Quest_SandBandit; public override ScenarioType Difficulty => ScenarioType.WIPtest; public override ScenarioPassives Passive => ScenarioPassives.SandBandit; public override AreaEnum SpawnScene => (AreaEnum)307; public override Vector3 SpawnPosition => new Vector3(-53.3f, 0.5f, 55.1f); public override Vector3 SpawnRotation => new Vector3(0f, 227.3f, 0f); public override bool HasQuest => true; public override string QuestName => "Sand Corsair Exile"; public override Dictionary<string, string> QuestLogSignatures => new Dictionary<string, string> { { "sandbandits.objective.a", "You have been exiled from the Sand Corsairs, leave before they turn on you!" }, { "sandbandits.objective.b", "Your grace period is over, Old Levant is no longer your ally." } }; internal static SandBanditScenario Instance { get; private set; } public override void Gear(Character character) { character.Inventory.ReceiveItemReward(9000010, 26, false); character.Inventory.ReceiveItemReward(5100010, 1, true); character.Inventory.ReceiveItemReward(3000087, 1, true); character.Inventory.ReceiveItemReward(3000201, 1, true); character.Inventory.ReceiveItemReward(3000205, 1, true); character.Inventory.ReceiveItemReward(2000110, 1, true); } public SandBanditScenario() { Instance = this; } public override void Init() { base.Init(); QE_StartTimer = CustomQuests.CreateQuestEvent("iggythemad.sandbandits.starttimer", true, false, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); SL.OnGameplayResumedAfterLoading += SL_OnGameplayResumedAfterLoading; SetupTestCharacter(); } public override void OnScenarioChosen() { VanillaQuestsHelper.SkipHostToFactionChoice(keepHouse: false, complete: true); } public override void OnScenarioChosen(Character character) { } public override void OnStartSpawn() { ChangeCharactersFactions((Factions)2, QuestLogSignatures["sandbandits.objective.a"]); QuestEventManager.Instance.AddEvent(QE_StartTimer, 1); GetOrGiveQuestToHost(); StartDelayedQuestUpdate(); } public override void OnStartSpawn(Character character) { } private void ChangeCharactersFactions(Factions faction, string notifText) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) foreach (string value in CharacterManager.Instance.PlayerCharacters.Values) { Character character = CharacterManager.Instance.GetCharacter(value); if (character.Faction != faction) { character.ChangeFaction(faction, true); if (!string.IsNullOrEmpty(notifText)) { ShowUIMessage(notifText); } } } } private void SL_OnGameplayResumedAfterLoading() { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Invalid comparison between Unknown and I4 if (PhotonNetwork.isNonMasterClientInRoom || !base.IsActiveScenario) { return; } Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } if (SceneManagerHelper.ActiveSceneName == "Abrassar_Dungeon6") { Character[] array = Object.FindObjectsOfType<Character>(); int num = 0; Character[] array2 = array; foreach (Character val in array2) { if (val.Alive && val.IsAI && (int)val.Faction == 2) { num++; } } Instance.ShowUIMessage(num + " former friends left alive."); } else if (SceneManagerHelper.ActiveSceneName == "Levant") { NetworkLevelLoader.Instance.RequestSwitchArea(AreaManager.Instance.GetArea((AreaEnum)301).SceneName, 0, 1.5f, false); } } private void StartDelayedQuestUpdate() { if (delayedQuestUpdate != null) { ((MonoBehaviour)Plugin.Instance).StopCoroutine(delayedQuestUpdate); } delayedQuestUpdate = ((MonoBehaviour)Plugin.Instance).StartCoroutine(UpdateQuestAfterDelay()); } private IEnumerator UpdateQuestAfterDelay() { float eventActiveTimeDelta = QuestEventManager.Instance.GetEventActiveTimeDelta(QE_StartTimer.EventUID); while (eventActiveTimeDelta < 0.3f) { yield return (object)new WaitForSeconds(1f); if (!((Object)(object)QuestEventManager.Instance == (Object)null)) { CharacterManager instance = CharacterManager.Instance; if (!Object.op_Implicit((Object)(object)((instance != null) ? instance.GetWorldHostCharacter() : null))) { yield break; } eventActiveTimeDelta = QuestEventManager.Instance.GetEventActiveTimeDelta(QE_StartTimer.EventUID); continue; } yield break; } CharacterManager instance2 = CharacterManager.Instance; Character val = ((instance2 != null) ? instance2.GetWorldHostCharacter() : null); if (Object.op_Implicit((Object)(object)val)) { if (((CharacterKnowledge)val.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)val.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); Quest quest = (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); UpdateQuestProgress(quest); } delayedQuestUpdate = null; } } public override void UpdateQuestProgress(Quest quest) { //IL_0033: 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 (!PhotonNetwork.isNonMasterClientInRoom && base.IsActiveScenario) { float eventActiveTimeDelta = QuestEventManager.Instance.GetEventActiveTimeDelta(QE_StartTimer.EventUID); QuestProgress questProgress = quest.m_questProgress; questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("sandbandits.objective.a")), eventActiveTimeDelta >= 0.3f); if (eventActiveTimeDelta >= 0.3f) { questProgress.UpdateLogEntry(questProgress.GetLogSignature(UID.op_Implicit("sandbandits.objective.b")), displayTime: true); ChangeCharactersFactions((Factions)1, QuestLogSignatures["sandbandits.objective.b"]); questProgress.DisableQuest((ProgressState)3); } else { ChangeCharactersFactions((Factions)2, string.Empty); StartDelayedQuestUpdate(); } } } private IEnumerator LeftAlive() { yield return (object)new WaitForSeconds(0.5f); Character[] array = Object.FindObjectsOfType<Character>(); int num = 0; Character[] array2 = array; foreach (Character val in array2) { if (val.Alive && val.IsAI && (int)val.Faction == 2) { num++; } } Instance.ShowUIMessage(num + " former friends left alive."); if (num > 0) { Instance.ShowUIMessage(num + " former friends left alive."); } } private void SetupTestCharacter() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) levantGuard = new DialogueCharacter { UID = "levantguard.character", Name = "Levant Guard", SpawnSceneBuildName = "Abrassar", SpawnPosition = new Vector3(-159.4f, 131.8f, -532.7f), SpawnRotation = new Vector3(0f, 43.7f, 0f), HelmetID = 3000115, ChestID = 3000112, BootsID = 3000118, WeaponID = 2130305, StartingPose = (SpellCastType)42 }; SL_Character obj = levantGuard.CreateAndApplyTemplate(); levantGuard.OnSetupDialogueGraph += TestCharacter_OnSetupDialogueGraph; obj.ShouldSpawn = () => base.IsActiveScenario; } private void TestCharacter_OnSetupDialogueGraph(DialogueTree graph, Character character) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown ActorParameter val = graph.actorParameters[0]; StatementNodeExt val2 = ((Graph)graph).AddNode<StatementNodeExt>(); val2.statement = new Statement("Halt! You are not welcome here, bandit. Go away or I'll make you."); val2.SetActorName(val.name); MultipleChoiceNodeExt val3 = ((Graph)graph).AddNode<MultipleChoiceNodeExt>(); val3.availableChoices.Add(new Choice(new Statement("Why dont you trust me?"))); val3.availableChoices.Add(new Choice(new Statement("I've left the corsairs behind. Let me in."))); val3.availableChoices.Add(new Choice(new Statement("How can I prove my loyalty to the king?"))); StatementNodeExt val4 = ((Graph)graph).AddNode<StatementNodeExt>(); val4.statement = new Statement("We have seen your bunch. Nothing more than soon-to-be-dead outlaws."); val4.SetActorName(val.name); StatementNodeExt val5 = ((Graph)graph).AddNode<StatementNodeExt>(); val5.statement = new Statement("Should we just believe you? Just like that? Piss off, kid. I'm watching you."); val5.SetActorName(val.name); StatementNodeExt val6 = ((Graph)graph).AddNode<StatementNodeExt>(); val6.statement = new Statement("Pfff-You can't be serious... Well I suppose getting rid of your people in the Sand Rose cave could ear you a way in."); val6.SetActorName(val.name); ((Graph)graph).allNodes.Clear(); ((Graph)graph).allNodes.Add((Node)(object)val2); ((Graph)graph).primeNode = (Node)(object)val2; ((Graph)graph).allNodes.Add((Node)(object)val3); ((Graph)graph).allNodes.Add((Node)(object)val4); ((Graph)graph).allNodes.Add((Node)(object)val5); ((Graph)graph).allNodes.Add((Node)(object)val6); ((Graph)graph).ConnectNodes((Node)(object)val2, (Node)(object)val3, -1, -1); ((Graph)graph).ConnectNodes((Node)(object)val3, (Node)(object)val4, 0, -1); ((Graph)graph).ConnectNodes((Node)(object)val4, (Node)(object)val2, -1, -1); ((Graph)graph).ConnectNodes((Node)(object)val3, (Node)(object)val5, 1, -1); ((Graph)graph).ConnectNodes((Node)(object)val5, (Node)(object)val2, -1, -1); ((Graph)graph).ConnectNodes((Node)(object)val3, (Node)(object)val6, 2, -1); ((Graph)graph).ConnectNodes((Node)(object)val6, (Node)(object)val2, -1, -1); } } public abstract class Scenario { public abstract ScenarioQuest Type { get; } public abstract ScenarioType Difficulty { get; } [Obsolete("Not yet implemented.")] public virtual ScenarioTheme Theme { get; } public abstract ScenarioPassives Passive { get; } public abstract AreaEnum SpawnScene { get; } public abstract Vector3 SpawnPosition { get; } public virtual Vector3 SpawnRotation { get { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) Quaternion identity = Quaternion.identity; return ((Quaternion)(ref identity)).eulerAngles; } } public abstract bool HasQuest { get; } public SL_Quest QuestTemplate { get; private set; } public virtual string QuestName { get; } public virtual Dictionary<string, string> QuestLogSignatures { get; } public QuestEventSignature QE_ScenarioQuestEvent { get; private set; } public string QE_Scenario_UID => "iggythemad.scenarios." + GetType().Name; public bool IsActiveScenario => QuestEventManager.Instance.HasQuestEvent(QE_ScenarioQuestEvent); public virtual void Gear(Character character) { } public virtual void OnStartDestiny() { Debug.Log((object)"OnStartDestiny"); GearManager.StartingGear(); } public abstract void OnStartSpawn(); public abstract void UpdateQuestProgress(Quest quest); public virtual void Init() { SL.OnPacksLoaded += OnPacksLoaded; QE_ScenarioQuestEvent = CustomQuests.CreateQuestEvent(QE_Scenario_UID, false, false, true, "A_Iggy_AlternateStart", "CustomEvent", "A custom event created with SideLoader"); } public virtual void OnPacksLoaded() { if (HasQuest) { PrepareSLQuest(); } } public virtual void OnScenarioChosen() { foreach (string value in CharacterManager.Instance.PlayerCharacters.Values) { Character character = CharacterManager.Instance.GetCharacter(value); OnScenarioChosen(character); } } public virtual void OnScenarioChosen(Character character) { } public virtual void OnStartSpawn(Character character) { } public IEnumerator StartScenario() { QuestEventManager.Instance.AddEvent(ScenarioManager.QE_DestinyChosen, 1); QuestEventManager.Instance.AddEvent(QE_ScenarioQuestEvent, 1); OnScenarioChosen(); foreach (string value in CharacterManager.Instance.PlayerCharacters.Values) { Character character = CharacterManager.Instance.GetCharacter(value); character.AutoKnock(true, Vector3.back, character); OnScenarioChosen(character); } yield return (object)new WaitForSeconds(1f); CharacterManager.Instance.GetWorldHostCharacter(); if (Object.op_Implicit((Object)(object)CharacterManager.Instance.GetFirstLocalCharacter())) { NetworkLevelLoader.Instance.RequestSwitchArea(AreaManager.Instance.GetArea(SpawnScene).SceneName, 0, 1.5f, false); } SL.OnGameplayResumedAfterLoading += OnGameplayResumedAfterScenarioStart; } private void OnGameplayResumedAfterScenarioStart() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) foreach (string value in CharacterManager.Instance.PlayerCharacters.Values) { Character character = CharacterManager.Instance.GetCharacter(value); if (SpawnPosition != default(Vector3)) { character.Teleport(SpawnPosition, SpawnRotation); } character.SpellCastProcess(29, 0, 0, 0f); OnStartSpawn(character); } OnStartSpawn(); OnStartDestiny(); SL.OnGameplayResumedAfterLoading -= OnGameplayResumedAfterScenarioStart; } private void PrepareSLQuest() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown SL_Quest val = new SL_Quest(); ((SL_Item)val).Target_ItemID = 7011620; ((SL_Item)val).New_ItemID = (int)Type; ((SL_Item)val).Name = QuestName; 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_0088: Unknown result type (might be due to invalid IL or missing references) Character worldHostCharacter = CharacterManager.Instance.GetWorldHostCharacter(); if (((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).IsItemLearned((int)Type)) { Item itemFromItemID = ((CharacterKnowledge)worldHostCharacter.Inventory.QuestKnowledge).GetItemFromItemID((int)Type); return (Quest)(object)((itemFromItemID is Quest) ? itemFromItemID : null); } Item obj = ItemManager.Instance.GenerateItemNetwork((int)Type); Quest val = (Quest)(object)((obj is Quest) ? obj : null); ((Component)val).transform.SetParent(((Component)worldHostCharacter.Inventory.QuestKnow
BepInEx/plugins/IggyTheMad-TrueHardcore/HardcoreRebalance.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using SideLoader; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("HardcoreRebalance")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HardcoreRebalance")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("42fa9a70-4056-4212-8387-b19532e9b8ae")] [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 HardcoreRebalance; internal class ContentTweks { [HarmonyPatch(typeof(InteractionTriggerBase), "TryActivateBasicAction", new Type[] { typeof(Character), typeof(int) })] public class InteractionTriggerBase_TryActivateBasicAction { [HarmonyPrefix] public static bool Prefix(InteractionTriggerBase __instance, Character _character, int _toggleState) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_character) || !_character.IsLocalPlayer) { return true; } EventActivator currentTriggerManager = __instance.CurrentTriggerManager; if (Object.op_Implicit((Object)(object)((currentTriggerManager is InteractionActivator) ? currentTriggerManager : null))) { EventActivator currentTriggerManager2 = __instance.CurrentTriggerManager; InteractionActivator val = (InteractionActivator)(object)((currentTriggerManager2 is InteractionActivator) ? currentTriggerManager2 : null); if (val.BasicInteraction != null && val.BasicInteraction is InteractionToggleContraption && Vector3.Distance(_character.CenterPosition, CabalLeverPos) < leverDist) { _character.CharacterUI.ShowInfoNotification("The lever is stuck..."); return false; } } return true; } } private static Vector3 CabalLeverPos = new Vector3(-1.6f, 12.5f, 44f); private static float leverDist = 2f; } public static class CraftingLimits { [HarmonyPatch(typeof(CraftingMenu), "TryCraft")] public class CraftingMenu_TryCraft { [HarmonyPrefix] public static bool Prefix(CraftingMenu __instance) { if ((Object)(object)((__instance != null) ? ((UIElement)__instance).LocalCharacter : null) != (Object)null && ((UIElement)__instance).LocalCharacter.IsLocalPlayer) { bool flag = false; if (Object.op_Implicit((Object)(object)((ItemDisplay)__instance.m_recipeResultDisplay).RefItem) || !HardcoreRebalanceBase.CraftLimitsStored) { return true; } if (__instance.m_ingredientSelectors.Length <= 1) { flag = true; } else { int num = 0; for (int i = 0; i < __instance.m_ingredientSelectors.Length; i++) { IngredientSelector obj = __instance.m_ingredientSelectors[i]; if (obj == null) { continue; } CompatibleIngredient assignedIngredient = obj.AssignedIngredient; if (assignedIngredient == null) { continue; } _ = assignedIngredient.ItemID; if (true) { num++; if (ExceptionIDs.CraftExceptions.Values.Contains(__instance.m_ingredientSelectors[i].AssignedIngredient.ItemID) || __instance.m_ingredientSelectors[i].AssignedIngredient.ItemPrefab.Name.Contains("Lantern") || __instance.m_ingredientSelectors[i].AssignedIngredient.ItemPrefab.Name.Contains("Tsar")) { flag = true; break; } } } if (num == 1) { flag = true; } } if (flag) { return true; } int num2 = ((__instance.m_lastRecipeIndex != -1) ? __instance.m_complexeRecipes[__instance.m_lastRecipeIndex].Key : __instance.m_lastFreeRecipeIndex); if (num2 != -1) { int num3 = 0; while (true) { int num4 = num3; Recipe obj2 = __instance.m_allRecipes[num2]; if (!(num4 < ((obj2 == null) ? null : obj2.Results?.Length))) { break; } ItemReferenceQuantity obj3 = __instance.m_allRecipes[num2].Results[num3]; if (obj3 != null && obj3.ItemID < -1) { Debug.Log((object)("itemID: " + __instance.m_allRecipes[num2].Results[num3].ItemID)); ((UIElement)__instance).LocalCharacter.CharacterUI.ShowInfoNotification("Mod craft allowed."); return true; } num3++; } } ((UIElement)__instance).LocalCharacter.CharacterUI.ShowInfoNotification("No recipe known..."); return false; } return true; } } internal static void Awake() { SL.OnGameplayResumedAfterLoading += StartingRecipe; } private static void StartingRecipe() { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { if (!item.IsLocalPlayer) { continue; } foreach (string value2 in ExceptionIDs.StartingRecipees.Values) { if (!item.ControlledCharacter.Inventory.RecipeKnowledge.IsRecipeLearned(value2)) { RecipeManager.Instance.m_recipes.TryGetValue(value2, out var value); item.ControlledCharacter.Inventory.RecipeKnowledge.LearnRecipe(value); } } } SL.OnGameplayResumedAfterLoading -= StartingRecipe; } } internal static class DeathMortality { [HarmonyPatch(typeof(DefeatScenariosManager), "OnAllPlayersDefeated")] public class DefeatScenariosManager_OnAllPlayersDefeated { [HarmonyPrefix] public static void Prefix(DefeatScenariosManager __instance) { if (!CharacterManager.Instance.GetFirstLocalCharacter().IsWorldHost) { return; } foreach (Character value in CharacterManager.Instance.Characters.Values) { if (value.IsAI && value.Stats.CurrentHealth > 0f) { value.Stats.AffectHealth(value.Stats.MaxHealth * HardcoreBalance.deathEnemyHealMult); } } Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(-2057); foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { Character controlledCharacter = item.ControlledCharacter; int num = 0; int num2 = Random.Range(1, 11); num = (controlledCharacter.HardcoreMode ? ((num2 <= 4) ? 1 : ((num2 <= 9) ? 2 : 3)) : ((num2 <= 7) ? 1 : ((num2 <= 9) ? 2 : 3))); controlledCharacter.Inventory.GenerateItem(itemPrefab, num, false); foreach (Item ownedItem in controlledCharacter.Inventory.GetOwnedItems(-2057)) { controlledCharacter.Inventory.TakeItemToPouch(ownedItem); } ((MonoBehaviour)HardcoreRebalanceBase.Instance).StartCoroutine(MoveToPouch(controlledCharacter)); int num3 = Random.Range(500, 2500); controlledCharacter.Inventory.OnCharacterReceivedHit((float)num3, false); } } } [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) { CheckMortality(); } } } private static bool reviver; public static List<Character> allPlayers; private static int onlinePlayersNo; internal static void Awake() { SL.OnGameplayResumedAfterLoading += Fixer; } private static void Fixer() { Debug.Log((object)"CHECKING MORTALITY----"); CheckMortality(); } private static void CheckMortality() { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { Character controlledCharacter = item.ControlledCharacter; if (!controlledCharacter.IsLocalPlayer || !controlledCharacter.Inventory.OwnsItem(-2057)) { continue; } int num = controlledCharacter.Inventory.ItemCount(-2057); for (int i = 0; i < num; i++) { controlledCharacter.StatusEffectMngr.AddStatusEffect(HardcoreEffects.Mortality.ToString()); } controlledCharacter.Inventory.RemoveItem(-2057, num); bool flag = false; foreach (Blessings value in Enum.GetValues(typeof(Blessings))) { if (((CharacterKnowledge)controlledCharacter.Inventory.SkillKnowledge).IsItemLearned((int)value)) { Item itemFromItemID = ((CharacterKnowledge)controlledCharacter.Inventory.SkillKnowledge).GetItemFromItemID((int)value); ItemManager.Instance.DestroyItem(itemFromItemID); ((CharacterKnowledge)controlledCharacter.Inventory.SkillKnowledge).RemoveItem(itemFromItemID); flag = true; } } if (flag) { controlledCharacter.CharacterUI.ShowInfoNotification("Blessings lost"); } } } private static IEnumerator MoveToPouch(Character xplayer) { yield return (object)new WaitForSeconds(0.1f); foreach (Item ownedItem in xplayer.Inventory.GetOwnedItems(-2057)) { xplayer.Inventory.TakeItemToPouch(ownedItem); } } public static void GetNewScenario(DefeatScenariosManager defeatManager) { DefeatScenario val = defeatManager.m_scerariosContainer.ChooseScenario(); defeatManager.ForceDefeat(val); } } public static class ExceptionIDs { private const string CRYSTAL_POWDER_RECIPE_UID = "-SEtMHRqWUmvrmyvryV8Ng"; public static readonly Dictionary<string, string> StartingRecipees; public static readonly Dictionary<string, int> CraftExceptions; static ExceptionIDs() { StartingRecipees = new Dictionary<string, string> { ["Crystal Powder"] = "-SEtMHRqWUmvrmyvryV8Ng", ["Trinket of Elatt"] = "com.iggy.trinketrecipe", ["Flint and Steel"] = "com.dub.flintandsteelrecipe", ["Makeshift Hatchet"] = "com.dub.makeshifthatchetrecipe", ["Makeshift Mining Pick"] = "com.dub.makeshiftminingpickrecipe", ["Makeshift Fishing Harpoon"] = "com.dub.fishingharpoonrecipe", ["Elixir of Memory Echoes"] = "4300192", ["Sugar"] = "OE10NFgta0ulLYZCrcChnw", ["Salt Water"] = "saltwater-recipe", ["Racid Water clear"] = "c9nZOQ_BmUaFBmB7xEadnQ", ["River Water clear"] = "SK6LKVhmx0CFs1-uwKJvaA", ["charcoal"] = "com.dub.charcoal", ["Healing Poultice"] = "com.dub.healingpoultice", ["First Aid Tools"] = "com.dub.Firstaidtools", ["Soaked Bandages"] = "com.dub.SoakedBandages", ["Camping Gear"] = "com.dub.campinggear", ["Crafting Influence"] = "com.dub.influencerecipe", ["Crafting Fletching Feathers"] = "com.dub.fletchingfeathers" }; CraftExceptions = new Dictionary<string, int> { ["Explorer Lantern"] = 5100000, ["Old Lantern"] = 5100010, ["Glowstone Lantern"] = 5100020, ["Firefly Lantern"] = 5100030, ["Lantern of Souls"] = 5100080, ["Coil Lantern"] = 5100090, ["Virgin Lantern"] = 5100100, ["Djinn’s Lamp"] = 5100110, ["Calixa’s Relic"] = 6600225, ["Elatt’s Relic"] = 6600222, ["Gep’s Generosity"] = 6600220, ["Haunted Memory"] = 6600224, ["Leyline Figment"] = 6600226, ["Pearlbird’s Courage"] = 6600221, ["Scourge’s Tears"] = 6600223, ["Vendavel's Hospitality"] = 6600227, ["Flowering Corruption"] = 6600228, ["Metalized Bones"] = 6600230, ["Enchanted Mask"] = 6600229, ["Noble’s Greed"] = 6600232, ["Scarlet Whisper"] = 6600231, ["Calygrey’s Wisdom"] = 6600233, ["Hailfrost Claymore"] = 2100270, ["Hailfrost Mace"] = 2020290, ["Hailfrost Hammer"] = 2120240, ["Hailfrost Axe"] = 2010250, ["Hailfrost Greataxe"] = 2110230, ["Hailfrost Spear"] = 2130280, ["Hailfrost Halberd"] = 2150110, ["Hailfrost Pistol"] = 5110270, ["Hailfrost Knuckles"] = 2160200, ["Hailfrost Sword"] = 2000280, ["Hailfrost Dagger"] = 5110015, ["Mysterious Blade"] = 2000320, ["Mysterious Long Blade"] = 2100300, ["Ceremonial Bow"] = 2200190, ["Cracked Red Moon"] = 2150180, ["Compasswood Staff"] = 2150030, ["Scarred Dagger"] = 5110340, ["De-powered Bludgeon"] = 2120270, ["Unusual Knuckles"] = 2160230, ["Strange Rusted Sword"] = 2000151 }; } } public static class NightGates { [HarmonyPatch(typeof(CharacterManager), "RequestAreaSwitch")] public class CharacterManager_RequestAreaSwitch { [HarmonyPrefix] public static bool Prefix(CharacterManager __instance, Character _character, Area _areaToSwitchTo, int _longTravelTime, int _spawnPoint, float _offset, string _overrideLocKey) { if (!HardcoreRebalanceBase.NightGatesStored) { return true; } Debug.Log((object)("Time is: " + EnvironmentConditions.Instance.TimeOfDay)); if (EnvironmentConditions.Instance.TimeOfDay > 20f || EnvironmentConditions.Instance.TimeOfDay < 4f) { bool flag = false; if ((_areaToSwitchTo.SceneName == "CierzoNewTerrain" && SceneManagerHelper.ActiveSceneName == "ChersoneseNewTerrain") || (_areaToSwitchTo.SceneName == "Berg" && SceneManagerHelper.ActiveSceneName == "Emercar")) { flag = GetBribeStage(_character, 100); } else if (_areaToSwitchTo.SceneName == "Levant" && SceneManagerHelper.ActiveSceneName == "Abrassar") { flag = GetBribeStage(_character, 200); } else if (_areaToSwitchTo.SceneName == "Harmattan" && SceneManagerHelper.ActiveSceneName == "AntiqueField") { flag = GetBribeStage(_character, 140); } else { if (!(_areaToSwitchTo.SceneName == "Monsoon") || !(SceneManagerHelper.ActiveSceneName == "HallowedMarshNewTerrain")) { return true; } flag = GetBribeStage(_character, 80, isBoat: true); } if (flag) { return true; } return false; } return true; } } private static int BribeAttempt; private static Coroutine bribeCO; private static bool GetBribeStage(Character _character, int bribeCost, bool isBoat = false) { if (BribeAttempt == 0) { if (isBoat) { _character.CharacterUI.ShowInfoNotification("No sailing at night...unless..."); } else { _character.CharacterUI.ShowInfoNotification("Gates are closed at night...unless..."); } } else if (BribeAttempt == 1) { if (isBoat) { _character.CharacterUI.ShowInfoNotification("Convince boatman for " + bribeCost + " silver?"); } else { _character.CharacterUI.ShowInfoNotification("Bribe guard for " + bribeCost + " silver?"); } } else if (BribeAttempt == 2) { if (isBoat) { _character.CharacterUI.ShowInfoNotification("Wanna pay? Convince boatman for " + bribeCost + " silver?"); } else { _character.CharacterUI.ShowInfoNotification("Wanna pay? Bribe guard for " + bribeCost + " silver?"); } } if (bribeCO != null) { ((MonoBehaviour)HardcoreRebalanceBase.Instance).StopCoroutine(bribeCO); bribeCO = null; } bribeCO = ((MonoBehaviour)HardcoreRebalanceBase.Instance).StartCoroutine(resetBribe()); if (BribeAttempt == 3) { BribeAttempt = 0; if (_character.Inventory.AvailableMoney > bribeCost) { _character.Inventory.RemoveMoney(bribeCost, false); return true; } _character.CharacterUI.ShowInfoNotification("Not enough silver..."); _character.Knock(true); return false; } if (BribeAttempt < 3) { BribeAttempt++; } return false; } private static IEnumerator resetBribe() { yield return (object)new WaitForSeconds(5f); BribeAttempt = 0; } } internal class Tester { } public enum HardcoreItems { ElattCleanse = -2051, ElattTrinket = -2052, ElattPiece = -2053, MortalAdd = -2057 } public enum Blessings { BlessingWisdom = -2054, BlessingPower = -2055, BlessingCourage = -2056, BlessingDetermination = -59000, BlessingInfluence = -59001, BlessingTolerance = -59002 } public enum HardcoreEffects { EnemyHealing, Mortality, CombatEquiping, TrapAware } public static class HardcoreBalance { public static int trinketDropChance = 1; public static float deathEnemyHealMult = 0.6f; public static int flintBreakChance = 30; public static float reviveTimer = 4f; public static float timeToEquip = 2f; } public static class EventsManager { [HarmonyPatch(typeof(NetworkLevelLoader), "UnPauseGameplay")] public class NetworkLevelLoader_UnPauseGameplay { [HarmonyPostfix] public static void Postfix(NetworkLevelLoader __instance, string _identifier) { if (HardcoreRebalanceBase.PerCityStashStored) { _cachedStash = null; } } } [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(ItemContainer), "ShowContent")] public class ItemContainer_ShowContent { [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] public static void Reversefix(ItemContainer __instance, Character _character) { } } [HarmonyPatch(typeof(TreasureChest), "ShowContent")] public class TreasureChest_ShowContent { [HarmonyPrefix] public static bool Prefix(TreasureChest __instance, Character _character) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 if (!HardcoreRebalanceBase.PerCityStashStored) { return true; } if ((int)((ItemContainer)__instance).SpecialType == 4 && TryGetStash(_character, out var stash)) { _character.CharacterUI.StashPanel.SetStash(stash); } ItemContainer_ShowContent.Reversefix((ItemContainer)(object)__instance, _character); return false; } } [HarmonyPatch(typeof(TreasureChest), "InitDrops")] public class TreasureChest_InitDrops { [HarmonyPostfix] public static void Postfix(TreasureChest __instance) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (HardcoreRebalanceBase.PerCityStashStored) { _ = ((ItemContainer)__instance).SpecialType; _ = 4; } } } [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 && val.IsLocalPlayer && _item.ItemID == -2051) { int num = 4; if (val.HardcoreMode) { num = 2; } val.StatusEffectMngr.ReduceStatusLevel(HardcoreEffects.Mortality.ToString(), num); ItemManager.Instance.DestroyItem(_item.UID); ((CharacterKnowledge)val.Inventory.SkillKnowledge).RemoveItem(_item); } } } [HarmonyPatch(typeof(Item), "Use", new Type[] { typeof(Character) })] public class Item_Usage { [HarmonyPrefix] public static bool Prefix(Item __instance, Character _character) { if (!_character.IsLocalPlayer) { return true; } if (__instance.ItemID == -2052) { int num = 10; _character.StatusEffectMngr.ReduceStatusLevel(HardcoreEffects.Mortality.ToString(), num); _character.Inventory.RemoveItem(-2052, 1); _character.SpellCastAnim((SpellCastType)25, (SpellCastModifier)0, 0); } return true; } } [HarmonyPatch(typeof(BasicDeployable), "TryDeploying", new Type[] { typeof(Character) })] public class BasicDeployable_TryDeploying { [HarmonyPrefix] public static bool Prefix(BasicDeployable __instance, Character _usingCharacter) { //IL_002c: 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) if ((Object)(object)_usingCharacter == (Object)null || !_usingCharacter.IsLocalPlayer) { return true; } if (AreaManager.Instance.GetIsCurrentAreaTownOrCity() && ((ItemExtension)__instance).Item.IsSleepKit) { float num = Vector3.Distance(levantSlums, ((Component)_usingCharacter).transform.position); if (SceneManagerHelper.ActiveSceneName == "Levant" && num < 30f) { return true; } _usingCharacter.CharacterUI.ShowInfoNotification("Vagrancy is not allowed"); return false; } return true; } } private enum CampingActivities { None = 0, Sleep = 2, Guard = 4, Repair = 8 } [HarmonyPatch(typeof(RestingMenu), "Show")] public class RestingMenu_Show { [HarmonyPrefix] public static void Prefix(RestingMenu __instance) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (!HardcoreRebalanceBase.CampingGuardStored) { return; } Debug.Log((object)"Showing Menu----"); foreach (Transform item in ((Component)__instance.m_restingActivitiesHolder).transform) { Transform val = item; CampingActivities[] array = new CampingActivities[3] { CampingActivities.Sleep, CampingActivities.Guard, CampingActivities.Repair }; for (int i = 0; i < array.Length; i++) { _ = array[i]; if (((Object)((Component)val).gameObject).name.Contains(CampingActivities.Guard.ToString())) { ((Component)val).gameObject.SetActive(false); } } } Debug.Log((object)"Disabling Guard----"); } } [HarmonyPatch(typeof(Item), "OnUse")] public class Item_OnUse { [HarmonyPostfix] public static void Postfix(Item __instance, Character _targetChar) { if (__instance.ItemID == 5600010 && ((EffectSynchronizer)__instance).OwnerCharacter.IsLocalPlayer && Random.Range(1, 101) <= HardcoreBalance.flintBreakChance) { __instance.RemoveQuantity(1); __instance.m_ownerCharacter.CharacterUI.ShowInfoNotification("Flint and Steel broke on use."); } } } [HarmonyPatch(typeof(Character), "UpdateReviveInteraction")] public class Character_UpdateReviveInteraction { [HarmonyPostfix] public static void Prefix(Character __instance) { if (!((Object)(object)__instance == (Object)null)) { Transform val = ((Component)__instance).transform.Find("ReviveInteraction"); if ((Object)(object)val != (Object)null) { ((InteractionBase)((Component)val).GetComponent<InteractionRevive>()).HoldActivationTime = HardcoreBalance.reviveTimer; } } } } [HarmonyPatch(typeof(DefeatCoinLost), "Activate")] public class DefeatCoinLost_Activate { [HarmonyPrefix] public static void Prefix(DefeatCoinLost __instance, Character _affectedCharacter, ref int ___m_minLostCoins, ref int ___m_maxLostCoins, ref int ___m_minPercentLost, ref int ___m_maxPerentLost) { if ((Object)(object)_affectedCharacter != (Object)null && _affectedCharacter.IsLocalPlayer) { Debug.Log((object)"lossing COINS"); ___m_minLostCoins = 50; ___m_maxLostCoins = 500; ___m_minPercentLost = 30; ___m_maxPerentLost = 90; } } } [HarmonyPatch(typeof(DefeatDamageEquipment), "Activate")] public class DefeatDamageEquipment_Activate { [HarmonyPrefix] public static void Prefix(DefeatDamageEquipment __instance, Character _affectedCharacter, ref int ___m_minDamage, ref int ___m_maxDamage) { if ((Object)(object)_affectedCharacter != (Object)null && _affectedCharacter.IsLocalPlayer) { Debug.Log((object)"breaking ARMOR"); ___m_minDamage = 100; ___m_maxDamage = 800; } } } [HarmonyPatch(typeof(CharacterEquipment), "RepairEquipment")] public class CharacterEquipmen_RepairEquipment { [HarmonyPrefix] public static void Prefix(CharacterEquipment __instance, bool _forceRepair, ref EquipmentSlot[] ___m_equipmentSlots) { if (__instance.m_character.IsLocalPlayer && ___m_equipmentSlots != null) { EquipmentSlot[] array = ___m_equipmentSlots; foreach (EquipmentSlot val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val.EquippedItem != (Object)null && val.HasItemEquipped) { Debug.Log((object)("SHOULD REPAIR: " + val.SlotName)); ((Item)val.EquippedItem).RepairedInRest = true; } } } else { Debug.Log((object)"HARD ERROR ---------------"); } } } [HarmonyPatch(typeof(CharacterEquipment), "RepairEquipmentAfterRest")] public class CharacterEquipmen_RepairEquipmentAfterRest { [HarmonyPrefix] public static void Prefix(CharacterEquipment __instance, ref EquipmentSlot[] ___m_equipmentSlots) { if (__instance.m_character.IsLocalPlayer && ___m_equipmentSlots != null) { EquipmentSlot[] array = ___m_equipmentSlots; foreach (EquipmentSlot val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val.EquippedItem != (Object)null && val.HasItemEquipped && ((Item)val.EquippedItem).CurrentDurability <= 0f) { ((Item)val.EquippedItem).RepairedInRest = false; Debug.Log((object)("BROKEN ITEM: " + val.SlotName)); } } } else { Debug.Log((object)"HARD ERROR ---------------"); } } } [HarmonyPatch(typeof(ItemDropper), "GenerateItem")] public class ItemDropper_GenerateItem { [HarmonyPrefix] public static void Prefix(ItemDropper __instance, ItemContainer _container, BasicItemDrop _itemDrop, int _spawnAmount) { if ((Object)(object)player != (Object)null && player.IsWorldHost && Random.Range(1, 200) <= HardcoreBalance.trinketDropChance) { ItemManager.Instance.GenerateItemNetwork(-2053).ChangeParent(((Component)_container).transform); } } } public static AreaManager areaManager; public static Character player; private static bool reviver = false; public static List<Character> allPlayers; private static int onlinePlayersNo; private static List<Character> oversleptPlayers; private static List<Character> wellPlayers; private static Vector3 levantSlums = new Vector3(-160f, 4.4f, 66f); private static int minAmbush = 20; private static bool startStash; private static readonly Dictionary<AreaEnum, (string UID, Vector3[] Positions)> CityStashData = new Dictionary<AreaEnum, (string, Vector3[])> { [(AreaEnum)100] = ("ImqRiGAT80aE2WtUHfdcMw", (Vector3[])(object)new Vector3[2] { new Vector3(-367.85f, -1488.25f, 596.277f), new Vector3(-373.539f, -1488.25f, 583.187f) }), [(AreaEnum)500] = ("ImqRiGAT80aE2WtUHfdcMw", (Vector3[])(object)new Vector3[2] { new Vector3(-386.62f, -1493.132f, 773.86f), new Vector3(-372.41f, -1493.132f, 773.86f) }), [(AreaEnum)200] = ("ImqRiGAT80aE2WtUHfdcMw", (Vector3[])(object)new Vector3[1] { new Vector3(-371.628f, -1493.41f, 569.91f) }), [(AreaEnum)300] = ("ZbPXNsPvlUeQVJRks3zBzg", (Vector3[])(object)new Vector3[2] { new Vector3(-369.28f, -1502.535f, 592.85f), new Vector3(-380.53f, -1502.535f, 593.08f) }), [(AreaEnum)400] = ("ImqRiGAT80aE2WtUHfdcMw", (Vector3[])(object)new Vector3[4] { new Vector3(-178.672f, -1515.915f, 597.934f), new Vector3(-182.373f, -1515.915f, 606.291f), new Vector3(-383.484f, -1504.82f, 583.343f), new Vector3(-392.681f, -1504.82f, 586.551f) }), [(AreaEnum)601] = ("IqUugGqBBkaOcQdRmhnMng", (Vector3[])(object)new Vector3[0]) }; private static ItemContainer _cachedStash; internal static void Awake() { SL.OnGameplayResumedAfterLoading += startItemsKill; allPlayers = new List<Character>(); oversleptPlayers = new List<Character>(); wellPlayers = new List<Character>(); } private static void startItemsKill() { SL.OnGameplayResumedAfterLoading -= startItemsKill; if (!PhotonNetwork.isNonMasterClientInRoom && !startStash) { startStash = true; QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent("dlMPJtXDWU6R1YEfsezlSA"), 1); QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent("ypT9_eYB6UK2gnAaqJVA3g"), 1); QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent("EEdVb-dL10qjF70lw0UZKw"), 1); QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent("1iyLYN6eXUCQY9ZjD0kd1w"), 1); QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent("Q-U-VKV68Uezx3jM4ZB8Jg"), 1); QuestEventManager.Instance.AddEvent(QuestEventDictionary.GetQuestEvent("_P9lL0G5RUOfVC4ydwa1kQ"), 1); } } public static bool TryGetStash(Character character, out ItemContainer stash) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if ((Object)(object)_cachedStash == (Object)null && AreaManager.Instance.CurrentArea != null && CityStashData.TryGetValue((AreaEnum)AreaManager.Instance.CurrentArea.ID, out (string, Vector3[]) value)) { _cachedStash = (ItemContainer)(TreasureChest)ItemManager.Instance.GetItem(value.Item1); } stash = _cachedStash; return (Object)(object)stash != (Object)null; } } public static class AIManager { [HarmonyPatch(typeof(Character), "UpdateStability")] public class Character_UpdateStability { [HarmonyPrefix] public static bool Prefix(Character __instance) { if (!__instance.IsLocalPlayer) { return true; } if (__instance.Blocking) { return false; } return true; } } [HarmonyPatch(typeof(Character), "OnReceiveHit")] public class Character_OnReceiveHit { [HarmonyPrefix] public static void Prefix(Character __instance, Weapon _weapon, float _damage, DamageList _damageList, Vector3 _hitDir, Vector3 _hitPoint, float _angle, float _angleDir, Character _dealerChar, float _knockBack) { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) if (!HardcoreRebalanceBase.EnemyHealingStored || !player.IsWorldHost || (Object)(object)_dealerChar == (Object)null) { return; } if (!__instance.IsAI && _dealerChar.IsAI && _knockBack > 1f) { _dealerChar.StatusEffectMngr.AddStatusEffect(HardcoreEffects.EnemyHealing.ToString()); } else if (__instance.IsAI && !_dealerChar.IsAI && _knockBack > 1f) { if (__instance.StatusEffectMngr.HasStatusEffect(HardcoreEffects.EnemyHealing.ToString())) { __instance.StatusEffectMngr.RemoveStatusWithIdentifierName(HardcoreEffects.EnemyHealing.ToString()); } } else { if (!__instance.IsAI || !_dealerChar.IsAI) { return; } foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { Character controlledCharacter = item.ControlledCharacter; if (Vector3.Distance(((Component)__instance).transform.position, ((Component)controlledCharacter).transform.position) < botDmgRange) { _damage *= botDmgMult; return; } } _damage = 0f; } } } [HarmonyPatch(typeof(Character), "StabilityHit")] public class Character_StabilityHit { [HarmonyPrefix] public static void Prefix(Character __instance, ref float _knockValue, float _angle, bool _block, Character _dealerChar) { if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)_dealerChar) && __instance.Blocking) { if (__instance.IsLocalPlayer) { _knockValue *= 1.4f; } else if (__instance.IsAI) { _knockValue *= 1.2f; } } } } [HarmonyPatch(typeof(Character), "StabilityHit")] public class Character_StabilityHitPost { [HarmonyPostfix] public static void Postfix(Character __instance, ref float _knockValue, float _angle, bool _block, Character _dealerChar) { if (Object.op_Implicit((Object)(object)__instance) && Object.op_Implicit((Object)(object)_dealerChar) && __instance.Blocking) { if (__instance.IsAI) { _dealerChar.StabilityHit(_knockValue / 2f, _angle * -1f, false, (Character)null); } if (__instance.IsLocalPlayer) { _dealerChar.StabilityHit(_knockValue / 3f, _angle * -1f, false, (Character)null); } } } } [HarmonyPatch(typeof(CharacterStats), "UseMana")] public class Character_UseMana { [HarmonyPostfix] public static void Postfix(CharacterStats __instance, Tag[] _tags, ref float _amount, ref Character ___m_character) { if (___m_character.IsLocalPlayer) { drainStability(___m_character, _amount, isMana: true); } } } [HarmonyPatch(typeof(AIPreset), "ApplyToCharAI")] private class AIFix { [HarmonyPostfix] public static void Postfix(CharacterAI _charAI) { if ((Object)(object)player != (Object)null && HardcoreRebalanceBase.EnhancedAIStored) { Debug.Log((object)"APPLYING Enhanced AI--------------"); AICEnemyDetection[] componentsInChildren = ((Component)_charAI).GetComponentsInChildren<AICEnemyDetection>(true); foreach (AICEnemyDetection obj in componentsInChildren) { obj.GoodViewAngle = goodViewAngle; obj.ViewAngle = viewAngle; obj.LowViewRange = lowViewRange; obj.ViewRange = viewRange; obj.ViewVisDetect = viewVisDetect; obj.HearingDetect = hearingDetect; obj.HearingDetectRange = hearingDetectRange; obj.HearingCanDetect = true; obj.SuspiciousMult = suspiciousMult; obj.SuspiciousDelay = suspiciousDelay; } } } } private static Character player; private static Character[] players; private static List<Character> allPlayers; private static float goodViewAngle = 40f; private static float viewAngle = 160f; private static float viewRange = 80f; private static float viewVisDetect = 80f; private static float lowViewRange = 35f; private static float suspiciousMult = 20f; private static float suspiciousDelay = 10f; private static float hearingDetect = 30f; private static float hearingDetectRange = 40f; private static float chanceToSwitchTargetOnHurt = 80f; private static int playersNo = 0; private static int counterNum = 0; private static List<UID> enemyHOTs; private static List<int> enemyTimers; private static int botRegenTimer = 20; private static float botDmgRange = 40f; private static float botDmgMult = 0.2f; private static int pullEnemiesTimer = 3; private static Coroutine pullCO; internal static void Awake() { enemyHOTs = new List<UID>(); enemyTimers = new List<int>(); players = (Character[])(object)new Character[2]; allPlayers = new List<Character>(); SL.OnGameplayResumedAfterLoading += Fixer; SL.OnGameplayResumedAfterLoading += NerfStability; } private static void NerfStability() { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { item.ControlledCharacter.Stats.m_stabilityRegen.BaseValue = 5f; } } private static void Fixer() { counterNum = 0; player = CharacterManager.Instance.GetFirstLocalCharacter(); if (player.IsWorldHost) { if (pullCO != null) { ((MonoBehaviour)HardcoreRebalanceBase.Instance).StopCoroutine(pullCO); } pullCO = ((MonoBehaviour)HardcoreRebalanceBase.Instance).StartCoroutine(EnemyPull()); ((MonoBehaviour)HardcoreRebalanceBase.Instance).StartCoroutine(EnemyHealer()); } } private static IEnumerator EnemyHealer() { yield return (object)new WaitForSeconds(2f); List<Character> list = new List<Character>(); CharacterManager.Instance.FindCharactersInRange(player.CenterPosition, botDmgRange, ref list); foreach (Character item in list) { if (item.IsAI && item.Alive && !item.IsDead && item.Stats.CurrentHealth > 2f) { item.Stats.AffectHealth(1000f); } } } private static IEnumerator EnemyPull() { while ((Object)(object)player != (Object)null) { foreach (PlayerSystem item in Global.Lobby.PlayersInLobby) { Character nplayer = item.ControlledCharacter; if (!((Object)(object)nplayer != (Object)null)) { continue; } List<Character> list = new List<Character>(); CharacterManager.Instance.FindCharactersInRange(nplayer.CenterPosition, botDmgRange, ref list); foreach (Character enemy in list) { yield return (object)new WaitForSeconds(Random.Range(0.1f, (float)pullEnemiesTimer)); TargetingSystem targetingSystem = enemy.TargetingSystem; if ((Object)(object)((targetingSystem != null) ? targetingSystem.LockingPoint : null) != (Object)null && !enemy.IsAlly(nplayer) && enemy.IsAI && enemy.Stats.CurrentHealth > 0f && !Physics.Linecast(enemy.CenterPosition, ((Component)((Component)nplayer).gameObject.GetComponent<Collider>()).transform.position, Global.SightHideMask) && Random.Range(1, 3) == 1) { enemy.TargetingSystem.SwitchTarget(nplayer.LockingPoint); } } } } } private static void drainStability(Character player, float _amount, bool isMana = false) { _amount = ((!isMana) ? (_amount * 1f) : (_amount * 2.5f)); if (_amount >= 30f) { _amount = 30f; } player.m_stability = Mathf.Clamp(player.m_stability - _amount, 0f, 100f); _ = player.Stability; _ = 1f; } } [BepInPlugin("com.iggy.hardcorere", "True Hardcore", "3.1.0")] [BepInDependency("com.sinai.SideLoader", "3.7.7")] public class HardcoreRebalanceBase : BaseUnityPlugin { private const string GUID = "com.iggy.hardcorere"; private const string NAME = "True Hardcore"; private const string VERSION = "3.1.0"; public static ConfigEntry<bool> EnhancedAI; public static ConfigEntry<bool> PickupAnim; public static ConfigEntry<bool> PerCityStash; public static ConfigEntry<bool> CampingGuard; public static ConfigEntry<bool> CraftLimits; public static ConfigEntry<bool> NightGates; public static ConfigEntry<bool> EnemyHealing; public static bool EnhancedAIStored; public static bool PickupAnimStored; public static bool PerCityStashStored; public static bool CampingGuardStored; public static bool CraftLimitsStored; public static bool NightGatesStored; public static bool EnemyHealingStored; public static string OptionsName = "Weenie Hut Jrs Options (RESTART REQUIRED)"; public static HardcoreRebalanceBase Instance; internal void Awake() { //IL_0110: Unknown result type (might be due to invalid IL or missing references) Instance = this; Debug.Log((object)"True Hardcoreawake"); EnhancedAI = ((BaseUnityPlugin)this).Config.Bind<bool>(OptionsName, "Improve enemies AI", true, "Disable to: Remove Improved enemies sight, aggresiveness and hearing."); PickupAnim = ((BaseUnityPlugin)this).Config.Bind<bool>(OptionsName, "OoC Animations", true, "Disable to: Remove looting and equiping animations while out of combat"); PerCityStash = ((BaseUnityPlugin)this).Config.Bind<bool>(OptionsName, "Per City Stash", true, "Disable to: Make stashes universal again, instead of per city."); CampingGuard = ((BaseUnityPlugin)this).Config.Bind<bool>(OptionsName, "Unsafe Camping", true, "Disable to: Allow players to guard while camping."); CraftLimits = ((BaseUnityPlugin)this).Config.Bind<bool>(OptionsName, "Crafting Limits", true, "Disable to: Allow VANILLA items to be crafted without recipee knowledge too. By default only MOD items can be crafted with no recipee."); NightGates = ((BaseUnityPlugin)this).Config.Bind<bool>(OptionsName, "Night Gates", true, "Disable to: Allow players to enter cities freely at night."); EnemyHealing = ((BaseUnityPlugin)this).Config.Bind<bool>(OptionsName, "Enemy Healing", true, "Disable to: Stop enemies from healing when damaging players."); _ = ((Component)this).gameObject; EventsManager.Awake(); AIManager.Awake(); CraftingLimits.Awake(); DeathMortality.Awake(); new Harmony("com.iggy.hardcorere").PatchAll(); } internal void Start() { EnhancedAIStored = EnhancedAI.Value; PickupAnimStored = PickupAnim.Value; PerCityStashStored = PerCityStash.Value; CampingGuardStored = CampingGuard.Value; CraftLimitsStored = CraftLimits.Value; NightGatesStored = NightGates.Value; EnemyHealingStored = EnemyHealing.Value; Debug.Log((object)"True HardcoreLoaded"); } } internal static class TrapAwareness { [HarmonyPatch(typeof(TrapTrigger), "OnTriggerEnter")] public class TrapTrigger_OnTriggerEnter { [HarmonyPrefix] public static bool Prefix(TrapTrigger __instance, Collider _other) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Invalid comparison between Unknown and I4 //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (AreaManager.Instance.GetIsCurrentAreaTownOrCity()) { return true; } if ((Object)(object)_other == (Object)null) { return true; } if ((Object)(object)NetworkLevelLoader.Instance == (Object)null || !NetworkLevelLoader.Instance.IsOverallLoadingDone) { if (!__instance.m_pendingActivation.Contains(_other)) { __instance.m_pendingActivation.Add(_other); } return true; } Character component = ((Component)_other).GetComponent<Character>(); if ((Object)(object)component == (Object)null || __instance.m_charactersInTrigger.Contains(component)) { return true; } if (__instance.IgnoreFaction || ((int)__instance.m_targetType == 1 && Object.op_Implicit((Object)(object)component.OwnerPlayerSys)) || ((int)__instance.m_targetType == 2 && UnityEngineExtensions.Contains<Factions>(__instance.m_targetableFactions, component.Faction))) { if (component.StatusEffectMngr.HasStatusEffect(HardcoreEffects.TrapAware.ToString())) { return false; } Debug.Log((object)(component.Name + " Added Awareness")); component.StatusEffectMngr.AddStatusEffect(HardcoreEffects.TrapAware.ToString()); return true; } return true; } } }
BepInEx/plugins/SLExtendedEffects-SideLoader_ExtendedEffects/SideLoader_ExtendedEffects.dll
Decompiled a day 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using SideLoader; using SideLoader.Model; using SideLoader.Model.Status; using SideLoader_ExtendedEffects.Events; using SideLoader_ExtendedEffects.Item_Context_Menu; using SideLoader_ExtendedEffects.Released; using TravelSpeed.Extensions; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SideLoader Custom Effects")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SideLoader Custom Effects")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TravelSpeed.Patches { [HarmonyPatch(typeof(Effect))] public static class EffectPatches { [HarmonyPatch("TryActivateLocally")] [HarmonyPrefix] public static bool Effect_TryActivateLocally_Prefix(Effect __instance, Character _affectedCharacter, object[] _infos) { return (Object)(object)__instance.m_parentStatusEffect == (Object)null || !__instance.m_parentStatusEffect.IsEffectSuspended(); } } [HarmonyPatch(typeof(StatusEffectDetailDisplay))] public static class StatusEffectDetailDisplayPatches { [HarmonyPatch("RefreshDisplay")] [HarmonyPostfix] public static void StatusEffectDetailDisplay_RefreshDisplay_Postfix(StatusEffectDetailDisplay __instance) { if ((Object)(object)__instance.m_statusEffect != (Object)null && __instance.m_statusEffect.IsTimerSuspended() && Object.op_Implicit((Object)(object)__instance.m_lblTimer)) { __instance.m_lblTimer.text = "Suspended"; } } } [HarmonyPatch(typeof(StatusEffect))] public static class StatusEffectPatches { [HarmonyPatch("UpdateTotalData")] [HarmonyPrefix] public static void StatusEffect_UpdateTotalData_Prefix(StatusEffect __instance, ref bool _updateDelta) { if (__instance.IsTimerSuspended()) { _updateDelta = false; } } } } namespace TravelSpeed.Extensions { public class StatusEffectExt { private bool timerSuspended = false; private bool effectSuspended = false; public bool TimerSuspended { get { return timerSuspended; } set { timerSuspended = value; } } public bool EffectSuspended { get { return effectSuspended; } set { effectSuspended = value; } } } public static class StatusEffectExtensions { private static ConditionalWeakTable<StatusEffect, StatusEffectExt> SuspendedEffects = new ConditionalWeakTable<StatusEffect, StatusEffectExt>(); public static void SetTimerSuspended(this StatusEffect statusEffect, bool suspended) { StatusEffectExt value = SuspendedEffects.GetValue(statusEffect, (StatusEffect key) => new StatusEffectExt()); value.TimerSuspended = suspended; } public static bool IsTimerSuspended(this StatusEffect statusEffect) { if (SuspendedEffects.TryGetValue(statusEffect, out var value)) { return value.TimerSuspended; } return false; } public static void SetEffectSuspended(this StatusEffect statusEffect, bool suspended) { StatusEffectExt value = SuspendedEffects.GetValue(statusEffect, (StatusEffect key) => new StatusEffectExt()); value.EffectSuspended = suspended; } public static bool IsEffectSuspended(this StatusEffect statusEffect) { if (SuspendedEffects.TryGetValue(statusEffect, out var value)) { return value.EffectSuspended; } return false; } } } namespace SideLoader_ExtendedEffects { public class CustomItemMenuManager { public Dictionary<int, CustomItemDisplayMenuOption> CustomItemOptions { get; private set; } public CustomItemMenuManager() { CustomItemOptions = new Dictionary<int, CustomItemDisplayMenuOption>(); } public void RegisterCustomMenuOption(int NewActionID, string ActionString, Action<Character, Item, ItemDisplayOptionPanel, int> OnCustomActionPressed, Func<Character, Item, ItemDisplayOptionPanel, int, bool> ShouldAddAction) { ExtendedEffects.Instance?.DebugLogMessage($"Registering custom action with ID {NewActionID} String {ActionString}"); if (!CustomItemOptions.ContainsKey(NewActionID)) { CustomItemOptions.Add(NewActionID, new CustomItemDisplayMenuOption(NewActionID, ActionString, OnCustomActionPressed, ShouldAddAction)); } else { ExtendedEffects.Instance?.DebugLogMessage($"Custom Action already exists with ID {NewActionID}"); } } public void UnRegisterCustomMenuOption(int CustomActionID) { if (CustomItemOptions.ContainsKey(CustomActionID)) { ExtendedEffects.Instance?.DebugLogMessage($"UnRegistering custom action ID {CustomActionID}"); CustomItemOptions.Remove(CustomActionID); } } } [BepInPlugin("sideloaderextendedeffects.extendedeffects", "SideLoader Extended Effects", "1.2.4")] public class ExtendedEffects : BaseUnityPlugin { public const string GUID = "sideloaderextendedeffects.extendedeffects"; public const string NAME = "SideLoader Extended Effects"; public const string VERSION = "1.2.4"; internal static ManualLogSource _Log; public const string SL_VISUAL_TRANSFORM = "SLVISUALCONTAINER"; public static ConfigEntry<bool> AddTestItems; public static ConfigEntry<bool> AddItemDebug; public static ConfigEntry<bool> ShowDebugLog; private static Dictionary<string, string> _SkillTreeOverrides = new Dictionary<string, string>(); public static ExtendedEffects Instance { get; private set; } public CustomItemMenuManager CustomItemMenuManager { get; private set; } public static Dictionary<string, string> SkillTreeOverrides => _SkillTreeOverrides; internal void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) _Log = ((BaseUnityPlugin)this).Logger; Instance = this; CustomItemMenuManager = new CustomItemMenuManager(); InitializeSL(); InitializeConfig(); new Harmony("sideloaderextendedeffects.extendedeffects").PatchAll(); } private void InitializeSL() { SL.BeforePacksLoaded += SL_BeforePacksLoaded; } private void InitializeConfig() { AddItemDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("SideLoader Extended Effects", "Add Debug Menu options to Items", false, "Add Debug Menu options to Items."); AddTestItems = ((BaseUnityPlugin)this).Config.Bind<bool>("SideLoader Extended Effects", "Add Test Items", false, "Adds test items, spawnable using the debug mode menu (requires restart)"); ShowDebugLog = ((BaseUnityPlugin)this).Config.Bind<bool>("SideLoader Extended Effects", "Show Debug Log", true, "Enables the Debug Log for SideLoader Extended Effects."); } private void SL_BeforePacksLoaded() { if (AddTestItems.Value) { DefineTestItems(); } if (AddItemDebug.Value) { CustomItemMenuManager.RegisterCustomMenuOption(101010, "Debug Log Item", delegate(Character Character, Item Item, ItemDisplayOptionPanel ItemDisplayOptionPanel, int someInt) { ((BaseUnityPlugin)this).Logger.LogMessage((object)Item); ((BaseUnityPlugin)this).Logger.LogMessage((object)$"Item Name {Item.DisplayName} Item ID {Item.ItemID} Item UID {Item.UID}"); ((BaseUnityPlugin)this).Logger.LogMessage((object)$"Item Current Slot {Item.CurrentEquipmentSlot}"); ((BaseUnityPlugin)this).Logger.LogMessage((object)$"Durability {Item.CurrentDurability} / {Item.MaxDurability}"); }, null); CustomItemMenuManager.RegisterCustomMenuOption(101110, "Repair Item", delegate(Character Character, Item Item, ItemDisplayOptionPanel ItemDisplayOptionPanel, int someInt) { Item.RepairAmount(9000f); }, null); } } public static void AddSkillTreeOverride(string trainerUID, string customTreeUID) { if (!SkillTreeOverrides.ContainsKey(trainerUID)) { SkillTreeOverrides.Add(trainerUID, customTreeUID); } else { _Log.LogMessage((object)"Override already found for this Trainer! Not sure how to handle this!"); } } public static bool HasSkillTreeOverride(string trainerUID) { return SkillTreeOverrides.ContainsKey(trainerUID); } private void DefineTestItems() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_0167: 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_017d: Expected O, but got Unknown SL_MeleeWeapon val = new SL_MeleeWeapon(); ((SL_Item)val).Target_ItemID = 2000031; ((SL_Item)val).New_ItemID = -26999; ((SL_Item)val).Name = "Emo Test Blade of Testing"; ((SL_Item)val).Description = "WHACK"; ((SL_Item)val).StatsHolder = (SL_ItemStats)new SL_WeaponStats { BaseDamage = new List<SL_Damage> { new SL_Damage { Damage = 25f, Type = (Types)0 } }, AttackSpeed = 0.9f }; SL_EffectTransform[] array = new SL_EffectTransform[1]; SL_EffectTransform val2 = new SL_EffectTransform(); val2.TransformName = "Activation"; val2.Effects = (SL_Effect[])(object)new SL_Effect[0]; array[0] = val2; ((SL_Item)val).EffectTransforms = (SL_EffectTransform[])(object)array; SL_MeleeWeapon val3 = val; ((ContentTemplate)val3).ApplyTemplate(); SL_Item val4 = new SL_Item(); val4.Target_ItemID = 4300130; val4.New_ItemID = -26987; val4.Name = "Emo Test Potion"; val4.Description = "Test Potion"; val4.EffectBehaviour = (EditBehaviours)2; val4.QtyRemovedOnUse = 0; SL_EffectTransform[] array2 = new SL_EffectTransform[1]; val2 = new SL_EffectTransform(); val2.TransformName = "Effects"; val2.Effects = (SL_Effect[])(object)new SL_Effect[0]; array2[0] = val2; val4.EffectTransforms = (SL_EffectTransform[])(object)array2; SL_Item val5 = val4; ((ContentTemplate)val5).ApplyTemplate(); SL_Skill val6 = new SL_Skill(); ((SL_Item)val6).Target_ItemID = 8100120; ((SL_Item)val6).New_ItemID = -26986; ((SL_Item)val6).Name = "Emo Test Skill"; ((SL_Item)val6).EffectBehaviour = (EditBehaviours)1; SL_EffectTransform[] array3 = new SL_EffectTransform[1]; val2 = new SL_EffectTransform(); val2.TransformName = "Activation"; val2.Effects = (SL_Effect[])(object)new SL_Effect[2] { new SL_RemoveItemFromInventory { ItemID = 4000010, ItemQuantity = 5 }, new SL_RemoveItemFromInventory { ItemID = 2000010, ItemQuantity = 2 } }; array3[0] = val2; ((SL_Item)val6).EffectTransforms = (SL_EffectTransform[])(object)array3; SL_Skill val7 = val6; ((ContentTemplate)val7).ApplyTemplate(); } public void DebugLogMessage(object logMessage) { if (ShowDebugLog.Value && _Log != null) { _Log.LogMessage(logMessage); } } } public class InstancedEvent<TInstance, TEvent> where TEvent : Delegate { private readonly Dictionary<TInstance, TEvent> dictionary = new Dictionary<TInstance, TEvent>(); public void AddListener(TInstance instance, TEvent listener) { if (!dictionary.ContainsKey(instance)) { dictionary.Add(instance, listener); return; } TEvent a = dictionary[instance]; a = Delegate.Combine(a, listener) as TEvent; dictionary[instance] = a; } public void RemoveListener(TInstance instance, TEvent listener) { if (dictionary.TryGetValue(instance, out var value)) { value = Delegate.Remove(value, listener) as TEvent; if (!value.GetInvocationList().Any()) { dictionary.Remove(instance); } else { dictionary[instance] = value; } } } internal void InvokeForInstance(TInstance instance, params object[] args) { if (dictionary.TryGetValue(instance, out var value)) { value.DynamicInvoke(args); } } } public static class OutwardEvents { public static InstancedEvent<Character, Action<Character, CharacterDamageEvent>> OnCharacterRecievedHit; } public static class OutwardHelpers { public static string Emission_Property_Value = "_EmissionColor"; public static void UpdateWeaponDamage(Weapon WeaponInstance, DamageList newDamageList) { WeaponInstance.Damage.Clear(); WeaponInstance.Stats.BaseDamage = newDamageList; WeaponInstance.m_baseDamage = WeaponInstance.Stats.BaseDamage.Clone(); WeaponInstance.m_activeBaseDamage = WeaponInstance.Stats.BaseDamage.Clone(); WeaponInstance.baseDamage = WeaponInstance.Stats.BaseDamage.Clone(); WeaponInstance.Stats.Attacks = SL_WeaponStats.GetScaledAttackData(WeaponInstance); } public static MeshFilter TryGetWeaponMesh(Equipment weaponGameObject, bool IncludeInActive = true) { BoxCollider[] componentsInChildren = ((Component)((Item)weaponGameObject).GetItemVisual()).GetComponentsInChildren<BoxCollider>(true); foreach (BoxCollider val in componentsInChildren) { ExtendedEffects.Instance.DebugLogMessage("BoxCollider GO Name " + ((Object)((Component)val).transform).name); if (((Component)((Component)val).transform.parent).gameObject.activeInHierarchy) { return ((Component)val).GetComponent<MeshFilter>(); } } return null; } public static Transform TryGetHumanBone(Character character, HumanBodyBones bone) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return ((Object)(object)character.Animator != (Object)null) ? character.Animator.GetBoneTransform(bone) : null; } public static T GetFromAssetBundle<T>(string SLPackName, string AssetBundle, string key) where T : Object { if (!SL.PacksLoaded) { return default(T); } return SL.GetSLPack(SLPackName).AssetBundles[AssetBundle].LoadAsset<T>(key); } public static List<T> GetTypeFromColliders<T>(Collider[] colliders) where T : Component { List<T> list = new List<T>(); foreach (Collider val in colliders) { T componentInChildren = ((Component)val).GetComponentInChildren<T>(); if ((Object)(object)componentInChildren != (Object)null) { list.Add(componentInChildren); } } return list; } public static Tag GetTagFromName(string tagName) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Tag[] tags = TagSourceManager.Instance.m_tags; foreach (Tag val in tags) { if (val.TagName == tagName) { return val; } } return default(Tag); } } public struct CharacterDamageEvent { public Character DamageTarget; public object DamageSource; public float TotalDamage; public DamageList DamageDone; public Vector3 DamageDirection; public Vector3 DamagePosition; public float HitAngle; public float HitAngleDirection; public Character DamageSourceCharacter; public float KnocksBack; public bool DamageInventory; } public struct BagEventData { public Bag Bag; public Character CharacterOwner; } public class SL_AffectCooldown : SL_Effect, ICustomModel { public float Amount; public bool IsModifier; public bool OnOwner; public int[] AllowedSkills; public Type SLTemplateModel => typeof(SL_AffectCooldown); public Type GameModel => typeof(AffectCooldown); public override void ApplyToComponent<T>(T component) { AffectCooldown affectCooldown = component as AffectCooldown; affectCooldown.Amount = Amount; affectCooldown.IsModifier = IsModifier; affectCooldown.OnOwner = OnOwner; affectCooldown.AllowedSkills = AllowedSkills; } public override void SerializeEffect<T>(T effect) { AffectCooldown affectCooldown = effect as AffectCooldown; Amount = affectCooldown.Amount; IsModifier = affectCooldown.IsModifier; OnOwner = affectCooldown.OnOwner; AllowedSkills = affectCooldown.AllowedSkills; } } public class AffectCooldown : Effect, ICustomModel { public float Amount; public bool IsModifier; public bool OnOwner; public int[] AllowedSkills; public Type SLTemplateModel => typeof(SL_AffectCooldown); public Type GameModel => typeof(AffectCooldown); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { Character val = (OnOwner ? ((Effect)this).OwnerCharacter : _affectedCharacter); IList<string> learnedActiveSkillUIDs = val.Inventory.SkillKnowledge.GetLearnedActiveSkillUIDs(); foreach (string item2 in learnedActiveSkillUIDs) { Item item = ItemManager.Instance.GetItem(item2); Skill val2 = (Skill)(object)((item is Skill) ? item : null); SL.Log(((Item)val2).Name + " " + ((Item)val2).ItemID); if (AllowedSkills != null && AllowedSkills.Length != 0 && !Extensions.Contains(AllowedSkills, ((Item)val2).ItemID)) { SL.Log("Not Whitelisted"); continue; } float num = (IsModifier ? (val2.RealCooldown * Amount / 100f) : Amount); val2.m_remainingCooldownTime -= num; val2.UpdateCooldownRatio(); } } } public class SL_ApplyEnchantment : SL_Effect, ICustomModel { public EquipmentSlotIDs EquipmentSlot; public int EnchantmentID; public bool ApplyPermanently; public Type SLTemplateModel => typeof(SL_ApplyEnchantment); public Type GameModel => typeof(ApplyEnchantment); public override void ApplyToComponent<T>(T component) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) ApplyEnchantment applyEnchantment = component as ApplyEnchantment; applyEnchantment.EquipmentSlot = EquipmentSlot; applyEnchantment.EnchantmentId = EnchantmentID; applyEnchantment.ApplyPermanently = ApplyPermanently; } public override void SerializeEffect<T>(T effect) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) ApplyEnchantment applyEnchantment = effect as ApplyEnchantment; EnchantmentID = applyEnchantment.EnchantmentId; EquipmentSlot = applyEnchantment.EquipmentSlot; ApplyPermanently = applyEnchantment.ApplyPermanently; } } public class ApplyEnchantment : Effect, ICustomModel { public EquipmentSlotIDs EquipmentSlot; public int EnchantmentId; public bool ApplyPermanently; [SerializeField] private UID affectedItem = UID.Empty; public Type SLTemplateModel => typeof(SL_ApplyEnchantment); public Type GameModel => typeof(ApplyEnchantment); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_affectedCharacter == (Object)null) { ExtendedEffects.Instance.DebugLogMessage("Affected Character null"); } else if (_affectedCharacter.Inventory.Equipment.EquipmentSlots[EquipmentSlot].HasItemEquipped) { Equipment equippedItem = _affectedCharacter.Inventory.Equipment.EquipmentSlots[EquipmentSlot].EquippedItem; if (UID.op_Implicit(((Item)equippedItem).UID) != affectedItem) { ExtendedEffects.Instance.DebugLogMessage("Item has Changed"); if (!((UID)(ref affectedItem)).IsNull) { ExtendedEffects.Instance.DebugLogMessage("Cleaning Affected Item"); CleanAffectedItem(); } affectedItem = UID.op_Implicit(((Item)equippedItem).UID); if (!equippedItem.m_enchantmentIDs.Contains(EnchantmentId)) { ExtendedEffects.Instance.DebugLogMessage($"Adding Enchant {EnchantmentId} to {((Item)equippedItem).Name}"); equippedItem.AddEnchantment(EnchantmentId, false); } } } else if (!((UID)(ref affectedItem)).IsNull) { CleanAffectedItem(); } } public override void StopAffectLocally(Character _affectedCharacter) { if (!((UID)(ref affectedItem)).IsNull) { CleanAffectedItem(); } ((Effect)this).StopAffectLocally(_affectedCharacter); } private void CleanAffectedItem() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (ApplyPermanently) { return; } Item item = ItemManager.Instance.GetItem(UID.op_Implicit(affectedItem)); Equipment val = (Equipment)(object)((item is Equipment) ? item : null); val.m_enchantmentIDs.Remove(EnchantmentId); foreach (Enchantment activeEnchantment in val.m_activeEnchantments) { if (((EffectPreset)activeEnchantment).PresetID == EnchantmentId) { val.m_activeEnchantments.Remove(activeEnchantment); activeEnchantment.UnapplyEnchantment(); float durabilityRatio = ((Item)val).DurabilityRatio; val.RefreshEnchantmentModifiers(); if (durabilityRatio != ((Item)val).DurabilityRatio) { ((Item)val).SetDurabilityRatio(durabilityRatio); } break; } } affectedItem = UID.Empty; } } public class SL_ChangeMaterialTimed : SL_Effect, ICustomModel { public string SLPackName; public string AssetBundleName; public string PrefabName; public float ChangeTime; public Type SLTemplateModel => typeof(SL_ChangeMaterialTimed); public Type GameModel => typeof(ChangeMaterialTimed); public override void ApplyToComponent<T>(T component) { ChangeMaterialTimed changeMaterialTimed = component as ChangeMaterialTimed; changeMaterialTimed.ChangeTime = ChangeTime; changeMaterialTimed.SLPackName = SLPackName; changeMaterialTimed.AssetBundleName = AssetBundleName; changeMaterialTimed.PrefabName = PrefabName; } public override void SerializeEffect<T>(T effect) { ChangeMaterialTimed changeMaterialTimed = effect as ChangeMaterialTimed; ChangeTime = changeMaterialTimed.ChangeTime; SLPackName = changeMaterialTimed.SLPackName; AssetBundleName = changeMaterialTimed.AssetBundleName; PrefabName = changeMaterialTimed.PrefabName; } } public class ChangeMaterialTimed : Effect, ICustomModel { public string SLPackName; public string AssetBundleName; public string PrefabName; public float ChangeTime; private bool IsChanged; private Dictionary<Renderer, Material> CurrentRenderers = new Dictionary<Renderer, Material>(); public Type SLTemplateModel => typeof(SL_ChangeMaterialTimed); public Type GameModel => typeof(ChangeMaterialTimed); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (IsChanged) { return; } Material fromAssetBundle = OutwardHelpers.GetFromAssetBundle<Material>(SLPackName, AssetBundleName, PrefabName); if ((Object)(object)fromAssetBundle != (Object)null) { CacheOriginalMaterials(_affectedCharacter); ChangeMaterialForRenderers(fromAssetBundle); if (ChangeTime > 0f) { ((MonoBehaviour)this).StartCoroutine(DelayRevert(_affectedCharacter)); } IsChanged = true; } } private IEnumerator DelayRevert(Character _affectedCharacter) { yield return (object)new WaitForSeconds(ChangeTime); ReturnToOriginalMaterials(); } public override void StopAffectLocally(Character _affectedCharacter) { ((Effect)this).StopAffectLocally(_affectedCharacter); if (ChangeTime <= 0f) { ReturnToOriginalMaterials(); } } private void CacheOriginalMaterials(Character _affectedCharacter) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown if ((Object)(object)_affectedCharacter == (Object)null) { return; } if (CurrentRenderers.Count > 0) { ReturnToOriginalMaterials(); } CurrentRenderers.Clear(); ExtendedEffects.Instance.DebugLogMessage("Caching Original Materials"); Renderer[] renderers = GetRenderers(_affectedCharacter.VisualHolderTrans, IncludeInActive: false); Renderer[] array = renderers; foreach (Renderer val in array) { if ((Object)(object)val != (Object)null) { ExtendedEffects.Instance.DebugLogMessage("Cached " + ((Object)((Component)val).transform).name + " " + ((Object)val.material).name); CurrentRenderers.Add(val, new Material(val.material)); } } } private void ChangeMaterialForRenderers(Material NewMaterial) { foreach (KeyValuePair<Renderer, Material> currentRenderer in CurrentRenderers) { if (!((Object)(object)currentRenderer.Key == (Object)null) && !((Object)(object)currentRenderer.Value == (Object)null) && CurrentRenderers.TryGetValue(currentRenderer.Key, out var _)) { ExtendedEffects.Instance.DebugLogMessage($"Changing {((Object)((Component)currentRenderer.Key).transform).name} to {NewMaterial}"); currentRenderer.Key.material = NewMaterial; } } } private void ReturnToOriginalMaterials() { foreach (KeyValuePair<Renderer, Material> currentRenderer in CurrentRenderers) { if (!((Object)(object)currentRenderer.Key == (Object)null) && !((Object)(object)currentRenderer.Value == (Object)null) && CurrentRenderers.TryGetValue(currentRenderer.Key, out var value)) { ExtendedEffects.Instance.DebugLogMessage($"Reverting {((Object)((Component)currentRenderer.Key).transform).name} to {currentRenderer.Value}"); currentRenderer.Key.material = value; } } IsChanged = false; } private Renderer[] GetRenderers(Transform transform, bool IncludeInActive) { return ((Component)transform).GetComponentsInChildren<Renderer>(IncludeInActive); } } public class SL_CustomImbueVFX : SL_Effect, ICustomModel { public string SLPackName; public string AssetBundleName; public string PrefabName; public Vector3 PositionOffset; public Vector3 RotationOffset; public bool IsMainHand = true; public Type SLTemplateModel => typeof(SL_CustomImbueVFX); public Type GameModel => typeof(SLEx_CustomImbueVFX); public override void ApplyToComponent<T>(T component) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) SLEx_CustomImbueVFX sLEx_CustomImbueVFX = component as SLEx_CustomImbueVFX; sLEx_CustomImbueVFX.SLPackName = SLPackName; sLEx_CustomImbueVFX.AssetBundleName = AssetBundleName; sLEx_CustomImbueVFX.PrefabName = PrefabName; sLEx_CustomImbueVFX.PositionOffset = PositionOffset; sLEx_CustomImbueVFX.RotationOffset = RotationOffset; sLEx_CustomImbueVFX.IsMainHand = IsMainHand; } public override void SerializeEffect<T>(T effect) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) SLEx_CustomImbueVFX sLEx_CustomImbueVFX = effect as SLEx_CustomImbueVFX; SLPackName = sLEx_CustomImbueVFX.SLPackName; AssetBundleName = sLEx_CustomImbueVFX.AssetBundleName; PrefabName = sLEx_CustomImbueVFX.PrefabName; PositionOffset = sLEx_CustomImbueVFX.PositionOffset; RotationOffset = sLEx_CustomImbueVFX.RotationOffset; IsMainHand = sLEx_CustomImbueVFX.IsMainHand; } } public class SLEx_CustomImbueVFX : Effect, ICustomModel { public string SLPackName; public string AssetBundleName; public string PrefabName; public Vector3 PositionOffset; public Vector3 RotationOffset; public bool IsMainHand; private GameObject Instance; private Equipment LastEquipmentInstance = null; public Type SLTemplateModel => typeof(SL_CustomImbueVFX); public Type GameModel => typeof(SLEx_CustomImbueVFX); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if ((Object)(object)_affectedCharacter == (Object)null) { return; } if ((Object)(object)LastEquipmentInstance != (Object)null && (Object)(object)_affectedCharacter.CurrentWeapon != (Object)(object)LastEquipmentInstance) { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)Instance); } LastEquipmentInstance = null; } Equipment val = FindCurrentWeapon(_affectedCharacter); if ((Object)(object)val == (Object)null) { return; } GameObject fromAssetBundle = OutwardHelpers.GetFromAssetBundle<GameObject>(SLPackName, AssetBundleName, PrefabName); if ((Object)(object)fromAssetBundle != (Object)null) { ParticleSystem[] componentsInChildren = fromAssetBundle.GetComponentsInChildren<ParticleSystem>(); if (componentsInChildren.Length == 0) { ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX prefab " + PrefabName + " and its children do not contain a particle system."); return; } MeshFilter val2 = OutwardHelpers.TryGetWeaponMesh(val, IncludeInActive: false); if ((Object)(object)val2 == (Object)null) { ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX Mesh Filter For " + ((Item)val).Name + " cant be found."); return; } if ((Object)(object)Instance == (Object)null) { Instance = Object.Instantiate<GameObject>(fromAssetBundle); } UpdateParticleSystemMesh(Instance, val, val2); LastEquipmentInstance = val; } else { ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX Prefab from AssetBundle " + AssetBundleName + " was null."); } } private void UpdateParticleSystemMesh(GameObject Instance, Equipment CurrentWeapon, MeshFilter meshFilter) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = Instance.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ShapeModule shape; if ((Object)(object)val != (Object)null) { shape = val.shape; if ((int)((ShapeModule)(ref shape)).shapeType == 13) { goto IL_004e; } } shape = val.shape; if ((int)((ShapeModule)(ref shape)).shapeType != 6) { continue; } goto IL_004e; IL_004e: ShapeModule shape2 = val.shape; ((ShapeModule)(ref shape2)).mesh = meshFilter.sharedMesh; ((ShapeModule)(ref shape2)).meshRenderer = ((Component)meshFilter).GetComponent<MeshRenderer>(); ((ShapeModule)(ref shape2)).scale = ((Component)CurrentWeapon).transform.localScale; ((ShapeModule)(ref shape2)).position = Vector3.zero; ((ShapeModule)(ref shape2)).rotation = Vector3.zero; } Instance.transform.parent = ((Component)((Item)CurrentWeapon).LoadedVisual).transform; if (RotationOffset == Vector3.zero) { Instance.transform.localEulerAngles = new Vector3(90f, 270f, 0f); } else { Instance.transform.localEulerAngles = RotationOffset; } Instance.transform.localPosition = PositionOffset; } private Equipment FindCurrentWeapon(Character _affectedCharacter) { Equipment val = null; EquipmentSlot matchingSlot = _affectedCharacter.Inventory.Equipment.GetMatchingSlot((EquipmentSlotIDs)6); if (IsMainHand) { if ((Object)(object)_affectedCharacter.CurrentWeapon == (Object)null) { ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX Current Weapon is null"); return null; } val = (Equipment)(object)_affectedCharacter.CurrentWeapon; } else { if ((Object)(object)matchingSlot == (Object)null) { ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX OffHand EquipmentSlot cannot be found"); return null; } if (!matchingSlot.HasItemEquipped) { ExtendedEffects.Instance?.DebugLogMessage("SLEx_CustomImbueVFX OffHand EquipmentSlotitem is null"); return null; } val = matchingSlot.EquippedItem; } return val; } public override void CleanUpOnDestroy() { ((Effect)this).CleanUpOnDestroy(); if (Object.op_Implicit((Object)(object)Instance)) { ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX Cleaning up Instance"); Object.Destroy((Object)(object)Instance); } } public override void StopAffectLocally(Character _affectedCharacter) { if (Object.op_Implicit((Object)(object)Instance)) { ExtendedEffects.Instance.DebugLogMessage("SLEx_CustomImbueVFX destroying Instance"); Object.Destroy((Object)(object)Instance); } } } public class SL_ForceAIState : SL_Effect, ICustomModel { public int AIState; public Type SLTemplateModel => typeof(SL_ForceAIState); public Type GameModel => typeof(SLEx_ForceAIStateForTime); public override void ApplyToComponent<T>(T component) { SLEx_ForceAIStateForTime sLEx_ForceAIStateForTime = component as SLEx_ForceAIStateForTime; sLEx_ForceAIStateForTime.AIState = AIState; } public override void SerializeEffect<T>(T effect) { SLEx_ForceAIStateForTime sLEx_ForceAIStateForTime = effect as SLEx_ForceAIStateForTime; AIState = sLEx_ForceAIStateForTime.AIState; } } public class SLEx_ForceAIStateForTime : Effect, ICustomModel { public int AIState; public Type SLTemplateModel => typeof(SL_ForceAIState); public Type GameModel => typeof(SLEx_ForceAIStateForTime); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (AIState <= 3) { CharacterAI component = ((Component)_affectedCharacter).GetComponent<CharacterAI>(); if (Object.op_Implicit((Object)(object)component)) { ForceCharacterAIState(component, AIState); } } } private void ForceCharacterAIState(CharacterAI CharacterAI, int state) { CharacterAI.SwitchAiState(state); } } public class SL_HidePlayer : SL_Effect, ICustomModel { public float HideTime; public Type SLTemplateModel => typeof(SL_HidePlayer); public Type GameModel => typeof(SLEx_HidePlayer); public override void ApplyToComponent<T>(T component) { SLEx_HidePlayer sLEx_HidePlayer = component as SLEx_HidePlayer; sLEx_HidePlayer.HideTime = HideTime; } public override void SerializeEffect<T>(T effect) { SLEx_HidePlayer sLEx_HidePlayer = effect as SLEx_HidePlayer; HideTime = sLEx_HidePlayer.HideTime; } } public class SLEx_HidePlayer : Effect, ICustomModel { public float HideTime; private bool IsRunning = false; public Type SLTemplateModel => typeof(SL_HidePlayer); public Type GameModel => typeof(SLEx_HidePlayer); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { SL.Log("Activating Locally"); if (!IsRunning) { ((MonoBehaviour)this).StartCoroutine(ToggleCharacterVisual(((Effect)this).OwnerCharacter)); } } private IEnumerator ToggleCharacterVisual(Character _affectedCharacter) { IsRunning = true; ((Component)_affectedCharacter.VisualHolderTrans).gameObject.SetActive(false); yield return (object)new WaitForSeconds(HideTime); ((Component)_affectedCharacter.VisualHolderTrans).gameObject.SetActive(true); IsRunning = false; } } public class SL_PlayAssetBundleVFX : SL_Effect, ICustomModel { public string SLPackName; public string AssetBundleName; public string PrefabName; public Vector3 PositionOffset; public Vector3 RotationOffset; public bool ParentToAffected; public bool PositionOffsetAsRelativeDirection; public bool RotateToPlayerDirection; public float LifeTime; public virtual Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX); public virtual Type GameModel => typeof(SLEx_PlayAssetBundleVFX); public override void ApplyToComponent<T>(T component) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) SLEx_PlayAssetBundleVFX sLEx_PlayAssetBundleVFX = component as SLEx_PlayAssetBundleVFX; sLEx_PlayAssetBundleVFX.SLPackName = SLPackName; sLEx_PlayAssetBundleVFX.AssetBundleName = AssetBundleName; sLEx_PlayAssetBundleVFX.PrefabName = PrefabName; sLEx_PlayAssetBundleVFX.PositionOffset = PositionOffset; sLEx_PlayAssetBundleVFX.RotationOffset = RotationOffset; sLEx_PlayAssetBundleVFX.ParentToAffected = ParentToAffected; sLEx_PlayAssetBundleVFX.PositionOffsetAsRelativeDirection = PositionOffsetAsRelativeDirection; sLEx_PlayAssetBundleVFX.RotateToPlayerDirection = RotateToPlayerDirection; sLEx_PlayAssetBundleVFX.LifeTime = LifeTime; } public override void SerializeEffect<T>(T effect) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) SLEx_PlayAssetBundleVFX sLEx_PlayAssetBundleVFX = effect as SLEx_PlayAssetBundleVFX; SLPackName = sLEx_PlayAssetBundleVFX.SLPackName; AssetBundleName = sLEx_PlayAssetBundleVFX.AssetBundleName; PrefabName = sLEx_PlayAssetBundleVFX.PrefabName; PositionOffset = sLEx_PlayAssetBundleVFX.PositionOffset; RotationOffset = sLEx_PlayAssetBundleVFX.RotationOffset; ParentToAffected = sLEx_PlayAssetBundleVFX.ParentToAffected; RotateToPlayerDirection = sLEx_PlayAssetBundleVFX.RotateToPlayerDirection; LifeTime = sLEx_PlayAssetBundleVFX.LifeTime; } } public class SLEx_PlayAssetBundleVFX : Effect, ICustomModel { public string SLPackName; public string AssetBundleName; public string PrefabName; public Vector3 PositionOffset; public Vector3 RotationOffset; public bool ParentToAffected; public bool PositionOffsetAsRelativeDirection; public bool RotateToPlayerDirection; public float LifeTime; private GameObject Instance; public virtual Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX); public virtual Type GameModel => typeof(SLEx_PlayAssetBundleVFX); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) GameObject fromAssetBundle = OutwardHelpers.GetFromAssetBundle<GameObject>(SLPackName, AssetBundleName, PrefabName); if ((Object)(object)fromAssetBundle != (Object)null) { if ((Object)(object)Instance == (Object)null) { Instance = Object.Instantiate<GameObject>(fromAssetBundle); } if (ParentToAffected) { Instance.transform.parent = _affectedCharacter.VisualHolderTrans; Instance.transform.localPosition = PositionOffset; Instance.transform.localEulerAngles = (RotateToPlayerDirection ? Vector3.zero : RotationOffset); } else { Instance.transform.position = ((Component)_affectedCharacter).transform.position + (PositionOffsetAsRelativeDirection ? (((Component)_affectedCharacter).transform.forward + ((Component)_affectedCharacter).transform.TransformVector(PositionOffset)) : PositionOffset); Instance.transform.eulerAngles = (RotateToPlayerDirection ? ((Component)_affectedCharacter).transform.eulerAngles : RotationOffset); } if (LifeTime > 0f) { ExtendedEffects.Instance.DebugLogMessage($"SLEx_PlayAssetBundleVFX LIFETIME IS {LifeTime}"); Object.Destroy((Object)(object)Instance, LifeTime); } } else { ExtendedEffects.Instance.DebugLogMessage("SLEx_PlayAssetBundleVFX Prefab from AssetBundle " + AssetBundleName + " was null."); } } public override void CleanUpOnDestroy() { ((Effect)this).CleanUpOnDestroy(); if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)Instance); } } public override void StopAffectLocally(Character _affectedCharacter) { if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)Instance); } } } public class SL_PlayAssetBundleVFX_Bones : SL_PlayAssetBundleVFX { public int BoneID; public override Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX_Bones); public override Type GameModel => typeof(SLEx_PlayAssetBundleVFX_Bones); public override void ApplyToComponent<T>(T component) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) SLEx_PlayAssetBundleVFX_Bones sLEx_PlayAssetBundleVFX_Bones = component as SLEx_PlayAssetBundleVFX_Bones; sLEx_PlayAssetBundleVFX_Bones.SLPackName = SLPackName; sLEx_PlayAssetBundleVFX_Bones.AssetBundleName = AssetBundleName; sLEx_PlayAssetBundleVFX_Bones.PrefabName = PrefabName; sLEx_PlayAssetBundleVFX_Bones.PositionOffset = PositionOffset; sLEx_PlayAssetBundleVFX_Bones.RotationOffset = RotationOffset; sLEx_PlayAssetBundleVFX_Bones.ParentToAffected = ParentToAffected; sLEx_PlayAssetBundleVFX_Bones.PositionOffsetAsRelativeDirection = PositionOffsetAsRelativeDirection; sLEx_PlayAssetBundleVFX_Bones.LifeTime = LifeTime; sLEx_PlayAssetBundleVFX_Bones.RotateToPlayerDirection = RotateToPlayerDirection; sLEx_PlayAssetBundleVFX_Bones.BoneID = BoneID; } public override void SerializeEffect<T>(T effect) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) SLEx_PlayAssetBundleVFX_Bones sLEx_PlayAssetBundleVFX_Bones = effect as SLEx_PlayAssetBundleVFX_Bones; SLPackName = sLEx_PlayAssetBundleVFX_Bones.SLPackName; AssetBundleName = sLEx_PlayAssetBundleVFX_Bones.AssetBundleName; PrefabName = sLEx_PlayAssetBundleVFX_Bones.PrefabName; PositionOffset = sLEx_PlayAssetBundleVFX_Bones.PositionOffset; RotationOffset = sLEx_PlayAssetBundleVFX_Bones.RotationOffset; ParentToAffected = sLEx_PlayAssetBundleVFX_Bones.ParentToAffected; PositionOffsetAsRelativeDirection = sLEx_PlayAssetBundleVFX_Bones.PositionOffsetAsRelativeDirection; LifeTime = sLEx_PlayAssetBundleVFX_Bones.LifeTime; BoneID = sLEx_PlayAssetBundleVFX_Bones.BoneID; } } public class SLEx_PlayAssetBundleVFX_Bones : SLEx_PlayAssetBundleVFX { public int BoneID; private GameObject Instance; public override Type SLTemplateModel => typeof(SL_PlayAssetBundleVFX_Bones); public override Type GameModel => typeof(SLEx_PlayAssetBundleVFX_Bones); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) GameObject fromAssetBundle = OutwardHelpers.GetFromAssetBundle<GameObject>(SLPackName, AssetBundleName, PrefabName); if ((Object)(object)fromAssetBundle != (Object)null) { Transform val = OutwardHelpers.TryGetHumanBone(_affectedCharacter, (HumanBodyBones)BoneID); if ((Object)(object)val == (Object)null) { ExtendedEffects.Instance.DebugLogMessage("SLEx_PlayAssetBundleVFX_Bone cannot find target bone"); return; } if ((Object)(object)Instance == (Object)null) { Instance = Object.Instantiate<GameObject>(fromAssetBundle); } if (ParentToAffected) { Instance.transform.parent = val; Instance.transform.localPosition = PositionOffset; Instance.transform.localEulerAngles = RotationOffset; } else { Instance.transform.position = ((Component)val).transform.position + (PositionOffsetAsRelativeDirection ? ((Component)_affectedCharacter).transform.TransformPoint(PositionOffset) : PositionOffset); Instance.transform.eulerAngles = (RotateToPlayerDirection ? ((Component)_affectedCharacter).transform.eulerAngles : RotationOffset); } if (LifeTime > 0f) { ExtendedEffects.Instance.DebugLogMessage($"SLEx_PlayAssetBundleVFX_Bones LIFETIME IS {LifeTime}"); Object.Destroy((Object)(object)Instance, LifeTime); } } else { ExtendedEffects.Instance.DebugLogMessage("SLEx_PlayAssetBundleVFX_Bones Prefab from AssetBundle " + AssetBundleName + " was null."); } } public override void CleanUpOnDestroy() { base.CleanUpOnDestroy(); if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)Instance); } } public override void StopAffectLocally(Character _affectedCharacter) { if (LifeTime == 0f && Object.op_Implicit((Object)(object)Instance)) { Object.Destroy((Object)(object)Instance); } } } public class SL_SetWeaponEmission : SL_Effect, ICustomModel { public Vector3 Color; public float ColorIntensity = 4f; public float ColorLerpTime = 0.5f; public Type SLTemplateModel => typeof(SL_SetWeaponEmission); public Type GameModel => typeof(SLEx_SetWeaponEmission); public override void ApplyToComponent<T>(T component) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) SLEx_SetWeaponEmission sLEx_SetWeaponEmission = component as SLEx_SetWeaponEmission; sLEx_SetWeaponEmission.ColorIntensity = ColorIntensity; sLEx_SetWeaponEmission.NewColor = Color; sLEx_SetWeaponEmission.ColorLerpTime = ColorLerpTime; } public override void SerializeEffect<T>(T component) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) SLEx_SetWeaponEmission sLEx_SetWeaponEmission = component as SLEx_SetWeaponEmission; Color = sLEx_SetWeaponEmission.NewColor; ColorIntensity = sLEx_SetWeaponEmission.ColorIntensity; ColorLerpTime = sLEx_SetWeaponEmission.ColorLerpTime; } } public class SLEx_SetWeaponEmission : Effect, ICustomModel { public Vector3 NewColor; public float ColorIntensity; public float ColorLerpTime; private bool IsRunning = false; public Type SLTemplateModel => typeof(SL_SetWeaponEmission); public Type GameModel => typeof(SLEx_SetWeaponEmission); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) Weapon currentWeapon = ((Effect)this).OwnerCharacter.CurrentWeapon; if ((Object)(object)currentWeapon != (Object)null) { Renderer component = ((Component)((Component)((Item)currentWeapon).LoadedVisual).GetComponentInChildren<BoxCollider>()).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null && !IsRunning) { ((MonoBehaviour)this).StartCoroutine(LerpMaterialEmissionColor(component, ColorLerpTime, new Color(NewColor.x, NewColor.y, NewColor.z, 1f), ColorIntensity)); } } } private IEnumerator LerpMaterialEmissionColor(Renderer Renderer, float lerpTime, Color newColor, float Intensity) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) IsRunning = true; Color OriginalColor = Renderer.material.GetColor("_EmissionColor"); float timer = 0f; while (timer < lerpTime) { float currentPercent = timer / lerpTime; Renderer.material.SetColor("_EmissionColor", Color.Lerp(OriginalColor, newColor * Intensity, currentPercent)); timer += Time.deltaTime; yield return null; } IsRunning = false; } } public class SL_SummonExtension : SL_Effect, ICustomModel { public Vector3 NewBaseColor; public Vector3 NewParticlesColor; public SL_Damage NewWeaponDamage; public string StatusEffectOnSpawn; public Type SLTemplateModel => typeof(SL_SummonExtension); public Type GameModel => typeof(SummonExtension); public override void ApplyToComponent<T>(T component) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown SummonExtension summonExtension = component as SummonExtension; summonExtension.NewBaseColor = NewBaseColor; summonExtension.NewParticlesColor = NewParticlesColor; summonExtension.NewWeaponDamage = new DamageType(NewWeaponDamage.Type, NewWeaponDamage.Damage); summonExtension.StatusEffectOnSpawn = StatusEffectOnSpawn; } public override void SerializeEffect<T>(T effect) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown SummonExtension summonExtension = effect as SummonExtension; NewBaseColor = summonExtension.NewBaseColor; NewParticlesColor = summonExtension.NewParticlesColor; StatusEffectOnSpawn = summonExtension.StatusEffectOnSpawn; NewWeaponDamage = new SL_Damage { Damage = summonExtension.NewWeaponDamage.Damage, Type = summonExtension.NewWeaponDamage.Type }; } } public class SummonExtension : Effect { public Vector3 NewBaseColor; public Vector3 NewParticlesColor; public DamageType NewWeaponDamage; public string StatusEffectOnSpawn; public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if ((Object)(object)_affectedCharacter.CurrentSummon != (Object)null) { UpdateSummonBaseColor(_affectedCharacter); UpdateSummonParticles(_affectedCharacter); if (!string.IsNullOrEmpty(StatusEffectOnSpawn)) { AddSummonStatusEffects(_affectedCharacter.CurrentSummon); } if (NewWeaponDamage != null) { OverrideSummonWeaponDamage(_affectedCharacter.CurrentSummon); } } } private void UpdateSummonBaseColor(Character _affectedCharacter) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)((Effect)this).OwnerCharacter.CurrentSummon).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { val.material.SetColor("_Color", new Color(NewBaseColor.x, NewBaseColor.y, NewBaseColor.z)); } } private void UpdateSummonParticles(Character _affectedCharacter) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = ((Component)((Effect)this).OwnerCharacter.CurrentSummon).GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { MainModule main = val.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(NewParticlesColor.x, NewParticlesColor.y, NewParticlesColor.z)); } } } private void AddSummonStatusEffects(Character _summonCharacter) { StatusEffect statusEffectPrefab = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(StatusEffectOnSpawn); if ((Object)(object)statusEffectPrefab != (Object)null) { _summonCharacter.StatusEffectMngr.AddStatusEffect(statusEffectPrefab.StatusName); } else { ExtendedEffects._Log.LogMessage((object)("SL_SummonExtension : Could not find Status by name " + StatusEffectOnSpawn)); } } private void OverrideSummonWeaponDamage(Character _summonCharacter) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)_summonCharacter.CurrentWeapon != (Object)null && NewWeaponDamage != null) { OutwardHelpers.UpdateWeaponDamage(_summonCharacter.CurrentWeapon, new DamageList(NewWeaponDamage)); } } } public class SL_SuspendStatusEffect : SL_Effect, ICustomModel { public string[] StatusEffectIdentifiers; public Type SLTemplateModel => typeof(SL_SuspendStatusEffect); public Type GameModel => typeof(SLEx_SuspendStatusEffect); public override void ApplyToComponent<T>(T component) { SLEx_SuspendStatusEffect sLEx_SuspendStatusEffect = component as SLEx_SuspendStatusEffect; sLEx_SuspendStatusEffect.StatusEffectIdentifiers = StatusEffectIdentifiers; } public override void SerializeEffect<T>(T effect) { SLEx_SuspendStatusEffect sLEx_SuspendStatusEffect = effect as SLEx_SuspendStatusEffect; StatusEffectIdentifiers = sLEx_SuspendStatusEffect.StatusEffectIdentifiers; } } public class SLEx_SuspendStatusEffect : Effect, ICustomModel { public string[] StatusEffectIdentifiers; public Type SLTemplateModel => typeof(SL_SuspendStatusEffect); public Type GameModel => typeof(SLEx_SuspendStatusEffect); private void SetSuspendedEffects(Character _affectedCharacter, bool suspended) { if (StatusEffectIdentifiers == null || StatusEffectIdentifiers.Length == 0) { ExtendedEffects._Log.LogDebug((object)"SLEx_SuspendStatusEffect defined without effects. Please specify the StatusEffectIdentifiers to suspend."); return; } foreach (StatusEffect status in _affectedCharacter.StatusEffectMngr.Statuses) { if (UnityEngineExtensions.Contains<string>(StatusEffectIdentifiers, status.IdentifierName) && status.IsEffectSuspended() != suspended) { ExtendedEffects._Log.LogDebug((object)$"Suspending effect of {status.IdentifierName} = {suspended}"); status.SetEffectSuspended(suspended); } } } public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { SetSuspendedEffects(_affectedCharacter, suspended: true); } public override void StopAffectLocally(Character _affectedCharacter) { SetSuspendedEffects(_affectedCharacter, suspended: false); } } public class SL_SuspendStatusTimer : SL_Effect, ICustomModel { public string[] StatusEffectIdentifiers; public Type SLTemplateModel => typeof(SL_SuspendStatusTimer); public Type GameModel => typeof(SLEx_SuspendStatusTimer); public override void ApplyToComponent<T>(T component) { SLEx_SuspendStatusTimer sLEx_SuspendStatusTimer = component as SLEx_SuspendStatusTimer; sLEx_SuspendStatusTimer.StatusEffectIdentifiers = StatusEffectIdentifiers; } public override void SerializeEffect<T>(T effect) { SLEx_SuspendStatusTimer sLEx_SuspendStatusTimer = effect as SLEx_SuspendStatusTimer; StatusEffectIdentifiers = sLEx_SuspendStatusTimer.StatusEffectIdentifiers; } } public class SLEx_SuspendStatusTimer : Effect, ICustomModel { public string[] StatusEffectIdentifiers; public Type SLTemplateModel => typeof(SL_SuspendStatusTimer); public Type GameModel => typeof(SLEx_SuspendStatusTimer); private void SetSuspendedTimers(Character _affectedCharacter, bool suspended) { if (StatusEffectIdentifiers == null || StatusEffectIdentifiers.Length == 0) { ExtendedEffects._Log.LogDebug((object)"SLEx_SuspendStatusTimer defined without effects. Please specify the StatusEffectIdentifiers to suspend."); return; } foreach (StatusEffect status in _affectedCharacter.StatusEffectMngr.Statuses) { if (UnityEngineExtensions.Contains<string>(StatusEffectIdentifiers, status.IdentifierName) && status.IsTimerSuspended() != suspended) { ExtendedEffects._Log.LogDebug((object)$"Suspending timer of {status.IdentifierName} = {suspended}"); status.SetTimerSuspended(suspended); } } } public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { SetSuspendedTimers(_affectedCharacter, suspended: true); } public override void StopAffectLocally(Character _affectedCharacter) { SetSuspendedTimers(_affectedCharacter, suspended: false); } } [Serializable] public class SkillTreeOverride { public string OriginalSkillTreeUID; public string NewSkillTreeUID; public SkillTreeOverride(string originalSkillTreeUID, string newSkillTreeUID) { OriginalSkillTreeUID = originalSkillTreeUID; NewSkillTreeUID = newSkillTreeUID; } } } namespace SideLoader_ExtendedEffects.Containers { public class SL_EffectLifecycleEffect : SL_ParentEffect { } public class EffectLifecycleEffect : ParentEffect, ICustomModel { private bool activated = false; public Type SLTemplateModel => typeof(SL_EffectLifecycleEffect); public Type GameModel => typeof(EffectLifecycleEffect); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (!activated) { ((EffectSynchronizer)((Effect)this).m_subEffects[0]).SynchronizeEffects((EffectCategories)2, ((Effect)this).OwnerCharacter); activated = true; } ((EffectSynchronizer)((Effect)this).m_subEffects[0]).SynchronizeEffects((EffectCategories)1, ((Effect)this).OwnerCharacter); } public override void StopAffectLocally(Character _affectedCharacter) { ((EffectSynchronizer)((Effect)this).m_subEffects[0]).SynchronizeEffects((EffectCategories)5, ((Effect)this).OwnerCharacter); activated = false; ((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects((EffectCategories)5, ((Effect)this).OwnerCharacter); ((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects((EffectCategories)2, ((Effect)this).OwnerCharacter); ((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects((EffectCategories)1, ((Effect)this).OwnerCharacter); base.StopAffectLocally(_affectedCharacter); } } public abstract class SL_ParentEffect : SL_Effect { public EditBehaviours EffectBehavior = (EditBehaviours)2; public SL_EffectTransform[] ChildEffects; public int ActivationLimit; public override void ApplyToComponent<T>(T component) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) try { ParentEffect parentEffect = component as ParentEffect; GameObject val = new GameObject(); Object.DontDestroyOnLoad((Object)(object)val); val.SetActive(false); parentEffect.ActivationLimit = ActivationLimit; parentEffect.ChildEffects = val.gameObject.AddComponent<SubEffect>(); SL_EffectTransform.ApplyTransformList(((Component)parentEffect.ChildEffects).transform, ChildEffects, EffectBehavior); } catch (Exception ex) { SL.Log((object)ex); } } public override void SerializeEffect<T>(T effect) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown try { ParentEffect parentEffect = effect as ParentEffect; if (((Component)parentEffect.ChildEffects).transform.childCount > 0) { List<SL_EffectTransform> list = new List<SL_EffectTransform>(); foreach (Transform item in ((Component)parentEffect.ChildEffects).transform) { Transform val = item; SL_EffectTransform val2 = SL_EffectTransform.ParseTransform(val); if (val2.HasContent) { list.Add(val2); } } ChildEffects = list.ToArray(); } ActivationLimit = parentEffect.ActivationLimit; } catch (Exception ex) { SL.Log((object)ex); } } } public abstract class ParentEffect : Shooter { public SubEffect ChildEffects; public int ActivationLimit; private float lastApplyTime = 0f; private Dictionary<Character, int> affectedThisInterval; public override void Setup(Factions[] _targetFactions, Transform _parent) { try { SL.Log("Set Up"); SL.Log("own parent: " + ((Object)((Effect)this).m_parentSynchronizer).name); ((Shooter)this).Setup(_targetFactions, _parent); if (((Effect)this).m_subEffects == null) { ((Effect)this).m_subEffects = (SubEffect[])(object)new SubEffect[1] { Object.Instantiate<SubEffect>(ChildEffects) }; } ((Component)((Effect)this).m_subEffects[0]).gameObject.SetActive(true); ((Effect)this).m_subEffects[0].Setup((Effect)(object)this, 0, _targetFactions, _parent); SL.Log((object)((Effect)this).m_subEffects[0].m_parentEffect); ((Effect)this).m_subEffects[0].m_parentEffect = (Effect)(object)this; Effect[] componentsInChildren = ((Component)((Component)((Effect)this).m_subEffects[0]).transform).GetComponentsInChildren<Effect>(); foreach (Effect val in componentsInChildren) { } } catch (Exception ex) { SL.Log("=========Setup Error!==========="); SL.Log((object)ex); } } public override void StopAffectLocally(Character _affectedCharacter) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) foreach (EffectCategories value in Enum.GetValues(typeof(EffectCategories))) { ((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects(value, _affectedCharacter); } ((Effect)this).StopAffectLocally(_affectedCharacter); } public virtual void StartApply(EffectCategories[] categories, Character affectedCharacter, Vector3 pos, Vector3 dir) { //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (Time.time - lastApplyTime > 0f) { lastApplyTime = Time.time; if (affectedThisInterval == null) { affectedThisInterval = new Dictionary<Character, int>(); } else { affectedThisInterval.Clear(); } } int value = 0; if (!affectedThisInterval.TryGetValue(affectedCharacter, out value)) { affectedThisInterval.Add(affectedCharacter, 0); } if (ActivationLimit == 0 || value < ActivationLimit) { affectedThisInterval[affectedCharacter]++; foreach (EffectCategories val in categories) { ((EffectSynchronizer)((Effect)this).m_subEffects[0]).SynchronizeEffects(val, affectedCharacter, pos, dir); } } } public virtual void StopApply(EffectCategories[] categories, Character affectedCharacter) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) foreach (EffectCategories val in categories) { ((EffectSynchronizer)((Effect)this).m_subEffects[0]).StopAllEffects(val, affectedCharacter); } } public virtual void Apply(EffectCategories[] categories, Character affectedCharacter, Vector3 pos, Vector3 dir) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) StartApply(categories, affectedCharacter, pos, dir); StopApply(categories, affectedCharacter); } } } namespace SideLoader_ExtendedEffects.Containers.Triggers { public class SL_OnEquipEffect : SL_ParentEffect { public EquipmentSlotIDs[] AllowedSlots; public override void ApplyToComponent<T>(T component) { base.ApplyToComponent(component); OnEquipEffect onEquipEffect = component as OnEquipEffect; onEquipEffect.AllowedSlots = AllowedSlots; } public override void SerializeEffect<T>(T effect) { base.SerializeEffect(effect); OnEquipEffect onEquipEffect = effect as OnEquipEffect; AllowedSlots = onEquipEffect.AllowedSlots; } } public class OnEquipEffect : TriggeredEffect<EquipEvent>, ICustomModel { public EquipmentSlotIDs[] AllowedSlots; public Type SLTemplateModel => typeof(SL_OnEquipEffect); public Type GameModel => typeof(OnEquipEffect); public override void OnEvent(object sender, EquipEvent args) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)args.character != (Object)(object)((Effect)this).OwnerCharacter) && (AllowedSlots == null || AllowedSlots.Length == 0 || UnityEngineExtensions.Contains<EquipmentSlotIDs>(AllowedSlots, args.slot))) { if (args.equipped) { ExtendedEffects.Instance.DebugLogMessage("Equipped item"); StartApply((EffectCategories[])(object)new EffectCategories[2] { (EffectCategories)2, (EffectCategories)1 }, args.character, args.character.m_lastPosition, args.character.m_lastForward); } else { ExtendedEffects.Instance.DebugLogMessage("Unequipped item"); StartApply((EffectCategories[])(object)new EffectCategories[2] { (EffectCategories)5, (EffectCategories)1 }, args.character, args.character.m_lastPosition, args.character.m_lastForward); } } } } public class SL_OnHitEffect : SL_ParentEffect { public OnHitEffect.DamageSourceType RequiredSourceType; public Types[] DamageTypes; public bool RequireAllTypes; public int MinDamage; public bool OnlyCountRequiredTypes; public bool UseHighestType; public bool IgnoreDamageReduction; public override void ApplyToComponent<T>(T component) { base.ApplyToComponent(component); OnHitEffect onHitEffect = component as OnHitEffect; onHitEffect.RequiredSourceType = RequiredSourceType; onHitEffect.DamageTypes = DamageTypes; onHitEffect.RequireAllTypes = RequireAllTypes; onHitEffect.MinDamage = MinDamage; onHitEffect.OnlyCountRequiredTypes = OnlyCountRequiredTypes; onHitEffect.UseHighestType = UseHighestType; onHitEffect.IgnoreDamageReduction = IgnoreDamageReduction; } public override void SerializeEffect<T>(T effect) { base.SerializeEffect(effect); OnHitEffect onHitEffect = effect as OnHitEffect; RequiredSourceType = onHitEffect.RequiredSourceType; DamageTypes = onHitEffect.DamageTypes; RequireAllTypes = onHitEffect.RequireAllTypes; MinDamage = onHitEffect.MinDamage; OnlyCountRequiredTypes = onHitEffect.OnlyCountRequiredTypes; UseHighestType = onHitEffect.UseHighestType; IgnoreDamageReduction = onHitEffect.IgnoreDamageReduction; } } public class OnHitEffect : TriggeredEffect<HitEvent>, ICustomModel { public enum DamageSourceType { ANY, WEAPON, NON_WEAPON } public DamageSourceType RequiredSourceType; public Types[] DamageTypes; public bool RequireAllTypes; public int MinDamage; public bool OnlyCountRequiredTypes; public bool UseHighestType; public bool IgnoreDamageReduction; public Type SLTemplateModel => typeof(SL_OnHitEffect); public Type GameModel => typeof(OnHitEffect); public override void OnEvent(object sender, HitEvent args) { //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) try { if ((RequiredSourceType == DamageSourceType.NON_WEAPON && args.source is Weapon) || (RequiredSourceType == DamageSourceType.WEAPON && !(args.source is Weapon))) { ExtendedEffects.Instance.DebugLogMessage("Wrong Hit Type"); return; } if (!IgnoreDamageReduction) { if (args.source is Weapon) { ? val = args.target; EffectSynchronizer source = args.source; ((Character)val).ProcessDamageReduction((Weapon)(object)((source is Weapon) ? source : null), args.damage, false); } else if (args.source is StatusEffect) { ? val2 = args.target; DamageList damage = args.damage; EffectSynchronizer source2 = args.source; ((Character)val2).ProcessDamageReduction((Weapon)null, damage, ((StatusEffect)((source2 is StatusEffect) ? source2 : null)).IgnoreBarrier); } else { args.target.ProcessDamageReduction((Weapon)null, args.damage, false); } } if (UseHighestType) { int dTypeOfHighestDamage = args.damage.GetDTypeOfHighestDamage((IList<int>)(List<int>)DamageType.TypeList); if (DamageTypes != null && DamageTypes.Length != 0 && ((DamageTypes != null && DamageTypes.Length > 1 && RequireAllTypes) || !UnityEngineExtensions.Contains<Types>(DamageTypes, args.damage[dTypeOfHighestDamage].Type))) { ExtendedEffects.Instance.DebugLogMessage("Highest Damage Type Wrong"); return; } if (args.damage[dTypeOfHighestDamage].Damage < (float)MinDamage) { ExtendedEffects.Instance.DebugLogMessage("Highest Damage Too Low"); return; } } else if (RequireAllTypes) { Types[] damageTypes = DamageTypes; foreach (Types val3 in damageTypes) { if (!args.damage.Contains(val3)) { ExtendedEffects.Instance.DebugLogMessage("Not All Types Present"); return; } } } else if (DamageTypes != null && DamageTypes.Length != 0) { Types[] damageTypes2 = DamageTypes; foreach (Types val4 in damageTypes2) { bool flag = false; if (args.damage.Contains(val4)) { flag = true; break; } if (!flag) { ExtendedEffects.Instance.DebugLogMessage("None Of Types Present"); return; } } } List<EffectCategories> list = new List<EffectCategories>(); List<EffectCategories> list2 = new List<EffectCategories>(); if ((Object)(object)args.target == (Object)(object)((Effect)this).OwnerCharacter) { try { list.Add((EffectCategories)6); list2.Add((EffectCategories)5); } catch (Exception logMessage) { ExtendedEffects.Instance.DebugLogMessage(logMessage); } } if ((Object)(object)args.dealer == (Object)(object)((Effect)this).OwnerCharacter) { list2.Add((EffectCategories)4); list.Add((EffectCategories)1); } if ((Object)(object)args.dealer == (Object)(object)args.target) { list.AddRange(list2); Apply(list.ToArray(), args.dealer, args.hitLocation, args.hitDirection); } else { Apply(list.ToArray(), args.dealer, args.hitLocation, args.hitDirection); Apply(list2.ToArray(), args.target, args.hitLocation, args.hitDirection); } } catch (Exception logMessage2) { ExtendedEffects.Instance.DebugLogMessage("=============Hit Event Error============"); ExtendedEffects.Instance.DebugLogMessage(logMessage2); } } } public abstract class TriggeredEffect<Event> : ParentEffect where Event : struct { private bool registered = false; public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (!registered) { ExtendedEffects.Instance.DebugLogMessage("Registering Event"); ExtendedEffects.Instance.DebugLogMessage(new EventHandler<Event>(OnEvent).Method.DeclaringType); Publisher<Event>.Handler += OnEvent; registered = true; } else { ExtendedEffects.Instance.DebugLogMessage("Event already registered"); } } public override void StopAffectLocally(Character _affectedCharacter) { if (registered) { ExtendedEffects.Instance.DebugLogMessage("Deregistering Event"); Publisher<Event>.Handler -= OnEvent; registered = false; } else { ExtendedEffects.Instance.DebugLogMessage("Event not registered"); } base.StopAffectLocally(_affectedCharacter); } public abstract void OnEvent(object sender, Event args); } } namespace SideLoader_ExtendedEffects.Patches { [HarmonyPatch(typeof(ItemDisplayOptionPanel))] public static class ItemDisplayOptionPanelPatches { [HarmonyPatch("GetActiveActions")] [HarmonyPostfix] private static void EquipmentMenu_GetActiveActions_Postfix(ItemDisplayOptionPanel __instance, GameObject pointerPress, ref List<int> __result) { if ((Object)(object)__instance.m_pendingItem == (Object)null || ((UIElement)__instance).LocalCharacter.IsAI) { return; } foreach (KeyValuePair<int, CustomItemDisplayMenuOption> customItemOption in ExtendedEffects.Instance.CustomItemMenuManager.CustomItemOptions) { if (__result.Contains(customItemOption.Key)) { continue; } if (customItemOption.Value.ShouldAddActionDelegate != null) { if (customItemOption.Value.ShouldAddActionDelegate(((UIElement)__instance).LocalCharacter, __instance.m_pendingItem, __instance, customItemOption.Key)) { __result.Add(customItemOption.Key); } } else { __result.Add(customItemOption.Key); } } } [HarmonyPatch("ActionHasBeenPressed")] [HarmonyPrefix] private static void EquipmentMenu_ActionHasBeenPressed_Prefix(ItemDisplayOptionPanel __instance, int _actionID) { Character targetCharacter = ((UIElement)__instance).m_characterUI.TargetCharacter; Item pendingItem = __instance.m_pendingItem; if (!Object.op_Implicit((Object)(object)targetCharacter) || !Object.op_Implicit((Object)(object)pendingItem) || !targetCharacter.Inventory.OwnsOrHasEquipped(pendingItem.ItemID)) { return; } foreach (KeyValuePair<int, CustomItemDisplayMenuOption> customItemOption in ExtendedEffects.Instance.CustomItemMenuManager.CustomItemOptions) { if (_actionID == customItemOption.Key) { customItemOption.Value?.OnCustomActionPressed(targetCharacter, pendingItem, __instance, _actionID); } } } [HarmonyPatch("GetActionText")] [HarmonyPrefix] private static bool EquipmentMenu_GetActionText_Prefix(ItemDisplayOptionPanel __instance, int _actionID, ref string __result) { foreach (KeyValuePair<int, CustomItemDisplayMenuOption> customItemOption in ExtendedEffects.Instance.CustomItemMenuManager.CustomItemOptions) { if (_actionID == customItemOption.Key) { __result = customItemOption.Value.ActionString; return false; } } return true; } } [HarmonyPatch(typeof(Trainer))] public static class TrainerPatches { [HarmonyPatch("GetSkillTree")] [HarmonyPrefix] public static bool GetSkillTreeOverridePrefix(Trainer __instance, ref SkillSchool __result) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) SNPC val = ((Component)__instance).GetComponentInParent<SNPC>(); string empty = string.Empty; if ((Object)(object)val == (Object)null) { val = ((Component)((Component)__instance).transform.parent.parent).GetComponentInChildren<SNPC>(); empty = __instance.HolderUID.m_value; } else { empty = val.HolderUID.m_value; } if ((Object)(object)val != (Object)null) { if (ExtendedEffects.HasSkillTreeOverride(empty)) { string text = ExtendedEffects.SkillTreeOverrides[empty]; SkillSchool skillTreeFromUID = SkillTreeHolder.Instance.GetSkillTreeFromUID(UID.op_Implicit(text)); if ((Object)(object)skillTreeFromUID != (Object)null) { __result = skillTreeFromUID; return false; } ExtendedEffects._Log.LogMessage((object)("Could not find a valid SkillSchool with UID " + text)); } else { ExtendedEffects._Log.LogMessage((object)("No Override For Trainer with UID " + empty)); } } else { ExtendedEffects._Log.LogMessage((object)"Character isn't a trainer."); } return true; } } } namespace SideLoader_ExtendedEffects.Item_Context_Menu { public class CustomItemDisplayMenuOption { public int CustomEquipActionID = 10000; public string ActionString = "Activate "; public Action<Character, Item, ItemDisplayOptionPanel, int> OnCustomActionPressed; public Func<Character, Item, ItemDisplayOptionPanel, int, bool> ShouldAddActionDelegate; public CustomItemDisplayMenuOption(int customEquipActionID, string equip_String, Action<Character, Item, ItemDisplayOptionPanel, int> onCustomActionPressed, Func<Character, Item, ItemDisplayOptionPanel, int, bool> shouldAddActionDelegate) { CustomEquipActionID = customEquipActionID; ActionString = equip_String; OnCustomActionPressed = onCustomActionPressed; ShouldAddActionDelegate = shouldAddActionDelegate; } } } namespace SideLoader_ExtendedEffects.Extensions { public static class SLEffectExtensions { public static void ApplyIcon(this SL_StatusEffect effect) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //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: Expected O, but got Unknown SLPack sLPack = SL.GetSLPack(((SL_StatusBase)effect).SLPackName); string path = sLPack.FolderPath + "\\StatusEffects\\" + effect.StatusIdentifier + "\\icon.png"; byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); Sprite val2 = CustomTextures.CreateSprite(val, (SpriteBorderTypes)0); StatusEffect statusEffectPrefab = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(effect.StatusIdentifier); statusEffectPrefab.OverrideIcon = val2; statusEffectPrefab.m_defaultStatusIcon = new StatusTypeIcon(Tag.None) { Icon = val2 }; } } } namespace SideLoader_ExtendedEffects.Released { public class SL_AffectCurrentHP : SL_Effect, ICustomModel { public float Modifier; public Type SLTemplateModel => typeof(SL_AffectCurrentHP); public Type GameModel => typeof(AffectCurrentHP); public override void ApplyToComponent<T>(T component) { AffectCurrentHP affectCurrentHP = component as AffectCurrentHP; affectCurrentHP.Modifier = Modifier; } public override void SerializeEffect<T>(T effect) { AffectCurrentHP affectCurrentHP = effect as AffectCurrentHP; Modifier = affectCurrentHP.Modifier; } } public class AffectCurrentHP : Effect { public float Modifier; public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (!(Modifier <= 0f)) { float num = _affectedCharacter.Health * Modifier; _affectedCharacter.Stats.AffectHealth(num); } } } public class SL_ApplyCharacterAuraVFX : SL_Effect, ICustomModel { public string SLPackName; public string AssetBundleName; public string PrefabName; public float LifeTime; public Type SLTemplateModel => typeof(SL_ApplyCharacterAuraVFX); public Type GameModel => typeof(ApplyCharacterAuraVFX); public override void ApplyToComponent<T>(T component) { ApplyCharacterAuraVFX applyCharacterAuraVFX = component as ApplyCharacterAuraVFX; applyCharacterAuraVFX.SLPackName = SLPackName; applyCharacterAuraVFX.AssetBundleName = AssetBundleName; applyCharacterAuraVFX.PrefabName = PrefabName; applyCharacterAuraVFX.LifeTime = LifeTime; } public override void SerializeEffect<T>(T effect) { ApplyCharacterAuraVFX applyCharacterAuraVFX = effect as ApplyCharacterAuraVFX; SLPackName = applyCharacterAuraVFX.SLPackName; AssetBundleName = applyCharacterAuraVFX.AssetBundleName; PrefabName = applyCharacterAuraVFX.PrefabName; LifeTime = applyCharacterAuraVFX.LifeTime; } } public class ApplyCharacterAuraVFX : Effect { public string SLPackName; public string AssetBundleName; public string PrefabName; public float LifeTime; private GameObject Instance; private GameObject Prefab = null; private SkinnedMeshRenderer BodyMesh = null; private ParticleSystem[] CachedPS = null; public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if ((Object)(object)Prefab == (Object)null) { Prefab = OutwardHelpers.GetFromAssetBundle<GameObject>(SLPackName, AssetBundleName, PrefabName); } if ((Object)(object)Prefab != (Object)null) { if ((Object)(object)BodyMesh == (Object)null) { BodyMesh = FindBaseBody(_affectedCharacter); } if ((Object)(object)BodyMesh == (Object)null) { ExtendedEffects.Instance.DebugLogMessage("ApplyCharacterAuraVFX cant find body mesh"); return; } if ((Object)(object)Instance == (Object)null) { Instance = Object.Instantiate<GameObject>(Prefab); } Instance.transform.parent = _affectedCharacter.VisualHolderTrans; if ((Object)(object)BodyMesh != (Object)null) { UpdateVFXParticleSystem(Instance, BodyMesh); } } else { ExtendedEffects.Instance.DebugLogMessage("ApplyCharacterAuraVFX Prefab is null."); } } public override void CleanUpOnDestroy() { ((Effect)this).CleanUpOnDestroy(); if (Object.op_Implicit((Object)(object)Instance)) { ExtendedEffects.Instance.DebugLogMessage("ApplyCharacterAuraVFX Cleaning up Instance"); Object.Destroy((Object)(object)Instance); } } public override void StopAffectLocally(Character _affectedCharacter) { if (Object.op_Implicit((Object)(object)Instance)) { ExtendedEffects.Instance.DebugLogMessage("ApplyCharacterAuraVFX destroying Instance"); Object.Destroy((Object)(object)Instance); } } private SkinnedMeshRenderer FindBaseBody(Character _affectedCharacter) { SkinnedMeshRenderer[] componentsInChildren = ((Component)_affectedCharacter.VisualHolderTrans).GetComponentsInChildren<SkinnedMeshRenderer>(true); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { if (((Object)((Component)val).transform).name.Contains("Body")) { return val; } } return null; } private void UpdateVFXParticleSystem(GameObject VFXInstance, SkinnedMeshRenderer SkinnedMeshRenderer) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if (CachedPS == null) { CachedPS = VFXInstance.GetComponentsInChildren<ParticleSystem>(); } if (CachedPS == null || CachedPS.Length == 0) { return; } ParticleSystem[] cachedPS = CachedPS; foreach (ParticleSystem val in cachedPS) { if ((Object)(object)val != (Object)null) { ShapeModule shape = val.shape; if ((int)((ShapeModule)(ref shape)).shapeType == 14) { ShapeModule shape2 = val.shape; ((ShapeModule)(ref shape2)).skinnedMeshRenderer = SkinnedMeshRenderer; ((ShapeModule)(ref shape2)).scale = Vector3.one; ((ShapeModule)(ref shape2)).position = Vector3.zero; ((ShapeModule)(ref shape2)).rotation = Vector3.zero; } } } VFXInstance.transform.localPosition = Vector3.zero; } } public class SL_RemoveItemFromInventory : SL_Effect, ICustomModel { public int ItemID; public int ItemQuantity; public Type SLTemplateModel => typeof(SL_RemoveItemFromInventory); public Type GameModel => typeof(RemoveItemFromInventory); public override void ApplyToComponent<T>(T component) { RemoveItemFromInventory removeItemFromInventory = component as RemoveItemFromInventory; removeItemFromInventory.ItemID = ItemID; removeItemFromInventory.ItemQuantity = ItemQuantity; } public override void SerializeEffect<T>(T effect) { RemoveItemFromInventory removeItemFromInventory = effect as RemoveItemFromInventory; ItemID = removeItemFromInventory.ItemID; ItemQuantity = removeItemFromInventory.ItemQuantity; } } public class RemoveItemFromInventory : Effect { public int ItemID; public int ItemQuantity; public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (_affectedCharacter.IsAI || (Object)(object)_affectedCharacter.Inventory == (Object)null) { return; } List<Item> ownedItems = _affectedCharacter.Inventory.GetOwnedItems(ItemID); if (ownedItems.Count > 0) { Item val = ownedItems[0]; if (val.IsStackable) { if (val.RemainingAmount >= ItemQuantity) { val.RemoveQuantity(ItemQuantity); } else { ExtendedEffects.Instance.DebugLogMessage("RemoveItemFromInventory :: Not enough items in stack"); } } else if (ownedItems.Count >= ItemQuantity) { _affectedCharacter.Inventory.RemoveItem(ItemID, ItemQuantity); } } else { ExtendedEffects.Instance.DebugLogMessage($"RemoveItemFromInventory :: No Items found with ID {ItemID}"); } } } public class SL_ScalingWeaponDamage : SL_Effect, ICustomModel { public SL_Damage[] DamageModifiers; public float KnockbackAmount; public bool HitInventory; public Type SLTemplateModel => typeof(SL_ScalingWeaponDamage); public Type GameModel => typeof(SLEx_ScalingWeaponDamage); public override void ApplyToComponent<T>(T component) { SLEx_ScalingWeaponDamage sLEx_ScalingWeaponDamage = component as SLEx_ScalingWeaponDamage; sLEx_ScalingWeaponDamage.KnockbackAmount = KnockbackAmount; sLEx_ScalingWeaponDamage.HitInventory = HitInventory; sLEx_ScalingWeaponDamage.DamageModifiers = DamageModifiers.ToList(); } public override void SerializeEffect<T>(T effect) { SLEx_ScalingWeaponDamage sLEx_ScalingWeaponDamage = effect as SLEx_ScalingWeaponDamage; KnockbackAmount = sLEx_ScalingWeaponDamage.KnockbackAmount; HitInventory = sLEx_ScalingWeaponDamage.HitInventory; DamageModifiers = sLEx_ScalingWeaponDamage.DamageModifiers.ToArray(); } } public class SLEx_ScalingWeaponDamage : Effect, ICustomModel { public List<SL_Damage> DamageModifiers; public float KnockbackAmount; public bool HitInventory; public Type SLTemplateModel => typeof(SL_ScalingWeaponDamage); public Type GameModel => typeof(SLEx_ScalingWeaponDamage); public override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) Character ownerCharacter = base.m_parentSynchronizer.OwnerCharacter; Weapon currentWeapon = ownerCharacter.CurrentWeapon; if ((Object)(object)currentWeapon != (Object)null) { Vector3 val = ((Component)ownerCharacter).transform.position - ((Component)_affectedCharacter).transform.position; _affectedCharacter.ReceiveHit((Object)(object)((Effect)this).OwnerCharacter, CalculateWeaponDamage(currentWeapon), val, ((Component)_affectedCharacter).transform.position, 0f, 0f, ownerCharacter, KnockbackAmount, HitInventory); } else { ExtendedEffects.Instance.DebugLogMessage("SLEx_ScalingWeapon Owner has no weapon equipped!"); } } private DamageList CalculateWeaponDamage(Weapon weapon) { DamageList NewList = weapon.Damage.Clone(); if (DamageModifiers != null && DamageModifiers.Count > 0) { int i; for (i = 0; i < NewList.Count; i++) { SL_Damage val = DamageModifiers.Find((SL_Damage x) => x.Type == NewList[i].Type); if (val != null) { DamageType obj = NewList[i]; obj.Damage *= val.Damage; } } } return NewList; } } } namespace SideLoader_ExtendedEffects.Released.Conditions { public class SL_EquipmentSlotHasTag : SL_EffectCondition, ICustomModel { public string EquipmentSlotID; public string TagName; public Type SLTemplateModel => typeof(SL_EquipmentSlotHasTag); public Type GameModel => typeof(EquipmentSlotHasTag); public override void ApplyToComponent<T>(T component) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) EquipmentSlotHasTag equipmentSlotHasTag = component as EquipmentSlotHasTag; equipmentSlotHasTag.EquipmentSlot = (EquipmentSlotIDs)Enum.Parse(typeof(EquipmentSlotIDs), EquipmentSlotID); equipmentSlotHasTag.TagName = TagName; } public override void SerializeEffect<T>(T component) { EquipmentSlotHasTag equipmentSlotHasTag = component as EquipmentSlotHasTag; EquipmentSlotID = ((object)(EquipmentSlotIDs)(ref equipmentSlotHasTag.EquipmentSlot)).ToString(); TagName = equipmentSlotHasTag.TagName; } } public class EquipmentSlotHasTag : EffectCondition { public EquipmentSlotIDs EquipmentSlot; public string TagName; public override bool CheckIsValid(Character _affectedCharacter) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (_affectedCharacter.Inventory.Equipment.HasItemEquipped(EquipmentSlot)) { Tag tagFromName = OutwardHelpers.GetTagFromName(TagName); if (tagFromName != default(Tag)) { Equipment equippedItem = _affectedCharacter.Inventory.Equipment.GetMatchingSlot(EquipmentSlot).EquippedItem; return (Object)(object)equippedItem != (Object)null && ((Item)equippedItem).HasTag(tagFromName); } ExtendedEffects.Instance.DebugLogMessage("Couldn't find tag with name " + TagName); } ExtendedEffects.Instance.DebugLogMessage($"Has no equipped Item in the specified slot {EquipmentSlot}"); return false; } } public class SL_HasStat : SL_EffectCondition, ICustomModel { public string TagName; public float StatValue; public bool IsAbsolute = true; public Type SLTemplateModel => typeof(SL_HasStat); public Type GameModel => typeof(HasStat); public override void ApplyToComponent<T>(T component) { HasStat hasStat = component as HasStat; hasStat.TagName = TagName; hasStat.StatValue = StatValue; hasStat.IsAbsolute = IsAbsolute; } public override void SerializeEffect<T>(T component) { HasStat hasStat = component as HasStat; TagName = hasStat.TagName; StatValue = hasStat.StatValue; IsAbsolute = hasStat.IsAbsolute; } } public class HasStat : EffectCondition { public string TagName; public float StatValue; public bool IsAbsolute = true; public override bool CheckIsValid(Character _affectedCharacter) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0027: Unknown result type (might be due to invalid IL or missing references) Tag tagFromName = OutwardHelpers.GetTagFromName(TagName); if (tagFromName != default(Tag)) { Stat stat = _affectedCharacter.Stats.GetStat(tagFromName); if (stat == null) { ExtendedEffects._Log.LogMessage((object)"FoundStat was null"); return false; } if (IsAbsolute) { return stat.CurrentValue <= StatValue; } float num = stat.CurrentValue / stat.MaxRange * 100f; return num <= StatValue; } ExtendedEffects._Log.LogMessage((object)("Stat Tag (" + TagName + ") could not be found")); return false; } } public class SL_IsAllowedScene : SL_EffectCondition, ICustomModel { public List<string> AllowedScenes; public Type SLTemplateModel => typeof(SL_IsAllowedScene); public Type GameModel => typeof(IsAllowedSceneCondition); public override void ApplyToComponent<T>(T component) { IsAllowedSceneCondition isAllowedSceneCondition = component as IsAllowedSceneCondition;