using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DearImGuiInjection;
using DearImGuiInjection.BepInEx;
using HarmonyLib;
using ImGuiNET;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core.Serizalization;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("PEAK-AIO")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PEAK-AIO")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0e070e16-c355-4db0-804c-0510a5aa436e")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.2.0")]
public static class ConfigManager
{
public static ManualLogSource Logger;
public static ConfigEntry<bool> InfiniteStamina;
public static ConfigEntry<bool> FlyMod;
public static ConfigEntry<float> FlySpeed;
public static ConfigEntry<float> FlyAcceleration;
public static ConfigEntry<bool> LockStatus;
public static ConfigEntry<bool> NoWeight;
public static ConfigEntry<bool> SpeedMod;
public static ConfigEntry<bool> JumpMod;
public static ConfigEntry<bool> NoFallDmg;
public static ConfigEntry<bool> ClimbMod;
public static ConfigEntry<bool> VineClimbMod;
public static ConfigEntry<bool> RopeClimbMod;
public static ConfigEntry<float> SpeedAmount;
public static ConfigEntry<float> JumpAmount;
public static ConfigEntry<float> ClimbAmount;
public static ConfigEntry<float> VineClimbAmount;
public static ConfigEntry<float> RopeClimbAmount;
public static ConfigEntry<float> RechargeAmountSlot1;
public static ConfigEntry<float> RechargeAmountSlot2;
public static ConfigEntry<float> RechargeAmountSlot3;
public static ConfigEntry<bool> TeleportToPing;
public static void Init(ConfigFile config, ManualLogSource logger)
{
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Expected O, but got Unknown
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Expected O, but got Unknown
//IL_026d: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Expected O, but got Unknown
Logger = logger;
InfiniteStamina = config.Bind<bool>("Cheats", "InfiniteStamina", false, "Enable infinite stamina");
TeleportToPing = config.Bind<bool>("Cheats", "TeleportToPing", false, "Automatically teleport to ping location");
FlyMod = config.Bind<bool>("Cheats", "Fly Mod", false, "Enables fly mode when checked.");
FlySpeed = config.Bind<float>("Cheats", "Fly Speed", 100f, "Speed used when flying.");
FlyAcceleration = config.Bind<float>("Cheats", "Fly Acceleration", 300f, "Acceleration used when flying.");
LockStatus = config.Bind<bool>("Afflictions", "LockStatus", false, (ConfigDescription)null);
NoWeight = config.Bind<bool>("Afflictions", "NoWeight", false, (ConfigDescription)null);
SpeedMod = config.Bind<bool>("Character", "SpeedMod", false, (ConfigDescription)null);
JumpMod = config.Bind<bool>("Character", "JumpMod", false, (ConfigDescription)null);
NoFallDmg = config.Bind<bool>("Character", "NoFallDmg", false, (ConfigDescription)null);
ClimbMod = config.Bind<bool>("Character", "ClimbMod", false, (ConfigDescription)null);
VineClimbMod = config.Bind<bool>("Character", "VineClimbMod", false, (ConfigDescription)null);
RopeClimbMod = config.Bind<bool>("Character", "RopeClimbMod", false, (ConfigDescription)null);
SpeedAmount = config.Bind<float>("Character", "SpeedAmount", 1f, (ConfigDescription)null);
JumpAmount = config.Bind<float>("Character", "JumpAmount", 10f, (ConfigDescription)null);
ClimbAmount = config.Bind<float>("Character", "ClimbAmount", 1f, (ConfigDescription)null);
VineClimbAmount = config.Bind<float>("Character", "VineClimbAmount", 1f, (ConfigDescription)null);
RopeClimbAmount = config.Bind<float>("Character", "RopeClimbAmount", 1f, (ConfigDescription)null);
RechargeAmountSlot1 = config.Bind<float>("Inventory", "RechargeAmountSlot1", 100f, new ConfigDescription("Recharge amount for slot 1", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 999f), Array.Empty<object>()));
RechargeAmountSlot2 = config.Bind<float>("Inventory", "RechargeAmountSlot2", 100f, new ConfigDescription("Recharge amount for slot 2", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 999f), Array.Empty<object>()));
RechargeAmountSlot3 = config.Bind<float>("Inventory", "RechargeAmountSlot3", 100f, new ConfigDescription("Recharge amount for slot 3", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 999f), Array.Empty<object>()));
Logger.LogInfo((object)"[PEAK AIO][ConfigManager] Config Loaded.");
}
}
internal static class ConstantFields
{
private static PropertyInfo infiniteStaminaProp;
private static PropertyInfo statusLockProp;
private static FieldInfo fallDamageTimeField;
private static FieldInfo staminaField;
private static FieldInfo movementModifierField;
private static FieldInfo jumpGravityField;
private static FieldInfo climbSpeedModField;
private static FieldInfo vineClimbSpeedModField;
private static FieldInfo ropeClimbSpeedModField;
private static MethodInfo setStatusMethod;
private static Array statusEnumValues;
public static PropertyInfo GetInfiniteStaminaProperty()
{
if (infiniteStaminaProp == null)
{
infiniteStaminaProp = typeof(Character).GetProperty("infiniteStam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return infiniteStaminaProp;
}
public static PropertyInfo GetStatusLockProperty()
{
if (statusLockProp == null)
{
statusLockProp = typeof(Character).GetProperty("statusesLocked", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return statusLockProp;
}
public static FieldInfo GetFallDamageTimeField()
{
if (fallDamageTimeField == null)
{
fallDamageTimeField = typeof(CharacterMovement).GetField("fallDamageTime", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return fallDamageTimeField;
}
public static FieldInfo GetStaminaField()
{
if (staminaField == null)
{
staminaField = typeof(CharacterData).GetField("_stam", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return staminaField;
}
public static FieldInfo GetMovementModifierField()
{
if (movementModifierField == null)
{
movementModifierField = typeof(CharacterMovement).GetField("movementModifier", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return movementModifierField;
}
public static FieldInfo GetJumpGravityField()
{
if (jumpGravityField == null)
{
jumpGravityField = typeof(CharacterMovement).GetField("jumpGravity", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return jumpGravityField;
}
public static FieldInfo GetClimbSpeedModField()
{
if (climbSpeedModField == null)
{
climbSpeedModField = typeof(CharacterClimbing).GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return climbSpeedModField;
}
public static FieldInfo GetVineClimbSpeedModField()
{
if (vineClimbSpeedModField == null)
{
vineClimbSpeedModField = typeof(CharacterVineClimbing).GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return vineClimbSpeedModField;
}
public static FieldInfo GetRopeClimbSpeedModField()
{
if (ropeClimbSpeedModField == null)
{
ropeClimbSpeedModField = typeof(CharacterRopeHandling).GetField("climbSpeedMod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return ropeClimbSpeedModField;
}
public static MethodInfo GetSetStatusMethod()
{
if (setStatusMethod == null)
{
setStatusMethod = typeof(CharacterAfflictions).GetMethod("SetStatus", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
}
return setStatusMethod;
}
public static Array GetStatusEnumValues()
{
if (statusEnumValues == null)
{
statusEnumValues = Enum.GetValues(typeof(STATUSTYPE));
}
return statusEnumValues;
}
public static void RefreshAll()
{
infiniteStaminaProp = null;
statusLockProp = null;
fallDamageTimeField = null;
staminaField = null;
movementModifierField = null;
jumpGravityField = null;
climbSpeedModField = null;
vineClimbSpeedModField = null;
ropeClimbSpeedModField = null;
setStatusMethod = null;
statusEnumValues = null;
}
}
public class EventComponent : MonoBehaviour
{
private void Update()
{
CharacterMovement movementComponent = GameHelpers.GetMovementComponent();
if ((Object)(object)movementComponent != (Object)null)
{
if (ConfigManager.SpeedMod.Value)
{
ConstantFields.GetMovementModifierField()?.SetValue(movementComponent, ConfigManager.SpeedAmount.Value);
}
if (ConfigManager.JumpMod.Value)
{
ConstantFields.GetJumpGravityField()?.SetValue(movementComponent, ConfigManager.JumpAmount.Value);
if (ConfigManager.NoFallDmg.Value)
{
ConstantFields.GetFallDamageTimeField()?.SetValue(movementComponent, 999f);
}
}
}
Character characterComponent = GameHelpers.GetCharacterComponent();
if ((Object)(object)characterComponent != (Object)null)
{
if (ConfigManager.InfiniteStamina.Value)
{
ConstantFields.GetInfiniteStaminaProperty()?.SetValue(characterComponent, true);
}
if (ConfigManager.LockStatus.Value)
{
ConstantFields.GetStatusLockProperty()?.SetValue(characterComponent, true);
}
}
CharacterClimbing climbingComponent = GameHelpers.GetClimbingComponent();
if ((Object)(object)climbingComponent != (Object)null && ConfigManager.ClimbMod.Value)
{
ConstantFields.GetClimbSpeedModField()?.SetValue(climbingComponent, ConfigManager.ClimbAmount.Value);
}
CharacterVineClimbing vineClimbComponent = GameHelpers.GetVineClimbComponent();
if ((Object)(object)vineClimbComponent != (Object)null && ConfigManager.VineClimbMod.Value)
{
ConstantFields.GetVineClimbSpeedModField()?.SetValue(vineClimbComponent, ConfigManager.VineClimbAmount.Value);
}
CharacterRopeHandling ropeClimbComponent = GameHelpers.GetRopeClimbComponent();
if ((Object)(object)ropeClimbComponent != (Object)null && ConfigManager.RopeClimbMod.Value)
{
ConstantFields.GetRopeClimbSpeedModField()?.SetValue(ropeClimbComponent, ConfigManager.RopeClimbAmount.Value);
}
}
}
internal static class GameHelpers
{
private static Character character;
private static CharacterData characterData;
private static CharacterMovement movementComponent;
private static CharacterAfflictions afflictionsComponent;
private static CharacterClimbing climbingComponent;
private static CharacterVineClimbing vineClimbingComponent;
private static CharacterRopeHandling ropeClimbingComponent;
public static Character GetCharacterComponent()
{
if ((Object)(object)character == (Object)null || !((Behaviour)character).isActiveAndEnabled)
{
character = Character.localCharacter;
}
return character;
}
public static CharacterData GetCharacterData()
{
if ((Object)(object)characterData == (Object)null || !((Behaviour)characterData).isActiveAndEnabled)
{
characterData = Object.FindFirstObjectByType<CharacterData>();
}
return characterData;
}
public static CharacterMovement GetMovementComponent()
{
if ((Object)(object)movementComponent == (Object)null || !((Behaviour)movementComponent).isActiveAndEnabled)
{
Character characterComponent = GetCharacterComponent();
movementComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterMovement>() : null);
}
return movementComponent;
}
public static CharacterAfflictions GetAfflictionsComponent()
{
if ((Object)(object)afflictionsComponent == (Object)null || !((Behaviour)afflictionsComponent).isActiveAndEnabled)
{
Character characterComponent = GetCharacterComponent();
afflictionsComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterAfflictions>() : null);
}
return afflictionsComponent;
}
public static CharacterClimbing GetClimbingComponent()
{
if ((Object)(object)climbingComponent == (Object)null || !((Behaviour)climbingComponent).isActiveAndEnabled)
{
Character characterComponent = GetCharacterComponent();
climbingComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterClimbing>() : null);
}
return climbingComponent;
}
public static CharacterVineClimbing GetVineClimbComponent()
{
if ((Object)(object)vineClimbingComponent == (Object)null || !((Behaviour)vineClimbingComponent).isActiveAndEnabled)
{
Character characterComponent = GetCharacterComponent();
vineClimbingComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterVineClimbing>() : null);
}
return vineClimbingComponent;
}
public static CharacterRopeHandling GetRopeClimbComponent()
{
if ((Object)(object)ropeClimbingComponent == (Object)null || !((Behaviour)ropeClimbingComponent).isActiveAndEnabled)
{
Character characterComponent = GetCharacterComponent();
ropeClimbingComponent = ((characterComponent != null) ? ((Component)characterComponent).GetComponent<CharacterRopeHandling>() : null);
}
return ropeClimbingComponent;
}
public static void Refresh()
{
character = null;
characterData = null;
movementComponent = null;
afflictionsComponent = null;
climbingComponent = null;
vineClimbingComponent = null;
ropeClimbingComponent = null;
}
}
public static class Globals
{
public static bool anyAfflictionEnabled;
public static Character character;
public static CharacterData characterData;
public static FieldInfo staminaField;
public static PropertyInfo infiniteStamProp;
public static FieldInfo sinceFallSlideField;
public static FieldInfo sinceGroundedField;
public static object movementComp;
public static FieldInfo movementModifierField;
public static FieldInfo jumpGravityField;
public static FieldInfo fallDamageTimeField;
public static object characterClimb;
public static FieldInfo climbSpeedModifierField;
public static object characterVineClimb;
public static FieldInfo vineClimbSpeedModifierField;
public static object characterRopeHandling;
public static FieldInfo ropeClimbSpeedModifierField;
public static object afflictionsObj;
public static MethodInfo setStatusMethod;
public static object weightEnumValue;
public static object poisonEnumValue;
public static object hotEnumValue;
public static object coldEnumValue;
public static object curseEnumValue;
public static object injuryEnumValue;
public static object drowsyEnumValue;
public static object hungerEnumValue;
public static List<Item> items = new List<Item>();
public static List<string> itemNames = new List<string>();
public static int[] selectedItems = new int[3] { -1, -1, -1 };
public static string[] itemDisplayNames = new string[3] { "None", "None", "None" };
public static string[] itemSearchBuffers = new string[3];
public static Player playerObj;
public static List<Character> allPlayers = new List<Character>();
public static List<string> playerNames = new List<string>();
public static int selectedPlayer = -1;
public static bool excludeSelfFromAllActions = true;
public static bool teleportToPingEnabled = false;
public static float teleportX = 0f;
public static float teleportY = 0f;
public static float teleportZ = 0f;
public static int selectedLuggageIndex = -1;
public static List<string> luggageLabels = new List<string>();
public static List<Luggage> luggageObject = new List<Luggage>();
public static List<Luggage> allOpenedLuggage = new List<Luggage>();
}
[HarmonyPatch(typeof(PointPinger), "ReceivePoint_Rpc")]
public class PointPingPatch
{
private static void Postfix(Vector3 point, Vector3 hitNormal, PointPinger __instance)
{
//IL_0059: 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_0064: 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)
try
{
if (ConfigManager.TeleportToPing.Value)
{
Character character = __instance.character;
object obj;
if (character == null)
{
obj = null;
}
else
{
PhotonView photonView = ((MonoBehaviourPun)character).photonView;
obj = ((photonView != null) ? photonView.Owner : null);
}
Player val = (Player)obj;
if (val != null && val == PhotonNetwork.LocalPlayer && (Object)(object)Character.localCharacter != (Object)null && !Character.localCharacter.data.dead)
{
Vector3 val2 = point + Vector3.up;
((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val2, true });
ConfigManager.Logger.LogInfo((object)"[Patch] Teleported to ping!");
}
}
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)("[Patch] Exception: " + ex));
}
}
}
[HarmonyPatch(typeof(Character), "Update")]
public class FlyPatch
{
private static bool isFlying = false;
private static Vector3 flyVelocity = Vector3.zero;
public static bool IsFlying => isFlying;
public static void SetFlying(bool enable)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
isFlying = enable;
flyVelocity = Vector3.zero;
ConfigManager.Logger.LogInfo((object)("[FlyMod] Flight " + (enable ? "enabled" : "disabled") + "."));
}
private static void Postfix(Character __instance)
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.IsLocal)
{
return;
}
if (!ConfigManager.FlyMod.Value)
{
if (isFlying)
{
isFlying = false;
flyVelocity = Vector3.zero;
ConfigManager.Logger.LogInfo((object)"[FlyMod] Flight disabled.");
}
return;
}
if (!isFlying)
{
isFlying = true;
ConfigManager.Logger.LogInfo((object)"[FlyMod] Flight enabled.");
}
__instance.data.isGrounded = true;
__instance.data.sinceGrounded = 0f;
__instance.data.sinceJump = 0f;
Vector3 val = Vector2.op_Implicit(__instance.input.movementInput);
Vector3 normalized = ((Vector3)(ref __instance.data.lookDirection_Flat)).normalized;
Vector3 val2 = Vector3.Cross(Vector3.up, normalized);
Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
Vector3 val3 = normalized * val.y + normalized2 * val.x;
if (__instance.input.jumpIsPressed)
{
val3 += Vector3.up;
}
if (__instance.input.crouchIsPressed)
{
val3 += Vector3.down;
}
float value = ConfigManager.FlySpeed.Value;
float value2 = ConfigManager.FlyAcceleration.Value;
flyVelocity = Vector3.Lerp(flyVelocity, ((Vector3)(ref val3)).normalized * value, Time.deltaTime * value2);
foreach (Bodypart part in __instance.refs.ragdoll.partList)
{
if ((Object)(object)((part != null) ? part.Rig : null) != (Object)null)
{
part.Rig.linearVelocity = flyVelocity;
}
}
}
}
[HarmonyPatch(typeof(CharacterAfflictions), "UpdateWeight")]
public class Patch_UpdateWeight
{
private static void Postfix(CharacterAfflictions __instance)
{
if (ConfigManager.NoWeight.Value)
{
__instance.SetStatus((STATUSTYPE)7, 0f);
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.onigremlin.peakaio", "PEAK AIO Mod", "1.0.2")]
public class PeakMod : BaseUnityPlugin
{
private bool styleApplied;
private int selectedTab = 1;
private void ApplyCustomStyle()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
ImGuiStylePtr style = ImGui.GetStyle();
RangeAccessor<Vector4> colors = ((ImGuiStylePtr)(ref style)).Colors;
Vector4 vector = new Vector4(0.953f, 0.941f, 0.902f, 1f);
Vector4 vector2 = new Vector4(0.361f, 0.294f, 0.231f, 1f);
Vector4 vector3 = new Vector4(0.18f, 0.18f, 0.18f, 1f);
Vector4 vector4 = new Vector4(0.18f, 0.28f, 0.22f, 1f);
Vector4 vector5 = new Vector4(0.866f, 0.827f, 0.741f, 1f);
Vector4 vector6 = new Vector4(0.8f, 0.78f, 0.65f, 1f);
Vector4 vector7 = new Vector4(0.75f, 0.72f, 0.61f, 1f);
Vector4 vector8 = new Vector4(0.55f, 0.42f, 0.28f, 1f);
new Vector4(0.75f, 0.6f, 0.5f, 1f);
new Vector4(0.76f, 0.44f, 0.39f, 1f);
Vector4 vector9 = new Vector4(0.318f, 0.569f, 0.384f, 1f);
colors[2] = vector;
colors[5] = vector3;
colors[10] = vector9;
colors[11] = vector9;
colors[0] = vector3;
colors[1] = vector8;
colors[18] = vector4;
colors[7] = vector5;
colors[8] = vector6;
colors[9] = vector7;
colors[5] = vector8;
colors[4] = vector;
colors[44] = vector9;
colors[45] = vector8;
colors[46] = vector8;
colors[3] = vector5;
colors[21] = vector5;
colors[22] = vector6;
colors[23] = vector7;
colors[24] = vector5;
colors[25] = vector5;
colors[26] = vector5;
colors[27] = vector8;
colors[14] = vector2;
colors[15] = vector4;
colors[16] = new Vector4(vector4.X + 0.1f, vector4.Y + 0.1f, vector4.Z + 0.1f, 1f);
colors[17] = new Vector4(vector4.X - 0.05f, vector4.Y - 0.05f, vector4.Z - 0.05f, 1f);
colors[19] = vector4;
colors[20] = new Vector4(vector4.X - 0.05f, vector4.Y - 0.05f, vector4.Z - 0.05f, 1f);
((ImGuiStylePtr)(ref style)).WindowRounding = 6f;
((ImGuiStylePtr)(ref style)).FrameRounding = 4f;
((ImGuiStylePtr)(ref style)).ChildRounding = 4f;
((ImGuiStylePtr)(ref style)).FrameBorderSize = 1f;
((ImGuiStylePtr)(ref style)).GrabRounding = 4f;
((ImGuiStylePtr)(ref style)).WindowPadding = new Vector2(4f, 4f);
((ImGuiStylePtr)(ref style)).CellPadding = new Vector2(4f, 4f);
((ImGuiStylePtr)(ref style)).FrameBorderSize = 1f;
((ImGuiStylePtr)(ref style)).ItemSpacing = new Vector2(2f, 4f);
}
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod Initialized");
((Component)this).gameObject.AddComponent<EventComponent>();
}
private void OnEnable()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
((BaseUnityPlugin)this).Logger.LogInfo((object)"[PEAK AIO] OnEnable called");
Globals.itemSearchBuffers = new string[3] { "", "", "" };
ConfigManager.Init(((BaseUnityPlugin)this).Config, ((BaseUnityPlugin)this).Logger);
DearImGuiInjection.Render += MyUI;
new Harmony("com.onigremlin.peakaio").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony patches applied.");
}
private void OnDisable()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"[PEAK AIO] OnDisable called");
DearImGuiInjection.Render -= MyUI;
}
private void DrawCheckbox(ConfigEntry<bool> config, string label, Action<bool> mainThreadAction = null)
{
bool value = config.Value;
if (!ImGui.Checkbox(label, ref value))
{
return;
}
config.Value = value;
((BaseUnityPlugin)this).Logger.LogInfo((object)("[Menu] " + label + " toggled to " + (value ? "ON" : "OFF")));
if (mainThreadAction != null)
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
mainThreadAction(value);
});
}
}
private void DrawSliderFloat(ConfigEntry<float> config, string label, float min, float max, string format = "%.2f")
{
float value = config.Value;
if (ImGui.SliderFloat(label, ref value, min, max, format))
{
config.Value = value;
}
}
private bool DrawSearchableCombo(string label, ref int selectedIndex, List<string> items, ref string searchBuffer)
{
bool result = false;
string text = "Search##" + label;
ImGui.PushItemWidth(ImGui.GetContentRegionAvail().X - 4f);
ImGui.InputText("##" + text, ref searchBuffer, 100u);
ImGui.PopItemWidth();
if (string.IsNullOrEmpty(searchBuffer) && !ImGui.IsItemActive())
{
Vector2 itemRectMin = ImGui.GetItemRectMin();
ImGui.SameLine();
ImGui.SetCursorScreenPos(itemRectMin + new Vector2(4f, 2f));
ImGui.PushStyleColor((ImGuiCol)0, new Vector4(0.18f, 0.18f, 0.18f, 1f));
ImGui.TextUnformatted("Search items...");
ImGui.PopStyleColor();
}
if (ImGui.BeginCombo(label, (selectedIndex >= 0 && selectedIndex < items.Count) ? items[selectedIndex] : "None"))
{
for (int i = 0; i < items.Count; i++)
{
if (string.IsNullOrEmpty(searchBuffer) || items[i].ToLower().Contains(searchBuffer.ToLower()))
{
bool flag = selectedIndex == i;
if (ImGui.Selectable($"{items[i]}##{i}", flag))
{
selectedIndex = i;
result = true;
}
if (flag)
{
ImGui.SetItemDefaultFocus();
}
}
}
ImGui.EndCombo();
}
return result;
}
private void DrawToolTip(string text)
{
ImGui.SameLine();
ImGui.TextDisabled("(?)");
if (ImGui.IsItemHovered())
{
ImGui.PushStyleColor((ImGuiCol)4, new Vector4(0.89f, 0.82f, 0.7f, 1f));
ImGui.PushStyleColor((ImGuiCol)0, new Vector4(0.18f, 0.18f, 0.18f, 1f));
ImGui.PushStyleVar((ImGuiStyleVar)4, 1f);
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(450f);
ImGui.TextUnformatted(text);
ImGui.PopTextWrapPos();
ImGui.EndTooltip();
ImGui.PopStyleVar();
ImGui.PopStyleColor(2);
}
}
private void MyUI()
{
//IL_0f5c: Unknown result type (might be due to invalid IL or missing references)
//IL_0f61: Unknown result type (might be due to invalid IL or missing references)
//IL_0f73: Unknown result type (might be due to invalid IL or missing references)
//IL_0f7a: Unknown result type (might be due to invalid IL or missing references)
//IL_0f81: Unknown result type (might be due to invalid IL or missing references)
try
{
if (!DearImGuiInjection.IsCursorVisible)
{
return;
}
if (!styleApplied)
{
ApplyCustomStyle();
styleApplied = true;
}
ImGui.SetNextWindowPos(new Vector2(20f, 20f), (ImGuiCond)2);
ImGui.SetNextWindowSize(new Vector2(500f, 300f), (ImGuiCond)2);
if (ImGui.Begin("PEAK AIO##Main", (ImGuiWindowFlags)32))
{
ImGui.BeginChild("Sidebar", new Vector2(85f, 0f), true);
ImGui.Dummy(new Vector2(4f, 2f));
string[] array = new string[5] { "PLAYER", "ITEMS", "LOBBY", "WORLD", "ABOUT" };
for (int i = 0; i < array.Length; i++)
{
bool flag = selectedTab == i + 1;
string obj = array[i];
Vector4 vector = (flag ? new Vector4(0.318f, 0.569f, 0.384f, 1f) : new Vector4(0.18f, 0.18f, 0.18f, 1f));
ImGui.PushStyleColor((ImGuiCol)0, vector);
float x = ImGui.CalcTextSize(obj).X;
ImGui.SetCursorPosX((ImGui.GetContentRegionAvail().X - x) * 0.5f);
if (ImGui.Selectable(obj, flag))
{
selectedTab = i + 1;
}
ImGui.PopStyleColor();
}
ImGui.EndChild();
ImGui.SameLine();
ImGui.BeginChild("MainArea");
if (selectedTab == 1)
{
float num = ImGui.GetContentRegionAvail().X / 2f;
ImGui.BeginChild("PlayerColumn", new Vector2(num, 0f), true);
ImGui.Indent(4f);
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
ImGui.Dummy(new Vector2(4f, 2f));
if (ImGui.CollapsingHeader("Self Mods##SelfMods", (ImGuiTreeNodeFlags)32))
{
DrawCheckbox(ConfigManager.InfiniteStamina, "Infinite Stamina", delegate(bool val)
{
Character characterComponent2 = GameHelpers.GetCharacterComponent();
PropertyInfo infiniteStaminaProperty = ConstantFields.GetInfiniteStaminaProperty();
if ((Object)(object)characterComponent2 != (Object)null && infiniteStaminaProperty != null)
{
infiniteStaminaProperty.SetValue(characterComponent2, val);
}
});
ImGui.SameLine();
DrawToolTip("Prevents stamina from decreasing, allowing unlimited sprinting and actions.");
DrawCheckbox(ConfigManager.LockStatus, "Freeze Afflictions", delegate(bool val)
{
Character characterComponent = GameHelpers.GetCharacterComponent();
PropertyInfo statusLockProperty = ConstantFields.GetStatusLockProperty();
if ((Object)(object)characterComponent != (Object)null && statusLockProperty != null)
{
statusLockProperty.SetValue(characterComponent, val);
}
});
ImGui.SameLine();
DrawToolTip("Prevents your statuses from changing.");
DrawCheckbox(ConfigManager.NoWeight, "No Weight");
ImGui.SameLine();
DrawToolTip("Disables weight penalties from carried items and backpack.");
DrawCheckbox(ConfigManager.SpeedMod, "Change Speed", delegate
{
CharacterMovement movementComponent2 = GameHelpers.GetMovementComponent();
FieldInfo movementModifierField = ConstantFields.GetMovementModifierField();
if ((Object)(object)movementComponent2 != (Object)null && movementModifierField != null)
{
movementModifierField.SetValue(movementComponent2, ConfigManager.SpeedAmount.Value);
}
});
ImGui.SameLine();
DrawToolTip("Overrides your character's movement speed with a custom multiplier.");
DrawCheckbox(ConfigManager.JumpMod, "Change Jump", delegate
{
CharacterMovement movementComponent = GameHelpers.GetMovementComponent();
FieldInfo jumpGravityField = ConstantFields.GetJumpGravityField();
FieldInfo fallDamageTimeField = ConstantFields.GetFallDamageTimeField();
if ((Object)(object)movementComponent != (Object)null && jumpGravityField != null)
{
jumpGravityField.SetValue(movementComponent, ConfigManager.JumpAmount.Value);
}
if ((Object)(object)movementComponent != (Object)null && fallDamageTimeField != null)
{
fallDamageTimeField.SetValue(movementComponent, ConfigManager.NoFallDmg.Value ? 999f : 1.5f);
}
});
ImGui.SameLine();
DrawToolTip("Modifies jump height, allowing higher or lower jumps depending on your settings.");
DrawCheckbox(ConfigManager.ClimbMod, "Change Climb", delegate
{
CharacterClimbing climbingComponent = GameHelpers.GetClimbingComponent();
FieldInfo climbSpeedModField = ConstantFields.GetClimbSpeedModField();
if ((Object)(object)climbingComponent != (Object)null && climbSpeedModField != null)
{
climbSpeedModField.SetValue(climbingComponent, ConfigManager.ClimbAmount.Value);
}
});
ImGui.SameLine();
DrawToolTip("Adjusts the speed at which you climb ladders and surfaces.");
DrawCheckbox(ConfigManager.VineClimbMod, "Change Vine Climb", delegate
{
CharacterVineClimbing vineClimbComponent = GameHelpers.GetVineClimbComponent();
FieldInfo vineClimbSpeedModField = ConstantFields.GetVineClimbSpeedModField();
if ((Object)(object)vineClimbComponent != (Object)null && vineClimbSpeedModField != null)
{
vineClimbSpeedModField.SetValue(vineClimbComponent, ConfigManager.VineClimbAmount.Value);
}
});
ImGui.SameLine();
DrawToolTip("Changes climbing speed specifically for vines.");
DrawCheckbox(ConfigManager.RopeClimbMod, "Change Rope Climb", delegate
{
CharacterRopeHandling ropeClimbComponent = GameHelpers.GetRopeClimbComponent();
FieldInfo ropeClimbSpeedModField = ConstantFields.GetRopeClimbSpeedModField();
if ((Object)(object)ropeClimbComponent != (Object)null && ropeClimbSpeedModField != null)
{
ropeClimbSpeedModField.SetValue(ropeClimbComponent, ConfigManager.RopeClimbAmount.Value);
}
});
ImGui.SameLine();
DrawToolTip("Modifies climbing speed when using ropes or rope-based obstacles.");
DrawCheckbox(ConfigManager.TeleportToPing, "Teleport to Ping");
ImGui.SameLine();
DrawToolTip("Teleports your character to the pinged location on the map.");
DrawCheckbox(ConfigManager.FlyMod, "Fly Mode", FlyPatch.SetFlying);
ImGui.SameLine();
DrawToolTip("Allows free movement in all directions while ignoring gravity.");
}
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
if (ImGui.CollapsingHeader("Teleport##PlayerTeleport", (ImGuiTreeNodeFlags)32))
{
ImGui.InputFloat("X", ref Globals.teleportX);
ImGui.InputFloat("Y", ref Globals.teleportY);
ImGui.InputFloat("Z", ref Globals.teleportZ);
if (ImGui.Button("Teleport to coords"))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)$"[Teleport] Requested to X:{Globals.teleportX} Y:{Globals.teleportY} Z:{Globals.teleportZ}");
Utilities.TeleportToCoords(Globals.teleportX, Globals.teleportY, Globals.teleportZ);
}
}
ImGui.EndChild();
ImGui.Unindent();
ImGui.SameLine();
ImGui.BeginChild("PlayerDetailsColumn", new Vector2(num - 10f, 0f), true);
ImGui.Indent(4f);
ImGui.Dummy(new Vector2(4f, 2f));
if (ImGui.CollapsingHeader("Details", (ImGuiTreeNodeFlags)32))
{
if (ConfigManager.JumpMod.Value)
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawCheckbox(ConfigManager.NoFallDmg, "No Fall Dmg");
DrawSliderFloat(ConfigManager.JumpAmount, "##jump_amt", 10f, 500f, "Jump Mult: %.2f");
}
if (ConfigManager.SpeedMod.Value)
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawSliderFloat(ConfigManager.SpeedAmount, "##speed_amt", 1f, 20f, "Move Speed: %.2f");
}
if (ConfigManager.ClimbMod.Value)
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawSliderFloat(ConfigManager.ClimbAmount, "##climb_amt", 1f, 20f, "Climb Speed: %.2f");
}
if (ConfigManager.VineClimbMod.Value)
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawSliderFloat(ConfigManager.VineClimbAmount, "##vine_climb_amt", 1f, 20f, "Vine Speed: %.2f");
}
if (ConfigManager.RopeClimbMod.Value)
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawSliderFloat(ConfigManager.RopeClimbAmount, "##rope_climb_amt", 1f, 20f, "Rope Speed: %.2f");
}
if (ConfigManager.FlyMod.Value)
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawSliderFloat(ConfigManager.FlySpeed, "##fly_speed", 10f, 100f, "Fly Speed: %.2f");
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawSliderFloat(ConfigManager.FlyAcceleration, "##fly_acceleration", 10f, 300f, "Fly Acceleration: %.2f");
}
}
ImGui.Unindent();
ImGui.EndChild();
}
else if (selectedTab == 2)
{
if (Globals.itemNames.Count == 0)
{
Utilities.UpdateItems();
}
List<(int, int)> list = new List<(int, int)>();
ImGui.Indent(4f);
ImGui.Dummy(new Vector2(4f, 2f));
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
if (ImGui.BeginTable("InventorySlots", 3, (ImGuiTableFlags)1984))
{
ImGui.TableSetupColumn("Slot 1");
ImGui.TableSetupColumn("Slot 2");
ImGui.TableSetupColumn("Slot 3");
ImGui.TableHeadersRow();
ImGui.TableNextRow();
for (int j = 0; j < 3; j++)
{
ImGui.TableSetColumnIndex(j);
ImGui.PushID(j);
string text = "None";
if (Player.localPlayer?.itemSlots != null && Player.localPlayer.itemSlots.Length > j && (Object)(object)Player.localPlayer.itemSlots[j]?.prefab != (Object)null)
{
text = Player.localPlayer.itemSlots[j].prefab.GetName();
}
ImGui.Text($"Item {j + 1}:");
ImGui.SameLine();
ImGui.Text(text);
ImGui.Spacing();
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
int selectedIndex = Globals.selectedItems[j];
if (DrawSearchableCombo($"##Combo{j}", ref selectedIndex, Globals.itemNames, ref Globals.itemSearchBuffers[j]))
{
Globals.selectedItems[j] = selectedIndex;
list.Add((j, selectedIndex));
}
ImGui.SameLine();
DrawToolTip("Search and assign any available item to this slot.");
ImGui.Spacing();
ConfigEntry<float> val2 = (ConfigEntry<float>)(j switch
{
0 => ConfigManager.RechargeAmountSlot1,
1 => ConfigManager.RechargeAmountSlot2,
2 => ConfigManager.RechargeAmountSlot3,
_ => ConfigManager.RechargeAmountSlot1,
});
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
DrawSliderFloat(val2, $"##recharge_mount##{j}", 0f, 100f, "Charge: %.1f");
if (ImGui.Button($"Recharge##{j}"))
{
Utilities.RechargeInventorySlot(j, val2.Value);
}
ImGui.SameLine();
DrawToolTip("Set how much to recharge the item’s charges when clicking 'Recharge'.");
ImGui.PopID();
}
ImGui.EndTable();
}
foreach (var (slot, itemIndex) in list)
{
Utilities.AssignInventoryItem(slot, itemIndex);
}
ImGui.Dummy(new Vector2(4f, 2f));
if (ImGui.Button("Refresh Item List"))
{
Utilities.UpdateItems();
}
ImGui.SameLine();
DrawToolTip("Reloads the list of available items in case something was missed or updated.");
ImGui.Unindent();
}
else if (selectedTab == 3)
{
float num2 = ImGui.GetContentRegionAvail().X / 2f;
if (Globals.allPlayers.Count == 0)
{
Utilities.RefreshPlayerList();
}
ImGui.BeginChild("Lobby_PlayerList", new Vector2(num2, 0f), true);
ImGui.Indent(4f);
ImGui.Dummy(new Vector2(4f, 2f));
if (ImGui.CollapsingHeader("Lobby Players", (ImGuiTreeNodeFlags)32))
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
if (ImGui.BeginCombo("Select Player", (Globals.selectedPlayer >= 0 && Globals.selectedPlayer < Globals.playerNames.Count) ? Globals.playerNames[Globals.selectedPlayer] : "None"))
{
for (int k = 0; k < Globals.playerNames.Count; k++)
{
bool flag2 = Globals.selectedPlayer == k;
if (ImGui.Selectable($"{Globals.playerNames[k]}##{k}", flag2))
{
Globals.selectedPlayer = k;
}
if (flag2)
{
ImGui.SetItemDefaultFocus();
}
}
ImGui.EndCombo();
}
ImGui.Dummy(new Vector2(4f, 4f));
ImGui.Separator();
ImGui.Text("All Players");
if (ImGui.Button("Revive All"))
{
Utilities.ReviveAllPlayers();
}
ImGui.SameLine();
if (ImGui.Button("Kill All"))
{
Utilities.KillAllPlayers();
}
bool excludeSelfFromAllActions = Globals.excludeSelfFromAllActions;
if (ImGui.Checkbox("Exclude Self from Kill All##KillAll", ref excludeSelfFromAllActions))
{
Globals.excludeSelfFromAllActions = excludeSelfFromAllActions;
}
if (ImGui.Button("Warp All To Me"))
{
Utilities.WarpAllPlayersToMe();
}
}
ImGui.Dummy(new Vector2(4f, 2f));
if (ImGui.Button("Refresh Players List"))
{
Utilities.RefreshPlayerList();
}
ImGui.SameLine();
DrawToolTip("Manually reloads the list of players in case it didn’t update automatically.");
ImGui.Unindent();
ImGui.EndChild();
ImGui.SameLine();
ImGui.BeginChild("Lobby_PlayerActions", new Vector2(num2 - 10f, 0f), true);
ImGui.Indent(4f);
ImGui.Dummy(new Vector2(0f, 4f));
if (ImGui.CollapsingHeader("Actions", (ImGuiTreeNodeFlags)32))
{
if (Globals.selectedPlayer >= 0 && Globals.selectedPlayer < Globals.allPlayers.Count)
{
if (ImGui.Button("Revive"))
{
Utilities.ReviveSelectedPlayer();
}
ImGui.SameLine();
if (ImGui.Button("Kill"))
{
Utilities.KillSelectedPlayer();
}
if (ImGui.Button("Warp To"))
{
Utilities.WarpToSelectedPlayer();
}
ImGui.SameLine();
if (ImGui.Button("Warp To Me"))
{
Utilities.WarpSelectedPlayerToMe();
}
ImGui.Dummy(new Vector2(4f, 2f));
ImGui.Separator();
ImGui.Text("Special Actions");
if (ImGui.Button("Spawn Scoutmaster"))
{
Utilities.SpawnScoutmasterForPlayer(Globals.selectedPlayer);
}
ImGui.SameLine();
DrawToolTip("Spawns a Scoutmaster near the selected player. Only works for host. Forces aggro.");
}
else
{
ImGui.Text("No player selected.");
}
}
ImGui.Unindent();
ImGui.EndChild();
}
else if (selectedTab == 4)
{
float num3 = ImGui.GetContentRegionAvail().X / 2f;
Utilities.EnsureLuggageListInitialized();
ImGui.BeginChild("World_LuggageList", new Vector2(num3, 0f), true);
ImGui.Indent(4f);
ImGui.Dummy(new Vector2(4f, 2f));
if (ImGui.CollapsingHeader("Containers", (ImGuiTreeNodeFlags)32))
{
ImGui.SetNextItemWidth(ImGui.GetContentRegionAvail().X - 4f);
string text2 = ((Globals.selectedLuggageIndex >= 0 && Globals.selectedLuggageIndex < Globals.luggageLabels.Count) ? Globals.luggageLabels[Globals.selectedLuggageIndex] : "None");
if (ImGui.BeginCombo("Select Container", text2))
{
if (Globals.luggageLabels.Count > 0)
{
for (int l = 0; l < Globals.luggageLabels.Count; l++)
{
bool flag3 = Globals.selectedLuggageIndex == l;
if (ImGui.Selectable($"{Globals.luggageLabels[l]}##{l}", flag3))
{
Globals.selectedLuggageIndex = l;
}
if (flag3)
{
ImGui.SetItemDefaultFocus();
}
}
}
else
{
ImGui.TextDisabled("No containers found.");
}
ImGui.EndCombo();
}
ImGui.Dummy(new Vector2(4f, 2f));
if (ImGui.Button("Refresh Luggage List"))
{
Utilities.hasInitializedLuggageList = false;
Utilities.RefreshLuggageList();
}
ImGui.SameLine();
DrawToolTip("Reloads the list of luggage within 300m of your position.");
ImGui.Dummy(new Vector2(4f, 4f));
ImGui.Separator();
ImGui.Text("All Nearby Containers");
if (ImGui.Button("Open All Nearby"))
{
Utilities.OpenAllNearbyLuggage();
}
}
ImGui.Unindent();
ImGui.EndChild();
ImGui.SameLine();
ImGui.BeginChild("World_LuggageActions", new Vector2(num3 - 10f, 0f), true);
ImGui.Indent(4f);
ImGui.Dummy(new Vector2(0f, 4f));
if (ImGui.CollapsingHeader("Actions", (ImGuiTreeNodeFlags)32))
{
if (Globals.selectedLuggageIndex >= 0 && Globals.selectedLuggageIndex < Globals.luggageLabels.Count)
{
string arg = Globals.luggageLabels[Globals.selectedLuggageIndex];
if (ImGui.Button("Warp To Luggage"))
{
((BaseUnityPlugin)this).Logger.LogInfo((object)$"[UI] Warp requested for index {Globals.selectedLuggageIndex} - {arg}");
Vector3 val3 = Globals.luggageObject[Globals.selectedLuggageIndex].Center();
val3.y += 1.5f;
Utilities.TeleportToCoords(val3.x, val3.y, val3.z);
}
if (ImGui.Button("Open Luggage"))
{
Utilities.OpenLuggage(Globals.selectedLuggageIndex);
}
}
else
{
ImGui.Text("No luggage selected.");
}
}
ImGui.Unindent();
ImGui.EndChild();
}
else if (selectedTab == 5)
{
ImGui.Indent(4f);
ImGui.Dummy(new Vector2(4f, 2f));
ImGui.Text("PEAK AIO Mod");
ImGui.Separator();
ImGui.Text("Version: 1.0.2");
ImGui.Text("Author: OniGremlin");
ImGui.Spacing();
ImGui.TextWrapped("PEAK AIO is a quality-of-life and utility mod designed for the game PEAK. It brings together a wide range of player enhancements, inventory tools, world manipulation, and lobby control features in one sleek ImGui-powered interface.");
ImGui.Spacing();
ImGui.Text("Key Features:");
ImGui.BulletText("Infinite stamina and affliction immunity");
ImGui.BulletText("Adjustable movement: speed, jump, and climb mods");
ImGui.BulletText("Real-time inventory editing and recharge");
ImGui.BulletText("Player-to-player warp, revive, and kill tools");
ImGui.BulletText("Custom teleportation and ping-based movement");
ImGui.BulletText("Stylized UI with tabbed interface");
ImGui.Spacing();
ImGui.Text("Special Thanks:");
ImGui.BulletText("Penswer for insight, and guidance");
ImGui.BulletText("BepInEx team for the modding framework");
ImGui.BulletText("DearImGuiInjection for seamless UI integration");
ImGui.BulletText("HarmonyX for runtime patching support");
ImGui.Spacing();
ImGui.Separator();
ImGui.TextWrapped("This mod is provided as-is for educational and personal use. Not affiliated with or endorsed by the developers of PEAK. Use responsibly.");
ImGui.Unindent();
}
ImGui.EndChild();
}
ImGui.End();
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)("[UI ERROR] Exception in MyUI: " + ex));
}
}
}
public static class Utilities
{
public static ManualLogSource Logger;
public static bool hasInitializedLuggageList;
public static void GetPlayer()
{
if ((Object)(object)Globals.playerObj == (Object)null)
{
Globals.playerObj = Player.localPlayer;
}
}
public static void UpdateItems()
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
Globals.items.Clear();
Globals.itemNames.Clear();
for (int i = 0; i < 3; i++)
{
Globals.selectedItems[i] = -1;
}
Object[] array = Resources.FindObjectsOfTypeAll(typeof(Item));
foreach (Object obj in array)
{
Item val = (Item)(object)((obj is Item) ? obj : null);
if ((Object)(object)val != (Object)null)
{
Scene scene = ((Component)val).gameObject.scene;
if (((Scene)(ref scene)).handle == 0)
{
scene = ((Component)val).gameObject.scene;
if (string.IsNullOrEmpty(((Scene)(ref scene)).name))
{
Globals.items.Add(val);
Globals.itemNames.Add(val.GetName());
}
}
}
}
});
}
public static void AssignInventoryItem(int slot, int itemIndex)
{
GetPlayer();
if ((Object)(object)Globals.playerObj == (Object)null)
{
Logger.LogError((object)"[PEAK AIO] Player is null during inventory operation");
}
else if ((Object)(object)Globals.playerObj != (Object)null && Globals.playerObj.itemSlots != null && Globals.playerObj.itemSlots.Length > slot && itemIndex >= 0 && itemIndex < Globals.items.Count)
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
ItemSlot obj = Globals.playerObj.itemSlots[slot];
obj.prefab = Globals.items[itemIndex];
obj.data = new ItemInstanceData(Guid.NewGuid());
ItemInstanceDataHandler.AddInstanceData(obj.data);
byte[] array = IBinarySerializable.ToManagedArray<InventorySyncData>(new InventorySyncData(Globals.playerObj.itemSlots, Globals.playerObj.backpackSlot, Globals.playerObj.tempFullSlot));
((MonoBehaviourPun)Globals.playerObj).photonView.RPC("SyncInventoryRPC", (RpcTarget)1, new object[2] { array, true });
});
Logger.LogInfo((object)$"[Inventory] Assigned {Globals.itemNames[itemIndex]} to slot {slot}");
}
}
public static void RechargeInventorySlot(int slot, float rechargeValue)
{
GetPlayer();
if ((Object)(object)Globals.playerObj == (Object)null)
{
Logger.LogError((object)"[PEAK AIO] Player is null during inventory operation");
}
else
{
if (!((Object)(object)Globals.playerObj != (Object)null) || Globals.playerObj.itemSlots == null || Globals.playerObj.itemSlots.Length <= slot)
{
return;
}
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Invalid comparison between Unknown and I4
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Invalid comparison between Unknown and I4
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Invalid comparison between Unknown and I4
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Invalid comparison between Unknown and I4
ItemSlot val = Globals.playerObj.itemSlots[slot];
if (val?.data?.data != null)
{
foreach (KeyValuePair<DataEntryKey, DataEntryValue> datum in val.data.data)
{
if ((int)datum.Key == 12)
{
DataEntryValue value = datum.Value;
IntItemData val2 = (IntItemData)(object)((value is IntItemData) ? value : null);
if (val2 != null)
{
val2.Value = (int)rechargeValue;
}
}
else if ((int)datum.Key == 10)
{
DataEntryValue value2 = datum.Value;
FloatItemData val3 = (FloatItemData)(object)((value2 is FloatItemData) ? value2 : null);
if (val3 != null)
{
val3.Value = rechargeValue;
}
}
else if ((int)datum.Key == 11)
{
DataEntryValue value3 = datum.Value;
FloatItemData val4 = (FloatItemData)(object)((value3 is FloatItemData) ? value3 : null);
if (val4 != null)
{
val4.Value = rechargeValue;
}
}
else if ((int)datum.Key == 2)
{
DataEntryValue value4 = datum.Value;
OptionableIntItemData val5 = (OptionableIntItemData)(object)((value4 is OptionableIntItemData) ? value4 : null);
if (val5 != null)
{
val5.Value = (int)rechargeValue;
}
}
}
}
});
Logger.LogInfo((object)$"[Inventory] Recharged slot {slot} to {rechargeValue}");
}
}
public static void RefreshPlayerList()
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
try
{
Globals.allPlayers.Clear();
Globals.playerNames.Clear();
Globals.selectedPlayer = -1;
foreach (Character allCharacter in Character.AllCharacters)
{
Globals.allPlayers.Add(allCharacter);
Globals.playerNames.Add(allCharacter.characterName);
}
Logger.LogInfo((object)$"[PlayerList] Found {Globals.allPlayers.Count} players.");
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)ex);
}
});
}
public static void ReviveAllPlayers()
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_0036: 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_003b: 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_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
foreach (Character allCharacter in Character.AllCharacters)
{
Vector3 val = (((Object)(object)allCharacter.Ghost != (Object)null) ? ((Component)allCharacter.Ghost).transform.position : allCharacter.Head);
((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2]
{
val + new Vector3(0f, 4f, 0f),
false
});
}
Logger.LogInfo((object)"[Lobby] Revive All triggered.");
});
}
public static void KillAllPlayers()
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_002a: 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_0044: Unknown result type (might be due to invalid IL or missing references)
foreach (Character allCharacter in Character.AllCharacters)
{
if (!Globals.excludeSelfFromAllActions || !allCharacter.IsLocal)
{
Vector3 position = ((Component)allCharacter).transform.position;
((MonoBehaviourPun)allCharacter).photonView.RPC("RPCA_Die", (RpcTarget)0, new object[1] { position });
}
}
Logger.LogInfo((object)$"[Lobby] Kill All triggered. ExcludeSelf: {Globals.excludeSelfFromAllActions}");
});
}
public static void WarpAllPlayersToMe()
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_0005: 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_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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)
Vector3 val = Character.localCharacter.Head + new Vector3(0f, 4f, 0f);
foreach (Character allCharacter in Character.AllCharacters)
{
((MonoBehaviourPun)allCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true });
}
Logger.LogInfo((object)"[Lobby] Warp All To Me triggered.");
});
}
public static void ReviveSelectedPlayer()
{
if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count)
{
return;
}
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
try
{
Character val = Globals.allPlayers[Globals.selectedPlayer];
Vector3 val2 = (((Object)(object)val.Ghost != (Object)null) ? ((Component)val.Ghost).transform.position : val.Head);
((MonoBehaviourPun)val).photonView.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[2]
{
val2 + new Vector3(0f, 4f, 0f),
false
});
Logger.LogInfo((object)$"[Lobby] Revive requested for player index {Globals.selectedPlayer}");
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)ex);
}
});
}
public static void KillSelectedPlayer()
{
if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count)
{
return;
}
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//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_002e: Unknown result type (might be due to invalid IL or missing references)
try
{
Character obj = Globals.allPlayers[Globals.selectedPlayer];
Vector3 position = ((Component)obj).transform.position;
((MonoBehaviourPun)obj).photonView.RPC("RPCA_Die", (RpcTarget)0, new object[1] { position });
Logger.LogInfo((object)$"[Lobby] Kill requested for player index {Globals.selectedPlayer}");
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)ex);
}
});
}
public static void WarpToSelectedPlayer()
{
if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count)
{
return;
}
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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)
try
{
Vector3 val = Globals.allPlayers[Globals.selectedPlayer].Head + new Vector3(0f, 4f, 0f);
((MonoBehaviourPun)Character.localCharacter).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true });
Logger.LogInfo((object)$"[Lobby] Warp to requested for player index {Globals.selectedPlayer}");
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)ex);
}
});
}
public static void WarpSelectedPlayerToMe()
{
if (Globals.selectedPlayer < 0 || Globals.selectedPlayer >= Globals.allPlayers.Count)
{
return;
}
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0046: Unknown result type (might be due to invalid IL or missing references)
try
{
Character obj = Globals.allPlayers[Globals.selectedPlayer];
Vector3 val = Character.localCharacter.Head + new Vector3(0f, 4f, 0f);
((MonoBehaviourPun)obj).photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true });
Logger.LogInfo((object)$"[Lobby] Warp to me requested for player index {Globals.selectedPlayer}");
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)ex);
}
});
}
public static void TeleportToCoords(float x, float y, float z)
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
//IL_006a: 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)
try
{
Character localCharacter = Character.localCharacter;
if ((Object)(object)localCharacter == (Object)null || localCharacter.data.dead)
{
Logger.LogWarning((object)"[Teleport] Local character is null or dead. Aborting teleport.");
}
else
{
PhotonView photonView = ((MonoBehaviourPun)localCharacter).photonView;
if (!((Object)(object)photonView == (Object)null))
{
Vector3 val = default(Vector3);
((Vector3)(ref val))..ctor(x, y, z);
photonView.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true });
ConfigManager.Logger.LogInfo((object)$"[Teleport] Teleported to {val}");
}
}
}
catch (Exception ex)
{
ConfigManager.Logger.LogError((object)("[Teleport] Exception: " + ex));
}
});
}
public static void EnsureLuggageListInitialized()
{
if (!hasInitializedLuggageList)
{
hasInitializedLuggageList = true;
RefreshLuggageList();
}
}
public static void RefreshLuggageList()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
Globals.luggageLabels.Clear();
Globals.luggageObject.Clear();
Globals.selectedLuggageIndex = -1;
List<(Luggage, float)> list = new List<(Luggage, float)>();
foreach (Luggage item3 in Luggage.ALL_LUGGAGE)
{
if (!((Object)(object)item3 == (Object)null))
{
float num = Vector3.Distance(Character.localCharacter.Head, item3.Center());
if (num <= 300f)
{
list.Add((item3, num));
}
}
}
list.Sort(((Luggage lug, float distance) a, (Luggage lug, float distance) b) => a.distance.CompareTo(b.distance));
foreach (var item4 in list)
{
Luggage item = item4.Item1;
float item2 = item4.Item2;
string arg = item.displayName ?? "Unnamed";
Globals.luggageLabels.Add($"{arg} [{item2:F1}m]");
Globals.luggageObject.Add(item);
}
Logger.LogInfo((object)$"[Luggage] Refreshed. Found {Globals.luggageLabels.Count} nearby.");
}
public static void OpenAllNearbyLuggage()
{
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
int num = 0;
for (int i = 0; i < Globals.luggageObject.Count; i++)
{
Luggage val = Globals.luggageObject[i];
if (!((Object)(object)val == (Object)null))
{
PhotonView component = ((Component)val).GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null)
{
component.RPC("OpenLuggageRPC", (RpcTarget)0, new object[1] { true });
num++;
}
}
}
Logger.LogInfo((object)$"[Luggage] Requested open for {num} nearby containers.");
});
}
public static void OpenLuggage(int index)
{
if (index < 0 || index >= Globals.luggageObject.Count)
{
return;
}
Luggage luggage = Globals.luggageObject[index];
if ((Object)(object)luggage == (Object)null)
{
return;
}
UnityMainThreadDispatcher.Enqueue((Action)delegate
{
try
{
PhotonView component = ((Component)luggage).GetComponent<PhotonView>();
if ((Object)(object)component != (Object)null)
{
component.RPC("OpenLuggageRPC", (RpcTarget)0, new object[1] { true });
Logger.LogInfo((object)("[Luggage] Sent OpenLuggageRPC for: " + luggage.displayName));
}
}
catch (Exception arg)
{
Logger.LogError((object)$"[Luggage] Open failed: {arg}");
}
});
}
public static void SpawnScoutmasterForPlayer(int playerIndex)
{
UnityMainThreadDispatcher.Enqueue((Action)async delegate
{
if (!PhotonNetwork.IsMasterClient)
{
Logger.LogWarning((object)"[Scoutmaster] Only the MasterClient can spawn the Scoutmaster.");
}
else if (playerIndex < 0 || playerIndex >= Character.AllCharacters.Count)
{
Logger.LogWarning((object)"[Scoutmaster] Invalid player index.");
}
else
{
Character targetCharacter = Character.AllCharacters[playerIndex];
Vector3 val = ((Component)targetCharacter).transform.position + new Vector3(Random.Range(-10f, 10f), 25f, Random.Range(-10f, 10f));
Vector3 down = Vector3.down;
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(val, down, ref val2, 100f, -1))
{
Vector3 val3 = ((RaycastHit)(ref val2)).point + Vector3.up * 1f;
Quaternion identity = Quaternion.identity;
GameObject scoutObj = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", val3, identity, (byte)0, (object[])null);
Character component = scoutObj.GetComponent<Character>();
if ((Object)(object)component != (Object)null)
{
component.data.spawnPoint = ((Component)component).transform;
}
await Task.Delay(100);
Scoutmaster component2 = scoutObj.GetComponent<Scoutmaster>();
if ((Object)(object)component2 != (Object)null)
{
try
{
MethodInfo method = typeof(Scoutmaster).GetMethod("SetCurrentTarget", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(component2, new object[2] { targetCharacter, 15f });
Logger.LogInfo((object)("[Scoutmaster] Target set to " + targetCharacter.characterName));
}
else
{
Logger.LogWarning((object)"[Scoutmaster] Reflection failed — method not found.");
}
}
catch (Exception ex)
{
Logger.LogError((object)("[Scoutmaster] Reflection error: " + ex));
}
}
}
else
{
Logger.LogWarning((object)"[Scoutmaster] No valid ground to spawn.");
}
}
});
}
}