Changeset 9 for trunk/src/game/BattleGroundRL.cpp
- Timestamp:
- 11/19/08 13:22:41 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/BattleGroundRL.cpp
r2 r9 48 48 m_Events |= 0x01; 49 49 50 // setup here, only when at least one player has ported to the map 51 if(!SetupBattleGround()) 52 { 53 EndNow(); 54 return; 55 } 56 50 57 for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; i++) 51 58 SpawnBGObject(i, RESPAWN_IMMEDIATELY); … … 73 80 for(uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; i++) 74 81 DoorOpen(i); 82 83 for(uint32 i = BG_RL_OBJECT_BUFF_1; i <= BG_RL_OBJECT_BUFF_2; i++) 84 SpawnBGObject(i, 60); 75 85 76 86 SendMessageToAll(LANG_ARENA_BEGUN); … … 81 91 if(Player *plr = objmgr.GetPlayer(itr->first)) 82 92 plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION); 93 94 if(!GetPlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE)) 95 EndBattleGround(HORDE); 96 else if(GetPlayersCountByTeam(ALLIANCE) && !GetPlayersCountByTeam(HORDE)) 97 EndBattleGround(ALLIANCE); 83 98 } 84 99 } … … 97 112 98 113 m_PlayerScores[plr->GetGUID()] = sc; 114 115 UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); 116 UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); 99 117 } 100 118 101 119 void BattleGroundRL::RemovePlayer(Player *plr, uint64 guid) 102 120 { 103 121 if(GetStatus() == STATUS_WAIT_LEAVE) 122 return; 123 124 UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); 125 UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); 126 127 if(!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE)) 128 EndBattleGround(HORDE); 129 else if(GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE)) 130 EndBattleGround(ALLIANCE); 104 131 } 105 132 … … 115 142 } 116 143 117 BattleGround::HandleKillPlayer(player, killer); 118 119 uint32 killer_team_index = GetTeamIndexByTeamId(killer->GetTeam()); 120 121 ++m_TeamKills[killer_team_index]; // add kills to killer's team 122 123 if(m_TeamKills[killer_team_index] >= GetPlayersCountByTeam(player->GetTeam())) 144 BattleGround::HandleKillPlayer(player,killer); 145 146 UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE)); 147 UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE)); 148 149 if(!GetAlivePlayersCountByTeam(ALLIANCE)) 124 150 { 125 151 // all opponents killed 126 EndBattleGround(killer->GetTeam()); 127 } 152 EndBattleGround(HORDE); 153 } 154 else if(!GetAlivePlayersCountByTeam(HORDE)) 155 { 156 // all opponents killed 157 EndBattleGround(ALLIANCE); 158 } 159 } 160 161 bool BattleGroundRL::HandlePlayerUnderMap(Player *player) 162 { 163 player->TeleportTo(GetMapId(),1285.810547,1667.896851,39.957642,player->GetOrientation(),false); 164 return true; 128 165 } 129 166 … … 151 188 } 152 189 190 void BattleGroundRL::FillInitialWorldStates(WorldPacket &data) 191 { 192 data << uint32(0xbb8) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7 193 data << uint32(0xbb9) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8 194 data << uint32(0xbba) << uint32(1); // 9 195 } 196 153 197 void BattleGroundRL::ResetBGSubclass() 154 198 { 155 m_TeamKills[BG_TEAM_ALLIANCE] = 0; 156 m_TeamKills[BG_TEAM_HORDE] = 0; 199 157 200 } 158 201 … … 160 203 { 161 204 // gates 162 if( !AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561f, 1601.938f, 31.60557f, -1.457349f, 0, 0, -0.6658813f, 0.7460576f, RESPAWN_IMMEDIATELY) 163 || !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648f, 1730.557f, 31.60557f, 1.684245f, 0, 0, 0.7460582f, 0.6658807f, RESPAWN_IMMEDIATELY)) 205 if( !AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY) 206 || !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648, 1730.557, 31.60557, 1.684245, 0, 0, 0.7460582, 0.6658807, RESPAWN_IMMEDIATELY) 207 // buffs 208 || !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971, 1632.719971, 36.730400, -1.448624, 0, 0, 0.6626201, -0.7489557, 120) 209 || !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049, 1699.170044, 34.872601, -0.06981307, 0, 0, 0.03489945, -0.9993908, 120)) 164 210 { 165 211 sLog.outErrorDb("BatteGroundRL: Failed to spawn some object!");