mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +00:00
LoadAAEffects2 converted to QueryDatabase
This commit is contained in:
parent
87efd22394
commit
68115505f8
46
zone/AA.cpp
46
zone/AA.cpp
@ -1466,32 +1466,30 @@ void Zone::LoadAAs() {
|
|||||||
bool ZoneDatabase::LoadAAEffects2() {
|
bool ZoneDatabase::LoadAAEffects2() {
|
||||||
aa_effects.clear(); //start fresh
|
aa_effects.clear(); //start fresh
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
const std::string query = "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC";
|
||||||
char *query = 0;
|
auto results = QueryDatabase(query);
|
||||||
MYSQL_RES *result;
|
if (!results.Success()) {
|
||||||
MYSQL_ROW row;
|
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
if (RunQuery(query, MakeAnyLenString(&query, "SELECT aaid, slot, effectid, base1, base2 FROM aa_effects ORDER BY aaid ASC, slot ASC"), errbuf, &result)) {
|
|
||||||
int count = 0;
|
|
||||||
while((row = mysql_fetch_row(result))!= nullptr) {
|
|
||||||
int aaid = atoi(row[0]);
|
|
||||||
int slot = atoi(row[1]);
|
|
||||||
int effectid = atoi(row[2]);
|
|
||||||
int base1 = atoi(row[3]);
|
|
||||||
int base2 = atoi(row[4]);
|
|
||||||
aa_effects[aaid][slot].skill_id = effectid;
|
|
||||||
aa_effects[aaid][slot].base1 = base1;
|
|
||||||
aa_effects[aaid][slot].base2 = base2;
|
|
||||||
aa_effects[aaid][slot].slot = slot; //not really needed, but we'll populate it just in case
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
if (count < 1) //no results
|
|
||||||
LogFile->write(EQEMuLog::Error, "Error loading AA Effects, none found in the database.");
|
|
||||||
} else {
|
|
||||||
LogFile->write(EQEMuLog::Error, "Error in ZoneDatabase::LoadAAEffects2 query: '%s': %s", query, errbuf);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
safe_delete_array(query);
|
|
||||||
|
if (results.RowCount()) { //no results
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error loading AA Effects, none found in the database.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
int aaid = atoi(row[0]);
|
||||||
|
int slot = atoi(row[1]);
|
||||||
|
int effectid = atoi(row[2]);
|
||||||
|
int base1 = atoi(row[3]);
|
||||||
|
int base2 = atoi(row[4]);
|
||||||
|
aa_effects[aaid][slot].skill_id = effectid;
|
||||||
|
aa_effects[aaid][slot].base1 = base1;
|
||||||
|
aa_effects[aaid][slot].base2 = base2;
|
||||||
|
aa_effects[aaid][slot].slot = slot; //not really needed, but we'll populate it just in case
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void Client::ResetAA(){
|
void Client::ResetAA(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user