Skip to content

Commit

Permalink
Migrate + Scoreboard + Logo button + Add cvar toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Arubinu committed Apr 12, 2022
1 parent d203700 commit f372626
Show file tree
Hide file tree
Showing 10 changed files with 400 additions and 246 deletions.
202 changes: 104 additions & 98 deletions RocketStats/Languages.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,111 +6,117 @@
#define LANG_DOCUMENTATION 3
#define LANG_DEVELOPERS 4

#define LANG_RESET_TOOLTIP 5
#define LANG_SCALE_TOOLTIP 6
#define LANG_ROTATE_TOOLTIP 7
#define LANG_OPACITY_TOOLTIP 8
#define LANG_OVERLAY_TOOLTIP 9
#define LANG_SELECT_ALL_TOOLTIP 10
#define LANG_MIGRATE_MESSAGE 5
#define LANG_MIGRATE_BUTTON_MIGRATE 6
#define LANG_MIGRATE_BUTTON_REMOVE 7
#define LANG_MIGRATE_BUTTON_NOTHING 8

#define LANG_TOGGLE_LOGO_HELP 11
#define LANG_TOGGLE_MENU 12
#define LANG_TOGGLE_MENU_HELP 13
#define LANG_TOGGLE_MENU_TOOLTIP 14
#define LANG_RESET_TOOLTIP 9
#define LANG_SCALE_TOOLTIP 10
#define LANG_ROTATE_TOOLTIP 11
#define LANG_OPACITY_TOOLTIP 12
#define LANG_OVERLAY_TOOLTIP 13
#define LANG_SELECT_ALL_TOOLTIP 14

#define LANG_MODE 15
#define LANG_MODE_TOOLTIP 16
#define LANG_MODE_SESSION 17
#define LANG_MODE_GAMEMODE 18
#define LANG_MODE_ALWAYS 19
#define LANG_MODE_ALWAYS_GAMEMODE 20
#define LANG_THEME 21
#define LANG_THEME_TOOLTIP 22
#define LANG_X 23
#define LANG_X_TOOLTIP 24
#define LANG_Y 25
#define LANG_Y_TOOLTIP 26
#define LANG_SCALE 27
#define LANG_ROTATE 28
#define LANG_OPACITY 29
#define LANG_TOGGLE_LOGO_HELP 15
#define LANG_TOGGLE_MENU 16
#define LANG_TOGGLE_MENU_HELP 17
#define LANG_TOGGLE_MENU_TOOLTIP 18

#define LANG_OVERLAY 30
#define LANG_OVERLAY_OBS 31
#define LANG_OVERLAY_MOVE 32
#define LANG_MODE 19
#define LANG_MODE_TOOLTIP 20
#define LANG_MODE_SESSION 21
#define LANG_MODE_GAMEMODE 22
#define LANG_MODE_ALWAYS 23
#define LANG_MODE_ALWAYS_GAMEMODE 24
#define LANG_THEME 25
#define LANG_THEME_TOOLTIP 26
#define LANG_X 27
#define LANG_X_TOOLTIP 28
#define LANG_Y 29
#define LANG_Y_TOOLTIP 30
#define LANG_SCALE 31
#define LANG_ROTATE 32
#define LANG_OPACITY 33

#define LANG_OPEN_FOLDER 33
#define LANG_OPEN_FOLDER_TOOLTIP 34
#define LANG_RELOAD_THEME 35
#define LANG_RELOAD_THEME_TOOLTIP 36
#define LANG_RELOAD_THEME_A 37
#define LANG_RELOAD_THEME_A_TOOLTIP 38
#define LANG_RESET_STATS 39
#define LANG_RESET_STATS_TOOLTIP 40
#define LANG_OVERLAY 34
#define LANG_OVERLAY_OBS 35
#define LANG_OVERLAY_MOVE 36

#define LANG_THEME_BY 41
#define LANG_OPEN_FOLDER 37
#define LANG_OPEN_FOLDER_TOOLTIP 38
#define LANG_RELOAD_THEME 39
#define LANG_RELOAD_THEME_TOOLTIP 40
#define LANG_RELOAD_THEME_A 41
#define LANG_RELOAD_THEME_A_TOOLTIP 42
#define LANG_RESET_STATS 43
#define LANG_RESET_STATS_TOOLTIP 44

#define LANG_SHOW_IN_MENU 42
#define LANG_SHOW_IN_GAME 43
#define LANG_FLOATING_POINT 44
#define LANG_PREVIEW_RANK 45
#define LANG_ROMAN_NUMBERS 46
#define LANG_MMR_TO_MMRCHANGE 47
#define LANG_MMRCHANGE_TO_MMR 48
#define LANG_THEME_BY 45

