Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discord RPC tweaks (from nightly feedback) #3205

Closed
wants to merge 26 commits into from

Conversation

Lpsd
Copy link
Member

@Lpsd Lpsd commented Oct 12, 2023

  • Added server name to the default presence details
  • Fixed a couple of cases where the presence wouldn't display properly (or at all)
    • When disconnecting from a server
    • When enabling rich presence in MTA settings
  • Added the following functions:
    • bool setDiscordRichPresenceStartTime(int seconds)
    • bool setDiscordRichPresenceEndTime(int seconds)
    • bool setDiscordRichPresencePartySize(int size, int max)
  • Added some default states when roaming around San Andreas. These are updated every 15 seconds:
    • On foot: Walking around <zone name>
    • In vehicle (prefixes): <prefix> <zone name> - e.g: Flying around Los Santos
    • Dead: In a ditch, En-route to hospital, Meeting their maker, Regretting their decisions, Wasted
    • Many more states based on player task, see
      static const std::multimap<eTaskType, STaskState> g_playerTaskStates{
      {TASK_COMPLEX_JUMP, {true, "Climbing around in", TASK_SIMPLE_CLIMB}},
      {TASK_SIMPLE_GANG_DRIVEBY, {true, "Doing a drive-by in"}},
      {TASK_SIMPLE_DRIVEBY_SHOOT, {true, "Doing a drive-by in"}},
      {TASK_SIMPLE_DIE, {false, "Blub blub...", TASK_SIMPLE_DROWN}},
      {TASK_SIMPLE_DIE, {false, "Breathing water", TASK_SIMPLE_DROWN}},
      {TASK_SIMPLE_DIE, {true, "Drowning in", TASK_SIMPLE_DROWN}},
      {TASK_SIMPLE_PLAYER_ON_FOOT, {true, "Ducking for cover in", {}, TASK_SIMPLE_DUCK, TASK_SECONDARY_DUCK}},
      {TASK_SIMPLE_PLAYER_ON_FOOT, {true, "Fighting in", {}, TASK_SIMPLE_FIGHT, TASK_SECONDARY_ATTACK}},
      {TASK_SIMPLE_PLAYER_ON_FOOT, {true, "Throwing fists in", {}, TASK_SIMPLE_FIGHT, TASK_SECONDARY_ATTACK}},
      {TASK_SIMPLE_PLAYER_ON_FOOT, {true, "Blastin' fools in", {}, TASK_SIMPLE_USE_GUN, TASK_SECONDARY_ATTACK}},
      {TASK_SIMPLE_PLAYER_ON_FOOT, {true, "Shooting up", {}, TASK_SIMPLE_USE_GUN, TASK_SECONDARY_ATTACK}},
      {TASK_SIMPLE_JETPACK, {true, "Jetpacking in"}},
      {TASK_SIMPLE_PLAYER_ON_FOOT, {true, "Literally on fire in", {}, TASK_SIMPLE_PLAYER_ON_FIRE, TASK_SECONDARY_PARTIAL_ANIM}},
      {TASK_SIMPLE_PLAYER_ON_FOOT, {true, "Burning up in", {}, TASK_SIMPLE_PLAYER_ON_FIRE, TASK_SECONDARY_PARTIAL_ANIM}},
      {TASK_COMPLEX_IN_WATER, {true, "Swimming in", TASK_SIMPLE_SWIM}},
      {TASK_COMPLEX_IN_WATER, {true, "Floating around in", TASK_SIMPLE_SWIM}},
      {TASK_COMPLEX_IN_WATER, {false, "Being chased by a shark", TASK_SIMPLE_SWIM}},
      {TASK_SIMPLE_CHOKING, {true, "Choking to death in"}},
  • Allow state, details, assets and button functions to be passed an empty string in order to reset to defaults.

Easter egg: when zone name is "Unknown" (out of normal SA bounds) it will show as Area 51 馃懡

image

@Fernando-A-Rocha
Copy link
Contributor

Very creative with the unique default states! Good job

Client/core/CCore.h Outdated Show resolved Hide resolved
Client/core/CCore.h Outdated Show resolved Hide resolved
Client/core/CDiscordRichPresence.cpp Outdated Show resolved Hide resolved
Client/core/CDiscordRichPresence.cpp Outdated Show resolved Hide resolved
Client/core/CDiscordRichPresence.cpp Outdated Show resolved Hide resolved
Client/core/CDiscordRichPresence.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
Client/mods/deathmatch/logic/CClientGame.cpp Outdated Show resolved Hide resolved
}

zoneName = (zoneName == "Unknown") ? "Area 51" : zoneName;
discordState = useZoneName ? SString(std::string(discordState + " %s").c_str(), zoneName.c_str()) : discordState;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to append a zone name

if (useZoneName)
    discordState.append(" " + zoneName);

{
std::srand(GetTickCount64_());
int index = (std::rand() % stateCount);
auto taskState = taskStates[index];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use a reference here to avoid unnecessary STaskState struct copy.

@tederis
Copy link
Collaborator

tederis commented Oct 23, 2023

This PR is no more relevant due to #3216.

Dutchman101 pushed a commit that referenced this pull request Oct 24, 2023
The changelog of this can be found in #3205 (as #3216 is the successor of #3205 and a near-copy). It was done this way because the #3205's author is on vacation, and we had pending code review changes to make.
@Dutchman101
Copy link
Member

Closed by ef26810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants