- Added "Teleport to Waypoint" (Teleport)

- WARNING: 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
  - WARNING: your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation
This commit is contained in:
EricPlayZ
2024-05-11 18:54:48 +03:00
parent ce56c7e71e
commit 61922760a3
5 changed files with 52 additions and 3 deletions

View File

@ -57,7 +57,8 @@ Thank you everyone for the support <3)" },
- Added "Old World Money" slider (Player)
- Added "Unlimited Immunity" (Player)
- Added "Unlimited Stamina" (Player)
- Added "Unlimited Items" (Player) - Stops the game from lowering the amount of items such as consumables / throwables when using them, alongside other inventory items such as ammo, lockpicks and other items; WARNING: This will not stop the item from getting removed from your inventory if you drop the entire amount; currently, if the amount of item is 1, it will still drop from your inventory unfortunately
- Added "Unlimited Items" (Player) - stops the game from lowering the amount of items such as consumables / throwables when using them, alongside other inventory items such as ammo, lockpicks and other items
- WARNING: this will not stop the item from getting removed from your inventory if you drop the entire amount; currently, if the amount of item is 1, it will still drop from your inventory unfortunately
- Added "One-Hit Kill" (Player)
- Added "Invisible to Enemies" (Player)
- Added "Allow Grapple Hook in Safezone" (Player)
@ -70,8 +71,11 @@ Thank you everyone for the support <3)" },
- Added "Instant Reload" (Weapon)
- Added "Lens Distortion" slider (Camera)
- Added "Disable Head Correction" (Camera) - disables centering of the player's hands to the center of the camera
- Added "Teleport to Coords" with X, Y, Z inputs (Teleport)
- Added "Saved Locations" section in Teleport menu, with the ability of saving, deleting and teleporting to said locations; these locations are saved in the config file and will contain a name and a set of coordinates for each location
- Added "Teleport to Coords" with X, Y, Z inputs (Teleport), with a "Get Player Coords" button which will automatically fill the X, Y and Z inputs
- Added "Teleport to Waypoint" (Teleport)
- WARNING: 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
- WARNING: your player height won't change when teleporting, so make sure you catch yourself if you fall under the map because of the teleportation
- Added "Saved Locations" in Teleport menu, with the ability of saving, deleting and teleporting to said locations; these locations are saved in the config file and will contain a name and a set of coordinates for each location
- Added "Increase Data PAKs Limit" (Misc; requires game restart to apply) - you can now add more than 8 data PAKs, e.g. data8.pak, data9.pak, data10.pak, etc, up to 200 PAKs in total
- Added "Disable Data PAKs CRC Check" (Misc; requires game restart to apply) - stops the game from scanning data PAKs, which allows you to use data PAK mods in multiplayer as well
- Added "Disable Savegame CRC Check" (Misc; requires game restart to apply) - stops the game from falsely saying your savegame is corrupt whenever you modify it

View File

@ -2,6 +2,7 @@
#include "..\menu\camera.h"
#include "..\menu\misc.h"
#include "..\menu\player.h"
#include "..\menu\teleport.h"
#include "..\menu\world.h"
#include "..\offsets.h"
#include "FreeCamera.h"
@ -269,6 +270,21 @@ namespace GamePH {
}
#pragma endregion
#pragma region SetNewWaypointLocation
static DWORD64 detourSetNewWaypointLocation(DWORD64 pLogicalPlayer, int a2, Vector3* newWaypointLoc);
static Utils::Hook::MHook<LPVOID, DWORD64(*)(DWORD64, int, Vector3*)> SetNewWaypointLocationHook{ "SetNewWaypointLocation", &Offsets::Get_SetNewWaypointLocation, &detourSetNewWaypointLocation };
static DWORD64 detourSetNewWaypointLocation(DWORD64 pLogicalPlayer, int a2, Vector3* newWaypointLoc) {
DWORD64 result = SetNewWaypointLocationHook.pOriginal(pLogicalPlayer, a2, newWaypointLoc);
Menu::Teleport::waypointCoords = *newWaypointLoc;
if (Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr()) {
const UINT offset = *Offsets::Get_SetNewWaypointLocationWaypointIsSetBoolInstr();
Menu::Teleport::waypointIsSet = reinterpret_cast<bool*>(pLogicalPlayer + offset);
}
return result;
}
#pragma endregion
#pragma region ByteHooks
static unsigned char SaveGameCRCBoolCheckBytes[3] = { 0xB3, 0x01, 0x90 }; // mov bl, 01
Utils::Hook::ByteHook<LPVOID> SaveGameCRCBoolCheckHook{ "SaveGameCRCBoolCheck", &Offsets::Get_SaveGameCRCBoolCheck, SaveGameCRCBoolCheckBytes, sizeof(SaveGameCRCBoolCheckBytes), &Menu::Misc::disableSavegameCRCCheck }; // and bl, dil

