OregonCore  revision fb2a440-git
Your Favourite TBC server
BattlegroundBE.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 "BattlegroundBE.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 
59 }
60 
62 {
64  DoorOpen(i);
65 
67  SpawnBGObject(i, 60);
68 }
69 
71 {
73  //create score and add it to map, default values are set in constructor
75 
76  m_PlayerScores[plr->GetGUID()] = sc;
77 
80 }
81 
82 void BattlegroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
83 {
85  return;
86 
89 
91 }
92 
94 {
96  return;
97 
98  if (!killer)
99  {
100  sLog.outError("Killer player not found");
101  return;
102  }
103 
104  Battleground::HandleKillPlayer(player, killer);
105 
108 
110 }
111 
113 {
114  // this is wrong way to implement these things. On official it done by gameobject spell cast.
115  if (GetStatus() != STATUS_IN_PROGRESS)
116  return;
117 
118  //uint32 SpellId = 0;
119  //uint64 buff_guid = 0;
120  switch (Trigger)
121  {
122  case 4538: // buff trigger?
123  //buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1];
124  break;
125  case 4539: // buff trigger?
126  //buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_2];
127  break;
128  default:
129  sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
130  Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
131  break;
132  }
133 
134  //if (buff_guid)
135  // HandleTriggerBuff(buff_guid,Source);
136 }
137 
139 {
140  data << uint32(0x9f1) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7
141  data << uint32(0x9f0) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8
142  data << uint32(0x9f3) << uint32(1); // 9
143 }
144 
146 {
147 
148 }
149 
151 {
152  // gates
153  if ( !AddObject(BG_BE_OBJECT_DOOR_1, BG_BE_OBJECT_TYPE_DOOR_1, 6287.277f, 282.1877f, 3.810925f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
154  || !AddObject(BG_BE_OBJECT_DOOR_2, BG_BE_OBJECT_TYPE_DOOR_2, 6189.546f, 241.7099f, 3.101481f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
155  || !AddObject(BG_BE_OBJECT_DOOR_3, BG_BE_OBJECT_TYPE_DOOR_3, 6299.116f, 296.5494f, 3.308032f, 0.8813917f, 0, 0, 0.4265689f, 0.9044551f, RESPAWN_IMMEDIATELY)
156  || !AddObject(BG_BE_OBJECT_DOOR_4, BG_BE_OBJECT_TYPE_DOOR_4, 6177.708f, 227.3481f, 3.604374f, -2.260201f, 0, 0, 0.9044551f, -0.4265689f, RESPAWN_IMMEDIATELY)
157  // buffs
158  || !AddObject(BG_BE_OBJECT_BUFF_1, BG_BE_OBJECT_TYPE_BUFF_1, 6249.042f, 275.3239f, 11.22033f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
159  || !AddObject(BG_BE_OBJECT_BUFF_2, BG_BE_OBJECT_TYPE_BUFF_2, 6228.26f, 249.566f, 11.21812f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
160  {
161  sLog.outErrorDb("BatteGroundBE: Failed to spawn some object!");
162  return false;
163  }
164 
165  return true;
166 }
167 
169 {
170  BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
171  if (itr == m_PlayerScores.end()) // player not found...
172  return;
173 
174  //there is nothing special in this score
175  Battleground::UpdatePlayerScore(Source, type, value);
176 
177 }
178 
179 /*
180 21:45:46 id:231310 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86
181 0000: 32 02 00 00 76 0e 00 00 00 00 00 00 09 00 f3 09 | 2...v...........
182 0010: 00 00 01 00 00 00 f1 09 00 00 01 00 00 00 f0 09 | ................
183 0020: 00 00 02 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................
184 0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................
185 0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
186 0050: 00 00 00 00 00 00 | ......
187 
188 spell 32724 - Gold Team
189 spell 32725 - Green Team
190 35774 Gold Team
191 35775 Green Team
192 */
193 
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()
void HandleKillPlayer(Player *player, Player *killer)
#define sLog
Log class singleton.
Definition: Log.h:187
void SpawnBGObject(uint32 type, uint32 respawntime)
void RemovePlayer(Player *plr, uint64 guid)
void UpdateWorldState(uint32 Field, uint32 Value)
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
void HandleAreaTrigger(Player *Source, uint32 Trigger)
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
virtual void AddPlayer(Player *plr)
BGObjects m_BgObjects
Definition: Battleground.h:672
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
virtual void FillInitialWorldStates(WorldPacket &d)
etc mysql my cnf *Then change max_allowed_packet to a bigger value
virtual void StartingEventCloseDoors()
virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value)
ACE_UINT64 uint64
Definition: Define.h:70
void DoorOpen(uint32 type)
virtual void StartingEventOpenDoors()
virtual void AddPlayer(Player *plr)
void SendAreaTriggerMessage(const char *Text,...) ATTR_PRINTF(2
void Update(uint32 diff)
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)