using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyCompany("REPOExtractionDestroyList")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("REPO Extraction Destroy List")]
[assembly: AssemblyTitle("REPOExtractionDestroyList")]
[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 REPOExtractionDestroyList
{
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "imkyran.REPOExtractionDestroyList";
public const string PLUGIN_NAME = "REPO Extraction Destroy List";
public const string PLUGIN_VERSION = "1.1.0";
}
[BepInPlugin("imkyran.REPOExtractionDestroyList", "REPO Extraction Destroy List", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("imkyran.REPOExtractionDestroyList");
public static ConfigEntry<bool> configEnableDestroyList;
public static ConfigEntry<int> configYOffest;
public static ConfigEntry<bool> configShowPlayers;
public static ConfigEntry<bool> configShowEnemies;
public static ConfigEntry<int> configDistance;
internal static bool canSetupFixedColliders = true;
private void Awake()
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Expected O, but got Unknown
harmony.PatchAll(typeof(Plugin));
configEnableDestroyList = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtractionDestroyList", "Enable Destroy List", true, "Enables the destroy list");
configYOffest = ((BaseUnityPlugin)this).Config.Bind<int>("ExtractionDestroyList", "UI Y Offset", 75, new ConfigDescription("Moves the UI up or down", (AcceptableValueBase)(object)new AcceptableValueRange<int>(75, 200), Array.Empty<object>()));
configShowPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtractionDestroyList", "Show Players In List", true, "Enables showing players in the destroy list");
configShowEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("ExtractionDestroyList", "Show Enemies In List", true, "Enables showing enemies in the destroy list");
configDistance = ((BaseUnityPlugin)this).Config.Bind<int>("ExtractionDestroyList", "UI Show Distance", 15, new ConfigDescription("Sets the distance from the extraction point that the UI will appear (0 disables this)", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
}
[HarmonyPatch(typeof(EnergyUI), "Update")]
[HarmonyPostfix]
public static void EnergyUI_Update_Postfix(EnergyUI __instance)
{
//IL_0027: 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_002d: 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)
//IL_0054: 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 (!((Object)(object)((Component)__instance).GetComponent<TextMeshProUGUI>() != (Object)null))
{
return;
}
if (configDistance.Value > 0)
{
Vector3 currentExtractionPos = GetCurrentExtractionPos();
if (currentExtractionPos == Vector3.zero)
{
return;
}
Vector3 position = ((Component)PlayerController.instance).transform.position;
float num = Vector3.Distance(currentExtractionPos, position);
if (num > (float)configDistance.Value)
{
return;
}
}
TextMeshProUGUI component = ((Component)__instance).GetComponent<TextMeshProUGUI>();
if (SemiFunc.RunIsLevel() && configEnableDestroyList.Value)
{
((TMP_Text)component).enableWordWrapping = false;
((TMP_Text)component).text = string.Concat(new string[4]
{
$"<line-height={configYOffest.Value}%>",
((TMP_Text)component).text,
ItemDestroyListAsString(FilterColliderList(GetAllCollidersInExtraction())),
"</b>"
});
}
}
[HarmonyPatch(typeof(RoundDirector), "ExtractionPointsLock")]
[HarmonyPostfix]
public static void RoundDirector_ExtractionPointsLock_Postfix(GameObject __0)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
if (!((Object)(object)RoundDirector.instance == (Object)null))
{
ExtractionPoint component = __0.GetComponent<ExtractionPoint>();
if ((Object)(object)component != (Object)null && SemiFunc.RunIsLevel() && (Object)(object)component == (Object)(ExtractionPoint)AccessTools.Field(typeof(RoundDirector), "extractionPointCurrent").GetValue(RoundDirector.instance))
{
((MonoBehaviour)component).StartCoroutine(SetupFixedCollidersOnExtraction(component));
}
}
}
internal static IEnumerator SetupFixedCollidersOnExtraction(ExtractionPoint point)
{
if (!canSetupFixedColliders)
{
yield break;
}
canSetupFixedColliders = false;
yield return (object)new WaitForSeconds(3.73f);
object obj;
if (point == null)
{
obj = null;
}
else
{
GameObject gameObject = ((Component)point).gameObject;
if (gameObject == null)
{
obj = null;
}
else
{
Transform transform = gameObject.transform;
obj = ((transform != null) ? transform.Find("Scale/Extraction Tube/Hurt Colliders Side") : null);
}
}
if ((Object)obj == (Object)null)
{
canSetupFixedColliders = true;
Debug.LogError((object)("Failed to setup extraction tube colliders on: " + ((Object)point).name));
yield break;
}
Transform ExtractionTubeParent = ((Component)point).gameObject.transform.Find("Scale/Extraction Tube");
Transform SideHurtColliders = ((Component)point).gameObject.transform.Find("Scale/Extraction Tube/Hurt Colliders Side");
GameObject NewSideColliders = Object.Instantiate<GameObject>(((Component)SideHurtColliders).gameObject, ExtractionTubeParent);
((Object)NewSideColliders).name = "Hurt Colliders Fake";
Object.Destroy((Object)(object)((Component)NewSideColliders.transform.Find("Hurt Collider Enemies")).gameObject);
NewSideColliders.transform.localPosition = new Vector3(0f, NewSideColliders.transform.localPosition.y - 3.2f, 0f);
HurtCollider[] componentsInChildren = NewSideColliders.GetComponentsInChildren<HurtCollider>();
foreach (HurtCollider collider in componentsInChildren)
{
((Component)collider).transform.localScale = new Vector3(((Component)collider).transform.localScale.x, ((Component)collider).transform.localScale.y * 2f, ((Component)collider).transform.localScale.z);
((Component)collider).gameObject.SetActive(false);
}
yield return (object)new WaitForSeconds(5f);
canSetupFixedColliders = true;
}
internal static string ItemDestroyListAsString(List<Collider> colliders)
{
string text = string.Empty;
foreach (Collider collider in colliders)
{
string text2 = ItemNameFromCollider(collider);
if (text2 != null)
{
if (text == string.Empty)
{
text = "\n<color=#FF2525><size=20>Destroy List:</size></color><line-height=45%>";
}
text = text + "\n<color=#FF2525><size=16>" + text2 + "</size></color><line-height=35%>";
}
}
return text;
}
internal static string ItemNameFromCollider(Collider collider)
{
PlayerAvatar val = ((Component)collider).gameObject.GetComponentInParent<PlayerAvatar>();
if (!Object.op_Implicit((Object)(object)val))
{
PlayerController componentInParent = ((Component)collider).gameObject.GetComponentInParent<PlayerController>();
if (Object.op_Implicit((Object)(object)componentInParent))
{
val = componentInParent.playerAvatarScript;
}
}
PlayerTumble componentInParent2 = ((Component)collider).gameObject.GetComponentInParent<PlayerTumble>();
if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)componentInParent2.playerAvatar != (Object)null)
{
val = componentInParent2.playerAvatar;
}
if ((Object)(object)val != (Object)null)
{
return configShowPlayers.Value ? SemiFunc.PlayerGetName(val) : null;
}
PhysGrabObject componentInParent3 = ((Component)collider).gameObject.GetComponentInParent<PhysGrabObject>();
if ((Object)(object)componentInParent3 == (Object)null)
{
return null;
}
EnemyRigidbody componentInParent4 = ((Component)collider).gameObject.GetComponentInParent<EnemyRigidbody>();
if ((Object)(object)componentInParent4 != (Object)null)
{
EnemyParent componentInParent5 = ((Component)componentInParent4).gameObject.GetComponentInParent<EnemyParent>();
if ((Object)(object)componentInParent5 != (Object)null && configShowEnemies.Value)
{
return componentInParent5.enemyName;
}
return null;
}
return ((Object)((Component)componentInParent3).gameObject).name.Replace("Cart Medium", "Cart").Replace("Cart Small", "Pocket Cart").Replace("Enemy Valuable", "Enemy Orb")
.Replace("Surplus Valuable", "Money Bag")
.Replace("Item ", "")
.Replace("Valuable ", "")
.Replace("(Clone)", "");
}
internal static List<Collider> FilterColliderList(List<Collider> colliders)
{
List<string> list = new List<string>();
List<Collider> list2 = new List<Collider>();
foreach (Collider collider in colliders)
{
string text = ItemNameFromCollider(collider);
if (text != null && !list.Contains(text))
{
list.Add(text);
list2.Add(collider);
}
}
return list2;
}
internal static List<Collider> GetAllCollidersInExtraction()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: 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_0167: 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_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
List<Collider> list = new List<Collider>();
if ((Object)(object)RoundDirector.instance != (Object)null)
{
object value = typeof(RoundDirector).GetField("extractionPointCurrent", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(RoundDirector.instance);
if (value == null)
{
return list;
}
ExtractionPoint val = (ExtractionPoint)((value is ExtractionPoint) ? value : null);
HurtCollider[] componentsInChildren = ((Component)val).GetComponentsInChildren<HurtCollider>(true);
foreach (HurtCollider val2 in componentsInChildren)
{
if ((int)val2.physImpact == 0 || !Object.op_Implicit((Object)(object)((Component)val2).GetComponent<BoxCollider>()))
{
continue;
}
BoxCollider component = ((Component)val2).GetComponent<BoxCollider>();
Bounds bounds = ((Collider)component).bounds;
Vector3 center = ((Bounds)(ref bounds)).center;
Vector3 val3 = component.size * 0.5f;
val3.x *= Mathf.Abs(((Component)val2).transform.lossyScale.x);
val3.y *= Mathf.Abs(((Component)val2).transform.lossyScale.y);
val3.z *= Mathf.Abs(((Component)val2).transform.lossyScale.z);
LayerMask val4 = LayerMask.op_Implicit(LayerMask.op_Implicit(SemiFunc.LayerMaskGetPhysGrabObject()) + LayerMask.GetMask(new string[1] { "Player" }) + LayerMask.GetMask(new string[1] { "Default" }) + LayerMask.GetMask(new string[1] { "Enemy" }));
Collider[] array = Physics.OverlapBox(center, val3, ((Component)val2).transform.rotation, LayerMask.op_Implicit(val4), (QueryTriggerInteraction)2);
Collider[] array2 = array;
foreach (Collider val5 in array2)
{
if ((((Component)val5).gameObject.CompareTag("Phys Grab Object") || ((Component)val5).gameObject.CompareTag("Player")) && !list.Contains(val5))
{
list.Add(val5);
}
}
}
}
return list;
}
internal static Vector3 GetCurrentExtractionPos()
{
//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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)RoundDirector.instance == (Object)null)
{
return Vector3.zero;
}
object? value = AccessTools.Field(typeof(RoundDirector), "extractionPointCurrent").GetValue(RoundDirector.instance);
ExtractionPoint val = (ExtractionPoint)((value is ExtractionPoint) ? value : null);
if ((Object)(object)val != (Object)null)
{
return ((Component)val).transform.position;
}
return Vector3.zero;
}
}
}