feat(UserSideBar): Added friend/player counters

This commit is contained in:
Yimura 2021-02-06 00:32:27 +01:00
parent 4e5756a818
commit 728d32378b
No known key found for this signature in database
GPG Key ID: 54EFAD29393A6E78
3 changed files with 17 additions and 4 deletions

View File

@ -37,12 +37,19 @@ namespace big
std::sort(std::begin(players), std::end(players));
g_temp.friend_count = 0;
g_temp.player_count = 0;
g_players.clear();
for (uint8_t i = 0; i < 32; i++)
{
player player = players[i];
if (player.id == PLAYER::PLAYER_ID()) g_player = player;
else if (player.is_online)
if (player.is_friend)
g_temp.friend_count++;
else
g_temp.player_count++;
g_players.emplace(player.id, player);
}

View File

@ -24,13 +24,15 @@ namespace big
ImGui::Separator();
if (ImGui::TreeNode("Friends"))
char title[64];
sprintf(title, "Friends (%d)###friend_lists", g_temp.friend_count);
if (ImGui::TreeNode(title))
{
ImGui::Unindent();
bool friendInLobby = false;
for (auto pair : g_players)
for (auto& pair : g_players)
{
player player = pair.second;
@ -56,11 +58,12 @@ namespace big
ImGui::Separator();
}
if (ImGui::TreeNode("Players"))
sprintf(title, "Players (%d)###player_lists", g_temp.player_count);
if (ImGui::TreeNode(title))
{
ImGui::Unindent();
for (auto pair : g_players)
for (auto& pair : g_players)
{
player player = pair.second;

View File

@ -21,6 +21,9 @@ namespace big
int character_slot = 0;
int friend_count = 0;
int player_count = 0;
int set_level = 0;
int spoofed_rank = 0;
int teleport_location = 0;