Skip to content

Commit

Permalink
add: features and fixes for the new map (Manor)
Browse files Browse the repository at this point in the history
  • Loading branch information
ALittlePatate committed Sep 20, 2024
1 parent 2308b63 commit 283eee1
Show file tree
Hide file tree
Showing 8 changed files with 311 additions and 14 deletions.
210 changes: 208 additions & 2 deletions DevourClient/ClientMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Threading.Tasks;
using Il2CppPhoton.Bolt;
using UnityEngine;
using Il2Cpp;

namespace DevourClient
{
Expand Down Expand Up @@ -59,6 +60,7 @@ enum CurrentTab : int
static bool need_fly_reset = false;
static bool crosshair = false;
static bool in_game_cache = false;
static bool should_show_start_message = true;
static Texture2D crosshairTexture = default!;

public void Start()
Expand All @@ -79,6 +81,8 @@ public void Start()
MelonCoroutines.Start(Helpers.Entities.GetGhosts());
MelonCoroutines.Start(Helpers.Entities.GetBoars());
MelonCoroutines.Start(Helpers.Entities.GetCorpses());
MelonCoroutines.Start(Helpers.Entities.GetCrows());
MelonCoroutines.Start(Helpers.Entities.GetLumps());
MelonCoroutines.Start(Helpers.Entities.GetAzazels());
MelonCoroutines.Start(Helpers.Entities.GetAllPlayers());
}
Expand Down Expand Up @@ -222,6 +226,12 @@ public void Update()

public void OnGUI()
{
if (should_show_start_message)
{
if (DevourClient.Hacks.Misc.ShowMessageBox("Welcome to DevourClient.\n\nPress the INS key to open the menu.") == 0)
should_show_start_message = false;
}

GUI.backgroundColor = Color.grey;

GUI.skin.button.normal.background = GUIHelper.MakeTex(2, 2, Color.black);
Expand Down Expand Up @@ -334,6 +344,22 @@ public void OnGUI()
Render.Render.DrawNameESP(corpse.transform.position, "Corpse", new Color(1.0f, 0.0f, 0.0f, 1.0f));
}
}

foreach (Il2Cpp.CrowBehaviour crow in Helpers.Entities.Crows)
{
if (crow != null)
{
Render.Render.DrawNameESP(crow.transform.position, "Crow", new Color(1.0f, 0.0f, 0.0f, 1.0f));
}
}

foreach (Il2Cpp.ManorLumpController lump in Helpers.Entities.Lumps)
{
if (lump != null)
{
Render.Render.DrawNameESP(lump.transform.position, "Lump", new Color(1.0f, 0.0f, 0.0f, 1.0f));
}
}
}

if (azazel_esp || azazel_snapline || azazel_skel_esp)
Expand Down Expand Up @@ -517,6 +543,11 @@ private static void EntitiesTab()
BoltNetwork.Instantiate(BoltPrefabs.AzazelNathan, Player.GetPlayer().transform.position, Quaternion.identity);
}

if (GUI.Button(new Rect(Settings.Settings.x + 360, Settings.Settings.y + 180, 60, 25), "April") && Player.IsInGameOrLobby() && BoltNetwork.IsServer)
{
BoltNetwork.Instantiate(BoltPrefabs.AzazelApril, Player.GetPlayer().transform.position, Quaternion.identity);
}

// demon

if (GUI.Button(new Rect(Settings.Settings.x + 10, Settings.Settings.y + 220, 60, 25), "Ghost") && Player.IsInGameOrLobby() && BoltNetwork.IsServer)
Expand Down Expand Up @@ -544,6 +575,16 @@ private static void EntitiesTab()
BoltNetwork.Instantiate(BoltPrefabs.Corpse, Player.GetPlayer().transform.position, Quaternion.identity);
}

if (GUI.Button(new Rect(Settings.Settings.x + 360, Settings.Settings.y + 220, 60, 25), "Crow") && BoltNetwork.IsServer && Player.IsInGameOrLobby())
{
BoltNetwork.Instantiate(BoltPrefabs.Crow, Player.GetPlayer().transform.position, Quaternion.identity);
}

if (GUI.Button(new Rect(Settings.Settings.x + 430, Settings.Settings.y + 220, 60, 25), "Lump") && BoltNetwork.IsServer && Player.IsInGameOrLobby())
{
BoltNetwork.Instantiate(BoltPrefabs.ManorLump, Player.GetPlayer().transform.position, Quaternion.identity);
}

