forked from itzkaydo/SoTMaulder-PalWorld
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeature.cpp
More file actions
182 lines (141 loc) · 5.35 KB
/
feature.cpp
File metadata and controls
182 lines (141 loc) · 5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#include "pch.h"
#include "feature.h"
using namespace SDK;
void ESP()
{
APalPlayerCharacter* pPalCharacter = Config.GetPalPlayerCharacter();
if (!pPalCharacter)
return;
UPalShooterComponent* pShootComponent = pPalCharacter->ShooterComponent;
if (!pShootComponent)
return;
APalWeaponBase* pWeapon = pShootComponent->HasWeapon;
if (pWeapon)
DrawUActorComponent(pWeapon->InstanceComponents, ImColor(128, 0, 0));
if (!Config.UCIM)
return;
TArray<SDK::APalCharacter*> T = {};
Config.UCIM->GetAllPalCharacter(&T);
if (!T.IsValid())
return;
for (int i = 0; i < T.Num(); i++)
ImGui::GetBackgroundDrawList()->AddText(nullptr, 16, ImVec2(10, 10 + (i * 30)), ImColor(128, 0, 0), T[i]->GetFullName().c_str());
}
void ESP_DEBUG(float mDist, ImVec4 color, UClass* mEntType)
{
APalPlayerCharacter* pLocalPlayer = Config.GetPalPlayerCharacter();
if (!pLocalPlayer)
return;
APalPlayerController* pPlayerController = static_cast<APalPlayerController*>(pLocalPlayer->Controller);
if (!pPlayerController)
return;
std::vector<AActor*> actors;
if (!config::GetAllActorsofType(mEntType, &actors, true))
return;
auto draw = ImGui::GetWindowDrawList();
__int32 actorsCount = actors.size();
for (AActor* actor : actors)
{
FVector actorLocation = actor->K2_GetActorLocation();
FVector localPlayerLocation = pLocalPlayer->K2_GetActorLocation();
float distantTo = pLocalPlayer->GetDistanceTo(actor);
if (distantTo > mDist)
continue;
FVector2D outScreen;
if (!pPlayerController->ProjectWorldLocationToScreen(actorLocation, &outScreen, true))
continue;
char data[0x256];
const char* StringData = "OBJECT: [%s]\nCLASS: [%s]\nINDEX: [%d]\nPOSITION: { %0.0f, %0.0f, %0.0f }\nDISTANCE: [%.0fm]";
if (distantTo >= 1000.f)
{
distantTo /= 1000.f;
StringData = "OBJECT: [%s]\nCLASS: [%s]\nINDEX: [%d]\nPOSITION: { %0.0f, %0.0f, %0.0f }\nDISTANCE: [%.0fkm]";
}
sprintf_s(data, StringData, actor->GetName().c_str(), actor->Class->GetFullName().c_str(), actorLocation.X, actorLocation.Y, actorLocation.Z, distantTo);
ImVec2 screen = ImVec2(static_cast<float>(outScreen.X), static_cast<float>(outScreen.Y));
draw->AddText(screen, ImColor(color), data);
}
}
void RenderWaypointsToScreen()
{
APalCharacter* pPalCharacater = Config.GetPalPlayerCharacter();
APalPlayerController* pPalController = Config.GetPalPlayerController();
if (!pPalCharacater || !pPalController)
return;
ImDrawList* draw = ImGui::GetWindowDrawList();
for (auto waypoint : Config.db_waypoints)
{
FVector2D vScreen;
if (!pPalController->ProjectWorldLocationToScreen(waypoint.waypointLocation, &vScreen, false))
continue;
auto color = ImColor(1.0f, 1.0f, 1.0f, 1.0f);
draw->AddText(ImVec2(vScreen.X, vScreen.Y), color, waypoint.waypointName.c_str());
}
}
void AddWaypointLocation(std::string wpName)
{
APalCharacter* pPalCharacater = Config.GetPalPlayerCharacter();
if (!pPalCharacater)
return;
FVector wpLocation = pPalCharacater->K2_GetActorLocation();
FRotator wpRotation = pPalCharacater->K2_GetActorRotation();
config::SWaypoint newWaypoint = config::SWaypoint(wpName, wpLocation, wpRotation);
Config.db_waypoints.push_back(newWaypoint);
}
void AddItemToInventoryByName(UPalPlayerInventoryData* data, char* itemName, int count)
{
// obtain lib instance
static UKismetStringLibrary* lib = UKismetStringLibrary::GetDefaultObj();
// Convert FNAME
wchar_t ws[255];
swprintf(ws, 255, L"%hs", itemName);
FName Name = lib->Conv_StringToName(FString(ws));
// Call
data->RequestAddItem(Name, count, true);
}
void RespawnLocalPlayer(bool bIsSafe)
{
APalPlayerController* pPalPlayerController = Config.GetPalPlayerController();
APalPlayerState* pPalPlayerState = Config.GetPalPlayerState();
if (!pPalPlayerController || !pPalPlayerState)
return;
bIsSafe ? pPalPlayerController->TeleportToSafePoint_ToServer() : pPalPlayerState->RequestRespawn();
}
void ForceJoinGuild(SDK::APalCharacter* targetPlayer)
{
if (!targetPlayer->CharacterParameterComponent->IndividualHandle)
return;
if (!Config.GetPalPlayerCharacter()->GetPalPlayerController())
return;
UPalNetworkGroupComponent* group = Config.GetPalPlayerCharacter()->GetPalPlayerController()->Transmitter->Group;
if (!group)
return;
SDK::FGuid myPlayerId = Config.GetPalPlayerController()->GetPlayerUId();
SDK::FGuid playerId = targetPlayer->CharacterParameterComponent->IndividualHandle->ID.PlayerUId;
group->RequestJoinGuildForPlayer_ToServer(myPlayerId, playerId); // One of these does the trick
group->RequestJoinGuildRequestForPlayer_ToServer(myPlayerId, playerId);
}
void GiveTechExploit(__int32 Tech)
{
SDK::APalPlayerCharacter* pPalPlayerCharacter = Config.GetPalPlayerCharacter();
if (!pPalPlayerCharacter)
return;
APalPlayerController* pPalPlayerController = pPalPlayerCharacter->GetPalPlayerController();
if (!pPalPlayerController)
return;
pPalPlayerController->Transmitter->GetPlayer()->RequestAddTechnolgyPoint_ToServer(Tech);
}
void DrawUActorComponent(SDK::TArray<SDK::UActorComponent*> Comps, ImColor color)
{
ImGui::GetBackgroundDrawList()->AddText(nullptr, 16, ImVec2(ImGui::GetIO().DisplaySize.x / 2, ImGui::GetIO().DisplaySize.y / 2), color, "Drawing...");
if (Comps.IsValid())
{
for (int i = 0; i < Comps.Num(); i++)
{
if (Comps[i] != NULL)
{
ImGui::GetBackgroundDrawList()->AddText(nullptr, 16, ImVec2(10, 10 + (i * 30)), color, Comps[i]->GetFullName().c_str());
}
}
}
}