Fixes for prev commit

This commit is contained in:
Grinch_ 2022-03-10 12:48:57 +06:00
parent b62341284f
commit efa9d8ecb6
4 changed files with 41 additions and 32 deletions

View File

@ -117,7 +117,7 @@
"Config": "Config", "Config": "Config",
"CopyrightDisclaimer": "Copyright Grinch_ 2019-2022. All rights reserved.", "CopyrightDisclaimer": "Copyright Grinch_ 2019-2022. All rights reserved.",
"Credits": "Credits", "Credits": "Credits",
"DiscordRPC" : "Discord rich presence", "DiscordRPC": "Discord rich presence",
"DiscordServer": "Discord server", "DiscordServer": "Discord server",
"FixVehKey": "Fix current vehicle", "FixVehKey": "Fix current vehicle",
"FlipVehKey": "Flip current vehicle", "FlipVehKey": "Flip current vehicle",
@ -276,6 +276,17 @@
"WantedLevel": "Wanted level", "WantedLevel": "Wanted level",
"WorkSkinOnly": "Only contains the skins that works" "WorkSkinOnly": "Only contains the skins that works"
}, },
"RPC": {
"BrowsingCheatMenu": "Browsing CheatMenu",
"Busted": "Busted!",
"DoingMission": "Doing {}",
"Driving": "Driving",
"In": "in",
"InsideMenus": "Inside Menus",
"PlayingFor": "Playing for {}:{}:{}",
"Walking": "Walking",
"Wasted": "Wasted!"
},
"Teleport": { "Teleport": {
"AddLocation": "Add location", "AddLocation": "Add location",
"Coordinates": "Coordinates", "Coordinates": "Coordinates",
@ -606,15 +617,5 @@
"VehiclePage": "Vehicle", "VehiclePage": "Vehicle",
"VisualPage": "Visual", "VisualPage": "Visual",
"WeaponPage": "Weapon" "WeaponPage": "Weapon"
},
"RPC" :
{
"Walking" : "Walking",
"Driving" : "Driving",
"In" : "in",
"DoingMission" : "Doing missions",
"BrowsingCheatMenu" : "Browsing CheatMenu",
"InsideMenus" : "Inside Menus",
"PlayingFor" : "Playing for {}:{}:{}"
} }
} }

View File

