add: player name, id and object when getting the players

This commit is contained in:
2023-01-08 20:44:19 +01:00
parent 8a1cf5e96b
commit d633f4e2fb
3 changed files with 83 additions and 7 deletions

View File

@@ -12,4 +12,54 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<WarningLevel>0</WarningLevel> <WarningLevel>0</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\net6\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Il2CppBehaviorDesigner.Runtime">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2CppBehaviorDesigner.Runtime.dll</HintPath>
</Reference>
<Reference Include="Il2Cppbolt">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppbolt.dll</HintPath>
</Reference>
<Reference Include="Il2Cppbolt.user">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppbolt.user.dll</HintPath>
</Reference>
<Reference Include="Il2CppInterop.Runtime">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\net6\Il2CppInterop.Runtime.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="Il2CppOpsive.UltimateCharacterController">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\Il2CppOpsive.UltimateCharacterController.dll</HintPath>
</Reference>
<Reference Include="MelonLoader">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\net6\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.HotReloadModule">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.HotReloadModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputModule">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.InputModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>D:\Jeux\steamapps\common\Devour\MelonLoader\Il2CppAssemblies\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>
</Project> </Project>

View File

@@ -2,6 +2,7 @@
using Il2CppOpsive.UltimateCharacterController.Character; using Il2CppOpsive.UltimateCharacterController.Character;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections; using System.Collections;
using MelonLoader;
namespace DevourClient.Helpers namespace DevourClient.Helpers
{ {
@@ -27,7 +28,7 @@ namespace DevourClient.Helpers
return Entities.LocalPlayer_.GetComponent<Il2Cpp.NolanBehaviour>(); return Entities.LocalPlayer_.GetComponent<Il2Cpp.NolanBehaviour>();
} }
public static bool IsPlayerCrawling() public static bool IsPlayerCrawling()
{ {
Il2Cpp.NolanBehaviour nb = Player.GetPlayer(); Il2Cpp.NolanBehaviour nb = Player.GetPlayer();
@@ -46,11 +47,17 @@ namespace DevourClient.Helpers
} }
} }
public class BasePlayer
public class Entities {
public GameObject p_GameObject = default!;
public string Name = default!;
public string Id = default!;
}
public class Entities
{ {
public static GameObject LocalPlayer_ = default!; public static GameObject LocalPlayer_ = default!;
public static GameObject[] Players = default!; public static BasePlayer[] Players = default!;
public static Il2Cpp.GoatBehaviour[] GoatsAndRats = default!; public static Il2Cpp.GoatBehaviour[] GoatsAndRats = default!;
public static Il2Cpp.SurvivalInteractable[] SurvivalInteractables = default!; public static Il2Cpp.SurvivalInteractable[] SurvivalInteractables = default!;
public static Il2Cpp.KeyBehaviour[] Keys = default!; public static Il2Cpp.KeyBehaviour[] Keys = default!;
@@ -83,13 +90,31 @@ namespace DevourClient.Helpers
{ {
for (;;) for (;;)
{ {
Players = GameObject.FindGameObjectsWithTag("Player"); int i = 0;
foreach (GameObject p in GameObject.FindGameObjectsWithTag("Player"))
{
string player_name = "";
string player_id = "-1";
Il2Cpp.DissonancePlayerTracking dpt = p.gameObject.GetComponent<Il2Cpp.DissonancePlayerTracking>();
if (dpt != null)
{
MelonLogger.Msg(dpt.state.PlayerName + " | " + dpt.state.PlayerId.ToString());
player_name = dpt.state.PlayerName;
player_id = dpt.state.PlayerId;
}
Players[i].Id = player_id;
Players[i].Name = player_name;
Players[i].p_GameObject = p;
i++;
}
// Wait 5 seconds before caching objects again. // Wait 5 seconds before caching objects again.
yield return new WaitForSeconds(5f); yield return new WaitForSeconds(5f);
} }
} }
public static IEnumerator GetGoatsAndRats() public static IEnumerator GetGoatsAndRats()
{ {
for (;;) for (;;)

View File

@@ -155,8 +155,9 @@ namespace DevourClient
{ {
if (this.player_esp || this.player_snapline) if (this.player_esp || this.player_snapline)
{ {
foreach (GameObject player in Helpers.Entities.Players) foreach (BasePlayer Bplayer in Helpers.Entities.Players)
{ {
GameObject player = Bplayer.p_GameObject;
if (player != null) if (player != null)
{ {