Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Mortal Kombat v1.1.1
BepInEx/plugins/Omniscye-Empress_MortalKombat/EmpressMortalKombat.dll
Decompiled a day 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.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using REPOLib.Modules; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.6.0")] [assembly: AssemblyInformationalVersion("1.0.6")] [assembly: AssemblyProduct("EmpressMortalKombat")] [assembly: AssemblyTitle("EmpressMortalKombat")] [assembly: AssemblyVersion("1.0.6.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 Empress.REPO.MortalKombat { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.empress.repo.mortalkombat", "Empress Mortal Kombat", "1.0.10")] public sealed class EmpressMortalKombatPlugin : BaseUnityPlugin { public const string PluginGuid = "com.empress.repo.mortalkombat"; public const string PluginName = "Empress Mortal Kombat"; public const string PluginVersion = "1.0.10"; public const string ItemName = "Empress Mortal Kombat"; internal const byte RequestEventCode = 160; internal const byte BeginEventCode = 161; internal const byte PunchEventCode = 162; internal const byte StateEventCode = 163; internal const byte HitEventCode = 164; internal const byte EndEventCode = 165; internal const byte CancelEventCode = 166; internal const byte VoidReturnEventCode = 167; private static bool _photonHooked; private static LoadBalancingClient _hookedClient; private Harmony _harmony; internal static EmpressMortalKombatPlugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } internal static MortalKombatSettings Settings { get; private set; } internal static string PluginDirectory { get; private set; } private void Awake() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); Settings = new MortalKombatSettings(((BaseUnityPlugin)this).Config); ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); MortalKombatAssets.Load(); MortalKombatItemBuilder.RegisterItem(); _harmony = new Harmony("com.empress.repo.mortalkombat"); _harmony.PatchAll(typeof(EmpressMortalKombatPlugin).Assembly); MortalKombatRuntime.EnsureHost(); } private void OnDestroy() { RemovePhotonHook(); } internal static void EnsurePhotonHooked() { LoadBalancingClient networkingClient = PhotonNetwork.NetworkingClient; if (networkingClient != null && (!_photonHooked || _hookedClient != networkingClient)) { if (_hookedClient != null) { _hookedClient.EventReceived -= OnPhotonEvent; } networkingClient.EventReceived -= OnPhotonEvent; networkingClient.EventReceived += OnPhotonEvent; _hookedClient = networkingClient; _photonHooked = true; } } internal static void RemovePhotonHook() { if (_hookedClient != null) { _hookedClient.EventReceived -= OnPhotonEvent; } _hookedClient = null; _photonHooked = false; } private static void OnPhotonEvent(EventData ev) { if (ev.CustomData is object[] data) { Dispatch(ev.Code, data); } } private static void Dispatch(byte code, object[] data) { if (code < 160 || code > 167) { return; } MortalKombatRuntime instance = MortalKombatRuntime.Instance; if ((Object)(object)instance == (Object)null) { return; } try { switch (code) { case 160: instance.ReceiveRequest(data); break; case 161: instance.ReceiveBegin(data); break; case 162: instance.ReceivePunch(data); break; case 163: instance.ReceiveState(data); break; case 164: instance.ReceiveHit(data); break; case 165: instance.ReceiveEnd(data); break; case 166: instance.ReceiveCancel(data); break; case 167: instance.ReceiveVoidReturn(data); break; } } catch (Exception ex) { ManualLogSource log = Log; if (log != null) { log.LogError((object)("Empress Mortal Kombat event " + code + " failed: " + ex.Message)); } } } internal static void RaiseToAll(byte code, object[] data) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonHooked(); if (!PhotonNetwork.InRoom) { Dispatch(code, data); return; } RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)1 }; PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendReliable); } internal static void SendLocalAndOthers(byte code, object[] data) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) EnsurePhotonHooked(); if (PhotonNetwork.InRoom) { RaiseEventOptions val = new RaiseEventOptions { Receivers = (ReceiverGroup)0 }; PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendReliable); } Dispatch(code, data); } } internal sealed class MortalKombatSettings { public readonly ConfigEntry<int> ShopPrice; public readonly ConfigEntry<int> FightHealth; public readonly ConfigEntry<int> PunchDamage; public readonly ConfigEntry<float> FightTime; public readonly ConfigEntry<float> ArenaHeight; public readonly ConfigEntry<float> MusicVolume; public readonly ConfigEntry<float> Volume; public MortalKombatSettings(ConfigFile config) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown ShopPrice = config.Bind<int>("Kombat", "ShopPrice", 25, new ConfigDescription("In game shop price in thousands. 25 means 25K on the shelf.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 500), Array.Empty<object>())); FightHealth = config.Bind<int>("Kombat", "FightHealth", 100, new ConfigDescription("Fight health for each kombatant.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(20, 500), Array.Empty<object>())); PunchDamage = config.Bind<int>("Kombat", "PunchDamage", 9, new ConfigDescription("Damage per landed punch.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); FightTime = config.Bind<float>("Kombat", "FightTime", 99f, new ConfigDescription("Round timer in seconds. Highest health wins on timeout.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 300f), Array.Empty<object>())); ArenaHeight = config.Bind<float>("Kombat", "ArenaHeight", 260f, new ConfigDescription("How high above the level the arena is built.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(80f, 800f), Array.Empty<object>())); MusicVolume = config.Bind<float>("Audio", "MusicVolume", 0.4f, new ConfigDescription("Kombat music volume.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); Volume = config.Bind<float>("Audio", "Volume", 0.85f, new ConfigDescription("Punch and announcer volume.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); } } internal static class MortalKombatAccess { private static readonly FieldInfo ItemLocalizedNameField = AccessTools.Field(typeof(Item), "itemNameLocalized"); private static readonly FieldRef<ItemAttributes, string> ItemNameRef = AccessTools.FieldRefAccess<ItemAttributes, string>("itemName"); private static readonly FieldRef<ItemAttributes, string> InstanceNameRef = AccessTools.FieldRefAccess<ItemAttributes, string>("instanceName"); private static readonly FieldRef<PlayerController, float> InputDisableTimerRef = AccessTools.FieldRefAccess<PlayerController, float>("InputDisableTimer"); private static readonly FieldRef<PlayerController, Rigidbody> ControllerRbRef = AccessTools.FieldRefAccess<PlayerController, Rigidbody>("rb"); private static readonly FieldRef<PlayerController, Vector3> ControllerVelocityRef = AccessTools.FieldRefAccess<PlayerController, Vector3>("Velocity"); private static readonly FieldRef<PlayerController, Vector3> ControllerVelocityRelativeRef = AccessTools.FieldRefAccess<PlayerController, Vector3>("VelocityRelative"); private static readonly FieldRef<PlayerController, Vector3> ControllerVelocityRelativeNewRef = AccessTools.FieldRefAccess<PlayerController, Vector3>("VelocityRelativeNew"); private static readonly FieldRef<PhysGrabObject, bool> HeldByLocalRef = AccessTools.FieldRefAccess<PhysGrabObject, bool>("heldByLocalPlayer"); private static readonly FieldRef<PlayerAvatar, bool> IsDisabledRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isDisabled"); private static readonly FieldRef<PlayerAvatar, PlayerAvatarVisuals> AvatarVisualsRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerAvatarVisuals>("playerAvatarVisuals"); private static readonly FieldRef<PlayerAvatar, PlayerHealth> AvatarHealthRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerHealth>("playerHealth"); private static readonly FieldRef<PlayerAvatar, PlayerTumble> AvatarTumbleRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); private static readonly FieldRef<PlayerTumble, PhysGrabObject> TumbleGrabRef = AccessTools.FieldRefAccess<PlayerTumble, PhysGrabObject>("physGrabObject"); private static readonly FieldRef<PlayerHealth, bool> GodModeRef = AccessTools.FieldRefAccess<PlayerHealth, bool>("godMode"); private static readonly FieldRef<PlayerHealth, float> InvincibleTimerRef = AccessTools.FieldRefAccess<PlayerHealth, float>("invincibleTimer"); private static readonly FieldRef<PlayerAvatar, Rigidbody> AvatarRbRef = AccessTools.FieldRefAccess<PlayerAvatar, Rigidbody>("rb"); private static readonly FieldRef<PlayerAvatar, Vector3> AvatarRbVelocityRef = AccessTools.FieldRefAccess<PlayerAvatar, Vector3>("rbVelocity"); private static readonly FieldRef<PlayerAvatar, Vector3> AvatarRbVelocityRawRef = AccessTools.FieldRefAccess<PlayerAvatar, Vector3>("rbVelocityRaw"); private static readonly FieldRef<PlayerAvatar, Vector3> AvatarClientPositionRef = AccessTools.FieldRefAccess<PlayerAvatar, Vector3>("clientPosition"); private static readonly FieldRef<PlayerAvatar, Vector3> AvatarClientPositionCurrentRef = AccessTools.FieldRefAccess<PlayerAvatar, Vector3>("clientPositionCurrent"); private static readonly FieldRef<PlayerAvatar, float> AvatarClientPositionDeltaRef = AccessTools.FieldRefAccess<PlayerAvatar, float>("clientPositionDelta"); private static readonly FieldRef<PlayerAvatar, Quaternion> AvatarClientRotationRef = AccessTools.FieldRefAccess<PlayerAvatar, Quaternion>("clientRotation"); private static readonly FieldRef<PlayerAvatar, Quaternion> AvatarClientRotationCurrentRef = AccessTools.FieldRefAccess<PlayerAvatar, Quaternion>("clientRotationCurrent"); private static readonly FieldRef<PlayerAvatar, bool> IsTumblingRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isTumbling"); private static readonly FieldRef<PlayerAvatarVisuals, PlayerAvatarRightArm> RightArmRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, PlayerAvatarRightArm>("playerAvatarRightArm"); private static readonly FieldRef<PlayerAvatarVisuals, Animator> VisualAnimatorRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Animator>("animator"); private static readonly FieldRef<PlayerAvatarVisuals, Vector3> VisualPositionRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Vector3>("visualPosition"); private static readonly FieldRef<PlayerAvatarVisuals, Vector3> VisualPositionLastRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Vector3>("positionLast"); private static readonly FieldRef<PlayerAvatarVisuals, ShadowCastingMode> LocalVisibilityRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, ShadowCastingMode>("localVisibility"); private static readonly FieldRef<PlayerAvatarVisuals, float> ShowSelfTimerRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, float>("showSelfOverrideTimer"); private static readonly FieldRef<RunManager, bool> LevelIsShopRef = AccessTools.FieldRefAccess<RunManager, bool>("levelIsShop"); private static readonly MethodInfo ApplyLocalVisibilityMethod = AccessTools.Method(typeof(PlayerAvatarVisuals), "ApplyLocalVisibility", new Type[1] { typeof(ShadowCastingMode) }, (Type[])null); private static readonly MethodInfo ApplyLocalVisibilityBodyMethod = AccessTools.Method(typeof(PlayerAvatarVisuals), "ApplyLocalVisibilityBody", (Type[])null, (Type[])null); private static readonly MethodInfo RightArmSetPoseMethod = AccessTools.Method(typeof(PlayerAvatarRightArm), "SetPose", new Type[1] { typeof(Vector3) }, (Type[])null); private static readonly MethodInfo RightArmHeadAnimateMethod = AccessTools.Method(typeof(PlayerAvatarRightArm), "HeadAnimate", new Type[1] { typeof(bool) }, (Type[])null); private static readonly MethodInfo RightArmAnimatePoseMethod = AccessTools.Method(typeof(PlayerAvatarRightArm), "AnimatePose", (Type[])null, (Type[])null); private static readonly MethodInfo LeftArmSetPoseMethod = AccessTools.Method(typeof(PlayerAvatarLeftArm), "SetPose", new Type[1] { typeof(Vector3) }, (Type[])null); private static readonly MethodInfo LeftArmHeadAnimateMethod = AccessTools.Method(typeof(PlayerAvatarLeftArm), "HeadAnimate", new Type[1] { typeof(bool) }, (Type[])null); private static readonly MethodInfo LeftArmAnimatePoseMethod = AccessTools.Method(typeof(PlayerAvatarLeftArm), "AnimatePose", (Type[])null, (Type[])null); private static readonly MethodInfo PlayerHealthHurtMethod = AccessTools.Method(typeof(PlayerHealth), "Hurt", new Type[4] { typeof(int), typeof(bool), typeof(int), typeof(bool) }, (Type[])null); private static readonly MethodInfo PlayerDeathMethod = AccessTools.Method(typeof(PlayerAvatar), "PlayerDeath", new Type[1] { typeof(int) }, (Type[])null); private static readonly MethodInfo ExplosionSpawnMethod = AccessTools.Method(typeof(ParticleScriptExplosion), "Spawn", new Type[8] { typeof(Vector3), typeof(float), typeof(int), typeof(int), typeof(float), typeof(bool), typeof(bool), typeof(float) }, (Type[])null); private static ParticleScriptExplosion _explosion; internal static bool InputAllowed() { if ((Object)(object)PlayerController.instance != (Object)null) { return InputDisableTimerRef.Invoke(PlayerController.instance) <= 0f; } return false; } internal static bool InShop() { if (!SemiFunc.RunIsShop() && !SemiFunc.RunIsLobby()) { if ((Object)(object)RunManager.instance != (Object)null) { return LevelIsShopRef.Invoke(RunManager.instance); } return false; } return true; } internal static bool HeldByLocal(PhysGrabObject grab) { if ((Object)(object)grab != (Object)null) { return HeldByLocalRef.Invoke(grab); } return false; } internal static bool IsDisabled(PlayerAvatar avatar) { if ((Object)(object)avatar != (Object)null) { return IsDisabledRef.Invoke(avatar); } return false; } internal static PlayerAvatarVisuals Visuals(PlayerAvatar avatar) { if (!((Object)(object)avatar != (Object)null)) { return null; } return AvatarVisualsRef.Invoke(avatar); } internal static PlayerHealth Health(PlayerAvatar avatar) { if (!((Object)(object)avatar != (Object)null)) { return null; } return AvatarHealthRef.Invoke(avatar); } internal static bool GetGodMode(PlayerHealth health) { if ((Object)(object)health != (Object)null) { return GodModeRef.Invoke(health); } return false; } internal static void SetGodMode(PlayerHealth health, bool value) { if ((Object)(object)health != (Object)null) { GodModeRef.Invoke(health) = value; } } internal static void SetInvincible(PlayerHealth health, float time) { if ((Object)(object)health != (Object)null) { InvincibleTimerRef.Invoke(health) = time; } } internal static bool IsTumbling(PlayerAvatar avatar) { if ((Object)(object)avatar != (Object)null) { return IsTumblingRef.Invoke(avatar); } return false; } internal static PlayerAvatarRightArm RightArm(PlayerAvatarVisuals visuals) { if (!((Object)(object)visuals != (Object)null)) { return null; } return RightArmRef.Invoke(visuals); } internal static void AnimateRightArmPose(PlayerAvatarRightArm rightArm, Vector3 pose) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)rightArm == (Object)null) && !(RightArmSetPoseMethod == null) && !(RightArmAnimatePoseMethod == null)) { RightArmSetPoseMethod.Invoke(rightArm, new object[1] { pose }); RightArmHeadAnimateMethod?.Invoke(rightArm, new object[1] { false }); RightArmAnimatePoseMethod.Invoke(rightArm, null); } } internal static PlayerAvatarLeftArm LeftArm(PlayerAvatarVisuals visuals) { if (!((Object)(object)visuals != (Object)null)) { return null; } return ((Component)visuals).GetComponentInChildren<PlayerAvatarLeftArm>(true); } internal static void AnimateLeftArmPose(PlayerAvatarLeftArm leftArm, Vector3 pose) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)leftArm == (Object)null) && !(LeftArmSetPoseMethod == null) && !(LeftArmAnimatePoseMethod == null)) { LeftArmSetPoseMethod.Invoke(leftArm, new object[1] { pose }); LeftArmHeadAnimateMethod?.Invoke(leftArm, new object[1] { false }); LeftArmAnimatePoseMethod.Invoke(leftArm, null); } } internal static Animator VisualAnimator(PlayerAvatarVisuals visuals) { if (!((Object)(object)visuals != (Object)null)) { return null; } return VisualAnimatorRef.Invoke(visuals); } internal static GameObject VisualMeshParent(PlayerAvatarVisuals visuals) { if (!((Object)(object)visuals != (Object)null)) { return null; } return visuals.meshParent; } internal static bool IsLocalVisuals(PlayerAvatarVisuals visuals) { PlayerAvatar val = LocalAvatar(); if ((Object)(object)visuals != (Object)null && (Object)(object)val != (Object)null) { return (Object)(object)visuals == (Object)(object)Visuals(val); } return false; } internal static ShadowCastingMode VisualVisibility(PlayerAvatarVisuals visuals) { if ((Object)(object)visuals != (Object)null) { return LocalVisibilityRef.Invoke(visuals); } return (ShadowCastingMode)3; } internal static void SetVisualVisibility(PlayerAvatarVisuals visuals, ShadowCastingMode mode, bool apply) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected I4, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)visuals == (Object)null) { return; } ShowSelfTimerRef.Invoke(visuals) = (((int)mode == 1) ? 0.35f : 0f); if (apply && ApplyLocalVisibilityMethod != null) { ApplyLocalVisibilityMethod.Invoke(visuals, new object[1] { mode }); return; } LocalVisibilityRef.Invoke(visuals) = (ShadowCastingMode)(int)mode; if (apply) { ApplyLocalVisibilityBodyMethod?.Invoke(visuals, null); } } internal static void FaceLocalAvatar(PlayerAvatar avatar, Quaternion rotation) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)avatar == (Object)null)) { PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null && (Object)(object)avatar == (Object)(object)LocalAvatar()) { instance.OverrideTurnRotation(rotation, 0.25f); ((Component)instance).transform.rotation = rotation; } ((Component)avatar).transform.rotation = rotation; if ((Object)(object)avatar.playerTransform != (Object)null) { avatar.playerTransform.rotation = rotation; } PlayerAvatarVisuals val = Visuals(avatar); if ((Object)(object)val != (Object)null) { ((Component)val).transform.rotation = rotation; val.bodySpringTarget = rotation; } } } internal static void ClearLocalFacingOverride() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)PlayerController.instance != (Object)null) { PlayerController.instance.OverrideTurnRotation(Quaternion.identity, 0f); } } internal static bool MoveLocal(Vector3 position, Quaternion rotation) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) PlayerController instance = PlayerController.instance; PlayerAvatar val = LocalAvatar(); if ((Object)(object)instance == (Object)null || (Object)(object)val == (Object)null) { return false; } ((Component)instance).transform.SetPositionAndRotation(position, rotation); Rigidbody val2 = ControllerRbRef.Invoke(instance); if ((Object)(object)val2 != (Object)null) { val2.position = position; val2.rotation = rotation; if (!val2.isKinematic) { val2.velocity = Vector3.zero; val2.angularVelocity = Vector3.zero; } } ControllerVelocityRef.Invoke(instance) = Vector3.zero; ControllerVelocityRelativeRef.Invoke(instance) = Vector3.zero; ControllerVelocityRelativeNewRef.Invoke(instance) = Vector3.zero; instance.InputDirection = Vector3.zero; instance.InputDirectionRaw = Vector3.zero; ((Component)val).transform.SetPositionAndRotation(position, rotation); if ((Object)(object)val.playerTransform != (Object)null) { val.playerTransform.SetPositionAndRotation(position, rotation); } Rigidbody val3 = AvatarRbRef.Invoke(val); if ((Object)(object)val3 != (Object)null) { val3.position = position; val3.rotation = rotation; if (!val3.isKinematic) { val3.velocity = Vector3.zero; val3.angularVelocity = Vector3.zero; } } AvatarRbVelocityRef.Invoke(val) = Vector3.zero; AvatarRbVelocityRawRef.Invoke(val) = Vector3.zero; AvatarClientPositionRef.Invoke(val) = position; AvatarClientPositionCurrentRef.Invoke(val) = position; AvatarClientPositionDeltaRef.Invoke(val) = 0f; AvatarClientRotationRef.Invoke(val) = rotation; AvatarClientRotationCurrentRef.Invoke(val) = rotation; PlayerAvatarVisuals val4 = Visuals(val); if ((Object)(object)val4 != (Object)null) { ((Component)val4).transform.SetPositionAndRotation(position, rotation); VisualPositionRef.Invoke(val4) = position; VisualPositionLastRef.Invoke(val4) = position; val4.bodySpringTarget = rotation; } return true; } internal static void TeleportTumble(PlayerAvatar avatar, Vector3 position, Quaternion rotation) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)avatar == (Object)null) { return; } PlayerTumble val = AvatarTumbleRef.Invoke(avatar); if (!((Object)(object)val == (Object)null)) { PhysGrabObject val2 = TumbleGrabRef.Invoke(val); if ((Object)(object)val2 != (Object)null) { val2.Teleport(position, rotation); } } } internal static Rigidbody LocalRigidbody() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return ControllerRbRef.Invoke(PlayerController.instance); } internal static PlayerAvatar LocalAvatar() { if (!((Object)(object)PlayerController.instance != (Object)null)) { return null; } return PlayerController.instance.playerAvatarScript; } internal static List<PlayerAvatar> Players() { if (!((Object)(object)GameDirector.instance != (Object)null) || GameDirector.instance.PlayerList == null) { return new List<PlayerAvatar>(); } return GameDirector.instance.PlayerList; } internal static PlayerAvatar AvatarByViewId(int viewId) { List<PlayerAvatar> list = Players(); for (int i = 0; i < list.Count; i++) { if ((Object)(object)list[i] != (Object)null && (Object)(object)list[i].photonView != (Object)null && list[i].photonView.ViewID == viewId) { return list[i]; } } return null; } internal static string NameOf(PlayerAvatar avatar) { if ((Object)(object)avatar == (Object)null) { return "UNKNOWN"; } string text = SemiFunc.PlayerGetName(avatar); if (!string.IsNullOrEmpty(text)) { return text.ToUpperInvariant(); } return "PLAYER"; } internal static void SetItemName(ItemAttributes attributes, string name) { if (!((Object)(object)attributes == (Object)null)) { ItemNameRef.Invoke(attributes) = name; InstanceNameRef.Invoke(attributes) = name; } } internal static string InstanceName(ItemAttributes attributes) { if (!((Object)(object)attributes != (Object)null)) { return null; } return InstanceNameRef.Invoke(attributes); } internal static void ClearLocalizedName(Item item) { if ((Object)(object)item != (Object)null) { ItemLocalizedNameField?.SetValue(item, null); } } internal static void SpawnSelfDestructEffect(Vector3 position) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_explosion == (Object)null) { _explosion = Object.FindObjectOfType<ParticleScriptExplosion>(true); } if (!((Object)(object)_explosion == (Object)null) && !(ExplosionSpawnMethod == null)) { ExplosionSpawnMethod.Invoke(_explosion, new object[8] { position, 5f, 0, 0, 1f, true, false, 1.5f }); } } catch (Exception ex) { ManualLogSource log = EmpressMortalKombatPlugin.Log; if (log != null) { log.LogWarning((object)("Self-destruct effect skipped: " + ex.Message)); } } } internal static void SelfDestructLocal(PlayerAvatar avatar) { if ((Object)(object)avatar == (Object)null || (Object)(object)avatar != (Object)(object)LocalAvatar() || IsDisabled(avatar)) { return; } PlayerHealth val = Health(avatar); if ((Object)(object)val != (Object)null && PlayerHealthHurtMethod != null) { try { PlayerHealthHurtMethod.Invoke(val, new object[4] { 1000, false, -1, false }); return; } catch (Exception ex) { ManualLogSource log = EmpressMortalKombatPlugin.Log; if (log != null) { log.LogWarning((object)("Fatal self-damage failed, using direct death: " + ex.Message)); } } } PlayerDeathMethod?.Invoke(avatar, new object[1] { -1 }); } } internal static class MortalKombatAssets { private const string BundleFile = "empressmortalkombat.empress"; private static AssetBundle _bundle; private static bool _loaded; private static readonly Dictionary<string, AudioClip> Clips = new Dictionary<string, AudioClip>(StringComparer.OrdinalIgnoreCase); internal static GameObject TokenPrefab { get; private set; } internal static GameObject ArenaPrefab { get; private set; } internal static GameObject BotPrefab { get; private set; } internal static GameObject SparkPrefab { get; private set; } internal static AudioClip Clip(string name) { Clips.TryGetValue(name, out var value); return value; } internal static AudioClip ClipContaining(string token) { AudioClip val = Clip(token); if ((Object)(object)val != (Object)null) { return val; } foreach (KeyValuePair<string, AudioClip> clip in Clips) { if (clip.Key.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) { return clip.Value; } } return null; } internal static AudioClip ClipRandomContaining(string token) { List<AudioClip> list = new List<AudioClip>(); foreach (KeyValuePair<string, AudioClip> clip in Clips) { if (clip.Key.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) { list.Add(clip.Value); } } if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } internal static AudioClip ThemeClip() { AudioClip val = ClipContaining("kombat"); if ((Object)(object)val == (Object)null) { val = ClipContaining("mortal"); } if ((Object)(object)val == (Object)null) { val = ClipContaining("theme"); } if ((Object)(object)val == (Object)null) { val = ClipContaining("music"); } return val; } internal static void Load() { if (_loaded) { return; } _loaded = true; string text = Path.Combine(EmpressMortalKombatPlugin.PluginDirectory ?? string.Empty, "bundles", "empressmortalkombat.empress"); if (File.Exists(text)) { _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle != (Object)null) { TokenPrefab = _bundle.LoadAsset<GameObject>("EmpressMKToken"); ArenaPrefab = _bundle.LoadAsset<GameObject>("EmpressMKArena"); BotPrefab = _bundle.LoadAsset<GameObject>("EmpressMKBot"); SparkPrefab = _bundle.LoadAsset<GameObject>("EmpressMKSpark"); } } else { ManualLogSource log = EmpressMortalKombatPlugin.Log; if (log != null) { log.LogError((object)("Empress Mortal Kombat bundle missing: " + text)); } } } internal static IEnumerator LoadAudio() { string path = Path.Combine(EmpressMortalKombatPlugin.PluginDirectory ?? string.Empty, "audio"); if (!Directory.Exists(path)) { yield break; } string[] files = Directory.GetFiles(path, "*.ogg"); foreach (string text in files) { string key = Path.GetFileNameWithoutExtension(text); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file://" + text, (AudioType)14); try { yield return request.SendWebRequest(); if ((int)request.result == 1) { AudioClip content = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)content != (Object)null) { ((Object)content).name = key; Clips[key] = content; } } } finally { ((IDisposable)request)?.Dispose(); } } } } internal sealed class MortalKombatHud { private GameObject _root; private GameObject _announcePanel; private GameObject _fightPanel; private GameObject _endPanel; private Text _announceTitle; private Text _announceVersus; private Text _announceRole; private Text _fightFlash; private Text _timerText; private Text _nameA; private Text _nameB; private Image _fillA; private Image _fillB; private Image _flashImageA; private Image _flashImageB; private Text _endTitle; private Text _endFlawless; private Text _endPrize; private Font _font; private Sprite _sprite; private float _announceStart; private float _flashUntil; private float _hitFlashA; private float _hitFlashB; private float _shownHpA = 1f; private float _shownHpB = 1f; private float _targetHpA = 1f; private float _targetHpB = 1f; private static readonly Color Gold = new Color(1f, 0.78f, 0.12f); private static readonly Color Blood = new Color(0.85f, 0.1f, 0.05f); private static readonly Color BarGreen = new Color(0.15f, 0.9f, 0.2f); internal void ShowAnnounce(string nameA, string nameB, bool localFighter) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); _announceStart = Time.time; _announcePanel.SetActive(true); _fightPanel.SetActive(false); _endPanel.SetActive(false); _announceTitle.text = "MORTAL KOMBAT"; _announceVersus.text = nameA + " VS " + nameB; _announceRole.text = (localFighter ? "YOU HAVE BEEN CHOSEN" : "A KOMBAT CHALLENGE HAS BEGUN"); ((Graphic)_announceRole).color = (Color)(localFighter ? Blood : new Color(0.85f, 0.85f, 0.85f)); _nameA.text = nameA; _nameB.text = nameB; } internal void ShowFight() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); _announcePanel.SetActive(false); _endPanel.SetActive(false); _fightPanel.SetActive(true); _shownHpA = 1f; _shownHpB = 1f; _targetHpA = 1f; _targetHpB = 1f; _fillA.fillAmount = 1f; _fillB.fillAmount = 1f; Flash("FIGHT!", Blood, 1.1f); } internal void Flash(string message, Color color, float seconds) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); _fightFlash.text = message; ((Graphic)_fightFlash).color = color; _flashUntil = Time.time + seconds; ((Component)_fightFlash).gameObject.SetActive(true); } internal void SetHealth(float fractionA, float fractionB) { EnsureBuilt(); if (fractionA < _targetHpA) { _hitFlashA = Time.time + 0.25f; } if (fractionB < _targetHpB) { _hitFlashB = Time.time + 0.25f; } _targetHpA = Mathf.Clamp01(fractionA); _targetHpB = Mathf.Clamp01(fractionB); } internal void SetTimer(float seconds) { EnsureBuilt(); _timerText.text = Mathf.CeilToInt(Mathf.Max(0f, seconds)).ToString(); } internal void ShowEnd(string winnerName, bool flawless, string prizeName) { EnsureBuilt(); _announcePanel.SetActive(false); _fightPanel.SetActive(false); _endPanel.SetActive(true); _endTitle.text = winnerName + " WINS!"; ((Component)_endFlawless).gameObject.SetActive(flawless); _endFlawless.text = "FLAWLESS VICTORY"; bool flag = !string.IsNullOrEmpty(prizeName); ((Component)_endPrize).gameObject.SetActive(flag); if (flag) { _endPrize.text = "PRIZE: " + prizeName; } } internal void HideAll() { if (!((Object)(object)_root == (Object)null)) { _announcePanel.SetActive(false); _fightPanel.SetActive(false); _endPanel.SetActive(false); } } internal void Tick() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root == (Object)null) { return; } if (_announcePanel.activeSelf && (Object)(object)_announceTitle != (Object)null) { float num = Time.time - _announceStart; float num2 = 1f + Mathf.Sin(num * 5.5f) * 0.045f; float num3 = Mathf.SmoothStep(0.25f, 1f, Mathf.Clamp01(num / 0.55f)); ((Transform)((Graphic)_announceTitle).rectTransform).localScale = Vector3.one * (num2 * num3); } if ((Object)(object)_fightFlash != (Object)null && ((Component)_fightFlash).gameObject.activeSelf) { if (_flashUntil - Time.time <= 0f) { ((Component)_fightFlash).gameObject.SetActive(false); } else { ((Transform)((Graphic)_fightFlash).rectTransform).localScale = Vector3.one * (1f + Mathf.Sin(Time.time * 22f) * 0.05f); } } if ((Object)(object)_fightPanel != (Object)null && _fightPanel.activeSelf) { _shownHpA = Mathf.MoveTowards(_shownHpA, _targetHpA, Time.deltaTime * 1.6f); _shownHpB = Mathf.MoveTowards(_shownHpB, _targetHpB, Time.deltaTime * 1.6f); _fillA.fillAmount = _shownHpA; _fillB.fillAmount = _shownHpB; ((Graphic)_fillA).color = BarColor(_shownHpA, _hitFlashA); ((Graphic)_fillB).color = BarColor(_shownHpB, _hitFlashB); } } private static Color BarColor(float fraction, float flashUntil) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (Time.time < flashUntil) { return Color.white; } return Color.Lerp(Blood, BarGreen, Mathf.Clamp01(fraction * 1.4f)); } internal void Dispose() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; } private Font HudFont() { if ((Object)(object)_font != (Object)null) { return _font; } _font = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); if ((Object)(object)_font == (Object)null) { _font = Resources.GetBuiltinResource<Font>("Arial.ttf"); } if ((Object)(object)_font == (Object)null) { Font[] array = Resources.FindObjectsOfTypeAll<Font>(); if (array != null && array.Length != 0) { _font = array[0]; } } return _font; } private Sprite WhiteSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_sprite != (Object)null) { return _sprite; } Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); ((Object)val).hideFlags = (HideFlags)61; val.SetPixel(0, 0, Color.white); ((Texture)val).wrapMode = (TextureWrapMode)1; val.Apply(false, true); _sprite = Sprite.Create(val, new Rect(0f, 0f, 1f, 1f), new Vector2(0.5f, 0.5f), 100f); ((Object)_sprite).hideFlags = (HideFlags)61; return _sprite; } private void EnsureBuilt() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0322: 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_035e: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: 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_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_root != (Object)null)) { _root = new GameObject("Empress Mortal Kombat Hud", new Type[3] { typeof(RectTransform), typeof(Canvas), typeof(CanvasScaler) }); Object.DontDestroyOnLoad((Object)(object)_root); Canvas component = _root.GetComponent<Canvas>(); component.renderMode = (RenderMode)0; component.sortingOrder = 5002; CanvasScaler component2 = _root.GetComponent<CanvasScaler>(); component2.uiScaleMode = (ScaleMode)1; component2.referenceResolution = new Vector2(1920f, 1080f); _announcePanel = Panel("Announce"); ((Graphic)MakeImage(_announcePanel.transform, "Dim", new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(2200f, 1300f))).color = new Color(0f, 0f, 0f, 0.62f); _announceTitle = MakeText(_announcePanel.transform, "Title", "MORTAL KOMBAT", 104, Gold, new Vector2(0.5f, 0.62f), Vector2.zero); _announceVersus = MakeText(_announcePanel.transform, "Versus", "", 46, Color.white, new Vector2(0.5f, 0.47f), Vector2.zero); _announceRole = MakeText(_announcePanel.transform, "Role", "", 34, Blood, new Vector2(0.5f, 0.36f), Vector2.zero); _fightPanel = Panel("Fight"); BuildBar(_fightPanel.transform, left: true, out _fillA, out _flashImageA, out _nameA); BuildBar(_fightPanel.transform, left: false, out _fillB, out _flashImageB, out _nameB); _timerText = MakeText(_fightPanel.transform, "Timer", "99", 52, Gold, new Vector2(0.5f, 1f), new Vector2(0f, -64f)); _fightFlash = MakeText(_fightPanel.transform, "Flash", "FIGHT!", 120, Blood, new Vector2(0.5f, 0.5f), Vector2.zero); ((Component)_fightFlash).gameObject.SetActive(false); _endPanel = Panel("End"); ((Graphic)MakeImage(_endPanel.transform, "Dim", new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(2200f, 1300f))).color = new Color(0f, 0f, 0f, 0.55f); _endTitle = MakeText(_endPanel.transform, "Winner", "", 84, Gold, new Vector2(0.5f, 0.58f), Vector2.zero); _endFlawless = MakeText(_endPanel.transform, "Flawless", "FLAWLESS VICTORY", 46, Blood, new Vector2(0.5f, 0.46f), Vector2.zero); _endPrize = MakeText(_endPanel.transform, "Prize", "", 34, BarGreen, new Vector2(0.5f, 0.37f), Vector2.zero); _announcePanel.SetActive(false); _fightPanel.SetActive(false); _endPanel.SetActive(false); } } private GameObject Panel(string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_root.transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; return val; } private void BuildBar(Transform parent, bool left, out Image fill, out Image flash, out Text nameText) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: 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) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) Vector2 anchor = default(Vector2); ((Vector2)(ref anchor))..ctor(left ? 0f : 1f, 1f); float num = (left ? 1f : (-1f)); Vector2 position = default(Vector2); ((Vector2)(ref position))..ctor(num * 360f, -52f); Image val = MakeImage(parent, left ? "FrameA" : "FrameB", anchor, position, new Vector2(620f, 46f)); ((Graphic)val).color = new Color(0.05f, 0.05f, 0.05f, 0.92f); ((Graphic)MakeImage(((Component)val).transform, "Back", new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(606f, 34f))).color = new Color(0.28f, 0.02f, 0.02f, 0.95f); fill = MakeImage(((Component)val).transform, "Fill", new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(606f, 34f)); ((Graphic)fill).color = BarGreen; fill.type = (Type)3; fill.fillMethod = (FillMethod)0; fill.fillOrigin = ((!left) ? 1 : 0); fill.fillAmount = 1f; flash = fill; nameText = MakeText(parent, left ? "NameA" : "NameB", "", 26, Color.white, anchor, new Vector2(num * 360f, -96f)); nameText.alignment = (TextAnchor)(left ? 3 : 5); ((Graphic)nameText).rectTransform.sizeDelta = new Vector2(620f, 40f); } private Image MakeImage(Transform parent, string name, Vector2 anchor, Vector2 position, Vector2 size) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchor; component.anchorMax = anchor; component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = size; component.anchoredPosition = position; Image component2 = val.GetComponent<Image>(); component2.sprite = WhiteSprite(); ((Graphic)component2).raycastTarget = false; return component2; } private Text MakeText(Transform parent, string name, string content, int size, Color color, Vector2 anchor, Vector2 position) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(Text), typeof(Outline) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchor; component.anchorMax = anchor; component.pivot = new Vector2(0.5f, 0.5f); component.sizeDelta = new Vector2(1800f, (float)size * 1.6f); component.anchoredPosition = position; Text component2 = val.GetComponent<Text>(); component2.font = HudFont(); component2.fontSize = size; component2.fontStyle = (FontStyle)1; component2.alignment = (TextAnchor)4; ((Graphic)component2).color = color; component2.text = content; ((Graphic)component2).raycastTarget = false; component2.horizontalOverflow = (HorizontalWrapMode)1; component2.verticalOverflow = (VerticalWrapMode)1; Outline component3 = val.GetComponent<Outline>(); ((Shadow)component3).effectColor = new Color(0f, 0f, 0f, 0.9f); ((Shadow)component3).effectDistance = new Vector2(3f, -3f); return component2; } } internal sealed class MortalKombatItem : MonoBehaviour { private PhysGrabObject _grab; private PhotonView _view; private bool _used; private void Awake() { _grab = ((Component)this).GetComponent<PhysGrabObject>(); _view = ((Component)this).GetComponent<PhotonView>(); } private void Update() { if (_used || (Object)(object)_grab == (Object)null || MortalKombatAccess.InShop() || ((Object)(object)MortalKombatRuntime.Instance != (Object)null && MortalKombatRuntime.Instance.Busy) || !MortalKombatAccess.HeldByLocal(_grab) || !MortalKombatAccess.InputAllowed() || !SemiFunc.InputDown((InputKey)2)) { return; } PlayerAvatar val = MortalKombatAccess.LocalAvatar(); if (!((Object)(object)val == (Object)null) && !((Object)(object)val.photonView == (Object)null)) { _used = true; int viewID = val.photonView.ViewID; int num = (((Object)(object)_view != (Object)null) ? _view.ViewID : (-1)); EmpressMortalKombatPlugin.EnsurePhotonHooked(); EmpressMortalKombatPlugin.RaiseToAll(160, new object[2] { viewID, num }); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } } } } internal static class MortalKombatItemBuilder { private static readonly string[] TemplatePaths = new string[4] { "Items/Item Grenade Human", "Items/Item Grenade Explosive", "Items/Item Grenade Stun", "Items/Item Grenade Duct Taped" }; private static GameObject _prefab; private static Item _item; private static bool _registered; internal static void RegisterItem() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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) if (_registered) { return; } GameObject val = null; for (int i = 0; i < TemplatePaths.Length; i++) { val = Resources.Load<GameObject>(TemplatePaths[i]); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { EmpressMortalKombatPlugin.Log.LogError((object)"Empress Mortal Kombat could not find a template item."); return; } ItemAttributes component = val.GetComponent<ItemAttributes>(); if ((Object)(object)component == (Object)null || (Object)(object)component.item == (Object)null) { EmpressMortalKombatPlugin.Log.LogError((object)"Empress Mortal Kombat template has no ItemAttributes."); return; } GameObject val2 = new GameObject("Empress Mortal Kombat Prefabs"); Object.DontDestroyOnLoad((Object)(object)val2); ((Object)val2).hideFlags = (HideFlags)61; val2.SetActive(false); _prefab = Object.Instantiate<GameObject>(val, val2.transform); ((Object)_prefab).name = "Empress Mortal Kombat"; MonoBehaviour[] componentsInChildren = _prefab.GetComponentsInChildren<MonoBehaviour>(true); foreach (MonoBehaviour val3 in componentsInChildren) { if (!((Object)(object)val3 == (Object)null)) { string name = ((object)val3).GetType().Name; if (name.StartsWith("ItemGrenade") || name == "ItemToggle" || name == "ItemBattery") { Object.DestroyImmediate((Object)(object)val3); } } } Renderer[] componentsInChildren2 = _prefab.GetComponentsInChildren<Renderer>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].enabled = false; } if ((Object)(object)MortalKombatAssets.TokenPrefab != (Object)null) { GameObject val4 = Object.Instantiate<GameObject>(MortalKombatAssets.TokenPrefab, _prefab.transform, false); ((Object)val4).name = "Empress Mortal Kombat Visual"; val4.transform.localPosition = new Vector3(0f, 0.05f, 0f); val4.transform.localRotation = Quaternion.identity; Collider[] componentsInChildren3 = val4.GetComponentsInChildren<Collider>(true); for (int j = 0; j < componentsInChildren3.Length; j++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[j]); } ScaleToSize(val4, 0.4f); componentsInChildren2 = val4.GetComponentsInChildren<Renderer>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].enabled = true; } ReplaceColliders(val4); } _prefab.AddComponent<MortalKombatItem>(); Item item = component.item; _item = Object.Instantiate<Item>(item); ((Object)_item).name = "Empress Mortal Kombat"; _item.itemName = "Empress Mortal Kombat"; MortalKombatAccess.ClearLocalizedName(_item); _item.itemSecretShopType = (itemSecretShopType)0; _item.maxAmount = 4; _item.maxAmountInShop = 2; _item.maxPurchase = false; _item.maxPurchaseAmount = 4; float value = (float)EmpressMortalKombatPlugin.Settings.ShopPrice.Value * 250f; Value val5 = (((Object)(object)item.value != (Object)null) ? Object.Instantiate<Value>(item.value) : ScriptableObject.CreateInstance<Value>()); SetFloatFieldContaining(val5, "min", value); SetFloatFieldContaining(val5, "max", value); _item.value = val5; ItemAttributes component2 = _prefab.GetComponent<ItemAttributes>(); component2.item = _item; MortalKombatAccess.SetItemName(component2, "Empress Mortal Kombat"); _registered = Items.RegisterItem(component2) != null; } private static void ReplaceColliders(GameObject visual) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_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) List<Collider> list = new List<Collider>(); Collider[] componentsInChildren = _prefab.GetComponentsInChildren<Collider>(true); foreach (Collider val in componentsInChildren) { if ((Object)(object)val != (Object)null && ((Object)(object)visual == (Object)null || !((Component)val).transform.IsChildOf(visual.transform))) { list.Add(val); } } if (list.Count == 0) { return; } GameObject gameObject = ((Component)list[0]).gameObject; PhysicMaterial sharedMaterial = list[0].sharedMaterial; for (int num = list.Count - 1; num >= 0; num--) { if (!((Object)(object)list[num] == (Object)null)) { if ((Object)(object)((Component)list[num]).gameObject == (Object)(object)gameObject) { Object.DestroyImmediate((Object)(object)list[num]); } else { Object.DestroyImmediate((Object)(object)((Component)list[num]).gameObject); } } } Bounds val2 = BoundsInSpace(gameObject.transform, visual); BoxCollider obj = gameObject.AddComponent<BoxCollider>(); obj.center = ((Bounds)(ref val2)).center; obj.size = Vector3.Max(((Bounds)(ref val2)).size, new Vector3(0.08f, 0.05f, 0.08f)); ((Collider)obj).sharedMaterial = sharedMaterial; } internal static Bounds BoundsInSpace(Transform space, GameObject target) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(Vector3.zero, Vector3.zero); bool has = false; MeshFilter[] componentsInChildren = target.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val in componentsInChildren) { if ((Object)(object)val != (Object)null && (Object)(object)val.sharedMesh != (Object)null) { EncapsulateMesh(space, ((Component)val).transform, val.sharedMesh, ref bounds, ref has); } } SkinnedMeshRenderer[] componentsInChildren2 = target.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if ((Object)(object)val2 != (Object)null && (Object)(object)val2.sharedMesh != (Object)null) { EncapsulateMesh(space, ((Component)val2).transform, val2.sharedMesh, ref bounds, ref has); } } return bounds; } private static void EncapsulateMesh(Transform space, Transform meshTransform, Mesh mesh, ref Bounds bounds, ref bool has) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) Bounds bounds2 = mesh.bounds; Matrix4x4 val = space.worldToLocalMatrix * meshTransform.localToWorldMatrix; for (int i = 0; i < 8; i++) { Vector3 val2 = ((Bounds)(ref bounds2)).center + Vector3.Scale(((Bounds)(ref bounds2)).extents, new Vector3(((i & 1) == 0) ? (-1f) : 1f, ((i & 2) == 0) ? (-1f) : 1f, ((i & 4) == 0) ? (-1f) : 1f)); Vector3 val3 = ((Matrix4x4)(ref val)).MultiplyPoint3x4(val2); if (!has) { bounds = new Bounds(val3, Vector3.zero); has = true; } else { ((Bounds)(ref bounds)).Encapsulate(val3); } } } internal static void ScaleToSize(GameObject target, float maxDimension) { //IL_0007: 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) //IL_000f: 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) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Bounds val = BoundsInSpace(target.transform, target); float num = Mathf.Max(((Bounds)(ref val)).size.x, Mathf.Max(((Bounds)(ref val)).size.y, ((Bounds)(ref val)).size.z)); if (!(num <= 0.0001f)) { target.transform.localScale = Vector3.one * (maxDimension / num); } } private static void SetFloatFieldContaining(object target, string token, float value) { if (target == null) { return; } FieldInfo[] fields = target.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.FieldType == typeof(float) && fieldInfo.Name.ToLowerInvariant().Contains(token)) { fieldInfo.SetValue(target, value); } } } } [HarmonyPatch(typeof(PlayerAvatarRightArm), "Update")] internal static class MortalKombatPatchRightArmUpdate { private static bool Prefix(PlayerAvatarRightArm __instance) { if (!((Object)(object)__instance == (Object)null)) { return (Object)(object)((Component)__instance).GetComponent<MortalKombatPunchArm>() == (Object)null; } return true; } } [HarmonyPatch(typeof(PlayerAvatarLeftArm), "Update")] internal static class MortalKombatPatchLeftArmUpdate { private static bool Prefix(PlayerAvatarLeftArm __instance) { if ((Object)(object)__instance == (Object)null) { return true; } MortalKombatPunchArm component = ((Component)__instance).GetComponent<MortalKombatPunchArm>(); if (!((Object)(object)component == (Object)null)) { return !component.UsingLeftArm; } return true; } } [HarmonyPatch(typeof(SemiFunc), "InputMovementX")] internal static class MortalKombatPatchMovementX { private static bool Prefix(ref float __result) { MortalKombatRuntime instance = MortalKombatRuntime.Instance; if ((Object)(object)instance == (Object)null || !instance.TryGetFightMovement(out var _)) { return true; } __result = 0f; return false; } } [HarmonyPatch(typeof(SemiFunc), "InputMovementY")] internal static class MortalKombatPatchMovementY { private static bool Prefix(ref float __result) { MortalKombatRuntime instance = MortalKombatRuntime.Instance; if ((Object)(object)instance == (Object)null || !instance.TryGetFightMovement(out var movement)) { return true; } __result = movement; return false; } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "ApplyLocalVisibility")] internal static class MortalKombatPatchLocalVisibility { private static void Prefix(PlayerAvatarVisuals __instance, ref ShadowCastingMode __0) { MortalKombatRuntime instance = MortalKombatRuntime.Instance; if ((Object)(object)instance != (Object)null && instance.ShouldForceLocalAvatarVisible(__instance)) { __0 = (ShadowCastingMode)1; } } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "ApplyLocalVisibilityBody")] internal static class MortalKombatPatchLocalVisibilityBody { private static void Prefix(PlayerAvatarVisuals __instance) { MortalKombatRuntime instance = MortalKombatRuntime.Instance; if ((Object)(object)instance != (Object)null && instance.ShouldForceLocalAvatarVisible(__instance)) { MortalKombatAccess.SetVisualVisibility(__instance, (ShadowCastingMode)1, apply: false); } } } internal sealed class MortalKombatRuntime : MonoBehaviour { private enum Phase { None, Announce, Fight, End } private const float AnnounceTime = 4.2f; private const float TeleportTime = 3.2f; private const float EndReturnTime = 3.5f; private const float EndTeardownTime = 4.8f; private const float PunchCooldown = 0.45f; private const float PunchRangeX = 1.8f; private const float PunchRangeY = 1.6f; private const float ArenaHalfWidth = 7.5f; private const float WinnerInvincibleTime = 10f; private const float VoidDropDepth = 200f; private const int BotId = -1; private const string BotName = "EMPRESS SHADOW"; private static readonly string[] UpgradeNames = new string[8] { "HEALTH UPGRADE", "STAMINA UPGRADE", "EXTRA JUMP", "TUMBLE LAUNCH", "SPRINT SPEED", "GRAB STRENGTH", "GRAB RANGE", "THROW STRENGTH" }; private readonly MortalKombatHud _hud = new MortalKombatHud(); private Phase _phase; private float _phaseStart; private int _fighterAId; private int _fighterBId; private GameObject _arena; private Vector3 _arenaCenter; private Vector3 _spawnA; private Vector3 _spawnB; private float _planeZ; private int _hpMax = 100; private int _hpA; private int _hpB; private float _timer; private LevelGenerator _level; private int _localRole; private Vector3 _returnPos; private Quaternion _returnRot; private bool _returnSent; private bool _teleported; private bool _returned; private float _punchReady; private float _heartbeat; private bool _endSent; private bool _loserDestroyed; private int _loserId; private int _winnerId; private bool _winnerInvincible; private float _winnerInvincibleEnd; private bool _winnerSavedGod; private GameObject _botGo; private Transform _botArmPivot; private Vector3 _botPos; private float _botVelY; private float _botPunchReady; private float _botJumpAt; private float _botArmTimer; private AudioSource _music; private AudioSource _flat; private bool _cameraActive; private PlayerAvatarVisuals _forcedLocalVisuals; private bool _localVisualForced; private bool _restoringLocalVisual; private bool _localVisualWasActive; private bool _localAnimatorWasEnabled; private AnimatorCullingMode _localAnimatorCulling; private ShadowCastingMode _localVisibility; private int _cameraOriginalCullingMask = -1; public static MortalKombatRuntime Instance { get; private set; } internal bool Busy => _phase != Phase.None; public static MortalKombatRuntime EnsureHost() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { return Instance; } GameObject val = new GameObject("Empress Mortal Kombat Runtime"); val.transform.parent = null; ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent<MortalKombatRuntime>(); return Instance; } private void Awake() { Instance = this; ((MonoBehaviour)this).StartCoroutine(MortalKombatAssets.LoadAudio()); } private void Update() { EmpressMortalKombatPlugin.EnsurePhotonHooked(); _hud.Tick(); MaintainLocalPresentation(); TickWinnerInvincibility(); if (_phase == Phase.Announce) { TickAnnounce(); } else if (_phase == Phase.Fight) { TickFight(); } else if (_phase == Phase.End) { TickEnd(); } } private void FixedUpdate() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if ((_phase != Phase.Fight && _phase != Phase.End) || _localRole == 0 || !_teleported || _returned) { return; } MaintainLocalFacing(); Rigidbody val = MortalKombatAccess.LocalRigidbody(); if (!((Object)(object)val == (Object)null)) { Vector3 position = val.position; float num = Mathf.Clamp(position.x, _arenaCenter.x - 7.5f, _arenaCenter.x + 7.5f); float num2 = Mathf.Lerp(position.z, _planeZ, 0.35f); val.position = new Vector3(num, position.y, num2); if (!val.isKinematic) { Vector3 velocity = val.velocity; val.velocity = new Vector3(velocity.x, velocity.y, velocity.z * 0.5f); } } } private void LateUpdate() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) MaintainLocalPresentation(); bool flag = false; if (_localRole != 0 && (Object)(object)CameraPosition.instance != (Object)null && (Object)(object)CameraAim.Instance != (Object)null) { PlayerAvatar val = MortalKombatAccess.LocalAvatar(); if ((Object)(object)val != (Object)null && !MortalKombatAccess.IsDisabled(val)) { if (_phase == Phase.Announce) { flag = true; AnnounceCamera(val); } else if (_phase == Phase.Fight || (_phase == Phase.End && !_returned)) { flag = true; FightCamera(val); } } } if (!flag && _cameraActive) { _cameraActive = false; CameraPosition instance = CameraPosition.instance; if (instance != null) { instance.OverridePosition(Vector3.zero, 0f); } SemiFunc.CameraOverrideStopAim(); } } private void AnnounceCamera(PlayerAvatar local) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) PlayerAvatarVisuals val = MortalKombatAccess.Visuals(local); Vector3 val2 = (((Object)(object)val != (Object)null && (Object)(object)val.headLookAtTransform != (Object)null) ? val.headLookAtTransform.position : (((Component)local).transform.position + Vector3.up * 1.2f)); Vector3 forward = ((Component)local).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.001f) { forward = Vector3.forward; } ((Vector3)(ref forward)).Normalize(); Vector3 val3 = val2 + forward * 2.4f + Vector3.up * 0.1f; _cameraActive = true; CameraPosition.instance.OverridePosition(val3, 0.25f); CameraAim.Instance.AimTargetSet(val2, 0.25f, 8f, ((Component)this).gameObject, 150); } private void FightCamera(PlayerAvatar local) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00d5: Unknown result type (might be due to invalid IL or missing references) Vector3 val = FighterPosition(_fighterAId); Vector3 val2 = FighterPosition(_fighterBId); Vector3 val3 = (val + val2) * 0.5f; float num = Mathf.Clamp(Mathf.Abs(val.x - val2.x) * 0.75f + 3.2f, 4.5f, 9.5f); float num2 = Mathf.Max(val.y, val2.y) * 0.35f + (_arenaCenter.y + 1.35f) * 0.65f; Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(val3.x, num2 + 0.4f, _planeZ - num); Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(val3.x, num2, _planeZ); _cameraActive = true; CameraPosition.instance.OverridePosition(val4, 0.25f); CameraAim.Instance.AimTargetSet(val5, 0.25f, 8f, ((Component)this).gameObject, 150); } private Vector3 FighterPosition(int viewId) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (viewId == -1) { return _botPos; } PlayerAvatar val = MortalKombatAccess.AvatarByViewId(viewId); if (!((Object)(object)val != (Object)null)) { return _arenaCenter; } return ((Component)val).transform.position; } internal void ReceiveRequest(object[] data) { if (data == null || data.Length < 2) { return; } int num = Convert.ToInt32(data[0]); int num2 = Convert.ToInt32(data[1]); if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (num2 > 0) { PhotonView val = PhotonView.Find(num2); if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).gameObject != (Object)null) { string text = MortalKombatAccess.InstanceName(((Component)val).gameObject.GetComponent<ItemAttributes>()); if ((Object)(object)StatsManager.instance != (Object)null && !string.IsNullOrEmpty(text)) { StatsManager.instance.ItemRemove(text); } if (PhotonNetwork.InRoom) { PhotonNetwork.Destroy(((Component)val).gameObject); } else { Object.Destroy((Object)(object)((Component)val).gameObject); } } } if (Busy) { return; } PlayerAvatar val2 = MortalKombatAccess.AvatarByViewId(num); if ((Object)(object)val2 == (Object)null) { return; } List<PlayerAvatar> list = new List<PlayerAvatar>(); List<PlayerAvatar> list2 = MortalKombatAccess.Players(); for (int i = 0; i < list2.Count; i++) { if ((Object)(object)list2[i] != (Object)null && (Object)(object)list2[i] != (Object)(object)val2 && (Object)(object)list2[i].photonView != (Object)null) { list.Add(list2[i]); } } int num3 = -1; if (list.Count > 0) { num3 = list[Random.Range(0, list.Count)].photonView.ViewID; } float value = EmpressMortalKombatPlugin.Settings.ArenaHeight.Value; EmpressMortalKombatPlugin.RaiseToAll(161, new object[5] { num, num3, 0f, value, 0f }); } internal void ReceiveBegin(object[] data) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) if (data != null && data.Length >= 5 && !Busy) { _fighterAId = Convert.ToInt32(data[0]); _fighterBId = Convert.ToInt32(data[1]); _arenaCenter = new Vector3(Convert.ToSingle(data[2]), Convert.ToSingle(data[3]), Convert.ToSingle(data[4])); _level = LevelGenerator.Instance; _hpMax = EmpressMortalKombatPlugin.Settings.FightHealth.Value; _hpA = _hpMax; _hpB = _hpMax; _timer = EmpressMortalKombatPlugin.Settings.FightTime.Value; _endSent = false; _loserDestroyed = false; _teleported = false; _returned = false; BuildArena(); PlayerAvatar val = MortalKombatAccess.LocalAvatar(); int num = (((Object)(object)val != (Object)null && (Object)(object)val.photonView != (Object)null) ? val.photonView.ViewID : (-999)); _localRole = ((num == _fighterAId) ? 1 : ((num == _fighterBId) ? 2 : 0)); if (_localRole != 0 && (Object)(object)val != (Object)null) { _returnPos = ((Component)val).transform.position; _returnRot = ((Component)val).transform.rotation; } _returnSent = false; if (_fighterBId == -1) { BuildBot(); } string nameA = MortalKombatAccess.NameOf(MortalKombatAccess.AvatarByViewId(_fighterAId)); string nameB = ((_fighterBId == -1) ? "EMPRESS SHADOW" : MortalKombatAccess.NameOf(MortalKombatAccess.AvatarByViewId(_fighterBId))); _hud.ShowAnnounce(nameA, nameB, _localRole != 0); StartMusic(); PlayFlat("toasty", 0.9f); if (SemiFunc.IsMasterClientOrSingleplayer()) { ReviveAndHeal(_fighterAId); ReviveAndHeal(_fighterBId); } _phase = Phase.Announce; _phaseStart = Time.time; } } private void ReviveAndHeal(int viewId) { if (viewId == -1) { return; } PlayerAvatar val = MortalKombatAccess.AvatarByViewId(viewId); if (!((Object)(object)val == (Object)null)) { if (MortalKombatAccess.IsDisabled(val)) { val.Revive(false); } PlayerHealth val2 = MortalKombatAccess.Health(val); if ((Object)(object)val2 != (Object)null) { val2.HealOther(100, true); } } } private void BuildArena() { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_0163: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017d: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) Vector3 val3; Vector3 val4; if ((Object)(object)MortalKombatAssets.ArenaPrefab != (Object)null) { _arena = Object.Instantiate<GameObject>(MortalKombatAssets.ArenaPrefab, _arenaCenter, Quaternion.identity); ((Object)_arena).name = "Empress Mortal Kombat Arena"; Transform val = _arena.transform.Find("SpawnA"); Transform val2 = _arena.transform.Find("SpawnB"); val3 = (((Object)(object)val != (Object)null) ? val.position : (_arenaCenter + new Vector3(-3.2f, 0.6f, 0f))); val4 = (((Object)(object)val2 != (Object)null) ? val2.position : (_arenaCenter + new Vector3(3.2f, 0.6f, 0f))); } else { _arena = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)_arena).name = "Empress Mortal Kombat Arena"; _arena.transform.position = _arenaCenter; _arena.transform.localScale = new Vector3(18f, 1f, 6f); val3 = _arenaCenter + new Vector3(-3.2f, 1.2f, 0f); val4 = _arenaCenter + new Vector3(3.2f, 1.2f, 0f); } _spawnA = ((val3.x <= val4.x) ? val3 : val4); _spawnB = ((val3.x <= val4.x) ? val4 : val3); _planeZ = _spawnA.z; } private void BuildBot() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) _botPos = _spawnB; _botVelY = 0f; _botPunchReady = 0f; _botJumpAt = Time.time + Random.Range(2f, 4f); if ((Object)(object)MortalKombatAssets.BotPrefab != (Object)null) { _botGo = Object.Instantiate<GameObject>(MortalKombatAssets.BotPrefab, _botPos, Quaternion.LookRotation(Vector3.left, Vector3.up)); ((Object)_botGo).name = "Empress Mortal Kombat Shadow"; _botArmPivot = FindChild(_botGo.transform, "BotArmPivot"); } } private static Transform FindChild(Transform root, string name) { Transform[] componentsInChildren = ((Component)root).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == name) { return val; } } return null; } private void TickAnnounce() { //IL_0068: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) float num = Time.time - _phaseStart; if (_localRole != 0 && (Object)(object)PlayerController.instance != (Object)null) { PlayerController.instance.InputDisable(0.3f); } if (_localRole != 0 && !_teleported && num >= 3.2f && (Object)(object)MortalKombatAccess.LocalAvatar() != (Object)null) { Vector3 position = ((_localRole == 1) ? _spawnA : _spawnB); _teleported = MortalKombatAccess.MoveLocal(position, StartingFacingRotation()); } if (num >= 4.2f) { _phase = Phase.Fight; _phaseStart = Time.time; _punchReady = Time.time + 0.2f; _heartbeat = 0f; _hud.ShowFight(); _hud.SetHealth(1f, 1f); _hud.SetTimer(_timer); PlayFlat("fight", 1f); } } private void TickFight() { _timer = Mathf.Max(0f, _timer - Time.deltaTime); _hud.SetTimer(_timer); TickLocalFighter(); if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if ((Object)(object)LevelGenerator.Instance != (Object)(object)_level) { SendCancel(0); return; } if (_fighterBId == -1) { TickBot(); } PlayerAvatar val = MortalKombatAccess.AvatarByViewId(_fighterAId); PlayerAvatar val2 = ((_fighterBId == -1) ? null : MortalKombatAccess.AvatarByViewId(_fighterBId)); if ((Object)(object)val == (Object)null || MortalKombatAccess.IsDisabled(val)) { SendEnd(_fighterBId, _fighterAId); return; } if (_fighterBId != -1 && ((Object)(object)val2 == (Object)null || MortalKombatAccess.IsDisabled(val2))) { SendEnd(_fighterAId, _fighterBId); return; } if (_timer <= 0f) { int num = ((_hpA > _hpB) ? _fighterAId : _fighterBId); int loserId = ((num == _fighterAId) ? _fighterBId : _fighterAId); SendEnd(num, loserId); return; } _heartbeat -= Time.deltaTime; if (_heartbeat <= 0f) { _heartbeat = 1f; EmpressMortalKombatPlugin.RaiseToAll(163, new object[3] { _hpA, _hpB, _timer }); } } private void TickLocalFighter() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) if (_localRole == 0 || !_teleported) { return; } PlayerAvatar val = MortalKombatAccess.LocalAvatar(); if ((Object)(object)val == (Object)null || MortalKombatAccess.IsDisabled(val)) { return; } if (((Component)val).transform.position.y < _arenaCenter.y - 12f) { MortalKombatAccess.MoveLocal((_localRole == 1) ? _spawnA : _spawnB, StartingFacingRotation()); } else { if (Time.time < _punchReady || !SemiFunc.InputDown((InputKey)10)) { return; } _punchReady = Time.time + 0.45f; Rigidbody val2 = MortalKombatAccess.LocalRigidbody(); if ((Object)(object)val2 != (Object)null && (Object)(object)PlayerController.instance != (Object)null) { Vector3 velocity = val2.velocity; if (velocity.y > 1.2f) { PlayerController.instance.ForceImpulse(Vector3.up * 4.5f); } else if (Mathf.Abs(velocity.x) > 0.8f) { PlayerController.instance.ForceImpulse(new Vector3(Mathf.Sign(velocity.x) * 5.5f, 0.6f, 0f)); } } EmpressMortalKombatPlugin.SendLocalAndOthers(162, new object[1] { val.photonView.ViewID }); } } private void TickBot() { //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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_botGo == (Object)null) { return; } PlayerAvatar val = MortalKombatAccess.AvatarByViewId(_fighterAId); if ((Object)(object)val == (Object)null) { return; } float y = _spawnB.y; Vector3 position = ((Component)val).transform.position; float num = Mathf.Sign(_botPos.x - position.x); if (num == 0f) { num = 1f; } float num2 = position.x + num * 1.1f; _botPos.x = Mathf.MoveTowards(_botPos.x, num2, 2.8f * Time.deltaTime); _botPos.x = Mathf.Clamp(_botPos.x, _arenaCenter.x - 7.5f, _arenaCenter.x + 7.5f); if (Time.time >= _botJumpAt && Mathf.Approximately(_botPos.y, y)) { _botVelY = 6f; _botJumpAt = Time.time + Random.Range(2f, 4.5f); } _botPos.y += _botVelY * Time.deltaTime; _botVelY -= 16f * Time.deltaTime; if (_botPos.y <= y) { _botPos.y = y; _botVelY = 0f; } _botPos.z = _planeZ; _botGo.transform.position = _botPos; _botGo.transform.rotation = Quaternion.Euler(0f, (position.x > _botPos.x) ? 90f : (-90f), 0f); if (_botArmTimer > 0f) { _botArmTimer -= Time.deltaTime; if ((Object)(object)_botArmPivot != (Object)null) { float num3 = Mathf.Sin(Mathf.Clamp01(1f - _botArmTimer / 0.35f) * MathF.PI); _botArmPivot.localRotation = Quaternion.Euler(-95f * num3, 0f, 0f); } } float num4 = Mathf.Abs(position.x - _botPos.x); float num5 = Mathf.Abs(position.y - _botPos.y); if (num4 < 1.6f && num5 < 1.5f && Time.time >= _botPunchReady) { _botPunchReady = Time.time + 0.85f; _botArmTimer = 0.35f; PlaySoundAt("punch", _botPos + Vector3.up * 1.2f, 10f); ApplyDamage(_fighterAId, Mathf.Sign(position.x - _botPos.x)); } } internal void ReceivePunch(object[] data) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00d8: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length < 1 || _phase != Phase.Fight) { return; } int num = Convert.ToInt32(data[0]); PlayerAvatar val = MortalKombatAccess.AvatarByViewId(num); bool flag = num == _fighterAId || num == _fighterBId; int num2 = ((num == _fighterAId) ? _fighterBId : _