Decompiled source of Providirector v1.0.3
Providirector.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Missions.BrotherEncounter; using EntityStates.VoidRaidCrab; using HG.BlendableTypes; using HarmonyLib; using Microsoft.CodeAnalysis; using On.EntityStates.Missions.BrotherEncounter; using On.EntityStates.VoidRaidCrab; using On.RoR2; using On.RoR2.Artifacts; using On.RoR2.Networking; using Providirector.NetworkCommands; using ProvidirectorGame; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Artifacts; using RoR2.CameraModes; using RoR2.CharacterAI; using RoR2.Networking; using RoR2.UI; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("Providirector")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Providirector")] [assembly: AssemblyTitle("Providirector")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Providirector { public class CameraModeDirector : CameraModePlayerBasic { private BlendableVector3 idealLocalCameraPosOverride = BlendableVector3.op_Implicit(new Vector3(0f, 0f, -5f)); public static CameraModeDirector director = new CameraModeDirector { isSpectatorMode = false }; public float cameraDistance { get { return idealLocalCameraPosOverride.value.z; } set { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) idealLocalCameraPosOverride = BlendableVector3.op_Implicit(new Vector3(0f, 0f, value)); } } public override void UpdateInternal(object rawInstanceData, in CameraModeContext context, out UpdateResult result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0036: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_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_011b: 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) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0166: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) InstanceData val = (InstanceData)rawInstanceData; CameraRigController cameraRigController = context.cameraInfo.cameraRigController; CameraTargetParams targetParams = context.targetInfo.targetParams; float fov = context.cameraInfo.baseFov; Quaternion val2 = context.cameraInfo.previousCameraState.rotation; Vector3 position = context.cameraInfo.previousCameraState.position; GameObject firstPersonTarget = null; float num = cameraRigController.baseFov; if (context.targetInfo.isSprinting) { num *= 1.3f; } val.neutralFov = Mathf.SmoothDamp(val.neutralFov, num, ref val.neutralFovVelocity, 0.2f, float.PositiveInfinity, Time.deltaTime); CharacterCameraParamsData basic = CharacterCameraParamsData.basic; basic.fov = BlendableFloat.op_Implicit(val.neutralFov); basic.idealLocalCameraPos.value = idealLocalCameraPosOverride.value; Vector2 val3 = Vector2.zero; if (Object.op_Implicit((Object)(object)targetParams)) { CharacterCameraParamsData.Blend(ref targetParams.currentCameraParamsData, ref basic, 0.5f); fov = basic.fov.value; val3 = targetParams.recoil; } if (basic.isFirstPerson.value) { firstPersonTarget = context.targetInfo.target; } val.minPitch = basic.minPitch.value; val.maxPitch = basic.maxPitch.value; float pitch = val.pitchYaw.pitch; float yaw = val.pitchYaw.yaw; pitch += val3.y; yaw += val3.x; pitch = Mathf.Clamp(pitch, val.minPitch, val.maxPitch); yaw = Mathf.Repeat(yaw, 360f); Vector3 val4 = ((CameraModePlayerBasic)this).CalculateTargetPivotPosition(ref context); if (Object.op_Implicit((Object)(object)context.targetInfo.target)) { val2 = Quaternion.Euler(pitch, yaw, 0f); Vector3 val5 = val4 + val2 * basic.idealLocalCameraPos.value - val4; float magnitude = ((Vector3)(ref val5)).magnitude; new Ray(val4, val5); float num2 = cameraRigController.Raycast(new Ray(val4, val5), magnitude, basic.wallCushion.value - 0.01f); if (val.currentCameraDistance >= num2) { val.currentCameraDistance = num2; val.cameraDistanceVelocity = 0f; } else { val.currentCameraDistance = Mathf.SmoothDamp(val.currentCameraDistance, num2, ref val.cameraDistanceVelocity, 0.5f); } position = val4 + ((Vector3)(ref val5)).normalized * val.currentCameraDistance; } result.cameraState.position = position; result.cameraState.rotation = val2; result.cameraState.fov = fov; result.showSprintParticles = context.targetInfo.isSprinting; result.firstPersonTarget = firstPersonTarget; ((CameraModePlayerBasic)this).UpdateCrosshair(rawInstanceData, ref context, ref result.cameraState, ref val4, ref result.crosshairWorldPosition); } public override void CollectLookInputInternal(object rawInstanceData, in CameraModeContext context, out CollectLookInputResult output) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) _ = context.viewerInfo; float y = Input.mouseScrollDelta.y; cameraDistance = Mathf.Clamp(cameraDistance + y, -100f, -2f); ((CameraModePlayerBasic)this).CollectLookInputInternal(rawInstanceData, ref context, ref output); } public override void ApplyLookInputInternal(object rawInstanceData, in CameraModeContext context, in ApplyLookInputArgs input) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) InstanceData val = (InstanceData)rawInstanceData; ref TargetInfo targetInfo = ref context.targetInfo; float minPitch = val.minPitch; float maxPitch = val.maxPitch; val.pitchYaw.pitch = Mathf.Clamp(val.pitchYaw.pitch - input.lookInput.y, minPitch, maxPitch); val.pitchYaw.yaw += input.lookInput.x; if (Object.op_Implicit((Object)(object)targetInfo.networkedViewAngles) && targetInfo.networkedViewAngles.hasEffectiveAuthority && Object.op_Implicit((Object)(object)targetInfo.networkUser)) { targetInfo.networkedViewAngles.viewAngles = val.pitchYaw; } } } public static class InputManager { public struct ButtonState { public bool down; public bool wasDown; public bool hasPressBeenClaimed; public bool justReleased { get { if (!down) { return wasDown; } return false; } } public bool justPressed { get { if (down) { return !wasDown; } return false; } } public void PushState(bool newState) { hasPressBeenClaimed &= newState; wasDown = down; down = newState; } } public static ButtonState SwapPage; public static ButtonState Slot1; public static ButtonState Slot2; public static ButtonState Slot3; public static ButtonState Slot4; public static ButtonState Slot5; public static ButtonState Slot6; public static ButtonState DebugSpawn; public static ButtonState ToggleAffixCommon; public static ButtonState ToggleAffixRare; public static ButtonState NextTarget; public static ButtonState PrevTarget; public static ButtonState FocusTarget; public static ButtonState BoostTarget; public static ButtonState ToggleHUD; } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class HarmonyPatches { [HarmonyPostfix] [HarmonyPatch(typeof(Run), "participatingPlayerCount")] public static void ParticipatingPlayerCountOverride(ref int __result) { if (Providirector.runIsActive) { __result--; if (__result <= 0) { __result = 1; } } } } [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.DacityP.Providirector", "Providirector", "1.0.2")] public class Providirector : BaseUnityPlugin { private static ConfigEntry<bool> _modEnabled; private static readonly bool _modEnabledfallback = true; private static ConfigEntry<bool> _debugEnabled; private static readonly bool _debugEnabledFallback = false; private static ConfigEntry<bool> _nearestNodeSnap; private static readonly bool _nearestNodeSnapFallback = true; private static ConfigEntry<float> _vanillaCreditScale; private static readonly float _vanillaCreditScaleFallback = 0.85f; private static ConfigEntry<bool> _skipClientVerification; private static readonly bool _skipClientVerificationFallback = true; private static ConfigEntry<float> _directorCredInit; private static ConfigEntry<float> _directorCredGain; private static ConfigEntry<int> _directorWalletInit; private static ConfigEntry<int> _directorWalletGain; private static ConfigEntry<int> _directorSpawnCap; public static bool runIsActive = false; private DirectorSync _currentDirectorConfig; public DebugInfoPanel panel; private static Harmony harmonyInstance; private CharacterMaster currentMaster; private CharacterMaster defaultMaster; private ServerState serverModeDirector; private ClientState clientModeDirector; private CombatSquad currentSquad; private BaseAI currentAI; private GameObject activeServerDirectorObject; private GameObject focusTargetPersistent; private float relockTargetServerTimer; private bool forceScriptEncounterAddControl; private bool currentlyAddingControl; private bool firstControllerAlreadySet; private bool enableFirstPerson; private GameObject activeHud; private ProvidirectorHUD hud; private GameObject activeClientDirectorObject; private HealthBar targetHealthbar; private GameObject spectateTarget; private CharacterMaster clientDefaultMaster; private float newCharacterMasterSpawnGrace; private static readonly Vector3 frontalCamera = new Vector3(0f, 0f, 0f); private CameraParamsOverrideHandle fpHandle; private CharacterCameraParamsData cpData; public static Providirector instance; private static NetworkUser _directorUser; private const short prvdChannel = 12345; private readonly Vector3 rescueShipTriggerZone = new Vector3(303f, -120f, 393f); private readonly Vector3 moonFightTriggerZone = new Vector3(-47f, 524f, -23f); private readonly Vector3 voidlingTriggerZone = new Vector3(-81f, 50f, 82f); private readonly Vector3 defaultZone = new Vector3(0f, -99999f, 0f); private const float gracePeriodLength = 5f; public static bool modEnabled { get { if (_modEnabled != null) { return _modEnabled.Value; } return _modEnabledfallback; } } public static bool debugEnabled { get { if (_debugEnabled != null) { return _debugEnabled.Value; } return _debugEnabledFallback; } } public static bool nearestNodeSnap { get { if (_debugEnabled != null) { return _nearestNodeSnap.Value; } return _nearestNodeSnapFallback; } } public static float vanillaCreditScale { get { if (_vanillaCreditScale != null) { return _vanillaCreditScale.Value; } return _vanillaCreditScaleFallback; } } public static bool skipClientVerification { get { if (_skipClientVerification != null) { return _skipClientVerification.Value; } return _skipClientVerificationFallback; } } public DirectorSync currentDirectorConfig { get { return _currentDirectorConfig; } set { _currentDirectorConfig = value; if (_currentDirectorConfig != null) { if (!_currentDirectorConfig.serverData) { DirectorState.snapToNearestNode = _currentDirectorConfig.snapToNearestNode; return; } DirectorState.baseCreditGain = _currentDirectorConfig.creditInit; DirectorState.creditGainPerLevel = _currentDirectorConfig.creditGain; DirectorState.baseWalletSize = _currentDirectorConfig.walletInit; DirectorState.walletGainPerLevel = _currentDirectorConfig.walletGain; DirectorState.directorSelfSpawnCap = _currentDirectorConfig.spawnCap; } } } private static LocalUser localUser => LocalUserManager.readOnlyLocalUsersList[0]; private CharacterBody currentBody { get { if (Object.op_Implicit((Object)(object)currentMaster)) { return currentMaster.GetBody(); } return null; } } private CameraRigController mainCamera => directorUser?.cameraRigController; private GameObject spectateTargetMaster => spectateTarget.GetComponent<CharacterBody>().masterObject; private static NetworkUser directorUser { get { return _directorUser; } set { _directorUser = value; } } private static bool directorIsLocal { get { if (runIsActive) { return (Object)(object)directorUser == (Object)(object)localUser.currentNetworkUser; } return false; } } private static bool haveControlAuthority => NetworkServer.active; private NetworkConnection serverDirectorConnection => ((NetworkBehaviour)directorUser).connectionToClient; private NetworkConnection localToServerConnection => ((NetworkBehaviour)localUser.currentNetworkUser).connectionToServer; public void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown RoR2Application.isModded = true; ProvidirectorResources.Load(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location)); harmonyInstance = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { SetupRiskOfOptions(); } RunHookSetup(); } private void OnEnable() { instance = this; } private void OnDisable() { instance = null; } private void RunHookSetup() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown Run.onRunDestroyGlobal += Run_onRunDestroyGlobal; RoR2Application.onUpdate += RoR2Application_onUpdate; Stage.onStageStartGlobal += GlobalStageStart; Run.Start += new hook_Start(StartRun); Run.OnServerSceneChanged += new hook_OnServerSceneChanged(Run_OnServerSceneChanged); RunCameraManager.Update += new hook_Update(RunCameraManager_Update); Run.onPlayerFirstCreatedServer += SetupDirectorUser; Run.BeginGameOver += new hook_BeginGameOver(Run_BeginGameOver); CombatDirector.Awake += new hook_Awake(CombatDirector_Awake); MapZone.TryZoneStart += new hook_TryZoneStart(TryInterceptMasterTP); GlobalEventManager.OnPlayerCharacterDeath += new hook_OnPlayerCharacterDeath(PreventDeathCallsIfDirector); VoidRaidGauntletController.Start += new hook_Start(VoidlingReady); VoidRaidGauntletController.OnBeginEncounter += new hook_OnBeginEncounter(SafeBeginEncounter); ScriptedCombatEncounter.BeginEncounter += new hook_BeginEncounter(SCEControlGate); ArenaMissionController.BeginRound += new hook_BeginRound(FieldCardUpdate); ArenaMissionController.EndRound += new hook_EndRound(RoundEndLock); Chat.CCSay += new hook_CCSay(InterpretDirectorCommand); BrotherEncounterPhaseBaseState.OnEnter += new hook_OnEnter(BeginMoonPhase); EncounterFinished.OnEnter += new hook_OnEnter(EncounterFinish); HoldoutZoneController.Start += new hook_Start(MoveToEscapeZone); LocalUser.RebuildControlChain += new hook_RebuildControlChain(DirectorControlChainMod); NetworkManagerSystem.onStartClientGlobal += LogClientMessageHandlers; NetworkManagerSystem.onStartServerGlobal += LogServerMessageHandlers; NetworkManagerSystem.OnClientSceneChanged += new hook_OnClientSceneChanged(SetupSceneChange); CharacterMaster.SpawnBody += new hook_SpawnBody(SpawnBodyClientForced); EscapeDeath.FixedUpdate += new hook_FixedUpdate(EscapeDeath_FixedUpdate); BaseSpinBeamAttackState.OnEnter += new hook_OnEnter(SetVelocityZeroSpin); BaseVacuumAttackState.OnEnter += new hook_OnEnter(SetVelocityZeroVacuum); EscapeDeath.OnExit += new hook_OnExit(SendStartNextDonutMessage); DoppelgangerInvasionManager.CreateDoppelganger += new hook_CreateDoppelganger(DisableDoppelgangerControl); if (harmonyInstance != null) { harmonyInstance.PatchAll(typeof(HarmonyPatches)); } } private void SetupRiskOfOptions() { //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Expected O, but got Unknown //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected O, but got Unknown //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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_0289: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown _modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Mod Enabled", true, "If checked, the mod is enabled and will be started in any multiplayer games where there are 2 or more players, and you are the host."); _nearestNodeSnap = ((BaseUnityPlugin)this).Config.Bind<bool>("Director", "Snap to Terrain", true, "If checked, grounded enemies will snap to nearby terrain when spawned. Otherwise, they will spawn directly in front of the camera, like flying enemies."); _directorCredInit = ((BaseUnityPlugin)this).Config.Bind<float>("Director", "Initial Credit", DirectorState.baseCreditGain, $"The amount of credits gained by the player director per second. Default value is {DirectorState.baseCreditGain}."); _directorCredGain = ((BaseUnityPlugin)this).Config.Bind<float>("Director", "Credit Gain Per Level", DirectorState.creditGainPerLevel, $"The amount credit gain increases with level. Default value is {DirectorState.creditGainPerLevel}."); _directorWalletInit = ((BaseUnityPlugin)this).Config.Bind<int>("Director", "Initial Capacity", (int)DirectorState.baseWalletSize, $"The base maximum capacity of the player director wallet. Default value is {(int)DirectorState.baseWalletSize}."); _directorWalletGain = ((BaseUnityPlugin)this).Config.Bind<int>("Director", "Capacity Gain Per Level", (int)DirectorState.walletGainPerLevel, $"The amount wallet size increases with level. Default value is {(int)DirectorState.walletGainPerLevel}."); _vanillaCreditScale = ((BaseUnityPlugin)this).Config.Bind<float>("Vanilla Config", "Vanilla Director Credit", 0.4f, "How strong the vanilla directors are. Default value is 40%."); _directorSpawnCap = ((BaseUnityPlugin)this).Config.Bind<int>("Director", "Spawn Cap", DirectorState.directorSelfSpawnCap, $"The maximum amount of characters spawnable by the director at any given time. Default value is {DirectorState.directorSelfSpawnCap}"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_modEnabled)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_nearestNodeSnap)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(_directorSpawnCap, new IntSliderConfig { min = 20, max = 80 })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_directorCredInit, new SliderConfig { min = 0f, max = 5f, formatString = "{0:G2}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_directorCredGain, new SliderConfig { min = 0f, max = 3f, formatString = "{0:G2}" })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(_directorWalletInit, new IntSliderConfig { min = 0, max = 100 })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(_directorWalletGain, new IntSliderConfig { min = 0, max = 100 })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_vanillaCreditScale, new SliderConfig { min = 0f, max = 1f, formatString = "{0:P0}" })); } private CharacterBody SpawnBodyClientForced(orig_SpawnBody orig, CharacterMaster self, Vector3 position, Quaternion rotation) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (!runIsActive) { return orig.Invoke(self, position, rotation); } if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'RoR2.CharacterBody RoR2.CharacterMaster::SpawnBody(UnityEngine.Vector3,UnityEngine.Quaternion)' called on client"); return null; } if (Object.op_Implicit((Object)(object)self.bodyInstanceObject)) { Debug.LogError((object)"Character cannot have more than one body at this time."); return null; } if (!Object.op_Implicit((Object)(object)self.bodyPrefab)) { Debug.LogErrorFormat("Attempted to spawn body of character master {0} with no body prefab.", new object[1] { ((Component)self).gameObject }); } if (!Object.op_Implicit((Object)(object)self.bodyPrefab.GetComponent<CharacterBody>())) { Debug.LogErrorFormat("Attempted to spawn body of character master {0} with a body prefab that has no {1} component attached.", new object[2] { ((Component)self).gameObject, typeof(CharacterBody).Name }); } bool flag = Object.op_Implicit((Object)(object)self.bodyPrefab.GetComponent<CharacterDirection>()); GameObject val = Object.Instantiate<GameObject>(self.bodyPrefab, position, flag ? Quaternion.identity : rotation); CharacterBody component = val.GetComponent<CharacterBody>(); component.masterObject = ((Component)self).gameObject; component.teamComponent.teamIndex = self.teamIndex; component.SetLoadoutServer(self.loadout); if (flag) { CharacterDirection component2 = val.GetComponent<CharacterDirection>(); float y = ((Quaternion)(ref rotation)).eulerAngles.y; component2.yaw = y; } NetworkConnection val2 = ((Component)self).GetComponent<NetworkIdentity>().clientAuthorityOwner; bool localPlayerAuthority = ((Component)component).GetComponent<NetworkIdentity>().localPlayerAuthority; if (currentlyAddingControl) { PLog("Current combat encounter is forced to be client-controlled, adding client control to body {0}", component); val2 = (firstControllerAlreadySet ? NetworkServer.connections[0] : ((NetworkBehaviour)directorUser).connectionToClient); } if (val2 != null && localPlayerAuthority) { val2.isReady = true; NetworkServer.SpawnWithClientAuthority(val, val2); } else { NetworkServer.Spawn(val); } self.bodyInstanceObject = val; if (!firstControllerAlreadySet && currentlyAddingControl) { ((Component)component).GetComponent<NetworkIdentity>().localPlayerAuthority = true; AddPlayerControl(self); firstControllerAlreadySet = true; } Run.instance.OnServerCharacterBodySpawned(component); return component; } private void StartRun(orig_Start orig, Run self) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) runIsActive = modEnabled && (NetworkUser.readOnlyInstancesList.Count > 1 || debugEnabled); orig.Invoke(self); if (!runIsActive) { return; } runIsActive = true; if (_modEnabled != null) { DirectorState.baseCreditGain = _directorCredInit.Value; DirectorState.creditGainPerLevel = _directorCredGain.Value; DirectorState.baseWalletSize = _directorWalletInit.Value; DirectorState.walletGainPerLevel = _directorWalletGain.Value; DirectorState.directorSelfSpawnCap = _directorSpawnCap.Value; } object[] array = new object[1]; NetworkPlayerName networkPlayerName = directorUser.GetNetworkPlayerName(); array[0] = ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName(); PLog("Director User is currently set to {0}", array); foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { SendNetMessageSingle(((NetworkBehaviour)readOnlyInstances).connectionToClient, MessageType.GameStart, 1u, (MessageBase)(object)new GameStart { gameobject = ((Component)directorUser).gameObject }); if ((Object)(object)readOnlyInstances == (Object)(object)directorUser) { SendNetMessageSingle(((NetworkBehaviour)readOnlyInstances).connectionToClient, MessageType.DirectorSync, 1u, (MessageBase)(object)new DirectorSync(serverData: true)); } } PLog("Providirector has been set up for this run!"); } private void PreventDeathCallsIfDirector(orig_OnPlayerCharacterDeath orig, GlobalEventManager self, DamageReport damageReport, NetworkUser victimNetworkUser) { if (runIsActive && modEnabled && !((Object)(object)victimNetworkUser == (Object)(object)directorUser)) { orig.Invoke(self, damageReport, victimNetworkUser); } } private void SetupDirectorUser(Run run, PlayerCharacterMasterController generatedPCMC) { NetworkUser networkUser = generatedPCMC.networkUser; if (!modEnabled || (NetworkUser.readOnlyInstancesList.Count <= 1 && !debugEnabled)) { return; } if (!Object.op_Implicit((Object)(object)directorUser)) { directorUser = localUser.currentNetworkUser; } if (!Object.op_Implicit((Object)(object)networkUser.master)) { PLog((LogLevel)4, "No master found on the spawned player!"); } else { if (!modEnabled || (Object)(object)networkUser != (Object)(object)directorUser || !haveControlAuthority) { return; } directorUser = networkUser; defaultMaster = networkUser.master; defaultMaster.bodyPrefab = BodyCatalog.FindBodyPrefab("WispBody"); defaultMaster.godMode = true; defaultMaster.teamIndex = (TeamIndex)0; currentMaster = defaultMaster; currentMaster.inventory.GiveItem(Items.TeleportWhenOob, 1); currentAI = null; Action<CharacterBody> action = delegate(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { PLog((LogLevel)4, "No body object found!"); } else { body.AddBuff(Buffs.Cloak); body.AddBuff(Buffs.Intangible); body.AddBuff(Buffs.Entangle); body.teamComponent.teamIndex = (TeamIndex)0; body.master.preventGameOver = false; PLog("Setup complete!"); } }; defaultMaster.onBodyStart += action; } } private void Run_OnServerSceneChanged(orig_OnServerSceneChanged orig, Run self, string sceneName) { orig.Invoke(self, sceneName); if (runIsActive) { if ((Object)(object)activeServerDirectorObject == (Object)null) { activeServerDirectorObject = Object.Instantiate<GameObject>(ProvidirectorResources.serverDirectorPrefab); serverModeDirector = activeServerDirectorObject.GetComponent<ServerState>(); ((MonoBehaviour)this).Invoke("PostSceneChangeServer", 0.1f); } forceScriptEncounterAddControl = sceneName.Equals("voidraid") || sceneName.Equals("moon2"); enableFirstPerson = sceneName.Equals("voidraid"); currentlyAddingControl = false; focusTargetPersistent = null; if ((Object)(object)currentMaster != (Object)(object)defaultMaster) { DisengagePlayerControl(); } } } private void PostSceneChangeServer() { PLog("Added {0} monstercards server-side.", ServerState.UpdateMonsterSelection()); SendNetMessageSingle(serverDirectorConnection, MessageType.CardSync, 1u, (MessageBase)(object)new CardSync { cardDisplayDatas = SerializeDisplays(ServerState.spawnCardTemplates) }); } private void CombatDirector_Awake(orig_Awake orig, CombatDirector self) { if (runIsActive && haveControlAuthority) { self.creditMultiplier *= vanillaCreditScale; } orig.Invoke(self); } private void AddPlayerControl(CharacterMaster target) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown if (!haveControlAuthority) { PLog("AddPlayerControl called on client. Cancelling."); return; } if ((Object)(object)target == (Object)null || (Object)(object)target == (Object)(object)currentMaster) { PLog((LogLevel)4, "Attempt to switch control onto a nonexistent or already present character!"); return; } if (!Object.op_Implicit((Object)(object)directorUser)) { PLog("Attempt to call AddPlayerControl without established DU"); return; } if (!Object.op_Implicit((Object)(object)defaultMaster)) { PLog((LogLevel)2, "Can't add player control without an established default master to fall back on."); return; } PLog("Attempting to take control of CharacterMaster {0}", new object[1] { ((Object)target).name }); if (Object.op_Implicit((Object)(object)currentMaster)) { DisengagePlayerControl(revertfallback: false); } else { PLog("No currently set master - we can proceed as normal."); } currentMaster = target; target.playerCharacterMasterController = defaultMaster.playerCharacterMasterController; target.playerStatsComponent = defaultMaster.playerStatsComponent; currentAI = ((Component)currentMaster).GetComponent<BaseAI>(); target.preventGameOver = false; Run.instance.userMasters[directorUser.id] = target; AIDisable(); if (Object.op_Implicit((Object)(object)currentAI)) { currentAI.onBodyDiscovered += AIDisable; } target.onBodyDeath.AddListener(new UnityAction(onNewMasterDeath)); target.GetBodyObject(); directorUser.masterObject = ((Component)target).gameObject; ((NetworkBehaviour)directorUser).connectionToClient.isReady = true; target.networkIdentity.localPlayerAuthority = true; target.networkIdentity.AssignClientAuthority(((NetworkBehaviour)directorUser).connectionToClient); newCharacterMasterSpawnGrace = 5f; SendSingleGeneric(((NetworkBehaviour)directorUser).connectionToClient, MessageType.ModeUpdate, (Object)(object)currentMaster == (Object)(object)defaultMaster); SendNetMessageSingle(((NetworkBehaviour)directorUser).connectionToClient, MessageType.NotifyNewMaster, 1u, (MessageBase)(object)new NotifyNewMaster { target = target }); SendSingleGeneric(((NetworkBehaviour)directorUser).connectionToClient, MessageType.FPUpdate, enableFirstPerson); PLog("{0} set as new master.", currentMaster); void onNewMasterDeath() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown PLog("Current Master has died, checking if we should disengage."); if (currentMaster.IsDeadAndOutOfLivesServer()) { currentMaster.onBodyDeath.RemoveListener(new UnityAction(onNewMasterDeath)); DisengagePlayerControl(); } else { PLog("No need to disengage, we have a pending revive."); } } } private IEnumerator SetBodyAuthorityPersistent(GameObject bodyobj) { if (!Object.op_Implicit((Object)(object)bodyobj) || !Object.op_Implicit((Object)(object)bodyobj.GetComponent<CharacterBody>())) { PLog("Body is undefined. Stopping authority set."); yield break; } if (!Object.op_Implicit((Object)(object)directorUser)) { PLog("No currently set network user. Stopping authority set."); yield break; } PLog("Preparing to set body authority..."); NetworkIdentity nid = bodyobj.GetComponent<NetworkIdentity>(); ((NetworkBehaviour)directorUser).connectionToClient.isReady = true; nid.localPlayerAuthority = true; bodyobj.GetComponent<CharacterBody>().master.preventGameOver = false; if (nid.clientAuthorityOwner != null && nid.clientAuthorityOwner != ((NetworkBehaviour)directorUser).connectionToClient) { PLog("Removing current authority from {0}", nid.clientAuthorityOwner); nid.RemoveClientAuthority(nid.clientAuthorityOwner); } while (!nid.AssignClientAuthority(((NetworkBehaviour)directorUser).connectionToClient)) { object[] array = new object[1]; NetworkPlayerName networkPlayerName = directorUser.GetNetworkPlayerName(); array[0] = ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName(); PLog("Failed to assign authority to {0}. Retrying in 1 second...", array); yield return (object)new WaitForSeconds(1f); } bodyobj.GetComponent<CharacterBody>().master.preventGameOver = false; PLog("{0} authority given to {1}", bodyobj, nid.clientAuthorityOwner); } private void DisengagePlayerControl(bool revertfallback = true) { if (!NetworkServer.active) { PLog("DisengagePlayerControl called on client. Cancelling."); return; } PLog("Reverting main player control from {0}...", currentMaster); currentMaster = null; if (!revertfallback) { return; } if (Object.op_Implicit((Object)(object)currentSquad)) { PLog("Swapping to next active master in current squad..."); foreach (CharacterMaster readOnlyMembers in currentSquad.readOnlyMembersList) { if (!readOnlyMembers.IsDeadAndOutOfLivesServer()) { AddPlayerControl(readOnlyMembers); return; } } PLog("No alive candidates. Proceeding."); } PLog("Reverting to default master..."); AddPlayerControl(defaultMaster); } private void AIDisable() { if (!NetworkServer.active) { PLog("AIDisable called on client. Cancelling."); } else if (Object.op_Implicit((Object)(object)currentAI)) { if (Object.op_Implicit((Object)(object)currentBody)) { currentAI.OnBodyLost(currentBody); } ((Behaviour)currentAI).enabled = false; } else { Debug.LogWarning((object)"Warning: No AI component to disable."); } } private void AIDisable(CharacterBody _) { AIDisable(); } private void SCEControlGate(orig_BeginEncounter orig, ScriptedCombatEncounter self) { if (!runIsActive) { orig.Invoke(self); return; } if (forceScriptEncounterAddControl) { currentlyAddingControl = true; firstControllerAlreadySet = false; currentSquad = self.combatSquad; currentSquad.onDefeatedServer += delegate { currentSquad = null; }; } orig.Invoke(self); currentlyAddingControl = false; } private void DirectorControlChainMod(orig_RebuildControlChain orig, LocalUser self) { if (!runIsActive || !directorIsLocal) { orig.Invoke(self); return; } self.cachedMasterObject = null; NetworkUser currentNetworkUser = self.currentNetworkUser; self.cachedMasterObject = ((currentNetworkUser != null) ? currentNetworkUser.masterObject : null); GameObject cachedMasterObject = self.cachedMasterObject; self.cachedMaster = ((cachedMasterObject != null) ? cachedMasterObject.GetComponent<CharacterMaster>() : null); CharacterMaster cachedMaster = self.cachedMaster; self.cachedMasterController = ((cachedMaster != null) ? cachedMaster.playerCharacterMasterController : null); CharacterMaster cachedMaster2 = self.cachedMaster; self.cachedStatsComponent = ((cachedMaster2 != null) ? cachedMaster2.playerStatsComponent : null); CharacterMaster cachedMaster3 = self.cachedMaster; self.cachedBody = ((cachedMaster3 != null) ? cachedMaster3.GetBody() : null); CharacterBody cachedBody = self.cachedBody; self.cachedBodyObject = ((cachedBody != null) ? ((Component)cachedBody).gameObject : null); } private void CameraRigController_Update(orig_Update orig, CameraRigController self) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!Object.op_Implicit((Object)(object)panel) || !((Behaviour)panel).isActiveAndEnabled || self.cameraModeContext.viewerInfo.localUser != localUser) { return; } LocalUser obj = self.cameraModeContext.viewerInfo.localUser; object arg; NetworkPlayerName networkPlayerName; if (obj == null) { arg = null; } else { NetworkUser currentNetworkUser = obj.currentNetworkUser; if (currentNetworkUser == null) { arg = null; } else { networkPlayerName = currentNetworkUser.GetNetworkPlayerName(); arg = ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName(); } } string text = $"CameraRigController (Viewer {arg}) ==============\n"; text += $"Mode {self.cameraMode}\n"; if (Object.op_Implicit((Object)(object)self.cameraModeContext.targetInfo.master)) { string text2 = text; CharacterMaster master = self.cameraModeContext.targetInfo.master; object arg2 = ((NetworkBehaviour)self.cameraModeContext.targetInfo.master).hasAuthority; NetworkUser networkUser = self.cameraModeContext.targetInfo.networkUser; object arg3; if (networkUser == null) { arg3 = null; } else { networkPlayerName = networkUser.GetNetworkPlayerName(); arg3 = ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName(); } text = text2 + $"Target Master: {master} <{arg2}>\nLinked NU: {arg3}\n"; } if (Object.op_Implicit((Object)(object)self.cameraModeContext.targetInfo.networkedViewAngles)) { text += $"P {self.cameraModeContext.targetInfo.networkedViewAngles?.viewAngles.pitch} Y {self.cameraModeContext.targetInfo.networkedViewAngles?.viewAngles.yaw} <{((NetworkBehaviour)self.cameraModeContext.targetInfo.networkedViewAngles).hasAuthority}>\n"; } if (Object.op_Implicit((Object)(object)self.cameraModeContext.targetInfo.body)) { string text3 = text; object[] array = new object[4]; EntityStateMachine component = ((Component)self.cameraModeContext.targetInfo.body).GetComponent<EntityStateMachine>(); object obj2; if (((component != null) ? component.state : null) == null) { obj2 = "Unknown"; } else { EntityStateMachine component2 = ((Component)self.cameraModeContext.targetInfo.body).GetComponent<EntityStateMachine>(); obj2 = ((component2 != null) ? component2.state : null); } array[0] = obj2; array[1] = self.cameraModeContext.targetInfo.body.transform.position; array[2] = self.cameraModeContext.targetInfo.body.transform.rotation; CharacterDirection component3 = ((Component)self.cameraModeContext.targetInfo.body).GetComponent<CharacterDirection>(); array[3] = ((component3 != null) ? new float?(component3.yaw) : null); text = text3 + string.Format("Target Body Data ---\nState - {0}\nPos - {1}\nRotation - {2}\nCharDirectionYaw - {3}\n", array); } if (newCharacterMasterSpawnGrace > 0f) { text += $"[[ GRACE {newCharacterMasterSpawnGrace}s ]]\n"; } if (self.cameraModeContext.viewerInfo.localUser != null) { string text4 = text; object[] array2 = new object[8]; LocalUser obj3 = self.cameraModeContext.viewerInfo.localUser; array2[0] = ((obj3 != null) ? obj3.cachedMasterObject : null); LocalUser obj4 = self.cameraModeContext.viewerInfo.localUser; array2[1] = ((obj4 != null) ? obj4.cachedMasterController : null); LocalUser obj5 = self.cameraModeContext.viewerInfo.localUser; bool? obj6; if (obj5 == null) { obj6 = null; } else { PlayerCharacterMasterController cachedMasterController = obj5.cachedMasterController; obj6 = ((cachedMasterController != null) ? new bool?(((NetworkBehaviour)cachedMasterController).hasAuthority) : null); } array2[2] = obj6; LocalUser obj7 = self.cameraModeContext.viewerInfo.localUser; object obj8; if (obj7 == null) { obj8 = null; } else { PlayerCharacterMasterController cachedMasterController2 = obj7.cachedMasterController; obj8 = ((cachedMasterController2 != null) ? cachedMasterController2.master : null); } array2[3] = obj8; LocalUser obj9 = self.cameraModeContext.viewerInfo.localUser; array2[4] = ((obj9 != null) ? obj9.cachedMaster : null); LocalUser obj10 = self.cameraModeContext.viewerInfo.localUser; bool? obj11; if (obj10 == null) { obj11 = null; } else { CharacterMaster cachedMaster = obj10.cachedMaster; obj11 = ((cachedMaster != null) ? new bool?(((NetworkBehaviour)cachedMaster).hasAuthority) : null); } array2[5] = obj11; LocalUser obj12 = self.cameraModeContext.viewerInfo.localUser; array2[6] = ((obj12 != null) ? obj12.cachedBody : null); LocalUser obj13 = self.cameraModeContext.viewerInfo.localUser; bool? obj14; if (obj13 == null) { obj14 = null; } else { CharacterBody cachedBody = obj13.cachedBody; obj14 = ((cachedBody != null) ? new bool?(((NetworkBehaviour)cachedBody).hasAuthority) : null); } array2[7] = obj14; text = text4 + string.Format("Viewer Local User Data ---\nMasterObj - {0}\nPCMC - {1} <{2}> linked to {3}\nMaster - {4} <{5}>\nBody - {6} <{7}>", array2); } text += "\nAdditional Debug Data ---\n"; text = ((!((Object)(object)PhaseCounter.instance != (Object)null)) ? (text + "Phase N/A") : (text + $"Phase {PhaseCounter.instance.phase}")); panel.SetDebugInfo(text); } private void RunCameraManager_Update(orig_Update orig, RunCameraManager self) { //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) if (!runIsActive || !directorIsLocal) { orig.Invoke(self); return; } bool flag = Object.op_Implicit((Object)(object)Stage.instance); CameraRigController[] cameras = self.cameras; if (flag) { int i = 0; for (int count = CameraRigController.readOnlyInstancesList.Count; i < count; i++) { if (CameraRigController.readOnlyInstancesList[i].suppressPlayerCameras) { return; } } } if (flag) { int num = 0; ReadOnlyCollection<NetworkUser> readOnlyLocalPlayersList = NetworkUser.readOnlyLocalPlayersList; for (int j = 0; j < readOnlyLocalPlayersList.Count; j++) { NetworkUser val = readOnlyLocalPlayersList[j]; CameraRigController val2 = cameras[num]; if (!Object.op_Implicit((Object)(object)val2)) { val2 = (cameras[num] = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/Main Camera")).GetComponent<CameraRigController>()); } val2.viewer = val; val.cameraRigController = val2; GameObject networkUserBodyObject = RunCameraManager.GetNetworkUserBodyObject(val); ForceSpectate val3 = InstanceTracker.FirstOrNull<ForceSpectate>(); if (Object.op_Implicit((Object)(object)val3)) { val2.nextTarget = val3.target; val2.cameraMode = (CameraModeBase)(object)CameraModePlayerBasic.spectator; } else if (Object.op_Implicit((Object)(object)networkUserBodyObject) && (Object)(object)val.master != (Object)(object)clientDefaultMaster) { val2.nextTarget = networkUserBodyObject; val2.cameraMode = (CameraModeBase)(object)CameraModePlayerBasic.playerBasic; } else if (Object.op_Implicit((Object)(object)networkUserBodyObject) && (Object)(object)val.master == (Object)(object)clientDefaultMaster) { val2.nextTarget = spectateTarget; val2.cameraMode = (CameraModeBase)(object)CameraModeDirector.director; } else if (!val2.disableSpectating) { val2.cameraMode = (CameraModeBase)(object)CameraModePlayerBasic.spectator; if (!Object.op_Implicit((Object)(object)val2.target)) { val2.nextTarget = CameraRigControllerSpectateControls.GetNextSpectateGameObject(val, (GameObject)null); } } else { val2.cameraMode = (CameraModeBase)(object)CameraModeNone.instance; } num++; } int num2 = num; for (int k = num; k < cameras.Length; k++) { ref CameraRigController reference = ref cameras[num]; if ((Object)(object)reference != (Object)null) { if (Object.op_Implicit((Object)(object)reference)) { Object.Destroy((Object)(object)((Component)cameras[num]).gameObject); } reference = null; } } Rect[] array = RunCameraManager.screenLayouts[num2]; for (int l = 0; l < num2; l++) { cameras[l].viewport = array[l]; } return; } for (int m = 0; m < cameras.Length; m++) { if (Object.op_Implicit((Object)(object)cameras[m])) { Object.Destroy((Object)(object)((Component)cameras[m]).gameObject); } } } private void SetupSceneChange(orig_OnClientSceneChanged orig, NetworkManagerSystem self, NetworkConnection conn) { orig.Invoke(self, conn); if (!runIsActive) { return; } if (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.MonsterTeamGainsItems)) { DirectorState.monsterInv = MonsterTeamGainsItemsArtifactManager.monsterTeamInventory; } else { DirectorState.monsterInv = null; } if (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.EliteOnly) && Object.op_Implicit((Object)(object)clientModeDirector)) { clientModeDirector.eliteTierIndex = (EliteTierIndex)2; } DirectorState.snapToNearestNode = nearestNodeSnap; DirectorState.eliteTiers = CombatDirector.eliteTiers; if (_modEnabled != null) { DirectorState.baseCreditGain = _directorCredInit.Value; DirectorState.creditGainPerLevel = _directorCredGain.Value; DirectorState.baseWalletSize = _directorWalletInit.Value; DirectorState.walletGainPerLevel = _directorWalletGain.Value; DirectorState.directorSelfSpawnCap = _directorSpawnCap.Value; } if (currentDirectorConfig != null) { if (!currentDirectorConfig.serverData) { DirectorState.snapToNearestNode = currentDirectorConfig.snapToNearestNode; } else { DirectorState.baseCreditGain = currentDirectorConfig.creditInit; DirectorState.creditGainPerLevel = currentDirectorConfig.creditGain; DirectorState.baseWalletSize = currentDirectorConfig.walletInit; DirectorState.walletGainPerLevel = currentDirectorConfig.walletGain; DirectorState.directorSelfSpawnCap = currentDirectorConfig.spawnCap; } } if (directorIsLocal) { if (directorIsLocal && (Object)(object)activeClientDirectorObject == (Object)null) { activeClientDirectorObject = Object.Instantiate<GameObject>(ProvidirectorResources.clientDirectorPrefab); clientModeDirector = activeClientDirectorObject.GetComponent<ClientState>(); clientModeDirector.OnCachedLimitReached += ClientModeDirector_OnCachedLimitReached; } SendNetMessageSingle(((NetworkBehaviour)directorUser).connectionToServer, MessageType.DirectorSync, 1u, (MessageBase)(object)new DirectorSync(serverData: false)); if ((Object)(object)activeHud == (Object)null) { activeHud = Object.Instantiate<GameObject>(ProvidirectorResources.hudPrefab); } } PLog("Attempting HUD afterinit"); TrySetHUD(); } private void ClientModeDirector_OnCachedLimitReached(int obj) { SendSingleGeneric(localToServerConnection, MessageType.CachedCredits, (uint)obj); } public void TrySetHUD() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)activeHud)) { return; } bool flag = true; if (Object.op_Implicit((Object)(object)mainCamera) && Object.op_Implicit((Object)(object)mainCamera.uiCam)) { if (Object.op_Implicit((Object)(object)activeHud)) { activeHud.GetComponent<Canvas>().worldCamera = mainCamera.uiCam; } } else { flag = false; } if (directorIsLocal) { hud = activeHud.GetComponent<ProvidirectorHUD>(); if (Object.op_Implicit((Object)(object)hud)) { hud.clientState = clientModeDirector; targetHealthbar = hud.spectateHealthBar; targetHealthbar.style = ProvidirectorResources.GenerateHBS(); } else { flag = false; } if (Object.op_Implicit((Object)(object)directorUser.master)) { clientDefaultMaster = directorUser.master; } else { flag = false; } } if (!flag) { PLog("HUD Setup incomplete, retrying in 0.5s"); ((MonoBehaviour)this).Invoke("TrySetHUD", 0.5f); } else if (directorIsLocal) { ToggleHUD(state: true); SetBaseUIVisible(value: false); SetFirstPersonClient(state: false); PLog("HUD setup complete"); if (NetworkManager.networkSceneName.Equals("voidraid")) { ((MonoBehaviour)this).StartCoroutine(MoveCollisionAttempt(voidlingTriggerZone, NetworkManager.networkSceneName)); } else if (NetworkManager.networkSceneName.Equals("moon2")) { ((MonoBehaviour)this).StartCoroutine(MoveCollisionAttempt(moonFightTriggerZone, NetworkManager.networkSceneName)); } else { ((MonoBehaviour)this).StartCoroutine(MoveCollisionAttempt(defaultZone, NetworkManager.networkSceneName)); } } } private void SetBaseUIVisible(bool value) { if (Object.op_Implicit((Object)(object)mainCamera) && Object.op_Implicit((Object)(object)mainCamera.hud)) { Transform transform = mainCamera.hud.mainContainer.transform; Transform val = transform.Find("MainUIArea/SpringCanvas/BottomLeftCluster/BarRoots"); Transform val2 = transform.Find("MainUIArea/SpringCanvas/BottomRightCluster"); Transform val3 = transform.Find("NotificationArea"); Transform val4 = transform.Find("MainUIArea/SpringCanvas/BottomCenterCluster"); if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.SetActive(value); } if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).gameObject.SetActive(value); } if (Object.op_Implicit((Object)(object)val3)) { ((Component)val3).gameObject.SetActive(value); } if (Object.op_Implicit((Object)(object)val4)) { ((Component)val4).gameObject.SetActive(value); } } } private void ChangeTarget(bool direction = true) { if (!Object.op_Implicit((Object)(object)clientModeDirector)) { return; } List<CharacterBody> list = new List<CharacterBody>(CharacterBody.readOnlyInstancesList); if (list.Count == 0) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)spectateTarget) ? spectateTarget.GetComponent<CharacterBody>() : null); if (direction) { list.Reverse(); } int num = (Object.op_Implicit((Object)(object)val) ? list.IndexOf(val) : 0); for (int i = num + 1; i < list.Count; i++) { if (IsTargetable(list[i])) { spectateTarget = ((Component)list[i]).gameObject; if (Object.op_Implicit((Object)(object)clientModeDirector)) { clientModeDirector.spectateTarget = spectateTarget; } return; } } for (int j = 0; j <= num; j++) { if (IsTargetable(list[j])) { spectateTarget = ((Component)list[j]).gameObject; if (Object.op_Implicit((Object)(object)clientModeDirector)) { clientModeDirector.spectateTarget = spectateTarget; } break; } } } private void ToggleHUD(bool state) { if (Object.op_Implicit((Object)(object)activeHud)) { activeHud.SetActive(state); } } private IEnumerator SetFirstPersonClient(bool state, float delay = 0f) { if (!runIsActive || !directorIsLocal) { yield break; } while (!Object.op_Implicit((Object)(object)directorUser.GetCurrentBody()) || !Object.op_Implicit((Object)(object)clientDefaultMaster) || !((Object)(object)directorUser.GetCurrentBody() != (Object)(object)clientDefaultMaster.GetBody())) { PLog("Could not find non-default body for DirectorUser. Retrying in 0.1s..."); if (!runIsActive || !directorIsLocal || activeHud.activeSelf) { yield break; } yield return (object)new WaitForSeconds(0.1f); } GameObject bodyObject = ((Component)directorUser.GetCurrentBody()).gameObject; bodyObject.GetComponent<NetworkIdentity>().localPlayerAuthority = true; SendSingleGeneric(((NetworkBehaviour)directorUser).connectionToServer, MessageType.RequestBodyResync, value: true); if (state) { yield return (object)new WaitForSeconds(delay); if (((CameraParamsOverrideHandle)(ref fpHandle)).isValid) { bodyObject.GetComponent<CameraTargetParams>().RemoveParamsOverride(fpHandle, 0.2f); fpHandle = default(CameraParamsOverrideHandle); } cpData = bodyObject.GetComponent<CameraTargetParams>().currentCameraParamsData; cpData.idealLocalCameraPos = BlendableVector3.op_Implicit(frontalCamera); cpData.isFirstPerson = BlendableBool.op_Implicit(true); fpHandle = bodyObject.GetComponent<CameraTargetParams>().AddParamsOverride(new CameraParamsOverrideRequest { cameraParamsData = cpData, priority = 0.5f }, 0.2f); } else if (((CameraParamsOverrideHandle)(ref fpHandle)).isValid) { bodyObject.GetComponent<CameraTargetParams>().RemoveParamsOverride(fpHandle, 0.2f); fpHandle = default(CameraParamsOverrideHandle); } } private IEnumerator MoveCollisionAttempt(Vector3 position, string intendedSceneName) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!runIsActive || !directorIsLocal) { PLog("Run is not active, or the director is not local. Cancelling the move collision attempt."); yield break; } while (!Object.op_Implicit((Object)(object)clientDefaultMaster) || !NetworkManager.networkSceneName.Equals(intendedSceneName) || !Object.op_Implicit((Object)(object)clientDefaultMaster.GetBodyObject()) || Run.instance.livingPlayerCount < NetworkUser.readOnlyInstancesList.Count) { PLog("Cannot move yet. Scene {0}, CDM {1}, Players {2}/{3}", new object[4] { NetworkManager.networkSceneName, ((Object)(object)clientDefaultMaster == (Object)null) ? "null" : ((string)(object)clientDefaultMaster), Run.instance.livingPlayerCount, NetworkUser.readOnlyInstancesList.Count }); yield return (object)new WaitForSeconds(1f); } TeleportHelper.TeleportGameObject(clientDefaultMaster.GetBodyObject(), position); PLog("Moved {0} MoveCollisionAttempt --> {1} (in {2})", clientDefaultMaster, position, NetworkManager.networkSceneName); } private void GlobalStageStart(Stage obj) { if (runIsActive) { string baseSceneName = obj.sceneDef.baseSceneName; if ((baseSceneName.Equals("arena") || baseSceneName.Equals("voidraid")) && Object.op_Implicit((Object)(object)clientModeDirector)) { clientModeDirector.rateModifier = (RateModifier)2; ClientState.spawnableCharacters.Clear(); } } } private void TryInterceptMasterTP(orig_TryZoneStart orig, MapZone self, Collider other) { if (!runIsActive) { orig.Invoke(self, other); return; } CharacterBody component = ((Component)other).GetComponent<CharacterBody>(); CharacterMaster val = ((component != null) ? component.master : null); if (((Object)(object)val == (Object)(object)clientDefaultMaster || (Object)(object)val == (Object)(object)currentMaster) && newCharacterMasterSpawnGrace > 0f) { PLog("Cancelling Zone Start for current master."); } else { orig.Invoke(self, other); } } private void Run_BeginGameOver(orig_BeginGameOver orig, Run self, GameEndingDef gameEndingDef) { if (!debugEnabled || !runIsActive || gameEndingDef.isWin) { orig.Invoke(self, gameEndingDef); if (runIsActive) { Run_onRunDestroyGlobal(self); } } } private void Run_onRunDestroyGlobal(Run obj) { if (Object.op_Implicit((Object)(object)activeHud)) { Object.Destroy((Object)(object)activeHud); } if (Object.op_Implicit((Object)(object)activeServerDirectorObject)) { Object.Destroy((Object)(object)activeServerDirectorObject); } if (Object.op_Implicit((Object)(object)activeClientDirectorObject)) { Object.Destroy((Object)(object)activeClientDirectorObject); } activeClientDirectorObject = null; clientModeDirector = null; activeServerDirectorObject = null; serverModeDirector = null; activeHud = null; runIsActive = false; spectateTarget = null; currentMaster = null; defaultMaster = null; clientDefaultMaster = null; currentDirectorConfig = null; if (Object.op_Implicit((Object)(object)panel)) { Object.Destroy((Object)(object)panel); } panel = null; } private void RoR2Application_onUpdate() { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) if (!runIsActive) { return; } InputManager.SwapPage.PushState(Input.GetKey((KeyCode)32)); InputManager.Slot1.PushState(Input.GetKey((KeyCode)49)); InputManager.Slot2.PushState(Input.GetKey((KeyCode)50)); InputManager.Slot3.PushState(Input.GetKey((KeyCode)51)); InputManager.Slot4.PushState(Input.GetKey((KeyCode)52)); InputManager.Slot5.PushState(Input.GetKey((KeyCode)53)); InputManager.Slot6.PushState(Input.GetKey((KeyCode)54)); InputManager.DebugSpawn.PushState(Input.GetKey((KeyCode)48)); InputManager.BoostTarget.PushState(Input.GetKey((KeyCode)98)); InputManager.ToggleAffixCommon.PushState(Input.GetKey((KeyCode)99)); InputManager.ToggleAffixRare.PushState(Input.GetKey((KeyCode)118)); InputManager.NextTarget.PushState(Input.GetKey((KeyCode)323)); InputManager.PrevTarget.PushState(Input.GetKey((KeyCode)324)); InputManager.FocusTarget.PushState(Input.GetKey((KeyCode)102)); InputManager.ToggleHUD.PushState(Input.GetKey((KeyCode)121)); Vector3 position = Vector3.zero; Quaternion val = Quaternion.identity; if (Object.op_Implicit((Object)(object)directorUser) && Object.op_Implicit((Object)(object)mainCamera)) { position = ((Component)mainCamera.sceneCam).transform.position; val = ((Component)mainCamera.sceneCam).transform.rotation; position += val * new Vector3(0f, 0f, 5f); } if (newCharacterMasterSpawnGrace > 0f) { newCharacterMasterSpawnGrace -= Time.deltaTime; } else { newCharacterMasterSpawnGrace = 0f; } bool flag = RunArtifactManager.instance.IsArtifactEnabled(Artifacts.EliteOnly); if (Object.op_Implicit((Object)(object)serverModeDirector)) { relockTargetServerTimer -= Time.deltaTime; if (relockTargetServerTimer < 0f) { relockTargetServerTimer = 4f; RelockFocus(); } } if ((Object)(object)clientModeDirector == (Object)null) { return; } if ((Object)(object)spectateTarget == (Object)null) { ChangeTarget(); } if ((Object.op_Implicit((Object)(object)localUser.eventSystem) && localUser.eventSystem.isCursorVisible) || !activeHud.activeSelf) { return; } if (InputManager.ToggleAffixRare.down) { clientModeDirector.eliteTierIndex = (EliteTierIndex)3; } else if (InputManager.ToggleAffixCommon.down && !flag) { clientModeDirector.eliteTierIndex = (EliteTierIndex)1; } else if (flag) { clientModeDirector.eliteTierIndex = (EliteTierIndex)2; } else { clientModeDirector.eliteTierIndex = (EliteTierIndex)0; } if (InputManager.NextTarget.justPressed) { ChangeTarget(); } if (InputManager.PrevTarget.justPressed) { ChangeTarget(direction: false); } if (InputManager.SwapPage.justPressed) { PLog("Attempted to swap page to {0}", clientModeDirector.page + 1); ClientState obj = clientModeDirector; int page = obj.page; obj.page = page + 1; } if (InputManager.Slot1.justPressed) { SendSpawnCommand(localToServerConnection, clientModeDirector.GetTrueIndex(0), clientModeDirector.eliteTierIndex, position, val); } if (InputManager.Slot2.justPressed) { SendSpawnCommand(localToServerConnection, clientModeDirector.GetTrueIndex(1), clientModeDirector.eliteTierIndex, position, val); } if (InputManager.Slot3.justPressed) { SendSpawnCommand(localToServerConnection, clientModeDirector.GetTrueIndex(2), clientModeDirector.eliteTierIndex, position, val); } if (InputManager.Slot4.justPressed) { SendSpawnCommand(localToServerConnection, clientModeDirector.GetTrueIndex(3), clientModeDirector.eliteTierIndex, position, val); } if (InputManager.Slot5.justPressed) { SendSpawnCommand(localToServerConnection, clientModeDirector.GetTrueIndex(4), clientModeDirector.eliteTierIndex, position, val); } if (InputManager.Slot6.justPressed) { SendSpawnCommand(localToServerConnection, clientModeDirector.GetTrueIndex(5), clientModeDirector.eliteTierIndex, position, val); } if (InputManager.FocusTarget.justPressed) { CharacterMaster component = spectateTargetMaster.GetComponent<CharacterMaster>(); if (clientModeDirector.ActivateFocus(component)) { SendFocusCommand(localToServerConnection, component); } } if (InputManager.BoostTarget.justPressed) { SendBurstCommand(localToServerConnection); } if (haveControlAuthority) { Object.op_Implicit((Object)(object)directorUser); } } private void RelockFocus() { if ((Object)(object)focusTargetPersistent == (Object)null) { return; } CharacterBody component = focusTargetPersistent.GetComponent<CharacterBody>(); CharacterMaster val = ((component != null) ? component.master : null); if ((Object)(object)val == (Object)null) { return; } foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)2)) { CharacterBody body = teamMember.body; CharacterMaster val2 = ((body != null) ? body.master : null); if (!((Object)(object)val == (Object)(object)val2) && !((Object)(object)val2 == (Object)null)) { BaseAI[] aiComponents = val2.aiComponents; foreach (BaseAI obj in aiComponents) { obj.currentEnemy.gameObject = focusTargetPersistent; obj.enemyAttentionDuration = 10f; } } } } private void LogServerMessageHandlers() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown NetworkServer.RegisterHandler((short)12345, new NetworkMessageDelegate(HandleCommsServer)); PLog("Providirector Server Message Handler registered on channel {0}", (short)12345); } private void LogClientMessageHandlers(NetworkClient client) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown client.RegisterHandler((short)12345, new NetworkMessageDelegate(HandleCommsClient)); PLog("Providirector Client Message Handler registered on channel {0}", (short)12345); } public static MessageSubIdentifier ReadHeader(NetworkReader reader) { return reader.ReadMessage<MessageSubIdentifier>(); } public void HandleCommsClient(NetworkMessage msg) { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) MessageSubIdentifier messageSubIdentifier = ReadHeader(msg.reader); switch (messageSubIdentifier.type) { case MessageType.Handshake: HandleHandshakeClient(msg, messageSubIdentifier); break; case MessageType.Burst: HandleBurstClient(msg, messageSubIdentifier); break; case MessageType.SpawnEnemy: HandleSpawnClient(msg, messageSubIdentifier); break; case MessageType.GameStart: HandleGameStartClient(msg, messageSubIdentifier); break; case MessageType.ModeUpdate: ToggleHUD(messageSubIdentifier.booleanValue); SetBaseUIVisible(!messageSubIdentifier.booleanValue); break; case MessageType.FPUpdate: ((MonoBehaviour)this).StartCoroutine(SetFirstPersonClient(messageSubIdentifier.booleanValue, 5f)); break; case MessageType.DirectorSync: currentDirectorConfig = msg.reader.ReadMessage<DirectorSync>(); break; case MessageType.MovePosition: { MovePosition movePosition = msg.reader.ReadMessage<MovePosition>(); if (directorIsLocal) { ((MonoBehaviour)this).StartCoroutine(MoveCollisionAttempt(movePosition.position, movePosition.intendedSceneName)); } break; } case MessageType.CardSync: { CardSync sync = msg.reader.ReadMessage<CardSync>(); UpdateCards(sync); break; } case MessageType.NotifyNewMaster: { CharacterMaster target = msg.reader.ReadMessage<NotifyNewMaster>().target; clientDefaultMaster.playerCharacterMasterController.master = target; target.playerCharacterMasterController = clientDefaultMaster.playerCharacterMasterController; target.playerStatsComponent = clientDefaultMaster.playerStatsComponent; directorUser.masterObject = ((Component)target).gameObject; newCharacterMasterSpawnGrace = 5f; break; } case MessageType.HandshakeResponse: case MessageType.FocusEnemy: break; } } public void HandleCommsServer(NetworkMessage msg) { //IL_00f7: 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) MessageSubIdentifier messageSubIdentifier = ReadHeader(msg.reader); switch (messageSubIdentifier.type) { case MessageType.HandshakeResponse: HandleHandshakeServer(msg, messageSubIdentifier); break; case MessageType.DirectorSync: currentDirectorConfig = msg.reader.ReadMessage<DirectorSync>(); break; case MessageType.Burst: HandleBurstServer(msg, messageSubIdentifier); break; case MessageType.SpawnEnemy: HandleSpawnServer(msg, messageSubIdentifier); break; case MessageType.FocusEnemy: HandleFocusServer(msg, messageSubIdentifier); break; case MessageType.RequestBodyResync: if (Object.op_Implicit((Object)(object)currentMaster)) { if (Object.op_Implicit((Object)(object)currentMaster.GetBodyObject())) { ((MonoBehaviour)this).StartCoroutine(SetBodyAuthorityPersistent(currentMaster.GetBodyObject())); } currentMaster.onBodyStart += OnBodyFound; } break; case MessageType.VoidRaidOnDeath: { VoidRaidGauntletUpdate voidRaidGauntletUpdate = msg.reader.ReadMessage<VoidRaidGauntletUpdate>(); VoidRaidGauntletController obj2 = VoidRaidGauntletController.instance; if (obj2 != null) { obj2.TryOpenGauntlet(voidRaidGauntletUpdate.position, voidRaidGauntletUpdate.nid); } break; } case MessageType.CachedCredits: if (CombatDirector.instancesList.Count > 0) { float num = 0.4f * (float)messageSubIdentifier.returnValue; CombatDirector obj = CombatDirector.instancesList[0]; obj.monsterCredit += num; PLog("Sent {0} unused monster credits to the first director", num); } break; case MessageType.GameStart: case MessageType.ModeUpdate: case MessageType.FPUpdate: case MessageType.MovePosition: case MessageType.CardSync: case MessageType.NotifyNewMaster: case MessageType.FogSafeZone: break; } void OnBodyFound(CharacterBody c) { ((MonoBehaviour)this).StartCoroutine(SetBodyAuthorityPersistent(((Component)c).gameObject)); c.master.onBodyStart -= OnBodyFound; } } public void HandleGameStartClient(NetworkMessage msg, MessageSubIdentifier _) { GameStart gameStart = msg.ReadMessage<GameStart>(); runIsActive = true; directorUser = gameStart.user; } public void HandleHandshakeClient(NetworkMessage msg, MessageSubIdentifier sid) { if (!NetworkServer.active) { directorUser = ((sid.booleanValue && modEnabled) ? localUser.currentNetworkUser : null); } if (sid.booleanValue) { SendSingleGeneric(msg.conn, MessageType.HandshakeResponse, modEnabled); } } public void HandleHandshakeServer(NetworkMessage msg, MessageSubIdentifier sid) { //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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown NetworkUser val = null; NetworkPlayerName networkPlayerName; foreach (NetworkUser instances in NetworkUser.instancesList) { object[] array = new object[2]; networkPlayerName = instances.GetNetworkPlayerName(); array[0] = ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName(); array[1] = ((NetworkBehaviour)instances).connectionToClient.address; PLog("{0}: {1}", array); if (((NetworkBehaviour)instances).connectionToClient == msg.conn) { object[] array2 = new object[1]; networkPlayerName = instances.GetNetworkPlayerName(); array2[0] = ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName(); PLog("Director identified as {0}", array2); val = instances; break; } } if (sid.booleanValue) { if ((Object)(object)val != (Object)null) { if (Object.op_Implicit((Object)(object)directorUser)) { SendSingleGeneric(((NetworkBehaviour)directorUser).connectionToClient, MessageType.Handshake, value: false); } directorUser = val; SimpleChatMessage val2 = new SimpleChatMessage(); networkPlayerName = directorUser.GetNetworkPlayerName(); val2.baseToken = $"Providirector -- Director response OK, set to {((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName()}"; Chat.SendBroadcastChat((ChatMessageBase)val2); { foreach (NetworkUser instances2 in NetworkUser.instancesList) { if ((Object)(object)instances2 != (Object)(object)directorUser) { SendSingleGeneric(((NetworkBehaviour)instances2).connectionToClient, MessageType.Handshake, value: false); } } return; } } PLog("Error: Cannot find NetworkUser associated with connection {0}", msg.conn.connectionId); } else { PLog("RECEIVE Director Refusal"); if ((Object)(object)val == (Object)(object)directorUser) { directorUser = null; } } } public void HandleSpawnClient(NetworkMessage msg, MessageSubIdentifier _) { SpawnConfirm spawnConfirm = msg.reader.ReadMessage<SpawnConfirm>(); clientModeDirector.DoPurchaseTrigger(spawnConfirm.cost, spawnConfirm.spawned); } public void HandleSpawnServer(NetworkMessage msg, MessageSubIdentifier _) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0042: 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_004e: Unknown result type (might be due to invalid IL or missing references) SpawnEnemy spawnEnemy = msg.reader.ReadMessage<SpawnEnemy>(); if (spawnEnemy != null) { NetworkWriter val = new NetworkWriter(); val.StartMessage((short)12345); val.Write((MessageBase)(object)new MessageSubIdentifier { type = MessageType.SpawnEnemy }); CharacterMaster spawned = default(CharacterMaster); int num = default(int); serverModeDirector.TrySpawn(spawnEnemy.slotIndex, spawnEnemy.position, spawnEnemy.rotation, spawnEnemy.eliteClassIndex, spawnEnemy.enableSnap, ref spawned, ref num); val.Write((MessageBase)(object)new SpawnConfirm { cost = num, spawned = spawned }); val.FinishMessage(); NetworkConnection conn = msg.conn; if (conn != null) { conn.SendWriter(val, 0); } } } public void HandleBurstClient(NetworkMessage _, MessageSubIdentifier sid) { clientModeDirector.DoBurstTrigger(sid.booleanValue); } public void HandleBurstServer(NetworkMessage msg, MessageSubIdentifier _) { SendSingleGeneric(msg.conn, MessageType.Burst, serverModeDirector.ActivateBurst()); } public void HandleFocusServer(NetworkMessage msg, MessageSubIdentifier _) { FocusEnemy focusEnemy = msg.reader.ReadMessage<FocusEnemy>(); if (Object.op_Implicit((Object)(object)focusEnemy.target) && (Object)(object)focusEnemy.target.bodyInstanceObject != (Object)(object)focusTargetPersistent) { focusTargetPersistent = focusEnemy.target.bodyInstanceObject; } else { focusTargetPersistent = null; } RelockFocus(); } private void UpdateCards(CardSync sync) { if (runIsActive && Object.op_Implicit((Object)(object)clientModeDirector)) { ClientState.spawnableCharacters.Clear(); SpawnCardDisplayData[] cardDisplayDatas = sync.cardDisplayDatas; foreach (SpawnCardDisplayData item in cardDisplayDatas) { ClientState.spawnableCharacters.Add(item); } } } public static void SendSingleGeneric(NetworkConnection connection, MessageType subtype, uint value) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown NetworkWriter val = new NetworkWriter(); val.StartMessage((short)12345); val.Write((MessageBase)(object)new MessageSubIdentifier { returnValue = value, type = subtype }); val.FinishMessage(); if (connection != null) { connection.SendWriter(val, 0); } } public static void SendSingleGeneric(NetworkConnection connection, MessageType subtype, bool value) { SendSingleGeneric(connection, subtype, value ? 1u : 0u); } public void SendNetMessageSingle(NetworkConnection connection, MessageType type, uint value, MessageBase message) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown NetworkWriter val = new NetworkWriter(); val.StartMessage((short)12345); val.Write((MessageBase)(object)new MessageSubIdentifier { returnValue = value, type = type }); val.Write(message); val.FinishMessage(); if (connection != null) { connection.SendWriter(val, 0); } } public bool SendSpawnCommand(NetworkConnection connection, int slotIndex, EliteTierIndex eliteClassIndex, Vector3 position, Quaternion rotation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_0059: Unknown result type (might be due to invalid IL or missing references) int num = default(int); if (!clientModeDirector.IsAbleToSpawn(slotIndex, position, rotation, ref num, eliteClassIndex)) { return false; } NetworkWriter val = new NetworkWriter(); val.StartMessage((short)12345); val.Write((MessageBase)(object)new MessageSubIdentifier { type = MessageType.SpawnEnemy }); val.Write((MessageBase)(object)new SpawnEnemy { slotIndex = slotIndex, eliteClassIndex = eliteClassIndex, position = position, rotation = rotation, enableSnap = nearestNodeSnap }); val.FinishMessage(); if (connection != null) { connection.SendWriter(val, 0); } return true; } public void SendBurstCommand(NetworkConnection connection) { if (!clientModeDirector.canBurst) { clientModeDirector.DoBurstTrigger(false); } else { SendSingleGeneric(connection, MessageType.Burst, value: true); } } public void SendFocusCommand(NetworkConnection connection, CharacterMaster target) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if (!((Object)(object)target == (Object)null)) { NetworkWriter val = new NetworkWriter(); val.StartMessage((short)12345); val.Write((MessageBase)(object)new MessageSubIdentifier { type = MessageType.FocusEnemy }); val.Write((MessageBase)(object)new FocusEnemy { target = target }); val.FinishMessage(); if (connection != null) { connection.SendWriter(val, 0); } } } public IEnumerator SendPositionUpdate(Vector3 position, string intendedSceneName, float delay = 0f) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)directorUser) || !haveControlAuthority) { PLog("Unable to send position update as either no directorUser is set or we don't have server permissions"); yield break; } if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } SendNetMessageSingle(((NetworkBehaviour)directorUser).connectionToClient, MessageType.MovePosition, 1u, (MessageBase)(object)new MovePosition { position = position, intendedSceneName = intendedSceneName }); } private void InterpretDirectorCommand(orig_CCSay orig, ConCommandArgs args) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_00a0: 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) orig.Invoke(args); if (!NetworkServer.active || runIsActive || !((Object)(object)args.sender == (Object)(object)localUser.currentNetworkUser)) { return; } string[] array = ((ConCommandArgs)(ref args))[0].Split((char[]?)null, 2); if (!array.FirstOrDefault().Equals("%")) { return; } if (array.Length < 2) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = $"Providirector -- Use '% [name]' to set the director. Default is the host." }); return; } string text = array[1]; NetworkPlayerName networkPlayerName; if (!int.TryParse(text, out var result)) { result = 0; foreach (NetworkUser instances in NetworkUser.instancesList) { networkPlayerName = instances.GetNetworkPlayerName(); if (((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName() == text) { break; } result++; } } if (result >= NetworkUser.instancesList.Count) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = $"Providirector -- Error - player name or NU Index {text} not found" }); return; } NetworkUser val = NetworkUser.instancesList[result]; SendSingleGeneric(((NetworkBehaviour)val).connectionToClient, MessageType.Handshake, value: true); SimpleChatMessage val2 = new SimpleChatMessage(); networkPlayerName = val.GetNetworkPlayerName(); val2.baseToken = $"Providirector -- Sent director request to {((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName()}"; Chat.SendBroadcastChat((ChatMessageBase)val2); } public bool VerifyDirectorSource(NetworkConnection conn) { NetworkUser obj = directorUser; return conn == ((obj != null) ? ((NetworkBehaviour)obj).connectionToClient : null); } public static bool IsTargetable(CharacterBody body) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)body)) { return false; } TeamComponent teamComponent = body.teamComponent; if (!Object.op_Implicit((Object)(object)teamComponent)) { return false; } if ((int)teamComponent.teamIndex != 1 && (int)teamComponent.teamIndex != 4) { if (debugEnabled) { return (int)teamComponent.teamIndex == 2; } return false; } return true; } public static void PLog(LogLevel level, string message, params object[] fmt) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.Log(level, (object)string.Format(message, fmt)); } } public static void PLog(LogLevel level, string message) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.Log(level, (object)message); } } public static void PLog(string message, params object[] fmt) { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.Log((LogLevel)16, (object)string.Format(message, fmt)); } } public static void PLog(string message) { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.Log((LogLevel)16, (object)message); } } private void EncounterFinish(orig_OnEnter orig, EncounterFinished self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)clientModeDirector)) { clientModeDirector.rateModifier = (RateModifier)1; } } private void BeginMoonPhase(orig_OnEnter orig, BrotherEncounterPhaseBaseState self) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (runIsActive) { bool flag = self.phaseControllerChildString != "Phase2"; if (haveControlAuthority) { forceScriptEncounterAddControl = flag; ((MonoBehaviour)this).StartCoroutine(SendPositionUpdate(defaultZone, "moon2")); } if (Object.op_Implicit((Object)(object)clientModeDirector)) { clientModeDirector.rateModifier = (RateModifier)((!flag) ? 1 : 2); } } orig.Invoke(self); } private SpawnCardDisplayData[] SerializeDisplays(IEnumerable<SpawnCard> sclist) { SpawnCardDisplayData[] array = (SpawnCardDisplayData[])(object)new SpawnCardDisplayData[sclist.Count()]; int num = 0; foreach (SpawnCard item in sclist) { array[num] = DirectorState.ExtractDisplayData(item); num++; } return array; } private void FieldCardUpdate(orig_BeginRound orig, ArenaMissionController self) { orig.Invoke(self); if (runIsActive && Object.op_Implicit((Object)(object)directorUser) && Object.op_Implicit((Object)(object)serverModeDirector)) { ServerState.spawnCardTemplates.Clear(); ServerState.spawnCardTemplates.AddRange(ArenaMissionController.instance.activeMonsterCards.Select((DirectorCard x) => x.spawnCard)); DirectorState.monsterInv = ArenaMissionController.instance.inventory; SendNetMessageSingle(serverDirectorConnection, MessageType.CardSync, 1u, (MessageBase)(object)new CardSync { cardDisplayDatas = SerializeDisplays(ServerState.spawnCardTemplates) }); SendSingleGeneric(serverDirectorConnection, MessageType.RateUpdate, 1u); } } private void RoundEndLock(orig_EndRound orig, ArenaMissionController self) { orig.Invoke(self); if (runIsActive && Object.op_Implicit((Object)(object)directorUser)) { ServerState.spawnCardTemplates.Clear(); DirectorState.monsterInv = ArenaMissionController.instance.inventory; SendNetMessageSingle(((NetworkBehaviour)directorUser).connectionToClient, MessageType.CardSync, 0u, (MessageBase)(object)new CardSync { cardDisplayDatas = (SpawnCardDisplayData[])(object)new SpawnCardDisplayData[0] }); SendSingleGeneric(serverDirectorConnection, MessageType.RateUpdate, 2u); } } private void VoidlingReady(orig_Start orig, VoidRaidGauntletController self) { orig.Invoke(self); if (!runIsActive) { return; } if (Object.op_Implicit((Object)(object)clientModeDirector)) { clientModeDirector.rateModifier = (RateModifier)2; } if (!haveControlAuthority) { return; } ScriptedCombatEncounter[] phaseEncounters = self.phaseEncounters; for (int i = 0; i < phaseEncounters.Length; i++) { phaseEncounters[i].onBeginEncounter += delegate { //IL_0003: Unknown result type (might be due to invalid IL or missing references) ((MonoBehaviour)this).StartCoroutine(SendPositionUpdate(defaultZone, "voidraid")); }; } } private void MoveToEscapeZone(orig_Start orig, HoldoutZoneController self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (self.inBoundsObjectiveToken.Equals("OBJECTIVE_MOON_CHARGE_DROPSHIP")) { PLog("EscapeSequence now active."); ((MonoBehaviour)this).StartCoroutine(SendPositionUpdate(rescueShipTriggerZone, "moon2", 3f)); } } private void SetVelocityZeroVacuum(orig_OnEnter orig, BaseVacuumAttackState self) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); RigidbodyMotor rigidbodyMotor = ((EntityState)self).outer.commonComponents.rigidbodyMotor; if (runIsActive && Object.op_Implicit((Object)(object)rigidbodyMotor) && rigidbodyMo
ScriptsAssembly.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using RoR2; using RoR2.Navigation; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] public class DebugInfoPanel : MonoBehaviour { public TextMeshProUGUI debugPanel; public void SetDebugInfo(string s) { ((TMP_Text)debugPanel).text = s; } } public class MouseOverTest : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler { void IPointerEnterHandler.OnPointerEnter(PointerEventData ed) { Debug.LogFormat("Entered {0}", new object[1] { ((Object)((Component)this).gameObject).name }); } void IPointerExitHandler.OnPointerExit(PointerEventData ed) { Debug.LogFormat("Exited {0}", new object[1] { ((Object)((Component)this).gameObject).name }); } } namespace ProvidirectorGame; public class BurstBarController : MonoBehaviour { public Image bar; public string rank; public float value; public float maxValue; public bool invert; public GameObject maximumDisplay; public GameObject maxFlashObject; public TextMeshProUGUI rankText; public TextMeshProUGUI chargeText; public Coroutine overlayHandler; private void Update() { if (invert) { bar.fillAmount = 1f - value / maxValue; } else { bar.fillAmount = value / maxValue; } ((TMP_Text)chargeText).text = $"{value / maxValue:P0}"; if (value >= maxValue) { ((Component)chargeText).gameObject.SetActive(false); GameObject obj = maximumDisplay; if (obj != null) { obj.SetActive(true); } if (overlayHandler == null) { overlayHandler = ((MonoBehaviour)this).StartCoroutine(FlashCoroutine()); } } else { ((Component)chargeText).gameObject.SetActive(true); ((TMP_Text)rankText).text = "Rank " + rank; GameObject obj2 = maximumDisplay; if (obj2 != null) { obj2.SetActive(false); } overlayHandler = null; } } private void OnDestroy() { if (overlayHandler != null) { ((MonoBehaviour)this).StopCoroutine(overlayHandler); } } private IEnumerator FlashCoroutine() { float toggleFlashTimer = 0.333f; float toggleTextTimer = 2f; bool textstate = false; maxFlashObject.SetActive(true); ((TMP_Text)rankText).text = "Ready"; while (value >= maxValue) { toggleFlashTimer -= 0.05f; toggleTextTimer -= 0.05f; if (toggleTextTimer <= 0f) { toggleTextTimer += 2f; textstate = !textstate; ((TMP_Text)rankText).text = (textstate ? ("Rank " + rank) : "Ready"); } if (toggleFlashTimer <= 0f) { toggleFlashTimer += 0.333f; maxFlashObject.SetActive(!maxFlashObject.activeSelf); } yield return (object)new WaitForSeconds(0.05f); } maxFlashObject.SetActive(false); ((TMP_Text)rankText).text = "Rank " + rank; } } public class SpawnCardDisplayData : MessageBase { public string iconName; public string bodyName; public Color bodyColor; public float baseMaxHealth; public float baseDamage; public int price; public override void Serialize(NetworkWriter writer) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) writer.Write(iconName); writer.Write(bodyName); writer.Write(bodyColor); writer.Write(baseMaxHealth); writer.Write(baseDamage); writer.Write(price); } public override void Deserialize(NetworkReader reader) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) iconName = reader.ReadString(); bodyName = reader.ReadString(); bodyColor = reader.ReadColor(); baseMaxHealth = reader.ReadSingle(); baseDamage = reader.ReadSingle(); price = reader.ReadInt32(); } } public enum SpawnFailReason { NoCredits, SpawnLimitReached, ServerSpawnFail } public class ClientState : DirectorState { public enum RateModifier { None, TeleporterBoosted, Locked } public bool isDirty; public float credits; private RateModifier _rateModifier; private int lastInstanceLevel; private EliteTierIndex _eliteTierIndex; protected List<CharacterMaster> spawnedCharacters; public static List<SpawnCardDisplayData> spawnableCharacters = new List<SpawnCardDisplayData>(); private int _page; private GameObject _spectateTarget; private const float focusCooldownLength = 5f; public float focusCooldownTimer; private float cachedCredits; private CharacterMaster _focusTarget; public RateModifier rateModifier { get { return _rateModifier; } set { _rateModifier = value; isDirty = true; } } public EliteTierIndex eliteTierIndex { get { return _eliteTierIndex; } set { _eliteTierIndex = value; isDirty = true; } } public EliteTierDef selectedEliteTier => DirectorState.eliteTiers[(int)eliteTierIndex]; public float creditsPerSecond { get { if (rateModifier != RateModifier.Locked) { return (DirectorState.baseCreditGain + DirectorState.creditGainPerLevel * DirectorState.instanceLevel) * ((rateModifier == RateModifier.TeleporterBoosted) ? 1.6f : 1f) * (float)(Run.instance.participatingPlayerCount + 1) / 2f; } return (float)(-base.maxCredits) / 3.5f; } } public float maxBoostCharge => (int)DirectorState.instanceLevel * 60 + 200; public int page { get { return _page; } set { int num = value % pageMax; if (_page != num) { _page = num; this.OnPageChange?.Invoke(); isDirty = true; } } } public int pageMax => Math.Max(1, (int)Math.Ceiling((float)spawnableCharacters.Count / 6f)); public bool canBurst { get { if (!(burstCharge < 100f)) { return !bursting; } return false; } } public GameObject spectateTarget { get { return _spectateTarget; } set { _spectateTarget = value; isDirty = true; } } public CharacterMaster focusTarget { get { return _focusTarget; } set { _focusTarget = value; isDirty = true; } } public event Action OnBurstCharged; public event Action OnLevelUp; public event Action OnBurstStart; public event Action OnBurstFail; public event Action<float> OnPurchaseSuccess; public event Action<SpawnFailReason> OnPurchaseFail; public event Action OnFocusTarget; public event Action OnPageChange; public event Action<int> OnCachedLimitReached; private void Start() { eliteTierIndex = EliteTierIndex.Normal; spawnedCharacters = new List<CharacterMaster>(); eliteTierIndex = EliteTierIndex.Normal; TeleporterInteraction.onTeleporterBeginChargingGlobal += TeleportBoost; TeleporterInteraction.onTeleporterChargedGlobal += Lock; GlobalEventManager.onClientDamageNotified += ChargeOnDamage; } private void OnDestroy() { TeleporterInteraction.onTeleporterBeginChargingGlobal -= TeleportBoost; TeleporterInteraction.onTeleporterChargedGlobal -= Lock; GlobalEventManager.onClientDamageNotified -= ChargeOnDamage; } public bool ActivateFocus(CharacterMaster c) { if (focusCooldownTimer <= 0f) { if ((Object)(object)c != (Object)(object)focusTarget) { focusTarget = c; } else { focusTarget = null; } focusCooldownTimer = 5f; this.OnFocusTarget?.Invoke(); return true; } return false; } private void Update() { if ((Object)(object)Run.instance == (Object)null) { return; } if (focusCooldownTimer > 0f) { focusCooldownTimer -= Time.deltaTime; } else { focusCooldownTimer = 0f; } if (bursting) { burstCharge -= 6.6666665f * Time.deltaTime; if (burstCharge <= 0f) { burstCharge = 0f; bursting = false; } } else if (rateModifier == RateModifier.Locked && burstCharge > 0f) { burstCharge -= 20f * Time.deltaTime; if (burstCharge <= 0f) { burstCharge = 0f; } } if (lastInstanceLevel != (int)DirectorState.instanceLevel) { this.OnLevelUp?.Invoke(); } lastInstanceLevel = (int)DirectorState.instanceLevel; credits += creditsPerSecond * Time.deltaTime; if (credits > (float)base.maxCredits) { cachedCredits += credits - (float)base.maxCredits; credits = base.maxCredits; if (cachedCredits >= (float)(base.maxCredits / 2)) { this.OnCachedLimitReached?.Invoke((int)cachedCredits); cachedCredits = 0f; } } if (credits < 0f) { credits = 0f; } } public int GetTrueIndex(int i) { return i + page * 6; } public bool IsAbleToSpawn(int index, Vector3 position, Quaternion rotation, out int adjustedCost, EliteTierIndex eliteIndexOverride = EliteTierIndex.Normal) { adjustedCost = -1; if (spawnableCharacters == null) { spawnableCharacters = new List<SpawnCardDisplayData>(); } if (index >= spawnableCharacters.Count || index < 0) { return false; } if (spawnableCharacters[index] == null) { return false; } if (rateModifier == RateModifier.Locked) { return false; } if (eliteIndexOverride == EliteTierIndex.Invalid) { return false; } SpawnCardDisplayData spawnCardDisplayData = spawnableCharacters[index]; float costMultiplier = DirectorState.eliteTiers[(int)eliteIndexOverride].costMultiplier; float num = (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Swarms) ? 0.5f : 1f); float num2 = (float)spawnCardDisplayData.price * costMultiplier * num; if (credits >= num2 && spawnedCharacters.Count < DirectorState.directorSelfSpawnCap) { adjustedCost = (int)num2; credits -= num2; return true; } if (spawnedCharacters.Count >= DirectorState.directorSelfSpawnCap) { this.OnPurchaseFail?.Invoke(SpawnFailReason.SpawnLimitReached); } else { this.OnPurchaseFail?.Invoke(SpawnFailReason.NoCredits); } return false; } private void TeleportBoost(TeleporterInteraction tp) { rateModifier = RateModifier.TeleporterBoosted; isDirty = true; } private void Lock(TeleporterInteraction tp) { rateModifier = RateModifier.Locked; isDirty = true; } public void DoBurstTrigger(bool value) { if (value) { bursting = true; this.OnBurstStart?.Invoke(); } else { this.OnBurstFail?.Invoke(); } } public void DoPurchaseTrigger(float value, CharacterMaster spawned = null) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown if (!(value >= 0f)) { return; } if (Object.op_Implicit((Object)(object)spawned)) { UnityAction HandleCharacterDeath = null; HandleCharacterDeath = (UnityAction)delegate { if ((Object)(object)spawned == (Object)null) { spawnedCharacters.RemoveAll((CharacterMaster master) => (Object)(object)master == (Object)null); } else { spawnedCharacters.Remove(spawned); } CharacterMaster obj = spawned; if (obj != null) { obj.onBodyDeath.RemoveListener(HandleCharacterDeath); } }; spawnedCharacters.Add(spawned); spawned.onBodyDeath.AddListener(HandleCharacterDeath); } this.OnPurchaseSuccess?.Invoke(value); } private void ChargeOnDamage(DamageDealtMessage msg) { if ((Object)(object)msg?.attacker == (Object)null || rateModifier == RateModifier.Locked) { return; } CharacterBody component = msg.attacker.GetComponent<CharacterBody>(); CharacterMaster val = ((component != null) ? component.master : null); GameObject victim = msg.victim; CharacterBody val2 = ((victim != null) ? victim.GetComponent<CharacterBody>() : null); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2) && spawnedCharacters.Contains(val) && burstCharge < 100f && !bursting) { float num = msg.damage / maxBoostCharge * 100f; if (!val2.isPlayerControlled) { num *= 0.333f; } burstCharge += num; if (burstCharge >= 100f) { burstCharge = 100f; this.OnBurstCharged?.Invoke(); } } } } public enum EliteTierIndex { Invalid = -1, Normal, Tier1, Honor1, Tier2 } public abstract class DirectorState : MonoBehaviour { public static float baseCreditGain = 1.5f; public static float creditGainPerLevel = 0.2f; public static float baseWalletSize = 80f; public static float walletGainPerLevel = 20f; public static int directorSelfSpawnCap = 40; public static EliteTierDef[] eliteTiers; public static bool snapToNearestNode; protected static Random rng; public static Inventory monsterInv; protected const float burstLossRate = 6.6666665f; [HideInInspector] public float burstCharge; [HideInInspector] public bool bursting; public static float instanceLevel { get { if (!Object.op_Implicit((Object)(object)Run.instance)) { return 0f; } return Run.instance.ambientLevel; } } public int maxCredits => (int)(baseWalletSize + walletGainPerLevel * (float)(int)instanceLevel); protected static EliteDef GetRandomEliteDef(EliteDef[] pool) { return pool[rng.Next(0, pool.Length)]; } public static SpawnCardDisplayData ExtractDisplayData(SpawnCard card) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)card == (Object)null) { return new SpawnCardDisplayData(); } CharacterMaster component = card.prefab.GetComponent<CharacterMaster>(); CharacterBody component2 = component.bodyPrefab.GetComponent<CharacterBody>(); return new SpawnCardDisplayData { iconName = ((Object)component).name.Replace("Master", "Icon"), bodyName = component2.GetDisplayName(), bodyColor = component2.bodyColor, baseMaxHealth = component2.baseMaxHealth, baseDamage = component2.baseDamage, price = card.directorCreditCost }; } protected static List<SpawnCard> GetNewMonsterSelectionInternal() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) List<SpawnCard> list = new List<SpawnCard>(); list.Clear(); if ((Object)(object)Run.instance == (Object)null || (Object)(object)ClassicStageInfo.instance == (Object)null || ClassicStageInfo.instance.monsterSelection == null || ClassicStageInfo.instance.monsterSelection.choices == null) { Debug.LogWarning((object)"No list of spawncards available!"); return list; } ChoiceInfo<DirectorCard>[] choices = ClassicStageInfo.instance.monsterSelection.choices; for (int i = 0; i < choices.Length; i++) { ChoiceInfo<DirectorCard> val = choices[i]; if (val.value != null) { SpawnCard spawnCard = val.value.spawnCard; if (!((Object)(object)spawnCard == (Object)null)) { list.Add(spawnCard); } } } Debug.LogFormat("Total {0} spawncards have been generated.", new object[1] { list.Count }); list.Sort((SpawnCard a, SpawnCard b) => a.directorCreditCost - b.directorCreditCost); return list; } static DirectorState() { //IL_0037: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown EliteTierDef[] obj = new EliteTierDef[5] { new EliteTierDef { costMultiplier = 1f, eliteTypes = (EliteDef[])(object)new EliteDef[1] }, default(EliteTierDef), default(EliteTierDef), default(EliteTierDef), default(EliteTierDef) }; EliteTierDef val = new EliteTierDef(); val.costMultiplier = 6f; val.eliteTypes = (EliteDef[])(object)new EliteDef[4] { Elites.Lightning, Elites.Ice, Elites.Fire, Elites.Earth }; obj[1] = val; val = new EliteTierDef(); val.costMultiplier = 3f; val.eliteTypes = (EliteDef[])(object)new EliteDef[4] { Elites.LightningHonor, Elites.IceHonor, Elites.FireHonor, Elites.EarthHonor }; obj[2] = val; val = new EliteTierDef(); val.costMultiplier = 36f; val.eliteTypes = (EliteDef[])(object)new EliteDef[2] { Elites.Poison, Elites.Haunted }; obj[3] = val; val = new EliteTierDef(); val.costMultiplier = 6f; val.eliteTypes = (EliteDef[])(object)new EliteDef[1] { Elites.Lunar }; obj[4] = val; eliteTiers = (EliteTierDef[])(object)obj; snapToNearestNode = false; rng = new Random(); } } public class FocusBarController : MonoBehaviour { public Image bar; public float value; public float maxValue; public GameObject maximumDisplay; public TextMeshProUGUI targetText; public TextMeshProUGUI cooldownText; private void Update() { bar.fillAmount = value / maxValue; ((TMP_Text)cooldownText).text = Math.Ceiling(value).ToString(); if (value <= 0f) { GameObject obj = maximumDisplay; if (obj != null) { obj.SetActive(true); } ((Component)cooldownText).gameObject.SetActive(false); } else { GameObject obj2 = maximumDisplay; if (obj2 != null) { obj2.SetActive(false); } ((Component)cooldownText).gameObject.SetActive(true); } } } public class MoneyBarController : MonoBehaviour { public Image bar; public TextMeshProUGUI[] valueTexts; public float value; public float maxValue; private Color _baseColor; public Color baseColor { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return _baseColor; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) _baseColor = value; if (Object.op_Implicit((Object)(object)bar)) { ((Graphic)bar).color = baseColor; } } } private void Start() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) baseColor = ((Graphic)bar).color; } private void Update() { bar.fillAmount = value / maxValue; TextMeshProUGUI[] array = valueTexts; for (int i = 0; i < array.Length; i++) { ((TMP_Text)array[i]).text = $"{(int)value} / {(int)maxValue}"; } } public IEnumerator FlashBar() { bool flash = false; for (int i = 0; i < 10; i++) { if (flash) { ((Graphic)bar).color = Color.white; } else { ((Graphic)bar).color = baseColor; } flash = !flash; yield return (object)new WaitForSeconds(0.05f); } ((Graphic)bar).color = baseColor; } } public class MonsterIcon : MonoBehaviour { public static List<AssetBundle> iconBundles; private static Dictionary<string, Sprite> iconDB; public Image icon; public Image noPurchaseOverlay; public TextMeshProUGUI costtext; public TooltipProvider ttp; private static Color purchaseOKColor = new Color(0.915f, 0.8625f, 0f); private static Color purchaseImpossible = new Color(0.396f, 0.379f, 0.173f); public int purchaseCost = -1; public void SetMonsterInfo(SpawnCardDisplayData data, ClientState clientState) { //IL_019b: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) if (data == null || (Object)(object)clientState == (Object)null) { icon.sprite = null; ((TMP_Text)costtext).text = ""; ((Behaviour)ttp).enabled = false; purchaseCost = -1; return; } EliteTierDef selectedEliteTier = clientState.selectedEliteTier; int num = (int)DirectorState.instanceLevel; float num2 = selectedEliteTier.costMultiplier * (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Swarms) ? 0.5f : 1f); purchaseCost = (int)Math.Floor((float)data.price * num2); ((TMP_Text)costtext).text = "$" + purchaseCost; ((Behaviour)ttp).enabled = true; if (!iconDB.ContainsKey(data.iconName)) { if (!iconDB.ContainsKey("DefaultIcon")) { icon.sprite = null; } else { icon.sprite = iconDB["DefaultIcon"]; } } else { icon.sprite = iconDB[data.iconName]; } ttp.titleToken = $"{data.bodyName} (${purchaseCost})"; ttp.bodyToken = $"{(data.baseMaxHealth + Mathf.Round(data.baseMaxHealth * 0.3f) * (float)(num - 1)) * num2} HP\n{data.baseDamage * (1f + 0.2f * (float)(num - 1)) * num2} Base Damage"; ttp.titleColor = ((data.bodyColor != Color.clear) ? data.bodyColor : Color.gray); } public void UpdatePurchaseableHUD(ClientState state) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (purchaseCost < 0 || (Object)(object)state == (Object)null || state.credits < (float)purchaseCost || state.rateModifier == ClientState.RateModifier.Locked) { ((Behaviour)noPurchaseOverlay).enabled = true; ((Graphic)costtext).color = purchaseImpossible; } else { ((Behaviour)noPurchaseOverlay).enabled = false; ((Graphic)costtext).color = purchaseOKColor; } } public static void AddIconsFromBundle(AssetBundle bundle) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown if (iconDB == null) { iconDB = new Dictionary<string, Sprite>(); } if (iconBundles == null) { iconBundles = new List<AssetBundle>(); } if ((Object)(object)bundle == (Object)null) { return; } iconBundles.Add(bundle); string[] allAssetNames = bundle.GetAllAssetNames(); foreach (string text in allAssetNames) { Object[] array = bundle.LoadAssetWithSubAssets(text, typeof(Sprite)); foreach (Object val in array) { if (val != (Object)null) { iconDB[val.name] = (Sprite)val; Debug.LogFormat("Added icon {0}", new object[1] { val.name }); } } } } } public class ProvidirectorHUD : MonoBehaviour { public MonsterIcon[] monsterIcons; public RectTransform monsterIconCluster; public TextMeshProUGUI notificationText; public MoneyBarController moneyBar; public BurstBarController burstBar; public FocusBarController focusBar; public HealthBar spectateHealthBar; public TextMeshProUGUI spectateNameText; public TextMeshProUGUI pageText; public Image tier1Backlight; public Image tier2Backlight; public Color defaultColor; public Color teleporterColor; public Color lockedColor; private const float notifDuration = 3f; private float notificationTimer; private float mIconLerpProgress = 1f; private ClientState _clientState; private GameObject _spectateTarget; private CharacterMaster _focusTarget; public ClientState clientState { get { return _clientState; } set { if ((Object)(object)clientState != (Object)null && (Object)(object)value != (Object)null) { clientState.OnLevelUp -= HandleLevelUp; clientState.OnPurchaseFail -= NotifySpawnFail; clientState.OnBurstFail -= NotifyBurstNotReady; clientState.OnPageChange -= HandlePageChange; } if ((Object)(object)value != (Object)null) { _clientState = value; clientState.OnLevelUp += HandleLevelUp; clientState.OnPurchaseFail += NotifySpawnFail; clientState.OnBurstFail += NotifyBurstNotReady; clientState.OnPageChange += HandlePageChange; } } } public GameObject spectateTarget { get { return _spectateTarget; } set { _spectateTarget = value; if ((Object)(object)spectateTarget == (Object)null) { ((Behaviour)spectateHealthBar).enabled = false; ((TMP_Text)spectateNameText).text = "---"; } else { ((Behaviour)spectateHealthBar).enabled = true; spectateHealthBar.source = spectateTarget.GetComponent<CharacterBody>().healthComponent; ((TMP_Text)spectateNameText).text = Util.GetBestBodyName(spectateTarget); } } } public CharacterMaster focusTarget { get { return _focusTarget; } set { _focusTarget = value; if ((Object)(object)focusTarget != (Object)null) { CharacterMaster obj = focusTarget; if ((Object)(object)((obj != null) ? obj.GetBodyObject() : null) != (Object)null) { ((TMP_Text)focusBar.targetText).text = Util.GetBestBodyName(focusTarget.GetBodyObject()); return; } } ((TMP_Text)focusBar.targetText).text = "Auto"; } } private void Start() { if (monsterIcons == null) { monsterIcons = new MonsterIcon[6]; } Array.Resize(ref monsterIcons, 6); } private void HandleLevelUp() { ((MonoBehaviour)this).StartCoroutine(moneyBar.FlashBar()); if (DirectorState.instanceLevel >= 99f) { burstBar.rank = "MAX"; } else if (DirectorState.instanceLevel >= 40f) { burstBar.rank = "2"; } else { burstBar.rank = "1"; } } private void HandlePageChange() { mIconLerpProgress = 0f; } private void Notify(string s) { if (s == null || s.Length == 0) { ((TMP_Text)notificationText).text = ""; notificationTimer = 0f; ((Behaviour)notificationText).enabled = false; } else { ((TMP_Text)notificationText).text = s; notificationTimer = 3f; ((Behaviour)notificationText).enabled = true; } } private void NotifySpawnFail(SpawnFailReason s) { switch (s) { case SpawnFailReason.NoCredits: Notify("Not enough money!"); break; case SpawnFailReason.SpawnLimitReached: Notify("Spawn limit reached!"); break; default: Notify("Failed to summon character!"); break; } } private void NotifyBurstNotReady() { Notify("Burst not ready!"); } private void Update() { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)this.clientState == (Object)null) { MonsterIcon[] array = monsterIcons; for (int i = 0; i < array.Length; i++) { array[i].SetMonsterInfo(null, null); } moneyBar.value = 0f; moneyBar.maxValue = 0f; burstBar.value = 0f; return; } ClientState clientState = this.clientState; moneyBar.value = clientState.credits; moneyBar.maxValue = clientState.maxCredits; burstBar.value = clientState.burstCharge; focusBar.value = clientState.focusCooldownTimer; notificationTimer -= Time.deltaTime; if (notificationTimer < 0f) { notificationTimer = 0f; } ((Behaviour)notificationText).enabled = ((Behaviour)notificationText).enabled && notificationTimer > 0f; for (int j = 0; j < 6; j++) { monsterIcons[j].UpdatePurchaseableHUD(clientState); } if (mIconLerpProgress < 1f) { mIconLerpProgress += 4f * Time.deltaTime; if (mIconLerpProgress > 1f) { mIconLerpProgress = 1f; } Vector3 val = Vector2.op_Implicit(monsterIconCluster.anchoredPosition); float num = 1f - (float)Math.Pow(mIconLerpProgress - 1f, 4.0); monsterIconCluster.anchoredPosition = Vector2.op_Implicit(new Vector3(val.x, 100f + num * 50f, val.z)); } if (!clientState.isDirty) { return; } clientState.isDirty = false; ((Behaviour)tier1Backlight).enabled = clientState.eliteTierIndex == EliteTierIndex.Tier1 || clientState.eliteTierIndex == EliteTierIndex.Honor1; ((Behaviour)tier2Backlight).enabled = clientState.eliteTierIndex == EliteTierIndex.Tier2; ((TMP_Text)pageText).text = $"Page {clientState.page + 1}"; switch (clientState.rateModifier) { case ClientState.RateModifier.TeleporterBoosted: moneyBar.baseColor = teleporterColor; break; case ClientState.RateModifier.Locked: moneyBar.baseColor = lockedColor; break; default: moneyBar.baseColor = defaultColor; break; } spectateTarget = clientState.spectateTarget; focusTarget = clientState.focusTarget; if (ClientState.spawnableCharacters == null) { return; } for (int k = 0; k < 6; k++) { int trueIndex = clientState.GetTrueIndex(k); if (trueIndex >= ClientState.spawnableCharacters.Count) { monsterIcons[k].SetMonsterInfo(null, null); } else { monsterIcons[k].SetMonsterInfo(ClientState.spawnableCharacters[trueIndex], clientState); } } } } public class ServerState : DirectorState { public static List<SpawnCard> spawnCardTemplates = new List<SpawnCard>(); public static Dictionary<int, BuffDef> burstBuffRequirements = new Dictionary<int, BuffDef>(); private void Update() { if (!((Object)(object)Run.instance == (Object)null) && bursting) { burstCharge -= 6.6666665f * Time.deltaTime; if (burstCharge <= 0f) { burstCharge = 100f; bursting = false; } } } public bool TrySpawn(int index, Vector3 position, Quaternion rotation, EliteTierIndex eliteTier, bool snappingOverride, out CharacterMaster spawned, out int trueCost) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) spawned = null; trueCost = -1; if (spawnCardTemplates == null) { spawnCardTemplates = new List<SpawnCard>(); } if (index >= spawnCardTemplates.Count || index < 0) { return false; } if ((Object)(object)spawnCardTemplates[index] == (Object)null) { return false; } if (eliteTier == EliteTierIndex.Invalid) { return false; } SpawnCard val = spawnCardTemplates[index]; EliteTierDef val2 = DirectorState.eliteTiers[(int)eliteTier]; float costMultiplier = val2.costMultiplier; float num = (RunArtifactManager.instance.IsArtifactEnabled(Artifacts.Swarms) ? 0.5f : 1f); float num2 = (float)val.directorCreditCost * costMultiplier * num; if ((float)base.maxCredits < num2) { return false; } GameObject prefab = val.prefab; NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph(val.nodeGraphType); if (!Object.op_Implicit((Object)(object)prefab) || (Object)(object)nodeGraph == (Object)null) { return false; } if (snappingOverride && (int)val.nodeGraphType == 0) { NodeIndex val3 = nodeGraph.FindClosestNodeWithFlagConditions(position, val.hullSize, (NodeFlags)0, (NodeFlags)0, false); if (!nodeGraph.GetNodePosition(val3, ref position)) { Debug.LogError((object)"Error: Failed to find valid snapping node. Defaulting to direct spawn."); } else { RaycastHit val4 = default(RaycastHit); Ray val5 = default(Ray); ((Ray)(ref val5))..ctor(position + Vector3.up * 2.5f, Vector3.down); float num3 = 4f; float num4 = 1f; CapsuleCollider component = prefab.GetComponent<CapsuleCollider>(); if (Object.op_Implicit((Object)(object)component)) { num4 = component.radius; } else { SphereCollider component2 = prefab.GetComponent<SphereCollider>(); if (Object.op_Implicit((Object)(object)component2)) { num4 = component2.radius; } } Ray val6 = val5; float num5 = num4; LayerIndex world = LayerIndex.world; if (Physics.SphereCast(val6, num5, ref val4, num3, LayerMask.op_Implicit(((LayerIndex)(ref world)).mask))) { position.y = ((Ray)(ref val5)).origin.y - ((RaycastHit)(ref val4)).distance; } position.y += Util.GetBodyPrefabFootOffset(prefab); } } GameObject obj = Object.Instantiate<GameObject>(prefab, position, rotation); CharacterMaster component3 = obj.GetComponent<CharacterMaster>(); NetworkServer.Spawn(obj); component3.SpawnBody(position, rotation); component3.inventory.GiveItem(Items.UseAmbientLevel, 1); if (val2 != null) { EliteDef randomEliteDef = DirectorState.GetRandomEliteDef(val2.eliteTypes); if ((Object)(object)randomEliteDef != (Object)null) { component3.inventory.SetEquipmentIndex(randomEliteDef.eliteEquipmentDef.equipmentIndex); component3.inventory.GiveItem(Items.BoostHp, Mathf.RoundToInt((randomEliteDef.healthBoostCoefficient - 1f) * 10f)); component3.inventory.GiveItem(Items.BoostDamage, Mathf.RoundToInt(randomEliteDef.damageBoostCoefficient - 1f) * 10); } } if (num != 1f) { component3.inventory.GiveItem(Items.CutHp, 1); } if (Object.op_Implicit((Object)(object)DirectorState.monsterInv)) { component3.inventory.AddItemsFrom(DirectorState.monsterInv); } component3.teamIndex = (TeamIndex)2; component3.GetBody().teamComponent.teamIndex = (TeamIndex)2; DeathRewards component4 = component3.GetBodyObject().GetComponent<DeathRewards>(); if ((Object)(object)component4 != (Object)null) { component4.expReward = (uint)Mathf.Max(1f, num2 * 0.3f * Run.instance.compensatedDifficultyCoefficient); component4.goldReward = (uint)Mathf.Max(1f, num2 * 0.7f * Run.instance.compensatedDifficultyCoefficient); } if (bursting) { AddBurstBuffs(component3.GetBody(), 0.15f * burstCharge); } spawned = component3; trueCost = (int)num2; return true; } public bool ActivateBurst() { bursting = true; foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers((TeamIndex)2)) { AddBurstBuffs(teamMember.body); teamMember.body.AddTimedBuff(Buffs.Energized, 4f); } return true; } public static int UpdateMonsterSelection() { spawnCardTemplates = DirectorState.GetNewMonsterSelectionInternal(); return spawnCardTemplates.Count; } private void AddBurstBuffs(CharacterBody body, float duration = 15f) { if ((int)DirectorState.instanceLevel >= 99) { body.AddTimedBuff(Buffs.ArmorBoost, duration); } if ((int)DirectorState.instanceLevel >= 40) { body.AddTimedBuff(Buffs.PowerBuff, duration); } body.AddTimedBuff(Buffs.TeamWarCry, duration); } }