Changeset 44 for trunk/src/game/SpellAuras.cpp
- Timestamp:
- 11/19/08 13:27:40 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/SpellAuras.cpp
r37 r44 1 1 /* 2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> 2 * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> 3 * 4 * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> 3 5 * 4 6 * This program is free software; you can redistribute it and/or modify … … 9 11 * This program is distributed in the hope that it will be useful, 10 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 14 * GNU General Public License for more details. 13 15 * 14 16 * You should have received a copy of the GNU General Public License 15 17 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 19 */ 18 20 … … 41 43 #include "Formulas.h" 42 44 #include "BattleGround.h" 45 #include "OutdoorPvP.h" 46 #include "OutdoorPvPMgr.h" 43 47 #include "CreatureAI.h" 44 48 #include "Util.h" … … 663 667 case AREA_AURA_FRIEND: 664 668 { 665 CellPair p( MaNGOS::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY()));669 CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); 666 670 Cell cell(p); 667 671 cell.data.Part.reserved = ALL_DISTRICT; 668 672 cell.SetNoCreate(); 669 673 670 MaNGOS::AnyFriendlyUnitInObjectRangeCheck u_check(caster, owner, m_radius);671 MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(targets, u_check);672 TypeContainerVisitor< MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);673 TypeContainerVisitor< MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);674 Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(caster, owner, m_radius); 675 Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(targets, u_check); 676 TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); 677 TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); 674 678 CellLock<GridReadGuard> cell_lock(cell, p); 675 679 cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); … … 679 683 case AREA_AURA_ENEMY: 680 684 { 681 CellPair p( MaNGOS::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY()));685 CellPair p(Trinity::ComputeCellPair(caster->GetPositionX(), caster->GetPositionY())); 682 686 Cell cell(p); 683 687 cell.data.Part.reserved = ALL_DISTRICT; 684 688 cell.SetNoCreate(); 685 689 686 MaNGOS::AnyAoETargetUnitInObjectRangeCheck u_check(caster, owner, m_radius); // No GetCharmer in searcher687 MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck> searcher(targets, u_check);688 TypeContainerVisitor< MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher);689 TypeContainerVisitor< MaNGOS::UnitListSearcher<MaNGOS::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher);690 Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(caster, owner, m_radius); // No GetCharmer in searcher 691 Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck> searcher(targets, u_check); 692 TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, WorldTypeMapContainer > world_unit_searcher(searcher); 693 TypeContainerVisitor<Trinity::UnitListSearcher<Trinity::AnyAoETargetUnitInObjectRangeCheck>, GridTypeMapContainer > grid_unit_searcher(searcher); 690 694 CellLock<GridReadGuard> cell_lock(cell, p); 691 695 cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); … … 2812 2816 // Soul Shard only from non-grey units 2813 2817 if( spellInfo->EffectItemType[m_effIndex] == 6265 && 2814 (victim->getLevel() <= MaNGOS::XP::GetGrayLevel(caster->getLevel()) ||2818 (victim->getLevel() <= Trinity::XP::GetGrayLevel(caster->getLevel()) || 2815 2819 victim->GetTypeId()==TYPEID_UNIT && !((Player*)caster)->isAllowedToLoot((Creature*)victim)) ) 2816 2820 return; … … 3263 3267 if(apply) 3264 3268 { 3265 // drop flag at stealth in bg 3266 if(Real && m_target->GetTypeId()==TYPEID_PLAYER && ((Player*)m_target)->InBattleGround()) 3267 if(BattleGround *bg = ((Player*)m_target)->GetBattleGround()) 3268 bg->EventPlayerDroppedFlag((Player*)m_target); 3269 if(Real && m_target->GetTypeId()==TYPEID_PLAYER) 3270 { 3271 // drop flag at stealth in bg 3272 if(((Player*)m_target)->InBattleGround()) 3273 { 3274 if(BattleGround *bg = ((Player*)m_target)->GetBattleGround()) 3275 bg->EventPlayerDroppedFlag((Player*)m_target); 3276 } 3277 // remove player from the objective's active player count at stealth 3278 if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) 3279 pvp->HandlePlayerActivityChanged((Player*)m_target); 3280 } 3269 3281 3270 3282 // only at real aura add … … 3310 3322 } 3311 3323 else 3324 { 3312 3325 m_target->SetVisibility(VISIBILITY_ON); 3326 if(m_target->GetTypeId() == TYPEID_PLAYER) 3327 if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) 3328 pvp->HandlePlayerActivityChanged((Player*)m_target); 3329 } 3313 3330 } 3314 3331 } … … 3343 3360 // apply glow vision 3344 3361 m_target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW); 3362 // remove player from the objective's active player count at invisibility 3363 if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) 3364 pvp->HandlePlayerActivityChanged((Player*)m_target); 3345 3365 3346 3366 // drop flag at invisible in bg … … 3378 3398 // if have stealth aura then already have stealth visibility 3379 3399 if(!m_target->HasAuraType(SPELL_AURA_MOD_STEALTH)) 3400 { 3380 3401 m_target->SetVisibility(VISIBILITY_ON); 3402 if(m_target->GetTypeId() == TYPEID_PLAYER) 3403 if(OutdoorPvP * pvp = ((Player*)m_target)->GetOutdoorPvP()) 3404 pvp->HandlePlayerActivityChanged((Player*)m_target); 3405 } 3381 3406 } 3382 3407 } … … 3820 3845 } 3821 3846 } 3847 else 3848 sOutdoorPvPMgr.HandleDropFlag((Player*)m_target,GetSpellProto()->Id); 3822 3849 } 3823 3850 }