Core/Spells: Fixed spell powers initialization

This commit is contained in:
Intel
2014-12-04 22:53:19 +02:00
parent e3fb937fdd
commit 60a6a8ba44
5 changed files with 12 additions and 3 deletions

View File

@@ -39,6 +39,7 @@ DB2Storage<SpellCastingRequirementsEntry> sSpellCastingRequirementsStore(Spell
DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore(SpellClassOptionsEntryfmt);
DB2Storage<SpellMiscEntry> sSpellMiscStore(SpellMiscEntryfmt);
DB2Storage<SpellPowerEntry> sSpellPowerStore(SpellPowerEntryfmt);
SpellPowerBySpellIDMap sSpellPowerBySpellIDStore;
DB2Storage<SpellReagentsEntry> sSpellReagentsStore(SpellReagentsEntryfmt);
DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore(SpellRuneCostEntryfmt);
DB2Storage<SpellTotemsEntry> sSpellTotemsStore(SpellTotemsEntryfmt);
@@ -144,6 +145,10 @@ void LoadDB2Stores(std::string const& dataPath)
LoadDB2(availableDb2Locales, bad_db2_files, sTaxiPathStore, db2Path, "TaxiPath.db2");
LoadDB2(availableDb2Locales, bad_db2_files, sTaxiPathNodeStore, db2Path, "TaxiPathNode.db2");
for (uint32 i = 0; i < sSpellPowerStore.GetNumRows(); ++i)
if (SpellPowerEntry const* power = sSpellPowerStore.LookupEntry(i))
sSpellPowerBySpellIDStore[power->SpellID] = power;
for (uint32 i = 0; i < sPhaseGroupStore.GetNumRows(); ++i)
if (PhaseGroupEntry const* group = sPhaseGroupStore.LookupEntry(i))
if (PhaseEntry const* phase = sPhaseStore.LookupEntry(group->PhaseID))

View File

@@ -39,6 +39,7 @@ extern DB2Storage<SpellCastingRequirementsEntry> sSpellCastingRequirementsStore;
extern DB2Storage<SpellClassOptionsEntry> sSpellClassOptionsStore;
extern DB2Storage<SpellMiscEntry> sSpellMiscStore;
extern DB2Storage<SpellPowerEntry> sSpellPowerStore;
extern SpellPowerBySpellIDMap sSpellPowerBySpellIDStore;
extern DB2Storage<SpellReagentsEntry> sSpellReagentsStore;
extern DB2Storage<SpellRuneCostEntry> sSpellRuneCostStore;
extern DB2Storage<SpellTotemsEntry> sSpellTotemsStore;

View File

@@ -354,6 +354,8 @@ struct TaxiPathNodeEntry
typedef std::map<uint32, uint32> ItemDisplayIDMap;
typedef std::map<uint32, SpellPowerEntry const*> SpellPowerBySpellIDMap;
struct TaxiPathBySourceAndDestination
{
TaxiPathBySourceAndDestination() : ID(0), price(0) { }

View File

@@ -880,7 +880,6 @@ SpellInfo::SpellInfo(SpellEntry const* spellEntry, SpellEffectEntryMap effects)
SpellEquippedItemsId = spellEntry->EquippedItemsID;
SpellInterruptsId = spellEntry->InterruptsID;
SpellLevelsId = spellEntry->LevelsID;
//SpellPowerId = spellEntry->PowerID;
SpellReagentsId = spellEntry->ReagentsID;
SpellShapeshiftId = spellEntry->ShapeshiftID;
SpellTargetRestrictionsId = spellEntry->TargetRestrictionsID;
@@ -2976,7 +2975,10 @@ SpellLevelsEntry const* SpellInfo::GetSpellLevels() const
SpellPowerEntry const* SpellInfo::GetSpellPower() const
{
return SpellPowerId ? sSpellPowerStore.LookupEntry(SpellPowerId) : NULL;
auto itr = sSpellPowerBySpellIDStore.find(Id);
if (itr != sSpellPowerBySpellIDStore.end())
return itr->second;
return NULL;
}
SpellReagentsEntry const* SpellInfo::GetSpellReagents() const

View File

@@ -404,7 +404,6 @@ public:
uint32 SpellEquippedItemsId;
uint32 SpellInterruptsId;
uint32 SpellLevelsId;
uint32 SpellPowerId;
uint32 SpellReagentsId;
uint32 SpellShapeshiftId;
uint32 SpellTargetRestrictionsId;