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/BattleGroundBE.cpp

    r2 r9  
    4848        { 
    4949            m_Events |= 0x01; 
     50            // setup here, only when at least one player has ported to the map 
     51            if(!SetupBattleGround()) 
     52            { 
     53                EndNow(); 
     54                return; 
     55            } 
    5056            for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; i++) 
    5157                SpawnBGObject(i, RESPAWN_IMMEDIATELY); 
     
    8793                if(Player *plr = objmgr.GetPlayer(itr->first)) 
    8894                    plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); 
     95 
     96            if(!GetPlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE)) 
     97                EndBattleGround(HORDE); 
     98            else if(GetPlayersCountByTeam(ALLIANCE) && !GetPlayersCountByTeam(HORDE)) 
     99                EndBattleGround(ALLIANCE); 
    89100        } 
    90101    } 
     
    103114 
    104115    m_PlayerScores[plr->GetGUID()] = sc; 
     116 
     117    UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); 
     118    UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); 
    105119} 
    106120 
    107121void BattleGroundBE::RemovePlayer(Player *plr, uint64 guid) 
    108122{ 
    109  
     123    if(GetStatus() == STATUS_WAIT_LEAVE) 
     124        return; 
     125 
     126    UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); 
     127    UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); 
     128 
     129    if(!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE)) 
     130        EndBattleGround(HORDE); 
     131    else if(GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE)) 
     132        EndBattleGround(ALLIANCE); 
    110133} 
    111134 
     
    121144    } 
    122145 
    123     BattleGround::HandleKillPlayer(player, killer); 
    124  
    125     uint32 killer_team_index = GetTeamIndexByTeamId(killer->GetTeam()); 
    126  
    127     ++m_TeamKills[killer_team_index];                       // add kills to killer's team 
    128  
    129     if(m_TeamKills[killer_team_index] >= GetPlayersCountByTeam(player->GetTeam())) 
     146    BattleGround::HandleKillPlayer(player,killer); 
     147 
     148    UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); 
     149    UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); 
     150 
     151    if(!GetAlivePlayersCountByTeam(ALLIANCE)) 
    130152    { 
    131153        // all opponents killed 
    132         EndBattleGround(killer->GetTeam()); 
    133     } 
     154        EndBattleGround(HORDE); 
     155    } 
     156    else if(!GetAlivePlayersCountByTeam(HORDE)) 
     157    { 
     158        // all opponents killed 
     159        EndBattleGround(ALLIANCE); 
     160    } 
     161} 
     162 
     163bool BattleGroundBE::HandlePlayerUnderMap(Player *player) 
     164{ 
     165    player->TeleportTo(GetMapId(),6238.930176,262.963470,0.889519,player->GetOrientation(),false); 
     166    return true; 
    134167} 
    135168 
     
    160193} 
    161194 
     195void BattleGroundBE::FillInitialWorldStates(WorldPacket &data) 
     196{ 
     197    data << uint32(0x9f1) << uint32(GetAlivePlayersCountByTeam(ALLIANCE));           // 7 
     198    data << uint32(0x9f0) << uint32(GetAlivePlayersCountByTeam(HORDE));           // 8 
     199    data << uint32(0x9f3) << uint32(1);           // 9 
     200} 
     201 
    162202void BattleGroundBE::ResetBGSubclass() 
    163203{ 
    164     m_TeamKills[BG_TEAM_ALLIANCE] = 0; 
    165     m_TeamKills[BG_TEAM_HORDE]    = 0; 
     204 
    166205} 
    167206