OpenTeamImmediately.cpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #include "OpenTeamImmediately.h"
  2. namespace cheat {
  3. static bool MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext_Hook(app::InLevelMainPageContext_DoTeamCountDown_Iterator* __this);
  4. static void MoleMole_InLevelPlayerProfilePageContext_SetupView_Hook(void* __this);
  5. static void MoleMole_InLevelPlayerProfilePageContext_ClearView_Hook(void* __this);
  6. OpenTeamImmediately::OpenTeamImmediately() {
  7. f_Enabled = config::getValue("functions:OpenTeamImmediately", "enabled", false);
  8. f_Hotkey = Hotkey("functions:OpenTeamImmediately");
  9. InLevelPlayerProfilePageContext = nullptr;
  10. HookManager::install(app::MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext, MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext_Hook);
  11. HookManager::install(app::MoleMole_InLevelPlayerProfilePageContext_ClearView, MoleMole_InLevelPlayerProfilePageContext_ClearView_Hook);
  12. HookManager::install(app::MoleMole_InLevelPlayerProfilePageContext_SetupView, MoleMole_InLevelPlayerProfilePageContext_SetupView_Hook);
  13. }
  14. OpenTeamImmediately& OpenTeamImmediately::getInstance() {
  15. static OpenTeamImmediately instance;
  16. return instance;
  17. }
  18. void OpenTeamImmediately::GUI() {
  19. ConfigCheckbox(_("Open Team Immediately"), f_Enabled, _("Open team immediately without waiting for count down."));
  20. if (f_Enabled.getValue()) {
  21. ImGui::Indent();
  22. f_Hotkey.Draw();
  23. ImGui::Unindent();
  24. }
  25. }
  26. void OpenTeamImmediately::Outer() {
  27. if (f_Hotkey.IsPressed())
  28. f_Enabled.setValue(!f_Enabled.getValue());
  29. }
  30. void OpenTeamImmediately::Status() {
  31. if (f_Enabled.getValue())
  32. ImGui::Text("OTI");
  33. }
  34. std::string OpenTeamImmediately::getModule() {
  35. return _("World");
  36. }
  37. static bool MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext_Hook(app::InLevelMainPageContext_DoTeamCountDown_Iterator* __this) {
  38. auto& openTeamImmediately = OpenTeamImmediately::getInstance();
  39. if (openTeamImmediately.f_Enabled.getValue() && !openTeamImmediately.InLevelPlayerProfilePageContext)
  40. app::MoleMole_InLevelMainPageContext_EndCountDown(__this->fields.__this);
  41. return CALL_ORIGIN(MoleMole_InLevelMainPageContext_DoTeamCountDown_c_Iterator0__MoveNext_Hook, __this);
  42. }
  43. static void MoleMole_InLevelPlayerProfilePageContext_SetupView_Hook(void* __this) {
  44. auto& openTeamImmediately = OpenTeamImmediately::getInstance();
  45. openTeamImmediately.InLevelPlayerProfilePageContext = __this;
  46. CALL_ORIGIN(MoleMole_InLevelPlayerProfilePageContext_SetupView_Hook, __this);
  47. }
  48. static void MoleMole_InLevelPlayerProfilePageContext_ClearView_Hook(void* __this) {
  49. auto& openTeamImmediately = OpenTeamImmediately::getInstance();
  50. CALL_ORIGIN(MoleMole_InLevelPlayerProfilePageContext_ClearView_Hook, __this);
  51. openTeamImmediately.InLevelPlayerProfilePageContext = nullptr;
  52. }
  53. }