@@ -24,6 +24,8 @@ public partial class MainWindow : Window
2424 public string RiotPath = "Riot Client\\ RiotClientServices.exe" ;
2525 //Auth doesn't need to be updated
2626 public Auth auth ;
27+ public string mapName ;
28+ public string gameMode ;
2729
2830 //Does stuff that the async function didn't like
2931 public MainWindow ( )
@@ -48,8 +50,10 @@ private async void MainScript(object sender, RoutedEventArgs e)
4850
4951 //ValAPI.Net for documentation
5052 auth = Websocket . GetAuthLocal ( ) ;
51-
53+
5254 //Discord RPC Stuff
55+
56+ //rpcclient = new DiscordRpcClient("Application ID");
5357 rpcclient = new DiscordRpcClient ( ConfigurationManager . AppSettings . Get ( "DiscordKey" ) ) ;
5458 rpcclient . SkipIdenticalPresence = true ;
5559 rpcclient . RegisterUriScheme ( ) ;
@@ -72,7 +76,7 @@ await Task.Run(async () =>
7276 }
7377
7478 //Until break
75- while ( 1 == 1 )
79+ while ( true )
7680 {
7781 //ValAPI.Net
7882 UserPresence . Presence presence = UserPresence . GetPresence ( auth . subject ) ;
@@ -93,6 +97,9 @@ await Task.Run(async () =>
9397 //If party is open
9498 if ( presence != null && presence . privinfo . partyAccessibility == "OPEN" )
9599 {
100+ //Get match map and real mode from presence
101+ mapName = presence . privinfo . matchMap ;
102+ gameMode = presence . privinfo . queueId ;
96103 //If looking for match
97104 if ( presence . privinfo . partyState == "MATCHMAKING" )
98105 {
@@ -194,15 +201,18 @@ await Task.Run(async () =>
194201 }
195202 else
196203 {
204+ if ( mapName == null ) mapName = "/Game/Maps/Poveglia/Range" ;
205+ if ( presence . privinfo . provisioningFlow == "ShootingRange" ) gameMode = "Shooting Range" ;
206+
197207 //One size fits all in game presence
198208 rpcclient . SetPresence ( new RichPresence ( )
199209 {
200- Details = "Playing " + myTI . ToTitleCase ( presence . privinfo . queueId ) + " on " + GetMapName ( presence . privinfo . matchMap ) ,
210+ Details = "Playing " + myTI . ToTitleCase ( gameMode ) + " on " + GetMapName ( mapName ) ,
201211 State = presence . privinfo . partyOwnerMatchScoreAllyTeam + "-" + presence . privinfo . partyOwnerMatchScoreEnemyTeam ,
202212 Assets = new Assets ( )
203213 {
204- LargeImageKey = GetMapName ( presence . privinfo . matchMap ) . ToLower ( ) . Replace ( " " , "_" ) ,
205- LargeImageText = GetMapName ( presence . privinfo . matchMap )
214+ LargeImageKey = GetMapName ( mapName ) . ToLower ( ) . Replace ( " " , "_" ) ,
215+ LargeImageText = GetMapName ( mapName )
206216 } ,
207217 Party = new Party
208218 {
@@ -261,60 +271,69 @@ private void Rpcclient_OnJoin(object sender, DiscordRPC.Message.JoinMessage args
261271 //Should prob change to dictionary
262272 public string GetMapName ( string mapid )
263273 {
264- if ( mapid == "/Game/Maps/Ascent/Ascent" )
265- {
266- return "Ascent" ;
267- }
268- else if ( mapid == "/Game/Maps/Bonsai/Bonsai" )
274+ string displayName ;
275+ switch ( mapid )
269276 {
270- return "Split" ;
271- }
272- else if ( mapid == "/Game/Maps/Duality/Duality" )
273- {
274- return "Bind" ;
275- }
276- else if ( mapid == "/Game/Maps/Port/Port" )
277- {
278- return "Icebox" ;
279- }
280- else if ( mapid == "/Game/Maps/Triad/Triad" )
281- {
282- return "Haven" ;
283- }
284- else if ( mapid == "/Game/Maps/Foxtrot/Foxtrot" )
285- {
286- return "Breeze" ;
287- }
288- else if ( mapid == "/Game/Maps/Canyon/Canyon" )
289- {
290- return "Fracture" ;
277+ case "/Game/Maps/Ascent/Ascent" :
278+ displayName = "Ascent" ;
279+ break ;
280+ case "/Game/Maps/Bonsai/Bonsai" :
281+ displayName = "Split" ;
282+ break ;
283+ case "/Game/Maps/Duality/Duality" :
284+ displayName = "Bind" ;
285+ break ;
286+ case "/Game/Maps/Port/Port" :
287+ displayName = "Icebox" ;
288+ break ;
289+ case "/Game/Maps/Triad/Triad" :
290+ displayName = "Haven" ;
291+ break ;
292+ case "/Game/Maps/Foxtrot/Foxtrot" :
293+ displayName = "Breeze" ;
294+ break ;
295+ case "/Game/Maps/Canyon/Canyon" :
296+ displayName = "Fracture" ;
297+ break ;
298+ case "/Game/Maps/Poveglia/Range" :
299+ displayName = "The Range" ;
300+ break ;
301+ default :
302+ displayName = "Unknown Map" ;
303+ break ;
291304 }
292- return null ;
305+ return displayName ;
293306 }
294307 //Same as above
295308 public static string GetModeName ( string mode )
296309 {
297- if ( mode == "/Game/GameModes/Bomb/BombGameMode.BombGameMode_C" )
298- {
299- return "Standard" ;
300- }
301- else if ( mode == "/Game/GameModes/Deathmatch/DeathmatchGameMode.DeathmatchGameMode_C" )
302- {
303- return "Deathmatch" ;
304- }
305- else if ( mode == "/Game/GameModes/GunGame/GunGameTeamsGameMode.GunGameTeamsGameMode_C" )
306- {
307- return "Escalation" ;
308- }
309- else if ( mode == "/Game/GameModes/OneForAll/OneForAll_GameMode.OneForAll_GameMode_C" )
310+ string displayName ;
311+ switch ( mode )
310312 {
311- return "Replication" ;
312- }
313- else if ( mode == "/Game/GameModes/QuickBomb/QuickBombGameMode.QuickBombGameMode_C" )
314- {
315- return "Spike Rush" ;
313+ case "/Game/GameModes/Bomb/BombGameMode.BombGameMode_C" :
314+ displayName = "Standard" ;
315+ break ;
316+ case "/Game/GameModes/Deathmatch/DeathmatchGameMode.DeathmatchGameMode_C" :
317+ displayName = "Deathmatch" ;
318+ break ;
319+ case "/Game/GameModes/GunGame/GunGameTeamsGameMode.GunGameTeamsGameMode_C" :
320+ displayName = "Escalation" ;
321+ break ;
322+ case "/Game/GameModes/OneForAll/OneForAll_GameMode.OneForAll_GameMode_C" :
323+ displayName = "Replication" ;
324+ break ;
325+ case "/Game/GameModes/QuickBomb/QuickBombGameMode.QuickBombGameMode_C" :
326+ displayName = "Spike Rush" ;
327+ break ;
328+ case "/Game/GameModes/ShootingRange/ShootingRangeGameMode.ShootingRangeGameMode_C" :
329+ displayName = "Shooting Range" ;
330+ break ;
331+ default :
332+ displayName = "Unknown Mode" ;
333+ break ;
316334 }
317- return null ;
335+ return displayName ;
336+
318337 }
319338 //Stops the rpc, removes the icon, and shuts down
320339 public void Quit ( )
0 commit comments