GetTotalAALevels converted to QueryDatabase

This commit is contained in:
Arthur Ice 2014-08-20 12:09:59 -07:00
parent 4214cf47c2
commit e33e8b713e

View File

@ -1673,23 +1673,20 @@ bool ZoneDatabase::LoadAAEffects() {
//AndMetal: this may now be obsolete since we have Zone::GetTotalAALevels() //AndMetal: this may now be obsolete since we have Zone::GetTotalAALevels()
uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) { uint8 ZoneDatabase::GetTotalAALevels(uint32 skill_id) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0; std::string query = StringFormat("SELECT count(slot) FROM aa_effects WHERE aaid = %i", skill_id);
MYSQL_RES *result; auto results = QueryDatabase(query);
MYSQL_ROW row; if (!results.Success()) {
int total=0; LogFile->write(EQEMuLog::Error, "Error in GetTotalAALevels '%s: %s", query.c_str(), results.ErrorMessage().c_str());
if (RunQuery(query, MakeAnyLenString(&query, "SELECT count(slot) from aa_effects where aaid=%i", skill_id), errbuf, &result)) { return 0;
safe_delete_array(query); }
if (mysql_num_rows(result) == 1) {
row = mysql_fetch_row(result); if (results.RowCount() != 1)
total=atoi(row[0]); return 0;
}
mysql_free_result(result); auto row = results.begin();
} else {
LogFile->write(EQEMuLog::Error, "Error in GetTotalAALevels '%s: %s", query, errbuf); return atoi(row[0]);
safe_delete_array(query);
}
return total;
} }
//this will allow us to count the number of effects for an AA by pulling the info from memory instead of the database. hopefully this will same some CPU cycles //this will allow us to count the number of effects for an AA by pulling the info from memory instead of the database. hopefully this will same some CPU cycles