Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Server/Arena: Implement Tol'Vir Arena.
Browse files Browse the repository at this point in the history
Signed-off-by: AriDEV <aridev666@gmail.com>
  • Loading branch information
AriDEV committed Apr 28, 2019
1 parent b132753 commit d50cd97
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/server/game/Battlegrounds/BattlegroundMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "BattlegroundRV.h"
#include "BattlegroundIC.h"
#include "BattlegroundTP.h"
#include "BattlegroundTV.h"
#include "BattlegroundBFG.h"
#include "Chat.h"
#include "Map.h"
Expand Down Expand Up @@ -515,6 +516,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
case BATTLEGROUND_RL:
case BATTLEGROUND_DS:
case BATTLEGROUND_RV:
case BATTLEGROUND_TV:
data->WriteBits(0, 22);
break;
default:
Expand Down Expand Up @@ -844,6 +846,9 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId original
case BATTLEGROUND_BFG:
bg = new BattlegroundBFG(*(BattlegroundBFG*)bg_template);
break;
case BATTLEGROUND_TV:
bg = new BattlegroundTV(*(BattlegroundTV*)bg_template);
break;
case BATTLEGROUND_RB:
case BATTLEGROUND_AA:
bg = new Battleground(*bg_template);
Expand Down Expand Up @@ -938,6 +943,9 @@ bool BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data)
case BATTLEGROUND_TP:
bg = new BattlegroundTP;
break;
case BATTLEGROUND_TV:
bg = new BattlegroundTV;
break;
case BATTLEGROUND_BFG:
bg = new BattlegroundBFG;
break;
Expand Down Expand Up @@ -1205,6 +1213,7 @@ bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
|| bgTypeId == BATTLEGROUND_NA
|| bgTypeId == BATTLEGROUND_DS
|| bgTypeId == BATTLEGROUND_RV
|| bgTypeId == BATTLEGROUND_TV
|| bgTypeId == BATTLEGROUND_RL;
}

Expand Down Expand Up @@ -1236,6 +1245,7 @@ BattlegroundQueueTypeId BattlegroundMgr::BGQueueTypeId(BattlegroundTypeId bgType
case BATTLEGROUND_NA:
case BATTLEGROUND_RL:
case BATTLEGROUND_RV:
case BATTLEGROUND_TV:
switch (arenaType)
{
case ARENA_TYPE_2v2:
Expand Down
148 changes: 148 additions & 0 deletions src/server/game/Battlegrounds/Zones/BattlegroundTV.cpp
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);
}
63 changes: 63 additions & 0 deletions src/server/game/Battlegrounds/Zones/BattlegroundTV.h
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
2 changes: 1 addition & 1 deletion src/server/game/Miscellaneous/SharedDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -3995,7 +3995,7 @@ enum BattlegroundTypeId
BATTLEGROUND_TOK = 699, // 5.x Temple of Kotmogu
BATTLEGROUND_CTF = 706, // 5.x CTF3
BATTLEGROUND_SM = 708, // 5.x Silvershard Mines
BATTLEGROUND_TA = 719, // 5.x Tol'Vir Arena
BATTLEGROUND_TV = 719, // 5.x Tol'Vir Arena
BATTLEGROUND_DG = 754, // 5.x Deepwind Gorge
BATTLEGROUND_TTP = 757, // 5.x The Tiger's Peak
};
Expand Down

0 comments on commit d50cd97

Please sign in to comment.