Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of PVP Mod v1.2.0
plugins/PVPMod.dll
Decompiled 2 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using HG.Reflection; using HarmonyLib; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PVPMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f44dff5d1956c703c2531653a260287999688725")] [assembly: AssemblyProduct("PVPMod")] [assembly: AssemblyTitle("PVPMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PVPMod { [Serializable] [BepInPlugin("com.brynzananas.pvpmod", "PVP mod", "1.2.0")] [BepInDependency("com.bepis.r2api", "5.1.7")] [BepInDependency("com.bepis.r2api.teams", "1.0.1")] [BepInDependency("com.bepis.r2api.networking", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class PVPModPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Action<ItemDef> <0>__StrongerDeathMarkEvents; public static Action<ItemDef> <1>__IncreaseDamageByShieldAndReduceShieldRechargeTimeEvents; public static Action<ItemDef> <2>__AddVenomOnHitUnderQuestionableConditionsEvents; public static CustomDotDamageEvaluation <3>__VenomDamageEvaluation; public static EventHandler <4>__PVPItemRewardTier1Weight_SettingChanged; public static Action<TeleporterInteraction> <5>__TeleporterInteraction_onTeleporterChargedGlobal; public static Action<Stage> <6>__Stage_onServerStageBegin; public static Action<TeamComponent, TeamIndex> <7>__TeamComponent_onJoinTeamGlobal; public static Action<TeamComponent, TeamIndex> <8>__TeamComponent_onLeaveTeamGlobal; public static Action<DamageReport> <9>__GlobalEventManager_onCharacterDeathGlobal; public static hook_SetTeamExperience <10>__TeamManager_SetTeamExperience; public static Action <11>__InitLanguageTokens; public static EventHandler <12>__StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CollectContentPackProvidersDelegate <>9__98_0; public static Func<Instruction, bool> <>9__114_3; public static Func<Instruction, bool> <>9__114_4; public static Func<Instruction, bool> <>9__114_5; public static Func<Instruction, bool> <>9__114_6; public static Func<Instruction, bool> <>9__116_2; public static Func<Instruction, bool> <>9__116_3; public static Func<Instruction, bool> <>9__116_4; public static Func<Instruction, bool> <>9__116_5; internal void <Awake>b__98_0(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new PVPModContentPack()); } internal bool <StrongerDeathMarkEvents>b__114_3(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <StrongerDeathMarkEvents>b__114_4(Instruction x) { return ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"); } internal bool <StrongerDeathMarkEvents>b__114_5(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "DeathMark"); } internal bool <StrongerDeathMarkEvents>b__114_6(Instruction x) { return ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "HasBuff"); } internal bool <IncreaseDamageByShieldAndReduceShieldRechargeTimeEvents>b__116_2(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <IncreaseDamageByShieldAndReduceShieldRechargeTimeEvents>b__116_3(Instruction x) { return ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"); } internal bool <IncreaseDamageByShieldAndReduceShieldRechargeTimeEvents>b__116_4(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "DeathMark"); } internal bool <IncreaseDamageByShieldAndReduceShieldRechargeTimeEvents>b__116_5(Instruction x) { return ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "HasBuff"); } } public const string ModGuid = "com.brynzananas.pvpmod"; public const string ModName = "PVP mod"; public const string ModVer = "1.2.0"; public static List<TeamIndex> playerTeamIndeces = new List<TeamIndex>(); public static List<TeamDef> playerTeamDefs = new List<TeamDef>(); public static List<CharacterBody> activePVPBodies = new List<CharacterBody>(); private static int _extraPlayerTeamsCount; public static DotIndex VenomDotIndex; public static DotDef VenomDot; public static List<ConfigEntryBase> configs = new List<ConfigEntryBase>(); public static ConfigEntry<bool> EnablePVP; public static ConfigEntry<bool> EnableContent; public static ConfigEntry<float> PVPCountdownTimer; public static ConfigEntry<int> PVPItemRewardAmount; public static ConfigEntry<float> PVPItemRewardTier1Weight; public static ConfigEntry<float> PVPItemRewardTier2Weight; public static ConfigEntry<float> PVPItemRewardTier3Weight; public static ConfigEntry<float> PVPItemRewardBossWeight; public static ConfigEntry<float> PVPItemRewardEquipmentWeight; public static ConfigEntry<float> PVPItemRewardLunarItemWeight; public static ConfigEntry<float> PVPItemRewardLunarEquipmentWeight; public static ConfigEntry<float> PVPItemRewardLunarCombinedWeight; public static ConfigEntry<float> PVPItemRewardTier1VoidWeight; public static ConfigEntry<float> PVPItemRewardTier2VoidWeight; public static ConfigEntry<float> PVPItemRewardTier3VoidWeight; public static ConfigEntry<float> PVPItemRewardBossVoidWeight; public static ConfigEntry<int> PVPLoserLoseItemsAmount; public static ConfigEntry<ItemTier> PVPLoserLoseItemsRarity; public static ConfigEntry<int> PVPLoserSpinelAfflictionsAmount; public static ConfigEntry<int> StrongerDeathMarkMinimumDebuffsToTrigger; public static ConfigEntry<bool> StrongerDeathMarkCountDebuffStacks; public static ConfigEntry<float> StrongerDeathMarkDebuffDuration; public static ConfigEntry<float> StrongerDeathMarkDebuffDurationPerStack; public static ConfigEntry<float> StrongerDeathMarkDebuffDamageIncrease; public static ConfigEntry<float> StrongerDeathMarkDebuffDamageIncreasePerStack; public static ConfigEntry<float> IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplier; public static ConfigEntry<float> IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplierPerStack; public static ConfigEntry<float> IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncrease; public static ConfigEntry<float> IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncreasePerStack; public static ConfigEntry<bool> AddVenomOnHitUnderQuestionableConditionsTranscendenceCondition; public static ConfigEntry<bool> AddVenomOnHitUnderQuestionableConditionsWingsCondition; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomDuration; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomDurationPerStack; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplier; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplierPerStack; public static ConfigEntry<bool> AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageStack; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRecharge; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargePerStack; public static ConfigEntry<bool> AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargeStack; public static ConfigEntry<bool> AddVenomOnHitUnderQuestionableConditionsVenomHemorrageStack; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDuration; public static ConfigEntry<float> AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDamageMultiplier; public static BasicPickupDropTable PVPItemReward; public static ExpansionDef DLC1Expansion; public static bool pvpEnabled; private static bool hooksSet; private static bool thisIsStupid; public static bool startingPVP = false; public static float startingStopwatch; public static GameObject PVPCountdownPrefab; public static List<PlayerCharacterMasterController> losers = new List<PlayerCharacterMasterController>(); public static int neededVotes; public static List<NetworkUser> networkUsers = new List<NetworkUser>(); public static bool calling; public static bool riskOfOptionsEnabled { get; private set; } public static PVPModPlugin instance { get; private set; } public static PluginInfo PInfo { get; private set; } public static ConfigFile configFile { get; private set; } public static AssetBundle assetBundle { get; private set; } public static PVPModItemDef StrongerDeathMark { get; private set; } public static PVPModItemDef IncreaseDamageByShieldAndReduceShieldRechargeTime { get; private set; } public static PVPModItemDef AddVenomOnHitUnderQuestionableConditions { get; private set; } public static BuffDef StrongerDeathMarkBuff { get; private set; } public static BuffDef VenomBuff { get; private set; } public static int extraPlayerTeamsCount { get { return _extraPlayerTeamsCount; } set { if (_extraPlayerTeamsCount != value) { _extraPlayerTeamsCount = value; Init(); } } } public void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Expected O, but got Unknown instance = this; PInfo = ((BaseUnityPlugin)this).Info; configFile = ((BaseUnityPlugin)this).Config; riskOfOptionsEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); extraPlayerTeamsCount = 16; SetHooks(); SetConfigs(); DLC1Expansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); assetBundle = AssetBundle.LoadFromFileAsync(Path.Combine(Path.GetDirectoryName(PInfo.Location), "assetbundles", "pvpmod")).assetBundle; Material[] array = assetBundle.LoadAllAssets<Material>(); foreach (Material val in array) { if (((Object)val.shader).name.StartsWith("StubbedRoR2")) { string text = ((Object)val.shader).name.Replace("StubbedRoR2", "RoR2") + ".shader"; Shader val2 = Addressables.LoadAssetAsync<Shader>((object)text).WaitForCompletion(); if (Object.op_Implicit((Object)(object)val2)) { val.shader = val2; } } } PVPItemReward = assetBundle.LoadAsset<BasicPickupDropTable>("Assets/PVPmod/pdPVPItemReward.asset"); PVPCountdownPrefab = assetBundle.LoadAsset<GameObject>("Assets/PVPmod/PVPCountdown.prefab"); SetWeights(); StrongerDeathMark = assetBundle.LoadAsset<PVPModItemDef>("Assets/PVPmod/StrongerDeathMark.asset").RegisterItemDef(StrongerDeathMarkEvents); IncreaseDamageByShieldAndReduceShieldRechargeTime = assetBundle.LoadAsset<PVPModItemDef>("Assets/PVPmod/IncreaseDamageByShieldAndReduceShieldRechargeTime.asset").RegisterItemDef(IncreaseDamageByShieldAndReduceShieldRechargeTimeEvents); AddVenomOnHitUnderQuestionableConditions = assetBundle.LoadAsset<PVPModItemDef>("Assets/PVPmod/AddVenomOnHitUnderQuestionableConditions.asset").RegisterItemDef(AddVenomOnHitUnderQuestionableConditionsEvents); if (EnableContent.Value) { object obj = <>c.<>9__98_0; if (obj == null) { CollectContentPackProvidersDelegate val3 = delegate(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)new PVPModContentPack()); }; <>c.<>9__98_0 = val3; obj = (object)val3; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; } NetworkingAPI.RegisterMessageType<SpawnPVPCountdown>(); } public static void AddVenomOnHitUnderQuestionableConditionsEvents(ItemDef itemDef) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Expected O, but got Unknown //IL_007d: 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_0072: 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_007d: Expected O, but got Unknown VenomBuff = assetBundle.LoadAsset<BuffDef>("Assets/PVPmod/bdVenom.asset").RegisterBuffDef<BuffDef>((Action<BuffDef>)null); VenomDot = new DotDef { interval = 1f, damageCoefficient = 1f, damageColorIndex = (DamageColorIndex)2, associatedBuff = VenomBuff }; DotDef venomDot = VenomDot; object obj2 = <>O.<3>__VenomDamageEvaluation; if (obj2 == null) { CustomDotDamageEvaluation val = VenomDamageEvaluation; <>O.<3>__VenomDamageEvaluation = val; obj2 = (object)val; } VenomDotIndex = DotAPI.RegisterDotDef(venomDot, (CustomDotBehaviour)null, (CustomDotVisual)null, (CustomDotDamageEvaluation)obj2); AddVenomOnHitUnderQuestionableConditionsTranscendenceCondition = Utils.CreateConfig(((Object)itemDef).name, "Transcendence Condition", defaultValue: true, ""); AddVenomOnHitUnderQuestionableConditionsWingsCondition = Utils.CreateConfig(((Object)itemDef).name, "Active Milky Chrisalis Condition", defaultValue: true, ""); AddVenomOnHitUnderQuestionableConditionsVenomDuration = Utils.CreateConfig(((Object)itemDef).name, "Venom Duration", 5f, ""); AddVenomOnHitUnderQuestionableConditionsVenomDurationPerStack = Utils.CreateConfig(((Object)itemDef).name, "Venom Duration Per Stack", 1f, ""); AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRecharge = Utils.CreateConfig(((Object)itemDef).name, "Recharge Shield Percentage", 5f, ""); AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargePerStack = Utils.CreateConfig(((Object)itemDef).name, "Recharge Shield Percentage Per Stack", 1f, ""); AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargeStack = Utils.CreateConfig(((Object)itemDef).name, "Recharge Shield Percentage Stack", defaultValue: true, ""); AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplier = Utils.CreateConfig(((Object)itemDef).name, "Victim Damage Percentage", 5f, ""); AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplierPerStack = Utils.CreateConfig(((Object)itemDef).name, "Victim Damage Percentage Per Stack", 1f, ""); AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageStack = Utils.CreateConfig(((Object)itemDef).name, "Victim Damage Stack", defaultValue: true, ""); AddVenomOnHitUnderQuestionableConditionsVenomHemorrageStack = Utils.CreateConfig(((Object)itemDef).name, "Hemorrage Stack", defaultValue: true, ""); AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDuration = Utils.CreateConfig(((Object)itemDef).name, "Hemorrage Duration", 15f, ""); AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDamageMultiplier = Utils.CreateConfig(((Object)itemDef).name, "Hemorrage Damage Percentage", 100f, ""); AddVenomOnHitUnderQuestionableConditionsTranscendenceCondition.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsWingsCondition.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomDuration.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomDurationPerStack.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRecharge.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargePerStack.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplier.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplierPerStack.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageStack.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomHemorrageStack.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDuration.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDamageMultiplier.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt; void GlobalEventManager_onServerDamageDealt(DamageReport obj) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) if (!((Enum)obj.damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)67108864)) { CharacterBody attackerBody = obj.attackerBody; Inventory val2 = ((attackerBody != null) ? attackerBody.inventory : null); if (Object.op_Implicit((Object)(object)val2) && (val2.GetItemCountEffective(Items.ShieldOnly) > 0 || !AddVenomOnHitUnderQuestionableConditionsTranscendenceCondition.Value)) { int itemCountEffective = val2.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { JetpackController val3 = JetpackController.FindJetpackController(obj.attacker); if (Object.op_Implicit((Object)(object)val3) || !AddVenomOnHitUnderQuestionableConditionsWingsCondition.Value) { DotController.InflictDot(((Component)obj.victim).gameObject, obj.attacker, obj.damageInfo.inflictedHurtbox, VenomDotIndex, Utils.GetStackingFloat(AddVenomOnHitUnderQuestionableConditionsVenomDuration.Value, AddVenomOnHitUnderQuestionableConditionsVenomDurationPerStack.Value, itemCountEffective), 1f, (uint?)null); } } } } } } public static void VenomDamageEvaluation(DotController self, PendingDamage pendingDamage) { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown CharacterBody val = (Object.op_Implicit((Object)(object)pendingDamage.attackerObject) ? pendingDamage.attackerObject.GetComponent<CharacterBody>() : null); if (!Object.op_Implicit((Object)(object)val)) { return; } Inventory inventory = val.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } int itemCountEffective = inventory.GetItemCountEffective((ItemDef)(object)AddVenomOnHitUnderQuestionableConditions); int buffCount = self.victimBody.GetBuffCount(VenomBuff); CharacterBody victimBody = self.victimBody; float num2 = (victimBody.damage *= Utils.GetStackingFloat(AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplier.Value, AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplierPerStack.Value, itemCountEffective) / 100f); float num3 = num2; if (Object.op_Implicit((Object)(object)val)) { HealthComponent healthComponent = val.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { healthComponent.RechargeShield(val.maxShield * Utils.GetStackingFloat(AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRecharge.Value, AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargePerStack.Value, itemCountEffective) / 100f * (AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargeStack.Value ? ((float)buffCount) : 1f)); } if (val.damage > num3) { num3 = val.damage; } } DamageInfo val2 = new DamageInfo { damage = num3 * (float)buffCount * (AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageStack.Value ? ((float)buffCount) : 1f), damageColorIndex = (DamageColorIndex)9, attacker = pendingDamage.attackerObject, inflictor = pendingDamage.attackerObject, position = ((Component)self).transform.position, inflictedHurtbox = pendingDamage.hitHurtBox, procCoefficient = 0f, damageType = DamageTypeCombo.op_Implicit((DamageType)67108864) }; self.victimHealthComponent.TakeDamageProcess(val2); for (int i = 0; i < ((!AddVenomOnHitUnderQuestionableConditionsVenomHemorrageStack.Value) ? 1 : buffCount); i++) { DotController.InflictDot(self.victimObject, val2.attacker, pendingDamage.hitHurtBox, (DotIndex)6, AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDuration.Value, AddVenomOnHitUnderQuestionableConditionsVenomHemorrageDamageMultiplier.Value / 100f, (uint?)null); } self.victimBody.AddTimedBuff(Buffs.HealingDisabled, VenomDot.interval + Time.fixedDeltaTime); self.victimBody.AddTimedBuff(Buffs.Slow50, VenomDot.interval + Time.fixedDeltaTime); self.victimBody.AddTimedBuff(Buffs.Weak, VenomDot.interval + Time.fixedDeltaTime); } public static void InitLanguageTokens() { Utils.AddLanguageToken(((ItemDef)StrongerDeathMark).nameToken, "Chaotic Death Mark of Doom"); Utils.AddLanguageToken(((ItemDef)StrongerDeathMark).pickupToken, string.Format("Enemies with {0}{1}{2} or more {3} are marked for death, taking bonus damage.", "<style=cIsDamage>", StrongerDeathMarkMinimumDebuffsToTrigger.Value, "</style>", StrongerDeathMarkCountDebuffStacks.Value ? "debuff stacks" : "debuffs")); Utils.AddLanguageToken(((ItemDef)StrongerDeathMark).descriptionToken, string.Format("Enemies with {0}{1}{2}, or more {3} are {4}marked for death{5}, increasing damage taken by {6}{7}%{8} {9}(+{10}% per stack){11} from all sources for {12}{13}{14} {15} (+{16} per stack){17} seconds.", "<style=cIsDamage>", StrongerDeathMarkMinimumDebuffsToTrigger.Value, "</style>", StrongerDeathMarkCountDebuffStacks.Value ? "debuff stacks" : "debuffs", "<style=cIsDamage>", "</style>", "<style=cIsDamage>", StrongerDeathMarkDebuffDamageIncrease.Value, "</style>", "<style=cStack>", StrongerDeathMarkDebuffDamageIncreasePerStack.Value, "</style>", "<style=cIsUtility>", StrongerDeathMarkDebuffDuration.Value, "</style>", "<style=cStack>", StrongerDeathMarkDebuffDuration.Value, "</style>")); Utils.AddLanguageToken(((ItemDef)IncreaseDamageByShieldAndReduceShieldRechargeTime).nameToken, "Exoskeleton Of Ruinous Powers"); Utils.AddLanguageToken(((ItemDef)IncreaseDamageByShieldAndReduceShieldRechargeTime).pickupToken, "Increase damage by max shield and reduce shield recharge start time."); Utils.AddLanguageToken(((ItemDef)IncreaseDamageByShieldAndReduceShieldRechargeTime).descriptionToken, string.Format("Deal {0}{1}%{2} {3}(+{4}% per stack){5} of your max shields as {6}damage{7}. Reduce shield recharge start time by {8}{9}%{10} {11}(+{12}% per stack){13}.", "<style=cIsHealing>", IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplier.Value, "</style>", "<style=cStack>", IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplierPerStack.Value, "</style>", "<style=cIsDamage>", "</style>", "<style=cIsUtility>", IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncrease.Value, "</style>", "<style=cStack>", IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncreasePerStack.Value, "</style>")); Utils.AddLanguageToken(((ItemDef)AddVenomOnHitUnderQuestionableConditions).nameToken, "Decaying Siphonbrood Venom"); bool value = AddVenomOnHitUnderQuestionableConditionsTranscendenceCondition.Value; bool value2 = AddVenomOnHitUnderQuestionableConditionsWingsCondition.Value; string text; if (value || value2) { text = "While you have"; if (value) { text += " Transcendence"; } if (value2) { if (value) { text += " and"; } text += " Milky Chrysalis activated"; } text += " hitting an enemy injects Decaying Venom."; } else { text = "Hitting an enemy injects Decaying Venom."; } string value3 = text + string.Format(" While enemy has Decaying Venom you {0}regenerate {1}%{2} {3}(+{4}% per stack){5} of your {6}maximum shield{7} per second. Deals {8}{9}%{10} {11}(+{12}% per stack){13} of the victim's {14}maximum damage{15} per second, or an amount per second equivalent to your {16}damage stat{17}, whichever is greater. Lasts {18}{19} seconds{20} {21}(+{22} seconds per stack){23}. Enemy affected gains 1 Hemorrhage stack per second, Healing Disabled, Slowed and Weak while this is active", "<style=cIsHealing>", AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRecharge.Value, "</style>", "<style=cStack>", AddVenomOnHitUnderQuestionableConditionsVenomAttackerShieldRechargePerStack.Value, "</style>", "<style=cIsHealing>", "</style>", "<style=cIsDamage>", AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplier.Value, "</style>", "<style=cStack>", AddVenomOnHitUnderQuestionableConditionsVenomVictimDamageMultiplierPerStack.Value, "</style>", "<style=cIsDamage>", "</style>", "<style=cIsDamage>", "</style>", "<style=cIsUtility>", AddVenomOnHitUnderQuestionableConditionsVenomDuration.Value, "</style>", "<style=cStack>", AddVenomOnHitUnderQuestionableConditionsVenomDurationPerStack.Value, "</style>"); Utils.AddLanguageToken(((ItemDef)AddVenomOnHitUnderQuestionableConditions).pickupToken, text); Utils.AddLanguageToken(((ItemDef)AddVenomOnHitUnderQuestionableConditions).descriptionToken, value3); } public static void SetConfigs() { EnablePVP = Utils.CreateConfig("Main", "Enable PVP", defaultValue: true, "Enable Players Versus Players after teleporter charge?"); EnableContent = Utils.CreateConfig("Main", "Enable content", defaultValue: true, "Enable all mod content?"); PVPCountdownTimer = Utils.CreateConfig("PVP", "Countdown timer", 3f, "Control countdown timer that begins PVP"); PVPItemRewardAmount = Utils.CreateConfig("PVP", "Item reward amount", 1, "Control how much items will be spawned on pvp win. Items spawn on the teleporter"); PVPItemRewardTier1Weight = Utils.CreateConfig("PVP", "Item reward common rarity weight", 100f, "Control weight for common rarity on random item reward selection"); PVPItemRewardTier2Weight = Utils.CreateConfig("PVP", "Item reward uncommon rarity weight", 0f, "Control weight for uncommon rarity on random item reward selection"); PVPItemRewardTier3Weight = Utils.CreateConfig("PVP", "Item reward legendary rarity weight", 0f, "Control weight for legendary rarity on random item reward selection"); PVPItemRewardBossWeight = Utils.CreateConfig("PVP", "Item reward boss rarity weight", 0f, "Control weight for boss rarity on random item reward selection"); PVPItemRewardEquipmentWeight = Utils.CreateConfig("PVP", "Item reward equipment rarity weight", 0f, "Control weight for equipment rarity on random item reward selection"); PVPItemRewardLunarItemWeight = Utils.CreateConfig("PVP", "Item reward lunar item rarity weight", 0f, "Control weight for lunar item rarity on random item reward selection"); PVPItemRewardLunarEquipmentWeight = Utils.CreateConfig("PVP", "Item reward lunar equipment rarity weight", 0f, "Control weight for lunar equipment rarity on random item reward selection"); PVPItemRewardLunarCombinedWeight = Utils.CreateConfig("PVP", "Item reward lunar combined rarity weight", 0f, "Control weight for lunar combined rarity on random item reward selection"); PVPItemRewardTier1VoidWeight = Utils.CreateConfig("PVP", "Item reward void common rarity weight", 0f, "Control weight for void common rarity on random item reward selection"); PVPItemRewardTier2VoidWeight = Utils.CreateConfig("PVP", "Item reward void uncommon rarity weight", 0f, "Control weight for void uncommon rarity on random item reward selection"); PVPItemRewardTier3VoidWeight = Utils.CreateConfig("PVP", "Item reward void legendary rarity weight", 0f, "Control weight for void legendary rarity on random item reward selection"); PVPItemRewardBossVoidWeight = Utils.CreateConfig("PVP", "Item reward void boss rarity weight", 0f, "Control weight for void boss rarity on random item reward selection"); PVPLoserLoseItemsAmount = Utils.CreateConfig("PVP", "Lose items amount", 1, "Control how much items PVP losers will lose?"); PVPLoserLoseItemsRarity = Utils.CreateConfig<ItemTier>("PVP", "Lose items rarity", (ItemTier)0, "Control which rarity of an item would be removed on PVP lose?"); PVPLoserSpinelAfflictionsAmount = Utils.CreateConfig("PVP", "Gain Tonic Affliction", 0, "Control how much Tonic Afflictions PVP losers will get?"); PVPItemRewardTier1Weight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardTier2Weight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardTier3Weight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardBossWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardEquipmentWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardLunarItemWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardLunarEquipmentWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardLunarCombinedWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardTier1VoidWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardTier2VoidWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardTier3VoidWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; PVPItemRewardBossVoidWeight.SettingChanged += PVPItemRewardTier1Weight_SettingChanged; } private static void PVPItemRewardTier1Weight_SettingChanged(object sender, EventArgs e) { SetWeights(); } public void OnDestroy() { UnsetHooks(); } private static void SetHooks() { //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown if (!hooksSet) { hooksSet = true; TeleporterInteraction.onTeleporterChargedGlobal += TeleporterInteraction_onTeleporterChargedGlobal; Stage.onServerStageBegin += Stage_onServerStageBegin; TeamComponent.onJoinTeamGlobal += TeamComponent_onJoinTeamGlobal; TeamComponent.onLeaveTeamGlobal += TeamComponent_onLeaveTeamGlobal; GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; object obj = <>O.<10>__TeamManager_SetTeamExperience; if (obj == null) { hook_SetTeamExperience val = TeamManager_SetTeamExperience; <>O.<10>__TeamManager_SetTeamExperience = val; obj = (object)val; } TeamManager.SetTeamExperience += (hook_SetTeamExperience)obj; RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(InitLanguageTokens)); } } private static void TeamManager_SetTeamExperience(orig_SetTeamExperience orig, TeamManager self, TeamIndex teamIndex, ulong newExperience) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0061: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, teamIndex, newExperience); if (thisIsStupid || !pvpEnabled || !playerTeamIndeces.Contains(teamIndex)) { return; } thisIsStupid = true; self.SetTeamExperience((TeamIndex)1, newExperience); foreach (TeamIndex playerTeamIndece in playerTeamIndeces) { if (playerTeamIndece != teamIndex) { self.SetTeamExperience(playerTeamIndece, newExperience); } } thisIsStupid = false; } public static void SetWeights() { bool flag = Object.op_Implicit((Object)(object)Run.instance) && Run.instance.IsExpansionEnabled(DLC1Expansion); PVPItemReward.tier1Weight = PVPItemRewardTier1Weight.Value; PVPItemReward.tier2Weight = PVPItemRewardTier2Weight.Value; PVPItemReward.tier3Weight = PVPItemRewardTier3Weight.Value; PVPItemReward.bossWeight = PVPItemRewardBossWeight.Value; PVPItemReward.equipmentWeight = PVPItemRewardEquipmentWeight.Value; PVPItemReward.lunarItemWeight = PVPItemRewardLunarItemWeight.Value; PVPItemReward.lunarEquipmentWeight = PVPItemRewardLunarEquipmentWeight.Value; PVPItemReward.lunarCombinedWeight = PVPItemRewardLunarCombinedWeight.Value; PVPItemReward.voidTier1Weight = (flag ? PVPItemRewardTier1VoidWeight.Value : 0f); PVPItemReward.voidTier2Weight = (flag ? PVPItemRewardTier2VoidWeight.Value : 0f); PVPItemReward.voidTier3Weight = (flag ? PVPItemRewardTier3VoidWeight.Value : 0f); PVPItemReward.voidBossWeight = (flag ? PVPItemRewardBossVoidWeight.Value : 0f); } private static void TeamComponent_onLeaveTeamGlobal(TeamComponent arg1, TeamIndex arg2) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = arg1.body; if (!((Object)(object)body == (Object)null) && body.isPlayerControlled && playerTeamIndeces.Contains(arg2) && activePVPBodies.Contains(body)) { activePVPBodies.Remove(body); } } private static void TeamComponent_onJoinTeamGlobal(TeamComponent arg1, TeamIndex arg2) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = arg1.body; if (!((Object)(object)body == (Object)null) && body.isPlayerControlled && playerTeamIndeces.Contains(arg2) && !activePVPBodies.Contains(body)) { activePVPBodies.Add(body); } } private static void GlobalEventManager_onCharacterDeathGlobal(DamageReport obj) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!pvpEnabled || !NetworkServer.active) { return; } TeamIndex victimTeamIndex = obj.victimTeamIndex; if (!playerTeamIndeces.Contains(victimTeamIndex)) { return; } if (Object.op_Implicit((Object)(object)obj.victimMaster) && Object.op_Implicit((Object)(object)obj.victimMaster.playerCharacterMasterController) && !losers.Contains(obj.victimMaster.playerCharacterMasterController)) { losers.Add(obj.victimMaster.playerCharacterMasterController); } int num = 0; CharacterBody val = null; foreach (CharacterBody activePVPBody in activePVPBodies) { if (!((Object)(object)activePVPBody == (Object)null) && activePVPBody.isPlayerControlled && Object.op_Implicit((Object)(object)activePVPBody.master) && !activePVPBody.master.IsDeadAndOutOfLivesServer()) { val = activePVPBody; num++; } } if (num <= 1) { EndPVP(punish: true); SpawnItems(); } } public static void SpawnItems() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Run.instance == (Object)null) && Run.instance.bossRewardRng != null && !((Object)(object)TeleporterInteraction.instance == (Object)null) && !((Object)(object)TeleporterInteraction.instance.bossGroup == (Object)null) && PVPItemRewardAmount.Value > 0) { float num = 360f / (float)PVPItemRewardAmount.Value; Vector3 val = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f); Quaternion val2 = Quaternion.AngleAxis(num, Vector3.up); for (int i = 0; i < PVPItemRewardAmount.Value; i++) { UniquePickup val3 = ((PickupDropTable)PVPItemReward).GeneratePickup(Run.instance.bossRewardRng); PickupDropletController.CreatePickupDroplet(val3, TeleporterInteraction.instance.bossGroup.dropPosition.position, val); val = val2 * val; } } } private static void StrongerDeathMarkEvents(ItemDef itemDef) { StrongerDeathMarkBuff = assetBundle.LoadAsset<BuffDef>("Assets/PVPmod/bdStrongerDeathMark.asset").RegisterBuffDef<BuffDef>((Action<BuffDef>)StrongerDeathMarkBuffEvents); StrongerDeathMarkMinimumDebuffsToTrigger = Utils.CreateConfig(((Object)itemDef).name, "Minimum debuffs", 15, "Minimum debuffs needed for adding damage increase debuff on debuff addition"); StrongerDeathMarkCountDebuffStacks = Utils.CreateConfig(((Object)itemDef).name, "Count stacks", defaultValue: true, "Count debuff stacks for effect triggering"); StrongerDeathMarkDebuffDuration = Utils.CreateConfig(((Object)itemDef).name, "Debuff duration", 10f, "Control debuff duration in seconds"); StrongerDeathMarkDebuffDurationPerStack = Utils.CreateConfig(((Object)itemDef).name, "Debuff duration per stack", 5f, "Control debuff duration per stack in seconds"); StrongerDeathMarkDebuffDamageIncrease = Utils.CreateConfig(((Object)itemDef).name, "Debuff damage multiplier", 600f, "Control debuff taken damage multiplier in percentage"); StrongerDeathMarkDebuffDamageIncreasePerStack = Utils.CreateConfig(((Object)itemDef).name, "Debuff damage multiplier per stack", 300f, "Control debuff taken damage multiplier per stack in percentage"); StrongerDeathMarkMinimumDebuffsToTrigger.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; StrongerDeathMarkCountDebuffStacks.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; StrongerDeathMarkDebuffDuration.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; StrongerDeathMarkDebuffDurationPerStack.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; StrongerDeathMarkDebuffDamageIncrease.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; StrongerDeathMarkDebuffDamageIncreasePerStack.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; void StrongerDeathMarkBuffEvents(BuffDef buffDef) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown CharacterBody.HandleCascadingBuffs += new hook_HandleCascadingBuffs(CharacterBody_HandleCascadingBuffs); HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); void CharacterBody_HandleCascadingBuffs(orig_HandleCascadingBuffs orig, CharacterBody self) { //IL_0014: 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_006b: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); int num = Util.GetItemCountGlobal(itemDef.itemIndex, true, true) - (Object.op_Implicit((Object)(object)self.teamComponent) ? Util.GetItemCountForTeam(self.teamComponent.teamIndex, itemDef.itemIndex, true, true) : (Object.op_Implicit((Object)(object)self.inventory) ? self.inventory.GetItemCountEffective(itemDef) : 0)); if (num > 0 && !self.HasBuff(buffDef)) { int num2 = 0; BuffIndex[] debuffBuffIndices = BuffCatalog.debuffBuffIndices; foreach (BuffIndex val2 in debuffBuffIndices) { if (self.HasBuff(val2)) { num2 += ((!StrongerDeathMarkCountDebuffStacks.Value) ? 1 : self.GetBuffCount(val2)); } } if (num2 >= StrongerDeathMarkMinimumDebuffsToTrigger.Value) { self.AddTimedBuff(buffDef, Utils.GetStackingFloat(StrongerDeathMarkDebuffDuration.Value, StrongerDeathMarkDebuffDurationPerStack.Value, num)); } } } float HandleStrongerDeathMark(CharacterBody characterBody, DamageInfo damageInfo) { if (!characterBody.HasBuff(buffDef) || (Object)(object)damageInfo.attacker == (Object)null) { return 1f; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if ((Object)(object)component == (Object)null) { return StrongerDeathMarkDebuffDamageIncrease.Value / 100f + 1f; } Inventory inventory = component.inventory; if ((Object)(object)inventory == (Object)null) { return StrongerDeathMarkDebuffDamageIncrease.Value / 100f + 1f; } int itemCount = inventory.GetItemCount(itemDef); if (itemCount <= 0) { return StrongerDeathMarkDebuffDamageIncrease.Value / 100f + 1f; } return Utils.GetStackingFloat(StrongerDeathMarkDebuffDamageIncrease.Value, StrongerDeathMarkDebuffDamageIncreasePerStack.Value, itemCount) / 100f + 1f; } void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel iLLabel = null; int locId = 0; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "DeathMark"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locId) })) { val.GotoLabel(iLLabel, (MoveType)0, false); Instruction prev = val.Emit(OpCodes.Ldarg_0).Prev; iLLabel.Target = prev; val.Emit(OpCodes.Ldfld, AccessTools.Field(typeof(HealthComponent), "body")); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<CharacterBody, DamageInfo, float>>((Func<CharacterBody, DamageInfo, float>)HandleStrongerDeathMark); val.Emit(OpCodes.Ldloc, locId); val.Emit(OpCodes.Mul); val.Emit(OpCodes.Stloc, locId); } else { ((BaseUnityPlugin)instance).Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!")); } } } } private static void StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged(object sender, EventArgs e) { InitLanguageTokens(); } private static void IncreaseDamageByShieldAndReduceShieldRechargeTimeEvents(ItemDef itemDef) { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplier = Utils.CreateConfig(((Object)itemDef).name, "Max shield to damage multiplier", 5f, "Control max shield to damage multiplier in percentage"); IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplierPerStack = Utils.CreateConfig(((Object)itemDef).name, "Max shield to damage multiplier per stack", 2.5f, "Control max shield to damage multiplier per stack in percentage"); IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncrease = Utils.CreateConfig(((Object)itemDef).name, "Shield regen cooldown reduction", 30f, "Control shield regeneration cooldown reduction in percentage"); IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncreasePerStack = Utils.CreateConfig(((Object)itemDef).name, "Shield regen cooldown reduction per stack", 15f, "Control shield regeneration cooldown reduction in percentage"); IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplier.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplierPerStack.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncrease.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncreasePerStack.SettingChanged += StrongerDeathMarkMinimumDebuffsToTrigger_SettingChanged; HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged); void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active) { self.AddItemBehavior<IncreaseDamageByShieldAndReduceShieldRechargeTimeBehaviour>(Object.op_Implicit((Object)(object)self.inventory) ? self.inventory.GetItemCount(itemDef) : 0); } } float HandleIncreaseDamageByShieldAndReduceShieldRechargeTime(CharacterBody characterBody, DamageInfo damageInfo) { if ((Object)(object)damageInfo.attacker == (Object)null) { return 1f; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if ((Object)(object)component == (Object)null) { return 1f; } Inventory inventory = component.inventory; if ((Object)(object)inventory == (Object)null) { return component.maxShield * IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplier.Value / 100f + 1f; } int itemCount = inventory.GetItemCount(itemDef); if (itemCount <= 0) { return component.maxShield * IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplier.Value / 100f + 1f; } return component.maxShield * Utils.GetStackingFloat(IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplier.Value, IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldToDamageMultiplierPerStack.Value, itemCount) / 100f + 1f; } void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel iLLabel = null; int locId = 0; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body"), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "DeathMark"), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "HasBuff"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref locId) })) { val.GotoLabel(iLLabel, (MoveType)0, false); Instruction prev = val.Emit(OpCodes.Ldarg_0).Prev; iLLabel.Target = prev; val.Emit(OpCodes.Ldfld, AccessTools.Field(typeof(HealthComponent), "body")); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<CharacterBody, DamageInfo, float>>((Func<CharacterBody, DamageInfo, float>)HandleIncreaseDamageByShieldAndReduceShieldRechargeTime); val.Emit(OpCodes.Ldloc, locId); val.Emit(OpCodes.Add); val.Emit(OpCodes.Stloc, locId); } else { ((BaseUnityPlugin)instance).Logger.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!")); } } } private static void UnsetHooks() { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown if (hooksSet) { hooksSet = false; TeleporterInteraction.onTeleporterChargedGlobal -= TeleporterInteraction_onTeleporterChargedGlobal; Stage.onServerStageBegin -= Stage_onServerStageBegin; TeamComponent.onJoinTeamGlobal -= TeamComponent_onJoinTeamGlobal; TeamComponent.onLeaveTeamGlobal -= TeamComponent_onLeaveTeamGlobal; GlobalEventManager.onCharacterDeathGlobal -= GlobalEventManager_onCharacterDeathGlobal; object obj = <>O.<10>__TeamManager_SetTeamExperience; if (obj == null) { hook_SetTeamExperience val = TeamManager_SetTeamExperience; <>O.<10>__TeamManager_SetTeamExperience = val; obj = (object)val; } TeamManager.SetTeamExperience -= (hook_SetTeamExperience)obj; RoR2Application.onLoadFinished = (Action)Delegate.Remove(RoR2Application.onLoadFinished, new Action(InitLanguageTokens)); } } private static void Stage_onServerStageBegin(Stage obj) { EndPVP(punish: false); } private static void TeleporterInteraction_onTeleporterChargedGlobal(TeleporterInteraction obj) { if (EnablePVP.Value) { StartPVP(); } } public static void StartPVP() { if (NetworkServer.active) { calling = false; int count = GetAlivePlayers().Count; if (count > 1) { startingPVP = true; startingStopwatch = PVPCountdownTimer.Value; NetMessageExtensions.Send((INetMessage)(object)new SpawnPVPCountdown(startingStopwatch), (NetworkDestination)1); } } } public static void BeginPVP() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: 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_014b: Unknown result type (might be due to invalid IL or missing references) SetWeights(); if (!NetworkServer.active || pvpEnabled) { return; } calling = false; int count = GetAlivePlayers().Count; if (count <= 1) { return; } count = PlayerCharacterMasterController.instances.Count; pvpEnabled = true; losers.Clear(); networkUsers.Clear(); int count2 = playerTeamDefs.Count; int num = 0; for (int i = 0; i < count2; i++) { TeamIndex val = playerTeamIndeces[i]; TeamManager.instance.SetTeamExperience(val, TeamManager.instance.GetTeamExperience((TeamIndex)1)); } int num2 = 0; while (num2 < count) { PlayerCharacterMasterController val2 = PlayerCharacterMasterController.instances[num2]; if (!((Object)(object)val2 == (Object)null)) { CharacterMaster master = val2.master; if (!((Object)(object)master == (Object)null)) { TeamIndex val3 = (TeamIndex)(-1); while (num > count2 - 1) { num -= extraPlayerTeamsCount; } val3 = playerTeamIndeces[num]; TeamComponent val4 = (Object.op_Implicit((Object)(object)master.GetBody()) ? master.GetBody().teamComponent : null); if (Object.op_Implicit((Object)(object)val4)) { val4.teamIndex = val3; } master.teamIndex = val3; ChangeMinionsTeam(val2, val3); } } num2++; num++; } } public static void EndPVP(bool punish) { //IL_0094: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !pvpEnabled) { return; } calling = false; int count = PlayerCharacterMasterController.instances.Count; pvpEnabled = false; startingPVP = false; networkUsers.Clear(); int count2 = playerTeamDefs.Count; for (int i = 0; i < count; i++) { PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[i]; if ((Object)(object)val == (Object)null) { continue; } CharacterMaster master = val.master; if ((Object)(object)master == (Object)null) { continue; } TeamIndex teamIndex = (TeamIndex)1; TeamComponent val2 = (Object.op_Implicit((Object)(object)master.GetBody()) ? master.GetBody().teamComponent : null); if (Object.op_Implicit((Object)(object)val2)) { val2.teamIndex = teamIndex; } master.teamIndex = teamIndex; ChangeMinionsTeam(val, teamIndex); if (!punish) { continue; } Inventory inventory = master.inventory; if (!Object.op_Implicit((Object)(object)inventory) || !master.IsDeadAndOutOfLivesServer() || !losers.Contains(val)) { continue; } losers.Remove(val); int value = PVPLoserSpinelAfflictionsAmount.Value; if (value > 0) { inventory.GiveItem(Items.TonicAffliction, value); } List<ItemDef> list = new List<ItemDef>(); int num = 0; for (int j = 0; j < ItemCatalog.itemCount; j++) { int num2 = inventory.permanentItemStacks.inner.sparseValues[j]; if (num2 <= 0) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)j); if (!((Object)(object)itemDef == (Object)null) && itemDef.canRemove && itemDef.tier == PVPLoserLoseItemsRarity.Value) { for (int k = 0; k < num2; k++) { list.Add(itemDef); num++; } } } int value2 = PVPLoserLoseItemsAmount.Value; for (int l = 0; l < value2; l++) { if (num <= 0) { break; } ItemDef val3 = list[Random.Range(0, num)]; inventory.RemoveItemPermanent(val3, 1); list.Remove(val3); num--; } } } public static void ChangeMinionsTeam(PlayerCharacterMasterController playerCharacterMasterController, TeamIndex teamIndex) { //IL_001f: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) MinionGroup val = null; for (int i = 0; i < MinionGroup.instancesList.Count; i++) { MinionGroup val2 = MinionGroup.instancesList[i]; if (MinionGroup.instancesList[i].ownerId == ((NetworkBehaviour)playerCharacterMasterController).netId) { val = val2; break; } } if (val == null) { return; } MinionOwnership[] members = val.members; foreach (MinionOwnership val3 in members) { if ((Object)(object)val3 == (Object)null) { continue; } CharacterMaster component = ((Component)val3).GetComponent<CharacterMaster>(); if ((Object)(object)component == (Object)null) { continue; } component.teamIndex = teamIndex; CharacterBody body = component.GetBody(); if (!((Object)(object)body == (Object)null)) { TeamComponent teamComponent = body.teamComponent; if (!((Object)(object)teamComponent == (Object)null)) { teamComponent.teamIndex = teamIndex; } } } } public void FixedUpdate() { if (NetworkServer.active && startingPVP) { startingStopwatch -= Time.fixedDeltaTime; if (startingStopwatch <= 0f) { BeginPVP(); startingPVP = false; } } if ((Object)(object)Run.instance == (Object)null) { return; } TeamDef val = TeamCatalog.teamDefs[1]; foreach (TeamDef playerTeamDef in playerTeamDefs) { playerTeamDef.softCharacterLimit = val.softCharacterLimit; playerTeamDef.friendlyFireScaling = val.friendlyFireScaling; playerTeamDef.levelUpEffect = val.levelUpEffect; playerTeamDef.nameToken = val.nameToken; } } public static void Init() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) playerTeamDefs.Clear(); playerTeamIndeces.Clear(); for (int i = 0; i < extraPlayerTeamsCount; i++) { CreateTeam("Player" + (i + 1)); } } public static TeamIndex CreateTeam(string name) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) TeamBehavior val = new TeamBehavior(name, (TeamClassification)4); string text = "TEAM_" + name.ToUpper() + "_NAME"; TeamDef val2 = new TeamDef { softCharacterLimit = 20, friendlyFireScaling = 0.5f, levelUpEffect = null, nameToken = "TEAM_PLAYER_NAME" }; TeamIndex val3 = TeamsAPI.RegisterTeam(val2, val); playerTeamDefs.Add(val2); playerTeamIndeces.Add(val3); return val3; } [ConCommand(/*Could not decode attribute arguments.*/)] public static void CallPVPVote(ConCommandArgs args) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0082: Expected O, but got Unknown if (!calling && !pvpEnabled) { int count = GetAlivePlayers().Count; if (count > 1) { neededVotes = count - 1; networkUsers.Add(args.sender); calling = true; Chat.SendBroadcastChat((ChatMessageBase)new UserChatMessage { sender = ((Component)args.sender).gameObject, text = " has called for PVP. Type `pvp_accept` in the console to proceed. Needed votes: " + neededVotes }); } } } [ConCommand(/*Could not decode attribute arguments.*/)] public static void AcceptPVPVote(ConCommandArgs args) { //IL_000e: 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_0014: 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_0034: Expected O, but got Unknown //IL_0042: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown if (!calling) { Chat.SendBroadcastChat((ChatMessageBase)new UserChatMessage { sender = ((Component)args.sender).gameObject, text = " wanted to accept PVP call but it has not been called yet. Use `pvp_call` to call it." }); } if (!pvpEnabled && !networkUsers.Contains(args.sender)) { neededVotes--; networkUsers.Add(args.sender); if (neededVotes <= 0) { Chat.SendBroadcastChat((ChatMessageBase)new UserChatMessage { sender = ((Component)args.sender).gameObject, text = " has voted for PVP. Starting PVP!" }); StartPVP(); calling = false; } else { Chat.SendBroadcastChat((ChatMessageBase)new UserChatMessage { sender = ((Component)args.sender).gameObject, text = " has voted for PVP. Needed votes: " + neededVotes }); } } } [ConCommand(/*Could not decode attribute arguments.*/)] public static void EndPVP(ConCommandArgs args) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_005c: Expected O, but got Unknown if (pvpEnabled) { int count = GetAlivePlayers().Count; if (count > 1) { Chat.SendBroadcastChat((ChatMessageBase)new UserChatMessage { sender = ((Component)args.sender).gameObject, text = " has called for PVP. Type `pvp_accept` in the console to proceed. Needed votes: " + neededVotes }); EndPVP(punish: true); } } } public static List<PlayerCharacterMasterController> GetAlivePlayers() { List<PlayerCharacterMasterController> list = new List<PlayerCharacterMasterController>(); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (!Object.op_Implicit((Object)(object)instance.master) || !instance.master.IsDeadAndOutOfLivesServer()) { list.Add(instance); } } return list; } } public class IncreaseDamageByShieldAndReduceShieldRechargeTimeBehaviour : ItemBehavior { public void FixedUpdate() { HealthComponent healthComponent = base.body.healthComponent; if (!((Object)(object)healthComponent == (Object)null) && !healthComponent.isShieldRegenForced) { float num = Utils.GetStackingFloat(PVPModPlugin.IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncrease.Value, PVPModPlugin.IncreaseDamageByShieldAndReduceShieldRechargeTimeShieldRegenSpeedIncreasePerStack.Value, base.stack) / 100f + 1f; float num2 = 7f / num; if (base.body.outOfDangerStopwatch >= num2) { healthComponent.ForceShieldRegen(); Util.PlaySound("Play_item_proc_personal_shield_recharge", ((Component)this).gameObject); } } } } public class PVPCountdown : MonoBehaviour { public TextMeshProUGUI textMeshProUGUI; public float countdown = 3f; public void Update() { countdown -= Time.deltaTime; if (countdown <= -1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } if (Object.op_Implicit((Object)(object)textMeshProUGUI)) { ((TMP_Text)textMeshProUGUI).text = ((countdown > 0f) ? ("PVP STARTS IN " + Mathf.Ceil(countdown)) : "FIGHT!"); } } } public class SpawnPVPCountdown : INetMessage, ISerializableObject { public float countdown; public SpawnPVPCountdown() { } public SpawnPVPCountdown(float countdown) { this.countdown = countdown; } public void Deserialize(NetworkReader reader) { countdown = reader.ReadSingle(); } public void OnReceived() { GameObject val = Object.Instantiate<GameObject>(PVPModPlugin.PVPCountdownPrefab); PVPCountdown component = val.GetComponent<PVPCountdown>(); component.countdown = countdown; } public void Serialize(NetworkWriter writer) { writer.Write(countdown); } } [CreateAssetMenu(menuName = "PVPMod/PVPModItemDef")] public class PVPModItemDef : ItemDef { [Serializable] public struct ItemTierSprite { public ItemTier itemTier; public Sprite sprite; } public ItemTierSprite[] itemTierSprites; } public class PVPModContentPack : IContentPackProvider { [CompilerGenerated] private sealed class <FinalizeAsync>d__5 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public FinalizeAsyncArgs args; public PVPModContentPack <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FinalizeAsync>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <GenerateContentPackAsync>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GetContentPackAsyncArgs args; public PVPModContentPack <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GenerateContentPackAsync>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; ContentPack.Copy(<>4__this.contentPack, args.output); args.ReportProgress(1f); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <LoadStaticContentAsync>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public LoadStaticContentAsyncArgs args; public PVPModContentPack <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <LoadStaticContentAsync>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { if (<>1__state != 0) { return false; } <>1__state = -1; <>4__this.contentPack.identifier = <>4__this.identifier; <>4__this.contentPack.itemDefs.Add(items.ToArray()); <>4__this.contentPack.buffDefs.Add(buffs.ToArray()); return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal ContentPack contentPack = new ContentPack(); public static List<ItemDef> items = new List<ItemDef>(); public static List<BuffDef> buffs = new List<BuffDef>(); public string identifier => "com.brynzananas.pvpmod.ContentProvider"; [IteratorStateMachine(typeof(<FinalizeAsync>d__5))] public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <FinalizeAsync>d__5(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<GenerateContentPackAsync>d__6))] public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GenerateContentPackAsync>d__6(0) { <>4__this = this, args = args }; } [IteratorStateMachine(typeof(<LoadStaticContentAsync>d__7))] public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <LoadStaticContentAsync>d__7(0) { <>4__this = this, args = args }; } } public static class Utils { public const string damagePrefix = "<style=cIsDamage>"; public const string stackPrefix = "<style=cStack>"; public const string utilityPrefix = "<style=cIsUtility>"; public const string healingPrefix = "<style=cIsHealing>"; public const string endPrefix = "</style>"; public static void AddLanguageToken(string token, string value) { AddLanguageToken(token, value, "en"); } public static void AddLanguageToken(string token, string value, string language) { Language val = Language.languagesByName[language]; if (val.stringsByToken.ContainsKey(token)) { val.stringsByToken[token] = value; } else { val.stringsByToken.Add(token, value); } } public static ConfigEntry<T> CreateConfig<T>(string section, string field, T defaultValue, string description) { return CreateConfig(section, field, defaultValue, description, riskOfOptionsRestartRequired: false); } public static ConfigEntry<T> CreateConfig<T>(string section, string field, T defaultValue, string description, bool riskOfOptionsRestartRequired) { ConfigEntry<T> val = PVPModPlugin.configFile.Bind<T>(section, field, defaultValue, description); if (PVPModPlugin.riskOfOptionsEnabled) { ModCompatabilities.RiskOfOptionsCompatAbility.HandleConfig(val, defaultValue, riskOfOptionsRestartRequired); } PVPModPlugin.configs.Add((ConfigEntryBase)(object)val); return val; } public static T RegisterItemDef<T>(this T itemDef, Action<ItemDef> onItemDefAdded = null) where T : ItemDef { //IL_0034: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ConfigEntry<bool> val = CreateConfig(((Object)(object)itemDef).name, "Enable", defaultValue: true, "Enable this item?", riskOfOptionsRestartRequired: true); ConfigEntry<ItemTier> val2 = CreateConfig<ItemTier>(((Object)(object)itemDef).name, "Rarity", ((ItemDef)itemDef).tier, "Control rarity of this item", riskOfOptionsRestartRequired: true); PVPModItemDef pVPModItemDef = itemDef as PVPModItemDef; if (Object.op_Implicit((Object)(object)pVPModItemDef)) { PVPModItemDef.ItemTierSprite[] itemTierSprites = pVPModItemDef.itemTierSprites; for (int i = 0; i < itemTierSprites.Length; i++) { PVPModItemDef.ItemTierSprite itemTierSprite = itemTierSprites[i]; if (itemTierSprite.itemTier == val2.Value) { ((ItemDef)pVPModItemDef).pickupIconSprite = itemTierSprite.sprite; ((ItemDef)pVPModItemDef).deprecatedTier = val2.Value; break; } } } if (val == null || val.Value) { PVPModContentPack.items.Add((ItemDef)(object)itemDef); onItemDefAdded?.Invoke((ItemDef)(object)itemDef); } return itemDef; } public static T RegisterBuffDef<T>(this T buffDef, Action<BuffDef> onBuffDefAdded = null) where T : BuffDef { PVPModContentPack.buffs.Add((BuffDef)(object)buffDef); onBuffDefAdded?.Invoke((BuffDef)(object)buffDef); return buffDef; } public static float GetStackingFloat(float baseValue, float stackValue, int stacks) { return baseValue + (float)(stacks - 1) * stackValue; } } public static class ModCompatabilities { public static class RiskOfOptionsCompatAbility { public const string ModGUID = "com.rune580.riskofoptions"; public static void HandleConfig<T>(ConfigEntry<T> configEntry, T value, bool restartRequired) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown if (value is float) { ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(configEntry as ConfigEntry<float>, restartRequired)); } if (value is bool) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntry as ConfigEntry<bool>, restartRequired)); } if (value is int) { ModSettingsManager.AddOption((BaseOption)new IntFieldOption(configEntry as ConfigEntry<int>, restartRequired)); } if (value is string) { ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(configEntry as ConfigEntry<string>, restartRequired)); } if (value is Enum) { Enum @enum = value as Enum; if (!@enum.GetType().GetCustomAttributes<FlagsAttribute>().Any()) { ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)configEntry, restartRequired)); } } } } } }