#define LANG_IN_FILE 49
#define LANG_IN_FILE_TOOLTIP 50
#define LANG_SHOW_IN_MENU 46
#define LANG_SHOW_IN_GAME 47
#define LANG_SHOW_IN_SCOREBOARD 48
#define LANG_FLOATING_POINT 49
#define LANG_PREVIEW_RANK 50
#define LANG_ROMAN_NUMBERS 51
#define LANG_MMR_TO_MMRCHANGE 52
#define LANG_MMRCHANGE_TO_MMR 53

#define LANG_GAMEMODE 51
#define LANG_RANK 52
#define LANG_DIVISION 53
#define LANG_MMR 54
#define LANG_MMRCHANGE 55
#define LANG_MMRCUMULCHANGE 56
#define LANG_WINS 57
#define LANG_LOSSES 58
#define LANG_STREAKS 59
#define LANG_WINRATIO 60
#define LANG_DEMOLITIONS 61
#define LANG_DEMOLITIONSMATCH 62
#define LANG_DEMOLITIONSCUMUL 63
#define LANG_DEATH 64
#define LANG_DEATHMATCH 65
#define LANG_DEATHCUMUL 66
#define LANG_BOOST 67
#define LANG_IN_FILE 54
#define LANG_IN_FILE_TOOLTIP 55

#define LANG_FILE_TITLE 68
#define LANG_FILE_GAMEMODE 69
#define LANG_FILE_RANK 70
#define LANG_FILE_DIVISION 71
#define LANG_FILE_MMR 72
#define LANG_FILE_MMRCHANGE 73
#define LANG_FILE_MMRCUMULCHANGE 74
#define LANG_FILE_WINS 75
#define LANG_FILE_LOSSES 76
#define LANG_FILE_STREAKS 77
#define LANG_FILE_WINRATIO 78
#define LANG_FILE_DEMOLITIONS 79
#define LANG_FILE_DEMOLITIONSMATCH 80
#define LANG_FILE_DEMOLITIONSCUMUL 81
#define LANG_FILE_DEATH 82
#define LANG_FILE_DEATHMATCH 83
#define LANG_FILE_DEATHCUMUL 84
#define LANG_FILE_BOOST 85
#define LANG_GAMEMODE 56
#define LANG_RANK 57
#define LANG_DIVISION 58
#define LANG_MMR 59
#define LANG_MMRCHANGE 60
#define LANG_MMRCUMULCHANGE 61
#define LANG_WINS 62
#define LANG_LOSSES 63
#define LANG_STREAKS 64
#define LANG_WINRATIO 65
#define LANG_DEMOLITIONS 66
#define LANG_DEMOLITIONSMATCH 67
#define LANG_DEMOLITIONSCUMUL 68
#define LANG_DEATH 69
#define LANG_DEATHMATCH 70
#define LANG_DEATHCUMUL 71
#define LANG_BOOST 72

#define LANG_HIDE_TITLE 86
#define LANG_HIDE_GAMEMODE 87
#define LANG_HIDE_RANK 88
#define LANG_HIDE_DIVISION 89
#define LANG_HIDE_MMR 90
#define LANG_HIDE_MMRCHANGE 91
#define LANG_HIDE_MMRCUMULCHANGE 92
#define LANG_HIDE_WINS 93
#define LANG_HIDE_LOSSES 94
#define LANG_HIDE_STREAKS 95
#define LANG_HIDE_WINRATIO 96
#define LANG_HIDE_DEMOLITIONS 97
#define LANG_HIDE_DEMOLITIONSMATCH 98
#define LANG_HIDE_DEMOLITIONSCUMUL 99
#define LANG_HIDE_DEATH 100
#define LANG_HIDE_DEATHMATCH 101
#define LANG_HIDE_DEATHCUMUL 102
#define LANG_FILE_TITLE 73
#define LANG_FILE_GAMEMODE 74
#define LANG_FILE_RANK 75
#define LANG_FILE_DIVISION 76
#define LANG_FILE_MMR 77
#define LANG_FILE_MMRCHANGE 78
#define LANG_FILE_MMRCUMULCHANGE 79
#define LANG_FILE_WINS 80
#define LANG_FILE_LOSSES 81
#define LANG_FILE_STREAKS 82
#define LANG_FILE_WINRATIO 83
#define LANG_FILE_DEMOLITIONS 84
#define LANG_FILE_DEMOLITIONSMATCH 85
#define LANG_FILE_DEMOLITIONSCUMUL 86
#define LANG_FILE_DEATH 87
#define LANG_FILE_DEATHMATCH 88
#define LANG_FILE_DEATHCUMUL 89
#define LANG_FILE_BOOST 90