// Animal

if (GUI.Button(new Rect(Settings.Settings.x + 10, Settings.Settings.y + 260, 60, 25), "Rat"))
Expand Down Expand Up @@ -588,7 +629,7 @@ private static void EntitiesTab()
{
Hacks.Misc.CarryObject("SurvivalPig");
}
}
}
}

private static void MapSpecificTab()
Expand Down Expand Up @@ -731,6 +772,94 @@ private static void MapSpecificTab()
Hacks.Misc.DespawnCorpses();
}
break;

case "Manor":
if (GUI.Button(new Rect(Settings.Settings.x + 190, Settings.Settings.y + 70, 150, 30), "TP to Azazel"))
{
try
{
Il2Cpp.NolanBehaviour nb = Player.GetPlayer();

nb.TeleportTo(Helpers.Map.GetAzazel().transform.position, Quaternion.identity);
}
catch
{
MelonLogger.Msg("Azazel not found !");
}
}

if (GUI.Button(new Rect(Settings.Settings.x + 190, Settings.Settings.y + 110, 150, 30), "Despawn Crows"))
{
Hacks.Misc.DespawnCrows();
}

if (GUI.Button(new Rect(Settings.Settings.x + 190, Settings.Settings.y + 150, 150, 30), "Despawn Lumps"))
{
Hacks.Misc.DespawnLumps();
}

if (GUI.Button(new Rect(Settings.Settings.x + 370, Settings.Settings.y + 70, 150, 30), "Switch realm"))
{
Il2Cpp.NolanBehaviour nb = Player.GetPlayer();
Vector3 pos = nb.transform.position;

ManorDeadRealmTrigger realm = Il2Cpp.ManorDeadRealmTrigger.FindObjectOfType<Il2Cpp.ManorDeadRealmTrigger>();
if (realm == null)
{
MelonLogger.Warning("realm was null.");
return;
}

if (realm.IsInDeadRealm)
{
// normal dimension
pos.x += 150f;// -10.216758f;
//pos.y = 0.009999979f;
//pos.z = -7.632657f;

}
else
{
// other dimension
pos.x -= 150f;//-160.03688f;
//pos.y = 0.010014875f;
//pos.z = -7.5686994f;
}

nb.locomotion.SetPosition(pos, false);
}

if (GUI.Button(new Rect(Settings.Settings.x + 370, Settings.Settings.y + 110, 150, 30), "Switch realm (house)"))
{
Il2Cpp.NolanBehaviour nb = Player.GetPlayer();
Vector3 pos = nb.transform.position;

ManorDeadRealmTrigger realm = Il2Cpp.ManorDeadRealmTrigger.FindObjectOfType<Il2Cpp.ManorDeadRealmTrigger>();
if (realm == null)
{
MelonLogger.Warning("realm was null.");
return;
}

if (realm.IsInDeadRealm)
{
// normal dimension
pos.x = -10.216758f;
pos.y = 0.009999979f;
pos.z = -7.632657f;

}
else
{
// other dimension
pos.x = -160.03688f;
pos.y = 0.010014875f;
pos.z = -7.5686994f;
}

nb.locomotion.SetPosition(pos, false);
}
break;
}

// load map
Expand Down Expand Up @@ -760,6 +889,12 @@ private static void MapSpecificTab()
{
Helpers.Map.LoadMap("Slaughterhouse");
}

if (GUI.Button(new Rect(Settings.Settings.x + 560, Settings.Settings.y + 240, 100, 30), "Manor") && BoltNetwork.IsServer)
{
Helpers.Map.LoadMap("Manor");
}

}

private static void EspTab()
Expand Down Expand Up @@ -916,13 +1051,36 @@ private static void ItemsTab()
}
}

if (GUILayout.Button("Shovel"))
{
if (BoltNetwork.IsServer && !Player.IsInGame())
{
BoltNetwork.Instantiate(BoltPrefabs.SurvivalSpade, Player.GetPlayer().transform.position, Quaternion.identity);
}
else
{
Hacks.Misc.CarryObject("SurvivalSpade");
}
}

if (GUILayout.Button("Cake"))
{
if (BoltNetwork.IsServer && !Player.IsInGame())
{
BoltNetwork.Instantiate(BoltPrefabs.SurvivalCake, Player.GetPlayer().transform.position, Quaternion.identity);
}
else
{
Hacks.Misc.CarryObject("SurvivalCake");
}
}

