Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
BattlegroundNA.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 "
BattlegroundNA.h
"
7
#include "
Language.h
"
8
#include "
Object.h
"
9
#include "
ObjectMgr.h
"
10
#include "
Player.h
"
11
#include "
WorldPacket.h
"
12
13
BattlegroundNA::BattlegroundNA
()
14
{
15
BgObjects
.resize(
BG_NA_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
BattlegroundNA::StartingEventCloseDoors
()
29
{
30
for
(
uint32
i =
BG_NA_OBJECT_DOOR_1
; i <=
BG_NA_OBJECT_DOOR_4
; ++i)
31
SpawnBGObject
(i,
RESPAWN_IMMEDIATELY
);
32
}
33
34
void
BattlegroundNA::StartingEventOpenDoors
()
35
{
36
for
(
uint32
i =
BG_NA_OBJECT_DOOR_1
; i <=
BG_NA_OBJECT_DOOR_2
; ++i)
37
DoorOpen
(i);
38
39
for
(
uint32
i =
BG_NA_OBJECT_BUFF_1
; i <=
BG_NA_OBJECT_BUFF_2
; ++i)
40
SpawnBGObject
(i, 60);
41
}
42
43
void
BattlegroundNA::AddPlayer
(
Player
* player)
44
{
45
Battleground::AddPlayer
(player);
46
PlayerScores
[player->
GetGUID
()] =
new
BattlegroundScore
;
47
UpdateArenaWorldState
();
48
}
49
50
void
BattlegroundNA::RemovePlayer
(
Player
*
/*player*/
,
uint64
/*guid*/
,
uint32
/*team*/
)
51
{
52
if
(
GetStatus
() ==
STATUS_WAIT_LEAVE
)
53
return
;
54
55
UpdateArenaWorldState
();
56
CheckArenaWinConditions
();
57
}
58
59
void
BattlegroundNA::HandleKillPlayer
(
Player
* player,
Player
* killer)
60
{
61
if
(
GetStatus
() !=
STATUS_IN_PROGRESS
)
62
return
;
63
64
if
(!killer)
65
{
66
SF_LOG_ERROR
(
"bg.battleground"
,
"BattlegroundNA: Killer player not found"
);
67
return
;
68
}
69
70
Battleground::HandleKillPlayer
(player, killer);
71
72
UpdateArenaWorldState
();
73
CheckArenaWinConditions
();
74
}
75
76
void
BattlegroundNA::HandleAreaTrigger
(
Player
* player,
uint32
trigger)
77
{
78
if
(
GetStatus
() !=
STATUS_IN_PROGRESS
)
79
return
;
80
81
switch
(trigger)
82
{
83
case
4536:
// buff trigger?
84
case
4537:
// buff trigger?
85
break
;
86
default
:
87
Battleground::HandleAreaTrigger
(player, trigger);
88
break
;
89
}
90
}
91
92
void
BattlegroundNA::FillInitialWorldStates
(
WorldStateBuilder
& builder)
93
{
94
builder.
AppendState
(0xa11, 1);
// 9
95
UpdateArenaWorldState
();
96
}
97
98
void
BattlegroundNA::Reset
()
99
{
100
//call parent's class reset
101
Battleground::Reset
();
102
}
103
104
bool
BattlegroundNA::SetupBattleground
()
105
{
106
// gates
107
if
(!
AddObject
(
BG_NA_OBJECT_DOOR_1
,
BG_NA_OBJECT_TYPE_DOOR_1
, 4031.854f, 2966.833f, 12.6462f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f,
RESPAWN_IMMEDIATELY
)
108
|| !
AddObject
(
BG_NA_OBJECT_DOOR_2
,
BG_NA_OBJECT_TYPE_DOOR_2
, 4081.179f, 2874.97f, 12.39171f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f,
RESPAWN_IMMEDIATELY
)
109
|| !
AddObject
(
BG_NA_OBJECT_DOOR_3
,
BG_NA_OBJECT_TYPE_DOOR_3
, 4023.709f, 2981.777f, 10.70117f, -2.648788f, 0, 0, 0.9697962f, -0.2439165f,
RESPAWN_IMMEDIATELY
)
110
|| !
AddObject
(
BG_NA_OBJECT_DOOR_4
,
BG_NA_OBJECT_TYPE_DOOR_4
, 4090.064f, 2858.438f, 10.23631f, 0.4928045f, 0, 0, 0.2439165f, 0.9697962f,
RESPAWN_IMMEDIATELY
)
111
// buffs
112
|| !
AddObject
(
BG_NA_OBJECT_BUFF_1
,
BG_NA_OBJECT_TYPE_BUFF_1
, 4009.189941f, 2895.250000f, 13.052700f, -1.448624f, 0, 0, 0.6626201f, -0.7489557f, 120)
113
|| !
AddObject
(
BG_NA_OBJECT_BUFF_2
,
BG_NA_OBJECT_TYPE_BUFF_2
, 4103.330078f, 2946.350098f, 13.051300f, -0.06981307f, 0, 0, 0.03489945f, -0.9993908f, 120))
114
{
115
SF_LOG_ERROR
(
"sql.sql"
,
"BatteGroundNA: Failed to spawn some object!"
);
116
return
false
;
117
}
118
119
return
true
;
120
}
RESPAWN_IMMEDIATELY
@ RESPAWN_IMMEDIATELY
Definition
Battleground.h:118
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
BattlegroundNA.h
BG_NA_OBJECT_DOOR_1
@ BG_NA_OBJECT_DOOR_1
Definition
BattlegroundNA.h:13
BG_NA_OBJECT_DOOR_4
@ BG_NA_OBJECT_DOOR_4
Definition
BattlegroundNA.h:16
BG_NA_OBJECT_MAX
@ BG_NA_OBJECT_MAX
Definition
BattlegroundNA.h:19
BG_NA_OBJECT_BUFF_2
@ BG_NA_OBJECT_BUFF_2
Definition
BattlegroundNA.h:18
BG_NA_OBJECT_DOOR_2
@ BG_NA_OBJECT_DOOR_2
Definition
BattlegroundNA.h:14
BG_NA_OBJECT_BUFF_1
@ BG_NA_OBJECT_BUFF_1
Definition
BattlegroundNA.h:17
BG_NA_OBJECT_DOOR_3
@ BG_NA_OBJECT_DOOR_3
Definition
BattlegroundNA.h:15
BG_NA_OBJECT_TYPE_DOOR_1
@ BG_NA_OBJECT_TYPE_DOOR_1
Definition
BattlegroundNA.h:24
BG_NA_OBJECT_TYPE_DOOR_2
@ BG_NA_OBJECT_TYPE_DOOR_2
Definition
BattlegroundNA.h:25
BG_NA_OBJECT_TYPE_BUFF_2
@ BG_NA_OBJECT_TYPE_BUFF_2
Definition
BattlegroundNA.h:29
BG_NA_OBJECT_TYPE_BUFF_1
@ BG_NA_OBJECT_TYPE_BUFF_1
Definition
BattlegroundNA.h:28
BG_NA_OBJECT_TYPE_DOOR_3
@ BG_NA_OBJECT_TYPE_DOOR_3
Definition
BattlegroundNA.h:26
BG_NA_OBJECT_TYPE_DOOR_4
@ BG_NA_OBJECT_TYPE_DOOR_4
Definition
BattlegroundNA.h:27
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
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::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
BattlegroundNA::SetupBattleground
bool SetupBattleground() OVERRIDE
Definition
BattlegroundNA.cpp:104
BattlegroundNA::FillInitialWorldStates
void FillInitialWorldStates(WorldStateBuilder &builder) OVERRIDE
Definition
BattlegroundNA.cpp:92
BattlegroundNA::StartingEventOpenDoors
void StartingEventOpenDoors() OVERRIDE
Definition
BattlegroundNA.cpp:34
BattlegroundNA::Reset
void Reset() OVERRIDE
Definition
BattlegroundNA.cpp:98
BattlegroundNA::RemovePlayer
void RemovePlayer(Player *player, uint64 guid, uint32 team) OVERRIDE
Definition
BattlegroundNA.cpp:50
BattlegroundNA::AddPlayer
void AddPlayer(Player *player) OVERRIDE
Definition
BattlegroundNA.cpp:43
BattlegroundNA::StartingEventCloseDoors
void StartingEventCloseDoors() OVERRIDE
Definition
BattlegroundNA.cpp:28
BattlegroundNA::BattlegroundNA
BattlegroundNA()
Definition
BattlegroundNA.cpp:13
BattlegroundNA::HandleAreaTrigger
void HandleAreaTrigger(Player *Source, uint32 Trigger) OVERRIDE
Definition
BattlegroundNA.cpp:76
BattlegroundNA::HandleKillPlayer
void HandleKillPlayer(Player *player, Player *killer) OVERRIDE
Definition
BattlegroundNA.cpp:59
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
BattlegroundNA.cpp
Generated on
for Project SkyFire Core by
1.17.0