forked from etternagame/etterna
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tiny discord rpc fixes etternagame#1122
- Loading branch information
Showing
8 changed files
with
67 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
-- like the 8th utility file | ||
|
||
-- update discord rpc for eval and gameplay | ||
function updateDiscordStatus(inEvaluation) | ||
local profile = GetPlayerOrMachineProfile(PLAYER_1) | ||
local song = GAMESTATE:GetCurrentSong() | ||
local steps = GAMESTATE:GetCurrentSteps() | ||
-- Discord thingies | ||
local largeImageTooltip = string.format( | ||
"%s: %5.2f", | ||
profile:GetDisplayName(), | ||
profile:GetPlayerRating() | ||
) | ||
local mode = GAMESTATE:GetGameplayMode() | ||
local detail = string.format( | ||
"%s: %s [%s]", | ||
song:GetDisplayMainTitle(), | ||
string.gsub(getCurRateDisplayString(), "Music", ""), | ||
song:GetGroupName() | ||
) | ||
if mode == "GameplayMode_Replay" then | ||
detail = "Replaying: "..detail | ||
elseif mode == "GameplayMode_Practice" then | ||
detail = "Practicing: "..detail | ||
end | ||
-- truncated to 128 characters(discord hard limit) | ||
detail = #detail < 128 and detail or string.sub(detail, 1, 124) .. "..." | ||
local state = string.format( | ||
"MSD: %05.2f", | ||
steps:GetMSD(getCurRateValue(), 1) | ||
) | ||
local endTime = 0 | ||
if inEvaluation then | ||
local score = SCOREMAN:GetMostRecentScore() | ||
if not score then | ||
score = SCOREMAN:GetTempReplayScore() | ||
end | ||
|
||
state = string.format( | ||
"%s - %05.2f%% %s", | ||
state, | ||
notShit.floor(score:GetWifeScore() * 10000) / 100, | ||
THEME:GetString("Grade", ToEnumShortString(score:GetWifeGrade())) | ||
) | ||
else | ||
endTime = os.time() + GetPlayableTime() | ||
end | ||
|
||
GAMESTATE:UpdateDiscordPresence(largeImageTooltip, detail, state, endTime) | ||
end | ||
|
||
-- update discord rpc for ingame menus | ||
function updateDiscordStatusForMenus() | ||
local profile = GetPlayerOrMachineProfile(PLAYER_1) | ||
local detail = string.format( | ||
"%s: %5.2f", | ||
profile:GetDisplayName(), | ||
profile:GetPlayerRating() | ||
) | ||
GAMESTATE:UpdateDiscordMenu(detail) | ||
end |