#define LANG_HIDE_TITLE 91
#define LANG_HIDE_GAMEMODE 92
#define LANG_HIDE_RANK 93
#define LANG_HIDE_DIVISION 94
#define LANG_HIDE_MMR 95
#define LANG_HIDE_MMRCHANGE 96
#define LANG_HIDE_MMRCUMULCHANGE 97
#define LANG_HIDE_WINS 98
#define LANG_HIDE_LOSSES 99
#define LANG_HIDE_STREAKS 100
#define LANG_HIDE_WINRATIO 101
#define LANG_HIDE_DEMOLITIONS 102
#define LANG_HIDE_DEMOLITIONSMATCH 103
#define LANG_HIDE_DEMOLITIONSCUMUL 104
#define LANG_HIDE_DEATH 105
#define LANG_HIDE_DEATHMATCH 106
#define LANG_HIDE_DEATHCUMUL 107
25 changes: 24 additions & 1 deletion RocketStats/Managements/FileManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,26 @@ bool RocketStats::WriteResInFile(std::string _filename, int id, const char* type
return false;
}

void RocketStats::MigrateFolder()
{
// If the old folder exist, copy everything to the new path
if (ExistsPath("RocketStats", true))
{
std::string old_path = GetPath("RocketStats", true);
fs::copy(old_path, GetPath(), (fs::copy_options::recursive | fs::copy_options::update_existing));
MigrateRemove();
}
}

void RocketStats::MigrateRemove()
{
if (ExistsPath("RocketStats", true))
fs::remove_all(GetPath("RocketStats", true));

RemoveFile("RocketStats_Loose.txt"); // Delete the old file
RemoveFile("RocketStats_images/BoostState.txt"); // Delete the old file
}

void RocketStats::UpdateFiles(bool force)
{
WriteGameMode(force);
Expand Down Expand Up @@ -205,6 +225,8 @@ bool RocketStats::ReadConfig()
rs_enable_inmenu = config["settings"]["inmenu"];
if (config["settings"]["ingame"].is_boolean())
rs_enable_ingame = config["settings"]["ingame"];
if (config["settings"]["inscoreboard"].is_boolean())
rs_enable_inscoreboard = config["settings"]["inscoreboard"];
if (config["settings"]["float"].is_boolean())
rs_enable_float = config["settings"]["float"];
if (config["settings"]["preview"].is_boolean())
Expand Down Expand Up @@ -394,6 +416,7 @@ void RocketStats::WriteConfig()
tmp["settings"]["overlay"] = rs_disp_overlay;
tmp["settings"]["inmenu"] = rs_enable_inmenu;
tmp["settings"]["ingame"] = rs_enable_ingame;
tmp["settings"]["inscoreboard"] = rs_enable_inscoreboard;
tmp["settings"]["float"] = rs_enable_float;
tmp["settings"]["preview"] = rs_preview_rank;
tmp["settings"]["roman"] = rs_roman_numbers;
Expand Down Expand Up @@ -648,5 +671,5 @@ void RocketStats::WriteDeath(bool force)
void RocketStats::WriteBoost(bool force)
{
if (force || (rs_in_file && rs_file_boost))
WriteInFile("RocketStats_BoostState.txt", std::to_string(gameWrapper->IsInGame() ? 0 : -1));
WriteInFile("RocketStats_BoostState.txt", std::to_string(is_offline_game ? 0 : -1));
}
4 changes: 2 additions & 2 deletions RocketStats/Managements/GameManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

void RocketStats::GameStart(std::string eventName)
{
if (!gameWrapper->IsInOnlineGame() || is_game_started)
if (!is_online_game || is_game_started)
return;

cvarManager->log("===== GameStart =====");
Expand Down Expand Up @@ -40,7 +40,7 @@ void RocketStats::GameStart(std::string eventName)

void RocketStats::GameEnd(std::string eventName)
{
if (gameWrapper->IsInOnlineGame() && my_team_num != -1)
if (is_online_game && my_team_num != -1)
{
cvarManager->log("===== GameEnd =====");
ServerWrapper server = gameWrapper->GetOnlineGame();
Expand Down
Loading

0 comments on commit f372626

Please sign in to comment.