diff --git a/cheat-library/src/user/cheat/GenshinCM.cpp b/cheat-library/src/user/cheat/GenshinCM.cpp index eb9ef82..24e61f8 100644 --- a/cheat-library/src/user/cheat/GenshinCM.cpp +++ b/cheat-library/src/user/cheat/GenshinCM.cpp @@ -15,13 +15,13 @@ cheat::GenshinCM& cheat::GenshinCM::instance() void cheat::GenshinCM::CursorSetVisibility(bool visibility) { - app::Cursor_set_visible(nullptr, visibility, nullptr); - app::Cursor_set_lockState(nullptr, visibility ? app::CursorLockMode__Enum::None : app::CursorLockMode__Enum::Locked, nullptr); + app::Cursor_set_visible(visibility, nullptr); + app::Cursor_set_lockState(visibility ? app::CursorLockMode__Enum::None : app::CursorLockMode__Enum::Locked, nullptr); } bool cheat::GenshinCM::CursorGetVisibility() { - return app::Cursor_get_visible(nullptr, nullptr); + return app::Cursor_get_visible(nullptr); } cheat::GenshinCM::GenshinCM() : diff --git a/cheat-library/src/user/cheat/esp/ESPRender.cpp b/cheat-library/src/user/cheat/esp/ESPRender.cpp index 852a388..2fd5e41 100644 --- a/cheat-library/src/user/cheat/esp/ESPRender.cpp +++ b/cheat-library/src/user/cheat/esp/ESPRender.cpp @@ -31,7 +31,7 @@ namespace cheat::feature::esp::render return; SAFE_BEGIN(); - auto camera = app::Camera_get_main(nullptr, nullptr); + auto camera = app::Camera_get_main(nullptr); if (camera == nullptr) return; @@ -58,8 +58,8 @@ namespace cheat::feature::esp::render if (pixelWidth == 0 || pixelHeight == 0) return; - auto screenWidth = app::Screen_get_width(nullptr, nullptr); - auto screenHeight = app::Screen_get_height(nullptr, nullptr); + auto screenWidth = app::Screen_get_width(nullptr); + auto screenHeight = app::Screen_get_height(nullptr); if (screenWidth == 0 || screenHeight == 0) return; @@ -88,7 +88,7 @@ namespace cheat::feature::esp::render screenPos.y *= s_ResolutionScale.y; } - screenPos.y = app::Screen_get_height(nullptr, nullptr) - screenPos.y; + screenPos.y = app::Screen_get_height(nullptr) - screenPos.y; return screenPos; } @@ -141,7 +141,7 @@ namespace cheat::feature::esp::render // Sometimes occurs access violation in UnityPlayer.dll // Callow: Have no idea what to do with it unless just catch exception - auto bounds = app::Utils_1_GetBounds(nullptr, gameObject, nullptr); + auto bounds = app::Utils_4_GetBounds(gameObject, nullptr); if (bounds.m_Extents.x < esp.f_MinSize && bounds.m_Extents.y < esp.f_MinSize && bounds.m_Extents.z < esp.f_MinSize) @@ -216,7 +216,7 @@ namespace cheat::feature::esp::render } - auto screenHeight = app::Screen_get_height(nullptr, nullptr); + auto screenHeight = app::Screen_get_height(nullptr); #define FIX_Y(field) boxScreen.##field##.y = screenHeight - boxScreen.##field##.y @@ -263,7 +263,7 @@ namespace cheat::feature::esp::render boxRect.yMax *= s_ResolutionScale.y; } - auto screenHeight = app::Screen_get_height(nullptr, nullptr); + auto screenHeight = app::Screen_get_height(nullptr); boxRect.yMin = screenHeight - boxRect.yMin; boxRect.yMax = screenHeight - boxRect.yMax; return boxRect; diff --git a/cheat-library/src/user/cheat/game/CacheFilterExecutor.cpp b/cheat-library/src/user/cheat/game/CacheFilterExecutor.cpp index 3016da0..a491f98 100644 --- a/cheat-library/src/user/cheat/game/CacheFilterExecutor.cpp +++ b/cheat-library/src/user/cheat/game/CacheFilterExecutor.cpp @@ -24,7 +24,7 @@ namespace cheat::game entityFilters[filter] = { false, 0 }; auto& entry = entityFilters[filter]; - auto timestamp = app::GetTimestamp(nullptr, nullptr); + auto timestamp = app::TimeUtil_get_NowTimeStamp(nullptr); if (entry.second + m_LifeTime > timestamp) return entry.first; diff --git a/cheat-library/src/user/cheat/game/Entity.cpp b/cheat-library/src/user/cheat/game/Entity.cpp index 6a99a6f..f998d85 100644 --- a/cheat-library/src/user/cheat/game/Entity.cpp +++ b/cheat-library/src/user/cheat/game/Entity.cpp @@ -77,7 +77,7 @@ namespace cheat::game if (m_RawEntity == nullptr) return {}; - return app::Miscs_GenLevelPos_1(nullptr, absolutePosition(), nullptr); + return app::Miscs_GenLevelPos_1(absolutePosition(), nullptr); } float Entity::distance(Entity* entity) @@ -102,7 +102,7 @@ namespace cheat::game if (m_RawEntity == nullptr) return 10000; - auto dist = app::Vector3_Distance(nullptr, relativePosition(), point, nullptr); + auto dist = app::Vector3_Distance(relativePosition(), point, nullptr); return dist; } @@ -111,7 +111,7 @@ namespace cheat::game if (m_RawEntity == nullptr) return 10000; - return app::Vector2_Distance(nullptr, levelPosition(), levelPoint, nullptr); + return app::Vector2_Distance(levelPosition(), levelPoint, nullptr); } bool Entity::isGadget() diff --git a/cheat-library/src/user/cheat/game/util.cpp b/cheat-library/src/user/cheat/game/util.cpp index 63bfc9c..9a71338 100644 --- a/cheat-library/src/user/cheat/game/util.cpp +++ b/cheat-library/src/user/cheat/game/util.cpp @@ -29,7 +29,7 @@ namespace cheat::game continue; auto& config = waypoint.config->fields; - uint16_t areaId = app::SimpleSafeUInt16_get_Value(nullptr, config.areaIdRawNum, nullptr); + uint16_t areaId = app::SimpleSafeUInt16_get_Value(config.areaIdRawNum, nullptr); bool isAreaUnlocked = app::MapModule_IsAreaUnlock(mapModule, sceneId, areaId, nullptr); if (waypoint.isUnlocked && isAreaUnlocked && !config._unlocked && !waypoint.isGroupLimit && !waypoint.isModelHidden) @@ -45,7 +45,7 @@ namespace cheat::game float minDistance = -1; WaypointInfo result{}; for (const auto& info : GetUnlockedWaypoints(targetSceneId)) { - float distance = app::Vector3_Distance(nullptr, position, info.position, nullptr); + float distance = app::Vector3_Distance(position, info.position, nullptr); if (minDistance < 0 || distance < minDistance) { minDistance = distance; diff --git a/cheat-library/src/user/cheat/imap/InteractiveMap.cpp b/cheat-library/src/user/cheat/imap/InteractiveMap.cpp index 0a072c8..fc28ce8 100644 --- a/cheat-library/src/user/cheat/imap/InteractiveMap.cpp +++ b/cheat-library/src/user/cheat/imap/InteractiveMap.cpp @@ -483,7 +483,7 @@ namespace cheat::feature if (nearestLabelPoint == nullptr) continue; - float distance = app::Vector2_Distance(nullptr, levelPosition, nearestLabelPoint->levelPosition, nullptr); + float distance = app::Vector2_Distance(levelPosition, nearestLabelPoint->levelPosition, nullptr); if (distance < minDistance || minDistancePoint == nullptr) { minDistance = distance; @@ -506,7 +506,7 @@ namespace cheat::feature if (!completed && point.completed) continue; - float distance = app::Vector2_Distance(nullptr, levelPosition, point.levelPosition, nullptr); + float distance = app::Vector2_Distance(levelPosition, point.levelPosition, nullptr); if (distance < minDistance || minDistancePoint == nullptr) { minDistance = distance; @@ -1274,11 +1274,11 @@ namespace cheat::feature static bool IsMapActive() { - auto uimanager = GET_SINGLETON(UIManager_1); + auto uimanager = GET_SINGLETON(UIManager); if (uimanager == nullptr) return false; - return app::UIManager_1_HasEnableMapCamera(uimanager, nullptr); + return app::UIManager_HasEnableMapCamera(uimanager, nullptr); } static app::Rect s_MapViewRect = { 0, 0, 1, 1 }; @@ -1300,8 +1300,8 @@ namespace cheat::feature screenPosition.y = (levelPosition.y - s_MapViewRect.m_YMin) / s_MapViewRect.m_Height; // Scaling to screen position - screenPosition.x = screenPosition.x * app::Screen_get_width(nullptr, nullptr); - screenPosition.y = (1.0f - screenPosition.y) * app::Screen_get_height(nullptr, nullptr); + screenPosition.x = screenPosition.x * app::Screen_get_width(nullptr); + screenPosition.y = (1.0f - screenPosition.y) * app::Screen_get_height(nullptr); return screenPosition; } @@ -1491,8 +1491,8 @@ namespace cheat::feature if (m_ScenesData.count(sceneID) == 0) return; - ImVec2 screenSize = { static_cast(app::Screen_get_width(nullptr, nullptr)), - static_cast(app::Screen_get_height(nullptr, nullptr)) }; + ImVec2 screenSize = { static_cast(app::Screen_get_width(nullptr)), + static_cast(app::Screen_get_height(nullptr)) }; auto iconSize = (f_DynamicSize && s_MapViewRect.m_Width != 0.0f) ? f_IconSize * (relativeSizeX / s_MapViewRect.m_Width) : f_IconSize; @@ -1549,7 +1549,7 @@ namespace cheat::feature UPDATE_DELAY_VAR(ImCircle, _miniMapCircle, 2000); - auto uiManager = GET_SINGLETON(UIManager_1); + auto uiManager = GET_SINGLETON(UIManager); if (uiManager == nullptr || uiManager->fields._sceneCanvas == nullptr) return {}; @@ -1559,7 +1559,7 @@ namespace cheat::feature auto mapPos = app::Transform_get_position(reinterpret_cast(back), nullptr); auto center = app::Camera_WorldToScreenPoint(uiManager->fields._uiCamera, mapPos, nullptr); - center.y = app::Screen_get_height(nullptr, nullptr) - center.y; + center.y = app::Screen_get_height(nullptr) - center.y; auto mapRect = app::RectTransform_get_rect(back, nullptr); float scaleFactor = app::Canvas_get_scaleFactor(uiManager->fields._sceneCanvas, nullptr); diff --git a/cheat-library/src/user/cheat/misc/Debug.cpp b/cheat-library/src/user/cheat/misc/Debug.cpp index 9a1c3f7..35fba9d 100644 --- a/cheat-library/src/user/cheat/misc/Debug.cpp +++ b/cheat-library/src/user/cheat/misc/Debug.cpp @@ -17,7 +17,7 @@ #include // This module is for debug purpose, and... well.. it's shit coded ^) -namespace cheat::feature +namespace cheat::feature { static bool ActorAbilityPlugin_OnEvent_Hook(void* __this, app::BaseEvent* e, MethodInfo* method); @@ -25,30 +25,30 @@ namespace cheat::feature static bool csvFriendly = true; static bool includeHeaders = true; - Debug::Debug() : Feature() - { + Debug::Debug() : Feature() + { events::GameUpdateEvent += FUNCTION_HANDLER(OnGameUpdate); - HookManager::install(app::ActorAbilityPlugin_OnEvent, ActorAbilityPlugin_OnEvent_Hook); - // HookManager::install(app::LuaShellManager_ReportLuaShellResult, LuaShellManager_ReportLuaShellResult_Hook); - // HookManager::install(app::LuaShellManager_DoString, LuaShellManager_DoString_Hook); - // HookManager::install(app::LuaEnv_DoString, LuaEnv_DoString_Hook); - // HookManager::install(app::Lua_xlua_pushasciistring, Lua_xlua_pushasciistring_Hook); + HookManager::install(app::ActorAbilityPlugin_OnEvent, ActorAbilityPlugin_OnEvent_Hook); + // HookManager::install(app::LuaShellManager_ReportLuaShellResult, LuaShellManager_ReportLuaShellResult_Hook); + // HookManager::install(app::LuaShellManager_DoString, LuaShellManager_DoString_Hook); + // HookManager::install(app::LuaEnv_DoString, LuaEnv_DoString_Hook); + // HookManager::install(app::Lua_xlua_pushasciistring, Lua_xlua_pushasciistring_Hook); - // HookManager::install(app::GameLogin_SendInfo_2, SendInfo_Hook); - // LOG_DEBUG("Hooked GameLogin::SendGameInfo. Origin at 0x%p", HookManager::getOrigin(SendInfo_Hook)); - } + // HookManager::install(app::GameLogin_SendInfo_2, SendInfo_Hook); + // LOG_DEBUG("Hooked GameLogin::SendGameInfo. Origin at 0x%p", HookManager::getOrigin(SendInfo_Hook)); + } - const FeatureGUIInfo& Debug::GetGUIInfo() const - { - static const FeatureGUIInfo info{ "DebugInfo", "Debug", false }; - return info; - } + const FeatureGUIInfo& Debug::GetGUIInfo() const + { + static const FeatureGUIInfo info{ "DebugInfo", "Debug", false }; + return info; + } - Debug& Debug::GetInstance() - { - static Debug instance; - return instance; - } + Debug& Debug::GetInstance() + { + static Debug instance; + return instance; + } // Raise when player start game log in (after press a door) @@ -152,7 +152,7 @@ namespace cheat::feature ImGui::Text("Object position: %s", il2cppi_to_string(location._pos).c_str()); ImGui::Text("_unlocked: %s", location._unlocked ? "true" : "false"); ImGui::Text("_groupLimit: %s", location._groupLimit ? "true" : "false"); - uint16_t areaId = app::SimpleSafeUInt16_get_Value(nullptr, location.areaIdRawNum, nullptr); + uint16_t areaId = app::SimpleSafeUInt16_get_Value(location.areaIdRawNum, nullptr); ImGui::Text("areaId: %u", areaId); ImGui::Text("areaUnlocked: %s", app::MapModule_IsAreaUnlock(singleton, sceneId, areaId, nullptr) ? "true" : "false"); ImGui::Text("gadgetIdRawNum: %u", location.gadgetIdRawNum); @@ -236,8 +236,8 @@ namespace cheat::feature auto combat = entity->combat(); if (combat != nullptr) { auto combatProp = combat->fields._combatProperty_k__BackingField; - auto maxHP = app::SafeFloat_GetValue(nullptr, combatProp->fields.maxHP, nullptr); - auto HP = app::SafeFloat_GetValue(nullptr, combatProp->fields.HP, nullptr); + auto maxHP = app::SafeFloat_GetValue(combatProp->fields.maxHP, nullptr); + auto HP = app::SafeFloat_GetValue(combatProp->fields.HP, nullptr); auto isLockHp = combatProp->fields.islockHP == nullptr || app::FixedBoolStack_get_value(combatProp->fields.islockHP, nullptr); auto isInvincible = combatProp->fields.isInvincible == nullptr || app::FixedBoolStack_get_value(combatProp->fields.isInvincible, nullptr); ImGui::BeginTooltip(); @@ -336,16 +336,16 @@ namespace cheat::feature // many cases we want to keep supporting. Ternary is cleaner, but not a big // performance hit if we keep a switch statement. switch (condition) { - case Debug::TeleportCondition::Closest: { - // We've already selected this. - break; - } - case Debug::TeleportCondition::Farthest: { - target = sortedEntities.back(); - break; - } + case Debug::TeleportCondition::Closest: { + // We've already selected this. + break; } - + case Debug::TeleportCondition::Farthest: { + target = sortedEntities.back(); + break; + } + } + // Separating this logic to keep it clean and consistent. if (target != nullptr) { @@ -500,7 +500,7 @@ namespace cheat::feature static bool checkOnlyShells = false; static bool showEmptyTypes = false; static Debug::EntitySortCondition sortCondition = Debug::EntitySortCondition::Distance; - static ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyScroll | + static ImGuiTabBarFlags tab_bar_flags = ImGuiTabBarFlags_Reorderable | ImGuiTabBarFlags_FittingPolicyScroll | ImGuiTabBarFlags_NoCloseWithMiddleMouseButton | ImGuiTabBarFlags_TabListPopupButton; auto& manager = game::EntityManager::instance(); @@ -529,7 +529,7 @@ namespace cheat::feature ImGui::Checkbox("Filter by Radius", &useRadius); if (!useRadius) ImGui::BeginDisabled(); - + ImGui::SameLine(); ImGui::PushItemWidth(200.0); ImGui::SliderFloat("Radius", &radius, 0.0f, 100.0f); @@ -767,23 +767,23 @@ namespace cheat::feature void DrawPositionInfo() { - auto avatarPos = app::ActorUtils_GetAvatarPos(nullptr, nullptr); + auto avatarPos = app::ActorUtils_GetAvatarPos(nullptr); ImGui::Text("Avatar position: %s", il2cppi_to_string(avatarPos).c_str()); - auto relativePos = app::WorldShiftManager_GetRelativePosition(nullptr, avatarPos, nullptr); + auto relativePos = app::WorldShiftManager_GetRelativePosition(avatarPos, nullptr); ImGui::Text("Relative position: %s", il2cppi_to_string(relativePos).c_str()); - auto levelPos = app::Miscs_GenLevelPos_1(nullptr, avatarPos, nullptr); + auto levelPos = app::Miscs_GenLevelPos_1(avatarPos, nullptr); ImGui::Text("Level position: %s", il2cppi_to_string(levelPos).c_str()); static app::Vector3 teleportPos = {}; ImGui::InputFloat3("Teleport position", reinterpret_cast(&teleportPos)); - + auto& teleport = MapTeleport::GetInstance(); if (ImGui::Button("Map teleport")) - teleport.TeleportTo(app::Vector2 { teleportPos.x, teleportPos.y }); - + teleport.TeleportTo(app::Vector2{ teleportPos.x, teleportPos.y }); + ImGui::SameLine(); if (ImGui::Button("World teleport")) @@ -791,7 +791,7 @@ namespace cheat::feature if (ImGui::TreeNode("Ground pos info")) { - auto groundNormal = app::Miscs_CalcCurrentGroundNorm(nullptr, avatarPos, nullptr); + auto groundNormal = app::Miscs_CalcCurrentGroundNorm(avatarPos, nullptr); ImGui::Text("Ground normal: %s", il2cppi_to_string(groundNormal).c_str()); static app::Vector3 pos{}; @@ -807,7 +807,7 @@ namespace cheat::feature static float length = 1000; ImGui::DragFloat("Raycast length", &length, 1.0f, -2000.0f, 2000.0f); - ImGui::Text("All: %f", app::Miscs_CalcCurrentGroundHeight_1(nullptr, avatarPos.x, avatarPos.z, avatarPos.y, length, 0xFFFFFFFF, nullptr)); + ImGui::Text("All: %f", app::Miscs_CalcCurrentGroundHeight_1(avatarPos.x, avatarPos.z, avatarPos.y, length, 0xFFFFFFFF, nullptr)); ImGui::TreePop(); } @@ -819,7 +819,7 @@ namespace cheat::feature ImGui::SameLine(); if (ImGui::Button("Copy All Info")) { - auto text = il2cppi_to_string(avatarPos) + "\n" + il2cppi_to_string(relativePos) + "\n" + il2cppi_to_string(levelPos) + "\n" + il2cppi_to_string(app::Miscs_CalcCurrentGroundNorm(nullptr, avatarPos, nullptr)); + auto text = il2cppi_to_string(avatarPos) + "\n" + il2cppi_to_string(relativePos) + "\n" + il2cppi_to_string(levelPos) + "\n" + il2cppi_to_string(app::Miscs_CalcCurrentGroundNorm(avatarPos, nullptr)); ImGui::SetClipboardText(text.c_str()); } ImGui::SameLine(); @@ -833,7 +833,7 @@ namespace cheat::feature for (int i = 0; i < 10; i++) name += std::to_string(rand() % 10); text = "\"name\":\"" + name + "\"," + text; - text = "{" + text + "}"; + text = "{" + text + "}"; ImGui::SetClipboardText(text.c_str()); } @@ -841,27 +841,27 @@ namespace cheat::feature void DrawMapManager() { - auto mapManager = GET_SINGLETON(MapManager); + auto mapManager = GET_SINGLETON(MapManager); if (mapManager == nullptr) return; int temp = mapManager->fields.playerSceneID; ImGui::InputInt("Player scene id", &temp); - temp = mapManager->fields.mapSceneID; - ImGui::InputInt("Map scene id", &temp); + temp = mapManager->fields.mapSceneID; + ImGui::InputInt("Map scene id", &temp); } void DrawImGuiFocusTest() { - ImGui::Text("Is any item active: %s", ImGui::IsAnyItemActive() ? "true" : "false"); - ImGui::Text("Is any item focused: %s", ImGui::IsAnyItemFocused() ? "true" : "false"); + ImGui::Text("Is any item active: %s", ImGui::IsAnyItemActive() ? "true" : "false"); + ImGui::Text("Is any item focused: %s", ImGui::IsAnyItemFocused() ? "true" : "false"); - ImGui::Button("Test"); - auto hk = Hotkey(); - int temp = 0; - InputHotkey("Test hotkey", &hk, false); - ImGui::InputInt("Test input", &temp); + ImGui::Button("Test"); + auto hk = Hotkey(); + int temp = 0; + InputHotkey("Test hotkey", &hk, false); + ImGui::InputInt("Test input", &temp); } std::map chestNames; @@ -908,7 +908,7 @@ namespace cheat::feature app::GadgetState__Enum chestState = static_cast(ownerData.gadgetState); ImGui::Text("Is ability locked: %s", pluginData._isLockByAbility ? "true" : "false"); ImGui::Text("State: %s", magic_enum::enum_name(chestState).data()); - + bool added = chestNames.count(entityName) > 0; if (tempNames.count(entityName) == 0) @@ -947,8 +947,8 @@ namespace cheat::feature ImGui::InputTextMultiline("Dict", &textStr); ImGui::TreePop(); } - - } + + } void DrawScenePropManager() { @@ -967,7 +967,7 @@ namespace cheat::feature } ImGui::Text("Prop count: %d", scenePropDict->count); - + auto& manager = game::EntityManager::instance(); for (auto& [id, propObject] : scenePropDict->pairs()) { @@ -979,20 +979,20 @@ namespace cheat::feature auto config = tree->fields._config->fields; auto pattern = config._._.scenePropPatternName; - app::ECGLPBEEEAA__Enum value; + app::MoleMole_Config_TreeType__Enum value; bool result = app::ScenePropManager_GetTreeTypeByPattern(scenePropManager, pattern, &value, nullptr); if (!result) continue; ImGui::Text("Tree at %s, type: %s, distance %0.3f", il2cppi_to_string(pos).c_str(), magic_enum::enum_name(value).data(), - manager.avatar()->distance(app::WorldShiftManager_GetRelativePosition(nullptr, pos, nullptr))); + manager.avatar()->distance(app::WorldShiftManager_GetRelativePosition(pos, nullptr))); } } class ItemFilter : game::IEntityFilter { public: - ItemFilter() : ItemFilter(app::EntityType__Enum_1::None, "") + ItemFilter() : ItemFilter(app::EntityType__Enum_1::None, "") {} ItemFilter(app::EntityType__Enum_1 type, const std::string& name) : m_Type(type), m_Name(name) @@ -1033,18 +1033,18 @@ namespace cheat::feature nlohmann::json jRoot; try { - jRoot =nlohmann::json::parse(fs); + jRoot = nlohmann::json::parse(fs); } catch (nlohmann::detail::parse_error& parseError) { UNREFERENCED_PARAMETER(parseError); LOG_ERROR("Failed to parse json"); } - + for (auto& [key, value] : jRoot["filters"].items()) simpleFilters[key] = ItemFilter(value["type"], value["name"]); - for (auto& value : jRoot["excluded"]) + for (auto& value : jRoot["excluded"]) removedItems.push_back(ItemFilter(value["type"], value["name"])); } @@ -1098,20 +1098,20 @@ namespace cheat::feature ImGui::InputText("## Name", &keyText); ImGui::SameLine(); - ImGui::InputText("## ItemName", &filter.m_Name); - ImGui::SameLine(); - + ImGui::InputText("## ItemName", &filter.m_Name); + ImGui::SameLine(); + std::string typeName = std::string(magic_enum::enum_name(filter.m_Type)); - ImGui::InputText("## ItemType", &typeName); + ImGui::InputText("## ItemType", &typeName); ImGui::PopItemWidth(); ImGui::PopID(); } } - void Debug::DrawExternal() - { - //auto draw = ImGui::GetBackgroundDrawList(); + void Debug::DrawExternal() + { + //auto draw = ImGui::GetBackgroundDrawList(); //std::string fpsString = fmt::format("{:.1f}/{:.1f}", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); //draw->AddText(ImVec2(100, 100), ImColor(0, 0, 0), fpsString.c_str()); @@ -1136,14 +1136,14 @@ namespace cheat::feature } } - for (auto& filter : removedItems) - { - if (executor.ApplyFilter(entity, reinterpret_cast(&filter))) - { - unexplored = false; - break; - } - } + for (auto& filter : removedItems) + { + if (executor.ApplyFilter(entity, reinterpret_cast(&filter))) + { + unexplored = false; + break; + } + } if (!unexplored) continue; @@ -1169,11 +1169,11 @@ namespace cheat::feature updated = true; } } - else if (selectedEntity != nullptr && ImGui::IsKeyPressed(ImGuiKey_R, false)) - { - removedItems.push_back(ItemFilter(selectedEntity->type(), selectedEntity->name())); - updated = true; - } + else if (selectedEntity != nullptr && ImGui::IsKeyPressed(ImGuiKey_R, false)) + { + removedItems.push_back(ItemFilter(selectedEntity->type(), selectedEntity->name())); + updated = true; + } if (selectedEntity != nullptr && ImGui::IsKeyPressed(ImGuiKey_T, false)) { @@ -1189,8 +1189,8 @@ namespace cheat::feature ImGui::Begin("Input name", nullptr, ImGuiWindowFlags_AlwaysAutoResize); ImGui::PushItemWidth(500); ImGui::InputText("Section", &tempSectionName); - if (!ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0)) - ImGui::SetKeyboardFocusHere(0); + if (!ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0)) + ImGui::SetKeyboardFocusHere(0); ImGui::InputText("Name", &tempName); ImGui::PopItemWidth(); ImGui::End(); @@ -1203,21 +1203,21 @@ namespace cheat::feature updated = true; } - if (ImGui::IsKeyPressed(ImGuiKey_Escape, false)) - { + if (ImGui::IsKeyPressed(ImGuiKey_Escape, false)) + { renderer::SetInputLock(this, false); - addingFilter = false; - } + addingFilter = false; + } } if (updated) FiltetItemPickerSave(); - } + } void DrawFPSGraph() { - static float values[120] = {0}; + static float values[120] = { 0 }; static int values_offset = 0; values[values_offset++] = ImGui::GetIO().Framerate; if (values_offset >= IM_ARRAYSIZE(values)) @@ -1232,43 +1232,43 @@ namespace cheat::feature } void Debug::DrawMain() - { - if (ImGui::CollapsingHeader("Entity Manager", ImGuiTreeNodeFlags_None)) - DrawEntitiesData(); + { + if (ImGui::CollapsingHeader("Entity Manager", ImGuiTreeNodeFlags_None)) + DrawEntitiesData(); - if (ImGui::CollapsingHeader("Position", ImGuiTreeNodeFlags_None)) - { - DrawMapManager(); - DrawPositionInfo(); - } + if (ImGui::CollapsingHeader("Position", ImGuiTreeNodeFlags_None)) + { + DrawMapManager(); + DrawPositionInfo(); + } //if (ImGui::CollapsingHeader("Filter item picker")) // DrawFilterItemPicker(); - //if (ImGui::CollapsingHeader("Chest plugin", ImGuiTreeNodeFlags_None)) - // DrawChestPlugin(); + //if (ImGui::CollapsingHeader("Chest plugin", ImGuiTreeNodeFlags_None)) + // DrawChestPlugin(); - //if (ImGui::CollapsingHeader("Interaction manager", ImGuiTreeNodeFlags_None)) - // DrawInteractionManagerInfo(); + //if (ImGui::CollapsingHeader("Interaction manager", ImGuiTreeNodeFlags_None)) + // DrawInteractionManagerInfo(); - if (ImGui::CollapsingHeader("Map Manager", ImGuiTreeNodeFlags_None)) - DrawManagerData(); + if (ImGui::CollapsingHeader("Map Manager", ImGuiTreeNodeFlags_None)) + DrawManagerData(); if (ImGui::CollapsingHeader("FPS Graph", ImGuiTreeNodeFlags_None)) DrawFPSGraph(); - } + } - bool Debug::NeedInfoDraw() const - { + bool Debug::NeedInfoDraw() const + { return showNotWritten && notWrittenChests.size() > 0; - } + } - void Debug::DrawInfo() - { + void Debug::DrawInfo() + { for (auto& name : notWrittenChests) { ImGui::Text("%s", name.c_str()); } - } + } diff --git a/cheat-library/src/user/cheat/misc/ProtectionBypass.cpp b/cheat-library/src/user/cheat/misc/ProtectionBypass.cpp index 6eb80df..c326a06 100644 --- a/cheat-library/src/user/cheat/misc/ProtectionBypass.cpp +++ b/cheat-library/src/user/cheat/misc/ProtectionBypass.cpp @@ -24,7 +24,7 @@ namespace cheat::feature { for (int i = 0; i < 4; i++) { LOG_TRACE("Emulating call of RecordUserData with type %d", i); - app::Application_RecordUserData(nullptr, i, nullptr); + app::Application_RecordUserData(i, nullptr); } // if (m_Enabled) { diff --git a/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.cpp b/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.cpp index a25a97a..be4281c 100644 --- a/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.cpp +++ b/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.cpp @@ -183,7 +183,7 @@ namespace cheat::feature byteArray->max_length = length; memcpy_s(byteArray->vector, length, content, length); - app::Packet_XorEncrypt(nullptr, &byteArray, length, nullptr); + app::Packet_XorEncrypt(&byteArray, length, nullptr); auto result = new char[length]; memcpy_s(result, length, byteArray->vector, length); @@ -249,13 +249,13 @@ namespace cheat::feature return sniffer.OnPacketIO(evt->_evt.packet, PacketIOType::Receive); } - int32_t PacketSniffer::KcpNative_kcp_client_send_packet_Hook(void* __this, void* kcp_client, app::KcpPacket_1* packet, MethodInfo* method) + int32_t PacketSniffer::KcpNative_kcp_client_send_packet_Hook(void* kcp_client, app::KcpPacket_1* packet, MethodInfo* method) { auto& sniffer = GetInstance(); if (!sniffer.OnPacketIO(packet, PacketIOType::Send)) return 0; - return CALL_ORIGIN(KcpNative_kcp_client_send_packet_Hook, __this, kcp_client, packet, method); + return CALL_ORIGIN(KcpNative_kcp_client_send_packet_Hook, kcp_client, packet, method); } } diff --git a/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.h b/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.h index 344452d..890130b 100644 --- a/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.h +++ b/cheat-library/src/user/cheat/misc/sniffer/PacketSniffer.h @@ -49,7 +49,7 @@ namespace cheat::feature static char* EncryptXor(void* content, uint32_t length); static bool KcpClient_TryDequeueEvent_Hook(void* __this, app::ClientKcpEvent* evt, MethodInfo* method); - static int32_t KcpNative_kcp_client_send_packet_Hook(void* __this, void* kcp_client, app::KcpPacket_1* packet, MethodInfo* method); + static int32_t KcpNative_kcp_client_send_packet_Hook(void* kcp_client, app::KcpPacket_1* packet, MethodInfo* method); bool OnPacketIO(app::KcpPacket_1* packet, PacketIOType type); }; diff --git a/cheat-library/src/user/cheat/player/NoCD.cpp b/cheat-library/src/user/cheat/player/NoCD.cpp index db3d04a..1ec6b06 100644 --- a/cheat-library/src/user/cheat/player/NoCD.cpp +++ b/cheat-library/src/user/cheat/player/NoCD.cpp @@ -128,11 +128,11 @@ namespace cheat::feature NoCD& noCD = NoCD::GetInstance(); if (noCD.f_AbilityReduce) { - auto cdTimer = app::SafeFloat_GetValue(nullptr, skillInfo->fields.cdTimer, nullptr); + auto cdTimer = app::SafeFloat_GetValue(skillInfo->fields.cdTimer, nullptr); if (cdTimer > noCD.f_TimerReduce * 5.0f) { - struct app::SafeFloat MyValueProtect = app::SafeFloat_SetValue(nullptr, noCD.f_TimerReduce * 5.0f, nullptr); + struct app::SafeFloat MyValueProtect = app::SafeFloat_SetValue(noCD.f_TimerReduce * 5.0f, nullptr); skillInfo->fields.cdTimer = MyValueProtect; } } diff --git a/cheat-library/src/user/cheat/player/NoClip.cpp b/cheat-library/src/user/cheat/player/NoClip.cpp index 686825c..0aea29a 100644 --- a/cheat-library/src/user/cheat/player/NoClip.cpp +++ b/cheat-library/src/user/cheat/player/NoClip.cpp @@ -154,7 +154,7 @@ namespace cheat::feature if (IsVectorZero(prevPos)) return; - float deltaTime = app::Time_get_deltaTime(nullptr, nullptr); + float deltaTime = app::Time_get_deltaTime(nullptr); app::Vector3 newPos = prevPos + dir * speed * deltaTime; if (!f_VelocityMode) diff --git a/cheat-library/src/user/cheat/player/RapidFire.cpp b/cheat-library/src/user/cheat/player/RapidFire.cpp index fbe3454..7ab5027 100644 --- a/cheat-library/src/user/cheat/player/RapidFire.cpp +++ b/cheat-library/src/user/cheat/player/RapidFire.cpp @@ -121,7 +121,7 @@ namespace cheat::feature return f_Multiplier; auto safeHP = baseCombat->fields._combatProperty_k__BackingField->fields.HP; - auto HP = app::SafeFloat_GetValue(nullptr, safeHP, nullptr); + auto HP = app::SafeFloat_GetValue(safeHP, nullptr); int attackCount = (int)ceil(HP / attackDamage); return std::clamp(attackCount, 1, 200); } diff --git a/cheat-library/src/user/cheat/teleport/CustomTeleports.cpp b/cheat-library/src/user/cheat/teleport/CustomTeleports.cpp index 6154517..a0aa564 100644 --- a/cheat-library/src/user/cheat/teleport/CustomTeleports.cpp +++ b/cheat-library/src/user/cheat/teleport/CustomTeleports.cpp @@ -30,7 +30,7 @@ namespace cheat::feature static std::string teleportName; ImGui::InputText("Teleport name", &teleportName); static std::vector> teleports; - app::Vector3 pos = app::ActorUtils_GetAvatarPos(nullptr, nullptr); + app::Vector3 pos = app::ActorUtils_GetAvatarPos(nullptr); if (ImGui::Button("Add teleport")) { // check if already added diff --git a/cheat-library/src/user/cheat/teleport/MapTeleport.cpp b/cheat-library/src/user/cheat/teleport/MapTeleport.cpp index b1a0e30..4eb1903 100644 --- a/cheat-library/src/user/cheat/teleport/MapTeleport.cpp +++ b/cheat-library/src/user/cheat/teleport/MapTeleport.cpp @@ -6,48 +6,48 @@ #include #include -namespace cheat::feature +namespace cheat::feature { static void InLevelMapPageContext_OnMapClicked_Hook(app::InLevelMapPageContext* __this, app::Vector2 screenPos, MethodInfo* method); static void InLevelMapPageContext_OnMarkClicked_Hook(app::InLevelMapPageContext* __this, app::MonoMapMark* mark, MethodInfo* method); - static app::Vector3 LocalEntityInfoData_GetTargetPos_Hook(app::LocalEntityInfoData* __this, MethodInfo* method); - + static app::Vector3 LocalEntityInfoData_get_initPos_Hook(app::LocalEntityInfoData* __this, MethodInfo* method); + static bool LoadingManager_NeedTransByServer_Hook(app::LoadingManager* __this, uint32_t sceneId, app::Vector3 position, MethodInfo* method); static void LoadingManager_PerformPlayerTransmit_Hook(app::LoadingManager* __this, app::Vector3 position, app::EnterType__Enum someEnum, uint32_t someUint1, app::EvtTransmitAvatar_EvtTransmitAvatar_TransmitType__Enum teleportType, uint32_t someUint2, MethodInfo* method); - static void Entity_SetPosition_Hook(app::BaseEntity* __this, app::Vector3 position, bool someBool, MethodInfo* method); + static void Entity_SetRelativePosition_Hook(app::BaseEntity* __this, app::Vector3 position, bool someBool, MethodInfo* method); - MapTeleport::MapTeleport() : Feature(), - NF(f_Enabled, "Map teleport", "MapTeleport", false), + MapTeleport::MapTeleport() : Feature(), + NF(f_Enabled, "Map teleport", "MapTeleport", false), NF(f_DetectHeight, "Auto height detect", "MapTeleport", true), NF(f_DefaultHeight, "Default teleport height", "MapTeleport", 300.0f), NF(f_Key, "Teleport key", "MapTeleport", Hotkey('T')) - { + { // Map touch HookManager::install(app::InLevelMapPageContext_OnMarkClicked, InLevelMapPageContext_OnMarkClicked_Hook); HookManager::install(app::InLevelMapPageContext_OnMapClicked, InLevelMapPageContext_OnMapClicked_Hook); // Stage 1 - HookManager::install(app::LocalEntityInfoData_GetTargetPos, LocalEntityInfoData_GetTargetPos_Hook); + HookManager::install(app::LocalEntityInfoData_get_initPos, LocalEntityInfoData_get_initPos_Hook); HookManager::install(app::LoadingManager_NeedTransByServer, LoadingManager_NeedTransByServer_Hook); // Stage 2 HookManager::install(app::LoadingManager_PerformPlayerTransmit, LoadingManager_PerformPlayerTransmit_Hook); // Stage 3 - HookManager::install(app::Entity_SetPosition, Entity_SetPosition_Hook); + HookManager::install(app::Entity_SetRelativePosition, Entity_SetRelativePosition_Hook); events::GameUpdateEvent += MY_METHOD_HANDLER(MapTeleport::OnGameUpdate); } - const FeatureGUIInfo& MapTeleport::GetGUIInfo() const - { - static const FeatureGUIInfo info { "Map Teleport", "Teleport", true }; - return info; - } + const FeatureGUIInfo& MapTeleport::GetGUIInfo() const + { + static const FeatureGUIInfo info{ "Map Teleport", "Teleport", true }; + return info; + } - void MapTeleport::DrawMain() - { + void MapTeleport::DrawMain() + { ConfigWidget("Enabled", f_Enabled, "Enable teleport-to-mark functionality.\n" \ @@ -71,13 +71,13 @@ namespace cheat::feature if (!f_Enabled) ImGui::EndDisabled(); - } + } - MapTeleport& MapTeleport::GetInstance() - { - static MapTeleport instance; - return instance; - } + MapTeleport& MapTeleport::GetInstance() + { + static MapTeleport instance; + return instance; + } // Hook for game manager needs for starting teleport in game update thread. // Because, when we use Teleport call in non game thread (imgui update thread for example) @@ -99,7 +99,7 @@ namespace cheat::feature { LOG_DEBUG("Stage 0. Target location at %s", il2cppi_to_string(position).c_str()); - auto avatarPosition = app::ActorUtils_GetAvatarPos(nullptr, nullptr); + auto avatarPosition = app::ActorUtils_GetAvatarPos(nullptr); auto nearestWaypoint = game::FindNearestWaypoint(position, sceneId); if (nearestWaypoint.data == nullptr) @@ -109,7 +109,7 @@ namespace cheat::feature } else { - float dist = app::Vector3_Distance(nullptr, position, nearestWaypoint.position, nullptr); + float dist = app::Vector3_Distance(position, nearestWaypoint.position, nullptr); LOG_DEBUG("Stage 0. Found nearest waypoint { sceneId: %d; waypointId: %d } with distance %fm.", nearestWaypoint.sceneId, nearestWaypoint.waypointId, dist); } @@ -122,7 +122,7 @@ namespace cheat::feature if (!mapBackground) return false; - auto uimanager = GET_SINGLETON(UIManager_1); + auto uimanager = GET_SINGLETON(UIManager); if (uimanager == nullptr) return false; @@ -149,10 +149,10 @@ namespace cheat::feature void MapTeleport::TeleportTo(app::Vector2 mapPosition) { - auto worldPosition = app::Miscs_GenWorldPos(nullptr, mapPosition, nullptr); + auto worldPosition = app::Miscs_GenWorldPos(mapPosition, nullptr); - auto relativePos = app::WorldShiftManager_GetRelativePosition(nullptr, worldPosition, nullptr); - auto groundHeight = app::Miscs_CalcCurrentGroundHeight(nullptr, relativePos.x, relativePos.z, nullptr); + auto relativePos = app::WorldShiftManager_GetRelativePosition(worldPosition, nullptr); + auto groundHeight = app::Miscs_CalcCurrentGroundHeight(relativePos.x, relativePos.z, nullptr); TeleportTo({ worldPosition.x, groundHeight > 0 ? groundHeight + 5 : f_DefaultHeight, worldPosition.z }, true, game::GetCurrentMapSceneID()); } @@ -188,7 +188,7 @@ namespace cheat::feature // Before call, game checked if distance is near (<60) to cast near teleport. // But it check distance to waypoint location, given by this function. // So, we need to replace target position to do correct check. - void MapTeleport::OnGetTargetPos(app::Vector3& position) + void MapTeleport::OnGetTargetPos(app::Vector3& position) { if (taskInfo.currentStage == 3) { @@ -199,7 +199,7 @@ namespace cheat::feature } // Checking is teleport is far (>60m), if it isn't we clear stage. - void MapTeleport::OnCheckTeleportDistance(bool needTransByServer) + void MapTeleport::OnCheckTeleportDistance(bool needTransByServer) { if (!needTransByServer && taskInfo.currentStage == 2) { @@ -210,7 +210,7 @@ namespace cheat::feature // After server responded, it will give us the waypoint target location to load. // Change it to teleport location. - void MapTeleport::OnPerformPlayerTransmit(app::Vector3& position) + void MapTeleport::OnPerformPlayerTransmit(app::Vector3& position) { if (taskInfo.currentStage == 2) { @@ -232,17 +232,17 @@ namespace cheat::feature if (taskInfo.needHeightCalculation) { - auto relativePos = app::WorldShiftManager_GetRelativePosition(nullptr, position, nullptr); + auto relativePos = app::WorldShiftManager_GetRelativePosition(position, nullptr); float groundHeight; switch (taskInfo.sceneId) { - // Underground mines has tunnel structure, so we need to calculate height from waypoint height to prevent tp above world. + // Underground mines has tunnel structure, so we need to calculate height from waypoint height to prevent tp above world. case 6: // Underground mines scene id, if it was changed, please create issue - groundHeight = app::Miscs_CalcCurrentGroundHeight_1(nullptr, relativePos.x, relativePos.z, originPosition.y, 100, - app::Miscs_GetSceneGroundLayerMask(nullptr, nullptr), nullptr); + groundHeight = app::Miscs_CalcCurrentGroundHeight_1(relativePos.x, relativePos.z, originPosition.y, 100, + app::Miscs_GetSceneGroundLayerMask(nullptr), nullptr); break; default: - groundHeight = app::Miscs_CalcCurrentGroundWaterHeight(nullptr, relativePos.x, relativePos.z, nullptr); + groundHeight = app::Miscs_CalcCurrentGroundWaterHeight(relativePos.x, relativePos.z, nullptr); break; } if (groundHeight > 0 && position.y != groundHeight) @@ -257,13 +257,13 @@ namespace cheat::feature } } - static app::Vector3 LocalEntityInfoData_GetTargetPos_Hook(app::LocalEntityInfoData* __this, MethodInfo* method) + static app::Vector3 LocalEntityInfoData_get_initPos_Hook(app::LocalEntityInfoData* __this, MethodInfo* method) { - auto result = CALL_ORIGIN(LocalEntityInfoData_GetTargetPos_Hook, __this, method); - + auto result = CALL_ORIGIN(LocalEntityInfoData_get_initPos_Hook, __this, method); + MapTeleport& mapTeleport = MapTeleport::GetInstance(); mapTeleport.OnGetTargetPos(result); - + return result; } @@ -288,7 +288,7 @@ namespace cheat::feature } - static void Entity_SetPosition_Hook(app::BaseEntity* __this, app::Vector3 position, bool someBool, MethodInfo* method) + static void Entity_SetRelativePosition_Hook(app::BaseEntity* __this, app::Vector3 position, bool someBool, MethodInfo* method) { auto& manager = game::EntityManager::instance(); if (manager.avatar()->raw() == __this) @@ -297,7 +297,7 @@ namespace cheat::feature mapTeleport.OnSetAvatarPosition(position); } - CALL_ORIGIN(Entity_SetPosition_Hook, __this, position, someBool, method); + CALL_ORIGIN(Entity_SetRelativePosition_Hook, __this, position, someBool, method); } } diff --git a/cheat-library/src/user/cheat/world/AutoCook.cpp b/cheat-library/src/user/cheat/world/AutoCook.cpp index e61864e..87aeeb3 100644 --- a/cheat-library/src/user/cheat/world/AutoCook.cpp +++ b/cheat-library/src/user/cheat/world/AutoCook.cpp @@ -99,7 +99,7 @@ namespace cheat::feature AutoCook& autoCook = AutoCook::GetInstance(); if (autoCook.f_Enabled) { - uint32_t maxCount = app::SimpleSafeUInt32_get_Value(nullptr, __this->fields.maxProficiencyRawNum, nullptr); + uint32_t maxCount = app::SimpleSafeUInt32_get_Value(__this->fields.maxProficiencyRawNum, nullptr); autoCook.CookCount = maxCount; } return CALL_ORIGIN(CookRecipeExcelConfig_get_maxProficiency, __this, method); diff --git a/cheat-library/src/user/cheat/world/AutoFish.cpp b/cheat-library/src/user/cheat/world/AutoFish.cpp index 6df814a..5608cac 100644 --- a/cheat-library/src/user/cheat/world/AutoFish.cpp +++ b/cheat-library/src/user/cheat/world/AutoFish.cpp @@ -7,7 +7,7 @@ #include #include -namespace cheat::feature +namespace cheat::feature { AutoFish::AutoFish() : Feature(), NFEX(f_Enabled, "Auto Fish", "m_AutoFish", "AutoFish", false, false), @@ -17,12 +17,12 @@ namespace cheat::feature { events::GameUpdateEvent += MY_METHOD_HANDLER(AutoFish::OnGameUpdate); - HookManager::install(app::FishingModule_RequestFishCastRod, FishingModule_RequestFishCastRod_Hook); - HookManager::install(app::FishingModule_onFishChosenNotify, FishingModule_onFishChosenNotify_Hook); - HookManager::install(app::FishingModule_OnFishBiteRsp, FishingModule_OnFishBiteRsp_Hook); + HookManager::install(app::FishingModule_RequestFishCastRod, FishingModule_RequestFishCastRod_Hook); + HookManager::install(app::FishingModule_onFishChosenNotify, FishingModule_onFishChosenNotify_Hook); + HookManager::install(app::FishingModule_OnFishBiteRsp, FishingModule_OnFishBiteRsp_Hook); HookManager::install(app::FishingModule_OnFishBattleBeginRsp, FishingModule_OnFishBattleBeginRsp_Hook); - HookManager::install(app::FishingModule_OnFishBattleEndRsp, FishingModule_OnFishBattleEndRsp_Hook); - HookManager::install(app::FishingModule_OnExitFishingRsp, FishingModule_OnExitFishingRsp_Hook); + HookManager::install(app::FishingModule_OnFishBattleEndRsp, FishingModule_OnFishBattleEndRsp_Hook); + HookManager::install(app::FishingModule_OnExitFishingRsp, FishingModule_OnExitFishingRsp_Hook); } const FeatureGUIInfo& AutoFish::GetGUIInfo() const @@ -43,11 +43,11 @@ namespace cheat::feature } bool AutoFish::NeedStatusDraw() const - { + { return f_Enabled; } - void AutoFish::DrawStatus() + void AutoFish::DrawStatus() { ImGui::Text("Auto Fish"); } @@ -58,19 +58,19 @@ namespace cheat::feature return instance; } - void AutoFish::FishingModule_onFishChosenNotify_Hook(void* __this, void* notify, MethodInfo* method) - { + void AutoFish::FishingModule_onFishChosenNotify_Hook(void* __this, void* notify, MethodInfo* method) + { CALL_ORIGIN(FishingModule_onFishChosenNotify_Hook, __this, notify, method); - auto& autoFish = GetInstance(); - if (!autoFish.f_Enabled) - return; + auto& autoFish = GetInstance(); + if (!autoFish.f_Enabled) + return; app::FishingModule_RequestFishBite(__this, nullptr); - } + } - void AutoFish::FishingModule_OnFishBiteRsp_Hook(void* __this, app::FishBiteRsp* rsp, MethodInfo* method) - { + void AutoFish::FishingModule_OnFishBiteRsp_Hook(void* __this, app::FishBiteRsp* rsp, MethodInfo* method) + { auto& autoFish = GetInstance(); if (!autoFish.f_Enabled) { @@ -78,30 +78,30 @@ namespace cheat::feature return; } - app::FishingModule_RequestFishBattleBegin(__this, nullptr); + app::FishingModule_RequestFishBattleBegin(__this, nullptr); } - void AutoFish::FishingModule_OnFishBattleBeginRsp_Hook(void* __this, app::FishBattleBeginRsp* rsp, MethodInfo* method) - { - auto& autoFish = GetInstance(); - if (!autoFish.f_Enabled) - { + void AutoFish::FishingModule_OnFishBattleBeginRsp_Hook(void* __this, app::FishBattleBeginRsp* rsp, MethodInfo* method) + { + auto& autoFish = GetInstance(); + if (!autoFish.f_Enabled) + { CALL_ORIGIN(FishingModule_OnFishBattleBeginRsp_Hook, __this, rsp, method); - return; - } + return; + } - std::lock_guard catchLock(autoFish.m_BattleFinishTimestampMutex); - autoFish.m_BattleFinishTimestamp = app::GetTimestamp(nullptr, nullptr) + autoFish.f_DelayBeforeCatch; + std::lock_guard catchLock(autoFish.m_BattleFinishTimestampMutex); + autoFish.m_BattleFinishTimestamp = app::TimeUtil_get_NowTimeStamp(nullptr) + autoFish.f_DelayBeforeCatch; } - void AutoFish::FishingModule_OnFishBattleEndRsp_Hook(void* __this, app::FishBattleEndRsp* rsp, MethodInfo* method) - { + void AutoFish::FishingModule_OnFishBattleEndRsp_Hook(void* __this, app::FishBattleEndRsp* rsp, MethodInfo* method) + { CALL_ORIGIN(FishingModule_OnFishBattleEndRsp_Hook, __this, rsp, method); auto& autoFish = GetInstance(); - if (rsp->fields.battleResult_ == app::FishBattleResult__Enum::Cancel - || rsp->fields.battleResult_ == app::FishBattleResult__Enum::Exit) + if (rsp->fields.battleResult_ == app::FishBattleResult__Enum::Cancel + || rsp->fields.battleResult_ == app::FishBattleResult__Enum::Exit) { std::lock_guard _lock2(autoFish.m_RecastTimestampMutex); autoFish.m_RecastTimestamp = 0; @@ -114,8 +114,8 @@ namespace cheat::feature if (rsp->fields.retcode_ != 0) { LOG_WARNING("Failed to catch fish, retrying in %u ms", autoFish.f_DelayBeforeCatch); - std::lock_guard catchLock(autoFish.m_BattleFinishTimestampMutex); - autoFish.m_BattleFinishTimestamp = app::GetTimestamp(nullptr, nullptr) + autoFish.f_DelayBeforeCatch; + std::lock_guard catchLock(autoFish.m_BattleFinishTimestampMutex); + autoFish.m_BattleFinishTimestamp = app::TimeUtil_get_NowTimeStamp(nullptr) + autoFish.f_DelayBeforeCatch; return; } @@ -123,21 +123,21 @@ namespace cheat::feature return; std::lock_guard _lock(autoFish.m_RecastTimestampMutex); - autoFish.m_RecastTimestamp = app::GetTimestamp(nullptr, nullptr) + autoFish.f_DelayBeforeRecast; - } + autoFish.m_RecastTimestamp = app::TimeUtil_get_NowTimeStamp(nullptr) + autoFish.f_DelayBeforeRecast; + } - void AutoFish::FishingModule_OnExitFishingRsp_Hook(void* __this, void* rsp, MethodInfo* method) - { + void AutoFish::FishingModule_OnExitFishingRsp_Hook(void* __this, void* rsp, MethodInfo* method) + { CALL_ORIGIN(FishingModule_OnExitFishingRsp_Hook, __this, rsp, method); auto& autoFish = GetInstance(); std::lock_guard _lock(autoFish.m_RecastTimestampMutex); autoFish.m_LastCastData.exist = false; - } + } - void AutoFish::FishingModule_RequestFishCastRod_Hook(void* __this, uint32_t baitId, uint32_t rodId, app::Vector3 pos, uint32_t rodEntityId, MethodInfo* method) - { + void AutoFish::FishingModule_RequestFishCastRod_Hook(void* __this, uint32_t baitId, uint32_t rodId, app::Vector3 pos, uint32_t rodEntityId, MethodInfo* method) + { CALL_ORIGIN(FishingModule_RequestFishCastRod_Hook, __this, baitId, rodId, pos, rodEntityId, method); auto& autoFish = GetInstance(); @@ -149,16 +149,16 @@ namespace cheat::feature autoFish.m_LastCastData.pos = pos; autoFish.m_LastCastData.rodEntityId = rodEntityId; - autoFish.m_RecastTimestamp = 0; - } + autoFish.m_RecastTimestamp = 0; + } + + void AutoFish::OnGameUpdate() + { + auto timestamp = app::TimeUtil_get_NowTimeStamp(nullptr); - void AutoFish::OnGameUpdate() - { - auto timestamp = app::GetTimestamp(nullptr, nullptr); - std::lock_guard _lock(m_BattleFinishTimestampMutex); std::lock_guard _lock2(m_RecastTimestampMutex); - + if (!m_LastCastData.exist) return; @@ -170,13 +170,13 @@ namespace cheat::feature static_cast(f_DelayBeforeCatch / 1000), nullptr); } - if (m_RecastTimestamp != 0 && timestamp > m_RecastTimestamp) - { - m_RecastTimestamp = 0; + if (m_RecastTimestamp != 0 && timestamp > m_RecastTimestamp) + { + m_RecastTimestamp = 0; - app::FishingModule_RequestFishCastRod(m_LastCastData.fishingModule, m_LastCastData.baitId, - m_LastCastData.rodId, m_LastCastData.pos, m_LastCastData.rodEntityId, nullptr); - } - } + app::FishingModule_RequestFishCastRod(m_LastCastData.fishingModule, m_LastCastData.baitId, + m_LastCastData.rodId, m_LastCastData.pos, m_LastCastData.rodEntityId, nullptr); + } + } } diff --git a/cheat-library/src/user/cheat/world/AutoTreeFarm.cpp b/cheat-library/src/user/cheat/world/AutoTreeFarm.cpp index ccdb84d..90acf09 100644 --- a/cheat-library/src/user/cheat/world/AutoTreeFarm.cpp +++ b/cheat-library/src/user/cheat/world/AutoTreeFarm.cpp @@ -8,29 +8,29 @@ #include #include -namespace cheat::feature +namespace cheat::feature { - AutoTreeFarm::AutoTreeFarm() : Feature(), - NF(m_Enabled, "Auto tree farm", "AutoTreeFarm", false), - NF(m_AttackDelay, "Attack delay", "AutoTreeFarm", 150), - NF(m_RepeatDelay, "Repeat delay", "AutoTreeFarm", 500), - NF(m_AttackPerTree,"Attack per tree", "AutoTreeFarm", 5), - NF(m_Range, "Range", "AutoTreeFarm", 15.0f) - { + AutoTreeFarm::AutoTreeFarm() : Feature(), + NF(m_Enabled, "Auto tree farm", "AutoTreeFarm", false), + NF(m_AttackDelay, "Attack delay", "AutoTreeFarm", 150), + NF(m_RepeatDelay, "Repeat delay", "AutoTreeFarm", 500), + NF(m_AttackPerTree, "Attack per tree", "AutoTreeFarm", 5), + NF(m_Range, "Range", "AutoTreeFarm", 15.0f) + { events::GameUpdateEvent += MY_METHOD_HANDLER(AutoTreeFarm::OnGameUpdate); } - const FeatureGUIInfo& AutoTreeFarm::GetGUIInfo() const - { - static const FeatureGUIInfo info{ "Auto Tree Farm", "World", true }; - return info; - } + const FeatureGUIInfo& AutoTreeFarm::GetGUIInfo() const + { + static const FeatureGUIInfo info{ "Auto Tree Farm", "World", true }; + return info; + } - void AutoTreeFarm::DrawMain() - { + void AutoTreeFarm::DrawMain() + { ImGui::TextColored(ImColor(255, 165, 0, 255), "Note. This feature is not fully tested detection-wise.\n" "Not recommended for main accounts or used with high values."); - + ConfigWidget("Enabled", m_Enabled, "Automatically attack trees in range."); ConfigWidget("Attack Delay (ms)", m_AttackDelay, 1, 0, 1000, "Delay before attacking the next tree (in ms)."); ConfigWidget("Repeat Delay (ms)", m_RepeatDelay, 1, 500, 1000, "Delay before attacking the same tree (in ms).\nValues <500ms will not work."); @@ -43,27 +43,27 @@ namespace cheat::feature ConfigWidget("Range (m)", m_Range, 0.1f, 1.0f, 15.0f); ImGui::TextColored(ImColor(255, 165, 0, 255), "Range is softly limited to ~15m for safety purposes."); - } + } - bool AutoTreeFarm::NeedStatusDraw() const + bool AutoTreeFarm::NeedStatusDraw() const { - return m_Enabled; - } + return m_Enabled; + } - void AutoTreeFarm::DrawStatus() - { - ImGui::Text("Tree Farm\n[%dms|%dms|%d|%.1fm]", + void AutoTreeFarm::DrawStatus() + { + ImGui::Text("Tree Farm\n[%dms|%dms|%d|%.1fm]", m_AttackDelay.value(), m_RepeatDelay.value(), m_AttackPerTree.value(), m_Range.value()); - } + } - AutoTreeFarm& AutoTreeFarm::GetInstance() - { - static AutoTreeFarm instance; - return instance; - } + AutoTreeFarm& AutoTreeFarm::GetInstance() + { + static AutoTreeFarm instance; + return instance; + } std::unordered_set GetTreeSet() @@ -126,7 +126,7 @@ namespace cheat::feature static std::unordered_set s_AttackQueueSet; static uint64_t s_LastAttackTimestamp = 0; - uint64_t timestamp = app::GetTimestamp(nullptr, nullptr); + uint64_t timestamp = app::TimeUtil_get_NowTimeStamp(nullptr); if (!m_Enabled || s_LastAttackTimestamp + m_AttackDelay > timestamp) return; @@ -146,27 +146,27 @@ namespace cheat::feature continue; auto position = tree->fields._.realBounds.m_Center; - if (manager.avatar()->distance(app::WorldShiftManager_GetRelativePosition(nullptr, position, nullptr)) > m_Range) + if (manager.avatar()->distance(app::WorldShiftManager_GetRelativePosition(position, nullptr)) > m_Range) continue; s_AttackQueueSet.insert(tree); s_AttackQueue.push(tree); } - + while (!s_AttackQueue.empty()) { auto tree = s_AttackQueue.front(); s_AttackQueue.pop(); s_AttackQueueSet.erase(tree); - + if (treeSet.count(tree) == 0) continue; auto position = tree->fields._.realBounds.m_Center; - if (manager.avatar()->distance(app::WorldShiftManager_GetRelativePosition(nullptr, position, nullptr)) > m_Range) + if (manager.avatar()->distance(app::WorldShiftManager_GetRelativePosition(position, nullptr)) > m_Range) continue; - app::ECGLPBEEEAA__Enum treeType; + app::MoleMole_Config_TreeType__Enum treeType; auto pattern = tree->fields._config->fields._._.scenePropPatternName; if (!app::ScenePropManager_GetTreeTypeByPattern(scenePropManager, pattern, &treeType, nullptr)) continue; diff --git a/cheat-library/src/user/cheat/world/DialogSkip.cpp b/cheat-library/src/user/cheat/world/DialogSkip.cpp index bdd4f39..019909e 100644 --- a/cheat-library/src/user/cheat/world/DialogSkip.cpp +++ b/cheat-library/src/user/cheat/world/DialogSkip.cpp @@ -77,7 +77,7 @@ namespace cheat::feature return; if (f_FastDialog) - app::Time_set_timeScale(nullptr, f_TimeSpeedup, nullptr); + app::Time_set_timeScale(f_TimeSpeedup, nullptr); bool isImportant = false; if (f_ExcludeImportant) @@ -107,7 +107,7 @@ namespace cheat::feature { int32_t value = 0; auto object = il2cpp_value_box((Il2CppClass*)*app::Int32__TypeInfo, &value); - auto notify = app::Notify_CreateNotify_1(nullptr, app::MoleMole_NotifyTypes__Enum::DialogSelectItemNotify, (app::Object*)object, nullptr); + auto notify = app::Notify_CreateNotify_1(app::MoleMole_NotifyTypes__Enum::DialogSelectItemNotify, (app::Object*)object, nullptr); app::TalkDialogContext_OnDialogSelectItem(talkDialog, ¬ify, nullptr); } else if (!talkDialog->fields._inSelect) @@ -126,9 +126,9 @@ namespace cheat::feature // Should be a better way to store the pre-dialog speed using Time_get_timeScale. static void InLevelCutScenePageContext_ClearView_Hook(app::InLevelCutScenePageContext* __this, MethodInfo* method) { - float gameSpeed = app::Time_get_timeScale(nullptr, nullptr); + float gameSpeed = app::Time_get_timeScale(nullptr); if (gameSpeed > 1.0f) - app::Time_set_timeScale(nullptr, 1.0f, nullptr); + app::Time_set_timeScale(1.0f, nullptr); CALL_ORIGIN(InLevelCutScenePageContext_ClearView_Hook, __this, method); } } diff --git a/cheat-library/src/user/cheat/world/KillAura.cpp b/cheat-library/src/user/cheat/world/KillAura.cpp index 137791d..30e165e 100644 --- a/cheat-library/src/user/cheat/world/KillAura.cpp +++ b/cheat-library/src/user/cheat/world/KillAura.cpp @@ -112,10 +112,10 @@ namespace cheat::feature if (combatProp == nullptr) continue; - auto maxHP = app::SafeFloat_GetValue(nullptr, combatProp->fields.maxHP, nullptr); + auto maxHP = app::SafeFloat_GetValue(combatProp->fields.maxHP, nullptr); auto isLockHp = combatProp->fields.islockHP == nullptr || app::FixedBoolStack_get_value(combatProp->fields.islockHP, nullptr); auto isInvincible = combatProp->fields.isInvincible == nullptr || app::FixedBoolStack_get_value(combatProp->fields.isInvincible, nullptr); - auto HP = app::SafeFloat_GetValue(nullptr, combatProp->fields.HP, nullptr); + auto HP = app::SafeFloat_GetValue(combatProp->fields.HP, nullptr); if (maxHP < 10 || HP < 2 || isLockHp || isInvincible) continue; @@ -151,9 +151,9 @@ namespace cheat::feature attackSet.erase(monster->runtimeID()); auto combat = monster->combat(); - auto maxHP = app::SafeFloat_GetValue(nullptr, combat->fields._combatProperty_k__BackingField->fields.maxHP, nullptr); + auto maxHP = app::SafeFloat_GetValue(combat->fields._combatProperty_k__BackingField->fields.maxHP, nullptr); - auto crashEvt = app::CreateCrashEvent(nullptr, *app::CreateCrashEvent__MethodInfo); + auto crashEvt = app::CreateCrashEvent(*app::CreateCrashEvent__MethodInfo); app::EvtCrash_Init(crashEvt, monster->runtimeID(), nullptr); crashEvt->fields.maxHp = maxHP; crashEvt->fields.velChange = 1000; diff --git a/cheat-library/src/user/cheat/world/MobVacuum.cpp b/cheat-library/src/user/cheat/world/MobVacuum.cpp index f061315..8e65a93 100644 --- a/cheat-library/src/user/cheat/world/MobVacuum.cpp +++ b/cheat-library/src/user/cheat/world/MobVacuum.cpp @@ -178,14 +178,14 @@ namespace cheat::feature uint32_t entityId = entity->runtimeID(); app::Vector3 entityRelPos = positions->count(entityId) ? (*positions)[entityId] : entity->relativePosition(); app::Vector3 newPosition = {}; - if (app::Vector3_Distance(nullptr, entityRelPos, targetPos, nullptr) < 0.1) + if (app::Vector3_Distance(entityRelPos, targetPos, nullptr) < 0.1) { newPosition = targetPos; } else { app::Vector3 dir = GetVectorDirection(entityRelPos, targetPos); - float deltaTime = app::Time_get_deltaTime(nullptr, nullptr); + float deltaTime = app::Time_get_deltaTime(nullptr); newPosition = entityRelPos + dir * f_Speed * deltaTime; } @@ -213,7 +213,7 @@ namespace cheat::feature app::Vector3 targetPos = CalcMobVacTargetPos(); app::Vector3 entityPos = entity->relativePosition(); - if (app::Vector3_Distance(nullptr, targetPos, entityPos, nullptr) < 0.2) + if (app::Vector3_Distance(targetPos, entityPos, nullptr) < 0.2) return; app::Vector3 dir = GetVectorDirection(targetPos, entityPos);