This repository has been archived by the owner on Feb 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Server/Arena: Implement Tol'Vir Arena.
Signed-off-by: AriDEV <aridev666@gmail.com>
- Loading branch information
Showing
4 changed files
with
222 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
/* | ||
* Copyright (C) 2011-2019 Project SkyFire <http://www.projectskyfire.org/> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include "BattlegroundTV.h" | ||
#include "Language.h" | ||
#include "Object.h" | ||
#include "ObjectMgr.h" | ||
#include "Player.h" | ||
#include "WorldPacket.h" | ||
|
||
BattlegroundTV::BattlegroundTV() | ||
{ | ||
BgObjects.resize(BG_TV_OBJECT_MAX); | ||
|
||
StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M; | ||
StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S; | ||
StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S; | ||
StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; | ||
//we must set messageIds | ||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE; | ||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS; | ||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS; | ||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN; | ||
} | ||
|
||
BattlegroundTV::~BattlegroundTV() | ||
{ | ||
|
||
} | ||
|
||
void BattlegroundTV::StartingEventCloseDoors() | ||
{ | ||
for (uint32 i = BG_TV_OBJECT_DOOR_1; i <= BG_TV_OBJECT_DOOR_2; ++i) | ||
SpawnBGObject(i, RESPAWN_IMMEDIATELY); | ||
|
||
for (uint32 i = BG_TV_OBJECT_BUFF_1; i <= BG_TV_OBJECT_BUFF_2; ++i) | ||
SpawnBGObject(i, RESPAWN_ONE_DAY); | ||
} | ||
|
||
void BattlegroundTV::StartingEventOpenDoors() | ||
{ | ||
for (uint32 i = BG_TV_OBJECT_DOOR_1; i <= BG_TV_OBJECT_DOOR_2; ++i) | ||
DoorOpen(i); | ||
|
||
for (uint32 i = BG_TV_OBJECT_BUFF_1; i <= BG_TV_OBJECT_BUFF_2; ++i) | ||
SpawnBGObject(i, 60); | ||
} | ||
|
||
void BattlegroundTV::AddPlayer(Player* player) | ||
{ | ||
Battleground::AddPlayer(player); | ||
PlayerScores[player->GetGUID()] = new BattlegroundScore; | ||
UpdateArenaWorldState(); | ||
} | ||
|
||
void BattlegroundTV::RemovePlayer(Player* /*player*/, uint64 /*guid*/, uint32 /*team*/) | ||
{ | ||
if (GetStatus() == STATUS_WAIT_LEAVE) | ||
return; | ||
|
||
UpdateArenaWorldState(); | ||
CheckArenaWinConditions(); | ||
} | ||
|
||
void BattlegroundTV::HandleKillPlayer(Player* player, Player* killer) | ||
{ | ||
if (GetStatus() != STATUS_IN_PROGRESS) | ||
return; | ||
|
||
if (!killer) | ||
{ | ||
SF_LOG_ERROR("bg.battleground", "Killer player not found"); | ||
return; | ||
} | ||
|
||
Battleground::HandleKillPlayer(player, killer); | ||
|
||
UpdateArenaWorldState(); | ||
CheckArenaWinConditions(); | ||
} | ||
|
||
void BattlegroundTV::HandleAreaTrigger(Player* player, uint32 trigger) | ||
{ | ||
if (GetStatus() != STATUS_IN_PROGRESS) | ||
return; | ||
|
||
switch (trigger) | ||
{ | ||
case 4536: | ||
case 4537: | ||
break; | ||
default: | ||
Battleground::HandleAreaTrigger(player, trigger); | ||
break; | ||
} | ||
} | ||
|
||
void BattlegroundTV::FillInitialWorldStates(WorldStateBuilder& builder) | ||
{ | ||
builder.AppendState(0xE1A, 1); | ||
UpdateArenaWorldState(); | ||
} | ||
|
||
void BattlegroundTV::Reset() | ||
{ | ||
//call parent's class reset | ||
Battleground::Reset(); | ||
} | ||
|
||
bool BattlegroundTV::SetupBattleground() | ||
{ | ||
// gates | ||
if (!AddObject(BG_TV_OBJECT_DOOR_1, BG_TV_OBJECT_TYPE_DOOR_1, -10774.6f, 430.992f, 24.41076f, 0.0156f, 0.0f, 0.0f, 0.0078f, RESPAWN_IMMEDIATELY) | ||
|| !AddObject(BG_TV_OBJECT_DOOR_2, BG_TV_OBJECT_TYPE_DOOR_2, -10655.0f, 428.117f, 24.416f, 3.148f, 0.0f, 0.0f, 1.0f, RESPAWN_IMMEDIATELY) | ||
// buffs | ||
|| !AddObject(BG_TV_OBJECT_BUFF_1, BG_TV_OBJECT_TYPE_BUFF_1, -10717.63f, 383.8223f, 24.412825f, 1.555f, 0.0f, 0.0f, 0.70154f, 120) | ||
|| !AddObject(BG_TV_OBJECT_BUFF_2, BG_TV_OBJECT_TYPE_BUFF_2, -10716.6f, 475.364f, 24.4131f, 0.0f, 0.0f, 0.70068f, -0.713476f, 120)) | ||
{ | ||
SF_LOG_ERROR("sql.sql", "BatteGroundTV: Failed to spawn some object!"); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
void BattlegroundTV::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) | ||
{ | ||
BattlegroundScoreMap::iterator itr = PlayerScores.find(Source->GetGUID()); | ||
if (itr == PlayerScores.end()) // player not found... | ||
return; | ||
|
||
//there is nothing special in this score | ||
Battleground::UpdatePlayerScore(Source, type, value, doAddHonor); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (C) 2011-2019 Project SkyFire <http://www.projectskyfire.org/> | ||
* Copyright (C) 2008-2019 TrinityCore <http://www.trinitycore.org/> | ||
* Copyright (C) 2005-2019 MaNGOS <https://www.getmangos.eu/> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the | ||
* Free Software Foundation; either version 3 of the License, or (at your | ||
* option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef SF_BATTLEGROUNDTV_H | ||
#define SF_BATTLEGROUNDTV_H | ||
|
||
#include "Battleground.h" | ||
|
||
enum BattlegroundTVObjectTypes | ||
{ | ||
BG_TV_OBJECT_DOOR_1 = 0, | ||
BG_TV_OBJECT_DOOR_2 = 1, | ||
BG_TV_OBJECT_BUFF_1 = 2, | ||
BG_TV_OBJECT_BUFF_2 = 3, | ||
BG_TV_OBJECT_MAX = 4 | ||
}; | ||
|
||
enum BattlegroundTVObjects | ||
{ | ||
BG_TV_OBJECT_TYPE_DOOR_1 = 213196, | ||
BG_TV_OBJECT_TYPE_DOOR_2 = 213197, | ||
BG_TV_OBJECT_TYPE_BUFF_1 = 184663, | ||
BG_TV_OBJECT_TYPE_BUFF_2 = 184664 | ||
}; | ||
|
||
class BattlegroundTV : public Battleground | ||
{ | ||
public: | ||
BattlegroundTV(); | ||
~BattlegroundTV(); | ||
|
||
/* inherited from BattlegroundClass */ | ||
void AddPlayer(Player* player); | ||
void StartingEventCloseDoors(); | ||
void StartingEventOpenDoors(); | ||
|
||
void RemovePlayer(Player* player, uint64 guid, uint32 team); | ||
void HandleAreaTrigger(Player* Source, uint32 Trigger); | ||
bool SetupBattleground(); | ||
void Reset(); | ||
void FillInitialWorldStates(WorldStateBuilder& builder); | ||
void HandleKillPlayer(Player* player, Player* killer); | ||
|
||
/* Scorekeeping */ | ||
void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters