Skip to content

Commit 414d4c4

Browse files
authored
Merge pull request #1 from weedeej/master
Added Shooting Range and UAC for starting Valorant.
2 parents 06640d0 + 8c3b849 commit 414d4c4

2 files changed

Lines changed: 120 additions & 51 deletions

File tree

ValorantStatus/MainWindow.xaml.cs

Lines changed: 70 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -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()

ValorantStatus/app.manifest

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<!-- UAC Manifest Options
8+
If you want to change the Windows User Account Control level replace the
9+
requestedExecutionLevel node with one of the following.
10+
11+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
12+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
13+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
14+
15+
Specifying requestedExecutionLevel element will disable file and registry virtualization.
16+
Remove this element if your application requires this virtualization for backwards
17+
compatibility.
18+
19+
`p.Start();` on MainWindow.xaml.cs:43 requires elevation.
20+
-->
21+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
22+
</requestedPrivileges>
23+
</security>
24+
</trustInfo>
25+
26+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
27+
<application>
28+
<!-- A list of the Windows versions that this application has been tested on
29+
and is designed to work with. Uncomment the appropriate elements
30+
and Windows will automatically select the most compatible environment.
31+
Uncomment if Tested.-->
32+
33+
<!-- Windows Vista -->
34+
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
35+
36+
<!-- Windows 7 -->
37+
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
38+
39+
<!-- Windows 8 -->
40+
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
41+
42+
<!-- Windows 8.1 -->
43+
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
44+
45+
<!-- Windows 10 -->
46+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
47+
48+
</application>
49+
</compatibility>
50+
</assembly>

0 commit comments

Comments
 (0)