using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.BeetleGuardMonster;
using On.RoR2;
using On.RoR2.Items;
using QueenGlandBuff.Changes;
using QueenGlandBuff.Modules;
using QueenGlandBuff.States;
using QueenGlandBuff.Utils;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Items;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("QueenGlandBuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("QueenGlandBuff")]
[assembly: AssemblyTitle("QueenGlandBuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace QueenGlandBuff
{
public static class Configs
{
public static ConfigFile MainConfig;
private const string Section_Queens_Gland = "Queens Gland";
private const string Section_Primary_Skill = "Primary Skill - Slam";
private const string Section_Secondary_Skill = "Secondary Skill - Sunder";
private const string Section_Special_Skill = "Special Skill - Valor";
private const string Section_Stats_Base = "Beetle Guard Ally Stats Base";
private const string Section_Stats_Level = "Beetle Guard Ally Stats Level";
private const string Section_Misc = "Misc";
public static string ConfigFolderPath => Path.Combine(Paths.ConfigPath, MainPlugin.pluginInfo.Metadata.GUID);
public static void Setup()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
MainConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "MainConfig.cfg"), true);
Read_Queens_Gland();
Read_Primary_SKill();
Read_Secondary_SKill();
Read_Special_SKill();
Read_Beetle_Stats();
Read_Misc();
}
private static void Read_Queens_Gland()
{
QueensGland.Enable = MainConfig.Bind<bool>("Queens Gland", "Enable Changes", true, "Enable changes to the Queens Gland item.").Value;
QueensGland.MaxSummons = MainConfig.Bind<int>("Queens Gland", "Max Summons", 1, "The Max amount of Beetle Guards each player can have.").Value;
QueensGland.RespawnTime = MainConfig.Bind<int>("Queens Gland", "Respawn Time", 30, "How long it takes for Beetle Guards to respawn.").Value;
QueensGland.BaseHealth = MainConfig.Bind<int>("Queens Gland", "BaseHealth", 10, "Extra health at a single stack. (1 = +10%)").Value;
QueensGland.StackHealth = MainConfig.Bind<int>("Queens Gland", "StackHealth", 10, "Extra Health to give per stack after capping out the max summons. (1 = +10%)").Value;
QueensGland.BaseDamage = MainConfig.Bind<int>("Queens Gland", "BaseDamage", 10, "Extra damage at a single stack. (1 = +10%)").Value;
QueensGland.StackDamage = MainConfig.Bind<int>("Queens Gland", "StackDamage", 20, "Extra Damage to give per stack after capping out the max summons. (1 = +10%)").Value;
QueensGland.AffixMode = MainConfig.Bind<int>("Queens Gland", "Become Elite", 1, "Makes Beetle Guard Ally spawn with an Elite Affix. (0 = never, 1 = always, 2 = only during Honor)").Value;
QueensGland.DefaultAffixName = MainConfig.Bind<string>("Queens Gland", "Default Elite", "EliteFireEquipment", "The Fallback equipment to give if an Elite Affix wasn't selected. (Set to None to disable)").Value;
QueensGland.AffixBlackList_Raw = MainConfig.Bind<string>("Queens Gland", "Elite Blacklist", "", "List of Elite Equipment the Beetle Guard cannot select. ('EliteAurelioniteEquipment, EliteLunarEquipment' for example disables Gilded and Perfected)").Value;
}
private static void Read_Primary_SKill()
{
BeetleGuardAlly.Enable_Slam_Skill = MainConfig.Bind<bool>("Primary Skill - Slam", "Enable Slam Changes", true, "Enable changes to its Slam skill.").Value;
}
private static void Read_Secondary_SKill()
{
BeetleGuardAlly.Enable_Sunder_Skill = MainConfig.Bind<bool>("Secondary Skill - Sunder", "Enable Sunder Changes", true, "Enable changes to its Sunder skill.").Value;
}
private static void Read_Special_SKill()
{
BeetleGuardAlly.Enable_Valor_Skill = MainConfig.Bind<bool>("Special Skill - Valor", "Enable Valor Changes", true, "Enable the custom Valor skill.").Value;
ValorBuff.Aggro_Range = MainConfig.Bind<float>("Special Skill - Valor", "Aggro Range", 60f, "Regular enemies within this range will aggro onto affected characters.").Value;
ValorBuff.Buff_Armor = MainConfig.Bind<float>("Special Skill - Valor", "Armor", 100f, "The amount of armor the user of this buff gets.").Value;
}
private static void Read_Beetle_Stats()
{
BeetleGuardAlly.Stats_Base_Health = MainConfig.Bind<float>("Beetle Guard Ally Stats Base", "Health", 480f, "Health at level 1. (Vanilla = 480)").Value;
BeetleGuardAlly.Stats_Base_Damage = MainConfig.Bind<float>("Beetle Guard Ally Stats Base", "Damage", 12f, "Damage at level 1. (Vanilla = 14)").Value;
BeetleGuardAlly.Stats_Base_Regen = MainConfig.Bind<float>("Beetle Guard Ally Stats Base", "Regen", 5f, "Regen at level 1. (Vanilla = 0.6)").Value;
BeetleGuardAlly.Stats_Level_Health = MainConfig.Bind<float>("Beetle Guard Ally Stats Level", "Health", 144f, "Health gained per level. (Vanilla = 144)").Value;
BeetleGuardAlly.Stats_Level_Damage = MainConfig.Bind<float>("Beetle Guard Ally Stats Level", "Damage", 2.4f, "Damage gained per level. (Vanilla = 2.4)").Value;
BeetleGuardAlly.Stats_Level_Regen = MainConfig.Bind<float>("Beetle Guard Ally Stats Level", "Regen", 1f, "Regen gained per level. (Vanilla = 0.12)").Value;
}
private static void Read_Misc()
{
BeetleGuardAlly.Elite_Skills = MainConfig.Bind<bool>("Misc", "Elite Skills", true, "Changes how some of its skills function based on its Aspect.").Value;
}
}
[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.*/)]
[BepInPlugin("com.kking117.QueenGlandBuff", "QueenGlandBuff", "1.5.4")]
public class MainPlugin : BaseUnityPlugin
{
public const string MODUID = "com.kking117.QueenGlandBuff";
public const string MODNAME = "QueenGlandBuff";
public const string MODVERSION = "1.5.4";
public const string MODTOKEN = "KKING117_QUEENGLANDBUFF_";
internal static ManualLogSource ModLogger;
public static PluginInfo pluginInfo;
internal static SceneDef BazaarSceneDef;
internal static bool RiskyMod_Loaded;
private void Awake()
{
ModLogger = ((BaseUnityPlugin)this).Logger;
pluginInfo = ((BaseUnityPlugin)this).Info;
Configs.Setup();
BeetleGuardAlly.Begin();
if (QueensGland.Enable)
{
QueensGland.Begin();
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Initializing ContentPack.");
new ContentPacks().Initialize();
((ResourceAvailability)(ref GameModeCatalog.availability)).CallWhenAvailable((Action)PostLoad);
}
private void PostLoad()
{
if (QueensGland.Enable)
{
QueensGland.PostLoad();
}
BazaarSceneDef = SceneCatalog.FindSceneDef("bazaar");
}
}
}
namespace QueenGlandBuff.Utils
{
internal class Helpers
{
private static readonly Random rng = new Random();
internal static void GiveRandomEliteAffix(CharacterMaster self)
{
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
if (QueensGland.AffixMode == 0 || (QueensGland.AffixMode == 2 && !RunArtifactManager.instance.IsArtifactEnabled(Artifacts.EliteOnly)))
{
return;
}
if (QueensGland.StageEliteEquipmentDefs.Count > 0)
{
int index = rng.Next(QueensGland.StageEliteEquipmentDefs.Count);
if (Object.op_Implicit((Object)(object)QueensGland.StageEliteEquipmentDefs[index]))
{
self.inventory.SetEquipmentIndex(QueensGland.StageEliteEquipmentDefs[index].equipmentIndex);
return;
}
}
self.inventory.SetEquipmentIndex(QueensGland.DefaultAffixIndex);
}
}
}
namespace QueenGlandBuff.States
{
public class Slam : BaseSkillState
{
public static float baseDuration = 1.75f;
public static float soundtime = 3.5f;
public static float damageCoefficient = 4f;
public static float forceMagnitude = 16f;
public static float RockDamageCoefficient = 1.25f;
public static int RockCount = 3;
public static float RockSpeed = 25f;
private static float RockRotateOffset = 9f;
private OverlapAttack attack;
public static string initialAttackSoundString = GroundSlam.initialAttackSoundString;
public static GameObject chargeEffectPrefab = GroundSlam.chargeEffectPrefab;
public static GameObject slamEffectPrefab = GroundSlam.slamEffectPrefab;
public static GameObject hitEffectPrefab = GroundSlam.hitEffectPrefab;
private Animator modelAnimator;
private Transform modelTransform;
private bool hasAttacked;
private float duration;
private bool crit;
private GameObject leftHandChargeEffect;
private GameObject rightHandChargeEffect;
private ChildLocator modelChildLocator;
private Transform groundSlamIndicatorInstance;
private void EnableIndicator(Transform indicator)
{
if (Object.op_Implicit((Object)(object)indicator))
{
((Component)indicator).gameObject.SetActive(true);
ObjectScaleCurve component = ((Component)indicator).gameObject.GetComponent<ObjectScaleCurve>();
if (Object.op_Implicit((Object)(object)component))
{
component.time = 0f;
}
}
}
private void DisableIndicator(Transform indicator)
{
if (Object.op_Implicit((Object)(object)indicator))
{
((Component)indicator).gameObject.SetActive(false);
}
}
public override void OnEnter()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_005e: 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_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
modelAnimator = ((EntityState)this).GetModelAnimator();
modelTransform = ((EntityState)this).GetModelTransform();
attack = new OverlapAttack();
attack.attacker = ((EntityState)this).gameObject;
attack.inflictor = ((EntityState)this).gameObject;
attack.teamIndex = TeamComponent.GetObjectTeam(attack.attacker);
attack.damage = damageCoefficient * ((BaseState)this).damageStat;
attack.hitEffectPrefab = hitEffectPrefab;
attack.forceVector = Vector3.up * forceMagnitude;
attack.damageType = DamageTypeCombo.op_Implicit((DamageSource)1);
if (Object.op_Implicit((Object)(object)modelTransform))
{
attack.hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == "GroundSlam");
}
duration = baseDuration / ((BaseState)this).attackSpeedStat;
Util.PlayAttackSpeedSound(initialAttackSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat * (soundtime / duration));
((EntityState)this).PlayAnimation("Body", "GroundSlam", "GroundSlam.playbackRate", duration, 0f);
if (!Object.op_Implicit((Object)(object)modelTransform))
{
return;
}
modelChildLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
if (Object.op_Implicit((Object)(object)modelChildLocator))
{
GameObject val = chargeEffectPrefab;
Transform val2 = modelChildLocator.FindChild("HandL");
Transform val3 = modelChildLocator.FindChild("HandR");
if (Object.op_Implicit((Object)(object)val2))
{
leftHandChargeEffect = Object.Instantiate<GameObject>(val, val2);
}
if (Object.op_Implicit((Object)(object)val3))
{
rightHandChargeEffect = Object.Instantiate<GameObject>(val, val3);
}
groundSlamIndicatorInstance = modelChildLocator.FindChild("GroundSlamIndicator");
EnableIndicator(groundSlamIndicatorInstance);
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
EntityState.Destroy((Object)(object)leftHandChargeEffect);
EntityState.Destroy((Object)(object)rightHandChargeEffect);
DisableIndicator(groundSlamIndicatorInstance);
}
public override void PlayAnimation(string layerName, int animationStateHash)
{
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (Object.op_Implicit((Object)(object)modelAnimator) && modelAnimator.GetFloat("GroundSlam.hitBoxActive") > 0.5f && !hasAttacked)
{
crit = ((EntityState)this).characterBody.RollCrit();
if (NetworkServer.active)
{
attack.isCrit = crit;
attack.Fire((List<HurtBox>)null);
}
if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)modelTransform))
{
FireProjectiles();
}
hasAttacked = true;
EntityState.Destroy((Object)(object)leftHandChargeEffect);
EntityState.Destroy((Object)(object)rightHandChargeEffect);
}
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)2;
}
private void FireProjectiles()
{
DisableIndicator(groundSlamIndicatorInstance);
EffectManager.SimpleMuzzleFlash(slamEffectPrefab, ((EntityState)this).gameObject, "SlamZone", true);
if (((EntityState)this).isAuthority)
{
if (BeetleGuardAlly.Elite_Skills && ((EntityState)this).characterBody.HasBuff(Buffs.AffixLunar))
{
Perfected_SpewRocks();
}
else
{
SpewRocks();
}
}
}
private void Perfected_SpewRocks()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
float num = (float)RockCount * RockDamageCoefficient / 8f;
ProjectileManager.instance.FireProjectile(BeetleGuardAlly.Perfected_Slam_RockProjectile, modelChildLocator.FindChild("GroundSlamIndicator").position, Quaternion.identity, ((EntityState)this).gameObject, ((BaseState)this).damageStat * num, 1f, crit, (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null);
}
private void SpewRocks()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_0090: 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_0098: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = modelChildLocator.FindChild("GroundSlamIndicator").position;
Vector3 forward = ((EntityState)this).characterDirection.forward;
float num = Random.Range(0f, 360f);
for (int i = 0; i < RockCount; i++)
{
Vector3 val = forward;
val = Quaternion.AngleAxis(num + 360f / (float)RockCount * ((float)i - (float)RockCount / 2f), Vector3.up) * forward;
val.y = RockRotateOffset;
FireProjectileInfo val2 = default(FireProjectileInfo);
val2.projectilePrefab = BeetleGuardAlly.Default_RockProjectile;
val2.position = position + ((Vector3)(ref val)).normalized;
val2.rotation = Util.QuaternionSafeLookRotation(val);
val2.owner = ((EntityState)this).gameObject;
val2.damage = ((BaseState)this).damageStat * RockDamageCoefficient;
val2.crit = crit;
val2.force = forceMagnitude;
val2.damageColorIndex = (DamageColorIndex)0;
((FireProjectileInfo)(ref val2)).speedOverride = RockSpeed;
val2.useSpeedOverride = true;
val2.damageTypeOverride = DamageTypeCombo.op_Implicit((DamageSource)1);
FireProjectileInfo val3 = val2;
ProjectileManager.instance.FireProjectile(val3);
}
}
}
public class Sunder : BaseSkillState
{
public static float baseDuration = 1.5f;
public static float soundtime = 3f;
public static float damageCoefficient = 4f;
public static float forceMagnitude = 16f;
public static float RockDamageCoefficient = 1.25f;
public static int RockCount = 3;
public static float RockSpeed = 55f;
public static float RockFanSpreadAngle = 2f;
public static float RockYLocOffset = 1f;
public static float RockYawAdd = 2f;
public static float RockYawOffset = -9f;
public static string initialAttackSoundString = FireSunder.initialAttackSoundString;
public static GameObject chargeEffectPrefab = FireSunder.chargeEffectPrefab;
public static GameObject hitEffectPrefab = FireSunder.hitEffectPrefab;
public static GameObject SunderProjectile = FireSunder.projectilePrefab;
private Animator modelAnimator;
private Transform modelTransform;
private bool hasAttacked;
private float duration;
private bool crit;
private GameObject rightHandChargeEffect;
private ChildLocator modelChildLocator;
private Transform handRTransform;
public override void OnEnter()
{
((BaseState)this).OnEnter();
modelAnimator = ((EntityState)this).GetModelAnimator();
modelTransform = ((EntityState)this).GetModelTransform();
duration = baseDuration / ((BaseState)this).attackSpeedStat;
Util.PlayAttackSpeedSound(initialAttackSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat * (soundtime / duration));
((EntityState)this).PlayAnimation("Body", "FireSunder", "FireSunder.playbackRate", duration, 0f);
if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
{
((EntityState)this).characterBody.SetAimTimer(duration + 2f);
}
if (Object.op_Implicit((Object)(object)modelTransform))
{
AimAnimator component = ((Component)modelTransform).GetComponent<AimAnimator>();
if (Object.op_Implicit((Object)(object)component))
{
((Behaviour)component).enabled = true;
}
modelChildLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
if (Object.op_Implicit((Object)(object)modelChildLocator))
{
GameObject val = chargeEffectPrefab;
handRTransform = modelChildLocator.FindChild("HandR");
if (Object.op_Implicit((Object)(object)handRTransform))
{
rightHandChargeEffect = Object.Instantiate<GameObject>(val, handRTransform);
}
}
}
crit = ((EntityState)this).characterBody.RollCrit();
}
public override void OnExit()
{
((EntityState)this).OnExit();
EntityState.Destroy((Object)(object)rightHandChargeEffect);
if (Object.op_Implicit((Object)(object)modelTransform))
{
AimAnimator component = ((Component)modelTransform).GetComponent<AimAnimator>();
if (Object.op_Implicit((Object)(object)component))
{
((Behaviour)component).enabled = true;
}
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (Object.op_Implicit((Object)(object)modelAnimator) && modelAnimator.GetFloat("FireSunder.activate") > 0.5f && !hasAttacked)
{
if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)modelTransform))
{
FireProjectiles();
}
hasAttacked = true;
EntityState.Destroy((Object)(object)rightHandChargeEffect);
}
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)2;
}
private void FireProjectiles()
{
//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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
if (((EntityState)this).isAuthority)
{
Ray aimRay = ((BaseState)this).GetAimRay();
((Ray)(ref aimRay)).origin = handRTransform.position;
if (BeetleGuardAlly.Elite_Skills && ((EntityState)this).characterBody.HasBuff(Buffs.AffixLunar))
{
Perfected_FanRocks();
FireProjectileInfo val = default(FireProjectileInfo);
val.projectilePrefab = BeetleGuardAlly.Perfected_Sunder_MainProjectile;
val.position = handRTransform.position;
val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
val.owner = ((EntityState)this).gameObject;
val.damage = ((BaseState)this).damageStat * damageCoefficient;
val.crit = crit;
val.force = forceMagnitude;
val.damageColorIndex = (DamageColorIndex)0;
val.damageTypeOverride = DamageTypeCombo.op_Implicit((DamageSource)2);
FireProjectileInfo val2 = val;
ProjectileManager.instance.FireProjectile(val2);
}
else
{
FireProjectileInfo val = default(FireProjectileInfo);
val.projectilePrefab = SunderProjectile;
val.position = handRTransform.position;
val.rotation = Util.QuaternionSafeLookRotation(((Ray)(ref aimRay)).direction);
val.owner = ((EntityState)this).gameObject;
val.damage = ((BaseState)this).damageStat * damageCoefficient;
val.crit = crit;
val.force = forceMagnitude;
val.damageColorIndex = (DamageColorIndex)0;
val.damageTypeOverride = DamageTypeCombo.op_Implicit((DamageSource)2);
FireProjectileInfo val3 = val;
ProjectileManager.instance.FireProjectile(val3);
FanRocks();
}
}
}
private void Perfected_FanRocks()
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
Ray aimRay = ((BaseState)this).GetAimRay();
Ray aimRay2 = ((BaseState)this).GetAimRay();
((Ray)(ref aimRay2)).origin = handRTransform.position;
((Ray)(ref aimRay2)).origin = ((Ray)(ref aimRay2)).origin + new Vector3(0f, RockYLocOffset, 0f);
int num = 5;
float num2 = (float)RockCount * RockDamageCoefficient / (float)num / 5f;
float speedOverride = RockSpeed * 1.25f;
GameObject val = null;
BullseyeSearch val2 = new BullseyeSearch();
val2.searchOrigin = ((Ray)(ref aimRay)).origin;
val2.searchDirection = ((Ray)(ref aimRay)).direction;
val2.maxDistanceFilter = 150f;
val2.maxAngleFilter = 10f;
val2.teamMaskFilter = TeamMask.allButNeutral;
((TeamMask)(ref val2.teamMaskFilter)).RemoveTeam(((EntityState)this).characterBody.teamComponent.teamIndex);
val2.sortMode = (SortMode)1;
val2.RefreshCandidates();
HurtBox val3 = val2.GetResults().FirstOrDefault();
if (Object.op_Implicit((Object)(object)val3))
{
val = HurtBox.FindEntityObject(val3);
if (Object.op_Implicit((Object)(object)val))
{
((Ray)(ref aimRay2)).direction = ((Component)val3).transform.position - ((Ray)(ref aimRay2)).origin;
}
}
float num3 = (float)num / 2f + 0.5f;
for (int i = 0; i < num; i++)
{
num3 -= 1f;
Vector3 val4 = Util.ApplySpread(((Ray)(ref aimRay2)).direction, 0f, 0f, 1f, 1f, num3 * RockFanSpreadAngle, 0f);
FireProjectileInfo val5 = default(FireProjectileInfo);
val5.projectilePrefab = BeetleGuardAlly.Perfected_Sunder_RockProjectile;
val5.position = ((Ray)(ref aimRay2)).origin;
val5.rotation = Util.QuaternionSafeLookRotation(val4);
val5.owner = ((EntityState)this).gameObject;
val5.damage = ((BaseState)this).damageStat * num2;
val5.crit = crit;
val5.force = forceMagnitude;
val5.damageColorIndex = (DamageColorIndex)0;
val5.damageTypeOverride = DamageTypeCombo.op_Implicit((DamageSource)2);
val5.target = val;
((FireProjectileInfo)(ref val5)).speedOverride = speedOverride;
val5.useSpeedOverride = true;
FireProjectileInfo val6 = val5;
ProjectileManager.instance.FireProjectile(val6);
}
}
private void FanRocks()
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_0278: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
Ray aimRay = ((BaseState)this).GetAimRay();
Ray aimRay2 = ((BaseState)this).GetAimRay();
((Ray)(ref aimRay2)).origin = handRTransform.position;
((Ray)(ref aimRay2)).origin = ((Ray)(ref aimRay2)).origin + new Vector3(0f, RockYLocOffset, 0f);
GameObject val = null;
BullseyeSearch val2 = new BullseyeSearch();
val2.searchOrigin = ((Ray)(ref aimRay)).origin;
val2.searchDirection = ((Ray)(ref aimRay)).direction;
val2.maxDistanceFilter = 90f;
val2.maxAngleFilter = 10f;
val2.teamMaskFilter = TeamMask.allButNeutral;
((TeamMask)(ref val2.teamMaskFilter)).RemoveTeam(((EntityState)this).characterBody.teamComponent.teamIndex);
val2.sortMode = (SortMode)1;
val2.RefreshCandidates();
HurtBox val3 = val2.GetResults().FirstOrDefault();
if (Object.op_Implicit((Object)(object)val3))
{
val = HurtBox.FindEntityObject(val3);
if (Object.op_Implicit((Object)(object)val))
{
((Ray)(ref aimRay2)).direction = ((Component)val3).transform.position - ((Ray)(ref aimRay2)).origin;
Vector3 direction = ((Ray)(ref aimRay2)).direction;
((Vector3)(ref direction)).Normalize();
}
}
float num = 0f;
if (((Ray)(ref aimRay2)).direction.y < 0.93f || ((Ray)(ref aimRay2)).direction.y > 0f)
{
num = RockYawOffset;
}
float num2 = (float)RockCount / 2f + 0.5f;
for (int i = 0; i < RockCount; i++)
{
num2 -= 1f;
float num3 = num2;
if (num3 < 0f)
{
num3 *= -1f;
}
num3 *= RockYawAdd;
Vector3 val4 = Util.ApplySpread(((Ray)(ref aimRay2)).direction, 0f, 0f, 1f, 1f, num2 * RockFanSpreadAngle, num + num3);
FireProjectileInfo val5 = default(FireProjectileInfo);
val5.projectilePrefab = BeetleGuardAlly.Default_RockProjectile;
val5.position = ((Ray)(ref aimRay2)).origin;
val5.rotation = Util.QuaternionSafeLookRotation(val4);
val5.owner = ((EntityState)this).gameObject;
val5.damage = ((BaseState)this).damageStat * RockDamageCoefficient;
val5.crit = crit;
val5.force = forceMagnitude;
val5.damageColorIndex = (DamageColorIndex)0;
val5.damageTypeOverride = DamageTypeCombo.op_Implicit((DamageSource)2);
((FireProjectileInfo)(ref val5)).speedOverride = RockSpeed;
val5.useSpeedOverride = true;
FireProjectileInfo val6 = val5;
ProjectileManager.instance.FireProjectile(val6);
}
}
}
public class Valor : BaseSkillState
{
public static float baseDuration = 3f;
public static float soundTime = 3.5f;
public static float soundOffset = 1.25f;
public static float buffDuration = 10f;
public static GameObject defenseUpPrefab = DefenseUp.defenseUpPrefab;
public static string initialSoundString = SpawnState.spawnSoundString;
private Animator modelAnimator;
private float duration;
private bool hasCastBuff;
private bool hasMadeSound;
public override void OnEnter()
{
((BaseState)this).OnEnter();
duration = baseDuration / ((BaseState)this).attackSpeedStat;
modelAnimator = ((EntityState)this).GetModelAnimator();
if (Object.op_Implicit((Object)(object)modelAnimator))
{
((EntityState)this).PlayAnimation("Body", "DefenseUp", "DefenseUp.playbackRate", duration, 0f);
}
if (NetworkServer.active)
{
((EntityState)this).characterBody.AddTimedBuff(Buffs.SmallArmorBoost, duration);
}
}
public override void FixedUpdate()
{
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
if (Object.op_Implicit((Object)(object)modelAnimator))
{
if (modelAnimator.GetFloat("DefenseUp.activate") > 0f && !hasMadeSound)
{
Util.PlayAttackSpeedSound(initialSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat * (soundTime / duration) * soundOffset);
hasMadeSound = true;
}
if (modelAnimator.GetFloat("DefenseUp.activate") > 0.5f && !hasCastBuff)
{
ScaleParticleSystemDuration component = Object.Instantiate<GameObject>(defenseUpPrefab, ((EntityState)this).transform.position, Quaternion.identity, ((EntityState)this).transform).GetComponent<ScaleParticleSystemDuration>();
if (Object.op_Implicit((Object)(object)component))
{
component.newDuration = buffDuration;
}
hasCastBuff = true;
if (NetworkServer.active)
{
((EntityState)this).characterBody.AddTimedBuff(ValorBuff.ThisBuffDef, buffDuration);
}
}
}
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)2;
}
}
}
namespace QueenGlandBuff.Modules
{
public static class Buffs
{
internal static List<BuffDef> buffDefs = new List<BuffDef>();
internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, bool isCooldown)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
buffName += "(QueenGlandBuff)";
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = buffName;
val.buffColor = buffColor;
val.canStack = canStack;
val.isDebuff = isDebuff;
val.isCooldown = isCooldown;
val.eliteDef = null;
val.iconSprite = buffIcon;
((Object)val).name = ((Object)val).name;
buffDefs.Add(val);
return val;
}
}
internal class ContentPacks : IContentPackProvider
{
internal ContentPack contentPack = new ContentPack();
public string identifier => "com.kking117.QueenGlandBuff";
public void Initialize()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
}
private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)this);
}
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
contentPack.identifier = identifier;
contentPack.buffDefs.Add(Buffs.buffDefs.ToArray());
contentPack.entityStateTypes.Add(States.entityStates.ToArray());
contentPack.projectilePrefabs.Add(Prefabs.projectilePrefabs.ToArray());
contentPack.skillDefs.Add(Skills.skillDefs.ToArray());
contentPack.skillFamilies.Add(Skills.skillFamilies.ToArray());
args.ReportProgress(1f);
yield break;
}
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
ContentPack.Copy(contentPack, args.output);
args.ReportProgress(1f);
yield break;
}
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
args.ReportProgress(1f);
yield break;
}
}
internal static class Prefabs
{
internal static List<GameObject> projectilePrefabs = new List<GameObject>();
}
public static class Projectiles
{
internal static void AddProjectile(GameObject proj)
{
Prefabs.projectilePrefabs.Add(proj);
}
}
internal static class Skills
{
internal static List<SkillFamily> skillFamilies = new List<SkillFamily>();
internal static List<SkillDef> skillDefs = new List<SkillDef>();
internal static void RegisterSkill(SkillDef skill)
{
skillDefs.Add(skill);
}
internal static void AddSkillToSlot(GameObject prefab, SkillDef skill, SkillSlot slot)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Invalid comparison between Unknown and I4
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Invalid comparison between Unknown and I4
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Invalid comparison between Unknown and I4
//IL_0064: 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_0120: 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_0142: Expected O, but got Unknown
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
SkillLocator component = prefab.GetComponent<SkillLocator>();
SkillFamily val = null;
if ((int)slot == 0)
{
if (!Object.op_Implicit((Object)(object)component.primary))
{
AddSkillFamilyToSlot(prefab, component, slot);
}
val = component.primary.skillFamily;
}
else if ((int)slot == 1)
{
if (!Object.op_Implicit((Object)(object)component.secondary))
{
AddSkillFamilyToSlot(prefab, component, slot);
}
val = component.secondary.skillFamily;
}
else if ((int)slot == 2)
{
if (!Object.op_Implicit((Object)(object)component.utility))
{
AddSkillFamilyToSlot(prefab, component, slot);
}
val = component.utility.skillFamily;
}
else if ((int)slot == 3)
{
if (!Object.op_Implicit((Object)(object)component.special))
{
AddSkillFamilyToSlot(prefab, component, slot);
}
val = component.special.skillFamily;
}
if (Object.op_Implicit((Object)(object)val))
{
Array.Resize(ref val.variants, val.variants.Length + 1);
Variant[] variants = val.variants;
int num = val.variants.Length - 1;
Variant val2 = new Variant
{
skillDef = skill
};
((Variant)(ref val2)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
variants[num] = val2;
}
}
internal static void AddSkillFamilyToSlot(GameObject prefab, SkillLocator skillLocator, SkillSlot slot)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Invalid comparison between Unknown and I4
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Invalid comparison between Unknown and I4
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Invalid comparison between Unknown and I4
if ((int)slot == 0)
{
skillLocator.primary = prefab.AddComponent<GenericSkill>();
SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val).name = ((Object)prefab).name + "PrimaryFamily";
val.variants = (Variant[])(object)new Variant[0];
skillLocator.primary._skillFamily = val;
skillFamilies.Add(val);
}
else if ((int)slot == 1)
{
skillLocator.secondary = prefab.AddComponent<GenericSkill>();
SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val2).name = ((Object)prefab).name + "SecondaryFamily";
val2.variants = (Variant[])(object)new Variant[0];
skillLocator.secondary._skillFamily = val2;
skillFamilies.Add(val2);
}
else if ((int)slot == 2)
{
skillLocator.utility = prefab.AddComponent<GenericSkill>();
SkillFamily val3 = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val3).name = ((Object)prefab).name + "UtilityFamily";
val3.variants = (Variant[])(object)new Variant[0];
skillLocator.utility._skillFamily = val3;
skillFamilies.Add(val3);
}
else if ((int)slot == 3)
{
skillLocator.special = prefab.AddComponent<GenericSkill>();
SkillFamily val4 = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val4).name = ((Object)prefab).name + "SpecialFamily";
val4.variants = (Variant[])(object)new Variant[0];
skillLocator.special._skillFamily = val4;
skillFamilies.Add(val4);
}
}
internal static void WipeLoadout(GameObject prefab)
{
GenericSkill[] componentsInChildren = prefab.GetComponentsInChildren<GenericSkill>();
foreach (GenericSkill val in componentsInChildren)
{
Object.DestroyImmediate((Object)(object)val);
}
SkillLocator component = prefab.GetComponent<SkillLocator>();
}
internal static AISkillDriver CopySkillDriver(AISkillDriver returnme, AISkillDriver copyme)
{
MonoBehaviour.print((object)("activationRequiresAimConfirmation = " + copyme.activationRequiresAimConfirmation));
MonoBehaviour.print((object)("activationRequiresAimTargetLoS = " + copyme.activationRequiresAimTargetLoS));
MonoBehaviour.print((object)("activationRequiresTargetLoS = " + copyme.activationRequiresTargetLoS));
MonoBehaviour.print((object)("aimType = " + ((object)(AimType)(ref copyme.aimType)).ToString()));
MonoBehaviour.print((object)("buttonPressType = " + ((object)(ButtonPressType)(ref copyme.buttonPressType)).ToString()));
MonoBehaviour.print((object)("driverUpdateTimerOverride = " + copyme.driverUpdateTimerOverride));
MonoBehaviour.print((object)("ignoreNodeGraph = " + copyme.ignoreNodeGraph));
MonoBehaviour.print((object)("maxDistance = " + copyme.maxDistance));
MonoBehaviour.print((object)("maxTargetHealthFraction = " + copyme.maxTargetHealthFraction));
MonoBehaviour.print((object)("maxUserHealthFractio = " + copyme.maxUserHealthFraction));
MonoBehaviour.print((object)("minDistance = " + copyme.minDistance));
MonoBehaviour.print((object)("minTargetHealthFraction = " + copyme.minTargetHealthFraction));
MonoBehaviour.print((object)("minUserHealthFraction = " + copyme.minUserHealthFraction));
MonoBehaviour.print((object)("moveInputScale = " + copyme.moveInputScale));
MonoBehaviour.print((object)("movementType = " + ((object)(MovementType)(ref copyme.movementType)).ToString()));
MonoBehaviour.print((object)("moveTargetType = " + ((object)(TargetType)(ref copyme.moveTargetType)).ToString()));
MonoBehaviour.print((object)("nextHighPriorityOverride = " + (object)copyme.nextHighPriorityOverride));
MonoBehaviour.print((object)("noRepeat = " + copyme.noRepeat));
MonoBehaviour.print((object)("requiredSkill = " + (object)copyme.requiredSkill));
MonoBehaviour.print((object)("requireEquipmentReady = " + copyme.requireEquipmentReady));
MonoBehaviour.print((object)("requireSkillReady = " + copyme.requireSkillReady));
MonoBehaviour.print((object)("resetCurrentEnemyOnNextDriverSelection = " + copyme.resetCurrentEnemyOnNextDriverSelection));
MonoBehaviour.print((object)("selectionRequiresAimTarget = " + copyme.selectionRequiresAimTarget));
MonoBehaviour.print((object)("selectionRequiresOnGround = " + copyme.selectionRequiresOnGround));
MonoBehaviour.print((object)("selectionRequiresTargetLoS = " + copyme.selectionRequiresTargetLoS));
MonoBehaviour.print((object)("shouldFireEquipment = " + copyme.shouldFireEquipment));
MonoBehaviour.print((object)("shouldSprint = " + copyme.shouldSprint));
MonoBehaviour.print((object)("skillSlot = " + ((object)(SkillSlot)(ref copyme.skillSlot)).ToString()));
return returnme;
}
}
public static class States
{
internal static List<Type> entityStates = new List<Type>();
public static void RegisterState(Type thistype)
{
entityStates.Add(thistype);
}
}
}
namespace QueenGlandBuff.Changes
{
public class BeetleGuardAlly
{
private static string LogName = "(BeetleGuardAlly)";
internal static float Stats_Base_Health = 480f;
internal static float Stats_Base_Damage = 12f;
internal static float Stats_Base_Regen = 5f;
internal static float Stats_Level_Health = 144f;
internal static float Stats_Level_Damage = 2.4f;
internal static float Stats_Level_Regen = 1f;
internal static bool Elite_Skills = true;
internal static bool Enable_Slam_Skill = true;
internal static bool Enable_Sunder_Skill = true;
internal static bool Enable_Valor_Skill = true;
public static GameObject Perfected_Slam_RockProjectile;
public static GameObject Perfected_Sunder_RockProjectile;
public static GameObject Perfected_Sunder_MainProjectile;
public static GameObject Default_RockProjectile;
public static GameObject BodyObject = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/BeetleGuardAllyBody");
public static GameObject MasterObject = LegacyResourcesAPI.Load<GameObject>("prefabs/charactermasters/BeetleGuardAllyMaster");
public static BaseAI BaseAI;
public static SkillDef SlamSkill;
public static SkillDef SunderSkill;
public static SkillDef ValorSkill;
public static SkillDef OldSlamSkill = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Beetle/BeetleGuardBodyGroundSlam.asset").WaitForCompletion();
public static SkillDef OldSunderSkill = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Beetle/BeetleGuardBodySunder.asset").WaitForCompletion();
public static void Begin()
{
MainPlugin.ModLogger.LogInfo((object)(LogName + " Beginning changes."));
CreateProjectiles();
UpdateBody();
CreateSkills();
UpdateLoadouts();
UpdateAI();
}
private static void CreateProjectiles()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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)
MainPlugin.ModLogger.LogInfo((object)"Creating BeetleGuardAlly projectiles.");
if (Enable_Slam_Skill || Enable_Sunder_Skill)
{
Default_RockProjectile = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/HermitCrab/HermitCrabBombProjectile.prefab").WaitForCompletion(), "KKING117_QUEENGLANDBUFF_RockProjectile", true);
ProjectileExplosion component = Default_RockProjectile.GetComponent<ProjectileExplosion>();
component.falloffModel = (FalloffModel)2;
component.bonusBlastForce = Vector3.down * 10f;
component.blastRadius = 8f;
component.blastProcCoefficient *= 0.3f;
Projectiles.AddProjectile(Default_RockProjectile);
if (Elite_Skills)
{
Perfected_Slam_RockProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherFirePillar.prefab").WaitForCompletion();
Perfected_Sunder_RockProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/LunarShardProjectile.prefab").WaitForCompletion();
Perfected_Sunder_MainProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherSunderWave.prefab").WaitForCompletion();
}
}
}
private static void UpdateBody()
{
MainPlugin.ModLogger.LogInfo((object)(LogName + " Changing body attributes."));
CharacterBody component = BodyObject.GetComponent<CharacterBody>();
component.baseAcceleration *= 1.5f;
component.baseJumpPower *= 1.3f;
CharacterDirection component2 = BodyObject.GetComponent<CharacterDirection>();
component2.turnSpeed *= 2f;
component.baseMaxHealth = Stats_Base_Health;
component.levelMaxHealth = Stats_Level_Health;
component.baseDamage = Stats_Base_Damage;
component.levelDamage = Stats_Level_Damage;
component.baseRegen = Stats_Base_Regen;
component.levelRegen = Stats_Level_Regen;
}
private static void CreateSkills()
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_0447: Unknown result type (might be due to invalid IL or missing references)
//IL_044c: Unknown result type (might be due to invalid IL or missing references)
//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
MainPlugin.ModLogger.LogInfo((object)(LogName + " Creating/Changing skills."));
SlamSkill = ScriptableObject.CreateInstance<SkillDef>();
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_PRIMARY_SLAM_NAME", "Slam");
if (Enable_Slam_Skill)
{
SlamSkill.activationState = new SerializableEntityStateType(typeof(Slam));
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_PRIMARY_SLAM_DESC", "Strike the ground for <style=cIsDamage>400%</style> and launch debris for <style=cIsDamage>3x125%</style> damage.");
QueenGlandBuff.Modules.States.RegisterState(typeof(Slam));
}
else
{
SlamSkill.activationState = new SerializableEntityStateType(typeof(GroundSlam));
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_PRIMARY_SLAM_DESC", "Strike the ground for <style=cIsDamage>400%</style> damage.");
}
SlamSkill.activationStateMachineName = "Body";
SlamSkill.dontAllowPastMaxStocks = false;
SlamSkill.resetCooldownTimerOnUse = false;
SlamSkill.keywordTokens = null;
SlamSkill.baseMaxStock = 1;
SlamSkill.rechargeStock = 1;
SlamSkill.requiredStock = 1;
SlamSkill.stockToConsume = 1;
SlamSkill.fullRestockOnAssign = true;
SlamSkill.baseRechargeInterval = 3f;
SlamSkill.beginSkillCooldownOnSkillEnd = false;
SlamSkill.canceledFromSprinting = false;
SlamSkill.cancelSprintingOnActivation = true;
SlamSkill.forceSprintDuringState = false;
SlamSkill.interruptPriority = (InterruptPriority)1;
SlamSkill.isCombatSkill = true;
SlamSkill.mustKeyPress = false;
SlamSkill.icon = null;
SlamSkill.skillDescriptionToken = "KKING117_QUEENGLANDBUFF_PRIMARY_SLAM_DESC";
SlamSkill.skillNameToken = "KKING117_QUEENGLANDBUFF_PRIMARY_SLAM_NAME";
SlamSkill.skillName = SlamSkill.skillNameToken;
Skills.RegisterSkill(SlamSkill);
SunderSkill = ScriptableObject.CreateInstance<SkillDef>();
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_SECONDARY_SUNDER_NAME", "Sunder");
if (Enable_Sunder_Skill)
{
SunderSkill.activationState = new SerializableEntityStateType(typeof(Sunder));
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_SECONDARY_SUNDER_DESC", "Tear the ground infront of you for <style=cIsDamage>400%</style>, launching a cluster of rocks for <style=cIsDamage>3x125%</style> damage.");
QueenGlandBuff.Modules.States.RegisterState(typeof(Sunder));
}
else
{
SunderSkill.activationState = new SerializableEntityStateType(typeof(FireSunder));
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_SECONDARY_SUNDER_DESC", "Tear the ground infront of you for <style=cIsDamage>400%</style> damage.");
}
SunderSkill.activationStateMachineName = "Body";
SunderSkill.baseMaxStock = 2;
SunderSkill.rechargeStock = 1;
SunderSkill.requiredStock = 1;
SunderSkill.stockToConsume = 1;
SunderSkill.fullRestockOnAssign = true;
SunderSkill.baseRechargeInterval = 8f;
SunderSkill.beginSkillCooldownOnSkillEnd = false;
SunderSkill.canceledFromSprinting = false;
SunderSkill.cancelSprintingOnActivation = true;
SunderSkill.forceSprintDuringState = false;
SunderSkill.interruptPriority = (InterruptPriority)1;
SunderSkill.isCombatSkill = true;
SunderSkill.mustKeyPress = false;
SunderSkill.icon = null;
SunderSkill.skillDescriptionToken = "KKING117_QUEENGLANDBUFF_SECONDARY_SUNDER_DESC";
SunderSkill.skillNameToken = "KKING117_QUEENGLANDBUFF_SECONDARY_SUNDER_NAME";
SunderSkill.skillName = SunderSkill.skillNameToken;
Skills.RegisterSkill(SunderSkill);
if (Enable_Valor_Skill)
{
ValorBuff.Begin();
ValorSkill = ScriptableObject.CreateInstance<SkillDef>();
string text = "";
if (ValorBuff.Aggro_Range > 0f)
{
text = "Draw the <style=cIsHealth>attention</style> of nearby enemies";
}
if (ValorBuff.Buff_Armor != 0f)
{
text = ((ValorBuff.Buff_Armor > 0f) ? ((!(ValorBuff.Aggro_Range > 0f)) ? (text + "Gain") : (text + " and gain")) : ((!(ValorBuff.Aggro_Range > 0f)) ? (text + "Lose") : (text + " and lose")));
text += $" <style=cIsUtility>{ValorBuff.Buff_Armor}</style> armor";
}
text += " for <style=cIsUtility>10</style> seconds.";
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_SPECIAL_TAUNT_NAME", "Valor");
LanguageAPI.Add("KKING117_QUEENGLANDBUFF_SPECIAL_TAUNT_DESC", text);
ValorSkill.activationState = new SerializableEntityStateType(typeof(Valor));
ValorSkill.activationStateMachineName = "Body";
QueenGlandBuff.Modules.States.RegisterState(typeof(Valor));
ValorSkill.baseMaxStock = 1;
ValorSkill.rechargeStock = 1;
ValorSkill.requiredStock = 1;
ValorSkill.stockToConsume = 1;
ValorSkill.fullRestockOnAssign = true;
ValorSkill.baseRechargeInterval = 30f;
ValorSkill.beginSkillCooldownOnSkillEnd = false;
ValorSkill.canceledFromSprinting = false;
ValorSkill.cancelSprintingOnActivation = true;
ValorSkill.forceSprintDuringState = false;
ValorSkill.interruptPriority = (InterruptPriority)1;
ValorSkill.isCombatSkill = false;
ValorSkill.mustKeyPress = false;
ValorSkill.icon = null;
ValorSkill.skillDescriptionToken = "KKING117_QUEENGLANDBUFF_SPECIAL_TAUNT_DESC";
ValorSkill.skillNameToken = "KKING117_QUEENGLANDBUFF_SPECIAL_TAUNT_NAME";
ValorSkill.skillName = ValorSkill.skillNameToken;
Skills.RegisterSkill(ValorSkill);
}
}
private static void UpdateLoadouts()
{
MainPlugin.ModLogger.LogInfo((object)(LogName + " Changing skill loadout."));
Skills.WipeLoadout(BodyObject);
Skills.AddSkillToSlot(BodyObject, SlamSkill, (SkillSlot)0);
Skills.AddSkillToSlot(BodyObject, SunderSkill, (SkillSlot)1);
if (Enable_Valor_Skill)
{
Skills.AddSkillToSlot(BodyObject, ValorSkill, (SkillSlot)3);
}
}
private static void UpdateAI()
{
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: 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_035c: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0395: Unknown result type (might be due to invalid IL or missing references)
//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0402: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_047a: Unknown result type (might be due to invalid IL or missing references)
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_04ee: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_056c: Unknown result type (might be due to invalid IL or missing references)
//IL_0574: Unknown result type (might be due to invalid IL or missing references)
//IL_05e4: Unknown result type (might be due to invalid IL or missing references)
//IL_05ec: Unknown result type (might be due to invalid IL or missing references)
//IL_063c: Unknown result type (might be due to invalid IL or missing references)
//IL_0674: Unknown result type (might be due to invalid IL or missing references)
//IL_067c: Unknown result type (might be due to invalid IL or missing references)
//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
//IL_06f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0744: Unknown result type (might be due to invalid IL or missing references)
//IL_077c: Unknown result type (might be due to invalid IL or missing references)
//IL_0784: Unknown result type (might be due to invalid IL or missing references)
//IL_07f4: Unknown result type (might be due to invalid IL or missing references)
//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
//IL_084c: Unknown result type (might be due to invalid IL or missing references)
//IL_0884: Unknown result type (might be due to invalid IL or missing references)
//IL_088c: Unknown result type (might be due to invalid IL or missing references)
//IL_08fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0904: Unknown result type (might be due to invalid IL or missing references)
//IL_0954: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
MainPlugin.ModLogger.LogInfo((object)(LogName + " Changing BaseAI and SkillDrivers."));
BaseAI = MasterObject.GetComponent<BaseAI>();
BaseAI.neverRetaliateFriendlies = true;
BaseAI.fullVision = true;
AISkillDriver[] componentsInChildren = MasterObject.GetComponentsInChildren<AISkillDriver>();
foreach (AISkillDriver val in componentsInChildren)
{
Object.DestroyImmediate((Object)(object)val);
}
if (Enable_Valor_Skill)
{
AISkillDriver val2 = MasterObject.AddComponent<AISkillDriver>();
val2.customName = "BuffAlly";
val2.activationRequiresAimConfirmation = true;
val2.activationRequiresAimTargetLoS = false;
val2.activationRequiresTargetLoS = true;
val2.aimType = (AimType)1;
val2.buttonPressType = (ButtonPressType)0;
val2.driverUpdateTimerOverride = 1f;
val2.ignoreNodeGraph = false;
val2.maxDistance = 30f;
val2.minDistance = 0f;
val2.maxTargetHealthFraction = float.PositiveInfinity;
val2.maxUserHealthFraction = float.PositiveInfinity;
val2.minTargetHealthFraction = float.NegativeInfinity;
val2.minUserHealthFraction = float.NegativeInfinity;
val2.moveInputScale = 1f;
val2.movementType = (MovementType)2;
val2.moveTargetType = (TargetType)0;
val2.noRepeat = false;
val2.requireEquipmentReady = false;
val2.requireSkillReady = true;
val2.resetCurrentEnemyOnNextDriverSelection = true;
val2.selectionRequiresAimTarget = false;
val2.selectionRequiresOnGround = false;
val2.selectionRequiresTargetLoS = true;
val2.shouldFireEquipment = false;
val2.shouldSprint = false;
val2.skillSlot = (SkillSlot)3;
}
AISkillDriver val3 = MasterObject.AddComponent<AISkillDriver>();
val3.customName = "FireSunder";
val3.activationRequiresAimConfirmation = true;
val3.activationRequiresAimTargetLoS = false;
val3.activationRequiresTargetLoS = true;
val3.aimType = (AimType)1;
val3.buttonPressType = (ButtonPressType)0;
val3.driverUpdateTimerOverride = 1f;
val3.ignoreNodeGraph = false;
val3.maxDistance = 40f;
val3.minDistance = 0f;
val3.maxTargetHealthFraction = float.PositiveInfinity;
val3.maxUserHealthFraction = float.PositiveInfinity;
val3.minTargetHealthFraction = float.NegativeInfinity;
val3.minUserHealthFraction = float.NegativeInfinity;
val3.moveInputScale = 1f;
val3.movementType = (MovementType)2;
val3.moveTargetType = (TargetType)0;
val3.noRepeat = false;
val3.requireEquipmentReady = false;
val3.requireSkillReady = true;
val3.resetCurrentEnemyOnNextDriverSelection = true;
val3.selectionRequiresAimTarget = true;
val3.selectionRequiresOnGround = false;
val3.selectionRequiresTargetLoS = true;
val3.shouldFireEquipment = false;
val3.shouldSprint = false;
val3.skillSlot = (SkillSlot)1;
AISkillDriver val4 = MasterObject.AddComponent<AISkillDriver>();
val4.customName = "Slam";
val4.activationRequiresAimConfirmation = false;
val4.activationRequiresAimTargetLoS = false;
val4.activationRequiresTargetLoS = false;
val4.aimType = (AimType)1;
val4.buttonPressType = (ButtonPressType)0;
val4.driverUpdateTimerOverride = -1f;
val4.ignoreNodeGraph = true;
val4.maxDistance = 10f;
val4.minDistance = 0f;
val4.maxTargetHealthFraction = float.PositiveInfinity;
val4.maxUserHealthFraction = float.PositiveInfinity;
val4.minTargetHealthFraction = float.NegativeInfinity;
val4.minUserHealthFraction = float.NegativeInfinity;
val4.moveInputScale = 1f;
val4.movementType = (MovementType)1;
val4.moveTargetType = (TargetType)0;
val4.noRepeat = false;
val4.requireEquipmentReady = false;
val4.requireSkillReady = true;
val4.resetCurrentEnemyOnNextDriverSelection = true;
val4.selectionRequiresAimTarget = false;
val4.selectionRequiresOnGround = false;
val4.selectionRequiresTargetLoS = false;
val4.shouldFireEquipment = false;
val4.shouldSprint = false;
val4.skillSlot = (SkillSlot)0;
AISkillDriver val5 = MasterObject.AddComponent<AISkillDriver>();
val5.customName = "ReturnToOwnerLeash";
val5.activationRequiresAimConfirmation = false;
val5.activationRequiresAimTargetLoS = false;
val5.activationRequiresTargetLoS = false;
val5.aimType = (AimType)3;
val5.buttonPressType = (ButtonPressType)0;
val5.driverUpdateTimerOverride = 3f;
val5.ignoreNodeGraph = false;
val5.maxDistance = float.PositiveInfinity;
val5.minDistance = 110f;
val5.maxTargetHealthFraction = float.PositiveInfinity;
val5.maxUserHealthFraction = float.PositiveInfinity;
val5.minTargetHealthFraction = float.NegativeInfinity;
val5.minUserHealthFraction = float.NegativeInfinity;
val5.moveInputScale = 1f;
val5.movementType = (MovementType)1;
val5.moveTargetType = (TargetType)2;
val5.noRepeat = false;
val5.requireEquipmentReady = false;
val5.selectionRequiresAimTarget = false;
val5.selectionRequiresOnGround = false;
val5.selectionRequiresTargetLoS = false;
val5.shouldFireEquipment = false;
val5.shouldSprint = true;
val5.requireSkillReady = false;
val5.skillSlot = (SkillSlot)(-1);
val5.resetCurrentEnemyOnNextDriverSelection = false;
AISkillDriver val6 = MasterObject.AddComponent<AISkillDriver>();
val6.customName = "StrafeBecauseCooldowns";
val6.activationRequiresAimConfirmation = false;
val6.activationRequiresAimTargetLoS = false;
val6.activationRequiresTargetLoS = false;
val6.aimType = (AimType)1;
val6.buttonPressType = (ButtonPressType)0;
val6.driverUpdateTimerOverride = -1f;
val6.ignoreNodeGraph = true;
val6.maxDistance = 10f;
val6.minDistance = 0f;
val6.maxTargetHealthFraction = float.PositiveInfinity;
val6.maxUserHealthFraction = float.PositiveInfinity;
val6.minTargetHealthFraction = float.NegativeInfinity;
val6.minUserHealthFraction = float.NegativeInfinity;
val6.moveInputScale = -0.8f;
val6.movementType = (MovementType)2;
val6.moveTargetType = (TargetType)0;
val6.noRepeat = false;
val6.requireEquipmentReady = false;
val6.requireSkillReady = false;
val6.resetCurrentEnemyOnNextDriverSelection = false;
val6.selectionRequiresAimTarget = false;
val6.selectionRequiresOnGround = false;
val6.selectionRequiresTargetLoS = true;
val6.shouldFireEquipment = false;
val6.shouldSprint = false;
val6.skillSlot = (SkillSlot)(-1);
AISkillDriver val7 = MasterObject.AddComponent<AISkillDriver>();
val7.customName = "ChaseOffNodegraph";
val7.activationRequiresAimConfirmation = false;
val7.activationRequiresAimTargetLoS = false;
val7.activationRequiresTargetLoS = false;
val7.aimType = (AimType)1;
val7.buttonPressType = (ButtonPressType)0;
val7.driverUpdateTimerOverride = -1f;
val7.ignoreNodeGraph = true;
val7.maxDistance = 25f;
val7.minDistance = 10f;
val7.maxTargetHealthFraction = float.PositiveInfinity;
val7.maxUserHealthFraction = float.PositiveInfinity;
val7.minTargetHealthFraction = float.NegativeInfinity;
val7.minUserHealthFraction = float.NegativeInfinity;
val7.moveInputScale = 1f;
val7.movementType = (MovementType)1;
val7.moveTargetType = (TargetType)0;
val7.noRepeat = false;
val7.requireEquipmentReady = false;
val7.requireSkillReady = false;
val7.resetCurrentEnemyOnNextDriverSelection = true;
val7.selectionRequiresAimTarget = false;
val7.selectionRequiresOnGround = false;
val7.selectionRequiresTargetLoS = true;
val7.shouldFireEquipment = true;
val7.shouldSprint = false;
val7.skillSlot = (SkillSlot)(-1);
AISkillDriver val8 = MasterObject.AddComponent<AISkillDriver>();
val8.customName = "Chase";
val8.activationRequiresAimConfirmation = false;
val8.activationRequiresAimTargetLoS = false;
val8.activationRequiresTargetLoS = false;
val8.aimType = (AimType)4;
val8.buttonPressType = (ButtonPressType)0;
val8.driverUpdateTimerOverride = -1f;
val8.ignoreNodeGraph = false;
val8.maxDistance = float.PositiveInfinity;
val8.minDistance = 0f;
val8.maxTargetHealthFraction = float.PositiveInfinity;
val8.maxUserHealthFraction = float.PositiveInfinity;
val8.minTargetHealthFraction = float.NegativeInfinity;
val8.minUserHealthFraction = float.NegativeInfinity;
val8.moveInputScale = 1f;
val8.movementType = (MovementType)1;
val8.moveTargetType = (TargetType)0;
val8.noRepeat = false;
val8.requireEquipmentReady = false;
val8.requireSkillReady = false;
val8.resetCurrentEnemyOnNextDriverSelection = true;
val8.selectionRequiresAimTarget = false;
val8.selectionRequiresOnGround = false;
val8.selectionRequiresTargetLoS = true;
val8.shouldFireEquipment = true;
val8.shouldSprint = false;
val8.skillSlot = (SkillSlot)(-1);
AISkillDriver val9 = MasterObject.AddComponent<AISkillDriver>();
val9.customName = "ReturnToLeaderDefault";
val9.activationRequiresAimConfirmation = false;
val9.activationRequiresAimTargetLoS = false;
val9.activationRequiresTargetLoS = false;
val9.aimType = (AimType)4;
val9.buttonPressType = (ButtonPressType)0;
val9.driverUpdateTimerOverride = -1f;
val9.ignoreNodeGraph = false;
val9.maxDistance = float.PositiveInfinity;
val9.minDistance = 18f;
val9.maxTargetHealthFraction = float.PositiveInfinity;
val9.maxUserHealthFraction = float.PositiveInfinity;
val9.minTargetHealthFraction = float.NegativeInfinity;
val9.minUserHealthFraction = float.NegativeInfinity;
val9.moveInputScale = 1f;
val9.movementType = (MovementType)1;
val9.moveTargetType = (TargetType)2;
val9.noRepeat = false;
val9.requireEquipmentReady = false;
val9.requireSkillReady = false;
val9.resetCurrentEnemyOnNextDriverSelection = true;
val9.selectionRequiresAimTarget = false;
val9.selectionRequiresOnGround = false;
val9.selectionRequiresTargetLoS = false;
val9.shouldFireEquipment = false;
val9.shouldSprint = true;
val9.skillSlot = (SkillSlot)(-1);
AISkillDriver val10 = MasterObject.AddComponent<AISkillDriver>();
val10.customName = "WaitNearLeaderDefault";
val10.activationRequiresAimConfirmation = false;
val10.activationRequiresAimTargetLoS = false;
val10.activationRequiresTargetLoS = false;
val10.aimType = (AimType)4;
val10.buttonPressType = (ButtonPressType)0;
val10.driverUpdateTimerOverride = -1f;
val10.ignoreNodeGraph = false;
val10.maxDistance = float.PositiveInfinity;
val10.minDistance = 0f;
val10.maxTargetHealthFraction = float.PositiveInfinity;
val10.maxUserHealthFraction = float.PositiveInfinity;
val10.minTargetHealthFraction = float.NegativeInfinity;
val10.minUserHealthFraction = float.NegativeInfinity;
val10.moveInputScale = 1f;
val10.movementType = (MovementType)0;
val10.moveTargetType = (TargetType)2;
val10.noRepeat = false;
val10.requireEquipmentReady = false;
val10.requireSkillReady = false;
val10.resetCurrentEnemyOnNextDriverSelection = true;
val10.selectionRequiresAimTarget = false;
val10.selectionRequiresOnGround = false;
val10.selectionRequiresTargetLoS = false;
val10.shouldFireEquipment = false;
val10.shouldSprint = false;
val10.skillSlot = (SkillSlot)(-1);
}
}
public class QueensGland
{
[CompilerGenerated]
private sealed class <>c__DisplayClass23_0
{
public BeetleGlandBodyBehavior self;
}
[CompilerGenerated]
private sealed class <>c__DisplayClass23_1
{
public CharacterMaster owner;
public <>c__DisplayClass23_0 CS$<>8__locals1;
}
[CompilerGenerated]
private sealed class <>c__DisplayClass23_2
{
public int extraglands;
public <>c__DisplayClass23_1 CS$<>8__locals2;
internal void <BeetleGland_Override>b__1(SpawnResult spawnResult)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SetupSummonedBeetleGuard(spawnResult, CS$<>8__locals2.owner, extraglands))
{
CS$<>8__locals2.CS$<>8__locals1.self.guardResummonCooldown = RespawnTime;
}
}
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_FixedUpdate <>9__23_0;
internal void <BeetleGland_Override>b__23_0(orig_FixedUpdate orig, BeetleGlandBodyBehavior self)
{
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01c2: Expected O, but got Unknown
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Expected O, but got Unknown
<>c__DisplayClass23_0 <>c__DisplayClass23_ = new <>c__DisplayClass23_0
{
self = self
};
if ((Object)(object)Stage.instance.sceneDef == (Object)(object)MainPlugin.BazaarSceneDef || !Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)<>c__DisplayClass23_.self).body) || !Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)<>c__DisplayClass23_.self).body.inventory))
{
return;
}
<>c__DisplayClass23_1 <>c__DisplayClass23_2 = new <>c__DisplayClass23_1();
<>c__DisplayClass23_2.CS$<>8__locals1 = <>c__DisplayClass23_;
<>c__DisplayClass23_2.owner = ((BaseItemBodyBehavior)<>c__DisplayClass23_2.CS$<>8__locals1.self).body.master;
if (!Object.op_Implicit((Object)(object)<>c__DisplayClass23_2.owner))
{
return;
}
BeetleGlandBodyBehavior self2 = <>c__DisplayClass23_2.CS$<>8__locals1.self;
self2.guardResummonCooldown -= Time.fixedDeltaTime;
if (!(<>c__DisplayClass23_2.CS$<>8__locals1.self.guardResummonCooldown <= 0f))
{
return;
}
<>c__DisplayClass23_2 CS$<>8__locals0 = new <>c__DisplayClass23_2();
CS$<>8__locals0.CS$<>8__locals2 = <>c__DisplayClass23_2;
CS$<>8__locals0.extraglands = Math.Max(0, CS$<>8__locals0.CS$<>8__locals2.owner.inventory.GetItemCount(Items.BeetleGland) - MaxSummons);
int deployableCount = CS$<>8__locals0.CS$<>8__locals2.owner.GetDeployableCount((DeployableSlot)2);
int deployableSameSlotLimit = CS$<>8__locals0.CS$<>8__locals2.owner.GetDeployableSameSlotLimit((DeployableSlot)2);
CS$<>8__locals0.CS$<>8__locals2.CS$<>8__locals1.self.guardResummonCooldown = 1f;
if (deployableCount >= deployableSameSlotLimit)
{
return;
}
DirectorSpawnRequest val = new DirectorSpawnRequest((SpawnCard)Resources.Load("SpawnCards/CharacterSpawnCards/cscBeetleGuardAlly"), new DirectorPlacementRule
{
placementMode = (PlacementMode)1,
minDistance = 3f,
maxDistance = 40f,
spawnOnTarget = ((Component)CS$<>8__locals0.CS$<>8__locals2.CS$<>8__locals1.self).transform
}, RoR2Application.rng);
val.summonerBodyObject = ((Component)CS$<>8__locals0.CS$<>8__locals2.CS$<>8__locals1.self).gameObject;
val.teamIndexOverride = (TeamIndex)1;
val.ignoreTeamMemberLimit = true;
val.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult spawnResult)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SetupSummonedBeetleGuard(spawnResult, CS$<>8__locals0.CS$<>8__locals2.owner, CS$<>8__locals0.extraglands))
{
CS$<>8__locals0.CS$<>8__locals2.CS$<>8__locals1.self.guardResummonCooldown = RespawnTime;
}
});
DirectorCore.instance.TrySpawnObject(val);
}
}
private static string LogName = "(QueensGland)";
public static bool Enable = true;
public static List<EquipmentDef> StageEliteEquipmentDefs = new List<EquipmentDef>();
public static EquipmentIndex DefaultAffixIndex = (EquipmentIndex)(-1);
internal static int BaseDamage = 20;
internal static int StackDamage = 20;
internal static int BaseHealth = 10;
internal static int StackHealth = 10;
internal static int MaxSummons = 1;
internal static float RespawnTime = 30f;
internal static int AffixMode = 1;
internal static string DefaultAffixName = "EliteFireEquipment";
internal static string AffixBlackList_Raw = "";
internal static List<EquipmentIndex> AffixBlackList;
internal static void Begin()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
ClampConfig();
UpdateItemDescription();
if (AffixMode != 0)
{
Stage.onServerStageBegin += ServerStageBegin;
}
CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(CharacterMaster_GetDeployableSameSlotLimit);
CharacterBody.onBodyInventoryChangedGlobal += CharacterBody_OnInventoryChanged;
BeetleGland_Override();
}
internal static void PostLoad()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Invalid comparison between Unknown and I4
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
if (AffixBlackList_Raw.Length <= 0)
{
return;
}
AffixBlackList = new List<EquipmentIndex>();
string[] array = AffixBlackList_Raw.Split(',');
for (int i = 0; i < array.Length; i++)
{
EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(array[i].Trim());
if ((int)val > -1)
{
AffixBlackList.Add(val);
}
}
}
private static void ClampConfig()
{
BaseDamage = Math.Max(0, BaseDamage);
StackDamage = Math.Max(0, StackDamage);
BaseHealth = Math.Max(0, BaseHealth);
StackHealth = Math.Max(0, StackHealth);
MaxSummons = Math.Max(1, MaxSummons);
RespawnTime = Math.Max(0f, RespawnTime);
AffixMode = Math.Max(0, AffixMode);
AffixMode = Math.Min(2, AffixMode);
}
private static void UpdateItemDescription()
{
MainPlugin.ModLogger.LogInfo((object)(LogName + " Changing item description."));
string text = "Recruit ";
string text2 = "<style=cIsUtility>Summon ";
if (AffixMode == 1)
{
text += "an Elite Beetle Guard.";
text2 += "an Elite Beetle Guard</style>";
}
else
{
text += "a Beetle Guard.";
text2 += "a Beetle Guard</style>";
}
if (MaxSummons > 1)
{
text2 += $" with bonus <style=cIsDamage>{(10 + BaseDamage) * 10}% damage</style>";
text2 += $" and <style=cIsHealing>{(10 + BaseHealth) * 10}% health</style>.";
text2 += $" Can have <style=cIsUtility>1</style> <style=cStack>(+1 per stack)</style> total Guards, up to <style=cIsUtility>{MaxSummons}</style>.";
if (StackHealth != 0 || StackDamage != 0)
{
text2 += " Further stacks give";
if (StackDamage != 0)
{
text2 += $" <style=cStack>+{StackDamage * 10}%</style> <style=cIsDamage>damage</style>";
text2 = ((StackHealth == 0) ? (text2 + ".") : (text2 + " and"));
}
if (StackHealth != 0)
{
text2 += $" <style=cStack>+{StackHealth * 10}%</style> <style=cIsHealing>health</style>";
}
}
}
else
{
text2 += $" with bonus <style=cIsDamage>{(10 + BaseDamage) * 10}% <style=cStack>(+{StackDamage * 10}% per stack)</style> damage</style>";
text2 += $" and <style=cIsHealing>{(10 + BaseHealth) * 10}% <style=cStack>(+{StackHealth * 10}% per stack)</style> health</style>.";
}
LanguageAPI.Add("ITEM_BEETLEGLAND_PICKUP", text);
LanguageAPI.Add("ITEM_BEETLEGLAND_DESC", text2);
}
private static void ServerStageBegin(Stage self)
{
UpdateEliteList();
}
private static void UpdateEliteList()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
return;
}
DefaultAffixIndex = EquipmentCatalog.FindEquipmentIndex(DefaultAffixName);
if ((int)DefaultAffixIndex != -1 && Run.instance.IsEquipmentExpansionLocked(DefaultAffixIndex))
{
DefaultAffixIndex = (EquipmentIndex)(-1);
}
StageEliteEquipmentDefs.Clear();
EliteTierDef[] combatDirectorEliteTiers = EliteAPI.GetCombatDirectorEliteTiers();
if (combatDirectorEliteTiers.Length == 0)
{
return;
}
bool flag = Stage.instance.sceneDef.cachedName.Contains("moon");
bool flag2 = RunArtifactManager.instance.IsArtifactEnabled(Artifacts.EliteOnly);
bool flag3 = Run.instance.loopClearCount > 0;
EliteRules arg = (EliteRules)0;
if (flag2)
{
arg = (EliteRules)1;
}
if (flag)
{
arg = (EliteRules)2;
}
for (int i = 0; i < combatDirectorEliteTiers.Length; i++)
{
if (!combatDirectorEliteTiers[i].isAvailable(arg))
{
continue;
}
for (int j = 0; j < combatDirectorEliteTiers[i].eliteTypes.GetLength(0); j++)
{
if (Object.op_Implicit((Object)(object)combatDirectorEliteTiers[i].eliteTypes[j]))
{
EquipmentDef eliteEquipmentDef = combatDirectorEliteTiers[i].eliteTypes[j].eliteEquipmentDef;
if (!StageEliteEquipmentDefs.Contains(eliteEquipmentDef) && (AffixBlackList == null || !AffixBlackList.Contains(eliteEquipmentDef.equipmentIndex)))
{
StageEliteEquipmentDefs.Add(eliteEquipmentDef);
}
}
}
}
}
private static int CharacterMaster_GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
{
//IL_0003: 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_000c: Invalid comparison between Unknown and I4
int result = orig.Invoke(self, slot);
if ((int)slot != 2)
{
return result;
}
int num = 1;
if (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.swarmsArtifactDef))
{
num = 2;
}
return Math.Min(MaxSummons, self.inventory.GetItemCount(Items.BeetleGland)) * num;
}
private static void CharacterBody_OnInventoryChanged(CharacterBody self)
{
UpdateBeetleGuardStacks(self.master);
}
private static void UpdateBeetleGuardStacks(CharacterMaster owner)
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Invalid comparison between Unknown and I4
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || owner.deployablesList == null)
{
return;
}
int deployableSameSlotLimit = owner.GetDeployableSameSlotLimit((DeployableSlot)2);
int itemCount = owner.inventory.GetItemCount(Items.BeetleGland);
int num = Math.Max(0, itemCount - MaxSummons);
int num2 = BaseDamage + StackDamage * num;
int num3 = BaseHealth + StackHealth * num;
int num4 = 0;
for (int i = 0; i < owner.deployablesList.Count; i++)
{
if ((int)owner.deployablesList[i].slot != 2)
{
continue;
}
Deployable deployable = owner.deployablesList[i].deployable;
if (!Object.op_Implicit((Object)(object)deployable))
{
continue;
}
CharacterMaster component = ((Component)deployable).GetComponent<CharacterMaster>();
if (!Object.op_Implicit((Object)(object)component))
{
continue;
}
num4++;
if (num4 > deployableSameSlotLimit)
{
component.TrueKill();
continue;
}
Inventory inventory = component.inventory;
if (Object.op_Implicit((Object)(object)inventory))
{
inventory.ResetItem(Items.BoostDamage);
inventory.ResetItem(Items.BoostHp);
inventory.ResetItem(Items.MinionLeash);
inventory.GiveItem(Items.BoostDamage, num2);
inventory.GiveItem(Items.BoostHp, num3);
inventory.GiveItem(Items.MinionLeash, 1);
}
}
}
private static void BeetleGland_Override()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
object obj = <>c.<>9__23_0;
if (obj == null)
{
hook_FixedUpdate val = delegate(orig_FixedUpdate orig, BeetleGlandBodyBehavior self)
{
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01c2: Expected O, but got Unknown
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Expected O, but got Unknown
if (!((Object)(object)Stage.instance.sceneDef == (Object)(object)MainPlugin.BazaarSceneDef) && Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)self).body) && Object.op_Implicit((Object)(object)((BaseItemBodyBehavior)self).body.inventory))
{
CharacterMaster owner = ((BaseItemBodyBehavior)self).body.master;
if (Object.op_Implicit((Object)(object)owner))
{
BeetleGlandBodyBehavior obj2 = self;
obj2.guardResummonCooldown -= Time.fixedDeltaTime;
if (self.guardResummonCooldown <= 0f)
{
int extraglands = Math.Max(0, owner.inventory.GetItemCount(Items.BeetleGland) - MaxSummons);
int deployableCount = owner.GetDeployableCount((DeployableSlot)2);
int deployableSameSlotLimit = owner.GetDeployableSameSlotLimit((DeployableSlot)2);
self.guardResummonCooldown = 1f;
if (deployableCount < deployableSameSlotLimit)
{
DirectorSpawnRequest val2 = new DirectorSpawnRequest((SpawnCard)Resources.Load("SpawnCards/CharacterSpawnCards/cscBeetleGuardAlly"), new DirectorPlacementRule
{
placementMode = (PlacementMode)1,
minDistance = 3f,
maxDistance = 40f,
spawnOnTarget = ((Component)self).transform
}, RoR2Application.rng);
val2.summonerBodyObject = ((Component)self).gameObject;
val2.teamIndexOverride = (TeamIndex)1;
val2.ignoreTeamMemberLimit = true;
val2.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(val2.onSpawnedServer, (Action<SpawnResult>)delegate(SpawnResult spawnResult)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SetupSummonedBeetleGuard(spawnResult, owner, extraglands))
{
self.guardResummonCooldown = RespawnTime;
}
});
DirectorCore.instance.TrySpawnObject(val2);
}
}
}
}
};
<>c.<>9__23_0 = val;
obj = (object)val;
}
BeetleGlandBodyBehavior.FixedUpdate += (hook_FixedUpdate)obj;
}
private static bool SetupSummonedBeetleGuard(SpawnResult spawnResult, CharacterMaster owner, int itemcount)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_0080: 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)
GameObject spawnedInstance = spawnResult.spawnedInstance;
if (!Object.op_Implicit((Object)(object)spawnedInstance))
{
return false;
}
CharacterMaster component = spawnedInstance.GetComponent<CharacterMaster>();
if (Object.op_Implicit((Object)(object)component))
{
Deployable val = ((Component)component).GetComponent<Deployable>();
if (!Object.op_Implicit((Object)(object)val))
{
val = ((Component)component).gameObject.AddComponent<Deployable>();
}
if (Object.op_Implicit((Object)(object)owner))
{
CharacterBody body = component.GetBody();
if (Object.op_Implicit((Object)(object)body))
{
component.teamIndex = owner.teamIndex;
body.teamComponent.teamIndex = owner.teamIndex;
}
Helpers.GiveRandomEliteAffix(component);
val.onUndeploy.AddListener(new UnityAction(component.TrueKill));
owner.AddDeployable(val, (DeployableSlot)2);
UpdateBeetleGuardStacks(owner);
return true;
}
}
return false;
}
}
public class ValorBuff
{
public static BuffDef ThisBuffDef;
private static Color BuffColor = new Color(0.827f, 0.196f, 0.098f, 1f);
internal static float Aggro_Range = 60f;
internal static float Buff_Armor = 100f;
internal static void Begin()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
MainPlugin.ModLogger.LogInfo((object)"Creating Valor buff.");
CreateBuff();
if (Aggro_Range > 0f)
{
CharacterBody.OnBuffFirstStackGained += new hook_OnBuffFirstStackGained(CharacterBody_OnBuffFirstStackGained);
}
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(CalculateStatsHook);
}
private static void CreateBuff()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
ThisBuffDef = Buffs.AddNewBuff("Valor", Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Beetle/bdBeetleJuice.asset").WaitForCompletion().iconSprite, BuffColor, canStack: false, isDebuff: false, isCooldown: false);
}
private static void CalculateStatsHook(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender) && sender.HasBuff(ThisBuffDef))
{
args.armorAdd += Buff_Armor;
}
}
private static void CharacterBody_OnBuffFirstStackGained(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buff)
{
orig.Invoke(self, buff);
if ((Object)(object)buff == (Object)(object)ThisBuffDef)
{
StealAggro(self);
}
}
private static void StealAggro(CharacterBody self)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//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_0037: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
return;
}
BullseyeSearch val = new BullseyeSearch();
val.viewer = self;
val.teamMaskFilter = TeamMask.allButNeutral;
((TeamMask)(ref val.teamMaskFilter)).RemoveTeam(self.master.teamIndex);
val.sortMode = (SortMode)1;
val.maxDistanceFilter = Aggro_Range;
val.searchOrigin = self.inputBank.aimOrigin;
val.searchDirection = self.inputBank.aimDirection;
val.maxAngleFilter = 180f;
val.filterByLoS = true;
val.RefreshCandidates();
foreach (HurtBox result in val.GetResults())
{
if (!Object.op_Implicit((Object)(object)result) || !Object.op_Implicit((Object)(object)result.healthComponent))
{
continue;
}
CharacterBody body = result.healthComponent.body;
if (Object.op_Implicit((Object)(object)body) && !body.isBoss && Object.op_Implicit((Object)(object)body.master))
{
CharacterMaster master = result.healthComponent.body.master;
BaseAI component = ((Component)master).GetComponent<BaseAI>();
if (Object.op_Implicit((Object)(object)component) && !component.isHealer)
{
component.currentEnemy.gameObject = ((Component)self.healthComponent).gameObject;
component.currentEnemy.bestHurtBox = self.mainHurtBox;
component.enemyAttention = Math.Min(9f, component.enemyAttentionDuration);
component.targetRefreshTimer = component.enemyAttention;
}
}
}
}
}
}