[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

@ -130,22 +130,28 @@ void WorldSession::HandleMoveWorldportAckOpcode()
_player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
// battleground state prepare
if(_player->InBattleGround())
// only add to bg group and object, if the player was invited (else he entered through command)
if(_player->InBattleGround() && _player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
{
BattleGround *bg = _player->GetBattleGround();
if(bg)
{
bg->AddPlayer(_player);
if(bg->GetMapId() == _player->GetMapId()) // we teleported to bg
{
if(!bg->GetBgRaid(_player->GetTeam())) // first player joined
// get the team this way, because arenas might 'override' the teams.
uint32 team = bg->GetPlayerTeam(_player->GetGUID());
if(!team)
team = _player->GetTeam();
if(!bg->GetBgRaid(team)) // first player joined
{
Group *group = new Group;
bg->SetBgRaid(_player->GetTeam(), group);
bg->SetBgRaid(team, group);
group->Create(_player->GetGUIDLow(), _player->GetName());
}
else // raid already exist
{
bg->GetBgRaid(_player->GetTeam())->AddMember(_player->GetGUID(), _player->GetName());
bg->GetBgRaid(team)->AddMember(_player->GetGUID(), _player->GetName());
}
}
}
@ -370,20 +376,29 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
if(movementInfo.z < -500.0f)
{
// NOTE: this is actually called many times while falling
// even after the player has been teleported away
// TODO: discard movement packets after the player is rooted
if(GetPlayer()->isAlive())
if(GetPlayer()->InBattleGround()
&& GetPlayer()->GetBattleGround()
&& GetPlayer()->GetBattleGround()->HandlePlayerUnderMap(_player))
{
GetPlayer()->EnvironmentalDamage(GetPlayer()->GetGUID(),DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
// change the death state to CORPSE to prevent the death timer from
// starting in the next player update
GetPlayer()->KillPlayer();
GetPlayer()->BuildPlayerRepop();
// do nothing, the handle already did if returned true
}
else
{
// NOTE: this is actually called many times while falling
// even after the player has been teleported away
// TODO: discard movement packets after the player is rooted
if(GetPlayer()->isAlive())
{
GetPlayer()->EnvironmentalDamage(GetPlayer()->GetGUID(),DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
// change the death state to CORPSE to prevent the death timer from
// starting in the next player update
GetPlayer()->KillPlayer();
GetPlayer()->BuildPlayerRepop();
}
// cancel the death timer here if started
GetPlayer()->RepopAtGraveyard();
// cancel the death timer here if started
GetPlayer()->RepopAtGraveyard();
}
}
}