Updated Copyright year to 2013
[getmangos.git] / src / game / BattleGround / BattleGroundNA.cpp
blobe903b73b37b35f96323c77093bfc3674049e2653
1 /*
2 * Copyright (C) 2005-2013 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "Object.h"
20 #include "Player.h"
21 #include "BattleGround.h"
22 #include "BattleGroundNA.h"
23 #include "ObjectMgr.h"
24 #include "WorldPacket.h"
25 #include "Language.h"
27 BattleGroundNA::BattleGroundNA()
29 m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
30 m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
31 m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
32 m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
33 // we must set messageIds
34 m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
35 m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
36 m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
37 m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
40 BattleGroundNA::~BattleGroundNA()
45 void BattleGroundNA::Update(uint32 diff)
47 BattleGround::Update(diff);
49 /*if (GetStatus() == STATUS_IN_PROGRESS)
51 // update something
52 }*/
55 void BattleGroundNA::StartingEventCloseDoors()
59 void BattleGroundNA::StartingEventOpenDoors()
61 OpenDoorEvent(BG_EVENT_DOOR);
64 void BattleGroundNA::AddPlayer(Player* plr)
66 BattleGround::AddPlayer(plr);
67 // create score and add it to map, default values are set in constructor
68 BattleGroundNAScore* sc = new BattleGroundNAScore;
70 m_PlayerScores[plr->GetObjectGuid()] = sc;
72 UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
73 UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
76 void BattleGroundNA::RemovePlayer(Player* /*plr*/, ObjectGuid /*guid*/)
78 if (GetStatus() == STATUS_WAIT_LEAVE)
79 return;
81 UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
82 UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
84 CheckArenaWinConditions();
87 void BattleGroundNA::HandleKillPlayer(Player* player, Player* killer)
89 if (GetStatus() != STATUS_IN_PROGRESS)
90 return;
92 if (!killer)
94 sLog.outError("BattleGroundNA: Killer player not found");
95 return;
98 BattleGround::HandleKillPlayer(player, killer);
100 UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
101 UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
103 CheckArenaWinConditions();
106 bool BattleGroundNA::HandlePlayerUnderMap(Player* player)
108 player->TeleportTo(GetMapId(), 4055.504395f, 2919.660645f, 13.611241f, player->GetOrientation(), false);
109 return true;
112 void BattleGroundNA::HandleAreaTrigger(Player* source, uint32 trigger)
114 if (GetStatus() != STATUS_IN_PROGRESS)
115 return;
117 // uint32 spellId = 0;
118 // uint64 buff_guid = 0;
119 switch (trigger)
121 case 4536: // buff trigger?
122 case 4537: // buff trigger?
123 break;
124 default:
125 sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", trigger);
126 source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", trigger);
127 break;
130 // if (buff_guid)
131 // HandleTriggerBuff(buff_guid, source);
134 void BattleGroundNA::FillInitialWorldStates(WorldPacket& data, uint32& count)
136 FillInitialWorldState(data, count, 0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
137 FillInitialWorldState(data, count, 0xa10, GetAlivePlayersCountByTeam(HORDE));
138 FillInitialWorldState(data, count, 0xa11, 1);
141 void BattleGroundNA::Reset()
143 // call parent's class reset
144 BattleGround::Reset();
147 bool BattleGroundNA::SetupBattleGround()
149 return true;
153 20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86
154 0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r...........
155 0010: 00 00 01 00 00 00 0f 0a 00 00 00 00 00 00 10 0a | ................
156 0020: 00 00 00 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................
157 0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................
158 0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
159 0050: 00 00 00 00 00 00 | ......