mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-20 21:41:29 +00:00
GetDecayTimes converted to QueryDatabase
This commit is contained in:
parent
826f7d0efd
commit
971c3f633f
@ -1845,32 +1845,26 @@ bool Zone::RemoveSpawnGroup(uint32 in_id) {
|
|||||||
|
|
||||||
// Added By Hogie
|
// Added By Hogie
|
||||||
bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes) {
|
bool ZoneDatabase::GetDecayTimes(npcDecayTimes_Struct* npcCorpseDecayTimes) {
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char* query = 0;
|
|
||||||
int i = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT varname, value FROM variables WHERE varname like 'decaytime%%' ORDER BY varname"), errbuf, &result)) {
|
const std::string query = "SELECT varname, value FROM variables WHERE varname LIKE 'decaytime%%' ORDER BY varname";
|
||||||
safe_delete_array(query);
|
auto results = QueryDatabase(query);
|
||||||
while((row = mysql_fetch_row(result))) {
|
if (!results.Success())
|
||||||
Seperator sep(row[0]);
|
return false;
|
||||||
npcCorpseDecayTimes[i].minlvl = atoi(sep.arg[1]);
|
|
||||||
npcCorpseDecayTimes[i].maxlvl = atoi(sep.arg[2]);
|
int index = 0;
|
||||||
if (atoi(row[1]) > 7200)
|
for (auto row = results.begin(); row != results.end(); ++row, ++index) {
|
||||||
npcCorpseDecayTimes[i].seconds = 720;
|
Seperator sep(row[0]);
|
||||||
else
|
npcCorpseDecayTimes[index].minlvl = atoi(sep.arg[1]);
|
||||||
npcCorpseDecayTimes[i].seconds = atoi(row[1]);
|
npcCorpseDecayTimes[index].maxlvl = atoi(sep.arg[2]);
|
||||||
i++;
|
|
||||||
}
|
if (atoi(row[1]) > 7200)
|
||||||
mysql_free_result(result);
|
npcCorpseDecayTimes[index].seconds = 720;
|
||||||
}
|
else
|
||||||
else {
|
npcCorpseDecayTimes[index].seconds = atoi(row[1]);
|
||||||
safe_delete_array(query);
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}// Added By Hogie -- End
|
}
|
||||||
|
|
||||||
void Zone::weatherSend()
|
void Zone::weatherSend()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user