diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/SpellAuras.cpp | 77 | ||||
-rw-r--r-- | src/game/SpellMgr.cpp | 63 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 2 | ||||
-rw-r--r-- | src/shared/revision_nr.h | 2 |
4 files changed, 95 insertions, 49 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index c922927a1fe..7177c137dd2 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1905,22 +1905,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_modifier.m_amount = caster->SpellHealingBonus(m_target, GetSpellProto(), m_modifier.m_amount, SPELL_DIRECT_DAMAGE); return; } - - // some auras applied at aura apply - if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER) - { - SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId()); - if(saBounds.first != saBounds.second) - { - uint32 zone = m_target->GetZoneId(); - uint32 area = m_target->GetAreaId(); - - for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) - if(itr->second->autocast && itr->second->IsFitToRequirements((Player*)m_target,zone,area)) - if( !m_target->HasAura(itr->second->spellId,0) ) - m_target->CastSpell(m_target,itr->second->spellId,true); - } - } } // AT REMOVE else @@ -1985,21 +1969,6 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_target->SetReducedThreatPercent(0, 0); return; } - - // some auras remove at aura remove - if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER) - { - SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId()); - if(saBounds.first != saBounds.second) - { - uint32 zone = m_target->GetZoneId(); - uint32 area = m_target->GetAreaId(); - - for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) - if(!itr->second->IsFitToRequirements((Player*)m_target,zone,area)) - m_target->RemoveAurasDueToSpell(itr->second->spellId); - } - } } // AT APPLY & REMOVE @@ -2250,6 +2219,29 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_target->RemovePetAura(petSpell); return; } + + if(GetEffIndex()==0 && m_target->GetTypeId()==TYPEID_PLAYER) + { + SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId()); + if(saBounds.first != saBounds.second) + { + uint32 zone = m_target->GetZoneId(); + uint32 area = m_target->GetAreaId(); + + for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + { + // some auras remove at aura remove + if(!itr->second->IsFitToRequirements((Player*)m_target,zone,area)) + m_target->RemoveAurasDueToSpell(itr->second->spellId); + // some auras applied at aura apply + else if(itr->second->autocast) + { + if( !m_target->HasAura(itr->second->spellId,0) ) + m_target->CastSpell(m_target,itr->second->spellId,true); + } + } + } + } } void Aura::HandleAuraMounted(bool apply, bool Real) @@ -6599,6 +6591,29 @@ void Aura::HandlePhase(bool apply, bool Real) m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL,false); ((Player*)m_target)->GetSession()->SendSetPhaseShift(apply ? GetMiscValue() : PHASEMASK_NORMAL); + + if(GetEffIndex()==0) + { + SpellAreaForAreaMapBounds saBounds = spellmgr.GetSpellAreaForAuraMapBounds(GetId()); + if(saBounds.first != saBounds.second) + { + uint32 zone = m_target->GetZoneId(); + uint32 area = m_target->GetAreaId(); + + for(SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr) + { + // some auras remove at aura remove + if(!itr->second->IsFitToRequirements((Player*)m_target,zone,area)) + m_target->RemoveAurasDueToSpell(itr->second->spellId); + // some auras applied at aura apply + else if(itr->second->autocast) + { + if( !m_target->HasAura(itr->second->spellId,0) ) + m_target->CastSpell(m_target,itr->second->spellId,true); + } + } + } + } } else m_target->SetPhaseMask(apply ? GetMiscValue() : PHASEMASK_NORMAL,false); 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; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 4eeeb628709..75615eaf3a0 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -726,7 +726,7 @@ struct SpellArea uint32 areaId; // zone/subzone/or 0 is not limited to zone uint32 questStart; // quest start (quest must be active or rewarded for spell apply) uint32 questEnd; // quest end (quest don't must be rewarded for spell apply) - uint32 auraSpell; // spell aura must be applied for spell apply + int32 auraSpell; // spell aura must be applied for spell apply )if possitive) and it don't must be applied in other case uint32 raceMask; // can be applied only to races Gender gender; // can be applied only to gender bool questStartCanActive; // if true then quest start can be active (not only rewarded) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f58ae1cc2eb..80833c7f634 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 "7374" + #define REVISION_NR "7376" #endif // __REVISION_NR_H__ |