fixed teleport to waypoint issues

This commit is contained in:
EricPlayZ
2024-05-11 19:31:55 +03:00
parent 61922760a3
commit dae6072423
4 changed files with 20 additions and 12 deletions

View File

@ -219,6 +219,10 @@ namespace GamePH {
prevFreeCam = false; prevFreeCam = false;
return 0; return 0;
} }
if (Menu::Teleport::waypointIsSet && !*Menu::Teleport::waypointIsSet && Menu::Teleport::justTeleportedToWaypoint) {
Menu::Teleport::justTeleportedToWaypoint = false;
return 0;
}
if (Menu::Player::godMode.GetValue()) if (Menu::Player::godMode.GetValue())
return 0; return 0;
@ -278,7 +282,7 @@ namespace GamePH {
DWORD64 result = SetNewWaypointLocationHook.pOriginal(pLogicalPlayer, a2, newWaypointLoc); DWORD64 result = SetNewWaypointLocationHook.pOriginal(pLogicalPlayer, a2, newWaypointLoc);
Menu::Teleport::waypointCoords = *newWaypointLoc; Menu::Teleport::waypointCoords = *newWaypointLoc;
if (Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr()) { if (Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr()) {
const UINT offset = *Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr(); const DWORD offset = *Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr();
Menu::Teleport::waypointIsSet = reinterpret_cast<bool*>(pLogicalPlayer + offset); Menu::Teleport::waypointIsSet = reinterpret_cast<bool*>(pLogicalPlayer + offset);
} }
return result; return result;

View File

@ -16,6 +16,7 @@ namespace Menu {
Vector3 waypointCoords{}; Vector3 waypointCoords{};
bool* waypointIsSet = nullptr; bool* waypointIsSet = nullptr;
bool justTeleportedToWaypoint = false;
static Vector3 teleportCoords{}; static Vector3 teleportCoords{};
KeyBindOption teleportToSelectedLocation{ VK_F9 }; KeyBindOption teleportToSelectedLocation{ VK_F9 };
@ -130,38 +131,40 @@ namespace Menu {
teleportCoords = playerCharacter->playerPos; teleportCoords = playerCharacter->playerPos;
} }
} }
static void TeleportPlayerTo(const Vector3& pos) { static bool TeleportPlayerTo(const Vector3& pos) {
if (isTeleportationDisabled()) if (isTeleportationDisabled())
return; return false;
if (pos.isDefault()) if (pos.isDefault())
return; return false;
Engine::CBulletPhysicsCharacter* playerCharacter = Engine::CBulletPhysicsCharacter::Get(); Engine::CBulletPhysicsCharacter* playerCharacter = Engine::CBulletPhysicsCharacter::Get();
if (Player::freezePlayer.GetValue()) { if (Player::freezePlayer.GetValue()) {
if (!playerCharacter) if (!playerCharacter)
return; return false;
playerCharacter->posBeforeFreeze = pos; playerCharacter->posBeforeFreeze = pos;
playerCharacter->MoveCharacter(pos); playerCharacter->MoveCharacter(pos);
} else if (Camera::freeCam.GetValue()) { } else if (Camera::freeCam.GetValue()) {
GamePH::FreeCamera* freeCam = GamePH::FreeCamera::Get(); GamePH::FreeCamera* freeCam = GamePH::FreeCamera::Get();
if (!freeCam) if (!freeCam)
return; return false;
Vector3 camPos{}; Vector3 camPos{};
freeCam->GetPosition(&camPos); freeCam->GetPosition(&camPos);
if (camPos.isDefault()) if (camPos.isDefault())
return; return false;
// need to implement camera teleportation here :( // need to implement camera teleportation here :(
} else { } else {
if (!playerCharacter) if (!playerCharacter)
return; return false;
playerCharacter->MoveCharacter(pos); playerCharacter->MoveCharacter(pos);
} }
return true;
} }
static void UpdateTeleportPos() { static void UpdateTeleportPos() {
@ -202,7 +205,7 @@ namespace Menu {
teleportToSelectedLocation.SetPrevValue(teleportToSelectedLocation.GetValue()); teleportToSelectedLocation.SetPrevValue(teleportToSelectedLocation.GetValue());
} }
if (teleportToWaypoint.HasChanged()) { if (teleportToWaypoint.HasChanged()) {
TeleportPlayerTo(waypointCoords); justTeleportedToWaypoint = TeleportPlayerTo(waypointCoords);
teleportToWaypoint.SetPrevValue(teleportToWaypoint.GetValue()); teleportToWaypoint.SetPrevValue(teleportToWaypoint.GetValue());
} }
if (teleportToCoords.HasChanged()) { if (teleportToCoords.HasChanged()) {
@ -391,7 +394,7 @@ namespace Menu {
ImGui::PopItemWidth(); ImGui::PopItemWidth();
if (ImGui::ButtonHotkey("Teleport to Waypoint", &teleportToWaypoint, "Teleports player to waypoint.\nWARNING: If the waypoint is selected to track an object/item on the map, Teleport to Waypoint will not work, if so just set the waypoint nearby instead.\nWARNING: Your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation") && waypointIsSet && *waypointIsSet) if (ImGui::ButtonHotkey("Teleport to Waypoint", &teleportToWaypoint, "Teleports player to waypoint.\nWARNING: If the waypoint is selected to track an object/item on the map, Teleport to Waypoint will not work, if so just set the waypoint nearby instead.\nWARNING: Your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation") && waypointIsSet && *waypointIsSet)
TeleportPlayerTo(waypointCoords); justTeleportedToWaypoint = TeleportPlayerTo(waypointCoords);
ImGui::SameLine(); ImGui::SameLine();
if (ImGui::ButtonHotkey("Teleport to Coords", &teleportToCoords, "Teleports player to the coords specified in the input boxes above")) if (ImGui::ButtonHotkey("Teleport to Coords", &teleportToCoords, "Teleports player to the coords specified in the input boxes above"))
TeleportPlayerTo(teleportCoords); TeleportPlayerTo(teleportCoords);

View File

@ -11,11 +11,12 @@ namespace Menu {
extern std::vector<TeleportLocation> savedTeleportLocations; extern std::vector<TeleportLocation> savedTeleportLocations;
extern Vector3 waypointCoords; extern Vector3 waypointCoords;
extern bool* waypointIsSet;
extern bool justTeleportedToWaypoint;
extern KeyBindOption teleportToSelectedLocation; extern KeyBindOption teleportToSelectedLocation;
extern KeyBindOption teleportToCoords; extern KeyBindOption teleportToCoords;
extern KeyBindOption teleportToWaypoint; extern KeyBindOption teleportToWaypoint;
extern bool* waypointIsSet;
extern void UpdateTeleportLocationVisualNames(); extern void UpdateTeleportLocationVisualNames();
extern std::vector<TeleportLocation> ParseTeleportLocations(const std::string& input); extern std::vector<TeleportLocation> ParseTeleportLocations(const std::string& input);

View File

@ -101,7 +101,7 @@ struct Offsets {
AddOffset(PlayerGetInventoryMoney, "gamedll_ph_x64_rwdi.dll", "8B C2 48 8B 44 C1", Utils::SigScan::PatternType::Address, LPVOID) AddOffset(PlayerGetInventoryMoney, "gamedll_ph_x64_rwdi.dll", "8B C2 48 8B 44 C1", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(HandleInventoryItemsAmount, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 8B 29", Utils::SigScan::PatternType::Address, LPVOID) AddOffset(HandleInventoryItemsAmount, "gamedll_ph_x64_rwdi.dll", "48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC ?? 8B 29", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(SetNewWaypointLocation, "gamedll_ph_x64_rwdi.dll", "85 D2 78 ?? 48 89 74 24 ?? 57 48 83 EC ?? 49 8B F8", Utils::SigScan::PatternType::Address, LPVOID) AddOffset(SetNewWaypointLocation, "gamedll_ph_x64_rwdi.dll", "85 D2 78 ?? 48 89 74 24 ?? 57 48 83 EC ?? 49 8B F8", Utils::SigScan::PatternType::Address, LPVOID)
AddOffset(SetNewWaypointLocationWaypointIsSetBoolInstr, "gamedll_ph_x64_rwdi.dll", "C6 84 33 [?? ?? ?? ?? 01 48 8B 5C 24", Utils::SigScan::PatternType::Address, DWORD64*) AddOffset(SetNewWaypointLocationWaypointIsSetBoolInstr, "gamedll_ph_x64_rwdi.dll", "C6 84 33 [?? ?? ?? ?? 01 48 8B 5C 24", Utils::SigScan::PatternType::Address, DWORD*)
//AddOffset(CompareAndUpdateFloat, "gamedll_ph_x64_rwdi.dll", "0F 2F C1 73 ?? 0F 28 C1 C3", Utils::SigScan::PatternType::Address, LPVOID) //AddOffset(CompareAndUpdateFloat, "gamedll_ph_x64_rwdi.dll", "0F 2F C1 73 ?? 0F 28 C1 C3", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(HandlePlayerImmunity, "gamedll_ph_x64_rwdi.dll", "48 8B C4 53 56 57 41 56 41 57", Utils::SigScan::PatternType::Address, LPVOID) //AddOffset(HandlePlayerImmunity, "gamedll_ph_x64_rwdi.dll", "48 8B C4 53 56 57 41 56 41 57", Utils::SigScan::PatternType::Address, LPVOID)
//AddOffset(HandlePlayerImmunity2, "gamedll_ph_x64_rwdi.dll", "40 55 56 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B F1 45 0F B6 F0", Utils::SigScan::PatternType::Address, LPVOID) //AddOffset(HandlePlayerImmunity2, "gamedll_ph_x64_rwdi.dll", "40 55 56 41 56 41 57 48 8D 6C 24 ?? 48 81 EC ?? ?? ?? ?? 48 8B F1 45 0F B6 F0", Utils::SigScan::PatternType::Address, LPVOID)