Rise
The Vieneo Province
Loading...
Searching...
No Matches
DiscordPresenceReferences.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdio>
4#include <string>
5#include <string_view>
6
7namespace RiseDiscord
8{
10 {
11 std::string_view imageKey;
12 const char* url;
13 };
14
15 inline const char* VehicleWikiUrl(std::string_view imageKey)
16 {
17 // Existing Discord artwork keys use the client's VehicleType slot numbers.
18 // Legacy Dasher/Steerhead pages redirect to the current model references.
19 static constexpr WikiReference references[] = {
20 { "type1", "https://www.risetvp.com/C-98_Construction_MuVER" },
21 { "type2", "https://www.risetvp.com/DIHV" },
22 { "type3", "https://www.risetvp.com/E-10_Saint" },
23 { "type4", "https://www.risetvp.com/P-13_Prowler" },
24 { "type5", "https://www.risetvp.com/A-4_Wanderer" },
25 { "type6", "https://www.risetvp.com/C-2A_Dasher" },
26 { "type7", "https://www.risetvp.com/T-121_Steerhead" },
27 { "type8", "https://www.risetvp.com/E-11_Saint" },
28 { "type21", "https://www.risetvp.com/C-2A_Dasher" },
29 { "type22", "https://www.risetvp.com/Mammoth" },
30 { "type24", "https://www.risetvp.com/W-6_Manx" },
31 { "type27", "https://www.risetvp.com/T-19_Stratomaster" },
32 { "type29", "https://www.risetvp.com/T-121_Steerhead" },
33 };
34 for (const auto& reference : references)
35 if (reference.imageKey == imageKey) return reference.url;
36 return nullptr;
37 }
38
39 inline const char* LocationWikiUrl(std::string_view imageKey)
40 {
41 static constexpr WikiReference references[] = {
42 { "deois", "https://www.risetvp.com/Category:Deois" },
43 { "o4", "https://www.risetvp.com/O-4" },
44 { "arcridge", "https://www.risetvp.com/Arcridge" },
45 { "mine", "https://www.risetvp.com/Category:Mining" },
46 { "township", "https://www.risetvp.com/Category:Township" },
47 { "farm", "https://www.risetvp.com/Category:Farming" },
48 { "estate", "https://www.risetvp.com/Estate" },
49 { "airfield", "https://www.risetvp.com/Category:Airfield" },
50 { "salvage", "https://www.risetvp.com/Category:Colonies" },
51 { "refinery", "https://www.risetvp.com/Category:Refinery" },
52 { "land", "https://www.risetvp.com/Assessor%27s_Parcel_Number" },
53 { "water", "https://www.risetvp.com/Assessor%27s_Parcel_Number" },
54 { "cpoc", "https://www.risetvp.com/CPOC" },
55 { "tac", "https://www.risetvp.com/TAC" },
56 { "ysp", "https://www.risetvp.com/YSP" },
57 { "apartment", "https://www.risetvp.com/Bradbury_Apartments" },
58 { "controltower", "https://www.risetvp.com/Control_Tower" },
59 { "hangar", "https://www.risetvp.com/Hangar" },
60 };
61 for (const auto& reference : references)
62 if (reference.imageKey == imageKey) return reference.url;
63 return nullptr;
64 }
65
66 inline std::string GroundParcelState(bool water, int plotU, int plotV, bool available)
67 {
68 const char* state = water ? "In the drink" : "On the ground";
69 // Use the same wrapped parcel offsets as the client map and Intermedia.
70 const int apnU = plotU + 3038, apnV = plotV + 2038;
71 if (!available || apnU < 0 || apnU > 9999 || apnV < 0 || apnV > 9999)
72 return state;
73 char text[80];
74 std::snprintf(text, sizeof text, "%s (APN %04i%04i)", state, apnU, apnV);
75 return text;
76 }
77}
const char * VehicleWikiUrl(std::string_view imageKey)
const char * LocationWikiUrl(std::string_view imageKey)
std::string GroundParcelState(bool water, int plotU, int plotV, bool available)