Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
BattlegroundBE.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#include "
BattlegroundBE.h
"
7
#include "
Language.h
"
8
#include "
Object.h
"
9
#include "
ObjectMgr.h
"
10
#include "
Player.h
"
11
#include "
WorldPacket.h
"
12
13
BattlegroundBE::BattlegroundBE
()
14
{
15
BgObjects
.resize(
BG_BE_OBJECT_MAX
);
16
17
StartDelayTimes
[
BG_STARTING_EVENT_FIRST
] =
BG_START_DELAY_1M
;
18
StartDelayTimes
[
BG_STARTING_EVENT_SECOND
] =
BG_START_DELAY_30S
;
19
StartDelayTimes
[
BG_STARTING_EVENT_THIRD
] =
BG_START_DELAY_15S
;
20
StartDelayTimes
[
BG_STARTING_EVENT_FOURTH
] =
BG_START_DELAY_NONE
;
21
//we must set messageIds
22
StartMessageIds
[
BG_STARTING_EVENT_FIRST
] =
LANG_ARENA_ONE_MINUTE
;
23
StartMessageIds
[
BG_STARTING_EVENT_SECOND
] =
LANG_ARENA_THIRTY_SECONDS
;
24
StartMessageIds
[
BG_STARTING_EVENT_THIRD
] =
LANG_ARENA_FIFTEEN_SECONDS
;
25
StartMessageIds
[
BG_STARTING_EVENT_FOURTH
] =
LANG_ARENA_HAS_BEGUN
;
26
}
27
28
void
BattlegroundBE::StartingEventCloseDoors
()
29
{
30
for
(
uint32
i =
BG_BE_OBJECT_DOOR_1
; i <=
BG_BE_OBJECT_DOOR_4
; ++i)
31
SpawnBGObject
(i,
RESPAWN_IMMEDIATELY
);
32
33
for
(
uint32
i =
BG_BE_OBJECT_BUFF_1
; i <=
BG_BE_OBJECT_BUFF_2
; ++i)
34
SpawnBGObject
(i,
RESPAWN_ONE_DAY
);
35
}
36
37
void
BattlegroundBE::StartingEventOpenDoors
()
38
{
39
for
(
uint32
i =
BG_BE_OBJECT_DOOR_1
; i <=
BG_BE_OBJECT_DOOR_2
; ++i)
40
DoorOpen
(i);
41
42
for
(
uint32
i =
BG_BE_OBJECT_BUFF_1
; i <=
BG_BE_OBJECT_BUFF_2
; ++i)
43
SpawnBGObject
(i, 60);
44
}
45
46
void
BattlegroundBE::AddPlayer
(
Player
* player)
47
{
48
Battleground::AddPlayer
(player);
49
PlayerScores
[player->
GetGUID
()] =
new
BattlegroundScore
;
50
UpdateArenaWorldState
();
51
}
52
53
void
BattlegroundBE::RemovePlayer
(
Player
*
/*player*/
,
uint64
/*guid*/
,
uint32
/*team*/
)
54
{
55
if
(
GetStatus
() ==
STATUS_WAIT_LEAVE
)
56
return
;
57
58
UpdateArenaWorldState
();
59
CheckArenaWinConditions
();
60
}
61
62
void
BattlegroundBE::HandleKillPlayer
(
Player
* player,
Player
* killer)
63
{
64
if
(
GetStatus
() !=
STATUS_IN_PROGRESS
)
65
return
;
66
67
if
(!killer)
68
{
69
SF_LOG_ERROR
(
"bg.battleground"
,
"Killer player not found"
);
70
return
;
71
}
72
73
Battleground::HandleKillPlayer
(player, killer);
74
75
UpdateArenaWorldState
();
76
CheckArenaWinConditions
();
77
}
78
79
void
BattlegroundBE::HandleAreaTrigger
(
Player
* player,
uint32
trigger)
80
{
81
if
(
GetStatus
() !=
STATUS_IN_PROGRESS
)
82
return
;
83
84
switch
(trigger)
85
{
86
case
4538:
// buff trigger?
87
case
4539:
// buff trigger?
88
break
;
89
default
:
90
Battleground::HandleAreaTrigger
(player, trigger);
91
break
;
92
}
93
}
94
95
void
BattlegroundBE::FillInitialWorldStates
(
WorldStateBuilder
& builder)
96
{
97
builder.
AppendState
(0x9f3, 1);
// 9
98
UpdateArenaWorldState
();
99
}
100
101
void
BattlegroundBE::Reset
()
102
{
103
//call parent's class reset
104
Battleground::Reset
();
105
}
106
107
bool
BattlegroundBE::SetupBattleground
()
108
{
109
// gates
110
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
)
111
|| !
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
)
112
|| !
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
)
113
|| !
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
)
114
// buffs
115
|| !
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)
116
|| !
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))
117
{
118
SF_LOG_ERROR
(
"sql.sql"
,
"BatteGroundBE: Failed to spawn some object!"
);
119
return
false
;
120
}
121
122
return
true
;
123
}
124
125
void
BattlegroundBE::UpdatePlayerScore
(
Player
* Source,
uint32
type,
uint32
value,
bool
doAddHonor)
126
{
127
BattlegroundScoreMap::iterator itr =
PlayerScores
.find(Source->
GetGUID
());
128
if
(itr ==
PlayerScores
.end())
// player not found...
129
return
;
130
131
//there is nothing special in this score
132
Battleground::UpdatePlayerScore
(Source, type, value, doAddHonor);
133
}
RESPAWN_IMMEDIATELY
@ RESPAWN_IMMEDIATELY
Definition
Battleground.h:118
RESPAWN_ONE_DAY
@ RESPAWN_ONE_DAY
Definition
Battleground.h:117
BG_START_DELAY_1M
@ BG_START_DELAY_1M
Definition
Battleground.h:128
BG_START_DELAY_30S
@ BG_START_DELAY_30S
Definition
Battleground.h:129
BG_START_DELAY_NONE
@ BG_START_DELAY_NONE
Definition
Battleground.h:131
BG_START_DELAY_15S
@ BG_START_DELAY_15S
Definition
Battleground.h:130
STATUS_WAIT_LEAVE
@ STATUS_WAIT_LEAVE
Definition
Battleground.h:149
STATUS_IN_PROGRESS
@ STATUS_IN_PROGRESS
Definition
Battleground.h:148
BG_STARTING_EVENT_THIRD
@ BG_STARTING_EVENT_THIRD
Definition
Battleground.h:236
BG_STARTING_EVENT_SECOND
@ BG_STARTING_EVENT_SECOND
Definition
Battleground.h:235
BG_STARTING_EVENT_FIRST
@ BG_STARTING_EVENT_FIRST
Definition
Battleground.h:234
BG_STARTING_EVENT_FOURTH
@ BG_STARTING_EVENT_FOURTH
Definition
Battleground.h:237
BattlegroundBE.h
BG_BE_OBJECT_TYPE_DOOR_3
@ BG_BE_OBJECT_TYPE_DOOR_3
Definition
BattlegroundBE.h:26
BG_BE_OBJECT_TYPE_DOOR_2
@ BG_BE_OBJECT_TYPE_DOOR_2
Definition
BattlegroundBE.h:25
BG_BE_OBJECT_TYPE_DOOR_1
@ BG_BE_OBJECT_TYPE_DOOR_1
Definition
BattlegroundBE.h:24
BG_BE_OBJECT_TYPE_BUFF_1
@ BG_BE_OBJECT_TYPE_BUFF_1
Definition
BattlegroundBE.h:28
BG_BE_OBJECT_TYPE_DOOR_4
@ BG_BE_OBJECT_TYPE_DOOR_4
Definition
BattlegroundBE.h:27
BG_BE_OBJECT_TYPE_BUFF_2
@ BG_BE_OBJECT_TYPE_BUFF_2
Definition
BattlegroundBE.h:29
BG_BE_OBJECT_DOOR_1
@ BG_BE_OBJECT_DOOR_1
Definition
BattlegroundBE.h:13
BG_BE_OBJECT_DOOR_2
@ BG_BE_OBJECT_DOOR_2
Definition
BattlegroundBE.h:14
BG_BE_OBJECT_MAX
@ BG_BE_OBJECT_MAX
Definition
BattlegroundBE.h:19
BG_BE_OBJECT_DOOR_3
@ BG_BE_OBJECT_DOOR_3
Definition
BattlegroundBE.h:15
BG_BE_OBJECT_BUFF_1
@ BG_BE_OBJECT_BUFF_1
Definition
BattlegroundBE.h:17
BG_BE_OBJECT_BUFF_2
@ BG_BE_OBJECT_BUFF_2
Definition
BattlegroundBE.h:18
BG_BE_OBJECT_DOOR_4
@ BG_BE_OBJECT_DOOR_4
Definition
BattlegroundBE.h:16
uint32
std::uint32_t uint32
Definition
Define.h:77
uint64
std::uint64_t uint64
Definition
Define.h:76
Language.h
LANG_ARENA_FIFTEEN_SECONDS
@ LANG_ARENA_FIFTEEN_SECONDS
Definition
Language.h:681
LANG_ARENA_HAS_BEGUN
@ LANG_ARENA_HAS_BEGUN
Definition
Language.h:682
LANG_ARENA_THIRTY_SECONDS
@ LANG_ARENA_THIRTY_SECONDS
Definition
Language.h:680
LANG_ARENA_ONE_MINUTE
@ LANG_ARENA_ONE_MINUTE
Definition
Language.h:679
SF_LOG_ERROR
#define SF_LOG_ERROR(filterType__,...)
Definition
Log.h:143
Object.h
ObjectMgr.h
Player.h
WorldPacket.h
BattlegroundBE::BattlegroundBE
BattlegroundBE()
Definition
BattlegroundBE.cpp:13
BattlegroundBE::RemovePlayer
void RemovePlayer(Player *player, uint64 guid, uint32 team) OVERRIDE
Definition
BattlegroundBE.cpp:53
BattlegroundBE::Reset
void Reset() OVERRIDE
Definition
BattlegroundBE.cpp:101
BattlegroundBE::FillInitialWorldStates
void FillInitialWorldStates(WorldStateBuilder &builder) OVERRIDE
Definition
BattlegroundBE.cpp:95
BattlegroundBE::StartingEventOpenDoors
void StartingEventOpenDoors() OVERRIDE
Definition
BattlegroundBE.cpp:37
BattlegroundBE::HandleAreaTrigger
void HandleAreaTrigger(Player *Source, uint32 Trigger) OVERRIDE
Definition
BattlegroundBE.cpp:79
BattlegroundBE::AddPlayer
void AddPlayer(Player *player) OVERRIDE
Definition
BattlegroundBE.cpp:46
BattlegroundBE::HandleKillPlayer
void HandleKillPlayer(Player *player, Player *killer) OVERRIDE
Definition
BattlegroundBE.cpp:62
BattlegroundBE::UpdatePlayerScore
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor=true) OVERRIDE
Definition
BattlegroundBE.cpp:125
BattlegroundBE::StartingEventCloseDoors
void StartingEventCloseDoors() OVERRIDE
Definition
BattlegroundBE.cpp:28
BattlegroundBE::SetupBattleground
bool SetupBattleground() OVERRIDE
Definition
BattlegroundBE.cpp:107
Battleground::AddPlayer
virtual void AddPlayer(Player *player)
Definition
Battleground.cpp:1139
Battleground::HandleKillPlayer
virtual void HandleKillPlayer(Player *player, Player *killer)
Definition
Battleground.cpp:1824
Battleground::DoorOpen
void DoorOpen(uint32 type)
Definition
Battleground.cpp:1557
Battleground::SpawnBGObject
void SpawnBGObject(uint32 type, uint32 respawntime)
Definition
Battleground.cpp:1587
Battleground::Reset
virtual void Reset()
Definition
Battleground.cpp:1097
Battleground::CheckArenaWinConditions
void CheckArenaWinConditions()
Definition
Battleground.cpp:1944
Battleground::BgObjects
BGObjects BgObjects
Definition
Battleground.h:508
Battleground::StartDelayTimes
BattlegroundStartTimeIntervals StartDelayTimes[BG_STARTING_EVENT_COUNT]
Definition
Battleground.h:575
Battleground::PlayerScores
BattlegroundScoreMap PlayerScores
Definition
Battleground.h:564
Battleground::GetStatus
BattlegroundStatus GetStatus() const
Definition
Battleground.h:305
Battleground::HandleAreaTrigger
virtual void HandleAreaTrigger(Player *, uint32)
Definition
Battleground.cpp:2001
Battleground::UpdateArenaWorldState
void UpdateArenaWorldState()
Definition
Battleground.cpp:1952
Battleground::UpdatePlayerScore
virtual void UpdatePlayerScore(Player *player, uint32 type, uint32 value, bool doAddHonor=true)
Definition
Battleground.cpp:1388
Battleground::AddObject
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)
Definition
Battleground.cpp:1482
Battleground::StartMessageIds
uint32 StartMessageIds[BG_STARTING_EVENT_COUNT]
Definition
Battleground.h:577
Object::GetGUID
uint64 GetGUID() const
Definition
Object.h:119
Player
Definition
Player.h:1289
WorldStateBuilder
Definition
WorldStateBuilder.h:16
WorldStateBuilder::AppendState
void AppendState(uint32 worldstate, uint32 value)
Definition
WorldStateBuilder.h:42
BattlegroundScore
Definition
Battleground.h:249
src
server
game
Battlegrounds
Zones
BattlegroundBE.cpp
Generated on
for Project SkyFire Core by
1.17.0