aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIntel <chemicstry@gmail.com>2014-12-04 22:53:19 +0200
committerIntel <chemicstry@gmail.com>2014-12-04 22:53:19 +0200
commit60a6a8ba441709a11d548cdc101f86f96ae70915 (patch)
treeaebf415b3be9432c32fed70cd6edb51a7b936721 /src
parente3fb937fdd0a22b0959f186dfbdba638063f1e36 (diff)
Core/Spells: Fixed spell powers initialization
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DataStores/DB2Stores.cpp5
-rw-r--r--src/server/game/DataStores/DB2Stores.h1
-rw-r--r--src/server/game/DataStores/DB2Structure.h2
-rw-r--r--src/server/game/Spells/SpellInfo.cpp6
-rw-r--r--src/server/game/Spells/SpellInfo.h1
5 files changed, 12 insertions, 3 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp
index 2d3751ccd9e..3c111da8aee 100644
--- a/src/server/game/DataStores/DB2Stores.cpp
+++ b/src/server/game/DataStores/DB2Stores.cpp
@@ -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))
diff --git a/src/server/game/DataStores/DB2Stores.h b/src/server/game/DataStores/DB2Stores.h
index 4294636b138..6521ea930a8 100644
--- a/src/server/game/DataStores/DB2Stores.h
+++ b/src/server/game/DataStores/DB2Stores.h
@@ -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;
diff --git a/src/server/game/DataStores/DB2Structure.h b/src/server/game/DataStores/DB2Structure.h
index e720017b09d..8e91ec8396f 100644
--- a/src/server/game/DataStores/DB2Structure.h
+++ b/src/server/game/DataStores/DB2Structure.h
@@ -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) { }
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 8eefeae232a..b97c169ec7b 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -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
diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h
index 413eb9d39a5..d787fc8b44e 100644
--- a/src/server/game/Spells/SpellInfo.h
+++ b/src/server/game/Spells/SpellInfo.h
@@ -404,7 +404,6 @@ public:
uint32 SpellEquippedItemsId;
uint32 SpellInterruptsId;
uint32 SpellLevelsId;
- uint32 SpellPowerId;
uint32 SpellReagentsId;
uint32 SpellShapeshiftId;
uint32 SpellTargetRestrictionsId;