OregonCore  revision fb2a440-git
Your Favourite TBC server
BattlegroundRL.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 "BattlegroundRL.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 BattlegroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
80 {
82  return;
83 
86 
88 }
89 
91 {
93  return;
94 
95  if (!killer)
96  {
97  sLog.outError("Killer player not found");
98  return;
99  }
100 
101  Battleground::HandleKillPlayer(player, killer);
102 
105 
107 }
108 
110 {
111  // this is wrong way to implement these things. On official it done by gameobject spell cast.
112  if (GetStatus() != STATUS_IN_PROGRESS)
113  return;
114 
115  //uint32 SpellId = 0;
116  //uint64 buff_guid = 0;
117  switch (Trigger)
118  {
119  case 4696: // buff trigger?
120  case 4697: // buff trigger?
121  break;
122  default:
123  sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
124  Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
125  break;
126  }
127 
128  //if (buff_guid)
129  // HandleTriggerBuff(buff_guid,Source);
130 }
131 
133 {
134  data << uint32(0xbb8) << uint32(GetAlivePlayersCountByTeam(ALLIANCE)); // 7
135  data << uint32(0xbb9) << uint32(GetAlivePlayersCountByTeam(HORDE)); // 8
136  data << uint32(0xbba) << uint32(1); // 9
137 }
138 
140 {
141 
142 }
143 
145 {
146  // gates
147  if ( !AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561f, 1601.938f, 31.60557f, -1.457349f, 0.0f, 0.0f, -0.6658813f, 0.7460576f, RESPAWN_IMMEDIATELY)
148  || !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648f, 1730.557f, 31.60557f, 1.684245f, 0.0f, 0.0f, 0.7460582f, 0.6658807f, RESPAWN_IMMEDIATELY)
149  // buffs
150  || !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971f, 1632.719971f, 36.730400f, -1.448624f, 0.0f, 0.0f, 0.6626201f, -0.7489557f, 120)
151  || !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049f, 1699.170044f, 34.872601f, -0.06981307f, 0.0f, 0.0f, 0.03489945f, -0.9993908f, 120))
152  {
153  sLog.outErrorDb("BatteGroundRL: Failed to spawn some object!");
154  return false;
155  }
156 
157  return true;
158 }
159 
160 /*
161 Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86
162 0000: 3C 02 00 00 80 0F 00 00 00 00 00 00 09 00 BA 0B | <...............
163 0010: 00 00 01 00 00 00 B9 0B 00 00 02 00 00 00 B8 0B | ................
164 0020: 00 00 00 00 00 00 D8 08 00 00 00 00 00 00 D7 08 | ................
165 0030: 00 00 00 00 00 00 D6 08 00 00 00 00 00 00 D5 08 | ................
166 0040: 00 00 00 00 00 00 D3 08 00 00 00 00 00 00 D4 08 | ................
167 0050: 00 00 00 00 00 00 | ......
168 */
169 
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 AddPlayer(Player *plr)
virtual void HandleKillPlayer(Player *player, Player *killer)
void RemovePlayer(Player *plr, uint64 guid)
void CheckArenaWinConditions()
virtual void ResetBGSubclass()
#define sLog
Log class singleton.
Definition: Log.h:187
void HandleAreaTrigger(Player *Source, uint32 Trigger)
virtual void FillInitialWorldStates(WorldPacket &d)
void SpawnBGObject(uint32 type, uint32 respawntime)
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
uint32 GetAlivePlayersCountByTeam(uint32 Team) const
virtual void AddPlayer(Player *plr)
BGObjects m_BgObjects
Definition: Battleground.h:672
void HandleKillPlayer(Player *player, Player *killer)
ACE_UINT64 uint64
Definition: Define.h:70
void DoorOpen(uint32 type)
void Update(uint32 diff)
virtual void StartingEventCloseDoors()
virtual void StartingEventOpenDoors()
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)