allow to use map configs for days instead of just the global config
This commit is contained in:
parent
b5056b71a8
commit
60924068a2
@ -113,10 +113,37 @@ public Plugin myinfo =
|
|||||||
url = "www.unloze.com"
|
url = "www.unloze.com"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public bool select_map_specific_waves()
|
||||||
|
{
|
||||||
|
char mapname[512];
|
||||||
|
char mapdaystitle[512];
|
||||||
|
GetCurrentMap(mapname, sizeof(mapname));
|
||||||
|
Format(mapdaystitle, sizeof(mapdaystitle), "configs/unloze_zr/mapwaves/%s_daystitle.txt", mapname);
|
||||||
|
Format(mapname, sizeof(mapname), "configs/unloze_zr/mapwaves/%s.txt", mapname);
|
||||||
|
|
||||||
|
BuildPath(Path_SM, mapname, sizeof(mapname), mapname);
|
||||||
|
BuildPath(Path_SM, mapdaystitle, sizeof(mapdaystitle), mapdaystitle);
|
||||||
|
if (FileExists(mapdaystitle) && FileExists(mapname))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public void loadDays()
|
public void loadDays()
|
||||||
{
|
{
|
||||||
char localPath[256];
|
char localPath[512];
|
||||||
|
if (select_map_specific_waves())
|
||||||
|
{
|
||||||
|
char mapname[512];
|
||||||
|
GetCurrentMap(mapname, sizeof(mapname));
|
||||||
|
Format(mapname, sizeof(mapname), "configs/unloze_zr/mapwaves/%s_daystitle.txt", mapname);
|
||||||
|
BuildPath(Path_SM, localPath, sizeof(localPath), mapname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
BuildPath(Path_SM, localPath, sizeof(localPath), "configs/unloze_zr/daystitle.txt");
|
BuildPath(Path_SM, localPath, sizeof(localPath), "configs/unloze_zr/daystitle.txt");
|
||||||
|
}
|
||||||
Handle fileHandle = OpenFile(localPath, "r");
|
Handle fileHandle = OpenFile(localPath, "r");
|
||||||
char lineBuffer[512];
|
char lineBuffer[512];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -1233,15 +1260,6 @@ public int ambient_index()
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Action RetrieveWaveSettings(int wave)
|
public Action RetrieveWaveSettings(int wave)
|
||||||
{
|
{
|
||||||
Handle l_hWave = INVALID_HANDLE;
|
|
||||||
l_hWave = OpenFile(g_cPathsWaveSettings, "r");
|
|
||||||
if (l_hWave == INVALID_HANDLE)
|
|
||||||
{
|
|
||||||
LogError("create a wavesettings.txt file");
|
|
||||||
delete l_hWave;
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
int total_days = 23;
|
int total_days = 23;
|
||||||
for (int i = 0; i < sizeof(g_cDaysTitles); i++)
|
for (int i = 0; i < sizeof(g_cDaysTitles); i++)
|
||||||
{
|
{
|
||||||
@ -1255,10 +1273,8 @@ public Action RetrieveWaveSettings(int wave)
|
|||||||
char hostname[512];
|
char hostname[512];
|
||||||
Format(hostname, sizeof(hostname), "UNLOZE | [ZRiot: Day %i/%i] %s | Ranking", wave, total_days, g_cDaysTitles[wave - 1]);
|
Format(hostname, sizeof(hostname), "UNLOZE | [ZRiot: Day %i/%i] %s | Ranking", wave, total_days, g_cDaysTitles[wave - 1]);
|
||||||
ServerCommand("hostname \"%s\"", hostname);
|
ServerCommand("hostname \"%s\"", hostname);
|
||||||
|
|
||||||
PrintToChatAll("Day %i: %s", wave, g_cDaysTitles[wave - 1]);
|
PrintToChatAll("Day %i: %s", wave, g_cDaysTitles[wave - 1]);
|
||||||
LoadWave(wave);
|
LoadWave(wave);
|
||||||
delete l_hWave;
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -1282,7 +1298,22 @@ public void LoadWave(int wave)
|
|||||||
char l_cLine[g_dLength];
|
char l_cLine[g_dLength];
|
||||||
bool l_bKeyIndex = false;
|
bool l_bKeyIndex = false;
|
||||||
Handle l_hFile = INVALID_HANDLE;
|
Handle l_hFile = INVALID_HANDLE;
|
||||||
|
if (select_map_specific_waves())
|
||||||
|
{
|
||||||
|
char mapname[512];
|
||||||
|
GetCurrentMap(mapname, sizeof(mapname));
|
||||||
|
Format(mapname, sizeof(mapname), "configs/unloze_zr/mapwaves/%s.txt", mapname);
|
||||||
|
BuildPath(Path_SM, mapname, sizeof(mapname), mapname);
|
||||||
|
l_hFile = OpenFile(mapname, "r");
|
||||||
|
kv.ImportFromFile(mapname);
|
||||||
|
kv1.ImportFromFile(mapname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
l_hFile = OpenFile(g_cPathsWaveSettings, "r");
|
l_hFile = OpenFile(g_cPathsWaveSettings, "r");
|
||||||
|
kv.ImportFromFile(g_cPathsWaveSettings);
|
||||||
|
kv1.ImportFromFile(g_cPathsWaveSettings);
|
||||||
|
}
|
||||||
Format(l_cJumptokey, sizeof(l_cJumptokey), "Wave %i", wave);
|
Format(l_cJumptokey, sizeof(l_cJumptokey), "Wave %i", wave);
|
||||||
Format(l_cJumptokey1, sizeof(l_cJumptokey1), "Wave %i", wave +1);
|
Format(l_cJumptokey1, sizeof(l_cJumptokey1), "Wave %i", wave +1);
|
||||||
for (int i = 0; i < g_dIndexes; i++)
|
for (int i = 0; i < g_dIndexes; i++)
|
||||||
@ -1291,8 +1322,6 @@ public void LoadWave(int wave)
|
|||||||
Format(g_cHumanClasses[i][g_iLength], sizeof(g_cHumanClasses), "");
|
Format(g_cHumanClasses[i][g_iLength], sizeof(g_cHumanClasses), "");
|
||||||
Format(g_cZMRoundClasses[i][g_iLength], sizeof(g_cZMRoundClasses), "");
|
Format(g_cZMRoundClasses[i][g_iLength], sizeof(g_cZMRoundClasses), "");
|
||||||
}
|
}
|
||||||
kv.ImportFromFile(g_cPathsWaveSettings);
|
|
||||||
kv1.ImportFromFile(g_cPathsWaveSettings);
|
|
||||||
if (!kv1.JumpToKey(l_cJumptokey1, false))
|
if (!kv1.JumpToKey(l_cJumptokey1, false))
|
||||||
{
|
{
|
||||||
//next wave does not exist, so we reached end wave right now.
|
//next wave does not exist, so we reached end wave right now.
|
||||||
|
Loading…
Reference in New Issue
Block a user