aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-07-23 09:30:05 +0800
committermegamage <none@none>2009-07-23 09:30:05 +0800
commitf481e7b14db88700631c01c58b23a1a2f7f4efb6 (patch)
treea0f9d08fec1f7e2a69782d4902b378da7ffb3634
parente79656b75a3a4272f25457b11856f8ca9df29ba4 (diff)
[8191] Drop code related to use long time empty `spell_affect` table. Author: XTZGZoReX
After switch to 3.x.x all data get explcitly from ClassMask fields in spell.dbc and no need in custom values. --HG-- branch : trunk
-rw-r--r--sql/FULL/world_spell_full.sql8
-rw-r--r--sql/mangos.sql25
-rw-r--r--sql/updates/4542_8191_world_spell_affect.sql3
-rw-r--r--src/game/Chat.cpp1
-rw-r--r--src/game/Chat.h1
-rw-r--r--src/game/Level3.cpp9
-rw-r--r--src/game/Player.cpp6
-rw-r--r--src/game/SpellAuras.cpp13
-rw-r--r--src/game/SpellMgr.cpp72
-rw-r--r--src/game/SpellMgr.h13
-rw-r--r--src/game/World.cpp3
11 files changed, 9 insertions, 145 deletions
diff --git a/sql/FULL/world_spell_full.sql b/sql/FULL/world_spell_full.sql
index 006373cddf1..667b2346950 100644
--- a/sql/FULL/world_spell_full.sql
+++ b/sql/FULL/world_spell_full.sql
@@ -1924,14 +1924,6 @@ INSERT INTO `spell_elixir` (`entry`, `mask`) VALUES
(62380, 0x3);
-- --------
--- SPELL AFFECT
--- --------
-
-TRUNCATE TABLE `spell_affect`;
-INSERT INTO `spell_affect` (`entry`, `effectId`, `SpellClassMask0`, `SpellClassMask1`, `SpellClassMask2`) VALUES
-(44544,0,685904631,1151048,0); -- Fingers of frost
-
--- --------
-- Death Knight
-- --------
DELETE FROM `spell_script_target` WHERE entry IN
diff --git a/sql/mangos.sql b/sql/mangos.sql
index 7d551217827..ed429442af9 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;
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/4542_8191_world_spell_affect.sql b/sql/updates/4542_8191_world_spell_affect.sql
new file mode 100644
index 00000000000..74e28a00b59
--- /dev/null
+++ b/sql/updates/4542_8191_world_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/src/game/Chat.cpp b/src/game/Chat.cpp
index 9ae5678c752..b14a7f94e6e 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -479,7 +479,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_required", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellRequiredCommand, "", NULL },
{ "spell_area", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellAreaCommand, "", NULL },
{ "spell_bonus_data", SEC_ADMINISTRATOR, true, &ChatHandler::HandleReloadSpellBonusesCommand, "", NULL },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 55116bae711..be4ad5f31c2 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -399,7 +399,6 @@ class ChatHandler
bool HandleReloadSkillDiscoveryTemplateCommand(const char* args);
bool HandleReloadSkillExtraItemTemplateCommand(const char* args);
bool HandleReloadSkillFishingBaseLevelCommand(const char* args);
- bool HandleReloadSpellAffectCommand(const char* args);
bool HandleReloadSpellRequiredCommand(const char* args);
bool HandleReloadSpellAreaCommand(const char* args);
bool HandleReloadSpellElixirCommand(const char* args);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index b82a6a845da..459beeff2f4 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -644,7 +644,6 @@ bool ChatHandler::HandleReloadAllSpellCommand(const char*)
{
HandleReloadSkillDiscoveryTemplateCommand("a");
HandleReloadSkillExtraItemTemplateCommand("a");
- HandleReloadSpellAffectCommand("a");
HandleReloadSpellRequiredCommand("a");
HandleReloadSpellAreaCommand("a");
HandleReloadSpellElixirCommand("a");
@@ -992,14 +991,6 @@ bool ChatHandler::HandleReloadSkillFishingBaseLevelCommand(const char* /*args*/)
return true;
}
-bool ChatHandler::HandleReloadSpellAffectCommand(const char*)
-{
- sLog.outString( "Re-Loading SpellAffect definitions..." );
- spellmgr.LoadSpellAffects();
- SendGlobalGMSysMessage("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/Player.cpp b/src/game/Player.cpp
index 41ed4882826..3f799b90352 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -17387,11 +17387,7 @@ void Player::RemoveSpellMods(Spell * spell)
checkedSpells.find(aur->GetParentAura()) != checkedSpells.end())
continue;
- flag96 const * mask = spellmgr.GetSpellAffect(aur->GetId(), aur->GetEffIndex());
- if (!mask)
- mask = &spellInfo->EffectSpellClassMask[aur->GetEffIndex()];
-
- if (spell->m_spellInfo->SpellFamilyFlags & *mask)
+ if (spell->m_spellInfo->SpellFamilyFlags & spellInfo->EffectSpellClassMask[aur->GetEffIndex()])
{
checkedSpells.insert(aur->GetParentAura());
spell->m_appliedMods.erase(aur->GetParentAura());
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 085ef00d191..f9b7d406061 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1718,12 +1718,8 @@ bool AuraEffect::isAffectedOnSpell(SpellEntry const *spell) const
if (spell->SpellFamilyName != m_spellProto->SpellFamilyName)
return false;
- // Check EffectClassMask and Spell_Affect table
- flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex);
- if (!spellAffect)
- spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex];
-
- if (*spellAffect & spell->SpellFamilyFlags)
+ // Check EffectClassMask
+ if (m_spellProto->EffectSpellClassMask[m_effIndex] & spell->SpellFamilyFlags)
return true;
return false;
}
@@ -1768,10 +1764,7 @@ void AuraEffect::HandleAddModifier(bool apply, bool Real, bool changeAmount)
mod->type = SpellModType(m_auraName); // SpellModType value == spell aura types
mod->spellId = GetId();
- flag96 const *spellAffect = spellmgr.GetSpellAffect(GetId(), m_effIndex);
- if (!spellAffect)
- spellAffect = &m_spellProto->EffectSpellClassMask[m_effIndex];
- mod->mask = *spellAffect;
+ mod->mask = m_spellProto->EffectSpellClassMask[m_effIndex];
mod->charges = GetParentAura()->GetAuraCharges();
m_spellmod = mod;
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index eafda06077c..43268713b2e 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -1065,77 +1065,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;
- }
-
- flag96 affect(fields[2].GetUInt32(), fields[3].GetUInt32(), fields[4].GetUInt32());
-
- // Spell.dbc have own data
- if (effectId>3)
- continue;
-
- flag96 dbc_affect;
- dbc_affect = spellInfo->EffectSpellClassMask[effectId];
- if(dbc_affect[0] == affect[0] && dbc_affect[1] == affect[1] && dbc_affect[2] == affect[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 );
-}
-
bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const
{
// false for spellInfo == NULL
@@ -3815,6 +3744,7 @@ void SpellMgr::LoadSpellCustomAttr()
break;
case 44544: // Fingers of Frost
spellInfo->procCharges=2;
+ spellInfo->EffectSpellClassMask[0] = flag96(685904631,1151048,0);
break;
case 28200: // Ascendance (Talisman of Ascendance trinket)
spellInfo->procCharges=6;
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index b32f77b18c7..ec602682a50 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -391,9 +391,6 @@ bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group);
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group);
int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellEntry const* spellproto);
-// Spell affects related declarations (accessed using SpellMgr functions)
-typedef UNORDERED_MAP<uint32, flag96> SpellAffectMap;
-
// Spell proc event related declarations (accessed using SpellMgr functions)
enum ProcFlags
{
@@ -735,14 +732,6 @@ class SpellMgr
// Accessors (const or static functions)
public:
- // Spell affects
- flag96 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;
@@ -1061,7 +1050,6 @@ class SpellMgr
void LoadSpellLearnSkills();
void LoadSpellLearnSpells();
void LoadSpellScriptTarget();
- void LoadSpellAffects();
void LoadSpellElixirs();
void LoadSpellProcEvents();
void LoadSpellBonusess();
@@ -1087,7 +1075,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 9ad5156801d..db59f101389 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1364,9 +1364,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();