Changeset 9 for trunk/src/game/Unit.cpp

Show
Ignore:
Timestamp:
11/19/08 13:22:41 (17 years ago)
Author:
yumileroy
Message:

[svn] -enabled instantiated battlegrounds
-enabled arena matches
-rewritten battleground queuing to support joining as group
-removed queue announcements

Original author: w12x
Date: 2008-10-05 08:48:32-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Unit.cpp

    r6 r9  
    594594    if (health <= damage) 
    595595    { 
    596         // battleground things 
    597         if(pVictim->GetTypeId() == TYPEID_PLAYER && (((Player*)pVictim)->InBattleGround())) 
    598         { 
    599             Player *killed = ((Player*)pVictim); 
    600             Player *killer = NULL; 
    601             if(GetTypeId() == TYPEID_PLAYER) 
    602                 killer = ((Player*)this); 
    603             else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) 
    604             { 
    605                 Unit *owner = GetOwner(); 
    606                 if(owner && owner->GetTypeId() == TYPEID_PLAYER) 
    607                     killer = ((Player*)owner); 
    608             } 
    609  
    610             if(killer) 
    611                 if(BattleGround *bg = killed->GetBattleGround()) 
    612                     bg->HandleKillPlayer(killed, killer);   // drop flags and etc 
    613         } 
    614  
    615596        DEBUG_LOG("DealDamage: victim just died"); 
    616597 
     
    750731 
    751732            he->DuelComplete(DUEL_INTERUPTED); 
     733        } 
     734 
     735        // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill) 
     736        if(pVictim->GetTypeId() == TYPEID_PLAYER && (((Player*)pVictim)->InBattleGround())) 
     737        { 
     738            Player *killed = ((Player*)pVictim); 
     739            Player *killer = NULL; 
     740            if(GetTypeId() == TYPEID_PLAYER) 
     741                killer = ((Player*)this); 
     742            else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) 
     743            { 
     744                Unit *owner = GetOwner(); 
     745                if(owner && owner->GetTypeId() == TYPEID_PLAYER) 
     746                    killer = ((Player*)owner); 
     747            } 
     748 
     749            if(killer) 
     750                if(BattleGround *bg = killed->GetBattleGround()) 
     751                    bg->HandleKillPlayer(killed, killer);   // drop flags and etc 
    752752        } 
    753753    } 
     
    41414141        AuraMap::iterator iter = m_Auras.begin(); 
    41424142        RemoveAura(iter); 
     4143    } 
     4144} 
     4145 
     4146void Unit::RemoveArenaAuras(bool onleave) 
     4147{ 
     4148    // in join, remove positive buffs, on end, remove negative 
     4149    // used to remove positive visible auras in arenas 
     4150    for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();) 
     4151    { 
     4152        if ( !(iter->second->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras 
     4153            && !iter->second->IsPassive()                               // don't remove passive auras 
     4154            && (!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) || !(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNK8))   // not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable) 
     4155            && (iter->second->IsPositive() ^ onleave))                   // remove positive buffs on enter, negative buffs on leave 
     4156            RemoveAura(iter); 
     4157        else 
     4158            ++iter; 
    41434159    } 
    41444160}