diff options
author | joschiwald <joschiwald@online.de> | 2013-07-21 18:56:25 +0200 |
---|---|---|
committer | joschiwald <joschiwald@online.de> | 2013-07-24 15:38:19 +0200 |
commit | 9fb45ef64c4434608cd94d0698e0ec845bd2dc3c (patch) | |
tree | 47809da0f1c02098c68738a5fc5628a24b4bc06c | |
parent | a522be81081dff341528969c799b526340294bc2 (diff) |
Core/Spells: load spell ranks for talents from dbc
-rw-r--r-- | sql/updates/world/2013_07_24_01_world_spell_ranks.sql | 682 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 85 | ||||
-rw-r--r-- | src/server/game/Spells/SpellMgr.h | 2 |
3 files changed, 761 insertions, 8 deletions
diff --git a/sql/updates/world/2013_07_24_01_world_spell_ranks.sql b/sql/updates/world/2013_07_24_01_world_spell_ranks.sql new file mode 100644 index 00000000000..db1d9803596 --- /dev/null +++ b/sql/updates/world/2013_07_24_01_world_spell_ranks.sql @@ -0,0 +1,682 @@ +DELETE FROM `spell_ranks` WHERE `first_spell_id` IN ( +5923, +5952, +9452, +9453, +9799, +11069, +11070, +11071, +11078, +11083, +11094, +11095, +11100, +11103, +11108, +11115, +11119, +11124, +11151, +11160, +11170, +11175, +11180, +11185, +11189, +11190, +11207, +11210, +11213, +11222, +11232, +11237, +11242, +11247, +11252, +11255, +12163, +12281, +12282, +12284, +12285, +12286, +12287, +12289, +12290, +12295, +12297, +12298, +12299, +12300, +12301, +12308, +12311, +12312, +12313, +12317, +12318, +12319, +12320, +12321, +12322, +12324, +12329, +12700, +12797, +12834, +12862, +13705, +13706, +13709, +13712, +13713, +13715, +13732, +13733, +13741, +13742, +13743, +13754, +13958, +13960, +13975, +13976, +13981, +13983, +14057, +14076, +14079, +14082, +14113, +14128, +14138, +14144, +14156, +14158, +14162, +14165, +14168, +14171, +14174, +14179, +14186, +14520, +14521, +14522, +14523, +14531, +14747, +14748, +14749, +14750, +14889, +14892, +14898, +14901, +14908, +14909, +14910, +14911, +14912, +14913, +15058, +15257, +15259, +15260, +15270, +15273, +15274, +15275, +15318, +15337, +15392, +16035, +16038, +16039, +16040, +16043, +16086, +16089, +16173, +16176, +16178, +16179, +16180, +16181, +16182, +16184, +16187, +16194, +16252, +16254, +16255, +16256, +16258, +16259, +16261, +16262, +16266, +16462, +16487, +16493, +16513, +16538, +16578, +16757, +16814, +16819, +16821, +16833, +16836, +16845, +16850, +16858, +16880, +16896, +16909, +16929, +16934, +16940, +16942, +16947, +16966, +16972, +16998, +17002, +17003, +17050, +17056, +17063, +17069, +17074, +17104, +17106, +17111, +17118, +17123, +17322, +17485, +17778, +17783, +17788, +17793, +17804, +17810, +17815, +17917, +17927, +17954, +17959, +18094, +18096, +18119, +18126, +18135, +18174, +18179, +18182, +18213, +18218, +18271, +18427, +18459, +18462, +18530, +18551, +18692, +18694, +18697, +18703, +18705, +18709, +18731, +18754, +18767, +18769, +18827, +19159, +19168, +19184, +19255, +19286, +19290, +19295, +19370, +19376, +19407, +19416, +19421, +19426, +19454, +19461, +19464, +19485, +19498, +19507, +19549, +19552, +19559, +19572, +19578, +19583, +19590, +19598, +19609, +19616, +19621, +20042, +20049, +20060, +20096, +20101, +20111, +20117, +20127, +20138, +20143, +20174, +20177, +20196, +20205, +20210, +20224, +20234, +20237, +20244, +20254, +20257, +20262, +20335, +20359, +20468, +20487, +20500, +20502, +20504, +23584, +23785, +24443, +24968, +25956, +26022, +27789, +27811, +27839, +27900, +28574, +28996, +28999, +29062, +29074, +29082, +29140, +29187, +29192, +29206, +29438, +29441, +29447, +29590, +29593, +29598, +29721, +29723, +29759, +29787, +29834, +29836, +29888, +30054, +30060, +30143, +30160, +30242, +30288, +30293, +30299, +30319, +30664, +30672, +30675, +30802, +30812, +30816, +30864, +30867, +30872, +30881, +30892, +30894, +30902, +30919, +31122, +31124, +31130, +31208, +31211, +31216, +31221, +31226, +31228, +31234, +31244, +31380, +31569, +31571, +31574, +31579, +31584, +31638, +31641, +31656, +31667, +31670, +31674, +31679, +31682, +31785, +31822, +31825, +31828, +31833, +31837, +31844, +31848, +31850, +31858, +31866, +31871, +31876, +31879, +32043, +32381, +32385, +32477, +33142, +33150, +33158, +33167, +33186, +33191, +33201, +33213, +33221, +33589, +33592, +33597, +33600, +33603, +33851, +33853, +33859, +33872, +33879, +33881, +33886, +34151, +34293, +34297, +34453, +34455, +34462, +34466, +34475, +34482, +34485, +34491, +34494, +34497, +34500, +34506, +34753, +34908, +34935, +34948, +34950, +35029, +35100, +35104, +35363, +35446, +35541, +35578, +35691, +37116, +44378, +44394, +44397, +44400, +44404, +44442, +44445, +44449, +44543, +44546, +44557, +44566, +44745, +45234, +46854, +46859, +46865, +46867, +46908, +46910, +46913, +46945, +46951, +47195, +47198, +47201, +47220, +47230, +47236, +47245, +47258, +47266, +47294, +47507, +47509, +47516, +47535, +47558, +47562, +47569, +47573, +47580, +47586, +48384, +48389, +48409, +48411, +48432, +48483, +48488, +48492, +48496, +48506, +48516, +48532, +48535, +48539, +48962, +48963, +48965, +48977, +48978, +48979, +48985, +48987, +48988, +48997, +49004, +49006, +49013, +49015, +49018, +49023, +49024, +49027, +49032, +49036, +49042, +49137, +49140, +49145, +49146, +49149, +49175, +49182, +49186, +49188, +49189, +49200, +49202, +49208, +49217, +49219, +49220, +49223, +49224, +49226, +49455, +49467, +49471, +49588, +50040, +50117, +50187, +50365, +50384, +50391, +50685, +50880, +51099, +51123, +51179, +51459, +51466, +51468, +51474, +51480, +51483, +51521, +51523, +51525, +51528, +51554, +51556, +51560, +51562, +51625, +51627, +51632, +51634, +51664, +51672, +51682, +51685, +51692, +51698, +51708, +51745, +51883, +52234, +52783, +52795, +53137, +53175, +53178, +53180, +53182, +53186, +53203, +53215, +53221, +53228, +53234, +53241, +53252, +53256, +53262, +53290, +53295, +53298, +53302, +53375, +53379, +53380, +53409, +53427, +53450, +53481, +53483, +53486, +53501, +53511, +53514, +53527, +53551, +53554, +53556, +53569, +53583, +53590, +53620, +53660, +53671, +53695, +53709, +53754, +54037, +54117, +54347, +54639, +54747, +55061, +55091, +55107, +55129, +55620, +55666, +56314, +56333, +56339, +56342, +56636, +56927, +57470, +57810, +57849, +57873, +57878, +58414, +58872, +59088, +61154, +61216, +61680, +61682, +61686, +61689, +62097, +62758, +62759, +62764, +62905, +63117, +63156, +63349, +63370, +63373, +63410, +63504, +63534, +63625, +63646, +63730, +64127, +64353, +65661, +66799); diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 9cedfdf922f..b1613e8a8cd 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1187,23 +1187,88 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 return true; } -void SpellMgr::LoadSpellRanks() +void SpellMgr::UnloadSpellInfoChains() { - uint32 oldMSTime = getMSTime(); + for (SpellChainMap::iterator itr = mSpellChains.begin(); itr != mSpellChains.end(); ++itr) + mSpellInfoMap[itr->first]->ChainEntry = NULL; + + mSpellChains.clear(); +} +void SpellMgr::LoadSpellTalentRanks() +{ // cleanup core data before reload - remove reference to ChainNode from SpellInfo - for (SpellChainMap::iterator itr = mSpellChains.begin(); itr != mSpellChains.end(); ++itr) + UnloadSpellInfoChains(); + + for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { - mSpellInfoMap[itr->first]->ChainEntry = NULL; + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); + if (!talentInfo) + continue; + + SpellInfo const* lastSpell = NULL; + for (uint8 rank = MAX_TALENT_RANK - 1; rank > 0; --rank) + { + if (talentInfo->RankID[rank]) + { + lastSpell = GetSpellInfo(talentInfo->RankID[rank]); + break; + } + } + + if (!lastSpell) + continue; + + SpellInfo const* firstSpell = GetSpellInfo(talentInfo->RankID[0]); + if (!firstSpell) + { + TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SpellMgr::LoadSpellTalentRanks: First Rank Spell %u for TalentEntry %u does not exist.", talentInfo->RankID[0], i); + continue; + } + + SpellInfo const* prevSpell = NULL; + for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) + { + uint32 spellId = talentInfo->RankID[rank]; + if (!spellId) + break; + + SpellInfo const* currentSpell = GetSpellInfo(spellId); + if (!currentSpell) + { + TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "SpellMgr::LoadSpellTalentRanks: Spell %u (Rank: %u) for TalentEntry %u does not exist.", spellId, rank + 1, i); + break; + } + + SpellChainNode node; + node.first = firstSpell; + node.last = lastSpell; + node.rank = rank + 1; + + node.prev = prevSpell; + node.next = node.rank < MAX_TALENT_RANK ? GetSpellInfo(talentInfo->RankID[rank + 1]) : NULL; + + mSpellChains[spellId] = node; + mSpellInfoMap[spellId]->ChainEntry = &mSpellChains[spellId]; + + prevSpell = currentSpell; + } } - mSpellChains.clear(); +} + +void SpellMgr::LoadSpellRanks() +{ + // cleanup data and load spell ranks for talents from dbc + LoadSpellTalentRanks(); + + uint32 oldMSTime = getMSTime(); + // 0 1 2 QueryResult result = WorldDatabase.Query("SELECT first_spell_id, spell_id, rank from spell_ranks ORDER BY first_spell_id, rank"); if (!result) { TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell rank records. DB table `spell_ranks` is empty."); - return; } @@ -1280,6 +1345,10 @@ void SpellMgr::LoadSpellRanks() { ++count; int32 addedSpell = itr->first; + + if (mSpellInfoMap[addedSpell]->ChainEntry) + TC_LOG_ERROR(LOG_FILTER_SQL, "Spell %u (rank: %u, first: %u) listed in `spell_ranks` has already ChainEntry from dbc.", addedSpell, itr->second, lastSpell); + mSpellChains[addedSpell].first = GetSpellInfo(lastSpell); mSpellChains[addedSpell].last = GetSpellInfo(rankChain.back().first); mSpellChains[addedSpell].rank = itr->second; @@ -1296,10 +1365,10 @@ void SpellMgr::LoadSpellRanks() mSpellChains[addedSpell].next = GetSpellInfo(itr->first); } while (true); - } while (!finished); + } + while (!finished); TC_LOG_INFO(LOG_FILTER_SERVER_LOADING, ">> Loaded %u spell rank records in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); - } void SpellMgr::LoadSpellRequired() diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index b7a3294efe3..6220ece3ded 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -696,6 +696,8 @@ class SpellMgr public: // Loading data at server startup + void UnloadSpellInfoChains(); + void LoadSpellTalentRanks(); void LoadSpellRanks(); void LoadSpellRequired(); void LoadSpellLearnSkills(); |