Decompiled source of APEX Prisoners v3.0.1
Localia.APEX_Prisoners.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Agents; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using GameData; using Gear; using HarmonyLib; using Microsoft.CodeAnalysis; using Player; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("APEX_Prisoners")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("APEX_Prisoners")] [assembly: AssemblyTitle("APEX_Prisoners")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [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 APEX_Prisoners { [BepInPlugin("Localia.APEX_Prisoners", "APEX_Prisoners", "3.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class EntryPoint : BasePlugin { private Harmony m_Harmony; public static ConfigEntry<bool> is_allowed_recoil { get; private set; } public static ConfigEntry<bool> is_allowed_slide { get; private set; } public static ConfigEntry<bool> is_allowed_RunReload { get; private set; } public override void Load() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown m_Harmony = new Harmony("Localia.APEX_Prisoners"); m_Harmony.PatchAll(); ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "Localia.APEX_Prisoners.cfg"), true); is_allowed_recoil = val.Bind<bool>("APEX: Prisoners", "Allow Recoil Reduce", true, "The recoil of the gun will be lowered when you move the mouse, making it easier for you to fire while moving."); is_allowed_slide = val.Bind<bool>("APEX: Prisoners", "Allow Super Slide", true, "You can use sliding for short acceleration, super jumping and fast downhill."); is_allowed_RunReload = val.Bind<bool>("APEX: Prisoners", "Allow Run-Reload", true, "You can reload your weapons while running, but there is a little speed penalty."); Recoil_Manager.is_allowed = is_allowed_recoil.Value; Slide_Manager.is_allowed = is_allowed_slide.Value; RunReload_Manager.is_allowed = is_allowed_slide.Value; Logs.Info("OK"); } } internal static class Logs { private static readonly ManualLogSource _logger; public static bool canChat; static Logs() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown canChat = false; _logger = new ManualLogSource("Localia.APEX_Prisoners"); Logger.Sources.Add((ILogSource)(object)_logger); } private static string Format(object msg) { return msg.ToString(); } public static void debugChat(string data) { if (canChat) { PlayerChatManager.PostChatMessageLocaly(SNet.LocalPlayer, data, (SNet_Player)null); } } public static void Info(object data) { _logger.LogMessage((object)Format(data)); } public static void Verbose(object data) { _logger.LogDebug((object)Format(data)); } public static void Debug(object data) { _logger.LogDebug((object)Format(data)); } public static void Error(object data) { _logger.LogError((object)Format(data)); } } public static class Recoil_Manager { public static bool is_aiming = false; public static bool is_allowed = false; public static float total_pitch = 0f; public static float total_yaw = 0f; public static float tem_spread = 0f; public static float verticalScale_min; public static float verticalScale_max; public static float horizontalScale_min; public static float horizontalScale_max; public static float power_min; public static float power_max; public static float last_yaw; public static float last_pitch; public static Dictionary<float, float> mouse_pitch = new Dictionary<float, float>(); public static Dictionary<float, float> mouse_yaw = new Dictionary<float, float>(); } [HarmonyPatch(typeof(LookCameraController), "MouseLookUpdate")] internal static class Patch_LookCameraControllerMouseLookUpdate { [HarmonyWrapSafe] public static void Postfix(LookCameraController __instance) { //IL_007e: 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_00b4: 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) if (Recoil_Manager.mouse_pitch.Count > 0) { List<float> list = new List<float>(Recoil_Manager.mouse_pitch.Keys); for (int i = 0; i < list.Count; i++) { float num = list[i]; if (num + 0.1f < Clock.Time) { Recoil_Manager.mouse_pitch.Remove(num); Recoil_Manager.mouse_yaw.Remove(num); } } } Recoil_Manager.mouse_pitch[Clock.Time] = Math.Abs(__instance.m_lookInputMouse.y); Recoil_Manager.mouse_yaw[Clock.Time] = Math.Abs(__instance.m_lookInputMouse.x); Recoil_Manager.last_pitch = __instance.m_lookInputMouse.y; Recoil_Manager.last_yaw = __instance.m_lookInputMouse.x; } } [HarmonyPatch(typeof(BulletWeapon), "Fire")] internal static class Patch_BulletWeaponFire { [HarmonyWrapSafe] public static void Prefix(BulletWeapon __instance) { if (!Recoil_Manager.is_allowed || !((ItemEquippable)__instance).FPItemHolder.ItemAimTrigger || !((Agent)((Item)__instance).Owner).IsLocallyOwned) { return; } Recoil_Manager.is_aiming = true; Recoil_Manager.total_yaw = 0f; Recoil_Manager.total_pitch = 0f; foreach (float key in Recoil_Manager.mouse_pitch.Keys) { if (key >= Clock.Time - 0.07f) { Recoil_Manager.total_yaw += Recoil_Manager.mouse_yaw[key]; Recoil_Manager.total_pitch += Recoil_Manager.mouse_pitch[key]; } } Recoil_Manager.mouse_pitch.Clear(); Recoil_Manager.mouse_yaw.Clear(); } } [HarmonyPatch(typeof(FPS_RecoilSystem))] internal static class Patch_FPS_RecoilSystem { [HarmonyPatch("ApplyRecoil")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool ApplyRecoil_prefix(FPS_RecoilSystem __instance, Vector2 __result, bool resetSimilarity, RecoilDataBlock recoilData) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_02ec: 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_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0325: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) if (Recoil_Manager.is_allowed) { Recoil_Manager.horizontalScale_min = recoilData.horizontalScale.Min; Recoil_Manager.horizontalScale_max = recoilData.horizontalScale.Max; Recoil_Manager.verticalScale_min = recoilData.verticalScale.Min; Recoil_Manager.verticalScale_max = recoilData.verticalScale.Max; Recoil_Manager.power_min = recoilData.power.Min; Recoil_Manager.power_max = recoilData.power.Max; if (Recoil_Manager.is_aiming) { Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(recoilData.verticalScale.GetRandom(), recoilData.horizontalScale.GetRandom()); float random = recoilData.power.GetRandom(); Vector2 val2 = val; ((Vector2)(ref val2)).Normalize(); val2 *= random; Logs.debugChat($"V:{val2.x}, H:{val2.y} "); float num = 1f; float num2 = 1f; if (Recoil_Manager.total_pitch > 0.0001f) { if (Math.Abs(Recoil_Manager.last_pitch) > 0.001f) { num = 0.5f; } if (Recoil_Manager.total_pitch > 0.26f) { num2 = 1f - Recoil_Manager.total_pitch / (Math.Abs(val2.y) * 4f); if (num2 <= 0.3f) { num2 = 0.3f; } Logs.debugChat($"pitch:[{Recoil_Manager.last_pitch}]{Recoil_Manager.total_pitch} => H:{val2.y}, multi:{num2} "); } } float num3 = 1f; float num4 = 1f; if (Recoil_Manager.total_yaw > 0.001f) { if (Math.Abs(Recoil_Manager.last_yaw) > 0.0001f) { num3 = 0.5f; } if (Recoil_Manager.total_yaw > 0.26f) { num4 = 1f - Recoil_Manager.total_yaw / (Math.Abs(val2.x) * 1f); if (num4 <= 0.2f) { num4 = 0.2f; } Logs.debugChat($"YAW:[{Recoil_Manager.last_yaw}]{Recoil_Manager.total_yaw} => V:{val2.x}, multi:{num4}"); } } val2.x *= num * num4; val2.y *= num2 * num3; float magnitude = ((Vector2)(ref val2)).magnitude; recoilData.power.Min = magnitude; recoilData.power.Max = magnitude; recoilData.horizontalScale.Min = val2.y; recoilData.horizontalScale.Max = val2.y; recoilData.verticalScale.Min = val2.x; recoilData.verticalScale.Max = val2.x; } Recoil_Manager.is_aiming = false; } return true; } [HarmonyPatch("ApplyRecoil")] [HarmonyPostfix] [HarmonyWrapSafe] public static void ApplyRecoil_postfix(FPS_RecoilSystem __instance, Vector2 __result, bool resetSimilarity, RecoilDataBlock recoilData) { if (Recoil_Manager.is_allowed) { recoilData.horizontalScale.Min = Recoil_Manager.horizontalScale_min; recoilData.horizontalScale.Max = Recoil_Manager.horizontalScale_max; recoilData.verticalScale.Min = Recoil_Manager.verticalScale_min; recoilData.verticalScale.Max = Recoil_Manager.verticalScale_max; recoilData.power.Min = Recoil_Manager.power_min; recoilData.power.Max = Recoil_Manager.power_max; } } } public static class Slide_Manager { public static bool can_slide_boost = false; public static bool is_allowed = false; public static bool is_gliding = false; public static bool is_boost_gliding = false; public static Vector3 jump_end_hvec; public static bool stand_exit_check = false; public static bool can_glide = false; public static bool can_slide_jump = false; public static bool can_slide_jump_boost = false; public static float start_slide_time = 0f; public static float start_slow_time = 0f; public static float glide_speedMulti = 1f; public static float last_slide_jump_speed = 1f; public static bool jump_speed_lock = false; public static float getSpeedMulti(PlayerAgent client) { //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) Vector3 horizontalVelocity = client.Locomotion.HorizontalVelocity; float magnitude = ((Vector3)(ref horizontalVelocity)).magnitude; float num = 1f; if (can_slide_boost) { can_slide_boost = false; is_boost_gliding = true; start_slow_time = Clock.Time; float num2 = 1.52f; float num3 = -0.14f; float num4 = num2 - client.PlayerData.runMoveSpeed * num3; num = magnitude * num3 + num4; if (num < 1f) { num = 1f; } } else { float num5 = Clock.Time - start_slow_time; num = 0f - (float)Math.Pow(num5 * 0.36f, 3.200000047683716) + 0.97f; if (num < 0.9f) { num = 0.9f; } } glide_speedMulti = num; return num; } public static Vector3 GetExtraSpeedFromGround(PlayerAgent client) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0036: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b5: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0200: 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_0168: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) Vector3 result = default(Vector3); ((Vector3)(ref result))..ctor(0f, 0f, 0f); Vector3 val = ((Component)client).transform.position + Vector3.up * 0.2f; RaycastHit val2 = default(RaycastHit); bool flag = Physics.Raycast(val, Vector3.down, ref val2, 0.8f, LayerManager.MASK_DEFAULT); if (!flag) { val += ((Component)client).transform.right * 0.2f; flag = Physics.Raycast(val, Vector3.down, ref val2, 0.5f, LayerManager.MASK_DEFAULT); } if (!flag) { val += ((Component)client).transform.right * -0.4f; flag = Physics.Raycast(val, Vector3.down, ref val2, 0.5f, LayerManager.MASK_DEFAULT); } if (flag) { Vector3 val3 = ((RaycastHit)(ref val2)).normal; float num = Mathf.Acos(Vector3.Dot(val3, Vector3.up)) * 57.29578f; Vector3 val4 = client.PlayerCharacterController.m_lastActualFixedMove; Vector3 val5 = default(Vector3); ((Vector3)(ref val5))..ctor(0f, ((Vector3)(ref val4))[1], 0f); float magnitude = ((Vector3)(ref val5)).magnitude; val4 = client.PlayerCharacterController.m_lastActualFixedMove; float num2 = magnitude / ((Vector3)(ref val4)).magnitude * 100f; if (num == 0f && num2 > 17f) { val3 = GetGroundNormalFromTriangle(client); num = Mathf.Acos(Vector3.Dot(val3, Vector3.up)) * 57.29578f; } float val6 = num / 60f; float val7 = num2 / 1.7f / 60f; float value = Math.Max(val6, val7); value = Math.Clamp(value, 0.05f, 0.8f); if (num > 10f || num2 > 17f) { val4 = VecCast(val3, Vector3.up); Vector3 normalized = ((Vector3)(ref val4)).normalized; result = normalized * value; return result; } } return result; } public static Vector3 GetGroundNormalFromTriangle(PlayerAgent client) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_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) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(0f, 1f, 0f); Vector3 val2 = ((Component)client).transform.position + Vector3.up * 0.4f + ((Component)client).transform.forward * 0.2f; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, Vector3.down, ref val3, 1.4f, LayerManager.MASK_DEFAULT)) { Vector3 point = ((RaycastHit)(ref val3)).point; val2 = val2 + ((Component)client).transform.right * 0.3f - ((Component)client).transform.forward * 0.4f; if (Physics.Raycast(val2, Vector3.down, ref val3, 1.4f, LayerManager.MASK_DEFAULT)) { Vector3 point2 = ((RaycastHit)(ref val3)).point; val2 -= ((Component)client).transform.right * 0.6f; if (Physics.Raycast(val2, Vector3.down, ref val3, 1.4f, LayerManager.MASK_DEFAULT)) { Vector3 point3 = ((RaycastHit)(ref val3)).point; val = Cal_Normal_3D(point, point2, point3); } } } return ((Vector3)(ref val)).normalized; } public static Vector3 Cal_Normal_3D(Vector3 v1, Vector3 v2, Vector3 v3) { //IL_0001: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_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_002f: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) double num = (v2.y - v1.y) * (v3.z - v1.z) - (v2.z - v1.z) * (v3.y - v1.y); double num2 = (v2.z - v1.z) * (v3.x - v1.x) - (v2.x - v1.x) * (v3.z - v1.z); double num3 = (v2.x - v1.x) * (v3.y - v1.y) - (v2.y - v1.y) * (v3.x - v1.x); return new Vector3((float)num, (float)num2, (float)num3); } public static Vector3 VecCast(Vector3 vector, Vector3 PlaneNorm) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) return vector + PlaneNorm * (Vector3.Dot(vector, PlaneNorm) * -1f); } } [HarmonyPatch(typeof(PLOC_Run))] internal static class Patch_PLOC_Run { [HarmonyPatch("CommonEnter")] [HarmonyPostfix] [HarmonyWrapSafe] public static void CommonEnter(PLOC_Run __instance) { if (Slide_Manager.is_allowed) { __instance.m_enterTime -= 0.2f; } } [HarmonyPatch("Update")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Update(PLOC_Run __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 if (Slide_Manager.is_allowed && (int)((PLOC_Base)__instance).m_owner.Locomotion.m_currentStateEnum == 1) { if (Clock.Time - __instance.m_enterTime > 0.5f) { Slide_Manager.can_slide_boost = true; Slide_Manager.can_slide_jump_boost = true; } else { Slide_Manager.can_slide_boost = false; Slide_Manager.can_slide_jump_boost = false; } } } } [HarmonyPatch(typeof(PLOC_Jump))] internal static class Patch_PLOC_Jump { [HarmonyPatch("Enter")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Enter(PLOC_Jump __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_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_0074: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (!Slide_Manager.is_allowed) { return; } Logs.debugChat($"Jump from {((PLOC_Base)__instance).m_owner.Locomotion.m_lastStateEnum}"); if ((int)((PLOC_Base)__instance).m_owner.Locomotion.m_lastStateEnum == 1) { Vector3 horizontalVelocity; if (Slide_Manager.can_slide_jump) { if (Slide_Manager.can_slide_jump_boost) { PlayerLocomotion locomotion = ((PLOC_Base)__instance).m_owner.Locomotion; locomotion.VerticalVelocity *= 0.8f; PlayerLocomotion locomotion2 = ((PLOC_Base)__instance).m_owner.Locomotion; locomotion2.HorizontalVelocity *= 1.3f; horizontalVelocity = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; if (((Vector3)(ref horizontalVelocity)).magnitude < ((PLOC_Base)__instance).m_owner.PlayerData.runMoveSpeed * 1.3f) { PlayerLocomotion locomotion3 = ((PLOC_Base)__instance).m_owner.Locomotion; horizontalVelocity = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; locomotion3.HorizontalVelocity = ((Vector3)(ref horizontalVelocity)).normalized * ((PLOC_Base)__instance).m_owner.PlayerData.runMoveSpeed * 1.3f; } } horizontalVelocity = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; ((PLOC_Fall)__instance).m_maxHorizontalVelocity = Mathf.Clamp(((Vector3)(ref horizontalVelocity)).magnitude, ((PLOC_Base)__instance).m_owner.PlayerData.airMoveSpeed, ((PLOC_Base)__instance).m_owner.PlayerData.runMoveSpeed * 1.6f); Slide_Manager.last_slide_jump_speed = ((PLOC_Fall)__instance).m_maxHorizontalVelocity; Logs.debugChat($"Slide Jump!"); } else if (!Slide_Manager.jump_speed_lock) { horizontalVelocity = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; float magnitude = ((Vector3)(ref horizontalVelocity)).magnitude; if (magnitude < Slide_Manager.last_slide_jump_speed) { Slide_Manager.last_slide_jump_speed = magnitude; } if (((PLOC_Fall)__instance).m_maxHorizontalVelocity < Slide_Manager.last_slide_jump_speed * 0.97f) { Slide_Manager.last_slide_jump_speed = Mathf.Clamp(Slide_Manager.last_slide_jump_speed, ((PLOC_Fall)__instance).m_maxHorizontalVelocity, Slide_Manager.last_slide_jump_speed * 0.97f); ((PLOC_Fall)__instance).m_maxHorizontalVelocity = Slide_Manager.last_slide_jump_speed; } } } else { Slide_Manager.can_slide_boost = true; } Slide_Manager.can_slide_jump = false; Slide_Manager.can_slide_jump_boost = false; Slide_Manager.jump_speed_lock = false; } } [HarmonyPatch(typeof(PLOC_Fall))] internal static class Patch_PLOC_Fall { [HarmonyPatch("Enter")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Enter(PLOC_Fall __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (Slide_Manager.is_allowed) { Logs.debugChat($"Fall from {((PLOC_Base)__instance).m_owner.Locomotion.m_currentStateEnum}"); if ((int)((PLOC_Base)__instance).m_owner.Locomotion.m_lastStateEnum == 1 && (int)((PLOC_Base)__instance).m_owner.Locomotion.m_currentStateEnum == 4) { Vector3 horizontalVelocity = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; __instance.m_maxHorizontalVelocity = Mathf.Clamp(((Vector3)(ref horizontalVelocity)).magnitude, ((PLOC_Base)__instance).m_owner.PlayerData.airMoveSpeed, ((PLOC_Base)__instance).m_owner.PlayerData.runMoveSpeed * 2f); Slide_Manager.last_slide_jump_speed = __instance.m_maxHorizontalVelocity; } } } } [HarmonyPatch(typeof(PLOC_Crouch))] internal static class Patch_PLOC_Crouch { [HarmonyPatch("Enter")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Enter(PLOC_Crouch __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (Slide_Manager.is_allowed) { Vector3 horizontalVelocity = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; float magnitude = ((Vector3)(ref horizontalVelocity)).magnitude; if (Slide_Manager.can_slide_boost || magnitude >= ((PLOC_Base)__instance).m_owner.PlayerData.walkMoveSpeed * 1.1f) { Slide_Manager.is_gliding = true; Slide_Manager.start_slide_time = Clock.Time; Slide_Manager.start_slow_time = Clock.Time; } Slide_Manager.can_slide_jump = false; Slide_Manager.can_slide_jump_boost = false; Logs.debugChat($"start Crouch {Clock.Time},rig vec{magnitude}"); } } [HarmonyPatch("Exit")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Exit(PLOC_Crouch __instance) { if (!Slide_Manager.is_allowed) { return; } if (Slide_Manager.is_gliding) { Slide_Manager.can_slide_jump = false; Slide_Manager.jump_speed_lock = false; float num = Clock.Time - Slide_Manager.start_slide_time; if (num > 0.25f) { Slide_Manager.can_slide_jump = true; } else if (Slide_Manager.can_slide_jump_boost) { Slide_Manager.jump_speed_lock = true; } if (!Slide_Manager.is_boost_gliding) { Slide_Manager.can_slide_jump_boost = false; } } Slide_Manager.is_gliding = false; Slide_Manager.is_boost_gliding = false; Slide_Manager.can_slide_boost = false; Logs.debugChat($"end Crouch {Clock.Time}"); } [HarmonyPatch("FixedUpdate")] [HarmonyPostfix] [HarmonyWrapSafe] public static void FixedUpdate(PLOC_Crouch __instance) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (Slide_Manager.is_allowed) { Vector3 val = ((PLOC_Base)__instance).m_owner.Locomotion.VerticalVelocity; float magnitude = ((Vector3)(ref val)).magnitude; val = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; float magnitude2 = ((Vector3)(ref val)).magnitude; val = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity + ((PLOC_Base)__instance).m_owner.Locomotion.VerticalVelocity; float magnitude3 = ((Vector3)(ref val)).magnitude; float num = Clock.Time - Slide_Manager.start_slide_time; Logs.debugChat(string.Format("crouch {4}s {0} V: {1}, H:{2} M:{3}", magnitude3, magnitude, magnitude2, Slide_Manager.glide_speedMulti, num)); } } } [HarmonyPatch(typeof(PLOC_Base))] internal static class Patch_PLOC_Base { [HarmonyPatch("UpdateHorizontalVelocityOnGround")] [HarmonyPostfix] [HarmonyWrapSafe] public static void UpdateHorizontalVelocityOnGround(PLOC_Base __instance, float moveSpeed) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 if (Slide_Manager.is_allowed && Slide_Manager.stand_exit_check && (int)__instance.m_owner.Locomotion.m_currentStateEnum == 0 && ((int)__instance.m_owner.Locomotion.m_lastStateEnum == 4 || (int)__instance.m_owner.Locomotion.m_lastStateEnum == 3)) { __instance.m_owner.Locomotion.HorizontalVelocity = Slide_Manager.jump_end_hvec; } } [HarmonyPatch("GetHorizontalVelocityFromInput")] [HarmonyPrefix] [HarmonyWrapSafe] public static bool GetHorizontalVelocityFromInput(PLOC_Base __instance, out Vector3 __result, float moveSpeed) { //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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) __result = PLOC_Base.m_horVelInputCurrent; if (Slide_Manager.is_allowed && Slide_Manager.is_gliding) { Vector3 extraSpeedFromGround = Slide_Manager.GetExtraSpeedFromGround(__instance.m_owner); if (((Vector3)(ref extraSpeedFromGround)).magnitude > 0f) { Slide_Manager.start_slow_time = Clock.Time; PlayerLocomotion locomotion = __instance.m_owner.Locomotion; locomotion.HorizontalVelocity += extraSpeedFromGround; } float speedMulti = Slide_Manager.getSpeedMulti(__instance.m_owner); Vector3 val = __instance.m_owner.Locomotion.HorizontalVelocity * speedMulti; float magnitude = ((Vector3)(ref val)).magnitude; Vector3 lastActualFixedMove = __instance.m_owner.PlayerCharacterController.m_lastActualFixedMove; float num = ((Vector3)(ref lastActualFixedMove)).magnitude * 30f; float crouchMoveSpeed = __instance.m_owner.PlayerData.crouchMoveSpeed; if (magnitude > crouchMoveSpeed && num > crouchMoveSpeed) { float moveSpeedModifier = __instance.m_owner.EnemyCollision.MoveSpeedModifier; float num2 = Mathf.Clamp(magnitude, __instance.m_owner.PlayerData.crouchMoveSpeed, magnitude * moveSpeedModifier); val = __instance.m_owner.Locomotion.HorizontalVelocity; PLOC_Base.m_horVelInputCurrent = ((Vector3)(ref val)).normalized * num2; ((Vector3)(ref lastActualFixedMove))[1] = 0f; Vector3 normalized = ((Vector3)(ref lastActualFixedMove)).normalized; PLOC_Base.m_horVelInputCurrent += normalized * num2 * 0.1f; val = PLOC_Base.m_horVelInputCurrent; PLOC_Base.m_horVelInputCurrent = ((Vector3)(ref val)).normalized * num2; __result = PLOC_Base.m_horVelInputCurrent; return false; } Slide_Manager.is_gliding = false; Slide_Manager.is_boost_gliding = false; } return true; } } [HarmonyPatch(typeof(PLOC_Stand))] internal static class Patch_PLOC_Stand_Slide { [HarmonyPatch("Enter")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Enter(PLOC_Stand __instance) { //IL_0012: 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) Slide_Manager.stand_exit_check = true; Slide_Manager.jump_end_hvec = ((PLOC_Base)__instance).m_owner.Locomotion.HorizontalVelocity; } [HarmonyPatch("Exit")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Exit(PLOC_Run __instance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (Slide_Manager.is_allowed && !Slide_Manager.stand_exit_check) { Slide_Manager.can_slide_boost = false; } Logs.debugChat($"Stand Exit to {((PLOC_Base)__instance).m_owner.Locomotion.m_currentStateEnum}"); } } [HarmonyPatch(typeof(PlayerLocomotion), "ChangeState")] internal static class Patch_PlayerLocomotionChangeState { [HarmonyWrapSafe] public static void Prefix(PlayerLocomotion __instance, PLOC_State state) { //IL_0007: 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) Logs.debugChat($"{__instance.m_lastStateEnum} => {state}"); } } public static class RunReload_Manager { public static bool can_slide_boost = false; public static bool is_allowed = false; public static float last_speedScale = 1f; public static bool last_reloadState = false; } [HarmonyPatch(typeof(PlayerInventoryBase))] internal static class Patch_PlayerInventoryBase { [HarmonyPatch("CanReloadCurrent")] [HarmonyPrefix] [HarmonyWrapSafe] public static void CanReloadCurrent_prefix(PlayerInventoryBase __instance) { if (RunReload_Manager.is_allowed && ((Agent)__instance.Owner).IsLocallyOwned) { __instance.Owner.Locomotion.IsRunning = false; } } [HarmonyPatch("CanReloadCurrent")] [HarmonyPostfix] [HarmonyWrapSafe] public static void CanReloadCurrent_postfix(PlayerInventoryBase __instance) { if (RunReload_Manager.is_allowed && ((Agent)__instance.Owner).IsLocallyOwned && (Object)(object)__instance.Owner.FPItemHolder != (Object)null) { __instance.Owner.Locomotion.IsRunning = __instance.Owner.FPItemHolder.IsRunning; } } } [HarmonyPatch(typeof(PLOC_Run))] internal static class Patch_PLOC_Run_FixedUpdate { [HarmonyPatch("FixedUpdate")] [HarmonyPrefix] [HarmonyWrapSafe] public static void FixedUpdate_prefix(PLOC_Run __instance) { RunReload_Manager.last_speedScale = __instance.m_speedScale; if (RunReload_Manager.is_allowed && (Object)(object)((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem != (Object)null && ((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem.IsReloading) { __instance.m_speedScale *= 0.75f; } } [HarmonyPatch("FixedUpdate")] [HarmonyPostfix] [HarmonyWrapSafe] public static void FixedUpdate_postfix(PLOC_Run __instance) { if (RunReload_Manager.is_allowed && (Object)(object)((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem != (Object)null && ((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem.IsReloading) { __instance.m_speedScale = RunReload_Manager.last_speedScale; } } } [HarmonyPatch(typeof(PLOC_Stand))] internal static class Patch_PLOC_Stand_RunReload { [HarmonyPatch("Update")] [HarmonyPrefix] [HarmonyWrapSafe] public static void Update_prefix(PLOC_Run __instance) { if (RunReload_Manager.is_allowed && (Object)(object)((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem != (Object)null) { RunReload_Manager.last_reloadState = ((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem.IsReloading; ((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem.IsReloading = false; } } [HarmonyPatch("Update")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Update_postfix(PLOC_Run __instance) { if (RunReload_Manager.is_allowed && (Object)(object)((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem != (Object)null) { ((PLOC_Base)__instance).m_owner.FPItemHolder.WieldedItem.IsReloading = RunReload_Manager.last_reloadState; } Slide_Manager.stand_exit_check = false; } } }
LocaliaCore.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using LevelGeneration; using Player; using SNetwork; using SemanticVersioning; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("LocaliaCore")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LocaliaCore")] [assembly: AssemblyTitle("LocaliaCore")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LocaliaCore; [BepInPlugin("Localia.LocaliaCore", "LocaliaCore", "3.0.0")] public class EntryPoint : BasePlugin { private Harmony m_Harmony; private const string Version = "3.0.0"; public const string ver = "3.0.0"; public override void Load() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp<LocaliaCore_Moniter>(); m_Harmony = new Harmony("Localia.LocaliaCore"); m_Harmony.PatchAll(); Logs.Info($"OK"); } } internal static class Logs { private static readonly ManualLogSource _logger; public static bool canDebug; static Logs() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown canDebug = false; _logger = new ManualLogSource("LocaliaCore"); Logger.Sources.Add((ILogSource)(object)_logger); } private static string Format(object msg) { return msg.ToString(); } public static void Info(object data) { _logger.LogMessage((object)Format(data)); } public static void debugChat(string data) { if (canDebug) { PlayerChatManager.PostChatMessageLocaly(SNet.LocalPlayer, data, (SNet_Player)null); } } public static void debugInfo(object data) { if (canDebug) { _logger.LogDebug((object)Format(data)); } } public static void Verbose(object data) { _logger.LogDebug((object)Format(data)); } public static void Debug(object data) { _logger.LogDebug((object)Format(data)); } public static void Error(object data) { _logger.LogError((object)Format(data)); } } [HarmonyPatch(typeof(StartMainGame), "Start")] internal static class Patch_StartMainGame { public static void Postfix() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (!LocaliaCore_Moniter.m_setuped) { LocaliaCore_Moniter.m_setuped = true; GameObject val = new GameObject("LocaliaCore"); Object.DontDestroyOnLoad((Object)(object)val); LocaliaCore_Moniter.current = val.AddComponent<LocaliaCore_Moniter>(); } } } [HarmonyPatch(typeof(GameStateManager), "DoChangeState")] internal static class Patch_DoChangeState { [HarmonyWrapSafe] public static void Postfix(GameStateManager __instance, eGameStateName nextState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 if ((int)nextState == 4) { LocaliaCore_Moniter.m_canUpdate = false; LocaliaCore_Moniter.clearCount(); Network_Manager.outLobbyClear(); } else if ((int)nextState == 5 || (int)nextState == 10) { LocaliaCore_Moniter.m_canUpdate = true; } else { if ((int)nextState != 1) { return; } StringBuilder stringBuilder = new StringBuilder(); string text = null; foreach (KeyValuePair<string, PluginInfo> plugin in ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins) { text = plugin.Key.Replace(";", " "); Network_Manager.myModList.Add(text); stringBuilder.Append(text + ";"); } text = stringBuilder.ToString(); text = text.Substring(0, text.Length - 1); Network_Manager.myModListBuffer_raw = Network_Manager.ChangtoDicBuffer(Network_Manager.MakeHeader(Network_Manager.dataType.MODLIST_DATA), text, 50); text = Cmp.GZipCompressString(text); Network_Manager.myModListBuffer = Network_Manager.ChangtoDicBuffer(Network_Manager.MakeHeader(Network_Manager.dataType.MODLIST_DATA), text, 50); API.onLoadedModList(); } } } [HarmonyPatch(typeof(SNet_PlayerSlotManager), "AddToPlayersInGame")] internal static class Patch_AddToPlayersInGame { [HarmonyWrapSafe] public static void Postfix(SNet_PlayerSlotManager __instance, bool __result, SNet_Player player) { if ((__result && Network_Manager.slot_lookup[player.PlayerSlotIndex()] == 0L) || Network_Manager.slot_lookup[player.PlayerSlotIndex()] != player.Lookup) { Logs.debugChat($"[{player.PlayerSlotIndex()}]{player.NickName} {player.Lookup} joined"); Network_Manager.clearSlot(player.PlayerSlotIndex()); Network_Manager.addSlotLookup(player); } } } [HarmonyPatch(typeof(SNet_PlayerSlotManager), "RemoveFromPlayersInGame")] internal static class Patch_RemoveFromPlayersInGame { [HarmonyWrapSafe] public static void Postfix(SNet_PlayerSlotManager __instance, bool __result, SNet_Player player) { if (__result && Network_Manager.slot_lookup[player.PlayerSlotIndex()] != 0) { Logs.debugChat($"<#F00>Remove Player [{player.PlayerSlotIndex()}]{player.NickName} {player.Lookup}"); Network_Manager.clearSlot(player.PlayerSlotIndex()); } } } [HarmonyPatch(typeof(SNet_SessionHub), "RemovePlayerFromSession")] internal static class Patch_RemovePlayerFromSession { [HarmonyWrapSafe] public static void Prefix(SNet_SessionHub __instance, SNet_Player player, bool broadcastIfMaster = true) { if ((Object)(object)player != (Object)null && __instance.PlayersInSession.Contains(player) && Network_Manager.slot_lookup[player.PlayerSlotIndex()] != 0) { Logs.debugChat($"<#F00>Remove Player Hub [{player.PlayerSlotIndex()}]{player.NickName} {player.Lookup}"); Network_Manager.clearSlot(player.PlayerSlotIndex()); } } } [HarmonyPatch(typeof(PlayerSync), "IncomingMapInteraction")] internal static class Patch_IncomingMapInteraction { [HarmonyWrapSafe] public static bool Prefix(PlayerSync __instance, pPlayerMapInteraction data) { //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_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) if (__instance.m_agent.IsBeingDespawned) { return false; } if (data.position.x == 114.514f && data.position.y == 233.666f) { int num = __instance.m_agent.Owner.PlayerSlotIndex(); ulong lookup = __instance.m_agent.Owner.Lookup; if (Network_Manager.slot_lookup[num] != 0L && Network_Manager.slot_lookup[num] == lookup) { if (Network_Manager.slot_avaliable[num] != lookup) { Logs.debugChat($"<#0F0>Get Available Info [{__instance.m_agent.Owner.PlayerSlotIndex()}]{__instance.m_agent.PlayerName} {__instance.m_agent.Owner.Lookup}"); } } else { Logs.debugChat($"<#0F0>Get Quick Available Info [{__instance.m_agent.Owner.PlayerSlotIndex()}]{__instance.m_agent.PlayerName} {__instance.m_agent.Owner.Lookup}"); Network_Manager.clearSlot(num); Network_Manager.addSlotLookup(__instance.m_agent.Owner); } Network_Manager.slot_avaliable[num] = lookup; if (Network_Manager.slot_ChalNum[num] == 0) { Network_Manager.a2s_back_times[num]++; if (Network_Manager.a2s_back_times[num] < 30) { Network_Manager.sendA2s_Info(__instance.m_agent.Owner); } Logs.debugInfo($"[{num}]a2s_back_times {Network_Manager.a2s_back_times[num]}"); } Network_Manager.sendCoreInfo(num); return false; } return true; } } [HarmonyPatch(typeof(LG_ComputerTerminalManager), "DoSendTerminalString")] internal static class Patch_DoSendTerminalString { [HarmonyWrapSafe] public static bool Prefix(LG_ComputerTerminalManager __instance, pTerminalString data) { return Network_Manager.processTerminalData(data); } } [HarmonyPatch(typeof(LG_ComputerTerminalManager), "DoSendTerminalStringValidation")] internal static class Patch_DoSendTerminalStringValidation { [HarmonyWrapSafe] public static bool Prefix(LG_ComputerTerminalManager __instance, pTerminalString data) { return Network_Manager.processTerminalData(data); } } internal class Network_Manager { public enum dataType { NONE, CORE_INFO, GET_MODLIST, MODLIST_DATA, USE_MODLIST_RAW, HEARTBEAT_PACK, HEARTBEAT_PACK_BACK } public static ulong[] slot_lookup = new ulong[4]; public static SNet_Player[] slot_SNet = (SNet_Player[])(object)new SNet_Player[4]; public static ulong[] slot_avaliable = new ulong[4]; public static Version[] slot_coreVer = (Version[])(object)new Version[4]; public static bool[] gotModList = new bool[4]; public static bool[] gettingModList = new bool[4]; public static float[] last_try_get_time = new float[4]; public static int[] try_times = new int[4]; public static int[] a2s_back_times = new int[4]; public static int[] slot_ChalNum = new int[4]; public static uint[] modListBufferLength = new uint[4]; public static float[] lastHeartBeatTime = new float[4]; public static Dictionary<uint, float> heartBeatBuffer = new Dictionary<uint, float>(); public static int[] slot_ping = new int[4]; public static Dictionary<uint, string>[] modListBuffer = new Dictionary<uint, string>[4]; public static List<string>[] modList = new List<string>[4]; public static Dictionary<uint, string> myModListBuffer = new Dictionary<uint, string>(); public static Dictionary<uint, string> myModListBuffer_raw = new Dictionary<uint, string>(); public static List<string> myModList = new List<string>(); public static bool USE_BUFFER_RAW = false; public static uint maxAllowedIndex = 100000u; public static int myChalNum = 0; public static void addSlotLookup(SNet_Player player) { if (player.PlayerSlotIndex() != -1) { slot_lookup[player.PlayerSlotIndex()] = player.Lookup; slot_SNet[player.PlayerSlotIndex()] = player; if (player.IsLocal) { addLocalToSlot(player); LocaliaCore_Moniter.boardcastAvaliable = 5; } else { sendA2s_Info(player); } } } public static void clearSlot(int slot) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (slot != -1) { slot_lookup[slot] = 0uL; slot_avaliable[slot] = 0uL; slot_coreVer[slot] = new Version("0.0.0", false); try_times[slot] = 0; a2s_back_times[slot] = 0; last_try_get_time[slot] = 0f; modListBufferLength[slot] = 0u; lastHeartBeatTime[slot] = 0f; slot_ChalNum[slot] = 0; slot_ping[slot] = -1; slot_SNet[slot] = null; gotModList[slot] = false; gettingModList[slot] = false; if (modListBuffer[slot] != null) { modListBuffer[slot].Clear(); } if (modList[slot] != null) { modList[slot].Clear(); } modListBuffer[slot] = new Dictionary<uint, string>(); modList[slot] = new List<string>(); } } public static void outLobbyClear() { Random random = new Random(); myChalNum = random.Next(10000, 99999); for (int i = 0; i < 4; i++) { clearSlot(i); } heartBeatBuffer.Clear(); } public static void addLocalToSlot(SNet_Player player) { int num = player.PlayerSlotIndex(); slot_avaliable[num] = player.Lookup; gotModList[num] = true; modList[num] = new List<string>(myModList); API.onGotModList(num, modList[num]); } public static bool processTerminalData(pTerminalString data) { if (data.ID >= 2330000000u) { try { string text = data.ID.ToString(CultureInfo.InvariantCulture); if (text.StartsWith("233")) { string s = text[3].ToString(CultureInfo.InvariantCulture); int num = int.Parse(s, CultureInfo.InvariantCulture.NumberFormat); if (isValidSlot(num)) { uint num2 = data.ID - (uint)(-1964967296 + num * 1000000); string data2 = data.inputString.data; string[] array = data2.Split('@'); string[] array2 = array[0].Split(';'); dataType dataType = (dataType)int.Parse(array2[0], CultureInfo.InvariantCulture.NumberFormat); Logs.debugInfo($"[{num}] => Me, {dataType}({num2}): {data2}"); switch (dataType) { case dataType.CORE_INFO: onRecv_CoreInfo(num, num2, array[1]); break; case dataType.MODLIST_DATA: onRecv_ModListData(num, num2, array[1]); break; case dataType.GET_MODLIST: onRecv_GetModList(num, num2, array[1]); break; case dataType.USE_MODLIST_RAW: onRecv_UseModlistRaw(num, num2, array[1]); break; case dataType.HEARTBEAT_PACK: onRecv_HeartBeat(num, num2, array[1]); break; case dataType.HEARTBEAT_PACK_BACK: onRecv_HeartBeatBack(num, num2, array[1]); break; } bool flag = Convert.ToBoolean(Convert.ToInt32(array2[1])); bool flag2 = Convert.ToBoolean(Convert.ToInt32(array2[2])); } } } catch (Exception ex) { Logs.Error(ex.Message); } return false; } return true; } public static void onRecv_CoreInfo(int slot, uint index, string body) { string[] array = body.Split(";"); int num = int.Parse(array[0], CultureInfo.InvariantCulture.NumberFormat); uint num2 = uint.Parse(array[1], CultureInfo.InvariantCulture.NumberFormat); Version val = Version.Parse(array[2], false); if (num2 == 0) { Logs.Error($"[{slot}]Mod list length is {num2}?"); } else if (num <= 10000) { Logs.Error($"[{slot}]ChalNumber is {num}?"); } else if (!gotModList[slot] && !gettingModList[slot] && try_times[slot] < 5) { gettingModList[slot] = true; modListBufferLength[slot] = num2; slot_ChalNum[slot] = num; slot_coreVer[slot] = val; Logs.debugChat($"<#FF0>[{slot}] Got CoreInfo. ML Len: {num2}, Ver: {val}"); sendGetModList(slot); } } public static void onRecv_GetModList(int slot, uint index, string body) { string[] array = body.Split(";"); int num = int.Parse(array[0], CultureInfo.InvariantCulture.NumberFormat); if (num == myChalNum) { string[] array2 = array[1].Split(","); int[] array3 = new int[array2.Length]; for (int i = 0; i < array2.Length; i++) { array3[i] = int.Parse(array2[i], CultureInfo.InvariantCulture.NumberFormat); } sendModListData(slot, array3); } } public static void onRecv_HeartBeat(int slot, uint index, string body) { string[] array = body.Split(";"); int num = int.Parse(array[0], CultureInfo.InvariantCulture.NumberFormat); if (num == myChalNum) { sendHeartBeatBacK(slot, index, (array.Length > 1) ? array[1] : ""); } } public static void onRecv_HeartBeatBack(int slot, uint index, string timestamp) { if (timestamp.Length > 1) { lastHeartBeatTime[slot] = 0f; int num = (int)((Clock.Time - float.Parse(timestamp, CultureInfo.InvariantCulture.NumberFormat)) * 1000f); if (num > 999) { num = 999; } slot_ping[slot] = num; } else if (heartBeatBuffer.ContainsKey(index)) { lastHeartBeatTime[slot] = 0f; int num2 = (int)((Clock.Time - heartBeatBuffer[index]) * 1000f); if (num2 > 999) { num2 = 999; } slot_ping[slot] = num2; heartBeatBuffer.Remove(index); } } public static void onRecv_UseModlistRaw(int slot, uint index, string body) { int num = int.Parse(body, CultureInfo.InvariantCulture.NumberFormat); if (num == myChalNum) { USE_BUFFER_RAW = true; sendCoreInfo(slot); } } public static void onRecv_ModListData(int slot, uint index, string body) { if (gotModList[slot] || !gettingModList[slot]) { return; } uint num = modListBufferLength[slot]; if (num == 0 && index >= num) { return; } modListBuffer[slot][index] = body; if (modListBuffer[slot].Count == num) { modListBufferLength[slot] = 0u; try_times[slot]++; gettingModList[slot] = false; Logs.debugChat($"<#FF0>[{slot}] Mod List Compeleted"); string text = DicMerge(modListBuffer[slot]); string text2 = null; modListBuffer[slot].Clear(); modList[slot].Clear(); try { text2 = Cmp.GZipDecompressString(text); } catch (Exception ex) { Logs.Error(ex.Message); text2 = null; } if (text2 == null) { text2 = text; sendUseModlistRaw(slot); } Logs.debugInfo($"[{slot}] Mod List Compeleted: {text2}"); modList[slot] = stringToList(text2); gotModList[slot] = true; sendCoreInfo(slot); API.onGotModList(slot, modList[slot]); } } public static void sendGetModList(int slot, int get_1 = 0, int get_2 = 0, int get_3 = 0) { if (!isValidSlot(slot)) { Logs.Error($"try to sendGetModList to invalid slot [{slot}]"); return; } last_try_get_time[slot] = Clock.Time; string text = string.Format(CultureInfo.InvariantCulture, "{0}{1};{2},{3},{4}", MakeHeader(dataType.GET_MODLIST), slot_ChalNum[slot], get_1, get_2, get_3); Send(slot_SNet[slot], dataType.GET_MODLIST, text); } public static void sendUseModlistRaw(int slot) { if (!isValidSlot(slot)) { Logs.Error($"try to sendUseModlistRaw to invalid slot [{slot}]"); return; } string text = string.Format(CultureInfo.InvariantCulture, "{0}{1}", MakeHeader(dataType.USE_MODLIST_RAW), slot_ChalNum[slot]); Send(slot_SNet[slot], dataType.USE_MODLIST_RAW, text); } public static void sendHeartBeat(int slot, uint index) { if (!isValidSlot(slot)) { Logs.Error($"try to sendHeartBeat to invalid slot [{slot}]"); return; } string text = string.Format(CultureInfo.InvariantCulture, "{0}{1};{2}", MakeHeader(dataType.HEARTBEAT_PACK), slot_ChalNum[slot], Clock.Time.ToString(CultureInfo.InvariantCulture.NumberFormat)); Send(slot_SNet[slot], dataType.HEARTBEAT_PACK, text, index, DebugChat: false); } public static void sendHeartBeatBacK(int slot, uint index, string timestamp) { if (!isValidSlot(slot)) { Logs.Error($"try to sendHeartBeatBacK to invalid slot [{slot}]"); return; } string text = string.Format(CultureInfo.InvariantCulture, "{0}{1}", MakeHeader(dataType.HEARTBEAT_PACK_BACK), timestamp); Send(slot_SNet[slot], dataType.HEARTBEAT_PACK, text, index, DebugChat: false); } public static void sendModListData(int slot, int[] send_list) { if (!isValidSlot(slot)) { Logs.Error($"try to sendModListData to invalid slot [{slot}]"); return; } bool flag = false; uint num = 0u; for (int i = 0; i < send_list.Length; i++) { if (send_list[i] > 0) { flag = true; num = (uint)send_list[i]; Send(slot_SNet[slot], dataType.MODLIST_DATA, USE_BUFFER_RAW ? myModListBuffer_raw[num] : myModListBuffer[num], num, DebugChat: false); } } if (!flag) { int num2 = (USE_BUFFER_RAW ? myModListBuffer_raw.Count : myModListBuffer.Count); for (int j = 0; j < num2; j++) { Send(slot_SNet[slot], dataType.MODLIST_DATA, USE_BUFFER_RAW ? myModListBuffer_raw[(uint)j] : myModListBuffer[(uint)j], (uint)j, DebugChat: false); } } } public static void sendCoreInfo(int slot) { if (!isValidSlot(slot)) { Logs.Error($"try to sendCoreInfo to invalid slot [{slot}]"); return; } string text = string.Format(CultureInfo.InvariantCulture, "{0}{1};{2};{3}", MakeHeader(dataType.CORE_INFO), myChalNum, USE_BUFFER_RAW ? myModListBuffer_raw.Count : myModListBuffer.Count, API.Core_VersionString()); Send(slot_SNet[slot], dataType.CORE_INFO, text); } public static string MakeHeader(dataType type, bool mustConfirm = false, bool masterBoardCast = false) { return string.Format(CultureInfo.InvariantCulture, "{0};{1};{2}@", (int)type, Convert.ToInt32(mustConfirm), Convert.ToInt32(masterBoardCast)); } public static Dictionary<uint, string> ChangtoDicBuffer(string header, string content, int maxlength) { Dictionary<uint, string> dictionary = new Dictionary<uint, string>(); string text = null; int num = 0; int num2 = maxlength - header.Length - 1; int num3 = content.Length; uint num4 = 0u; while (num3 > 0) { if (num2 > num3) { num2 = num3; } text = content.Substring(num, num2); dictionary[num4] = header + text; num += num2; num3 -= num2; num4++; } return dictionary; } public static void Send(SNet_Player client, dataType type, string text, uint index = 0u, bool DebugChat = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown pTerminalString val = new pTerminalString(); int num = SNet.LocalPlayer.PlayerSlotIndex(); if (num >= 0 && num < 10) { val.ID = (uint)(-1964967296 + num * 1000000) + index; pString50 val2 = new pString50(); val2.m_data = text; val.inputString = val2; ((SNet_SyncedAction<pTerminalString>)(object)LG_ComputerTerminalManager.Current.m_sendTerminalString).m_packet.Send(val, (SNet_ChannelType)2, client); Logs.debugInfo($"Me => [{client.PlayerSlotIndex()}], {type}({index}): {val2.m_data}"); if (DebugChat) { Logs.debugChat($"<#05F>Send {type} to {client.NickName}"); } } } public static bool sendA2s_Info(SNet_Player client = null) { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); if ((Object)(object)localPlayerAgent != (Object)null) { Vector2 position = default(Vector2); ((Vector2)(ref position))..ctor(114.514f, 233.666f); pPlayerMapInteraction val = default(pPlayerMapInteraction); val.position = position; val.interaction = false; if ((Object)(object)client == (Object)null) { localPlayerAgent.Sync.m_mapInteractionPacket.Send(val, (SNet_ChannelType)2); Logs.debugChat($"<#05F>Send Available to all"); } else if (!client.IsBot) { localPlayerAgent.Sync.m_mapInteractionPacket.Send(val, (SNet_ChannelType)2, client); Logs.debugChat($"<#05F>Send Available to {client.NickName}"); } return true; } return false; } public static string DicMerge(Dictionary<uint, string> dic) { StringBuilder stringBuilder = new StringBuilder(); uint count = (uint)dic.Count; for (uint num = 0u; num < count; num++) { stringBuilder.Append(dic[num]); } return stringBuilder.ToString(); } public static List<string> stringToList(string data) { List<string> list = new List<string>(); string[] array = data.Split(';'); for (int i = 0; i < array.Length; i++) { list.Add(array[i]); Logs.debugInfo(string.Format(CultureInfo.InvariantCulture, "{0}", list[i])); } return list; } public static string Encrypt(string content, string secretKey) { byte[] bytes = Encoding.Unicode.GetBytes(content); byte[] bytes2 = Encoding.Unicode.GetBytes(secretKey); byte[] array = new byte[bytes.Length]; for (int i = 0; i < bytes.Length; i++) { array[i] = (byte)(bytes[i] ^ bytes2[i % bytes2.Length]); } return Encoding.Unicode.GetString(array); } public static bool isValidSlot(int slot) { if (slot < 0 || slot_lookup[slot] == 0L || slot_avaliable[slot] == 0L || (Object)(object)slot_SNet[slot] == (Object)null || slot_SNet[slot].IsBot || slot_SNet[slot].IsLocal) { return false; } return true; } } internal class Cmp { public static string GZipCompressString(string rawString) { if (string.IsNullOrEmpty(rawString) || rawString.Length == 0) { return ""; } byte[] bytes = Encoding.UTF8.GetBytes(rawString.ToString(CultureInfo.InvariantCulture)); byte[] inArray = Compress(bytes); return Convert.ToBase64String(inArray); } private static byte[] Compress(byte[] rawData) { MemoryStream memoryStream = new MemoryStream(); GZipStream gZipStream = new GZipStream(memoryStream, CompressionMode.Compress, leaveOpen: true); gZipStream.Write(rawData, 0, rawData.Length); gZipStream.Close(); return memoryStream.ToArray(); } public static string GetStringByString(string Value) { return GZipDecompressString(Value); } public static string GZipDecompressString(string zippedString) { if (string.IsNullOrEmpty(zippedString) || zippedString.Length == 0) { return ""; } byte[] zippedData = Convert.FromBase64String(zippedString.ToString(CultureInfo.InvariantCulture)); return Encoding.UTF8.GetString(Decompress(zippedData)); } public static byte[] Decompress(byte[] zippedData) { MemoryStream stream = new MemoryStream(zippedData); GZipStream gZipStream = new GZipStream(stream, CompressionMode.Decompress); MemoryStream memoryStream = new MemoryStream(); byte[] array = new byte[1024]; while (true) { int num = gZipStream.Read(array, 0, array.Length); if (num <= 0) { break; } memoryStream.Write(array, 0, num); } gZipStream.Close(); return memoryStream.ToArray(); } } public class API { public static Version Core_Version() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown return new Version("3.0.0", false); } public static string Core_VersionString() { return "3.0.0"; } public static bool is_Core_VersionSatisfy(string minVer, string maxVer = "9999.999.99") { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown Version val = new Version("3.0.0", false); Version val2 = new Version(minVer, false); Version val3 = new Version(maxVer, false); if (val >= val2 && val <= val3) { return true; } return false; } public static void PingEverywhereDeluxe_NewPoint() { } public static void APEX_SLIDE_START() { } public static void APEX_SLIDE_END() { } public static void TeamSharedVision_Lookat() { } public static void TeamSharedVision_Enemy_Focusing() { } public static void TeamSharedVision_Box_Focusing() { } public static void TeamSharedVision_XRAY_State_Changed() { } public static void BodyGlowStick_Create() { } public static void RC_MINE_Create() { } public static void RC_MINE_State_Changed() { } public static int HumanCount() { return LocaliaCore_Moniter.player_Count; } public static int AvailableHumanCount() { return LocaliaCore_Moniter.available_Count; } public static int ModListHumanCount() { return LocaliaCore_Moniter.completed_Count; } public static bool is_Valid_Human(int slot) { if (slot >= 0 && slot < 4 && Network_Manager.slot_lookup[slot] != 0 && (Object)(object)Network_Manager.slot_SNet[slot] != (Object)null && !Network_Manager.slot_SNet[slot].IsBot) { return true; } return false; } public static bool has_got_modlist(int slot) { if (slot >= 0 && slot < 4) { return Network_Manager.gotModList[slot]; } return false; } public static int Get_ModList_Count(int slot) { if (has_got_modlist(slot)) { return Network_Manager.modList[slot].Count; } return -1; } public static List<string> Get_ModList(int slot) { if (has_got_modlist(slot)) { return Network_Manager.modList[slot]; } return null; } public static int Get_Slot_Ping(int slot) { if (has_Install_Core(slot)) { return Network_Manager.slot_ping[slot]; } return -1; } public static bool has_Install_Core(int slot) { if (is_Valid_Human(slot) && Network_Manager.slot_avaliable[slot] != 0) { return true; } return false; } public static bool has_Everyone_Install_Core() { if (LocaliaCore_Moniter.available_Count == LocaliaCore_Moniter.player_Count) { return true; } return false; } public static bool has_Everyone_Got_Modlist() { if (LocaliaCore_Moniter.available_Count == LocaliaCore_Moniter.completed_Count) { return true; } return false; } public static bool has_Install_Plugin(int slot, string PLUGIN_GUID, string minVer = null, string maxVer = null) { if (has_got_modlist(slot) && Network_Manager.modList[slot].Count > 0 && Network_Manager.modList[slot].Contains(PLUGIN_GUID.Replace(";", " "))) { return true; } return false; } public static bool has_Everyone_Install_Plugin(string PLUGIN_GUID, string minVer, string maxVer) { for (int i = 0; i < 4; i++) { if (is_Valid_Human(i) && !has_Install_Plugin(i, PLUGIN_GUID)) { return false; } } return true; } public static void onLoadedModList() { } public static void onGotModList(int slot, List<string> ModList) { for (int i = 0; i < ModList.Count; i++) { Logs.debugInfo($"{ModList[i]}"); } } public static void onHumanCountChanged(int oldCount, int newCount) { LocaliaCore_Moniter.player_Count = newCount; } public static void onAvailableHumanCountChanged(int oldCount, int newCount) { LocaliaCore_Moniter.available_Count = newCount; } public static void onModListHumanCountChanged(int oldCount, int newCount) { LocaliaCore_Moniter.completed_Count = newCount; } } public class LocaliaCore_Moniter : MonoBehaviour { public static bool m_setuped = false; public static bool m_canUpdate = false; public static int available_Count; public static int player_Count; public static int boardcastAvaliable = 0; public static int completed_Count; public static uint heartBeatIndex = 0u; public static float next_heartbeat_time = 0f; public static float next_boardcastAvaliable_time = 0f; public static Version heartBeatV2 = new Version("1.1.2", false); public static LocaliaCore_Moniter current; public static void clearCount() { API.onHumanCountChanged(player_Count, 0); API.onAvailableHumanCountChanged(available_Count, 0); API.onModListHumanCountChanged(available_Count, 0); } public static void checkHeartbeat(int slot, bool canSend) { if (Network_Manager.slot_SNet[slot].IsLocal || Network_Manager.slot_ChalNum[slot] <= 0) { return; } if (canSend) { if (Network_Manager.slot_coreVer[slot] < heartBeatV2) { heartBeatIndex++; if (heartBeatIndex == Network_Manager.maxAllowedIndex) { heartBeatIndex = 0u; } Network_Manager.heartBeatBuffer[heartBeatIndex] = Clock.Time; if (Network_Manager.lastHeartBeatTime[slot] == 0f) { Network_Manager.lastHeartBeatTime[slot] = Network_Manager.heartBeatBuffer[heartBeatIndex]; } Network_Manager.sendHeartBeat(slot, heartBeatIndex); } else { if (Network_Manager.lastHeartBeatTime[slot] == 0f) { Network_Manager.lastHeartBeatTime[slot] = Clock.Time; } Network_Manager.sendHeartBeat(slot, 0u); } } if (Network_Manager.lastHeartBeatTime[slot] > 0f) { int num = (int)((Clock.Time - Network_Manager.lastHeartBeatTime[slot]) * 1000f); if (num > 999) { num = 999; } if (num > Network_Manager.slot_ping[slot]) { Network_Manager.slot_ping[slot] = num; } } } public static void checkModListGetting(int slot) { if (Network_Manager.gettingModList[slot] && Clock.Time - Network_Manager.last_try_get_time[slot] > 5f) { Network_Manager.gettingModList[slot] = false; if (Network_Manager.modListBuffer[slot] != null) { Network_Manager.modListBuffer[slot].Clear(); } Network_Manager.modListBuffer[slot] = new Dictionary<uint, string>(); Network_Manager.try_times[slot]++; if (Network_Manager.try_times[slot] < 5) { SNet_Player client = Network_Manager.slot_SNet[slot]; Network_Manager.sendA2s_Info(client); } } } public void FixedUpdate() { try { if (!m_canUpdate) { return; } if (boardcastAvaliable > 0 && Clock.Time > next_boardcastAvaliable_time && Network_Manager.sendA2s_Info()) { boardcastAvaliable--; next_boardcastAvaliable_time = Clock.Time + 2f * (float)(5 - boardcastAvaliable) + 1f; } int num = 0; int num2 = 0; int num3 = 0; bool canSend = false; if (Clock.Time > next_heartbeat_time) { next_heartbeat_time = Clock.Time + 0.5f; canSend = true; } for (int i = 0; i < 4; i++) { if (Network_Manager.slot_lookup[i] == 0 || !((Object)(object)Network_Manager.slot_SNet[i] != (Object)null) || Network_Manager.slot_SNet[i].IsBot) { continue; } num++; if (Network_Manager.slot_avaliable[i] != 0) { num2++; if (Network_Manager.gotModList[i]) { num3++; } else { checkModListGetting(i); } checkHeartbeat(i, canSend); } } bool flag = false; if (player_Count != num) { flag = true; API.onHumanCountChanged(player_Count, num); } if (available_Count != num2) { flag = true; API.onAvailableHumanCountChanged(available_Count, num2); } if (completed_Count != num3) { flag = true; API.onModListHumanCountChanged(available_Count, num3); } if (flag) { Logs.Verbose($"human available: {available_Count}/{player_Count}, credited: {completed_Count}"); } } catch (Exception ex) { Logs.Error(ex.Message); } } }
ModList.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CellMenu; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LocaliaCore; using SNetwork; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("ModList")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ModList")] [assembly: AssemblyTitle("ModList")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ModList; [BepInPlugin("Localia.ModList", "ModList", "3.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class EntryPoint : BasePlugin { private Harmony m_Harmony; public override void Load() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (API.is_Core_VersionSatisfy("3.0.0", "9999.999.99")) { m_Harmony = new Harmony("Localia.ModList"); m_Harmony.PatchAll(); Logs.Info($"OK"); } else { Logs.Error($"The LocaliaCore version is lower than the need version, please update."); ((BasePlugin)this).Unload(); } } } internal static class Logs { private static readonly ManualLogSource _logger; public static bool canDebug; static Logs() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown canDebug = false; _logger = new ManualLogSource("ModList"); Logger.Sources.Add((ILogSource)(object)_logger); } private static string Format(object msg) { return msg.ToString(); } public static void Info(object data) { _logger.LogMessage((object)Format(data)); } public static void debugChat(string data) { if (canDebug) { PlayerChatManager.PostChatMessageLocaly(SNet.LocalPlayer, data, (SNet_Player)null); } } public static void debugInfo(object data) { if (canDebug) { _logger.LogDebug((object)Format(data)); } } public static void Verbose(object data) { _logger.LogDebug((object)Format(data)); } public static void Debug(object data) { _logger.LogDebug((object)Format(data)); } public static void Error(object data) { _logger.LogError((object)Format(data)); } } [HarmonyPatch(typeof(GameStateManager), "DoChangeState")] internal static class Patch_DoChangeState { [HarmonyWrapSafe] public static void Postfix(GameStateManager __instance, eGameStateName nextState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Invalid comparison between Unknown and I4 if ((int)nextState == 1) { foreach (KeyValuePair<string, PluginInfo> plugin in ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins) { string key = plugin.Key.Replace(";", " "); ModList_Manager.myModDic[key] = plugin.Value.Metadata.Name; } return; } if ((int)nextState == 4) { ModList_Manager.ClearButtonText(); } } } [HarmonyPatch(typeof(CM_PageLoadout))] internal static class Patch_CM_PageLoadout { [HarmonyPatch("SetPageActive")] [HarmonyPostfix] [HarmonyWrapSafe] public static void SetPageActive(CM_PageLoadout __instance, bool active) { if (active) { ModList_Manager.GenerateLobbyButtons(); } } [HarmonyPatch("SetPopupVisible")] [HarmonyPostfix] [HarmonyWrapSafe] public static void SetPopupVisible(CM_PageLoadout __instance, bool visible) { if ((Object)(object)ModList_Manager.PageLoadout != (Object)null && !visible) { ((RectTransformComp)ModList_Manager.ModListWindow).SetVisible(visible); } } [HarmonyPatch("UpdatePlayerBars")] [HarmonyPostfix] [HarmonyWrapSafe] public static void Postfix() { ModList_Manager.checkSlotState(); } } internal class ModList_Manager { public static CM_PageLoadout PageLoadout; public static CM_ScrollWindow ModListWindow; public static Dictionary<string, string> myModDic = new Dictionary<string, string>(); public static CM_PlayerLobbyBar[] PlayerLobbyBars; public static CM_Item[] UI_ModButtons = (CM_Item[])(object)new CM_Item[4]; public static void ShowListWindow(int ori_slot) { //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) int num = PlayerLobbyBars[ori_slot].m_player.PlayerSlotIndex(); if (!API.has_got_modlist(num)) { return; } List<string> list = API.Get_ModList(num); List<iScrollWindowContent> val = new List<iScrollWindowContent>(); for (int i = 0; i < list.Count; i++) { iScrollWindowContent val2 = GOUtil.SpawnChildAndGetComp<iScrollWindowContent>(PageLoadout.m_inviteWindowContentPrefab); if (myModDic.Keys.Contains(list[i])) { val2.SetText("<#0f4f94>" + list[i]); } else { val2.SetText("<#b3b3b3>" + list[i]); } val.Add(val2); CM_TimedButton component = ((Component)val2.transform).GetComponent<CM_TimedButton>(); if ((Object)(object)component != (Object)null) { ((CM_Item)component).TextMeshRoot = ((Component)PageLoadout).transform; component.m_holdButtonDuration = 0f; ((RectTransformComp)component).ForcePopupLayer(true, (GameObject)null); } GameObject gameObject = ((Component)val2.transform.FindChild("Arrow")).gameObject; if ((Object)(object)gameObject != (Object)null) { gameObject.SetActive(false); } GameObject gameObject2 = ((Component)val2.transform.FindChild("MainText")).gameObject; if ((Object)(object)gameObject2 != (Object)null) { TextMeshPro component2 = ((Component)gameObject2.transform).GetComponent<TextMeshPro>(); ((TMP_Text)component2).fontStyle = (FontStyles)0; ((TMP_Text)component2).m_fontStyle = (FontStyles)0; ((TMP_Text)component2).m_FontStyleInternal = (FontStyles)0; RectTransform component3 = ((Component)gameObject2.transform).GetComponent<RectTransform>(); component3.offsetMax = new Vector2(700f, component3.offsetMax.y); } } float num2 = (float)val.Count * 60f; if (num2 < 300f) { num2 = 300f; } else if (num2 > 1000f) { num2 = 1000f; } if (PlayerLobbyBars[ori_slot].m_player.IsLocal) { ((Component)ModListWindow).transform.localScale = new Vector3(1f, 1f, 1f); } else { ((Component)ModListWindow).transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); } ModListWindow.SetContentItems(val, 10f); ((RectTransformComp)ModListWindow).SetSize(new Vector2(600f, num2)); ((Component)ModListWindow).transform.position = ((Component)UI_ModButtons[ori_slot]).transform.position; ((RectTransformComp)ModListWindow).SetVisible(true); } public static void checkSlotState() { if (!Object.op_Implicit((Object)(object)PageLoadout)) { return; } for (int i = 0; i < 4; i++) { if (PlayerLobbyBars[i].HasPlayer()) { int num = PlayerLobbyBars[i].m_player.PlayerSlotIndex(); if (num >= 0 && API.has_Install_Core(num)) { if (API.has_got_modlist(num)) { int num2 = API.Get_ModList_Count(num); if (num2 > 0) { int num3 = API.Get_Slot_Ping(i); if (num3 != -1) { UI_ModButtons[i].SetText($"<#6ecc72>MOD: SYNCED {num3}ms"); } else { UI_ModButtons[i].SetText("<#6ecc72>MOD: SYNCED"); } continue; } } UI_ModButtons[i].SetText("<#FFF>MOD: GETTING..."); continue; } } UI_ModButtons[i].SetText("<#FFF>MOD: UNKNOWN"); } } public static void ClearButtonText() { if (Object.op_Implicit((Object)(object)PageLoadout)) { for (int i = 0; i < 4; i++) { UI_ModButtons[i].SetText("<#FFF>MOD: UNKNOWN"); } } } public static void GenerateLobbyButtons() { //IL_0078: 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_0102: 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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)PageLoadout)) { return; } PageLoadout = GuiManager.MainMenuLayer.PageLoadout; PlayerLobbyBars = Il2CppArrayBase<CM_PlayerLobbyBar>.op_Implicit((Il2CppArrayBase<CM_PlayerLobbyBar>)(object)GuiManager.MainMenuLayer.PageLoadout.m_playerLobbyBars); ModListWindow = GOUtil.SpawnChildAndGetComp<CM_ScrollWindow>(PageLoadout.m_inviteWindowPrefab, (Transform)(object)((CM_PageBase)PageLoadout).m_movingContentHolder); ((RectTransformComp)ModListWindow).Setup(); ((RectTransformComp)ModListWindow).SetAnchor((GuiAnchor)1, true); ((RectTransformComp)ModListWindow).SetPosition(Vector2.zero); ((RectTransformComp)ModListWindow).SetSize(new Vector2(600f, 900f)); ((RectTransformComp)ModListWindow).SetVisible(false); ((CM_PopupOverlay)ModListWindow).SetupFromButton(((Component)PageLoadout).GetComponentInParent<iCellMenuPopupController>(), ((Component)PageLoadout).GetComponentInParent<CM_PageBase>()); ModListWindow.SetText("Mod List"); for (int i = 0; i < 4; i++) { UI_ModButtons[i] = ((Il2CppObjectBase)((GuiLayer)((CM_PageBase)PageLoadout).m_guiLayer).AddRectComp(((Component)PlayerLobbyBars[i].m_inviteButton).gameObject, (GuiAnchor)4, Vector2.zero, PlayerLobbyBars[i].m_hasPlayerRoot.transform)).Cast<CM_Item>(); ((Component)UI_ModButtons[i]).transform.localPosition = new Vector3(-35f, 490f, 0f); ((Component)UI_ModButtons[i]).transform.localScale = new Vector3(0.75f, 0.75f, 0.75f); UI_ModButtons[i].SetText("<#FFF>Mod: UNKOWN"); UI_ModButtons[i].ID = i + 23366674; UI_ModButtons[i].OnBtnPressCallback += Action<int>.op_Implicit((Action<int>)delegate(int id) { ShowListWindow(id - 23366674); }); ((Object)UI_ModButtons[i]).name = $"UI_ModListButton_{i}"; ((Component)UI_ModButtons[i]).gameObject.SetActive(true); TextMeshPro component = ((Component)((Component)UI_ModButtons[i]).transform).GetComponent<TextMeshPro>(); ((TMP_Text)component).fontStyle = (FontStyles)0; ((TMP_Text)component).m_fontStyle = (FontStyles)0; ((TMP_Text)component).m_FontStyleInternal = (FontStyles)0; RectTransform component2 = ((Component)((Component)UI_ModButtons[i]).transform).GetComponent<RectTransform>(); component2.offsetMax = new Vector2(500f, component2.offsetMax.y); } } }