From d413906cd72c5a901bd6bf5ab59ff21ec3c5ec47 Mon Sep 17 00:00:00 2001 From: thepercentageguy Date: Mon, 27 Jun 2022 20:20:13 +0200 Subject: [PATCH] i finally got around to adding RPC, also gf fix --- source/engine/io/Discord.hx | 8 +++----- source/states/gameplay/PlayState.hx | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/source/engine/io/Discord.hx b/source/engine/io/Discord.hx index 019a937a9b..fe2a701548 100644 --- a/source/engine/io/Discord.hx +++ b/source/engine/io/Discord.hx @@ -14,7 +14,7 @@ class DiscordClient #if cpp trace("Discord Client starting..."); DiscordRpc.start({ - clientID: "814588678700924999", + clientID: "991042339101347860", onReady: onReady, onError: onError, onDisconnected: onDisconnected @@ -76,9 +76,8 @@ class DiscordClient #end } - public static function changePresence(details:String, state:Null, ?smallImageKey : String, ?hasStartTimestamp : Bool, ?endTimestamp: Float) + public static function changePresence(details:String, state:Null, ?hasStartTimestamp : Bool, ?endTimestamp: Float) { - #if var startTimestamp:Float = if(hasStartTimestamp) Date.now().getTime() else 0; if (endTimestamp > 0) @@ -91,13 +90,12 @@ class DiscordClient state: state, largeImageKey: 'icon', largeImageText: "Friday Night Funkin'", - smallImageKey : smallImageKey, + // smallImageKey : smallImageKey, // Obtained times are in milliseconds so they are divided so Discord can use it startTimestamp : Std.int(startTimestamp / 1000), endTimestamp : Std.int(endTimestamp / 1000) }); //trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); - #end } } diff --git a/source/states/gameplay/PlayState.hx b/source/states/gameplay/PlayState.hx index b340b4fd6c..0a0c6ff725 100644 --- a/source/states/gameplay/PlayState.hx +++ b/source/states/gameplay/PlayState.hx @@ -77,6 +77,7 @@ class PlayState extends MusicBeatState public static var curStage:String = ''; public static var SONG:SwagSong; public static var isStoryMode:Bool = false; + public static var isModded:Bool = false; public static var storyWeek:Int = 0; public static var storyPlaylist:Array = []; public static var storyDifficulty:Int = 1; @@ -289,7 +290,7 @@ class PlayState extends MusicBeatState detailsPausedText = "Paused - " + detailsText; // Updating Discord Rich Presence. - DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")"); #end switch (SONG.song.toLowerCase()) @@ -651,7 +652,7 @@ class PlayState extends MusicBeatState if (curStage == 'limo') gfVersion = 'gf-car'; - if (SONG.gf != null || SONG.gf != "") + if (SONG.gf.length > 0) gfVersion = SONG.gf; gf = new Character(400, 130, gfVersion); @@ -1171,7 +1172,7 @@ class PlayState extends MusicBeatState songLength = FlxG.sound.music.length; // Updating Discord Rich Presence (with Time Left) - DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength); + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", true, songLength); #end } @@ -1443,11 +1444,11 @@ class PlayState extends MusicBeatState #if desktop if (startTimer.finished) { - DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition); + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", true, songLength - Conductor.songPosition); } else { - DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")"); } #end } @@ -1462,11 +1463,11 @@ class PlayState extends MusicBeatState { if (Conductor.songPosition > 0.0) { - DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition); + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", true, songLength - Conductor.songPosition); } else { - DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")"); } } #end @@ -1479,7 +1480,7 @@ class PlayState extends MusicBeatState #if desktop if (health > 0 && !paused) { - DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")"); } #end @@ -1572,7 +1573,7 @@ class PlayState extends MusicBeatState openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); #if desktop - DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")"); #end } @@ -1581,7 +1582,7 @@ class PlayState extends MusicBeatState FlxG.switchState(new ChartingState()); #if desktop - DiscordClient.changePresence("Chart Editor", null, null, true); + DiscordClient.changePresence("Chart Editor", null, null); #end } @@ -1786,7 +1787,7 @@ class PlayState extends MusicBeatState #if desktop // Game Over doesn't get his own variable because it's only used here - DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")"); #end }