GUILayout.EndScrollView();
GUILayout.EndVertical();

GUILayout.BeginVertical();

GUILayout.Label("Rituel Objects");
GUILayout.Label("Ritual Objects");

Settings.Settings.rituelObjectsScrollPosition = GUILayout.BeginScrollView(Settings.Settings.rituelObjectsScrollPosition, GUILayout.Width(220), GUILayout.Height(190));

Expand Down Expand Up @@ -987,6 +1145,30 @@ private static void ItemsTab()
Hacks.Misc.CarryObject("RitualBook-Active-1");
}
}

if (GUILayout.Button("Dirty head"))
{
if (BoltNetwork.IsServer && !Player.IsInGame())
{
BoltNetwork.Instantiate(BoltPrefabs.SurvivalHead, Player.GetPlayer().transform.position, Quaternion.identity);
}
else
{
Hacks.Misc.CarryObject("SurvivalHead");
}
}

if (GUILayout.Button("Clean head"))
{
if (BoltNetwork.IsServer && !Player.IsInGame())
{
BoltNetwork.Instantiate(BoltPrefabs.SurvivalCleanHead, Player.GetPlayer().transform.position, Quaternion.identity);
}
else
{
Hacks.Misc.CarryObject("SurvivalCleanHead");
}
}

GUILayout.EndScrollView();
GUILayout.EndVertical();
Expand Down Expand Up @@ -1183,6 +1365,22 @@ private static void ItemsTab()
}
}

if (GUILayout.Button("SurvivalApril"))
{
if (BoltNetwork.IsServer)
{
BoltNetwork.Instantiate(BoltPrefabs.SurvivalApril, Player.GetPlayer().transform.position, Quaternion.identity);
}
}

if (GUILayout.Button("SurvivalFrank"))
{
if (BoltNetwork.IsServer)
{
BoltNetwork.Instantiate(BoltPrefabs.SurvivalFrank, Player.GetPlayer().transform.position, Quaternion.identity);
}
}

if (GUILayout.Button("SurvivalRose"))
{
if (BoltNetwork.IsServer)
Expand Down Expand Up @@ -1247,6 +1445,14 @@ private static void ItemsTab()
}
}

if (GUILayout.Button("Miror"))
{
if (BoltNetwork.IsServer)
{
BoltNetwork.Instantiate(BoltPrefabs.ManorMirror, Player.GetPlayer().transform.position, Quaternion.identity);
}
}

GUILayout.EndScrollView();
GUILayout.EndVertical();
GUILayout.EndHorizontal();
Expand Down
46 changes: 44 additions & 2 deletions DevourClient/Hacks/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,24 @@ public static void BurnRitualObj(string map, bool burnAll)
}
break;

default:
case "Manor":
Il2Cpp.MapController mapc = UnityEngine.Object.FindObjectOfType<Il2Cpp.MapController>();
if (!mapc)
{
return;
}

if (burnAll)
{
mapc.SetProgressTo(10);
}
else
{
mapc.SetProgressTo(mapc.GetMapProgress() + 1);
}
break;

default:
Il2Cpp.SurvivalObjectBurnController _altar = UnityEngine.Object.FindObjectOfType<Il2Cpp.SurvivalObjectBurnController>();
if (!_altar) {
return;
Expand Down Expand Up @@ -432,11 +449,36 @@ public static void DespawnCorpses()
}
}

public static void ShowMessageBox(string message)
public static void DespawnCrows()
{
foreach (Il2Cpp.CrowBehaviour crow in Helpers.Entities.Crows)
{
if (crow != null)
{
crow.Despawn();
}
}
}

public static void DespawnLumps()
{
foreach (Il2Cpp.ManorLumpController lump in Helpers.Entities.Lumps)
{
if (lump != null)
{
lump.Dissolve();
}
}
}

public static int ShowMessageBox(string message)
{
//not used, might be useful, some day
Il2CppHorror.Menu menu = UnityEngine.Object.FindObjectOfType<Il2CppHorror.Menu>();
if (menu == null)
return 1;
menu.ShowMessageModal(message);
return 0;
}

public static void PlaySound()
Expand Down
Loading

0 comments on commit 283eee1

Please sign in to comment.