using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyVersion("0.0.0.0")]
[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 RepoNetworkFix
{
[BepInPlugin("com.antigravity.reponetworkfix", "REPO Massive Absolute Zero (v6.0.0)", "6.0.0")]
public class RepoNetworkFixPlugin : BaseUnityPlugin
{
public static RepoNetworkFixPlugin Instance;
private static float deltaTime;
private GUIStyle guiStyle = new GUIStyle();
public static bool NetworkTuned;
private void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
new Harmony("com.antigravity.reponetworkfix").PatchAll();
guiStyle.fontSize = 18;
guiStyle.fontStyle = (FontStyle)1;
guiStyle.normal.textColor = Color.white;
((BaseUnityPlugin)this).Logger.LogInfo((object)"REPO Massive Absolute Zero v6.0.0: ГИГА-ДЕД И 30 ИГРОКОВ В СТРОЮ.");
}
public static void Log(string msg)
{
((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg);
}
private void Update()
{
deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f;
}
private void OnGUI()
{
//IL_0036: 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_0055: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.InRoom)
{
float num = 1f / deltaTime;
guiStyle.normal.textColor = ((PhotonNetwork.GetPing() > 100) ? Color.yellow : Color.green);
GUI.Label(new Rect(15f, 15f, 600f, 30f), $"{num:0} FPS | Ping: {PhotonNetwork.GetPing()} ms | Massive v6.0.0", guiStyle);
}
}
public static void SendGrandpaChat(string msg)
{
//IL_0020: 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)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
SemiFunc.UIBigMessage("Дед: " + msg, "\ud83d\udc74", 2.5f, Color.red, Color.yellow);
}
}
}
public static class Accessors
{
public static readonly FieldRef<Enemy, float> GetEnemyHealth = AccessTools.FieldRefAccess<Enemy, float>("Health");
public static readonly FieldRef<ValuableDirector, List<GameObject>> GetMediumPool = AccessTools.FieldRefAccess<ValuableDirector, List<GameObject>>("mediumValuables");
public static readonly FieldRef<ValuableDirector, List<GameObject>> GetBigPool = AccessTools.FieldRefAccess<ValuableDirector, List<GameObject>>("bigValuables");
public static readonly FieldRef<EnemyHunter, object> GetInvestigatePoint = AccessTools.FieldRefAccess<EnemyHunter, object>("investigatePoint");
}
public static class StateStorage
{
public static readonly ConditionalWeakTable<PlayerAvatar, StrongBox<Vector3>> PlayerLastPos = new ConditionalWeakTable<PlayerAvatar, StrongBox<Vector3>>();
public static readonly ConditionalWeakTable<EnemyHunter, StrongBox<bool>> GrandpaAnger = new ConditionalWeakTable<EnemyHunter, StrongBox<bool>>();
public static readonly string[] GrandpaPhrases = new string[6] { "А ну стоять, внучок! Куда без шапки?!", "Куда по помытому?! Я только скрип пола услышал!", "Тихо вы там! Я сериал не слышу!", "Пенсию принесли? Или опять эти ваши биткоины крадете?", "Я тебя не вижу, но я тебя чую... Пахнет дилетантством!", "Где мои очки? Опять с кровати упал..." };
}
[HarmonyPatch(typeof(MenuPageServerList), "ButtonCreateNew")]
public static class MassiveLobbyPatch
{
[HarmonyPostfix]
public static void Postfix()
{
if (PhotonNetwork.CurrentRoom != null)
{
PhotonNetwork.CurrentRoom.MaxPlayers = 30;
PhotonNetwork.CurrentRoom.IsOpen = true;
PhotonNetwork.CurrentRoom.IsVisible = true;
}
}
}
[HarmonyPatch(typeof(MenuPageLobby), "ButtonStart")]
public static class LateJoinAlwaysOpenPatch
{
[HarmonyPostfix]
public static void Postfix()
{
if (PhotonNetwork.CurrentRoom != null)
{
PhotonNetwork.CurrentRoom.IsOpen = true;
PhotonNetwork.CurrentRoom.IsVisible = true;
}
}
}
[HarmonyPatch(typeof(ValuableDirector), "Start")]
public static class WeaponLootSpawnPatch
{
[HarmonyPostfix]
public static void Postfix(ValuableDirector __instance)
{
GameObject[] array = Resources.LoadAll<GameObject>("Weapons");
if (array != null && array.Length != 0)
{
List<GameObject> list = Accessors.GetMediumPool.Invoke(__instance);
List<GameObject> list2 = Accessors.GetBigPool.Invoke(__instance);
GameObject[] array2 = array;
foreach (GameObject item in array2)
{
list?.Add(item);
list2?.Add(item);
}
RepoNetworkFixPlugin.Log("Absolute Zero v6.0.0: Weapons added to loot tables.");
}
}
}
[HarmonyPatch(typeof(EnemyHunter), "UpdateState")]
public static class GigaGrandpaPatch
{
[HarmonyPrefix]
public static void Prefix(EnemyHunter __instance)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
Enemy component = ((Component)__instance).GetComponent<Enemy>();
if (!((Object)(object)component == (Object)null))
{
float num = Accessors.GetEnemyHealth.Invoke(component);
if (num < 50f)
{
((Component)__instance).transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
}
StrongBox<bool> orCreateValue = StateStorage.GrandpaAnger.GetOrCreateValue(__instance);
bool flag = Accessors.GetInvestigatePoint.Invoke(__instance) != null;
if (!orCreateValue.Value && flag)
{
orCreateValue.Value = true;
string msg = StateStorage.GrandpaPhrases[Random.Range(0, StateStorage.GrandpaPhrases.Length)];
RepoNetworkFixPlugin.SendGrandpaChat(msg);
}
else if (!flag)
{
orCreateValue.Value = false;
}
}
}
}
[HarmonyPatch(typeof(PhysGrabObject), "FixedUpdate")]
public static class FinalPhysPatch
{
[HarmonyPrefix]
public static bool Prefix(PhysGrabObject __instance)
{
if (__instance.grabbedLocal || __instance.playerGrabbing.Count > 0)
{
return true;
}
if (Time.frameCount % 4 != ((Object)((Component)__instance).gameObject).GetInstanceID() % 4)
{
return false;
}
return (Object)(object)__instance.rb != (Object)null && !__instance.rb.IsSleeping();
}
}
[HarmonyPatch(typeof(PlayerAvatar), "OnPhotonSerializeView")]
public static class FinalDeltaSyncPatch
{
[HarmonyPrefix]
public static bool Prefix(PlayerAvatar __instance, PhotonStream stream)
{
//IL_001e: 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_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_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
if (stream.IsWriting)
{
StrongBox<Vector3> orCreateValue = StateStorage.PlayerLastPos.GetOrCreateValue(__instance);
Vector3 val = ((Component)__instance).transform.position - orCreateValue.Value;
if (((Vector3)(ref val)).sqrMagnitude < 0.0064f)
{
return false;
}
orCreateValue.Value = ((Component)__instance).transform.position;
}
return true;
}
}
}