diff --git a/src/game/features/network/CheaterPool.cpp b/src/game/features/network/CheaterPool.cpp index 1d3025b..a8a883a 100644 --- a/src/game/features/network/CheaterPool.cpp +++ b/src/game/features/network/CheaterPool.cpp @@ -1,28 +1,37 @@ -#include "core/commands/BoolCommand.hpp" +#include "core/commands/LoopedCommand.hpp" #include "core/hooking/DetourHook.hpp" #include "game/hooks/Hooks.hpp" #include "game/pointers/Pointers.hpp" namespace YimMenu::Features { - class CheaterPool : public BoolCommand + class CheaterPool : public LoopedCommand { - using BoolCommand::BoolCommand; + using LoopedCommand::LoopedCommand; + + int m_OldRegion; virtual void OnEnable() override { Pointers.SetJoinRequestPoolTypePatch->Apply(); Pointers.HandleJoinRequestIgnorePoolPatch->Apply(); + m_OldRegion = *Pointers.RegionCode; + } + + virtual void OnTick() override + { + *Pointers.RegionCode = 0; // put everyone in the same region for easier matchmaking } virtual void OnDisable() override { Pointers.SetJoinRequestPoolTypePatch->Restore(); Pointers.HandleJoinRequestIgnorePoolPatch->Restore(); + *Pointers.RegionCode = m_OldRegion; } }; - static CheaterPool _CheaterPool{"cheaterpool", "Join YimMenu-only Sessions", "Matchmaking will put you into sessions with other YimMenu users.", true}; + static CheaterPool _CheaterPool{"cheaterpool", "Join YimMenu-only Sessions", "Matchmaking will put you into sessions with other YimMenu users."}; } namespace YimMenu::Hooks diff --git a/src/game/features/system/Chat.cpp b/src/game/features/system/Chat.cpp index 054b7d4..9e70f0c 100644 --- a/src/game/features/system/Chat.cpp +++ b/src/game/features/system/Chat.cpp @@ -23,6 +23,7 @@ namespace while (true) { + YimMenu::ChatDisplay::MarkAccessed(); YimMenu::ScriptMgr::Yield(); int update_res = MISC::UPDATE_ONSCREEN_KEYBOARD(); diff --git a/src/game/frontend/ChatDisplay.cpp b/src/game/frontend/ChatDisplay.cpp index b7f013a..83bb017 100644 --- a/src/game/frontend/ChatDisplay.cpp +++ b/src/game/frontend/ChatDisplay.cpp @@ -30,6 +30,7 @@ namespace YimMenu } m_Messages.push_back(notification); + MarkAccessed(); } void ChatDisplay::DrawImpl() @@ -40,32 +41,53 @@ namespace YimMenu static const float y_pos = position * 100 + 200; static const float x_pos = *Pointers.ScreenResX - 470; - ImGui::SetNextWindowSize(ImVec2(*Pointers.ScreenResX - x_pos - 10, *Pointers.ScreenResY - y_pos), ImGuiCond_Always); - ImGui::SetNextWindowPos(ImVec2(x_pos, y_pos), ImGuiCond_Always); - - if (ImGui::Begin("##chatwin", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoInputs)) + if (m_Messages.size() && m_Opacity >= 0.011f) { - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.0f, 0.0f, 0.0f, 0.0f)); - ImGui::PushFont(Menu::Font::g_ChatFont); + ImGui::SetNextWindowSize(ImVec2(*Pointers.ScreenResX - x_pos - 10, *Pointers.ScreenResY - y_pos), ImGuiCond_Always); + ImGui::SetNextWindowPos(ImVec2(x_pos, y_pos), ImGuiCond_Always); - for (auto& message : m_Messages) + if (ImGui::Begin("##chatwin", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoInputs)) { - ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(message.m_Color)); - ImGui::TextWrapped("%s:", message.m_Sender.data()); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.0f, 0.0f, 0.0f, 0.0f)); + ImGui::PushFont(Menu::Font::g_ChatFont); + + for (auto& message : m_Messages) + { + auto color = message.m_Color; + color.Value.w = m_Opacity; + ImGui::PushStyleColor(ImGuiCol_Text, color.Value); + ImGui::TextWrapped("%s:", message.m_Sender.data()); + ImGui::PopStyleColor(); + ImGui::SameLine(); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, m_Opacity)); + ImGui::TextWrapped("%s", message.m_Message.data()); + ImGui::PopStyleColor(); + } + + ImGui::PopFont(); ImGui::PopStyleColor(); - ImGui::SameLine(); - ImGui::TextWrapped("%s", message.m_Message.data()); } - ImGui::PopFont(); - ImGui::PopStyleColor(); + ImGui::End(); } - ImGui::End(); + // TODO: unlink fade speed with FPS + if (std::chrono::system_clock::now() - m_LastAccessTime > 15s && m_Opacity != 0.0f) + { + m_Opacity -= 0.01f; + if (m_Opacity <= 0.011f) + m_Opacity = 0.0f; + } } void ChatDisplay::ClearImpl() { m_Messages.clear(); } + + void ChatDisplay::MarkAccessedImpl() + { + m_Opacity = 1.0f; + m_LastAccessTime = std::chrono::system_clock::now(); + } } \ No newline at end of file diff --git a/src/game/frontend/ChatDisplay.hpp b/src/game/frontend/ChatDisplay.hpp index e7a3004..03813c9 100644 --- a/src/game/frontend/ChatDisplay.hpp +++ b/src/game/frontend/ChatDisplay.hpp @@ -16,12 +16,15 @@ namespace YimMenu class ChatDisplay { private: + std::chrono::system_clock::time_point m_LastAccessTime; + float m_Opacity = 1.0f; std::vector m_Messages = {}; std::mutex m_Mutex; void ShowImpl(std::string sender, std::string message, ImColor color); void DrawImpl(); void ClearImpl(); + void MarkAccessedImpl(); static ChatDisplay& GetInstance() { @@ -44,6 +47,11 @@ namespace YimMenu { GetInstance().ClearImpl(); } + + static void MarkAccessed() + { + GetInstance().MarkAccessedImpl(); + } }; } \ No newline at end of file diff --git a/src/game/frontend/Onboarding.cpp b/src/game/frontend/Onboarding.cpp index 78b6fe7..28d809d 100644 --- a/src/game/frontend/Onboarding.cpp +++ b/src/game/frontend/Onboarding.cpp @@ -38,9 +38,9 @@ namespace YimMenu static int value = 0; ImGui::RadioButton("Play with YimMenu users", &value, 0); ImGui::SameLine(); - ImGui::RadioButton("Play with everyone", &value, 1); + ImGui::RadioButton("Play with everyone (Broken!)", &value, 1); ImGui::TextWrapped("%s", - "You can always change your choice by going to Network > Spoofing > Join YimMenu-only Sessions. Our official repository is at " + "You can always change your choice by toggling Network > Spoofing > Join YimMenu-only Sessions. Our official repository is at " "https://github.com/YimMenu/YimMenuV2. Make sure to only download the menu from GitHub to avoid malware. " "You can use the repository to report bugs, suggest features, and contribute by making pull requests. We also have a " "Matrix server that can be found at https://matrix.to/#/#yimmenu:matrix.org for faster communication with developers " diff --git a/src/game/frontend/submenus/Network.cpp b/src/game/frontend/submenus/Network.cpp index 53436d6..fa413f4 100644 --- a/src/game/frontend/submenus/Network.cpp +++ b/src/game/frontend/submenus/Network.cpp @@ -90,11 +90,11 @@ namespace YimMenu::Submenus auto spoofing = std::make_shared("Spoofing"); auto matchmakingGroup = std::make_shared("Matchmaking"); + matchmakingGroup->AddItem(std::make_shared("cheaterpool"_J)); auto spoofMMRegion = std::make_shared("", 1); spoofMMRegion->AddItem(std::make_shared("spoofmmregion"_J, "Spoof Region")); spoofMMRegion->AddItem(std::make_shared("spoofmmregion"_J, std::make_shared("mmregion"_J, "##mmregion"))); - matchmakingGroup->AddItem(spoofMMRegion); - matchmakingGroup->AddItem(std::make_shared("cheaterpool"_J)); + matchmakingGroup->AddItem(std::make_shared("cheaterpool"_J, spoofMMRegion, true)); spoofing->AddItem(matchmakingGroup); AddCategory(std::move(session)); diff --git a/src/game/frontend/submenus/Settings.cpp b/src/game/frontend/submenus/Settings.cpp index 49a56a8..ede1276 100644 --- a/src/game/frontend/submenus/Settings.cpp +++ b/src/game/frontend/submenus/Settings.cpp @@ -39,6 +39,7 @@ namespace YimMenu::Submenus auto playerEsp = std::make_shared("Player ESP", 10); auto pedEsp = std::make_shared("Ped ESP", 10); auto overlay = std::make_shared("Overlay"); + auto chat = std::make_shared("Chat"); hotkeys->AddItem(std::make_shared(Hotkeys)); @@ -74,9 +75,12 @@ namespace YimMenu::Submenus overlay->AddItem(std::make_shared("overlay"_J)); overlay->AddItem(std::make_shared("overlay"_J, std::make_shared("overlayfps"_J))); + chat->AddItem(std::make_shared("clearchat"_J)); + gui->AddItem(playerEsp); gui->AddItem(pedEsp); gui->AddItem(overlay); + gui->AddItem(chat); AddCategory(std::move(hotkeys)); AddCategory(std::move(gui));