using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.GrandParentBoss;
using EntityStates.RoboBallMini.Weapon;
using HG.GeneralSerializer;
using IL.EntityStates;
using IL.RoR2;
using IL.RoR2.Items;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.GrandParentBoss;
using On.EntityStates.RoboBallMini.Weapon;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SuperCyanTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SuperCyanTweaks")]
[assembly: AssemblyTitle("SuperCyanTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SuperCyanTweaks;
public static class Configs
{
public static ConfigEntry<bool> alphaConstructTeleportEnabled { get; private set; }
public static ConfigEntry<float> alphaConstructTeleportMinDist { get; private set; }
public static ConfigEntry<float> alphaConstructTeleportCooldown { get; private set; }
public static ConfigEntry<float> beetleSpawnDuration { get; private set; }
public static ConfigEntry<float> beetleHeadbuttDmg { get; private set; }
public static ConfigEntry<float> bighornBisonChargeCoeff { get; private set; }
public static ConfigEntry<int> clayApothecaryCost { get; private set; }
public static ConfigEntry<float> clayApothecaryTarBallRange { get; private set; }
public static ConfigEntry<int> geepCost { get; private set; }
public static ConfigEntry<int> grandparentCost { get; private set; }
public static ConfigEntry<float> grandparentRockActivationRange { get; private set; }
public static ConfigEntry<float> grandparentGravOrbForce { get; private set; }
public static ConfigEntry<bool> grandparentGravOrbDynamicSpeed { get; private set; }
public static ConfigEntry<bool> grandparentReduceDowntime { get; private set; }
public static ConfigEntry<bool> gupDelayAttackOnSpawn { get; private set; }
public static ConfigEntry<bool> impOnHelminthRoost { get; private set; }
public static ConfigEntry<float> lemurianFireballRange { get; private set; }
public static ConfigEntry<float> mushrumSprintDist { get; private set; }
public static ConfigEntry<float> mushrumSprintCoeff { get; private set; }
public static ConfigEntry<bool> mushrumOnHabitatFall { get; private set; }
public static ConfigEntry<bool> scuRespectNodegraph { get; private set; }
public static ConfigEntry<float> scuPrimaryAttackRange { get; private set; }
public static ConfigEntry<float> scuProbeHealthThreshold { get; private set; }
public static ConfigEntry<int> distributorCost { get; private set; }
public static ConfigEntry<int> probeCost { get; private set; }
public static ConfigEntry<bool> probeOnShipGraveyard { get; private set; }
public static ConfigEntry<bool> probeOnRepurposedCrater { get; private set; }
public static ConfigEntry<bool> probeOnSolusEvent { get; private set; }
public static ConfigEntry<bool> probeDelayAttackOnSpawn { get; private set; }
public static ConfigEntry<int> transporterCost { get; private set; }
public static ConfigEntry<int> voidReaverCost { get; private set; }
public static ConfigEntry<float> eclipseLiteBarrierBase { get; private set; }
public static ConfigEntry<float> eclipseLiteBarrierStack { get; private set; }
public static ConfigEntry<bool> empathyCoresDamageTweak { get; private set; }
public static ConfigEntry<float> happiestMaskProcChance { get; private set; }
public static ConfigEntry<float> stealthKitThreshold { get; private set; }
public static ConfigEntry<float> bestBuddyRamDamage { get; private set; }
public static ConfigEntry<bool> bestBuddyBehaviorTweak { get; private set; }
public static ConfigEntry<bool> bestBuddyHitDetection { get; private set; }
public static ConfigEntry<bool> sonorousWhispersRework { get; private set; }
public static ConfigEntry<float> wakeOfVulturesDurationBase { get; private set; }
public static ConfigEntry<float> wakeOfVulturesDurationStack { get; private set; }
public static ConfigEntry<bool> warBondsInheritable { get; private set; }
public static ConfigEntry<bool> waxQuailMultiJump { get; private set; }
public static ConfigEntry<float> eccentricVaseCooldown { get; private set; }
public static ConfigEntry<float> eccentricVaseMaxDist { get; private set; }
public static ConfigEntry<float> eccentricVaseAcceleration { get; private set; }
public static ConfigEntry<bool> eccentricVaseCloak { get; private set; }
public static ConfigEntry<bool> eccentricVaseIntangible { get; private set; }
public static ConfigEntry<bool> eccentricVaseNoCrater { get; private set; }
public static ConfigEntry<float> molotovResidueSize { get; private set; }
public static ConfigEntry<float> molotovResidueDuration { get; private set; }
public static ConfigEntry<float> molotovResidueTickrate { get; private set; }
public static ConfigEntry<float> molotovExplosionDamage { get; private set; }
public static ConfigEntry<bool> equipDroneAlwaysFire { get; private set; }
public static ConfigEntry<float> gunnerTurretRange { get; private set; }
public static void Init(ConfigFile cfg)
{
alphaConstructTeleportEnabled = cfg.Bind<bool>("Enemies - Alpha Construct", "Teleport To Players", true, "Alpha Constructs that are out of range will periodically teleport near a target. Vanilla is false.");
alphaConstructTeleportMinDist = cfg.Bind<float>("Enemies - Alpha Construct", "Minimum Teleport Distance", 75f, "Alpha Constructs will attempt to teleport if their target is past this range. For reference, their attacking range is 75m.");
alphaConstructTeleportCooldown = cfg.Bind<float>("Enemies - Alpha Construct", "Teleport Cooldown", 30f, "Set the cooldown of the Alpha Construct's teleport skill.");
beetleSpawnDuration = cfg.Bind<float>("Enemies - Beetle", "Spawn Duration", 3.5f, "Set the spawn duration to this value. Vanilla is 5. Set to a negative value for no change.");
beetleHeadbuttDmg = cfg.Bind<float>("Enemies - Beetle", "Headbutt Damage Coefficient", 2.5f, "Set the damage coefficient to this value. Vanilla is 2. Set to a negative value for no change.");
bighornBisonChargeCoeff = cfg.Bind<float>("Enemies - Bighorn Bison", "Charge Coefficient", -1f, "Base speed is multiplied by this value while charging. Vanilla is 8. Set to a negative value for no change.");
clayApothecaryCost = cfg.Bind<int>("Enemies - Clay Apothecary", "Spawn Cost", 125, "Set the director credit cost. Vanilla is 150. Set to a negative value for no change.");
clayApothecaryTarBallRange = cfg.Bind<float>("Enemies - Clay Apothecary", "Max Tar Ball Range", 75f, "Clay Apothecaries will attack from this far away with tar balls. Vanilla is 65. Set to a negative value for no change.");
geepCost = cfg.Bind<int>("Enemies - Geep", "Spawn Cost", 50, "Set the director credit cost. Vanilla is 35. Set to a negative value for no change.");
grandparentCost = cfg.Bind<int>("Enemies - Grandparent", "Spawn Cost", 1000, "Set the director credit cost. Vanilla is 1150. Set to a negative value for no change.");
grandparentRockActivationRange = cfg.Bind<float>("Enemies - Grandparent", "Rock Throw Activation Range", 1500f, "Activation range of Rock Throw. Vanilla is 300. Set to a negative value for no change.");
grandparentGravOrbForce = cfg.Bind<float>("Enemies - Grandparent", "Gravity Orb Force", -3000f, "The force of the gravity orb's pull. Set to vanilla value (-1000) for no change.");
grandparentGravOrbDynamicSpeed = cfg.Bind<bool>("Enemies - Grandparent", "Dynamic Orb Speed", true, "Gravity Orb projectile speed scales with target distance. Vanilla is false.");
grandparentReduceDowntime = cfg.Bind<bool>("Enemies - Grandparent", "Reduce Downtime", true, "Grandparents will spend less time in the 'rotate to target' behaviors. Vanilla is false.");
gupDelayAttackOnSpawn = cfg.Bind<bool>("Enemies - Gup", "Delay Attack After Spawning", true, "Adds a small delay between spawning and throwing out their first attack.");
impOnHelminthRoost = cfg.Bind<bool>("Enemies - Imp", "Spawn on Helminth Hatchery", true, "Imps appear on Helminth Hatchery.");
lemurianFireballRange = cfg.Bind<float>("Enemies - Lemurian", "Max Fireball Range", 45f, "Lemurians will attack from this far away with fireballs. Strafe range is still capped at 30m. Vanilla is 30. Set to a negative value for no change.");
mushrumSprintDist = cfg.Bind<float>("Enemies - Mini Mushrum", "Sprint Distance", 60f, "Mini Mushrums start sprinting from this far away. Set to a negative value to disable.");
mushrumSprintCoeff = cfg.Bind<float>("Enemies - Mini Mushrum", "Sprint Coefficient", 3f, "Set the sprint speed multiplier to this value. Vanilla is 2.5. Set to a negative value for no change.");
mushrumOnHabitatFall = cfg.Bind<bool>("Enemies - Mini Mushrum", "Spawn on Golden Dieback", true, "Mini Mushrums appear on Golden Dieback.");
scuRespectNodegraph = cfg.Bind<bool>("Enemies - Solus Control Unit", "Respect Nodegraph", true, "Solus Control Units will properly follow the nodegraph while chasing. Applies to AWU as well.");
scuPrimaryAttackRange = cfg.Bind<float>("Enemies - Solus Control Unit", "Max Primary Attack Range", 100f, "Solus Control Units will attack from this far away. Vanilla is 50. Set to a negative value for no change. Applies to AWU as well.");
scuProbeHealthThreshold = cfg.Bind<float>("Enemies - Solus Control Unit", "Probe Health Threshold", 1f, "Solus Control Units will deploy Solus Probes under this health fraction. Vanilla is 0.9. Set to a negative value for no change. Applies to AWU as well.");
distributorCost = cfg.Bind<int>("Enemies - Solus Distributor", "Spawn Cost", 40, "Set the director credit cost. Vanilla is 20. Set to a negative value for no change.");
probeCost = cfg.Bind<int>("Enemies - Solus Probe", "Spawn Cost", 40, "Set the director credit cost. Vanilla is 60. Set to a negative value for no change.");
probeOnShipGraveyard = cfg.Bind<bool>("Enemies - Solus Probe", "Spawn on Siren’s Call", true, "Solus Probes appear on Siren’s Call.");
probeOnRepurposedCrater = cfg.Bind<bool>("Enemies - Solus Probe", "Spawn on Repurposed Crater", true, "Solus Probes appear on Repurposed Crater.");
probeOnSolusEvent = cfg.Bind<bool>("Enemies - Solus Probe", "Add to Solus Family Event", true, "Solus Probes appear during the Solus Family Event.");
probeDelayAttackOnSpawn = cfg.Bind<bool>("Enemies - Solus Probe", "Delay Attack After Spawning", true, "Adds a small delay between spawning and throwing out their first attack.");
transporterCost = cfg.Bind<int>("Enemies - Solus Transporter", "Spawn Cost", 125, "Set the director credit cost. Vanilla is 200. Set to a negative value for no change.");
voidReaverCost = cfg.Bind<int>("Enemies - Void Reaver", "Spawn Cost", 250, "Set the director credit cost. Vanilla is 300. Set to a negative value for no change.");
eclipseLiteBarrierBase = cfg.Bind<float>("Items - Eclipse Lite", "Base Barrier Percentage", -1f, "Set the barrier gain per second of cooldown, in percentage. Vanilla is 1%. Set to a negative value for no change.");
eclipseLiteBarrierStack = cfg.Bind<float>("Items - Eclipse Lite", "Stack Barrier Percentage", 0.5f, "Set the barrier gain per second of cooldown, in percentage. Vanilla is 0.25%. Set to a negative value for no change.");
empathyCoresDamageTweak = cfg.Bind<bool>("Items - Empathy Cores", "Empathy Cores Damage Tweak", true, "Empathy Cores damage boost affects skill damage instead of base damage.\nThis nerfs synergies that depend on base damage, notably the chainguns from Spare Drone Parts.");
happiestMaskProcChance = cfg.Bind<float>("Items - Happiest Mask", "Proc Chance", 10f, "Set the proc chance of this item, in percentage. Vanilla is 7%. Set to a negative value for no change.");
stealthKitThreshold = cfg.Bind<float>("Items - Old War Stealthkit", "Activation Threshold", 0.5f, "This item will activate under this health fraction. Vanilla is 0.25. Set to a negative value for no change.");
bestBuddyRamDamage = cfg.Bind<float>("Items - Orphaned Core", "Ram Damage", 6f, "Set the damage coefficient to this value. The value is multiplied by x2.5 against heavy targets. Vanilla is 4. Set to a negative value for no change.");
bestBuddyBehaviorTweak = cfg.Bind<bool>("Items - Orphaned Core", "Tweak Behavior", true, "Adjusts the AI of Best Buddy to be more competent. Vanilla is false.");
bestBuddyHitDetection = cfg.Bind<bool>("Items - Orphaned Core", "Improve Hit Detection", true, "Improves the re-hit rate and makes the kinetic aura hitbox roughly match the visuals. Vanilla is false.");
sonorousWhispersRework = cfg.Bind<bool>("Items - Sonorous Whispers", "Sonorous Whispers Rework", true, "Items only drop from bosses proper instead of Champions, and will no longer drop from elites.\nStacking improves item rarity.\nEffect is now team-wide.");
wakeOfVulturesDurationBase = cfg.Bind<float>("Items - Wake of Vultures", "Base Duration", 12f, "Set the aspect buff duration. Vanilla is 8. Set to a negative value for no change.");
wakeOfVulturesDurationStack = cfg.Bind<float>("Items - Wake of Vultures", "Stack Duration", 6f, "Set the aspect buff duration. Vanilla is 5. Set to a negative value for no change.");
warBondsInheritable = cfg.Bind<bool>("Items - War Bonds", "War Bonds is Inheritable", false, "Whether this item can be inherited by turrets and such. Vanilla is true.");
waxQuailMultiJump = cfg.Bind<bool>("Items - Wax Quail", "Wax Quail Multi Jump", true, "Additional non-base jumps will grant a jump boost as well. Vanilla is false.");
eccentricVaseCooldown = cfg.Bind<float>("Equipment - Eccentric Vase", "Cooldown", 30f, "Adjust this equipment's cooldown. Vanilla is 45. Set to a negative value for no change.");
eccentricVaseMaxDist = cfg.Bind<float>("Equipment - Eccentric Vase", "Max Range", 2000f, "Adjust the maximum length of the zipline. Vanilla is 1000. Set to a negative value for no change.");
eccentricVaseAcceleration = cfg.Bind<float>("Equipment - Eccentric Vase", "Acceleration", 50f, "Set the acceleration value. Vanilla is 30. Set to a negative value for no change.");
eccentricVaseCloak = cfg.Bind<bool>("Equipment - Eccentric Vase", "Cloaked While Traveling", true, "User is cloaked while traveling. Vanilla is false.");
eccentricVaseIntangible = cfg.Bind<bool>("Equipment - Eccentric Vase", "Intangible While Traveling", true, "User is intangible while traveling. Vanilla is false.");
eccentricVaseNoCrater = cfg.Bind<bool>("Equipment - Eccentric Vase", "No Cratering", true, "User is briefly immune to fall damage on exit. Vanilla is false.");
molotovResidueSize = cfg.Bind<float>("Equipment - Molotov (6-Pack)", "Fire Residue Size", 1.75f, "Multiply the size of the lingering fire pools by this value. Vanilla is 1. Set to a negative value for no change.");
molotovResidueDuration = cfg.Bind<float>("Equipment - Molotov (6-Pack)", "Fire Residue Duration", 10f, "Adjust the duration of the lingering fire pools. Vanilla is 7. Set to a negative value for no change.");
molotovResidueTickrate = cfg.Bind<float>("Equipment - Molotov (6-Pack)", "Fire Residue Tickrate", 2f, "Adjust the tickrate of the lingering fire pools, in attacks per second. Vanilla is 1. Set to a negative value for no change.");
molotovExplosionDamage = cfg.Bind<float>("Equipment - Molotov (6-Pack)", "Explosion Damage", -1f, "Set the damage coefficient of the fire explosions to this value. Vanilla is 2.5, despite what the description says. Set to a negative value for no change.");
equipDroneAlwaysFire = cfg.Bind<bool>("Drones - Equipment Drone", "Always Fire Equipment", true, "Equipment Drones will attempt to fire their Equipment as often as possible. Vanilla is false.");
gunnerTurretRange = cfg.Bind<float>("Drones - Gunner Turret", "Attack Range", 75f, "Gunner Turrets will attack from this far away. Vanilla is 60. Set to a negative value for no change.");
}
}
public class EquipmentDrone
{
public static GameObject equipDroneMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/EquipmentDroneMaster.prefab").WaitForCompletion();
public EquipmentDrone()
{
if (!Configs.equipDroneAlwaysFire.Value)
{
return;
}
AISkillDriver[] components = equipDroneMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array = components;
foreach (AISkillDriver val in array)
{
val.shouldFireEquipment = true;
if (val.driverUpdateTimerOverride > 0.5f)
{
val.driverUpdateTimerOverride = 0.5f;
}
}
}
}
public class GunnerTurret
{
public static GameObject gunnerTurretMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Drones/Turret1Master.prefab").WaitForCompletion();
public GunnerTurret()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Invalid comparison between Unknown and I4
if (!(Configs.gunnerTurretRange.Value >= 0f))
{
return;
}
AISkillDriver[] components = gunnerTurretMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array = components;
foreach (AISkillDriver val in array)
{
if ((int)val.skillSlot == 0)
{
val.maxDistance = Configs.gunnerTurretRange.Value;
}
}
}
}
public class AlphaConstruct
{
public static GameObject minorConstructBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MinorConstructBody.prefab").WaitForCompletion();
public static GameObject minorConstructMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MinorConstructMaster.prefab").WaitForCompletion();
public AlphaConstruct()
{
//IL_006a: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: 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_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
if (Configs.alphaConstructTeleportEnabled.Value)
{
BaseAI component = minorConstructMasterPrefab.GetComponent<BaseAI>();
if (Object.op_Implicit((Object)(object)component))
{
component.enemySearch.maxDistanceFilter = float.PositiveInfinity;
}
if (!Object.op_Implicit((Object)(object)minorConstructBodyPrefab.GetComponent<TargetingAndPredictionController>()))
{
minorConstructBodyPrefab.AddComponent<TargetingAndPredictionController>();
}
bool flag = default(bool);
ContentAddition.AddEntityState<MinorConstructTeleport>(ref flag);
SkillDef val = ScriptableObject.CreateInstance<SkillDef>();
val.activationState = new SerializableEntityStateType(typeof(MinorConstructTeleport));
val.activationStateMachineName = "Body";
val.baseMaxStock = 1;
val.baseRechargeInterval = Configs.alphaConstructTeleportCooldown.Value;
val.beginSkillCooldownOnSkillEnd = false;
val.canceledFromSprinting = false;
val.cancelSprintingOnActivation = true;
val.dontAllowPastMaxStocks = true;
val.forceSprintDuringState = false;
val.fullRestockOnAssign = false;
val.hideCooldown = false;
val.hideStockCount = false;
val.interruptPriority = (InterruptPriority)1;
val.isCombatSkill = false;
val.mustKeyPress = false;
val.rechargeStock = 1;
val.requiredStock = 1;
val.resetCooldownTimerOnUse = false;
val.skillName = "MINORCONSTRUCT_UTILITY_TELEPORT_NAME";
val.stockToConsume = 1;
ContentAddition.AddSkillDef(val);
SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
((Object)val2).name = "MinorConstructUtilityFamily";
Array.Resize(ref val2.variants, 1);
val2.variants[0].skillDef = val;
GenericSkill val3 = minorConstructBodyPrefab.AddComponent<GenericSkill>();
val3.skillName = "MinorConstructTeleport";
val3._skillFamily = val2;
SkillLocator component2 = minorConstructBodyPrefab.GetComponent<SkillLocator>();
component2.utility = val3;
ContentAddition.AddSkillFamily(val2);
AISkillDriver val4 = minorConstructMasterPrefab.AddComponent<AISkillDriver>();
val4.activationRequiresAimConfirmation = false;
val4.activationRequiresAimTargetLoS = false;
val4.activationRequiresTargetLoS = false;
val4.aimType = (AimType)1;
val4.aimVectorDampTimeOverride = 0.05f;
val4.aimVectorMaxSpeedOverride = float.PositiveInfinity;
val4.buttonPressType = (ButtonPressType)2;
val4.customName = "TeleportToTarget";
val4.driverUpdateTimerOverride = 1f;
val4.ignoreNodeGraph = false;
val4.maxDistance = float.PositiveInfinity;
val4.maxTargetHealthFraction = float.PositiveInfinity;
val4.maxTimesSelected = -1;
val4.maxUserHealthFraction = float.PositiveInfinity;
val4.minDistance = Configs.alphaConstructTeleportMinDist.Value;
val4.minTargetHealthFraction = float.NegativeInfinity;
val4.minUserHealthFraction = float.NegativeInfinity;
val4.moveInputScale = 1f;
val4.movementType = (MovementType)0;
val4.moveTargetType = (TargetType)0;
val4.noRepeat = false;
val4.requireEquipmentReady = false;
val4.requireSkillReady = true;
val4.resetCurrentEnemyOnNextDriverSelection = false;
val4.selectionRequiresAimTarget = false;
val4.selectionRequiresOnGround = false;
val4.selectionRequiresTargetLoS = false;
val4.selectionRequiresTargetNonFlier = false;
val4.shouldFireEquipment = false;
val4.shouldSprint = false;
val4.skillSlot = (SkillSlot)2;
minorConstructMasterPrefab.ReorderSkillDrivers(val4, 1);
if (!Object.op_Implicit((Object)(object)minorConstructBodyPrefab.GetComponent<RemoveTeleportStocksOnStart>()))
{
minorConstructBodyPrefab.AddComponent<RemoveTeleportStocksOnStart>();
}
}
}
}
public class RemoveTeleportStocksOnStart : MonoBehaviour
{
private CharacterBody characterBody;
private SkillLocator skillLocator;
private void Awake()
{
characterBody = ((Component)this).GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)characterBody.skillLocator))
{
skillLocator = characterBody.skillLocator;
}
}
private void Start()
{
if (Object.op_Implicit((Object)(object)skillLocator) && Object.op_Implicit((Object)(object)skillLocator.utility))
{
skillLocator.utility.RemoveAllStocks();
}
}
}
public class MinorConstructTeleport : BaseState
{
public float duration = 0.2f;
public float nodeSearchRadiusMin = 25f;
public float nodeSearchRadiusMax = 40f;
public float collisionCheckDistance = 5f;
public int findSurfaceRaycastCount = 10;
public float findSurfaceMaxRaycastLength = 50f;
public GameObject teleportEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MajorConstructSpawnMinorConstructEffect.prefab").WaitForCompletion();
public GameObject arrivalEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/MajorAndMinorConstruct/MajorConstructMuzzleflashSpawnMinorConstruct.prefab").WaitForCompletion();
public string arrivalSoundString = "Play_majorConstruct_R_pulse";
public HurtBox target;
public override void OnEnter()
{
((BaseState)this).OnEnter();
target = ((EntityState)this).GetComponent<TargetingAndPredictionController>().GetTargetHurtBox();
if (!Object.op_Implicit((Object)(object)target))
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (Object.op_Implicit((Object)(object)target) && ((EntityState)this).fixedAge > duration)
{
Teleport();
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
}
private void Teleport()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
if (FindOffsetPosition(((Component)target).transform, out var offsetPosition))
{
Vector3 position = ((EntityState)this).transform.position;
if (FindNearbySurface(offsetPosition))
{
EffectManager.SpawnEffect(teleportEffectPrefab, new EffectData
{
origin = position
}, false);
EffectManager.SpawnEffect(arrivalEffectPrefab, new EffectData
{
origin = ((EntityState)this).transform.position
}, false);
Util.PlaySound(arrivalSoundString, ((EntityState)this).gameObject);
}
}
}
private bool FindNearbySurface(Vector3 targetPos)
{
//IL_0003: 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_000a: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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)
RaycastHit val = default(RaycastHit);
bool result = false;
if (((EntityState)this).isAuthority)
{
MinionOwnership minionOwnership = ((EntityState)this).characterBody.master.minionOwnership;
if (!Object.op_Implicit((Object)(object)((minionOwnership != null) ? minionOwnership.ownerMaster : null)))
{
for (int i = 0; i < findSurfaceRaycastCount; i++)
{
if (Physics.Raycast(targetPos, Random.onUnitSphere, ref val, findSurfaceMaxRaycastLength, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)))
{
((EntityState)this).transform.position = ((RaycastHit)(ref val)).point;
((EntityState)this).transform.up = ((RaycastHit)(ref val)).normal;
result = true;
}
}
}
}
return result;
}
private bool FindOffsetPosition(Transform targetTransform, out Vector3 offsetPosition)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return FindBestTeleportPosition(targetTransform.position, out offsetPosition);
}
private bool FindBestTeleportPosition(Vector3 nearPosition, out Vector3 teleportPosition)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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)
if (!Object.op_Implicit((Object)(object)DirectorCore.instance) || !Object.op_Implicit((Object)(object)SceneInfo.instance))
{
teleportPosition = default(Vector3);
return false;
}
NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph((GraphType)1);
List<NodeIndex> list = nodeGraph.FindNodesInRange(nearPosition, nodeSearchRadiusMin, nodeSearchRadiusMax, (HullMask)1);
if (list.Count >= 1)
{
Vector3 val2 = default(Vector3);
for (int i = 0; i < list.Count; i++)
{
NodeIndex val = list[i];
if (!DirectorCore.instance.CheckNodeOccupied(nodeGraph, val) && nodeGraph.GetNodePosition(val, ref val2) && (!(collisionCheckDistance >= 0f) || CheckTeleportPositionValid(val2)))
{
teleportPosition = val2;
return true;
}
}
}
teleportPosition = default(Vector3);
return false;
}
private bool CheckTeleportPositionValid(Vector3 telePosition)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
if (Physics.OverlapSphere(telePosition, collisionCheckDistance, LayerMask.op_Implicit(CommonMasks.allCharacterCollisions), (QueryTriggerInteraction)1).Length != 0)
{
return false;
}
return true;
}
}
public class Beetle
{
public static EntityStateConfiguration beetleSpawn = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/Beetle/EntityStates.BeetleMonster.SpawnState.asset").WaitForCompletion();
public static EntityStateConfiguration beetleHeadbutt = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/Beetle/EntityStates.BeetleMonster.HeadbuttState.asset").WaitForCompletion();
public Beetle()
{
if (Configs.beetleSpawnDuration.Value >= 0f)
{
beetleSpawn.TryModifyFieldValue("duration", Configs.beetleSpawnDuration.Value);
}
if (Configs.beetleHeadbuttDmg.Value >= 0f)
{
beetleHeadbutt.TryModifyFieldValue("damageCoefficient", Configs.beetleHeadbuttDmg.Value);
}
}
}
public class BighornBison
{
public static EntityStateConfiguration bisonCharge = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/Base/Bison/EntityStates.Bison.Charge.asset").WaitForCompletion();
public BighornBison()
{
if (Configs.bighornBisonChargeCoeff.Value >= 0f)
{
bisonCharge.TryModifyFieldValue("chargeMovementSpeedCoefficient", Configs.bighornBisonChargeCoeff.Value);
}
}
}
public class ClayApothecary
{
public static CharacterSpawnCard cscClayGrenadier = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/ClayGrenadier/cscClayGrenadier.asset").WaitForCompletion();
public static GameObject clayGrenadierMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ClayGrenadier/ClayGrenadierMaster.prefab").WaitForCompletion();
public ClayApothecary()
{
if (Configs.clayApothecaryCost.Value >= 0)
{
((SpawnCard)cscClayGrenadier).directorCreditCost = Configs.clayApothecaryCost.Value;
}
if (!(Configs.clayApothecaryTarBallRange.Value >= 0f))
{
return;
}
AISkillDriver[] components = clayGrenadierMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array = components;
foreach (AISkillDriver val in array)
{
if (val.customName == "ThrowBarrel")
{
val.maxDistance = Configs.clayApothecaryTarBallRange.Value;
}
}
}
}
public class Geep
{
public static CharacterSpawnCard cscGeep = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/Gup/cscGeepBody.asset").WaitForCompletion();
public Geep()
{
if (Configs.geepCost.Value >= 0)
{
((SpawnCard)cscGeep).directorCreditCost = Configs.geepCost.Value;
}
}
}
public class Grandparent
{
public static CharacterSpawnCard cscGrandparent = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Grandparent/cscGrandparent.asset").WaitForCompletion();
public static GameObject grandparentMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Grandparent/GrandparentMaster.prefab").WaitForCompletion();
public static GameObject gravOrb = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Grandparent/GrandparentGravSphere.prefab").WaitForCompletion();
public Grandparent()
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Invalid comparison between Unknown and I4
if (Configs.grandparentCost.Value >= 0)
{
((SpawnCard)cscGrandparent).directorCreditCost = Configs.grandparentCost.Value;
}
if (Configs.grandparentRockActivationRange.Value >= 0f)
{
AISkillDriver[] components = grandparentMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array = components;
foreach (AISkillDriver val in array)
{
if (val.customName == "GroundSwipe")
{
val.maxDistance = Configs.grandparentRockActivationRange.Value;
}
}
}
if (Configs.grandparentGravOrbDynamicSpeed.Value)
{
FireSecondaryProjectile.Fire += new hook_Fire(FireGravOrb);
}
if (Configs.grandparentGravOrbForce.Value != -1000f)
{
RadialForce component = gravOrb.GetComponent<RadialForce>();
if (Object.op_Implicit((Object)(object)component))
{
component.forceMagnitude = Configs.grandparentGravOrbForce.Value;
}
}
if (!Configs.grandparentReduceDowntime.Value)
{
return;
}
AISkillDriver[] components2 = grandparentMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array2 = components2;
foreach (AISkillDriver val2 in array2)
{
if ((int)val2.skillSlot == -1 && val2.driverUpdateTimerOverride > 2f)
{
val2.driverUpdateTimerOverride = 2f;
}
}
}
private void FireGravOrb(orig_Fire orig, FireSecondaryProjectile self)
{
//IL_00a8: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && Object.op_Implicit((Object)(object)((Component)((EntityState)self).characterBody).gameObject) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.master))
{
BaseAI component = ((Component)((EntityState)self).characterBody.master).GetComponent<BaseAI>();
if (Object.op_Implicit((Object)(object)component) && component.currentEnemy != null && Object.op_Implicit((Object)(object)component.currentEnemy.characterBody) && Object.op_Implicit((Object)(object)((Component)component.currentEnemy.characterBody).gameObject))
{
Vector3 val = ((Component)((EntityState)self).characterBody).gameObject.transform.position - ((Component)component.currentEnemy.characterBody).gameObject.transform.position;
num = ((Vector3)(ref val)).magnitude;
}
}
float num2 = Mathf.Clamp(num / 90f, 1f, 15f);
ProjectileSimple component2 = self.projectilePrefab.GetComponent<ProjectileSimple>();
if (Object.op_Implicit((Object)(object)component2))
{
component2.desiredForwardSpeed *= num2;
}
orig.Invoke(self);
if (Object.op_Implicit((Object)(object)component2))
{
component2.desiredForwardSpeed /= num2;
}
}
}
public class Gup
{
public static GameObject gupMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Gup/GupMaster.prefab").WaitForCompletion();
public Gup()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
if (Configs.gupDelayAttackOnSpawn.Value)
{
AISkillDriver val = gupMasterPrefab.AddComponent<AISkillDriver>();
val.activationRequiresAimConfirmation = false;
val.activationRequiresAimTargetLoS = false;
val.activationRequiresTargetLoS = false;
val.aimType = (AimType)1;
val.buttonPressType = (ButtonPressType)1;
val.customName = "SpawnAttackDelay";
val.driverUpdateTimerOverride = 1f;
val.ignoreNodeGraph = false;
val.maxDistance = float.PositiveInfinity;
val.maxTargetHealthFraction = float.PositiveInfinity;
val.maxTimesSelected = 1;
val.maxUserHealthFraction = float.PositiveInfinity;
val.minDistance = 0f;
val.minTargetHealthFraction = float.NegativeInfinity;
val.minUserHealthFraction = float.NegativeInfinity;
val.moveInputScale = 1f;
val.movementType = (MovementType)1;
val.moveTargetType = (TargetType)0;
val.noRepeat = true;
val.requireEquipmentReady = false;
val.requireSkillReady = false;
val.resetCurrentEnemyOnNextDriverSelection = false;
val.selectionRequiresAimTarget = false;
val.selectionRequiresOnGround = false;
val.selectionRequiresTargetLoS = false;
val.selectionRequiresTargetNonFlier = false;
val.shouldFireEquipment = false;
val.shouldSprint = false;
val.skillSlot = (SkillSlot)(-1);
gupMasterPrefab.ReorderSkillDrivers(val, 0);
}
}
}
public class Imp
{
public static CharacterSpawnCard cscImp = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Imp/cscImp.asset").WaitForCompletion();
public Imp()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_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_004e: Expected O, but got Unknown
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
if (Configs.impOnHelminthRoost.Value)
{
DirectorCardHolder val = new DirectorCardHolder
{
Card = new DirectorCard
{
minimumStageCompletions = 0,
preventOverhead = false,
selectionWeight = 2,
spawnDistance = (MonsterSpawnDistance)0,
spawnCard = (SpawnCard)(object)cscImp
},
MonsterCategory = (MonsterCategory)2
};
Helpers.AddNewMonsterToStage(val, false, (Stage)1099511627776L, "");
}
}
}
public class Lemurian
{
public static GameObject lemurianMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/LemurianMaster.prefab").WaitForCompletion();
public Lemurian()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Invalid comparison between Unknown and I4
if (!(Configs.lemurianFireballRange.Value >= 0f))
{
return;
}
if (Configs.lemurianFireballRange.Value > 30f)
{
AISkillDriver val = lemurianMasterPrefab.AddComponent<AISkillDriver>();
val.activationRequiresAimConfirmation = false;
val.activationRequiresAimTargetLoS = false;
val.activationRequiresTargetLoS = true;
val.aimType = (AimType)1;
val.buttonPressType = (ButtonPressType)0;
val.customName = "ChasePrimary";
val.driverUpdateTimerOverride = -1f;
val.ignoreNodeGraph = false;
val.maxDistance = Configs.lemurianFireballRange.Value;
val.maxTargetHealthFraction = float.PositiveInfinity;
val.maxTimesSelected = -1;
val.maxUserHealthFraction = float.PositiveInfinity;
val.minDistance = 15f;
val.minTargetHealthFraction = float.NegativeInfinity;
val.minUserHealthFraction = float.NegativeInfinity;
val.moveInputScale = 1f;
val.movementType = (MovementType)1;
val.moveTargetType = (TargetType)0;
val.noRepeat = false;
val.requireEquipmentReady = false;
val.requireSkillReady = false;
val.resetCurrentEnemyOnNextDriverSelection = false;
val.selectionRequiresAimTarget = false;
val.selectionRequiresOnGround = false;
val.selectionRequiresTargetLoS = true;
val.selectionRequiresTargetNonFlier = false;
val.shouldFireEquipment = false;
val.shouldSprint = false;
val.skillSlot = (SkillSlot)0;
lemurianMasterPrefab.ReorderSkillDrivers(val, 4);
return;
}
AISkillDriver[] components = lemurianMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array = components;
foreach (AISkillDriver val2 in array)
{
if ((int)val2.skillSlot == 0)
{
val2.maxDistance = Configs.lemurianFireballRange.Value;
}
}
}
}
public class MiniMushrum
{
public static GameObject mushrumMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MiniMushroom/MiniMushroomMaster.prefab").WaitForCompletion();
public static GameObject mushrumBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MiniMushroom/MiniMushroomBody.prefab").WaitForCompletion();
public static CharacterSpawnCard cscMiniMushroom = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/MiniMushroom/cscMiniMushroom.asset").WaitForCompletion();
public MiniMushrum()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: 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_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: 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_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Expected O, but got Unknown
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Expected O, but got Unknown
if (Configs.mushrumSprintDist.Value >= 0f)
{
AISkillDriver val = mushrumMasterPrefab.AddComponent<AISkillDriver>();
val.activationRequiresAimConfirmation = false;
val.activationRequiresAimTargetLoS = false;
val.activationRequiresTargetLoS = false;
val.aimType = (AimType)1;
val.buttonPressType = (ButtonPressType)0;
val.customName = "PathSprint";
val.driverUpdateTimerOverride = -1f;
val.ignoreNodeGraph = false;
val.maxDistance = float.PositiveInfinity;
val.maxTargetHealthFraction = float.PositiveInfinity;
val.maxTimesSelected = -1;
val.maxUserHealthFraction = float.PositiveInfinity;
val.minDistance = Configs.mushrumSprintDist.Value;
val.minTargetHealthFraction = float.NegativeInfinity;
val.minUserHealthFraction = float.NegativeInfinity;
val.moveInputScale = 1f;
val.movementType = (MovementType)1;
val.moveTargetType = (TargetType)0;
val.noRepeat = false;
val.requireEquipmentReady = false;
val.requireSkillReady = false;
val.resetCurrentEnemyOnNextDriverSelection = false;
val.selectionRequiresAimTarget = false;
val.selectionRequiresOnGround = false;
val.selectionRequiresTargetLoS = false;
val.selectionRequiresTargetNonFlier = false;
val.shouldFireEquipment = false;
val.shouldSprint = true;
val.skillSlot = (SkillSlot)(-1);
mushrumMasterPrefab.ReorderSkillDrivers(val, 3);
}
if (Configs.mushrumSprintCoeff.Value >= 0f)
{
CharacterBody component = mushrumBodyPrefab.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component))
{
component.sprintingSpeedMultiplier = Configs.mushrumSprintCoeff.Value;
}
}
if (Configs.mushrumOnHabitatFall.Value)
{
DirectorCardHolder val2 = new DirectorCardHolder
{
Card = new DirectorCard
{
minimumStageCompletions = 0,
preventOverhead = false,
selectionWeight = 1,
spawnDistance = (MonsterSpawnDistance)0,
spawnCard = (SpawnCard)(object)cscMiniMushroom
},
MonsterCategory = (MonsterCategory)2
};
Helpers.AddNewMonsterToStage(val2, false, (Stage)549755813888L, "");
}
}
}
public class SolusControlUnit
{
public static GameObject scuMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBoss/RoboBallBossMaster.prefab").WaitForCompletion();
public static GameObject awuMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBoss/SuperRoboBallBossMaster.prefab").WaitForCompletion();
public SolusControlUnit()
{
if (Configs.scuRespectNodegraph.Value || Configs.scuPrimaryAttackRange.Value >= 0f || Configs.scuProbeHealthThreshold.Value >= 0f)
{
AISkillDriver[] components = scuMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array = components;
foreach (AISkillDriver skillDriver in array)
{
AdjustSkillDrivers(skillDriver);
}
components = awuMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array2 = components;
foreach (AISkillDriver skillDriver2 in array2)
{
AdjustSkillDrivers(skillDriver2);
}
}
}
private void AdjustSkillDrivers(AISkillDriver skillDriver)
{
switch (skillDriver.customName)
{
case "FireAndChase":
if (Configs.scuRespectNodegraph.Value)
{
skillDriver.ignoreNodeGraph = false;
}
break;
case "FireAndStop":
if (Configs.scuPrimaryAttackRange.Value >= 0f)
{
skillDriver.maxDistance = Configs.scuPrimaryAttackRange.Value;
}
break;
case "FireAndFlee":
if (Configs.scuPrimaryAttackRange.Value >= 0f && Configs.scuPrimaryAttackRange.Value < skillDriver.maxDistance)
{
skillDriver.maxDistance = Configs.scuPrimaryAttackRange.Value;
}
break;
case "DeployMinion":
if (Configs.scuProbeHealthThreshold.Value >= 0f)
{
if (Configs.scuProbeHealthThreshold.Value >= 1f)
{
skillDriver.maxUserHealthFraction = float.PositiveInfinity;
}
else
{
skillDriver.maxUserHealthFraction = Configs.scuProbeHealthThreshold.Value;
}
}
break;
}
}
}
public class SolusDistributor
{
public static CharacterSpawnCard cscMinePod = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/MinePod/cscMinePod.asset").WaitForCompletion();
public SolusDistributor()
{
if (Configs.distributorCost.Value >= 0)
{
((SpawnCard)cscMinePod).directorCreditCost = Configs.distributorCost.Value;
}
}
}
public class SolusProbe
{
public static CharacterSpawnCard cscProbe = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/RoboBallBoss/cscRoboBallMini.asset").WaitForCompletion();
public static GameObject probeMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBoss/RoboBallMiniMaster.prefab").WaitForCompletion();
public static FamilyDirectorCardCategorySelection solusFamily = Addressables.LoadAssetAsync<FamilyDirectorCardCategorySelection>((object)"RoR2/DLC3/dccsSuperRoboBallpitFamily.asset").WaitForCompletion();
public SolusProbe()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_00a3: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: 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_014c: Expected O, but got Unknown
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: 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_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
if (Configs.probeCost.Value >= 0)
{
((SpawnCard)cscProbe).directorCreditCost = Configs.probeCost.Value;
}
if (Configs.probeOnShipGraveyard.Value)
{
DirectorCardHolder val = new DirectorCardHolder
{
Card = new DirectorCard
{
minimumStageCompletions = 0,
preventOverhead = false,
selectionWeight = 5,
spawnDistance = (MonsterSpawnDistance)0,
spawnCard = (SpawnCard)(object)cscProbe
},
MonsterCategory = (MonsterCategory)2
};
Helpers.AddNewMonsterToStage(val, false, (Stage)256, "");
}
if (Configs.probeOnRepurposedCrater.Value)
{
DirectorCardHolder val2 = new DirectorCardHolder
{
Card = new DirectorCard
{
minimumStageCompletions = 0,
preventOverhead = false,
selectionWeight = 5,
spawnDistance = (MonsterSpawnDistance)0,
spawnCard = (SpawnCard)(object)cscProbe
},
MonsterCategory = (MonsterCategory)2
};
Helpers.AddNewMonsterToStage(val2, false, (Stage)140737488355328L, "");
}
if (Configs.probeOnSolusEvent.Value)
{
DirectorCardHolder val3 = new DirectorCardHolder
{
Card = new DirectorCard
{
minimumStageCompletions = 0,
preventOverhead = false,
selectionWeight = 1,
spawnDistance = (MonsterSpawnDistance)0,
spawnCard = (SpawnCard)(object)cscProbe
},
MonsterCategory = (MonsterCategory)2
};
DirectorAPI.AddCard((DirectorCardCategorySelection)(object)solusFamily, val3);
}
if (Configs.probeDelayAttackOnSpawn.Value)
{
AISkillDriver val4 = probeMasterPrefab.AddComponent<AISkillDriver>();
val4.activationRequiresAimConfirmation = false;
val4.activationRequiresAimTargetLoS = false;
val4.activationRequiresTargetLoS = false;
val4.aimType = (AimType)1;
val4.buttonPressType = (ButtonPressType)1;
val4.customName = "SpawnAttackDelay";
val4.driverUpdateTimerOverride = 1.5f;
val4.ignoreNodeGraph = false;
val4.maxDistance = float.PositiveInfinity;
val4.maxTargetHealthFraction = float.PositiveInfinity;
val4.maxTimesSelected = 1;
val4.maxUserHealthFraction = float.PositiveInfinity;
val4.minDistance = 0f;
val4.minTargetHealthFraction = float.NegativeInfinity;
val4.minUserHealthFraction = float.NegativeInfinity;
val4.moveInputScale = 1f;
val4.movementType = (MovementType)2;
val4.moveTargetType = (TargetType)0;
val4.noRepeat = true;
val4.requireEquipmentReady = false;
val4.requireSkillReady = false;
val4.resetCurrentEnemyOnNextDriverSelection = false;
val4.selectionRequiresAimTarget = false;
val4.selectionRequiresOnGround = false;
val4.selectionRequiresTargetLoS = false;
val4.selectionRequiresTargetNonFlier = false;
val4.shouldFireEquipment = false;
val4.shouldSprint = false;
val4.skillSlot = (SkillSlot)(-1);
probeMasterPrefab.ReorderSkillDrivers(val4, 0);
}
}
}
public class SolusTransporter
{
public static CharacterSpawnCard cscIronHauler = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/IronHauler/cscIronHauler.asset").WaitForCompletion();
public SolusTransporter()
{
if (Configs.transporterCost.Value >= 0)
{
((SpawnCard)cscIronHauler).directorCreditCost = Configs.transporterCost.Value;
}
}
}
public class VoidReaver
{
public static CharacterSpawnCard cscNullifier = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Nullifier/cscNullifier.asset").WaitForCompletion();
public VoidReaver()
{
if (Configs.voidReaverCost.Value >= 0)
{
((SpawnCard)cscNullifier).directorCreditCost = Configs.voidReaverCost.Value;
}
}
}
public class EccentricVase
{
public static BuffDef cloakBuff = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdCloak.asset").WaitForCompletion();
public static BuffDef intangibleBuff = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdIntangible.asset").WaitForCompletion();
public static BuffDef fallImmuneBuff = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Junk/Common/bdIgnoreFallDamage.asset").WaitForCompletion();
public static GameObject ziplineVehicle = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Gateway/ZiplineVehicle.prefab").WaitForCompletion();
public static EquipmentDef gateway = Addressables.LoadAssetAsync<EquipmentDef>((object)"RoR2/Base/Gateway/Gateway.asset").WaitForCompletion();
public EccentricVase()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Expected O, but got Unknown
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
if (Configs.eccentricVaseCooldown.Value >= 0f)
{
gateway.cooldown = Configs.eccentricVaseCooldown.Value;
}
if (Configs.eccentricVaseMaxDist.Value >= 0f)
{
bool hookFailed = true;
EquipmentSlot.FireGateway += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1000f)
}))
{
val.Next.Operand = Configs.eccentricVaseMaxDist.Value;
hookFailed = false;
}
if (hookFailed)
{
Log.Error("Eccentric Vase length hook failed!");
}
};
if (!hookFailed)
{
UpdateDescription(Configs.eccentricVaseMaxDist.Value);
}
}
if (Configs.eccentricVaseAcceleration.Value >= 0f)
{
ziplineVehicle.GetComponent<ZiplineVehicle>().acceleration = Configs.eccentricVaseAcceleration.Value;
}
if (Configs.eccentricVaseCloak.Value || Configs.eccentricVaseIntangible.Value || Configs.eccentricVaseNoCrater.Value)
{
ZiplineVehicle.OnPassengerEnter += new hook_OnPassengerEnter(OnPassengerEnter);
ZiplineVehicle.OnPassengerExit += new hook_OnPassengerExit(OnPassengerExit);
}
}
private void OnPassengerEnter(orig_OnPassengerEnter orig, ZiplineVehicle self, GameObject passenger)
{
CharacterBody component = passenger.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component))
{
if (Configs.eccentricVaseCloak.Value)
{
component.AddBuff(cloakBuff);
}
if (Configs.eccentricVaseIntangible.Value)
{
component.AddBuff(intangibleBuff);
}
}
orig.Invoke(self, passenger);
}
private void OnPassengerExit(orig_OnPassengerExit orig, ZiplineVehicle self, GameObject passenger)
{
orig.Invoke(self, passenger);
CharacterBody component = passenger.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)component))
{
if (Configs.eccentricVaseCloak.Value)
{
component.RemoveBuff(cloakBuff);
}
if (Configs.eccentricVaseIntangible.Value)
{
component.RemoveBuff(intangibleBuff);
}
if (Configs.eccentricVaseNoCrater.Value)
{
component.AddTimedBuff(fallImmuneBuff, 0.5f);
}
}
}
private void UpdateDescription(float distance)
{
string text = distance.ToString().Replace(",", ".");
LanguageAPI.Add("EQUIPMENT_GATEWAY_DESC", "Create a <style=cIsUtility>quantum tunnel</style> of up to <style=cIsUtility>" + text + "m</style> in length. Lasts 30 seconds.", "en");
}
}
public class Molotov6Pack
{
public static GameObject molotovDotZone = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Molotov/MolotovProjectileDotZone.prefab").WaitForCompletion();
public static GameObject molotovClusterProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Molotov/MolotovClusterProjectile.prefab").WaitForCompletion();
public static GameObject molotovSingleProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/Molotov/MolotovSingleProjectile.prefab").WaitForCompletion();
public Molotov6Pack()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
float num = 1f;
float num2 = 2.5f;
if (Configs.molotovResidueSize.Value >= 0f)
{
Transform transform = ((Component)molotovDotZone.GetComponent<ProjectileDotZone>()).gameObject.transform;
transform.localScale *= Configs.molotovResidueSize.Value;
}
if (Configs.molotovResidueDuration.Value >= 0f)
{
molotovDotZone.GetComponent<ProjectileDotZone>().lifetime = Configs.molotovResidueDuration.Value;
}
if (Configs.molotovResidueTickrate.Value > 0f)
{
molotovDotZone.GetComponent<ProjectileDotZone>().fireFrequency = Configs.molotovResidueTickrate.Value;
num = Configs.molotovResidueTickrate.Value;
}
else if (Configs.molotovResidueTickrate.Value == 0f)
{
((Behaviour)molotovDotZone.GetComponent<ProjectileDotZone>()).enabled = false;
num = 0f;
}
if (Configs.molotovExplosionDamage.Value >= 0f)
{
((ProjectileExplosion)molotovClusterProjectile.GetComponent<ProjectileImpactExplosion>()).blastDamageCoefficient = Configs.molotovExplosionDamage.Value;
((ProjectileExplosion)molotovSingleProjectile.GetComponent<ProjectileImpactExplosion>()).blastDamageCoefficient = Configs.molotovExplosionDamage.Value;
num2 = Configs.molotovExplosionDamage.Value;
}
if (num != 2f || num2 != 5f)
{
UpdateDescription(num * 100f, num2 * 100f);
}
}
private void UpdateDescription(float tickRate, float explosionDamage)
{
string text = tickRate.ToString().Replace(",", ".");
string text2 = explosionDamage.ToString().Replace(",", ".");
LanguageAPI.Add("EQUIPMENT_MOLOTOV_DESC", "Throw <style=cIsDamage>6</style> molotov cocktails that <style=cIsDamage>ignites</style> enemies for <style=cIsDamage>" + text2 + "% base damage</style>. Each molotov leaves a burning area for <style=cIsDamage>" + text + "% damage per second</style>.", "en");
}
}
public class EclipseLite
{
public EclipseLite()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
bool updated = false;
float basePercentage = 1f;
float stackPercentage = 0.25f;
if (Configs.eclipseLiteBarrierBase.Value >= 0f)
{
bool hookFailed2 = true;
CharacterBody.OnSkillCooldown += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val2 = new ILCursor(il);
if (val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BarrierOnCooldown")
}) && val2.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.01f)
}))
{
val2.Next.Operand = Configs.eclipseLiteBarrierBase.Value / 100f;
hookFailed2 = false;
updated = true;
basePercentage = Configs.eclipseLiteBarrierBase.Value;
}
if (hookFailed2)
{
Log.Error("Eclipse Lite (first stack) hook failed!");
}
};
}
if (Configs.eclipseLiteBarrierStack.Value >= 0f)
{
bool hookFailed = true;
CharacterBody.OnSkillCooldown += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BarrierOnCooldown")
}) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.0025f)
}))
{
val.Next.Operand = Configs.eclipseLiteBarrierStack.Value / 100f;
hookFailed = false;
updated = true;
stackPercentage = Configs.eclipseLiteBarrierStack.Value;
}
if (hookFailed)
{
Log.Error("Eclipse Lite (subsequent stacks) hook failed!");
}
};
}
if (updated)
{
UpdateDescription(basePercentage, stackPercentage);
}
}
private void UpdateDescription(float baseBarrier, float stackBarrier)
{
string text = baseBarrier.ToString().Replace(",", ".");
string text2 = stackBarrier.ToString().Replace(",", ".");
LanguageAPI.Add("ITEM_BARRIERONCOOLDOWN_DESC", "When a skill comes off cooldown, gain a <style=cIsDamage>temporary barrier</style> for <style=cIsHealing>" + text + "%</style> <style=cStack>(+" + text2 + "% per stack)</style> of your maximum health per second of the skill's base cooldown.", "en");
}
}
public class EmpathyCores
{
public static GameObject roboBallBuddyRedPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBuddy/RoboBallRedBuddyBody.prefab").WaitForCompletion();
public static GameObject roboBallBuddyGreenPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/RoboBallBuddy/RoboBallGreenBuddyBody.prefab").WaitForCompletion();
public static ItemDef teamSizeDamageBonus = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/TeamSizeDamageBonus/TeamSizeDamageBonus.asset").WaitForCompletion();
public EmpathyCores()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
if (!Configs.empathyCoresDamageTweak.Value)
{
return;
}
bool hookFailed = true;
CharacterBody.RecalculateStats += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "TeamSizeDamageBonus")
}))
{
val.Remove();
val.Emit<Main>(OpCodes.Ldsfld, "emptyItemDef");
hookFailed = false;
}
if (hookFailed)
{
Log.Error("Empathy Cores damage tweak hook failed!");
}
};
if (!hookFailed)
{
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients);
FireEyeBeam.ModifyBullet += new hook_ModifyBullet(FireEyeBeam);
}
}
private void GetStatCoefficients(CharacterBody body, StatHookEventArgs args)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)body) || (!((Object)(object)BodyCatalog.GetBodyPrefab(body.bodyIndex) == (Object)(object)roboBallBuddyRedPrefab) && !((Object)(object)BodyCatalog.GetBodyPrefab(body.bodyIndex) == (Object)(object)roboBallBuddyGreenPrefab)) || !Object.op_Implicit((Object)(object)body.inventory))
{
return;
}
int itemCountEffective = body.inventory.GetItemCountEffective(teamSizeDamageBonus);
if (itemCountEffective > 0)
{
int num = Math.Max(TeamComponent.GetTeamMembers(body.teamComponent.teamIndex).Count - 1, 0);
float multiplier = 1f + (float)(num * itemCountEffective);
ProbeLaserDmgMultiplier component = ((Component)body).GetComponent<ProbeLaserDmgMultiplier>();
if (Object.op_Implicit((Object)(object)component))
{
component.multiplier = multiplier;
return;
}
component = ((Component)body).gameObject.AddComponent<ProbeLaserDmgMultiplier>();
component.multiplier = multiplier;
}
}
private void FireEyeBeam(orig_ModifyBullet orig, FireEyeBeam self, BulletAttack bulletAttack)
{
if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
{
ProbeLaserDmgMultiplier component = ((Component)((EntityState)self).characterBody).GetComponent<ProbeLaserDmgMultiplier>();
if (Object.op_Implicit((Object)(object)component))
{
bulletAttack.damage *= component.multiplier;
}
}
orig.Invoke(self, bulletAttack);
}
}
public class ProbeLaserDmgMultiplier : MonoBehaviour
{
public float multiplier = 1f;
}
public class HappiestMask
{
public HappiestMask()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
if (!(Configs.happiestMaskProcChance.Value >= 0f))
{
return;
}
bool hookFailed = true;
GlobalEventManager.OnCharacterDeath += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "GhostOnKill")
}) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 7f)
}))
{
val.Next.Operand = Configs.happiestMaskProcChance.Value;
hookFailed = false;
}
if (hookFailed)
{
Log.Error("Happiest Mask Proc Chance hook failed!");
}
};
if (!hookFailed)
{
UpdateDescription(Configs.happiestMaskProcChance.Value);
}
}
private void UpdateDescription(float procChance)
{
string text = procChance.ToString().Replace(",", ".");
LanguageAPI.Add("ITEM_GHOSTONKILL_DESC", "Killing enemies has a <style=cIsDamage>" + text + "%</style> chance to <style=cIsDamage>spawn a ghost</style> of the killed enemy with <style=cIsDamage>1500%</style> damage. Lasts <style=cIsDamage>30s</style> <style=cStack>(+30s per stack)</style>.", "en");
}
}
public class OldWarStealthkit
{
public static ItemDef stealthkit = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/Phasing/Phasing.asset").WaitForCompletion();
public OldWarStealthkit()
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
bool updated = false;
if (Configs.stealthKitThreshold.Value >= 0f)
{
bool hookFailed = true;
PhasingBodyBehavior.FixedUpdate += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, "RoR2.HealthComponent", "get_isHealthLow")
}))
{
val.Remove();
val.EmitDelegate<Func<HealthComponent, bool>>((Func<HealthComponent, bool>)((HealthComponent health) => health.IsHealthBelowThreshold(Configs.stealthKitThreshold.Value)));
hookFailed = false;
updated = true;
}
if (hookFailed)
{
Log.Error("Old War Stealthkit threshold hook failed!");
}
};
}
if (updated)
{
if (Configs.stealthKitThreshold.Value != 0.25f)
{
stealthkit.tags = stealthkit.tags.RemoveFromArray((ItemTag)16);
}
UpdateDescription(Configs.stealthKitThreshold.Value * 100f);
}
}
private void UpdateDescription(float threshold)
{
string text = threshold.ToString().Replace(",", ".");
LanguageAPI.Add("ITEM_PHASING_DESC", "Falling below <style=cIsHealth>" + text + "% health</style> causes you to gain <style=cIsUtility>40% movement speed</style> and <style=cIsUtility>invisibility</style> for <style=cIsUtility>5s</style>. Recharges every <style=cIsUtility>30 seconds</style> <style=cStack>(-50% per stack)</style>.", "en");
}
}
public class OrphanedCore
{
public static EntityStateConfiguration bestBuddyRam = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)"RoR2/DLC3/FriendUnit/EntityStates.FriendUnit.KineticAura.asset").WaitForCompletion();
public static GameObject friendUnitMasterPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/FriendUnit/FriendUnitMaster.prefab").WaitForCompletion();
public static GameObject friendUnitBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/FriendUnit/FriendUnitBody.prefab").WaitForCompletion();
public OrphanedCore()
{
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
if (Configs.bestBuddyRamDamage.Value >= 0f)
{
bestBuddyRam.TryModifyFieldValue("chargeDamageCoefficient", Configs.bestBuddyRamDamage.Value);
bestBuddyRam.TryModifyFieldValue("knockbackDamageCoefficient", Configs.bestBuddyRamDamage.Value * 2.5f);
UpdateDescription(Configs.bestBuddyRamDamage.Value * 100f);
}
if (Configs.bestBuddyHitDetection.Value)
{
if (bestBuddyRam.TryGetFieldValueString<float>("refreshTime", out var value) && value > 1f)
{
bestBuddyRam.TryModifyFieldValue("refreshTime", 1f);
}
CharacterBody component = friendUnitBodyPrefab.GetComponent<CharacterBody>();
if (!Object.op_Implicit((Object)(object)component))
{
return;
}
ModelLocator component2 = ((Component)component).GetComponent<ModelLocator>();
if (!Object.op_Implicit((Object)(object)component2))
{
return;
}
Transform modelTransform = component2.modelTransform;
if (!Object.op_Implicit((Object)(object)modelTransform))
{
return;
}
HitBoxGroup component3 = ((Component)modelTransform).GetComponent<HitBoxGroup>();
if (!Object.op_Implicit((Object)(object)component3))
{
return;
}
HitBox[] hitBoxes = component3.hitBoxes;
HitBox[] array = hitBoxes;
foreach (HitBox val in array)
{
Transform transform = ((Component)val).transform;
transform.localScale *= 2.5f;
}
}
if (!Configs.bestBuddyBehaviorTweak.Value)
{
return;
}
if (bestBuddyRam.TryGetFieldValueString<float>("initialHopVelocity", out var value2) && value2 < 1.2f)
{
bestBuddyRam.TryModifyFieldValue("initialHopVelocity", 1.2f);
}
if (bestBuddyRam.TryGetFieldValueString<float>("lockonDistance", out var value3) && value3 < 40f)
{
bestBuddyRam.TryModifyFieldValue("lockonDistance", 50f);
}
if (bestBuddyRam.TryGetFieldValueString<float>("lockonAngle", out var value4) && value4 < 360f)
{
bestBuddyRam.TryModifyFieldValue("lockonAngle", 360f);
}
if (bestBuddyRam.TryGetFieldValueString<float>("recoilAmplitude", out var value5) && value5 < 2f)
{
bestBuddyRam.TryModifyFieldValue("recoilAmplitude", 2f);
}
AISkillDriver[] components = friendUnitMasterPrefab.GetComponents<AISkillDriver>();
AISkillDriver[] array2 = components;
foreach (AISkillDriver val2 in array2)
{
string customName = val2.customName;
string text = customName;
if (!(text == "KineticAura"))
{
if (text == "StrafeAroundEnemy")
{
if (val2.minDistance > 0f)
{
val2.minDistance = 0f;
}
if (val2.maxDistance < 20f)
{
val2.maxDistance = 20f;
}
break;
}
continue;
}
if (val2.maxDistance < 50f)
{
val2.maxDistance = 50f;
}
val2.requireSkillReady = true;
val2.shouldSprint = true;
val2.resetCurrentEnemyOnNextDriverSelection = true;
break;
}
}
private void UpdateDescription(float ramDamage)
{
string text = ramDamage.ToString().Replace(",", ".");
LanguageAPI.Add("ITEM_PHYSICSPROJECTILE_DESC", "Gain a <style=cIsHealing>friendly Solus unit</style> that launches itself at enemies for <style=cIsDamage>" + text + "%</style> <style=cStack>(+" + text + "% per stack)</style> <style=cIsDamage>damage</style>. The unit inherits your <style=cIsUtility>movement speed items</style> and deals <style=cIsDamage>more damage the faster it moves</style>. The unit can be pet to <style=cIsHealing>cleanse negative effects</style>. Recharges after 15 seconds.", "en");
}
}
public class SonorousWhispers
{
public static ItemDef whispers = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/ItemDropChanceOnKill/ItemDropChanceOnKill.asset").WaitForCompletion();
public static WeightedSelection<UniquePickup> selector = new WeightedSelection<UniquePickup>(8);
public static float tier1Weight = 0.6f;
public static float tier2Weight = 0.38f;
public static float tier3Weight = 0.02f;
public SonorousWhispers()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
if (!Configs.sonorousWhispersRework.Value)
{
return;
}
bool hookFailed = true;
GlobalEventManager.OnCharacterDeath += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ItemDropChanceOnKill")
}))
{
val.Remove();
val.Emit<Main>(OpCodes.Ldsfld, "emptyItemDef");
hookFailed = false;
}
if (hookFailed)
{
Log.Error("Sonorous Whispers Rework hook failed!");
}
};
if (!hookFailed)
{
whispers.tags = whispers.tags.AddToArray((ItemTag)13);
GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal;
UpdateDescription();
}
}
private void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//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_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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active || damageReport == null)
{
return;
}
CharacterBody victimBody = damageReport.victimBody;
CharacterMaster attackerMaster = damageReport.attackerMaster;
TeamIndex attackerTeamIndex = damageReport.attackerTeamIndex;
if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)attackerMaster))
{
return;
}
GameObject val = null;
if (Object.op_Implicit((Object)(object)damageReport.victim))
{
val = ((Component)damageReport.victim).gameObject;
}
Vector3 val2 = Vector3.zero;
Quaternion val3 = Quaternion.identity;
Transform transform = val.transform;
if (Object.op_Implicit((Object)(object)transform))
{
val2 = transform.position;
val3 = transform.rotation;
}
InputBankTest val4 = null;
if (Object.op_Implicit((Object)(object)victimBody))
{
val4 = victimBody.inputBank;
}
Ray val5 = (Ray)(Object.op_Implicit((Object)(object)val4) ? val4.GetAimRay() : new Ray(val2, val3 * Vector3.forward));
int num = 0;
ReadOnlyCollection<CharacterMaster> readOnlyInstancesList = CharacterMaster.readOnlyInstancesList;
for (int i = 0; i < readOnlyInstancesList.Count; i++)
{
CharacterMaster val6 = readOnlyInstancesList[i];
if (val6.teamIndex == attackerTeamIndex)
{
num += val6.inventory.GetItemCountEffective(Items.ItemDropChanceOnKill);
}
}
if (num > 0 && victimBody.isBoss)
{
PickupDropletController.CreatePickupDroplet(GenerateDrop(num), val2 + Vector3.up * 1.5f, Vector3.up * 20f + ((Ray)(ref val5)).direction * 2f, false, false);
}
}
private UniquePickup GenerateDrop(int num)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
selector.Clear();
Add(Run.instance.availableTier1DropList, tier1Weight);
Add(Run.instance.availableTier2DropList, tier2Weight * (float)num);
Add(Run.instance.availableTier3DropList, tier3Weight * Mathf.Pow((float)num, 2f));
return PickupDropTable.GeneratePickupFromWeightedSelection(Run.instance.runRNG, selector);
}
private void Add(List<PickupIndex> sourceDropList, float listWeight)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (listWeight <= 0f || sourceDropList.Count == 0)
{
return;
}
float num = listWeight / (float)sourceDropList.Count;
foreach (PickupIndex sourceDrop in sourceDropList)
{
selector.AddChoice(new UniquePickup(sourceDrop), num);
}
}
private void UpdateDescription()
{
string text = (tier1Weight * 100f).ToString().Replace(",", ".");
string text2 = (tier2Weight * 100f).ToString().Replace(",", ".");
string text3 = (tier3Weight * 100f).ToString().Replace(",", ".");
LanguageAPI.Add("ITEM_ITEMDROPCHANCEONKILL_PICKUP", "Bosses drop an item on kill.", "en");
LanguageAPI.Add("ITEM_ITEMDROPCHANCEONKILL_DESC", "Bosses drop an item (" + text + "%/<style=cIsHealing>" + text2 + "%</style>/<color=#FF7F7F>" + text3 + "%</color>) on kill. <style=cStack>(Increases rarity chances of the items per stack).</style>", "en");
LanguageAPI.Add("ITEM_ITEMDROPCHANCEONKILL_PICKUP", "Obtenez un objet lorsqu'un boss est éliminé.", "fr");
LanguageAPI.Add("ITEM_ITEMDROPCHANCEONKILL_DESC", $"Les boss vaincus font apparaître un objet ({tier1Weight * 100f} %/<style=cIsHealing>{tier2Weight * 100f} %</style>/<color=#FF7F7F>{tier3Weight * 100f} %</color>). " + "<style=cStack>(La rareté de l'objet augmente à chaque cumul).</style>", "fr");
}
}
public class WakeOfVultures
{
public WakeOfVultures()
{
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
bool updated = false;
float baseDuration = 8f;
float stackDuration = 5f;
if (Configs.wakeOfVulturesDurationBase.Value >= 0f || Configs.wakeOfVulturesDurationStack.Value >= 0f)
{
if (Configs.wakeOfVulturesDurationBase.Value >= 0f)
{
baseDuration = Configs.wakeOfVulturesDurationBase.Value;
}
if (Configs.wakeOfVulturesDurationStack.Value >= 0f)
{
stackDuration = Configs.wakeOfVulturesDurationStack.Value;
}
bool hookFailed = true;
GlobalEventManager.OnCharacterDeath += (Manipulator)delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "HeadHunter")
}) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 3f)
}))
{
if (Configs.wakeOfVulturesDurationBase.Value >= 0f)
{
val.Next.Operand = baseDuration - stackDuration;
}
int index = val.Index;
val.Index = index + 1;
if (Configs.wakeOfVulturesDurationStack.Value >= 0f)
{
val.Next.Operand = stackDuration;
}
hookFailed = false;
updated = true;
}
if (hookFailed)
{
Log.Error("Wake of Vultures hook failed!");
}
};
}
if (updated)
{
UpdateDescription(baseDuration, stackDuration);
}
}
private void UpdateDescription(float baseDuration, float stackDuration)
{
string text = baseDuration.ToString().Replace(",", ".");
string text2 = stackDuration.ToString().Replace(",", ".");
LanguageAPI.Add("ITEM_HEADHUNTER_DESC", "Gain the <style=cIsDamage>power</style> of any killed elite monster for <style=cIsDamage>" + text + "s</style> <style=cStack>(+" + text2 + "s per stack)</style>.", "en");
}
}
public class WarBonds
{
public static ItemDef warBonds = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC2/Items/BarrageOnBoss/BarrageOnBoss.asset").WaitForCompletion();
public WarBonds()
{
if (!Configs.warBondsInheritable.Value)
{
warBonds.tags = warBonds.tags.AddToArray((ItemTag)13);
}
}
}
public class WaxQuail
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<Instruction, bool> <>9__0_1;
public static Func<Instruction, bool> <>9__0_2;
public static Manipulator <>9__0_0;
internal void <.ctor>b__0_0(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
bool flag = true;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.5f)
}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.5f)
}))
{
val.Index += 1;
val.Remove();
flag = false;
}
if (flag)
{
Log.Error("Wax Quail Multi Jump hook failed!");
}
}
internal bool <.ctor>b__0_1(Instruction x)
{
return ILPatternMatchingExt.MatchLdcR4(x, 1.5f);
}
internal bool <.ctor>b__0_2(Instruction x)
{
return ILPatternMatchingExt.MatchLdcR4(x, 1.5f);
}
}
public WaxQuail()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
if (!Configs.waxQuailMultiJump.Value)
{
return;
}
object obj = <>c.<>9__0_0;
if (obj == null)
{
Manipulator val = delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val2 = new ILCursor(il);
bool flag = true;
if (val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.5f)
}) && val2.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1.5f)
}))
{
val2.Index += 1;
val2.Remove();
flag = false;
}
if (flag)
{
Log.Error("Wax Quail Multi Jump hook failed!");
}
};
<>c.<>9__0_0 = val;
obj = (object)val;
}
GenericCharacterMain.ProcessJump_bool += (Manipulator)obj;
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[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("Samuel17.SuperCyanTweaks", "SuperCyanTweaks", "1.0.2")]
public class Main : BaseUnityPlugin
{
public static ItemDef emptyItemDef;
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
Configs.Init(((BaseUnityPlugin)this).Config);
new AlphaConstruct();
new Beetle();
new BighornBison();
new ClayApothecary();
new Geep();
new Grandparent();
new Gup();
new Imp();
new Lemurian();
new MiniMushrum();
new SolusControlUnit();
new SolusDistributor();
new SolusProbe();
new SolusTransporter();
new VoidReaver();
new EclipseLite();
new EmpathyCores();
new HappiestMask();
new OldWarStealthkit();
new OrphanedCore();
new SonorousWhispers();
new WakeOfVultures();
new WarBonds();
new WaxQuail();
new EccentricVase();
new Molotov6Pack();
new EquipmentDrone();
new GunnerTurret();
}
}
public static class Utils
{
public static void ReorderSkillDrivers(this GameObject master, int targetIdx)
{
AISkillDriver[] components = master.GetComponents<AISkillDriver>();
master.ReorderSkillDrivers(components, components.Length - 1, targetIdx);
}
public static void ReorderSkillDrivers(this GameObject master, AISkillDriver targetSkill, int targetIdx)
{
AISkillDriver[] components = master.GetComponents<AISkillDriver>();
master.ReorderSkillDrivers(components, Array.IndexOf(components, targetSkill), targetIdx);
}
public static void ReorderSkillDrivers(this GameObject master, AISkillDriver[] skills, int currentIdx, int targetIdx)
{
if (currentIdx < 0 || currentIdx >= skills.Length)
{
Log.Error($"{currentIdx} index not found or out of range. Must be less than {skills.Length}");
return;
}
string targetName = skills[currentIdx].customName;
if (targetIdx < 0 || targetIdx >= skills.Length)
{
Log.Error($"Unable to reorder skilldriver {targetName} into position {targetIdx}. target must be less than {skills.Length}");
return;
}
if (targetIdx == currentIdx)
{
Log.Warning($"Skilldriver {targetName} already has the target index of {targetIdx}");
return;
}
Dictionary<string, string> dictionary = skills.Where((AISkillDriver s) => (Object)(object)s.nextHighPriorityOverride != (Object)null).ToDictionary((AISkillDriver s) => s.customName, (AISkillDriver s) => s.nextHighPriorityOverride.customName);
if (targetIdx > currentIdx)
{
master.AddComponentCopy<AISkillDriver>(skills[currentIdx]);
Object.DestroyImmediate((Object)(object)skills[currentIdx]);
}
for (int i = targetIdx; i < skills.Length; i++)
{
if (i != currentIdx)
{
master.AddComponentCopy<AISkillDriver>(skills[i]);
Object.DestroyImmediate((Object)(object)skills[i]);
}
}
skills = master.GetComponents<AISkillDriver>();
AISkillDriver val = ((IEnumerable<AISkillDriver>)skills).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == targetName));
if ((Object)(object)val != (Object)null && Array.IndexOf(skills, val) == targetIdx)
{
Log.Debug($"Successfully set {targetName} to {targetIdx}");
}
else
{
Log.Error($"Done fucked it up on {targetName} with {targetIdx}");
}
if (!dictionary.Any())
{
return;
}
foreach (AISkillDriver val2 in skills)
{
if (Object.op_Implicit((Object)(object)val2) && dictionary.TryGetValue(val2.customName, out var target))
{
AISkillDriver val3 = ((IEnumerable<AISkillDriver>)skills).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver s) => s.customName == target));
if ((Object)(object)val3 == (Object)null)
{
Log.Error("Unable to reset skill override for " + val2.customName + " targeting " + target);
continue;
}
val2.nextHighPriorityOverride = val3;
Log.Debug("successfully reset override for " + val2.customName + " targeting " + target);
}
}
}
public static void RemoveComponent<T>(this GameObject go) where T : Component
{
T val = default(T);
if (go.TryGetComponent<T>(ref val))
{
Object.Destroy((Object)(object)val);
}
}
public static void RemoveComponents<T>(this GameObject go) where T : Component
{
T[] components = go.GetComponents<T>();
for (int i = 0; i < components.Length; i++)
{
Object.Destroy((Object)(object)components[i]);
}
}
public static T GetCopyOf<T>(this Component comp, T other) where T : Component
{
Type type = ((object)comp).GetType();
if (type != ((object)other).GetType())
{
return default(T);
}
BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
PropertyInfo[] properties = type.GetProperties(bindingAttr);
PropertyInfo[] array = properties;
foreach (PropertyInfo propertyInfo in array)
{
if (propertyInfo.CanWrite)
{
try
{
propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
}
catch
{
}
}
}
FieldInfo[] fields = type.GetFields(bindingAttr);
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
}
return (T)(object)((comp is T) ? comp : null);
}
public static T GetCopyOf<T>(this ScriptableObject comp, T other) where T : ScriptableObject
{
Type type = ((object)comp).GetType();
if (type != ((object)other).GetType())
{
return default(T);
}
BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
PropertyInfo[] properties = type.GetProperties(bindingAttr);
PropertyInfo[] array = properties;
foreach (PropertyInfo propertyInfo in array)
{
if (propertyInfo.CanWrite)
{
try
{
propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null);
}
catch
{
}
}
}
FieldInfo[] fields = type.GetFields(bindingAttr);
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
fieldInfo.SetValue(comp, fieldInfo.GetValue(other));
}
return (T)(object)((comp is T) ? comp : null);
}
public static T AddComponentCopy<T>(this GameObject go, T toAdd) where T : Component
{
return ((Component)(object)go.AddComponent<T>()).GetCopyOf(toAdd);
}
public static bool TryModifyFieldValue<T>(this EntityStateConfiguration entityStateConfiguration, string fieldName, T value)
{
ref SerializedField orCreateField = ref ((SerializedFieldCollection)(ref entityStateConfiguration.serializedFieldsCollection)).GetOrCreateField(fieldName);
if (Object.op_Implicit(orCreateField.fieldValue.objectValue) && typeof(Object).IsAssignableFrom(typeof(T)))
{
ref Object objectValue = ref orCreateField.fieldValue.objectValue;
object obj = value;
objectValue = (Object)((obj is Object) ? obj : null);
return true;
}
if (orCreateField.fieldValue.stringValue != null && StringSerializer.CanSerializeType(typeof(T)))
{
orCreateField.fieldValue.stringValue = StringSerializer.Serialize(typeof(T), (object)value);
return true;
}
Debug.LogError((object)("Failed to modify field " + fieldName));
return false;
}
public static bool TryGetFieldValue<T>(this EntityStateConfiguration entityStateConfiguration, string fieldName, out T value) where T : Object
{
ref SerializedField orCreateField = ref ((SerializedFieldCollection)(ref entityStateConfiguration.serializedFieldsCollection)).GetOrCreateField(fieldName);
if (Object.op_Implicit(orCreateField.fieldValue.objectValue) && typeof(Object).IsAssignableFrom(typeof(T)))
{
value = (T)(object)orCreateField.fieldValue.objectValue;
return true;
}
if (!string.IsNullOrEmpty(orCreateField.fieldValue.stringValue))
{
Debug.LogError((object)("Failed to return " + fieldName + " as an Object, try getting the string value instead."));
}
else
{
Debug.LogError((object)("Field is null " + fieldName));
}
value = default(T);
return false;
}
public static bool TryGetFieldValueString<T>(this EntityStateConfiguration entityStateConfiguration, string fieldName, out T value) where T : IEquatable<T>
{
ref SerializedField orCreateField = ref ((SerializedFieldCollection)(ref entityStateConfiguration.serializedFieldsCollection)).GetOrCreateField(fieldName);
if (orCreateField.fieldValue.stringValue != null && StringSerializer.CanSerializeType(typeof(T)))
{
value = (T)StringSerializer.Deserialize(typeof(T), orCreateField.fieldValue.stringValue);
return true;
}
if (Object.op_Implicit(orCreateField.fieldValue.objectValue))
{
Debug.LogError((object)("Failed to return " + fieldName + " as a string, try getting the Object value instead."));
}
else
{
Debug.LogError((object)("Field is null " + fieldName));
}
value = default(T);
return false;
}
public static T[] AddToArray<T>(this T[] array, params T[] items)
{
return (array ?? Enumerable.Empty<T>()).Concat(items).ToArray();
}
public static T[] RemoveFromArray<T>(this T[] array, params T[] items)
{
return (array ?? Enumerable.Empty<T>()).Except(items).ToArray();
}
}