now showing how many hours to next tier and displays all tier benefits
This commit is contained in:
parent
de4155b758
commit
81c0af7ebc
@ -19,6 +19,10 @@ int g_iPlayerRTVCapacity;
|
||||
int g_iAvgHour_Contribution_per_player;
|
||||
int g_iRtvBoost_tier;
|
||||
int g_iPlayerTier[MAXPLAYERS + 1];
|
||||
int g_iPlayerNextTierHours[MAXPLAYERS + 1];
|
||||
|
||||
char g_GroupNames[32][64];
|
||||
int g_GroupNameCount = 0;
|
||||
|
||||
StringMap g_GroupOverrides; // group name -> comma-separated override list
|
||||
|
||||
@ -90,10 +94,7 @@ public void LoadGroupOverrides()
|
||||
delete kv;
|
||||
return;
|
||||
}
|
||||
|
||||
// collect group names first
|
||||
char groupNames[32][64];
|
||||
int groupCount = 0;
|
||||
g_GroupNameCount = 0;
|
||||
|
||||
if (kv.GotoFirstSubKey())
|
||||
{
|
||||
@ -103,19 +104,19 @@ public void LoadGroupOverrides()
|
||||
kv.GetSectionName(sName, sizeof(sName));
|
||||
if (StrContains(sName, "tier", false) == 0)
|
||||
{
|
||||
strcopy(groupNames[groupCount], 64, sName);
|
||||
groupCount++;
|
||||
strcopy(g_GroupNames[g_GroupNameCount], 64, sName);
|
||||
g_GroupNameCount++;
|
||||
}
|
||||
}
|
||||
while (kv.GotoNextKey() && groupCount < 32);
|
||||
while (kv.GotoNextKey() && g_GroupNameCount < 32);
|
||||
}
|
||||
|
||||
// now for each group, rewind and re-navigate fresh
|
||||
for (int i = 0; i < groupCount; i++)
|
||||
for (int i = 0; i < g_GroupNameCount; i++)
|
||||
{
|
||||
kv.Rewind();
|
||||
|
||||
if (!kv.JumpToKey(groupNames[i]))
|
||||
if (!kv.JumpToKey(g_GroupNames[i]))
|
||||
continue;
|
||||
|
||||
if (!kv.JumpToKey("Overrides"))
|
||||
@ -137,7 +138,7 @@ public void LoadGroupOverrides()
|
||||
}
|
||||
while (kv.GotoNextKey(false));
|
||||
|
||||
g_GroupOverrides.SetString(groupNames[i], overrideList);
|
||||
g_GroupOverrides.SetString(g_GroupNames[i], overrideList);
|
||||
}
|
||||
|
||||
delete kv;
|
||||
@ -360,6 +361,7 @@ public void SQL_OnDatabaseConnect(Database db, const char[] error, any data)
|
||||
|
||||
public void OnClientPostAdminCheck(int client)
|
||||
{
|
||||
g_iPlayerNextTierHours[client] = 0;
|
||||
GetClientAuthId(client, AuthId_Steam2, g_csSID[client], sizeof(g_csSID[]));
|
||||
is_bot_player[client] = false;
|
||||
g_iPlayerTier[client] = -1;
|
||||
@ -694,14 +696,17 @@ public void SetPlayerTier(int client)
|
||||
Call_Finish();
|
||||
if (g_iPlayerTimeServer[client] < next_hours)
|
||||
{
|
||||
PrintToChat(client, "You need %i hours to reach next tier. Check your features with !sm_tier", next_hours - g_iPlayerTimeServer[client]);
|
||||
g_iPlayerNextTierHours[client] = next_hours - g_iPlayerTimeServer[client];
|
||||
PrintToChat(client, "You need %i hours to reach next tier. Check your features with !sm_tier", g_iPlayerNextTierHours[client]);
|
||||
}
|
||||
else
|
||||
|
||||
delete kv;
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
g_iPlayerNextTierHours[client] = 0;
|
||||
g_iPlayerTier[client] = -1;
|
||||
Format(g_csSID[client], sizeof(g_csSID[]), "");
|
||||
is_bot_player[client] = false;
|
||||
@ -804,21 +809,11 @@ public Action Command_TopTime(int client, int args)
|
||||
|
||||
public void PrintClientGroupOverrides(int client)
|
||||
{
|
||||
AdminId id = GetUserAdmin(client);
|
||||
|
||||
char sTitle[64];
|
||||
Format(sTitle, sizeof(sTitle), "Tier %i Rewards", g_iPlayerTier[client]);
|
||||
char sTitle[128];
|
||||
Format(sTitle, sizeof(sTitle), "Tier %i | Next tier requires %i hours.", g_iPlayerTier[client], g_iPlayerNextTierHours[client]);
|
||||
Menu menu = new Menu(MenuHandler1);
|
||||
menu.SetTitle(sTitle);
|
||||
|
||||
if (id == INVALID_ADMIN_ID || GetAdminGroupCount(id) == 0)
|
||||
{
|
||||
menu.AddItem("-1", "You have no tiers.", ITEMDRAW_DISABLED);
|
||||
menu.ExitButton = true;
|
||||
menu.Display(client, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
char rtv_boost_tier[32];
|
||||
Format(rtv_boost_tier, sizeof(rtv_boost_tier), "tier%i", g_iRtvBoost_tier);
|
||||
|
||||
@ -828,36 +823,29 @@ public void PrintClientGroupOverrides(int client)
|
||||
char entwatch_tier[32];
|
||||
Format(entwatch_tier, sizeof(entwatch_tier), "tier%i", FindConVar("sm_entwatch_tier_requirement").IntValue);
|
||||
|
||||
int groupCount = GetAdminGroupCount(id);
|
||||
for (int i = 0; i < groupCount; i++)
|
||||
for (int i = 0; i < g_GroupNameCount; i++)
|
||||
{
|
||||
char groupName[64];
|
||||
GroupId grp = GetAdminGroup(id, i, groupName, sizeof(groupName));
|
||||
|
||||
if (grp == INVALID_GROUP_ID)
|
||||
continue;
|
||||
|
||||
char entry[128];
|
||||
if (StrEqual(groupName, rtv_boost_tier))
|
||||
{
|
||||
Format(entry, sizeof(entry), "tier%i: %ix mapvote/rtv/nomination boost", g_iRtvBoost_tier, g_iPlayerRTVCapacity);
|
||||
menu.AddItem("-1", entry, ITEMDRAW_DISABLED);
|
||||
}
|
||||
if (StrEqual(groupName, spray_tier))
|
||||
{
|
||||
Format(entry, sizeof(entry), "%s: sprays", spray_tier);
|
||||
menu.AddItem("-1", entry, ITEMDRAW_DISABLED);
|
||||
}
|
||||
if (StrEqual(groupName, entwatch_tier))
|
||||
{
|
||||
Format(entry, sizeof(entry), "%s: items", entwatch_tier);
|
||||
menu.AddItem("-1", entry, ITEMDRAW_DISABLED);
|
||||
}
|
||||
|
||||
char overrides[512];
|
||||
if (g_GroupOverrides.GetString(groupName, overrides, sizeof(overrides)))
|
||||
|
||||
if (StrEqual(g_GroupNames[i], rtv_boost_tier))
|
||||
{
|
||||
Format(entry, sizeof(entry), "%s: %s", groupName, overrides);
|
||||
Format(entry, sizeof(entry), "%s: %ix mapvote/rtv/nomination boost", g_GroupNames[i], g_iPlayerRTVCapacity);
|
||||
menu.AddItem("-1", entry, ITEMDRAW_DISABLED);
|
||||
}
|
||||
if (StrEqual(g_GroupNames[i], spray_tier))
|
||||
{
|
||||
Format(entry, sizeof(entry), "%s: sprays", g_GroupNames[i]);
|
||||
menu.AddItem("-1", entry, ITEMDRAW_DISABLED);
|
||||
}
|
||||
if (StrEqual(g_GroupNames[i], entwatch_tier))
|
||||
{
|
||||
Format(entry, sizeof(entry), "%s: items", g_GroupNames[i]);
|
||||
menu.AddItem("-1", entry, ITEMDRAW_DISABLED);
|
||||
}
|
||||
if (g_GroupOverrides.GetString(g_GroupNames[i], overrides, sizeof(overrides)))
|
||||
{
|
||||
Format(entry, sizeof(entry), "%s: %s", g_GroupNames[i], overrides);
|
||||
menu.AddItem("-1", entry, ITEMDRAW_DISABLED);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user