@ -24,7 +24,7 @@ void RPC::Init()
void RPC::Process() void RPC::Process()
{ {
if (!Menu::m_bDiscordRPC) if (!(Menu::m_bDiscordRPC && bInit))
{ {
return; return;
} }
@ -40,7 +40,12 @@ void RPC::Process()
if (pPed) if (pPed)
{ {
size_t curTimer = CTimer::m_snTimeInMilliseconds; size_t curTimer = CTimer::m_snTimeInMilliseconds;
#ifdef GTASA
size_t wantedLevel = pPed->GetWantedLevel();
#else
size_t wantedLevel = pPed->m_pWanted->m_nWantedLevel; size_t wantedLevel = pPed->m_pWanted->m_nWantedLevel;
#endif
if (wantedLevel > 0) if (wantedLevel > 0)
{ {
detailsText = std::format("{}: ", TEXT("Player.WantedLevel")); detailsText = std::format("{}: ", TEXT("Player.WantedLevel"));
@ -67,27 +72,27 @@ void RPC::Process()
smallImgText = std::format("{} {} {}", TEXT("RPC.Walking"), TEXT("RPC.In"), Util::GetLocationName(&pPed->GetPosition())); smallImgText = std::format("{} {} {}", TEXT("RPC.Walking"), TEXT("RPC.In"), Util::GetLocationName(&pPed->GetPosition()));
} }
size_t seconds = curTimer - startTime; size_t seconds = (curTimer - startTime) / 1000;
size_t minutes = (seconds / 60) % 60; size_t minutes = (seconds / 60) % 60;
size_t hours = (minutes / 60) % 60; size_t hours = (minutes / 60) % 60;
stateText = std::format(TEXT("RPC.PlayingFor"), hours, minutes, seconds); stateText = std::format(TEXT("RPC.PlayingFor"), hours, minutes, seconds);
if (BY_GAME(Util::IsOnMission(), false, false))
{
stateText = TEXT("RPC.DoingMission");
}
if (CheatMenu::IsMenuShown()) if (CheatMenu::IsMenuShown())
{ {
stateText = TEXT("RPC.BrowsingCheatMenu"); stateText = TEXT("RPC.BrowsingCheatMenu");
} }
if (BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive)) if (Command<Commands::IS_CHAR_DEAD>(CPools::GetPedRef(pPed)))
{ {
stateText = TEXT("RPC.InsideMenus"); stateText = TEXT("RPC.Wasted");
}
if (BY_GAME(pPed->m_nPedFlags.bIsBeingArrested, false, false))
{
stateText = TEXT("RPC.Busted");
} }
largeImgText = std::format("{}: {} / {} {}: {} / {}", TEXT("Player.Armour"), pPed->m_fArmour, BY_GAME(pInfo->m_nMaxArmour, pInfo->m_nMaxArmour, 100), TEXT("Player.Health"), pPed->m_fHealth, BY_GAME(pPed->m_fMaxHealth, 100, 100)); largeImgText = std::format("{}: {} / {} {}: {} / {}", TEXT("Player.Armour"), pPed->m_fArmour, BY_GAME(pInfo->m_nMaxArmour, pInfo->m_nMaxArmour, 100), TEXT("Player.Health"), int(pPed->m_fHealth), BY_GAME(int(pPed->m_fMaxHealth), 100, 100));
largeImg = std::format("{}{}", BY_GAME("sa", "vc", "3"), curImage); largeImg = std::format("{}{}", BY_GAME("sa", "vc", "3"), curImage);
discord::Activity activity{}; discord::Activity activity{};
@ -109,11 +114,11 @@ void RPC::Process()
}); });
pCore->RunCallbacks(); pCore->RunCallbacks();
if (curTimer - timer > 10000) if (curTimer - timer > 60000)
{ {
curImage++; curImage++;
if (curImage > totalLargeImages) if (curImage > 5) // Must upload images to discord servers
{ {
curImage = 1; curImage = 1;
} }

View File

@ -6,7 +6,6 @@ class RPC
private: private:
static inline discord::Core* pCore; static inline discord::Core* pCore;
static inline bool bInit = false; static inline bool bInit = false;
static inline size_t totalLargeImages = 5;
public: public:
RPC() = delete; RPC() = delete;

View File

@ -30,12 +30,16 @@ workspace "CheatMenu"
location "../build" location "../build"
targetdir "../build/bin" targetdir "../build/bin"
libdirs {
PSDK_DIR .. "/output/lib",
"../depend/lib"
}
links { links {
"d3d9", "d3d9",
"d3d11", "d3d11",
"Pdh", "Pdh",
"urlmon", "urlmon",
"depend",
"discord_game_sdk" "discord_game_sdk"
} }
@ -48,10 +52,6 @@ project "depend"
"../depend/**.c", "../depend/**.c",
"../depend/**.cpp" "../depend/**.cpp"
} }
libdirs {
PSDK_DIR .. "/output/lib",
"../depend/lib"
}
filter "configurations:Debug" filter "configurations:Debug"
defines { "DEBUG", "IS_PLATFORM_WIN" } defines { "DEBUG", "IS_PLATFORM_WIN" }
@ -109,7 +109,9 @@ project "CheatMenuIII"
"../src/filehandler.cpp", "../src/filehandler.cpp",
"../src/dllmain.cpp", "../src/dllmain.cpp",
"../src/locale.h", "../src/locale.h",
"../src/locale.cpp" "../src/locale.cpp",
"../src/rpc.h",
"../src/rpc.cpp"
} }
includedirs { includedirs {
PSDK_DIR .. "/plugin_III/", PSDK_DIR .. "/plugin_III/",
@ -192,7 +194,9 @@ project "CheatMenuVC"
"../src/hotkeys.cpp", "../src/hotkeys.cpp",
"../src/dllmain.cpp", "../src/dllmain.cpp",
"../src/locale.h", "../src/locale.h",
"../src/locale.cpp" "../src/locale.cpp",
"../src/rpc.h",
"../src/rpc.cpp"
} }
includedirs { includedirs {
PSDK_DIR .. "/plugin_vc/", PSDK_DIR .. "/plugin_vc/",