Changeset 9 for trunk/src/game/BattleGroundBE.cpp
- Timestamp:
- 11/19/08 13:22:41 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/BattleGroundBE.cpp
r2 r9 48 48 { 49 49 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 } 50 56 for(uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; i++) 51 57 SpawnBGObject(i, RESPAWN_IMMEDIATELY); … … 87 93 if(Player *plr = objmgr.GetPlayer(itr->first)) 88 94 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); 89 100 } 90 101 } … … 103 114 104 115 m_PlayerScores[plr->GetGUID()] = sc; 116 117 UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE)); 118 UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE)); 105 119 } 106 120 107 121 void BattleGroundBE::RemovePlayer(Player *plr, uint64 guid) 108 122 { 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); 110 133 } 111 134 … … 121 144 } 122 145 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)) 130 152 { 131 153 // 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 163 bool BattleGroundBE::HandlePlayerUnderMap(Player *player) 164 { 165 player->TeleportTo(GetMapId(),6238.930176,262.963470,0.889519,player->GetOrientation(),false); 166 return true; 134 167 } 135 168 … … 160 193 } 161 194 195 void 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 162 202 void BattleGroundBE::ResetBGSubclass() 163 203 { 164 m_TeamKills[BG_TEAM_ALLIANCE] = 0; 165 m_TeamKills[BG_TEAM_HORDE] = 0; 204 166 205 } 167 206