Skip to content
This repository was archived by the owner on Oct 15, 2020. It is now read-only.

Commit d2a2678

Browse files
committed
Add "show/hide_player_info" message settings.
1 parent 5630785 commit d2a2678

File tree

3 files changed

+46
-6
lines changed

3 files changed

+46
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# StreamGraphicsGSI-RL
22

3-
Version: 1.3.1
3+
Version: 1.4.0
44

55
Orignal coded based on [diogotr7/AuroraGSI-RocketLeague](https://github.com/diogotr7/AuroraGSI-RocketLeague).
66

StreamGraphicsGSI-RL/StreamGraphicsGSI.cpp

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@
44
#include <sstream>
55
#include <iomanip>
66

7-
BAKKESMOD_PLUGIN(StreamGraphicsGSI, "StreamGraphicsGSI", "1.3.1", PLUGINTYPE_THREADED)
7+
BAKKESMOD_PLUGIN(StreamGraphicsGSI, "StreamGraphicsGSI", "1.4.0", PLUGINTYPE_THREADED)
88

99
using placeholders::_1;
1010

1111
const float COLOR_DARKEN = 0.75;
12+
bool PLAYER_INFO_DISPLAY_STATE = false;
1213

1314
#pragma region Plugin Methods
1415
void StreamGraphicsGSI::onLoad()
1516
{
16-
cvarManager->registerCvar("streamgraphics_gsi_url", "http://192.168.1.70:8000/api/v1/set_multiple_for_path_and_flatten/data/com/rocketleague/gsi", "HTTP server url to send the JSON post to.", true, false, 0, false, 0, true);
17+
cvarManager->registerCvar("streamgraphics_gsi_url", "http://192.168.1.70:8000/api/v1/", "Base HTTP server url.", true, false, 0, false, 0, true);
18+
cvarManager->registerCvar("streamgraphics_gsi_url_data", "set_multiple_for_path_and_flatten/data/com/rocketleague/gsi", "HTTP server url to send the JSON data to.", true, false, 0, false, 0, true);
19+
cvarManager->registerCvar("streamgraphics_gsi_url_show_player_info", "easy_set/overlay/rocketleague-gsi-spec-info/display/fade-in", "HTTP server url to run show-player-info.", true, false, 0, false, 0, true);
20+
cvarManager->registerCvar("streamgraphics_gsi_url_hide_player_info", "easy_set/overlay/rocketleague-gsi-spec-info/display/fade-out", "HTTP server url to run hide-player-info.", true, false, 0, false, 0, true);
1721

1822
this->gameWrapper->HookEventPost("Function GameEvent_Soccar_TA.ReplayPlayback.BeginState", std::bind(&StreamGraphicsGSI::ReplayStartEvent, this, _1));
1923
this->gameWrapper->HookEventPost("Function GameEvent_Soccar_TA.ReplayPlayback.EndState", std::bind(&StreamGraphicsGSI::ReplayEndEvent, this, _1));
@@ -43,11 +47,33 @@ void StreamGraphicsGSI::StartLoop() {
4347
void StreamGraphicsGSI::SendToStreamGraphics(std::string data)
4448
{
4549
try {
46-
http::Request request(cvarManager->getCvar("streamgraphics_gsi_url").getStringValue());
50+
http::Request request(cvarManager->getCvar("streamgraphics_gsi_url").getStringValue() + cvarManager->getCvar("streamgraphics_gsi_url_data").getStringValue());
4751
(void)request.send("POST", data, { "Content-Type: application/json" });
4852
}
4953
catch (...) {
50-
cvarManager->log("Failed GSI HTTP POST: Please reload the plugin to try again. Using URL - " + cvarManager->getCvar("streamgraphics_gsi_url").getStringValue());
54+
cvarManager->log("Failed GSI HTTP POST: Please reload the plugin to try again. Using URL - " + cvarManager->getCvar("streamgraphics_gsi_url").getStringValue() + cvarManager->getCvar("streamgraphics_gsi_url_data").getStringValue());
55+
ok = false;
56+
}
57+
}
58+
void StreamGraphicsGSI::ShowPlayerInfo()
59+
{
60+
try {
61+
http::Request request(cvarManager->getCvar("streamgraphics_gsi_url").getStringValue() + cvarManager->getCvar("streamgraphics_gsi_url_show_player_info").getStringValue());
62+
(void)request.send("POST");
63+
}
64+
catch (...) {
65+
cvarManager->log("Failed GSI HTTP POST (show-player-info): Please reload the plugin to try again. Using URL - " + cvarManager->getCvar("streamgraphics_gsi_url").getStringValue() + cvarManager->getCvar("streamgraphics_gsi_url_show_player_info").getStringValue());
66+
ok = false;
67+
}
68+
}
69+
void StreamGraphicsGSI::HidePlayerInfo()
70+
{
71+
try {
72+
http::Request request(cvarManager->getCvar("streamgraphics_gsi_url").getStringValue() + cvarManager->getCvar("streamgraphics_gsi_url_hide_player_info").getStringValue());
73+
(void)request.send("POST");
74+
}
75+
catch (...) {
76+
cvarManager->log("Failed GSI HTTP POST (show-player-info): Please reload the plugin to try again. Using URL - " + cvarManager->getCvar("streamgraphics_gsi_url").getStringValue() + cvarManager->getCvar("streamgraphics_gsi_url_hide_player_info").getStringValue());
5177
ok = false;
5278
}
5379
}
@@ -272,6 +298,10 @@ void StreamGraphicsGSI::UpdateState(ServerWrapper wrapper) {
272298

273299
GameState.CurrentSpec.CurrentBoostAmount = boost;
274300

301+
if (!GameState.IsSpectatingPlayerPOV && !GameState.InReplayMode) {
302+
ShowPlayerInfo();
303+
}
304+
275305
GameState.IsSpectatingPlayerPOV = true;
276306
}
277307
else {
@@ -294,6 +324,10 @@ void StreamGraphicsGSI::UpdateState(ServerWrapper wrapper) {
294324

295325
GameState.CurrentSpec.CurrentBoostAmount = 0;
296326

327+
if (GameState.IsSpectatingPlayerPOV || GameState.InReplayMode) {
328+
HidePlayerInfo();
329+
}
330+
297331
GameState.IsSpectatingPlayerPOV = false;
298332
}
299333
}
@@ -373,6 +407,10 @@ void StreamGraphicsGSI::UpdateState(ServerWrapper wrapper) {
373407

374408
void StreamGraphicsGSI::ResetStates()
375409
{
410+
if (GameState.IsSpectatingPlayerPOV || GameState.InReplayMode) {
411+
HidePlayerInfo();
412+
}
413+
376414
GameState.Status = GameStatus::Menu;
377415

378416
GameState.Match.Playlist = -1;
@@ -389,7 +427,7 @@ void StreamGraphicsGSI::ResetStates()
389427
GameState.Match.Teams[0].TeamBoost = 0.0;
390428
GameState.Match.Teams[0].Name = "";
391429
GameState.Match.Teams[0].ColorHex = "#1A1A1A";
392-
GameState.Match.Teams[1].ColorDarkHex = "#000000";
430+
GameState.Match.Teams[0].ColorDarkHex = "#000000";
393431

394432
GameState.Match.Teams[1].Index = 1;
395433
GameState.Match.Teams[1].PlayerCount = 0;

StreamGraphicsGSI-RL/StreamGraphicsGSI.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class StreamGraphicsGSI : public BakkesMod::Plugin::BakkesModPlugin
1919
#pragma region StreamGraphics
2020
void StartLoop();
2121
void SendToStreamGraphics(std::string);
22+
void ShowPlayerInfo();
23+
void HidePlayerInfo();
2224
#pragma endregion
2325

2426
#pragma region Events

0 commit comments

Comments
 (0)