ElementalSight.cpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "ElementalSight.h"
  2. namespace cheat {
  3. static void LevelSceneElementViewPlugin_Tick_Hook(app::LevelSceneElementViewPlugin* __this, float inDeltaTime);
  4. ElementalSight::ElementalSight() : Function() {
  5. f_Enabled = config::getValue("functions:ElementalSight", "enabled", false);
  6. f_Hotkey = Hotkey("functions:ElementalSight");
  7. HookManager::install(app::MoleMole_LevelSceneElementViewPlugin_Tick, LevelSceneElementViewPlugin_Tick_Hook);
  8. }
  9. ElementalSight& ElementalSight::getInstance() {
  10. static ElementalSight instance;
  11. return instance;
  12. }
  13. void ElementalSight::GUI() {
  14. ConfigCheckbox(_("ELEMENTAL_SIGHT_TITLE"), f_Enabled, _("ELEMENTAL_SIGHT_DESCRIPTION"));
  15. if (f_Enabled.getValue()) {
  16. ImGui::Indent();
  17. f_Hotkey.Draw();
  18. ImGui::Unindent();
  19. }
  20. }
  21. void ElementalSight::Outer() {
  22. if (f_Hotkey.IsPressed())
  23. f_Enabled.setValue(!f_Enabled.getValue());
  24. }
  25. void ElementalSight::Status() {
  26. if (f_Enabled.getValue())
  27. ImGui::Text(_("ELEMENTAL_SIGHT_TITLE"));
  28. }
  29. std::string ElementalSight::getModule() {
  30. return _("MODULE_WORLD");
  31. }
  32. void LevelSceneElementViewPlugin_Tick_Hook(app::LevelSceneElementViewPlugin* __this, float inDeltaTime) {
  33. auto& elementalSight = ElementalSight::getInstance();
  34. if (elementalSight.f_Enabled.getValue())
  35. app::MoleMole_LevelSceneElementViewPlugin_TriggerElementView(__this, true);
  36. CALL_ORIGIN(LevelSceneElementViewPlugin_Tick_Hook, __this, inDeltaTime);
  37. }
  38. }