diff options
Diffstat (limited to 'src/game/SpellMgr.cpp')
-rw-r--r-- | src/game/SpellMgr.cpp | 63 |
1 files changed, 47 insertions, 16 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index e294742e5c1..80abcf0258d 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2688,7 +2688,7 @@ void SpellMgr::LoadSpellAreas() spellArea.questStart = fields[2].GetUInt32(); spellArea.questStartCanActive = fields[3].GetBool(); spellArea.questEnd = fields[4].GetUInt32(); - spellArea.auraSpell = fields[5].GetUInt32(); + spellArea.auraSpell = fields[5].GetInt32(); spellArea.raceMask = fields[6].GetUInt32(); spellArea.gender = Gender(fields[7].GetUInt8()); spellArea.autocast = fields[8].GetBool(); @@ -2699,10 +2699,35 @@ void SpellMgr::LoadSpellAreas() continue; } - if(mSpellAreaForAuraMap.find(spellArea.spellId)!=mSpellAreaForAuraMap.end()) { - sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement that already listed in table itself", spell,spellArea.auraSpell); - continue; + bool ok = true; + SpellAreaMapBounds sa_bounds = GetSpellAreaMapBounds(spellArea.spellId); + for(SpellAreaMap::const_iterator itr = sa_bounds.first; itr != sa_bounds.second; ++itr) + { + if(spellArea.spellId && itr->second.spellId && spellArea.spellId != itr->second.spellId) + continue; + if(spellArea.areaId && itr->second.areaId && spellArea.areaId!= itr->second.areaId) + continue; + if(spellArea.questStart && itr->second.questStart && spellArea.questStart!= itr->second.questStart) + continue; + if(spellArea.auraSpell && itr->second.auraSpell && spellArea.auraSpell!= itr->second.auraSpell) + continue; + if(spellArea.raceMask && itr->second.raceMask && (spellArea.raceMask & itr->second.raceMask)==0) + continue; + if(spellArea.gender != GENDER_NONE && itr->second.gender != GENDER_NONE && spellArea.gender!= itr->second.gender) + continue; + + // duplicate by requirements + ok =false; + break; + } + + if(!ok) + { + sLog.outErrorDb("Spell %u listed in `spell_area` already listed with similar requirements.", spell); + continue; + } + } if(spellArea.areaId && !GetAreaEntryByAreaID(spellArea.areaId)) @@ -2734,33 +2759,33 @@ void SpellMgr::LoadSpellAreas() if(spellArea.auraSpell) { - SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellArea.auraSpell); + SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(spellArea.auraSpell)); if(!spellInfo) { - sLog.outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell,spellArea.auraSpell); + sLog.outErrorDb("Spell %u listed in `spell_area` have wrong aura spell (%u) requirement", spell,abs(spellArea.auraSpell)); continue; } - if(spellInfo->EffectApplyAuraName[0]!=SPELL_AURA_DUMMY) + if(spellInfo->EffectApplyAuraName[0]!=SPELL_AURA_DUMMY && spellInfo->EffectApplyAuraName[0]!=SPELL_AURA_PHASE) { - sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell requirement (%u) without dummy aura in effect 0", spell,spellArea.auraSpell); + sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell requirement (%u) without dummy/phase aura in effect 0", spell,abs(spellArea.auraSpell)); continue; } - if(spellArea.auraSpell==spellArea.spellId) + if(abs(spellArea.auraSpell)==spellArea.spellId) { - sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell,spellArea.auraSpell); + sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell,abs(spellArea.auraSpell)); continue; } - // not allow autocast chains by auraSpell field - if(spellArea.autocast) + // not allow autocast chains by auraSpell field (but allow use as alternative if not present) + if(spellArea.autocast && spellArea.auraSpell > 0) { bool chain = false; SpellAreaForAuraMapBounds saBound = GetSpellAreaForAuraMapBounds(spellArea.spellId); for(SpellAreaForAuraMap::const_iterator itr = saBound.first; itr != saBound.second; ++itr) { - if(itr->second->autocast) + if(itr->second->autocast && itr->second->auraSpell > 0) { chain = true; break; @@ -2776,7 +2801,7 @@ void SpellMgr::LoadSpellAreas() SpellAreaMapBounds saBound2 = GetSpellAreaMapBounds(spellArea.auraSpell); for(SpellAreaMap::const_iterator itr2 = saBound2.first; itr2 != saBound2.second; ++itr2) { - if(itr2->second.autocast && itr2->second.auraSpell) + if(itr2->second.autocast && itr2->second.auraSpell > 0) { chain = true; break; @@ -2824,7 +2849,7 @@ void SpellMgr::LoadSpellAreas() // for search at aura apply if(spellArea.auraSpell) - mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(spellArea.auraSpell,sa)); + mSpellAreaForAuraMap.insert(SpellAreaForAuraMap::value_type(abs(spellArea.auraSpell),sa)); ++count; } while( result->NextRow() ); @@ -3123,8 +3148,14 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 if(auraSpell) { // not have expected aura - if(!player || !player->HasAura(auraSpell,0)) + if(!player) return false; + if(auraSpell > 0) + // have expected aura + return player->HasAura(auraSpell,0); + else + // not have expected aura + return !player->HasAura(-auraSpell,0); } return true; |