diff options
-rw-r--r-- | sql/mangos.sql | 14 | ||||
-rw-r--r-- | sql/updates/4649_world_8250_spell_threat.sql | 3 | ||||
-rw-r--r-- | sql/updates/8247_01_mangos_spell_bonus_data.sql.tbd | 18 | ||||
-rw-r--r-- | src/game/DBCStructure.h | 7 | ||||
-rw-r--r-- | src/game/Spell.cpp | 9 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 44 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 13 | ||||
-rw-r--r-- | src/shared/Database/SQLStorage.cpp | 2 |
8 files changed, 60 insertions, 50 deletions
diff --git a/sql/mangos.sql b/sql/mangos.sql index bd2e0838d65..3e99024dfc6 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -17709,7 +17709,6 @@ INSERT INTO `spell_bonus_data` VALUES ('50536', '0', '0', '0.013', 'Death Knight - Unholy Blight Triggered'), ('50401', '0', '0', '0', 'Death Knight - Razor Frost'), ('56903', '0', '0', '0', 'Death Knight - Lichflame'), - ('5185', '1.6104', '0', '0', 'Druid - Healing Touch'), ('33763', '0', '0.09518', '0', 'Druid - Lifebloom'), ('774', '0', '0.37604', '0', 'Druid - Rejuvenation'), @@ -18036,7 +18035,6 @@ INSERT INTO `spell_threat` VALUES (284,39), (285,59), (770,108), -(778,108), (1608,78), (1672,180), (1715,61), @@ -18056,10 +18054,8 @@ INSERT INTO `spell_threat` VALUES (8380,180), (8972,118), (9745,148), -(9749,108), (9880,178), (9881,207), -(9907,108), (11556,43), (11564,98), (11565,118), @@ -18072,20 +18068,12 @@ INSERT INTO `spell_threat` VALUES (11600,275), (11601,315), (11775,395), -(14274,200), (14921,415), -(15629,300), -(15630,400), -(15631,500), -(15632,600), (16857,108), (17735,200), (17750,300), (17751,450), (17752,600), -(17390,108), -(17391,108), -(17392,108), (20569,100), (20736,100), (20925,20), @@ -18105,9 +18093,7 @@ INSERT INTO `spell_threat` VALUES (25286,175), (25288,355), (25289,60), -(26993,127), (26996,176), -(27011,127), (27179,54), (29704,230), (29707,196), diff --git a/sql/updates/4649_world_8250_spell_threat.sql b/sql/updates/4649_world_8250_spell_threat.sql new file mode 100644 index 00000000000..a19513363bd --- /dev/null +++ b/sql/updates/4649_world_8250_spell_threat.sql @@ -0,0 +1,3 @@ +-- ALTER TABLE db_version CHANGE COLUMN required_8249_02_mangos_spell_chain required_8250_01_mangos_spell_threat bit; + +DELETE FROM `spell_threat` WHERE `entry` IN (778,9749,9907,14274,15629,15630,15631,15632,17390,17391,17392,26993,27011);
\ No newline at end of file diff --git a/sql/updates/8247_01_mangos_spell_bonus_data.sql.tbd b/sql/updates/8247_01_mangos_spell_bonus_data.sql.tbd deleted file mode 100644 index 9af02b45d51..00000000000 --- a/sql/updates/8247_01_mangos_spell_bonus_data.sql.tbd +++ /dev/null @@ -1,18 +0,0 @@ -ALTER TABLE db_version CHANGE COLUMN required_8237_01_mangos_creature_template required_8247_01_mangos_spell_bonus_data bit; - -DELETE FROM `spell_bonus_data` where entry in (49941, 55078, 50444, 52212, 47632, 47633, 55095, 49184, 45477, 45477, 50842, 47476, 50536, 50401, 56903); -INSERT INTO `spell_bonus_data`(`entry`, `direct_bonus`, `dot_bonus`, `ap_bonus`, `comments`) VALUES -(49941, 0, 0, 0.04, "Death Knight - Blood Boil"), -(55078, 0, 0, 0.055, "Death Knight - Blood Plague Dummy Proc"), -(50444, 0, 0, 0.105, "Death Knight - Corpse Explosion Triggered"), -(52212, 0, 0, 0.0475, "Death Knight - Death and Decay Triggered"), -(47632, 0, 0, 0.15, "Death Knight - Death Coil Damage"), -(47633, 0, 0, 0.15, "Death Knight - Death Coil Heal"), -(55095, 0, 0, 0.055, "Death Knight - Frost Fever"), -(49184, 0, 0, 0.1, "Death Knight - Howling Blast"), -(45477, 0, 0, 0.1, "Death Knight - Icy Touch"), -(50842, 0, 0, 0.04, "Death Knight - Pestilence"), -(47476, 0, 0, 0.06, "Death Knight - Strangulate"), -(50536, 0, 0, 0.013, "Death Knight - Unholy Blight Triggered"), -(50401, 0, 0, 0, "Death Knight - Razor Frost"), -(56903, 0, 0, 0, "Death Knight - Lichflame"); diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index ffc37e1ee9b..910316881a4 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -1463,13 +1463,6 @@ struct SpellFocusObjectEntry // 16 string flags, unused }; -// stored in SQL table -struct SpellThreatEntry -{ - uint32 spellId; - int32 threat; -}; - struct SpellRadiusEntry { uint32 ID; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f4e992b6a7b..5c1b2fc3687 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4200,13 +4200,14 @@ void Spell::HandleThreatSpells(uint32 spellId) if(!m_targets.getUnitTarget()->CanHaveThreatList()) return; - SpellThreatEntry const *threatSpell = sSpellThreatStore.LookupEntry<SpellThreatEntry>(spellId); - if(!threatSpell) + uint16 threat = spellmgr.GetSpellThreat(spellId); + + if(!threat) return; - m_targets.getUnitTarget()->AddThreat(m_caster, float(threatSpell->threat)); + m_targets.getUnitTarget()->AddThreat(m_caster, float(threat)); - DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threatSpell->threat); + DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threat); } void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i) diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index f3e02e6d8f3..ae708153142 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1446,12 +1446,50 @@ void SpellMgr::LoadSpellElixirs() void SpellMgr::LoadSpellThreats() { - sSpellThreatStore.Free(); // for reload + mSpellThreatMap.clear(); // need for reload case - sSpellThreatStore.Load(); + uint32 count = 0; + + // 0 1 + QueryResult *result = WorldDatabase.Query("SELECT entry, Threat FROM spell_threat"); + if( !result ) + { + + barGoLink bar( 1 ); + + bar.step(); + + sLog.outString(); + sLog.outString( ">> Loaded %u aggro generating spells", count ); + return; + } + + barGoLink bar( result->GetRowCount() ); + + do + { + Field *fields = result->Fetch(); + + bar.step(); + + uint32 entry = fields[0].GetUInt32(); + uint16 Threat = fields[1].GetUInt16(); + + if (!sSpellStore.LookupEntry(entry)) + { + sLog.outErrorDb("Spell %u listed in `spell_threat` does not exist", entry); + continue; + } + + mSpellThreatMap[entry] = Threat; + + ++count; + } while( result->NextRow() ); + + delete result; - sLog.outString( ">> Loaded %u aggro generating spells", sSpellThreatStore.RecordCount ); sLog.outString(); + sLog.outString( ">> Loaded %u aggro generating spells", count ); } bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index db1473bcb3b..2540f141b43 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -40,8 +40,6 @@ class Player; class Spell; struct SpellModifier; -extern SQLStorage sSpellThreatStore; - // only used in code enum SpellCategories { @@ -526,6 +524,7 @@ typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap; #define ELIXIR_SHATTRATH_MASK 0x8 typedef std::map<uint32, uint8> SpellElixirMap; +typedef std::map<uint32, uint16> SpellThreatMap; // Spell script target related declarations (accessed using SpellMgr functions) enum SpellScriptTargetType @@ -763,6 +762,15 @@ class SpellMgr return SPELL_NORMAL; } + uint16 GetSpellThreat(uint32 spellid) const + { + SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid); + if(itr==mSpellThreatMap.end()) + return 0; + + return itr->second; + } + // Spell proc events SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const { @@ -1080,6 +1088,7 @@ class SpellMgr SpellLearnSpellMap mSpellLearnSpells; SpellTargetPositionMap mSpellTargetPositions; SpellElixirMap mSpellElixirs; + SpellThreatMap mSpellThreatMap; SpellProcEventMap mSpellProcEventMap; SpellBonusMap mSpellBonusMap; SkillLineAbilityMap mSkillLineAbilityMap; diff --git a/src/shared/Database/SQLStorage.cpp b/src/shared/Database/SQLStorage.cpp index 50fd484bff5..4113d35236d 100644 --- a/src/shared/Database/SQLStorage.cpp +++ b/src/shared/Database/SQLStorage.cpp @@ -38,7 +38,6 @@ const char GameObjectInfodstfmt[]="iiissssiifiiiiiiiiiiiiiiiiiiiiiiiiiiiii"; const char ItemPrototypesrcfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiisiiii"; const char ItemPrototypedstfmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiiiiiiiiiifiiifiiiiiifiiiiiifiiiiiifiiiiiifiiiisiiiiiiiiiiiiiiiiiiiiiiiiifiiiiiiii"; const char PageTextfmt[]="isi"; -const char SpellThreatfmt[]="ii"; const char InstanceTemplatesrcfmt[]="iiiiiiffffs"; const char InstanceTemplatedstfmt[]="iiiiiiffffi"; @@ -50,7 +49,6 @@ SQLStorage sEquipmentStorage(EquipmentInfofmt,"entry","creature_equip_template") SQLStorage sGOStorage(GameObjectInfosrcfmt, GameObjectInfodstfmt, "entry","gameobject_template"); SQLStorage sItemStorage(ItemPrototypesrcfmt, ItemPrototypedstfmt, "entry","item_template"); SQLStorage sPageTextStore(PageTextfmt,"entry","page_text"); -SQLStorage sSpellThreatStore(SpellThreatfmt,"entry","spell_threat"); SQLStorage sInstanceTemplate(InstanceTemplatesrcfmt, InstanceTemplatedstfmt, "map","instance_template"); void SQLStorage::Free () |