View File

@ -14,10 +14,13 @@ namespace Menu {
static int selectedTPLocation = -1;
static char newLocationName[25]{};
Vector3 waypointCoords{};
bool* waypointIsSet = nullptr;
static Vector3 teleportCoords{};
KeyBindOption teleportToSelectedLocation{ VK_F9 };
KeyBindOption teleportToCoords{ VK_NONE };
KeyBindOption teleportToWaypoint{ VK_F10 };
void UpdateTeleportLocationVisualNames() {
savedTeleportLocationNames.clear();
@ -131,6 +134,9 @@ namespace Menu {
if (isTeleportationDisabled())
return;
if (pos.isDefault())
return;
Engine::CBulletPhysicsCharacter* playerCharacter = Engine::CBulletPhysicsCharacter::Get();
if (Player::freezePlayer.GetValue()) {
@ -157,6 +163,7 @@ namespace Menu {
playerCharacter->MoveCharacter(pos);
}
}
static void UpdateTeleportPos() {
if (isTeleportationDisabled()) {
if (!teleportCoords.isDefault())
@ -187,12 +194,17 @@ namespace Menu {
}
static void HotkeysUpdate() {
teleportToSelectedLocation.SetChangesAreDisabled(selectedTPLocation < 0 || selectedTPLocation >= savedTeleportLocations.size());
teleportToWaypoint.SetChangesAreDisabled(isTeleportationDisabled() || !waypointIsSet || !*waypointIsSet);
teleportToCoords.SetChangesAreDisabled(isTeleportationDisabled());
if (teleportToSelectedLocation.HasChanged()) {
TeleportPlayerTo(savedTeleportLocations[selectedTPLocation].pos);
teleportToSelectedLocation.SetPrevValue(teleportToSelectedLocation.GetValue());
}
if (teleportToWaypoint.HasChanged()) {
TeleportPlayerTo(waypointCoords);
teleportToWaypoint.SetPrevValue(teleportToWaypoint.GetValue());
}
if (teleportToCoords.HasChanged()) {
TeleportPlayerTo(teleportCoords);
teleportToCoords.SetPrevValue(teleportToCoords.GetValue());
@ -359,8 +371,16 @@ namespace Menu {
cameraPos = "Free Camera Position -- X: " + std::format("{:.2f}", camPos.X) + ", Y: " + std::format("{:.2f}", camPos.Y) + ", Z: " + std::format("{:.2f}", camPos.Z);
}
static std::string waypointPos = "Waypoint Position = X: 0.00, Y: 0.00, Z: 0.00";
if (!waypointIsSet || !*waypointIsSet || waypointCoords.isDefault())
waypointPos = "Waypoint Position -- X: 0.00, Y: 0.00, Z: 0.00";
else {
waypointPos = "Waypoint Position -- X: " + std::format("{:.2f}", waypointCoords.X) + ", Y: " + std::format("{:.2f}", waypointCoords.Y) + ", Z: " + std::format("{:.2f}", waypointCoords.Z);
}
ImGui::Text(playerPos.data());
ImGui::Text(cameraPos.data());
ImGui::Text(waypointPos.data());
ImGui::PushItemWidth(200.0f * Menu::scale);
ImGui::InputFloat("X", &teleportCoords.X, 1.0f, 10.0f, "%.2f");
@ -370,6 +390,9 @@ namespace Menu {
ImGui::InputFloat("Z", &teleportCoords.Z, 1.0f, 10.0f, "%.2f");
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)
TeleportPlayerTo(waypointCoords);
ImGui::SameLine();
if (ImGui::ButtonHotkey("Teleport to Coords", &teleportToCoords, "Teleports player to the coords specified in the input boxes above"))
TeleportPlayerTo(teleportCoords);
ImGui::SameLine();

View File

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

View File

@ -100,6 +100,8 @@ struct Offsets {
AddOffset(PlayerGetCurrentWeapon, "gamedll_ph_x64_rwdi.dll", "8B C2 48 8D 14 80 48 83 BC D1 ?? ?? ?? ?? ?? 74 ?? 48 8B 84 D1 ?? ?? ?? ?? C3 33 C0 C3 CC CC CC 8B C2", 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(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(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(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)