mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
LoadTickItems converted to QueryDatabase
This commit is contained in:
parent
029314ec7f
commit
19e04a1875
@ -2296,18 +2296,20 @@ void Zone::ReloadWorld(uint32 Option){
|
||||
|
||||
void Zone::LoadTickItems()
|
||||
{
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char* query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
tick_items.clear();
|
||||
|
||||
if(database.RunQuery(query, MakeAnyLenString(&query, "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick"), errbuf, &result))
|
||||
{
|
||||
while((row = mysql_fetch_row(result)))
|
||||
{
|
||||
if(atoi(row[0]) >= 1)
|
||||
{
|
||||
const std::string query = "SELECT it_itemid, it_chance, it_level, it_qglobal, it_bagslot FROM item_tick";
|
||||
auto results = database.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query.c_str(), results.ErrorMessage().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
if(atoi(row[0]) == 0)
|
||||
continue;
|
||||
|
||||
item_tick_struct ti_tmp;
|
||||
ti_tmp.itemid = atoi(row[0]);
|
||||
ti_tmp.chance = atoi(row[1]);
|
||||
@ -2315,16 +2317,9 @@ void Zone::LoadTickItems()
|
||||
ti_tmp.bagslot = (int16)atoi(row[4]);
|
||||
ti_tmp.qglobal = std::string(row[3]);
|
||||
tick_items[atoi(row[0])] = ti_tmp;
|
||||
|
||||
}
|
||||
}
|
||||
mysql_free_result(result);
|
||||
safe_delete_array(query);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Error in Zone::LoadTickItems: %s (%s)", query, errbuf);
|
||||
safe_delete_array(query);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint32 Zone::GetSpawnKillCount(uint32 in_spawnid) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user