Add files via upload
This commit is contained in:
@@ -1,57 +1,143 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using MelonLoader;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace DevourClient.Helpers
|
namespace DevourClient.Helpers
|
||||||
{
|
{
|
||||||
class GUIHelper
|
public static class GUIHelper // 改为静态类
|
||||||
{
|
{
|
||||||
|
private static Texture2D previewTexture;
|
||||||
|
private static GUIStyle boxStyle;
|
||||||
|
|
||||||
|
private static Dictionary<Color, Texture2D> colorTextureCache = new Dictionary<Color, Texture2D>();
|
||||||
|
private static Dictionary<int, Texture2D> circularTextureCache = new Dictionary<int, Texture2D>();
|
||||||
|
|
||||||
|
// 初始化方法
|
||||||
|
public static void Initialize()
|
||||||
|
{
|
||||||
|
if (previewTexture == null)
|
||||||
|
{
|
||||||
|
previewTexture = new Texture2D(1, 1);
|
||||||
|
boxStyle = new GUIStyle(GUI.skin.box);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理方法
|
||||||
|
public static void Cleanup()
|
||||||
|
{
|
||||||
|
if (previewTexture != null)
|
||||||
|
{
|
||||||
|
UnityEngine.Object.Destroy(previewTexture);
|
||||||
|
previewTexture = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var texture in colorTextureCache.Values)
|
||||||
|
{
|
||||||
|
if (texture != null)
|
||||||
|
{
|
||||||
|
UnityEngine.Object.Destroy(texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
colorTextureCache.Clear();
|
||||||
|
|
||||||
|
foreach (var texture in circularTextureCache.Values)
|
||||||
|
{
|
||||||
|
if (texture != null)
|
||||||
|
{
|
||||||
|
UnityEngine.Object.Destroy(texture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
circularTextureCache.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
private static float R;
|
private static float R;
|
||||||
private static float G;
|
private static float G;
|
||||||
private static float B;
|
private static float B;
|
||||||
|
|
||||||
public static Color ColorPick(string title, Color color)
|
public static Color ColorPick(string title, Color color)
|
||||||
{
|
{
|
||||||
GUI.Label(new Rect(Settings.Settings.x + 195, Settings.Settings.y + 70, 250, 30), title);
|
Initialize(); // 确保已初始化
|
||||||
|
|
||||||
R = GUI.VerticalSlider(new Rect(Settings.Settings.x + 240, Settings.Settings.y + 100, 30, 90), color.r, 0f, 1f);
|
// 使用 GUILayout 来创建更可靠的滑动条
|
||||||
G = GUI.VerticalSlider(new Rect(Settings.Settings.x + 270, Settings.Settings.y + 100, 30, 90), color.g, 0f, 1f);
|
GUILayout.BeginArea(new Rect(Settings.Settings.x + 195, Settings.Settings.y + 70, 250, 250));
|
||||||
B = GUI.VerticalSlider(new Rect(Settings.Settings.x + 300, Settings.Settings.y + 100, 30, 90), color.b, 0f, 1f);
|
|
||||||
|
|
||||||
GUI.Label(new Rect(Settings.Settings.x + 240, Settings.Settings.y + 190, 30, 30), "R");
|
|
||||||
GUI.Label(new Rect(Settings.Settings.x + 270, Settings.Settings.y + 190, 30, 30), "G");
|
|
||||||
GUI.Label(new Rect(Settings.Settings.x + 300, Settings.Settings.y + 190, 30, 30), "B");
|
|
||||||
|
|
||||||
color = new Color(R, G, B, 1);
|
GUILayout.Label(title);
|
||||||
|
GUILayout.Space(10);
|
||||||
|
|
||||||
void DrawPreview(Rect position, Color color_to_draw)
|
// R 通道
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("R", GUILayout.Width(20));
|
||||||
|
R = GUILayout.HorizontalSlider(color.r, 0f, 1f, GUILayout.Width(150));
|
||||||
|
GUILayout.Label(((int)(R * 255)).ToString(), GUILayout.Width(30));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
// G 通道
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("G", GUILayout.Width(20));
|
||||||
|
G = GUILayout.HorizontalSlider(color.g, 0f, 1f, GUILayout.Width(150));
|
||||||
|
GUILayout.Label(((int)(G * 255)).ToString(), GUILayout.Width(30));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
// B 通道
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("B", GUILayout.Width(20));
|
||||||
|
B = GUILayout.HorizontalSlider(color.b, 0f, 1f, GUILayout.Width(150));
|
||||||
|
GUILayout.Label(((int)(B * 255)).ToString(), GUILayout.Width(30));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.Space(10);
|
||||||
|
|
||||||
|
// 颜色预览
|
||||||
|
void DrawPreview(Color color_to_draw)
|
||||||
{
|
{
|
||||||
Texture2D texture = new Texture2D(1, 1);
|
if (previewTexture == null)
|
||||||
texture.SetPixel(0, 0, color_to_draw);
|
{
|
||||||
texture.Apply();
|
previewTexture = new Texture2D(1, 1);
|
||||||
GUIStyle boxStyle = new GUIStyle(GUI.skin.box);
|
}
|
||||||
boxStyle.normal.background = texture;
|
|
||||||
GUI.Box(position, GUIContent.none, boxStyle);
|
previewTexture.SetPixel(0, 0, color_to_draw);
|
||||||
|
previewTexture.Apply();
|
||||||
|
boxStyle.normal.background = previewTexture;
|
||||||
|
GUILayout.Box(GUIContent.none, boxStyle, GUILayout.Height(30));
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawPreview(new Rect(Settings.Settings.x + 195, Settings.Settings.y + 100, 20, 90), color);
|
DrawPreview(new Color(R, G, B, 1));
|
||||||
|
|
||||||
|
GUILayout.EndArea();
|
||||||
|
|
||||||
return color;
|
return new Color(R, G, B, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture2D MakeTex(int width, int height, Color col)
|
public static Texture2D MakeTex(int width, int height, Color col)
|
||||||
{
|
{
|
||||||
|
string cacheKey = $"{width}x{height}_{col.r}_{col.g}_{col.b}";
|
||||||
|
|
||||||
|
if (colorTextureCache.TryGetValue(col, out Texture2D cachedTexture))
|
||||||
|
{
|
||||||
|
return cachedTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture2D result = new Texture2D(width, height);
|
||||||
Color[] pix = new Color[width * height];
|
Color[] pix = new Color[width * height];
|
||||||
for (int i = 0; i < pix.Length; ++i)
|
for (int i = 0; i < pix.Length; ++i)
|
||||||
{
|
{
|
||||||
pix[i] = col;
|
pix[i] = col;
|
||||||
}
|
}
|
||||||
Texture2D result = new Texture2D(width, height);
|
|
||||||
result.SetPixels(pix);
|
result.SetPixels(pix);
|
||||||
result.Apply();
|
result.Apply();
|
||||||
|
|
||||||
|
colorTextureCache[col] = result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture2D GetCircularTexture(int width, int height)
|
public static Texture2D GetCircularTexture(int width, int height)
|
||||||
{
|
{
|
||||||
|
int size = Mathf.Max(width, height);
|
||||||
|
if (circularTextureCache.TryGetValue(size, out Texture2D cachedTexture))
|
||||||
|
{
|
||||||
|
return cachedTexture;
|
||||||
|
}
|
||||||
|
|
||||||
Texture2D texture = new Texture2D(width, height);
|
Texture2D texture = new Texture2D(width, height);
|
||||||
for (int x = 0; x < texture.width; x++)
|
for (int x = 0; x < texture.width; x++)
|
||||||
{
|
{
|
||||||
@@ -69,7 +155,8 @@ namespace DevourClient.Helpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
texture.Apply();
|
texture.Apply();
|
||||||
|
|
||||||
|
circularTextureCache[size] = texture;
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,12 @@
|
|||||||
Il2CppPhoton.Bolt.BoltNetwork.LoadScene(mapName);
|
Il2CppPhoton.Bolt.BoltNetwork.LoadScene(mapName);
|
||||||
|
|
||||||
MelonLoader.MelonLogger.Warning("Please press the button only once, it may take some time for the map to load.");
|
MelonLoader.MelonLogger.Warning("Please press the button only once, it may take some time for the map to load.");
|
||||||
|
Hacks.Misc.ShowMessageBox("Please press the button only once, it may take some time for the map to load.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MelonLoader.MelonLogger.Warning("You must be the host to use this command!");
|
MelonLoader.MelonLogger.Warning("You must be the host to use this command!");
|
||||||
|
Hacks.Misc.ShowMessageBox("You must be the host to use this command!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,374 +1,577 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Il2CppOpsive.UltimateCharacterController.Character;
|
using Il2CppOpsive.UltimateCharacterController.Character;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
using Il2CppPhoton.Bolt;
|
using Il2CppPhoton.Bolt;
|
||||||
|
|
||||||
namespace DevourClient.Helpers
|
namespace DevourClient.Helpers
|
||||||
{
|
{
|
||||||
public class BasePlayer
|
public class BasePlayer
|
||||||
{
|
{
|
||||||
public GameObject p_GameObject { get; set; } = default!;
|
public GameObject p_GameObject { get; set; } = default!;
|
||||||
public string Name { get; set; } = default!;
|
public string Name { get; set; } = default!;
|
||||||
public string Id { get; set; } = default!;
|
public string Id { get; set; } = default!;
|
||||||
|
|
||||||
public void Kill()
|
public void Kill()
|
||||||
{
|
{
|
||||||
if (p_GameObject == null)
|
if (p_GameObject == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Il2Cpp.SurvivalAzazelBehaviour sab = Il2Cpp.SurvivalAzazelBehaviour.FindObjectOfType<Il2Cpp.SurvivalAzazelBehaviour>();
|
Il2Cpp.SurvivalAzazelBehaviour sab = Il2Cpp.SurvivalAzazelBehaviour.FindObjectOfType<Il2Cpp.SurvivalAzazelBehaviour>();
|
||||||
|
|
||||||
if (sab == null)
|
if (sab == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sab.OnKnockout(sab.gameObject, p_GameObject);
|
sab.OnKnockout(sab.gameObject, p_GameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Revive()
|
public void Revive()
|
||||||
{
|
{
|
||||||
if (p_GameObject == null)
|
if (p_GameObject == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Il2Cpp.NolanBehaviour nb = p_GameObject.GetComponent<Il2Cpp.NolanBehaviour>();
|
Il2Cpp.NolanBehaviour nb = p_GameObject.GetComponent<Il2Cpp.NolanBehaviour>();
|
||||||
Il2Cpp.SurvivalReviveInteractable _reviveInteractable = UnityEngine.Object.FindObjectOfType<Il2Cpp.SurvivalReviveInteractable>();
|
Il2Cpp.SurvivalReviveInteractable _reviveInteractable = UnityEngine.Object.FindObjectOfType<Il2Cpp.SurvivalReviveInteractable>();
|
||||||
|
|
||||||
_reviveInteractable.Interact(nb.gameObject);
|
_reviveInteractable.Interact(nb.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Jumpscare()
|
public void Jumpscare()
|
||||||
{
|
{
|
||||||
if (!BoltNetwork.IsServer)
|
if (!BoltNetwork.IsServer)
|
||||||
{
|
{
|
||||||
MelonLogger.Msg("You need to be server !");
|
MelonLogger.Msg("You need to be server !");
|
||||||
return;
|
Hacks.Misc.ShowMessageBox("You need to be server !");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (p_GameObject == null)
|
|
||||||
{
|
if (p_GameObject == null)
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
Il2Cpp.SurvivalAzazelBehaviour sab = Il2Cpp.SurvivalAzazelBehaviour.FindObjectOfType<Il2Cpp.SurvivalAzazelBehaviour>();
|
|
||||||
|
Il2Cpp.SurvivalAzazelBehaviour sab = Il2Cpp.SurvivalAzazelBehaviour.FindObjectOfType<Il2Cpp.SurvivalAzazelBehaviour>();
|
||||||
if (sab == null)
|
|
||||||
{
|
if (sab == null)
|
||||||
return;
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
sab.OnPickedUpPlayer(sab.gameObject, p_GameObject, false);
|
|
||||||
|
sab.OnPickedUpPlayer(sab.gameObject, p_GameObject, false);
|
||||||
/*
|
|
||||||
MelonLogger.Msg(Name);
|
MelonLogger.Msg(Name);
|
||||||
Il2Cpp.JumpScare _jumpscare = UnityEngine.Object.FindObjectOfType<Il2Cpp.JumpScare>();
|
Hacks.Misc.ShowMessageBox(Name);
|
||||||
_jumpscare.player = p_GameObject;
|
|
||||||
_jumpscare.Activate(p_GameObject.GetComponent<BoltEntity>());
|
/*
|
||||||
*/
|
MelonLogger.Msg(Name);
|
||||||
}
|
Il2Cpp.JumpScare _jumpscare = UnityEngine.Object.FindObjectOfType<Il2Cpp.JumpScare>();
|
||||||
|
_jumpscare.player = p_GameObject;
|
||||||
public void LockInCage()
|
_jumpscare.Activate(p_GameObject.GetComponent<BoltEntity>());
|
||||||
{
|
*/
|
||||||
if (p_GameObject == null)
|
}
|
||||||
{
|
|
||||||
return;
|
public void LockInCage()
|
||||||
}
|
{
|
||||||
|
if (p_GameObject == null)
|
||||||
BoltNetwork.Instantiate(BoltPrefabs.Cage, p_GameObject.transform.position, Quaternion.identity);
|
{
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
public void TP()
|
|
||||||
{
|
BoltNetwork.Instantiate(BoltPrefabs.Cage, p_GameObject.transform.position, Quaternion.identity);
|
||||||
if (p_GameObject == null)
|
}
|
||||||
{
|
|
||||||
return;
|
public void TP()
|
||||||
}
|
{
|
||||||
|
if (p_GameObject == null)
|
||||||
Il2Cpp.NolanBehaviour nb = Player.GetPlayer();
|
{
|
||||||
nb.TeleportTo(p_GameObject.transform.position, Quaternion.identity);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TPAzazel()
|
Il2Cpp.NolanBehaviour nb = Player.GetPlayer();
|
||||||
{
|
nb.TeleportTo(p_GameObject.transform.position, Quaternion.identity);
|
||||||
if (p_GameObject == null)
|
}
|
||||||
{
|
|
||||||
return;
|
public void TPAzazel()
|
||||||
}
|
{
|
||||||
|
if (p_GameObject == null)
|
||||||
UltimateCharacterLocomotion ucl = Helpers.Map.GetAzazel().GetComponent<UltimateCharacterLocomotion>();
|
{
|
||||||
|
return;
|
||||||
if (ucl)
|
}
|
||||||
{
|
|
||||||
ucl.SetPosition(p_GameObject.transform.position);
|
UltimateCharacterLocomotion ucl = Helpers.Map.GetAzazel().GetComponent<UltimateCharacterLocomotion>();
|
||||||
}
|
|
||||||
else
|
if (ucl)
|
||||||
{
|
{
|
||||||
MelonLogger.Error("Azazel not found!");
|
ucl.SetPosition(p_GameObject.transform.position);
|
||||||
return;
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
MelonLogger.Error("Azazel not found!");
|
||||||
public void ShootPlayer()
|
Hacks.Misc.ShowMessageBox("Azazel not found!");
|
||||||
{
|
return;
|
||||||
if (!BoltNetwork.IsServer)
|
}
|
||||||
{
|
}
|
||||||
MelonLogger.Msg("You need to be server !");
|
|
||||||
return;
|
public void ShootPlayer()
|
||||||
}
|
{
|
||||||
|
if (!BoltNetwork.IsServer)
|
||||||
if (p_GameObject == null)
|
{
|
||||||
{
|
MelonLogger.Msg("You need to be server !");
|
||||||
return;
|
Hacks.Misc.ShowMessageBox("You need to be server !");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
Il2Cpp.AzazelSamBehaviour _azazelSam = UnityEngine.Object.FindObjectOfType<Il2Cpp.AzazelSamBehaviour>();
|
|
||||||
|
if (p_GameObject == null)
|
||||||
if (_azazelSam)
|
{
|
||||||
{
|
return;
|
||||||
_azazelSam.OnShootPlayer(p_GameObject, true);
|
}
|
||||||
}
|
|
||||||
}
|
Il2Cpp.AzazelSamBehaviour _azazelSam = UnityEngine.Object.FindObjectOfType<Il2Cpp.AzazelSamBehaviour>();
|
||||||
}
|
|
||||||
public class Player
|
if (_azazelSam)
|
||||||
{
|
{
|
||||||
public static bool IsInGame()
|
_azazelSam.OnShootPlayer(p_GameObject, true);
|
||||||
{
|
}
|
||||||
Il2Cpp.OptionsHelpers optionsHelpers = UnityEngine.Object.FindObjectOfType<Il2Cpp.OptionsHelpers>();
|
}
|
||||||
return optionsHelpers.inGame;
|
}
|
||||||
}
|
public class Player
|
||||||
|
{
|
||||||
public static bool IsInGameOrLobby()
|
public static bool IsInGame()
|
||||||
{
|
{
|
||||||
return GetPlayer() != null;
|
Il2Cpp.OptionsHelpers optionsHelpers = UnityEngine.Object.FindObjectOfType<Il2Cpp.OptionsHelpers>();
|
||||||
}
|
return optionsHelpers.inGame;
|
||||||
|
}
|
||||||
public static Il2Cpp.NolanBehaviour GetPlayer()
|
|
||||||
{
|
public static bool IsInGameOrLobby()
|
||||||
if (Entities.LocalPlayer_.p_GameObject == null)
|
{
|
||||||
{
|
return GetPlayer() != null;
|
||||||
return null!;
|
}
|
||||||
}
|
|
||||||
|
public static Il2Cpp.NolanBehaviour GetPlayer()
|
||||||
return Entities.LocalPlayer_.p_GameObject.GetComponent<Il2Cpp.NolanBehaviour>();
|
{
|
||||||
}
|
if (Entities.LocalPlayer_.p_GameObject == null)
|
||||||
|
{
|
||||||
public static bool IsPlayerCrawling()
|
return null!;
|
||||||
{
|
}
|
||||||
Il2Cpp.NolanBehaviour nb = Player.GetPlayer();
|
|
||||||
|
return Entities.LocalPlayer_.p_GameObject.GetComponent<Il2Cpp.NolanBehaviour>();
|
||||||
if (nb == null)
|
}
|
||||||
{
|
|
||||||
return false;
|
public static bool IsPlayerCrawling()
|
||||||
}
|
{
|
||||||
|
Il2Cpp.NolanBehaviour nb = Player.GetPlayer();
|
||||||
return nb.IsCrawling();
|
|
||||||
}
|
if (nb == null)
|
||||||
|
{
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
public class Entities
|
|
||||||
{
|
return nb.IsCrawling();
|
||||||
public static int MAX_PLAYERS = 4; //will change by calling CreateCustomizedLobby
|
}
|
||||||
|
|
||||||
public static BasePlayer LocalPlayer_ = new BasePlayer();
|
}
|
||||||
public static BasePlayer[] Players = default!;
|
|
||||||
public static Il2Cpp.GoatBehaviour[] GoatsAndRats = default!;
|
public class Entities
|
||||||
public static Il2Cpp.SurvivalInteractable[] SurvivalInteractables = default!;
|
{
|
||||||
public static Il2Cpp.KeyBehaviour[] Keys = default!;
|
private static bool isRunning = true; // Control coroutine running state
|
||||||
public static Il2Cpp.SurvivalDemonBehaviour[] Demons = default!;
|
private static List<object> activeCoroutines = new List<object>(); // Track active coroutines
|
||||||
public static Il2Cpp.SpiderBehaviour[] Spiders = default!;
|
|
||||||
public static Il2Cpp.GhostBehaviour[] Ghosts = default!;
|
public static int MAX_PLAYERS = 4; //will change by calling CreateCustomizedLobby
|
||||||
public static Il2Cpp.SurvivalAzazelBehaviour[] Azazels = default!;
|
|
||||||
public static Il2Cpp.BoarBehaviour[] Boars = default!;
|
public static BasePlayer LocalPlayer_ = new BasePlayer();
|
||||||
public static Il2Cpp.CorpseBehaviour[] Corpses = default!;
|
public static BasePlayer[] Players = default!;
|
||||||
public static Il2Cpp.CrowBehaviour[] Crows = default!;
|
public static Il2Cpp.GoatBehaviour[] GoatsAndRats = default!;
|
||||||
public static Il2Cpp.ManorLumpController[] Lumps = default!;
|
public static Il2Cpp.SurvivalInteractable[] SurvivalInteractables = default!;
|
||||||
|
public static Il2Cpp.KeyBehaviour[] Keys = default!;
|
||||||
public static IEnumerator GetLocalPlayer()
|
public static Il2Cpp.SurvivalDemonBehaviour[] Demons = default!;
|
||||||
{
|
public static Il2Cpp.SpiderBehaviour[] Spiders = default!;
|
||||||
while (true)
|
public static Il2Cpp.GhostBehaviour[] Ghosts = default!;
|
||||||
{
|
public static Il2Cpp.SurvivalAzazelBehaviour[] Azazels = default!;
|
||||||
GameObject[] currentPlayers = GameObject.FindGameObjectsWithTag("Player");
|
public static Il2Cpp.BoarBehaviour[] Boars = default!;
|
||||||
|
public static Il2Cpp.CorpseBehaviour[] Corpses = default!;
|
||||||
for (int i = 0; i < currentPlayers.Length; i++)
|
public static Il2Cpp.CrowBehaviour[] Crows = default!;
|
||||||
{
|
public static Il2Cpp.ManorLumpController[] Lumps = default!;
|
||||||
if (currentPlayers[i].GetComponent<Il2Cpp.NolanBehaviour>().entity.IsOwner)
|
|
||||||
{
|
// Method to stop all coroutines
|
||||||
LocalPlayer_.p_GameObject = currentPlayers[i];
|
public static void StopAllCoroutines()
|
||||||
break;
|
{
|
||||||
}
|
isRunning = false;
|
||||||
}
|
foreach (var coroutine in activeCoroutines)
|
||||||
|
{
|
||||||
// Wait 5 seconds before caching objects again.
|
if (coroutine != null)
|
||||||
yield return new WaitForSeconds(5f);
|
{
|
||||||
}
|
MelonCoroutines.Stop(coroutine);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static IEnumerator GetAllPlayers()
|
activeCoroutines.Clear();
|
||||||
{
|
|
||||||
while (true)
|
// Clean up all cached objects
|
||||||
{
|
CleanupCachedObjects();
|
||||||
GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
|
}
|
||||||
Players = new BasePlayer[players.Length];
|
|
||||||
|
// Clean up cached objects
|
||||||
int i = 0;
|
private static void CleanupCachedObjects()
|
||||||
foreach (GameObject p in players)
|
{
|
||||||
{
|
if (Players != null)
|
||||||
string player_name = "";
|
{
|
||||||
string player_id = "-1";
|
foreach (var player in Players)
|
||||||
|
{
|
||||||
Il2Cpp.DissonancePlayerTracking dpt = p.gameObject.GetComponent<Il2Cpp.DissonancePlayerTracking>();
|
if (player != null)
|
||||||
if (dpt != null)
|
{
|
||||||
{
|
player.p_GameObject = null;
|
||||||
player_name = dpt.state.PlayerName;
|
}
|
||||||
player_id = dpt.state.PlayerId;
|
}
|
||||||
}
|
Players = null;
|
||||||
|
}
|
||||||
if (Players[i] == null)
|
|
||||||
{
|
LocalPlayer_.p_GameObject = null;
|
||||||
Players[i] = new BasePlayer();
|
GoatsAndRats = null;
|
||||||
}
|
SurvivalInteractables = null;
|
||||||
|
Keys = null;
|
||||||
Players[i].Id = player_id;
|
Demons = null;
|
||||||
Players[i].Name = player_name;
|
Spiders = null;
|
||||||
Players[i].p_GameObject = p;
|
Ghosts = null;
|
||||||
|
Azazels = null;
|
||||||
i++;
|
Boars = null;
|
||||||
}
|
Corpses = null;
|
||||||
|
Crows = null;
|
||||||
|
Lumps = null;
|
||||||
// Wait 5 seconds before caching objects again.
|
}
|
||||||
yield return new WaitForSeconds(5f);
|
|
||||||
}
|
// Method to start all coroutines
|
||||||
}
|
public static void StartAllCoroutines()
|
||||||
public static IEnumerator GetGoatsAndRats()
|
{
|
||||||
{
|
isRunning = true;
|
||||||
while (true)
|
activeCoroutines.Clear();
|
||||||
{
|
|
||||||
GoatsAndRats = Il2Cpp.GoatBehaviour.FindObjectsOfType<Il2Cpp.GoatBehaviour>();
|
// Start all coroutines and save references
|
||||||
|
activeCoroutines.Add(MelonCoroutines.Start(GetLocalPlayer()));
|
||||||
// Wait 5 seconds before caching objects again.
|
activeCoroutines.Add(MelonCoroutines.Start(GetAllPlayers()));
|
||||||
yield return new WaitForSeconds(5f);
|
activeCoroutines.Add(MelonCoroutines.Start(GetGoatsAndRats()));
|
||||||
}
|
activeCoroutines.Add(MelonCoroutines.Start(GetSurvivalInteractables()));
|
||||||
}
|
activeCoroutines.Add(MelonCoroutines.Start(GetKeys()));
|
||||||
|
activeCoroutines.Add(MelonCoroutines.Start(GetDemons()));
|
||||||
public static IEnumerator GetSurvivalInteractables()
|
activeCoroutines.Add(MelonCoroutines.Start(GetSpiders()));
|
||||||
{
|
activeCoroutines.Add(MelonCoroutines.Start(GetGhosts()));
|
||||||
while (true)
|
activeCoroutines.Add(MelonCoroutines.Start(GetBoars()));
|
||||||
{
|
activeCoroutines.Add(MelonCoroutines.Start(GetCorpses()));
|
||||||
SurvivalInteractables = Il2Cpp.SurvivalInteractable.FindObjectsOfType<Il2Cpp.SurvivalInteractable>();
|
activeCoroutines.Add(MelonCoroutines.Start(GetCrows()));
|
||||||
|
activeCoroutines.Add(MelonCoroutines.Start(GetLumps()));
|
||||||
// Wait 5 seconds before caching objects again.
|
activeCoroutines.Add(MelonCoroutines.Start(GetAzazels()));
|
||||||
yield return new WaitForSeconds(5f);
|
}
|
||||||
}
|
|
||||||
}
|
public static IEnumerator GetLocalPlayer()
|
||||||
|
{
|
||||||
public static IEnumerator GetKeys()
|
while (isRunning)
|
||||||
{
|
{
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
Keys = Il2Cpp.KeyBehaviour.FindObjectsOfType<Il2Cpp.KeyBehaviour>();
|
GameObject[] currentPlayers = GameObject.FindGameObjectsWithTag("Player");
|
||||||
|
if (currentPlayers != null)
|
||||||
// Wait 5 seconds before caching objects again.
|
{
|
||||||
yield return new WaitForSeconds(5f);
|
for (int i = 0; i < currentPlayers.Length; i++)
|
||||||
}
|
{
|
||||||
}
|
if (currentPlayers[i].GetComponent<Il2Cpp.NolanBehaviour>().entity.IsOwner)
|
||||||
|
{
|
||||||
public static IEnumerator GetDemons()
|
// Clean up old references before updating
|
||||||
{
|
if (LocalPlayer_.p_GameObject != currentPlayers[i])
|
||||||
while (true)
|
{
|
||||||
{
|
LocalPlayer_.p_GameObject = currentPlayers[i];
|
||||||
Demons = Il2Cpp.SurvivalDemonBehaviour.FindObjectsOfType<Il2Cpp.SurvivalDemonBehaviour>();
|
}
|
||||||
|
break;
|
||||||
// Wait 5 seconds before caching objects again.
|
}
|
||||||
yield return new WaitForSeconds(5f);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
public static IEnumerator GetSpiders()
|
{
|
||||||
{
|
string err = $"GetLocalPlayer coroutine encountered an error: {e.Message}";
|
||||||
while (true)
|
MelonLogger.Error(err);
|
||||||
{
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
Spiders = Il2Cpp.SpiderBehaviour.FindObjectsOfType<Il2Cpp.SpiderBehaviour>();
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
// Wait 5 seconds before caching objects again.
|
|
||||||
yield return new WaitForSeconds(5f);
|
yield return new WaitForSeconds(5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerator GetGhosts()
|
public static IEnumerator GetAllPlayers()
|
||||||
{
|
{
|
||||||
while (true)
|
while (isRunning)
|
||||||
{
|
{
|
||||||
Ghosts = Il2Cpp.GhostBehaviour.FindObjectsOfType<Il2Cpp.GhostBehaviour>();
|
try
|
||||||
|
{
|
||||||
// Wait 5 seconds before caching objects again.
|
GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
|
||||||
yield return new WaitForSeconds(5f);
|
|
||||||
}
|
// Clean up old array before creating new one
|
||||||
}
|
if (Players != null)
|
||||||
|
{
|
||||||
public static IEnumerator GetBoars()
|
foreach (var player in Players)
|
||||||
{
|
{
|
||||||
while (true)
|
if (player != null)
|
||||||
{
|
{
|
||||||
Boars = Il2Cpp.BoarBehaviour.FindObjectsOfType<Il2Cpp.BoarBehaviour>();
|
player.p_GameObject = null;
|
||||||
|
}
|
||||||
// Wait 5 seconds before caching objects again.
|
}
|
||||||
yield return new WaitForSeconds(5f);
|
}
|
||||||
}
|
|
||||||
}
|
// Create new array
|
||||||
|
Players = new BasePlayer[players.Length];
|
||||||
public static IEnumerator GetCorpses()
|
|
||||||
{
|
for (int i = 0; i < players.Length; i++)
|
||||||
while (true)
|
{
|
||||||
{
|
if (Players[i] == null)
|
||||||
Corpses = Il2Cpp.CorpseBehaviour.FindObjectsOfType<Il2Cpp.CorpseBehaviour>();
|
{
|
||||||
|
Players[i] = new BasePlayer();
|
||||||
// Wait 5 seconds before caching objects again.
|
}
|
||||||
yield return new WaitForSeconds(5f);
|
|
||||||
}
|
Players[i].p_GameObject = players[i];
|
||||||
}
|
|
||||||
|
Il2Cpp.DissonancePlayerTracking dpt = players[i].GetComponent<Il2Cpp.DissonancePlayerTracking>();
|
||||||
public static IEnumerator GetCrows()
|
if (dpt != null)
|
||||||
{
|
{
|
||||||
while (true)
|
Players[i].Name = dpt.state.PlayerName;
|
||||||
{
|
Players[i].Id = dpt.state.PlayerId;
|
||||||
Crows = Il2Cpp.CrowBehaviour.FindObjectsOfType<Il2Cpp.CrowBehaviour>();
|
}
|
||||||
|
}
|
||||||
// Wait 5 seconds before caching objects again.
|
}
|
||||||
yield return new WaitForSeconds(5f);
|
catch (System.Exception e)
|
||||||
}
|
{
|
||||||
}
|
string err = $"GetAllPlayers coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
public static IEnumerator GetLumps()
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
{
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
while (true)
|
}
|
||||||
{
|
|
||||||
Lumps = Il2Cpp.ManorLumpController.FindObjectsOfType<Il2Cpp.ManorLumpController>();
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
// Wait 5 seconds before caching objects again.
|
}
|
||||||
yield return new WaitForSeconds(5f);
|
|
||||||
}
|
public static IEnumerator GetGoatsAndRats()
|
||||||
}
|
{
|
||||||
|
while (isRunning)
|
||||||
public static IEnumerator GetAzazels()
|
{
|
||||||
{
|
try
|
||||||
/*
|
{
|
||||||
* ikr AzazelS, because in case we spawn multiple we want the esp to render all of them
|
GoatsAndRats = Il2Cpp.GoatBehaviour.FindObjectsOfType<Il2Cpp.GoatBehaviour>();
|
||||||
*/
|
}
|
||||||
while (true)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
Azazels = Il2Cpp.SurvivalAzazelBehaviour.FindObjectsOfType<Il2Cpp.SurvivalAzazelBehaviour>();
|
string err = $"GetGoatsAndRats coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
// Wait 5 seconds before caching objects again.
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
yield return new WaitForSeconds(5f);
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
yield return new WaitForSeconds(5f);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetSurvivalInteractables()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
SurvivalInteractables = Il2Cpp.SurvivalInteractable.FindObjectsOfType<Il2Cpp.SurvivalInteractable>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetSurvivalInteractables coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetKeys()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Keys = Il2Cpp.KeyBehaviour.FindObjectsOfType<Il2Cpp.KeyBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetKeys coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetDemons()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Demons = Il2Cpp.SurvivalDemonBehaviour.FindObjectsOfType<Il2Cpp.SurvivalDemonBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetDemons coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetSpiders()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Spiders = Il2Cpp.SpiderBehaviour.FindObjectsOfType<Il2Cpp.SpiderBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetSpiders coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetGhosts()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Ghosts = Il2Cpp.GhostBehaviour.FindObjectsOfType<Il2Cpp.GhostBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetGhosts coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetBoars()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Boars = Il2Cpp.BoarBehaviour.FindObjectsOfType<Il2Cpp.BoarBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetBoars coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetCorpses()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Corpses = Il2Cpp.CorpseBehaviour.FindObjectsOfType<Il2Cpp.CorpseBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetCorpses coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetCrows()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Crows = Il2Cpp.CrowBehaviour.FindObjectsOfType<Il2Cpp.CrowBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetCrows coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetLumps()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Lumps = Il2Cpp.ManorLumpController.FindObjectsOfType<Il2Cpp.ManorLumpController>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"GetLumps coroutine encountered an error: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerator GetAzazels()
|
||||||
|
{
|
||||||
|
while (isRunning)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Azazels = Il2Cpp.SurvivalAzazelBehaviour.FindObjectsOfType<Il2Cpp.SurvivalAzazelBehaviour>();
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
string err = $"Error in GetAzazels coroutine: {e.Message}";
|
||||||
|
MelonLogger.Error(err);
|
||||||
|
DevourClient.Settings.Settings.errorMessage = err;
|
||||||
|
DevourClient.Settings.Settings.showErrorMessage = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return new WaitForSeconds(5f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user