Skip to content

Commit

Permalink
make shavit-mapchooser grab tiers even if not mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
rtldg committed Feb 11, 2025
1 parent ad48aa3 commit b150073
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions addons/sourcemod/scripting/shavit-mapchooser.sp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ enum
MapListFolder,
MapListMixed,
MapListZonedMixedWithFolder,
MapListLAST,
}

public Plugin myinfo =
Expand Down Expand Up @@ -199,7 +200,7 @@ public void OnPluginStart()

g_mMapList = new StringMap();

g_cvMapListType = new Convar("smc_maplist_type", "2", "Where the plugin should get the map list from.\n0 - zoned maps from database\n1 - from maplist file (mapcycle.txt)\n2 - from maps folder\n3 - from zoned maps and confirmed by maplist file\n4 - from zoned maps and confirmed by maps folder", _, true, 0.0, true, 4.0);
g_cvMapListType = new Convar("smc_maplist_type", "2", "Where the plugin should get the map list from.\n0 - zoned maps from database\n1 - from maplist file (mapcycle.txt)\n2 - from maps folder\n3 - from zoned maps and confirmed by maplist file\n4 - from zoned maps and confirmed by maps folder", _, true, 0.0, true, float(MapListLAST)-1.0);
g_cvMatchFuzzyMap = new Convar("smc_match_fuzzy", "1", "If set to 1, the plugin will accept partial map matches from the database. Useful for workshop maps, bad for duplicate map names", _, true, 0.0, true, 1.0);
g_cvHijackMap = new Convar("smc_hijack_sm_map_so_its_faster", "1", "Hijacks sourcemod's built-in sm_map command so it's faster.", 0, true, 0.0, true, 1.0);
g_cvExcludePrefixes = new Convar("smc_exclude_prefixes", "de_,cs_,as_,ar_,dz_,gd_,lobby_,training1,mg_,gg_,jb_,coop_,aim_,awp_,cp_,ctf_,fy_,dm_,hg_,rp_,ze_,zm_,arena_,pl_,plr_,mvm_,db_,trade_,ba_,mge_,ttt_,ph_,hns_,test_,", "Exclude maps based on these prefixes.\nA good reference: https://developer.valvesoftware.com/wiki/Map_prefixes");
Expand Down Expand Up @@ -689,7 +690,8 @@ void InitiateMapVote(MapChange when)
char map[PLATFORM_MAX_PATH];
char mapdisplay[PLATFORM_MAX_PATH + 32];

StringMap tiersMap = (gB_Rankings && gI_Driver == Driver_mysql) ? Shavit_GetMapTiers() : null;
StringMap tiersMap = null;
if (gB_Rankings) tiersMap = Shavit_GetMapTiers();

int nominateMapsToAdd = (mapsToAdd > g_aNominateList.Length) ? g_aNominateList.Length : mapsToAdd;
for(int i = 0; i < nominateMapsToAdd; i++)
Expand Down Expand Up @@ -1290,7 +1292,8 @@ void SMC_NominateMatches(int client, const char[] mapname)
bool isOldMap = false;
char map[PLATFORM_MAX_PATH];
char oldMapName[PLATFORM_MAX_PATH];
StringMap tiersMap = (gB_Rankings && gI_Driver == Driver_mysql) ? Shavit_GetMapTiers() : null;
StringMap tiersMap = null;
if (gB_Rankings) tiersMap = Shavit_GetMapTiers();
int min = GetConVarInt(g_cvMinTier);
int max = GetConVarInt(g_cvMaxTier);

Expand Down Expand Up @@ -1579,7 +1582,8 @@ void CreateNominateMenu()
g_hNominateMenu = new Menu(NominateMenuHandler);

g_hNominateMenu.SetTitle("Nominate");
StringMap tiersMap = (gB_Rankings && gI_Driver == Driver_mysql) ? Shavit_GetMapTiers() : null;
StringMap tiersMap = null;
if (gB_Rankings) tiersMap = Shavit_GetMapTiers();

g_aMapList.SortCustom(SlowSortThatSkipsFolders);

Expand Down Expand Up @@ -1661,7 +1665,8 @@ void CreateTierMenus()
int max = GetConVarInt(g_cvMaxTier);

InitTierMenus(min,max);
StringMap tiersMap = (gB_Rankings && gI_Driver == Driver_mysql) ? Shavit_GetMapTiers() : null;
StringMap tiersMap = null;
if (gB_Rankings) tiersMap = Shavit_GetMapTiers();

int length = g_aMapList.Length;
for(int i = 0; i < length; ++i)
Expand Down Expand Up @@ -2110,7 +2115,8 @@ public Action BaseCommands_Command_Map_Menu(int client, int args)
char map[PLATFORM_MAX_PATH];
Menu menu = new Menu(MapsMenuHandler);

StringMap tiersMap = (gB_Rankings && gI_Driver == Driver_mysql) ? Shavit_GetMapTiers() : null;
StringMap tiersMap = null;
if (gB_Rankings) tiersMap = Shavit_GetMapTiers();
ArrayList maps;

if (args < 1)
Expand Down

0 comments on commit b150073

Please sign in to comment.