Code cleanup and performance enhancement efforts
This commit is contained in:
1390
DevourClient/ClientMain.cs
Normal file
1390
DevourClient/ClientMain.cs
Normal file
File diff suppressed because it is too large
Load Diff
@@ -121,16 +121,37 @@ namespace DevourClient.Hacks
|
||||
{
|
||||
if (!Il2CppPhoton.Bolt.BoltNetwork.IsServer)
|
||||
{
|
||||
MelonLogger.Msg("You need to be host to spawn stuff !");
|
||||
Hacks.Misc.ShowMessageBox("You need to be host to spawn stuff !");
|
||||
return;
|
||||
}
|
||||
|
||||
GameObject _azazel;
|
||||
Vector3 pos = Player.GetPlayer().transform.position;
|
||||
GameObject _localPlayer = Helpers.Entities.LocalPlayer_.p_GameObject;
|
||||
|
||||
_azazel = BoltNetwork.Instantiate(_azazelPrefabId, new Vector3(pos.x, pos.y, pos.z + 1f), Quaternion.identity);
|
||||
if (_localPlayer != null)
|
||||
{
|
||||
Vector3 pos = _localPlayer.transform.position;
|
||||
|
||||
_azazel.gameObject.GetComponent<Il2Cpp.SurvivalAzazelBehaviour>().Spawn();
|
||||
GameObject _azazel;
|
||||
|
||||
_azazel = BoltNetwork.Instantiate(_azazelPrefabId, new Vector3(pos.x, pos.y, pos.z + 1f), Quaternion.identity);
|
||||
Il2Cpp.SurvivalAzazelBehaviour azazelBehaviour = _azazel?.GetComponent<Il2Cpp.SurvivalAzazelBehaviour>();
|
||||
|
||||
if (_azazel != null)
|
||||
{
|
||||
if (azazelBehaviour != null)
|
||||
{
|
||||
_azazel.gameObject.GetComponent<Il2Cpp.SurvivalAzazelBehaviour>().Spawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
MelonLogger.Error("azazelBehaviour is null!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MelonLogger.Error("azazel is null!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void CarryObject(string name)
|
||||
|
||||
@@ -81,7 +81,6 @@ namespace DevourClient.Helpers
|
||||
}
|
||||
|
||||
BoltNetwork.Instantiate(BoltPrefabs.Cage, p_GameObject.transform.position, Quaternion.identity);
|
||||
|
||||
}
|
||||
|
||||
public void TP()
|
||||
@@ -104,28 +103,35 @@ namespace DevourClient.Helpers
|
||||
|
||||
UltimateCharacterLocomotion ucl = Helpers.Map.GetAzazel().GetComponent<UltimateCharacterLocomotion>();
|
||||
|
||||
try
|
||||
if (ucl)
|
||||
{
|
||||
ucl.SetPosition(p_GameObject.transform.position);
|
||||
}
|
||||
catch { return; }
|
||||
else
|
||||
{
|
||||
MelonLogger.Error("Azazel not found!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShootPlayer()
|
||||
{
|
||||
if (!BoltNetwork.IsServer){
|
||||
MelonLogger.Msg("You need to be server !");
|
||||
return;
|
||||
if (!BoltNetwork.IsServer)
|
||||
{
|
||||
MelonLogger.Msg("You need to be server !");
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_GameObject == null){
|
||||
return;
|
||||
if (p_GameObject == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Il2Cpp.AzazelSamBehaviour _azazelSam = UnityEngine.Object.FindObjectOfType<Il2Cpp.AzazelSamBehaviour>();
|
||||
|
||||
if (_azazelSam){
|
||||
_azazelSam.OnShootPlayer(p_GameObject, true);
|
||||
|
||||
if (_azazelSam)
|
||||
{
|
||||
_azazelSam.OnShootPlayer(p_GameObject, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,12 +142,12 @@ namespace DevourClient.Helpers
|
||||
Il2Cpp.OptionsHelpers optionsHelpers = UnityEngine.Object.FindObjectOfType<Il2Cpp.OptionsHelpers>();
|
||||
return optionsHelpers.inGame;
|
||||
}
|
||||
|
||||
|
||||
public static bool IsInGameOrLobby()
|
||||
{
|
||||
return GetPlayer() != null;
|
||||
}
|
||||
|
||||
|
||||
public static Il2Cpp.NolanBehaviour GetPlayer()
|
||||
{
|
||||
if (Entities.LocalPlayer_.p_GameObject == null)
|
||||
@@ -163,9 +169,9 @@ namespace DevourClient.Helpers
|
||||
|
||||
return nb.IsCrawling();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Entities
|
||||
{
|
||||
public static int MAX_PLAYERS = 4; //will change by calling CreateCustomizedLobby
|
||||
@@ -184,7 +190,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetLocalPlayer()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
GameObject[] currentPlayers = GameObject.FindGameObjectsWithTag("Player");
|
||||
|
||||
@@ -201,10 +207,10 @@ namespace DevourClient.Helpers
|
||||
yield return new WaitForSeconds(5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static IEnumerator GetAllPlayers()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
GameObject[] players = GameObject.FindGameObjectsWithTag("Player");
|
||||
Players = new BasePlayer[players.Length];
|
||||
@@ -231,9 +237,9 @@ namespace DevourClient.Helpers
|
||||
Players[i].Name = player_name;
|
||||
Players[i].p_GameObject = p;
|
||||
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Wait 5 seconds before caching objects again.
|
||||
yield return new WaitForSeconds(5f);
|
||||
@@ -241,7 +247,7 @@ namespace DevourClient.Helpers
|
||||
}
|
||||
public static IEnumerator GetGoatsAndRats()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
GoatsAndRats = Il2Cpp.GoatBehaviour.FindObjectsOfType<Il2Cpp.GoatBehaviour>();
|
||||
|
||||
@@ -252,7 +258,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetSurvivalInteractables()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
SurvivalInteractables = Il2Cpp.SurvivalInteractable.FindObjectsOfType<Il2Cpp.SurvivalInteractable>();
|
||||
|
||||
@@ -263,7 +269,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetKeys()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
Keys = Il2Cpp.KeyBehaviour.FindObjectsOfType<Il2Cpp.KeyBehaviour>();
|
||||
|
||||
@@ -274,7 +280,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetDemons()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
Demons = Il2Cpp.SurvivalDemonBehaviour.FindObjectsOfType<Il2Cpp.SurvivalDemonBehaviour>();
|
||||
|
||||
@@ -285,7 +291,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetSpiders()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
Spiders = Il2Cpp.SpiderBehaviour.FindObjectsOfType<Il2Cpp.SpiderBehaviour>();
|
||||
|
||||
@@ -296,7 +302,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetGhosts()
|
||||
{
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
Ghosts = Il2Cpp.GhostBehaviour.FindObjectsOfType<Il2Cpp.GhostBehaviour>();
|
||||
|
||||
@@ -307,7 +313,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetBoars()
|
||||
{
|
||||
for (; ; )
|
||||
while (true)
|
||||
{
|
||||
Boars = Il2Cpp.BoarBehaviour.FindObjectsOfType<Il2Cpp.BoarBehaviour>();
|
||||
|
||||
@@ -318,7 +324,7 @@ namespace DevourClient.Helpers
|
||||
|
||||
public static IEnumerator GetCorpses()
|
||||
{
|
||||
for (; ; )
|
||||
while (true)
|
||||
{
|
||||
Corpses = Il2Cpp.CorpseBehaviour.FindObjectsOfType<Il2Cpp.CorpseBehaviour>();
|
||||
|
||||
@@ -332,7 +338,7 @@ namespace DevourClient.Helpers
|
||||
/*
|
||||
* ikr AzazelS, because in case we spawn multiple we want the esp to render all of them
|
||||
*/
|
||||
for (;;)
|
||||
while (true)
|
||||
{
|
||||
Azazels = Il2Cpp.SurvivalAzazelBehaviour.FindObjectsOfType<Il2Cpp.SurvivalAzazelBehaviour>();
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using HarmonyLib;
|
||||
using DevourClient;
|
||||
|
||||
namespace DevourClient.Hooks
|
||||
{
|
||||
@@ -11,7 +10,7 @@ namespace DevourClient.Hooks
|
||||
[HarmonyPrefix]
|
||||
static void Prefix(ref Il2CppOpsive.UltimateCharacterController.Traits.Attribute attribute)
|
||||
{
|
||||
if (Load.unlimitedUV && attribute.m_Name == "Battery")
|
||||
if (ClientMain.unlimitedUV && attribute.m_Name == "Battery")
|
||||
{
|
||||
attribute.m_Value = 100.0f;
|
||||
return;
|
||||
@@ -25,9 +24,9 @@ namespace DevourClient.Hooks
|
||||
{
|
||||
static void Postfix(ref Il2Cpp.RankHelpers.ExpGainInfo __result)
|
||||
{
|
||||
if (Load.exp_modifier)
|
||||
if (ClientMain.exp_modifier)
|
||||
{
|
||||
__result.totalExp = (int)Load.exp;
|
||||
__result.totalExp = (int)ClientMain.exp;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user