diff --git a/common/shareddb.cpp b/common/shareddb.cpp index 4e6f28904..ecee4ca17 100644 --- a/common/shareddb.cpp +++ b/common/shareddb.cpp @@ -53,6 +53,7 @@ #include "repositories/sharedbank_repository.h" #include "repositories/character_inspect_messages_repository.h" #include "repositories/spells_new_repository.h" +#include "repositories/damageshieldtypes_repository.h" namespace ItemField { @@ -1675,20 +1676,17 @@ bool SharedDatabase::GetCommandSubSettings(std::vector 0 " - "AND `spellid` <= %i", iMaxSpellID); - auto results = QueryDatabase(query); - if (!results.Success()) { - return; - } +void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* s) +{ + const auto& l = DamageshieldtypesRepository::All(*this); - for(auto& row = results.begin(); row != results.end(); ++row) { - const int spellID = Strings::ToInt(row[0]); - if((spellID > 0) && (spellID <= iMaxSpellID)) - sp[spellID].damage_shield_type = Strings::ToUnsignedInt(row[1]); - } + if (l.empty()) { + return; + } + for (const auto& e : l) { + s[e.spellid].damage_shield_type = e.type; + } } const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) { @@ -1972,7 +1970,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) { sp[e.id].damage_shield_type = 0; } - LoadDamageShieldTypes(sp, max_spells); + LoadDamageShieldTypes(sp); } void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* s) diff --git a/common/shareddb.h b/common/shareddb.h index 032865cbd..8002b62b4 100644 --- a/common/shareddb.h +++ b/common/shareddb.h @@ -173,7 +173,7 @@ public: int GetMaxSpellID(); bool LoadSpells(const std::string &prefix, int32 *records, const SPDat_Spell_Struct **sp); void LoadSpells(void *data, int max_spells); - void LoadDamageShieldTypes(SPDat_Spell_Struct *sp, int32 iMaxSpellID); + void LoadDamageShieldTypes(SPDat_Spell_Struct* s); uint32 GetSharedSpellsCount() { return m_shared_spells_count; } uint32 GetSpellsCount();