diff --git a/sql/mangos.sql b/sql/mangos.sql index f01f65d50..0f050d7b6 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, - `required_8190_01_mangos_creature_template` bit(1) default NULL + `required_8191_01_mangos_spell_affect` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -13542,29 +13542,6 @@ LOCK TABLES `skinning_loot_template` WRITE; /*!40000 ALTER TABLE `skinning_loot_template` ENABLE KEYS */; UNLOCK TABLES; --- --- Table structure for table `spell_affect` --- - -DROP TABLE IF EXISTS `spell_affect`; -CREATE TABLE `spell_affect` ( - `entry` smallint(5) unsigned NOT NULL default '0', - `effectId` tinyint(3) unsigned NOT NULL default '0', - `SpellClassMask0` int(5) unsigned NOT NULL default '0', - `SpellClassMask1` int(5) unsigned NOT NULL default '0', - `SpellClassMask2` int(5) unsigned NOT NULL default '0', - PRIMARY KEY (`entry`,`effectId`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - --- --- Dumping data for table `spell_affect` --- - -LOCK TABLES `spell_affect` WRITE; -/*!40000 ALTER TABLE `spell_affect` DISABLE KEYS */; -/*!40000 ALTER TABLE `spell_affect` ENABLE KEYS */; -UNLOCK TABLES; - -- -- Table structure for table `spell_area` -- diff --git a/sql/updates/8191_01_mangos_spell_affect.sql b/sql/updates/8191_01_mangos_spell_affect.sql new file mode 100644 index 000000000..55ee08420 --- /dev/null +++ b/sql/updates/8191_01_mangos_spell_affect.sql @@ -0,0 +1,3 @@ +ALTER TABLE db_version CHANGE COLUMN required_8190_01_mangos_creature_template required_8191_01_mangos_spell_affect bit; + +DROP TABLE IF EXISTS `spell_affect`; diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 77ad89347..4c96a5fbd 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -245,6 +245,7 @@ pkgdata_DATA = \ 8140_01_mangos_spell_proc_event.sql \ 8158_01_mangos_playercreateinfo_action.sql \ 8190_01_mangos_creature_template.sql \ + 8191_01_mangos_spell_affect.sql \ README ## Additional files to include when running 'make dist' @@ -470,4 +471,5 @@ EXTRA_DIST = \ 8140_01_mangos_spell_proc_event.sql \ 8158_01_mangos_playercreateinfo_action.sql \ 8190_01_mangos_creature_template.sql \ + 8191_01_mangos_spell_affect.sql \ README diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 122056050..3255e04d0 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -443,7 +443,6 @@ ChatCommand * ChatHandler::getCommandTable() { "skill_extra_item_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillExtraItemTemplateCommand, "", NULL }, { "skill_fishing_base_level", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSkillFishingBaseLevelCommand, "", NULL }, { "skinning_loot_template", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadLootTemplatesSkinningCommand, "", NULL }, - { "spell_affect", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellAffectCommand, "", NULL }, { "spell_area", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellAreaCommand, "", NULL }, { "spell_bonus_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellBonusesCommand, "", NULL }, { "spell_chain", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellChainCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index fe6c8a8a4..280d5505b 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -370,7 +370,6 @@ class ChatHandler bool HandleReloadSkillDiscoveryTemplateCommand(const char* args); bool HandleReloadSkillExtraItemTemplateCommand(const char* args); bool HandleReloadSkillFishingBaseLevelCommand(const char* args); - bool HandleReloadSpellAffectCommand(const char* args); bool HandleReloadSpellAreaCommand(const char* args); bool HandleReloadSpellChainCommand(const char* args); bool HandleReloadSpellElixirCommand(const char* args); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index ad5941e8a..df4cce2f1 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -151,7 +151,6 @@ bool ChatHandler::HandleReloadAllSpellCommand(const char*) { HandleReloadSkillDiscoveryTemplateCommand("a"); HandleReloadSkillExtraItemTemplateCommand("a"); - HandleReloadSpellAffectCommand("a"); HandleReloadSpellAreaCommand("a"); HandleReloadSpellChainCommand("a"); HandleReloadSpellElixirCommand("a"); @@ -481,14 +480,6 @@ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleReloadSpellAffectCommand(const char*) -{ - sLog.outString( "Re-Loading SpellAffect definitions..." ); - spellmgr.LoadSpellAffects(); - SendGlobalSysMessage("DB table `spell_affect` (spell mods apply requirements) reloaded."); - return true; -} - bool ChatHandler::HandleReloadSpellAreaCommand(const char*) { sLog.outString( "Re-Loading SpellArea Data..." ); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 44558e2f9..5ae984aec 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1282,19 +1282,13 @@ void Aura::HandleAddModifier(bool apply, bool Real) mod->spellId = GetId(); uint32 const *ptr; - SpellAffectEntry const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex); - if (spellAffect) - ptr = &spellAffect->SpellClassMask[0]; - else + switch (m_effIndex) { - switch (m_effIndex) - { - case 0: ptr = &m_spellProto->EffectSpellClassMaskA[0]; break; - case 1: ptr = &m_spellProto->EffectSpellClassMaskB[0]; break; - case 2: ptr = &m_spellProto->EffectSpellClassMaskC[0]; break; - default: - return; - } + case 0: ptr = &m_spellProto->EffectSpellClassMaskA[0]; break; + case 1: ptr = &m_spellProto->EffectSpellClassMaskB[0]; break; + case 2: ptr = &m_spellProto->EffectSpellClassMaskC[0]; break; + default: + return; } mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32; @@ -1328,19 +1322,13 @@ void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/) mod->spellId = GetId(); uint32 const *ptr; - SpellAffectEntry const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex); - if (spellAffect) - ptr = &spellAffect->SpellClassMask[0]; - else + switch (m_effIndex) { - switch (m_effIndex) - { - case 0: ptr = &m_spellProto->EffectSpellClassMaskA[0]; break; - case 1: ptr = &m_spellProto->EffectSpellClassMaskB[0]; break; - case 2: ptr = &m_spellProto->EffectSpellClassMaskC[0]; break; - default: - return; - } + case 0: ptr = &m_spellProto->EffectSpellClassMaskA[0]; break; + case 1: ptr = &m_spellProto->EffectSpellClassMaskB[0]; break; + case 2: ptr = &m_spellProto->EffectSpellClassMaskC[0]; break; + default: + return; } mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index fa5efea0e..06133d780 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -681,126 +681,6 @@ void SpellMgr::LoadSpellTargetPositions() sLog.outString( ">> Loaded %u spell teleport coordinates", count ); } -void SpellMgr::LoadSpellAffects() -{ - mSpellAffectMap.clear(); // need for reload case - - uint32 count = 0; - - // 0 1 2 3 4 - QueryResult *result = WorldDatabase.Query("SELECT entry, effectId, SpellClassMask0, SpellClassMask1, SpellClassMask2 FROM spell_affect"); - if( !result ) - { - - barGoLink bar( 1 ); - - bar.step(); - - sLog.outString(); - sLog.outString( ">> Loaded %u spell affect definitions", count ); - return; - } - - barGoLink bar( result->GetRowCount() ); - - do - { - Field *fields = result->Fetch(); - - bar.step(); - - uint32 entry = fields[0].GetUInt32(); - uint8 effectId = fields[1].GetUInt8(); - - SpellEntry const* spellInfo = sSpellStore.LookupEntry(entry); - - if (!spellInfo) - { - sLog.outErrorDb("Spell %u listed in `spell_affect` does not exist", entry); - continue; - } - - if (effectId >= 3) - { - sLog.outErrorDb("Spell %u listed in `spell_affect` have invalid effect index (%u)", entry,effectId); - continue; - } - - if( spellInfo->Effect[effectId] != SPELL_EFFECT_APPLY_AURA || - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_FLAT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_PCT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_TARGET_TRIGGER ) - { - sLog.outErrorDb("Spell %u listed in `spell_affect` have not SPELL_AURA_ADD_FLAT_MODIFIER (%u) or SPELL_AURA_ADD_PCT_MODIFIER (%u) or SPELL_AURA_ADD_TARGET_TRIGGER (%u) for effect index (%u)", entry,SPELL_AURA_ADD_FLAT_MODIFIER,SPELL_AURA_ADD_PCT_MODIFIER,SPELL_AURA_ADD_TARGET_TRIGGER,effectId); - continue; - } - - SpellAffectEntry affect; - affect.SpellClassMask[0] = fields[2].GetUInt32(); - affect.SpellClassMask[1] = fields[3].GetUInt32(); - affect.SpellClassMask[2] = fields[4].GetUInt32(); - - // Spell.dbc have own data - uint32 const *ptr = 0; - switch (effectId) - { - case 0: ptr = &spellInfo->EffectSpellClassMaskA[0]; break; - case 1: ptr = &spellInfo->EffectSpellClassMaskB[0]; break; - case 2: ptr = &spellInfo->EffectSpellClassMaskC[0]; break; - default: - continue; - } - if(ptr[0] == affect.SpellClassMask[0] || ptr[1] == affect.SpellClassMask[1] || ptr[2] == affect.SpellClassMask[2]) - { - char text[]="ABC"; - sLog.outErrorDb("Spell %u listed in `spell_affect` have redundant (same with EffectSpellClassMask%c) data for effect index (%u) and not needed, skipped.", entry, text[effectId], effectId); - continue; - } - - mSpellAffectMap[(entry<<8) + effectId] = affect; - - ++count; - } while( result->NextRow() ); - - delete result; - - sLog.outString(); - sLog.outString( ">> Loaded %u custom spell affect definitions", count ); - - for (uint32 id = 0; id < sSpellStore.GetNumRows(); ++id) - { - SpellEntry const* spellInfo = sSpellStore.LookupEntry(id); - if (!spellInfo) - continue; - - for (int effectId = 0; effectId < 3; ++effectId) - { - if( spellInfo->Effect[effectId] != SPELL_EFFECT_APPLY_AURA || - (spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_FLAT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_PCT_MODIFIER && - spellInfo->EffectApplyAuraName[effectId] != SPELL_AURA_ADD_TARGET_TRIGGER) ) - continue; - - uint32 const *ptr = 0; - switch (effectId) - { - case 0: ptr = &spellInfo->EffectSpellClassMaskA[0]; break; - case 1: ptr = &spellInfo->EffectSpellClassMaskB[0]; break; - case 2: ptr = &spellInfo->EffectSpellClassMaskC[0]; break; - default: - continue; - } - if(ptr[0] || ptr[1] || ptr[2]) - continue; - - if(mSpellAffectMap.find((id<<8) + effectId) != mSpellAffectMap.end()) - continue; - - sLog.outErrorDb("Spell %u (%s) misses spell_affect for effect %u",id,spellInfo->SpellName[sWorld.GetDefaultDbcLocale()], effectId); - } - } -} - bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const { // false for spellInfo == NULL diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 3b63a092b..caeb8b8cd 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -342,13 +342,6 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group); DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group); int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto); -// Spell affects related declarations (accessed using SpellMgr functions) -struct SpellAffectEntry -{ - uint32 SpellClassMask[3]; -}; -typedef UNORDERED_MAP SpellAffectMap; - // Spell proc event related declarations (accessed using SpellMgr functions) enum ProcFlags { @@ -639,14 +632,6 @@ class SpellMgr // Accessors (const or static functions) public: - // Spell affects - SpellAffectEntry const*GetSpellAffect(uint32 spellId, uint8 effectId) const - { - SpellAffectMap::const_iterator itr = mSpellAffectMap.find((spellId<<8) + effectId); - if( itr != mSpellAffectMap.end( ) ) - return &itr->second; - return 0; - } bool IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const; @@ -908,7 +893,6 @@ class SpellMgr void LoadSpellLearnSkills(); void LoadSpellLearnSpells(); void LoadSpellScriptTarget(); - void LoadSpellAffects(); void LoadSpellElixirs(); void LoadSpellProcEvents(); void LoadSpellBonusess(); @@ -927,7 +911,6 @@ class SpellMgr SpellLearnSkillMap mSpellLearnSkills; SpellLearnSpellMap mSpellLearnSpells; SpellTargetPositionMap mSpellTargetPositions; - SpellAffectMap mSpellAffectMap; SpellElixirMap mSpellElixirs; SpellProcEventMap mSpellProcEventMap; SpellBonusMap mSpellBonusMap; diff --git a/src/game/World.cpp b/src/game/World.cpp index 865356d41..0aec60ef4 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1253,9 +1253,6 @@ void World::SetInitialWorldSettings() sLog.outString( "Loading Spell target coordinates..." ); spellmgr.LoadSpellTargetPositions(); - sLog.outString( "Loading SpellAffect definitions..." ); - spellmgr.LoadSpellAffects(); - sLog.outString( "Loading spell pet auras..." ); spellmgr.LoadSpellPetAuras(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f395437a7..99a7486c2 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8190" + #define REVISION_NR "8191" #endif // __REVISION_NR_H__