From b3d8e22539b1a9bc97e9f5bc211a7649d85c8616 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Thu, 2 Oct 2014 22:52:25 -0400 Subject: [PATCH] Make ZoneDatabase::FillAAEffects get the data from memory Note: This should probably be moved out of ZoneDatabase --- zone/aa.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/zone/aa.cpp b/zone/aa.cpp index 1f933b30e..8af3896d3 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1751,19 +1751,15 @@ void ZoneDatabase::FillAAEffects(SendAA_Struct* aa_struct){ if(!aa_struct) return; - std::string query = StringFormat("SELECT effectid, base1, base2, slot from aa_effects where aaid=%i order by slot asc", aa_struct->id); - auto results = QueryDatabase(query); - if (!results.Success()) { - LogFile->write(EQEMuLog::Error, "Error in Client::FillAAEffects query: '%s': %s", query.c_str(), results.ErrorMessage().c_str()); - return; - } - - int index = 0; - for (auto row = results.begin(); row != results.end(); ++row, ++index) { - aa_struct->abilities[index].skill_id=atoi(row[0]); - aa_struct->abilities[index].base1=atoi(row[1]); - aa_struct->abilities[index].base2=atoi(row[2]); - aa_struct->abilities[index].slot=atoi(row[3]); + auto it = aa_effects.find(aa_struct->id); + if (it != aa_effects.end()) { + for (int slot = 0; slot < aa_struct->total_abilities; slot++) { + // aa_effects is a map of a map, so the slot reference does not start at 0 + aa_struct->abilities[slot].skill_id = it->second[slot + 1].skill_id; + aa_struct->abilities[slot].base1 = it->second[slot + 1].base1; + aa_struct->abilities[slot].base2 = it->second[slot + 1].base2; + aa_struct->abilities[slot].slot = it->second[slot + 1].slot; + } } }