Decompiled source of Juggernaut v4.1.7
plugins/CustomGrip.dll
Decompiled 2 months agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using TinyHelper; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace CustomGrip; [BepInPlugin("com.ehaugw.customgrip", "CustomGrip", "1.0.0")] public class CustomGrip : BaseUnityPlugin { public const string GUID = "com.ehaugw.customgrip"; public const string VERSION = "1.0.0"; public const string NAME = "CustomGrip"; internal void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.ehaugw.customgrip"); val.PatchAll(); } public static void ChangeGrip(Character character, WeaponType toMoveset) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown if (character != null) { Animator animator = character.Animator; if (animator != null) { animator.SetInteger("WeaponType", (int)toMoveset); } } } public static void ResetGrip(Character character) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected I4, but got Unknown Weapon val = ((character != null) ? character.CurrentWeapon : null); if (val != null && character != null) { Animator animator = character.Animator; if (animator != null) { animator.SetInteger("WeaponType", (int)val.Type); } } } } [HarmonyPatch(typeof(Character), "HitEnded")] public class Character_HitEnded { [HarmonyPrefix] public static void Prefix(Character __instance, ref int _attackID) { if (_attackID != -2 && !__instance.IsCasting) { CustomGrip.ResetGrip(__instance); } } } [HarmonyPatch(typeof(Character), "StopLocomotionAction")] public class Character_StopLocomotionAction { [HarmonyPrefix] public static void Prefix(Character __instance) { CustomGrip.ResetGrip(__instance); } } public class WeaponSkillAnimationSelector : Effect { public WeaponType WeaponType; protected override void ActivateLocally(Character character, object[] _infos) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CustomGrip.ChangeGrip(character, WeaponType); } public static void SetCustomAttackAnimation(Skill skill, WeaponType weaponType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Transform transform = TinyGameObjectManager.MakeFreshObject("ActivationEffects", true, true, ((Component)skill).transform).transform; ((Component)transform).gameObject.AddComponent<WeaponSkillAnimationSelector>().WeaponType = weaponType; } }
plugins/DelayedDamage.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using TinyHelper; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace DelayedDamage; [BepInPlugin("com.ehaugw.delayeddamage", "Delayed Damage", "2.1.0")] [BepInDependency("com.ehaugw.tinyhelper", "4.8.2")] public class DelayedDamage : BaseUnityPlugin { [HarmonyPatch(typeof(ResourcesPrefabManager), "Load")] public class ResourcesPrefabManager_Load { [HarmonyPostfix] public static void Postfix() { ResourcesPrefabManager instance = ResourcesPrefabManager.Instance; if (instance != null && instance.Loaded) { MakeDelayedDamageStatusEffect(); } } } [HarmonyPatch(typeof(Character), "OnReceiveHit", new Type[] { typeof(Weapon), typeof(float), typeof(DamageList), typeof(Vector3), typeof(Vector3), typeof(float), typeof(float), typeof(Character), typeof(float) })] public class Character_ReceiveHit { [HarmonyPrefix] public static void Prefix(Character __instance, ref float _damage, Character _dealerChar, DamageList _damageList, float _knockBack) { DelaySomeDamage(__instance, _dealerChar, ref _damage, _damageList, _knockBack); } } public const string GUID = "com.ehaugw.delayeddamage"; public const string VERSION = "2.1.0"; public const string NAME = "Delayed Damage"; public static DelayedDamage Instance; public StatusEffect DelayedDamageInstance; [Obsolete("GetDamageToDelay is deprecated because it would only track one function, please append to GetDamageToDelayList instead to track everything.")] public static Func<Character, Character, DamageList, float, float> GetDamageToDelay = (Character character, Character dealer, DamageList damageList, float damage) => 0f; public static List<Func<Character, Character, DamageList, float, float>> GetDamageToDelayList = new List<Func<Character, Character, DamageList, float, float>>(); public static Action<Character, Character, float> OnDelayedDamageTaken = delegate { }; internal void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Instance = this; Harmony val = new Harmony("com.ehaugw.delayeddamage"); val.PatchAll(); } private static void MakeDelayedDamageStatusEffect() { Instance.DelayedDamageInstance = TinyEffectManager.MakeStatusEffectPrefab("Delayed Damage", "Delayed Damage", "A lingering effect that affects your health over time.", (float)DelayedDamageEffect.LifeSpan, DelayedDamageEffect.RefreshRate, (StackBehaviors)5, "Bleeding", true, (string)null, (UID?)null, "com.ehaugw.delayeddamage", (string)null, (string)null, (string)null); EffectSignature statusEffectSignature = Instance.DelayedDamageInstance.StatusEffectSignature; DelayedDamageEffect delayedDamageEffect = TinyGameObjectManager.MakeFreshObject("Effects", true, true, ((Component)statusEffectSignature).transform).AddComponent<DelayedDamageEffect>(); ((Effect)delayedDamageEffect).UseOnce = false; statusEffectSignature.Effects = new List<Effect> { (Effect)(object)delayedDamageEffect }; } public static void DelaySomeDamage(Character character, Character dealer, ref float damage, DamageList damageList, float knockBack) { float num = Mathf.Clamp(GetDamageToDelayList.Select((Func<Character, Character, DamageList, float, float> func) => func(character, dealer, damageList, knockBack)).Sum(), 0f, damage) + GetDamageToDelay(character, dealer, damageList, knockBack); if (num > 0f) { damage -= num; DealDelayedDamage(character, dealer, num); } } public static void DealDelayedDamage(Character character, Character dealer, float delayedDamage) { object obj; if (character == null) { obj = null; } else { StatusEffectManager statusEffectMngr = character.StatusEffectMngr; obj = ((statusEffectMngr != null) ? statusEffectMngr.AddStatusEffect("Delayed Damage") : null); } StatusEffect val = (StatusEffect)obj; if (val != null) { if ((Object)(object)dealer != (Object)null) { val.SetSourceCharacter(dealer); } ((EffectSynchronizer)val).SetPotency(delayedDamage); } } public static float GetRemainingDelayedDamage(Character character) { float? obj; if (character == null) { obj = null; } else { StatusEffectManager statusEffectMngr = character.StatusEffectMngr; obj = ((statusEffectMngr == null) ? null : (from status in statusEffectMngr.Statuses?.Where((StatusEffect status) => status.IdentifierName == "Delayed Damage") select ((EffectSynchronizer)status).EffectPotency)?.Sum()); } float? num = obj; return num.GetValueOrDefault(); } } public class DelayedDamageEffect : Effect { public static int LifeSpan = 15; public static float RefreshRate = 1f; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { StatusEffect parentStatusEffect = base.m_parentStatusEffect; float num = (0f - ((parentStatusEffect != null) ? ((EffectSynchronizer)parentStatusEffect).EffectPotency : 1f)) / ((float)LifeSpan / RefreshRate); StatusEffect parentStatusEffect2 = base.m_parentStatusEffect; Debug.Log((object)(((parentStatusEffect2 != null) ? ((EffectSynchronizer)parentStatusEffect2).EffectPotency.ToString() : null) ?? "Effect is Null")); Action<Character, Character, float> onDelayedDamageTaken = DelayedDamage.OnDelayedDamageTaken; StatusEffect parentStatusEffect3 = base.m_parentStatusEffect; onDelayedDamageTaken(_affectedCharacter, ((parentStatusEffect3 != null) ? ((EffectSynchronizer)parentStatusEffect3).OwnerCharacter : null) ?? null, num); _affectedCharacter.Stats.AffectHealth(num); } }
plugins/Juggernaut.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using CustomGrip; using DelayedDamage; using HarmonyLib; using NodeCanvas.DialogueTrees; using NodeCanvas.Framework; using Proficiencies; using SideLoader; using SideLoader.Model; using SynchronizedWorldObjects; using TinyHelper; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace Juggernaut; internal class InitTackle : Effect { protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { Skill lastUsedSkill = _affectedCharacter.LastUsedSkill; MeleeSkill val = (MeleeSkill)(object)((lastUsedSkill is MeleeSkill) ? lastUsedSkill : null); val.MeleeHitDetector.LinecastTrans = UnityEngineExtensions.FindAllInAllChildren(((Component)_affectedCharacter).transform, "hand_left").First(); } } public class JuggernautNPC : SynchronizedNPC { public static void Init() { //IL_0029: 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_006b: 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_0089: Expected O, but got Unknown JuggernautNPC juggernautNPC = new JuggernautNPC("The Juggernaut", 17, new int[4] { 2100000, 3000035, 3100061, 3100095 }, (int[])null, (Vector3?)new Vector3(1.15f, 1.15f, 1.15f), (Factions?)null); ((SynchronizedNPC)juggernautNPC).AddToScene(new SynchronizedNPCScene("Berg", new Vector3(1207.5f, -13.72215f, 1378.747f), new Vector3(0f, 220.5518f, 0f), (Factions?)null, false, (SpellCastType)(-1), (string)null, (int[])null, (int[])null, (Func<bool>)null)); } public JuggernautNPC(string identifierName, int rpcListenerID, int[] defaultEquipment = null, int[] moddedEquipment = null, Vector3? scale = null, Factions? faction = null) : base(identifierName, rpcListenerID, defaultEquipment, moddedEquipment, scale, faction, (VisualData)null) { } public override object SetupClientSide(int rpcListenerID, string instanceUID, int sceneViewID, int recursionCount, string rpcMeta) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) object obj = ((SynchronizedNPC)this).SetupClientSide(rpcListenerID, instanceUID, sceneViewID, recursionCount, rpcMeta); Character val = (Character)((obj is Character) ? obj : null); if ((Object)(object)val == (Object)null) { return null; } GameObject gameObject = ((Component)val).gameObject; GameObject val2 = TinyDialogueManager.AssignTrainerTemplate(gameObject.transform); DialogueActor val3 = TinyDialogueManager.SetDialogueActorName(val2, ((SynchronizedWorldObject)this).IdentifierName); Trainer val4 = TinyDialogueManager.SetTrainerSkillTree(val2, Juggernaut.juggernautTreeInstance.UID); Graph dialogueGraph = TinyDialogueManager.GetDialogueGraph(val2); TinyDialogueManager.SetActorReference(dialogueGraph, val3); dialogueGraph.allNodes.Clear(); ActionNode val5 = TinyDialogueManager.MakeTrainDialogueAction(dialogueGraph, val4); StatementNodeExt val6 = TinyDialogueManager.MakeStatementNode(dialogueGraph, ((SynchronizedWorldObject)this).IdentifierName, "What do you want, peasant?"); StatementNodeExt val7 = TinyDialogueManager.MakeStatementNode(dialogueGraph, ((SynchronizedWorldObject)this).IdentifierName, "Hah! Like you don't know... Everyone knows me, I'm a living legend known as \"The Juggernaut\"!"); string text = "I wish to become a legend like you!"; string text2 = "Who are you?"; MultipleChoiceNodeExt val8 = TinyDialogueManager.MakeMultipleChoiceNode(dialogueGraph, new string[2] { text2, text }); dialogueGraph.primeNode = (Node)(object)val6; TinyDialogueManager.ChainNodes(dialogueGraph, (Node[])(object)new Node[2] { (Node)val6, (Node)val8 }); TinyDialogueManager.ConnectMultipleChoices(dialogueGraph, (Node)(object)val8, (Node[])(object)new Node[2] { (Node)val7, (Node)val5 }); GameObject gameObject2 = ((Component)gameObject.transform.parent).gameObject; gameObject2.SetActive(true); return val; } } public class JuggernautFormulas { public const float UNYIELDING_MOVEMENT_SPEED_FORGIVENESS = 0.5f; public const float UNYIELDING_STAMINA_COST_FORGIVENESS = 0.5f; public const float RUTHLESS_ATTACK_STAMINA_COST_REDUCTION = 0.5f; public const float RUTHLESS_DAMAGE_BONUS = 0.3f; public const float RUTHLESS_RAW_DAMAGE_RATIO = 0.3f; public static float GetBastardDamageBonus() { return 0.1f; } public static float GetBastardImpactBonus() { return 0.1f; } public static float GetUnyieldingMovementSpeedForgivenes(Character character) { return 0.5f; } public static float GetUnyieldingStaminaCostForgivenes(Character character) { return 0.5f; } public static float GetRuthlessAttackStaminaCostReduction(Character character) { return 0.5f; } public static float GetRuthlessDamageBonus(Character character) { return 0.3f; } public static float GetRuthlessRawDamageRatio(Character character) { return 0.3f; } public static float GetRuthlessBodySize(Character character) { return SkillRequirements.ApplyRuthlessSize(character) ? 1.1f : 1f; } } internal class TackleEffect : PunctualDamage { protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_007b: 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_008f: 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_009c: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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) //IL_014d: 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) Character ownerCharacter = ((Effect)this).OwnerCharacter; if (_affectedCharacter.Stability <= 0f || _affectedCharacter.IsInKnockback || ownerCharacter.Stability <= 0f || ownerCharacter.IsInKnockback) { return; } float num = Mathf.Min(_affectedCharacter.Stats.GetImpactResistance() * 0.01f, 1f); float num2 = Mathf.Min(ownerCharacter.Stats.GetImpactResistance() * 0.01f, 1f); Vector3 val = (Vector3)_infos[1]; if (num2 == num) { _affectedCharacter.AutoKnock(true, val, ownerCharacter); ownerCharacter.AutoKnock(true, -val, _affectedCharacter); return; } if (num2 == 1f) { _affectedCharacter.AutoKnock(true, val, ownerCharacter); return; } if (num == 1f) { ownerCharacter.AutoKnock(true, -val, _affectedCharacter); return; } float num3 = _affectedCharacter.Stability / (1f - num); float num4 = ownerCharacter.Stability / (1f - num2); base.Knockback = Mathf.Min(num3, num4); base.DamageAmplifiedByOwner = false; if (num3 < num4) { _affectedCharacter.AutoKnock(true, (Vector3)_infos[1], ownerCharacter); _infos[1] = -(Vector3)_infos[1]; ((PunctualDamage)this).ActivateLocally(ownerCharacter, _infos); } else { ((PunctualDamage)this).ActivateLocally(_affectedCharacter, _infos); _infos[1] = -(Vector3)_infos[1]; ownerCharacter.AutoKnock(true, (Vector3)_infos[1], _affectedCharacter); } } } public class WarCryEffect : Effect { public const float Range = 20f; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) List<Character> source = new List<Character>(); CharacterManager.Instance.FindCharactersInRange(_affectedCharacter.CenterPosition, 20f, ref source); source = source.Where((Character c) => !c.IsAlly(_affectedCharacter)).ToList(); foreach (Character item in source) { if (SkillRequirements.Careful(_affectedCharacter)) { item.StatusEffectMngr.AddStatusEffect(ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Confusion"), _affectedCharacter); } if (SkillRequirements.Vengeful(_affectedCharacter)) { item.StatusEffectMngr.AddStatusEffect(ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Pain"), _affectedCharacter); } CasualStagger.Stagger(item); item.TargetingSystem.SwitchTarget(_affectedCharacter.LockingPoint); } } } internal class HordeBreakerEffect : Effect { public static void StaticActivate(HordeBreakerEffect effect, Character defender, Character offender, object[] _infos, Effect instance) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (SkillRequirements.Careful(offender) && defender.StatusEffectMngr.HasStatusEffect("Confusion")) { defender.AutoKnock(true, Vector3.zero, offender); } else { CasualStagger.Stagger(defender); } if (SkillRequirements.Vengeful(offender) && defender.StatusEffectMngr.HasStatusEffect("Pain")) { defender.StatusEffectMngr.AddStatusEffect(ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Slow Down"), offender); } } protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { StaticActivate(this, _affectedCharacter, ((Effect)this).OwnerCharacter, _infos, (Effect)(object)this); } } internal class JuggernaughtyEffect : Effect { public static void StaticActivate(Character character, object[] _infos, Effect instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_000d: 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) Trainer val = new Trainer(); At.SetField<Trainer>(val, "m_uid", (object)UID.Generate()); At.SetField<Trainer>(val, "m_skillTreeUID", (object)Juggernaut.juggernautTreeInstance.UID); val.StartTraining(character); } protected override void ActivateLocally(Character character, object[] _infos) { StaticActivate(character, _infos, (Effect)(object)this); } } public class SkillRequirements { private static bool SafeHasSkillKnowledge(Character character, int skillID) { bool? obj; if (character == null) { obj = null; } else { CharacterInventory inventory = character.Inventory; if (inventory == null) { obj = null; } else { CharacterSkillKnowledge skillKnowledge = inventory.SkillKnowledge; obj = ((skillKnowledge != null) ? new bool?(((CharacterKnowledge)skillKnowledge).IsItemLearned(skillID)) : null); } } bool? flag = obj; return flag.GetValueOrDefault(); } public static bool IsRageEffect(StatusEffect effect) { //IL_001a: 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) return effect != null && effect.HasMatch(TagSourceManager.Instance.GetTag(UID.op_Implicit(225.ToString()))); } public static bool IsDisciplineEffect(StatusEffect effect) { //IL_001a: 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) return effect != null && effect.HasMatch(TagSourceManager.Instance.GetTag(UID.op_Implicit(226.ToString()))); } public static bool Enraged(Character character) { return character.StatusEffectMngr.HasStatusEffect("Rage") || character.StatusEffectMngr.HasStatusEffect("Rage Amplified"); } public static bool Disciplined(Character character) { return character.StatusEffectMngr.HasStatusEffect("Discipline") || character.StatusEffectMngr.HasStatusEffect("Discipline Amplified"); } public static bool Careful(Character character) { return SafeHasSkillKnowledge(character, 2502019); } public static bool Vengeful(Character character) { return SafeHasSkillKnowledge(character, 2502020); } public static bool CanParryCancelAnimations(Character character) { return SafeHasSkillKnowledge(character, 2502019); } public static bool CanSkillCancelAnimations(Character character) { return SafeHasSkillKnowledge(character, 2502019); } public static bool CanDelayDamageEqualToProtection(Character character) { return SafeHasSkillKnowledge(character, 2502019); } public static bool CanAddProtectionToImpactResistance(Character character) { return SafeHasSkillKnowledge(character, 2502021); } public static bool CanAddProtectionToPhysicalResistance(Character character) { return SafeHasSkillKnowledge(character, 2502021); } public static bool CanAddProtectionToAnyDamageResistance(Character character) { return SafeHasSkillKnowledge(character, 2502021); } public static bool CanAddBonusBastardImpactBonus(Character character) { return SafeHasSkillKnowledge(character, 2502015); } public static bool CanAddBonusBastardWeaponDamage(Character character) { return SafeHasSkillKnowledge(character, 2502015); } public static bool CanEnrageFromDamage(Character character) { return SafeHasSkillKnowledge(character, 2502020); } public static bool CanAddBonusRageDamage(Character character) { return SafeHasSkillKnowledge(character, 2502022) && Enraged(character) && Vengeful(character); } public static bool CanReduceWeaponAttackStaminaCost(Character character) { return SafeHasSkillKnowledge(character, 2502022) && Enraged(character) && Vengeful(character); } public static bool ShouldPurgeAllExceptRageGivenEnraged(Character character) { return SafeHasSkillKnowledge(character, 2502022) && Vengeful(character); } public static bool CanReduceMoveSpeedArmorPenalty(Character character) { return SafeHasSkillKnowledge(character, 2502022) && SafeHasSkillKnowledge(character, 2502019); } public static bool CanReduceStaminaCostArmorPenalty(Character character) { return SafeHasSkillKnowledge(character, 2502022) && SafeHasSkillKnowledge(character, 2502019); } public static bool CanTerrify(Character character) { return SafeHasSkillKnowledge(character, 2502022) && SafeHasSkillKnowledge(character, 2502019); } public static bool ApplyRuthlessSize(Character character) { return SafeHasSkillKnowledge(character, 2502022); } public static bool CanConvertToRawDamage(Character character) { return false; } public static bool ShouldPurgeOnlyRageGivenDisciplined(Character character) { return false; } } [BepInPlugin("com.ehaugw.juggernautclass", "Juggernaut Class", "4.1.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("com.ehaugw.tinyhelper", "4.8.2")] [BepInDependency("com.ehaugw.delayeddamage", "2.1.0")] [BepInDependency("com.ehaugw.customgrip", "1.0.0")] [BepInDependency("com.ehaugw.synchronizedworldobjects", "1.0.3")] public class Juggernaut : BaseUnityPlugin { public const string GUID = "com.ehaugw.juggernautclass"; public const string VERSION = "4.1.7"; public const string NAME = "Juggernaut Class"; public static string ModFolderName = Directory.GetParent(typeof(Juggernaut).Assembly.Location).Name.ToString(); public Skill bastardInstance; public Skill parryInstance; public Skill tackleInstance; public Skill relentlessInstance; public Skill unyieldingInstance; public Skill vengefulInstance; public Skill fortifiedInstance; public Skill ruthlessInstance; public Skill juggernaughtyInstance; public Skill hordeBreakerInstance; public Skill warCryInstance; public Skill stoicismInstance; public Skill cullInstance; public static SkillSchool juggernautTreeInstance; public Trainer juggernautTrainer; internal void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown GameObject val = new GameObject("JuggernautRPC"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<RPCManager>(); SL.OnPacksLoaded += OnPackLoaded; JuggernautNPC.Init(); Harmony val2 = new Harmony("com.ehaugw.juggernautclass"); val2.PatchAll(); DelayedDamage.GetDamageToDelayList.Add(StoicismDelayedDamageSourceGetDelayedDamage); DelayedDamage.GetDamageToDelayList.Add(UnyieldingDelayedDamageSource); } private float StoicismDelayedDamageSourceGetDelayedDamage(Character character, Character dealer, DamageList damageList, float knockBack) { return SkillRequirements.SafeHasSkillKnowledge(character, 2502037) ? Mathf.Max(0f, (((damageList != null) ? damageList.TotalDamage : 0f) - 20f) / 2f) : 0f; } private float UnyieldingDelayedDamageSource(Character character, Character dealer, DamageList damageList, float knockBack) { if (damageList != null && damageList.Contains((Types)0)) { DamageType val = default(DamageType); damageList.TryGet((Types)0, ref val); float result; if (!SkillRequirements.CanDelayDamageEqualToProtection(character)) { result = 0f; } else { float? obj; if (character == null) { obj = null; } else { CharacterStats stats = character.Stats; obj = ((stats != null) ? new float?(stats.GetDamageProtection((Types)0)) : null); } float? num = obj; result = Mathf.Min(num.GetValueOrDefault(), val?.Damage ?? 0f); } return result; } return 0f; } private void OnPackLoaded() { parryInstance = ParrySpell.Init(); tackleInstance = TackleSpell.Init(); relentlessInstance = RelentlessSkill.Init(); unyieldingInstance = UnyieldingSpell.Init(); vengefulInstance = VengefulSpell.Init(); fortifiedInstance = FortifiedSpell.Init(); ruthlessInstance = RuthlessSpell.Init(); juggernaughtyInstance = JuggernaughtySpell.Init(); hordeBreakerInstance = HordeBreakerSpell.Init(); warCryInstance = WarCrySpell.Init(); stoicismInstance = Stoicism.Init(); cullInstance = Cull.Init(); JuggernautSkillTree.SetupSkillTree(ref juggernautTreeInstance); } } public class Cull { public const int Threshold = 15; public static Skill Init() { //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_0023: 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_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0073: 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_0090: Expected O, but got Unknown SL_Skill val = new SL_Skill { Name = "Cull", EffectBehaviour = (EditBehaviours)2, Target_ItemID = 8205030, New_ItemID = 2502040, SLPackName = Juggernaut.ModFolderName, SubfolderName = "Cull", Description = "Weapon attacks that would reduce a creature to less health than the weapon's base damage cause the creatures to die instead.", IsUsable = false, CastType = (SpellCastType)(-1), CastModifier = (SpellCastModifier)0, CastLocomotionEnabled = false, MobileCastMovementMult = -1f }; ((ContentTemplate)val).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val).New_ItemID); return (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); } } [HarmonyPatch(typeof(Character), "OnReceiveHit")] public class Character_OnReceiveHit { [HarmonyPostfix] public static void Postfix(Character __instance, Weapon _weapon, DamageList _damageList, Vector3 _hitDir) { //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (SkillRequirements.SafeHasSkillKnowledge((_weapon != null) ? ((EffectSynchronizer)_weapon).OwnerCharacter : null, 2502040)) { DamageList val = _weapon.Damage.Clone(); val.IgnoreHalfResistances = _damageList.IgnoreHalfResistances; __instance.Stats.GetMitigatedDamage((Tag[])null, ref val, false); float totalDamage = val.TotalDamage; float? obj; if (_weapon == null) { obj = null; } else { Character ownerCharacter = ((EffectSynchronizer)_weapon).OwnerCharacter; obj = ((ownerCharacter != null) ? new float?(ProficiencyExtensions.GetTotalWeaponProficiency(ownerCharacter)) : null); } float? num = obj; float num2 = totalDamage * (1f + num.GetValueOrDefault() / 10f); if (__instance.Health < num2) { __instance.VitalityHit((_weapon != null) ? ((EffectSynchronizer)_weapon).OwnerCharacter : null, num2, _hitDir); } } } } public class Stoicism { public const int Threshold = 15; public static Skill Init() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) SL_Skill val = new SL_Skill(); ((SL_Item)val).Name = "Stoicism"; ((SL_Item)val).EffectBehaviour = (EditBehaviours)2; ((SL_Item)val).Target_ItemID = 8205030; ((SL_Item)val).New_ItemID = 2502037; ((SL_Item)val).SLPackName = Juggernaut.ModFolderName; ((SL_Item)val).SubfolderName = "Stoicism"; ((SL_Item)val).Description = "When you take more than " + 15 + " direct damage, half of the damage exceeding " + 15 + " is delayed over " + DelayedDamageEffect.LifeSpan + " seconds."; ((SL_Item)val).IsUsable = false; ((SL_Item)val).CastType = (SpellCastType)(-1); ((SL_Item)val).CastModifier = (SpellCastModifier)0; ((SL_Item)val).CastLocomotionEnabled = false; ((SL_Item)val).MobileCastMovementMult = -1f; SL_Skill val2 = val; ((ContentTemplate)val2).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val2).New_ItemID); return (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); } } public class WarCrySpell { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static DescriptionModifier <>9__0_0; internal void <Init>b__0_0(Item item, ref string description) { if (item.ItemID == 2502025) { if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "Unleash a terrifying roar that staggers nearby enemies. Applies confusion to affected enemies."; } else if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "Unleash a terrifying roar that staggers nearby enemies. Applies pain to affected enemies."; } } } } public static Skill Init() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_001a: 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_0025: Expected O, but got Unknown DescriptionModifier onDescriptionModified = TinyHelper.OnDescriptionModified; object obj = <>c.<>9__0_0; if (obj == null) { DescriptionModifier val = delegate(Item item, ref string description) { if (item.ItemID == 2502025) { if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "Unleash a terrifying roar that staggers nearby enemies. Applies confusion to affected enemies."; } else if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "Unleash a terrifying roar that staggers nearby enemies. Applies pain to affected enemies."; } } }; <>c.<>9__0_0 = val; obj = (object)val; } TinyHelper.OnDescriptionModified = (DescriptionModifier)Delegate.Combine((Delegate?)(object)onDescriptionModified, (Delegate?)obj); SL_Skill val2 = new SL_Skill(); ((SL_Item)val2).Name = "War Cry"; ((SL_Item)val2).EffectBehaviour = (EditBehaviours)1; ((SL_Item)val2).Target_ItemID = 8200110; ((SL_Item)val2).New_ItemID = 2502025; ((SL_Item)val2).SLPackName = Juggernaut.ModFolderName; ((SL_Item)val2).SubfolderName = "WarCry"; ((SL_Item)val2).Description = string.Format("Unleash a terrifying roar that staggers nearby enemies.\n\n{0}: Applies confusion to affected enemies.\n\n{1}: Applies pain to affected enemies.", "Unyielding", "Vengeful"); ((SL_Item)val2).CastType = (SpellCastType)25; ((SL_Item)val2).CastModifier = (SpellCastModifier)0; ((SL_Item)val2).CastLocomotionEnabled = false; ((SL_Item)val2).MobileCastMovementMult = 0f; SL_EffectTransform[] array = new SL_EffectTransform[1]; SL_EffectTransform val3 = new SL_EffectTransform(); val3.TransformName = "Effects"; val3.Effects = (SL_Effect[])(object)new SL_Effect[0]; array[0] = val3; ((SL_Item)val2).EffectTransforms = (SL_EffectTransform[])(object)array; val2.Cooldown = 100f; val2.StaminaCost = 4f; val2.ManaCost = 0f; val2.HealthCost = 0f; SL_Skill val4 = val2; ((ContentTemplate)val4).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val4).New_ItemID); Skill val5 = (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); ((Component)((Component)val5).transform.Find("Effects")).gameObject.AddComponent<WarCryEffect>(); return val5; } } public class JuggernaughtySpell { public static Skill Init() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0014: 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_007f: Expected O, but got Unknown SL_Skill val = new SL_Skill(); ((SL_Item)val).Name = "Juggernaughty"; ((SL_Item)val).EffectBehaviour = (EditBehaviours)2; ((SL_Item)val).Target_ItemID = 8100120; ((SL_Item)val).New_ItemID = 2502023; ((SL_Item)val).Description = "Trainer Hax"; ((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[0]; array[0] = val2; ((SL_Item)val).EffectTransforms = (SL_EffectTransform[])(object)array; val.Cooldown = 1f; val.StaminaCost = 0f; val.ManaCost = 0f; val.HealthCost = 0f; SL_Skill val3 = val; ((ContentTemplate)val3).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val3).New_ItemID); Skill val4 = (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); Transform val5 = ((Component)val4).transform.Find("Effects"); ((Component)val5).gameObject.AddComponent<JuggernaughtyEffect>(); return val4; } } public class HordeBreakerSpell { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static DescriptionModifier <>9__1_0; internal void <Init>b__1_0(Item item, ref string description) { if (item.ItemID == 2502024) { if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "Does two attacks in wide archs that stagger on hit. Confused enemies are knocked down."; } else if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "Does two attacks in wide archs that stagger on hit. Enemies in pain are slowed down."; } } } } public static void Description(Item item, string description) { } public static Skill Init() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_001a: 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_0025: Expected O, but got Unknown DescriptionModifier onDescriptionModified = TinyHelper.OnDescriptionModified; object obj = <>c.<>9__1_0; if (obj == null) { DescriptionModifier val = delegate(Item item, ref string description) { if (item.ItemID == 2502024) { if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "Does two attacks in wide archs that stagger on hit. Confused enemies are knocked down."; } else if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "Does two attacks in wide archs that stagger on hit. Enemies in pain are slowed down."; } } }; <>c.<>9__1_0 = val; obj = (object)val; } TinyHelper.OnDescriptionModified = (DescriptionModifier)Delegate.Combine((Delegate?)(object)onDescriptionModified, (Delegate?)obj); SL_AttackSkill val2 = new SL_AttackSkill(); ((SL_Item)val2).Name = "Horde Breaker"; ((SL_Item)val2).EffectBehaviour = (EditBehaviours)1; ((SL_Item)val2).Target_ItemID = 8100320; ((SL_Item)val2).New_ItemID = 2502024; ((SL_Item)val2).SLPackName = Juggernaut.ModFolderName; ((SL_Item)val2).SubfolderName = "HordeBreaker"; ((SL_Item)val2).Description = string.Format("Does two attacks in wide archs that stagger on hit.\n\n{0}: Confused enemies are knocked down.\n\n{1}: Enemies in pain are slowed down.", "Unyielding", "Vengeful"); ((SL_Item)val2).CastType = (SpellCastType)502; ((SL_Item)val2).CastModifier = (SpellCastModifier)2; ((SL_Item)val2).CastLocomotionEnabled = false; ((SL_Item)val2).MobileCastMovementMult = -1f; ((SL_Item)val2).CastSheatheRequired = 2; WeaponType[] array = new WeaponType[9]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); val2.RequiredWeaponTypes = (WeaponType[])(object)array; SL_EffectTransform[] array2 = new SL_EffectTransform[1]; SL_EffectTransform val3 = new SL_EffectTransform(); val3.TransformName = "Effects"; val3.Effects = (SL_Effect[])(object)new SL_Effect[0]; array2[0] = val3; ((SL_Item)val2).EffectTransforms = (SL_EffectTransform[])(object)array2; ((SL_Skill)val2).Cooldown = 60f; ((SL_Skill)val2).StaminaCost = 16f; ((SL_Skill)val2).ManaCost = 0f; ((SL_Skill)val2).HealthCost = 0f; SL_AttackSkill val4 = val2; ((ContentTemplate)val4).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val4).New_ItemID); Skill val5 = (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); Object.Destroy((Object)(object)((Component)((Component)val5).transform.Find("HitEffects_Rage")).gameObject); Object.Destroy((Object)(object)((Component)((Component)val5).transform.Find("HitEffects_Discipline")).gameObject); WeaponSkillAnimationSelector.SetCustomAttackAnimation(val5, (WeaponType)50); Transform val6 = ((Component)val5).transform.Find("HitEffects"); ((Component)val6).gameObject.AddComponent<HordeBreakerEffect>(); WeaponDamage componentInChildren = ((Component)val5).gameObject.GetComponentInChildren<WeaponDamage>(); componentInChildren.WeaponDamageMult = 1f; componentInChildren.WeaponDurabilityLossPercent = 0f; componentInChildren.WeaponDurabilityLoss = 1f; ((PunctualDamage)componentInChildren).Damages = (DamageType[])(object)new DamageType[0]; componentInChildren.WeaponKnockbackMult = 1f; Object.Destroy((Object)(object)((Component)val5).gameObject.GetComponentInChildren<HasStatusEffectEffectCondition>()); Object.Destroy((Object)(object)((Component)val5).gameObject.GetComponentInChildren<AddStatusEffect>()); return val5; } } public class RuthlessSpell { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static DescriptionModifier <>9__1_0; internal void <Init>b__1_0(Item item, ref string description) { if (item.ItemID == 2502022) { if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "Armor stamina and movement penalties are reduced. Damaging enemies causes confusion among their allies, and may even cause them to stagger in fear."; } else if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "While enraged, all damage is increased and the attack stamina cost is reduced, but you can't be affected by boons other than Rage."; } } } } public const float Range = 7f; public static Skill Init() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0044: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0091: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_001a: 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_0025: Expected O, but got Unknown DescriptionModifier onDescriptionModified = TinyHelper.OnDescriptionModified; object obj = <>c.<>9__1_0; if (obj == null) { DescriptionModifier val = delegate(Item item, ref string description) { if (item.ItemID == 2502022) { if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "Armor stamina and movement penalties are reduced. Damaging enemies causes confusion among their allies, and may even cause them to stagger in fear."; } else if (SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "While enraged, all damage is increased and the attack stamina cost is reduced, but you can't be affected by boons other than Rage."; } } }; <>c.<>9__1_0 = val; obj = (object)val; } TinyHelper.OnDescriptionModified = (DescriptionModifier)Delegate.Combine((Delegate?)(object)onDescriptionModified, (Delegate?)obj); SL_Skill val2 = new SL_Skill { Name = "Ruthless", EffectBehaviour = (EditBehaviours)1, Target_ItemID = 8205030, New_ItemID = 2502022, SLPackName = Juggernaut.ModFolderName, SubfolderName = "Ruthless", Description = string.Format("{0}: Armor stamina and movement penalties are reduced. Damaging enemies causes confusion among their allies, and may even cause them to stagger in fear.\n\n{1}: While enraged, weapon damage is increased and the attack stamina cost is reduced, but you can't be affected by boons other than Rage.", "Unyielding", "Vengeful"), CastType = (SpellCastType)25, CastModifier = (SpellCastModifier)0, CastLocomotionEnabled = false, MobileCastMovementMult = 0f }; ((ContentTemplate)val2).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val2).New_ItemID); return (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); } } [HarmonyPatch(typeof(CharacterStats), "GetAmplifiedDamage")] public class CharacterStats_GetAmplifiedDamage { [HarmonyPostfix] public static void Postfix(CharacterStats __instance, ref DamageList _damages) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown object field = At.GetField<CharacterStats>(__instance, "m_character"); Character val = (Character)((field is Character) ? field : null); if (val != null) { if (SkillRequirements.CanAddBonusRageDamage(val)) { _damages *= 1f + JuggernautFormulas.GetRuthlessDamageBonus(val); } if (SkillRequirements.CanConvertToRawDamage(val)) { float totalDamage = _damages.TotalDamage; float ruthlessRawDamageRatio = JuggernautFormulas.GetRuthlessRawDamageRatio(val); _damages *= 1f - ruthlessRawDamageRatio; _damages.Add(new DamageType((Types)8, totalDamage * ruthlessRawDamageRatio)); } } } } [HarmonyPatch(typeof(Weapon), "GetStamCost")] public class Weapon_GetStamCost { [HarmonyPostfix] public static void Postfix(Weapon __instance, ref float __result) { if (((Item)__instance).IsEquipped) { Character ownerCharacter = ((EffectSynchronizer)__instance).OwnerCharacter; if (ownerCharacter != null && SkillRequirements.CanReduceWeaponAttackStaminaCost(ownerCharacter)) { __result *= 1f - JuggernautFormulas.GetRuthlessAttackStaminaCostReduction(ownerCharacter); } } } } [HarmonyPatch(typeof(CharacterEquipment), "GetTotalMovementModifier")] public class CharacterEquipment_GetTotalMovementModifier { [HarmonyPrefix] public static void Prefix(CharacterEquipment __instance, out Tuple<float?, Stat, Character> __state) { __state = null; object field = At.GetField<CharacterEquipment>(__instance, "m_character"); Character val = (Character)((field is Character) ? field : null); if (val != null && SkillRequirements.CanReduceMoveSpeedArmorPenalty(val)) { CharacterStats stats = val.Stats; object field2 = At.GetField<CharacterStats>(stats, "m_equipementPenalties"); Stat val2 = (Stat)((field2 is Stat) ? field2 : null); if (val2 != null) { __state = new Tuple<float?, Stat, Character>(val2.CurrentValue, val2, val); At.SetField<Stat>(val2, "m_currentValue", (object)(__state.Item1.Value * JuggernautFormulas.GetUnyieldingMovementSpeedForgivenes(val))); } } } [HarmonyPostfix] public static void Postfix(CharacterEquipment __instance, Tuple<float?, Stat, Character> __state) { if (__state != null) { if (__state.Item1 != __state.Item2.CurrentValue / JuggernautFormulas.GetUnyieldingMovementSpeedForgivenes(__state.Item3)) { Debug.Log((object)"Logic error at CharacterEquipment_GetTotalMovementModifier in Juggernaut class. m_equipementPenalties changed during call!"); } At.SetField<Stat>(__state.Item2, "m_currentValue", (object)__state.Item1.Value); } } } [HarmonyPatch(typeof(CharacterEquipment), "GetTotalStaminaUseModifier")] public class CharacterEquipment_GetTotalStaminaUseModifier { [HarmonyPrefix] public static void Prefix(CharacterEquipment __instance, out Tuple<float?, Stat, Character> __state) { __state = null; object field = At.GetField<CharacterEquipment>(__instance, "m_character"); Character val = (Character)((field is Character) ? field : null); if (val != null && SkillRequirements.CanReduceStaminaCostArmorPenalty(val)) { CharacterStats stats = val.Stats; object field2 = At.GetField<CharacterStats>(stats, "m_equipementPenalties"); Stat val2 = (Stat)((field2 is Stat) ? field2 : null); if (val2 != null) { __state = new Tuple<float?, Stat, Character>(val2.CurrentValue, val2, val); At.SetField<Stat>(val2, "m_currentValue", (object)(__state.Item1.Value * JuggernautFormulas.GetUnyieldingStaminaCostForgivenes(val))); } } } [HarmonyPostfix] public static void Postfix(CharacterEquipment __instance, Tuple<float?, Stat, Character> __state) { if (__state != null) { if (__state.Item1 != __state.Item2.CurrentValue / JuggernautFormulas.GetUnyieldingStaminaCostForgivenes(__state.Item3)) { Debug.Log((object)"Logic error at CharacterEquipment_GetTotalStaminaUseModifier in Juggernaut class. m_equipementPenalties changed during call!"); } At.SetField<Stat>(__state.Item2, "m_currentValue", (object)__state.Item1.Value); } } } [HarmonyPatch(typeof(StatusEffectManager), "AddStatusEffect", new Type[] { typeof(StatusEffect), typeof(Character), typeof(string[]) })] public class StatusEffectManager_AddStatusEffect { [HarmonyPrefix] public static bool Prefix(StatusEffectManager __instance, ref StatusEffect _statusEffect) { //IL_000f: 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) StatusEffect val = _statusEffect; IList<Tag> inheritedTags = val.InheritedTags; if (val != null && val.HasMatch(TagSourceManager.Boon)) { object field = At.GetField<StatusEffectManager>(__instance, "m_character"); Character val2 = (Character)((field is Character) ? field : null); if (val2 != null) { bool? flag = null; if (SkillRequirements.ShouldPurgeAllExceptRageGivenEnraged(val2) && (SkillRequirements.Enraged(val2) || SkillRequirements.IsRageEffect(val))) { flag = false; } if (SkillRequirements.ShouldPurgeOnlyRageGivenDisciplined(val2) && (SkillRequirements.Disciplined(val2) || SkillRequirements.IsDisciplineEffect(val))) { flag = true; } if (flag.HasValue) { foreach (StatusEffect status in __instance.Statuses) { if (status.HasMatch(TagSourceManager.Boon) && SkillRequirements.IsRageEffect(status) == flag) { status.IncreaseAge(Convert.ToInt32(status.RemainingLifespan)); } } if (SkillRequirements.IsRageEffect(val) == flag) { return false; } } } } return true; } } public class FortifiedSpell { public static Skill Init() { //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_0023: 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_0039: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown SL_Skill val = new SL_Skill { Name = "Fortified", EffectBehaviour = (EditBehaviours)2, Target_ItemID = 8205030, New_ItemID = 2502021, SLPackName = Juggernaut.ModFolderName, SubfolderName = "Fortified", Description = $"Gives resistance bonuses equal to your Protection.", IsUsable = false, CastType = (SpellCastType)(-1), CastModifier = (SpellCastModifier)0, CastLocomotionEnabled = false, MobileCastMovementMult = -1f }; ((ContentTemplate)val).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val).New_ItemID); return (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); } } [HarmonyPatch(typeof(CharacterEquipment), "GetEquipmentDamageResistance")] public class CharacterEquipment_GetEquipmentDamageResistance { [HarmonyPostfix] public static void Postfix(CharacterEquipment __instance, ref float __result, ref Types _type) { object field = At.GetField<CharacterEquipment>(__instance, "m_character"); Character val = (Character)((field is Character) ? field : null); if (val != null && (((int)_type == 0 && SkillRequirements.CanAddProtectionToPhysicalResistance(val)) || SkillRequirements.CanAddProtectionToAnyDamageResistance(val))) { __result += val.Stats.GetDamageProtection((Types)0); } } } [HarmonyPatch(typeof(CharacterEquipment), "GetEquipmentImpactResistance")] public class CharacterEquipment_GetEquipmentImpactResistance { [HarmonyPostfix] public static void Postfix(CharacterEquipment __instance, ref float __result) { object field = At.GetField<CharacterEquipment>(__instance, "m_character"); Character val = (Character)((field is Character) ? field : null); if (val != null && SkillRequirements.CanAddProtectionToImpactResistance(val)) { __result += val.Stats.GetDamageProtection((Types)0); } } } public class VengefulSpell { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static DescriptionModifier <>9__1_0; internal void <Init>b__1_0(Item item, ref string description) { if (item.ItemID == 2502020 && SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "Being damaged causes rage to build up."; } } } public const string NAME = "Vengeful"; public static Skill Init() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0044: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0082: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_001a: 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_0025: Expected O, but got Unknown DescriptionModifier onDescriptionModified = TinyHelper.OnDescriptionModified; object obj = <>c.<>9__1_0; if (obj == null) { DescriptionModifier val = delegate(Item item, ref string description) { if (item.ItemID == 2502020 && SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502020)) { description = "Being damaged causes rage to build up."; } }; <>c.<>9__1_0 = val; obj = (object)val; } TinyHelper.OnDescriptionModified = (DescriptionModifier)Delegate.Combine((Delegate?)(object)onDescriptionModified, (Delegate?)obj); SL_Skill val2 = new SL_Skill { Name = "Vengeful", EffectBehaviour = (EditBehaviours)2, Target_ItemID = 8205030, New_ItemID = 2502020, SLPackName = Juggernaut.ModFolderName, SubfolderName = "Vengeful", Description = "Being damaged causes rage to build up.\n\nBe aware that learning this skill has impact on most other Juggernaut skills!", IsUsable = false, CastType = (SpellCastType)(-1), CastModifier = (SpellCastModifier)0, CastLocomotionEnabled = false, MobileCastMovementMult = -1f }; ((ContentTemplate)val2).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val2).New_ItemID); return (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); } } [HarmonyPatch(typeof(Character), "ReceiveHit", new Type[] { typeof(Object), typeof(DamageList), typeof(Vector3), typeof(Vector3), typeof(float), typeof(float), typeof(Character), typeof(float), typeof(bool) })] public class Character_ReceiveHit { [HarmonyPostfix] public static void Postfix(Character __instance, ref DamageList __result, Object _damageSource, DamageList _damage, Vector3 _hitDir, Vector3 _hitPoint, float _angle, float _angleDir, Character _dealerChar, float _knockBack, bool _hitInventory) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (SkillRequirements.CanEnrageFromDamage(__instance) && __result.TotalDamage > 0f) { __instance.StatusEffectMngr.AddStatusEffectBuildUp(ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Rage"), _damage.TotalDamage, __instance); } Object obj = ((_damageSource is Item) ? _damageSource : null); object obj2 = ((obj != null) ? ((EffectSynchronizer)obj).OwnerCharacter : null); if (obj2 == null) { Object obj3 = ((_damageSource is Effect) ? _damageSource : null); obj2 = ((obj3 != null) ? ((Effect)obj3).OwnerCharacter : null); if (obj2 == null) { Object obj4 = ((_damageSource is EffectSynchronizer) ? _damageSource : null); obj2 = ((obj4 != null) ? ((EffectSynchronizer)obj4).OwnerCharacter : null); } } Character ownerCharacter = (Character)obj2; if (!SkillRequirements.CanTerrify(ownerCharacter) || !(__result.TotalDamage > 0f)) { return; } List<Character> source = new List<Character>(); CharacterManager.Instance.FindCharactersInRange(__instance.CenterPosition, 7f, ref source); source = source.Where((Character c) => !c.IsAlly(ownerCharacter)).ToList(); foreach (Character item in source) { StatusEffectManager statusEffectMngr = item.StatusEffectMngr; if (statusEffectMngr != null) { bool flag = statusEffectMngr.HasStatusEffect("Confusion"); statusEffectMngr.AddStatusEffectBuildUp(ResourcesPrefabManager.Instance.GetStatusEffectPrefab("Confusion"), Mathf.Clamp(__result.TotalDamage, 0f, 40f), item); if (!flag && statusEffectMngr.HasStatusEffect("Confusion")) { CasualStagger.Stagger(item); } } } } } public class UnyieldingSpell { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static DescriptionModifier <>9__1_0; internal void <Init>b__1_0(Item item, ref string description) { if (item.ItemID == 2502019 && SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "A portion of physical damage taken proportional to your Protection is delayed over " + DelayedDamageEffect.LifeSpan + " seconds."; } } } public const string NAME = "Unyielding"; public static Skill Init() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0044: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0096: 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_00ae: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_001a: 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_0025: Expected O, but got Unknown DescriptionModifier onDescriptionModified = TinyHelper.OnDescriptionModified; object obj = <>c.<>9__1_0; if (obj == null) { DescriptionModifier val = delegate(Item item, ref string description) { if (item.ItemID == 2502019 && SkillRequirements.SafeHasSkillKnowledge(CharacterManager.Instance.GetFirstLocalCharacter(), 2502019)) { description = "A portion of physical damage taken proportional to your Protection is delayed over " + DelayedDamageEffect.LifeSpan + " seconds."; } }; <>c.<>9__1_0 = val; obj = (object)val; } TinyHelper.OnDescriptionModified = (DescriptionModifier)Delegate.Combine((Delegate?)(object)onDescriptionModified, (Delegate?)obj); SL_Skill val2 = new SL_Skill { Name = "Unyielding", EffectBehaviour = (EditBehaviours)2, Target_ItemID = 8205030, New_ItemID = 2502019, SLPackName = Juggernaut.ModFolderName, SubfolderName = "Unyielding", Description = "A portion of physical damage taken proportional to your Protection is delayed over " + DelayedDamageEffect.LifeSpan + " seconds.\n\nBe aware that learning this skill has impact on most other Juggernaut skills!", IsUsable = false, CastType = (SpellCastType)(-1), CastModifier = (SpellCastModifier)0, CastLocomotionEnabled = false, MobileCastMovementMult = -1f }; ((ContentTemplate)val2).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val2).New_ItemID); return (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); } } public class RelentlessSkill { public static Skill Init() { //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_0023: 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_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0073: 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_0090: Expected O, but got Unknown SL_Skill val = new SL_Skill { Name = "Relentless", EffectBehaviour = (EditBehaviours)2, Target_ItemID = 8205030, New_ItemID = 2502018, SLPackName = Juggernaut.ModFolderName, SubfolderName = "Relentless", Description = "Reduces armor movement penalties and gives bonus physical resistance equal to your armor protection.", IsUsable = false, CastType = (SpellCastType)(-1), CastModifier = (SpellCastModifier)0, CastLocomotionEnabled = false, MobileCastMovementMult = -1f }; ((ContentTemplate)val).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val).New_ItemID); return (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); } } public class TackleSpell { public static Skill Init() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) SL_AttackSkill val = new SL_AttackSkill(); ((SL_Item)val).Name = "Tackle"; ((SL_Item)val).EffectBehaviour = (EditBehaviours)2; ((SL_Item)val).Target_ItemID = 8100072; ((SL_Item)val).New_ItemID = 2502017; ((SL_Item)val).SLPackName = Juggernaut.ModFolderName; ((SL_Item)val).SubfolderName = "Tackle"; ((SL_Item)val).Description = "Required: Empty left hand\nRam into your opponent! Either of you will fall. The most stable at foot will triump!"; ((SL_Item)val).CastType = (SpellCastType)758; ((SL_Item)val).CastModifier = (SpellCastModifier)2; ((SL_Item)val).CastLocomotionEnabled = false; ((SL_Item)val).MobileCastMovementMult = -1f; ((SL_Item)val).CastSheatheRequired = 0; val.RequiredOffHandTypes = (WeaponType[])(object)new WeaponType[0]; ((SL_Skill)val).Cooldown = 30f; ((SL_Skill)val).StaminaCost = 8f; ((SL_Skill)val).ManaCost = 0f; ((SL_Skill)val).HealthCost = 0f; SL_AttackSkill val2 = val; ((ContentTemplate)val2).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val2).New_ItemID); MeleeSkill val3 = (MeleeSkill)(object)((itemPrefab is MeleeSkill) ? itemPrefab : null); val3.Blockable = false; GameObject gameObject = ((Component)TinyGameObjectManager.GetOrMake(((Component)val3).transform, "MeleeHitDetector", true, true)).gameObject; val3.MeleeHitDetector = gameObject.gameObject.AddComponent<MeleeHitDetector>(); val3.MeleeHitDetector.Radius = 0.3f; val3.MeleeHitDetector.LinecastCount = 3; val3.MeleeHitDetector.Damage = -1f; EmptyOffHandCondition.AddToSkill((Skill)(object)val3, false, false); GameObject gameObject2 = ((Component)TinyGameObjectManager.GetOrMake(((Component)val3).transform, "ActivationEffects", true, true)).gameObject; gameObject2.AddComponent<InitTackle>(); for (int i = 0; i < 4; i++) { EnableHitDetection val4 = gameObject2.AddComponent<EnableHitDetection>(); ((Effect)val4).Delay = 0.2f + (float)i * 0.08f; } GameObject gameObject3 = ((Component)TinyGameObjectManager.GetOrMake(((Component)val3).transform, "HitEffects", true, true)).gameObject; TackleEffect tackleEffect = gameObject3.AddComponent<TackleEffect>(); ((PunctualDamage)tackleEffect).Knockback = 10f; ((PunctualDamage)tackleEffect).Damages = (DamageType[])(object)new DamageType[1] { new DamageType((Types)0, 3f) }; GameObject gameObject4 = ((Component)ResourcesPrefabManager.Instance.GetItemPrefab(8100190)).gameObject; PlaySoundEffect[] componentsInChildren = ((Component)gameObject4.transform.Find("ActivationEffects")).GetComponentsInChildren<PlaySoundEffect>(); foreach (PlaySoundEffect val5 in componentsInChildren) { PlaySoundEffect val6 = gameObject2.AddComponent<PlaySoundEffect>(); val6.Sounds = val5.Sounds; ((Effect)val6).Delay = ((Effect)val5).Delay; val6.Follow = val5.Follow; val6.MinPitch = val5.MinPitch; val6.MaxPitch = val5.MaxPitch; ((Effect)val6).SyncType = ((Effect)val5).SyncType; } return (Skill)(object)val3; } } public class ParrySpell { public static Skill Init() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) SL_AttackSkill val = new SL_AttackSkill(); ((SL_Item)val).Name = "Parry"; ((SL_Item)val).EffectBehaviour = (EditBehaviours)1; ((SL_Item)val).Target_ItemID = 8100360; ((SL_Item)val).New_ItemID = 2502016; ((SL_Item)val).Description = "Completely block a physical attack."; ((SL_Item)val).CastType = (SpellCastType)501; ((SL_Item)val).CastModifier = (SpellCastModifier)2; ((SL_Item)val).CastLocomotionEnabled = false; ((SL_Item)val).MobileCastMovementMult = -1f; ((SL_Item)val).CastSheatheRequired = 2; WeaponType[] array = new WeaponType[8]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); val.RequiredWeaponTypes = (WeaponType[])(object)array; ((SL_Skill)val).Cooldown = 3f; ((SL_Skill)val).StaminaCost = 4f; ((SL_Skill)val).ManaCost = 0f; ((SL_Skill)val).HealthCost = 0f; SL_AttackSkill val2 = val; ((ContentTemplate)val2).ApplyTemplate(); Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(((SL_Item)val2).New_ItemID); Skill val3 = (Skill)(object)((itemPrefab is Skill) ? itemPrefab : null); Transform val4 = UnityEngineExtensions.FindInAllChildren(((Component)val3).gameObject.transform, "HitEffects"); Object.Destroy((Object)(object)((Component)val4).gameObject); return val3; } } public class JuggernautSkillTree { public static void SetupSkillTree(ref SkillSchool juggernautTreeInstance) { //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_0018: 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) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0062: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0079: 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) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b5: Expected O, but got Unknown //IL_00c0: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00d5: 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_00e1: 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_00f4: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0116: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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_0130: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0179: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_01d3: 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) //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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_0216: Expected O, but got Unknown //IL_0221: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_02e4: Expected O, but got Unknown //IL_02ef: Expected O, but got Unknown //IL_02f6: Expected O, but got Unknown SL_SkillTree val = new SL_SkillTree { Name = "Juggernaut", SkillRows = new List<SL_SkillRow> { new SL_SkillRow { RowIndex = 1, Slots = new List<SL_BaseSkillSlot> { (SL_BaseSkillSlot)new SL_SkillSlotFork { ColumnIndex = 2, RequiredSkillSlot = Vector2.zero, Choice1 = new SL_SkillSlot { ColumnIndex = 2, SilverCost = 50, SkillID = 2502020, RequiredSkillSlot = Vector2.zero, Breakthrough = false }, Choice2 = new SL_SkillSlot { ColumnIndex = 2, SilverCost = 50, SkillID = 2502019, RequiredSkillSlot = Vector2.zero, Breakthrough = false } } } }, new SL_SkillRow { RowIndex = 2, Slots = new List<SL_BaseSkillSlot> { (SL_BaseSkillSlot)new SL_SkillSlot { ColumnIndex = 1, SilverCost = 100, SkillID = 2502017, Breakthrough = false, RequiredSkillSlot = Vector2.zero } } }, new SL_SkillRow { RowIndex = 3, Slots = new List<SL_BaseSkillSlot> { (SL_BaseSkillSlot)new SL_SkillSlot { ColumnIndex = 2, SilverCost = 500, SkillID = 2502022, Breakthrough = true, RequiredSkillSlot = new Vector2(1f, 2f) } } }, new SL_SkillRow { RowIndex = 4, Slots = new List<SL_BaseSkillSlot> { (SL_BaseSkillSlot)new SL_SkillSlot { ColumnIndex = 1, SilverCost = 600, SkillID = 2502021, Breakthrough = false, RequiredSkillSlot = new Vector2(3f, 2f) }, (SL_BaseSkillSlot)new SL_SkillSlot { ColumnIndex = 3, SilverCost = 600, SkillID = 2502037, Breakthrough = false, RequiredSkillSlot = new Vector2(3f, 2f) } } }, new SL_SkillRow { RowIndex = 5, Slots = new List<SL_BaseSkillSlot> { (SL_BaseSkillSlot)new SL_SkillSlotFork { ColumnIndex = 2, RequiredSkillSlot = new Vector2(3f, 2f), Choice1 = new SL_SkillSlot { ColumnIndex = 2, SilverCost = 600, SkillID = 2502040, RequiredSkillSlot = new Vector2(3f, 2f), Breakthrough = false }, Choice2 = new SL_SkillSlot { ColumnIndex = 2, SilverCost = 600, SkillID = 2502024, RequiredSkillSlot = new Vector2(3f, 2f), Breakthrough = false } } } } } }; juggernautTreeInstance = val.CreateBaseSchool(); val.ApplyRows(); } }
plugins/Proficiencies.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace Proficiencies; public interface IWeaponProficiencyFromItem { float Apply(Item item); } public interface IWeaponProficiencyOnCharacter { void Apply(Character character, float original, ref float result); } [BepInPlugin("com.ehaugw.proficiencies", "Proficiencies", "1.0.1")] public class Proficiencies : BaseUnityPlugin { [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Item_Description { [HarmonyPostfix] public static void Postfix(Item __instance, ref string __result) { float weaponProficiency = __instance.GetWeaponProficiency(); if (weaponProficiency != 0f) { __result = "Weapon Proficiency: " + weaponProficiency + "\n" + __result; } } } public const string GUID = "com.ehaugw.proficiencies"; public const string VERSION = "1.0.1"; public const string NAME = "Proficiencies"; public static List<IWeaponProficiencyOnCharacter> IWeaponProficiencyOnCharacterSources = new List<IWeaponProficiencyOnCharacter>(); public static List<IWeaponProficiencyFromItem> IWeaponProfiencyFromItemSources = new List<IWeaponProficiencyFromItem>(); internal void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Harmony val = new Harmony("com.ehaugw.proficiencies"); val.PatchAll(); } } public static class ProficiencyExtensions { public static float GetWeaponProficiency(this Item item) { return Proficiencies.IWeaponProfiencyFromItemSources.Select((IWeaponProficiencyFromItem modifier) => modifier.Apply(item)).Sum(); } public static float GetTotalWeaponProficiency(this Character character) { EquipmentSlotIDs[] array = new EquipmentSlotIDs[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); float num = ((IEnumerable<EquipmentSlotIDs>)(object)array).Select(delegate(EquipmentSlotIDs slot) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) Character obj = character; float? obj2; if (obj == null) { obj2 = null; } else { CharacterInventory inventory = obj.Inventory; obj2 = ((inventory == null) ? null : inventory.GetEquippedItem(slot)?.GetWeaponProficiency()); } float? num2 = obj2; return num2.GetValueOrDefault(); }).Sum(); float result = num; foreach (IWeaponProficiencyOnCharacter iWeaponProficiencyOnCharacterSource in Proficiencies.IWeaponProficiencyOnCharacterSources) { iWeaponProficiencyOnCharacterSource.Apply(character, num, ref result); } return result; } }
plugins/SynchronizedWorldObjects.dll
Decompiled 2 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading.Tasks; using BepInEx; using HarmonyLib; using MapMagic; using Photon; using SideLoader; using TinyHelper; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] namespace SynchronizedWorldObjects; [BepInPlugin("com.ehaugw.synchronizedworldobjects", "Synchronized World Objects", "1.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency("com.ehaugw.tinyhelper", "4.8.2")] public class SynchronizedWorldObjects : BaseUnityPlugin { public const string GUID = "com.ehaugw.synchronizedworldobjects"; public const string VERSION = "1.0.3"; public const string NAME = "Synchronized World Objects"; internal void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown GameObject val = new GameObject("SynchronizedWorldObjectsRPC"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<SynchronizedWorldObjectManager>(); SynchronizedWorldObjectManager.SyncedWorldObjects = new List<SynchronizedWorldObject>(); SL.OnPacksLoaded += OnPackLoaded; SL.OnSceneLoaded += OnSceneLoaded; Harmony val2 = new Harmony("com.ehaugw.synchronizedworldobjects"); val2.PatchAll(); } private void OnPackLoaded() { } private void OnSceneLoaded() { SynchronizedWorldObjectManager.OnSceneLoaded(); } } public abstract class SynchronizedWorldObject { public string IdentifierName; public string SceneIdentifierName; public int RPCListenerID; public string Uid; public SynchronizedWorldObject(string identifierName, int rpcListenerID) { IdentifierName = identifierName; RPCListenerID = rpcListenerID; SynchronizedWorldObjectManager.SyncedWorldObjects.Add(this); } public virtual bool ShouldBeSpawned() { return SceneManagerHelper.ActiveSceneName == SceneIdentifierName; } public abstract bool OnSceneLoaded(); public abstract bool OnGuestJoined(string guestUID); public abstract object SetupClientSide(int rpcListenerID, string instanceUID, int sceneViewID, int recursionCount, string rpcMeta); } internal class SynchronizedWorldObjectManager : MonoBehaviour { public static SynchronizedWorldObjectManager Instance; public static List<SynchronizedWorldObject> SyncedWorldObjects; public static void OnSceneLoaded() { foreach (SynchronizedWorldObject syncedWorldObject in SyncedWorldObjects) { syncedWorldObject.OnSceneLoaded(); } } internal void Start() { Instance = this; PhotonView val = ((Component)this).gameObject.AddComponent<PhotonView>(); val.viewID = 951; Debug.Log((object)("Registered SynchronizedWorldObjectManager with ViewID " + ((MonoBehaviour)this).photonView.viewID)); } [PunRPC] public void SetupClientSide(int rpcListenerID, string instanceUID, int sceneViewID, int recursionCount, string rpcMeta) { foreach (SynchronizedWorldObject syncedWorldObject in SyncedWorldObjects) { syncedWorldObject.SetupClientSide(rpcListenerID, instanceUID, sceneViewID, recursionCount, rpcMeta); } } } public class SynchronizedDeployable : SynchronizedEquipment { public SynchronizedDeployable(int itemID) : base(itemID) { } public override object SetupClientSide(int rpcListenerID, string instanceUID, int sceneViewID, int recursionCount, string rpcMeta) { return null; } public override Item SetupServerSide() { Item val = base.SetupServerSide(); val.IsPickable = false; val.HasPhysicsWhenWorld = false; Deployable component = ((Component)val).GetComponent<Deployable>(); component.StartDeployAnimation(); Dropable component2 = ((Component)val).GetComponent<Dropable>(); if (Object.op_Implicit((Object)(object)component2)) { component2.GenerateContents(); } FueledContainer component3 = ((Component)val).GetComponent<FueledContainer>(); if (Object.op_Implicit((Object)(object)component3)) { component3.TryKindle = true; } return val; } } public class SynchronizedEquipment : SynchronizedWorldObject { public Vector3 Position; public Vector3 Rotation; public Vector3 Scale; public int ItemID; public bool IsPickable = false; public SynchronizedEquipment(int itemID) : base("-1", -1) { ItemID = itemID; } public void AddToScene(string scene, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0011: 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_0019: Unknown result type (might be due to invalid IL or missing references) SceneIdentifierName = scene; Position = position; Rotation = rotation; Scale = scale; } public override bool OnGuestJoined(string guestUID) { return false; } public override bool OnSceneLoaded() { if (ShouldBeSpawned()) { if (!PhotonNetwork.isNonMasterClientInRoom) { SetupServerSide(); } return true; } return false; } public override object SetupClientSide(int rpcListenerID, string instanceUID, int sceneViewID, int recursionCount, string rpcMeta) { return null; } public virtual Item SetupServerSide() { //IL_0015: 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_0034: Unknown result type (might be due to invalid IL or missing references) Item val = ItemManager.Instance.GenerateItemNetwork(ItemID); val.ChangeParent((Transform)null, Position, Extensions.EulerToQuat(Rotation)); val.SetForceSyncPos(); val.SaveType = (SaveTypes)2; val.IsPickable = false; val.HasPhysicsWhenWorld = true; return val; } } public class SynchronizedNPCScene { public string Scene; public Vector3 Position; public Vector3 Rotation; public Factions? Faction; public bool Sheathed; public SpellCastType Pose; public string RPCMeta; public int[] DefaultEquipment; public int[] ModdedEquipment; public Func<bool> ShouldSpawnInScene; public SynchronizedNPCScene(string scene, Vector3 position, Vector3 rotation, Factions? faction = null, bool sheathed = true, SpellCastType pose = -1, string rpcMeta = null, int[] defaultEquipment = null, int[] moddedEquipment = null, Func<bool> shouldSpawnInScene = null) { //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_0017: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Scene = scene; Position = position; Rotation = rotation; Faction = faction; Sheathed = sheathed; Pose = pose; RPCMeta = rpcMeta; DefaultEquipment = defaultEquipment; ModdedEquipment = moddedEquipment; ShouldSpawnInScene = shouldSpawnInScene ?? ((Func<bool>)(() => true)); } } public class SynchronizedNPC : SynchronizedWorldObject { public enum HairColors { BrownMedium, BrownBright, BrownDark, Black, Blonde, White, Red, Blue, Green, Orange, Purple } public enum HairStyles { Bald, Basic, PonyTail, Wild, CombedBack, PonyTailBraids, BraidsBack, Bun, MaleShort, MaleMedium, MaleLong, CornrowsMedium, CornrowsLong, CornrowsShort, Ball } public int[] DefaultEquipment = new int[0]; public int[] ModdedEquipment = new int[0]; public Vector3 Scale; public string RPCMeta; public Factions Faction; private Character localCharacter; private AIRoot aiRoot; public VisualData VisualData; public List<SynchronizedNPCScene> Scenes = new List<SynchronizedNPCScene>(); public SynchronizedNPCScene ActiveScene; public SynchronizedNPC(string identifierName, int rpcListenerID, int[] defaultEquipment = null, int[] moddedEquipment = null, Vector3? scale = null, Factions? faction = null, VisualData visualData = null) : base(identifierName, rpcListenerID) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0073: 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) DefaultEquipment = defaultEquipment ?? new int[0]; ModdedEquipment = moddedEquipment ?? new int[0]; Scale = (Vector3)(((??)scale) ?? Vector3.one); Faction = faction.GetValueOrDefault(); VisualData = visualData; } public void AddToScene(SynchronizedNPCScene scene) { Scenes.Add(scene); } public void AssignAI(AIRoot aiRoot) { this.aiRoot = aiRoot; } public GameObject GetGameObject() { return GameObject.Find("UNPC_" + IdentifierName); } public object GetSynchronizedObject(string instanceUID) { return CharacterManager.Instance.GetCharacter(instanceUID); } public override bool ShouldBeSpawned() { foreach (SynchronizedNPCScene scene in Scenes) { if (scene.ShouldSpawnInScene() && scene.Scene == SceneManagerHelper.ActiveSceneName) { ActiveScene = scene; return true; } } return false; } public override bool OnSceneLoaded() { if (ShouldBeSpawned()) { if (!PhotonNetwork.isNonMasterClientInRoom) { int num = PhotonNetwork.AllocateSceneViewID(); GameObject gameObject = GetGameObject(); if ((Object)(object)gameObject == (Object)null) { SetupServerSide(); ((MonoBehaviour)SynchronizedWorldObjectManager.Instance).photonView.RPC("SetupClientSide", (PhotonTargets)0, new object[5] { RPCListenerID, Uid, num, 0, ActiveScene.RPCMeta }); return true; } } } else { GameObject gameObject2 = GetGameObject(); if (gameObject2 != null) { Object.DestroyImmediate((Object)(object)gameObject2); } } return false; } public override bool OnGuestJoined(string guestUID) { if (ShouldBeSpawned()) { if (!PhotonNetwork.isNonMasterClientInRoom) { int num = PhotonNetwork.AllocateSceneViewID(); GameObject gameObject = GetGameObject(); if ((Object)(object)gameObject == (Object)null) { ((MonoBehaviour)SynchronizedWorldObjectManager.Instance).photonView.RPC("SetupClientSide", (PhotonTargets)0, new object[5] { RPCListenerID, Uid, num, 0, ActiveScene.RPCMeta }); return true; } } } else { GameObject gameObject2 = GetGameObject(); if (gameObject2 != null) { Object.DestroyImmediate((Object)(object)gameObject2); } } return false; } public override object SetupClientSide(int rpcListenerID, string instanceUID, int sceneViewID, int recursionCount, string rpcMeta) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //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_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) if (RPCListenerID != rpcListenerID) { return null; } ActiveScene = Scenes.FirstOrDefault((SynchronizedNPCScene x) => x.RPCMeta == rpcMeta); int num = 200; object synchronizedObject = GetSynchronizedObject(instanceUID); Character val = (Character)((synchronizedObject is Character) ? synchronizedObject : null); if ((Object)(object)val == (Object)null) { if (recursionCount * num < 20000) { DelayedTask.GetTask(num).ContinueWith((Task _) => SetupClientSide(rpcListenerID, instanceUID, sceneViewID, recursionCount + 1, rpcMeta)); Console.Read(); return null; } Debug.Log((object)("SynchronizedNPC with UID " + instanceUID + " could not fetched from server")); return null; } GameObject val2 = new GameObject("UNPC_" + IdentifierName); val2.transform.position = ActiveScene.Position; val2.transform.rotation = Quaternion.Euler(ActiveScene.Rotation); GameObject gameObject = ((Component)val).gameObject; if (VisualData != null) { ((MonoBehaviour)TinyHelper.Instance).StartCoroutine(SL_Character.SetVisuals(val, ((object)VisualData).ToString())); } gameObject.transform.parent = val2.transform; gameObject.transform.position = val2.transform.position; gameObject.transform.rotation = val2.transform.rotation; gameObject.transform.localScale = Scale; Object.DestroyImmediate((Object)(object)gameObject.GetComponent<StartingEquipment>()); ((Behaviour)val.Stats).enabled = false; Weapon currentWeapon = val.CurrentWeapon; if (currentWeapon != null && ((Equipment)currentWeapon).TwoHanded) { val.LeftHandEquipment = (Equipment)(object)val.CurrentWeapon; val.LeftHandChanged(); } if ((Object)(object)val.CurrentWeapon != (Object)null) { val.Sheathed = ActiveScene.Sheathed; } localCharacter = val; return val; } public void AITick() { //IL_004c: 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_008b: Expected I4, but got Unknown DelayedTask.GetTask(1000).ContinueWith(delegate { AITick(); }); Console.Read(); if ((Object)(object)localCharacter != (Object)null) { SpellCastType[] array = (SpellCastType[])(object)new SpellCastType[2] { (SpellCastType)55, (SpellCastType)41 }; if (UnityEngineExtensions.Contains<SpellCastType>(array, ActiveScene.Pose) && localCharacter.InLocomotion) { localCharacter.Animator.SetInteger("SpellType", (int)ActiveScene.Pose); localCharacter.Animator.SetTrigger("Spell"); } } } public object SetupServerSide() { //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_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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) UID val = UID.Generate(); string text = ((object)(UID)(ref val)).ToString(); GameObject gameObject = ((Component)TinyCharacterManager.SpawnCharacter(text, ActiveScene.Position, ActiveScene.Rotation)).gameObject; gameObject.transform.rotation = Quaternion.Euler(ActiveScene.Rotation); Character component = gameObject.GetComponent<Character>(); At.SetField<Character>(component, "m_instantiationType", (object)(CharacterInstantiationTypes)2); int[] array = ActiveScene.DefaultEquipment ?? DefaultEquipment; foreach (int num in array) { ? val2 = component.Inventory.Equipment; Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(num); ((CharacterEquipment)val2).EquipInstantiate((Equipment)(object)((itemPrefab is Equipment) ? itemPrefab : null)); } int[] array2 = ActiveScene.ModdedEquipment ?? ModdedEquipment; for (int j = 0; j < array2.Length; j++) { int num2 = array2[j]; if (ResourcesPrefabManager.Instance.ContainsItemPrefab(num2.ToString())) { Item obj = ItemManager.Instance.GenerateItemNetwork(num2); Equipment val3 = (Equipment)(object)((obj is Equipment) ? obj : null); component.Inventory.TakeItem(((Item)val3).UID); At.Invoke<CharacterEquipment>(component.Inventory.Equipment, "EquipWithoutAssociating", new Type[2] { typeof(Equipment), typeof(bool) }, new object[2] { val3, false }); } } Weapon currentWeapon = component.CurrentWeapon; if (currentWeapon != null && ((Equipment)currentWeapon).TwoHanded) { component.LeftHandEquipment = (Equipment)(object)component.CurrentWeapon; component.LeftHandChanged(); } if ((Object)(object)component.CurrentWeapon != (Object)null) { component.Sheathed = ActiveScene.Sheathed; } component.ChangeFaction((Factions)(((??)ActiveScene.Faction) ?? Faction), true); gameObject.SetActive(true); DelayedTask.GetTask(1000).ContinueWith(delegate { AITick(); }); Console.Read(); Uid = text; return text; } }
plugins/TinyHelper.dll
Decompiled 2 months ago#define DEBUG using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading; using System.Threading.Tasks; using BepInEx; using CharacterQuestKnowledgeExtensions; using HarmonyLib; using Localizer; using NodeCanvas.DialogueTrees; using NodeCanvas.Framework; using NodeCanvas.Tasks.Actions; using NodeCanvas.Tasks.Conditions; using Photon; using TinyHelper; using TinyHelper.Effects; using TinyHelper.Interfaces; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("0.0.0.0")] public static class TinyHelpers { public static void Shuffle<T>(this IList<T> list) { Random random = new Random(); int count = list.Count; for (int num = list.Count - 1; num > 1; num--) { int index = random.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } } namespace CharacterQuestKnowledgeExtensions { public static class CharacterQuestKnowledgeExtensions { public static bool IsItemLearnedLocal(this CharacterQuestKnowledge questKnowledge, int _itemID) { return (from q in ((CharacterKnowledge)questKnowledge).GetLearnedItems() where q.ItemID == _itemID && Object.op_Implicit((Object)(object)((EffectSynchronizer)q).OwnerCharacter) select q).Count() > 0; } public static bool IsQuestCompletedLocal(this CharacterQuestKnowledge questKnowledge, int _itemID) { return ((CharacterKnowledge)questKnowledge).GetLearnedItems().Where(delegate(Item q) { int result; if (q.ItemID == _itemID && Object.op_Implicit((Object)(object)((EffectSynchronizer)q).OwnerCharacter)) { Quest val = (Quest)(object)((q is Quest) ? q : null); if (val != null) { result = (val.IsCompleted ? 1 : 0); goto IL_002e; } } result = 0; goto IL_002e; IL_002e: return (byte)result != 0; }).Count() > 0; } } } namespace CharacterExtensions { public static class CharacterExtensions { public static List<Item> EquippedOnBag(this Character character) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) object result; if (character == null) { result = null; } else { CharacterInventory inventory = character.Inventory; result = ((inventory == null) ? null : inventory.GetOwnedItems(TinyTagManager.GetOrMakeTag("Item"))?.Where((Item x) => x.DisplayedOnBag)?.ToList()); } return (List<Item>)result; } } } namespace TinyHelper { public static class At { public static BindingFlags flags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static object Call(object obj, string method, params object[] args) { MethodInfo method2 = obj.GetType().GetMethod(method, flags); if (method2 != null) { return method2.Invoke(obj, args); } return null; } public static void SetValue<T>(T value, Type type, object obj, string field) { FieldInfo field2 = type.GetField(field, flags); if (field2 != null) { field2.SetValue(obj, value); } } public static object GetValue(Type type, object obj, string value) { FieldInfo field = type.GetField(value, flags); if (field != null) { return field.GetValue(obj); } return null; } public static void InheritBaseValues(object _derived, object _base) { FieldInfo[] fields = _base.GetType().GetFields(flags); foreach (FieldInfo fieldInfo in fields) { try { _derived.GetType().GetField(fieldInfo.Name).SetValue(_derived, fieldInfo.GetValue(_base)); } catch { } } } } public class QuestKnowledgeCondition : EffectCondition { public int[] Quests; public LogicType Logic = LogicType.Any; protected override bool CheckIsValid(Character _affectedCharacter) { return QuestRequirements.HasQuestKnowledge(_affectedCharacter, Quests, Logic); } } public class StatusEffectsCondition : EffectCondition { public enum LogicType { Any, All } public string[] StatusEffectNames; public LogicType Logic = LogicType.Any; protected override bool CheckIsValid(Character _affectedCharacter) { StatusEffectManager statusEffectManager = ((_affectedCharacter != null) ? _affectedCharacter.StatusEffectMngr : null); if (statusEffectManager != null) { IEnumerable<bool> source = StatusEffectNames.Select((string x) => (Object)(object)statusEffectManager.GetStatusEffectOfName(x) != (Object)null); return (Logic == LogicType.Any) ? source.Any((bool x) => x) : source.All((bool x) => x); } return false; } } public class AddNewStatusEffectRandom : AddStatusEffectRandom { protected override bool TryTriggerConditions() { List<StatusEffect> list = base.Statuses.ToList(); list.Shuffle(); base.ForceID = -1; for (int i = 0; i < list.Count; i++) { StatusEffect val = list[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)((Effect)this).m_affectedCharacter == (Object)null) && !((Effect)this).m_affectedCharacter.StatusEffectMngr.HasStatusEffect(val.EffectFamily)) { base.ForceID = UnityEngineExtensions.IndexOf<StatusEffect>(base.Statuses, val); break; } } return ((AddStatusEffectRandom)this).TryTriggerConditions(); } } public class EnableHitDetection : Effect { protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { Item parentItem = ((Effect)this).ParentItem; MeleeSkill val = (MeleeSkill)(object)((parentItem is MeleeSkill) ? parentItem : null); if (val != null && (Object)(object)val.MeleeHitDetector != (Object)null) { MeleeHitDetector val2 = ((_affectedCharacter != null) ? _affectedCharacter.SkillMeleeDetector : null); if (val2 != null) { val2.HitStarted(-1); return; } } Weapon obj = ((_affectedCharacter != null) ? _affectedCharacter.CurrentWeapon : null); MeleeWeapon val3 = (MeleeWeapon)(object)((obj is MeleeWeapon) ? obj : null); if (val3 != null) { ((Weapon)val3).HitStarted(-1); } } } public class RemoveItemFromInventory : Effect { public int ItemID; public int Amount = 1; public bool AffectOwner = false; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (AffectOwner) { _affectedCharacter = ((Effect)this).OwnerCharacter; } CharacterInventory inventory = _affectedCharacter.Inventory; if (inventory != null) { inventory.RemoveItem(ItemID, Amount); } } } public class CooldownChangeEffect : Effect { public float HitKnockbackCooldown = -1f; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { Item parentItem = ((Effect)this).ParentItem; Skill val = (Skill)(object)((parentItem is Skill) ? parentItem : null); if (val != null && HitKnockbackCooldown != -1f && _affectedCharacter.IsInKnockback) { At.SetValue(HitKnockbackCooldown, typeof(Skill), val, "m_remainingCooldownTime"); } } } public class EquipSkillDurabilityCondition : EquipDurabilityCondition { protected override bool CheckIsValid(Character _affectedCharacter) { Skill component = ((Component)((Component)this).transform.parent.parent).gameObject.GetComponent<Skill>(); if (component != null) { base.DurabilityRequired = component.DurabilityCost; } return ((EquipDurabilityCondition)this).CheckIsValid(_affectedCharacter); } public static ActivationCondition AddToSkill(Skill skill, EquipmentSlotIDs slot) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0035: 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) Transform orMake = TinyGameObjectManager.GetOrMake(((Component)skill).transform, "AdditionalActivationConditions", setActive: true, dontDestroyOnLoad: true); GameObject gameObject = ((Component)TinyGameObjectManager.GetOrMake(orMake, "EquipSkillDurabilityCondition", setActive: true, dontDestroyOnLoad: true)).gameObject; ActivationCondition val = new ActivationCondition(); EquipSkillDurabilityCondition equipSkillDurabilityCondition = gameObject.AddComponent<EquipSkillDurabilityCondition>(); ((EquipDurabilityCondition)equipSkillDurabilityCondition).EquipmentSlot = slot; val.Condition = (EffectCondition)(object)equipSkillDurabilityCondition; At.SetValue("A required piece of equipment is missing or too damaged to be used this way.", typeof(ActivationCondition), val, "m_defaultMessage"); List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>(); list.Add(val); At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions"); return val; } public static ActivationCondition AddToSkillNotBroken(Skill skill, EquipmentSlotIDs slot) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0035: 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) Transform orMake = TinyGameObjectManager.GetOrMake(((Component)skill).transform, "AdditionalActivationConditions", setActive: true, dontDestroyOnLoad: true); GameObject gameObject = ((Component)TinyGameObjectManager.GetOrMake(orMake, "EquipDurabilityCondition", setActive: true, dontDestroyOnLoad: true)).gameObject; ActivationCondition val = new ActivationCondition(); EquipDurabilityCondition val2 = gameObject.AddComponent<EquipDurabilityCondition>(); val2.EquipmentSlot = slot; val2.DurabilityRequired = 0f; val.Condition = (EffectCondition)(object)val2; At.SetValue("A required piece of equipment is missing or broken.", typeof(ActivationCondition), val, "m_defaultMessage"); List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>(); list.Add(val); At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions"); return val; } } public class AffectCorruption : Effect { public float AffectQuantity = 0f; public bool AffectOwner = false; public bool IsRaw = false; protected override KeyValuePair<string, Type>[] GenerateSignature() { return new KeyValuePair<string, Type>[1] { new KeyValuePair<string, Type>("Value", typeof(float)) }; } public override void SetValue(string[] _data) { if (_data == null || _data.Length >= 1) { float.TryParse(_data[0], out AffectQuantity); } } protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (AffectOwner) { _affectedCharacter = ((Effect)this).OwnerCharacter; } if ((Object)(object)_affectedCharacter != (Object)null && _affectedCharacter.Alive && Object.op_Implicit((Object)(object)_affectedCharacter.PlayerStats)) { _affectedCharacter.PlayerStats.AffectCorruptionLevel(AffectQuantity, !IsRaw); } } } public class UseMana : Effect { public float UsedMana = 0f; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { _affectedCharacter.Stats.UseMana((Tag[])null, UsedMana); } } public class SpecificImbueCondition : EffectCondition { public ImbueEffectPreset imbueEffectPreset; private bool inverse = false; protected override bool CheckIsValid(Character _affectedCharacter) { Weapon val = ((_affectedCharacter != null) ? _affectedCharacter.CurrentWeapon : null); return val != null && val.HasImbuePreset(imbueEffectPreset); } public static ActivationCondition AddToSkill(Skill skill, ImbueEffectPreset imbueEffectPreset, bool inverse = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown GameObject val = new GameObject("SpecificImbueCondition"); ActivationCondition val2 = new ActivationCondition(); SpecificImbueCondition specificImbueCondition = val.AddComponent<SpecificImbueCondition>(); Object.DontDestroyOnLoad((Object)(object)specificImbueCondition); val.SetActive(false); val2.Condition = (EffectCondition)(object)specificImbueCondition; specificImbueCondition.inverse = inverse; specificImbueCondition.imbueEffectPreset = imbueEffectPreset; At.SetValue("You do not have the required imbue effect.", typeof(ActivationCondition), val2, "m_defaultMessage"); List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>(); list.Add(val2); At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions"); return val2; } } public class ExtendedAddStatusEffect : AddStatusEffect { public bool ExtendDuration = false; protected override void ActivateLocally(Character _targetCharacter, object[] _infos) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown StatusEffect status = base.Status; if (ExtendDuration) { bool? obj; if (_targetCharacter == null) { obj = null; } else { StatusEffectManager statusEffectMngr = _targetCharacter.StatusEffectMngr; obj = ((statusEffectMngr != null) ? new bool?(statusEffectMngr.HasStatusEffect(status.IdentifierName)) : null); } bool? flag = obj; if (flag.GetValueOrDefault()) { StatusData statusData = status.StatusData; status.StatusData = new StatusData(statusData); StatusEffect statusEffectOfName = _targetCharacter.StatusEffectMngr.GetStatusEffectOfName(status.IdentifierName); float num = ((statusEffectOfName != null) ? statusEffectOfName.RemainingLifespan : 0f); float num2 = ((status.RemainingLifespan > 0f) ? status.RemainingLifespan : status.StartLifespan); status.StatusData.LifeSpan = num2 + num; ((AddStatusEffect)this).ActivateLocally(_targetCharacter, _infos); status.StatusData = statusData; return; } } ((AddStatusEffect)this).ActivateLocally(_targetCharacter, _infos); } } public static class AnimatorExtension { public static bool HasParameter(this Animator animator, string paramName) { AnimatorControllerParameter[] parameters = animator.parameters; foreach (AnimatorControllerParameter val in parameters) { if (val.name == paramName) { return true; } } return false; } } public class TinyCharacterManager { public static Character SpawnCharacter(string uid, Vector3 position, Vector3 rotation) { //IL_0047: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) Character character = CharacterManager.Instance.GetCharacter(uid); if ((Object)(object)character != (Object)null) { return character; } object[] array = new object[4] { 4, "NewPlayerPrefab", uid, string.Empty }; GameObject val = PhotonNetwork.InstantiateSceneObject("_characters/NewPlayerPrefab", position, Quaternion.Euler(rotation), (byte)0, array); val.SetActive(false); Character component = val.GetComponent<Character>(); component.SetUID(UID.op_Implicit(uid)); At.SetValue<Character>(component, typeof(int), 1, "m_isAI"); return component; } } public class TinyDialogueManager { public static GameObject AssignMerchantTemplate(Transform parentTransform) { //IL_0025: 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) GameObject val = Object.Instantiate<GameObject>(Resources.Load<GameObject>("editor/templates/MerchantTemplate")); val.transform.parent = parentTransform; val.transform.position = parentTransform.position; val.transform.rotation = parentTransform.rotation; return val; } public static GameObject AssignTrainerTemplate(Transform parentTransform) { //IL_0025: 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) GameObject val = Object.Instantiate<GameObject>(Resources.Load<GameObject>("editor/templates/TrainerTemplate")); val.transform.parent = parentTransform; val.transform.position = parentTransform.position; val.transform.rotation = parentTransform.rotation; return val; } public static DialogueActor SetDialogueActorName(GameObject dialogueGameObject, string name) { DialogueActor componentInChildren = dialogueGameObject.GetComponentInChildren<DialogueActor>(); componentInChildren.SetName(name); return componentInChildren; } public static Merchant SetMerchant(GameObject merchantTemplate, UID merchantUID) { return merchantTemplate.GetComponentInChildren<Merchant>(); } public static Trainer SetTrainerSkillTree(GameObject trainerTemplate, UID skillTreeUID) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) Trainer componentInChildren = trainerTemplate.GetComponentInChildren<Trainer>(); At.SetValue<UID>(skillTreeUID, typeof(Trainer), componentInChildren, "m_skillTreeUID"); return componentInChildren; } public static Graph GetDialogueGraph(GameObject trainerTemplate) { DialogueTreeController componentInChildren = trainerTemplate.GetComponentInChildren<DialogueTreeController>(); return ((GraphOwner)componentInChildren).graph; } public static void SetActorReference(Graph graph, DialogueActor actor) { List<ActorParameter> list = At.GetValue(typeof(DialogueTree), (graph is DialogueTree) ? graph : null, "_actorParameters") as List<ActorParameter>; list[0].actor = (IDialogueActor)(object)actor; list[0].name = actor.name; } public static ActionNode MakeMerchantDialogueAction(Graph graph, Merchant merchant) { //IL_0008: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ActionNode val = graph.AddNode<ActionNode>(); ShopDialogueAction val2 = new ShopDialogueAction { Merchant = new BBParameter<Merchant>(merchant) }; BBParameter<Character> obj = new BBParameter<Character>(); ((BBParameter)obj).name = "gInstigator"; val2.PlayerCharacter = obj; ShopDialogueAction action = val2; val.action = (ActionTask)(object)action; return val; } public static ActionNode MakeTrainDialogueAction(Graph graph, Trainer trainer) { //IL_0008: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ActionNode val = graph.AddNode<ActionNode>(); TrainDialogueAction val2 = new TrainDialogueAction { Trainer = new BBParameter<Trainer>(trainer) }; BBParameter<Character> obj = new BBParameter<Character>(); ((BBParameter)obj).name = "gInstigator"; val2.PlayerCharacter = obj; TrainDialogueAction action = val2; val.action = (ActionTask)(object)action; return val; } public static ActionNode MakeStartQuest(Graph graph, int questID) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown ActionNode val = graph.AddNode<ActionNode>(); GiveQuest val3 = (GiveQuest)(object)(val.action = (ActionTask)new GiveQuest()); ref BBParameter<Quest> quest = ref val3.quest; Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(questID); quest = new BBParameter<Quest>((Quest)(object)((itemPrefab is Quest) ? itemPrefab : null)); return val; } public static ActionNode MakeQuestEvent(Graph graph, string EventUID) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //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_0029: Expected O, but got Unknown ActionNode val = graph.AddNode<ActionNode>(); SendQuestEvent val3 = (SendQuestEvent)(object)(val.action = (ActionTask)new SendQuestEvent()); val3.QuestEventRef = new QuestEventReference { EventUID = EventUID }; return val; } public static ConditionNode MakeEventOccuredCondition(Graph graph, string EventUID, int MinStack) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //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_0021: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown ConditionNode val = graph.AddNode<ConditionNode>(); val.condition = (ConditionTask)new Condition_QuestEventOccured { QuestEventRef = new QuestEventReference { EventUID = EventUID }, MinStack = MinStack }; return val; } public static ConditionNode MakeHasItemCondition(Graph graph, int itemID, int MinStack) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_003d: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown ConditionNode val = graph.AddNode<ConditionNode>(); Condition_OwnsItem val2 = new Condition_OwnsItem(); BBParameter<Character> obj = new BBParameter<Character>(); ((BBParameter)obj).name = "gInstigator"; val2.character = obj; val2.item = new BBParameter<ItemReference>(new ItemReference { ItemID = itemID }); val2.minAmount = new BBParameter<int>(MinStack); val2.itemMustBeEquiped = new BBParameter<bool>(false); val2.SaveMatchingContainerVariable = null; val.condition = (ConditionTask)val2; return val; } public static ConditionNode MakeHasItemConditionSimple(Graph graph, int itemID, int MinStack, int enchantment = 0) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown ConditionNode val = graph.AddNode<ConditionNode>(); Condition_SimpleOwnsItem val2 = new Condition_SimpleOwnsItem(); BBParameter<Character> obj = new BBParameter<Character>(); ((BBParameter)obj).name = "gInstigator"; val2.character = obj; val2.item = new BBParameter<Item>(ResourcesPrefabManager.Instance.GetItemPrefab(itemID)); val2.minAmount = new BBParameter<int>(MinStack); val.condition = (ConditionTask)val2; return val; } public static ActionNode MakeGiveItemReward(Graph graph, int itemID, Receiver receiver, int quantity = 1) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown ActionNode val = graph.AddNode<ActionNode>(); GiveReward val3 = (GiveReward)(object)(val.action = (ActionTask)new GiveReward()); val3.RewardReceiver = receiver; ItemQuantity val4 = new ItemQuantity(); ItemReference val5 = new ItemReference(); val5.ItemID = itemID; val4.Item = new BBParameter<ItemReference>(val5); val4.Quantity = BBParameter<int>.op_Implicit(quantity); val3.ItemReward = new List<ItemQuantity> { val4 }; return val; } public static ActionNode MakeResignItem(Graph graph, int itemID, Receiver provider, int quantity = 1, int enchantment = 0) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_003e: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown ActionNode val = graph.AddNode<ActionNode>(); RemoveItem val2 = new RemoveItem(); BBParameter<Character> obj = new BBParameter<Character>(); ((BBParameter)obj).name = "gInstigator"; val2.fromCharacter = obj; val2.Items = new List<BBParameter<ItemReference>> { new BBParameter<ItemReference>(new ItemReference { ItemID = itemID }) }; val2.Amount = new List<BBParameter<int>> { new BBParameter<int>(quantity) }; val.action = (ActionTask)val2; return val; } public static StatementNodeExt MakeStatementNode(Graph graph, string name, string statementText) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown StatementNodeExt val = graph.AddNode<StatementNodeExt>(); val.statement = new Statement(statementText); val.SetActorName(name); return val; } public static MultipleChoiceNodeExt MakeMultipleChoiceNode(Graph graph, string[] statementTexts) { //IL_001a: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown MultipleChoiceNodeExt val = graph.AddNode<MultipleChoiceNodeExt>(); foreach (string text in statementTexts) { val.availableChoices.Add(new Choice { statement = new Statement { text = text } }); } return val; } public static void ChainNodes(Graph graph, Node[] nodes) { Node val = null; foreach (Node val2 in nodes) { if (val != null) { graph.ConnectNodes(val, val2, -1, -1); } val = val2; } } public static void ConnectMultipleChoices(Graph graph, Node baseNode, Node[] nodes) { for (int i = 0; i < nodes.Length; i++) { graph.ConnectNodes(baseNode, nodes[i], i, -1); } } } public class TinyGameObjectManager { public static Transform GetOrMake(Transform parent, string child, bool setActive, bool dontDestroyOnLoad) { return parent.Find(child) ?? MakeFreshObject(child, setActive, dontDestroyOnLoad, parent).transform; } public static GameObject InstantiateClone(GameObject sourceGameObject, bool setActive, bool dontDestroyOnLoad) { return InstantiateClone(sourceGameObject, ((Object)sourceGameObject).name + "(Clone)", setActive, dontDestroyOnLoad); } public static GameObject InstantiateClone(GameObject sourceGameObject, string newGameObjectName, bool setActive, bool dontDestroyOnLoad) { GameObject val = Object.Instantiate<GameObject>(sourceGameObject); val.SetActive(setActive); ((Object)val).name = newGameObjectName; if (dontDestroyOnLoad) { Object.DontDestroyOnLoad((Object)(object)val); } return val; } public static Transform MakeFreshTransform(Transform parent, string child, bool setActive, bool dontDestroyOnLoad) { return MakeFreshObject(child, setActive, dontDestroyOnLoad, parent).transform; } public static GameObject MakeFreshObject(string newGameObjectName, bool setActive, bool dontDestroyOnLoad, Transform parent = null) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown GameObject val = new GameObject(newGameObjectName); val.SetActive(setActive); if ((Object)(object)parent != (Object)null) { val.transform.SetParent(parent); } if (dontDestroyOnLoad) { RecursiveDontDestroyOnLoad(val.transform); } return val; } public static void RecursiveDontDestroyOnLoad(Transform transform) { Transform val = transform; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } Object.DontDestroyOnLoad((Object)(object)((Component)val).gameObject); } } public enum Behaviour { Add, Purge, Replace } public class TinyItemManager { private static Dictionary<int, ItemLocalization> m_ItemLocalizationDictionary; private static Dictionary<string, Item> m_ItemPrefabDictionary; private static Dictionary<int, ItemLocalization> ItemLocalizationDictionary { get { if (m_ItemLocalizationDictionary == null) { m_ItemLocalizationDictionary = At.GetValue(typeof(LocalizationManager), LocalizationManager.Instance, "m_itemLocalization") as Dictionary<int, ItemLocalization>; } return m_ItemLocalizationDictionary; } } private static Dictionary<string, Item> ItemPrefabDictionary { get { if (m_ItemPrefabDictionary == null) { m_ItemPrefabDictionary = At.GetValue(typeof(ResourcesPrefabManager), null, "ITEM_PREFABS") as Dictionary<string, Item>; } return m_ItemPrefabDictionary; } } public static bool SetLegacyResult(int itemID, int legacyOutcomeID) { Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(itemID); if ((Object)(object)itemPrefab != (Object)null) { itemPrefab.LegacyItemID = legacyOutcomeID; return true; } return false; } public static bool AddEnchantingOption(int itemID, int enchantingRecipeID) { //IL_0045: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) Item itemPrefab = ResourcesPrefabManager.Instance.GetItemPrefab(itemID); EnchantmentRecipe enchantmentRecipeForID = RecipeManager.Instance.GetEnchantmentRecipeForID(enchantingRecipeID); if ((Object)(object)enchantmentRecipeForID != (Object)null && (Object)(object)itemPrefab != (Object)null) { List<IngredientData> list = enchantmentRecipeForID.CompatibleEquipments.CompatibleEquipments.ToList(); list.Add(new IngredientData { Type = (IngredientType)1, SpecificIngredient = itemPrefab }); enchantmentRecipeForID.CompatibleEquipments = new EquipmentData { EquipmentTag = enchantmentRecipeForID.CompatibleEquipments.EquipmentTag, CompatibleEquipments = list.ToArray() }; return true; } return false; } public static Item MakeItem(int newID, int targetID, string name = null, string description = null, string identifierName = null) { Item val = TryCloneTargetItem(newID, targetID, newID + "_" + identifierName); ApplyNameAndDescription(val, name, description); return val; } public static Skill MakeSkill(int newID, int targetID, string name = null, string description = null, string identifierName = null, int? manaCost = 0, int? staminaCost = 0, int? healthCost = 0, bool? ignoreLearnNotification = null, bool? hideInUI = null) { Item obj = MakeItem(newID, targetID, name, description, identifierName); Skill val = (Skill)(object)((obj is Skill) ? obj : null); if (manaCost.HasValue) { val.ManaCost = manaCost.GetValueOrDefault(); } if (healthCost.HasValue) { val.HealthCost = healthCost.GetValueOrDefault(); } if (staminaCost.HasValue) { val.StaminaCost = staminaCost.GetValueOrDefault(); } val.IgnoreLearnNotification = ignoreLearnNotification.GetValueOrDefault(); return val; } public static Item TryCloneTargetItem(int newID, int targetID, string identifierName = null) { Dictionary<string, Item> itemPrefabDictionary = ItemPrefabDictionary; Item item = GetItem(targetID.ToString()); if ((Object)(object)item == (Object)null) { TinyHelper.TinyHelperPrint("Could not find target item with ID " + targetID + "."); return null; } if ((Object)(object)((Component)item).gameObject.GetComponent<Item>() == (Object)null) { TinyHelper.TinyHelperPrint(((Object)item).name + " is does not have an Item component."); return null; } GameObject val = Object.Instantiate<GameObject>(((Component)item).gameObject); val.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val); Item component = val.GetComponent<Item>(); component.ItemID = newID; ((Object)component).name = identifierName ?? (newID + "_" + component.Name.Replace(" ", "")); ItemPrefabDictionary.Add(component.ItemID.ToString(), component); return component; } public static void ApplyNameAndDescription(Item item, string name, string description) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown ItemLocalization value = new ItemLocalization(name, description); At.SetValue(name, typeof(Item), item, "m_name"); if (ItemLocalizationDictionary.ContainsKey(item.ItemID)) { ItemLocalizationDictionary[item.ItemID] = value; } else { ItemLocalizationDictionary.Add(item.ItemID, value); } } private static Item GetItem(int itemID) { return GetItem(itemID.ToString()); } private static Item GetItem(string itemID) { return ItemPrefabDictionary[itemID]; } } public class TinyHelperRPCManager : MonoBehaviour { public static TinyHelperRPCManager Instance; internal void Start() { Instance = this; PhotonView val = ((Component)this).gameObject.AddComponent<PhotonView>(); val.viewID = 954; Debug.Log((object)("Registered TinyHelpertRPC with ViewID " + ((MonoBehaviour)this).photonView.viewID)); } [PunRPC] public void ApplyAddImbueEffectRPC(string weaponGUID, int infusionID, float duration) { Item item = ItemManager.Instance.GetItem(weaponGUID); Weapon val = (Weapon)(object)((item is Weapon) ? item : null); ? val2 = val; EffectPreset effectPreset = ResourcesPrefabManager.Instance.GetEffectPreset(infusionID); ((Weapon)val2).AddImbueEffect((ImbueEffectPreset)(object)((effectPreset is ImbueEffectPreset) ? effectPreset : null), duration, (ImbueStack)null); } [PunRPC] public void CharacterForceCancelRPC(string characterGUID, bool bool1, bool bool2) { Character character = CharacterManager.Instance.GetCharacter(characterGUID); character.ForceCancel(bool1, bool2); } } public class QuestRequirements { public static bool HasQuestEvent(string questEventUID) { return QuestEventManager.Instance.GetEventCurrentStack(questEventUID) > 0; } public static bool HasQuestKnowledge(Character character, int[] questIDs, LogicType logicType, bool inverted = false, bool requireCompleted = false) { bool flag = false; object obj; if (character == null) { obj = null; } else { CharacterInventory inventory = character.Inventory; obj = ((inventory != null) ? inventory.QuestKnowledge : null); } CharacterQuestKnowledge q = (CharacterQuestKnowledge)obj; if (q != null) { IEnumerable<bool> source = questIDs.Select((int x) => ((CharacterKnowledge)q).IsItemLearned(x) && (q.IsQuestCompleted(x) || !requireCompleted)); flag = flag || ((logicType == LogicType.Any) ? source.Any((bool x) => x) : source.All((bool x) => x)); } return flag ^ inverted; } public static bool HasQuestKnowledgeLocal(Character character, int[] questIDs, LogicType logicType, bool inverted = false, bool requireCompleted = false) { bool flag = false; object obj; if (character == null) { obj = null; } else { CharacterInventory inventory = character.Inventory; obj = ((inventory != null) ? inventory.QuestKnowledge : null); } CharacterQuestKnowledge q = (CharacterQuestKnowledge)obj; if (q != null) { IEnumerable<bool> source = questIDs.Select((int x) => q.IsItemLearnedLocal(x) && (q.IsQuestCompletedLocal(x) || !requireCompleted)); flag = flag || ((logicType == LogicType.Any) ? source.Any((bool x) => x) : source.All((bool x) => x)); } return flag ^ inverted; } } public enum LogicType { Any, All } public class SkillRequirements { public static bool SafeHasSkillKnowledge(Character character, int skillID) { bool? obj; if (character == null) { obj = null; } else { CharacterInventory inventory = character.Inventory; if (inventory == null) { obj = null; } else { CharacterSkillKnowledge skillKnowledge = inventory.SkillKnowledge; obj = ((skillKnowledge != null) ? new bool?(((CharacterKnowledge)skillKnowledge).IsItemLearned(skillID)) : null); } } bool? flag = obj; return flag.GetValueOrDefault(); } } public class CustomTexture { public enum SpriteBorderTypes { None, Item, TrainerSkill } public enum IconName { m_itemIcon, SkillTreeIcon } private static Dictionary<string, byte[]> m_loadedTextures; private static Dictionary<string, byte[]> LoadedTextures { get { if (m_loadedTextures == null) { m_loadedTextures = new Dictionary<string, byte[]>(); } return m_loadedTextures; } } public static Texture2D LoadTexture(string filePath, int mipCount, bool linear, FilterMode filterMode, float? mipMapBias = null, string rootPath = null) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) filePath = (rootPath ?? TinyHelper.PLUGIN_ROOT_PATH) + filePath; if (!LoadedTextures.ContainsKey(filePath)) { LoadedTextures[filePath] = File.ReadAllBytes(filePath); } Texture2D val = new Texture2D(4, 4, (TextureFormat)12, mipCount > 0, linear); ((Texture)val).filterMode = filterMode; ((Texture)val).mipMapBias = mipMapBias ?? ((Texture)val).mipMapBias; ImageConversion.LoadImage(val, LoadedTextures[filePath]); ((Texture)val).filterMode = (FilterMode)1; return val; } public static Sprite MakeSprite(Texture2D texture, SpriteBorderTypes spriteBorderType) { //IL_0079: 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) float num; float num2; float num3; float num4; switch (spriteBorderType) { case SpriteBorderTypes.Item: num = 1f; num2 = 2f; num3 = 2f; num4 = 3f; break; case SpriteBorderTypes.TrainerSkill: num = 1f; num2 = 1f; num3 = 1f; num4 = 2f; break; default: num = 0f; num2 = 0f; num3 = 0f; num4 = 0f; break; } return Sprite.Create(texture, new Rect(num, num3, (float)((Texture)texture).width - num2, (float)((Texture)texture).height - num4), new Vector2(0f, 0f), 100f, 0u); } } public class CooldownChangeWeaponDamageTargetHealth : WeaponDamageTargetHealth { public float ExecuteSetCooldown = -1f; public float HitKnockbackCooldown = -1f; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { Item parentItem = ((Effect)this).ParentItem; Skill val = (Skill)(object)((parentItem is Skill) ? parentItem : null); if (val != null) { if (HitKnockbackCooldown != -1f && _affectedCharacter.IsInKnockback) { At.SetValue(HitKnockbackCooldown, typeof(Skill), val, "m_remainingCooldownTime"); } bool isDead = _affectedCharacter.IsDead; ((WeaponDamage)this).ActivateLocally(_affectedCharacter, _infos); if (!isDead && _affectedCharacter.IsDead && ExecuteSetCooldown != -1f) { At.SetValue(ExecuteSetCooldown, typeof(Skill), val, "m_remainingCooldownTime"); } } } } public class ToggleEffect : Effect { public StatusEffect StatusEffectInstance; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { if (_affectedCharacter.StatusEffectMngr.HasStatusEffect(StatusEffectInstance.IdentifierName)) { _affectedCharacter.StatusEffectMngr.CleanseStatusEffect(((Object)StatusEffectInstance).name); } else { _affectedCharacter.StatusEffectMngr.AddStatusEffect(StatusEffectInstance, ((Effect)this).SourceCharacter); } } } public class AddThenSpreadStatus : AddStatusEffect { public float Range; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (base.AffectController) { _affectedCharacter = ((Effect)this).OwnerCharacter; } if ((Object)(object)((_affectedCharacter != null) ? _affectedCharacter.StatusEffectMngr : null) == (Object)null || (Object)(object)base.Status == (Object)null) { return; } if (_affectedCharacter.StatusEffectMngr.HasStatusEffect(base.Status.IdentifierName)) { List<Character> source = new List<Character>(); CharacterManager.Instance.FindCharactersInRange(_affectedCharacter.CenterPosition, Range, ref source); foreach (Character item in source.Where((Character c) => !c.IsAlly(((Effect)this).SourceCharacter))) { ((AddStatusEffect)this).ActivateLocally(item, _infos); } } ((AddStatusEffect)this).ActivateLocally(_affectedCharacter, _infos); } } public class EmptyOffHandCondition : EffectCondition { public bool AllowDrawnTwoHandedInRight = false; public bool AllowSheathedTwoHandedInLeft = false; protected override bool CheckIsValid(Character _affectedCharacter) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_affectedCharacter == (Object)null) { goto IL_00dc; } bool? obj; if (_affectedCharacter == null) { obj = null; } else { Equipment leftHandEquipment = _affectedCharacter.LeftHandEquipment; obj = ((leftHandEquipment != null) ? new bool?(((Item)leftHandEquipment).HasTag(TinyTagManager.GetOrMakeTag("HandsFreeTag"))) : null); } if (obj ?? true) { bool? obj2; if (_affectedCharacter == null) { obj2 = null; } else { Weapon currentWeapon = _affectedCharacter.CurrentWeapon; obj2 = ((currentWeapon != null) ? new bool?(((Equipment)currentWeapon).TwoHanded) : null); } bool? flag = obj2; if (!flag.GetValueOrDefault()) { goto IL_00dc; } } if (!_affectedCharacter.Sheathed && AllowDrawnTwoHandedInRight) { Weapon currentWeapon2 = _affectedCharacter.CurrentWeapon; if (currentWeapon2 == null || ((Equipment)currentWeapon2).TwoHandedRight) { goto IL_00dc; } } int result; if (_affectedCharacter.Sheathed && AllowSheathedTwoHandedInLeft) { Weapon currentWeapon3 = _affectedCharacter.CurrentWeapon; result = ((currentWeapon3 == null || ((Equipment)currentWeapon3).TwoHandedRight) ? 1 : 0); } else { result = 0; } goto IL_00dd; IL_00dc: result = 1; goto IL_00dd; IL_00dd: return (byte)result != 0; } public static ActivationCondition AddToSkill(Skill skill, bool allowDrawnTwoHandedInRight = false, bool allowSheathedTwoHandedInLeft = false) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown GameObject val = new GameObject("EmptyOffhandCondition"); ActivationCondition val2 = new ActivationCondition(); EmptyOffHandCondition emptyOffHandCondition = val.AddComponent<EmptyOffHandCondition>(); Object.DontDestroyOnLoad((Object)(object)emptyOffHandCondition); val.SetActive(false); val2.Condition = (EffectCondition)(object)emptyOffHandCondition; emptyOffHandCondition.AllowDrawnTwoHandedInRight = allowDrawnTwoHandedInRight; emptyOffHandCondition.AllowSheathedTwoHandedInLeft = allowSheathedTwoHandedInLeft; At.SetValue("Requires an empty left hand.", typeof(ActivationCondition), val2, "m_defaultMessage"); List<ActivationCondition> list = (At.GetValue(typeof(Skill), skill, "m_additionalConditions") as ActivationCondition[])?.ToList() ?? new List<ActivationCondition>(); list.Add(val2); At.SetValue(list.ToArray(), typeof(Skill), skill, "m_additionalConditions"); return val2; } } internal class InputEnablerEffect : Effect { protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { StatusEffect parentStatusEffect = base.m_parentStatusEffect; if (parentStatusEffect != null && (double)((_affectedCharacter != null) ? _affectedCharacter.AnimMoveSqMagnitude : 0f) > 0.1 && (double)parentStatusEffect.Age > 0.5) { StatusEffectManager statusEffectMngr = _affectedCharacter.StatusEffectMngr; if (statusEffectMngr != null) { statusEffectMngr.CleanseStatusEffect(parentStatusEffect.IdentifierName); } _affectedCharacter.ForceCancel(true, true); } } } internal class TinyUnofficialPatches { } [HarmonyPatch(typeof(Skill), "HasEnoughMana")] public class Skill_HasEnoughMana { [HarmonyPostfix] public static void Postfix(Skill __instance, ref bool _tryingToActivate, ref bool __result) { if (__instance.ManaCost <= 0f) { __result = true; } } } [HarmonyPatch(typeof(Skill), "HasEnoughStamina")] public class Skill_HasEnoughStamina { [HarmonyPostfix] public static void Postfix(Skill __instance, ref bool _tryingToActivate, ref bool __result) { if (__instance.StaminaCost <= 0f) { __result = true; } } } [HarmonyPatch(typeof(Skill), "HasEnoughHealth")] public class Skill_HasEnoughHealth { [HarmonyPostfix] public static void Postfix(Skill __instance, ref bool _tryingToActivate, ref bool __result) { if (__instance.HealthCost <= 0f) { __result = true; } } } public class WeaponManager { public static Dictionary<WeaponType, float> Speeds = new Dictionary<WeaponType, float> { { (WeaponType)0, 1.251f }, { (WeaponType)1, 1.399f }, { (WeaponType)2, 1.629f }, { (WeaponType)51, 1.71f }, { (WeaponType)52, 1.667f }, { (WeaponType)53, 2.036f }, { (WeaponType)54, 1.499f }, { (WeaponType)50, 1.612f } }; public static Dictionary<WeaponType, float> HeavyImpactModifiers = new Dictionary<WeaponType, float> { { (WeaponType)0, 1.3f }, { (WeaponType)1, 1.3f }, { (WeaponType)2, 2.5f }, { (WeaponType)51, 1.5f }, { (WeaponType)52, 1.3f }, { (WeaponType)53, 2f }, { (WeaponType)54, 1.2f }, { (WeaponType)50, 1.3f } }; } public class TinyTagManager { public static Tag GetOrMakeTag(string name) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0077: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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) Tag val = ((IEnumerable<Tag>)TagSourceManager.Instance.DbTags).FirstOrDefault((Func<Tag, bool>)((Tag x) => x.TagName == name)); if (val == Tag.None) { ((Tag)(ref val))..ctor(TagSourceManager.TagRoot, name); ((Tag)(ref val)).SetTagType((TagTypes)0); TagSourceManager.Instance.DbTags.Add(val); TagSourceManager.Instance.RefreshTags(true); return val; } return val; } public static string[] GetOrMakeTags(string[] names) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) foreach (string name in names) { GetOrMakeTag(name); } return names; } public static string[] GetSafeTags(string[] tags) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); foreach (string tag in tags) { ((IEnumerable<Tag>)TagSourceManager.Instance.DbTags).FirstOrDefault((Func<Tag, bool>)((Tag x) => x.TagName == tag || ((Tag)(ref x)).UID == UID.op_Implicit(tag))); if (true) { list.Add(tag); } } return list.ToArray(); } } public class TinyUIDManager { public static UID MakeUID(string name, string modGUID, string category) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (modGUID == null || name == null || category == null) { Debug.LogError((object)$"TinyUIDManager.MakeUID({name}, {modGUID}, {category} returned a random UID. This will cause trouble in multiplayer!"); return default(UID); } return new UID((modGUID + "." + category + "." + name).Replace(" ", "").ToLower()); } } [BepInPlugin("com.ehaugw.tinyhelper", "Tiny Helper", "4.8.2")] public class TinyHelper : BaseUnityPlugin { public delegate void DescriptionModifier(Item item, ref string description); [HarmonyPatch(typeof(ResourcesPrefabManager), "Load")] public class ResourcesPrefabManager_Load { [HarmonyPostfix] public static void Postfix() { ResourcesPrefabManager instance = ResourcesPrefabManager.Instance; if (instance != null && instance.Loaded) { TinyHelper.OnPrefabLoaded(); } } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public class Item_Description { [HarmonyPostfix] public static void Postfix(Item __instance, ref string __result) { OnDescriptionModified(__instance, ref __result); } } public const string GUID = "com.ehaugw.tinyhelper"; public const string VERSION = "4.8.2"; public const string NAME = "Tiny Helper"; public static DescriptionModifier OnDescriptionModified; public static TinyHelper Instance; private static int tinyHelperPrintedMessages; public static string PLUGIN_ROOT_PATH => typeof(TinyHelper).Assembly.Location + "\\..\\..\\"; public static event Action OnPrefabLoaded; internal void Awake() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Instance = this; GameObject val = new GameObject("TinyHelperRPC"); Object.DontDestroyOnLoad((Object)(object)val); val.AddComponent<TinyHelperRPCManager>(); Harmony val2 = new Harmony("com.ehaugw.tinyhelper"); val2.PatchAll(); } public static void TinyHelperPrint(string str) { Debug.Log((object)("TinyHelper #" + tinyHelperPrintedMessages++ + ": " + str)); } static TinyHelper() { TinyHelper.OnPrefabLoaded = delegate { }; OnDescriptionModified = delegate { }; tinyHelperPrintedMessages = 0; } } public class DelayedTask { public static Task GetTask(int milliseconds) { TaskCompletionSource<object> tcs = new TaskCompletionSource<object>(); new Timer(delegate { tcs.SetResult(null); }).Change(milliseconds, -1); return tcs.Task; } } public class TinyEffectManager { public static StatusEffect MakeStatusEffectPrefab(string effectName, string familyName, string description, float lifespan, float refreshRate, StackBehaviors stackBehavior, string targetStatusName, bool isMalusEffect, string tagID = null, UID? uid = null, string modGUID = null, string iconFileName = null, string displayName = null, string rootPath = null) { //IL_001d: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0187: 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_018f: Expected O, but got Unknown //IL_0194: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown Dictionary<string, StatusEffect> dictionary = At.GetValue(typeof(ResourcesPrefabManager), null, "STATUSEFFECT_PREFABS") as Dictionary<string, StatusEffect>; StatusEffectFamily val = MakeStatusEffectFamiliy(familyName, stackBehavior, -1, (LengthTypes)0); GameObject val2 = TinyGameObjectManager.InstantiateClone(((Component)dictionary[targetStatusName]).gameObject, effectName, setActive: false, dontDestroyOnLoad: true); StatusEffect obj = val2.GetComponent<StatusEffect>() ?? val2.AddComponent<StatusEffect>(); StatusEffect val3 = obj; dictionary[effectName] = obj; StatusEffect val4 = val3; At.SetValue(effectName, typeof(StatusEffect), val4, "m_identifierName"); At.SetValue<StatusEffectFamily>(val, typeof(StatusEffect), val4, "m_bindFamily"); At.SetValue(displayName ?? effectName, typeof(StatusEffect), val4, "m_nameLocKey"); At.SetValue(description, typeof(StatusEffect), val4, "m_descriptionLocKey"); val4.RefreshRate = refreshRate; val4.IsMalusEffect = isMalusEffect; At.SetValue<EffectSignatureModes>((EffectSignatureModes)1, typeof(StatusEffect), val4, "m_effectSignatureMode"); At.SetValue<FamilyModes>((FamilyModes)0, typeof(StatusEffect), val4, "m_familyMode"); val4.RequiredStatus = null; val4.RemoveRequiredStatus = false; if (iconFileName != null) { val4.OverrideIcon = CustomTexture.MakeSprite(CustomTexture.LoadTexture(iconFileName, 0, linear: false, (FilterMode)0, null, rootPath), CustomTexture.SpriteBorderTypes.None); } TagSourceSelector value = ((tagID != null) ? new TagSourceSelector(TagSourceManager.Instance.GetTag(UID.op_Implicit(tagID))) : new TagSourceSelector()); At.SetValue<TagSourceSelector>(value, typeof(StatusEffect), val4, "m_effectType"); StatusData val5 = new StatusData(val4.StatusData); StatusData val6 = val5; val4.StatusData = val5; StatusData val7 = val6; val7.LifeSpan = lifespan; List<StatusData> list = At.GetValue(typeof(StatusEffect), val4, "m_statusStack") as List<StatusData>; list[0] = val7; Object.Destroy((Object)(object)((Component)val2.GetComponentInChildren<EffectSignature>()).gameObject); EffectSignature val8 = TinyGameObjectManager.MakeFreshObject("Signature", setActive: true, dontDestroyOnLoad: true).AddComponent<EffectSignature>(); ((Object)val8).name = "Signature"; val8.SignatureUID = (UID)(((??)uid) ?? TinyUIDManager.MakeUID(effectName, modGUID, "Status Effect")); EffectSignature effectSignature = (val7.EffectSignature = val8); val.EffectSignature = effectSignature; StatusEffectFamilySelector val10 = new StatusEffectFamilySelector(); ((UidSelector<StatusEffectFamily>)(object)val10).Set(val); At.SetValue<StatusEffectFamilySelector>(val10, typeof(StatusEffect), val4, "m_stackingFamily"); return val4; } public static StatusEffectFamily MakeStatusEffectFamiliy(string familyName, StackBehaviors stackBehavior, int maxStackCount, LengthTypes lengthType, UID? uid = null, string modGUID = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0031: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0019: Unknown result type (might be due to invalid IL or missing references) StatusEffectFamily val = new StatusEffectFamily(); uid = (UID)(((??)uid) ?? ((modGUID != null) ? TinyUIDManager.MakeUID(familyName, modGUID, "Status Effect Family") : UID.Generate())); At.SetValue<UID>(uid.Value, typeof(StatusEffectFamily), val, "m_uid"); val.Name = familyName; val.StackBehavior = stackBehavior; val.MaxStackCount = maxStackCount; val.LengthType = lengthType; return val; } public static void SetNameAndDesc(EffectPreset imbueEffect, string name, string desc) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown ItemLocalization value = new ItemLocalization(name, desc); if (At.GetValue(typeof(LocalizationManager), LocalizationManager.Instance, "m_itemLocalization") is Dictionary<int, ItemLocalization> dictionary) { if (dictionary.ContainsKey(imbueEffect.PresetID)) { dictionary[imbueEffect.PresetID] = value; } else { dictionary.Add(imbueEffect.PresetID, value); } } } public static AddStatusEffectBuildUp MakeStatusEffectBuildup(Transform effectTransform, string statusEffectName, float buildup) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) AddStatusEffectBuildUp val = ((Component)effectTransform).gameObject.AddComponent<AddStatusEffectBuildUp>(); val.BuildUpValue = buildup; val.Status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(statusEffectName); ((Effect)val).OverrideEffectCategory = (EffectCategories)4; return val; } public static AddStatusEffect MakeStatusEffectChance(Transform effectTransform, string statusEffectName, int chance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) AddStatusEffect val = ((Component)effectTransform).gameObject.AddComponent<AddStatusEffect>(); val.SetChanceToContract(chance); val.Status = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(statusEffectName); ((Effect)val).OverrideEffectCategory = (EffectCategories)4; return val; } public static WeaponDamage MakeWeaponDamage(Transform effectTransform, float baseDamage, float damageScaling, Types damageType, float knockback) { //IL_001b: 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_002a: 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_0032: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) WeaponDamage val = ((Component)effectTransform).gameObject.AddComponent<WeaponDamage>(); val.WeaponDamageMult = 1f + damageScaling; val.OverrideDType = damageType; ((PunctualDamage)val).Damages = (DamageType[])(object)new DamageType[1] { new DamageType(damageType, baseDamage) }; ((Effect)val).OverrideEffectCategory = (EffectCategories)4; ((PunctualDamage)val).Knockback = knockback; return val; } public static WeaponDamage MakeDynamicWeaponDamage(Transform effectTransform, IDamageScaler damageScaler) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) DynamicWeaponDamage dynamicWeaponDamage = ((Component)effectTransform).gameObject.AddComponent<DynamicWeaponDamage>(); ((Effect)dynamicWeaponDamage).OverrideEffectCategory = (EffectCategories)4; dynamicWeaponDamage.DamageScaler = damageScaler; return (WeaponDamage)(object)dynamicWeaponDamage; } public static void MakeAbsorbHealth(Transform effectTransform, float absorbRatio) { AddAbsorbHealth obj = ((Component)effectTransform).gameObject.AddComponent<AddAbsorbHealth>(); At.SetValue(absorbRatio, typeof(AddAbsorbHealth), obj, "m_healthRatio"); } public static ImbueEffectPreset MakeImbuePreset(int imbueID, string name, string description, string iconFileName = null, int? visualEffectID = null, List<Skill> replaceOnSkills = null, string statusEffectName = null, int? chanceToContract = null, int? buildUp = null, float? scalingDamage = null, float? flatDamage = null, float? knockback = null, Types? damageType = null) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got I4 //IL_023b->IL023b: Incompatible stack types: O vs I4 //IL_0234->IL023b: Incompatible stack types: I4 vs O //IL_0234->IL023b: Incompatible stack types: O vs I4 Dictionary<int, EffectPreset> dictionary = (Dictionary<int, EffectPreset>)At.GetValue(typeof(ResourcesPrefabManager), null, "EFFECTPRESET_PREFABS"); if (!dictionary.ContainsKey(imbueID)) { GameObject val = new GameObject(imbueID + "_" + name.Replace(" ", "")); val.SetActive(true); Object.DontDestroyOnLoad((Object)(object)val); ImbueEffectPreset val2 = val.AddComponent<ImbueEffectPreset>(); ((Object)val2).name = imbueID + "_" + name.Replace(" ", ""); At.SetValue(imbueID, typeof(EffectPreset), val2, "m_StatusEffectID"); At.SetValue(name, typeof(ImbueEffectPreset), val2, "m_imbueNameKey"); At.SetValue(description, typeof(ImbueEffectPreset), val2, "m_imbueDescKey"); if (visualEffectID.HasValue) { val2.ImbueStatusIcon = ((ImbueEffectPreset)dictionary[visualEffectID.Value]).ImbueStatusIcon; val2.ImbueFX = ((ImbueEffectPreset)dictionary[visualEffectID.Value]).ImbueFX; } if (iconFileName != null) { val2.ImbueStatusIcon = CustomTexture.MakeSprite(CustomTexture.LoadTexture(iconFileName, 0, linear: false, (FilterMode)0), CustomTexture.SpriteBorderTypes.None); } SetNameAndDesc((EffectPreset)(object)val2, name, description); dictionary.Add(imbueID, (EffectPreset)(object)val2); if (statusEffectName != null && chanceToContract.GetValueOrDefault() > 0) { MakeStatusEffectChance(TinyGameObjectManager.GetOrMake(((Component)val2).transform, "Effects", setActive: true, dontDestroyOnLoad: true), statusEffectName, chanceToContract.GetValueOrDefault()); } if (statusEffectName != null && buildUp.GetValueOrDefault() > 0) { MakeStatusEffectBuildup(TinyGameObjectManager.GetOrMake(((Component)val2).transform, "Effects", setActive: true, dontDestroyOnLoad: true), statusEffectName, buildUp.GetValueOrDefault()); } if (scalingDamage.GetValueOrDefault() > 0f || flatDamage.GetValueOrDefault() > 0f || knockback.GetValueOrDefault() > 0f) { object obj = TinyGameObjectManager.GetOrMake(((Component)val2).transform, "Effects", setActive: true, dontDestroyOnLoad: true); float valueOrDefault = flatDamage.GetValueOrDefault(); valueOrDefault = scalingDamage.GetValueOrDefault(); Types? val3 = damageType; int num; if (val3.HasValue) { obj = val3.GetValueOrDefault(); num = (int)obj; } else { num = 9; obj = num; num = (int)obj; } MakeWeaponDamage((Transform)(object)num, valueOrDefault, valueOrDefault, (Types)obj, knockback.GetValueOrDefault()); } foreach (Skill item in replaceOnSkills ?? new List<Skill>()) { if ((Object)(object)item != (Object)null) { ((ImbueObject)((Component)item).GetComponentInChildren<ImbueWeapon>()).ImbuedEffect = val2; } } return val2; } return null; } public static EffectPreset GetEffectPreset(int effectID) { Dictionary<int, EffectPreset> dictionary = (Dictionary<int, EffectPreset>)At.GetValue(typeof(ResourcesPrefabManager), null, "EFFECTPRESET_PREFABS"); if (dictionary.ContainsKey(effectID)) { EffectPreset val = dictionary[effectID]; if (val != null) { return val; } } return null; } public static void AddStatusEffectForDuration(Character character, string _statusIdentifier, float duration, Character source = null, float chance = 1f) { StatusEffect statusEffectPrefab = ResourcesPrefabManager.Instance.GetStatusEffectPrefab(_statusIdentifier); AddStatusEffectForDuration(character, statusEffectPrefab, duration, source, chance); } public static void AddStatusEffectForDuration(Character character, StatusEffect statusEffect, float duration, Character source = null, float chance = 1f) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown StatusEffectManager statusEffectMngr = character.StatusEffectMngr; if (statusEffectMngr != null) { StatusData statusData = statusEffect.StatusData; statusEffect.StatusData = new StatusData(statusData); statusEffect.StatusData.LifeSpan = duration; statusEffectMngr.AddStatusEffect(statusEffect, source); statusEffect.StatusData = statusData; } } public static void ChangeEffectPresetDamageTypeData(EffectPreset effect, Types originalType, Types newType) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_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) PunctualDamage[] componentsInChildren = ((Component)effect).gameObject.GetComponentsInChildren<PunctualDamage>(); foreach (PunctualDamage val in componentsInChildren) { WeaponDamage val2 = (WeaponDamage)(object)((val is WeaponDamage) ? val : null); if (val2 != null && val2.OverrideDType == originalType) { val2.OverrideDType = newType; } DamageType[] damages = val.Damages; foreach (DamageType val3 in damages) { if (val3.Type == originalType) { val3.Type = newType; } } } } } public class CasualStagger : Effect { protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { Stagger(_affectedCharacter); } public static void Stagger(Character character) { At.SetValue<HurtType>((HurtType)1, typeof(Character), character, "m_hurtType"); character.Animator.SetTrigger("Knockback"); character.ForceCancel(false, true); ((MonoBehaviour)character).Invoke("DelayedForceCancel", 0.3f); if (Object.op_Implicit((Object)(object)character.CharacterUI)) { character.CharacterUI.OnPlayerKnocked(); } } } public class CooldownChangeWeaponDamage : WeaponDamage { public float ExecutionSetCooldown = -1f; public float HitKnockbackCooldown = -1f; protected override void ActivateLocally(Character _affectedCharacter, object[] _infos) { Item parentItem = ((Effect)this).ParentItem; Skill val = (Skill)(object)((parentItem is Skill) ? parentItem : null); if (val != null) { if (HitKnockbackCooldown != -1f && _affectedCharacter.IsInKnockback) { At.SetValue(HitKnockbackCooldown, typeof(Skill), val, "m_remainingCooldownTime"); } bool isDead = _affectedCharacter.IsDead; ((WeaponDamage)this).ActivateLocally(_affectedCharacter, _infos); if (!isDead && _affectedCharacter.IsDead && ExecutionSetCooldown != -1f) { At.SetValue(ExecutionSetCooldown, typeof(Skill), val, "m_remainingCooldownTime"); } } } } } namespace TinyHelper.Interfaces { public interface IDamageScaler { float GetWeaponDamageMult(WeaponDamage weaponDamage); Types GetOverrideDType(WeaponDamage weaponDamage); DamageType[] GetDamages(WeaponDamage weaponDamage); float GetKnockback(WeaponDamage weaponDamage); } } namespace TinyHelper.Effects { public class DynamicWeaponDamage : WeaponDamage { public IDamageScaler DamageScaler = null; private void Recalculate() { //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) Console.WriteLine("recalculated"); Debug.WriteLine("recalculated"); base.WeaponDamageMult = DamageScaler.GetWeaponDamageMult((WeaponDamage)(object)this); base.OverrideDType = DamageScaler.GetOverrideDType((WeaponDamage)(object)this); ((PunctualDamage)this).Damages = DamageScaler.GetDamages((WeaponDamage)(object)this); ((PunctualDamage)this).Knockback = DamageScaler.GetKnockback((WeaponDamage)(object)this); } protected override void StartInit() { Recalculate(); ((WeaponDamage)this).StartInit(); } public override Weapon BuildDamage(Character _targetCharacter, ref DamageList _list, ref float _knockback) { Recalculate(); return ((WeaponDamage)this).BuildDamage(_targetCharacter, ref _list, ref _knockback); } protected override void BuildDamage(Weapon _weapon, Character _targetCharacter, bool _isSkillOrShield, ref DamageList _list, ref float _knockback) { Recalculate(); ((WeaponDamage)this).BuildDamage(_weapon, _targetCharacter, _isSkillOrShield, ref _list, ref _knockback); } protected override void ActivateLocally(Character _targetCharacter, object[] _infos) { Recalculate(); ((WeaponDamage)this).ActivateLocally(_targetCharacter, _infos); } protected override DamageList DealHit(Character _targetCharacter) { Recalculate(); return ((WeaponDamage)this).DealHit(_targetCharacter); } public override float DamageMult(Character _targetCharacter, bool _isSkill) { Recalculate(); return ((WeaponDamage)this).DamageMult(_targetCharacter, _isSkill); } public override float KnockbackMult(Character _targetCharacter, bool _isSkill) { Recalculate(); return ((WeaponDamage)this).KnockbackMult(_targetCharacter, _isSkill); } } public class ShootBlastFromEffect : ShootBlast { public override void Setup(TargetingSystem _targetSystem, Transform _parent) { Character sourceCharacter = ((Effect)this).SourceCharacter; ((Shooter)this).Setup(((sourceCharacter != null) ? sourceCharacter.TargetingSystem : null) ?? _targetSystem, _parent); } } }