[6910] Implemented rewritten arenas. Original author w12x@getmangos.com

Many thanks also to:
  Balrok@github.com for long time updating.
  Triply@github.com for great work in rewriting process.
  All who I forget to name.
Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
ApoC 2008-12-15 23:52:46 +01:00
parent c51a6bc59e
commit a5331ab517
47 changed files with 3406 additions and 924 deletions

View file

@ -605,25 +605,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
((Creature*)pVictim)->SetLootRecipient(this);
if (health <= damage)
{
// battleground things
if(pVictim->GetTypeId() == TYPEID_PLAYER && (((Player*)pVictim)->InBattleGround()))
{
Player *killed = ((Player*)pVictim);
Player *killer = NULL;
if(GetTypeId() == TYPEID_PLAYER)
killer = ((Player*)this);
else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
{
Unit *owner = GetOwner();
if(owner && owner->GetTypeId() == TYPEID_PLAYER)
killer = ((Player*)owner);
}
if(killer)
if(BattleGround *bg = killed->GetBattleGround())
bg->HandleKillPlayer(killed, killer); // drop flags and etc
}
DEBUG_LOG("DealDamage: victim just died");
// find player: owner of controlled `this` or `this` itself maybe
@ -762,6 +743,19 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
he->DuelComplete(DUEL_INTERUPTED);
}
// battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
if(pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->InBattleGround())
{
Player *killed = ((Player*)pVictim);
if(BattleGround *bg = killed->GetBattleGround())
if(player)
bg->HandleKillPlayer(killed, player);
//later we can add support for creature->player kills here i'm
//not sure, but i guess those kills also get counted in av
//else if(GetTypeId() == TYPEID_UNIT)
// bg->HandleKillPlayer(killed,(Creature*)this);
}
}
else // if (health <= damage)
{
@ -4173,6 +4167,22 @@ void Unit::RemoveAllAuras()
}
}
void Unit::RemoveArenaAuras(bool onleave)
{
// in join, remove positive buffs, on end, remove negative
// used to remove positive visible auras in arenas
for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
{
if ( !(iter->second->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras
&& !iter->second->IsPassive() // don't remove passive auras
&& (!(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)
&& (iter->second->IsPositive() ^ onleave)) // remove positive buffs on enter, negative buffs on leave
RemoveAura(iter);
else
++iter;
}
}
void Unit::RemoveAllAurasOnDeath()
{
// used just after dieing to remove all visible auras