using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Commando.CommandoWeapon; using EntityStates.Drone.Command; using EntityStates.Huntress; using EntityStates.Huntress.HuntressWeapon; using EntityStates.Mage; using Faithful; using Faithful.Shared; using Faithful.Skills.Technician; using Faithful.Skills.Temp; using HG; using HG.BlendableTypes; using HarmonyLib; using IL.RoR2; using ItemQualities; using ItemQualities.ContentManagement; using ItemQualities.Utilities.Extensions; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using Newtonsoft.Json; using On.EntityStates; using On.EntityStates.Drone.Command; using On.EntityStates.Huntress.HuntressWeapon; using On.EntityStates.Mage; using On.RoR2; using On.RoR2.UI; using On.RoR2.UI.LogBook; using On.RoR2.UI.MainMenu; using R2API; using Rewired.ComponentControls.Effects; using RoR2; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2.Hologram; using RoR2.Navigation; using RoR2.Networking; using RoR2.Skills; using RoR2.UI; using RoR2.UI.MainMenu; using TMPro; using Unity; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.ResourceManagement.ResourceLocations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: AssemblyTitle("Faithful")] [assembly: AssemblyProduct("Faithful")] [assembly: AssemblyInformationalVersion("1.0.0+a3847d8d49ebd63741d9f9764e69c1db4cbe298b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCompany("Faithful")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [Embedded] [CompilerGenerated] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Faithful { internal static class Assets { public const string bundleName = "faithfulbundle"; public static AssetBundle assetBundle; public static Material mageJetMaterial; public static Material infusionGlassMaterial; public static Material areaIndicatorIntersectionOnlyMaterial; public static Material areaIndicatorRimMaterial; public static Material artifactMaterial; public static Material artifactShellExplosionIndicatorMaterial; public static Material baubleTimestopSphereMaterial; public static Material blueprintScreenMaterial; public static Material blueprintsInvalidMaterial; public static Material blueprintsOkMaterial; public static Material bootShockwaveMaterial; public static Material captainAirstrikeAltAreaIndicatorInnerMaterial; public static Material captainAirstrikeAltAreaIndicatorOuterMaterial; public static Material captainAirstrikeAreaIndicatorMaterial; public static Material captainSupplyDropAreaIndicator2Material; public static Material captainSupplyDropAreaIndicatorOuterMaterial; public static Material chefAlwaysOnTopMaterial; public static Material childStarCoreMaterial; public static Material childStarGlowMaterial; public static Material chipProjectileMaterial; public static Material clayBubbleMaterial; public static Material combinerEnergyFadeMaterial; public static Material coreCage2Material; public static Material defectiveUnitDenialSphereNoiseMaterial; public static Material defectiveUnitDetonateSphereEnergyMaterial; public static Material defectiveUnitDetonateSphereEnergyPersMaterial; public static Material defectiveUnitDetonateSphereNoiseMaterial; public static Material defectiveUnitDetonateSpherePulseMaterial; public static Material defectiveUnitNullifySpherePulseMaterial; public static Material droneBrokenGenericMaterial; public static Material nullifierArmorMaterial; public static Material nullifierGemPortalMaterial; public static Material nullifierGemPortal3Material; public static Material nullifierBlackholeZoneAreaIndicatorMaterial; public static Material nullifierExplosionAreaIndicatorHardMaterial; public static Material radarTowerAreaIndicatorMaterial; public static Material shockDamageAuraGlassMaterial; public static Material teamAreaIndicatorFullMonsterMaterial; public static Material teamAreaIndicatorFullPlayerMaterial; public static Material teamAreaIndicatorIntersectionMonsterMaterial; public static Material teamAreaIndicatorIntersectionPlayerMaterial; public static Material timeCrystalAreaIndicatorMaterial; public static Material voidDeathBombAreaIndicatorBackMaterial; public static Material voidDeathBombAreaIndicatorFrontMaterial; public static Material voidSurvivorBlasterSphereAreaIndicatorMaterial; public static Material voidSurvivorBlasterSphereAreaIndicatorCorruptedMaterial; public static Material chestMaterial; public static Wave[] mageJetWaves; public static GameObject mageJetAkEventsPrefab; public static GameObject radiusIndicatorPrefab; public static GameObject pennonEffectPrefab; public static GameObject matrixEffectPrefab; public static GameObject matrixEffectLocalPrefab; public static GameObject shrineUseEffectPrefab; public static GameObject technicianArcPrefab; public static GameObject technicianTrackingIndicatorPrefab; public static PhysicMaterial ragdollMaterial; public static DynamicBone scarfDynamicBone; public static Sprite dronePingIcon; public static Sprite inventoryPingIcon; public static Sprite lootPingIcon; public static Sprite shrinePingIcon; public static Sprite teleporterPingIcon; public static Sprite mysteryPingIcon; public static Sprite chestInspectIcon; public static Sprite droneInspectIcon; public static Sprite lunarInspectIcon; public static Sprite pillarInspectIcon; public static Sprite printerInspectIcon; public static Sprite radioScannerInspectIcon; public static Sprite scapperInspectIcon; public static Sprite shrineInspectIcon; public static Sprite meridianInspectIcon; public static Sprite voidInspectIcon; public static Sprite mysteryInspectIcon; public static Material chanceShrineSymbolMaterial; public static ExpansionDef sotvDef; public static ExpansionDef sotsDef; private const string defaultModel = "temporalcubemesh"; private const string defaultIcon = "textemporalcubeicon"; private const string defaultConsumedIcon = "textemporalcubeconsumedicon"; private const string defaultBuffIcon = "texbufftemporalcube"; private static readonly Dictionary officialItemLookup = new Dictionary(StringComparer.OrdinalIgnoreCase); private static readonly HashSet scannedOfficialItemKeys = new HashSet(StringComparer.OrdinalIgnoreCase); private static bool builtOfficialItemLookup; public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(Utils.pluginInfo.Location), "faithfulbundle"); public static void Init() { assetBundle = AssetBundle.LoadFromFile(AssetBundlePath); if (Utils.verboseConsole) { string[] allAssetNames = assetBundle.GetAllAssetNames(); string[] array = allAssetNames; foreach (string text in array) { Log.Debug("[ASSETS] - Loaded asset '" + text + "'"); } } FetchNeededRoR2Resources(); RiskOfOptionsWrapper.UpdateModIcon(); } private static void FetchNeededRoR2Resources() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_0801: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Unknown result type (might be due to invalid IL or missing references) //IL_0898: Unknown result type (might be due to invalid IL or missing references) //IL_08b8: Unknown result type (might be due to invalid IL or missing references) //IL_093c: Unknown result type (might be due to invalid IL or missing references) //IL_0983: Unknown result type (might be due to invalid IL or missing references) //IL_09f3: Unknown result type (might be due to invalid IL or missing references) //IL_0a3a: Unknown result type (might be due to invalid IL or missing references) //IL_0a4a: Unknown result type (might be due to invalid IL or missing references) //IL_0a4f: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0ae7: Unknown result type (might be due to invalid IL or missing references) //IL_0b6e: Unknown result type (might be due to invalid IL or missing references) //IL_0bb5: Unknown result type (might be due to invalid IL or missing references) //IL_0c25: Unknown result type (might be due to invalid IL or missing references) //IL_0c6c: Unknown result type (might be due to invalid IL or missing references) //IL_0c7c: Unknown result type (might be due to invalid IL or missing references) //IL_0c81: Unknown result type (might be due to invalid IL or missing references) //IL_0cee: Unknown result type (might be due to invalid IL or missing references) //IL_0d1c: Unknown result type (might be due to invalid IL or missing references) //IL_0d4a: Unknown result type (might be due to invalid IL or missing references) //IL_0d78: Unknown result type (might be due to invalid IL or missing references) //IL_0d8d: Unknown result type (might be due to invalid IL or missing references) //IL_0da2: Unknown result type (might be due to invalid IL or missing references) //IL_0dc6: Unknown result type (might be due to invalid IL or missing references) //IL_0e6c: Unknown result type (might be due to invalid IL or missing references) //IL_0ea9: Unknown result type (might be due to invalid IL or missing references) //IL_0f56: Unknown result type (might be due to invalid IL or missing references) //IL_0f9d: Unknown result type (might be due to invalid IL or missing references) //IL_105e: Unknown result type (might be due to invalid IL or missing references) //IL_10e2: Unknown result type (might be due to invalid IL or missing references) //IL_115c: Unknown result type (might be due to invalid IL or missing references) //IL_11a3: Unknown result type (might be due to invalid IL or missing references) //IL_11ea: Unknown result type (might be due to invalid IL or missing references) //IL_1296: Unknown result type (might be due to invalid IL or missing references) //IL_129b: Unknown result type (might be due to invalid IL or missing references) //IL_12a4: Unknown result type (might be due to invalid IL or missing references) //IL_12b4: Unknown result type (might be due to invalid IL or missing references) //IL_12b9: Unknown result type (might be due to invalid IL or missing references) //IL_1310: Unknown result type (might be due to invalid IL or missing references) //IL_1368: Unknown result type (might be due to invalid IL or missing references) //IL_1396: Unknown result type (might be due to invalid IL or missing references) //IL_1451: Unknown result type (might be due to invalid IL or missing references) //IL_1465: Unknown result type (might be due to invalid IL or missing references) //IL_1497: Unknown result type (might be due to invalid IL or missing references) //IL_14c9: Unknown result type (might be due to invalid IL or missing references) //IL_14fb: Unknown result type (might be due to invalid IL or missing references) //IL_152d: Unknown result type (might be due to invalid IL or missing references) //IL_155f: Unknown result type (might be due to invalid IL or missing references) //IL_1591: Unknown result type (might be due to invalid IL or missing references) //IL_1618: Unknown result type (might be due to invalid IL or missing references) //IL_164f: Unknown result type (might be due to invalid IL or missing references) //IL_1669: Unknown result type (might be due to invalid IL or missing references) //IL_166e: Unknown result type (might be due to invalid IL or missing references) //IL_1697: Unknown result type (might be due to invalid IL or missing references) //IL_169c: Unknown result type (might be due to invalid IL or missing references) mageJetMaterial = Object.Instantiate(Addressables.LoadAssetAsync((object)"aa5dbb90045bc694bb20ffb706507091").WaitForCompletion()); mageJetMaterial.SetTexture("_RemapTex", GetTexture("texRamp4T0NFire")); infusionGlassMaterial = FetchAsset("RoR2/Base/Infusion/matInfusionGlass.mat"); areaIndicatorIntersectionOnlyMaterial = FetchAsset("RoR2/Base/Common/VFX/matAreaIndicatorIntersectionOnly.mat"); areaIndicatorRimMaterial = FetchAsset("RoR2/Base/Common/VFX/matAreaIndicatorRim.mat"); artifactMaterial = FetchAsset("RoR2/GlobalContent/matArtifact.mat"); artifactShellExplosionIndicatorMaterial = FetchAsset("RoR2/Base/artifactworld/matArtifactShellExplosionIndicator.mat"); baubleTimestopSphereMaterial = FetchAsset("RoR2/Base/SlowOnHit/matBaubleTimestopSphere.mat"); blueprintScreenMaterial = FetchAsset("RoR2/Junk/Misc/matBlueprintScreen.mat"); blueprintsInvalidMaterial = FetchAsset("RoR2/Base/Engi/matBlueprintsInvalid.mat"); blueprintsOkMaterial = FetchAsset("RoR2/Base/Engi/matBlueprintsOk.mat"); bootShockwaveMaterial = FetchAsset("RoR2/Base/FallBoots/matBootShockwave.mat"); captainAirstrikeAltAreaIndicatorInnerMaterial = FetchAsset("RoR2/Base/Captain/matCaptainAirstrikeAltAreaIndicatorInner.mat"); captainAirstrikeAltAreaIndicatorOuterMaterial = FetchAsset("RoR2/Base/Captain/matCaptainAirstrikeAltAreaIndicatorOuter.mat"); captainAirstrikeAreaIndicatorMaterial = FetchAsset("RoR2/Base/Captain/matCaptainAirstrikeAreaIndicator.mat"); captainSupplyDropAreaIndicator2Material = FetchAsset("RoR2/Base/Captain/matCaptainSupplyDropAreaIndicator2.mat"); captainSupplyDropAreaIndicatorOuterMaterial = FetchAsset("RoR2/Base/Captain/matCaptainSupplyDropAreaIndicatorOuter.mat"); chefAlwaysOnTopMaterial = FetchAsset("RoR2/DLC2/Chef/matChef_AlwaysOnTop.mat"); childStarCoreMaterial = FetchAsset("RoR2/DLC2/Child/matChildStarCore.mat"); childStarGlowMaterial = FetchAsset("RoR2/DLC2/Child/matChildStarGlow.mat"); chipProjectileMaterial = FetchAsset("RoR2/DLC3/SolusHeart/matChipProjectile.mat"); clayBubbleMaterial = FetchAsset("RoR2/Base/Clay/matClayBubble.mat"); combinerEnergyFadeMaterial = FetchAsset("RoR2/DLC3/DroneCombinerStation/matCombinerEnergyFade.mat"); coreCage2Material = FetchAsset("RoR2/DLC3/Items/MasterCore/matCoreCage2.mat"); defectiveUnitDenialSphereNoiseMaterial = FetchAsset("RoR2/DLC3/DefectiveUnit/matDefectiveUnitDenialSphereNoise.mat"); defectiveUnitDetonateSphereEnergyMaterial = FetchAsset("RoR2/DLC3/DefectiveUnit/matDefectiveUnitDetonateSphereEnergy.mat"); defectiveUnitDetonateSphereEnergyPersMaterial = FetchAsset("RoR2/DLC3/DefectiveUnit/matDefectiveUnitDetonateSphereEnergyPers.mat"); defectiveUnitDetonateSphereNoiseMaterial = FetchAsset("RoR2/DLC3/DefectiveUnit/matDefectiveUnitDetonateSphereNoise.mat"); defectiveUnitDetonateSpherePulseMaterial = FetchAsset("RoR2/DLC3/DefectiveUnit/matDefectiveUnitDetonateSpherePulse.mat"); defectiveUnitNullifySpherePulseMaterial = FetchAsset("RoR2/DLC3/DefectiveUnit/matDefectiveUnitNullifySpherePulse.mat"); droneBrokenGenericMaterial = FetchAsset("RoR2/Base/Drones/matDroneBrokenGeneric.mat"); nullifierArmorMaterial = FetchAsset("RoR2/Base/Nullifier/matNullifierArmor.mat"); nullifierGemPortalMaterial = FetchAsset("RoR2/Base/Nullifier/matNullifierGemPortal.mat"); nullifierGemPortal3Material = FetchAsset("RoR2/DLC1/Common/Void/matNullifierGemPortal3.mat"); nullifierBlackholeZoneAreaIndicatorMaterial = FetchAsset("RoR2/DLC1/Common/Void/matNullifierBlackholeZoneAreaIndicator.mat"); nullifierExplosionAreaIndicatorHardMaterial = FetchAsset("RoR2/Base/Nullifier/matNullifierExplosionAreaIndicatorHard.mat"); radarTowerAreaIndicatorMaterial = FetchAsset("RoR2/Base/RadarTower/matRadarTowerAreaIndicator.mat"); shockDamageAuraGlassMaterial = FetchAsset("RoR2/DLC3/Items/ShockDamageAura/matShockDamageAuraGlass.mat"); teamAreaIndicatorFullMonsterMaterial = FetchAsset("RoR2/Base/Common/matTeamAreaIndicatorFullMonster.mat"); teamAreaIndicatorFullPlayerMaterial = FetchAsset("RoR2/Base/Common/matTeamAreaIndicatorFullPlayer.mat"); teamAreaIndicatorIntersectionMonsterMaterial = FetchAsset("RoR2/Base/Common/matTeamAreaIndicatorIntersectionMonster.mat"); teamAreaIndicatorIntersectionPlayerMaterial = FetchAsset("RoR2/Base/Common/matTeamAreaIndicatorIntersectionPlayer.mat"); timeCrystalAreaIndicatorMaterial = FetchAsset("RoR2/Base/crystalworld/matTimeCrystalAreaIndicator.mat"); voidDeathBombAreaIndicatorBackMaterial = FetchAsset("RoR2/Base/Common/matVoidDeathBombAreaIndicatorBack.mat"); voidDeathBombAreaIndicatorFrontMaterial = FetchAsset("RoR2/Base/Common/matVoidDeathBombAreaIndicatorFront.mat"); voidSurvivorBlasterSphereAreaIndicatorMaterial = FetchAsset("RoR2/DLC1/VoidSurvivor/matVoidSurvivorBlasterSphereAreaIndicator.mat"); voidSurvivorBlasterSphereAreaIndicatorCorruptedMaterial = FetchAsset("RoR2/DLC1/VoidSurvivor/matVoidSurvivorBlasterSphereAreaIndicatorCorrupted.mat"); chestMaterial = FetchAsset("RoR2/Base/Chest1/matChest1.mat"); mageJetWaves = ((Component)Addressables.LoadAssetAsync((object)"92199783eae803f4095bc93685a5ee70").WaitForCompletion().GetComponent() .Find("ModelBase") .Find("mdlMage") .Find("MageArmature") .Find("ROOT") .Find("base") .Find("stomach") .Find("chest") .Find("JetsOn") .Find("Point Light")).GetComponent().sinWaves; GameObject val = Object.Instantiate(((Component)Addressables.LoadAssetAsync((object)"92199783eae803f4095bc93685a5ee70").WaitForCompletion().transform.Find("ModelBase").Find("mdlMage").Find("MageArmature") .Find("ROOT") .Find("base") .Find("stomach") .Find("chest") .Find("JetsOn")).gameObject); mageJetAkEventsPrefab = PrefabAPI.InstantiateClone(val, "faithfulMageJetAkEvents", false); Object.DestroyImmediate((Object)(object)val); Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("Fire")).gameObject); Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("Point Light")).gameObject); Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("JetsL")).gameObject); Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("JetsR")).gameObject); Object.DestroyImmediate((Object)(object)((Component)mageJetAkEventsPrefab.transform.Find("FireRing")).gameObject); mageJetAkEventsPrefab.transform.SetParent((Transform)null); mageJetAkEventsPrefab.transform.position = Vector3.zero; mageJetAkEventsPrefab.transform.localEulerAngles = Vector3.zero; mageJetAkEventsPrefab.transform.localScale = Vector3.zero; Object.DestroyImmediate((Object)(object)mageJetAkEventsPrefab.GetComponent()); GameObject val2 = Object.Instantiate(Addressables.LoadAssetAsync((object)"6b314230ed88f3c4b8d55cc64846854b").WaitForCompletion()); pennonEffectPrefab = PrefabAPI.InstantiateClone(val2, "faithfulLeadersPennonEffect", false); Object.DestroyImmediate((Object)(object)val2); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent()).material.SetColor("_Color", new Color(0.5803921f, 0.22745098f, 61f / 85f)); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent()).material.SetColor("_TintColor", new Color(0.5803921f, 0.22745098f, 61f / 85f)); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent()).material.SetTexture("_RemapTex", GetTexture("texRampPennonBuff")); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent()).material.SetTexture("_MainTex", GetTexture("texIndicatorPennonMask")); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent()).material.mainTexture = GetTexture("texIndicatorPennonMask"); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent()).material.SetColor("_Color", new Color(0.1f, 0f, 2.6384087f)); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent()).material.SetColor("_TintColor", new Color(0.1f, 0f, 2.6384087f)); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).GetComponent()).material.SetColor("_Color", new Color(0.1f, 0f, 1f)); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).GetComponent()).material.SetColor("_TintColor", new Color(0.1f, 0f, 1f)); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent()).material.SetColor("_Color", new Color(0.5803921f, 0.22745098f, 1f)); ((Renderer)((Component)pennonEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent()).material.SetColor("_TintColor", new Color(0.5803921f, 0.22745098f, 1f)); GameObject val3 = Object.Instantiate(Addressables.LoadAssetAsync((object)"6b314230ed88f3c4b8d55cc64846854b").WaitForCompletion()); matrixEffectPrefab = PrefabAPI.InstantiateClone(val3, "faithfulTargetingMatrixEffect", false); Object.DestroyImmediate((Object)(object)val3); Material material = ((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent()).material; ((Object)material).name = "matTargetingMatrixEffect"; material.SetFloat("_InvFade", 0f); material.SetColor("_Color", new Color(1f, 0f, 0f)); material.SetColor("_TintColor", new Color(1f, 0f, 0f)); material.SetTexture("_RemapTex", GetTexture("texRampPennonBuff")); material.SetTexture("_MainTex", GetTexture("texIndicatorMatrixMask")); material.mainTexture = GetTexture("texIndicatorMatrixMask"); ((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent()).material.SetColor("_Color", new Color(1f, 0f, 0f)); ((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent()).material.SetColor("_TintColor", new Color(1f, 0f, 0f)); Object.DestroyImmediate((Object)(object)((Component)matrixEffectPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).gameObject); ((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent()).material.SetColor("_Color", new Color(1f, 0f, 0f)); ((Renderer)((Component)matrixEffectPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent()).material.SetColor("_TintColor", new Color(1f, 0f, 0f)); GameObject val4 = Object.Instantiate(Addressables.LoadAssetAsync((object)"6b314230ed88f3c4b8d55cc64846854b").WaitForCompletion()); matrixEffectLocalPrefab = PrefabAPI.InstantiateClone(val4, "faithfulTargetingMatrixEffect", false); Object.DestroyImmediate((Object)(object)val4); Material material2 = ((Renderer)((Component)matrixEffectLocalPrefab.transform.Find("Visual").Find("PulseEffect, Ring")).GetComponent()).material; ((Object)material2).name = "matTargetingMatrixLocalEffect"; material2.SetColor("_Color", new Color(1f, 0f, 0f)); material2.SetColor("_TintColor", new Color(1f, 0f, 0f)); material2.SetTexture("_RemapTex", GetTexture("texRampPennonBuff")); material2.SetTexture("_MainTex", GetTexture("texIndicatorMatrixMask")); material2.mainTexture = GetTexture("texIndicatorMatrixMask"); ((Renderer)((Component)matrixEffectLocalPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent()).material.SetColor("_Color", new Color(1f, 0f, 0f)); ((Renderer)((Component)matrixEffectLocalPrefab.transform.Find("Visual").Find("ColoredLightShafts (1)")).GetComponent()).material.SetColor("_TintColor", new Color(1f, 0f, 0f)); Object.DestroyImmediate((Object)(object)((Component)matrixEffectLocalPrefab.transform.Find("Visual").Find("FlarePerst_Ps (1)")).gameObject); ((Renderer)((Component)matrixEffectLocalPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent()).material.SetColor("_Color", new Color(1f, 0f, 0f)); ((Renderer)((Component)matrixEffectLocalPrefab.transform.Find("Visual").Find("SoftGlow")).GetComponent()).material.SetColor("_TintColor", new Color(1f, 0f, 0f)); GameObject val5 = Object.Instantiate(Addressables.LoadAssetAsync((object)"5ba295c0a3919a544939e6efe1ff17b3").WaitForCompletion()); radiusIndicatorPrefab = PrefabAPI.InstantiateClone(val5, "faithfulRadiusIndicator", false); Object.DestroyImmediate((Object)(object)val5); Object.DestroyImmediate((Object)(object)radiusIndicatorPrefab.GetComponent()); Object.DestroyImmediate((Object)(object)radiusIndicatorPrefab.GetComponent()); ((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Donut")).GetComponent()).material.SetColor("_Color", Color.white); ((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Donut")).GetComponent()).material.SetColor("_TintColor", Color.white); ((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Radius, Spherical")).GetComponent()).material.SetColor("_Color", Color.white); ((Renderer)((Component)radiusIndicatorPrefab.transform.Find("Radius, Spherical")).GetComponent()).material.SetColor("_TintColor", Color.white); radiusIndicatorPrefab.transform.position = Vector3.zero; radiusIndicatorPrefab.transform.eulerAngles = Vector3.zero; radiusIndicatorPrefab.transform.localScale = new Vector3(1f, 1f, 1f); radiusIndicatorPrefab.AddComponent(); shrineUseEffectPrefab = FetchAsset("RoR2/Base/Common/VFX/ShrineUseEffect.prefab"); GameObject val6 = Object.Instantiate(FetchAsset("RoR2/Base/Engi/LaserEngiTurret.prefab")); technicianArcPrefab = PrefabAPI.InstantiateClone(val6, "faithfulTechnicianArc", false); Object.DestroyImmediate((Object)(object)val6); ((Component)technicianArcPrefab.transform.Find("LaserStart")).GetComponent().widthMultiplier = 3f; ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart")).GetComponent()).material.SetColor("_Color", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart")).GetComponent()).material.SetColor("_TintColor", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart")).GetComponent()).material.SetTexture("_RemapTex", GetTexture("texRampTechnician")); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart")).GetComponent()).material.SetTexture("_Cloud2Tex", GetTexture("texLightningTechnician")); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("Flare")).GetComponent()).material.SetColor("_Color", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("Flare")).GetComponent()).material.SetColor("_TintColor", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("Flare")).GetComponent()).material.SetTexture("_MainTex", GetTexture("texTechnicianFlare")); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("Flare")).GetComponent()).material.SetTexture("_RemapTex", GetTexture("texRampTechnician")); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("HitFlash")).GetComponent()).material.SetColor("_Color", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("HitFlash")).GetComponent()).material.SetTexture("_RemapTex", GetTexture("texRampTechnician")); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("Ring, Bright")).GetComponent()).material.SetColor("_Color", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserStart").Find("Ring, Bright")).GetComponent()).material.SetTexture("_RemapTex", GetTexture("texRampTechnician")); ((Component)technicianArcPrefab.transform.Find("LaserStart").Find("Point light")).GetComponent().color = new Color(0.9725f, 1f, 0.5373f); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserEnd").Find("Flare")).GetComponent()).material.SetColor("_Color", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserEnd").Find("Flare")).GetComponent()).material.SetColor("_TintColor", new Color(0.9725f, 1f, 0.5373f)); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserEnd").Find("Flare")).GetComponent()).material.SetTexture("_MainTex", GetTexture("texTechnicianFlare")); ((Renderer)((Component)technicianArcPrefab.transform.Find("LaserEnd").Find("Flare")).GetComponent()).material.SetTexture("_RemapTex", GetTexture("texRampTechnician")); ParticleSystem component = ((Component)technicianArcPrefab.transform.Find("LaserEnd").Find("Flare")).GetComponent(); MainModule main = component.main; ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(4f); GameObject val7 = Object.Instantiate(Addressables.LoadAssetAsync((object)"2c791c24593eab442b64bb8c822a4f01").WaitForCompletion()); technicianTrackingIndicatorPrefab = PrefabAPI.InstantiateClone(val7, "faithfulTechnicianTracker", false); Object.DestroyImmediate((Object)(object)val7); ((Component)technicianTrackingIndicatorPrefab.transform.Find("Core Pip")).GetComponent().color = new Color(1f, 1f, 0.375f, 0.286f); ((Renderer)((Component)technicianTrackingIndicatorPrefab.transform.Find("Core Pip")).GetComponent()).sortingOrder = 1; ((Component)technicianTrackingIndicatorPrefab.transform.Find("Core, Dark")).GetComponent().color = new Color(0.5f, 0.5f, 0.25f, 0.953f); technicianTrackingIndicatorPrefab.transform.Find("Holder").localScale = new Vector3(1f, 1f, 1f); ((Component)technicianTrackingIndicatorPrefab.transform.Find("Holder")).GetComponent().reverse = true; ((Component)technicianTrackingIndicatorPrefab.transform.Find("Holder")).GetComponent().fastRotationSpeed = 60f; ((Component)technicianTrackingIndicatorPrefab.transform.Find("Holder")).GetComponent().slowRotationSpeed = 30f; Object.DestroyImmediate((Object)(object)((Component)technicianTrackingIndicatorPrefab.transform.Find("Holder")).GetComponent()); GameObject[] array = Utils.FindChildrenWithTerm(technicianTrackingIndicatorPrefab.transform.Find("Holder"), "Nib Holder"); array[0].transform.localEulerAngles = Vector3.zero; array[1].transform.localEulerAngles = Vector3.zero; ((Component)array[0].transform.Find("Nib")).transform.localPosition = new Vector3(0.22f, 0f, 0f); ((Component)array[1].transform.Find("Nib")).transform.localPosition = new Vector3(-0.22f, 0f, 0f); ((Component)array[0].transform.Find("Nib")).transform.localEulerAngles = new Vector3(0f, 0f, 90f); ((Component)array[1].transform.Find("Nib")).transform.localEulerAngles = new Vector3(0f, 0f, 270f); ((Component)array[0].transform.Find("Nib")).transform.localScale = new Vector3(0.15f, 0.15f, 1f); ((Component)array[1].transform.Find("Nib")).transform.localScale = new Vector3(0.15f, 0.15f, 1f); ((Component)array[0].transform.Find("Nib")).GetComponent().sprite = GetSprite("texCrosshairTrackerBracket"); ((Component)array[1].transform.Find("Nib")).GetComponent().sprite = GetSprite("texCrosshairTrackerBracket"); ((Component)array[0].transform.Find("Nib")).GetComponent().color = new Color(1f, 1f, 0.375f, 0.286f); ((Component)array[1].transform.Find("Nib")).GetComponent().color = new Color(1f, 1f, 0.375f, 0.286f); Object.DestroyImmediate((Object)(object)array[2]); ragdollMaterial = ((Component)Addressables.LoadAssetAsync((object)"64ee0a4463fdfdc41ac7a06c8f5f2f0f").WaitForCompletion().GetComponentInChildren() .bones[1]).GetComponent().material; scarfDynamicBone = Utils.FindChildByName(Addressables.LoadAssetAsync((object)"RoR2/DLC1/LunarSun/DisplaySunHeadNeck.prefab").WaitForCompletion().transform, "Bandage1").GetComponent(); dronePingIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texDroneIconOutlined.png"); inventoryPingIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texInventoryIconOutlined.png"); lootPingIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texLootIconOutlined.png"); shrinePingIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texShrineIconOutlined.png"); teleporterPingIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texTeleporterIconOutlined.png"); mysteryPingIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texMysteryIcon.png"); chestInspectIcon = FetchAsset("RoR2/Base/ChestIcon_1.png"); droneInspectIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texDroneIconOutlined.png"); lunarInspectIcon = FetchAsset("RoR2/Base/LunarIcon_1.png"); pillarInspectIcon = FetchAsset("RoR2/Base/PillarIcon.png"); printerInspectIcon = FetchAsset("RoR2/Base/PrinterIcon_1.png"); radioScannerInspectIcon = FetchAsset("RoR2/Base/RadioScannerIcon_2.png"); scapperInspectIcon = FetchAsset("RoR2/Base/ScrapperIcon.png"); shrineInspectIcon = FetchAsset("RoR2/Base/ShrineIcon.png"); meridianInspectIcon = FetchAsset("RoR2/DLC2/texColossusExpansionIcon.png"); voidInspectIcon = FetchAsset("RoR2/Base/VoidIcon_2.png"); mysteryInspectIcon = FetchAsset("RoR2/Base/Common/MiscIcons/texMysteryIcon.png"); chanceShrineSymbolMaterial = FetchAsset("RoR2/Base/ShrineChance/matShrineChanceSymbol.mat"); sotvDef = FetchAsset("RoR2/DLC1/Common/DLC1.asset"); sotsDef = FetchAsset("RoR2/DLC2/Common/DLC2.asset"); if (Utils.verboseConsole) { Log.Debug("[ASSETS] - Fetched all needed resources from RoR2 assets."); } } public static string FindAsset(string _file) { _file = _file.ToLower(); string[] allAssetNames = assetBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { if (text.ToLower().Contains(_file)) { return text; } } return null; } public static bool HasAsset(string _name) { string text = FindAsset(_name); return text != null; } public static void LogRoR2Resources() { List> list = new List>(); LegacyResourcesAPI.GetAllPathGuidPairs(list); foreach (KeyValuePair item in list) { Log.Debug("[ASSETS] - Resource found: '" + item.Key + "' | GUID: " + item.Value); } } public static void FindRoR2Resources(string _searchTerm) { List> list = new List>(); LegacyResourcesAPI.GetAllPathGuidPairs(list); string text = "\n[ASSETS]\n====================\nAttempting to find resources with search term: '" + _searchTerm + "'\n--------------------"; bool flag = false; foreach (KeyValuePair item in list) { if (item.Key.ToUpper().Contains(_searchTerm.ToUpper())) { flag = true; text = text + "\nResource found: '" + item.Key + "' | GUID: " + item.Value; } } text += (flag ? "\n====================" : "\nNo resources found...\n===================="); Log.Info(text); } public static T FetchAsset(string _path) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) return Addressables.LoadAssetAsync((object)_path).WaitForCompletion(); } public static bool TryGetOfficialItem(string _value, out ItemDef _itemDef) { _itemDef = null; if (string.IsNullOrWhiteSpace(_value)) { return false; } BuildOfficialItemLookup(); return officialItemLookup.TryGetValue(_value.Trim(), out _itemDef) && (Object)(object)_itemDef != (Object)null; } private static void BuildOfficialItemLookup() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if (builtOfficialItemLookup) { return; } builtOfficialItemLookup = true; foreach (IResourceLocator resourceLocator in Addressables.ResourceLocators) { foreach (object key in resourceLocator.Keys) { if (!(key is string text) || !text.StartsWith("RoR2/", StringComparison.OrdinalIgnoreCase) || !text.EndsWith(".asset", StringComparison.OrdinalIgnoreCase) || !scannedOfficialItemKeys.Add(text)) { continue; } IList list = Addressables.LoadResourceLocationsAsync((object)text, typeof(ItemDef)).WaitForCompletion(); if (list != null && list.Count != 0) { ItemDef val = Addressables.LoadAssetAsync(list[0]).WaitForCompletion(); if (!((Object)(object)val == (Object)null)) { CacheOfficialItemAliases(val, text); } } } } } private static void CacheOfficialItemAliases(ItemDef _itemDef, string _path) { if (!((Object)(object)_itemDef == (Object)null)) { AddOfficialItemAlias(((Object)_itemDef).name, _itemDef); AddOfficialItemAlias(_itemDef.nameToken, _itemDef); AddOfficialItemAlias(_path, _itemDef); string text = Language.GetString(_itemDef.nameToken); if (!string.IsNullOrWhiteSpace(text) && !string.Equals(text, _itemDef.nameToken, StringComparison.Ordinal)) { AddOfficialItemAlias(text, _itemDef); } } } private static void AddOfficialItemAlias(string _alias, ItemDef _itemDef) { if (!string.IsNullOrWhiteSpace(_alias) && !((Object)(object)_itemDef == (Object)null)) { _alias = _alias.Trim(); if (!officialItemLookup.ContainsKey(_alias)) { officialItemLookup.Add(_alias, _itemDef); } } } public static Sprite GetIcon(string _name) { string text = _name + ".png"; string text2 = FindAsset(text); if (text2 == null) { if (Utils.verboseConsole) { Log.Error("Requested asset '" + text + "' could not be found."); } _name = _name.ToLower(); return assetBundle.LoadAsset(_name.Contains("buff") ? FindAsset("texbufftemporalcube") : (_name.Contains("consumed") ? FindAsset("textemporalcubeconsumedicon") : FindAsset("textemporalcubeicon"))); } return assetBundle.LoadAsset(text2); } public static GameObject GetCrosshair(string _crosshairName) { GameObject val = LegacyResourcesAPI.Load("Prefabs/Crosshair/" + _crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("Crosshair '" + _crosshairName + "' could not be found - defaulting to standard crosshair."); return LegacyResourcesAPI.Load("Prefabs/Crosshair/StandardCrosshair"); } return val; } public static GameObject GetObject(string _name, string _default = null) { string text = _name + ".prefab"; string text2 = FindAsset(text); if (text2 == null) { if (Utils.verboseConsole) { Log.Error("Requested asset '" + text + "' could not be found."); } if (_default != null) { return assetBundle.LoadAsset(_default); } return null; } return assetBundle.LoadAsset(text2); } public static Mesh GetMesh(string _name, string _default = null) { string text = _name + ".prefab"; string text2 = FindAsset(text); GameObject val = null; if (text2 == null) { if (Utils.verboseConsole) { Log.Error("Requested asset '" + text + "' could not be found."); } if (_default != null) { val = assetBundle.LoadAsset(_default); } } else { val = assetBundle.LoadAsset(text2); } if ((Object)(object)val == (Object)null) { return null; } MeshFilter component = val.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("[ASSETS] | Unable to get mesh for asset '" + text + "' - Mesh filter component not found!"); return null; } return component.sharedMesh; } public static GameObject GetModel(string _name) { return GetObject(_name, "temporalcubemesh"); } public static Texture GetTexture(string _name) { string text = _name + ".png"; string text2 = FindAsset(text); if (text2 == null) { Log.Error("Requested asset '" + text + "' could not be found."); return null; } return assetBundle.LoadAsset(text2); } public static Sprite GetSprite(string _name) { string text = _name + ".png"; string text2 = FindAsset(text); if (text2 == null) { Log.Error("Requested asset '" + text + "' could not be found."); return null; } return assetBundle.LoadAsset(text2); } public static Material GetMaterial(string _name) { string text = _name + ".mat"; string text2 = FindAsset(text); if (text2 == null) { Log.Error("Requested asset '" + text + "' could not be found."); return null; } return assetBundle.LoadAsset(text2); } public static Shader GetShader(string _name) { string text = _name + ".shader"; string text2 = FindAsset(text); if (text2 == null) { Log.Error("Requested asset '" + text + "' could not be found."); return null; } return assetBundle.LoadAsset(text2); } public static Material GetShrineSymbolMaterial(Texture _texture, Color _colour) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(chanceShrineSymbolMaterial); val.SetTexture("_MainTex", _texture); val.SetColor("_TintColor", _colour); return val; } public static GameObject GetClonedDopplegangerMaster(GameObject _bodyPrefab, string _masterName, string _masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/" + _masterToCopy + "MonsterMaster"), _masterName, true); val.GetComponent().bodyPrefab = _bodyPrefab; ContentAddition.AddMaster(val); return val; } } internal delegate void Callback(); internal delegate void InHoldoutZoneCallback(CharacterBody _contained, HoldoutZoneController _zone); internal delegate void OnHoldoutZoneStartCallback(HoldoutZoneController _zone); internal delegate void OnHoldoutZoneCalcRadiusCallback(ref float _radius, HoldoutZoneController _zone); internal delegate void StatsModCallback(int _count, StatHookEventArgs _stats); internal delegate void OnIncomingDamageCallback(DamageInfo _report, CharacterMaster _attacker, CharacterMaster _victim); internal delegate void OnHitEnemyCallback(DamageInfo _info, GameObject _victim); internal delegate void OnTakeDamageProcessCallback(HealthComponent _healthComponent, DamageInfo _info); internal delegate void DamageReportCallback(DamageReport _report); internal delegate void OnAddBuffCallback(BuffIndex _buff, CharacterBody _character); internal delegate void OnAddTimedBuffCallback(BuffDef _buff, ref float _duration, CharacterBody _character); internal delegate void OnAddTimedBuffMaxStacksCallback(BuffDef _buff, ref float _duration, ref int _maxStacks, CharacterBody _character); internal delegate void OnExtendTimedBuffsCallback(BuffDef _buff, ref float _duration, ref float _max, CharacterBody _character); internal delegate void OnSetTimedBuffDurationCallback(BuffDef _buff, ref float _duration, bool _allStacks, CharacterBody _character); internal delegate void OnInflictDamageOverTimeCallback(GameObject _victimObject, GameObject _attackerObject, DotIndex _dotIndex, float _duration, float _damageMultiplier, uint? _maxStacksFromAttacker); internal delegate void OnInflictDamageOverTimeRefCallback(ref InflictDotInfo _inflictDotInfo); internal delegate void OnTransferItemCallback(Inventory _inventory, ItemIndex _index, int _count); internal delegate void OnTransferItemFloatCallback(Inventory _inventory, ItemIndex _index, float _count); internal delegate void OnInventoryCallback(Inventory _inventory); internal delegate void OnHealCallback(HealthComponent _healthComponent, ref float _amount, ref ProcChainMask _procChainMask, ref bool _nonRegen); internal delegate void CharacterBodyCallback(CharacterBody _body); internal delegate void OnInteractionBeginProcCallback(Interactor _interactor, IInteractable _interactable, GameObject _interactableObject); internal delegate void OnPurchaseInteractionBeginCallback(PurchaseInteraction _shop, CharacterMaster _activator); internal delegate bool OnPurchaseCanBeAffordedCallback(PurchaseInteraction _shop, CharacterMaster _activator); internal delegate void InteractorCallback(Interactor _interactor); internal delegate void FaithfulInteractorCallback(FaithfulInteractableBehaviour _behaviour, Interactor _interactor); internal delegate void OnProcessJumpCallback(GenericCharacterMain _character); internal delegate void PlayerToPlayerCallback(PlayerCharacterMasterController _player1, PlayerCharacterMasterController _player2); internal delegate void PlayerHolderToPlayerCallback(int _count, PlayerCharacterMasterController _holder, PlayerCharacterMasterController _other); internal delegate void AllyHolderToAllyCallback(int _count, CharacterMaster _holder, CharacterMaster _other); internal delegate void GenericCharacterCallback(GenericCharacterMain _character); internal delegate void SceneDirectorCallback(SceneDirector _director); internal delegate void SceneExitControllerCallback(SceneExitController _exitController); internal static class Behaviour { [CompilerGenerated] private static class <>O { public static hook_Update <0>__HookHoldoutZoneControllerUpdate; public static hook_Start <1>__HookHoldoutZoneControllerStart; public static hook_Awake <2>__HookCharacterBodyAwake; public static hook_Start <3>__HookCharacterBodyStart; public static hook_AddBuff_BuffIndex <4>__HookAddBuffIndex; public static hook_AddTimedBuff_BuffDef_float <5>__HookAddTimedBuffDef; public static hook_AddTimedBuff_BuffDef_float_int <6>__HookAddTimedBuffDefMaxStacks; public static hook_ExtendTimedBuffIfPresent_BuffDef_float_float <7>__HookExtendTimedBuffs; public static hook_SetTimedBuffDurationIfPresent <8>__HookSetTimedBuffDuration; public static hook_GiveItemPermanent_ItemIndex_int <9>__HookServerGiveItemPermanent; public static hook_GiveItemTemp <10>__HookServerGiveItemTemporary; public static hook_RemoveItem_ItemIndex_int <11>__HookServerRemoveItem; public static hook_HandleInventoryChanged <12>__HookInventoryChanged; public static hook_RpcItemAdded <13>__HookItemAdded; public static hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 <14>__HookInflictDamageOverTime; public static hook_InflictDot_refInflictDotInfo <15>__HookInflictDamageOverTimeRef; public static hook_Awake <16>__HookHealthComponentAwake; public static hook_Heal <17>__HookHeal; public static hook_TakeDamageProcess <18>__HookTakeDamageProcess; public static hook_RecalculateStats <19>__HookRecalculateStats; public static hook_UpdateAllTemporaryVisualEffects <20>__HookUpdateVisualEffects; public static hook_FixedUpdate <21>__HookCharacterBodyFixedUpdate; public static hook_RollCrit <22>__HookCharacterBodyRollCrit; public static Action <23>__HookInteractionBegin; public static hook_OnInteractionBegin <24>__HookPurchaseInteractionBegin; public static hook_CanBeAffordedByInteractor <25>__HookPurchaseCanBeAfforded; public static hook_ProcessJump <26>__HookProcessJump; public static hook_FixedUpdate <27>__HookGenericCharacterFixedUpdate; public static hook_SetState <28>__HookSceneExitControllerSetState; public static hook_OnHitEnemy <29>__HookOnHitEnemy; public static StatHookEventHandler <30>__HookStatsMod; public static Action <31>__HookOnDamageDealt; public static Action <32>__HookOnCharacterDeath; public static Action <33>__HookPrePopulateScene; } private static bool enabled = false; internal static GameObject characterBodyHelperPrefab; private static List updateCallbacks = new List(); private static List debugUpdateCallbacks = new List(); private static List fixedUpdateCallbacks = new List(); private static List debugFixedUpdateCallbacks = new List(); private static List inHoldoutZoneCallbacks = new List(); private static List onHoldoutZoneStartCallbacks = new List(); private static List onHoldoutZoneCalcRadiusCallbacks = new List(); private static List itemStatsMods = new List(); private static List buffStatsMods = new List(); private static List onIncomingDamageCallbacks = new List(); private static List onHitEnemyLateCallbacks = new List(); private static List onTakeDamageProcessCallbacks = new List(); private static List onTakeDamageProcessLateCallbacks = new List(); private static List onDamageDealtCallbacks = new List(); private static List onCharacterDeathCallbacks = new List(); private static List onAddBuffCallbacks = new List(); private static List onAddTimedBuffCallbacks = new List(); private static List onAddTimedBuffMaxStacksCallbacks = new List(); private static List onExtendTimedBuffsCallbacks = new List(); private static List onSetTimedBuffDurationCallbacks = new List(); private static List onInflictDamageOverTimeCallbacks = new List(); private static List onInflictDamageOverTimeRefCallbacks = new List(); private static List onGiveItemPermanentCallbacks = new List(); private static List onGiveItemPermanentLateCallbacks = new List(); private static List onGiveItemTemporaryCallbacks = new List(); private static List onGiveItemTemporaryLateCallbacks = new List(); private static List onRemoveItemCallbacks = new List(); private static List onInventoryChangedCallbacks = new List(); private static Dictionary> onItemAddedCallbacks = new Dictionary>(); private static List onHealCallbacks = new List(); private static List onCharacterBodyAwakeCallbacks = new List(); private static List onCharacterBodyStartCallbacks = new List(); private static List onRecalculateStatsCallbacks = new List(); private static List onUpdateVisualEffectsCallbacks = new List(); private static List onCharacterBodyFixedUpdateCallbacks = new List(); private static Dictionary onCharacterBodyTickCallbacks = new Dictionary(); private static List onInteractionBeginProcCallbacks = new List(); private static List onPurchaseInteractionBeginCallbacks = new List(); private static List onPurchaseCanBeAffordedCallbacks = new List(); private static List onProcessJumpCallbacks = new List(); private static List playerToPlayerCallbacks = new List(); private static List playerItemToPlayerCallbacks = new List(); private static List playerBuffToPlayerCallbacks = new List(); private static List allyItemToAllyCallbacks = new List(); private static List allyBuffToAllyCallbacks = new List(); private static List genericCharacterFixedUpdateCallbacks = new List(); private static List onPrePopulateSceneCallbacks = new List(); private static List onPreSceneExitCallbacks = new List(); private static Dictionary critOverrideCounts = new Dictionary(); public static void Init() { CreatePrefabs(); Enable(); DebugLog("Behaviour initialised"); } public static void Enable() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //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_00b4: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0117: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Expected O, but got Unknown //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Expected O, but got Unknown //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Expected O, but got Unknown //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Expected O, but got Unknown //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Expected O, but got Unknown //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Expected O, but got Unknown //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Expected O, but got Unknown if (!enabled) { enabled = true; object obj = <>O.<0>__HookHoldoutZoneControllerUpdate; if (obj == null) { hook_Update val = HookHoldoutZoneControllerUpdate; <>O.<0>__HookHoldoutZoneControllerUpdate = val; obj = (object)val; } HoldoutZoneController.Update += (hook_Update)obj; object obj2 = <>O.<1>__HookHoldoutZoneControllerStart; if (obj2 == null) { hook_Start val2 = HookHoldoutZoneControllerStart; <>O.<1>__HookHoldoutZoneControllerStart = val2; obj2 = (object)val2; } HoldoutZoneController.Start += (hook_Start)obj2; object obj3 = <>O.<2>__HookCharacterBodyAwake; if (obj3 == null) { hook_Awake val3 = HookCharacterBodyAwake; <>O.<2>__HookCharacterBodyAwake = val3; obj3 = (object)val3; } CharacterBody.Awake += (hook_Awake)obj3; object obj4 = <>O.<3>__HookCharacterBodyStart; if (obj4 == null) { hook_Start val4 = HookCharacterBodyStart; <>O.<3>__HookCharacterBodyStart = val4; obj4 = (object)val4; } CharacterBody.Start += (hook_Start)obj4; object obj5 = <>O.<4>__HookAddBuffIndex; if (obj5 == null) { hook_AddBuff_BuffIndex val5 = HookAddBuffIndex; <>O.<4>__HookAddBuffIndex = val5; obj5 = (object)val5; } CharacterBody.AddBuff_BuffIndex += (hook_AddBuff_BuffIndex)obj5; object obj6 = <>O.<5>__HookAddTimedBuffDef; if (obj6 == null) { hook_AddTimedBuff_BuffDef_float val6 = HookAddTimedBuffDef; <>O.<5>__HookAddTimedBuffDef = val6; obj6 = (object)val6; } CharacterBody.AddTimedBuff_BuffDef_float += (hook_AddTimedBuff_BuffDef_float)obj6; object obj7 = <>O.<6>__HookAddTimedBuffDefMaxStacks; if (obj7 == null) { hook_AddTimedBuff_BuffDef_float_int val7 = HookAddTimedBuffDefMaxStacks; <>O.<6>__HookAddTimedBuffDefMaxStacks = val7; obj7 = (object)val7; } CharacterBody.AddTimedBuff_BuffDef_float_int += (hook_AddTimedBuff_BuffDef_float_int)obj7; object obj8 = <>O.<7>__HookExtendTimedBuffs; if (obj8 == null) { hook_ExtendTimedBuffIfPresent_BuffDef_float_float val8 = HookExtendTimedBuffs; <>O.<7>__HookExtendTimedBuffs = val8; obj8 = (object)val8; } CharacterBody.ExtendTimedBuffIfPresent_BuffDef_float_float += (hook_ExtendTimedBuffIfPresent_BuffDef_float_float)obj8; object obj9 = <>O.<8>__HookSetTimedBuffDuration; if (obj9 == null) { hook_SetTimedBuffDurationIfPresent val9 = HookSetTimedBuffDuration; <>O.<8>__HookSetTimedBuffDuration = val9; obj9 = (object)val9; } CharacterBody.SetTimedBuffDurationIfPresent += (hook_SetTimedBuffDurationIfPresent)obj9; object obj10 = <>O.<9>__HookServerGiveItemPermanent; if (obj10 == null) { hook_GiveItemPermanent_ItemIndex_int val10 = HookServerGiveItemPermanent; <>O.<9>__HookServerGiveItemPermanent = val10; obj10 = (object)val10; } Inventory.GiveItemPermanent_ItemIndex_int += (hook_GiveItemPermanent_ItemIndex_int)obj10; object obj11 = <>O.<10>__HookServerGiveItemTemporary; if (obj11 == null) { hook_GiveItemTemp val11 = HookServerGiveItemTemporary; <>O.<10>__HookServerGiveItemTemporary = val11; obj11 = (object)val11; } Inventory.GiveItemTemp += (hook_GiveItemTemp)obj11; object obj12 = <>O.<11>__HookServerRemoveItem; if (obj12 == null) { hook_RemoveItem_ItemIndex_int val12 = HookServerRemoveItem; <>O.<11>__HookServerRemoveItem = val12; obj12 = (object)val12; } Inventory.RemoveItem_ItemIndex_int += (hook_RemoveItem_ItemIndex_int)obj12; object obj13 = <>O.<12>__HookInventoryChanged; if (obj13 == null) { hook_HandleInventoryChanged val13 = HookInventoryChanged; <>O.<12>__HookInventoryChanged = val13; obj13 = (object)val13; } Inventory.HandleInventoryChanged += (hook_HandleInventoryChanged)obj13; object obj14 = <>O.<13>__HookItemAdded; if (obj14 == null) { hook_RpcItemAdded val14 = HookItemAdded; <>O.<13>__HookItemAdded = val14; obj14 = (object)val14; } Inventory.RpcItemAdded += (hook_RpcItemAdded)obj14; object obj15 = <>O.<14>__HookInflictDamageOverTime; if (obj15 == null) { hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 val15 = HookInflictDamageOverTime; <>O.<14>__HookInflictDamageOverTime = val15; obj15 = (object)val15; } DotController.InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 += (hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1)obj15; object obj16 = <>O.<15>__HookInflictDamageOverTimeRef; if (obj16 == null) { hook_InflictDot_refInflictDotInfo val16 = HookInflictDamageOverTimeRef; <>O.<15>__HookInflictDamageOverTimeRef = val16; obj16 = (object)val16; } DotController.InflictDot_refInflictDotInfo += (hook_InflictDot_refInflictDotInfo)obj16; object obj17 = <>O.<16>__HookHealthComponentAwake; if (obj17 == null) { hook_Awake val17 = HookHealthComponentAwake; <>O.<16>__HookHealthComponentAwake = val17; obj17 = (object)val17; } HealthComponent.Awake += (hook_Awake)obj17; object obj18 = <>O.<17>__HookHeal; if (obj18 == null) { hook_Heal val18 = HookHeal; <>O.<17>__HookHeal = val18; obj18 = (object)val18; } HealthComponent.Heal += (hook_Heal)obj18; object obj19 = <>O.<18>__HookTakeDamageProcess; if (obj19 == null) { hook_TakeDamageProcess val19 = HookTakeDamageProcess; <>O.<18>__HookTakeDamageProcess = val19; obj19 = (object)val19; } HealthComponent.TakeDamageProcess += (hook_TakeDamageProcess)obj19; object obj20 = <>O.<19>__HookRecalculateStats; if (obj20 == null) { hook_RecalculateStats val20 = HookRecalculateStats; <>O.<19>__HookRecalculateStats = val20; obj20 = (object)val20; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj20; object obj21 = <>O.<20>__HookUpdateVisualEffects; if (obj21 == null) { hook_UpdateAllTemporaryVisualEffects val21 = HookUpdateVisualEffects; <>O.<20>__HookUpdateVisualEffects = val21; obj21 = (object)val21; } CharacterBody.UpdateAllTemporaryVisualEffects += (hook_UpdateAllTemporaryVisualEffects)obj21; object obj22 = <>O.<21>__HookCharacterBodyFixedUpdate; if (obj22 == null) { hook_FixedUpdate val22 = HookCharacterBodyFixedUpdate; <>O.<21>__HookCharacterBodyFixedUpdate = val22; obj22 = (object)val22; } CharacterBody.FixedUpdate += (hook_FixedUpdate)obj22; object obj23 = <>O.<22>__HookCharacterBodyRollCrit; if (obj23 == null) { hook_RollCrit val23 = HookCharacterBodyRollCrit; <>O.<22>__HookCharacterBodyRollCrit = val23; obj23 = (object)val23; } CharacterBody.RollCrit += (hook_RollCrit)obj23; GlobalEventManager.OnInteractionsGlobal += HookInteractionBegin; object obj24 = <>O.<24>__HookPurchaseInteractionBegin; if (obj24 == null) { hook_OnInteractionBegin val24 = HookPurchaseInteractionBegin; <>O.<24>__HookPurchaseInteractionBegin = val24; obj24 = (object)val24; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj24; object obj25 = <>O.<25>__HookPurchaseCanBeAfforded; if (obj25 == null) { hook_CanBeAffordedByInteractor val25 = HookPurchaseCanBeAfforded; <>O.<25>__HookPurchaseCanBeAfforded = val25; obj25 = (object)val25; } PurchaseInteraction.CanBeAffordedByInteractor += (hook_CanBeAffordedByInteractor)obj25; object obj26 = <>O.<26>__HookProcessJump; if (obj26 == null) { hook_ProcessJump val26 = HookProcessJump; <>O.<26>__HookProcessJump = val26; obj26 = (object)val26; } GenericCharacterMain.ProcessJump += (hook_ProcessJump)obj26; object obj27 = <>O.<27>__HookGenericCharacterFixedUpdate; if (obj27 == null) { hook_FixedUpdate val27 = HookGenericCharacterFixedUpdate; <>O.<27>__HookGenericCharacterFixedUpdate = val27; obj27 = (object)val27; } GenericCharacterMain.FixedUpdate += (hook_FixedUpdate)obj27; object obj28 = <>O.<28>__HookSceneExitControllerSetState; if (obj28 == null) { hook_SetState val28 = HookSceneExitControllerSetState; <>O.<28>__HookSceneExitControllerSetState = val28; obj28 = (object)val28; } SceneExitController.SetState += (hook_SetState)obj28; object obj29 = <>O.<29>__HookOnHitEnemy; if (obj29 == null) { hook_OnHitEnemy val29 = HookOnHitEnemy; <>O.<29>__HookOnHitEnemy = val29; obj29 = (object)val29; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj29; object obj30 = <>O.<30>__HookStatsMod; if (obj30 == null) { StatHookEventHandler val30 = HookStatsMod; <>O.<30>__HookStatsMod = val30; obj30 = (object)val30; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj30; GlobalEventManager.onServerDamageDealt += HookOnDamageDealt; GlobalEventManager.onCharacterDeathGlobal += HookOnCharacterDeath; SceneDirector.onPrePopulateSceneServer += HookPrePopulateScene; } } public static void Disable() { //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_0033: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Expected O, but got Unknown //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Expected O, but got Unknown //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Expected O, but got Unknown //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Expected O, but got Unknown //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Expected O, but got Unknown if (enabled) { enabled = false; object obj = <>O.<0>__HookHoldoutZoneControllerUpdate; if (obj == null) { hook_Update val = HookHoldoutZoneControllerUpdate; <>O.<0>__HookHoldoutZoneControllerUpdate = val; obj = (object)val; } HoldoutZoneController.Update -= (hook_Update)obj; object obj2 = <>O.<1>__HookHoldoutZoneControllerStart; if (obj2 == null) { hook_Start val2 = HookHoldoutZoneControllerStart; <>O.<1>__HookHoldoutZoneControllerStart = val2; obj2 = (object)val2; } HoldoutZoneController.Start -= (hook_Start)obj2; object obj3 = <>O.<2>__HookCharacterBodyAwake; if (obj3 == null) { hook_Awake val3 = HookCharacterBodyAwake; <>O.<2>__HookCharacterBodyAwake = val3; obj3 = (object)val3; } CharacterBody.Awake -= (hook_Awake)obj3; object obj4 = <>O.<3>__HookCharacterBodyStart; if (obj4 == null) { hook_Start val4 = HookCharacterBodyStart; <>O.<3>__HookCharacterBodyStart = val4; obj4 = (object)val4; } CharacterBody.Start -= (hook_Start)obj4; object obj5 = <>O.<4>__HookAddBuffIndex; if (obj5 == null) { hook_AddBuff_BuffIndex val5 = HookAddBuffIndex; <>O.<4>__HookAddBuffIndex = val5; obj5 = (object)val5; } CharacterBody.AddBuff_BuffIndex -= (hook_AddBuff_BuffIndex)obj5; object obj6 = <>O.<5>__HookAddTimedBuffDef; if (obj6 == null) { hook_AddTimedBuff_BuffDef_float val6 = HookAddTimedBuffDef; <>O.<5>__HookAddTimedBuffDef = val6; obj6 = (object)val6; } CharacterBody.AddTimedBuff_BuffDef_float -= (hook_AddTimedBuff_BuffDef_float)obj6; object obj7 = <>O.<6>__HookAddTimedBuffDefMaxStacks; if (obj7 == null) { hook_AddTimedBuff_BuffDef_float_int val7 = HookAddTimedBuffDefMaxStacks; <>O.<6>__HookAddTimedBuffDefMaxStacks = val7; obj7 = (object)val7; } CharacterBody.AddTimedBuff_BuffDef_float_int -= (hook_AddTimedBuff_BuffDef_float_int)obj7; object obj8 = <>O.<7>__HookExtendTimedBuffs; if (obj8 == null) { hook_ExtendTimedBuffIfPresent_BuffDef_float_float val8 = HookExtendTimedBuffs; <>O.<7>__HookExtendTimedBuffs = val8; obj8 = (object)val8; } CharacterBody.ExtendTimedBuffIfPresent_BuffDef_float_float -= (hook_ExtendTimedBuffIfPresent_BuffDef_float_float)obj8; object obj9 = <>O.<8>__HookSetTimedBuffDuration; if (obj9 == null) { hook_SetTimedBuffDurationIfPresent val9 = HookSetTimedBuffDuration; <>O.<8>__HookSetTimedBuffDuration = val9; obj9 = (object)val9; } CharacterBody.SetTimedBuffDurationIfPresent -= (hook_SetTimedBuffDurationIfPresent)obj9; object obj10 = <>O.<9>__HookServerGiveItemPermanent; if (obj10 == null) { hook_GiveItemPermanent_ItemIndex_int val10 = HookServerGiveItemPermanent; <>O.<9>__HookServerGiveItemPermanent = val10; obj10 = (object)val10; } Inventory.GiveItemPermanent_ItemIndex_int -= (hook_GiveItemPermanent_ItemIndex_int)obj10; object obj11 = <>O.<11>__HookServerRemoveItem; if (obj11 == null) { hook_RemoveItem_ItemIndex_int val11 = HookServerRemoveItem; <>O.<11>__HookServerRemoveItem = val11; obj11 = (object)val11; } Inventory.RemoveItem_ItemIndex_int -= (hook_RemoveItem_ItemIndex_int)obj11; object obj12 = <>O.<12>__HookInventoryChanged; if (obj12 == null) { hook_HandleInventoryChanged val12 = HookInventoryChanged; <>O.<12>__HookInventoryChanged = val12; obj12 = (object)val12; } Inventory.HandleInventoryChanged -= (hook_HandleInventoryChanged)obj12; object obj13 = <>O.<13>__HookItemAdded; if (obj13 == null) { hook_RpcItemAdded val13 = HookItemAdded; <>O.<13>__HookItemAdded = val13; obj13 = (object)val13; } Inventory.RpcItemAdded -= (hook_RpcItemAdded)obj13; object obj14 = <>O.<14>__HookInflictDamageOverTime; if (obj14 == null) { hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 val14 = HookInflictDamageOverTime; <>O.<14>__HookInflictDamageOverTime = val14; obj14 = (object)val14; } DotController.InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 -= (hook_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1)obj14; object obj15 = <>O.<15>__HookInflictDamageOverTimeRef; if (obj15 == null) { hook_InflictDot_refInflictDotInfo val15 = HookInflictDamageOverTimeRef; <>O.<15>__HookInflictDamageOverTimeRef = val15; obj15 = (object)val15; } DotController.InflictDot_refInflictDotInfo -= (hook_InflictDot_refInflictDotInfo)obj15; object obj16 = <>O.<16>__HookHealthComponentAwake; if (obj16 == null) { hook_Awake val16 = HookHealthComponentAwake; <>O.<16>__HookHealthComponentAwake = val16; obj16 = (object)val16; } HealthComponent.Awake -= (hook_Awake)obj16; object obj17 = <>O.<17>__HookHeal; if (obj17 == null) { hook_Heal val17 = HookHeal; <>O.<17>__HookHeal = val17; obj17 = (object)val17; } HealthComponent.Heal -= (hook_Heal)obj17; object obj18 = <>O.<18>__HookTakeDamageProcess; if (obj18 == null) { hook_TakeDamageProcess val18 = HookTakeDamageProcess; <>O.<18>__HookTakeDamageProcess = val18; obj18 = (object)val18; } HealthComponent.TakeDamageProcess -= (hook_TakeDamageProcess)obj18; object obj19 = <>O.<19>__HookRecalculateStats; if (obj19 == null) { hook_RecalculateStats val19 = HookRecalculateStats; <>O.<19>__HookRecalculateStats = val19; obj19 = (object)val19; } CharacterBody.RecalculateStats -= (hook_RecalculateStats)obj19; object obj20 = <>O.<20>__HookUpdateVisualEffects; if (obj20 == null) { hook_UpdateAllTemporaryVisualEffects val20 = HookUpdateVisualEffects; <>O.<20>__HookUpdateVisualEffects = val20; obj20 = (object)val20; } CharacterBody.UpdateAllTemporaryVisualEffects -= (hook_UpdateAllTemporaryVisualEffects)obj20; object obj21 = <>O.<21>__HookCharacterBodyFixedUpdate; if (obj21 == null) { hook_FixedUpdate val21 = HookCharacterBodyFixedUpdate; <>O.<21>__HookCharacterBodyFixedUpdate = val21; obj21 = (object)val21; } CharacterBody.FixedUpdate -= (hook_FixedUpdate)obj21; GlobalEventManager.OnInteractionsGlobal -= HookInteractionBegin; object obj22 = <>O.<24>__HookPurchaseInteractionBegin; if (obj22 == null) { hook_OnInteractionBegin val22 = HookPurchaseInteractionBegin; <>O.<24>__HookPurchaseInteractionBegin = val22; obj22 = (object)val22; } PurchaseInteraction.OnInteractionBegin -= (hook_OnInteractionBegin)obj22; object obj23 = <>O.<25>__HookPurchaseCanBeAfforded; if (obj23 == null) { hook_CanBeAffordedByInteractor val23 = HookPurchaseCanBeAfforded; <>O.<25>__HookPurchaseCanBeAfforded = val23; obj23 = (object)val23; } PurchaseInteraction.CanBeAffordedByInteractor -= (hook_CanBeAffordedByInteractor)obj23; object obj24 = <>O.<26>__HookProcessJump; if (obj24 == null) { hook_ProcessJump val24 = HookProcessJump; <>O.<26>__HookProcessJump = val24; obj24 = (object)val24; } GenericCharacterMain.ProcessJump -= (hook_ProcessJump)obj24; object obj25 = <>O.<27>__HookGenericCharacterFixedUpdate; if (obj25 == null) { hook_FixedUpdate val25 = HookGenericCharacterFixedUpdate; <>O.<27>__HookGenericCharacterFixedUpdate = val25; obj25 = (object)val25; } GenericCharacterMain.FixedUpdate -= (hook_FixedUpdate)obj25; object obj26 = <>O.<29>__HookOnHitEnemy; if (obj26 == null) { hook_OnHitEnemy val26 = HookOnHitEnemy; <>O.<29>__HookOnHitEnemy = val26; obj26 = (object)val26; } GlobalEventManager.OnHitEnemy -= (hook_OnHitEnemy)obj26; object obj27 = <>O.<30>__HookStatsMod; if (obj27 == null) { StatHookEventHandler val27 = HookStatsMod; <>O.<30>__HookStatsMod = val27; obj27 = (object)val27; } RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj27; GlobalEventManager.onServerDamageDealt -= HookOnDamageDealt; GlobalEventManager.onCharacterDeathGlobal -= HookOnCharacterDeath; SceneDirector.onPrePopulateSceneServer -= HookPrePopulateScene; } } private static void CreatePrefabs() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("temp GO"); val.AddComponent(); characterBodyHelperPrefab = PrefabAPI.InstantiateClone(val, "faithfulCharacterBodyHelper"); Object.Destroy((Object)(object)val); characterBodyHelperPrefab.AddComponent(); characterBodyHelperPrefab.AddComponent(); characterBodyHelperPrefab.AddComponent(); characterBodyHelperPrefab.AddComponent(); characterBodyHelperPrefab.AddComponent(); characterBodyHelperPrefab.AddComponent(); } public static void Update() { foreach (Callback updateCallback in updateCallbacks) { updateCallback(); } if (!Utils.debugMode) { return; } foreach (Callback debugUpdateCallback in debugUpdateCallbacks) { debugUpdateCallback(); } } public static void FixedUpdate() { foreach (Callback fixedUpdateCallback in fixedUpdateCallbacks) { fixedUpdateCallback(); } if (Utils.debugMode) { foreach (Callback debugFixedUpdateCallback in debugFixedUpdateCallbacks) { debugFixedUpdateCallback(); } } PlayerOnPlayerFixedUpdate(); AllyOnAllyFixedUpdate(); } public static void OverrideCritCheck(CharacterBody _body, int _count = 1) { if (critOverrideCounts.ContainsKey(_body)) { critOverrideCounts[_body] += _count; } else { critOverrideCounts.Add(_body, _count); } } public static void AddUpdateCallback(Callback _callback, bool _debugOnly = false) { if (_debugOnly) { debugUpdateCallbacks.Add(_callback); } else { updateCallbacks.Add(_callback); } } public static void AddFixedUpdateCallback(Callback _callback, bool _debugOnly = false) { if (_debugOnly) { debugFixedUpdateCallbacks.Add(_callback); } else { fixedUpdateCallbacks.Add(_callback); } } public static void AddStatsMod(Item _item, StatsModCallback _callback) { itemStatsMods.Add(new ItemStatsMod(_item, _callback)); DebugLog("Added stat mods for '" + _item.token + "' item"); } public static void AddStatsMod(Buff _buff, StatsModCallback _callback) { buffStatsMods.Add(new BuffStatsMod(_buff, _callback)); DebugLog("Added stat mods for '" + _buff.token + "' buff"); } public static void AddInHoldoutZoneCallback(InHoldoutZoneCallback _callback) { inHoldoutZoneCallbacks.Add(_callback); DebugLog("Added in Holdout Zone behaviour"); } public static void AddOnHoldoutZoneStartCallback(OnHoldoutZoneStartCallback _callback) { onHoldoutZoneStartCallbacks.Add(_callback); DebugLog("Added on Holdout Zone start behaviour"); } public static void AddOnHoldoutZoneCalcRadiusCallback(OnHoldoutZoneCalcRadiusCallback _callback) { onHoldoutZoneCalcRadiusCallbacks.Add(_callback); DebugLog("Added on Holdout Zone calc radius behaviour"); } public static void AddPlayerToPlayerCallback(PlayerToPlayerCallback _callback) { playerToPlayerCallbacks.Add(_callback); DebugLog("Added Player to Player behaviour"); } public static void AddPlayerToPlayerCallback(Item _requiredItem, PlayerHolderToPlayerCallback _callback) { playerItemToPlayerCallbacks.Add(new PlayerItemToPlayer(_requiredItem, _callback)); DebugLog("Added Player to Player behaviour"); } public static void AddPlayerToPlayerCallback(Buff _requiredBuff, PlayerHolderToPlayerCallback _callback) { playerBuffToPlayerCallbacks.Add(new PlayerBuffToPlayer(_requiredBuff, _callback)); DebugLog("Added Player to Player behaviour"); } public static void AddAllyToAllyCallback(Item _requiredItem, AllyHolderToAllyCallback _callback) { allyItemToAllyCallbacks.Add(new AllyItemToAlly(_requiredItem, _callback)); DebugLog("Added Ally to Ally behaviour"); } public static void AddAllyToAllyCallback(Buff _requiredBuff, AllyHolderToAllyCallback _callback) { allyBuffToAllyCallbacks.Add(new AllyBuffToAlly(_requiredBuff, _callback)); DebugLog("Added Ally to Ally behaviour"); } public static void AddOnIncomingDamageCallback(OnIncomingDamageCallback _callback) { onIncomingDamageCallbacks.Add(_callback); DebugLog("Added On Incoming Damage behaviour"); } public static void AddOnHitEnemyLateCallback(OnHitEnemyCallback _callback) { onHitEnemyLateCallbacks.Add(_callback); DebugLog("Added On Hit Enemy Late behaviour"); } public static void AddOnTakeDamageProcessCallback(OnTakeDamageProcessCallback _callback) { onTakeDamageProcessCallbacks.Add(_callback); DebugLog("Added On Take Damage Process behaviour"); } public static void AddOnTakeDamageProcessLateCallback(OnTakeDamageProcessCallback _callback) { onTakeDamageProcessLateCallbacks.Add(_callback); DebugLog("Added On Take Damage Process Late behaviour"); } public static void AddOnDamageDealtCallback(DamageReportCallback _callback) { onDamageDealtCallbacks.Add(_callback); DebugLog("Added On Damage Dealt behaviour"); } public static void AddOnCharacterDeathCallback(DamageReportCallback _callback) { onCharacterDeathCallbacks.Add(_callback); DebugLog("Added On Character Death behaviour"); } public static void AddOnAddBuffCallback(OnAddBuffCallback _callback) { onAddBuffCallbacks.Add(_callback); DebugLog("Added On Add Buff behaviour"); } public static void AddOnAddTimedBuffCallback(OnAddTimedBuffCallback _callback) { onAddTimedBuffCallbacks.Add(_callback); DebugLog("Added On Add Timed Buff behaviour"); } public static void AddOnAddTimedBuffMaxStacksCallback(OnAddTimedBuffMaxStacksCallback _callback) { onAddTimedBuffMaxStacksCallbacks.Add(_callback); DebugLog("Added On Add Timed Buff Max Stacks behaviour"); } public static void AddOnExtendTimedBuffsCallback(OnExtendTimedBuffsCallback _callback) { onExtendTimedBuffsCallbacks.Add(_callback); DebugLog("Added On Extend Timed Buffs behaviour"); } public static void AddOnSetTimedBuffDurationCallback(OnSetTimedBuffDurationCallback _callback) { onSetTimedBuffDurationCallbacks.Add(_callback); DebugLog("Added On Set Timed Buff Duration behaviour"); } public static void AddOnInflictDamageOverTimeCallback(OnInflictDamageOverTimeCallback _callback) { onInflictDamageOverTimeCallbacks.Add(_callback); DebugLog("Added On Inflict Damage Over Time behaviour"); } public static void AddOnInflictDamageOverTimeRefCallback(OnInflictDamageOverTimeRefCallback _callback) { onInflictDamageOverTimeRefCallbacks.Add(_callback); DebugLog("Added On Inflict Damage Over Time Ref behaviour"); } public static void AddServerOnGiveItemPermanentCallback(OnTransferItemCallback _callback) { onGiveItemPermanentCallbacks.Add(_callback); DebugLog("Added On Give Item Permanent behaviour"); } public static void AddServerOnGiveItemPermanentLateCallback(OnTransferItemCallback _callback) { onGiveItemPermanentLateCallbacks.Add(_callback); DebugLog("Added On Give Item Permanent Late behaviour"); } public static void AddServerOnGiveItemTemporaryCallback(OnTransferItemFloatCallback _callback) { onGiveItemTemporaryCallbacks.Add(_callback); DebugLog("Added On Give Item Temporary behaviour"); } public static void AddServerOnGiveItemTemporaryLateCallback(OnTransferItemFloatCallback _callback) { onGiveItemTemporaryLateCallbacks.Add(_callback); DebugLog("Added On Give Item Temporary Late behaviour"); } public static void AddServerOnRemoveItemCallback(OnTransferItemCallback _callback) { onRemoveItemCallbacks.Add(_callback); DebugLog("Added On Remove Item behaviour"); } public static void AddOnInventoryChangedCallback(OnInventoryCallback _callback) { onInventoryChangedCallbacks.Add(_callback); DebugLog("Added On Inventory Changed behaviour"); } public static void RemoveOnInventoryChangedCallback(OnInventoryCallback _callback) { onInventoryChangedCallbacks.Remove(_callback); DebugLog("Removed On Inventory Changed behaviour"); } public static void AddOnItemAddedCallback(ItemDef _itemDef, OnInventoryCallback _callback) { if (onItemAddedCallbacks.ContainsKey(_itemDef)) { onItemAddedCallbacks[_itemDef].Add(_callback); } else { onItemAddedCallbacks[_itemDef] = new List { _callback }; } DebugLog("Added On Item Added behaviour"); } public static void RemoveOnItemAddedCallback(ItemDef _itemDef, OnInventoryCallback _callback) { if (onItemAddedCallbacks.ContainsKey(_itemDef)) { onItemAddedCallbacks[_itemDef].Remove(_callback); if (onItemAddedCallbacks[_itemDef].Count == 0) { onItemAddedCallbacks.Remove(_itemDef); } DebugLog("Removed On Item Added behaviour"); } } public static void AddOnHealCallback(OnHealCallback _callback) { onHealCallbacks.Add(_callback); DebugLog("Added On Heal behaviour"); } public static void AddOnCharacterBodyAwakeCallback(CharacterBodyCallback _callback) { onCharacterBodyAwakeCallbacks.Add(_callback); DebugLog("Added On Character Body Awake behaviour"); } public static void AddOnCharacterBodyStartCallback(CharacterBodyCallback _callback) { onCharacterBodyStartCallbacks.Add(_callback); DebugLog("Added On Character Body Start behaviour"); } public static void AddOnRecalculateStatsCallback(CharacterBodyCallback _callback) { onRecalculateStatsCallbacks.Add(_callback); DebugLog("Added On Recalculate Stats behaviour"); } public static void AddOnUpdateVisualEffectsCallback(CharacterBodyCallback _callback) { onUpdateVisualEffectsCallbacks.Add(_callback); DebugLog("Added On Update Visual Effects behaviour"); } public static void AddOnCharacterBodyFixedUpdateCallback(CharacterBodyCallback _callback) { onCharacterBodyFixedUpdateCallbacks.Add(_callback); DebugLog("Added On Character Body Fixed Update behaviour"); } public static void RemoveOnCharacterBodyFixedUpdateCallback(CharacterBodyCallback _callback) { onCharacterBodyFixedUpdateCallbacks.Remove(_callback); DebugLog("Removed On Character Body Fixed Update behaviour"); } public static void AddOnCharacterBodyTickCallback(float _tickRate, CharacterBodyCallback _callback) { onCharacterBodyTickCallbacks.Add(_tickRate, _callback); DebugLog("Added On Character Body Tick behaviour"); } public static void AddOnInteractionBeginProcCallback(OnInteractionBeginProcCallback _callback) { onInteractionBeginProcCallbacks.Add(_callback); DebugLog("Added On Interaction Begin Proc behaviour"); } public static void AddOnPurchaseInteractionBeginCallback(OnPurchaseInteractionBeginCallback _callback) { onPurchaseInteractionBeginCallbacks.Add(_callback); DebugLog("Added On Purchase Interaction Begin behaviour"); } public static void AddOnPurchaseCanBeAffordedCallback(OnPurchaseCanBeAffordedCallback _callback) { onPurchaseCanBeAffordedCallbacks.Add(_callback); DebugLog("Added On Purchase Can Be Afforded behaviour"); } public static void AddOnProcessJumpCallback(OnProcessJumpCallback _callback) { onProcessJumpCallbacks.Add(_callback); DebugLog("Added On Process Jump behaviour"); } public static void AddGenericCharacterFixedUpdateCallback(GenericCharacterCallback _callback) { genericCharacterFixedUpdateCallbacks.Add(_callback); DebugLog("Added Generic Character Fixed Update behaviour"); } public static void AddOnPrePopulateSceneCallback(SceneDirectorCallback _callback) { onPrePopulateSceneCallbacks.Add(_callback); DebugLog("Added On Pre-Populate Scene behaviour"); } public static void AddOnPreSceneExitCallback(SceneExitControllerCallback _callback) { onPreSceneExitCallbacks.Add(_callback); DebugLog("Added On Pre-Scene Exit behaviour"); } private static void PlayerOnPlayerFixedUpdate() { List players = Utils.GetPlayers(); foreach (PlayerCharacterMasterController item in players) { foreach (PlayerItemToPlayer playerItemToPlayerCallback in playerItemToPlayerCallbacks) { playerItemToPlayerCallback.Process(item, players); } foreach (PlayerBuffToPlayer playerBuffToPlayerCallback in playerBuffToPlayerCallbacks) { playerBuffToPlayerCallback.Process(item, players); } foreach (PlayerCharacterMasterController item2 in players) { if ((Object)(object)item == (Object)(object)item2) { continue; } foreach (PlayerToPlayerCallback playerToPlayerCallback in playerToPlayerCallbacks) { playerToPlayerCallback(item, item2); } } } } private static void AllyOnAllyFixedUpdate() { List charactersForTeam = Utils.GetCharactersForTeam((TeamIndex)1); foreach (CharacterMaster item in charactersForTeam) { foreach (AllyItemToAlly allyItemToAllyCallback in allyItemToAllyCallbacks) { allyItemToAllyCallback.Process(item, charactersForTeam); } foreach (AllyBuffToAlly allyBuffToAllyCallback in allyBuffToAllyCallbacks) { allyBuffToAllyCallback.Process(item, charactersForTeam); } } } private static void HookStatsMod(CharacterBody _body, StatHookEventArgs _stats) { foreach (ItemStatsMod itemStatsMod in itemStatsMods) { itemStatsMod.Process(_body, _stats); } foreach (BuffStatsMod buffStatsMod in buffStatsMods) { buffStatsMod.Process(_body, _stats); } } private static void HookHoldoutZoneControllerUpdate(orig_Update orig, HoldoutZoneController self) { CharacterBody[] characterBodiesInHoldoutZone = Utils.GetCharacterBodiesInHoldoutZone(self); CharacterBody[] array = characterBodiesInHoldoutZone; foreach (CharacterBody contained in array) { foreach (InHoldoutZoneCallback inHoldoutZoneCallback in inHoldoutZoneCallbacks) { inHoldoutZoneCallback(contained, self); } } orig.Invoke(self); } private static void HookHoldoutZoneControllerStart(orig_Start orig, HoldoutZoneController self) { FaithfulHoldoutZoneBehaviour faithfulHoldoutZoneBehaviour = ((Component)self).gameObject.AddComponent(); faithfulHoldoutZoneBehaviour.Init(onHoldoutZoneCalcRadiusCallbacks); foreach (OnHoldoutZoneStartCallback onHoldoutZoneStartCallback in onHoldoutZoneStartCallbacks) { onHoldoutZoneStartCallback(self); } orig.Invoke(self); } private static void HookCharacterBodyAwake(orig_Awake orig, CharacterBody self) { orig.Invoke(self); foreach (CharacterBodyCallback onCharacterBodyAwakeCallback in onCharacterBodyAwakeCallbacks) { onCharacterBodyAwakeCallback(self); } } private static void HookCharacterBodyStart(orig_Start orig, CharacterBody self) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && (Object)(object)self.master != (Object)null) { GameObject val = Object.Instantiate(characterBodyHelperPrefab); NetworkServer.Spawn(val); FaithfulCharacterBodyBehaviour component = val.GetComponent(); component.NetworkcharacterID = ((Component)self).GetComponent().netId; foreach (KeyValuePair onCharacterBodyTickCallback in onCharacterBodyTickCallbacks) { component.AddTickBehaviour(onCharacterBodyTickCallback.Value, onCharacterBodyTickCallback.Key); } } orig.Invoke(self); foreach (CharacterBodyCallback onCharacterBodyStartCallback in onCharacterBodyStartCallbacks) { onCharacterBodyStartCallback(self); } } private static void HookAddBuffIndex(orig_AddBuff_BuffIndex orig, CharacterBody self, BuffIndex buffType) { //IL_0019: 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) foreach (OnAddBuffCallback onAddBuffCallback in onAddBuffCallbacks) { onAddBuffCallback(buffType, self); } orig.Invoke(self, buffType); } private static void HookAddTimedBuffDef(orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration) { foreach (OnAddTimedBuffCallback onAddTimedBuffCallback in onAddTimedBuffCallbacks) { onAddTimedBuffCallback(buffDef, ref duration, self); } orig.Invoke(self, buffDef, duration); } private static void HookAddTimedBuffDefMaxStacks(orig_AddTimedBuff_BuffDef_float_int orig, CharacterBody self, BuffDef buffDef, float duration, int maxStacks) { foreach (OnAddTimedBuffMaxStacksCallback onAddTimedBuffMaxStacksCallback in onAddTimedBuffMaxStacksCallbacks) { onAddTimedBuffMaxStacksCallback(buffDef, ref duration, ref maxStacks, self); } orig.Invoke(self, buffDef, duration, maxStacks); } private static void HookExtendTimedBuffs(orig_ExtendTimedBuffIfPresent_BuffDef_float_float orig, CharacterBody self, BuffDef buffDef, float duration, float max) { foreach (OnExtendTimedBuffsCallback onExtendTimedBuffsCallback in onExtendTimedBuffsCallbacks) { onExtendTimedBuffsCallback(buffDef, ref duration, ref max, self); } orig.Invoke(self, buffDef, duration, max); } private static void HookSetTimedBuffDuration(orig_SetTimedBuffDurationIfPresent orig, CharacterBody self, BuffDef buffDef, float duration, bool allStacks) { foreach (OnSetTimedBuffDurationCallback onSetTimedBuffDurationCallback in onSetTimedBuffDurationCallbacks) { onSetTimedBuffDurationCallback(buffDef, ref duration, allStacks, self); } orig.Invoke(self, buffDef, duration, allStacks); } private static void HookInflictDamageOverTime(orig_InflictDot_GameObject_GameObject_DotIndex_float_float_Nullable1 orig, GameObject victimObject, GameObject attackerObject, DotIndex dotIndex, float duration, float damageMultiplier, uint? maxStacksFromAttacker) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(victimObject, attackerObject, dotIndex, duration, damageMultiplier, maxStacksFromAttacker); foreach (OnInflictDamageOverTimeCallback onInflictDamageOverTimeCallback in onInflictDamageOverTimeCallbacks) { onInflictDamageOverTimeCallback(victimObject, attackerObject, dotIndex, duration, damageMultiplier, maxStacksFromAttacker); } } private static void HookInflictDamageOverTimeRef(orig_InflictDot_refInflictDotInfo orig, ref InflictDotInfo inflictDotInfo) { foreach (OnInflictDamageOverTimeRefCallback onInflictDamageOverTimeRefCallback in onInflictDamageOverTimeRefCallbacks) { onInflictDamageOverTimeRefCallback(ref inflictDotInfo); } orig.Invoke(ref inflictDotInfo); } private static void HookServerGiveItemPermanent(orig_GiveItemPermanent_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int countToAdd) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) foreach (OnTransferItemCallback onGiveItemPermanentCallback in onGiveItemPermanentCallbacks) { onGiveItemPermanentCallback(self, itemIndex, countToAdd); } orig.Invoke(self, itemIndex, countToAdd); foreach (OnTransferItemCallback onGiveItemPermanentLateCallback in onGiveItemPermanentLateCallbacks) { onGiveItemPermanentLateCallback(self, itemIndex, countToAdd); } } private static void HookServerGiveItemTemporary(orig_GiveItemTemp orig, Inventory self, ItemIndex itemIndex, float countToAdd) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) foreach (OnTransferItemFloatCallback onGiveItemTemporaryCallback in onGiveItemTemporaryCallbacks) { onGiveItemTemporaryCallback(self, itemIndex, countToAdd); } orig.Invoke(self, itemIndex, countToAdd); foreach (OnTransferItemFloatCallback onGiveItemTemporaryLateCallback in onGiveItemTemporaryLateCallbacks) { onGiveItemTemporaryLateCallback(self, itemIndex, countToAdd); } } private static void HookServerRemoveItem(orig_RemoveItem_ItemIndex_int orig, Inventory self, ItemIndex itemIndex, int count) { //IL_001a: 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) foreach (OnTransferItemCallback onRemoveItemCallback in onRemoveItemCallbacks) { onRemoveItemCallback(self, itemIndex, count); } orig.Invoke(self, itemIndex, count); } private static void HookInventoryChanged(orig_HandleInventoryChanged orig, Inventory self) { orig.Invoke(self); foreach (OnInventoryCallback onInventoryChangedCallback in onInventoryChangedCallbacks) { onInventoryChangedCallback(self); } } private static void HookItemAdded(orig_RpcItemAdded orig, Inventory self, ItemIndex itemIndex) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, itemIndex); ItemDef val = ItemCatalog.GetItemDef(itemIndex); if ((Object)(object)val == (Object)null) { return; } if (Utils.qualityEnabled) { val = QualityCompat.GetBaseItem(val); } if (!onItemAddedCallbacks.ContainsKey(val)) { return; } foreach (OnInventoryCallback item in onItemAddedCallbacks[val]) { item(self); } } private static void HookHealthComponentAwake(orig_Awake orig, HealthComponent self) { FaithfulHealthComponentBehaviour faithfulHealthComponentBehaviour = ((Component)self).gameObject.AddComponent(); orig.Invoke(self); } private static float HookHeal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) foreach (OnHealCallback onHealCallback in onHealCallbacks) { onHealCallback(self, ref amount, ref procChainMask, ref nonRegen); } return orig.Invoke(self, amount, procChainMask, nonRegen); } private static void HookTakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { foreach (OnTakeDamageProcessCallback onTakeDamageProcessCallback in onTakeDamageProcessCallbacks) { onTakeDamageProcessCallback(self, damageInfo); } orig.Invoke(self, damageInfo); foreach (OnTakeDamageProcessCallback onTakeDamageProcessLateCallback in onTakeDamageProcessLateCallbacks) { onTakeDamageProcessLateCallback(self, damageInfo); } } private static void HookRecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); foreach (CharacterBodyCallback onRecalculateStatsCallback in onRecalculateStatsCallbacks) { onRecalculateStatsCallback(self); } self.UpdateAllTemporaryVisualEffects(); } private static void HookUpdateVisualEffects(orig_UpdateAllTemporaryVisualEffects orig, CharacterBody self) { orig.Invoke(self); foreach (CharacterBodyCallback onUpdateVisualEffectsCallback in onUpdateVisualEffectsCallbacks) { onUpdateVisualEffectsCallback(self); } } private static void HookCharacterBodyFixedUpdate(orig_FixedUpdate orig, CharacterBody self) { orig.Invoke(self); foreach (CharacterBodyCallback onCharacterBodyFixedUpdateCallback in onCharacterBodyFixedUpdateCallbacks) { onCharacterBodyFixedUpdateCallback(self); } } private static bool HookCharacterBodyRollCrit(orig_RollCrit orig, CharacterBody self) { if (critOverrideCounts.ContainsKey(self)) { int num = critOverrideCounts[self]; if (num > 0) { critOverrideCounts[self] = num - 1; return true; } } return orig.Invoke(self); } private static void HookInteractionBegin(Interactor _interactor, IInteractable _interactable, GameObject _interactableObject) { if ((Object)(object)_interactor == (Object)null || _interactable == null || !Object.op_Implicit((Object)(object)_interactableObject) || !CanRunInteractionBeginProc(_interactable, _interactableObject)) { return; } foreach (OnInteractionBeginProcCallback onInteractionBeginProcCallback in onInteractionBeginProcCallbacks) { onInteractionBeginProcCallback(_interactor, _interactable, _interactableObject); } } private static bool CanRunInteractionBeginProc(IInteractable _interactable, GameObject _interactableObject) { MonoBehaviour val = (MonoBehaviour)(object)((_interactable is MonoBehaviour) ? _interactable : null); if (!Object.op_Implicit((Object)(object)val)) { return false; } InteractionProcFilter component = _interactableObject.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { return component.shouldAllowOnInteractionBeginProc; } PurchaseInteraction val2 = (PurchaseInteraction)(object)((_interactable is PurchaseInteraction) ? _interactable : null); if (Object.op_Implicit((Object)(object)val2)) { return !val2.disableSpawnOnInteraction; } DelusionChestController component2 = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { PickupPickerController component3 = ((Component)val).GetComponent(); return (Object)(object)component3 == (Object)null || !((Behaviour)component3).enabled; } if (Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { return false; } if (Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { return false; } if (Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { return false; } PowerPedestal component4 = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component4)) { return component4.CanTriggerFireworks; } AccessCodesNodeController component5 = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component5)) { return component5.CheckInteractionOrder(); } return true; } private static void HookPurchaseInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { foreach (OnPurchaseInteractionBeginCallback onPurchaseInteractionBeginCallback in onPurchaseInteractionBeginCallbacks) { CharacterBody component = ((Component)activator).gameObject.GetComponent(); if ((Object)(object)component != (Object)null) { onPurchaseInteractionBeginCallback(self, component.master); } } orig.Invoke(self, activator); } private static bool HookPurchaseCanBeAfforded(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor activator) { foreach (OnPurchaseCanBeAffordedCallback onPurchaseCanBeAffordedCallback in onPurchaseCanBeAffordedCallbacks) { CharacterBody component = ((Component)activator).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && onPurchaseCanBeAffordedCallback(self, component.master)) { return true; } } return orig.Invoke(self, activator); } private static void HookProcessJump(orig_ProcessJump orig, GenericCharacterMain self) { orig.Invoke(self); foreach (OnProcessJumpCallback onProcessJumpCallback in onProcessJumpCallbacks) { onProcessJumpCallback(self); } } private static void HookGenericCharacterFixedUpdate(orig_FixedUpdate orig, GenericCharacterMain self) { orig.Invoke(self); foreach (GenericCharacterCallback genericCharacterFixedUpdateCallback in genericCharacterFixedUpdateCallbacks) { genericCharacterFixedUpdateCallback(self); } } private static void HookSceneExitControllerSetState(orig_SetState orig, SceneExitController self, ExitState newState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) if ((int)newState == 2) { foreach (SceneExitControllerCallback onPreSceneExitCallback in onPreSceneExitCallbacks) { onPreSceneExitCallback(self); } } orig.Invoke(self, newState); } private static void HookOnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { orig.Invoke(self, damageInfo, victim); foreach (OnHitEnemyCallback onHitEnemyLateCallback in onHitEnemyLateCallbacks) { onHitEnemyLateCallback(damageInfo, victim); } } private static void HookOnDamageDealt(DamageReport _report) { foreach (DamageReportCallback onDamageDealtCallback in onDamageDealtCallbacks) { onDamageDealtCallback(_report); } } private static void HookOnCharacterDeath(DamageReport _report) { foreach (DamageReportCallback onCharacterDeathCallback in onCharacterDeathCallbacks) { onCharacterDeathCallback(_report); } } private static void HookPrePopulateScene(SceneDirector _director) { foreach (SceneDirectorCallback onPrePopulateSceneCallback in onPrePopulateSceneCallbacks) { onPrePopulateSceneCallback(_director); } } public static void OnIncomingDamageServer(DamageInfo _damageInfo, CharacterMaster _attacker, CharacterMaster _victim) { foreach (OnIncomingDamageCallback onIncomingDamageCallback in onIncomingDamageCallbacks) { onIncomingDamageCallback(_damageInfo, _attacker, _victim); } } public static void DebugLog(string _message) { if (Utils.verboseConsole) { Log.Debug("[BEHAVIOUR] - " + _message); } } } internal struct ItemStatsMod { public Item item; public StatsModCallback callback; public ItemStatsMod(Item _item, StatsModCallback _callback) { item = _item; callback = _callback; } public void Process(CharacterBody _body, StatHookEventArgs _stats) { Inventory inventory = _body.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(item.itemDef); if (itemCountEffective != 0) { callback(itemCountEffective, _stats); } } } } internal struct BuffStatsMod { public Buff buff; public StatsModCallback callback; public BuffStatsMod(Buff _buff, StatsModCallback _callback) { buff = _buff; callback = _callback; } public void Process(CharacterBody _body, StatHookEventArgs _stats) { int buffCount = _body.GetBuffCount(buff.buffDef); if (buffCount != 0) { callback(buffCount, _stats); } } } internal struct PlayerItemToPlayer { public Item item; public PlayerHolderToPlayerCallback callback; public PlayerItemToPlayer(Item _item, PlayerHolderToPlayerCallback _callback) { item = _item; callback = _callback; } public void Process(PlayerCharacterMasterController _player, List _others) { if (!Object.op_Implicit((Object)(object)_player.body)) { return; } Inventory inventory = _player.body.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } int itemCountEffective = inventory.GetItemCountEffective(item.itemDef); if (itemCountEffective == 0) { return; } foreach (PlayerCharacterMasterController _other in _others) { if (!((Object)(object)_other == (Object)(object)_player)) { callback(itemCountEffective, _player, _other); } } } } internal struct PlayerBuffToPlayer { public Buff buff; public PlayerHolderToPlayerCallback callback; public PlayerBuffToPlayer(Buff _buff, PlayerHolderToPlayerCallback _callback) { buff = _buff; callback = _callback; } public void Process(PlayerCharacterMasterController _player, List _others) { if (!Object.op_Implicit((Object)(object)_player.body)) { return; } int buffCount = _player.body.GetBuffCount(buff.buffDef); if (buffCount == 0) { return; } foreach (PlayerCharacterMasterController _other in _others) { if (!((Object)(object)_other == (Object)(object)_player)) { callback(buffCount, _player, _other); } } } } internal struct AllyItemToAlly { public Item item; public AllyHolderToAllyCallback callback; public AllyItemToAlly(Item _item, AllyHolderToAllyCallback _callback) { item = _item; callback = _callback; } public void Process(CharacterMaster _ally, List _others) { if (!_ally.hasBody) { return; } Inventory inventory = _ally.GetBody().inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } int itemCountEffective = inventory.GetItemCountEffective(item.itemDef); if (itemCountEffective == 0) { return; } foreach (CharacterMaster _other in _others) { if (!((Object)(object)_other == (Object)(object)_ally)) { callback(itemCountEffective, _ally, _other); } } } } internal struct AllyBuffToAlly { public Buff buff; public AllyHolderToAllyCallback callback; public AllyBuffToAlly(Buff _buff, AllyHolderToAllyCallback _callback) { buff = _buff; callback = _callback; } public void Process(CharacterMaster _ally, List _others) { if (!_ally.hasBody) { return; } int buffCount = _ally.GetBody().GetBuffCount(buff.buffDef); if (buffCount == 0) { return; } foreach (CharacterMaster _other in _others) { if (!((Object)(object)_other == (Object)(object)_ally)) { callback(buffCount, _ally, _other); } } } } internal class FaithfulHermitsShawlBehaviour : MonoBehaviour, ICharacterBehaviour { public CharacterBody character; private Item m_hermitsShawlItem; private Buff patienceBuff; private int itemCount = -1; private bool hooked = false; private bool ooc = false; private bool forcedInCombat = false; private int maxBuffs; private int maxBuffsStacking; private float buffCooldown; private Item hermitsShawlItem { get { if (m_hermitsShawlItem == null) { m_hermitsShawlItem = Items.GetItem("HERMITS_SHAWL"); } return m_hermitsShawlItem; } } private int currentMaxBuffs => Utils.CalculateStackingValue(itemCount, maxBuffs, maxBuffsStacking); private float currentBuffCooldown { get { int num = currentMaxBuffs; return buffCooldown / (float)((num <= 1) ? 1 : (num - 1)); } } public FaithfulHermitsShawlBehaviour() { Utils.RegisterCharacterBehaviour(this); } public void Init(CharacterBody _character) { character = _character; patienceBuff = Buffs.GetBuff("PATIENCE"); FetchSettings(); Inventory inventory = character.inventory; if ((Object)(object)inventory != (Object)null) { UpdateItemCount(inventory.GetItemCountEffective(hermitsShawlItem.itemDef)); } Behaviour.AddOnItemAddedCallback(hermitsShawlItem.itemDef, OnItemAdded); character.UpdateAllTemporaryVisualEffects(); } public void FetchSettings() { if (hermitsShawlItem != null) { maxBuffsStacking = hermitsShawlItem.FetchSetting("MAX_BUFFS_STACKING").Value; maxBuffs = hermitsShawlItem.FetchSetting("MAX_BUFFS").Value; buffCooldown = hermitsShawlItem.FetchSetting("BUFF_RECHARGE").Value; } } private void OnDestroy() { Utils.UnregisterCharacterBehaviour(this); Behaviour.RemoveOnItemAddedCallback(hermitsShawlItem.itemDef, OnItemAdded); UnhookBehaviour(); } private void OnItemAdded(Inventory _inventory) { if (!hooked) { CharacterBody inventoryBody = Utils.GetInventoryBody(_inventory); if (!((Object)(object)inventoryBody == (Object)null) && !((Object)(object)inventoryBody != (Object)(object)character)) { int itemCountEffective = _inventory.GetItemCountEffective(hermitsShawlItem.itemDef); UpdateItemCount(itemCountEffective); } } } private void HookBehaviour() { if (!hooked) { hooked = true; Behaviour.AddOnInventoryChangedCallback(OnInventoryChanged); Behaviour.AddOnCharacterBodyFixedUpdateCallback(OnCharacterBodyFixedUpdate); } } private void UnhookBehaviour() { if (hooked) { hooked = false; Behaviour.RemoveOnInventoryChangedCallback(OnInventoryChanged); Behaviour.RemoveOnCharacterBodyFixedUpdateCallback(OnCharacterBodyFixedUpdate); } } protected void OnInventoryChanged(Inventory _inventory) { CharacterBody inventoryBody = Utils.GetInventoryBody(_inventory); if (!((Object)(object)inventoryBody == (Object)null) && !((Object)(object)inventoryBody != (Object)(object)character)) { int itemCountEffective = _inventory.GetItemCountEffective(hermitsShawlItem.itemDef); UpdateItemCount(itemCountEffective); } } private void OnCharacterBodyFixedUpdate(CharacterBody _body) { if (!((Object)(object)_body != (Object)(object)character) && Utils.hosting && itemCount >= 1) { UpdateOutOfCombat(); } } private void UpdateOutOfCombat() { bool flag = character.outOfCombat && !forcedInCombat; if (flag == ooc) { return; } ooc = flag; if (ooc) { int buffCount = character.GetBuffCount(patienceBuff.buffDef); if (buffCount < currentMaxBuffs) { character.AddBuff(patienceBuff.buffDef); } ((MonoBehaviour)this).Invoke("DelayedBuff", currentBuffCooldown); } } public void ForceIntoCombat() { ((MonoBehaviour)this).CancelInvoke("AllowOutOfCombat"); forcedInCombat = true; ((MonoBehaviour)this).Invoke("AllowOutOfCombat", 5f); } private void AllowOutOfCombat() { forcedInCombat = false; } private void DelayedBuff() { if (ooc) { int buffCount = character.GetBuffCount(patienceBuff.buffDef); if (buffCount < currentMaxBuffs) { character.AddBuff(patienceBuff.buffDef); } ((MonoBehaviour)this).Invoke("DelayedBuff", currentBuffCooldown); } } private void UpdateItemCount(int _newCount) { if (_newCount != itemCount) { itemCount = _newCount; if (!hooked && itemCount > 0) { HookBehaviour(); } } } } internal class FaithfulLeadersPennonBehaviour : MonoBehaviour, ICharacterBehaviour { public CharacterBody character; private TemporaryVisualEffect visualEffect; private int count = 0; private bool enableRadiusIndicator; private float baseRadius; private float radiusStacking; private FaithfulRadiusIndicatorBehaviour radiusIndicator; public FaithfulLeadersPennonBehaviour() { Utils.RegisterCharacterBehaviour(this); } public void Init(CharacterBody _character) { character = _character; FetchSettings(); Inventory inventory = character.inventory; if ((Object)(object)inventory != (Object)null) { UpdateItemCount(inventory.GetItemCountEffective(Items.GetItem("LEADERS_PENNON").itemDef)); } Behaviour.AddOnInventoryChangedCallback(OnInventoryChanged); character.UpdateAllTemporaryVisualEffects(); } public void FetchSettings() { Item item = Items.GetItem("LEADERS_PENNON"); enableRadiusIndicator = item.FetchSetting("ENABLE_RADIUS_INDICATOR").Value; baseRadius = item.FetchSetting("RADIUS").Value; radiusStacking = item.FetchSetting("RADIUS_STACKING").Value; } private void OnDestroy() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) Utils.UnregisterCharacterBehaviour(this); if ((Object)(object)radiusIndicator != (Object)null) { Object.Destroy((Object)(object)((Component)radiusIndicator).gameObject); } if ((Object)(object)visualEffect != (Object)null) { visualEffect.visualState = (VisualState)1; } Behaviour.RemoveOnInventoryChangedCallback(OnInventoryChanged); } protected void OnInventoryChanged(Inventory _inventory) { CharacterBody inventoryBody = Utils.GetInventoryBody(_inventory); if (!((Object)(object)inventoryBody == (Object)null) && !((Object)(object)inventoryBody != (Object)(object)character)) { int itemCountEffective = _inventory.GetItemCountEffective(Items.GetItem("LEADERS_PENNON").itemDef); UpdateItemCount(itemCountEffective); } } protected void UpdateItemCount(int _newCount) { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (_newCount == count) { return; } count = _newCount; if (!enableRadiusIndicator) { return; } if ((Object)(object)radiusIndicator != (Object)null) { if (count == 0) { Object.Destroy((Object)(object)((Component)radiusIndicator).gameObject); return; } float targetSize = Utils.CalculateStackingValue(count, baseRadius, radiusStacking); radiusIndicator.SetTargetSize(targetSize); } else { float startingTargetSize = Utils.CalculateStackingValue(count, baseRadius, radiusStacking); radiusIndicator = Utils.CreateRadiusIndicator(character, 0f, startingTargetSize, new Color(0.5803921f, 0.22745098f, 61f / 85f)); } } public void UpdateVisualEffect(bool _active) { //IL_00e8: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Assets.pennonEffectPrefab == (Object)null) { return; } if (_active) { if (!((Object)(object)visualEffect != (Object)null)) { GameObject val = Object.Instantiate(Assets.pennonEffectPrefab, character.corePosition, Quaternion.identity); visualEffect = val.GetComponent(); visualEffect.parentTransform = character.coreTransform; visualEffect.visualState = (VisualState)0; visualEffect.healthComponent = character.healthComponent; visualEffect.radius = character.radius; LocalCameraEffect component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.targetCharacter = ((Component)this).gameObject; } } } else if (!((Object)(object)visualEffect == (Object)null)) { visualEffect.visualState = (VisualState)1; } } } internal class FaithfulLongshotGeodeBehaviour : MonoBehaviour, ICharacterBehaviour { public CharacterBody character; private bool enableRadiusIndicator; private float effectRadius; private QualityValues qualityRadiuses = new QualityValues(); private FaithfulRadiusIndicatorBehaviour radiusIndicator; public FaithfulLongshotGeodeBehaviour() { Utils.RegisterCharacterBehaviour(this); } public void Init(CharacterBody _character) { character = _character; FetchSettings(); Inventory inventory = character.inventory; if ((Object)(object)inventory != (Object)null) { UpdateRadiusIndicator(inventory); } Behaviour.AddOnInventoryChangedCallback(OnInventoryChanged); } public void FetchSettings() { Item item = Items.GetItem("LONGSHOT_GEODE"); enableRadiusIndicator = item.FetchSetting("ENABLE_RADIUS_INDICATOR").Value; effectRadius = item.FetchSetting("DISTANCE").Value; if (Utils.qualityEnabled) { qualityRadiuses.UpdateValues(item.FetchQualitySetting("DISTANCE")); } } private void OnDestroy() { Utils.UnregisterCharacterBehaviour(this); if ((Object)(object)radiusIndicator != (Object)null) { Object.Destroy((Object)(object)((Component)radiusIndicator).gameObject); } Behaviour.RemoveOnInventoryChangedCallback(OnInventoryChanged); } protected void OnInventoryChanged(Inventory _inventory) { if (enableRadiusIndicator) { CharacterBody inventoryBody = Utils.GetInventoryBody(_inventory); if (!((Object)(object)inventoryBody == (Object)null) && !((Object)(object)inventoryBody != (Object)(object)character)) { UpdateRadiusIndicator(_inventory); } } } protected void UpdateRadiusIndicator(Inventory _inventory) { //IL_0155: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_inventory == (Object)null) { return; } Item item = Items.GetItem("LONGSHOT_GEODE"); bool flag = _inventory.GetItemCountEffective(item.itemDef) != 0; float num = effectRadius; if (Utils.qualityEnabled) { QualityCounts itemCountsEffective = QualityCompat.GetItemCountsEffective(_inventory, item); if (itemCountsEffective.LEGENDARY != 0) { num = qualityRadiuses.LEGENDARY; } else if (itemCountsEffective.EPIC != 0) { num = qualityRadiuses.EPIC; } else if (itemCountsEffective.RARE != 0) { num = qualityRadiuses.RARE; } else if (itemCountsEffective.UNCOMMON != 0) { num = qualityRadiuses.UNCOMMON; } } if (!enableRadiusIndicator) { return; } if ((Object)(object)radiusIndicator != (Object)null) { if (!flag) { Object.Destroy((Object)(object)((Component)radiusIndicator).gameObject); } else if (radiusIndicator.targetSize != num) { radiusIndicator.SetTargetSize(num); } } else if (flag) { radiusIndicator = Utils.CreateRadiusIndicator(character, 0f, num, new Color(0.78039217f, 0.14901961f, 43f / 85f)); } } } internal class FaithfulTargetingMatrixBehaviour : NetworkBehaviour, ICharacterBehaviour, IDisplayModelBehaviour { public CharacterBody character; public CharacterBody target; private List targets = new List(); private Dictionary targetOutOfRangeTimers = new Dictionary(); private TemporaryVisualEffect visualEffect; private Vector3 displayPos; private Vector3 displayTargetingMovement = new Vector3(-0.0135f, 0f, 0f); private Vector3 lensMovement = new Vector3(0f, 0.00675f, 0f); private float displayOpen = 0f; private float displaySpeed = 4f; private bool targeting = false; private GameObject m_displayMesh; private GameObject m_display; private GameObject m_clockwiseLens; private GameObject m_antiClockwiseLens; private Transform m_modelTransform; private Vector3 clockwiseLensScale; private Vector3 antiClockwiseLensScale; private Vector3 clockwiseLensPos; private Vector3 antiClockwiseLensPos; private bool enableTargetEffect; private bool targetEffectGlobal; private float maxDistance; private float outOfRangeTime; private string[] blacklisted = new string[1] { "AffixEarthHealerBody" }; private BodyIndex[] blacklistedIndexes; private static int kCmdCmdSyncTarget; private static int kRpcRpcAddSyncTarget; private static int kRpcRpcSyncNoTarget; private bool HasAnyTarget { get { UpdatePrimaryTarget(); return (Object)(object)target != (Object)null; } } private GameObject displayMesh { get { if ((Object)(object)modelTransform == (Object)null) { return null; } if ((Object)(object)m_displayMesh == (Object)null) { m_displayMesh = Utils.FindChildByName(modelTransform, "TargetingMatrixDisplayMesh(Clone)"); } return m_displayMesh; } } private GameObject display { get { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)displayMesh == (Object)null) { return null; } if ((Object)(object)m_display == (Object)null) { m_display = Utils.FindChildByName(displayMesh.transform, "Display"); displayPos = m_display.transform.localPosition; } return m_display; } } private GameObject clockwiseLens { get { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)displayMesh == (Object)null) { return null; } if ((Object)(object)m_clockwiseLens == (Object)null) { m_clockwiseLens = Utils.FindChildByName(displayMesh.transform, "Lens_Clock"); clockwiseLensScale = m_clockwiseLens.transform.localScale; clockwiseLensPos = m_clockwiseLens.transform.localPosition; } return m_clockwiseLens; } } private GameObject antiClockwiseLens { get { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)displayMesh == (Object)null) { return null; } if ((Object)(object)m_antiClockwiseLens == (Object)null) { m_antiClockwiseLens = Utils.FindChildByName(displayMesh.transform, "Lens_Anti"); antiClockwiseLensScale = m_antiClockwiseLens.transform.localScale; antiClockwiseLensPos = m_antiClockwiseLens.transform.localPosition; } return m_antiClockwiseLens; } } private Transform modelTransform { get { if ((Object)(object)m_modelTransform == (Object)null) { CharacterBody obj = character; object obj2; if (obj == null) { obj2 = null; } else { ModelLocator modelLocator = obj.modelLocator; obj2 = ((modelLocator != null) ? modelLocator.modelTransform : null); } m_modelTransform = (Transform)obj2; } return m_modelTransform; } } public string relatedItemToken => "TARGETING_MATRIX"; public FaithfulTargetingMatrixBehaviour() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Utils.RegisterCharacterBehaviour(this); } public void Init(CharacterBody _character) { character = _character; FetchBlacklistedIndexes(); FetchSettings(); if ((Object)(object)modelTransform != (Object)null) { DisplayModelBehaviourRelay displayModelBehaviourRelay = ((Component)modelTransform).gameObject.AddComponent(); displayModelBehaviourRelay.Init(this); } UpdateDisplayObject(); } private void FetchBlacklistedIndexes() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) List list = new List(); string[] array = blacklisted; foreach (string text in array) { list.Add(BodyCatalog.FindBodyIndex(text)); } blacklistedIndexes = list.ToArray(); } public void FetchSettings() { Item item = Items.GetItem("TARGETING_MATRIX"); enableTargetEffect = item.FetchSetting("ENABLE_TARGET_EFFECT").Value; targetEffectGlobal = item.FetchSetting("TARGET_EFFECT_GLOBAL").Value; maxDistance = item.FetchSetting("MAX_DISTANCE").Value; outOfRangeTime = item.FetchSetting("OUT_OF_RANGE_TIME").Value; } private void FixedUpdate() { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (targeting && !HasAnyTarget) { targeting = false; ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(CloseDisplay()); } if (!targeting && HasAnyTarget) { targeting = true; ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(OpenDisplay()); } if (!Utils.hosting || !HasAnyTarget) { return; } bool flag = false; for (int num = targets.Count - 1; num >= 0; num--) { CharacterBody val = targets[num]; if ((Object)(object)val == (Object)null || (Object)(object)val.healthComponent == (Object)null || !val.healthComponent.alive) { RemoveTarget(val, _sync: false); flag = true; } else { Vector3 corePosition = val.corePosition; if (Vector3.Distance(corePosition, character.corePosition) > maxDistance) { targetOutOfRangeTimers[val] = (targetOutOfRangeTimers.TryGetValue(val, out var value) ? (value + Time.fixedDeltaTime) : Time.fixedDeltaTime); } else { targetOutOfRangeTimers[val] = 0f; } if (targetOutOfRangeTimers.TryGetValue(val, out var value2) && value2 > outOfRangeTime) { RemoveTarget(val, _sync: false); flag = true; } } } if (flag) { CallCmdSyncTarget(); SearchForTarget(); } } private void UpdateDisplayObject() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)display == (Object)null)) { display.transform.localPosition = displayPos + displayTargetingMovement * (1f - displayOpen); clockwiseLens.transform.localPosition = clockwiseLensPos + lensMovement * (1f - displayOpen); antiClockwiseLens.transform.localPosition = antiClockwiseLensPos + lensMovement * (1f - displayOpen); clockwiseLens.transform.localScale = clockwiseLensScale * displayOpen; antiClockwiseLens.transform.localScale = antiClockwiseLensScale * displayOpen; } } private IEnumerator OpenDisplay() { while (displayOpen < 1f) { displayOpen = Mathf.Clamp01(displayOpen + Time.deltaTime * displaySpeed); UpdateDisplayObject(); yield return null; } } private IEnumerator CloseDisplay() { while (displayOpen > 0f) { displayOpen = Mathf.Clamp01(displayOpen - Time.deltaTime * displaySpeed); UpdateDisplayObject(); yield return null; } } private void OnDestroy() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Utils.UnregisterCharacterBehaviour(this); RemoveTarget(_sync: false); if ((Object)(object)visualEffect != (Object)null) { visualEffect.visualState = (VisualState)1; } } public void OnKill(CharacterBody _killed) { if (HasTarget(_killed)) { RemoveTarget(_killed); } ((MonoBehaviour)this).Invoke("SearchForTargetForKill", 0.1f); } private void SearchForTarget() { SearchForTarget(int.MaxValue); } private void SearchForTargetForKill() { if (!((Object)(object)character == (Object)null) && !((Object)(object)character.inventory == (Object)null)) { int maxTargetsToAdd = ((Faithful.targetingMatrix != null) ? Faithful.targetingMatrix.GetTargetsPerKill(character.inventory) : 0); SearchForTarget(maxTargetsToAdd); } } private void SearchForTarget(int _maxTargetsToAdd) { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) if (!Utils.hosting || (Object)(object)character == (Object)null || (Object)(object)character.inventory == (Object)null) { return; } int num = ((Faithful.targetingMatrix != null) ? Faithful.targetingMatrix.GetTargetCapacity(character.inventory) : 0); if (num <= 0) { RemoveTarget(); return; } if (TrimTargetsToCapacity(num)) { CallCmdSyncTarget(); } if (targets.Count >= num || _maxTargetsToAdd <= 0) { return; } int num2 = ((_maxTargetsToAdd == int.MaxValue) ? num : Mathf.Min(num, targets.Count + _maxTargetsToAdd)); ReadOnlyCollection readOnlyInstancesList = CharacterBody.readOnlyInstancesList; if (readOnlyInstancesList == null) { return; } List list = new List(); Vector3 corePosition = character.corePosition; foreach (CharacterBody item in readOnlyInstancesList) { if (!HasTarget(item) && item.teamComponent.teamIndex != character.teamComponent.teamIndex && !((Object)(object)item.master == (Object)null) && !((Object)(object)item.healthComponent == (Object)null) && item.healthComponent.alive) { float num3 = Vector3.Distance(corePosition, item.corePosition); if (!(num3 > maxDistance) && !blacklistedIndexes.Contains(item.bodyIndex)) { list.Add(item); } } } bool flag = false; while (list.Count > 0 && targets.Count < num2) { CharacterBody val = list[Random.Range(0, list.Count)]; list.Remove(val); FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = Utils.FindCharacterBodyHelper(val); if (!((Object)(object)faithfulCharacterBodyBehaviour == (Object)null)) { FaithfulTargetingMatrixBehaviour targetingMatrix = faithfulCharacterBodyBehaviour.targetingMatrix; if (!((Object)(object)targetingMatrix == (Object)null)) { AddTarget(val, targetingMatrix); flag = true; } } } if (flag) { CallCmdSyncTarget(); } } public void RemoveTarget(bool _sync = true) { if (!HasAnyTarget) { return; } List list = targets.ToList(); foreach (CharacterBody item in list) { RemoveTarget(item, _sync: false); } targets.Clear(); targetOutOfRangeTimers.Clear(); target = null; if (_sync && Utils.hosting) { CallCmdSyncTarget(); } } public bool RemoveTarget(CharacterBody _target, bool _sync = true) { if ((Object)(object)_target == (Object)null) { bool result = targets.RemoveAll((CharacterBody targetBody) => (Object)(object)targetBody == (Object)null) > 0; UpdatePrimaryTarget(); return result; } if (!targets.Contains(_target)) { return false; } FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = Utils.FindCharacterBodyHelper(_target); (((Object)(object)faithfulCharacterBodyBehaviour == (Object)null) ? null : faithfulCharacterBodyBehaviour.targetingMatrix)?.SetNotTargeted(); targets.Remove(_target); targetOutOfRangeTimers.Remove(_target); UpdatePrimaryTarget(); if (_sync && Utils.hosting) { CallCmdSyncTarget(); } return true; } public void RefreshTargetCapacity() { if (Utils.hosting && !((Object)(object)character == (Object)null) && !((Object)(object)character.inventory == (Object)null)) { int num = ((Faithful.targetingMatrix != null) ? Faithful.targetingMatrix.GetTargetCapacity(character.inventory) : 0); if (num <= 0) { RemoveTarget(); } else if (TrimTargetsToCapacity(num)) { CallCmdSyncTarget(); } } } public bool HasTarget(CharacterBody _target) { if ((Object)(object)_target == (Object)null) { return false; } return targets.Contains(_target); } private void AddTarget(CharacterBody _target, FaithfulTargetingMatrixBehaviour _targetTargetingMatrixBehaviour) { if (!((Object)(object)_target == (Object)null) && !HasTarget(_target)) { targets.Add(_target); targetOutOfRangeTimers[_target] = 0f; UpdatePrimaryTarget(); _targetTargetingMatrixBehaviour?.SetTargeted(character); } } private void UpdatePrimaryTarget() { targets.RemoveAll((CharacterBody targetBody) => (Object)(object)targetBody == (Object)null); target = ((targets.Count > 0) ? targets[0] : null); } private bool TrimTargetsToCapacity(int _targetCapacity) { bool result = false; while (targets.Count > _targetCapacity) { RemoveTarget(targets[targets.Count - 1], _sync: false); result = true; } return result; } public void SetTargeted(CharacterBody _targeter) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Utils.localPlayerBody != (Object)(object)_targeter) && !((Object)(object)visualEffect != (Object)null) && enableTargetEffect) { GameObject val = Object.Instantiate(targetEffectGlobal ? Assets.matrixEffectPrefab : Assets.matrixEffectLocalPrefab, character.corePosition, Quaternion.identity); visualEffect = val.GetComponent(); visualEffect.parentTransform = character.coreTransform; visualEffect.visualState = (VisualState)0; visualEffect.healthComponent = character.healthComponent; visualEffect.radius = character.radius; LocalCameraEffect component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.targetCharacter = ((Component)this).gameObject; } } } public void SetNotTargeted() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)visualEffect == (Object)null)) { visualEffect.visualState = (VisualState)1; } } [Command] public void CmdSyncTarget() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) CallRpcSyncNoTarget(); foreach (CharacterBody target in targets) { if (!((Object)(object)target == (Object)null)) { NetworkIdentity component = ((Component)target).GetComponent(); if (!((Object)(object)component == (Object)null)) { CallRpcAddSyncTarget(component.netId); } } } } [ClientRpc] private void RpcAddSyncTarget(NetworkInstanceId _targetNetID) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (Utils.hosting) { return; } GameObject obj = ClientScene.FindLocalObject(_targetNetID); CharacterBody val = ((obj != null) ? obj.GetComponent() : null); if ((Object)(object)val == (Object)null) { Log.Warning($"[TARGETING MATRIX] | Could not find target body with net ID {_targetNetID} - Sync unsuccessful."); return; } FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = Utils.FindCharacterBodyHelper(val); if (!((Object)(object)faithfulCharacterBodyBehaviour == (Object)null)) { FaithfulTargetingMatrixBehaviour targetingMatrix = faithfulCharacterBodyBehaviour.targetingMatrix; if (!((Object)(object)targetingMatrix == (Object)null)) { AddTarget(val, targetingMatrix); } } } [ClientRpc] private void RpcSyncNoTarget() { if (!Utils.hosting) { RemoveTarget(_sync: false); } } public void OnDisplayModelCreated() { UpdateDisplayObject(); } private void UNetVersion() { } protected static void InvokeCmdCmdSyncTarget(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkServer.active) { Debug.LogError((object)"Command CmdSyncTarget called on client."); } else { ((FaithfulTargetingMatrixBehaviour)(object)obj).CmdSyncTarget(); } } public void CallCmdSyncTarget() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"Command function CmdSyncTarget called on server."); return; } if (((NetworkBehaviour)this).isServer) { CmdSyncTarget(); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)5); val.WritePackedUInt32((uint)kCmdCmdSyncTarget); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdSyncTarget"); } protected static void InvokeRpcRpcAddSyncTarget(NetworkBehaviour obj, NetworkReader reader) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcAddSyncTarget called on server."); } else { ((FaithfulTargetingMatrixBehaviour)(object)obj).RpcAddSyncTarget(reader.ReadNetworkId()); } } protected static void InvokeRpcRpcSyncNoTarget(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcSyncNoTarget called on server."); } else { ((FaithfulTargetingMatrixBehaviour)(object)obj).RpcSyncNoTarget(); } } public void CallRpcAddSyncTarget(NetworkInstanceId _targetNetID) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: 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) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcAddSyncTarget called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcAddSyncTarget); val.Write(((Component)this).GetComponent().netId); val.Write(_targetNetID); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcAddSyncTarget"); } public void CallRpcSyncNoTarget() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcSyncNoTarget called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcSyncNoTarget); val.Write(((Component)this).GetComponent().netId); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSyncNoTarget"); } static FaithfulTargetingMatrixBehaviour() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown kCmdCmdSyncTarget = -1894886286; NetworkBehaviour.RegisterCommandDelegate(typeof(FaithfulTargetingMatrixBehaviour), kCmdCmdSyncTarget, new CmdDelegate(InvokeCmdCmdSyncTarget)); kRpcRpcAddSyncTarget = 748765521; NetworkBehaviour.RegisterRpcDelegate(typeof(FaithfulTargetingMatrixBehaviour), kRpcRpcAddSyncTarget, new CmdDelegate(InvokeRpcRpcAddSyncTarget)); kRpcRpcSyncNoTarget = 1267996713; NetworkBehaviour.RegisterRpcDelegate(typeof(FaithfulTargetingMatrixBehaviour), kRpcRpcSyncNoTarget, new CmdDelegate(InvokeRpcRpcSyncNoTarget)); NetworkCRC.RegisterBehaviour("FaithfulTargetingMatrixBehaviour", 0); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } } internal class FaithfulTJetpackBehaviour : NetworkBehaviour, ICharacterBehaviour { public CharacterBody character; protected Buff emptyFuelBuff; protected Buff lowFuelBuff; protected Buff highFuelBuff; protected int currentFuelBuffPerc; protected bool active = false; protected int itemCount = 0; protected int buffedItemCount = 5; protected float baseMaxVelocity = 42f; protected float baseRisingAcceleration = 36f; protected float fallingAcceleration = 320f; protected float baseFuel = 4f; protected float fuelPerStack = 2f; protected float baseRefuelDuration = 12f; protected float refuelDurationReductionPerStack = 0.2f; protected float maxVelocityMultiplier = 1f; protected float accelerationMultiplier = 1f; protected float maxVelocityBuff = 10f; protected float risingAccelerationBuff = 8f; protected bool grounded = false; protected bool jetActivated = false; protected bool firstJet = true; protected bool refueling = false; protected float fuelUsed = 0f; protected float lastJetTime; protected bool hasDisplay = false; protected bool ignoreFallDamage = false; protected GameObject jetpack; protected GameObject additionalBoosters; protected GameObject dial; protected GameObject jetMiddle; protected GameObject jetLeft; protected GameObject jetRight; protected GameObject jetsOn; protected GameObject jetsOff; protected bool initialised = false; protected static readonly float igniteRange; protected static readonly float igniteAngle; protected static readonly float baseIgniteDuration; protected static readonly float directDamageFraction; protected static readonly float burnDamageFraction; protected static readonly float igniteDurationIncreaseFraction; protected bool hasDoneInitialIgnite = false; protected float igniteStopwatch = 0f; protected readonly HashSet igniteVictims = new HashSet(); private static int kCmdCmdSyncJetpack; private static int kRpcRpcSyncJetpack; protected float fuelCapacity => Utils.CalculateStackingValue(itemCount, baseFuel, fuelPerStack); protected float fuelRemaining => fuelCapacity - fuelUsed; protected float fuelRemainingPerc => 1f - fuelUsed / fuelCapacity; protected float refuelDuration => baseRefuelDuration * Mathf.Max(0.1f, 1f - Mathf.Log((float)itemCount, Mathf.Pow(2f, 1f / refuelDurationReductionPerStack))); protected float refuelRate => fuelCapacity / refuelDuration; protected float timeSinceLastJet => Time.time - lastJetTime; protected float dynamicAccelerationDifference => fallingAcceleration - risingAcceleration; protected bool canBeActivated => character.characterMotor.velocity.y < 0f && fuelRemaining > 0f; protected float buffPerc { get { int num = itemCount - 1; int num2 = buffedItemCount - 1; return Mathf.Min((float)num / (float)num2, 1f); } } protected float maxVelocity => (baseMaxVelocity + maxVelocityBuff * buffPerc) * jumpPowerModifier * maxVelocityMultiplier; protected float risingAcceleration => baseRisingAcceleration + risingAccelerationBuff * buffPerc; protected float jumpPowerModifier => Mathf.Sqrt(character.jumpPower / character.baseJumpPower); public FaithfulTJetpackBehaviour() { Utils.RegisterCharacterBehaviour(this); } public void AssignCharacter(CharacterBody _character) { character = _character; } protected void Init(CharacterBody _characterBody) { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown //IL_0454: Unknown result type (might be due to invalid IL or missing references) if (initialised && ((Object)(object)jetpack != (Object)null || !hasDisplay)) { return; } initialised = true; FetchSettings(); emptyFuelBuff = Buffs.GetBuff("4T0N_JETPACK_EMPTY"); lowFuelBuff = Buffs.GetBuff("4T0N_JETPACK_LOW"); highFuelBuff = Buffs.GetBuff("4T0N_JETPACK_HIGH"); Transform modelTransform = _characterBody.modelLocator.modelTransform; jetpack = Utils.FindChildByName(modelTransform, "4T0NJetpackDisplayMesh(Clone)"); if ((Object)(object)jetpack == (Object)null) { hasDisplay = false; additionalBoosters = null; dial = null; jetMiddle = null; jetLeft = null; jetRight = null; jetsOff = null; jetsOn = new GameObject("JetsOn"); jetsOn.transform.SetParent(modelTransform, false); GameObject val = Object.Instantiate(Assets.mageJetAkEventsPrefab); val.transform.SetParent(jetsOn.transform, false); val.SetActive(true); return; } hasDisplay = true; additionalBoosters = Utils.FindChildByName(jetpack.transform, "Pack"); dial = Utils.FindChildByName(jetpack.transform, "Dial"); jetMiddle = Utils.FindChildByName(jetpack.transform, "Jet_Middle"); jetLeft = Utils.FindChildByName(jetpack.transform, "Jet_Left"); jetRight = Utils.FindChildByName(jetpack.transform, "Jet_Right"); ((Component)jetpack.GetComponent().Find("4-T0N_Jetpack_Jetflare_Display")).gameObject.AddComponent(); jetsOn = ((Component)jetpack.GetComponent().Find("Jets_On")).gameObject; jetsOff = ((Component)jetpack.GetComponent().Find("Jets_Off")).gameObject; jetsOn.SetActive(false); GameObject val2 = Object.Instantiate(Assets.mageJetAkEventsPrefab); val2.transform.SetParent(jetsOn.transform, false); val2.SetActive(true); FlickerLight val3 = ((Component)jetsOn.GetComponent().Find("Point_Light_Middle")).gameObject.AddComponent(); FlickerLight val4 = ((Component)jetsOn.GetComponent().Find("Point_Light_Left")).gameObject.AddComponent(); FlickerLight val5 = ((Component)jetsOn.GetComponent().Find("Point_Light_Right")).gameObject.AddComponent(); val3.light = ((Component)jetsOn.GetComponent().Find("Point_Light_Middle")).GetComponent(); val3.sinWaves = Assets.mageJetWaves; val4.light = ((Component)jetsOn.GetComponent().Find("Point_Light_Left")).GetComponent(); val4.sinWaves = Assets.mageJetWaves; val5.light = ((Component)jetsOn.GetComponent().Find("Point_Light_Right")).GetComponent(); val5.sinWaves = Assets.mageJetWaves; FlickerLight val6 = ((Component)jetsOff.GetComponent().Find("Point_Light_Middle")).gameObject.AddComponent(); FlickerLight val7 = ((Component)jetsOff.GetComponent().Find("Point_Light_Left")).gameObject.AddComponent(); FlickerLight val8 = ((Component)jetsOff.GetComponent().Find("Point_Light_Right")).gameObject.AddComponent(); val6.light = ((Component)jetsOff.GetComponent().Find("Point_Light_Middle")).GetComponent(); val6.sinWaves = Assets.mageJetWaves; val7.light = ((Component)jetsOff.GetComponent().Find("Point_Light_Left")).GetComponent(); val7.sinWaves = Assets.mageJetWaves; val8.light = ((Component)jetsOff.GetComponent().Find("Point_Light_Right")).GetComponent(); val8.sinWaves = Assets.mageJetWaves; if (((Object)modelTransform).name == "mdlMage" || ((Object)modelTransform).name == "mdlSeeker") { additionalBoosters.transform.localScale = Vector3.zero; } } private void OnDestroy() { Utils.UnregisterCharacterBehaviour(this); } public void FetchSettings() { Item item = Items.GetItem("4T0N_JETPACK"); ignoreFallDamage = item.FetchSetting("DISABLE_FALL_DAMAGE").Value; baseFuel = item.FetchSetting("FUEL_TIME").Value; fuelPerStack = item.FetchSetting("FUEL_TIME_STACKING").Value; baseRefuelDuration = item.FetchSetting("RECHARGE_TIME").Value; refuelDurationReductionPerStack = item.FetchSetting("RECHARGE_TIME_REDUCTION").Value / 100f; maxVelocityMultiplier = item.FetchSetting("MAX_VELOCITY_MULTIPLIER").Value; accelerationMultiplier = item.FetchSetting("ACCELERATION_MULTIPLIER").Value; } public void UpdateItemCount(int _itemCount) { itemCount = _itemCount; if (!active && itemCount > 0) { Activate(); } else if (active && itemCount == 0) { Deactivate(); } } protected void Activate() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown if (!active && !((Object)(object)character == (Object)null)) { active = true; grounded = false; jetActivated = false; firstJet = true; refueling = false; fuelUsed = 0f; GenericCharacterMain.ProcessJump += new hook_ProcessJump(OnProcessJump); GenericCharacterMain.FixedUpdate += new hook_FixedUpdate(OnFixedUpdate); JetpackOn.FixedUpdate += new hook_FixedUpdate(OnArtificerJetpackFixedUpdate); MageCharacterMain.ProcessJump += new hook_ProcessJump(OnArtificerProcessJump); GlobalEventManager.IsImmuneToFallDamage += new hook_IsImmuneToFallDamage(OnIsImmuneToFallDamage); } } protected void Deactivate() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown if (active) { active = false; GenericCharacterMain.ProcessJump -= new hook_ProcessJump(OnProcessJump); GenericCharacterMain.FixedUpdate -= new hook_FixedUpdate(OnFixedUpdate); JetpackOn.FixedUpdate -= new hook_FixedUpdate(OnArtificerJetpackFixedUpdate); MageCharacterMain.ProcessJump -= new hook_ProcessJump(OnArtificerProcessJump); } } protected void OnFixedUpdate(orig_FixedUpdate orig, GenericCharacterMain self) { if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character) { orig.Invoke(self); return; } Init(((EntityState)self).characterBody); UpdateVisuals(); UpdateDisplayBuff(); UpdateIgnite(); SyncJetpack(); orig.Invoke(self); } protected void OnArtificerProcessJump(orig_ProcessJump orig, MageCharacterMain self) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character) { orig.Invoke(self); return; } bool flag = ((object)self.jetpackStateMachine.state).GetType() == typeof(JetpackOn); if (((BaseCharacterMain)self).hasCharacterMotor && ((BaseCharacterMain)self).hasInputBank && ((EntityState)self).isAuthority && (jetActivated || (character.inputBank.jump.down && canBeActivated))) { JetpackBehaviour((GenericCharacterMain)(object)self); if (flag && !jetActivated) { self.jetpackStateMachine.SetNextState((EntityState)new Idle()); } else if (!flag && jetActivated) { self.jetpackStateMachine.SetNextState((EntityState)new JetpackOn()); } } else { orig.Invoke(self); } } protected void OnProcessJump(orig_ProcessJump orig, GenericCharacterMain self) { if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character || !((BaseCharacterMain)self).hasCharacterMotor || !((BaseCharacterMain)self).hasInputBank || !((EntityState)self).isAuthority) { orig.Invoke(self); return; } JetpackBehaviour(self); if (!jetActivated && (!character.inputBank.jump.down || !canBeActivated)) { orig.Invoke(self); } } private bool OnIsImmuneToFallDamage(orig_IsImmuneToFallDamage orig, GlobalEventManager self, CharacterBody body) { if ((Object)(object)self == (Object)null || (Object)(object)body != (Object)(object)character || !ignoreFallDamage) { return orig.Invoke(self, body); } if (jetActivated) { return true; } return orig.Invoke(self, body); } protected void JetpackBehaviour(GenericCharacterMain self) { if (Time.timeScale == 0f) { lastJetTime += Time.fixedDeltaTime; return; } if (((BaseState)self).isGrounded) { Grounded(); } else { MidAir(); } Refuel(); } protected void UpdateVisuals() { //IL_0030: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (hasDisplay) { dial.transform.localEulerAngles = new Vector3(0f, 0f, 360f * fuelRemainingPerc); Vector3 localScale = (jetActivated ? new Vector3(1f, 3.5f, 1f) : new Vector3(1f, 1f, 1f)); jetMiddle.transform.localScale = localScale; jetLeft.transform.localScale = localScale; jetRight.transform.localScale = localScale; jetsOn.SetActive(jetActivated); jetsOff.SetActive(!jetActivated); } else { jetsOn.SetActive(jetActivated); } } protected void UpdateDisplayBuff() { //IL_0057: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) if (!Utils.hosting) { return; } int num = Mathf.CeilToInt(fuelRemainingPerc * 100f); if (num != currentFuelBuffPerc) { currentFuelBuffPerc = num; if (num == 0) { character.AddBuff(emptyFuelBuff.buffDef.buffIndex); character.SetBuffCount(lowFuelBuff.buffDef.buffIndex, 0); character.SetBuffCount(highFuelBuff.buffDef.buffIndex, 0); } else if (num < 26) { character.RemoveBuff(emptyFuelBuff.buffDef.buffIndex); character.SetBuffCount(lowFuelBuff.buffDef.buffIndex, num); character.SetBuffCount(highFuelBuff.buffDef.buffIndex, 0); } else { character.RemoveBuff(emptyFuelBuff.buffDef.buffIndex); character.SetBuffCount(lowFuelBuff.buffDef.buffIndex, 0); character.SetBuffCount(highFuelBuff.buffDef.buffIndex, num); } } } protected void OnArtificerJetpackFixedUpdate(orig_FixedUpdate orig, JetpackOn self) { if (self == null || (Object)(object)((EntityState)self).characterBody != (Object)(object)character) { orig.Invoke(self); } else if (!jetActivated) { orig.Invoke(self); } } protected void Grounded() { if (!grounded) { DeactivateJet(); grounded = true; } } protected void MidAir() { grounded = false; if (jetActivated) { JettingMidAir(); } else if (character.inputBank.jump.down && canBeActivated) { ActivateJet(); Jet(); } } protected void Refuel() { if (jetActivated || !grounded) { refueling = false; } else if (fuelUsed != 0f) { if (refueling) { fuelUsed = Mathf.Max(fuelUsed - refuelRate * Time.fixedDeltaTime, 0f); } else { refueling = true; } } } protected void JettingMidAir() { if (!character.inputBank.jump.down || fuelRemaining == 0f || character.characterMotor.velocity.y > maxVelocity) { DeactivateJet(); } else { Jet(); } } protected void ActivateJet() { if (!jetActivated) { jetActivated = true; firstJet = true; } } protected void DeactivateJet() { if (jetActivated) { jetActivated = false; } } protected void Jet() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) float y = character.characterMotor.velocity.y; float num = (risingAcceleration + Mathf.Clamp01((0f - y + maxVelocity * 0.3f) / 80f) * dynamicAccelerationDifference) * jumpPowerModifier * accelerationMultiplier; character.characterMotor.velocity = new Vector3(character.characterMotor.velocity.x, Mathf.MoveTowards(y, maxVelocity, num * Time.fixedDeltaTime), character.characterMotor.velocity.z); if (firstJet) { firstJet = false; } else { ReduceFuel(); } lastJetTime = Time.time; } protected void ReduceFuel() { fuelUsed = Mathf.Min(fuelUsed + timeSinceLastJet, fuelCapacity); } protected void SyncJetpack() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)character == (Object)(object)Utils.localPlayerBody && (Object)(object)Utils.netUtils != (Object)null) { Utils.netUtils.SyncJetpack(((Component)this).GetComponent().netId, new JetpackSyncData(fuelUsed, jetActivated)); } } [Command] public void CmdSyncJetpack(JetpackSyncData _data) { CallRpcSyncJetpack(_data); } [ClientRpc] private void RpcSyncJetpack(JetpackSyncData _data) { if (!((Object)(object)character == (Object)(object)Utils.localPlayerBody)) { fuelUsed = _data.fuelUsed; jetActivated = _data.jetActivated; } } protected void UpdateIgnite() { if (!Utils.hosting || itemCount <= 0 || (Object)(object)character == (Object)null || (Object)(object)character.inventory == (Object)null || (Object)(object)character.healthComponent == (Object)null || !character.healthComponent.alive) { igniteStopwatch = 0f; hasDoneInitialIgnite = false; return; } if (!Utils.qualityEnabled) { igniteStopwatch = 0f; hasDoneInitialIgnite = false; return; } if (Faithful.tJetpack == null || !Faithful.tJetpack.MainItem.supportsQuality) { igniteStopwatch = 0f; hasDoneInitialIgnite = false; return; } QualityCounts itemCountsEffective = QualityCompat.GetItemCountsEffective(character.inventory, Faithful.tJetpack.MainItem); if (itemCountsEffective.Total <= 0) { igniteStopwatch = 0f; hasDoneInitialIgnite = false; return; } float num = CalculateIgniteFrequency(itemCountsEffective); if (num <= 0f) { igniteStopwatch = 0f; hasDoneInitialIgnite = false; return; } float num2 = 1f / num; if (!jetActivated) { igniteStopwatch = Mathf.Min(igniteStopwatch, num2 * 0.95f); return; } if (!hasDoneInitialIgnite) { IgniteEnemiesBelow(CalculateIgniteDamage(itemCountsEffective)); hasDoneInitialIgnite = true; igniteStopwatch = 0f; return; } igniteStopwatch += Time.fixedDeltaTime; while (igniteStopwatch >= num2) { igniteStopwatch -= num2; IgniteEnemiesBelow(CalculateIgniteDamage(itemCountsEffective)); } } protected float CalculateIgniteDamage(QualityCounts _qualityCounts) { TJetpack tJetpack = Faithful.tJetpack; if (tJetpack == null) { return 0f; } return Utils.CalculateStackingValue(_qualityCounts.UNCOMMON, tJetpack.DamageQualityValues.UNCOMMON, tJetpack.DamageStackingQualityValues.UNCOMMON) + Utils.CalculateStackingValue(_qualityCounts.RARE, tJetpack.DamageQualityValues.RARE, tJetpack.DamageStackingQualityValues.RARE) + Utils.CalculateStackingValue(_qualityCounts.EPIC, tJetpack.DamageQualityValues.EPIC, tJetpack.DamageStackingQualityValues.EPIC) + Utils.CalculateStackingValue(_qualityCounts.LEGENDARY, tJetpack.DamageQualityValues.LEGENDARY, tJetpack.DamageStackingQualityValues.LEGENDARY); } protected float CalculateIgniteFrequency(QualityCounts _qualityCounts) { TJetpack tJetpack = Faithful.tJetpack; if (tJetpack == null) { return 0f; } float num = CalculateIgniteFrequencyForQuality(_qualityCounts.UNCOMMON, tJetpack.FrequencyQualityValues.UNCOMMON, tJetpack.FrequencyStackingQualityValues.UNCOMMON, tJetpack.FrequencyMaxQualityValues.UNCOMMON); float num2 = CalculateIgniteFrequencyForQuality(_qualityCounts.RARE, tJetpack.FrequencyQualityValues.RARE, tJetpack.FrequencyStackingQualityValues.RARE, tJetpack.FrequencyMaxQualityValues.RARE); float num3 = CalculateIgniteFrequencyForQuality(_qualityCounts.EPIC, tJetpack.FrequencyQualityValues.EPIC, tJetpack.FrequencyStackingQualityValues.EPIC, tJetpack.FrequencyMaxQualityValues.EPIC); float num4 = CalculateIgniteFrequencyForQuality(_qualityCounts.LEGENDARY, tJetpack.FrequencyQualityValues.LEGENDARY, tJetpack.FrequencyStackingQualityValues.LEGENDARY, tJetpack.FrequencyMaxQualityValues.LEGENDARY); return Mathf.Max(new float[4] { num, num2, num3, num4 }); } protected float CalculateIgniteFrequencyForQuality(int _count, float _baseFrequency, float _stackingFrequency, int _maxFrequency) { float num = Utils.CalculateStackingValue(_count, _baseFrequency, _stackingFrequency); return Mathf.Min(num, (float)_maxFrequency); } protected void IgniteEnemiesBelow(float _damageCoefficient) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if (_damageCoefficient <= 0f || (Object)(object)character.teamComponent == (Object)null) { return; } Vector3 corePosition = character.corePosition; BullseyeSearch val = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(character.teamComponent.teamIndex), filterByLoS = false, searchOrigin = corePosition, searchDirection = Vector3.down, sortMode = (SortMode)1, maxDistanceFilter = igniteRange, maxAngleFilter = igniteAngle }; val.RefreshCandidates(); val.FilterOutGameObject(((Component)character).gameObject); igniteVictims.Clear(); foreach (HurtBox result in val.GetResults()) { if (!((Object)(object)result == (Object)null) && !((Object)(object)result.healthComponent == (Object)null)) { HealthComponent healthComponent = result.healthComponent; CharacterBody body = healthComponent.body; if (!((Object)(object)body == (Object)null) && !((Object)(object)body == (Object)(object)character) && healthComponent.alive && !(body.corePosition.y >= corePosition.y) && igniteVictims.Add(healthComponent)) { float damageCoefficient = _damageCoefficient * directDamageFraction; float burnDamageCoefficient = _damageCoefficient * burnDamageFraction; HitEnemyWithJetpackFlame(result, body, damageCoefficient); ApplyJetpackBurn(body, burnDamageCoefficient); } } } } protected void HitEnemyWithJetpackFlame(HurtBox _hurtBox, CharacterBody _victimBody, float _damageCoefficient) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown if (Utils.hosting && !((Object)(object)_hurtBox == (Object)null) && !((Object)(object)_victimBody == (Object)null) && !((Object)(object)_victimBody.healthComponent == (Object)null) && !(_damageCoefficient <= 0f)) { DamageInfo val = new DamageInfo { attacker = ((Component)character).gameObject, inflictor = ((Component)this).gameObject, damage = character.damage * _damageCoefficient, damageColorIndex = (DamageColorIndex)3, damageType = DamageTypeCombo.op_Implicit((DamageType)0), crit = character.RollCrit(), force = Vector3.zero, position = ((Component)_hurtBox).transform.position, procCoefficient = 1f }; _victimBody.healthComponent.TakeDamage(val); GlobalEventManager.instance.OnHitEnemy(val, ((Component)_victimBody).gameObject); GlobalEventManager.instance.OnHitAll(val, ((Component)_victimBody).gameObject); } } protected void ApplyJetpackBurn(CharacterBody _victimBody, float _burnDamageCoefficient) { //IL_007b: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) if (!Utils.hosting || (Object)(object)_victimBody == (Object)null || (Object)(object)_victimBody.healthComponent == (Object)null || _burnDamageCoefficient <= 0f || (Object)(object)character == (Object)null || (Object)(object)character.inventory == (Object)null) { return; } DotIndex val = (DotIndex)1; DotDef val2 = DotController.dotDefs[val]; float num = character.damage * _burnDamageCoefficient; float num2 = baseIgniteDuration; if (_burnDamageCoefficient > 1f) { num2 *= 1f + (_burnDamageCoefficient - 1f) * igniteDurationIncreaseFraction; } float num3 = Mathf.Min(val2.damageCoefficient * character.damage, _victimBody.healthComponent.fullCombinedHealth * 0.01f); if (!(num3 <= 0f)) { float num4 = num2 / val2.interval; if (!(num4 <= 0f)) { float damageMultiplier = num / (num3 * num4); InflictDotInfo val3 = new InflictDotInfo { attackerObject = ((Component)character).gameObject, victimObject = ((Component)_victimBody).gameObject, dotIndex = val, duration = num2, damageMultiplier = damageMultiplier, hitHurtBox = _victimBody.mainHurtBox }; StrengthenBurnUtils.CheckDotForUpgrade(character.inventory, ref val3); DotController.InflictDot(ref val3); } } } static FaithfulTJetpackBehaviour() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown igniteRange = 14f; igniteAngle = 45f; baseIgniteDuration = 4f; directDamageFraction = 0.5f; burnDamageFraction = 0.5f; igniteDurationIncreaseFraction = 0.25f; kCmdCmdSyncJetpack = -1222377709; NetworkBehaviour.RegisterCommandDelegate(typeof(FaithfulTJetpackBehaviour), kCmdCmdSyncJetpack, new CmdDelegate(InvokeCmdCmdSyncJetpack)); kRpcRpcSyncJetpack = 1274165629; NetworkBehaviour.RegisterRpcDelegate(typeof(FaithfulTJetpackBehaviour), kRpcRpcSyncJetpack, new CmdDelegate(InvokeRpcRpcSyncJetpack)); NetworkCRC.RegisterBehaviour("FaithfulTJetpackBehaviour", 0); } private void UNetVersion() { } protected static void InvokeCmdCmdSyncJetpack(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkServer.active) { Debug.LogError((object)"Command CmdSyncJetpack called on client."); } else { ((FaithfulTJetpackBehaviour)(object)obj).CmdSyncJetpack(GeneratedNetworkCode._ReadJetpackSyncData_None(reader)); } } public void CallCmdSyncJetpack(JetpackSyncData _data) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!NetworkClient.active) { Debug.LogError((object)"Command function CmdSyncJetpack called on server."); return; } if (((NetworkBehaviour)this).isServer) { CmdSyncJetpack(_data); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)5); val.WritePackedUInt32((uint)kCmdCmdSyncJetpack); val.Write(((Component)this).GetComponent().netId); GeneratedNetworkCode._WriteJetpackSyncData_None(val, _data); ((NetworkBehaviour)this).SendCommandInternal(val, 0, "CmdSyncJetpack"); } protected static void InvokeRpcRpcSyncJetpack(NetworkBehaviour obj, NetworkReader reader) { if (!NetworkClient.active) { Debug.LogError((object)"RPC RpcSyncJetpack called on server."); } else { ((FaithfulTJetpackBehaviour)(object)obj).RpcSyncJetpack(GeneratedNetworkCode._ReadJetpackSyncData_None(reader)); } } public void CallRpcSyncJetpack(JetpackSyncData _data) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogError((object)"RPC Function RpcSyncJetpack called on client."); return; } NetworkWriter val = new NetworkWriter(); val.Write((short)0); val.Write((short)2); val.WritePackedUInt32((uint)kRpcRpcSyncJetpack); val.Write(((Component)this).GetComponent().netId); GeneratedNetworkCode._WriteJetpackSyncData_None(val, _data); ((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSyncJetpack"); } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { bool result = default(bool); return result; } public override void OnDeserialize(NetworkReader reader, bool initialState) { } } internal class TJetpackJetFlare : MonoBehaviour { private Renderer renderer; private void Awake() { renderer = ((Component)this).GetComponent(); renderer.material = Assets.mageJetMaterial; } private void FixedUpdate() { if (!((Object)renderer.material).name.Contains("mage")) { renderer.material = Assets.mageJetMaterial; } } } internal struct JetpackSyncData { public float fuelUsed; public bool jetActivated; public JetpackSyncData(float _fuelUsed, bool _jetActivated) { fuelUsed = _fuelUsed; jetActivated = _jetActivated; } } internal class Buff { public Setting hiddenSetting; public Setting enableOverlaySetting; public bool qualityBuff = false; public BuffDef buffDef; public Overlays.Overlay overlay; public string token; public string langTokenOverride; public string name; public string safeName; public bool overlayEnabled => enableOverlaySetting != null && enableOverlaySetting.Value && overlay != null; public string sourceToken => string.IsNullOrEmpty(langTokenOverride) ? token : langTokenOverride; public Buff(string _token, string _safeName, string _iconName, Color _colour, bool _canStack = true, bool _isDebuff = false, bool _isHidden = false, bool _hasConfig = true, bool _usePercentageDisplay = false, Overlays.Overlay _overlay = null, string _langTokenOverride = null, bool _qualityBuff = false) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) token = _token; qualityBuff = _qualityBuff; langTokenOverride = _langTokenOverride; name = Languages.GetLanguageString("FAITHFUL_" + sourceToken + "_BUFF"); safeName = _safeName; overlay = _overlay; if (_hasConfig) { CreateDefaultSettings(); } bool flag = !Utils.debugMode && (_iconName == "texbufftemporalcube" || !Assets.HasAsset(_iconName)); if (!flag) { flag = hiddenSetting != null && hiddenSetting.Value; } buffDef = ScriptableObject.CreateInstance(); ((Object)buffDef).name = safeName; buffDef.buffColor = _colour; buffDef.canStack = _canStack; buffDef.isDebuff = _isDebuff; buffDef.isHidden = _isHidden || flag; buffDef.iconSprite = Assets.GetIcon(_iconName); buffDef.stackingDisplayMethod = (StackingDisplayMethod)(_usePercentageDisplay ? 1 : 0); ContentAddition.AddBuffDef(buffDef); if (Utils.verboseConsole) { Log.Debug("Created buff '" + _token + "'"); } if (flag && Utils.verboseConsole) { if (_hasConfig && hiddenSetting.Value) { Log.Debug("Hiding buff '" + _token + "' due to user preference"); } else { Log.Debug("Hiding buff '" + _token + "' due to use of temporary assets outside of debug mode"); } } } private void CreateDefaultSettings() { hiddenSetting = CreateSetting("HIDDEN", "Hide Buff?", _defaultValue: false, "Should the icon for this buff be hidden during runs?", _restartRequired: true); if (overlay != null) { enableOverlaySetting = CreateSetting("OVERLAY", "Enable Overlay?", _defaultValue: true, "Should the character overlay for this buff be enabled?"); } } public Setting CreateSetting(string _tokenAddition, string _key, T _defaultValue, string _description, bool _restartRequired = false, string _valueFormatting = "{0:0}") { if (qualityBuff && !Utils.qualityEnabled) { return null; } if (Utils.verboseConsole) { Log.Info("[BUFF] | Creating setting '" + _key + "' for '" + safeName + " (" + token + ")'"); } string text = "BUFF_" + token + "_" + _tokenAddition; string section = (qualityBuff ? ("Quality Buff: " + safeName) : ("Buff: " + safeName)); bool restartRequired = _restartRequired; return Config.CreateSetting(text, section, _key, _defaultValue, _description, _isStat: true, _isClientSide: false, default(T), default(T), default(T), default(T), _canRandomise: true, restartRequired, _valueFormatting); } } internal static class Buffs { [CompilerGenerated] private static class <>O { public static hook_UpdateOverlays <0>__OnUpdateOverlays; public static hook_OnBuffFirstStackGained <1>__OnBuffFirstStackGained; public static hook_OnBuffFinalStackLost <2>__OnBuffFinalStackLost; } private static List buffs; public static void Init() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_003c: 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_0047: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown buffs = new List(); object obj = <>O.<0>__OnUpdateOverlays; if (obj == null) { hook_UpdateOverlays val = OnUpdateOverlays; <>O.<0>__OnUpdateOverlays = val; obj = (object)val; } CharacterModel.UpdateOverlays += (hook_UpdateOverlays)obj; object obj2 = <>O.<1>__OnBuffFirstStackGained; if (obj2 == null) { hook_OnBuffFirstStackGained val2 = OnBuffFirstStackGained; <>O.<1>__OnBuffFirstStackGained = val2; obj2 = (object)val2; } CharacterBody.OnBuffFirstStackGained += (hook_OnBuffFirstStackGained)obj2; object obj3 = <>O.<2>__OnBuffFinalStackLost; if (obj3 == null) { hook_OnBuffFinalStackLost val3 = OnBuffFinalStackLost; <>O.<2>__OnBuffFinalStackLost = val3; obj3 = (object)val3; } CharacterBody.OnBuffFinalStackLost += (hook_OnBuffFinalStackLost)obj3; } public static Buff AddBuff(string _token, string _safeName, string _iconDir, Color _colour, bool _canStack = true, bool _isDebuff = false, bool _isHidden = false, bool _hasConfig = true, bool _usePercentageDisplay = false, Overlays.Overlay _overlay = null, string _langTokenOverride = null, bool _qualityBuff = false) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) Buff buff = new Buff(_token, _safeName, _iconDir, _colour, _canStack, _isDebuff, _isHidden, _hasConfig, _usePercentageDisplay, _overlay, _langTokenOverride, _qualityBuff); buffs.Add(buff); return buff; } private static void OnUpdateOverlays(orig_UpdateOverlays orig, CharacterModel self) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 orig.Invoke(self); if ((Object)(object)self == (Object)null) { return; } RemoveFaithfulOverlays(self); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (int)self.visibility == 0 || (Object)(object)body.healthComponent == (Object)null || !body.healthComponent.alive) { return; } foreach (Buff buff in buffs) { if (buff == null || !buff.overlayEnabled) { continue; } Overlays.Overlay overlay = buff.overlay; BuffDef buffDef = buff.buffDef; if (overlay == null || (Object)(object)buffDef == (Object)null || (Object)(object)overlay.Material == (Object)null || !body.HasBuff(buffDef)) { continue; } if (self.activeOverlayCount >= CharacterModel.maxOverlays) { break; } int num = 0; for (int i = 0; i < self.activeOverlayCount; i++) { if ((Object)(object)self.currentOverlays[i] == (Object)(object)overlay.Material) { num++; } } self.currentOverlays[self.activeOverlayCount] = overlay.Material; self.activeOverlayCount++; } } private static void OnBuffFirstStackGained(orig_OnBuffFirstStackGained orig, CharacterBody self, BuffDef buffDef) { orig.Invoke(self, buffDef); MarkOverlayDirtyIfFaithfulOverlayBuff(self, buffDef); } private static void OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef) { orig.Invoke(self, buffDef); MarkOverlayDirtyIfFaithfulOverlayBuff(self, buffDef); } private static void MarkOverlayDirtyIfFaithfulOverlayBuff(CharacterBody _body, BuffDef _buffDef) { if (!((Object)(object)_body == (Object)null) && !((Object)(object)_buffDef == (Object)null) && BuffHasFaithfulOverlay(_buffDef)) { MarkBodyMaterialsDirty(_body); } } private static bool BuffHasFaithfulOverlay(BuffDef _buffDef) { if ((Object)(object)_buffDef == (Object)null) { return false; } foreach (Buff buff in buffs) { if (buff == null || !buff.overlayEnabled || (Object)(object)buff.buffDef == (Object)null || !((Object)(object)buff.buffDef == (Object)(object)_buffDef)) { continue; } return true; } return false; } private static void MarkBodyMaterialsDirty(CharacterBody _body) { if ((Object)(object)_body == (Object)null) { return; } ModelLocator modelLocator = _body.modelLocator; if ((Object)(object)modelLocator == (Object)null) { return; } Transform modelTransform = modelLocator.modelTransform; if (!((Object)(object)modelTransform == (Object)null)) { CharacterModel val = ((Component)modelTransform).GetComponent() ?? ((Component)modelTransform).GetComponentInChildren(); if (!((Object)(object)val == (Object)null)) { val.materialsDirty = true; } } } private static void RemoveFaithfulOverlays(CharacterModel _model) { if ((Object)(object)_model == (Object)null) { return; } int num = 0; for (int i = 0; i < _model.activeOverlayCount; i++) { Material val = _model.currentOverlays[i]; if (!IsFaithfulOverlayMaterial(val)) { _model.currentOverlays[num] = val; num++; } } for (int j = num; j < _model.activeOverlayCount; j++) { _model.currentOverlays[j] = null; } _model.activeOverlayCount = num; } private static bool IsFaithfulOverlayMaterial(Material _material) { if ((Object)(object)_material == (Object)null) { return false; } foreach (Buff buff in buffs) { if (buff == null || !buff.overlayEnabled || buff.overlay == null || !((Object)(object)buff.overlay.Material == (Object)(object)_material)) { continue; } return true; } return false; } public static Buff GetBuff(string _token) { foreach (Buff buff in buffs) { if (buff.token == _token) { return buff; } } Log.Error("Attempted to fetch buff '" + _token + "' but couldn't find it"); return null; } } internal class GodMode { protected Toolbox toolbox; private Buff godModeBuff; public GodMode(Toolbox _toolbox) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown toolbox = _toolbox; godModeBuff = Buffs.AddBuff("DEBUG_MODE", "Debug Mode", "texbuffdevmode", Color.white, _canStack: false, _isDebuff: false, !Utils.debugMode, _hasConfig: false); Behaviour.AddInHoldoutZoneCallback(InHoldoutZone); Behaviour.AddOnIncomingDamageCallback(OnIncomingDamage); Behaviour.AddOnPurchaseInteractionBeginCallback(OnPurchaseInteractionBegin); Behaviour.AddOnPurchaseCanBeAffordedCallback(OnPurchaseCanBeAfforded); Behaviour.AddStatsMod(godModeBuff, GodModeStatsMod); Behaviour.AddOnHealCallback(OnHeal); Behaviour.AddUpdateCallback(Update, _debugOnly: true); CharacterBody.GetUserName += new hook_GetUserName(OnGetUsername); MapZone.TeleportBody += new hook_TeleportBody(OnMapTeleportBody); } private void InHoldoutZone(CharacterBody _body, HoldoutZoneController _zone) { if (_body.GetBuffCount(godModeBuff.buffDef) > 0) { Utils.ChargeHoldoutZone(_zone); } } private void OnIncomingDamage(DamageInfo _report, CharacterMaster _attacker, CharacterMaster _victim) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_victim == (Object)null) && _victim.hasBody) { CharacterBody body = _victim.GetBody(); if (body.GetBuffCount(godModeBuff.buffDef) > 0) { _report.rejected = true; _report.canRejectForce = true; _report.damage = 0f; _report.force = default(Vector3); } } } private void OnPurchaseInteractionBegin(PurchaseInteraction _shop, CharacterMaster _activator) { if (_activator.hasBody && _activator.GetBody().GetBuffCount(godModeBuff.buffDef) > 0) { _shop.cost = 0; } } private bool OnPurchaseCanBeAfforded(PurchaseInteraction _shop, CharacterMaster _activator) { if (!_activator.hasBody) { return false; } if (_activator.GetBody().GetBuffCount(godModeBuff.buffDef) > 0) { return true; } return false; } private void GodModeStatsMod(int _count, StatHookEventArgs _stats) { _stats.baseDamageAdd += float.PositiveInfinity; _stats.attackSpeedMultAdd += 3f; _stats.baseRegenAdd += 10000000f; _stats.moveSpeedMultAdd += 2f; _stats.jumpPowerMultAdd += 0.5f; _stats.cooldownReductionAdd += float.PositiveInfinity; } private void OnHeal(HealthComponent _healthComponent, ref float _amount, ref ProcChainMask _procChainMask, ref bool _nonRegen) { CharacterBody component = ((Component)_healthComponent).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && component.GetBuffCount(godModeBuff.buffDef) > 0) { _amount = float.PositiveInfinity; } } private void Update() { if (!Utils.debugMode || !Utils.hosting || !Utils.expansionEnabled || PlayerCharacterMasterController.instances.Count <= 0) { return; } CharacterBody body = PlayerCharacterMasterController.instances[0].master.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { return; } if (Input.GetKeyDown((KeyCode)283)) { if (body.GetBuffCount(godModeBuff.buffDef) > 0) { body.RemoveBuff(godModeBuff.buffDef); if (Utils.verboseConsole) { Log.Debug("God Mode disabled"); } } else { body.AddBuff(godModeBuff.buffDef); if (Utils.verboseConsole) { Log.Debug("God Mode enabled!"); } } } if (Input.GetKeyDown((KeyCode)102) && body.GetBuffCount(godModeBuff.buffDef) > 0) { CharacterMotor component = ((Component)body).GetComponent(); if ((Object)(object)component != (Object)null) { component.isFlying = !component.isFlying; } } } private string OnGetUsername(orig_GetUserName orig, CharacterBody self) { if (self.GetBuffCount(godModeBuff.buffDef) > 0) { return "Godly " + orig.Invoke(self); } return orig.Invoke(self); } private void OnMapTeleportBody(orig_TeleportBody orig, MapZone self, CharacterBody characterBody) { if (characterBody.GetBuffCount(godModeBuff.buffDef) <= 0) { orig.Invoke(self, characterBody); } } } internal class Inspiration { protected Toolbox toolbox; private Buff inspirationBuff; public float critDamageMult = 0.2f; public Inspiration(Toolbox _toolbox) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) toolbox = _toolbox; inspirationBuff = Buffs.AddBuff("INSPIRATION", "Inspiration", "texbuffinspiredboost", Color.white, _canStack: true, _isDebuff: false, _isHidden: false, _hasConfig: true, _usePercentageDisplay: true); Behaviour.AddStatsMod(inspirationBuff, InspirationStatsMod); } private void InspirationStatsMod(int _count, StatHookEventArgs _stats) { _stats.critAdd += (float)_count; _stats.critDamageMultAdd += critDamageMult * (float)_count; } } internal class Overclocked { private Buff buff; public float m_attackSpeedBuff = 0.5f; public float m_moveSpeedBuff = 0.25f; private static readonly Overlays.Overlay overlay = Overlays.CreateOverlay(new Overlays.OverlaySettings { MaterialAddress = "RoR2/Base/CritOnUse/matFullCrit.mat", Colour = new Color(0.16f, 1f, 0f, 0.6f) }); public Overclocked() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) buff = Buffs.AddBuff("OVERCLOCKED", "Overclocked", "texBuffElectroSpeed", Color.white, _canStack: false, _isDebuff: false, _isHidden: false, _hasConfig: true, _usePercentageDisplay: false, overlay); Behaviour.AddStatsMod(buff, OverclockedStatsMod); } private void OverclockedStatsMod(int _count, StatHookEventArgs _stats) { _stats.attackSpeedMultAdd += m_attackSpeedBuff * (float)_count; _stats.moveSpeedMultAdd += m_moveSpeedBuff * (float)_count; } } internal class Patience { protected Toolbox toolbox; private Buff buff; public float damage = 0.25f; public Patience(Toolbox _toolbox) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) toolbox = _toolbox; buff = Buffs.AddBuff("PATIENCE", "Patience", "texBuffHermitShawl", Color.white); Behaviour.AddStatsMod(buff, PatienceStatsMod); } private void PatienceStatsMod(int _count, StatHookEventArgs _stats) { _stats.damageMultAdd += damage * (float)_count; } } internal class Repair { private Buff buff; public float m_healPerc = 0.025f; public float m_tickRate = 2f; private static readonly Overlays.Overlay overlay = Overlays.CreateOverlay(new Overlays.OverlaySettings { MaterialAddress = "RoR2/Base/CritOnUse/matFullCrit.mat", Colour = new Color(0f, 0f, 0.64f, 0.64f) }); public Repair() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) buff = Buffs.AddBuff("REPAIR", "Arc Healing", "texBuffElectroHeal", Color.white, _canStack: false, _isDebuff: false, _isHidden: false, _hasConfig: true, _usePercentageDisplay: false, overlay); Behaviour.AddOnCharacterBodyTickCallback(m_tickRate, OnTick); } private void OnTick(CharacterBody _body) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) HealthComponent component = ((Component)_body).GetComponent(); if (!((Object)(object)component == (Object)null) && _body.HasBuff(buff.buffDef.buffIndex)) { component.HealFraction(m_healPerc, default(ProcChainMask)); } } } internal class Vengeance { protected Toolbox toolbox; private Buff vengeanceBuff; public float damage = 0.75f; public Vengeance(Toolbox _toolbox) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) toolbox = _toolbox; vengeanceBuff = Buffs.AddBuff("VENGEANCE", "Vengeance", "texbuffvengefulboost", Color.red); Behaviour.AddOnDamageDealtCallback(OnDamageDealt); Behaviour.AddStatsMod(vengeanceBuff, VengeanceStatsMod); } private void OnDamageDealt(DamageReport _report) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)_report.dotType == -1 && _report.damageDealt != 0f) { CharacterBody attackerBody = _report.attackerBody; if (Object.op_Implicit((Object)(object)attackerBody) && attackerBody.GetBuffCount(vengeanceBuff.buffDef) > 0) { attackerBody.ClearTimedBuffs(vengeanceBuff.buffDef); } } } private void VengeanceStatsMod(int _count, StatHookEventArgs _stats) { _stats.damageMultAdd += damage * (float)_count; } } internal static class QualityCompat { [CompilerGenerated] private static class <>O { public static LoadContentAsyncDelegate <0>__LoadQualityContent; public static hook_OnInventoryChanged <1>__CharacterBody_OnInventoryChanged; public static hook_OnDestroy <2>__Inventory_OnDestroy; public static hook_CanSelectItemEntry <3>__LogBookController_CanSelectItemEntry; } private static Dictionary itemQualityGroups = new Dictionary(); private static Dictionary> cachedItemCountsEffective = new Dictionary>(); private static Dictionary> cachedItemCountsPermanent = new Dictionary>(); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] internal static void Init() { //IL_001c: 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_0027: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown //IL_007f: 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_008a: Expected O, but got Unknown Log.Info("Faithful detected Quality, initializing compatibility!"); object obj = <>O.<0>__LoadQualityContent; if (obj == null) { LoadContentAsyncDelegate val = LoadQualityContent; <>O.<0>__LoadQualityContent = val; obj = (object)val; } QualityContentManager.LoadContentAsync += (LoadContentAsyncDelegate)obj; object obj2 = <>O.<1>__CharacterBody_OnInventoryChanged; if (obj2 == null) { hook_OnInventoryChanged val2 = CharacterBody_OnInventoryChanged; <>O.<1>__CharacterBody_OnInventoryChanged = val2; obj2 = (object)val2; } CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)obj2; object obj3 = <>O.<2>__Inventory_OnDestroy; if (obj3 == null) { hook_OnDestroy val3 = Inventory_OnDestroy; <>O.<2>__Inventory_OnDestroy = val3; obj3 = (object)val3; } Inventory.OnDestroy += (hook_OnDestroy)obj3; object obj4 = <>O.<3>__LogBookController_CanSelectItemEntry; if (obj4 == null) { hook_CanSelectItemEntry val4 = LogBookController_CanSelectItemEntry; <>O.<3>__LogBookController_CanSelectItemEntry = val4; obj4 = (object)val4; } LogBookController.CanSelectItemEntry += (hook_CanSelectItemEntry)obj4; Behaviour.AddOnPreSceneExitCallback(delegate { cachedItemCountsEffective.Clear(); cachedItemCountsPermanent.Clear(); }); } private static void CharacterBody_OnInventoryChanged(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (!((Object)(object)self.inventory == (Object)null)) { cachedItemCountsEffective.Remove(self.inventory); cachedItemCountsPermanent.Remove(self.inventory); } } private static void Inventory_OnDestroy(orig_OnDestroy orig, Inventory self) { orig.Invoke(self); if (!((Object)(object)self == (Object)null)) { cachedItemCountsEffective.Remove(self); cachedItemCountsPermanent.Remove(self); } } private static IEnumerator LoadQualityContent(QualityContentLoadArgs _args) { foreach (Item item in Items.AllItems) { if (item.supportsQuality) { itemQualityGroups.Add(item, _args.CreateItemQualityGroup(item.itemDef)); } } yield break; } private static bool LogBookController_CanSelectItemEntry(orig_CanSelectItemEntry orig, ItemDef itemDef, Dictionary expansionAvailability) { if (IsHiddenFromLogbookQualityVariant(itemDef)) { return false; } return orig.Invoke(itemDef, expansionAvailability); } private static bool IsHiddenFromLogbookQualityVariant(ItemDef _itemDef) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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) if ((Object)(object)_itemDef == (Object)null) { return false; } foreach (KeyValuePair itemQualityGroup in itemQualityGroups) { if (itemQualityGroup.Key != null && !((Object)(object)itemQualityGroup.Value == (Object)null) && itemQualityGroup.Key.hiddenFromLogbook) { if (itemQualityGroup.Value.UncommonItemIndex == _itemDef.itemIndex) { return true; } if (itemQualityGroup.Value.RareItemIndex == _itemDef.itemIndex) { return true; } if (itemQualityGroup.Value.EpicItemIndex == _itemDef.itemIndex) { return true; } if (itemQualityGroup.Value.LegendaryItemIndex == _itemDef.itemIndex) { return true; } } } return false; } public static ItemDef GetBaseItem(ItemDef _qualityItem) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair itemQualityGroup in itemQualityGroups) { if (itemQualityGroup.Key != null && !((Object)(object)itemQualityGroup.Value == (Object)null)) { ItemIndex uncommonItemIndex = itemQualityGroup.Value.UncommonItemIndex; ItemIndex rareItemIndex = itemQualityGroup.Value.RareItemIndex; ItemIndex epicItemIndex = itemQualityGroup.Value.EpicItemIndex; ItemIndex legendaryItemIndex = itemQualityGroup.Value.LegendaryItemIndex; if (uncommonItemIndex == _qualityItem.itemIndex || rareItemIndex == _qualityItem.itemIndex || epicItemIndex == _qualityItem.itemIndex || legendaryItemIndex == _qualityItem.itemIndex) { return itemQualityGroup.Key.itemDef; } } } return _qualityItem; } public static ItemIndex GetQualityItemIndex(Item _item, Quality _quality) { //IL_0032: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (!itemQualityGroups.TryGetValue(_item, out var value)) { Log.Warning("[QUALITY COMPAT] - Couldn't find quality group for item '" + _item.name + "', returning none!"); return (ItemIndex)(-1); } if (1 == 0) { } ItemIndex result = (ItemIndex)(_quality switch { Quality.UNCOMMON => value.UncommonItemIndex, Quality.RARE => value.RareItemIndex, Quality.EPIC => value.EpicItemIndex, Quality.LEGENDARY => value.LegendaryItemIndex, _ => -1, }); if (1 == 0) { } return result; } public static ItemDef GetQualityItemDef(Item _item, Quality _quality) { //IL_0003: 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) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) ItemIndex qualityItemIndex = GetQualityItemIndex(_item, _quality); if ((int)qualityItemIndex == -1) { return null; } return ItemCatalog.GetItemDef(qualityItemIndex); } public static QualityCounts GetItemCountsEffective(Inventory _inventory, Item _item) { //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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (!itemQualityGroups.TryGetValue(_item, out var value)) { Log.Warning("[QUALITY COMPAT] - Couldn't find quality group for item '" + _item.name + "', returning default counts!"); return new QualityCounts(); } if (cachedItemCountsEffective.TryGetValue(_inventory, out var value2)) { if (value2.TryGetValue(_item, out var value3)) { return value3; } } else { cachedItemCountsEffective.Add(_inventory, new Dictionary()); } ItemQualityCounts itemCountsEffective = InventoryExtensions.GetItemCountsEffective(_inventory, value); QualityCounts qualityCounts = new QualityCounts(); qualityCounts.UNCOMMON = itemCountsEffective.UncommonCount; qualityCounts.RARE = itemCountsEffective.RareCount; qualityCounts.EPIC = itemCountsEffective.EpicCount; qualityCounts.LEGENDARY = itemCountsEffective.LegendaryCount; QualityCounts qualityCounts2 = qualityCounts; cachedItemCountsEffective[_inventory].Add(_item, qualityCounts2); return qualityCounts2; } public static QualityCounts GetItemCountsPermanent(Inventory _inventory, Item _item) { //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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (!itemQualityGroups.TryGetValue(_item, out var value)) { Log.Warning("[QUALITY COMPAT] - Couldn't find quality group for item '" + _item.name + "', returning default counts!"); return new QualityCounts(); } if (cachedItemCountsPermanent.TryGetValue(_inventory, out var value2)) { if (value2.TryGetValue(_item, out var value3)) { return value3; } } else { cachedItemCountsPermanent.Add(_inventory, new Dictionary()); } ItemQualityCounts itemCountsPermanent = InventoryExtensions.GetItemCountsPermanent(_inventory, value); QualityCounts qualityCounts = new QualityCounts(); qualityCounts.UNCOMMON = itemCountsPermanent.UncommonCount; qualityCounts.RARE = itemCountsPermanent.RareCount; qualityCounts.EPIC = itemCountsPermanent.EpicCount; qualityCounts.LEGENDARY = itemCountsPermanent.LegendaryCount; QualityCounts qualityCounts2 = qualityCounts; cachedItemCountsPermanent[_inventory].Add(_item, qualityCounts2); return qualityCounts2; } } internal static class QualityCompatBootstrap { internal const string QualityGuid = "com.Gorakh.ItemQualities"; internal static bool IsAvailable => Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities"); internal static void TryInit() { if (!IsAvailable) { return; } InitNoInline(); foreach (KeyValuePair item in Utils.Items) { if (item.Value.SupportsQuality) { item.Value.QualityConstructor(); } } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void InitNoInline() { QualityCompat.Init(); } } internal enum Quality { UNCOMMON, RARE, EPIC, LEGENDARY } internal struct QualityCounts { public int UNCOMMON; public int RARE; public int EPIC; public int LEGENDARY; public readonly int Total => UNCOMMON + RARE + EPIC + LEGENDARY; public QualityCounts() { UNCOMMON = 0; RARE = 0; EPIC = 0; LEGENDARY = 0; } public Quality GetHighestQuality() { if (LEGENDARY > 0) { return Quality.LEGENDARY; } if (EPIC > 0) { return Quality.EPIC; } if (RARE > 0) { return Quality.RARE; } return Quality.UNCOMMON; } } internal class QualityValues { public T UNCOMMON { get; private set; } public T RARE { get; private set; } public T EPIC { get; private set; } public T LEGENDARY { get; private set; } public void UpdateValues(QualitySetting _setting, float _multiplier = 1f) { if (_setting != null) { UNCOMMON = ApplyMultiplier(_setting.GetValue(Quality.UNCOMMON), _multiplier); RARE = ApplyMultiplier(_setting.GetValue(Quality.RARE), _multiplier); EPIC = ApplyMultiplier(_setting.GetValue(Quality.EPIC), _multiplier); LEGENDARY = ApplyMultiplier(_setting.GetValue(Quality.LEGENDARY), _multiplier); } } private static T ApplyMultiplier(T value, float multiplier) { if (typeof(T) == typeof(float)) { float num = (float)(object)value; return (T)(object)(num * multiplier); } if (typeof(T) == typeof(int)) { int num2 = (int)(object)value; return (T)(object)Mathf.RoundToInt((float)num2 * multiplier); } return value; } public T GetValue(Quality _quality) { if (1 == 0) { } T result = _quality switch { Quality.UNCOMMON => UNCOMMON, Quality.RARE => RARE, Quality.EPIC => EPIC, Quality.LEGENDARY => LEGENDARY, _ => default(T), }; if (1 == 0) { } return result; } } internal static class QualityConfig { private static Dictionary qualitySettings = new Dictionary(); public static QualitySetting CreateSetting(string _token, string _section, string _key, T _uncommonDefaultValue, T _rareDefaultValue, T _epicDefaultValue, T _legendaryDefaultValue, string _description, bool _isStat = true, bool _isClientSide = false, T _minValue = default(T), T _maxValue = default(T), T _randomiserMin = default(T), T _randomiserMax = default(T), bool _canRandomise = true, bool _restartRequired = false, string _valueFormatting = "{0:0}") { if (qualitySettings.ContainsKey(_token)) { Log.Warning("[QUALITY CONFIG] - Could not create quality setting for token '" + _token + "' as token already exists."); return null; } QualitySetting qualitySetting = new QualitySetting(_token, _section, _key, _uncommonDefaultValue, _rareDefaultValue, _epicDefaultValue, _legendaryDefaultValue, _description, _isStat, _isClientSide, _minValue, _maxValue, _randomiserMin, _randomiserMax, _canRandomise, _restartRequired, _valueFormatting); qualitySettings.Add(_token, qualitySetting); return qualitySetting; } public static QualitySetting CreateSetting(string _token, string _section, string _key, T _defaultValue, string _description, bool _isStat = true, bool _isClientSide = false, T _minValue = default(T), T _maxValue = default(T), T _randomiserMin = default(T), T _randomiserMax = default(T), bool _canRandomise = true, bool _restartRequired = false, string _valueFormatting = "{0:0}") { if (qualitySettings.ContainsKey(_token)) { Log.Warning("[QUALITY CONFIG] - Could not create quality setting for token '" + _token + "' as token already exists."); return null; } QualitySetting qualitySetting = new QualitySetting(_token, _section, _key, _defaultValue, _defaultValue, _defaultValue, _defaultValue, _description, _isStat, _isClientSide, _minValue, _maxValue, _randomiserMin, _randomiserMax, _canRandomise, _restartRequired, _valueFormatting, _isSingleValue: true); qualitySettings.Add(_token, qualitySetting); return qualitySetting; } public static QualitySetting FetchSetting(string _token) { if (!qualitySettings.ContainsKey(_token)) { Log.Warning("[QUALITY CONFIG] - Attempted to fetch quality setting with token '" + _token + "' but token was not found."); return null; } try { return qualitySettings[_token] as QualitySetting; } catch { Log.Warning("[QUALITY CONFIG] - Could not fetch quality setting with token '" + _token + "' as type '" + typeof(T).Name + "'."); return null; } } } internal class QualitySetting : IQualitySetting { private Dictionary> qualitySettings = new Dictionary>(); private string token; private bool isSingleValue = false; public string Token => token; public T Value { get { if (!isSingleValue) { Log.Warning("[QUALITY SETTING] - Asked to get value for quality setting with token '" + token + "' but this quality setting has different values for each quality. Use GetValue(Quality _quality) instead."); } return qualitySettings[Quality.UNCOMMON].Value; } } public QualitySetting(string _token, string _section, string _key, T _uncommonDefaultValue, T _rareDefaultValue, T _epicDefaultValue, T _legendaryDefaultValue, string _description, bool _isStat = true, bool _isClientSide = false, T _minValue = default(T), T _maxValue = default(T), T _randomiserMin = default(T), T _randomiserMax = default(T), bool _canRandomise = true, bool _restartRequired = false, string _valueFormatting = "{0:0}", bool _isSingleValue = false) { token = _token; isSingleValue = _isSingleValue; if (isSingleValue) { Setting value = Config.CreateSetting(_token + "_QUALITY_ALL", "Quality " + _section, "(ALL) " + _key, _uncommonDefaultValue, _description, _isStat, _isClientSide, _minValue, _maxValue, _randomiserMin, _randomiserMax, _canRandomise, _restartRequired, _valueFormatting); { foreach (Quality value3 in Enum.GetValues(typeof(Quality))) { qualitySettings.Add(value3, value); } return; } } foreach (Quality value4 in Enum.GetValues(typeof(Quality))) { string text = value4.ToString(); if (1 == 0) { } T val = value4 switch { Quality.UNCOMMON => _uncommonDefaultValue, Quality.RARE => _rareDefaultValue, Quality.EPIC => _epicDefaultValue, Quality.LEGENDARY => _legendaryDefaultValue, _ => default(T), }; if (1 == 0) { } T defaultValue = val; Setting value2 = Config.CreateSetting(_token + "_QUALITY_" + text, "Quality " + _section, "(" + text + ") " + _key, defaultValue, _description, _isStat, _isClientSide, _minValue, _maxValue, _randomiserMin, _randomiserMax, _canRandomise, _restartRequired, _valueFormatting); qualitySettings.Add(value4, value2); } } public T GetValue(Quality _quality) { if (!qualitySettings.ContainsKey(_quality)) { Log.Warning($"[QUALITY SETTING] - Attempted to get value for quality '{_quality}' in quality setting with token '{token}' but quality was not found."); return default(T); } return qualitySettings[_quality].Value; } } public interface IQualitySetting { string Token { get; } } internal class FaithfulCharacterBodyBehaviour : NetworkBehaviour { public Flags frameFlags = new Flags(); public Flags stageFlags = new Flags(); [SyncVar(hook = "CharacterIDChanged")] public NetworkInstanceId characterID; private CharacterBody character; private bool characterBodyFound = false; public FaithfulTJetpackBehaviour tJetpack; public FaithfulLeadersPennonBehaviour leadersPennon; public FaithfulLongshotGeodeBehaviour longshotGeode; public FaithfulTargetingMatrixBehaviour targetingMatrix; public FaithfulHermitsShawlBehaviour hermitsShawl; private bool searchingForCharacterBody = false; private List m_tickBehaviours = new List(); public NetworkInstanceId NetworkcharacterID { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return characterID; } [param: In] set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) ref NetworkInstanceId reference = ref characterID; if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard) { ((NetworkBehaviour)this).syncVarHookGuard = true; CharacterIDChanged(value); ((NetworkBehaviour)this).syncVarHookGuard = false; } ((NetworkBehaviour)this).SetSyncVar(value, ref reference, 1u); } } private void FixedUpdate() { foreach (CharacterBodyTickBehaviour tickBehaviour in m_tickBehaviours) { tickBehaviour.FixedUpdate(); } } public void AddTickBehaviour(CharacterBodyCallback _callback, float _tickRate) { m_tickBehaviours.Add(new CharacterBodyTickBehaviour(_callback, _tickRate)); } private void CharacterIDChanged(NetworkInstanceId _newValue) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) NetworkcharacterID = _newValue; ((MonoBehaviour)this).StartCoroutine(LinkCharacterBody()); } public override void OnStartClient() { ((NetworkBehaviour)this).OnStartClient(); ((MonoBehaviour)this).StartCoroutine(LinkCharacterBody()); ((MonoBehaviour)this).Invoke("CheckForCharacterBody", 8f); } private void CheckForCharacterBody() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (!characterBodyFound && !NetworkServer.active && Utils.verboseConsole) { Log.Warning($"Faithful Character Body behaviour not linked for net ID {characterID}."); } } private void LateUpdate() { frameFlags.Reset(); if (characterBodyFound && (Object)(object)character == (Object)null && NetworkServer.active) { NetworkServer.Destroy(((Component)this).gameObject); } } private IEnumerator LinkCharacterBody() { if (searchingForCharacterBody) { yield break; } searchingForCharacterBody = true; while ((Object)(object)character == (Object)null) { FaithfulCharacterBodyBehaviour faithfulCharacterBodyBehaviour = this; GameObject obj = ClientScene.FindLocalObject(characterID); faithfulCharacterBodyBehaviour.character = ((obj != null) ? obj.GetComponent() : null); yield return null; } characterBodyFound = true; foreach (CharacterBodyTickBehaviour tickBehaviour in m_tickBehaviours) { tickBehaviour.UpdateCharacterBody(character); } Utils.RegisterFaithfulCharacterBodyBehaviour(character, this); tJetpack = ((Component)this).GetComponent(); tJetpack.AssignCharacter(character); leadersPennon = ((Component)this).GetComponent(); leadersPennon.Init(character); longshotGeode = ((Component)this).GetComponent(); longshotGeode.Init(character); targetingMatrix = ((Component)this).GetComponent(); targetingMatrix.Init(character); hermitsShawl = ((Component)this).GetComponent(); hermitsShawl.Init(character); if ((Object)(object)character.inventory != (Object)null) { tJetpack.UpdateItemCount(character.inventory.GetItemCountEffective(Items.GetItem("4T0N_JETPACK").itemDef)); } if (Utils.verboseConsole) { string messageSource = (NetworkServer.active ? "SERVER" : "CLIENT"); Log.Message($"[{messageSource}] - Faithful Character Body behaviour linked for character '{((Object)character).name}' with net ID {characterID}."); } searchingForCharacterBody = false; } private void UNetVersion() { } public override bool OnSerialize(NetworkWriter writer, bool forceAll) { //IL_0008: 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 (forceAll) { writer.Write(characterID); return true; } bool flag = false; if ((((NetworkBehaviour)this).syncVarDirtyBits & 1) != 0) { if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); flag = true; } writer.Write(characterID); } if (!flag) { writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits); } return flag; } public override void OnDeserialize(NetworkReader reader, bool initialState) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (initialState) { characterID = reader.ReadNetworkId(); return; } int num = (int)reader.ReadPackedUInt32(); if ((num & 1) != 0) { CharacterIDChanged(reader.ReadNetworkId()); } } } internal interface ICharacterBehaviour { void FetchSettings(); } internal class CharacterBodyTickBehaviour { private CharacterBody m_body; private CharacterBodyCallback m_callback; private float m_tickRate; private float m_timer = 0f; public CharacterBodyTickBehaviour(CharacterBodyCallback _callback, float _tickRate) { m_callback = _callback; m_tickRate = _tickRate; m_timer = 1f / m_tickRate; } public void UpdateCharacterBody(CharacterBody _body) { m_body = _body; } public void FixedUpdate() { m_timer -= Time.fixedDeltaTime; if (m_timer <= 0f) { m_timer = 1f / m_tickRate; if ((Object)(object)m_body != (Object)null) { m_callback(m_body); } } } } internal class FaithfulHealthComponentBehaviour : MonoBehaviour, IOnIncomingDamageServerReceiver { public CharacterBody character; public CharacterMaster lastAttacker; private void Start() { character = ((Component)this).gameObject.GetComponent(); } public void OnIncomingDamageServer(DamageInfo _damageInfo) { lastAttacker = null; if (_damageInfo == null) { return; } CharacterMaster victim = (Object.op_Implicit((Object)(object)character) ? character.master : null); CharacterMaster attacker = null; if (Object.op_Implicit((Object)(object)_damageInfo.attacker)) { CharacterBody component = _damageInfo.attacker.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { attacker = (lastAttacker = component.master); } } Behaviour.OnIncomingDamageServer(_damageInfo, attacker, victim); } } internal class FaithfulHoldoutZoneBehaviour : MonoBehaviour { private HoldoutZoneController zone; private List onHoldoutZoneCalcRadiusCallbacks; private List holders = new List(); private bool playerInside = false; private float qualityTimer = 0f; private int qualityBuffsApplied = 0; private QualityValues sizeQualityValues = new QualityValues(); private QualityValues sizeStackingQualityValues = new QualityValues(); private float intervalQuality; private int maxInstancesQuality; private void Awake() { zone = ((Component)this).GetComponent(); if (Utils.qualityEnabled) { sizeQualityValues = Faithful.spaciousUmbrella.SizeQualityValues; sizeStackingQualityValues = Faithful.spaciousUmbrella.SizeStackingQualityValues; intervalQuality = Faithful.spaciousUmbrella.IntervalQuality; maxInstancesQuality = Faithful.spaciousUmbrella.MaxInstancesQuality; } } private void OnEnable() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (((Object)zone).name != "HoldoutZone") { zone.calcRadius += new CalcRadiusDelegate(OnCalcRadius); } Utils.RegisterActiveHoldoutZone(zone); } private void OnDisable() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown if (((Object)zone).name != "HoldoutZone") { zone.calcRadius -= new CalcRadiusDelegate(OnCalcRadius); } Utils.UnregisterActiveHoldoutZone(zone); } private void FixedUpdate() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!Utils.qualityEnabled) { return; } holders.Clear(); foreach (CharacterBody alivePlayerBody in Utils.GetAlivePlayerBodies()) { if (!((Object)(object)alivePlayerBody.inventory == (Object)null) && alivePlayerBody.inventory.GetItemCountEffective(Faithful.spaciousUmbrella.MainItem.itemDef.itemIndex) > 0) { holders.Add(alivePlayerBody); } } if (holders.Count == 0) { return; } bool flag = false; foreach (CharacterBody holder in holders) { if (Utils.IsCharacterInHoldoutZone(holder, zone)) { flag = true; break; } } if (!flag) { playerInside = false; qualityTimer = 0f; qualityBuffsApplied = 0; } else if (!playerInside) { playerInside = true; qualityTimer = Time.time; qualityBuffsApplied = 0; } else if (Time.time - qualityTimer >= intervalQuality && qualityBuffsApplied < maxInstancesQuality) { qualityBuffsApplied++; qualityTimer = Time.time; } } public void Init(List _onHoldoutZoneCalcRadiusCallbacks) { onHoldoutZoneCalcRadiusCallbacks = _onHoldoutZoneCalcRadiusCallbacks; } private void OnCalcRadius(ref float _radius) { foreach (OnHoldoutZoneCalcRadiusCallback onHoldoutZoneCalcRadiusCallback in onHoldoutZoneCalcRadiusCallbacks) { onHoldoutZoneCalcRadiusCallback(ref _radius, zone); } if (Utils.qualityEnabled && qualityBuffsApplied > 0) { _radius += GetQualityRadiusIncrease(); } } private float GetQualityRadiusIncrease() { if (holders.Count == 0 || qualityBuffsApplied == 0) { return 0f; } List list = new List(); foreach (CharacterBody holder in holders) { if (Utils.IsCharacterInHoldoutZone(holder, zone)) { list.Add(holder); } } if (list.Count == 0) { return 0f; } int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; foreach (CharacterBody item in list) { QualityCounts itemCountsEffective = QualityCompat.GetItemCountsEffective(item.inventory, Faithful.spaciousUmbrella.MainItem); num += itemCountsEffective.UNCOMMON; num2 += itemCountsEffective.RARE; num3 += itemCountsEffective.EPIC; num4 += itemCountsEffective.LEGENDARY; } if (num == 0 && num2 == 0 && num3 == 0 && num4 == 0) { return 0f; } float num5 = 0f; num5 += Utils.CalculateStackingValue(num, sizeQualityValues.UNCOMMON, sizeStackingQualityValues.UNCOMMON); num5 += Utils.CalculateStackingValue(num2, sizeQualityValues.RARE, sizeStackingQualityValues.RARE); num5 += Utils.CalculateStackingValue(num3, sizeQualityValues.EPIC, sizeStackingQualityValues.EPIC); num5 += Utils.CalculateStackingValue(num4, sizeQualityValues.LEGENDARY, sizeStackingQualityValues.LEGENDARY); return num5 * (float)qualityBuffsApplied; } } internal class FaithfulRadiusIndicatorBehaviour : MonoBehaviour { private Transform parent; private float adjustmentSpeed; private float m_targetSize; public float size => ((Component)this).transform.lossyScale.x * 13f; public float targetSize => m_targetSize; public void Init(Transform _parent, float _startingSize, Color _colour, float _adjustmentSpeed = 1f) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) parent = _parent; ((Component)this).transform.parent = parent; adjustmentSpeed = _adjustmentSpeed; m_targetSize = _startingSize; SetSize(_startingSize); SetColour(_colour); } private IEnumerator AdjustToSize(float _targetSize) { float startingSize = size; float sizeDif = _targetSize - startingSize; float timeSpent = 0f; while (timeSpent < 1f) { timeSpent = Mathf.Min(timeSpent + Time.deltaTime * adjustmentSpeed, 1f); SetSize(startingSize + sizeDif * Mathf.SmoothStep(0f, 1f, timeSpent)); yield return null; } } public void SetColour(Color _colour) { //IL_0020: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) ((Renderer)((Component)((Component)this).transform.Find("Donut")).GetComponent()).material.SetColor("_Color", _colour); ((Renderer)((Component)((Component)this).transform.Find("Donut")).GetComponent()).material.SetColor("_TintColor", _colour); ((Renderer)((Component)((Component)this).transform.Find("Radius, Spherical")).GetComponent()).material.SetColor("_Color", _colour); ((Renderer)((Component)((Component)this).transform.Find("Radius, Spherical")).GetComponent()).material.SetColor("_TintColor", _colour); } public void SetTargetSize(float _targetSize) { if (!Mathf.Approximately(_targetSize, m_targetSize)) { m_targetSize = _targetSize; ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).StartCoroutine(AdjustToSize(_targetSize)); } } private void SetSize(float _size) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) float num = _size / 13f; ((Component)this).transform.parent = null; ((Component)this).transform.localScale = new Vector3(num, num, num); ((Component)this).transform.parent = parent; } } internal class FaithfulRotatorBehaviour : MonoBehaviour { [SerializeField] private Vector3 rotationAxis = Vector3.up; [SerializeField] private float rotationSpeed = 1f; public void Init(Vector3 _rotationAxis, float _rotationSpeed) { //IL_0004: 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) rotationAxis = ((Vector3)(ref _rotationAxis)).normalized; rotationSpeed = _rotationSpeed; } private void Update() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.Rotate(rotationAxis * rotationSpeed * Time.deltaTime, (Space)1); } } internal static class Config { private static ConfigFile configFile; private static Dictionary settings = new Dictionary(); public static void Init(ConfigFile _configFile) { configFile = _configFile; RiskOfOptionsWrapper.Init(); } public static Setting CreateSetting(string _token, string _section, string _key, T _defaultValue, string _description, bool _isStat = true, bool _isClientSide = false, T _minValue = default(T), T _maxValue = default(T), T _randomiserMin = default(T), T _randomiserMax = default(T), bool _canRandomise = true, bool _restartRequired = false, string _valueFormatting = "{0:0}") { if (settings.ContainsKey(_token)) { Log.Warning("[CONFIG] - Could not create setting for token '" + _token + "' as token already exists."); return null; } Setting setting = new Setting(configFile, _token, _section, _key, _defaultValue, _description, _isStat, _isClientSide, _minValue, _maxValue, _randomiserMin, _randomiserMax, _canRandomise, _restartRequired, _valueFormatting); if (!_token.ToUpper().Contains("TEMP")) { RiskOfOptionsWrapper.AddOption(setting); } settings.Add(_token, setting); return setting; } public static Setting FetchSetting(string _token) { if (!settings.ContainsKey(_token)) { Log.Warning("[CONFIG] - Attempted to fetch setting with token '" + _token + "' but token was not found."); return null; } try { return settings[_token] as Setting; } catch { Log.Warning("[CONFIG] - Could not fetch setting with token '" + _token + "' as type '" + typeof(T).Name + "'."); return null; } } public static ISetting FetchSetting(string _token) { if (!settings.ContainsKey(_token)) { Log.Warning("[CONFIG] - Attempted to fetch setting with token '" + _token + "' but token was not found."); return null; } return settings[_token]; } public static string FormatLanguageToken(string _token, string _tokenPrefix = "", string _corruptedItemName = "", bool _useRawToken = false, string _quality = "", bool _warn = true, Dictionary _manualSettingTokens = null) { string text = (_useRawToken ? _token : Languages.GetLanguageString(_token, _warn)); if (_manualSettingTokens != null) { foreach (KeyValuePair _manualSettingToken in _manualSettingTokens) { string text2 = _manualSettingToken.Key; if (!text2.StartsWith("[")) { text2 = "[" + text2 + "]"; } string newValue = _manualSettingToken.Value ?? ""; text = text.Replace(text2, newValue); } } string text3 = _tokenPrefix; if (text3 != "") { text3 += "_"; } string text4 = _quality; string text5 = ""; if (text4 != "") { text4 = "_QUALITY_" + text4; text5 = "_QUALITY_ALL"; } foreach (KeyValuePair setting in settings) { string text6 = setting.Key; if (text3 != "") { if (!text6.Contains(text3)) { continue; } if (!setting.Value.isDefault && setting.Value.isStat && Languages.HasLanguageString(_token + "_ALT")) { return FormatLanguageToken(_token + "_ALT", _tokenPrefix, _corruptedItemName, _useRawToken, _quality); } text6 = text6.Replace(text3, ""); } if (text4 != "") { if (!text6.Contains(text4)) { continue; } text6 = text6.Replace(text4, ""); } text6 = "[" + text6 + "]"; text = text.Replace(text6, setting.Value.ValueObject.ToString()); } if (text5 != "") { foreach (KeyValuePair setting2 in settings) { string text7 = setting2.Key; if (text3 != "") { if (!text7.Contains(text3)) { continue; } text7 = text7.Replace(text3, ""); } if (text7.Contains(text5)) { text7 = text7.Replace(text5, ""); text7 = "[" + text7 + "]"; text = text.Replace(text7, setting2.Value.ValueObject.ToString()); } } } text = RemoveZeroStackingTags(text); if (text.Contains("[CORRUPTED_ITEM]")) { if (!string.IsNullOrWhiteSpace(_corruptedItemName)) { text = text.Replace("[CORRUPTED_ITEM]", (Languages.GetLanguageString("FAITHFUL_LANGUAGE") == "English") ? Utils.Pluralize(_corruptedItemName) : _corruptedItemName); } else { Log.Error("[CONFIG] - Was unable to process corrupted item token for language token '" + _token + "' as no corrupted item name was provided."); text = text.Replace(" Corrupts all [CORRUPTED_ITEM].", ""); } } else if (!string.IsNullOrWhiteSpace(_corruptedItemName)) { text = text + " " + Languages.GetLanguageString("FAITHFUL_ITEM_CORRUPT"); text = text.Replace("[CORRUPTED_ITEM]", (Languages.GetLanguageString("FAITHFUL_LANGUAGE") == "English") ? Utils.Pluralize(_corruptedItemName) : _corruptedItemName); } return text; } private static string RemoveZeroStackingTags(string _languageString) { string pattern = "( ?)(.*?)<\\/style>"; return Regex.Replace(_languageString, pattern, delegate(Match match) { string value = match.Groups[2].Value; MatchCollection matchCollection = Regex.Matches(value, "\\d"); bool flag = matchCollection.Count > 0 && matchCollection.Cast().All((Match d) => d.Value == "0"); bool flag2 = matchCollection.Cast().Any((Match d) => d.Value != "0"); return (matchCollection.Count > 0 && !flag2) ? "" : match.Value; }); } public static void DeleteSetting(string _token) { if (settings.ContainsKey(_token)) { settings[_token].DeleteFromConfigFile(); settings.Remove(_token); } } public static void ResetSettingRandomisers() { foreach (KeyValuePair setting in settings) { setting.Value.isRandomised = false; } } public static Dictionary GetSettings() { return settings; } } internal static class RiskOfOptionsWrapper { public static string pluginGUID; public static string pluginName; private static bool enabled; private static Assembly assembly; private static Type baseOptionType; private static Type checkBoxOptionType; private static Type stepSliderOptionType; private static Type intSliderOptionType; private static Type stringInputFieldOptionType; private static Type checkBoxConfigType; private static Type stepSliderConfigType; private static Type intSliderConfigType; private static Type inputFieldConfigType; private static MethodInfo setModIconMethod; private static MethodInfo addOptionMethod; public static void Init() { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (assembly.GetName().Name == "RiskOfOptions") { RiskOfOptionsWrapper.assembly = assembly; enabled = true; GetTypes(); GetMethods(); if (Utils.verboseConsole) { Log.Info("Risk Of Options wrapper created successfully."); } } } } public static void UpdateModIcon() { if (enabled && setModIconMethod != null) { setModIconMethod.Invoke(null, new object[1] { Assets.GetIcon("texCustomExpansionIcon") }); } } public static void AddOption(Setting _setting) { if (!enabled || addOptionMethod == null) { return; } if (typeof(T) == typeof(bool)) { if (!(checkBoxOptionType == null) && !(checkBoxConfigType == null)) { object obj = Activator.CreateInstance(checkBoxConfigType); checkBoxConfigType.GetField("restartRequired")?.SetValue(obj, _setting.restartRequired); object obj2 = Activator.CreateInstance(checkBoxOptionType, _setting.configEntry, obj); try { addOptionMethod.Invoke(null, new object[3] { obj2, pluginGUID, pluginName }); } catch (Exception arg) { Log.Warning($"[CONFIG] | Failed to add Risk Of Options option for setting '{_setting.token}'.\nException: {arg}"); } } } else if (typeof(T) == typeof(float)) { if (!(stepSliderOptionType == null) && !(stepSliderConfigType == null)) { object obj3 = Activator.CreateInstance(stepSliderConfigType); stepSliderConfigType.GetField("min")?.SetValue(obj3, Convert.ToSingle(_setting.sliderMin)); stepSliderConfigType.GetField("max")?.SetValue(obj3, Convert.ToSingle(_setting.sliderMax)); stepSliderConfigType.GetField("increment")?.SetValue(obj3, _setting.stepSliderIncrement); stepSliderConfigType.GetField("restartRequired")?.SetValue(obj3, _setting.restartRequired); stepSliderConfigType.GetProperty("FormatString")?.SetValue(obj3, _setting.valueFormatting); object obj4 = Activator.CreateInstance(stepSliderOptionType, _setting.configEntry, obj3); try { addOptionMethod.Invoke(null, new object[3] { obj4, pluginGUID, pluginName }); } catch (Exception arg2) { Log.Warning($"[CONFIG] | Failed to add Risk Of Options option for setting '{_setting.token}'.\nException: {arg2}"); } } } else if (typeof(T) == typeof(int)) { if (!(intSliderOptionType == null) && !(intSliderConfigType == null)) { object obj5 = Activator.CreateInstance(intSliderConfigType); intSliderConfigType.GetField("min")?.SetValue(obj5, Convert.ToInt32(_setting.sliderMin)); intSliderConfigType.GetField("max")?.SetValue(obj5, Convert.ToInt32(_setting.sliderMax)); intSliderConfigType.GetField("restartRequired")?.SetValue(obj5, _setting.restartRequired); intSliderConfigType.GetProperty("FormatString")?.SetValue(obj5, _setting.valueFormatting); object obj6 = Activator.CreateInstance(intSliderOptionType, _setting.configEntry, obj5); try { addOptionMethod.Invoke(null, new object[3] { obj6, pluginGUID, pluginName }); } catch (Exception arg3) { Log.Warning($"[CONFIG] | Failed to add Risk Of Options option for setting '{_setting.token}'.\nException: {arg3}"); } } } else if (typeof(T) == typeof(string) && !(stringInputFieldOptionType == null) && !(inputFieldConfigType == null)) { object obj7 = Activator.CreateInstance(inputFieldConfigType); inputFieldConfigType.GetField("restartRequired")?.SetValue(obj7, _setting.restartRequired); object obj8 = Activator.CreateInstance(stringInputFieldOptionType, _setting.configEntry, obj7); try { addOptionMethod.Invoke(null, new object[3] { obj8, pluginGUID, pluginName }); } catch (Exception arg4) { Log.Warning($"[CONFIG] | Failed to add Risk Of Options option for setting '{_setting.token}'.\nException: {arg4}"); } } } private static void GetTypes() { if (!(assembly == null)) { baseOptionType = assembly.GetType("RiskOfOptions.Options.BaseOption"); if (baseOptionType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'BaseOption' could not be found."); } checkBoxOptionType = assembly.GetType("RiskOfOptions.Options.CheckBoxOption"); if (checkBoxOptionType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'CheckBoxOption' could not be found."); } stepSliderOptionType = assembly.GetType("RiskOfOptions.Options.StepSliderOption"); if (stepSliderOptionType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'StepSliderOption' could not be found."); } intSliderOptionType = assembly.GetType("RiskOfOptions.Options.IntSliderOption"); if (intSliderOptionType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'IntSliderOption' could not be found."); } stringInputFieldOptionType = assembly.GetType("RiskOfOptions.Options.StringInputFieldOption"); if (stringInputFieldOptionType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'StringInputFieldOption' could not be found."); } checkBoxConfigType = assembly.GetType("RiskOfOptions.OptionConfigs.CheckBoxConfig"); if (checkBoxConfigType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'CheckBoxConfig' could not be found."); } stepSliderConfigType = assembly.GetType("RiskOfOptions.OptionConfigs.StepSliderConfig"); if (stepSliderConfigType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'StepSliderConfig' could not be found."); } intSliderConfigType = assembly.GetType("RiskOfOptions.OptionConfigs.IntSliderConfig"); if (intSliderConfigType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'IntSliderConfig' could not be found."); } inputFieldConfigType = assembly.GetType("RiskOfOptions.OptionConfigs.InputFieldConfig"); if (inputFieldConfigType == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the type 'InputFieldConfig' could not be found."); } } } private static void GetMethods() { if (!(assembly == null) && !(baseOptionType == null)) { setModIconMethod = assembly.GetType("RiskOfOptions.ModSettingsManager")?.GetMethod("SetModIcon", new Type[1] { typeof(Sprite) }); if (setModIconMethod == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the method 'SetModIcon' could not be found."); } addOptionMethod = assembly.GetType("RiskOfOptions.ModSettingsManager")?.GetMethod("AddOption", new Type[3] { baseOptionType, typeof(string), typeof(string) }); if (addOptionMethod == null) { Log.Warning("[CONFIG] | Risk Of Options was found but the method 'AddOption' could not be found."); } } } } internal class Setting : ISetting { private ConfigFile configFile; private string m_token; public ConfigEntry configEntry; public T defaultValue; private bool m_isStat; private bool m_isClientSide; private bool synced = true; private T syncedValue; private bool m_isRandomised = false; private bool canRandomise = true; private T randomisedValue; private T minValue; private T maxValue; private T randomiserMin; private T randomiserMax; public bool restartRequired; public string valueFormatting; public string token => m_token; public T Value { get { if ((Object)(object)Utils.netUtils != (Object)null && !Utils.hosting && synced && !EqualityComparer.Default.Equals(syncedValue, default(T)) && !isClientSide) { return GetClampedValue(syncedValue); } if (Utils.randomiserMode && isStat && canRandomise) { return GetClampedValue(RandomisedValue); } return GetClampedValue(configEntry.Value); } set { configEntry.Value = value; } } private T RandomisedValue { get { if (!m_isRandomised) { GenerateRandomisedValue(); } return randomisedValue; } } public float stepSliderIncrement { get { if (typeof(T) == typeof(bool) || typeof(T) == typeof(int)) { return 1f; } if (typeof(T) == typeof(float) && !string.IsNullOrEmpty(valueFormatting)) { Match match = Regex.Match(valueFormatting, "{0:0+(\\.(0+))?}"); if (match.Success) { string value = match.Groups[1].Value; int num = ((value.Length > 1) ? (value.Length - 1) : 0); if (1 == 0) { } float result = num switch { 0 => 1f, 1 => 0.1f, 2 => 0.01f, _ => 0.01f, }; if (1 == 0) { } return result; } } return 1f; } } public T sliderMin { get { if (typeof(T) == typeof(bool) || EqualityComparer.Default.Equals(minValue, default(T))) { return (T)Convert.ChangeType(0, typeof(T)); } return minValue; } } public T sliderMax { get { if (typeof(T) == typeof(bool)) { return (T)Convert.ChangeType(0, typeof(T)); } if (EqualityComparer.Default.Equals(maxValue, default(T))) { return (T)Convert.ChangeType(Convert.ToDouble(defaultValue) * 10.0, typeof(T)); } return maxValue; } } public object ValueObject => Value; public bool isDefault => EqualityComparer.Default.Equals(defaultValue, Value); public bool isStat => m_isStat; public bool isClientSide => m_isClientSide; public bool isSynced => synced; public bool isRandomised { get { return m_isRandomised; } set { m_isRandomised = value; } } public Type type => typeof(T); public Setting(ConfigFile _configFile, string _token, string _section, string _key, T _defaultValue, string _description, bool _isStat = true, bool _isClientSide = false, T _minValue = default(T), T _maxValue = default(T), T _randomiserMin = default(T), T _randomiserMax = default(T), bool _canRandomise = true, bool _restartRequired = false, string _valueFormatting = "{0:0}") { configFile = _configFile; m_token = _token; defaultValue = _defaultValue; minValue = _minValue; maxValue = _maxValue; randomiserMin = _randomiserMin; randomiserMax = _randomiserMax; if (!EqualityComparer.Default.Equals(minValue, default(T))) { _description += $"\nMin value: {minValue}"; } if (!EqualityComparer.Default.Equals(maxValue, default(T))) { _description += $"\nMax value: {maxValue}"; } configEntry = configFile.Bind(_section, _key, _defaultValue, _description); m_isStat = _isStat; m_isClientSide = _isClientSide; canRandomise = _canRandomise; restartRequired = _restartRequired; valueFormatting = _valueFormatting; } public void Sync() { synced = false; if ((Object)(object)Utils.netUtils != (Object)null) { Utils.netUtils.SyncSetting(this); } } public void Delete() { Config.DeleteSetting(token); } public void DeleteFromConfigFile() { configFile.Remove(((ConfigEntryBase)configEntry).Definition); } private void GenerateRandomisedValue() { if (m_isRandomised) { return; } m_isRandomised = true; randomisedValue = defaultValue; if (!isStat) { return; } float num = ((Random.Range(0, 2) == 0) ? Random.Range(1f, 2f) : ((Random.Range(0, 2) == 0) ? Random.Range(1f, 5f) : Random.Range(1f, 10f))); if (type == typeof(int)) { float num4; if (!EqualityComparer.Default.Equals(randomiserMin, default(T)) || !EqualityComparer.Default.Equals(randomiserMax, default(T))) { float num2 = Convert.ToSingle(randomiserMin); float num3 = Convert.ToSingle(randomiserMax); num4 = Random.Range(num2, num3); } else { num4 = Convert.ToSingle(randomisedValue); num4 = ((Random.Range(0, 2) != 0) ? (num4 / num) : (num4 * num)); } randomisedValue = (T)(object)Mathf.RoundToInt(num4); } else if (type == typeof(float)) { float num7; if (!EqualityComparer.Default.Equals(randomiserMin, default(T)) || !EqualityComparer.Default.Equals(randomiserMax, default(T))) { float num5 = (float)(object)randomiserMin; float num6 = (float)(object)randomiserMax; num7 = Random.Range(num5, num6); } else { num7 = (float)(object)randomisedValue; num7 = ((Random.Range(0, 2) != 0) ? (num7 / num) : (num7 * num)); } num7 = ((num7 >= 100f) ? (Mathf.Round(num7 / 25f) * 25f) : ((num7 >= 10f) ? (Mathf.Round(num7 / 5f) * 5f) : ((num7 >= 5f) ? (Mathf.Round(num7 * 2f) / 2f) : ((!(num7 >= 1f)) ? (Mathf.Round(num7 * 20f) / 20f) : (Mathf.Round(num7 * 4f) / 4f))))); randomisedValue = (T)(object)num7; } } public SettingData GetSettingData() { return new SettingData(this); } public T GetClampedValue(T _originalValue) { if (type == typeof(int)) { int num = Mathf.Clamp((int)(object)_originalValue, EqualityComparer.Default.Equals(minValue, default(T)) ? int.MinValue : ((int)(object)minValue), EqualityComparer.Default.Equals(maxValue, default(T)) ? int.MaxValue : ((int)(object)maxValue)); return (T)(object)num; } if (type == typeof(float)) { float num2 = Mathf.Clamp((float)(object)_originalValue, EqualityComparer.Default.Equals(minValue, default(T)) ? float.MinValue : ((float)(object)minValue), EqualityComparer.Default.Equals(maxValue, default(T)) ? float.MaxValue : ((float)(object)maxValue)); return (T)(object)num2; } return _originalValue; } public void SetSyncedValue(SettingData _settingData) { if (!synced) { synced = true; if (type == typeof(bool)) { syncedValue = (T)(object)_settingData.boolValue; } else if (type == typeof(int)) { syncedValue = (T)(object)_settingData.intValue; } else if (type == typeof(float)) { syncedValue = (T)(object)_settingData.floatValue; } else { Log.Warning($"[CONFIG] - Could not sync setting '{token}' with type '{type}'."); } } } } public interface ISetting { string token { get; } object ValueObject { get; } bool isDefault { get; } bool isStat { get; } bool isClientSide { get; } bool isSynced { get; } bool isRandomised { get; set; } Type type { get; } void Sync(); void DeleteFromConfigFile(); SettingData GetSettingData(); void SetSyncedValue(SettingData _settingData); } public struct SettingData { public string token; public bool boolValue; public int intValue; public float floatValue; public SettingData(ISetting _setting) { boolValue = false; intValue = 0; floatValue = 0f; token = _setting.token; if (_setting.type == typeof(bool)) { boolValue = (bool)_setting.ValueObject; } else if (_setting.type == typeof(int)) { intValue = (int)_setting.ValueObject; } else if (_setting.type == typeof(float)) { floatValue = (float)_setting.ValueObject; } } } internal class DebugAudioAnalysis : DebugPanel { private DebugToggle logAudioToggle; private DebugToggle displayAudioToggle; public override void Awake() { base.Awake(); logAudioToggle = ((Component)((Component)this).transform.Find("LogAudioToggle")).gameObject.AddComponent(); displayAudioToggle = ((Component)((Component)this).transform.Find("DisplayAudioToggle")).gameObject.AddComponent(); logAudioToggle.Init(OnLogEnable, OnLogDisable); displayAudioToggle.Init(OnDisplayEnable, OnDisplayDisable); } private void OnDisable() { AkSoundEngineDynamicPatcher.logAudio = false; AkSoundEngineDynamicPatcher.analyseAudio = false; logAudioToggle.SetState(_state: false); displayAudioToggle.SetState(_state: false); } private void OnLogEnable() { AkSoundEngineDynamicPatcher.logAudio = true; } private void OnLogDisable() { AkSoundEngineDynamicPatcher.logAudio = false; } private void OnDisplayEnable() { AkSoundEngineDynamicPatcher.analyseAudio = true; } private void OnDisplayDisable() { AkSoundEngineDynamicPatcher.analyseAudio = false; } } internal static class AkSoundEngineDynamicPatcher { private static GameObject audioAnalysisPrefab; public static bool logAudio = false; public static bool analyseAudio = false; private static List audioAnalysisOwnerList = new List(); public static void Init() { audioAnalysisPrefab = Assets.GetObject("DebugAudioInstanceCanvas"); } public static void PatchAll(Harmony _harmony) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown MethodInfo[] methods = typeof(AkSoundEngine).GetMethods(BindingFlags.Static | BindingFlags.Public); MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.Name == "PostEvent") { _harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(AkSoundEngineDynamicPatcher).GetMethod("PostEventPrefix")), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } public static void PostEventPrefix(MethodBase __originalMethod, object[] __args) { if (__args.Length == 2 && __args[0] is string && __args[1] is GameObject) { string eventName = __args[0] as string; object obj = __args[1]; AnalyseAudio(eventName, (GameObject)((obj is GameObject) ? obj : null)); return; } if (__args.Length == 2 && __args[0] is uint && __args[1] is GameObject) { uint eventID = Convert.ToUInt32(__args[0]); object obj2 = __args[1]; AnalyseAudio(eventID, (GameObject)((obj2 is GameObject) ? obj2 : null)); return; } if (__args.Length == 2 && __args[0] is string && __args[1] is ulong) { AnalyseAudio(__args[0] as string, Convert.ToUInt64(__args[1])); return; } string text = ""; ParameterInfo[] parameters = __originalMethod.GetParameters(); foreach (ParameterInfo parameterInfo in parameters) { text = ((!(text == "")) ? (text + ", " + parameterInfo.ParameterType.Name + " " + parameterInfo.Name) : ("Unmanaged PostEvent called with args: " + parameterInfo.ParameterType.Name + " " + parameterInfo.Name)); } Log.Info(text + "."); } private static void AnalyseAudio(string _eventName, GameObject _source) { if (logAudio) { Log.Info("Sound event '" + _eventName + "' playing on game object '" + ((Object)_source).name + "'."); } if (analyseAudio) { CreateAudioAnalysisCanvas("Event Name:\n" + _eventName, _source); } } private static void AnalyseAudio(uint _eventID, GameObject _source) { if (logAudio) { Log.Info($"Sound event with ID {_eventID} playing on game object '{((Object)_source).name}'."); } if (analyseAudio) { CreateAudioAnalysisCanvas($"Event ID:\n{_eventID}", _source); } } private static void AnalyseAudio(string _eventName, ulong _sourceID) { if (logAudio) { Log.Info($"Sound event '{_eventName}' playing on game object with ID {_sourceID}."); } } private static void CreateAudioAnalysisCanvas(string _eventID, GameObject _owner) { if (!((Object)(object)_owner == (Object)null)) { GameObject val = Object.Instantiate(audioAnalysisPrefab); AudioAnalysisCanvas audioAnalysisCanvas = val.AddComponent(); audioAnalysisCanvas.Init(_eventID); GetAudioAnalysisOwner(_owner).AddAudioAnalysis(audioAnalysisCanvas); } } public static void ForgetAudioAnalysisOwner(AudioAnalysisOwner _owner) { audioAnalysisOwnerList.Remove(_owner); } private static AudioAnalysisOwner GetAudioAnalysisOwner(GameObject _owner) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown foreach (AudioAnalysisOwner audioAnalysisOwner2 in audioAnalysisOwnerList) { if ((Object)(object)audioAnalysisOwner2.ownerObject == (Object)(object)_owner) { return audioAnalysisOwner2; } } GameObject val = new GameObject("FaithfulAudioAnalysis"); AudioAnalysisOwner audioAnalysisOwner = val.AddComponent(); audioAnalysisOwner.Init(_owner); return audioAnalysisOwner; } } internal class AudioAnalysisOwner : MonoBehaviour { private Transform mainCameraTransform; private GameObject owner; private List audioAnalysisList = new List(); public GameObject ownerObject => owner; public void Init(GameObject _owner) { owner = _owner; ((Component)this).gameObject.layer = LayerMask.NameToLayer("UI, WorldSpace"); UpdatePosition(); UpdateRotation(); } private void OnDestroy() { AkSoundEngineDynamicPatcher.ForgetAudioAnalysisOwner(this); } private void LateUpdate() { UpdatePosition(); UpdateRotation(); UpdateState(); } private void UpdatePosition() { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)owner != (Object)null) { Vector3 position = owner.transform.position; Vector3 val = ((Component)Camera.main).transform.position - position; float magnitude = ((Vector3)(ref val)).magnitude; ((Component)this).transform.position = position + ((Vector3)(ref val)).normalized * (magnitude - 1f); } } private void UpdateRotation() { if ((Object)(object)mainCameraTransform == (Object)null) { mainCameraTransform = ((Component)Camera.main).transform; } if (!((Object)(object)mainCameraTransform == (Object)null)) { ((Component)this).transform.LookAt(mainCameraTransform); ((Component)this).transform.Rotate(0f, 180f, 0f); } } private void UpdateState() { if ((Object)(object)owner == (Object)null || audioAnalysisList.Count == 0) { Object.Destroy((Object)(object)((Component)this).gameObject); } } public void AddAudioAnalysis(AudioAnalysisCanvas _audioAnalysis) { audioAnalysisList.Add(_audioAnalysis); _audioAnalysis.PassOwner(this); } public void ForgetAudioAnalysis(AudioAnalysisCanvas _audioAnalysis) { audioAnalysisList.Remove(_audioAnalysis); } } internal class AudioAnalysisCanvas : MonoBehaviour { private AudioAnalysisOwner audioAnalysisOwner; private TextMeshProUGUI audioText; public void Init(string _audioID) { audioText = Utils.FindChildWithTerm(((Component)this).transform.Find("Panel"), "AudioText").GetComponent(); ((TMP_Text)audioText).text = _audioID; Utils.ApplyFonts(((Component)this).transform); ((MonoBehaviour)this).Invoke("DestroyObject", 4f); } private void Awake() { Utils.SetLayer(((Component)this).gameObject, "UI, WorldSpace"); } private void OnDestroy() { if ((Object)(object)audioAnalysisOwner != (Object)null) { audioAnalysisOwner.ForgetAudioAnalysis(this); } } public void PassOwner(AudioAnalysisOwner _audioAnalysisOwner) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) audioAnalysisOwner = _audioAnalysisOwner; ((Component)this).transform.SetParent(((Component)audioAnalysisOwner).transform); ((Component)this).transform.localPosition = Vector3.zero; ((Component)this).transform.localEulerAngles = Vector3.zero; } private void DestroyObject() { Object.Destroy((Object)(object)((Component)this).gameObject); } } internal class DebugController : MonoBehaviour { public DebugMain debugMain; public DebugStatsMonitor debugStatsMonitor; public DebugSpawnMenu debugSpawnMenu; public DebugStageControls debugStageControls; public DebugGameControls debugGameControls; public DebugObjectAnalysis debugObjectAnalysis; public DebugComponentAnalysis debugComponentAnalysis; public DebugAudioAnalysis debugAudioAnalysis; public CharacterBody localBody => Utils.localPlayerBody; public void Init() { debugMain = ((Component)((Component)this).transform.Find("DebugMainPanel")).gameObject.AddComponent(); debugMain.Init(this, _startOpen: true); debugStatsMonitor = ((Component)((Component)this).transform.Find("DebugStatsPanel")).gameObject.AddComponent(); debugStatsMonitor.Init(this); debugSpawnMenu = ((Component)((Component)this).transform.Find("DebugSpawnPanel")).gameObject.AddComponent(); debugSpawnMenu.Init(this); debugStageControls = ((Component)((Component)this).transform.Find("DebugStagePanel")).gameObject.AddComponent(); debugStageControls.Init(this); debugGameControls = ((Component)((Component)this).transform.Find("DebugGamePanel")).gameObject.AddComponent(); debugGameControls.Init(this); debugAudioAnalysis = ((Component)((Component)this).transform.Find("DebugAudioPanel")).gameObject.AddComponent(); debugAudioAnalysis.Init(this); debugObjectAnalysis = ((Component)((Component)this).transform.Find("DebugObjectAnalysisPanel")).gameObject.AddComponent(); debugObjectAnalysis.Init(this); debugComponentAnalysis = ((Component)((Component)this).transform.Find("DebugComponentAnalysisPanel")).gameObject.AddComponent(); debugComponentAnalysis.Init(this); debugObjectAnalysis.AssignComponentAnalyser(debugComponentAnalysis); debugComponentAnalysis.AssignObjectAnalyser(debugObjectAnalysis); debugMain.CreateToggles(); } } internal class DebugGameControls : DebugPanel { protected TMP_InputField timeScaleInput; public override void Awake() { base.Awake(); timeScaleInput = ((Component)((Component)this).transform.Find("TimeScaleInputField")).gameObject.GetComponent(); ((UnityEvent)(object)timeScaleInput.onValueChanged).AddListener((UnityAction)OnTimeScaleChanged); } private void OnTimeScaleChanged(string _newTimeScale) { if (float.TryParse(_newTimeScale, out var result)) { Time.timeScale = result; Log.Debug($"[DEBUG MENU] | Changed time scale to: {result}."); } } } internal class DebugMain : DebugPanel { public override void Awake() { base.Awake(); } public void CreateToggles() { DebugPanelToggle debugPanelToggle = ((Component)((Component)this).transform.Find("StatsMonitorToggle")).gameObject.AddComponent(); debugPanelToggle.Init(debugController.debugStatsMonitor); DebugPanelToggle debugPanelToggle2 = ((Component)((Component)this).transform.Find("SpawnMenuToggle")).gameObject.AddComponent(); debugPanelToggle2.Init(debugController.debugSpawnMenu); DebugPanelToggle debugPanelToggle3 = ((Component)((Component)this).transform.Find("StageControlsToggle")).gameObject.AddComponent(); debugPanelToggle3.Init(debugController.debugStageControls); DebugPanelToggle debugPanelToggle4 = ((Component)((Component)this).transform.Find("GameControlsToggle")).gameObject.AddComponent(); debugPanelToggle4.Init(debugController.debugGameControls); DebugPanelToggle debugPanelToggle5 = ((Component)((Component)this).transform.Find("ObjectAnalysisToggle")).gameObject.AddComponent(); debugPanelToggle5.Init(debugController.debugObjectAnalysis); DebugPanelToggle debugPanelToggle6 = ((Component)((Component)this).transform.Find("AudioAnalysisToggle")).gameObject.AddComponent(); debugPanelToggle6.Init(debugController.debugAudioAnalysis); } } internal class DebugMode { protected GameObject ui; public DebugMode() { HookBehaviours(); } public void Update() { //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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_0177: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) if (!Utils.debugMode) { return; } if (Input.GetKeyDown((KeyCode)284)) { ToggleUI(); } if (!Utils.hosting || (!Input.GetKey((KeyCode)282) && !Input.GetKey((KeyCode)286))) { return; } bool key = Input.GetKey((KeyCode)286); bool flag = false; PickupIndex pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)0); if (Input.GetKeyDown((KeyCode)49)) { flag = true; } else if (Input.GetKeyDown((KeyCode)50)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)1); } else if (Input.GetKeyDown((KeyCode)51)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)2); } else if (Input.GetKeyDown((KeyCode)52)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)4); } else if (Input.GetKeyDown((KeyCode)53)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)3); } else if (Input.GetKeyDown((KeyCode)54)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)6); } else if (Input.GetKeyDown((KeyCode)55)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)7); } else if (Input.GetKeyDown((KeyCode)56)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)8); } else if (Input.GetKeyDown((KeyCode)57)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex((ItemTier)9); } else if (Input.GetKeyDown((KeyCode)48)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex(EquipmentCatalog.equipmentDefs.Where((EquipmentDef x) => x.nameToken == "EQUIPMENT_COMMANDMISSILE_NAME").FirstOrDefault().equipmentIndex); } else if (Input.GetKeyDown((KeyCode)45)) { flag = true; pickupIndex = PickupCatalog.FindPickupIndex(EquipmentCatalog.equipmentDefs.Where((EquipmentDef x) => x.nameToken == "EQUIPMENT_METEOR_NAME").FirstOrDefault().equipmentIndex); } if (flag) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; if (Utils.verboseConsole) { Log.Debug($"Spawning item at coordinates {transform.position}"); } GameObject val = Object.Instantiate(LegacyResourcesAPI.Load("Prefabs/NetworkedObjects/CommandCube"), transform.position, transform.rotation); PickupIndexNetworker component = val.GetComponent(); UniquePickup networkpickupState = component.NetworkpickupState; networkpickupState.pickupIndex = pickupIndex; networkpickupState.decayValue = (key ? 1f : 0f); component.NetworkpickupState = networkpickupState; val.GetComponent().SetOptionsFromPickupForCommandArtifact(networkpickupState); NetworkServer.Spawn(val); } } private void HookBehaviours() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (Utils.debugMode) { Stage.Start += new hook_Start(OnStageStart); } } private IEnumerator OnStageStart(orig_Start orig, Stage self) { CreateUI(); return orig.Invoke(self); } private void CreateUI() { ui = Object.Instantiate(Assets.GetObject("debugcanvas")); DebugController debugController = ui.AddComponent(); debugController.Init(); ui.SetActive(false); } private void ToggleUI() { ui.SetActive(!ui.activeInHierarchy); } } internal class DebugObjectAnalysis : DebugPanel { private TextMeshProUGUI titleText; private TextMeshProUGUI tagText; private TextMeshProUGUI layerText; private DebugObjectAnalysisParentSection parentSection; private DebugObjectAnalysisStateButtons stateButtons; private DebugObjectAnalysisComponentsSection componentsSection; private DebugObjectAnalysisChildrenSection childrenSection; private DebugObjectAnalysisSearchSection searchSection; private DebugComponentAnalysis componentAnalyser; private GameObject analysedObject; private bool analysing = false; public override void Awake() { base.Awake(); GameObject obj = Utils.FindChildWithTerm(((Component)this).transform, "PanelTitle"); titleText = ((obj != null) ? obj.GetComponent() : null); tagText = Utils.FindChildWithTerm(((Component)this).transform, "TagTitle").GetComponent(); layerText = Utils.FindChildWithTerm(((Component)this).transform, "LayerTitle").GetComponent(); parentSection = ((Component)((Component)this).transform.Find("ParentSection")).gameObject.AddComponent(); parentSection.Init(this); stateButtons = ((Component)this).gameObject.AddComponent(); stateButtons.Init(this); componentsSection = ((Component)((Component)this).transform.Find("ComponentsSection")).gameObject.AddComponent(); componentsSection.Init(this); childrenSection = ((Component)((Component)this).transform.Find("ChildrenSection")).gameObject.AddComponent(); childrenSection.Init(this); searchSection = ((Component)((Component)this).transform.Find("SearchSection")).gameObject.AddComponent(); searchSection.Init(this); AnalyseObject(); } public void AssignComponentAnalyser(DebugComponentAnalysis _componentAnalyser) { componentAnalyser = _componentAnalyser; } private void OnEnable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PingerController.AttemptPing += new hook_AttemptPing(OnAttemptPing); } private void OnDisable() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PingerController.AttemptPing -= new hook_AttemptPing(OnAttemptPing); } private void FixedUpdate() { if (analysing && (Object)(object)analysedObject == (Object)null) { AnalyseObject(); } } public override void OnMinimise() { base.OnMinimise(); AnalyseObject(); } public override void OnMaximise() { base.OnMaximise(); AnalyseObject(); } public void AnalyseObject(GameObject _object = null) { if (minimised) { _object = null; } analysedObject = _object; if ((Object)(object)analysedObject == (Object)null) { ((TMP_Text)titleText).text = "Object Analysis"; ((TMP_Text)tagText).text = "Tag: None"; ((TMP_Text)layerText).text = "Layer: None"; analysing = false; ((Component)tagText).gameObject.SetActive(false); ((Component)layerText).gameObject.SetActive(false); ((Component)parentSection).gameObject.SetActive(false); ((Component)componentsSection).gameObject.SetActive(false); ((Component)childrenSection).gameObject.SetActive(false); ((Component)searchSection).gameObject.SetActive(!minimised); } else { ((TMP_Text)titleText).text = "Analysing '" + ((Object)analysedObject).name + "'"; ((TMP_Text)tagText).text = "Tag: " + analysedObject.tag; ((TMP_Text)layerText).text = "Layer: " + LayerMask.LayerToName(analysedObject.layer); analysing = true; ((Component)tagText).gameObject.SetActive(!minimised); ((Component)layerText).gameObject.SetActive(!minimised); ((Component)parentSection).gameObject.SetActive(!minimised); ((Component)componentsSection).gameObject.SetActive(!minimised); ((Component)childrenSection).gameObject.SetActive(!minimised); ((Component)searchSection).gameObject.SetActive(false); } parentSection.AnalyseObject(analysedObject); stateButtons.AnalyseObject(analysedObject); componentsSection.AnalyseObject(analysedObject); childrenSection.AnalyseObject(analysedObject); } public void RefreshAnalysedObject() { AnalyseObject(analysedObject); } public void AnalyseComponent(object _component, List _lookupTree = null) { componentAnalyser.Open(); componentAnalyser.Maximise(); componentAnalyser.AnalyseComponent(_component, _lookupTree); } private void OnAttemptPing(orig_AttemptPing orig, PingerController self, Ray aimRay, GameObject bodyObject) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_017a: Unknown result type (might be due to invalid IL or missing references) float num = default(float); aimRay = CameraRigController.ModifyAimRayIfApplicable(aimRay, bodyObject, ref num); float num2 = 1000f + num; bool flag = false; RaycastHit val = default(RaycastHit); if (Util.CharacterRaycast(bodyObject, aimRay, ref val, num2, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)), (QueryTriggerInteraction)0)) { HurtBox component = ((Component)((RaycastHit)(ref val)).collider).GetComponent(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent)) { AnalyseObject(((Component)component.healthComponent.body).gameObject); flag = true; } } if (!flag && Util.CharacterRaycast(bodyObject, aimRay, ref val, num2, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(CommonMasks.characterBodiesOrDefault) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.pickups)).mask)), (QueryTriggerInteraction)2)) { GameObject val2 = ((Component)((RaycastHit)(ref val)).collider).gameObject; NetworkIdentity componentInParent = val2.GetComponentInParent(); ForcePingable component2 = val2.GetComponent(); if (!Object.op_Implicit((Object)(object)componentInParent) && ((Object)(object)component2 == (Object)null || !component2.bypassEntityLocator)) { Transform parent = val2.transform.parent; EntityLocator val3 = (Object.op_Implicit((Object)(object)parent) ? ((Component)parent).GetComponentInChildren() : val2.GetComponent()); if (Object.op_Implicit((Object)(object)val3)) { val2 = val3.entity; } } AnalyseObject(val2); } orig.Invoke(self, aimRay, bodyObject); } } internal class DebugComponentAnalysis : DebugPanel { private DebugObjectAnalysis objectAnalysis; private TextMeshProUGUI titleText; private TextMeshProUGUI namespaceText; private TextMeshProUGUI ownerText; private DebugComponentAnalysisStateButtons stateButtons; private DebugComponentAnalysisMethodsSection methodsSection; private DebugComponentAnalysisAttributesSection attributesSection; private object analysedComponent; private bool analysing = false; private List lookupTree = new List(); public override void Awake() { base.Awake(); GameObject obj = Utils.FindChildWithTerm(((Component)this).transform, "PanelTitle"); titleText = ((obj != null) ? obj.GetComponent() : null); namespaceText = Utils.FindChildWithTerm(((Component)this).transform, "NamespaceTitle").GetComponent(); ownerText = Utils.FindChildWithTerm(((Component)this).transform, "OwnerTitle").GetComponent(); stateButtons = ((Component)this).gameObject.AddComponent(); stateButtons.Init(this); methodsSection = ((Component)((Component)this).transform.Find("MethodsSection")).gameObject.AddComponent(); attributesSection = ((Component)((Component)this).transform.Find("AttributesSection")).gameObject.AddComponent(); AnalyseComponent(); } private void FixedUpdate() { if (analysing && (analysedComponent == null || analysedComponent == null || analysedComponent.Equals(null) || (lookupTree.Count > 0 && lookupTree[0].GetValue() == null))) { AnalyseComponent(); objectAnalysis.RefreshAnalysedObject(); } } public void AssignObjectAnalyser(DebugObjectAnalysis _objectAnalysis) { objectAnalysis = _objectAnalysis; methodsSection.Init(objectAnalysis); attributesSection.Init(objectAnalysis); } public override void OnMinimise() { base.OnMinimise(); AnalyseComponent(); } public override void OnMaximise() { base.OnMaximise(); AnalyseComponent(); } public void AnalyseComponent(object _component = null, List _lookupTree = null) { if (_lookupTree != null) { lookupTree = _lookupTree; } else { lookupTree.Clear(); } if (minimised) { _component = null; } bool flag = _component is Component; analysedComponent = _component; if (analysedComponent == null || analysedComponent == null || analysedComponent.Equals(null)) { ((TMP_Text)titleText).text = "Component Analysis"; ((TMP_Text)namespaceText).text = "Namespace: None"; ((TMP_Text)ownerText).text = "Owner: None"; analysing = false; } else { string[] array = analysedComponent.GetType().ToString().Split('.'); ((TMP_Text)titleText).text = "Analysing " + array[^1]; ((TMP_Text)namespaceText).text = ((array.Length > 1) ? ("Namespace: " + string.Join('.', array.Take(array.Length - 1))) : "Namespace: None"); if (flag) { ? val = ownerText; object obj = analysedComponent; ((TMP_Text)val).text = "Owner: '" + ((Object)((Component)((obj is Component) ? obj : null)).gameObject).name + "'"; } else if (_lookupTree != null && _lookupTree.Count > 0) { string[] array2 = _lookupTree[_lookupTree.Count - 1].type.ToString().Split('.'); ((TMP_Text)ownerText).text = "Owner: " + array2[^1]; } else { ((TMP_Text)ownerText).text = "Owner: N/A"; } analysing = true; } stateButtons.AnalyseComponent(analysedComponent); methodsSection.AnalyseComponent(analysedComponent, _lookupTree); attributesSection.AnalyseComponent(analysedComponent, _lookupTree); } public void RefreshAnalysedObject() { objectAnalysis.RefreshAnalysedObject(); } } internal class DebugObjectAnalysisParentSection : MonoBehaviour { private DebugObjectAnalysis analysisBehaviour; private TextMeshProUGUI title; private Button selectParentButton; private GameObject targetParent = null; public void Init(DebugObjectAnalysis _analysisBehaviour) { analysisBehaviour = _analysisBehaviour; } private void Awake() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown title = Utils.FindChildWithTerm(((Component)this).transform, "Title").GetComponent(); selectParentButton = ((Component)((Component)this).transform.Find("SelectParentButton")).GetComponent