OregonCore  revision fb2a440-git
Your Favourite TBC server
BattlegroundNA.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore Project. See AUTHORS file for Copyright information
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #include "Object.h"
19 #include "Player.h"
20 #include "Battleground.h"
21 #include "BattlegroundNA.h"
22 #include "Creature.h"
23 #include "ObjectMgr.h"
24 #include "MapManager.h"
25 #include "Language.h"
26 
28 {
30 
35  //we must set messageIds
40 }
41 
43 {
44 
45 }
46 
48 {
50 }
51 
53 {
56 }
57 
59 {
61  DoorOpen(i);
62 
64  SpawnBGObject(i, 60);
65 }
66 
68 {
70  //create score and add it to map, default values are set in constructor
72 
73  m_PlayerScores[plr->GetGUID()] = sc;
74 
77 }
78 
79 void BattlegroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
80 {
82  return;
83 
86 
88 }
89 
91 {
93  return;
94 
95  if (!killer)
96  {
97  sLog.outError("BattlegroundNA: Killer player not found");
98  return;
99  }
100 
101  Battleground::HandleKillPlayer(player, killer);
102 
105 
107 }
108 
110 {
111  if (GetStatus() != STATUS_IN_PROGRESS)
112  return;
113 
114  //uint32 SpellId = 0;
115  //uint64 buff_guid = 0;
116  switch (Trigger)
117  {
118  case 4536: // buff trigger?
119  case 4537: // buff trigger?
120  break;
121  default:
122  sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
123  Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
124  break;
125  }
126 
127  //if (buff_guid)
128  // HandleTriggerBuff(buff_guid,Source);
129 }
130 
132 {
133  data << uint32(0xa0f) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7
134  data << uint32(0xa10) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8
135  data << uint32(0xa11) << uint32(1); // 9
136 }
137 
139 {
140 
141 }
142 
144 {
145  // gates
146  if ( !AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854f, 2966.833f, 12.6462f, -2.648788f, 0.0f, 0.0f, 0.9697962f, -0.2439165f, RESPAWN_IMMEDIATELY)
147  || !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179f, 2874.97f, 12.39171f, 0.4928045f, 0.0f, 0.0f, 0.2439165f, 0.9697962f, RESPAWN_IMMEDIATELY)
148  || !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709f, 2981.777f, 10.70117f, -2.648788f, 0.0f, 0.0f, 0.9697962f, -0.2439165f, RESPAWN_IMMEDIATELY)
149  || !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064f, 2858.438f, 10.23631f, 0.4928045f, 0.0f, 0.0f, 0.2439165f, 0.9697962f, RESPAWN_IMMEDIATELY)
150  // buffs
151  || !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0.0f, 0.0f, 0.6626201f, -0.7489557f, 120)
152  || !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0.0f, 0.0f, 0.03489945f, -0.9993908f, 120))
153  {
154  sLog.outErrorDb("BatteGroundNA: Failed to spawn some object!");
155  return false;
156  }
157 
158  return true;
159 }
160 
161 /*
162 20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86
163 0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r...........
164 0010: 00 00 01 00 00 00 0f 0a 00 00 00 00 00 00 10 0a | ................
165 0020: 00 00 00 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................
166 0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................
167 0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
168 0050: 00 00 00 00 00 00 | ......
169 */
170 
bool AddObject(uint32 type, uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime=0)
uint32 m_StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:728
virtual void HandleKillPlayer(Player *player, Player *killer)
void CheckArenaWinConditions()
virtual void ResetBGSubclass()
#define sLog
Log class singleton.
Definition: Log.h:187
void SpawnBGObject(uint32 type, uint32 respawntime)
void UpdateWorldState(uint32 Field, uint32 Value)
virtual void AddPlayer(Player *plr)
uint32 GetStatus() const
Definition: Battleground.h:317
BattlegroundScoreMap m_PlayerScores
Definition: Battleground.h:713
BattlegroundStartTimeIntervals m_StartDelayTimes[BG_STARTING_EVENT_COUNT]
Definition: Battleground.h:726
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
virtual void AddPlayer(Player *plr)
BGObjects m_BgObjects
Definition: Battleground.h:672
void RemovePlayer(Player *plr, uint64 guid)
void Update(uint32 diff)
virtual void StartingEventCloseDoors()
virtual void StartingEventOpenDoors()
void HandleAreaTrigger(Player *Source, uint32 Trigger)
ACE_UINT64 uint64
Definition: Define.h:70
void DoorOpen(uint32 type)
virtual void FillInitialWorldStates(WorldPacket &d)
void HandleKillPlayer(Player *player, Player *killer)
void SendAreaTriggerMessage(const char *Text,...) ATTR_PRINTF(2
WorldSession * GetSession() const
Definition: Player.h:1944
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Player.h:922
const uint64 & GetGUID() const
Definition: Object.h:162
virtual void Update(uint32 diff)