diff --git a/scripting/shavit-core.sp b/scripting/shavit-core.sp index 481f34dc..d0687e0f 100644 --- a/scripting/shavit-core.sp +++ b/scripting/shavit-core.sp @@ -90,6 +90,7 @@ bool gB_Late = false; // modules bool gB_Zones = false; +bool gB_WR = false; // cvars ConVar gCV_Autobhop = null; @@ -315,6 +316,7 @@ public void OnPluginStart() } gB_Zones = LibraryExists("shavit-zones"); + gB_WR = LibraryExists("shavit-wr"); } public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue) @@ -336,6 +338,11 @@ public void OnLibraryAdded(const char[] name) { gB_Zones = true; } + + else if(StrEqual(name, "shavit-wr")) + { + gB_WR = true; + } } public void OnLibraryRemoved(const char[] name) @@ -344,6 +351,11 @@ public void OnLibraryRemoved(const char[] name) { gB_Zones = false; } + + else if(StrEqual(name, "shavit-wr")) + { + gB_WR = false; + } } public void OnAdminMenuReady(Handle topmenu) @@ -599,7 +611,22 @@ public Action Command_Style(int client, int args) else { - strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]); + float time = 0.0; + + if(gB_WR) + { + Shavit_GetWRTime(i, time); + } + + if(time > 0.0) + { + FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], time); + } + + else + { + strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]); + } } menu.AddItem(sInfo, sDisplay, (gBS_Style[client] == i)? ITEMDRAW_DISABLED:ITEMDRAW_DEFAULT); @@ -622,12 +649,12 @@ public Action Command_Style(int client, int args) return Plugin_Handled; } -public int StyleMenu_Handler(Menu m, MenuAction action, int param1, int param2) +public int StyleMenu_Handler(Menu menu, MenuAction action, int param1, int param2) { if(action == MenuAction_Select) { char[] info = new char[16]; - m.GetItem(param2, info, 16); + menu.GetItem(param2, info, 16); int style = StringToInt(info); @@ -641,7 +668,7 @@ public int StyleMenu_Handler(Menu m, MenuAction action, int param1, int param2) else if(action == MenuAction_End) { - delete m; + delete menu; } return 0; diff --git a/scripting/shavit-replay.sp b/scripting/shavit-replay.sp index 37f9b58e..86d56c45 100644 --- a/scripting/shavit-replay.sp +++ b/scripting/shavit-replay.sp @@ -1201,8 +1201,8 @@ public Action Command_DeleteReplay(int client, int args) return Plugin_Handled; } - Menu m = new Menu(DeleteReplay_Callback); - m.SetTitle("%T", "DeleteReplayMenuTitle", client); + Menu menu = new Menu(DeleteReplay_Callback); + menu.SetTitle("%T", "DeleteReplayMenuTitle", client); for(int i = 0; i < gI_Styles; i++) { @@ -1214,18 +1214,33 @@ public Action Command_DeleteReplay(int client, int args) char[] sInfo = new char[4]; IntToString(i, sInfo, 4); - m.AddItem(sInfo, gS_StyleStrings[i][sStyleName]); + float time = 0.0; + Shavit_GetWRTime(i, time); + + char[] sDisplay = new char[64]; + + if(time > 0.0) + { + FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], time); + } + + else + { + strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]); + } + + menu.AddItem(sInfo, sDisplay); } - if(m.ItemCount == 0) + if(menu.ItemCount == 0) { char[] sMenuItem = new char[64]; FormatEx(sMenuItem, 64, "%T", "ReplaysUnavailable", client); - m.AddItem("-1", sMenuItem); + menu.AddItem("-1", sMenuItem); } - m.ExitButton = true; - m.Display(client, 20); + menu.ExitButton = true; + menu.Display(client, 20); return Plugin_Handled; } @@ -1356,7 +1371,22 @@ Action OpenReplayMenu(int client) char[] sInfo = new char[8]; IntToString(i, sInfo, 8); - menu.AddItem(sInfo, gS_StyleStrings[i][sStyleName], (gI_FrameCount[i] > 0)? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED); + float time = 0.0; + Shavit_GetWRTime(i, time); + + char[] sDisplay = new char[64]; + + if(time > 0.0) + { + FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], time); + } + + else + { + strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]); + } + + menu.AddItem(sInfo, sDisplay, (gI_FrameCount[i] > 0)? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED); } if(menu.ItemCount == 0) diff --git a/scripting/shavit-wr.sp b/scripting/shavit-wr.sp index 7e7307a7..fbb8eae0 100644 --- a/scripting/shavit-wr.sp +++ b/scripting/shavit-wr.sp @@ -1103,7 +1103,19 @@ Action ShowWRStyleMenu(int client) char[] sInfo = new char[8]; IntToString(i, sInfo, 8); - menu.AddItem(sInfo, gS_StyleStrings[i][sStyleName]); + char[] sDisplay = new char[64]; + + if(gF_WRTime[i] > 0.0) + { + FormatEx(sDisplay, 64, "%s - WR: %.01f", gS_StyleStrings[i][sStyleName], gF_WRTime[i]); + } + + else + { + strcopy(sDisplay, 64, gS_StyleStrings[i][sStyleName]); + } + + menu.AddItem(sInfo, sDisplay, (gI_RecordAmount[i] > 0)? ITEMDRAW_DEFAULT:ITEMDRAW_DISABLED); } // should NEVER happen