using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using BraqsItems.Misc;
using BraqsItems.Util;
using HG;
using IL.RoR2;
using IL.RoR2.Skills;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.Orbs;
using On.RoR2.Skills;
using R2API;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace BraqsItems
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Braquen.BraqsItems", "Braqs Items", "1.6.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BraqsItemsMain : BaseUnityPlugin
{
public const string GUID = "com.Braquen.BraqsItems";
public const string MODNAME = "Braqs Items";
public const string VERSION = "1.6.2";
public static ExpansionDef BraqsItemsExpansion;
internal static AssetBundle assetBundle;
public static PluginInfo PluginInfo { get; private set; }
public static BraqsItemsMain instance { get; private set; }
internal static string assetBundleDir => Path.Combine(Path.GetDirectoryName(PluginInfo.Location), "braqsitemsassets");
private void Awake()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
instance = this;
PluginInfo = ((BaseUnityPlugin)this).Info;
assetBundle = AssetBundle.LoadFromFile(assetBundleDir);
ConfigManager.Init(Paths.ConfigPath);
Stats.Init();
CharacterEvents.Init();
BraqsItemsExpansion = assetBundle.LoadAsset<ExpansionDef>("BraqsItemsExpansion");
BraqsItemsExpansion.disabledIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texUnlockIcon.png").WaitForCompletion();
ContentAddition.AddExpansionDef(BraqsItemsExpansion);
BrokenItemRelationships.CreateBrokenItemProvider();
AttackSpeedOnHit.Init();
BiggerExplosions.Init();
LightningOnOverkill.Init();
LightningOnOverkillVoid.Init();
ExplodeAgain.Init();
HealFromBleed.Init();
RepairBrokenItems.Init();
SkillSaver.Init();
HealFromBleedVoid.Init();
ExplosionFrenzy.Init();
HundredRendingFists.Init();
LightningDamageBoost.Init();
}
}
public class LunarAOE
{
private class DamageShareOrb : Orb
{
private const float speed = 100f;
public float damageValue;
public GameObject attacker;
public TeamIndex teamIndex;
public List<HealthComponent> bouncedObjects;
public bool isCrit;
public float scale;
public ProcChainMask procChainMask;
public float procCoefficient;
public DamageColorIndex damageColorIndex;
public DamageTypeCombo damageTypeCombo;
public override void Begin()
{
//IL_0012: 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_0023: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
((Orb)this).duration = ((Orb)this).distanceToTarget / 100f;
EffectData val = new EffectData
{
scale = scale,
origin = base.origin,
genericFloat = ((Orb)this).duration
};
val.SetHurtBoxReference(base.target);
EffectManager.SpawnEffect(lunarMissile, val, true);
}
public override void OnArrival()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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_0083: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)base.target))
{
HealthComponent healthComponent = base.target.healthComponent;
if (Object.op_Implicit((Object)(object)healthComponent))
{
Vector3 position = ((Component)base.target).transform.position;
GameObject gameObject = ((Component)healthComponent).gameObject;
DamageInfo val = new DamageInfo();
val.damage = damageValue;
val.damageType = damageTypeCombo;
val.attacker = attacker;
val.inflictor = null;
val.crit = isCrit;
val.procChainMask = procChainMask;
val.procCoefficient = procCoefficient;
val.position = position;
val.damageColorIndex = damageColorIndex;
healthComponent.TakeDamage(val);
GlobalEventManager.instance.OnHitEnemy(val, gameObject);
GlobalEventManager.instance.OnHitAll(val, gameObject);
}
}
}
public static float TryDistributeDamage(DamageInfo damageInfo, HealthComponent victim = null)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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_0060: Expected O, but got Unknown
//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_0078: 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_0084: 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_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: 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_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
CharacterBody val = default(CharacterBody);
if (!damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) || ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, procType))
{
return damageInfo.damage;
}
int itemCountEffective = val.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective <= 0)
{
return damageInfo.damage;
}
float maxDistanceFilter = 10f * (float)itemCountEffective;
TeamIndex val2 = val.teamComponent.teamIndex;
BullseyeSearch val3 = new BullseyeSearch();
val3.teamMaskFilter = TeamMask.GetEnemyTeams(val2);
val3.maxDistanceFilter = maxDistanceFilter;
val3.searchOrigin = damageInfo.position;
val3.searchDirection = Vector3.zero;
val3.sortMode = (SortMode)0;
val3.filterByLoS = false;
val3.RefreshCandidates();
if (Object.op_Implicit((Object)(object)victim))
{
val3.FilterOutGameObject(((Component)victim).gameObject);
}
IEnumerable<HurtBox> enumerable = val3.GetResults().Where((Func<HurtBox, bool>)Util.IsValid).Distinct((IEqualityComparer<HurtBox>?)(object)default(EntityEqualityComparer));
float result = damageInfo.damage / (float)(enumerable.Count() + (Object.op_Implicit((Object)(object)victim) ? 1 : 0));
EffectData val4 = new EffectData
{
origin = damageInfo.position
};
EffectManager.SpawnEffect(SparkEffect, val4, true);
float num = damageInfo.procCoefficient / 2f;
foreach (HurtBox item in enumerable)
{
DamageShareOrb damageShareOrb = new DamageShareOrb();
((Orb)damageShareOrb).origin = damageInfo.position;
damageShareOrb.damageValue = result;
damageShareOrb.damageTypeCombo = damageInfo.damageType;
damageShareOrb.isCrit = damageInfo.crit;
damageShareOrb.teamIndex = val2;
damageShareOrb.attacker = damageInfo.attacker;
damageShareOrb.procChainMask = damageInfo.procChainMask;
ProcTypeAPI.AddModdedProc(ref damageShareOrb.procChainMask, procType);
damageShareOrb.procCoefficient = num;
damageShareOrb.damageColorIndex = (DamageColorIndex)3;
((Orb)damageShareOrb).target = item;
OrbManager.instance.AddOrb((Orb)(object)damageShareOrb);
}
return result;
}
}
public static ItemDef itemDef;
private static GameObject lunarMissile;
private static GameObject SparkEffect;
public static ModdedProcType procType;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (ConfigManager.AttackSpeedOnHit_isEnabled.Value)
{
Log.Info("Initializing LunarAOE Item");
itemDef = Helpers.GetItemDef("LunarAOE");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
procType = ProcTypeAPI.ReserveProcType();
GenerateEffect();
Hooks();
Log.Info("LunarAOE Initialized");
}
}
private static void GenerateEffect()
{
//IL_0005: 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_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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
lunarMissile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MissileVoid/MissileVoidOrbEffect.prefab").WaitForCompletion(), "LunarMissile");
SparkEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/EliteLightning/LightningStakeNova.prefab").WaitForCompletion(), "LunarAoESpark");
Texture val = Addressables.LoadAssetAsync<Texture>((object)"RoR2/Base/Common/ColorRamps/texRampHelfire.png").WaitForCompletion();
try
{
Object.Destroy((Object)(object)((Component)SparkEffect.transform.Find("Lightning, Spark Center")).gameObject);
Object.Destroy((Object)(object)((Component)SparkEffect.transform.Find("Nova Sphere")).gameObject);
}
catch (Exception ex)
{
Log.Warning("Stats:GenerateEffect() ; Could not create lunar aoe effect.\n" + ex);
}
ContentAddition.AddEffect(SparkEffect);
try
{
lunarMissile.GetComponent<OrbEffect>().endEffect = SparkEffect;
}
catch (Exception ex2)
{
Log.Warning("LunarAOE:GenerateEffect() ; Could not edit missile impact.\n" + ex2);
}
try
{
TrailRenderer component = ((Component)lunarMissile.transform.Find("MissileVoidGhost/Trail")).gameObject.GetComponent<TrailRenderer>();
component.time = 1f;
((Renderer)component).material.SetTexture("_RemapTex", val);
}
catch (Exception ex3)
{
Log.Warning("LunarAOE:GenerateEffect() ; Could not edit missile trail.\n" + ex3);
}
try
{
((Component)lunarMissile.transform.Find("MissileVoidGhost/Point Light")).gameObject.GetComponent<Light>().color = new Color(0.53f, 0.52f, 0.76f);
}
catch (Exception ex4)
{
Log.Warning("LunarAOE:GenerateEffect() ; Could not edit missile light.\n" + ex4);
}
try
{
((Renderer)((Component)lunarMissile.transform.Find("MissileVoidGhost/Flare")).gameObject.GetComponent<ParticleSystemRenderer>()).material.SetTexture("_RemapTex", val);
}
catch (Exception ex5)
{
Log.Warning("LunarAOE:GenerateEffect() ; Could not edit missile flare.\n" + ex5);
}
ContentAddition.AddEffect(lunarMissile);
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess);
}
private static void GlobalEventManager_OnHitAllProcess(orig_OnHitAllProcess orig, GlobalEventManager self, DamageInfo damageInfo, GameObject hitObject)
{
orig.Invoke(self, damageInfo, hitObject);
if (damageInfo.procCoefficient != 0f && !damageInfo.rejected && Object.op_Implicit((Object)(object)damageInfo.attacker) && !Object.op_Implicit((Object)(object)hitObject.GetComponent<HealthComponent>()))
{
damageInfo.damage = DamageShareOrb.TryDistributeDamage(damageInfo);
}
}
private static void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo)
{
//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)
if (damageInfo.procCoefficient == 0f || damageInfo.rejected || !NetworkServer.active || ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, procType))
{
orig.Invoke(self, damageInfo);
return;
}
damageInfo.damage = DamageShareOrb.TryDistributeDamage(damageInfo, self);
orig.Invoke(self, damageInfo);
}
}
public static class AttackSpeedOnHit
{
public class BraqsItems_AttackSpeedOnHitTracker : ItemBehavior
{
public List<CharacterBody> victims = new List<CharacterBody>();
private void Start()
{
}
public bool TryAddVictim(CharacterBody victim)
{
if (!victims.Contains(victim))
{
victims.Add(victim);
base.body.RecalculateStats();
return true;
}
return false;
}
public void RemoveVictim(CharacterBody victim)
{
if (victims.Contains(victim))
{
victims.Remove(victim);
base.body.RecalculateStats();
}
}
private void OnDestroy()
{
}
}
public static ItemDef itemDef;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (ConfigManager.AttackSpeedOnHit_isEnabled.Value)
{
Log.Info("Initializing Hundreds and Thousands Item");
itemDef = Helpers.GetItemDef("AttackSpeedOnHit");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
Log.Info("Hundreds and Thousands Initialized");
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged);
GlobalEventManager.onServerDamageDealt += GlobalEventManager_onServerDamageDealt;
}
private static void GlobalEventManager_onServerDamageDealt(DamageReport obj)
{
BraqsItems_AttackSpeedOnHitTracker braqsItems_AttackSpeedOnHitTracker = default(BraqsItems_AttackSpeedOnHitTracker);
CharacterEvents.BraqsItems_CharacterEventComponent braqsItems_CharacterEventComponent = default(CharacterEvents.BraqsItems_CharacterEventComponent);
if (Object.op_Implicit((Object)(object)obj.attackerBody) && Object.op_Implicit((Object)(object)obj.victimMaster) && Object.op_Implicit((Object)(object)obj.victimBody.healthComponent) && obj.victimBody.healthComponent.alive && ((Component)obj.attackerBody).TryGetComponent<BraqsItems_AttackSpeedOnHitTracker>(ref braqsItems_AttackSpeedOnHitTracker) && ((Component)obj.victimMaster).TryGetComponent<CharacterEvents.BraqsItems_CharacterEventComponent>(ref braqsItems_CharacterEventComponent) && Object.op_Implicit((Object)(object)braqsItems_CharacterEventComponent.body) && braqsItems_AttackSpeedOnHitTracker.TryAddVictim(braqsItems_CharacterEventComponent.body))
{
braqsItems_CharacterEventComponent.OnCharacterDeath += braqsItems_AttackSpeedOnHitTracker.RemoveVictim;
}
}
private static void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
{
self.AddItemBehavior<BraqsItems_AttackSpeedOnHitTracker>(self.inventory.GetItemCountEffective(itemDef));
orig.Invoke(self);
}
public static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
BraqsItems_AttackSpeedOnHitTracker braqsItems_AttackSpeedOnHitTracker = default(BraqsItems_AttackSpeedOnHitTracker);
if (((Component)sender).TryGetComponent<BraqsItems_AttackSpeedOnHitTracker>(ref braqsItems_AttackSpeedOnHitTracker))
{
args.attackSpeedMultAdd += (float)braqsItems_AttackSpeedOnHitTracker.victims.Count * ((float)(((ItemBehavior)braqsItems_AttackSpeedOnHitTracker).stack - 1) * ConfigManager.AttackSpeedOnHit_percentPerStack.Value + ConfigManager.AttackSpeedOnHit_percentBase.Value);
}
}
}
public static class BiggerExplosions
{
public static ItemDef itemDef;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (ConfigManager.BiggerExplosions_isEnabled.Value)
{
Log.Info("Initializing Accelerant Item");
itemDef = Helpers.GetItemDef("BiggerExplosions");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
Log.Info("Acclerant Initialized");
}
}
private static void Hooks()
{
Stats.StatsCompEvent.StatsCompRecalc = (EventHandler<Stats.StatsCompRecalcArgs>)Delegate.Combine(Stats.StatsCompEvent.StatsCompRecalc, new EventHandler<Stats.StatsCompRecalcArgs>(StatsCompEvent_StatsCompRecalc));
}
public static void StatsCompEvent_StatsCompRecalc(object sender, Stats.StatsCompRecalcArgs args)
{
if (Object.op_Implicit((Object)(object)args.Stats) && NetworkServer.active && Object.op_Implicit((Object)(object)args.Stats.inventory))
{
int itemCountEffective = args.Stats.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0)
{
args.Stats.blastRadiusBoostAdd *= 1f + (float)(itemCountEffective - 1) * ConfigManager.BiggerExplosions_percentPerStack.Value + ConfigManager.BiggerExplosions_percentBase.Value;
}
}
}
}
public static class LightningOnOverkill
{
public static ItemDef itemDef;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (ConfigManager.LightningOnOverkill_isEnabled.Value)
{
Log.Info("Initializing Jumper Cables Item");
itemDef = Helpers.GetItemDef("LightningOnOverkill");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
Log.Info("Jumper Cables Initialized");
}
}
private static void Hooks()
{
GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
}
private static void GlobalEventManager_onCharacterDeathGlobal(DamageReport obj)
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: 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_00af: 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_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)obj.attackerBody) || !Object.op_Implicit((Object)(object)obj.attackerBody.inventory))
{
return;
}
int itemCountEffective = obj.attackerBody.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective <= 0)
{
return;
}
float num = Util.OnHitProcDamage(obj.damageDealt - obj.combinedHealthBeforeDamage, obj.attackerBody.baseDamage, (float)(itemCountEffective - 1) * ConfigManager.LightningOnOverkill_damagePercentPerStack.Value + ConfigManager.LightningOnOverkill_damagePercentBase.Value);
if (!(num <= 0f))
{
LightningOrb val = new LightningOrb
{
origin = obj.victimBody.corePosition,
damageValue = num,
isCrit = obj.damageInfo.crit,
bouncesRemaining = ConfigManager.LightningOnOverkill_bounceBase.Value + (itemCountEffective - 1) * ConfigManager.LightningOnOverkill_bouncePerStack.Value,
teamIndex = obj.attackerBody.teamComponent.teamIndex,
attacker = obj.attacker,
procCoefficient = 0.2f,
bouncedObjects = new List<HealthComponent> { obj.victim },
lightningType = (LightningType)0,
damageColorIndex = (DamageColorIndex)3,
range = ConfigManager.LightningOnOverkill_rangeBase.Value + (float)(itemCountEffective - 1) * ConfigManager.LightningOnOverkill_rangePerStack.Value
};
HurtBox val2 = val.PickNextTarget(obj.victimBody.corePosition);
if (Object.op_Implicit((Object)(object)val2))
{
((Orb)val).target = val2;
OrbManager.instance.AddOrb((Orb)(object)val);
}
}
}
}
public static class TimedCooldownReduction
{
public class BraqsItems_CooldownReductionTimer : ItemBehavior
{
private float totalBuffTime = 1f;
private int lastBuffStackCount;
private void Start()
{
float num = base.stack - 1;
totalBuffTime = 1f + num / (0.1f * num + 1f);
}
private void FixedUpdate()
{
if (Object.op_Implicit((Object)(object)base.body) && !base.body.HasBuff(timerBuffDef))
{
base.body.AddTimedBuff(timerBuffDef, 10f);
ApplyBuffs();
ReduceCooldown();
}
if (Object.op_Implicit((Object)(object)base.body) && base.body.HasBuff(buffDef))
{
int buffCount = base.body.GetBuffCount(buffDef);
if (buffCount != lastBuffStackCount)
{
ReduceCooldown();
lastBuffStackCount = buffCount;
}
}
}
private void ApplyBuffs()
{
int stack = base.stack;
for (int i = 0; i < stack; i++)
{
base.body.AddTimedBuff(buffDef, totalBuffTime * (float)(i + 1) / (float)base.stack);
}
}
private void ReduceCooldown()
{
int num = (int)Math.Floor(Random.Range(0f, (float)base.body.skillLocator.skillSlotCount));
base.body.skillLocator.allSkills[num].RunRecharge(1f);
}
}
public static ItemConfigManager configManager = new ItemConfigManager("TIMEDCOOLDOWNREDUCTION");
public static ItemDef itemDef;
public static BuffDef timerBuffDef;
public static BuffDef buffDef;
public static ConfigEntry<bool> isEnabled = configManager.Bind("Enable", defaultValue: true, "Load this item.");
public static ConfigEntry<float> activationTimer = configManager.Bind("Reduction Timer", 10f, "Number of seconds between activation of the cooldown reduction.");
public static ConfigEntry<float> cooldowonReduction = configManager.Bind("Cooldown reduction", 0.01f, "Number of seconds taken off of a skill's remaining cooldown when the item activates.");
public static float baseTimer = 10f;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
Log.Info("Initializing Simon Says");
if (isEnabled.Value)
{
itemDef = Helpers.GetItemDef("TimedCooldownReduction");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
Log.Info("Simon Says Initialized");
}
}
private static void Hooks()
{
}
}
public static class LightningOnOverkillVoid
{
public class BraqsItems_LightningOnOverkillVoidBehavior : ItemBehavior
{
private class DamageBonus
{
public float damage;
public int hitsLeft;
}
private List<DamageBonus> damageBonuses = new List<DamageBonus>();
private float totalDamageBonus;
public void StoreDeathDamage(float damage)
{
totalDamageBonus += damage;
damageBonuses.Add(new DamageBonus
{
damage = damage,
hitsLeft = ConfigManager.LightningOnOverkillVoid_hitsBase.Value + (base.stack - 1) * ConfigManager.LightningOnOverkillVoid_hitsPerStack.Value
});
}
public void FireVoidLightning(DamageInfo damageInfo, CharacterBody victimBody)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_0066: 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_007c: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_009d: 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: Expected O, but got Unknown
int count = damageBonuses.Count;
if (count > 0 && !(totalDamageBonus <= 0f))
{
float damageValue = totalDamageBonus / (float)count;
ProcChainMask procChainMask = damageInfo.procChainMask;
ProcTypeAPI.AddModdedProc(ref procChainMask, procType);
VoidLightningOrb val = new VoidLightningOrb
{
origin = damageInfo.position,
damageValue = damageValue,
isCrit = damageInfo.crit,
totalStrikes = count,
teamIndex = base.body.teamComponent.teamIndex,
attacker = damageInfo.attacker,
procCoefficient = 0.3f,
procChainMask = procChainMask,
damageColorIndex = (DamageColorIndex)9,
secondsPerStrike = 0.1f
};
HurtBox mainHurtBox = victimBody.mainHurtBox;
if (Object.op_Implicit((Object)(object)mainHurtBox))
{
((Orb)val).target = mainHurtBox;
OrbManager.instance.AddOrb((Orb)(object)val);
}
OnBonusProcced();
}
}
private void OnBonusProcced()
{
for (int num = damageBonuses.Count - 1; num >= 0; num--)
{
if (--damageBonuses[num].hitsLeft <= 0)
{
totalDamageBonus -= damageBonuses[num].damage;
damageBonuses.RemoveAt(num);
}
}
}
}
public static ItemDef itemDef;
public static ModdedProcType procType;
internal static void Init()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
if (ConfigManager.LightningOnOverkillVoid_isEnabled.Value)
{
Log.Info("Initializing Sunken Chains Item");
itemDef = Helpers.GetItemDef("LightningOnOverkillVoid");
if (ConfigManager.LightningOnOverkill_isEnabled.Value)
{
itemDef.AddContagiousRelationship(LightningOnOverkill.itemDef);
}
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
procType = ProcTypeAPI.ReserveProcType();
Hooks();
Log.Info("Sunken Chains Initialized");
}
}
private static void Hooks()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy);
CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged);
}
private static void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
{
self.AddItemBehavior<BraqsItems_LightningOnOverkillVoidBehavior>(self.inventory.GetItemCountEffective(itemDef));
orig.Invoke(self);
}
private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
{
//IL_0016: 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)
CharacterBody val = default(CharacterBody);
BraqsItems_LightningOnOverkillVoidBehavior braqsItems_LightningOnOverkillVoidBehavior = default(BraqsItems_LightningOnOverkillVoidBehavior);
CharacterBody val2 = default(CharacterBody);
if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && !ProcTypeAPI.HasModdedProc(damageInfo.procChainMask, procType) && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) && ((Component)val).TryGetComponent<BraqsItems_LightningOnOverkillVoidBehavior>(ref braqsItems_LightningOnOverkillVoidBehavior) && victim.TryGetComponent<CharacterBody>(ref val2) && Object.op_Implicit((Object)(object)val2.healthComponent) && val2.healthComponent.alive && ((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased)
{
braqsItems_LightningOnOverkillVoidBehavior.FireVoidLightning(damageInfo, val2);
}
orig.Invoke(self, damageInfo, victim);
}
private static void GlobalEventManager_onCharacterDeathGlobal(DamageReport obj)
{
BraqsItems_LightningOnOverkillVoidBehavior braqsItems_LightningOnOverkillVoidBehavior = default(BraqsItems_LightningOnOverkillVoidBehavior);
if (!Object.op_Implicit((Object)(object)obj.attackerBody) || !((Component)obj.attackerBody).TryGetComponent<BraqsItems_LightningOnOverkillVoidBehavior>(ref braqsItems_LightningOnOverkillVoidBehavior))
{
return;
}
int itemCountEffective = obj.attackerBody.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0)
{
float num = ConfigManager.LightningOnOverkillVoid_damagePercentBase.Value + (float)(itemCountEffective - 1) * ConfigManager.LightningOnOverkillVoid_damagePercentPerStack.Value;
num *= (obj.damageDealt - obj.combinedHealthBeforeDamage) / obj.damageDealt;
float num2 = Util.OnHitProcDamage(obj.attackerBody.damage, obj.attackerBody.baseDamage, num);
Debug.Log((object)("Storing " + num2 + " damage from overkill."));
if (!(num2 <= 0f))
{
braqsItems_LightningOnOverkillVoidBehavior.StoreDeathDamage(num2);
}
}
}
}
public static class ExplodeAgain
{
public static ItemDef itemDef;
public static ModdedProcType procType;
private static GameObject bomblettePrefab;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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)
if (ConfigManager.ExplodeAgain_isEnabled.Value)
{
Log.Info("Initializing Bomblette Item");
itemDef = Helpers.GetItemDef("ExplodeAgain");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
procType = ProcTypeAPI.ReserveProcType();
bomblettePrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Toolbot/CryoCanisterBombletsProjectile.prefab").WaitForCompletion(), "inertBomblet");
Hooks();
Log.Info("Bomblette Initialized");
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
BlastAttack.Fire += new hook_Fire(BlastAttack_Fire);
}
private static Result BlastAttack_Fire(orig_Fire orig, BlastAttack self)
{
//IL_0061: 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)
CharacterBody val = default(CharacterBody);
if (NetworkServer.active && Object.op_Implicit((Object)(object)self.attacker) && self.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory))
{
int itemCountEffective = val.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0 && !ProcTypeAPI.HasModdedProc(self.procChainMask, procType))
{
FireChildExplosions(self, val, itemCountEffective);
}
}
return orig.Invoke(self);
}
private static void FireChildExplosions(BlastAttack self, CharacterBody body, int items)
{
//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_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
if (self.procCoefficient == 0f && !ConfigManager.ExplodeAgain_ignoreProcCoefficient.Value)
{
return;
}
Vector3 position = self.position;
Vector3 up = Vector3.up;
int num = (items - 1) * ConfigManager.ExplodeAgain_maxBombsPerStack.Value + ConfigManager.ExplodeAgain_maxBombsBase.Value;
GameObject val = bomblettePrefab;
ProjectileExplosion component = val.GetComponent<ProjectileExplosion>();
component.blastRadius = self.radius * ConfigManager.ExplodeAgain_radiusCoefficient.Value;
component.blastProcCoefficient = self.procCoefficient;
float damage = Util.OnHitProcDamage(self.baseDamage, body.damage, ConfigManager.ExplodeAgain_damageCoefficient.Value);
ProcChainMask procChainMask = self.procChainMask;
ProcTypeAPI.AddModdedProc(ref procChainMask, procType);
float num2 = (ConfigManager.ExplodeAgain_ignoreProcCoefficient.Value ? 1f : self.procCoefficient);
for (int i = 0; i < num; i++)
{
if (Util.CheckRoll(ConfigManager.ExplodeAgain_chance.Value * num2, body.master))
{
float speedOverride = Random.Range(0.5f, 1f) * self.radius * 3f;
float num3 = (float)i * MathF.PI * 2f / (float)num;
up.x += Mathf.Sin(num3);
up.z += Mathf.Cos(num3);
FireProjectileInfo val2 = default(FireProjectileInfo);
val2.projectilePrefab = val;
val2.position = position + new Vector3(Mathf.Sin(num3), 0f, Mathf.Cos(num3));
val2.rotation = Util.QuaternionSafeLookRotation(up);
val2.procChainMask = procChainMask;
val2.owner = self.attacker;
val2.damage = damage;
val2.crit = self.crit;
val2.force = self.baseForce;
val2.damageColorIndex = (DamageColorIndex)3;
((FireProjectileInfo)(ref val2)).speedOverride = speedOverride;
val2.useSpeedOverride = true;
FireProjectileInfo val3 = val2;
ProjectileManager.instance.FireProjectile(val3);
}
}
}
}
public class HealFromBleed
{
public static ItemDef itemDef;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (ConfigManager.HealFromBleed_isEnabled.Value)
{
Log.Info("Initializing Leech Jar Item");
itemDef = Helpers.GetItemDef("HealFromBleed");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
Log.Info("Leech Jar Initialized");
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
}
private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)sender.inventory) && sender.inventory.GetItemCountEffective(itemDef) > 0)
{
args.bleedChanceAdd += 5f;
}
}
private static float GetExtraBleedChance(Inventory inventory)
{
if (inventory.GetItemCountEffective(itemDef) <= 0)
{
return 0f;
}
return 5f;
}
private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Invalid comparison between Unknown and I4
//IL_0009: 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_0096: Expected O, but got Unknown
//IL_009d: 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)
CharacterBody val = default(CharacterBody);
if (((!damageInfo.rejected && (int)damageInfo.dotIndex == 0) || (int)damageInfo.dotIndex == 6) && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory))
{
int itemCountEffective = val.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0)
{
float healValue = ((float)(itemCountEffective - 1) * ConfigManager.HealFromBleed_percentPerStack.Value + ConfigManager.HealFromBleed_percentBase.Value) * val.maxHealth * damageInfo.damage / val.damage;
HealOrb val2 = new HealOrb();
((Orb)val2).origin = ((Component)self).transform.position;
((Orb)val2).target = val.mainHurtBox;
val2.healValue = healValue;
OrbManager.instance.AddOrb((Orb)(object)val2);
}
}
orig.Invoke(self, damageInfo);
}
}
public static class RepairBrokenItems
{
public static ItemDef itemDef;
public static Dictionary<ItemTier, int> tierWeights;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (ConfigManager.RepairBrokenItems_isEnabled.Value)
{
Log.Info("Initializing Goobo Sr. Item");
itemDef = Helpers.GetItemDef("RepairBrokenItems");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
Log.Info("Goobo Sr. Initialized");
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
CharacterMaster.OnServerStageBegin += new hook_OnServerStageBegin(CharacterMaster_OnServerStageBegin);
}
private unsafe static void CharacterMaster_OnServerStageBegin(orig_OnServerStageBegin orig, CharacterMaster self, Stage stage)
{
//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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Invalid comparison between Unknown and I4
//IL_00cb: 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: Invalid comparison between Unknown and I4
//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_00e7: Invalid comparison between Unknown and I4
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, stage);
int itemCountEffective = self.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective <= 0 || !Object.op_Implicit((Object)(object)self) || !Object.op_Implicit((Object)(object)stage))
{
return;
}
itemCountEffective = (itemCountEffective - 1) * ConfigManager.RepairBrokenItems_repairsPerStack.Value + ConfigManager.RepairBrokenItems_repairsBase.Value;
ReadOnlyArray<Pair> itemPairsForRelationship = ItemCatalog.GetItemPairsForRelationship(BrokenItemRelationships.brokenItemRelationship);
int length = itemPairsForRelationship.Length;
float[] array = new float[length];
float[] array2 = new float[length];
float num = 0f;
for (int i = 0; i < length; i++)
{
Pair val = Unsafe.Read<Pair>((void*)itemPairsForRelationship[i]);
int itemCountEffective2 = self.inventory.GetItemCountEffective(val.itemDef2);
if ((int)val.itemDef1.tier == 0 || (int)val.itemDef1.tier == 6)
{
array2[i] = ConfigManager.RepairBrokenItems_whiteChance.Value;
}
else if ((int)val.itemDef1.tier == 2 || (int)val.itemDef1.tier == 8)
{
array2[i] = ConfigManager.RepairBrokenItems_redChance.Value;
}
else
{
array2[i] = ConfigManager.RepairBrokenItems_defaultChance.Value;
}
array[i] = itemCountEffective2;
num += (float)itemCountEffective2;
}
if (num <= 0f)
{
return;
}
int[] array3 = new int[length];
for (int j = 0; j < itemCountEffective; j++)
{
if (!(num > 0f))
{
break;
}
float num2 = 0f;
float num3 = Random.Range(0f, num);
for (int k = 0; k < length; k++)
{
num2 += array[k];
if (num2 >= num3)
{
if (Util.CheckRoll(array2[k], self))
{
array3[k]++;
}
array[k] -= 1f;
num -= 1f;
break;
}
}
}
for (int l = 0; l < array3.Length; l++)
{
tryRepairItems(self, Unsafe.Read<Pair>((void*)itemPairsForRelationship[l]), array3[l]);
}
}
public static void tryRepairItems(CharacterMaster master, Pair pair, int count)
{
//IL_0015: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)master == (Object)null) && count > 0)
{
count = Math.Min(count, master.inventory.GetItemCountEffective(pair.itemDef2));
master.inventory.RemoveItemPermanent(pair.itemDef2, count);
master.inventory.GiveItemPermanent(pair.itemDef1, count);
CharacterMasterNotificationQueue.SendTransformNotification(master, pair.itemDef2.itemIndex, pair.itemDef1.itemIndex, (TransformationType)5);
}
}
}
public static class SkillSaver
{
public static ItemDef itemDef;
public static GameObject pillEffect;
public static GameObject restockEffect;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (ConfigManager.SkillSaver_isEnabled.Value)
{
Log.Info("Initializing Rhino Pill Item");
itemDef = Helpers.GetItemDef("SkillSaver");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
GenerateEffect();
Hooks();
Log.Info("Rhino Pill Initialized");
}
}
private static void GenerateEffect()
{
//IL_0005: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
try
{
pillEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/CoinImpact.prefab").WaitForCompletion(), "BluePills");
MainModule main = ((Component)pillEffect.transform.Find("CoinParticle")).gameObject.GetComponent<ParticleSystem>().main;
((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.3f);
((Renderer)((Component)pillEffect.transform.Find("CoinParticle")).gameObject.GetComponent<ParticleSystemRenderer>()).material.SetColor("_Color", new Color(0f, 0.5f, 1f));
ContentAddition.AddEffect(pillEffect);
}
catch (Exception ex)
{
Log.Warning("SkillSaver:GenerateEffect() ; Could not edit coin impact.\n" + ex);
}
try
{
restockEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/EquipmentRestockEffect.prefab").WaitForCompletion(), "SkillStock");
((Component)restockEffect.transform.Find("Light")).gameObject.GetComponent<Light>().color = new Color(0.1f, 0.6f, 1f);
GameObject gameObject = ((Component)restockEffect.transform.Find("MotionEmitter")).gameObject;
((Renderer)((Component)gameObject.transform.Find("SquaresEmitter")).gameObject.GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(0f, 0.5f, 1f));
((Renderer)((Component)gameObject.transform.Find("FlashEmitter")).gameObject.GetComponent<ParticleSystemRenderer>()).material.SetColor("_TintColor", new Color(0.1f, 0.6f, 1f));
ContentAddition.AddEffect(restockEffect);
}
catch (Exception ex2)
{
Log.Warning("SkillSaver:GenerateEffect() ; Could not edit restock effect.\n" + ex2);
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
SkillDef.OnExecute += new Manipulator(SkillDef_OnExecute);
MercDashSkillDef.OnExecute += new hook_OnExecute(MercDashSkillDef_OnExecute);
}
private static void GenericSkill_DeductStock(orig_DeductStock orig, GenericSkill self, int count)
{
//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_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Expected O, but got Unknown
if (Object.op_Implicit((Object)(object)self.characterBody) && Object.op_Implicit((Object)(object)self.characterBody.inventory) && Object.op_Implicit((Object)(object)self.characterBody.master))
{
int itemCountEffective = self.characterBody.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0)
{
int num = count;
float num2 = (float)itemCountEffective * ConfigManager.SkillSaver_chance.Value / ((float)itemCountEffective * ConfigManager.SkillSaver_chance.Value + 100f) * 100f;
for (int i = 0; i < count; i++)
{
count -= (Util.CheckRoll(num2, self.characterBody.master) ? 1 : 0);
}
if (num != count)
{
Util.PlaySound("Play_UI_equipment_activate", ((Component)self.characterBody).gameObject);
EffectData val = new EffectData
{
scale = 1f,
origin = self.characterBody.corePosition
};
EffectManager.SpawnEffect(pillEffect, val, true);
val.SetNetworkedObjectReference(((Component)self.characterBody).gameObject);
EffectManager.SpawnEffect(restockEffect, val, true);
}
}
}
orig.Invoke(self, count);
}
private static void MercDashSkillDef_OnExecute(orig_OnExecute orig, MercDashSkillDef self, GenericSkill skillSlot)
{
//IL_0075: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00bc: 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)
orig.Invoke(self, skillSlot);
CharacterBody characterBody = skillSlot.characterBody;
if (Object.op_Implicit((Object)(object)characterBody))
{
int itemCountEffective = characterBody.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0 && Util.CheckRoll((float)itemCountEffective * ConfigManager.SkillSaver_chance.Value / ((float)itemCountEffective * ConfigManager.SkillSaver_chance.Value + 100f) * 100f, characterBody.master))
{
Util.PlaySound("Play_UI_equipment_activate", ((Component)characterBody).gameObject);
EffectData val = new EffectData
{
scale = 1f,
origin = characterBody.corePosition
};
EffectManager.SpawnEffect(pillEffect, val, true);
val.SetNetworkedObjectReference(((Component)characterBody).gameObject);
EffectManager.SpawnEffect(restockEffect, val, true);
InstanceData val2 = (InstanceData)skillSlot.skillInstanceData;
skillSlot.stock += 1;
val2.waitingForHit = false;
val2.hasExtraStock = true;
}
}
}
private static void EquipmentSlot_OnEquipmentExecuted(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
try
{
val.GotoNext((MoveType)2, new Func<Instruction, bool>[5]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<EquipmentSlot>(x, "inventory"),
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EquipmentSlot>(x, "get_activeEquipmentSlot"),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1)
});
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<int, EquipmentSlot, int>>((Func<int, EquipmentSlot, int>)((int i, EquipmentSlot c) => TryPreventStockConsumption(i, c.characterBody)));
}
catch (Exception e)
{
Helpers.ErrorHookFailed("Add equip save chance", e);
}
}
private static void SkillDef_OnExecute(ILContext il)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
try
{
val.GotoNext((MoveType)2, new Func<Instruction, bool>[5]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchDup(x),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GenericSkill>(x, "get_stock"),
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<SkillDef>(x, "stockToConsume")
});
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Func<int, GenericSkill, int>>((Func<int, GenericSkill, int>)((int i, GenericSkill c) => (c.skillDef is MercDashSkillDef || (!(c.baseRechargeInterval > 0f) && c.rechargeStock != 0)) ? i : TryPreventStockConsumption(i, c.characterBody)));
}
catch (Exception e)
{
Helpers.ErrorHookFailed("Add skill save chance", e);
}
}
private static int TryPreventStockConsumption(int stocksToConsume, CharacterBody characterBody)
{
//IL_0084: 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_0094: 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_00a1: Expected O, but got Unknown
if (stocksToConsume > 0 && Object.op_Implicit((Object)(object)characterBody.master) && Object.op_Implicit((Object)(object)characterBody.inventory))
{
int itemCountEffective = characterBody.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0 && Util.CheckRoll((float)itemCountEffective * ConfigManager.SkillSaver_chance.Value / ((float)itemCountEffective * ConfigManager.SkillSaver_chance.Value + 100f) * 100f, characterBody.master))
{
Util.PlaySound("Play_UI_equipment_activate", ((Component)characterBody).gameObject);
EffectData val = new EffectData
{
scale = 1f,
origin = characterBody.corePosition
};
EffectManager.SpawnEffect(pillEffect, val, true);
val.SetNetworkedObjectReference(((Component)characterBody).gameObject);
EffectManager.SpawnEffect(restockEffect, val, true);
return 0;
}
}
return stocksToConsume;
}
}
public static class HealFromBleedVoid
{
public static ItemDef itemDef;
private static GameObject healBurstPrefab;
internal static void Init()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
Log.Info("Initializing Royal Tick Item");
itemDef = Helpers.GetItemDef("HealFromBleedVoid");
if (ConfigManager.HealFromBleed_isEnabled.Value)
{
itemDef.AddContagiousRelationship(HealFromBleed.itemDef);
}
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
healBurstPrefab = generateEffects();
ContentAddition.AddEffect(healBurstPrefab);
Hooks();
Log.Info("Royal Tick Initialized");
}
private static GameObject generateEffects()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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_0075: 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_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: 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_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: 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_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_0316: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_033d: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_0363: Unknown result type (might be due to invalid IL or missing references)
//IL_0368: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0388: Unknown result type (might be due to invalid IL or missing references)
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_039e: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
Color val = default(Color);
((Color)(ref val))..ctor(87.1f, 67.8f, 98f);
Gradient val2 = new Gradient();
val2.mode = (GradientMode)0;
val2.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
{
new GradientAlphaKey
{
alpha = 181f,
time = 0f
},
new GradientAlphaKey
{
alpha = 0f,
time = 1f
}
};
val2.colorKeys = (GradientColorKey[])(object)new GradientColorKey[2]
{
new GradientColorKey
{
color = val,
time = 0f
},
new GradientColorKey
{
color = new Color(0f, 0f, 0f),
time = 1f
}
};
GameObject obj = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/EliteEarth/AffixEarthHealExplosion.prefab").WaitForCompletion(), "VoidHealPulse");
Texture val3 = Addressables.LoadAssetAsync<Texture>((object)"RoR2/Base/Common/ColorRamps/texRampNullifierSmooth.png").WaitForCompletion();
GameObject obj2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MushroomVoid/MushroomVoidEffect.prefab").WaitForCompletion();
ParticleSystem component = ((Component)obj2.transform.Find("Visual/Stars")).gameObject.GetComponent<ParticleSystem>();
ParticleSystemRenderer component2 = ((Component)obj2.transform.Find("Visual/Stars")).gameObject.GetComponent<ParticleSystemRenderer>();
Object.Destroy((Object)(object)((Component)obj.transform.Find("Flash, White")).gameObject);
Object.Destroy((Object)(object)((Component)obj.transform.Find("Flash, Blue")).gameObject);
((Renderer)((Component)obj.transform.Find("Chunks")).gameObject.GetComponent<ParticleSystemRenderer>()).material.SetTexture("_RemapTex", val3);
Light component3 = ((Component)obj.transform.Find("Point Light")).gameObject.GetComponent<Light>();
component3.color = val;
component3.range = 1f;
((Renderer)((Component)obj.transform.Find("Nova Sphere")).gameObject.GetComponent<ParticleSystemRenderer>()).material.SetTexture("_RemapTex", val3);
ParticleSystem component4 = ((Component)obj.transform.Find("LightShafts")).gameObject.GetComponent<ParticleSystem>();
MainModule main = component4.main;
((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(val);
ColorOverLifetimeModule colorOverLifetime = component4.colorOverLifetime;
((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val2);
((Renderer)((Component)obj.transform.Find("Rapid Small FLash, Blue")).gameObject.GetComponent<ParticleSystemRenderer>()).materials = ((Renderer)component2).materials;
ParticleSystem component5 = ((Component)obj.transform.Find("Rapid Small FLash, Blue")).gameObject.GetComponent<ParticleSystem>();
MainModule main2 = component5.main;
((MainModule)(ref main2)).maxParticles = 100;
((MainModule)(ref main2)).startLifetime = MinMaxCurve.op_Implicit(0.5f);
RotationOverLifetimeModule rotationOverLifetime = component5.rotationOverLifetime;
((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true;
RotationOverLifetimeModule rotationOverLifetime2 = component.rotationOverLifetime;
((RotationOverLifetimeModule)(ref rotationOverLifetime)).x = ((RotationOverLifetimeModule)(ref rotationOverLifetime2)).x;
rotationOverLifetime2 = component.rotationOverLifetime;
((RotationOverLifetimeModule)(ref rotationOverLifetime)).y = ((RotationOverLifetimeModule)(ref rotationOverLifetime2)).y;
rotationOverLifetime2 = component.rotationOverLifetime;
((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = ((RotationOverLifetimeModule)(ref rotationOverLifetime2)).z;
rotationOverLifetime2 = component.rotationOverLifetime;
((RotationOverLifetimeModule)(ref rotationOverLifetime)).xMultiplier = ((RotationOverLifetimeModule)(ref rotationOverLifetime2)).xMultiplier;
rotationOverLifetime2 = component.rotationOverLifetime;
((RotationOverLifetimeModule)(ref rotationOverLifetime)).yMultiplier = ((RotationOverLifetimeModule)(ref rotationOverLifetime2)).yMultiplier;
rotationOverLifetime2 = component.rotationOverLifetime;
((RotationOverLifetimeModule)(ref rotationOverLifetime)).zMultiplier = ((RotationOverLifetimeModule)(ref rotationOverLifetime2)).zMultiplier;
ColorOverLifetimeModule colorOverLifetime2 = component5.colorOverLifetime;
((ColorOverLifetimeModule)(ref colorOverLifetime2)).enabled = true;
ColorOverLifetimeModule colorOverLifetime3 = component.colorOverLifetime;
((ColorOverLifetimeModule)(ref colorOverLifetime2)).color = ((ColorOverLifetimeModule)(ref colorOverLifetime3)).color;
SizeOverLifetimeModule sizeOverLifetime = component5.sizeOverLifetime;
((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true;
SizeOverLifetimeModule sizeOverLifetime2 = component.sizeOverLifetime;
((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = ((SizeOverLifetimeModule)(ref sizeOverLifetime2)).size;
MainModule main3 = component.main;
((MainModule)(ref main2)).startColor = ((MainModule)(ref main3)).startColor;
EffectComponent val4 = default(EffectComponent);
obj.TryGetComponent<EffectComponent>(ref val4);
val4.applyScale = true;
return obj;
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy);
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
private static void GlobalEventManager_ProcessHitEnemy(ILContext il)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
int needleTickCountLoc = -1;
int inventoryLoc = -1;
try
{
val.GotoNext((MoveType)2, new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref inventoryLoc),
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BleedOnHitVoid"),
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref needleTickCountLoc)
});
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "procCoefficient")
});
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, needleTickCountLoc)
});
val.GotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 10f),
(Instruction x) => ILPatternMatchingExt.MatchMul(x)
});
val.Emit(OpCodes.Ldloc, inventoryLoc);
val.EmitDelegate<Func<Inventory, float>>((Func<Inventory, float>)GetExtraCollapseChance);
val.Emit(OpCodes.Add);
}
catch (Exception e)
{
Helpers.ErrorHookFailed("Add base collapse chance", e);
}
}
private static float GetExtraCollapseChance(Inventory inventory)
{
if (inventory.GetItemCountEffective(itemDef) <= 0)
{
return 0f;
}
return 5f;
}
private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Invalid comparison between Unknown and I4
CharacterBody val = default(CharacterBody);
if (!damageInfo.rejected && (int)damageInfo.dotIndex == 8 && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory))
{
int itemCountEffective = val.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0 && Object.op_Implicit((Object)(object)val.healthComponent))
{
_ = val.healthComponent;
FireHealBurst(((float)(itemCountEffective - 1) * ConfigManager.HealFromBleedVoid_percentPerStack.Value + ConfigManager.HealFromBleedVoid_percentBase.Value) * damageInfo.damage / val.damage, itemCountEffective, val);
}
}
orig.Invoke(self, damageInfo);
}
private static void FireHealBurst(float fractionalHeal, int stack, CharacterBody body)
{
//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_0036: 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_0043: Expected O, but got Unknown
//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_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_0064: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0080: 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_00a3: 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_00db: Unknown result type (might be due to invalid IL or missing references)
if (stack <= 0)
{
Log.Warning("FireHealBurst called with no stacks");
return;
}
float num = ConfigManager.HealFromBleedVoid_radiusBase.Value + ConfigManager.HealFromBleedVoid_radiusPerStack.Value * (float)(stack - 1);
EffectData val = new EffectData
{
scale = num,
origin = body.corePosition
};
EffectManager.SpawnEffect(healBurstPrefab, val, true);
SphereSearch val2 = new SphereSearch
{
mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
origin = body.corePosition,
queryTriggerInteraction = (QueryTriggerInteraction)2,
radius = num
};
TeamMask val3 = default(TeamMask);
((TeamMask)(ref val3)).AddTeam(body.teamComponent.teamIndex);
List<HurtBox> list = new List<HurtBox>();
val2.RefreshCandidates().FilterCandidatesByHurtBoxTeam(val3).FilterCandidatesByDistinctHurtBoxEntities()
.GetHurtBoxes(list);
int i = 0;
for (int count = list.Count; i < count; i++)
{
HealthComponent healthComponent = list[i].healthComponent;
healthComponent.HealFraction(fractionalHeal, default(ProcChainMask));
Util.PlaySound("Play_item_proc_TPhealingNova_hitPlayer", ((Component)healthComponent).gameObject);
}
}
}
public static class ExplosionFrenzy
{
public class BraqsItems_ExplosionFrenzyBehavior : ItemBehavior
{
private int maxBonus;
public int bonus;
private List<BraqsItems_BurnTracker> victims = new List<BraqsItems_BurnTracker>();
private void Start()
{
maxBonus = ConfigManager.ExplosionFrenzy_bonusCapPerStack.Value * (base.stack - 1) + ConfigManager.ExplosionFrenzy_bonusCapBase.Value;
}
private void OnDestroy()
{
}
public void AddVictim(GameObject victim)
{
BraqsItems_BurnTracker braqsItems_BurnTracker = default(BraqsItems_BurnTracker);
victim.TryGetComponent<BraqsItems_BurnTracker>(ref braqsItems_BurnTracker);
if (!Object.op_Implicit((Object)(object)braqsItems_BurnTracker))
{
braqsItems_BurnTracker = victim.AddComponent<BraqsItems_BurnTracker>();
braqsItems_BurnTracker.victimBodyObject = victim;
}
else if (victims.Contains(braqsItems_BurnTracker))
{
return;
}
braqsItems_BurnTracker.AddAttacker(this);
victims.Add(braqsItems_BurnTracker);
ApplyBonus();
}
public void RemoveVictim(BraqsItems_BurnTracker victim)
{
victims.Remove(victim);
ApplyBonus();
}
private void ApplyBonus()
{
bonus = Math.Min(victims.Count, maxBonus);
base.body.RecalculateStats();
}
}
public class BraqsItems_BurnTracker : MonoBehaviour
{
public List<BraqsItems_ExplosionFrenzyBehavior> attackers = new List<BraqsItems_ExplosionFrenzyBehavior>();
public GameObject victimBodyObject;
private CharacterBody victimCharacterBody;
public void Start()
{
victimCharacterBody = (Object.op_Implicit((Object)(object)victimBodyObject) ? victimBodyObject.GetComponent<CharacterBody>() : null);
}
public void OnDestroy()
{
foreach (BraqsItems_ExplosionFrenzyBehavior attacker in attackers)
{
attacker.RemoveVictim(this);
}
}
public void FixedUpdate()
{
if (!Object.op_Implicit((Object)(object)victimCharacterBody) || !victimCharacterBody.HasBuff(Buffs.OnFire))
{
Object.Destroy((Object)(object)this);
}
}
public void AddAttacker(BraqsItems_ExplosionFrenzyBehavior attacker)
{
if (!attackers.Contains(attacker))
{
attackers.Add(attacker);
}
}
}
public static ItemDef itemDef;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (ConfigManager.ExplosionFrenzy_isEnabled.Value)
{
Log.Info("Initializing My Manifesto Item");
itemDef = Helpers.GetItemDef("ExplosionFrenzy");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
Log.Info("My Manifesto Initialized");
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(CharacterBody_OnInventoryChanged);
BlastAttack.Fire += new hook_Fire(BlastAttack_Fire);
DotController.onDotInflictedServerGlobal += new OnDotInflictedServerGlobalDelegate(DotController_onDotInflictedServerGlobal);
Stats.StatsCompEvent.StatsCompRecalc = (EventHandler<Stats.StatsCompRecalcArgs>)Delegate.Combine(Stats.StatsCompEvent.StatsCompRecalc, new EventHandler<Stats.StatsCompRecalcArgs>(StatsCompEvent_StatsCompRecalc));
}
private static void DotController_onDotInflictedServerGlobal(DotController dotController, ref InflictDotInfo inflictDotInfo)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Invalid comparison between Unknown and I4
CharacterEvents.BraqsItems_CharacterEventComponent braqsItems_CharacterEventComponent = default(CharacterEvents.BraqsItems_CharacterEventComponent);
CharacterBody val = default(CharacterBody);
BraqsItems_ExplosionFrenzyBehavior braqsItems_ExplosionFrenzyBehavior = default(BraqsItems_ExplosionFrenzyBehavior);
if (((int)inflictDotInfo.dotIndex == 1 || (int)inflictDotInfo.dotIndex == 7) && Object.op_Implicit((Object)(object)dotController.victimBody) && Object.op_Implicit((Object)(object)dotController.victimHealthComponent) && dotController.victimHealthComponent.alive && Object.op_Implicit((Object)(object)dotController.victimBody.master) && ((Component)dotController.victimBody.master).TryGetComponent<CharacterEvents.BraqsItems_CharacterEventComponent>(ref braqsItems_CharacterEventComponent) && inflictDotInfo.attackerObject.TryGetComponent<CharacterBody>(ref val) && ((Component)val).TryGetComponent<BraqsItems_ExplosionFrenzyBehavior>(ref braqsItems_ExplosionFrenzyBehavior))
{
braqsItems_ExplosionFrenzyBehavior.AddVictim(dotController.victimObject);
}
}
private static void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self)
{
self.AddItemBehavior<BraqsItems_ExplosionFrenzyBehavior>(self.inventory.GetItemCountEffective(itemDef));
orig.Invoke(self);
}
private static Result BlastAttack_Fire(orig_Fire orig, BlastAttack self)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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_0113: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
Result val = orig.Invoke(self);
CharacterBody val2 = default(CharacterBody);
if (Object.op_Implicit((Object)(object)self.attacker) && self.attacker.TryGetComponent<CharacterBody>(ref val2) && Object.op_Implicit((Object)(object)val2.inventory))
{
int itemCountEffective = val2.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0 && val.hitCount > 0)
{
float value = ((float)(itemCountEffective - 1) * ConfigManager.ExplosionFrenzy_igniteDamagePerStack.Value + ConfigManager.ExplosionFrenzy_igniteDamageBase.Value) * self.baseDamage;
for (int i = 0; i < val.hitCount; i++)
{
HurtBox hurtBox = val.hitPoints[i].hurtBox;
if (Object.op_Implicit((Object)(object)hurtBox.healthComponent))
{
InflictDotInfo val3 = default(InflictDotInfo);
val3.victimObject = ((Component)hurtBox.healthComponent).gameObject;
val3.attackerObject = self.attacker;
val3.totalDamage = value;
val3.dotIndex = (DotIndex)1;
val3.damageMultiplier = 1f;
InflictDotInfo val4 = val3;
StrengthenBurnUtils.CheckDotForUpgrade(val2.inventory, ref val4);
DotController.InflictDot(ref val4);
}
}
}
}
return val;
}
public static void StatsCompEvent_StatsCompRecalc(object sender, Stats.StatsCompRecalcArgs args)
{
BraqsItems_ExplosionFrenzyBehavior braqsItems_ExplosionFrenzyBehavior = default(BraqsItems_ExplosionFrenzyBehavior);
if (Object.op_Implicit((Object)(object)args.Stats) && NetworkServer.active && Object.op_Implicit((Object)(object)args.Stats.body) && ((Component)args.Stats.body).TryGetComponent<BraqsItems_ExplosionFrenzyBehavior>(ref braqsItems_ExplosionFrenzyBehavior))
{
int bonus = braqsItems_ExplosionFrenzyBehavior.bonus;
if (bonus > 0)
{
args.Stats.blastRadiusBoostAdd *= (float)bonus * ConfigManager.ExplosionFrenzy_bonusPerBurn.Value + 1f;
}
}
}
}
public static class HundredRendingFists
{
public class BraqsItems_RendController : MonoBehaviour
{
private class DamageStore
{
public GameObject attackerObject;
public float damage;
public float damageCoefficient;
}
private GameObject delayedDamageIndicator;
private List<DamageStore> damageStores = new List<DamageStore>();
public float storeBonus;
private bool firstStackApplied;
public CharacterBody body;
public HealthComponent healthComponent;
private void Start()
{
CharacterBody val = default(CharacterBody);
if (((Component)this).gameObject.TryGetComponent<CharacterBody>(ref val))
{
body = val;
healthComponent = body.healthComponent;
}
else
{
Object.Destroy((Object)(object)this);
}
}
private void OnDestroy()
{
if (Object.op_Implicit((Object)(object)delayedDamageIndicator))
{
Object.Destroy((Object)(object)delayedDamageIndicator);
}
}
private void FixedUpdate()
{
if (!body.HasBuff(RendDebuff) && firstStackApplied)
{
DealStoredDamage();
}
}
public static void ApplyRend(GameObject attacker, CharacterBody victim, DamageInfo damage, float damageCoefficient)
{
BraqsItems_RendController braqsItems_RendController = default(BraqsItems_RendController);
((Component)victim).TryGetComponent<BraqsItems_RendController>(ref braqsItems_RendController);
if (!Object.op_Implicit((Object)(object)braqsItems_RendController))
{
braqsItems_RendController = ((Component)victim).gameObject.AddComponent<BraqsItems_RendController>();
braqsItems_RendController.body = victim;
}
braqsItems_RendController.StoreDamage(attacker, damage, damageCoefficient);
braqsItems_RendController.firstStackApplied = true;
}
private void StoreDamage(GameObject attacker, DamageInfo damageInfo, float damageCoefficient)
{
bool flag = true;
float damage = damageInfo.damage;
for (int i = 0; i < damageStores.Count; i++)
{
if ((Object)(object)damageStores[i].attackerObject == (Object)(object)attacker)
{
damageStores[i].damage += damage;
damageStores[i].damageCoefficient = damageCoefficient;
flag = false;
}
}
if (flag)
{
damageStores.Add(new DamageStore
{
attackerObject = attacker,
damage = damage,
damageCoefficient = damageCoefficient
});
}
storeBonus += damageInfo.procCoefficient;
UpdateBuffStacks();
}
private void DealStoredDamage()
{
//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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Expected O, but got Unknown
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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)
//IL_00e0: 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_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)healthComponent))
{
float num = storeBonus * ConfigManager.HundredRendingFists_storeBonus.Value;
float scale = Mathf.Min(ConfigManager.HundredRendingFists_storedDamageBase.Value + num, 3f);
EffectManager.SpawnEffect(delayedDamageActivateEffect, new EffectData
{
origin = body.corePosition,
color = Color32.op_Implicit(Color.white),
scale = scale
}, true);
for (int i = 0; i < damageStores.Count; i++)
{
DamageStore damageStore = damageStores[i];
DamageInfo val = new DamageInfo();
val.crit = false;
val.damage = damageStore.damage * (damageStore.damageCoefficient + num);
val.force = Vector3.zero;
val.inflictor = ((Component)this).gameObject;
val.position = body.corePosition;
val.procCoefficient = 0f;
val.damageColorIndex = (DamageColorIndex)8;
val.damageType = DamageTypeCombo.op_Implicit((DamageType)67108864);
val.attacker = damageStore.attackerObject;
healthComponent.TakeDamage(val);
}
}
Object.Destroy((Object)(object)this);
}
private void UpdateBuffStacks()
{
//IL_0022: 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)
float value = ConfigManager.HundredRendingFists_rendDuration.Value;
for (int i = 0; i < body.timedBuffs.Count; i++)
{
TimedBuff val = body.timedBuffs[i];
if (val.buffIndex == RendDebuff.buffIndex)
{
val.timer = value;
}
}
for (int j = 0; (float)j < storeBonus - (float)body.GetBuffCount(RendDebuff); j++)
{
body.AddTimedBuff(RendDebuff, value);
}
}
}
public static ItemDef itemDef;
public static BuffDef RendDebuff;
private static GameObject delayedDamageActivateEffect;
private static GameObject delayedDamageEffect;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
if (ConfigManager.HundredRendingFists_isEnabled.Value)
{
Log.Info("Initializing North Star Hand Wraps Item");
itemDef = Helpers.GetItemDef("HundredRendingFists");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
RendDebuff = ScriptableObject.CreateInstance<BuffDef>();
((Object)RendDebuff).name = "Rend";
RendDebuff.canStack = true;
RendDebuff.isHidden = false;
RendDebuff.isDebuff = true;
RendDebuff.buffColor = Color.white;
RendDebuff.isCooldown = false;
RendDebuff.iconSprite = BraqsItemsMain.assetBundle.LoadAsset<Sprite>("texBuffRendIcon");
ContentAddition.AddBuffDef(RendDebuff);
delayedDamageEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Items/DelayedDamage/DelayedDamageIndicator.prefab").WaitForCompletion();
delayedDamageActivateEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/BleedOnHitVoid/FractureImpactEffect.prefab").WaitForCompletion();
Hooks();
Log.Info("North Star Hand Wraps Initialized");
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy);
}
private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
{
CharacterBody val = default(CharacterBody);
CharacterBody val2 = default(CharacterBody);
if (!damageInfo.rejected && damageInfo.procCoefficient > 0f && Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory) && victim.TryGetComponent<CharacterBody>(ref val2) && Object.op_Implicit((Object)(object)val2.healthComponent))
{
int itemCountEffective = val.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0 && Object.op_Implicit((Object)(object)val.master))
{
float damageCoefficient = (float)(itemCountEffective - 1) * ConfigManager.HundredRendingFists_storedDamagePerStack.Value + ConfigManager.HundredRendingFists_storedDamageBase.Value;
BraqsItems_RendController.ApplyRend(damageInfo.attacker, val2, damageInfo, damageCoefficient);
}
}
orig.Invoke(self, damageInfo, victim);
}
}
public static class LightningDamageBoost
{
public static ItemDef itemDef;
private static DamageColorIndex chargedColor;
internal static void Init()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
if (ConfigManager.InductionCoil_isEnabled.Value)
{
Log.Info("Initializing Induction Coil Item");
itemDef = Helpers.GetItemDef("LightningDamageBoost");
ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
ItemAPI.Add(new CustomItem(itemDef, val));
Hooks();
chargedColor = ColorsAPI.RegisterDamageColor(new Color(0.37f, 0.5f, 0.924f));
Log.Info("Induction Coil Initialized");
}
}
private static void Hooks()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
LightningOrb.Begin += new hook_Begin(LightningOrb_Begin);
VoidLightningOrb.Begin += new hook_Begin(VoidLightningOrb_Begin);
}
private static void VoidLightningOrb_Begin(orig_Begin orig, VoidLightningOrb self)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
CharacterBody val = default(CharacterBody);
if (Object.op_Implicit((Object)(object)self.attacker) && self.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory))
{
int itemCountEffective = val.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0)
{
self.damageColorIndex = chargedColor;
self.damageValue *= 1f + (float)(itemCountEffective - 1) * ConfigManager.InductionCoil_damageBonusPerStack.Value + ConfigManager.InductionCoil_damageBonusBase.Value;
}
}
orig.Invoke(self);
}
private static void LightningOrb_Begin(orig_Begin orig, LightningOrb self)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
CharacterBody val = default(CharacterBody);
if (Object.op_Implicit((Object)(object)self.attacker) && self.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory))
{
int itemCountEffective = val.inventory.GetItemCountEffective(itemDef);
if (itemCountEffective > 0)
{
self.damageColorIndex = chargedColor;
self.damageValue *= 1f + (float)(itemCountEffective - 1) * ConfigManager.InductionCoil_damageBonusPerStack.Value + ConfigManager.InductionCoil_damageBonusBase.Value;
}
}
orig.Invoke(self);
}
}
public class ConfigManager
{
public static ConfigEntry<string> ConfigVersion;
public static ConfigEntry<bool> AttackSpeedOnHit_isEnabled;
public static ConfigEntry<float> AttackSpeedOnHit_percentPerStack;
public static ConfigEntry<float> AttackSpeedOnHit_percentBase;
public static ConfigEntry<bool> BiggerExplosions_isEnabled;
public static ConfigEntry<float> BiggerExplosions_percentPerStack;
public static ConfigEntry<float> BiggerExplosions_percentBase;
public static ConfigEntry<bool> LightningOnOverkill_isEnabled;
public static ConfigEntry<float> LightningOnOverkill_damagePercentPerStack;
public static ConfigEntry<float> LightningOnOverkill_damagePercentBase;
public static ConfigEntry<int> LightningOnOverkill_bouncePerStack;
public st