Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POI Display Improvements #82

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 44 additions & 10 deletions src/feats/display_poi.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "display_poi.hpp"
#include "../globals.hpp"
#include "../sig.hpp"
#include "hotkey.hpp"

namespace Feats {
namespace DisplayPoi {
uint8_t scanStatus = 0;
enum ScanStatus { NOT_SCANNED = 0, SCANNING = 1, FINISHED = 2, FAILED = 3 };

void init() {}
void tick() {}
uint8_t scanStatus = NOT_SCANNED;

uintptr_t scanEx(const char *pattern) {
MEMORY_BASIC_INFORMATION mbi;
Expand Down Expand Up @@ -75,33 +75,67 @@ namespace Feats {
SDK::UDataTableFunctionLibrary::GetDataTableRowNames(poiData, &poiNames);
const auto totalRows = poiNames.Num();

SDK::FName iconClassName;
iconClassName.Number = 0;

for (size_t i = 0; i < totalRows; i++) {
const auto poi = *(SDK::FMiniMapPOIData **)(firstIndex + i * 0x18);
poi->VisibleZoomRange.LowerBound.Value = 0.0f;
poi->VisibleZoomRange.UpperBound.Value = 1.0f;
poi->ValidBigMapDistance = 0.0f;
poi->ValidMinimapDistance = 0.0f;
poi->bIsCanTransfer = true;
poi->bIsCanShowTips = false;
poi->bIsCanInteract = true;

if (iconClassName.Number == 0 &&
poi->MapIconInfoClassName.ToString() == "SkillTransferMapIconInfo") {
iconClassName = poi->MapIconInfoClassName;
}
}

for (size_t i = 0; i < totalRows; i++) {
const auto poi = *(SDK::FMiniMapPOIData **)(firstIndex + i * 0x18);
poi->MapIconInfoClassName = iconClassName;
}

scanStatus = FINISHED;
} else {
scanStatus = FAILED;
}
} else {
scanStatus = FAILED;
}
}

void startScan() {
if (scanStatus == NOT_SCANNED) {
std::thread(scan).detach();
scanStatus = SCANNING;
}
}

scanStatus++;
void init() {}

void tick() {
if (Feats::Hotkey::hotkeyPressed(confActivate)) {
startScan();
}
}

void menu() {
if (ImGui::Button("Display all detectable POI in map (slow)")) {
if (scanStatus == 0) {
std::thread(scan).detach();
scanStatus++;
}
startScan();
}

ImGui::SameLine();

if (scanStatus == 1) {
if (scanStatus == SCANNING) {
ImGui::Text("Scanning...");
} else if (scanStatus == 2) {
} else if (scanStatus == FINISHED) {
ImGui::Text("Finished");
} else if (scanStatus == FAILED) {
ImGui::Text("Failed to scan for pattern");
}
}
} // namespace DisplayPoi
Expand Down
3 changes: 3 additions & 0 deletions src/feats/display_poi.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Feats {
namespace DisplayPoi {
const std::string confPrefix = "/feats/displayPoi";
const std::string confActivate = confPrefix + "/activate";

void init();
void tick();
void menu();
Expand Down
2 changes: 2 additions & 0 deletions src/feats/hotkey.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "hotkey.hpp"
#include "../logger/logger.hpp"
#include "../main.hpp"
#include "display_poi.hpp"
#include "esp.hpp"
#include "inf_dodge.hpp"
#include "jump_height.hpp"
Expand Down Expand Up @@ -48,6 +49,7 @@ namespace Feats {
ASSIGN_BINDINGS_EMPTY_DEFAULT("Rapid attack", Feats::RapidAttack::confToggleEnabled);
ASSIGN_BINDINGS_EMPTY_DEFAULT("Infinite dodge", Feats::InfDodge::confToggleEnabled);
ASSIGN_BINDINGS_EMPTY_DEFAULT("No transparency", Feats::NoTransparency::confToggleEnabled);
ASSIGN_BINDINGS_EMPTY_DEFAULT("Display all POIs", Feats::DisplayPoi::confActivate);
ASSIGN_BINDINGS("Toggle menu", confToggle, {defaultToggleKey});
}

Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "feats/ability_failure.hpp"
#include "feats/anti_anti_cheat.hpp"
#include "feats/chain_logging.hpp"
#include "feats/display_poi.hpp"
#include "feats/esp.hpp"
#include "feats/fov.hpp"
#include "feats/hotkey.hpp"
Expand Down Expand Up @@ -63,6 +64,7 @@ int MainThread(HINSTANCE hInstDLL) {
REGISTER_FEATURE(Feats::Hotkey);
REGISTER_FEATURE(Feats::TeleportBox);
REGISTER_FEATURE(Feats::JumpHeight);
REGISTER_FEATURE(Feats::DisplayPoi);
REGISTER_FEATURE(Feats::Esp);
REGISTER_FEATURE(Feats::RapidAttack);
REGISTER_FEATURE(Feats::NoTransparency);
Expand Down