mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-04 06:02:26 +00:00
LoadDamageShieldTypes converted to queryDatabase
This commit is contained in:
parent
1366774931
commit
0622f02470
@ -1388,32 +1388,20 @@ uint8 SharedDatabase::GetTrainLevel(uint8 Class_, SkillUseTypes Skill, uint8 Lev
|
|||||||
|
|
||||||
void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) {
|
void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) {
|
||||||
|
|
||||||
const char *DSQuery = "SELECT `spellid`, `type` from `damageshieldtypes` WHERE `spellid` > 0 "
|
std::string query = StringFormat("SELECT `spellid`, `type` FROM `damageshieldtypes` WHERE `spellid` > 0 "
|
||||||
"AND `spellid` <= %i";
|
"AND `spellid` <= %i", iMaxSpellID);
|
||||||
|
auto results = QueryDatabase(query);
|
||||||
|
if (!results.Success()) {
|
||||||
|
LogFile->write(EQEMuLog::Error, "Error in LoadDamageShieldTypes: %s %s", query.c_str(), results.ErrorMessage().c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const char *ERR_MYSQLERROR = "Error in LoadDamageShieldTypes: %s %s";
|
for(auto row = results.begin(); row != results.end(); ++row) {
|
||||||
|
int spellID = atoi(row[0]);
|
||||||
|
if((spellID > 0) && (spellID <= iMaxSpellID))
|
||||||
|
sp[spellID].DamageShieldType = atoi(row[1]);
|
||||||
|
}
|
||||||
|
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
|
||||||
char* query = 0;
|
|
||||||
MYSQL_RES *result;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
|
|
||||||
if(RunQuery(query,MakeAnyLenString(&query,DSQuery,iMaxSpellID),errbuf,&result)) {
|
|
||||||
|
|
||||||
while((row = mysql_fetch_row(result))) {
|
|
||||||
|
|
||||||
int SpellID = atoi(row[0]);
|
|
||||||
if((SpellID > 0) && (SpellID <= iMaxSpellID)) {
|
|
||||||
sp[SpellID].DamageShieldType = atoi(row[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mysql_free_result(result);
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LogFile->write(EQEMuLog::Error, ERR_MYSQLERROR, query, errbuf);
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) {
|
const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user