Some consistency-cleanups on the TC battleground (This means war?)
--HG-- branch : trunk rename : src/server/game/BattleGrounds/ArenaTeam.cpp => src/server/game/Battlegrounds/ArenaTeam.cpp rename : src/server/game/BattleGrounds/ArenaTeam.h => src/server/game/Battlegrounds/ArenaTeam.h rename : src/server/game/BattleGrounds/BattleGround.cpp => src/server/game/Battlegrounds/Battleground.cpp rename : src/server/game/BattleGrounds/BattleGround.h => src/server/game/Battlegrounds/Battleground.h rename : src/server/game/BattleGrounds/Zones/BattleGroundAA.cpp => src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundAA.h => src/server/game/Battlegrounds/Zones/BattlegroundAA.h rename : src/server/game/BattleGrounds/Zones/BattleGroundAB.cpp => src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundAB.h => src/server/game/Battlegrounds/Zones/BattlegroundAB.h rename : src/server/game/BattleGrounds/Zones/BattleGroundAV.cpp => src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundAV.h => src/server/game/Battlegrounds/Zones/BattlegroundAV.h rename : src/server/game/BattleGrounds/Zones/BattleGroundBE.cpp => src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundBE.h => src/server/game/Battlegrounds/Zones/BattlegroundBE.h rename : src/server/game/BattleGrounds/Zones/BattleGroundDS.cpp => src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundDS.h => src/server/game/Battlegrounds/Zones/BattlegroundDS.h rename : src/server/game/BattleGrounds/Zones/BattleGroundEY.cpp => src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundEY.h => src/server/game/Battlegrounds/Zones/BattlegroundEY.h rename : src/server/game/BattleGrounds/Zones/BattleGroundIC.cpp => src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundIC.h => src/server/game/Battlegrounds/Zones/BattlegroundIC.h rename : src/server/game/BattleGrounds/Zones/BattleGroundNA.cpp => src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundNA.h => src/server/game/Battlegrounds/Zones/BattlegroundNA.h rename : src/server/game/BattleGrounds/Zones/BattleGroundRB.cpp => src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundRB.h => src/server/game/Battlegrounds/Zones/BattlegroundRB.h rename : src/server/game/BattleGrounds/Zones/BattleGroundRL.cpp => src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundRL.h => src/server/game/Battlegrounds/Zones/BattlegroundRL.h rename : src/server/game/BattleGrounds/Zones/BattleGroundRV.cpp => src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundRV.h => src/server/game/Battlegrounds/Zones/BattlegroundRV.h rename : src/server/game/BattleGrounds/Zones/BattleGroundSA.cpp => src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundSA.h => src/server/game/Battlegrounds/Zones/BattlegroundSA.h rename : src/server/game/BattleGrounds/Zones/BattleGroundWS.cpp => src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp rename : src/server/game/BattleGrounds/Zones/BattleGroundWS.h => src/server/game/Battlegrounds/Zones/BattlegroundWS.h
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundAA.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
|
||||
BattleGroundAA::BattleGroundAA()
|
||||
{
|
||||
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundAA::~BattleGroundAA()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundAA::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
}
|
||||
|
||||
void BattleGroundAA::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundAA::StartingEventOpenDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundAA::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundAAScore* sc = new BattleGroundAAScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundAA::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundAA::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattleGroundAA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool BattleGroundAA::SetupBattleGround()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDAA_H
|
||||
#define __BATTLEGROUNDAA_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
class BattleGroundAAScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundAAScore() {};
|
||||
virtual ~BattleGroundAAScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattleGroundAA : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundAA();
|
||||
~BattleGroundAA();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,717 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundAB.h"
|
||||
#include "Creature.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
uint32 BG_AB_HonorScoreTicks[BG_HONOR_MODE_NUM] = {
|
||||
330, // normal honor
|
||||
200 // holiday
|
||||
};
|
||||
|
||||
uint32 BG_AB_ReputationScoreTicks[BG_HONOR_MODE_NUM] = {
|
||||
200, // normal honor
|
||||
150 // holiday
|
||||
};
|
||||
|
||||
BattleGroundAB::BattleGroundAB()
|
||||
{
|
||||
m_BuffChange = true;
|
||||
m_BgObjects.resize(BG_AB_OBJECT_MAX);
|
||||
m_BgCreatures.resize(BG_AB_ALL_NODES_COUNT + 5);//+5 for aura triggers
|
||||
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundAB::~BattleGroundAB()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundAB::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
int team_points[BG_TEAMS_COUNT] = { 0, 0 };
|
||||
|
||||
for (int node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
{
|
||||
// 3 sec delay to spawn new banner instead previous despawned one
|
||||
if (m_BannerTimers[node].timer)
|
||||
{
|
||||
if (m_BannerTimers[node].timer > diff)
|
||||
m_BannerTimers[node].timer -= diff;
|
||||
else
|
||||
{
|
||||
m_BannerTimers[node].timer = 0;
|
||||
_CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false);
|
||||
}
|
||||
}
|
||||
|
||||
// 1-minute to occupy a node from contested state
|
||||
if (m_NodeTimers[node])
|
||||
{
|
||||
if (m_NodeTimers[node] > diff)
|
||||
m_NodeTimers[node] -= diff;
|
||||
else
|
||||
{
|
||||
m_NodeTimers[node] = 0;
|
||||
// Change from contested to occupied !
|
||||
uint8 teamIndex = m_Nodes[node]-1;
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
m_Nodes[node] += 2;
|
||||
// burn current contested banner
|
||||
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex);
|
||||
// create new occupied banner
|
||||
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
_NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE);
|
||||
// Message to chatlog
|
||||
|
||||
if (teamIndex == 0)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node));
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_AB_HORDE,_GetNodeNameId(node));
|
||||
PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
if (m_Nodes[node] == team + BG_AB_NODE_TYPE_OCCUPIED)
|
||||
++team_points[team];
|
||||
}
|
||||
|
||||
// Accumulate points
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
{
|
||||
int points = team_points[team];
|
||||
if (!points)
|
||||
continue;
|
||||
m_lastTick[team] += diff;
|
||||
if (m_lastTick[team] > BG_AB_TickIntervals[points])
|
||||
{
|
||||
m_lastTick[team] -= BG_AB_TickIntervals[points];
|
||||
m_TeamScores[team] += BG_AB_TickPoints[points];
|
||||
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
|
||||
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
|
||||
if (m_ReputationScoreTics[team] >= m_ReputationTics)
|
||||
{
|
||||
(team == BG_TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
|
||||
m_ReputationScoreTics[team] -= m_ReputationTics;
|
||||
}
|
||||
if (m_HonorScoreTics[team] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE);
|
||||
m_HonorScoreTics[team] -= m_HonorTics;
|
||||
}
|
||||
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||
m_IsInformedNearVictory = true;
|
||||
}
|
||||
|
||||
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
|
||||
if (team == BG_TEAM_ALLIANCE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
|
||||
if (team == BG_TEAM_HORDE)
|
||||
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
|
||||
// update achievement flags
|
||||
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
|
||||
uint8 otherTeam = (team + 1) % BG_TEAMS_COUNT;
|
||||
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
|
||||
m_TeamScores500Disadvantage[otherTeam] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Test win condition
|
||||
if (m_TeamScores[BG_TEAM_ALLIANCE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleGround(ALLIANCE);
|
||||
if (m_TeamScores[BG_TEAM_HORDE] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAB::StartingEventCloseDoors()
|
||||
{
|
||||
// despawn banners, auras and buffs
|
||||
for (int obj = BG_AB_OBJECT_BANNER_NEUTRAL; obj < BG_AB_DYNAMIC_NODES_COUNT * 8; ++obj)
|
||||
SpawnBGObject(obj, RESPAWN_ONE_DAY);
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT * 3; ++i)
|
||||
SpawnBGObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + i, RESPAWN_ONE_DAY);
|
||||
|
||||
// Starting doors
|
||||
DoorClose(BG_AB_OBJECT_GATE_A);
|
||||
DoorClose(BG_AB_OBJECT_GATE_H);
|
||||
SpawnBGObject(BG_AB_OBJECT_GATE_A, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AB_OBJECT_GATE_H, RESPAWN_IMMEDIATELY);
|
||||
|
||||
// Starting base spirit guides
|
||||
_NodeOccupied(BG_AB_SPIRIT_ALIANCE,ALLIANCE);
|
||||
_NodeOccupied(BG_AB_SPIRIT_HORDE,HORDE);
|
||||
}
|
||||
|
||||
void BattleGroundAB::StartingEventOpenDoors()
|
||||
{
|
||||
// spawn neutral banners
|
||||
for (int banner = BG_AB_OBJECT_BANNER_NEUTRAL, i = 0; i < 5; banner += 8, ++i)
|
||||
SpawnBGObject(banner, RESPAWN_IMMEDIATELY);
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
//randomly select buff to spawn
|
||||
uint8 buff = urand(0, 2);
|
||||
SpawnBGObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + buff + i * 3, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
DoorOpen(BG_AB_OBJECT_GATE_A);
|
||||
DoorOpen(BG_AB_OBJECT_GATE_H);
|
||||
}
|
||||
|
||||
void BattleGroundAB::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in the constructor
|
||||
BattleGroundABScore* sc = new BattleGroundABScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundAB::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
switch(Trigger)
|
||||
{
|
||||
case 3948: // Arathi Basin Alliance Exit.
|
||||
if (Source->GetTeam() != ALLIANCE)
|
||||
Source->GetSession()->SendAreaTriggerMessage("Only The Alliance can use that portal");
|
||||
else
|
||||
Source->LeaveBattleground();
|
||||
break;
|
||||
case 3949: // Arathi Basin Horde Exit.
|
||||
if (Source->GetTeam() != HORDE)
|
||||
Source->GetSession()->SendAreaTriggerMessage("Only The Horde can use that portal");
|
||||
else
|
||||
Source->LeaveBattleground();
|
||||
break;
|
||||
case 3866: // Stables
|
||||
case 3869: // Gold Mine
|
||||
case 3867: // Farm
|
||||
case 3868: // Lumber Mill
|
||||
case 3870: // Black Smith
|
||||
case 4020: // Unk1
|
||||
case 4021: // Unk2
|
||||
//break;
|
||||
default:
|
||||
//sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
//Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* type: 0-neutral, 1-contested, 3-occupied
|
||||
teamIndex: 0-ally, 1-horde */
|
||||
void BattleGroundAB::_CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay)
|
||||
{
|
||||
// Just put it into the queue
|
||||
if (delay)
|
||||
{
|
||||
m_BannerTimers[node].timer = 2000;
|
||||
m_BannerTimers[node].type = type;
|
||||
m_BannerTimers[node].teamIndex = teamIndex;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 obj = node*8 + type + teamIndex;
|
||||
|
||||
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
|
||||
|
||||
// handle aura with banner
|
||||
if (!type)
|
||||
return;
|
||||
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
|
||||
SpawnBGObject(obj, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
void BattleGroundAB::_DelBanner(uint8 node, uint8 type, uint8 teamIndex)
|
||||
{
|
||||
uint8 obj = node*8 + type + teamIndex;
|
||||
SpawnBGObject(obj, RESPAWN_ONE_DAY);
|
||||
|
||||
// handle aura with banner
|
||||
if (!type)
|
||||
return;
|
||||
obj = node * 8 + ((type == BG_AB_NODE_TYPE_OCCUPIED) ? (5 + teamIndex) : 7);
|
||||
SpawnBGObject(obj, RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
int32 BattleGroundAB::_GetNodeNameId(uint8 node)
|
||||
{
|
||||
switch (node)
|
||||
{
|
||||
case BG_AB_NODE_STABLES: return LANG_BG_AB_NODE_STABLES;
|
||||
case BG_AB_NODE_BLACKSMITH: return LANG_BG_AB_NODE_BLACKSMITH;
|
||||
case BG_AB_NODE_FARM: return LANG_BG_AB_NODE_FARM;
|
||||
case BG_AB_NODE_LUMBER_MILL:return LANG_BG_AB_NODE_LUMBER_MILL;
|
||||
case BG_AB_NODE_GOLD_MINE: return LANG_BG_AB_NODE_GOLD_MINE;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BattleGroundAB::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
||||
|
||||
// Node icons
|
||||
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
data << uint32(BG_AB_OP_NODEICONS[node]) << uint32((m_Nodes[node] == 0)?1:0);
|
||||
|
||||
// Node occupied states
|
||||
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
for (uint8 i = 1; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
data << uint32(BG_AB_OP_NODESTATES[node] + plusArray[i]) << uint32((m_Nodes[node] == i)?1:0);
|
||||
|
||||
// How many bases each team owns
|
||||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
if (m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
++ally;
|
||||
else if (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
++horde;
|
||||
|
||||
data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(ally);
|
||||
data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(horde);
|
||||
|
||||
// Team scores
|
||||
data << uint32(BG_AB_OP_RESOURCES_MAX) << uint32(BG_AB_MAX_TEAM_SCORE);
|
||||
data << uint32(BG_AB_OP_RESOURCES_WARNING) << uint32(BG_AB_WARNING_NEAR_VICTORY_SCORE);
|
||||
data << uint32(BG_AB_OP_RESOURCES_ALLY) << uint32(m_TeamScores[BG_TEAM_ALLIANCE]);
|
||||
data << uint32(BG_AB_OP_RESOURCES_HORDE) << uint32(m_TeamScores[BG_TEAM_HORDE]);
|
||||
|
||||
// other unknown
|
||||
data << uint32(0x745) << uint32(0x2); // 37 1861 unk
|
||||
}
|
||||
|
||||
void BattleGroundAB::_SendNodeUpdate(uint8 node)
|
||||
{
|
||||
// Send node owner state update to refresh map icons on client
|
||||
const uint8 plusArray[] = {0, 2, 3, 0, 1};
|
||||
|
||||
if (m_prevNodes[node])
|
||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_prevNodes[node]], 0);
|
||||
else
|
||||
UpdateWorldState(BG_AB_OP_NODEICONS[node], 0);
|
||||
|
||||
UpdateWorldState(BG_AB_OP_NODESTATES[node] + plusArray[m_Nodes[node]], 1);
|
||||
|
||||
// How many bases each team owns
|
||||
uint8 ally = 0, horde = 0;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED)
|
||||
++ally;
|
||||
else if (m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED)
|
||||
++horde;
|
||||
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, ally);
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, horde);
|
||||
}
|
||||
|
||||
void BattleGroundAB::_NodeOccupied(uint8 node,Team team)
|
||||
{
|
||||
if (!AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], team))
|
||||
sLog.outError("Failed to spawn spirit guide! point: %u, team: %u,", node, team);
|
||||
|
||||
uint8 capturedNodes = 0;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if (m_Nodes[node] == GetTeamIndexByTeamId(team) + BG_AB_NODE_TYPE_OCCUPIED && !m_NodeTimers[i])
|
||||
++capturedNodes;
|
||||
}
|
||||
if (capturedNodes >= 5)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, team);
|
||||
if (capturedNodes >= 4)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, team);
|
||||
|
||||
if(node >= BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
|
||||
return;
|
||||
Creature* trigger = GetBGCreature(node+7);//0-6 spirit guides
|
||||
if (!trigger)
|
||||
trigger = AddCreature(WORLD_TRIGGER,node+7,team,BG_AB_NodePositions[node][0],BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2],BG_AB_NodePositions[node][3]);
|
||||
|
||||
//add bonus honor aura trigger creature when node is accupied
|
||||
//cast bonus aura (+50% honor in 25yards)
|
||||
//aura should only apply to players who have accupied the node, set correct faction for trigger
|
||||
if (trigger)
|
||||
{
|
||||
trigger->setFaction(team == ALLIANCE ? 84 : 83);
|
||||
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundAB::_NodeDeOccupied(uint8 node)
|
||||
{
|
||||
if (node >= BG_AB_DYNAMIC_NODES_COUNT)
|
||||
return;
|
||||
|
||||
//remove bonus honor aura trigger creature when node is lost
|
||||
if(node < BG_AB_DYNAMIC_NODES_COUNT)//only dynamic nodes, no start points
|
||||
DelCreature(node+7);//NULL checks are in DelCreature! 0-6 spirit guides
|
||||
|
||||
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
|
||||
std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]];
|
||||
if (!ghost_list.empty())
|
||||
{
|
||||
WorldSafeLocsEntry const *ClosestGrave = NULL;
|
||||
for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
|
||||
{
|
||||
Player* plr = objmgr.GetPlayer(*itr);
|
||||
if (!plr)
|
||||
continue;
|
||||
|
||||
if (!ClosestGrave) // cache
|
||||
ClosestGrave = GetClosestGraveYard(plr);
|
||||
|
||||
if (ClosestGrave)
|
||||
plr->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, plr->GetOrientation());
|
||||
}
|
||||
}
|
||||
|
||||
if (m_BgCreatures[node])
|
||||
DelCreature(node);
|
||||
|
||||
// buff object isn't despawned
|
||||
}
|
||||
|
||||
/* Invoked if a player used a banner as a gameobject */
|
||||
void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint8 node = BG_AB_NODE_STABLES;
|
||||
GameObject* obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+7]);
|
||||
while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10))))
|
||||
{
|
||||
++node;
|
||||
obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]);
|
||||
}
|
||||
|
||||
if (node == BG_AB_DYNAMIC_NODES_COUNT)
|
||||
{
|
||||
// this means our player isn't close to any of banners - maybe cheater ??
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam());
|
||||
|
||||
// Check if player really could use this banner, not cheated
|
||||
if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2))
|
||||
return;
|
||||
|
||||
source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
uint32 sound = 0;
|
||||
// If node is neutral, change to contested
|
||||
if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL)
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
m_Nodes[node] = teamIndex + 1;
|
||||
// burn current neutral banner
|
||||
_DelBanner(node, BG_AB_NODE_TYPE_NEUTRAL, 0);
|
||||
// create new contested banner
|
||||
_CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: team and node names not localized
|
||||
if (teamIndex == 0)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY);
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE);
|
||||
|
||||
sound = BG_AB_SOUND_NODE_CLAIMED;
|
||||
}
|
||||
// If node is contested
|
||||
else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED))
|
||||
{
|
||||
// If last state is NOT occupied, change node to enemy-contested
|
||||
if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
|
||||
// burn current contested banner
|
||||
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
|
||||
// create new contested banner
|
||||
_CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
}
|
||||
// If contested, change back to occupied
|
||||
else
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED;
|
||||
// burn current contested banner
|
||||
_DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex);
|
||||
// create new occupied banner
|
||||
_CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
m_NodeTimers[node] = 0;
|
||||
_NodeOccupied(node,(teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE);
|
||||
|
||||
// FIXME: node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
}
|
||||
sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
}
|
||||
// If node is occupied, change to enemy-contested
|
||||
else
|
||||
{
|
||||
UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1);
|
||||
m_prevNodes[node] = m_Nodes[node];
|
||||
m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED;
|
||||
// burn current occupied banner
|
||||
_DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex);
|
||||
// create new contested banner
|
||||
_CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true);
|
||||
_SendNodeUpdate(node);
|
||||
_NodeDeOccupied(node);
|
||||
m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME;
|
||||
|
||||
// FIXME: node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node));
|
||||
|
||||
sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
}
|
||||
|
||||
// If node is occupied again, send "X has taken the Y" msg.
|
||||
if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED)
|
||||
{
|
||||
// FIXME: team and node names not localized
|
||||
if (teamIndex == BG_TEAM_ALLIANCE)
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node));
|
||||
else
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node));
|
||||
}
|
||||
PlaySoundToAll(sound);
|
||||
}
|
||||
|
||||
bool BattleGroundAB::SetupBattleGround()
|
||||
{
|
||||
for (int i = 0 ; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if (!AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + 8*i,BG_AB_OBJECTID_NODE_BANNER_0 + i,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_A + 8*i,BG_AB_OBJECTID_BANNER_CONT_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_CONT_H + 8*i,BG_AB_OBJECTID_BANNER_CONT_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_ALLY + 8*i,BG_AB_OBJECTID_BANNER_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_BANNER_HORDE + 8*i,BG_AB_OBJECTID_BANNER_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_ALLY + 8*i,BG_AB_OBJECTID_AURA_A,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_HORDE + 8*i,BG_AB_OBJECTID_AURA_H,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_AURA_CONTESTED + 8*i,BG_AB_OBJECTID_AURA_C,BG_AB_NodePositions[i][0],BG_AB_NodePositions[i][1],BG_AB_NodePositions[i][2],BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2),RESPAWN_ONE_DAY)
|
||||
)
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundAB: Failed to spawn some object BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!AddObject(BG_AB_OBJECT_GATE_A,BG_AB_OBJECTID_GATE_A,BG_AB_DoorPositions[0][0],BG_AB_DoorPositions[0][1],BG_AB_DoorPositions[0][2],BG_AB_DoorPositions[0][3],BG_AB_DoorPositions[0][4],BG_AB_DoorPositions[0][5],BG_AB_DoorPositions[0][6],BG_AB_DoorPositions[0][7],RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_AB_OBJECT_GATE_H,BG_AB_OBJECTID_GATE_H,BG_AB_DoorPositions[1][0],BG_AB_DoorPositions[1][1],BG_AB_DoorPositions[1][2],BG_AB_DoorPositions[1][3],BG_AB_DoorPositions[1][4],BG_AB_DoorPositions[1][5],BG_AB_DoorPositions[1][6],BG_AB_DoorPositions[1][7],RESPAWN_IMMEDIATELY)
|
||||
)
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundAB: Failed to spawn door object BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
//buffs
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
if (!AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i, Buff_Entries[0], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 1, Buff_Entries[1], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY)
|
||||
)
|
||||
sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundAB::Reset()
|
||||
{
|
||||
//call parent's class reset
|
||||
BattleGround::Reset();
|
||||
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
m_lastTick[BG_TEAM_ALLIANCE] = 0;
|
||||
m_lastTick[BG_TEAM_HORDE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_ReputationScoreTics[BG_TEAM_ALLIANCE] = 0;
|
||||
m_ReputationScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_IsInformedNearVictory = false;
|
||||
bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID());
|
||||
m_HonorTics = (isBGWeekend) ? BG_AB_ABBGWeekendHonorTicks : BG_AB_NotABBGWeekendHonorTicks;
|
||||
m_ReputationTics = (isBGWeekend) ? BG_AB_ABBGWeekendReputationTicks : BG_AB_NotABBGWeekendReputationTicks;
|
||||
m_TeamScores500Disadvantage[BG_TEAM_ALLIANCE] = false;
|
||||
m_TeamScores500Disadvantage[BG_TEAM_HORDE] = false;
|
||||
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
m_Nodes[i] = 0;
|
||||
m_prevNodes[i] = 0;
|
||||
m_NodeTimers[i] = 0;
|
||||
m_BannerTimers[i].timer = 0;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < BG_AB_ALL_NODES_COUNT + 5; ++i)//+5 for aura triggers
|
||||
if (m_BgCreatures[i])
|
||||
DelCreature(i);
|
||||
}
|
||||
|
||||
void BattleGroundAB::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattleGroundAB::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(player->GetTeam());
|
||||
|
||||
// Is there any occupied node for this team?
|
||||
std::vector<uint8> nodes;
|
||||
for (uint8 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (m_Nodes[i] == teamIndex + 3)
|
||||
nodes.push_back(i);
|
||||
|
||||
WorldSafeLocsEntry const* good_entry = NULL;
|
||||
// If so, select the closest node to place ghost on
|
||||
if (!nodes.empty())
|
||||
{
|
||||
float plr_x = player->GetPositionX();
|
||||
float plr_y = player->GetPositionY();
|
||||
|
||||
float mindist = 999999.0f;
|
||||
for (uint8 i = 0; i < nodes.size(); ++i)
|
||||
{
|
||||
WorldSafeLocsEntry const*entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[nodes[i]]);
|
||||
if (!entry)
|
||||
continue;
|
||||
float dist = (entry->x - plr_x)*(entry->x - plr_x)+(entry->y - plr_y)*(entry->y - plr_y);
|
||||
if (mindist > dist)
|
||||
{
|
||||
mindist = dist;
|
||||
good_entry = entry;
|
||||
}
|
||||
}
|
||||
nodes.clear();
|
||||
}
|
||||
// If not, place ghost on starting location
|
||||
if (!good_entry)
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[teamIndex+5]);
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
||||
void BattleGroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
((BattleGroundABScore*)itr->second)->BasesAssaulted += value;
|
||||
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_ASSAULT_BASE);
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
((BattleGroundABScore*)itr->second)->BasesDefended += value;
|
||||
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, AB_OBJECTIVE_DEFEND_BASE);
|
||||
break;
|
||||
default:
|
||||
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool BattleGroundAB::IsAllNodesConrolledByTeam(uint32 team) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (int i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if ((team == ALLIANCE && m_Nodes[i] == BG_AB_NODE_STATUS_ALLY_OCCUPIED) ||
|
||||
(team == HORDE && m_Nodes[i] == BG_AB_NODE_STATUS_HORDE_OCCUPIED))
|
||||
++count;
|
||||
|
||||
return count == BG_AB_DYNAMIC_NODES_COUNT;
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDAB_H
|
||||
#define __BATTLEGROUNDAB_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
enum BG_AB_WorldStates
|
||||
{
|
||||
BG_AB_OP_OCCUPIED_BASES_HORDE = 1778,
|
||||
BG_AB_OP_OCCUPIED_BASES_ALLY = 1779,
|
||||
BG_AB_OP_RESOURCES_ALLY = 1776,
|
||||
BG_AB_OP_RESOURCES_HORDE = 1777,
|
||||
BG_AB_OP_RESOURCES_MAX = 1780,
|
||||
BG_AB_OP_RESOURCES_WARNING = 1955
|
||||
/*
|
||||
BG_AB_OP_STABLE_ICON = 1842, //Stable map icon (NONE)
|
||||
BG_AB_OP_STABLE_STATE_ALIENCE = 1767, //Stable map state (ALIENCE)
|
||||
BG_AB_OP_STABLE_STATE_HORDE = 1768, //Stable map state (HORDE)
|
||||
BG_AB_OP_STABLE_STATE_CON_ALI = 1769, //Stable map state (CON ALIENCE)
|
||||
BG_AB_OP_STABLE_STATE_CON_HOR = 1770, //Stable map state (CON HORDE)
|
||||
BG_AB_OP_FARM_ICON = 1845, //Farm map icon (NONE)
|
||||
BG_AB_OP_FARM_STATE_ALIENCE = 1772, //Farm state (ALIENCE)
|
||||
BG_AB_OP_FARM_STATE_HORDE = 1773, //Farm state (HORDE)
|
||||
BG_AB_OP_FARM_STATE_CON_ALI = 1774, //Farm state (CON ALIENCE)
|
||||
BG_AB_OP_FARM_STATE_CON_HOR = 1775, //Farm state (CON HORDE)
|
||||
|
||||
BG_AB_OP_BLACKSMITH_ICON = 1846, //Blacksmith map icon (NONE)
|
||||
BG_AB_OP_BLACKSMITH_STATE_ALIENCE = 1782, //Blacksmith map state (ALIENCE)
|
||||
BG_AB_OP_BLACKSMITH_STATE_HORDE = 1783, //Blacksmith map state (HORDE)
|
||||
BG_AB_OP_BLACKSMITH_STATE_CON_ALI = 1784, //Blacksmith map state (CON ALIENCE)
|
||||
BG_AB_OP_BLACKSMITH_STATE_CON_HOR = 1785, //Blacksmith map state (CON HORDE)
|
||||
BG_AB_OP_LUMBERMILL_ICON = 1844, //Lumber Mill map icon (NONE)
|
||||
BG_AB_OP_LUMBERMILL_STATE_ALIENCE = 1792, //Lumber Mill map state (ALIENCE)
|
||||
BG_AB_OP_LUMBERMILL_STATE_HORDE = 1793, //Lumber Mill map state (HORDE)
|
||||
BG_AB_OP_LUMBERMILL_STATE_CON_ALI = 1794, //Lumber Mill map state (CON ALIENCE)
|
||||
BG_AB_OP_LUMBERMILL_STATE_CON_HOR = 1795, //Lumber Mill map state (CON HORDE)
|
||||
BG_AB_OP_GOLDMINE_ICON = 1843, //Gold Mine map icon (NONE)
|
||||
BG_AB_OP_GOLDMINE_STATE_ALIENCE = 1787, //Gold Mine map state (ALIENCE)
|
||||
BG_AB_OP_GOLDMINE_STATE_HORDE = 1788, //Gold Mine map state (HORDE)
|
||||
BG_AB_OP_GOLDMINE_STATE_CON_ALI = 1789, //Gold Mine map state (CON ALIENCE
|
||||
BG_AB_OP_GOLDMINE_STATE_CON_HOR = 1790, //Gold Mine map state (CON HORDE)
|
||||
*/
|
||||
};
|
||||
|
||||
const uint32 BG_AB_OP_NODESTATES[5] = {1767, 1782, 1772, 1792, 1787};
|
||||
|
||||
const uint32 BG_AB_OP_NODEICONS[5] = {1842, 1846, 1845, 1844, 1843};
|
||||
|
||||
/* Note: code uses that these IDs follow each other */
|
||||
enum BG_AB_NodeObjectId
|
||||
{
|
||||
BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_4 = 180091 // Gold mine banner
|
||||
};
|
||||
|
||||
enum BG_AB_ObjectType
|
||||
{
|
||||
// for all 5 node points 8*5=40 objects
|
||||
BG_AB_OBJECT_BANNER_NEUTRAL = 0,
|
||||
BG_AB_OBJECT_BANNER_CONT_A = 1,
|
||||
BG_AB_OBJECT_BANNER_CONT_H = 2,
|
||||
BG_AB_OBJECT_BANNER_ALLY = 3,
|
||||
BG_AB_OBJECT_BANNER_HORDE = 4,
|
||||
BG_AB_OBJECT_AURA_ALLY = 5,
|
||||
BG_AB_OBJECT_AURA_HORDE = 6,
|
||||
BG_AB_OBJECT_AURA_CONTESTED = 7,
|
||||
//gates
|
||||
BG_AB_OBJECT_GATE_A = 40,
|
||||
BG_AB_OBJECT_GATE_H = 41,
|
||||
//buffs
|
||||
BG_AB_OBJECT_SPEEDBUFF_STABLES = 42,
|
||||
BG_AB_OBJECT_REGENBUFF_STABLES = 43,
|
||||
BG_AB_OBJECT_BERSERKBUFF_STABLES = 44,
|
||||
BG_AB_OBJECT_SPEEDBUFF_BLACKSMITH = 45,
|
||||
BG_AB_OBJECT_REGENBUFF_BLACKSMITH = 46,
|
||||
BG_AB_OBJECT_BERSERKBUFF_BLACKSMITH = 47,
|
||||
BG_AB_OBJECT_SPEEDBUFF_FARM = 48,
|
||||
BG_AB_OBJECT_REGENBUFF_FARM = 49,
|
||||
BG_AB_OBJECT_BERSERKBUFF_FARM = 50,
|
||||
BG_AB_OBJECT_SPEEDBUFF_LUMBER_MILL = 51,
|
||||
BG_AB_OBJECT_REGENBUFF_LUMBER_MILL = 52,
|
||||
BG_AB_OBJECT_BERSERKBUFF_LUMBER_MILL = 53,
|
||||
BG_AB_OBJECT_SPEEDBUFF_GOLD_MINE = 54,
|
||||
BG_AB_OBJECT_REGENBUFF_GOLD_MINE = 55,
|
||||
BG_AB_OBJECT_BERSERKBUFF_GOLD_MINE = 56,
|
||||
BG_AB_OBJECT_MAX = 57,
|
||||
};
|
||||
|
||||
/* Object id templates from DB */
|
||||
enum BG_AB_ObjectTypes
|
||||
{
|
||||
BG_AB_OBJECTID_BANNER_A = 180058,
|
||||
BG_AB_OBJECTID_BANNER_CONT_A = 180059,
|
||||
BG_AB_OBJECTID_BANNER_H = 180060,
|
||||
BG_AB_OBJECTID_BANNER_CONT_H = 180061,
|
||||
|
||||
BG_AB_OBJECTID_AURA_A = 180100,
|
||||
BG_AB_OBJECTID_AURA_H = 180101,
|
||||
BG_AB_OBJECTID_AURA_C = 180102,
|
||||
|
||||
BG_AB_OBJECTID_GATE_A = 180255,
|
||||
BG_AB_OBJECTID_GATE_H = 180256
|
||||
};
|
||||
|
||||
enum BG_AB_Timers
|
||||
{
|
||||
BG_AB_FLAG_CAPTURING_TIME = 60000,
|
||||
};
|
||||
|
||||
enum BG_AB_Score
|
||||
{
|
||||
BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400,
|
||||
BG_AB_MAX_TEAM_SCORE = 1600
|
||||
};
|
||||
|
||||
/* do NOT change the order, else wrong behaviour */
|
||||
enum BG_AB_BattleGroundNodes
|
||||
{
|
||||
BG_AB_NODE_STABLES = 0,
|
||||
BG_AB_NODE_BLACKSMITH = 1,
|
||||
BG_AB_NODE_FARM = 2,
|
||||
BG_AB_NODE_LUMBER_MILL = 3,
|
||||
BG_AB_NODE_GOLD_MINE = 4,
|
||||
|
||||
BG_AB_DYNAMIC_NODES_COUNT = 5, // dynamic nodes that can be captured
|
||||
|
||||
BG_AB_SPIRIT_ALIANCE = 5,
|
||||
BG_AB_SPIRIT_HORDE = 6,
|
||||
|
||||
BG_AB_ALL_NODES_COUNT = 7, // all nodes (dynamic and static)
|
||||
};
|
||||
|
||||
enum BG_AB_NodeStatus
|
||||
{
|
||||
BG_AB_NODE_TYPE_NEUTRAL = 0,
|
||||
BG_AB_NODE_TYPE_CONTESTED = 1,
|
||||
BG_AB_NODE_STATUS_ALLY_CONTESTED = 1,
|
||||
BG_AB_NODE_STATUS_HORDE_CONTESTED = 2,
|
||||
BG_AB_NODE_TYPE_OCCUPIED = 3,
|
||||
BG_AB_NODE_STATUS_ALLY_OCCUPIED = 3,
|
||||
BG_AB_NODE_STATUS_HORDE_OCCUPIED = 4
|
||||
};
|
||||
|
||||
enum BG_AB_Sounds
|
||||
{
|
||||
BG_AB_SOUND_NODE_CLAIMED = 8192,
|
||||
BG_AB_SOUND_NODE_CAPTURED_ALLIANCE = 8173,
|
||||
BG_AB_SOUND_NODE_CAPTURED_HORDE = 8213,
|
||||
BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE = 8212,
|
||||
BG_AB_SOUND_NODE_ASSAULTED_HORDE = 8174,
|
||||
BG_AB_SOUND_NEAR_VICTORY = 8456
|
||||
};
|
||||
|
||||
enum BG_AB_Objectives
|
||||
{
|
||||
AB_OBJECTIVE_ASSAULT_BASE = 122,
|
||||
AB_OBJECTIVE_DEFEND_BASE = 123
|
||||
};
|
||||
|
||||
#define BG_AB_NotABBGWeekendHonorTicks 330
|
||||
#define BG_AB_ABBGWeekendHonorTicks 200
|
||||
#define BG_AB_NotABBGWeekendReputationTicks 200
|
||||
#define BG_AB_ABBGWeekendReputationTicks 150
|
||||
|
||||
// x, y, z, o
|
||||
const float BG_AB_NodePositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
|
||||
{1166.785f, 1200.132f, -56.70859f, 0.9075713f}, // stables
|
||||
{977.0156f, 1046.616f, -44.80923f, -2.600541f}, // blacksmith
|
||||
{806.1821f, 874.2723f, -55.99371f, -2.303835f}, // farm
|
||||
{856.1419f, 1148.902f, 11.18469f, -2.303835f}, // lumber mill
|
||||
{1146.923f, 848.1782f, -110.917f, -0.7330382f} // gold mine
|
||||
};
|
||||
|
||||
// x, y, z, o, rot0, rot1, rot2, rot3
|
||||
const float BG_AB_DoorPositions[2][8] = {
|
||||
{1284.597f, 1281.167f, -15.97792f, 0.7068594f, 0.012957f, -0.060288f, 0.344959f, 0.93659f},
|
||||
{708.0903f, 708.4479f, -17.8342f, -2.391099f, 0.050291f, 0.015127f, 0.929217f, -0.365784f}
|
||||
};
|
||||
|
||||
// Tick intervals and given points: case 0,1,2,3,4,5 captured nodes
|
||||
const uint32 BG_AB_TickIntervals[6] = {0, 12000, 9000, 6000, 3000, 1000};
|
||||
const uint32 BG_AB_TickPoints[6] = {0, 10, 10, 10, 10, 30};
|
||||
|
||||
// WorldSafeLocs ids for 5 nodes, and for ally, and horde starting location
|
||||
const uint32 BG_AB_GraveyardIds[BG_AB_ALL_NODES_COUNT] = {895, 894, 893, 897, 896, 898, 899};
|
||||
|
||||
// x, y, z, o
|
||||
const float BG_AB_BuffPositions[BG_AB_DYNAMIC_NODES_COUNT][4] = {
|
||||
{1185.71f, 1185.24f, -56.36f, 2.56f}, // stables
|
||||
{990.75f, 1008.18f, -42.60f, 2.43f}, // blacksmith
|
||||
{817.66f, 843.34f, -56.54f, 3.01f}, // farm
|
||||
{807.46f, 1189.16f, 11.92f, 5.44f}, // lumber mill
|
||||
{1146.62f, 816.94f, -98.49f, 6.14f} // gold mine
|
||||
};
|
||||
|
||||
// x, y, z, o
|
||||
const float BG_AB_SpiritGuidePos[BG_AB_ALL_NODES_COUNT][4] = {
|
||||
{1200.03f, 1171.09f, -56.47f, 5.15f}, // stables
|
||||
{1017.43f, 960.61f, -42.95f, 4.88f}, // blacksmith
|
||||
{833.00f, 793.00f, -57.25f, 5.27f}, // farm
|
||||
{775.17f, 1206.40f, 15.79f, 1.90f}, // lumber mill
|
||||
{1207.48f, 787.00f, -83.36f, 5.51f}, // gold mine
|
||||
{1354.05f, 1275.48f, -11.30f, 4.77f}, // alliance starting base
|
||||
{714.61f, 646.15f, -10.87f, 4.34f} // horde starting base
|
||||
};
|
||||
|
||||
struct BG_AB_BannerTimer
|
||||
{
|
||||
uint32 timer;
|
||||
uint8 type;
|
||||
uint8 teamIndex;
|
||||
};
|
||||
|
||||
class BattleGroundABScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundABScore(): BasesAssaulted(0), BasesDefended(0) {};
|
||||
virtual ~BattleGroundABScore() {};
|
||||
uint32 BasesAssaulted;
|
||||
uint32 BasesDefended;
|
||||
};
|
||||
|
||||
class BattleGroundAB : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundAB();
|
||||
~BattleGroundAB();
|
||||
|
||||
void Update(uint32 diff);
|
||||
void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
void RemovePlayer(Player *plr,uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
virtual bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void EndBattleGround(uint32 winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
/* Scorekeeping */
|
||||
virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
/* Nodes occupying */
|
||||
virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited
|
||||
bool IsTeamScores500Disadvantage(uint32 team) const { return m_TeamScores500Disadvantage[GetTeamIndexByTeamId(team)]; }
|
||||
private:
|
||||
/* Gameobject spawning/despawning */
|
||||
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
|
||||
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
|
||||
void _SendNodeUpdate(uint8 node);
|
||||
|
||||
/* Creature spawning/despawning */
|
||||
// TODO: working, scripted peons spawning
|
||||
void _NodeOccupied(uint8 node,Team team);
|
||||
void _NodeDeOccupied(uint8 node);
|
||||
|
||||
int32 _GetNodeNameId(uint8 node);
|
||||
|
||||
/* Nodes info:
|
||||
0: neutral
|
||||
1: ally contested
|
||||
2: horde contested
|
||||
3: ally occupied
|
||||
4: horde occupied */
|
||||
uint8 m_Nodes[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint8 m_prevNodes[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
BG_AB_BannerTimer m_BannerTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint32 m_NodeTimers[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
uint32 m_lastTick[BG_TEAMS_COUNT];
|
||||
uint32 m_HonorScoreTics[BG_TEAMS_COUNT];
|
||||
uint32 m_ReputationScoreTics[BG_TEAMS_COUNT];
|
||||
bool m_IsInformedNearVictory;
|
||||
uint32 m_HonorTics;
|
||||
uint32 m_ReputationTics;
|
||||
// need for achievements
|
||||
bool m_TeamScores500Disadvantage[BG_TEAMS_COUNT];
|
||||
};
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundBE.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
BattleGroundBE::BattleGroundBE()
|
||||
{
|
||||
m_BgObjects.resize(BG_BE_OBJECT_MAX);
|
||||
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundBE::~BattleGroundBE()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundBE::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
}
|
||||
|
||||
void BattleGroundBE::StartingEventCloseDoors()
|
||||
{
|
||||
for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_4; ++i)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
|
||||
for (uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i)
|
||||
SpawnBGObject(i, RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
void BattleGroundBE::StartingEventOpenDoors()
|
||||
{
|
||||
for (uint32 i = BG_BE_OBJECT_DOOR_1; i <= BG_BE_OBJECT_DOOR_2; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
for (uint32 i = BG_BE_OBJECT_BUFF_1; i <= BG_BE_OBJECT_BUFF_2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
void BattleGroundBE::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundBEScore* sc = new BattleGroundBEScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::HandleKillPlayer(player,killer);
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(),6238.930176,262.963470,0.889519,player->GetOrientation(),false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
{
|
||||
case 4538: // buff trigger?
|
||||
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_1];
|
||||
break;
|
||||
case 4539: // buff trigger?
|
||||
//buff_guid = m_BgObjects[BG_BE_OBJECT_BUFF_2];
|
||||
break;
|
||||
default:
|
||||
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
void BattleGroundBE::FillInitialWorldStates(WorldPacket &data)
|
||||
{
|
||||
data << uint32(0x9f3) << uint32(1); // 9
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundBE::Reset()
|
||||
{
|
||||
//call parent's class reset
|
||||
BattleGround::Reset();
|
||||
}
|
||||
|
||||
bool BattleGroundBE::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
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)
|
||||
|| !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)
|
||||
|| !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)
|
||||
|| !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)
|
||||
// buffs
|
||||
|| !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)
|
||||
|| !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))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundBE: Failed to spawn some object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundBE::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
//there is nothing special in this score
|
||||
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
21:45:46 id:231310 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86
|
||||
0000: 32 02 00 00 76 0e 00 00 00 00 00 00 09 00 f3 09 | 2...v...........
|
||||
0010: 00 00 01 00 00 00 f1 09 00 00 01 00 00 00 f0 09 | ................
|
||||
0020: 00 00 02 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................
|
||||
0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................
|
||||
0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
|
||||
0050: 00 00 00 00 00 00 | ......
|
||||
|
||||
spell 32724 - Gold Team
|
||||
spell 32725 - Green Team
|
||||
35774 Gold Team
|
||||
35775 Green Team
|
||||
*/
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDBE_H
|
||||
#define __BATTLEGROUNDBE_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
enum BattleGroundBEObjectTypes
|
||||
{
|
||||
BG_BE_OBJECT_DOOR_1 = 0,
|
||||
BG_BE_OBJECT_DOOR_2 = 1,
|
||||
BG_BE_OBJECT_DOOR_3 = 2,
|
||||
BG_BE_OBJECT_DOOR_4 = 3,
|
||||
BG_BE_OBJECT_BUFF_1 = 4,
|
||||
BG_BE_OBJECT_BUFF_2 = 5,
|
||||
BG_BE_OBJECT_MAX = 6
|
||||
};
|
||||
|
||||
enum BattleGroundBEObjects
|
||||
{
|
||||
BG_BE_OBJECT_TYPE_DOOR_1 = 183971,
|
||||
BG_BE_OBJECT_TYPE_DOOR_2 = 183973,
|
||||
BG_BE_OBJECT_TYPE_DOOR_3 = 183970,
|
||||
BG_BE_OBJECT_TYPE_DOOR_4 = 183972,
|
||||
BG_BE_OBJECT_TYPE_BUFF_1 = 184663,
|
||||
BG_BE_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattleGroundBEScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundBEScore() {};
|
||||
virtual ~BattleGroundBEScore() {};
|
||||
};
|
||||
|
||||
class BattleGroundBE : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundBE();
|
||||
~BattleGroundBE();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundDS.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
BattleGroundDS::BattleGroundDS()
|
||||
{
|
||||
m_BgObjects.resize(BG_DS_OBJECT_MAX);
|
||||
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundDS::~BattleGroundDS()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundDS::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
if (getWaterFallTimer() < diff)
|
||||
{
|
||||
if (isWaterFallActive())
|
||||
{
|
||||
setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
|
||||
for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
|
||||
SpawnBGObject(i, getWaterFallTimer());
|
||||
setWaterFallActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
setWaterFallTimer(BG_DS_WATERFALL_DURATION);
|
||||
for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
setWaterFallActive(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
setWaterFallTimer(getWaterFallTimer() - diff);
|
||||
}
|
||||
|
||||
void BattleGroundDS::StartingEventCloseDoors()
|
||||
{
|
||||
for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
void BattleGroundDS::StartingEventOpenDoors()
|
||||
{
|
||||
for (uint32 i = BG_DS_OBJECT_DOOR_1; i <= BG_DS_OBJECT_DOOR_2; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
for (uint32 i = BG_DS_OBJECT_BUFF_1; i <= BG_DS_OBJECT_BUFF_2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
|
||||
setWaterFallTimer(urand(BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX));
|
||||
setWaterFallActive(false);
|
||||
|
||||
for (uint32 i = BG_DS_OBJECT_WATER_1; i <= BG_DS_OBJECT_WATER_2; ++i)
|
||||
SpawnBGObject(i, getWaterFallTimer());
|
||||
}
|
||||
|
||||
void BattleGroundDS::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundDSScore* sc = new BattleGroundDSScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundDS::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundDS::HandleKillPlayer(Player* player, Player* killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("BattleGroundDS: Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::HandleKillPlayer(player,killer);
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundDS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
switch(Trigger)
|
||||
{
|
||||
case 5347:
|
||||
case 5348:
|
||||
break;
|
||||
default:
|
||||
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool BattleGroundDS::HandlePlayerUnderMap(Player *player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(), 1299.046, 784.825, 9.338, 2.422, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundDS::FillInitialWorldStates(WorldPacket &data)
|
||||
{
|
||||
data << uint32(3610) << uint32(1); // 9 show
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundDS::Reset()
|
||||
{
|
||||
//call parent's class reset
|
||||
BattleGround::Reset();
|
||||
}
|
||||
|
||||
|
||||
bool BattleGroundDS::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if (!AddObject(BG_DS_OBJECT_DOOR_1, BG_DS_OBJECT_TYPE_DOOR_1, 1350.95, 817.2, 20.8096, 3.15, 0, 0, 0.99627, 0.0862864, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_DS_OBJECT_DOOR_2, BG_DS_OBJECT_TYPE_DOOR_2, 1232.65, 764.913, 20.0729, 6.3, 0, 0, 0.0310211, -0.999519, RESPAWN_IMMEDIATELY)
|
||||
// water
|
||||
|| !AddObject(BG_DS_OBJECT_WATER_1, BG_DS_OBJECT_TYPE_WATER_1, 1291.56, 790.837, 7.1, 3.14238, 0, 0, 0.694215, -0.719768, 120)
|
||||
|| !AddObject(BG_DS_OBJECT_WATER_2, BG_DS_OBJECT_TYPE_WATER_2, 1291.56, 790.837, 7.1, 3.14238, 0, 0, 0.694215, -0.719768, 120)
|
||||
// buffs
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_1, BG_DS_OBJECT_TYPE_BUFF_1, 1291.7, 813.424, 7.11472, 4.64562, 0, 0, 0.730314, -0.683111, 120)
|
||||
|| !AddObject(BG_DS_OBJECT_BUFF_2, BG_DS_OBJECT_TYPE_BUFF_2, 1291.7, 768.911, 7.11472, 1.55194, 0, 0, 0.700409, 0.713742, 120))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundDS: Failed to spawn some object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDDS_H
|
||||
#define __BATTLEGROUNDDS_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
enum BattleGroundDSObjectTypes
|
||||
{
|
||||
BG_DS_OBJECT_DOOR_1 = 0,
|
||||
BG_DS_OBJECT_DOOR_2 = 1,
|
||||
BG_DS_OBJECT_WATER_1 = 2,
|
||||
BG_DS_OBJECT_WATER_2 = 3,
|
||||
BG_DS_OBJECT_BUFF_1 = 4,
|
||||
BG_DS_OBJECT_BUFF_2 = 5,
|
||||
BG_DS_OBJECT_MAX = 6
|
||||
};
|
||||
|
||||
enum BattleGroundDSObjects
|
||||
{
|
||||
BG_DS_OBJECT_TYPE_DOOR_1 = 192642,
|
||||
BG_DS_OBJECT_TYPE_DOOR_2 = 192643,
|
||||
BG_DS_OBJECT_TYPE_WATER_1 = 194395,
|
||||
BG_DS_OBJECT_TYPE_WATER_2 = 191877,
|
||||
BG_DS_OBJECT_TYPE_BUFF_1 = 184663,
|
||||
BG_DS_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
enum BattleGroundDSData
|
||||
{ // These values are NOT blizzlike... need the correct data!
|
||||
BG_DS_WATERFALL_TIMER_MIN = 30000,
|
||||
BG_DS_WATERFALL_TIMER_MAX = 60000,
|
||||
BG_DS_WATERFALL_DURATION = 10000,
|
||||
};
|
||||
|
||||
class BattleGroundDSScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundDSScore() {};
|
||||
virtual ~BattleGroundDSScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattleGroundDS : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundDS();
|
||||
~BattleGroundDS();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
private:
|
||||
uint32 m_waterTimer;
|
||||
bool m_waterfallActive;
|
||||
protected:
|
||||
bool isWaterFallActive() { return m_waterfallActive; };
|
||||
void setWaterFallActive(bool active) { m_waterfallActive = active; };
|
||||
void setWaterFallTimer(uint32 timer) { m_waterTimer = timer; };
|
||||
uint32 getWaterFallTimer() { return m_waterTimer; };
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,939 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundEY.h"
|
||||
#include "Creature.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
uint32 BG_EY_HonorScoreTicks[BG_HONOR_MODE_NUM] = {
|
||||
330, // normal honor
|
||||
200 // holiday
|
||||
};
|
||||
|
||||
BattleGroundEY::BattleGroundEY()
|
||||
{
|
||||
m_BuffChange = true;
|
||||
m_BgObjects.resize(BG_EY_OBJECT_MAX);
|
||||
m_BgCreatures.resize(BG_EY_CREATURES_MAX);
|
||||
m_Points_Trigger[FEL_REALVER] = TR_FEL_REALVER_BUFF;
|
||||
m_Points_Trigger[BLOOD_ELF] = TR_BLOOD_ELF_BUFF;
|
||||
m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF;
|
||||
m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF;
|
||||
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundEY::~BattleGroundEY()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundEY::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
m_PointAddingTimer -= diff;
|
||||
if (m_PointAddingTimer <= 0)
|
||||
{
|
||||
m_PointAddingTimer = BG_EY_FPOINTS_TICK_TIME;
|
||||
if (m_TeamPointsCount[BG_TEAM_ALLIANCE] > 0)
|
||||
AddPoints(ALLIANCE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_ALLIANCE] - 1]);
|
||||
if (m_TeamPointsCount[BG_TEAM_HORDE] > 0)
|
||||
AddPoints(HORDE, BG_EY_TickPoints[m_TeamPointsCount[BG_TEAM_HORDE] - 1]);
|
||||
}
|
||||
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN || m_FlagState == BG_EY_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsTimer -= diff;
|
||||
|
||||
if (m_FlagsTimer < 0)
|
||||
{
|
||||
m_FlagsTimer = 0;
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_WAIT_RESPAWN)
|
||||
RespawnFlag(true);
|
||||
else
|
||||
RespawnFlagAfterDrop();
|
||||
}
|
||||
}
|
||||
|
||||
m_TowerCapCheckTimer -= diff;
|
||||
if (m_TowerCapCheckTimer <= 0)
|
||||
{
|
||||
//check if player joined point
|
||||
/*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times
|
||||
but we can count of players on current point in CheckSomeoneLeftPoint
|
||||
*/
|
||||
this->CheckSomeoneJoinedPoint();
|
||||
//check if player left point
|
||||
this->CheckSomeoneLeftPoint();
|
||||
this->UpdatePointStatuses();
|
||||
m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::StartingEventCloseDoors()
|
||||
{
|
||||
SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_IMMEDIATELY);
|
||||
|
||||
for (uint32 i = BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER; i < BG_EY_OBJECT_MAX; ++i)
|
||||
SpawnBGObject(i, RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
void BattleGroundEY::StartingEventOpenDoors()
|
||||
{
|
||||
SpawnBGObject(BG_EY_OBJECT_DOOR_A, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_EY_OBJECT_DOOR_H, RESPAWN_ONE_DAY);
|
||||
|
||||
for (uint32 i = BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER; i <= BG_EY_OBJECT_FLAG_NETHERSTORM; ++i)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
for (uint32 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
//randomly spawn buff
|
||||
uint8 buff = urand(0, 2);
|
||||
SpawnBGObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + buff + i * 3, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::AddPoints(uint32 Team, uint32 Points)
|
||||
{
|
||||
BattleGroundTeamId team_index = GetTeamIndexByTeamId(Team);
|
||||
m_TeamScores[team_index] += Points;
|
||||
m_HonorScoreTics[team_index] += Points;
|
||||
if (m_HonorScoreTics[team_index] >= m_HonorTics)
|
||||
{
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), Team);
|
||||
m_HonorScoreTics[team_index] -= m_HonorTics;
|
||||
}
|
||||
UpdateTeamScore(Team);
|
||||
}
|
||||
|
||||
void BattleGroundEY::CheckSomeoneJoinedPoint()
|
||||
{
|
||||
GameObject *obj = NULL;
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REALVER + i]);
|
||||
if (obj)
|
||||
{
|
||||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[EY_POINTS_MAX].size())
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j]));
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
if (plr->CanCaptureTowerPoint() && plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
|
||||
{
|
||||
//player joined point!
|
||||
//show progress bar
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, plr);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[i], plr);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, plr);
|
||||
//add player to point
|
||||
m_PlayersNearPoint[i].push_back(m_PlayersNearPoint[EY_POINTS_MAX][j]);
|
||||
//remove player from "free space"
|
||||
m_PlayersNearPoint[EY_POINTS_MAX].erase(m_PlayersNearPoint[EY_POINTS_MAX].begin() + j);
|
||||
}
|
||||
else
|
||||
++j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::CheckSomeoneLeftPoint()
|
||||
{
|
||||
//reset current point counts
|
||||
for (uint8 i = 0; i < 2*EY_POINTS_MAX; ++i)
|
||||
m_CurrentPointPlayersCount[i] = 0;
|
||||
GameObject *obj = NULL;
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REALVER + i]);
|
||||
if (obj)
|
||||
{
|
||||
uint8 j = 0;
|
||||
while (j < m_PlayersNearPoint[i].size())
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[i][j]);
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j]));
|
||||
//move not existed player to "free space" - this will cause many error showing in log, but it is a very important bug
|
||||
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
|
||||
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
|
||||
++j;
|
||||
continue;
|
||||
}
|
||||
if (!plr->CanCaptureTowerPoint() || !plr->IsWithinDistInMap(obj, BG_EY_POINT_RADIUS))
|
||||
//move player out of point (add him to players that are out of points
|
||||
{
|
||||
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
|
||||
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
|
||||
this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr);
|
||||
}
|
||||
else
|
||||
{
|
||||
//player is neat flag, so update count:
|
||||
m_CurrentPointPlayersCount[2 * i + GetTeamIndexByTeamId(plr->GetTeam())]++;
|
||||
++j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::UpdatePointStatuses()
|
||||
{
|
||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
||||
{
|
||||
if (m_PlayersNearPoint[point].empty())
|
||||
continue;
|
||||
//count new point bar status:
|
||||
m_PointBarStatus[point] += (m_CurrentPointPlayersCount[2 * point] - m_CurrentPointPlayersCount[2 * point + 1] < BG_EY_POINT_MAX_CAPTURERS_COUNT) ? m_CurrentPointPlayersCount[2 * point] - m_CurrentPointPlayersCount[2 * point + 1] : BG_EY_POINT_MAX_CAPTURERS_COUNT;
|
||||
|
||||
if (m_PointBarStatus[point] > BG_EY_PROGRESS_BAR_ALI_CONTROLLED)
|
||||
//point is fully alliance's
|
||||
m_PointBarStatus[point] = BG_EY_PROGRESS_BAR_ALI_CONTROLLED;
|
||||
if (m_PointBarStatus[point] < BG_EY_PROGRESS_BAR_HORDE_CONTROLLED)
|
||||
//point is fully horde's
|
||||
m_PointBarStatus[point] = BG_EY_PROGRESS_BAR_HORDE_CONTROLLED;
|
||||
|
||||
uint32 pointOwnerTeamId = 0;
|
||||
//find which team should own this point
|
||||
if (m_PointBarStatus[point] <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW)
|
||||
pointOwnerTeamId = HORDE;
|
||||
else if (m_PointBarStatus[point] >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH)
|
||||
pointOwnerTeamId = ALLIANCE;
|
||||
else
|
||||
pointOwnerTeamId = EY_POINT_NO_OWNER;
|
||||
|
||||
for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i)
|
||||
{
|
||||
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]);
|
||||
if (plr)
|
||||
{
|
||||
this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr);
|
||||
//if point owner changed we must evoke event!
|
||||
if (pointOwnerTeamId != m_PointOwnedByTeam[point])
|
||||
{
|
||||
//point was uncontrolled and player is from team which captured point
|
||||
if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId)
|
||||
this->EventTeamCapturedPoint(plr, point);
|
||||
|
||||
//point was under control and player isn't from team which controlled it
|
||||
if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point])
|
||||
this->EventTeamLostPoint(plr, point);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::UpdateTeamScore(uint32 Team)
|
||||
{
|
||||
uint32 score = GetTeamScore(Team);
|
||||
//TODO there should be some sound played when one team is near victory!! - and define variables
|
||||
/*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE)
|
||||
{
|
||||
if (Team == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_EY_SOUND_NEAR_VICTORY);
|
||||
m_IsInformedNearVictory = true;
|
||||
}*/
|
||||
|
||||
if (score >= BG_EY_MAX_TEAM_SCORE)
|
||||
{
|
||||
score = BG_EY_MAX_TEAM_SCORE;
|
||||
EndBattleGround(Team);
|
||||
}
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_RESOURCES, score);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_RESOURCES, score);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
//complete map reward
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundEY::UpdatePointsCount(uint32 Team)
|
||||
{
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(EY_ALLIANCE_BASE, m_TeamPointsCount[BG_TEAM_ALLIANCE]);
|
||||
else
|
||||
UpdateWorldState(EY_HORDE_BASE, m_TeamPointsCount[BG_TEAM_HORDE]);
|
||||
}
|
||||
|
||||
void BattleGroundEY::UpdatePointsIcons(uint32 Team, uint32 Point)
|
||||
{
|
||||
//we MUST firstly send 0, after that we can send 1!!!
|
||||
if (m_PointState[Point] == EY_POINT_UNDER_CONTROL)
|
||||
{
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 0);
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 1);
|
||||
else
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Team == ALLIANCE)
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateAllianceControlledIndex, 0);
|
||||
else
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateHordeControlledIndex, 0);
|
||||
UpdateWorldState(m_PointsIconStruct[Point].WorldStateControlIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map
|
||||
BattleGroundEYScore* sc = new BattleGroundEYScore;
|
||||
|
||||
m_PlayersNearPoint[EY_POINTS_MAX].push_back(plr->GetGUID());
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
for (int j = EY_POINTS_MAX; j >= 0; --j)
|
||||
{
|
||||
for (size_t i = 0; i < m_PlayersNearPoint[j].size(); ++i)
|
||||
if (m_PlayersNearPoint[j][i] == guid)
|
||||
m_PlayersNearPoint[j].erase(m_PlayersNearPoint[j].begin() + i);
|
||||
}
|
||||
if (IsFlagPickedup())
|
||||
{
|
||||
if (m_FlagKeeper == guid)
|
||||
{
|
||||
if (plr)
|
||||
EventPlayerDroppedFlag(plr);
|
||||
else
|
||||
{
|
||||
SetFlagPicker(0);
|
||||
RespawnFlag(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!Source->isAlive()) //hack code, must be removed later
|
||||
return;
|
||||
|
||||
switch(Trigger)
|
||||
{
|
||||
case TR_BLOOD_ELF_POINT:
|
||||
if (m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[BLOOD_ELF] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_BLOOD_ELF);
|
||||
break;
|
||||
case TR_FEL_REALVER_POINT:
|
||||
if (m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[FEL_REALVER] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_FEL_REALVER);
|
||||
break;
|
||||
case TR_MAGE_TOWER_POINT:
|
||||
if (m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[MAGE_TOWER] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_MAGE_TOWER);
|
||||
break;
|
||||
case TR_DRAENEI_RUINS_POINT:
|
||||
if (m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL && m_PointOwnedByTeam[DRAENEI_RUINS] == Source->GetTeam())
|
||||
if (m_FlagState && GetFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
|
||||
break;
|
||||
case 4512:
|
||||
case 4515:
|
||||
case 4517:
|
||||
case 4519:
|
||||
case 4530:
|
||||
case 4531:
|
||||
case 4568:
|
||||
case 4569:
|
||||
case 4570:
|
||||
case 4571:
|
||||
case 5866:
|
||||
break;
|
||||
default:
|
||||
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool BattleGroundEY::SetupBattleGround()
|
||||
{
|
||||
// doors
|
||||
if (!AddObject(BG_EY_OBJECT_DOOR_A, BG_OBJECT_A_DOOR_EY_ENTRY, 2527.6f, 1596.91f, 1262.13f, -3.12414f, -0.173642f, -0.001515f, 0.98477f, -0.008594f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_EY_OBJECT_DOOR_H, BG_OBJECT_H_DOOR_EY_ENTRY, 1803.21f, 1539.49f, 1261.09f, 3.14159f, 0.173648f, 0, 0.984808f, 0, RESPAWN_IMMEDIATELY)
|
||||
// banners (alliance)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_FEL_REALVER_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2047.19f, 1349.19f, 1189.0f, -1.62316f, 0, 0, 0.725374f, -0.688354f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_BLOOD_ELF_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2074.32f, 1385.78f, 1194.72f, 0.488692f, 0, 0, 0.241922f, 0.970296f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_BLOOD_ELF_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2025.13f, 1386.12f, 1192.74f, 2.3911f, 0, 0, 0.930418f, 0.366501f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2276.8f, 1400.41f, 1196.33f, 2.44346f, 0, 0, 0.939693f, 0.34202f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2305.78f, 1404.56f, 1199.38f, 1.74533f, 0, 0, 0.766044f, 0.642788f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2245.4f, 1366.41f, 1195.28f, 2.21657f, 0, 0, 0.894934f, 0.446198f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_A_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_A_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_A_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_A_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY)
|
||||
// banners (horde)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_FEL_REALVER_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_FEL_REALVER_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2047.19f, 1349.19f, 1189.0f, -1.62316f, 0, 0, 0.725374f, -0.688354f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_BLOOD_ELF_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2074.32f, 1385.78f, 1194.72f, 0.488692f, 0, 0, 0.241922f, 0.970296f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_BLOOD_ELF_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2025.13f, 1386.12f, 1192.74f, 2.3911f, 0, 0, 0.930418f, 0.366501f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2276.8f, 1400.41f, 1196.33f, 2.44346f, 0, 0, 0.939693f, 0.34202f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2305.78f, 1404.56f, 1199.38f, 1.74533f, 0, 0, 0.766044f, 0.642788f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2245.4f, 1366.41f, 1195.28f, 2.21657f, 0, 0, 0.894934f, 0.446198f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_H_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_H_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_H_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_H_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY)
|
||||
// banners (natural)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2057.46f, 1735.07f, 1187.91f, -0.925024f, 0, 0, 0.446198f, -0.894934f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_FEL_REALVER_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2032.25f, 1729.53f, 1190.33f, 1.8675f, 0, 0, 0.803857f, 0.594823f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_FEL_REALVER_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2092.35f, 1775.46f, 1187.08f, -0.401426f, 0, 0, 0.199368f, -0.979925f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2047.19f, 1349.19f, 1189.0f, -1.62316f, 0, 0, 0.725374f, -0.688354f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2074.32f, 1385.78f, 1194.72f, 0.488692f, 0, 0, 0.241922f, 0.970296f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2025.13f, 1386.12f, 1192.74f, 2.3911f, 0, 0, 0.930418f, 0.366501f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2276.8f, 1400.41f, 1196.33f, 2.44346f, 0, 0, 0.939693f, 0.34202f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2305.78f, 1404.56f, 1199.38f, 1.74533f, 0, 0, 0.766044f, 0.642788f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2245.4f, 1366.41f, 1195.28f, 2.21657f, 0, 0, 0.894934f, 0.446198f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_OBJECT_N_BANNER_EY_ENTRY, 2270.84f, 1784.08f, 1186.76f, 2.42601f, 0, 0, 0.936672f, 0.350207f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_LEFT, BG_OBJECT_N_BANNER_EY_ENTRY, 2269.13f, 1737.7f, 1186.66f, 0.994838f, 0, 0, 0.477159f, 0.878817f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_RIGHT, BG_OBJECT_N_BANNER_EY_ENTRY, 2300.86f, 1741.25f, 1187.7f, -0.785398f, 0, 0, 0.382683f, -0.92388f, RESPAWN_ONE_DAY)
|
||||
// flags
|
||||
|| !AddObject(BG_EY_OBJECT_FLAG_NETHERSTORM, BG_OBJECT_FLAG2_EY_ENTRY, 2174.782227f, 1569.054688f, 1160.361938f, -1.448624f, 0, 0, 0.662620f, -0.748956f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_FLAG_FEL_REALVER, BG_OBJECT_FLAG1_EY_ENTRY, 2044.28f, 1729.68f, 1189.96f, -0.017453f, 0, 0, 0.008727f, -0.999962f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_FLAG_BLOOD_ELF, BG_OBJECT_FLAG1_EY_ENTRY, 2048.83f, 1393.65f, 1194.49f, 0.20944f, 0, 0, 0.104528f, 0.994522f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_FLAG_DRAENEI_RUINS, BG_OBJECT_FLAG1_EY_ENTRY, 2286.56f, 1402.36f, 1197.11f, 3.72381f, 0, 0, 0.957926f, -0.287016f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_FLAG_MAGE_TOWER, BG_OBJECT_FLAG1_EY_ENTRY, 2284.48f, 1731.23f, 1189.99f, 2.89725f, 0, 0, 0.992546f, 0.121869f, RESPAWN_ONE_DAY)
|
||||
// tower cap
|
||||
|| !AddObject(BG_EY_OBJECT_TOWER_CAP_FEL_REALVER, BG_OBJECT_FR_TOWER_CAP_EY_ENTRY, 2024.600708f, 1742.819580f, 1195.157715f, 2.443461f, 0, 0, 0.939693f, 0.342020f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_TOWER_CAP_BLOOD_ELF, BG_OBJECT_BE_TOWER_CAP_EY_ENTRY, 2050.493164f, 1372.235962f, 1194.563477f, 1.710423f, 0, 0, 0.754710f, 0.656059f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_TOWER_CAP_DRAENEI_RUINS, BG_OBJECT_DR_TOWER_CAP_EY_ENTRY, 2301.010498f, 1386.931641f, 1197.183472f, 1.570796f, 0, 0, 0.707107f, 0.707107f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER, BG_OBJECT_HU_TOWER_CAP_EY_ENTRY, 2282.121582f, 1760.006958f, 1189.707153f, 1.919862f, 0, 0, 0.819152f, 0.573576f, RESPAWN_ONE_DAY)
|
||||
)
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundEY: Failed to spawn some object BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
//buffs
|
||||
for (int i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(m_Points_Trigger[i]);
|
||||
if (!at)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Unknown trigger: %u", m_Points_Trigger[i]);
|
||||
continue;
|
||||
}
|
||||
if (!AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
|| !AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY)
|
||||
)
|
||||
sLog.outError("BattleGroundEY: Cannot spawn buff");
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE);
|
||||
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_HORDE);
|
||||
if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundEY: Failed to spawn spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundEY::Reset()
|
||||
{
|
||||
//call parent's class reset
|
||||
BattleGround::Reset();
|
||||
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamPointsCount[BG_TEAM_HORDE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_ALLIANCE] = 0;
|
||||
m_HonorScoreTics[BG_TEAM_HORDE] = 0;
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
m_FlagCapturedBgObjectType = 0;
|
||||
m_FlagKeeper = 0;
|
||||
m_DroppedFlagGUID = 0;
|
||||
m_PointAddingTimer = 0;
|
||||
m_TowerCapCheckTimer = 0;
|
||||
bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID());
|
||||
m_HonorTics = (isBGWeekend) ? BG_EY_EYWeekendHonorTicks : BG_EY_NotEYWeekendHonorTicks;
|
||||
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
m_PointOwnedByTeam[i] = EY_POINT_NO_OWNER;
|
||||
m_PointState[i] = EY_POINT_STATE_UNCONTROLLED;
|
||||
m_PointBarStatus[i] = BG_EY_PROGRESS_BAR_STATE_MIDDLE;
|
||||
m_PlayersNearPoint[i].clear();
|
||||
m_PlayersNearPoint[i].reserve(15); //tip size
|
||||
}
|
||||
m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].clear();
|
||||
m_PlayersNearPoint[EY_PLAYERS_OUT_OF_POINTS].reserve(30);
|
||||
}
|
||||
|
||||
void BattleGroundEY::RespawnFlag(bool send_message)
|
||||
{
|
||||
if (m_FlagCapturedBgObjectType > 0)
|
||||
SpawnBGObject(m_FlagCapturedBgObjectType, RESPAWN_ONE_DAY);
|
||||
|
||||
m_FlagCapturedBgObjectType = 0;
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_IMMEDIATELY);
|
||||
|
||||
if (send_message)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_EY_RESETED_FLAG, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_RESET); // flags respawned sound...
|
||||
}
|
||||
|
||||
UpdateWorldState(NETHERSTORM_FLAG, 1);
|
||||
}
|
||||
|
||||
void BattleGroundEY::RespawnFlagAfterDrop()
|
||||
{
|
||||
RespawnFlag(true);
|
||||
|
||||
GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID());
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID()));
|
||||
|
||||
SetDroppedFlagGUID(0);
|
||||
}
|
||||
|
||||
void BattleGroundEY::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player, neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if (IsFlagPickedup() && GetFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsFlagPickedup())
|
||||
return;
|
||||
|
||||
if (GetFlagPickerGUID() != Source->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_GROUND;
|
||||
m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME;
|
||||
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
Source->CastSpell(Source, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
|
||||
//this does not work correctly :((it should remove flag carrier name)
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_WAIT_RESPAWN);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
|
||||
return;
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_ALLIANCE, BG_EY_FLAG_STATE_ON_PLAYER);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWorldState(NETHERSTORM_FLAG_STATE_HORDE, BG_EY_FLAG_STATE_ON_PLAYER);
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_PICKED_UP_HORDE);
|
||||
}
|
||||
|
||||
if (m_FlagState == BG_EY_FLAG_STATE_ON_BASE)
|
||||
UpdateWorldState(NETHERSTORM_FLAG, 0);
|
||||
m_FlagState = BG_EY_FLAG_STATE_ON_PLAYER;
|
||||
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY);
|
||||
SetFlagPicker(Source->GetGUID());
|
||||
//get flag aura on player
|
||||
Source->CastSpell(Source, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, Source->GetName());
|
||||
else
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName());
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventTeamLostPoint(Player *Source, uint32 Point)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//Natural point
|
||||
uint32 Team = m_PointOwnedByTeam[Point];
|
||||
|
||||
if (!Team)
|
||||
return;
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_ALLIANCE]--;
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance + 1, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeAlliance + 2, RESPAWN_ONE_DAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_HORDE]--;
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 1, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].DespawnObjectTypeHorde + 2, RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_LoosingPointTypes[Point].SpawnNeutralObjectType + 2, RESPAWN_IMMEDIATELY);
|
||||
|
||||
//buff isn't despawned
|
||||
|
||||
m_PointOwnedByTeam[Point] = EY_POINT_NO_OWNER;
|
||||
m_PointState[Point] = EY_POINT_NO_OWNER;
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
SendMessageToAll(m_LoosingPointTypes[Point].MessageIdAlliance,CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
else
|
||||
SendMessageToAll(m_LoosingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
|
||||
UpdatePointsIcons(Team, Point);
|
||||
UpdatePointsCount(Team);
|
||||
|
||||
//remove bonus honor aura trigger creature when node is lost
|
||||
if (Point < EY_POINTS_MAX)
|
||||
DelCreature(Point + 6);//NULL checks are in DelCreature! 0-5 spirit guides
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 Team = Source->GetTeam();
|
||||
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 2, RESPAWN_ONE_DAY);
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_ALLIANCE]++;
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_TeamPointsCount[BG_TEAM_HORDE]++;
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
//buff isn't respawned
|
||||
|
||||
m_PointOwnedByTeam[Point] = Team;
|
||||
m_PointState[Point] = EY_POINT_UNDER_CONTROL;
|
||||
|
||||
if (Team == ALLIANCE)
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance,CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
else
|
||||
SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde,CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
|
||||
if (m_BgCreatures[Point])
|
||||
DelCreature(Point);
|
||||
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId);
|
||||
if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team))
|
||||
sLog.outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u",
|
||||
Point, Team, m_CapturingPointTypes[Point].GraveYardId);
|
||||
|
||||
// SpawnBGCreature(Point,RESPAWN_IMMEDIATELY);
|
||||
|
||||
UpdatePointsIcons(Team, Point);
|
||||
UpdatePointsCount(Team);
|
||||
|
||||
if (Point >= EY_POINTS_MAX)
|
||||
return;
|
||||
|
||||
Creature* trigger = GetBGCreature(Point + 6);//0-5 spirit guides
|
||||
if (!trigger)
|
||||
trigger = AddCreature(WORLD_TRIGGER,Point+6,Team,BG_EY_TriggerPositions[Point][0],BG_EY_TriggerPositions[Point][1],BG_EY_TriggerPositions[Point][2],BG_EY_TriggerPositions[Point][3]);
|
||||
|
||||
//add bonus honor aura trigger creature when node is accupied
|
||||
//cast bonus aura (+50% honor in 25yards)
|
||||
//aura should only apply to players who have accupied the node, set correct faction for trigger
|
||||
if (trigger)
|
||||
{
|
||||
trigger->setFaction(Team == ALLIANCE ? 84 : 83);
|
||||
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
m_FlagState = BG_EY_FLAG_STATE_WAIT_RESPAWN;
|
||||
Source->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
else
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||
|
||||
SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY);
|
||||
|
||||
m_FlagsTimer = BG_EY_FLAG_RESPAWN_TIME;
|
||||
m_FlagCapturedBgObjectType = BgObjectType;
|
||||
|
||||
uint8 team_id = 0;
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
team_id = BG_TEAM_ALLIANCE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
}
|
||||
else
|
||||
{
|
||||
team_id = BG_TEAM_HORDE;
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
}
|
||||
|
||||
if (m_TeamPointsCount[team_id] > 0)
|
||||
AddPoints(Source->GetTeam(), BG_EY_FlagPoints[m_TeamPointsCount[team_id] - 1]);
|
||||
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1);
|
||||
}
|
||||
|
||||
void BattleGroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
if (itr == m_PlayerScores.end()) // player not found
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // flags captured
|
||||
((BattleGroundEYScore*)itr->second)->FlagCaptures += value;
|
||||
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, EY_OBJECTIVE_CAPTURE_FLAG);
|
||||
break;
|
||||
default:
|
||||
BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundEY::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(EY_HORDE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_HORDE]);
|
||||
data << uint32(EY_ALLIANCE_BASE) << uint32(m_TeamPointsCount[BG_TEAM_ALLIANCE]);
|
||||
data << uint32(0xab6) << uint32(0x0);
|
||||
data << uint32(0xab5) << uint32(0x0);
|
||||
data << uint32(0xab4) << uint32(0x0);
|
||||
data << uint32(0xab3) << uint32(0x0);
|
||||
data << uint32(0xab2) << uint32(0x0);
|
||||
data << uint32(0xab1) << uint32(0x0);
|
||||
data << uint32(0xab0) << uint32(0x0);
|
||||
data << uint32(0xaaf) << uint32(0x0);
|
||||
|
||||
data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == HORDE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[DRAENEI_RUINS] == ALLIANCE && m_PointState[DRAENEI_RUINS] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(m_PointState[DRAENEI_RUINS] != EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == ALLIANCE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[MAGE_TOWER] == HORDE && m_PointState[MAGE_TOWER] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(MAGE_TOWER_UNCONTROL) << uint32(m_PointState[MAGE_TOWER] != EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == HORDE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[FEL_REALVER] == ALLIANCE && m_PointState[FEL_REALVER] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(FEL_REAVER_UNCONTROL) << uint32(m_PointState[FEL_REALVER] != EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == HORDE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(m_PointOwnedByTeam[BLOOD_ELF] == ALLIANCE && m_PointState[BLOOD_ELF] == EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(BLOOD_ELF_UNCONTROL) << uint32(m_PointState[BLOOD_ELF] != EY_POINT_UNDER_CONTROL);
|
||||
|
||||
data << uint32(NETHERSTORM_FLAG) << uint32(m_FlagState == BG_EY_FLAG_STATE_ON_BASE);
|
||||
|
||||
data << uint32(0xad2) << uint32(0x1);
|
||||
data << uint32(0xad1) << uint32(0x1);
|
||||
data << uint32(0xabe) << uint32(GetTeamScore(HORDE));
|
||||
data << uint32(0xabd) << uint32(GetTeamScore(ALLIANCE));
|
||||
data << uint32(0xa05) << uint32(0x8e);
|
||||
data << uint32(0xaa0) << uint32(0x0);
|
||||
data << uint32(0xa9f) << uint32(0x0);
|
||||
data << uint32(0xa9e) << uint32(0x0);
|
||||
data << uint32(0xc0d) << uint32(0x17b);
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const *BattleGroundEY::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
uint32 g_id = 0;
|
||||
|
||||
switch(player->GetTeam())
|
||||
{
|
||||
case ALLIANCE: g_id = EY_GRAVEYARD_MAIN_ALLIANCE; break;
|
||||
case HORDE: g_id = EY_GRAVEYARD_MAIN_HORDE; break;
|
||||
default: return NULL;
|
||||
}
|
||||
|
||||
float distance, nearestDistance;
|
||||
|
||||
WorldSafeLocsEntry const* entry = NULL;
|
||||
WorldSafeLocsEntry const* nearestEntry = NULL;
|
||||
entry = sWorldSafeLocsStore.LookupEntry(g_id);
|
||||
nearestEntry = entry;
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
sLog.outError("BattleGroundEY: Not found the main team graveyard. Graveyard system isn't working!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
float plr_x = player->GetPositionX();
|
||||
float plr_y = player->GetPositionY();
|
||||
float plr_z = player->GetPositionZ();
|
||||
|
||||
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
|
||||
nearestDistance = distance;
|
||||
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
if (m_PointOwnedByTeam[i] == player->GetTeam() && m_PointState[i] == EY_POINT_UNDER_CONTROL)
|
||||
{
|
||||
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
|
||||
if (!entry)
|
||||
sLog.outError("BattleGroundEY: Not found graveyard: %u",m_CapturingPointTypes[i].GraveYardId);
|
||||
else
|
||||
{
|
||||
distance = (entry->x - plr_x)*(entry->x - plr_x) + (entry->y - plr_y)*(entry->y - plr_y) + (entry->z - plr_z)*(entry->z - plr_z);
|
||||
if (distance < nearestDistance)
|
||||
{
|
||||
nearestDistance = distance;
|
||||
nearestEntry = entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nearestEntry;
|
||||
}
|
||||
|
||||
bool BattleGroundEY::IsAllNodesConrolledByTeam(uint32 team) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (int i = 0; i < EY_POINTS_MAX; ++i)
|
||||
if (m_PointOwnedByTeam[i] == team && m_PointState[i] == EY_POINT_UNDER_CONTROL)
|
||||
++count;
|
||||
|
||||
return count == EY_POINTS_MAX;
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDEY_H
|
||||
#define __BATTLEGROUNDEY_H
|
||||
|
||||
#include "Language.h"
|
||||
|
||||
class BattleGround;
|
||||
|
||||
#define BG_EY_FLAG_RESPAWN_TIME (8*IN_MILLISECONDS) //8 seconds
|
||||
#define BG_EY_FPOINTS_TICK_TIME (2*IN_MILLISECONDS) //2 seconds
|
||||
|
||||
enum BG_EY_WorldStates
|
||||
{
|
||||
EY_ALLIANCE_RESOURCES = 2749,
|
||||
EY_HORDE_RESOURCES = 2750,
|
||||
EY_ALLIANCE_BASE = 2752,
|
||||
EY_HORDE_BASE = 2753,
|
||||
DRAENEI_RUINS_HORDE_CONTROL = 2733,
|
||||
DRAENEI_RUINS_ALLIANCE_CONTROL = 2732,
|
||||
DRAENEI_RUINS_UNCONTROL = 2731,
|
||||
MAGE_TOWER_ALLIANCE_CONTROL = 2730,
|
||||
MAGE_TOWER_HORDE_CONTROL = 2729,
|
||||
MAGE_TOWER_UNCONTROL = 2728,
|
||||
FEL_REAVER_HORDE_CONTROL = 2727,
|
||||
FEL_REAVER_ALLIANCE_CONTROL = 2726,
|
||||
FEL_REAVER_UNCONTROL = 2725,
|
||||
BLOOD_ELF_HORDE_CONTROL = 2724,
|
||||
BLOOD_ELF_ALLIANCE_CONTROL = 2723,
|
||||
BLOOD_ELF_UNCONTROL = 2722,
|
||||
PROGRESS_BAR_PERCENT_GREY = 2720, //100 = empty (only grey), 0 = blue|red (no grey)
|
||||
PROGRESS_BAR_STATUS = 2719, //50 init!, 48 ... hordak bere .. 33 .. 0 = full 100% hordacky , 100 = full alliance
|
||||
PROGRESS_BAR_SHOW = 2718, //1 init, 0 druhy send - bez messagu, 1 = controlled aliance
|
||||
NETHERSTORM_FLAG = 2757,
|
||||
//set to 2 when flag is picked up, and to 1 if it is dropped
|
||||
NETHERSTORM_FLAG_STATE_ALLIANCE = 2769,
|
||||
NETHERSTORM_FLAG_STATE_HORDE = 2770
|
||||
};
|
||||
|
||||
enum BG_EY_ProgressBarConsts
|
||||
{
|
||||
BG_EY_POINT_MAX_CAPTURERS_COUNT = 5,
|
||||
BG_EY_POINT_RADIUS = 70,
|
||||
BG_EY_PROGRESS_BAR_DONT_SHOW = 0,
|
||||
BG_EY_PROGRESS_BAR_SHOW = 1,
|
||||
BG_EY_PROGRESS_BAR_PERCENT_GREY = 40,
|
||||
BG_EY_PROGRESS_BAR_STATE_MIDDLE = 50,
|
||||
BG_EY_PROGRESS_BAR_HORDE_CONTROLLED = 0,
|
||||
BG_EY_PROGRESS_BAR_NEUTRAL_LOW = 30,
|
||||
BG_EY_PROGRESS_BAR_NEUTRAL_HIGH = 70,
|
||||
BG_EY_PROGRESS_BAR_ALI_CONTROLLED = 100
|
||||
};
|
||||
|
||||
enum BG_EY_Sounds
|
||||
{
|
||||
//strange ids, but sure about them
|
||||
BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE = 8212,
|
||||
BG_EY_SOUND_FLAG_CAPTURED_HORDE = 8213,
|
||||
BG_EY_SOUND_FLAG_PICKED_UP_HORDE = 8174,
|
||||
BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE = 8173,
|
||||
BG_EY_SOUND_FLAG_RESET = 8192
|
||||
};
|
||||
|
||||
enum BG_EY_Spells
|
||||
{
|
||||
BG_EY_NETHERSTORM_FLAG_SPELL = 34976,
|
||||
BG_EY_PLAYER_DROPPED_FLAG_SPELL = 34991
|
||||
};
|
||||
|
||||
enum EYBattleGroundObjectEntry
|
||||
{
|
||||
BG_OBJECT_A_DOOR_EY_ENTRY = 184719, //Alliance door
|
||||
BG_OBJECT_H_DOOR_EY_ENTRY = 184720, //Horde door
|
||||
BG_OBJECT_FLAG1_EY_ENTRY = 184493, //Netherstorm flag (generic)
|
||||
BG_OBJECT_FLAG2_EY_ENTRY = 184141, //Netherstorm flag (flagstand)
|
||||
BG_OBJECT_FLAG3_EY_ENTRY = 184142, //Netherstorm flag (flagdrop)
|
||||
BG_OBJECT_A_BANNER_EY_ENTRY = 184381, //Visual Banner (Alliance)
|
||||
BG_OBJECT_H_BANNER_EY_ENTRY = 184380, //Visual Banner (Horde)
|
||||
BG_OBJECT_N_BANNER_EY_ENTRY = 184382, //Visual Banner (Neutral)
|
||||
BG_OBJECT_BE_TOWER_CAP_EY_ENTRY = 184080, //BE Tower Cap Pt
|
||||
BG_OBJECT_FR_TOWER_CAP_EY_ENTRY = 184081, //Fel Reaver Cap Pt
|
||||
BG_OBJECT_HU_TOWER_CAP_EY_ENTRY = 184082, //Human Tower Cap Pt
|
||||
BG_OBJECT_DR_TOWER_CAP_EY_ENTRY = 184083 //Draenei Tower Cap Pt
|
||||
};
|
||||
|
||||
enum EYBattleGroundPointsTrigger
|
||||
{
|
||||
TR_BLOOD_ELF_POINT = 4476,
|
||||
TR_FEL_REALVER_POINT = 4514,
|
||||
TR_MAGE_TOWER_POINT = 4516,
|
||||
TR_DRAENEI_RUINS_POINT = 4518,
|
||||
TR_BLOOD_ELF_BUFF = 4568,
|
||||
TR_FEL_REALVER_BUFF = 4569,
|
||||
TR_MAGE_TOWER_BUFF = 4570,
|
||||
TR_DRAENEI_RUINS_BUFF = 4571
|
||||
};
|
||||
|
||||
enum EYBattleGroundGaveyards
|
||||
{
|
||||
EY_GRAVEYARD_MAIN_ALLIANCE = 1103,
|
||||
EY_GRAVEYARD_MAIN_HORDE = 1104,
|
||||
EY_GRAVEYARD_FEL_REALVER = 1105,
|
||||
EY_GRAVEYARD_BLOOD_ELF = 1106,
|
||||
EY_GRAVEYARD_DRAENEI_RUINS = 1107,
|
||||
EY_GRAVEYARD_MAGE_TOWER = 1108
|
||||
};
|
||||
|
||||
enum EYBattleGroundPoints
|
||||
{
|
||||
FEL_REALVER = 0,
|
||||
BLOOD_ELF = 1,
|
||||
DRAENEI_RUINS = 2,
|
||||
MAGE_TOWER = 3,
|
||||
|
||||
EY_PLAYERS_OUT_OF_POINTS = 4,
|
||||
EY_POINTS_MAX = 4
|
||||
};
|
||||
|
||||
enum EYBattleGroundCreaturesTypes
|
||||
{
|
||||
EY_SPIRIT_FEL_REALVER = 0,
|
||||
EY_SPIRIT_BLOOD_ELF = 1,
|
||||
EY_SPIRIT_DRAENEI_RUINS = 2,
|
||||
EY_SPIRIT_MAGE_TOWER = 3,
|
||||
EY_SPIRIT_MAIN_ALLIANCE = 4,
|
||||
EY_SPIRIT_MAIN_HORDE = 5,
|
||||
|
||||
EY_TRIGGER_FEL_REALVER = 6,
|
||||
EY_TRIGGER_BLOOD_ELF = 7,
|
||||
EY_TRIGGER_DRAENEI_RUINS = 8,
|
||||
EY_TRIGGER_MAGE_TOWER = 9,
|
||||
|
||||
BG_EY_CREATURES_MAX = 10
|
||||
};
|
||||
|
||||
enum EYBattleGroundObjectTypes
|
||||
{
|
||||
BG_EY_OBJECT_DOOR_A = 0,
|
||||
BG_EY_OBJECT_DOOR_H = 1,
|
||||
BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER = 2,
|
||||
BG_EY_OBJECT_A_BANNER_FEL_REALVER_LEFT = 3,
|
||||
BG_EY_OBJECT_A_BANNER_FEL_REALVER_RIGHT = 4,
|
||||
BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER = 5,
|
||||
BG_EY_OBJECT_A_BANNER_BLOOD_ELF_LEFT = 6,
|
||||
BG_EY_OBJECT_A_BANNER_BLOOD_ELF_RIGHT = 7,
|
||||
BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER = 8,
|
||||
BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_LEFT = 9,
|
||||
BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_RIGHT = 10,
|
||||
BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER = 11,
|
||||
BG_EY_OBJECT_A_BANNER_MAGE_TOWER_LEFT = 12,
|
||||
BG_EY_OBJECT_A_BANNER_MAGE_TOWER_RIGHT = 13,
|
||||
BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER = 14,
|
||||
BG_EY_OBJECT_H_BANNER_FEL_REALVER_LEFT = 15,
|
||||
BG_EY_OBJECT_H_BANNER_FEL_REALVER_RIGHT = 16,
|
||||
BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER = 17,
|
||||
BG_EY_OBJECT_H_BANNER_BLOOD_ELF_LEFT = 18,
|
||||
BG_EY_OBJECT_H_BANNER_BLOOD_ELF_RIGHT = 19,
|
||||
BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER = 20,
|
||||
BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_LEFT = 21,
|
||||
BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_RIGHT = 22,
|
||||
BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER = 23,
|
||||
BG_EY_OBJECT_H_BANNER_MAGE_TOWER_LEFT = 24,
|
||||
BG_EY_OBJECT_H_BANNER_MAGE_TOWER_RIGHT = 25,
|
||||
BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER = 26,
|
||||
BG_EY_OBJECT_N_BANNER_FEL_REALVER_LEFT = 27,
|
||||
BG_EY_OBJECT_N_BANNER_FEL_REALVER_RIGHT = 28,
|
||||
BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER = 29,
|
||||
BG_EY_OBJECT_N_BANNER_BLOOD_ELF_LEFT = 30,
|
||||
BG_EY_OBJECT_N_BANNER_BLOOD_ELF_RIGHT = 31,
|
||||
BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER = 32,
|
||||
BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_LEFT = 33,
|
||||
BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_RIGHT = 34,
|
||||
BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER = 35,
|
||||
BG_EY_OBJECT_N_BANNER_MAGE_TOWER_LEFT = 36,
|
||||
BG_EY_OBJECT_N_BANNER_MAGE_TOWER_RIGHT = 37,
|
||||
BG_EY_OBJECT_TOWER_CAP_FEL_REALVER = 38,
|
||||
BG_EY_OBJECT_TOWER_CAP_BLOOD_ELF = 39,
|
||||
BG_EY_OBJECT_TOWER_CAP_DRAENEI_RUINS = 40,
|
||||
BG_EY_OBJECT_TOWER_CAP_MAGE_TOWER = 41,
|
||||
BG_EY_OBJECT_FLAG_NETHERSTORM = 42,
|
||||
BG_EY_OBJECT_FLAG_FEL_REALVER = 43,
|
||||
BG_EY_OBJECT_FLAG_BLOOD_ELF = 44,
|
||||
BG_EY_OBJECT_FLAG_DRAENEI_RUINS = 45,
|
||||
BG_EY_OBJECT_FLAG_MAGE_TOWER = 46,
|
||||
//buffs
|
||||
BG_EY_OBJECT_SPEEDBUFF_FEL_REALVER = 47,
|
||||
BG_EY_OBJECT_REGENBUFF_FEL_REALVER = 48,
|
||||
BG_EY_OBJECT_BERSERKBUFF_FEL_REALVER = 49,
|
||||
BG_EY_OBJECT_SPEEDBUFF_BLOOD_ELF = 50,
|
||||
BG_EY_OBJECT_REGENBUFF_BLOOD_ELF = 51,
|
||||
BG_EY_OBJECT_BERSERKBUFF_BLOOD_ELF = 52,
|
||||
BG_EY_OBJECT_SPEEDBUFF_DRAENEI_RUINS = 53,
|
||||
BG_EY_OBJECT_REGENBUFF_DRAENEI_RUINS = 54,
|
||||
BG_EY_OBJECT_BERSERKBUFF_DRAENEI_RUINS = 55,
|
||||
BG_EY_OBJECT_SPEEDBUFF_MAGE_TOWER = 56,
|
||||
BG_EY_OBJECT_REGENBUFF_MAGE_TOWER = 57,
|
||||
BG_EY_OBJECT_BERSERKBUFF_MAGE_TOWER = 58,
|
||||
BG_EY_OBJECT_MAX = 59
|
||||
};
|
||||
|
||||
#define BG_EY_NotEYWeekendHonorTicks 330
|
||||
#define BG_EY_EYWeekendHonorTicks 200
|
||||
|
||||
enum BG_EY_Score
|
||||
{
|
||||
BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400,
|
||||
BG_EY_MAX_TEAM_SCORE = 1600
|
||||
};
|
||||
|
||||
enum BG_EY_FlagState
|
||||
{
|
||||
BG_EY_FLAG_STATE_ON_BASE = 0,
|
||||
BG_EY_FLAG_STATE_WAIT_RESPAWN = 1,
|
||||
BG_EY_FLAG_STATE_ON_PLAYER = 2,
|
||||
BG_EY_FLAG_STATE_ON_GROUND = 3
|
||||
};
|
||||
|
||||
enum EYBattleGroundPointState
|
||||
{
|
||||
EY_POINT_NO_OWNER = 0,
|
||||
EY_POINT_STATE_UNCONTROLLED = 0,
|
||||
EY_POINT_UNDER_CONTROL = 3
|
||||
};
|
||||
|
||||
enum BG_EY_Objectives
|
||||
{
|
||||
EY_OBJECTIVE_CAPTURE_FLAG = 183
|
||||
};
|
||||
|
||||
struct BattleGroundEYPointIconsStruct
|
||||
{
|
||||
BattleGroundEYPointIconsStruct(uint32 _WorldStateControlIndex, uint32 _WorldStateAllianceControlledIndex, uint32 _WorldStateHordeControlledIndex)
|
||||
: WorldStateControlIndex(_WorldStateControlIndex), WorldStateAllianceControlledIndex(_WorldStateAllianceControlledIndex), WorldStateHordeControlledIndex(_WorldStateHordeControlledIndex) {}
|
||||
uint32 WorldStateControlIndex;
|
||||
uint32 WorldStateAllianceControlledIndex;
|
||||
uint32 WorldStateHordeControlledIndex;
|
||||
};
|
||||
|
||||
// x, y, z, o
|
||||
const float BG_EY_TriggerPositions[EY_POINTS_MAX][4] = {
|
||||
{2044.28f, 1729.68f, 1189.96f, -0.017453f}, // FEL_REALVER center
|
||||
{2048.83f, 1393.65f, 1194.49f, 0.20944f}, // BLOOD_ELF center
|
||||
{2286.56f, 1402.36f, 1197.11f, 3.72381f}, // DRAENEI_RUINS center
|
||||
{2284.48f, 1731.23f, 1189.99f, 2.89725f} // MAGE_TOWER center
|
||||
};
|
||||
|
||||
struct BattleGroundEYLoosingPointStruct
|
||||
{
|
||||
BattleGroundEYLoosingPointStruct(uint32 _SpawnNeutralObjectType, uint32 _DespawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _DespawnObjectTypeHorde, uint32 _MessageIdHorde)
|
||||
: SpawnNeutralObjectType(_SpawnNeutralObjectType),
|
||||
DespawnObjectTypeAlliance(_DespawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
|
||||
DespawnObjectTypeHorde(_DespawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde)
|
||||
{}
|
||||
|
||||
uint32 SpawnNeutralObjectType;
|
||||
uint32 DespawnObjectTypeAlliance;
|
||||
uint32 MessageIdAlliance;
|
||||
uint32 DespawnObjectTypeHorde;
|
||||
uint32 MessageIdHorde;
|
||||
};
|
||||
|
||||
struct BattleGroundEYCapturingPointStruct
|
||||
{
|
||||
BattleGroundEYCapturingPointStruct(uint32 _DespawnNeutralObjectType, uint32 _SpawnObjectTypeAlliance, uint32 _MessageIdAlliance, uint32 _SpawnObjectTypeHorde, uint32 _MessageIdHorde, uint32 _GraveYardId)
|
||||
: DespawnNeutralObjectType(_DespawnNeutralObjectType),
|
||||
SpawnObjectTypeAlliance(_SpawnObjectTypeAlliance), MessageIdAlliance(_MessageIdAlliance),
|
||||
SpawnObjectTypeHorde(_SpawnObjectTypeHorde), MessageIdHorde(_MessageIdHorde),
|
||||
GraveYardId(_GraveYardId)
|
||||
{}
|
||||
|
||||
uint32 DespawnNeutralObjectType;
|
||||
uint32 SpawnObjectTypeAlliance;
|
||||
uint32 MessageIdAlliance;
|
||||
uint32 SpawnObjectTypeHorde;
|
||||
uint32 MessageIdHorde;
|
||||
uint32 GraveYardId;
|
||||
};
|
||||
|
||||
const uint8 BG_EY_TickPoints[EY_POINTS_MAX] = {1, 2, 5, 10};
|
||||
const uint32 BG_EY_FlagPoints[EY_POINTS_MAX] = {75, 85, 100, 500};
|
||||
|
||||
//constant arrays:
|
||||
const BattleGroundEYPointIconsStruct m_PointsIconStruct[EY_POINTS_MAX] =
|
||||
{
|
||||
BattleGroundEYPointIconsStruct(FEL_REAVER_UNCONTROL, FEL_REAVER_ALLIANCE_CONTROL, FEL_REAVER_HORDE_CONTROL),
|
||||
BattleGroundEYPointIconsStruct(BLOOD_ELF_UNCONTROL, BLOOD_ELF_ALLIANCE_CONTROL, BLOOD_ELF_HORDE_CONTROL),
|
||||
BattleGroundEYPointIconsStruct(DRAENEI_RUINS_UNCONTROL, DRAENEI_RUINS_ALLIANCE_CONTROL, DRAENEI_RUINS_HORDE_CONTROL),
|
||||
BattleGroundEYPointIconsStruct(MAGE_TOWER_UNCONTROL, MAGE_TOWER_ALLIANCE_CONTROL, MAGE_TOWER_HORDE_CONTROL)
|
||||
};
|
||||
const BattleGroundEYLoosingPointStruct m_LoosingPointTypes[EY_POINTS_MAX] =
|
||||
{
|
||||
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_LOST_H_F_RUINS),
|
||||
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_LOST_H_B_TOWER),
|
||||
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_LOST_H_D_RUINS),
|
||||
BattleGroundEYLoosingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_LOST_H_M_TOWER)
|
||||
};
|
||||
const BattleGroundEYCapturingPointStruct m_CapturingPointTypes[EY_POINTS_MAX] =
|
||||
{
|
||||
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_FEL_REALVER_CENTER, BG_EY_OBJECT_A_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_A_F_RUINS, BG_EY_OBJECT_H_BANNER_FEL_REALVER_CENTER, LANG_BG_EY_HAS_TAKEN_H_F_RUINS, EY_GRAVEYARD_FEL_REALVER),
|
||||
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_BLOOD_ELF_CENTER, BG_EY_OBJECT_A_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_A_B_TOWER, BG_EY_OBJECT_H_BANNER_BLOOD_ELF_CENTER, LANG_BG_EY_HAS_TAKEN_H_B_TOWER, EY_GRAVEYARD_BLOOD_ELF),
|
||||
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_DRAENEI_RUINS_CENTER, BG_EY_OBJECT_A_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_A_D_RUINS, BG_EY_OBJECT_H_BANNER_DRAENEI_RUINS_CENTER, LANG_BG_EY_HAS_TAKEN_H_D_RUINS, EY_GRAVEYARD_DRAENEI_RUINS),
|
||||
BattleGroundEYCapturingPointStruct(BG_EY_OBJECT_N_BANNER_MAGE_TOWER_CENTER, BG_EY_OBJECT_A_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_A_M_TOWER, BG_EY_OBJECT_H_BANNER_MAGE_TOWER_CENTER, LANG_BG_EY_HAS_TAKEN_H_M_TOWER, EY_GRAVEYARD_MAGE_TOWER)
|
||||
};
|
||||
|
||||
class BattleGroundEYScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundEYScore () : FlagCaptures(0) {};
|
||||
virtual ~BattleGroundEYScore() {};
|
||||
uint32 FlagCaptures;
|
||||
};
|
||||
|
||||
class BattleGroundEY : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundEY();
|
||||
~BattleGroundEY();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetFlagPickerGUID() const { return m_FlagKeeper; }
|
||||
void SetFlagPicker(uint64 guid) { m_FlagKeeper = guid; }
|
||||
bool IsFlagPickedup() const { return m_FlagKeeper != 0; }
|
||||
uint8 GetFlagState() const { return m_FlagState; }
|
||||
void RespawnFlag(bool send_message);
|
||||
void RespawnFlagAfterDrop();
|
||||
|
||||
void RemovePlayer(Player *plr,uint64 guid);
|
||||
void HandleBuffUse(uint64 const& buff_guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player *player, Player *killer);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
virtual bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void UpdateTeamScore(uint32 Team);
|
||||
void EndBattleGround(uint32 winner);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;}
|
||||
uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;}
|
||||
|
||||
/* Battleground Events */
|
||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
||||
virtual void EventPlayerDroppedFlag(Player *Source);
|
||||
|
||||
/* achievement req. */
|
||||
bool IsAllNodesConrolledByTeam(uint32 team) const;
|
||||
private:
|
||||
void EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType);
|
||||
void EventTeamCapturedPoint(Player *Source, uint32 Point);
|
||||
void EventTeamLostPoint(Player *Source, uint32 Point);
|
||||
void UpdatePointsCount(uint32 Team);
|
||||
void UpdatePointsIcons(uint32 Team, uint32 Point);
|
||||
|
||||
/* Point status updating procedures */
|
||||
void CheckSomeoneLeftPoint();
|
||||
void CheckSomeoneJoinedPoint();
|
||||
void UpdatePointStatuses();
|
||||
|
||||
/* Scorekeeping */
|
||||
uint32 GetTeamScore(uint32 Team) const { return m_TeamScores[GetTeamIndexByTeamId(Team)]; }
|
||||
void AddPoints(uint32 Team, uint32 Points);
|
||||
|
||||
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
|
||||
void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
|
||||
|
||||
uint32 m_HonorScoreTics[2];
|
||||
uint32 m_TeamPointsCount[2];
|
||||
|
||||
uint32 m_Points_Trigger[EY_POINTS_MAX];
|
||||
|
||||
uint64 m_FlagKeeper; // keepers guid
|
||||
uint64 m_DroppedFlagGUID;
|
||||
uint32 m_FlagCapturedBgObjectType; // type that should be despawned when flag is captured
|
||||
uint8 m_FlagState; // for checking flag state
|
||||
int32 m_FlagsTimer;
|
||||
int32 m_TowerCapCheckTimer;
|
||||
|
||||
uint32 m_PointOwnedByTeam[EY_POINTS_MAX];
|
||||
uint8 m_PointState[EY_POINTS_MAX];
|
||||
int32 m_PointBarStatus[EY_POINTS_MAX];
|
||||
typedef std::vector<uint64> PlayersNearPointType;
|
||||
PlayersNearPointType m_PlayersNearPoint[EY_POINTS_MAX + 1];
|
||||
uint8 m_CurrentPointPlayersCount[2*EY_POINTS_MAX];
|
||||
|
||||
int32 m_PointAddingTimer;
|
||||
uint32 m_HonorTics;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Player.h"
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundIC.h"
|
||||
#include "Language.h"
|
||||
|
||||
BattleGroundIC::BattleGroundIC()
|
||||
{
|
||||
m_BgCreatures.resize(2);
|
||||
m_BgObjects.resize(5);
|
||||
//TODO FIX ME!
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundIC::~BattleGroundIC()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundIC::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
}
|
||||
|
||||
void BattleGroundIC::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundIC::StartingEventOpenDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundIC::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundICScore* sc = new BattleGroundICScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundIC::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundIC::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
}
|
||||
|
||||
void BattleGroundIC::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
|
||||
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
|
||||
}
|
||||
|
||||
bool BattleGroundIC::SetupBattleGround()
|
||||
{
|
||||
AddObject(0, 195157, 459.72f, -419.93f, 42.55f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
||||
AddObject(1, 195158, 797.72f, -1009.48f, 138.52f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
||||
AddObject(2, 195338, 418.98f, -838.33f, 51.09f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
||||
AddObject(3, 195343, 1267.45f, -390.88f, 24.23f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
||||
AddObject(4, 195333, 769.27f, -833.53f, 9.57f, 0, 0, 0, 0.9996573f, 0.02617699f, 10*MINUTE);
|
||||
SpawnLeader(ALLIANCE);
|
||||
SpawnLeader(HORDE);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundIC::SpawnLeader(uint32 teamid)
|
||||
{
|
||||
if (teamid == ALLIANCE)
|
||||
AddCreature(34924, 0, ALLIANCE, 307.03f, -833.04f, 48.91f, 6.23f, 10*MINUTE);
|
||||
else
|
||||
AddCreature(34922, 1, HORDE, 1264.42f, -766.80f, 48.91f, 3.28f, 10*MINUTE);
|
||||
}
|
||||
|
||||
void BattleGroundIC::HandleKillUnit(Creature *unit, Player * /*killer*/)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 entry = unit->GetEntry();
|
||||
if (entry == 34924)
|
||||
{
|
||||
RewardHonorToTeam(500,HORDE);
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
else if (entry == 34922)
|
||||
{
|
||||
RewardHonorToTeam(500,ALLIANCE);
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundIC::EndBattleGround(uint32 winner)
|
||||
{
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundIC::EventPlayerClickedOnFlag(Player * /*source*/, GameObject* /*target_obj*/)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDIC_H
|
||||
#define __BATTLEGROUNDIC_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
enum Buffs
|
||||
{
|
||||
OIL_REFINERY = 68719,
|
||||
QUARRY = 68720
|
||||
};
|
||||
|
||||
enum BG_IC_Objectives
|
||||
{
|
||||
IC_OBJECTIVE_ASSAULT_BASE = 245,
|
||||
IC_OBJECTIVE_DEFEND_BASE = 246
|
||||
};
|
||||
|
||||
class BattleGroundICScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundICScore() {};
|
||||
virtual ~BattleGroundICScore() {};
|
||||
};
|
||||
|
||||
class BattleGroundIC : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundIC();
|
||||
~BattleGroundIC();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr,uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void SpawnLeader(uint32 teamid);
|
||||
void HandleKillUnit(Creature *unit, Player *killer);
|
||||
void EndBattleGround(uint32 winner);
|
||||
void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundNA.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
BattleGroundNA::BattleGroundNA()
|
||||
{
|
||||
m_BgObjects.resize(BG_NA_OBJECT_MAX);
|
||||
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundNA::~BattleGroundNA()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundNA::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
}
|
||||
|
||||
void BattleGroundNA::StartingEventCloseDoors()
|
||||
{
|
||||
for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_4; ++i)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
void BattleGroundNA::StartingEventOpenDoors()
|
||||
{
|
||||
for (uint32 i = BG_NA_OBJECT_DOOR_1; i <= BG_NA_OBJECT_DOOR_2; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
for (uint32 i = BG_NA_OBJECT_BUFF_1; i <= BG_NA_OBJECT_BUFF_2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
void BattleGroundNA::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundNAScore* sc = new BattleGroundNAScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("BattleGroundNA: Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::HandleKillPlayer(player,killer);
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(),4055.504395,2919.660645,13.611241,player->GetOrientation(),false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
{
|
||||
case 4536: // buff trigger?
|
||||
case 4537: // buff trigger?
|
||||
break;
|
||||
default:
|
||||
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
void BattleGroundNA::FillInitialWorldStates(WorldPacket &data)
|
||||
{
|
||||
data << uint32(0xa11) << uint32(1); // 9
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundNA::Reset()
|
||||
{
|
||||
//call parent's class reset
|
||||
BattleGround::Reset();
|
||||
}
|
||||
|
||||
bool BattleGroundNA::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if (!AddObject(BG_NA_OBJECT_DOOR_1, BG_NA_OBJECT_TYPE_DOOR_1, 4031.854, 2966.833, 12.6462, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_2, BG_NA_OBJECT_TYPE_DOOR_2, 4081.179, 2874.97, 12.39171, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_3, BG_NA_OBJECT_TYPE_DOOR_3, 4023.709, 2981.777, 10.70117, -2.648788, 0, 0, 0.9697962, -0.2439165, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_NA_OBJECT_DOOR_4, BG_NA_OBJECT_TYPE_DOOR_4, 4090.064, 2858.438, 10.23631, 0.4928045, 0, 0, 0.2439165, 0.9697962, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_NA_OBJECT_BUFF_1, BG_NA_OBJECT_TYPE_BUFF_1, 4009.189941, 2895.250000, 13.052700, -1.448624, 0, 0, 0.6626201, -0.7489557, 120)
|
||||
|| !AddObject(BG_NA_OBJECT_BUFF_2, BG_NA_OBJECT_TYPE_BUFF_2, 4103.330078, 2946.350098, 13.051300, -0.06981307, 0, 0, 0.03489945, -0.9993908, 120))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundNA: Failed to spawn some object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
20:12:14 id:036668 [S2C] SMSG_INIT_WORLD_STATES (706 = 0x02C2) len: 86
|
||||
0000: 2f 02 00 00 72 0e 00 00 00 00 00 00 09 00 11 0a | /...r...........
|
||||
0010: 00 00 01 00 00 00 0f 0a 00 00 00 00 00 00 10 0a | ................
|
||||
0020: 00 00 00 00 00 00 d4 08 00 00 00 00 00 00 d8 08 | ................
|
||||
0030: 00 00 00 00 00 00 d7 08 00 00 00 00 00 00 d6 08 | ................
|
||||
0040: 00 00 00 00 00 00 d5 08 00 00 00 00 00 00 d3 08 | ................
|
||||
0050: 00 00 00 00 00 00 | ......
|
||||
*/
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDNA_H
|
||||
#define __BATTLEGROUNDNA_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
enum BattleGroundNAObjectTypes
|
||||
{
|
||||
BG_NA_OBJECT_DOOR_1 = 0,
|
||||
BG_NA_OBJECT_DOOR_2 = 1,
|
||||
BG_NA_OBJECT_DOOR_3 = 2,
|
||||
BG_NA_OBJECT_DOOR_4 = 3,
|
||||
BG_NA_OBJECT_BUFF_1 = 4,
|
||||
BG_NA_OBJECT_BUFF_2 = 5,
|
||||
BG_NA_OBJECT_MAX = 6
|
||||
};
|
||||
|
||||
enum BattleGroundNAObjects
|
||||
{
|
||||
BG_NA_OBJECT_TYPE_DOOR_1 = 183978,
|
||||
BG_NA_OBJECT_TYPE_DOOR_2 = 183980,
|
||||
BG_NA_OBJECT_TYPE_DOOR_3 = 183977,
|
||||
BG_NA_OBJECT_TYPE_DOOR_4 = 183979,
|
||||
BG_NA_OBJECT_TYPE_BUFF_1 = 184663,
|
||||
BG_NA_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattleGroundNAScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundNAScore() {};
|
||||
virtual ~BattleGroundNAScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattleGroundNA : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundNA();
|
||||
~BattleGroundNA();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Player.h"
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundRB.h"
|
||||
#include "Language.h"
|
||||
|
||||
BattleGroundRB::BattleGroundRB()
|
||||
{
|
||||
//TODO FIX ME!
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundRB::~BattleGroundRB()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundRB::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
}
|
||||
|
||||
void BattleGroundRB::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundRB::StartingEventOpenDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundRB::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundRBScore* sc = new BattleGroundRBScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundRB::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundRB::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
}
|
||||
|
||||
void BattleGroundRB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
std::map<uint64, BattleGroundScore*>::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDRB_H
|
||||
#define __BATTLEGROUNDRB_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
class BattleGroundRBScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundRBScore() {};
|
||||
virtual ~BattleGroundRBScore() {};
|
||||
};
|
||||
|
||||
class BattleGroundRB : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundRB();
|
||||
~BattleGroundRB();
|
||||
void Update(uint32 diff);
|
||||
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr,uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
private:
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundRL.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
BattleGroundRL::BattleGroundRL()
|
||||
{
|
||||
m_BgObjects.resize(BG_RL_OBJECT_MAX);
|
||||
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundRL::~BattleGroundRL()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundRL::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
/*if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
// update something
|
||||
}*/
|
||||
}
|
||||
|
||||
void BattleGroundRL::StartingEventCloseDoors()
|
||||
{
|
||||
for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
void BattleGroundRL::StartingEventOpenDoors()
|
||||
{
|
||||
for (uint32 i = BG_RL_OBJECT_DOOR_1; i <= BG_RL_OBJECT_DOOR_2; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
for (uint32 i = BG_RL_OBJECT_BUFF_1; i <= BG_RL_OBJECT_BUFF_2; ++i)
|
||||
SpawnBGObject(i, 60);
|
||||
}
|
||||
|
||||
void BattleGroundRL::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundRLScore* sc = new BattleGroundRLScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::HandleKillPlayer(player,killer);
|
||||
|
||||
UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(),1285.810547,1667.896851,39.957642,player->GetOrientation(),false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
{
|
||||
case 4696: // buff trigger?
|
||||
case 4697: // buff trigger?
|
||||
break;
|
||||
default:
|
||||
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
void BattleGroundRL::FillInitialWorldStates(WorldPacket &data)
|
||||
{
|
||||
data << uint32(0xbba) << uint32(1); // 9
|
||||
UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattleGroundRL::Reset()
|
||||
{
|
||||
//call parent's reset
|
||||
BattleGround::Reset();
|
||||
}
|
||||
|
||||
bool BattleGroundRL::SetupBattleGround()
|
||||
{
|
||||
// gates
|
||||
if (!AddObject(BG_RL_OBJECT_DOOR_1, BG_RL_OBJECT_TYPE_DOOR_1, 1293.561, 1601.938, 31.60557, -1.457349, 0, 0, -0.6658813, 0.7460576, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RL_OBJECT_DOOR_2, BG_RL_OBJECT_TYPE_DOOR_2, 1278.648, 1730.557, 31.60557, 1.684245, 0, 0, 0.7460582, 0.6658807, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_1, BG_RL_OBJECT_TYPE_BUFF_1, 1328.719971, 1632.719971, 36.730400, -1.448624, 0, 0, 0.6626201, -0.7489557, 120)
|
||||
|| !AddObject(BG_RL_OBJECT_BUFF_2, BG_RL_OBJECT_TYPE_BUFF_2, 1243.300049, 1699.170044, 34.872601, -0.06981307, 0, 0, 0.03489945, -0.9993908, 120))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundRL: Failed to spawn some object!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
Packet S->C, id 600, SMSG_INIT_WORLD_STATES (706), len 86
|
||||
0000: 3C 02 00 00 80 0F 00 00 00 00 00 00 09 00 BA 0B | <...............
|
||||
0010: 00 00 01 00 00 00 B9 0B 00 00 02 00 00 00 B8 0B | ................
|
||||
0020: 00 00 00 00 00 00 D8 08 00 00 00 00 00 00 D7 08 | ................
|
||||
0030: 00 00 00 00 00 00 D6 08 00 00 00 00 00 00 D5 08 | ................
|
||||
0040: 00 00 00 00 00 00 D3 08 00 00 00 00 00 00 D4 08 | ................
|
||||
0050: 00 00 00 00 00 00 | ......
|
||||
*/
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDRL_H
|
||||
#define __BATTLEGROUNDRL_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
enum BattleGroundRLObjectTypes
|
||||
{
|
||||
BG_RL_OBJECT_DOOR_1 = 0,
|
||||
BG_RL_OBJECT_DOOR_2 = 1,
|
||||
BG_RL_OBJECT_BUFF_1 = 2,
|
||||
BG_RL_OBJECT_BUFF_2 = 3,
|
||||
BG_RL_OBJECT_MAX = 4
|
||||
};
|
||||
|
||||
enum BattleGroundRLObjects
|
||||
{
|
||||
BG_RL_OBJECT_TYPE_DOOR_1 = 185918,
|
||||
BG_RL_OBJECT_TYPE_DOOR_2 = 185917,
|
||||
BG_RL_OBJECT_TYPE_BUFF_1 = 184663,
|
||||
BG_RL_OBJECT_TYPE_BUFF_2 = 184664
|
||||
};
|
||||
|
||||
class BattleGroundRLScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundRLScore() {};
|
||||
virtual ~BattleGroundRLScore() {};
|
||||
//TODO fix me
|
||||
};
|
||||
|
||||
class BattleGroundRL : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundRL();
|
||||
~BattleGroundRL();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,234 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundRV.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
BattleGroundRV::BattleGroundRV()
|
||||
{
|
||||
m_BgObjects.resize(BG_RV_OBJECT_MAX);
|
||||
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FIRST] = BG_START_DELAY_1M;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_SECOND] = BG_START_DELAY_30S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_15S;
|
||||
m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE;
|
||||
//we must set messageIds
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_ARENA_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_ARENA_THIRTY_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_ARENA_FIFTEEN_SECONDS;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_ARENA_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundRV::~BattleGroundRV()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BattleGroundRV::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if (getTimer() < diff)
|
||||
{
|
||||
uint32 i;
|
||||
switch(getState())
|
||||
{
|
||||
case BG_RV_STATE_OPEN_FENCES:
|
||||
{
|
||||
setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
|
||||
setState(BG_RV_STATE_CLOSE_FIRE);
|
||||
break;
|
||||
}
|
||||
case BG_RV_STATE_CLOSE_FIRE:
|
||||
for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
|
||||
DoorClose(i);
|
||||
setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
|
||||
setState(BG_RV_STATE_OPEN_PILARS);
|
||||
break;
|
||||
case BG_RV_STATE_OPEN_PILARS:
|
||||
for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
|
||||
DoorOpen(i);
|
||||
setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
|
||||
setState(BG_RV_STATE_OPEN_FIRE);
|
||||
break;
|
||||
case BG_RV_STATE_OPEN_FIRE:
|
||||
for (i = BG_RV_OBJECT_FIRE_1; i <= BG_RV_OBJECT_FIREDOOR_2; ++i)
|
||||
DoorOpen(i);
|
||||
setTimer(BG_RV_FIRE_TO_PILAR_TIMER);
|
||||
setState(BG_RV_STATE_CLOSE_PILARS);
|
||||
break;
|
||||
case BG_RV_STATE_CLOSE_PILARS:
|
||||
uint32 i;
|
||||
for (i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i)
|
||||
DoorOpen(i);
|
||||
setTimer(BG_RV_PILAR_TO_FIRE_TIMER);
|
||||
setState(BG_RV_STATE_CLOSE_FIRE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
setTimer(getTimer() - diff);
|
||||
}
|
||||
|
||||
void BattleGroundRV::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundRV::StartingEventOpenDoors()
|
||||
{
|
||||
// Buff respawn
|
||||
SpawnBGObject(BG_RV_OBJECT_BUFF_1, 90);
|
||||
SpawnBGObject(BG_RV_OBJECT_BUFF_2, 90);
|
||||
// Open fences
|
||||
DoorOpen(BG_RV_OBJECT_FENCE_1);
|
||||
DoorOpen(BG_RV_OBJECT_FENCE_2);
|
||||
// Elevators
|
||||
DoorOpen(BG_RV_OBJECT_ELEVATOR_1);
|
||||
DoorOpen(BG_RV_OBJECT_ELEVATOR_2);
|
||||
|
||||
setState(BG_RV_STATE_OPEN_FENCES);
|
||||
setTimer(BG_RV_FIRST_TIMER);
|
||||
}
|
||||
|
||||
void BattleGroundRV::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundRVScore* sc = new BattleGroundRVScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
|
||||
}
|
||||
|
||||
void BattleGroundRV::RemovePlayer(Player * /*plr*/, uint64 /*guid*/)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
void BattleGroundRV::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
if (!killer)
|
||||
{
|
||||
sLog.outError("BattleGroundRV: Killer player not found");
|
||||
return;
|
||||
}
|
||||
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_A, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
UpdateWorldState(BG_RV_WORLD_STATE_H, GetAlivePlayersCountByTeam(HORDE));
|
||||
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
bool BattleGroundRV::HandlePlayerUnderMap(Player *player)
|
||||
{
|
||||
player->TeleportTo(GetMapId(), 763.5, -284, 28.276, 2.422, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void BattleGroundRV::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
switch(Trigger)
|
||||
{
|
||||
case 5224:
|
||||
case 5226:
|
||||
break;
|
||||
default:
|
||||
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundRV::FillInitialWorldStates(WorldPacket &data)
|
||||
{
|
||||
data << uint32(BG_RV_WORLD_STATE_A) << uint32(GetAlivePlayersCountByTeam(ALLIANCE));
|
||||
data << uint32(BG_RV_WORLD_STATE_H) << uint32(GetAlivePlayersCountByTeam(HORDE));
|
||||
data << uint32(BG_RV_WORLD_STATE) << uint32(1);
|
||||
}
|
||||
|
||||
void BattleGroundRV::Reset()
|
||||
{
|
||||
//call parent's class reset
|
||||
BattleGround::Reset();
|
||||
}
|
||||
|
||||
bool BattleGroundRV::SetupBattleGround()
|
||||
{
|
||||
// Fence
|
||||
if (!AddObject(BG_RV_OBJECT_FENCE_1, BG_RV_OBJECT_TYPE_FENCE_1, 763.432373, -274.058197, 28.276695, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FENCE_2, BG_RV_OBJECT_TYPE_FENCE_2, 763.432373, -294.419464, 28.276684, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// elevators
|
||||
|| !AddObject(BG_RV_OBJECT_ELEVATOR_1, BG_RV_OBJECT_TYPE_ELEVATOR_1, 763.536377, -294.535767, 0.505383, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_ELEVATOR_2, BG_RV_OBJECT_TYPE_ELEVATOR_2, 763.506348, -273.873352, 0.505383, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// buffs
|
||||
|| !AddObject(BG_RV_OBJECT_BUFF_1, BG_RV_OBJECT_TYPE_BUFF_1, 735.551819, -284.794678, 28.276682, 0.034906, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_BUFF_2, BG_RV_OBJECT_TYPE_BUFF_2, 791.224487, -284.794464, 28.276682, 2.600535, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// fire
|
||||
|| !AddObject(BG_RV_OBJECT_FIRE_1, BG_RV_OBJECT_TYPE_FIRE_1, 743.543457, -283.799469, 28.286655, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIRE_2, BG_RV_OBJECT_TYPE_FIRE_2, 782.971802, -283.799469, 28.286655, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIREDOOR_1, BG_RV_OBJECT_TYPE_FIREDOOR_1, 743.711060, -284.099609, 27.542587, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_FIREDOOR_2, BG_RV_OBJECT_TYPE_FIREDOOR_2, 783.221252, -284.133362, 27.535686, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Gear
|
||||
|| !AddObject(BG_RV_OBJECT_GEAR_1, BG_RV_OBJECT_TYPE_GEAR_1, 763.664551, -261.872986, 26.686588, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_GEAR_2, BG_RV_OBJECT_TYPE_GEAR_2, 763.578979, -306.146149, 26.665222, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Pulley
|
||||
|| !AddObject(BG_RV_OBJECT_PULLEY_1, BG_RV_OBJECT_TYPE_PULLEY_1, 700.722290, -283.990662, 39.517582, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PULLEY_2, BG_RV_OBJECT_TYPE_PULLEY_2, 826.303833, -283.996429, 39.517582, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
// Pilars
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_1, BG_RV_OBJECT_TYPE_PILAR_1, 763.632385, -306.162384, 25.909504, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_2, BG_RV_OBJECT_TYPE_PILAR_2, 723.644287, -284.493256, 24.648525, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_3, BG_RV_OBJECT_TYPE_PILAR_3, 763.611145, -261.856750, 25.909504, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_4, BG_RV_OBJECT_TYPE_PILAR_4, 802.211609, -284.493256, 24.648525, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
/*
|
||||
// Pilars Collision - Fixme: Use the collision pilars - should make u break LoS
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_COLLISION_1, BG_RV_OBJECT_TYPE_PILAR_COLLISION_1, 763.632385, -306.162384, 30.639660, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_COLLISION_2, BG_RV_OBJECT_TYPE_PILAR_COLLISION_2, 723.644287, -284.493256, 32.382710, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_COLLISION_3, BG_RV_OBJECT_TYPE_PILAR_COLLISION_3, 763.611145, -261.856750, 30.639660, 0.000000, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_RV_OBJECT_PILAR_COLLISION_4, BG_RV_OBJECT_TYPE_PILAR_COLLISION_4, 802.211609, -284.493256, 32.382710, 3.141593, 0, 0, 0, RESPAWN_IMMEDIATELY)
|
||||
*/
|
||||
)
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundRV: Failed to spawn some object!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef __BATTLEGROUNDRV_H
|
||||
#define __BATTLEGROUNDRV_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
enum BattleGroundRVObjectTypes
|
||||
{
|
||||
BG_RV_OBJECT_BUFF_1,
|
||||
BG_RV_OBJECT_BUFF_2,
|
||||
BG_RV_OBJECT_FIRE_1,
|
||||
BG_RV_OBJECT_FIRE_2,
|
||||
BG_RV_OBJECT_FIREDOOR_1,
|
||||
BG_RV_OBJECT_FIREDOOR_2,
|
||||
|
||||
BG_RV_OBJECT_PILAR_1,
|
||||
BG_RV_OBJECT_PILAR_3,
|
||||
BG_RV_OBJECT_GEAR_1,
|
||||
BG_RV_OBJECT_GEAR_2,
|
||||
|
||||
BG_RV_OBJECT_PILAR_2,
|
||||
BG_RV_OBJECT_PILAR_4,
|
||||
BG_RV_OBJECT_PULLEY_1,
|
||||
BG_RV_OBJECT_PULLEY_2,
|
||||
/*
|
||||
BG_RV_OBJECT_PILAR_COLLISION_1,
|
||||
BG_RV_OBJECT_PILAR_COLLISION_2,
|
||||
BG_RV_OBJECT_PILAR_COLLISION_3,
|
||||
BG_RV_OBJECT_PILAR_COLLISION_4,
|
||||
*/
|
||||
BG_RV_OBJECT_ELEVATOR_1,
|
||||
BG_RV_OBJECT_ELEVATOR_2,
|
||||
BG_RV_OBJECT_FENCE_1,
|
||||
BG_RV_OBJECT_FENCE_2,
|
||||
BG_RV_OBJECT_MAX,
|
||||
};
|
||||
|
||||
enum BattleGroundRVObjects
|
||||
{
|
||||
BG_RV_OBJECT_TYPE_BUFF_1 = 184663,
|
||||
BG_RV_OBJECT_TYPE_BUFF_2 = 184664,
|
||||
BG_RV_OBJECT_TYPE_FIRE_1 = 192704,
|
||||
BG_RV_OBJECT_TYPE_FIRE_2 = 192705,
|
||||
|
||||
BG_RV_OBJECT_TYPE_FIREDOOR_2 = 192387,
|
||||
BG_RV_OBJECT_TYPE_FIREDOOR_1 = 192388,
|
||||
BG_RV_OBJECT_TYPE_PULLEY_1 = 192389,
|
||||
BG_RV_OBJECT_TYPE_PULLEY_2 = 192390,
|
||||
BG_RV_OBJECT_TYPE_FENCE_1 = 192391,
|
||||
BG_RV_OBJECT_TYPE_FENCE_2 = 192392,
|
||||
BG_RV_OBJECT_TYPE_GEAR_1 = 192393,
|
||||
BG_RV_OBJECT_TYPE_GEAR_2 = 192394,
|
||||
BG_RV_OBJECT_TYPE_ELEVATOR_1 = 194582,
|
||||
BG_RV_OBJECT_TYPE_ELEVATOR_2 = 194586,
|
||||
/*
|
||||
BG_RV_OBJECT_TYPE_PILAR_COLLISION_1 = 194580, // axe
|
||||
BG_RV_OBJECT_TYPE_PILAR_COLLISION_2 = 194579, // arena
|
||||
BG_RV_OBJECT_TYPE_PILAR_COLLISION_3 = 194581, // lightning
|
||||
BG_RV_OBJECT_TYPE_PILAR_COLLISION_4 = 194578, // ivory
|
||||
*/
|
||||
BG_RV_OBJECT_TYPE_PILAR_1 = 194583, // axe
|
||||
BG_RV_OBJECT_TYPE_PILAR_2 = 194584, // arena
|
||||
BG_RV_OBJECT_TYPE_PILAR_3 = 194585, // lightning
|
||||
BG_RV_OBJECT_TYPE_PILAR_4 = 194587, // ivory
|
||||
};
|
||||
|
||||
enum BattleGroundRVData
|
||||
{
|
||||
BG_RV_STATE_OPEN_FENCES,
|
||||
BG_RV_STATE_OPEN_PILARS,
|
||||
BG_RV_STATE_CLOSE_PILARS,
|
||||
BG_RV_STATE_OPEN_FIRE,
|
||||
BG_RV_STATE_CLOSE_FIRE,
|
||||
BG_RV_FIRE_TO_PILAR_TIMER = 20000,
|
||||
BG_RV_PILAR_TO_FIRE_TIMER = 5000,
|
||||
BG_RV_FIRST_TIMER = 20133,
|
||||
BG_RV_WORLD_STATE_A = 0xe10,
|
||||
BG_RV_WORLD_STATE_H = 0xe11,
|
||||
BG_RV_WORLD_STATE = 0xe1a,
|
||||
};
|
||||
|
||||
class BattleGroundRVScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundRVScore() {};
|
||||
virtual ~BattleGroundRVScore() {};
|
||||
};
|
||||
|
||||
class BattleGroundRV : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundRV();
|
||||
~BattleGroundRV();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket &d);
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
bool SetupBattleGround();
|
||||
void HandleKillPlayer(Player* player, Player *killer);
|
||||
bool HandlePlayerUnderMap(Player * plr);
|
||||
|
||||
private:
|
||||
uint32 Timer;
|
||||
uint32 State;
|
||||
|
||||
protected:
|
||||
uint32 getTimer() { return Timer; };
|
||||
void setTimer(uint32 timer) { Timer = timer; };
|
||||
|
||||
uint32 getState() { return State; };
|
||||
void setState(uint32 state) { State = state; };
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,846 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundSA.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "GameObject.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
|
||||
BattleGroundSA::BattleGroundSA()
|
||||
{
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_SA_START_TWO_MINUTES;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_SA_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_SA_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_SA_HAS_BEGUN;
|
||||
m_BgObjects.resize(BG_SA_MAXOBJ);
|
||||
m_BgCreatures.resize(BG_SA_MAXNPC + BG_SA_MAX_GY);
|
||||
TimerEnabled = false;
|
||||
UpdateWaitTimer = 0;
|
||||
SignaledRoundTwo = false;
|
||||
SignaledRoundTwoHalfMin = false;
|
||||
InitSecondRound = false;
|
||||
}
|
||||
|
||||
BattleGroundSA::~BattleGroundSA()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundSA::Reset()
|
||||
{
|
||||
TotalTime = 0;
|
||||
attackers = ((urand(0,1)) ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
for (uint8 i = 0; i <= 5; i++)
|
||||
GateStatus[i] = BG_SA_GATE_OK;
|
||||
ShipsStarted = false;
|
||||
status = BG_SA_WARMUP;
|
||||
}
|
||||
|
||||
bool BattleGroundSA::SetupBattleGround()
|
||||
{
|
||||
return ResetObjs();
|
||||
}
|
||||
|
||||
bool BattleGroundSA::ResetObjs()
|
||||
{
|
||||
uint32 atF = BG_SA_Factions[attackers];
|
||||
uint32 defF = BG_SA_Factions[attackers ? TEAM_ALLIANCE : TEAM_HORDE];
|
||||
|
||||
|
||||
for (uint8 i = 0; i <BG_SA_MAXOBJ; i++)
|
||||
DelObject(i);
|
||||
|
||||
for (uint8 i = 0; i < BG_SA_MAXNPC; i++)
|
||||
DelCreature(i);
|
||||
|
||||
for (uint8 i = BG_SA_MAXNPC; i < BG_SA_MAXNPC + BG_SA_MAX_GY; i++)
|
||||
DelCreature(i);
|
||||
|
||||
for (uint8 i = 0; i < 6; i++)
|
||||
GateStatus[i] = BG_SA_GATE_OK;
|
||||
|
||||
for (uint8 i = 0; i < BG_SA_CENTRAL_FLAG; i++)
|
||||
{
|
||||
if (!AddObject(i,BG_SA_ObjEntries[i],
|
||||
BG_SA_ObjSpawnlocs[i][0],BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2],BG_SA_ObjSpawnlocs[i][3],
|
||||
0,0,0,0,RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
}
|
||||
|
||||
//Cannons and demolishers - NPCs are spawned
|
||||
//By capturing GYs.
|
||||
for (uint8 i = 0; i < BG_SA_NPC_SPARKLIGHT; i++)
|
||||
{
|
||||
if (!AddCreature(BG_SA_NpcEntries[i], i, (attackers == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE),
|
||||
BG_SA_NpcSpawnlocs[i][0],BG_SA_NpcSpawnlocs[i][1],
|
||||
BG_SA_NpcSpawnlocs[i][2],BG_SA_NpcSpawnlocs[i][3],600))
|
||||
return false;
|
||||
}
|
||||
|
||||
OverrideGunFaction();
|
||||
DemolisherStartState(true);
|
||||
|
||||
for (uint8 i = 0; i <= BG_SA_TITAN_RELIC; i++)
|
||||
{
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF);
|
||||
}
|
||||
|
||||
GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
|
||||
GetBGObject(BG_SA_TITAN_RELIC)->Refresh();
|
||||
|
||||
for (uint8 i = 0; i <= 5; i++)
|
||||
GateStatus[i] = BG_SA_GATE_OK;
|
||||
|
||||
// MAD props for Kiper for discovering those values - 4 hours of his work.
|
||||
GetBGObject(BG_SA_BOAT_ONE)->UpdateRotationFields(1.0f, 0.0002f);
|
||||
GetBGObject(BG_SA_BOAT_TWO)->UpdateRotationFields(1.0f, 0.00001f);
|
||||
SpawnBGObject(BG_SA_BOAT_ONE, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_SA_BOAT_TWO, RESPAWN_IMMEDIATELY);
|
||||
|
||||
TotalTime = 0;
|
||||
ShipsStarted = false;
|
||||
|
||||
//Graveyards!
|
||||
for (uint8 i = 0;i < BG_SA_MAX_GY; i++)
|
||||
{
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
|
||||
|
||||
if (!sg)
|
||||
{
|
||||
sLog.outError("SOTA: Can't find GY entry %u",BG_SA_GYEntries[i]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (i == BG_SA_BEACH_GY)
|
||||
{
|
||||
GraveyardStatus[i] = attackers;
|
||||
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE)? HORDE : ALLIANCE));
|
||||
}
|
||||
else
|
||||
{
|
||||
GraveyardStatus[i] = ((attackers == TEAM_HORDE)? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
if (!AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], ((attackers == TEAM_HORDE)? ALLIANCE : HORDE)))
|
||||
sLog.outError("SOTA: couldn't spawn GY: %u",i);
|
||||
}
|
||||
}
|
||||
|
||||
//GY capture points
|
||||
for (uint8 i = BG_SA_CENTRAL_FLAG; i < BG_SA_PORTAL_DEFFENDER_BLUE; i++)
|
||||
{
|
||||
AddObject(i, (BG_SA_ObjEntries[i] - (attackers == TEAM_ALLIANCE ? 1:0)),
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0,0,0,0,RESPAWN_ONE_DAY);
|
||||
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_PORTAL_DEFFENDER_BLUE; i < BG_SA_BOMB; i++)
|
||||
{
|
||||
AddObject(i, BG_SA_ObjEntries[i],
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0,0,0,0,RESPAWN_ONE_DAY);
|
||||
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, defF);
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_BOMB; i < BG_SA_MAXOBJ; i++)
|
||||
{
|
||||
AddObject(i, BG_SA_ObjEntries[BG_SA_BOMB],
|
||||
BG_SA_ObjSpawnlocs[i][0], BG_SA_ObjSpawnlocs[i][1],
|
||||
BG_SA_ObjSpawnlocs[i][2], BG_SA_ObjSpawnlocs[i][3],
|
||||
0,0,0,0,RESPAWN_ONE_DAY);
|
||||
GetBGObject(i)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
|
||||
}
|
||||
|
||||
//Player may enter BEFORE we set up bG - lets update his worldstates anyway...
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_HORDE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
UpdateWorldState(BG_SA_LEFT_GY_HORDE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
UpdateWorldState(BG_SA_CENTER_GY_HORDE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE , GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE , GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE , GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
|
||||
if (attackers == TEAM_ALLIANCE)
|
||||
{
|
||||
UpdateWorldState(BG_SA_ALLY_ATTACKS, 1);
|
||||
UpdateWorldState(BG_SA_HORDE_ATTACKS, 0);
|
||||
|
||||
UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_ALL, 1);
|
||||
UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_ALL, 1);
|
||||
UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_HRD, 0);
|
||||
UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_HRD, 0);
|
||||
|
||||
UpdateWorldState(BG_SA_HORDE_DEFENCE_TOKEN,1);
|
||||
UpdateWorldState(BG_SA_ALLIANCE_DEFENCE_TOKEN,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateWorldState(BG_SA_HORDE_ATTACKS, 1);
|
||||
UpdateWorldState(BG_SA_ALLY_ATTACKS, 0);
|
||||
|
||||
UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_ALL, 0);
|
||||
UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_ALL, 0);
|
||||
UpdateWorldState(BG_SA_RIGHT_ATT_TOKEN_HRD, 1);
|
||||
UpdateWorldState(BG_SA_LEFT_ATT_TOKEN_HRD, 1);
|
||||
|
||||
UpdateWorldState(BG_SA_HORDE_DEFENCE_TOKEN,0);
|
||||
UpdateWorldState(BG_SA_ALLIANCE_DEFENCE_TOKEN,1);
|
||||
}
|
||||
|
||||
UpdateWorldState(BG_SA_PURPLE_GATEWS, 1);
|
||||
UpdateWorldState(BG_SA_RED_GATEWS, 1);
|
||||
UpdateWorldState(BG_SA_BLUE_GATEWS, 1);
|
||||
UpdateWorldState(BG_SA_GREEN_GATEWS, 1);
|
||||
UpdateWorldState(BG_SA_YELLOW_GATEWS, 1);
|
||||
UpdateWorldState(BG_SA_ANCIENT_GATEWS, 1);
|
||||
|
||||
TeleportPlayers();
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundSA::StartShips()
|
||||
{
|
||||
if (ShipsStarted)
|
||||
return;
|
||||
|
||||
DoorOpen(BG_SA_BOAT_ONE);
|
||||
DoorOpen(BG_SA_BOAT_TWO);
|
||||
|
||||
for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++)
|
||||
{
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end();itr++)
|
||||
{
|
||||
if (Player* p = objmgr.GetPlayer(itr->first))
|
||||
{
|
||||
if (p->GetTeamId() != attackers)
|
||||
continue;
|
||||
|
||||
UpdateData data;
|
||||
WorldPacket pkt;
|
||||
GetBGObject(i)->BuildValuesUpdateBlockForPlayer(&data, p);
|
||||
data.BuildPacket(&pkt);
|
||||
p->GetSession()->SendPacket(&pkt);
|
||||
}
|
||||
}
|
||||
}
|
||||
ShipsStarted = true;
|
||||
}
|
||||
|
||||
void BattleGroundSA::Update(uint32 diff)
|
||||
{
|
||||
if (InitSecondRound)
|
||||
{
|
||||
if (UpdateWaitTimer < diff)
|
||||
{
|
||||
if (!SignaledRoundTwo)
|
||||
{
|
||||
SignaledRoundTwo = true;
|
||||
InitSecondRound = false;
|
||||
SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
}else
|
||||
{
|
||||
UpdateWaitTimer -= diff;
|
||||
return;
|
||||
}
|
||||
}
|
||||
BattleGround::Update(diff);
|
||||
TotalTime += diff;
|
||||
|
||||
if (status == BG_SA_WARMUP )
|
||||
{
|
||||
BG_SA_ENDROUNDTIME = BG_SA_ROUNDLENGTH;
|
||||
if (TotalTime >= BG_SA_WARMUPLENGTH)
|
||||
{
|
||||
TotalTime = 0;
|
||||
ToggleTimer();
|
||||
DemolisherStartState(false);
|
||||
status = BG_SA_ROUND_ONE;
|
||||
}
|
||||
if (TotalTime >= BG_SA_BOAT_START)
|
||||
StartShips();
|
||||
return;
|
||||
}
|
||||
else if (status == BG_SA_SECOND_WARMUP)
|
||||
{
|
||||
if (RoundScores[0].time<BG_SA_ROUNDLENGTH)
|
||||
BG_SA_ENDROUNDTIME = RoundScores[0].time;
|
||||
else
|
||||
BG_SA_ENDROUNDTIME = BG_SA_ROUNDLENGTH;
|
||||
|
||||
if (TotalTime >= 60000)
|
||||
{
|
||||
SendWarningToAll(LANG_BG_SA_HAS_BEGUN);
|
||||
TotalTime = 0;
|
||||
ToggleTimer();
|
||||
DemolisherStartState(false);
|
||||
status = BG_SA_ROUND_TWO;
|
||||
}
|
||||
if (TotalTime >= 30000)
|
||||
{
|
||||
if (!SignaledRoundTwoHalfMin)
|
||||
{
|
||||
SignaledRoundTwoHalfMin = true;
|
||||
SendMessageToAll(LANG_BG_SA_ROUND_TWO_START_HALF_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
}
|
||||
StartShips();
|
||||
return;
|
||||
}
|
||||
else if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if (status == BG_SA_ROUND_ONE)
|
||||
{
|
||||
if (TotalTime >= BG_SA_ROUNDLENGTH)
|
||||
{
|
||||
RoundScores[0].winner = attackers;
|
||||
RoundScores[0].time = BG_SA_ROUNDLENGTH;
|
||||
TotalTime = 0;
|
||||
status = BG_SA_SECOND_WARMUP;
|
||||
attackers = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
|
||||
UpdateWaitTimer = 5000;
|
||||
SignaledRoundTwo = false;
|
||||
SignaledRoundTwoHalfMin = false;
|
||||
InitSecondRound = true;
|
||||
ToggleTimer();
|
||||
ResetObjs();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (status == BG_SA_ROUND_TWO)
|
||||
{
|
||||
if (TotalTime >= BG_SA_ENDROUNDTIME)
|
||||
{
|
||||
RoundScores[1].time = BG_SA_ROUNDLENGTH;
|
||||
RoundScores[1].winner = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
|
||||
|
||||
if (RoundScores[0].time == RoundScores[1].time)
|
||||
EndBattleGround(NULL);
|
||||
else if (RoundScores[0].time < RoundScores[1].time)
|
||||
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
|
||||
else
|
||||
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (status == BG_SA_ROUND_ONE || status == BG_SA_ROUND_TWO)
|
||||
{
|
||||
SendTime();
|
||||
UpdateDemolisherSpawns();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundSA::StartingEventCloseDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundSA::StartingEventOpenDoors()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundSA::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
uint32 ally_attacks = uint32(attackers == TEAM_ALLIANCE ? 1 : 0);
|
||||
uint32 horde_attacks = uint32(attackers == TEAM_HORDE ? 1 : 0);
|
||||
|
||||
data << uint32(BG_SA_ANCIENT_GATEWS) << uint32(GateStatus[BG_SA_ANCIENT_GATE]);
|
||||
data << uint32(BG_SA_YELLOW_GATEWS) << uint32(GateStatus[BG_SA_YELLOW_GATE]);
|
||||
data << uint32(BG_SA_GREEN_GATEWS) << uint32(GateStatus[BG_SA_GREEN_GATE]);
|
||||
data << uint32(BG_SA_BLUE_GATEWS) << uint32(GateStatus[BG_SA_BLUE_GATE]);
|
||||
data << uint32(BG_SA_RED_GATEWS) << uint32(GateStatus[BG_SA_RED_GATE]);
|
||||
data << uint32(BG_SA_PURPLE_GATEWS) << uint32(GateStatus[BG_SA_PURPLE_GATE]);
|
||||
|
||||
data << uint32(BG_SA_BONUS_TIMER) << uint32(0);
|
||||
|
||||
data << uint32(BG_SA_HORDE_ATTACKS)<< horde_attacks;
|
||||
data << uint32(BG_SA_ALLY_ATTACKS) << ally_attacks;
|
||||
|
||||
//Time will be sent on first update...
|
||||
data << uint32(BG_SA_ENABLE_TIMER) << ((TimerEnabled) ? uint32(1) : uint32(0));
|
||||
data << uint32(BG_SA_TIMER_MINS) << uint32(0);
|
||||
data << uint32(BG_SA_TIMER_SEC_TENS) << uint32(0);
|
||||
data << uint32(BG_SA_TIMER_SEC_DECS) << uint32(0);
|
||||
|
||||
data << uint32(BG_SA_RIGHT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
data << uint32(BG_SA_LEFT_GY_HORDE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
data << uint32(BG_SA_CENTER_GY_HORDE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_HORDE?1:0);
|
||||
|
||||
data << uint32(BG_SA_RIGHT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_RIGHT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
data << uint32(BG_SA_LEFT_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_LEFT_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
data << uint32(BG_SA_CENTER_GY_ALLIANCE) << uint32(GraveyardStatus[BG_SA_CENTRAL_CAPTURABLE_GY] == TEAM_ALLIANCE?1:0);
|
||||
|
||||
data << uint32(BG_SA_HORDE_DEFENCE_TOKEN) << ally_attacks;
|
||||
data << uint32(BG_SA_ALLIANCE_DEFENCE_TOKEN) << horde_attacks;
|
||||
|
||||
data << uint32(BG_SA_LEFT_ATT_TOKEN_HRD) << horde_attacks;
|
||||
data << uint32(BG_SA_RIGHT_ATT_TOKEN_HRD) << horde_attacks;
|
||||
data << uint32(BG_SA_RIGHT_ATT_TOKEN_ALL) << ally_attacks;
|
||||
data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks;
|
||||
}
|
||||
|
||||
void BattleGroundSA::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundSAScore* sc = new BattleGroundSAScore;
|
||||
|
||||
if (!ShipsStarted)
|
||||
{
|
||||
if (plr->GetTeamId() == attackers)
|
||||
{
|
||||
plr->CastSpell(plr,12438,true);//Without this player falls before boat loads...
|
||||
|
||||
if (urand(0,1))
|
||||
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
|
||||
else
|
||||
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
|
||||
|
||||
}
|
||||
else
|
||||
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plr->GetTeamId() == attackers)
|
||||
plr->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
|
||||
else
|
||||
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
|
||||
}
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundSA::RemovePlayer(Player* /*plr*/,uint64 /*guid*/)
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundSA::HandleAreaTrigger(Player * /*Source*/, uint32 /*Trigger*/)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
}
|
||||
|
||||
void BattleGroundSA::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
if (itr == m_PlayerScores.end()) // player not found...
|
||||
return;
|
||||
|
||||
if (type == SCORE_DESTROYED_DEMOLISHER)
|
||||
((BattleGroundSAScore*)itr->second)->demolishers_destroyed += value;
|
||||
else if (type == SCORE_DESTROYED_WALL)
|
||||
((BattleGroundSAScore*)itr->second)->gates_destroyed += value;
|
||||
else
|
||||
BattleGround::UpdatePlayerScore(Source,type,value, doAddHonor);
|
||||
}
|
||||
|
||||
void BattleGroundSA::TeleportPlayers()
|
||||
{
|
||||
for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
{
|
||||
if (Player *plr = objmgr.GetPlayer(itr->first))
|
||||
{
|
||||
// should remove spirit of redemption
|
||||
if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
plr->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
if (!plr->isAlive())
|
||||
{
|
||||
plr->ResurrectPlayer(1.0f);
|
||||
plr->SpawnCorpseBones();
|
||||
}
|
||||
|
||||
plr->SetHealth(plr->GetMaxHealth());
|
||||
plr->SetPower(POWER_MANA, plr->GetMaxPower(POWER_MANA));
|
||||
plr->CombatStopWithPets(true);
|
||||
|
||||
if (plr->GetTeamId() == attackers)
|
||||
{
|
||||
plr->CastSpell(plr,12438,true); //Without this player falls before boat loads...
|
||||
|
||||
if (urand(0,1))
|
||||
plr->TeleportTo(607, 2682.936f, -830.368f, 50.0f, 2.895f, 0);
|
||||
else
|
||||
plr->TeleportTo(607, 2577.003f, 980.261f, 50.0f, 0.807f, 0);
|
||||
}
|
||||
else
|
||||
plr->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundSA::EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent)
|
||||
{
|
||||
if (!go || !go->GetGOInfo())
|
||||
return;
|
||||
|
||||
switch(hitType)
|
||||
{
|
||||
case BG_OBJECT_DMG_HIT_TYPE_JUST_DAMAGED://under attack
|
||||
SendWarningToAll(LANG_BG_SA_IS_UNDER_ATTACK, go->GetGOInfo()->name);
|
||||
break;
|
||||
case BG_OBJECT_DMG_HIT_TYPE_DAMAGED:
|
||||
break;
|
||||
case BG_OBJECT_DMG_HIT_TYPE_JUST_HIGH_DAMAGED:
|
||||
{
|
||||
uint32 i = GetGateIDFromDestroyEventID(destroyedEvent);
|
||||
GateStatus[i] = BG_SA_GATE_DAMAGED;
|
||||
uint32 uws = GetWorldStateFromGateID(i);
|
||||
if (uws)
|
||||
UpdateWorldState(uws, GateStatus[i]);
|
||||
break;
|
||||
}
|
||||
case BG_OBJECT_DMG_HIT_TYPE_HIGH_DAMAGED:
|
||||
break;
|
||||
case BG_OBJECT_DMG_HIT_TYPE_JUST_DESTROYED://handled at DestroyGate()
|
||||
if (destroyedEvent == 19837)
|
||||
SendWarningToAll(LANG_BG_SA_CHAMBER_BREACHED);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundSA::HandleKillUnit(Creature* unit, Player* killer)
|
||||
{
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
if (unit->GetEntry() == 28781) //Demolisher
|
||||
UpdatePlayerScore(killer, SCORE_DESTROYED_DEMOLISHER, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
You may ask what the fuck does it do?
|
||||
Prevents owner overwriting guns faction with own.
|
||||
*/
|
||||
void BattleGroundSA::OverrideGunFaction()
|
||||
{
|
||||
if (!m_BgCreatures[0])
|
||||
return;
|
||||
|
||||
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
|
||||
{
|
||||
if (Creature* gun = GetBGCreature(i))
|
||||
gun->setFaction(BG_SA_Factions[attackers? TEAM_ALLIANCE : TEAM_HORDE]);
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4;i++)
|
||||
{
|
||||
if (Creature* dem = GetBGCreature(i))
|
||||
dem->setFaction(BG_SA_Factions[attackers]);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundSA::DemolisherStartState(bool start)
|
||||
{
|
||||
if (!m_BgCreatures[0])
|
||||
return;
|
||||
|
||||
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
|
||||
{
|
||||
if (Creature* dem = GetBGCreature(i))
|
||||
{
|
||||
if (start)
|
||||
dem->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
else
|
||||
dem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundSA::DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent)
|
||||
{
|
||||
uint32 i = GetGateIDFromDestroyEventID(destroyedEvent);
|
||||
if (!GateStatus[i])
|
||||
return;
|
||||
|
||||
if (GameObject* g = GetBGObject(i))
|
||||
{
|
||||
if (g->GetGOValue()->building.health == 0)
|
||||
{
|
||||
GateStatus[i] = BG_SA_GATE_DESTROYED;
|
||||
uint32 uws = GetWorldStateFromGateID(i);
|
||||
if (uws)
|
||||
UpdateWorldState(uws, GateStatus[i]);
|
||||
bool rewardHonor = true;
|
||||
switch(i)
|
||||
{
|
||||
case BG_SA_GREEN_GATE:
|
||||
if (GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case BG_SA_BLUE_GATE:
|
||||
if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case BG_SA_RED_GATE:
|
||||
if (GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
case BG_SA_PURPLE_GATE:
|
||||
if (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED)
|
||||
rewardHonor = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i < 5)
|
||||
DelObject(i+9);
|
||||
UpdatePlayerScore(pl,SCORE_DESTROYED_WALL, 1);
|
||||
if (rewardHonor)
|
||||
UpdatePlayerScore(pl,SCORE_BONUS_HONOR,(GetBonusHonorFromKill(1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattleGroundSA::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
uint32 safeloc = 0;
|
||||
WorldSafeLocsEntry const* ret;
|
||||
WorldSafeLocsEntry const* closest;
|
||||
float dist, nearest;
|
||||
float x,y,z;
|
||||
|
||||
player->GetPosition(x,y,z);
|
||||
|
||||
if (player->GetTeamId() == attackers)
|
||||
safeloc = BG_SA_GYEntries[BG_SA_BEACH_GY];
|
||||
else
|
||||
safeloc = BG_SA_GYEntries[BG_SA_DEFENDER_LAST_GY];
|
||||
|
||||
closest = sWorldSafeLocsStore.LookupEntry(safeloc);
|
||||
nearest = sqrt((closest->x - x)*(closest->x - x) + (closest->y - y)*(closest->y - y)+(closest->z - z)*(closest->z - z));
|
||||
|
||||
for (uint8 i = BG_SA_RIGHT_CAPTURABLE_GY; i < BG_SA_MAX_GY; i++)
|
||||
{
|
||||
if (GraveyardStatus[i] != player->GetTeamId())
|
||||
continue;
|
||||
|
||||
ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
|
||||
dist = sqrt((ret->x - x)*(ret->x - x) + (ret->y - y)*(ret->y - y)+(ret->z - z)*(ret->z - z));
|
||||
if (dist < nearest)
|
||||
{
|
||||
closest = ret;
|
||||
nearest = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return closest;
|
||||
}
|
||||
|
||||
void BattleGroundSA::SendTime()
|
||||
{
|
||||
uint32 end_of_round = (BG_SA_ENDROUNDTIME - TotalTime);
|
||||
UpdateWorldState(BG_SA_TIMER_MINS, end_of_round/60000);
|
||||
UpdateWorldState(BG_SA_TIMER_SEC_TENS, (end_of_round%60000)/10000);
|
||||
UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000);
|
||||
}
|
||||
|
||||
void BattleGroundSA::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
{
|
||||
switch(target_obj->GetEntry())
|
||||
{
|
||||
case 191307:
|
||||
case 191308:
|
||||
if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
|
||||
CaptureGraveyard(BG_SA_LEFT_CAPTURABLE_GY, Source);
|
||||
break;
|
||||
case 191305:
|
||||
case 191306:
|
||||
if (GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED)
|
||||
CaptureGraveyard(BG_SA_RIGHT_CAPTURABLE_GY, Source);
|
||||
break;
|
||||
case 191310:
|
||||
case 191309:
|
||||
if ((GateStatus[BG_SA_GREEN_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_BLUE_GATE] == BG_SA_GATE_DESTROYED) && (GateStatus[BG_SA_RED_GATE] == BG_SA_GATE_DESTROYED || GateStatus[BG_SA_PURPLE_GATE] == BG_SA_GATE_DESTROYED))
|
||||
CaptureGraveyard(BG_SA_CENTRAL_CAPTURABLE_GY, Source);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
void BattleGroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
||||
{
|
||||
if (GraveyardStatus[i] == attackers)
|
||||
return;
|
||||
|
||||
DelCreature(BG_SA_MAXNPC + i);
|
||||
GraveyardStatus[i] = Source->GetTeamId();
|
||||
WorldSafeLocsEntry const *sg = NULL;
|
||||
sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
|
||||
AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE));
|
||||
uint32 npc = 0;
|
||||
uint32 flag = 0;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case BG_SA_LEFT_CAPTURABLE_GY:
|
||||
flag = BG_SA_LEFT_FLAG;
|
||||
DelObject(flag);
|
||||
AddObject(flag,(BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0],BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2],BG_SA_ObjSpawnlocs[flag][3],0,0,0,0,RESPAWN_ONE_DAY);
|
||||
|
||||
npc = BG_SA_NPC_RIGSPARK;
|
||||
AddCreature(BG_SA_NpcEntries[npc], npc, attackers,
|
||||
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
|
||||
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
|
||||
|
||||
UpdateWorldState(BG_SA_LEFT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0));
|
||||
UpdateWorldState(BG_SA_LEFT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendWarningToAll(LANG_BG_SA_A_GY_WEST);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_H_GY_WEST);
|
||||
break;
|
||||
case BG_SA_RIGHT_CAPTURABLE_GY:
|
||||
flag = BG_SA_RIGHT_FLAG;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0],BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2],BG_SA_ObjSpawnlocs[flag][3],0,0,0,0,RESPAWN_ONE_DAY);
|
||||
|
||||
npc = BG_SA_NPC_SPARKLIGHT;
|
||||
AddCreature(BG_SA_NpcEntries[npc], npc, attackers,
|
||||
BG_SA_NpcSpawnlocs[npc][0], BG_SA_NpcSpawnlocs[npc][1],
|
||||
BG_SA_NpcSpawnlocs[npc][2], BG_SA_NpcSpawnlocs[npc][3]);
|
||||
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0));
|
||||
UpdateWorldState(BG_SA_RIGHT_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendWarningToAll(LANG_BG_SA_A_GY_EAST);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_H_GY_EAST);
|
||||
break;
|
||||
case BG_SA_CENTRAL_CAPTURABLE_GY:
|
||||
flag = BG_SA_CENTRAL_FLAG;
|
||||
DelObject(flag);
|
||||
AddObject(flag, (BG_SA_ObjEntries[flag] - (Source->GetTeamId() == TEAM_ALLIANCE ? 0:1)),
|
||||
BG_SA_ObjSpawnlocs[flag][0],BG_SA_ObjSpawnlocs[flag][1],
|
||||
BG_SA_ObjSpawnlocs[flag][2],BG_SA_ObjSpawnlocs[flag][3],0,0,0,0,RESPAWN_ONE_DAY);
|
||||
|
||||
UpdateWorldState(BG_SA_CENTER_GY_ALLIANCE, (GraveyardStatus[i] == TEAM_ALLIANCE? 1:0));
|
||||
UpdateWorldState(BG_SA_CENTER_GY_HORDE, (GraveyardStatus[i] == TEAM_ALLIANCE? 0:1));
|
||||
if (Source->GetTeamId() == TEAM_ALLIANCE)
|
||||
SendWarningToAll(LANG_BG_SA_A_GY_SOUTH);
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_H_GY_SOUTH);
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void BattleGroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
|
||||
{
|
||||
if (object->GetEntry() == BG_SA_ObjEntries[BG_SA_TITAN_RELIC] && GateStatus[BG_SA_ANCIENT_GATE] == BG_SA_GATE_DESTROYED)
|
||||
{
|
||||
if (Source->GetTeamId() == attackers)
|
||||
{
|
||||
if (Source->GetTeamId() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_SA_ALLIANCE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
else SendMessageToAll(LANG_BG_SA_HORDE_CAPTURED_RELIC, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
|
||||
if (status == BG_SA_ROUND_ONE)
|
||||
{
|
||||
RoundScores[0].winner = attackers;
|
||||
RoundScores[0].time = TotalTime;
|
||||
attackers = (attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
|
||||
status = BG_SA_SECOND_WARMUP;
|
||||
TotalTime = 0;
|
||||
ToggleTimer();
|
||||
SendWarningToAll(LANG_BG_SA_ROUND_ONE_END);
|
||||
UpdateWaitTimer = 5000;
|
||||
SignaledRoundTwo = false;
|
||||
SignaledRoundTwoHalfMin = false;
|
||||
InitSecondRound = true;
|
||||
ResetObjs();
|
||||
}
|
||||
else if (status == BG_SA_ROUND_TWO)
|
||||
{
|
||||
RoundScores[1].winner = attackers;
|
||||
RoundScores[1].time = TotalTime;ToggleTimer();
|
||||
if (RoundScores[0].time == RoundScores[1].time)
|
||||
EndBattleGround(NULL);
|
||||
else if (RoundScores[0].time < RoundScores[1].time)
|
||||
EndBattleGround(RoundScores[0].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
|
||||
else
|
||||
EndBattleGround(RoundScores[1].winner == TEAM_ALLIANCE ? ALLIANCE : HORDE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundSA::ToggleTimer()
|
||||
{
|
||||
TimerEnabled = !TimerEnabled;
|
||||
UpdateWorldState(BG_SA_ENABLE_TIMER, (TimerEnabled) ? 1 : 0);
|
||||
}
|
||||
|
||||
void BattleGroundSA::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//honor reward for winning
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), ALLIANCE);
|
||||
else if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), HORDE);
|
||||
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), HORDE);
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundSA::UpdateDemolisherSpawns()
|
||||
{
|
||||
for (uint8 i = BG_SA_DEMOLISHER_1; i <= BG_SA_DEMOLISHER_4; i++)
|
||||
{
|
||||
if (m_BgCreatures[i])
|
||||
{
|
||||
if (Creature *Demolisher = GetBGCreature(i))
|
||||
{
|
||||
if (Demolisher->isDead())
|
||||
{
|
||||
uint8 gy = (i >= BG_SA_DEMOLISHER_3 ? 3 : 2);
|
||||
if (GraveyardStatus[gy] == attackers)
|
||||
Demolisher->Relocate(BG_SA_NpcSpawnlocs[i + 11][0], BG_SA_NpcSpawnlocs[i + 11][1],
|
||||
BG_SA_NpcSpawnlocs[i + 11][2], BG_SA_NpcSpawnlocs[i + 11][3]);
|
||||
else
|
||||
Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
|
||||
BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]);
|
||||
|
||||
Demolisher->Respawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDSA_H
|
||||
#define __BATTLEGROUNDSA_H
|
||||
|
||||
class BattleGround;
|
||||
|
||||
class BattleGroundSAScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundSAScore(): demolishers_destroyed(0), gates_destroyed(0) {};
|
||||
virtual ~BattleGroundSAScore() {};
|
||||
uint8 demolishers_destroyed;
|
||||
uint8 gates_destroyed;
|
||||
};
|
||||
|
||||
#define BG_SA_FLAG_AMOUNT 3
|
||||
#define BG_SA_DEMOLISHER_AMOUNT 4
|
||||
|
||||
enum BG_SA_Status
|
||||
{
|
||||
BG_SA_NOTSTARTED = 0,
|
||||
BG_SA_WARMUP,
|
||||
BG_SA_ROUND_ONE,
|
||||
BG_SA_SECOND_WARMUP,
|
||||
BG_SA_ROUND_TWO,
|
||||
BG_SA_BONUS_ROUND
|
||||
};
|
||||
|
||||
enum BG_SA_GateState
|
||||
{
|
||||
BG_SA_GATE_OK = 1,
|
||||
BG_SA_GATE_DAMAGED = 2,
|
||||
BG_SA_GATE_DESTROYED = 3
|
||||
};
|
||||
|
||||
enum BG_SA_Timers
|
||||
{
|
||||
BG_SA_BOAT_START = 60000,
|
||||
BG_SA_WARMUPLENGTH = 120000,
|
||||
BG_SA_ROUNDLENGTH = 600000
|
||||
};
|
||||
|
||||
enum BG_SA_WorldStates
|
||||
{
|
||||
BG_SA_TIMER_MINS = 3559,
|
||||
BG_SA_TIMER_SEC_TENS = 3560,
|
||||
BG_SA_TIMER_SEC_DECS = 3561,
|
||||
BG_SA_ALLY_ATTACKS = 4352,
|
||||
BG_SA_HORDE_ATTACKS = 4353,
|
||||
|
||||
BG_SA_PURPLE_GATEWS = 3614,
|
||||
BG_SA_RED_GATEWS = 3617,
|
||||
BG_SA_BLUE_GATEWS = 3620,
|
||||
BG_SA_GREEN_GATEWS = 3623,
|
||||
BG_SA_YELLOW_GATEWS = 3638,
|
||||
BG_SA_ANCIENT_GATEWS = 3849,
|
||||
|
||||
|
||||
BG_SA_LEFT_GY_ALLIANCE = 3635,
|
||||
BG_SA_RIGHT_GY_ALLIANCE = 3636,
|
||||
BG_SA_CENTER_GY_ALLIANCE = 3637,
|
||||
|
||||
BG_SA_RIGHT_ATT_TOKEN_ALL = 3627,
|
||||
BG_SA_LEFT_ATT_TOKEN_ALL = 3626,
|
||||
|
||||
BG_SA_LEFT_ATT_TOKEN_HRD = 3629,
|
||||
BG_SA_RIGHT_ATT_TOKEN_HRD = 3628,
|
||||
|
||||
BG_SA_HORDE_DEFENCE_TOKEN = 3631,
|
||||
BG_SA_ALLIANCE_DEFENCE_TOKEN = 3630,
|
||||
|
||||
BG_SA_RIGHT_GY_HORDE = 3632,
|
||||
BG_SA_LEFT_GY_HORDE = 3633,
|
||||
BG_SA_CENTER_GY_HORDE = 3634,
|
||||
|
||||
BG_SA_BONUS_TIMER = 0xdf3,
|
||||
BG_SA_ENABLE_TIMER = 3564,
|
||||
};
|
||||
|
||||
enum BG_SA_NPCs
|
||||
{
|
||||
BG_SA_GUN_1 = 0,
|
||||
BG_SA_GUN_2,
|
||||
BG_SA_GUN_3,
|
||||
BG_SA_GUN_4,
|
||||
BG_SA_GUN_5,
|
||||
BG_SA_GUN_6,
|
||||
BG_SA_GUN_7,
|
||||
BG_SA_GUN_8,
|
||||
BG_SA_GUN_9,
|
||||
BG_SA_GUN_10,
|
||||
BG_SA_DEMOLISHER_1,
|
||||
BG_SA_DEMOLISHER_2,
|
||||
BG_SA_DEMOLISHER_3,
|
||||
BG_SA_DEMOLISHER_4,
|
||||
BG_SA_NPC_TRIGGER_1,
|
||||
BG_SA_NPC_TRIGGER_2,
|
||||
BG_SA_NPC_TRIGGER_3,
|
||||
BG_SA_NPC_TRIGGER_4,
|
||||
BG_SA_NPC_TRIGGER_5,
|
||||
BG_SA_NPC_SPARKLIGHT,
|
||||
BG_SA_NPC_RIGSPARK,
|
||||
BG_SA_MAXNPC
|
||||
};
|
||||
|
||||
const uint32 BG_SA_NpcEntries[BG_SA_MAXNPC] =
|
||||
{
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
27894,
|
||||
//4 beach demolishers
|
||||
28781,
|
||||
28781,
|
||||
28781,
|
||||
28781,
|
||||
//Triggers
|
||||
23472,
|
||||
23472,
|
||||
23472,
|
||||
23472,
|
||||
23472,
|
||||
//Fizzle Sparklight, or whatever his name was
|
||||
29260,
|
||||
29262
|
||||
};
|
||||
|
||||
const float BG_SA_NpcSpawnlocs[BG_SA_MAXNPC + BG_SA_DEMOLISHER_AMOUNT][4] =
|
||||
{
|
||||
//Cannons
|
||||
{ 1436.429f, 110.05f, 41.407f, 5.4f },
|
||||
{ 1404.9023f, 84.758f, 41.183f, 5.46f },
|
||||
{ 1068.693f, -86.951f, 93.81f, 0.02f },
|
||||
{ 1068.83f, -127.56f, 96.45f, 0.0912f },
|
||||
{ 1422.115f, -196.433f, 42.1825f, 1.0222f },
|
||||
{ 1454.887f, -220.454f, 41.956f, 0.9627f },
|
||||
{ 1232.345f, -187.517f, 66.945f, 0.45f },
|
||||
{ 1249.634f, -224.189f, 66.72f, 0.635f },
|
||||
{ 1236.213f, 92.287f, 64.965f, 5.751f },
|
||||
{ 1215.11f, 57.772f, 64.739f, 5.78f } ,
|
||||
//Demolishers
|
||||
{ 1611.597656,-117.270073,8.719355,2.513274},
|
||||
{ 1575.562500,-158.421875,5.024450,2.129302},
|
||||
{ 1618.047729,61.424641,7.248210,3.979351},
|
||||
{ 1575.103149,98.873344,2.830360,3.752458},
|
||||
//trigger
|
||||
{ 1453.49, -250.453, 30.896, 4.2883},
|
||||
{ 1377.05, 97.036, 30.8605, 2.46539},
|
||||
{ 1186.05, 58.8048, 56.5491, 2.75992},
|
||||
{ 1042.83, -72.839, 84.8145, 3.58615},
|
||||
{ 1233.62, -250.49, 55.4036, 3.7016},
|
||||
//Npcs
|
||||
{ 1348.644165, -298.786469, 31.080130, 1.710423},
|
||||
{ 1358.191040, 195.527786, 31.018187, 4.171337},
|
||||
//Demolishers2
|
||||
{ 1371.055786, -317.071136, 35.007359, 1.947460},
|
||||
{ 1424.034912, -260.195190, 31.084425, 2.820013},
|
||||
{ 1353.139893, 223.745438, 35.265411, 4.343684},
|
||||
{ 1404.809570, 197.027237, 32.046032, 3.605401}
|
||||
};
|
||||
|
||||
enum BG_SA_Objects
|
||||
{
|
||||
BG_SA_GREEN_GATE = 0,
|
||||
BG_SA_YELLOW_GATE,
|
||||
BG_SA_BLUE_GATE,
|
||||
BG_SA_RED_GATE,
|
||||
BG_SA_PURPLE_GATE,
|
||||
BG_SA_ANCIENT_GATE,
|
||||
BG_SA_TITAN_RELIC,
|
||||
BG_SA_BOAT_ONE,
|
||||
BG_SA_BOAT_TWO,
|
||||
BG_SA_SIGIL_1,
|
||||
BG_SA_SIGIL_2,
|
||||
BG_SA_SIGIL_3,
|
||||
BG_SA_SIGIL_4,
|
||||
BG_SA_SIGIL_5,
|
||||
BG_SA_CENTRAL_FLAGPOLE,
|
||||
BG_SA_RIGHT_FLAGPOLE,
|
||||
BG_SA_LEFT_FLAGPOLE,
|
||||
BG_SA_CENTRAL_FLAG,
|
||||
BG_SA_RIGHT_FLAG,
|
||||
BG_SA_LEFT_FLAG,
|
||||
BG_SA_PORTAL_DEFFENDER_BLUE,
|
||||
BG_SA_PORTAL_DEFFENDER_GREEN,
|
||||
BG_SA_PORTAL_DEFFENDER_YELLOW,
|
||||
BG_SA_PORTAL_DEFFENDER_PURPLE,
|
||||
BG_SA_PORTAL_DEFFENDER_RED,
|
||||
BG_SA_BOMB,
|
||||
BG_SA_MAXOBJ = BG_SA_BOMB+68
|
||||
};
|
||||
|
||||
const float BG_SA_ObjSpawnlocs[BG_SA_MAXOBJ][4] =
|
||||
{
|
||||
{ 1411.57f, 108.163f, 28.692f, 5.441f },
|
||||
{ 1055.452f, -108.1f, 82.134f, 0.034f },
|
||||
{ 1431.3413f, -219.437f, 30.893f, 0.9736f },
|
||||
{ 1227.667f, -212.555f, 55.372f, 0.5023f },
|
||||
{ 1214.681f, 81.21f, 53.413f, 5.745f },
|
||||
{ 878.555f, -108.2f, 117.845f, 0.0f },
|
||||
{ 836.5f, -108.8f, 120.219f, 0.0f },
|
||||
//Ships
|
||||
{ 2679.696777, -826.891235, 3.712860, 5.78367f}, //rot2 1 rot3 0.0002
|
||||
{ 2574.003662, 981.261475, 2.603424, 0.807696},
|
||||
//Sigils
|
||||
{ 1414.054f, 106.72f, 41.442f, 5.441f },
|
||||
{ 1060.63f, -107.8f, 94.7f, 0.034f },
|
||||
{ 1433.383f, -216.4f, 43.642f, 0.9736f },
|
||||
{ 1230.75f, -210.724f, 67.611f, 0.5023f },
|
||||
{ 1217.8f, 79.532f, 66.58f, 5.745f },
|
||||
//Flagpoles
|
||||
{ 1215.114258,-65.711861,70.084267,-3.124123},
|
||||
{1338.863892,-153.336533,30.895121,-2.530723},
|
||||
{1309.124268,9.410645,30.893402,-1.623156},
|
||||
//Flags
|
||||
{ 1215.108032,-65.715767,70.084267,-3.124123},
|
||||
{ 1338.859253,-153.327316,30.895077,-2.530723},
|
||||
{ 1309.192017,9.416233,30.893402,1.518436},
|
||||
//Portal
|
||||
{1468.380005, -225.798996, 30.896200, 0.0}, //blue
|
||||
{1394.270020, 72.551399, 31.054300, 0.0},//green
|
||||
{1065.260010, -89.79501, 81.073402, 0.0},//yellow
|
||||
{1216.069946, 47.904301, 54.278198,0.0}, //purple
|
||||
{1255.569946, -233.548996, 56.43699, 0.0},//red
|
||||
//Bombs
|
||||
{1333.45, 211.354, 31.0538, 5.03666},
|
||||
{1334.29, 209.582, 31.0532, 1.28088},
|
||||
{1332.72, 210.049, 31.0532, 1.28088},
|
||||
{1334.28, 210.78, 31.0538, 3.85856},
|
||||
{1332.64, 211.39, 31.0532, 1.29266},
|
||||
{1371.41, 194.028, 31.5107, 0.753095},
|
||||
{1372.39, 194.951, 31.4679, 0.753095},
|
||||
{1371.58, 196.942, 30.9349, 1.01777},
|
||||
{1370.43, 196.614, 30.9349, 0.957299},
|
||||
{1369.46, 196.877, 30.9351, 2.45348},
|
||||
{1370.35, 197.361, 30.9349, 1.08689},
|
||||
{1369.47, 197.941, 30.9349, 0.984787},
|
||||
{1592.49, 47.5969, 7.52271, 4.63218},
|
||||
{1593.91, 47.8036, 7.65856, 4.63218},
|
||||
{1593.13, 46.8106, 7.54073, 4.63218},
|
||||
{1589.22, 36.3616, 7.45975, 4.64396},
|
||||
{1588.24, 35.5842, 7.55613, 4.79564},
|
||||
{1588.14, 36.7611, 7.49675, 4.79564},
|
||||
{1595.74, 35.5278, 7.46602, 4.90246},
|
||||
{1596, 36.6475, 7.47991, 4.90246},
|
||||
{1597.03, 36.2356, 7.48631, 4.90246},
|
||||
{1597.93, 37.1214, 7.51725, 4.90246},
|
||||
{1598.16, 35.888, 7.50018, 4.90246},
|
||||
{1579.6, -98.0917, 8.48478, 1.37996},
|
||||
{1581.2, -98.401, 8.47483, 1.37996},
|
||||
{1580.38, -98.9556, 8.4772, 1.38781},
|
||||
{1585.68, -104.966, 8.88551, 0.493246},
|
||||
{1586.15, -106.033, 9.10616, 0.493246},
|
||||
{1584.88, -105.394, 8.82985, 0.493246},
|
||||
{1581.87, -100.899, 8.46164, 0.929142},
|
||||
{1581.48, -99.4657, 8.46926, 0.929142},
|
||||
{1583.2, -91.2291, 8.49227, 1.40038},
|
||||
{1581.94, -91.0119, 8.49977, 1.40038},
|
||||
{1582.33, -91.951, 8.49353, 1.1844},
|
||||
{1342.06, -304.049, 30.9532, 5.59507},
|
||||
{1340.96, -304.536, 30.9458, 1.28323},
|
||||
{1341.22, -303.316, 30.9413, 0.486051},
|
||||
{1342.22, -302.939, 30.986, 4.87643},
|
||||
{1382.16, -287.466, 32.3063, 4.80968},
|
||||
{1381, -287.58, 32.2805, 4.80968},
|
||||
{1381.55, -286.536, 32.3929, 2.84225},
|
||||
{1382.75, -286.354, 32.4099, 1.00442},
|
||||
{1379.92, -287.34, 32.2872, 3.81615},
|
||||
{1100.52, -2.41391, 70.2984, 0.131054},
|
||||
{1099.35, -2.13851, 70.3375, 4.4586},
|
||||
{1099.59, -1.00329, 70.238, 2.49903},
|
||||
{1097.79, 0.571316, 70.159, 4.00307},
|
||||
{1098.74, -7.23252, 70.7972, 4.1523},
|
||||
{1098.46, -5.91443, 70.6715, 4.1523},
|
||||
{1097.53, -7.39704, 70.7959, 4.1523},
|
||||
{1097.32, -6.64233, 70.7424, 4.1523},
|
||||
{1096.45, -5.96664, 70.7242, 4.1523},
|
||||
{971.725, 0.496763, 86.8467, 2.09233},
|
||||
{973.589, 0.119518, 86.7985, 3.17225},
|
||||
{972.524, 1.25333, 86.8351, 5.28497},
|
||||
{971.993, 2.05668, 86.8584, 5.28497},
|
||||
{973.635, 2.11805, 86.8197, 2.36722},
|
||||
{974.791, 1.74679, 86.7942, 1.5936},
|
||||
{974.771, 3.0445, 86.8125, 0.647199},
|
||||
{979.554, 3.6037, 86.7923, 1.69178},
|
||||
{979.758, 2.57519, 86.7748, 1.76639},
|
||||
{980.769, 3.48904, 86.7939, 1.76639},
|
||||
{979.122, 2.87109, 86.7794, 1.76639},
|
||||
{986.167, 4.85363, 86.8439, 1.5779},
|
||||
{986.176, 3.50367, 86.8217, 1.5779},
|
||||
{987.33, 4.67389, 86.8486, 1.5779},
|
||||
{985.23, 4.65898, 86.8368, 1.5779},
|
||||
{984.556, 3.54097, 86.8137, 1.5779},
|
||||
};
|
||||
|
||||
/* Ships:
|
||||
* 193182 - ally
|
||||
* 193183 - horde
|
||||
* 193184 - horde
|
||||
* 193185 - ally
|
||||
* Banners:
|
||||
* 191308 - left one,
|
||||
* 191306 - right one,
|
||||
* 191310 - central,
|
||||
* Ally ones, substract 1
|
||||
* to get horde ones.
|
||||
*/
|
||||
|
||||
const uint32 BG_SA_ObjEntries[BG_SA_MAXOBJ + BG_SA_FLAG_AMOUNT] =
|
||||
{
|
||||
190722,
|
||||
190727,
|
||||
190724,
|
||||
190726,
|
||||
190723,
|
||||
192549,
|
||||
192834,
|
||||
193182,
|
||||
193185,
|
||||
192687,
|
||||
192685,
|
||||
192689,
|
||||
192690,
|
||||
192691,
|
||||
191311,
|
||||
191311,
|
||||
191311,
|
||||
191310,
|
||||
191306,
|
||||
191308,
|
||||
192819,
|
||||
192819,
|
||||
192819,
|
||||
192819,
|
||||
192819,
|
||||
190753
|
||||
};
|
||||
|
||||
const uint32 BG_SA_Factions[2] =
|
||||
{
|
||||
1732,
|
||||
1735,
|
||||
};
|
||||
|
||||
enum BG_SA_Graveyards
|
||||
{
|
||||
BG_SA_BEACH_GY = 0,
|
||||
BG_SA_DEFENDER_LAST_GY,
|
||||
BG_SA_RIGHT_CAPTURABLE_GY,
|
||||
BG_SA_LEFT_CAPTURABLE_GY,
|
||||
BG_SA_CENTRAL_CAPTURABLE_GY,
|
||||
BG_SA_MAX_GY
|
||||
};
|
||||
|
||||
const uint32 BG_SA_GYEntries[BG_SA_MAX_GY] =
|
||||
{
|
||||
1350,
|
||||
1349,
|
||||
1347,
|
||||
1346,
|
||||
1348,
|
||||
};
|
||||
|
||||
const float BG_SA_GYOrientation[BG_SA_MAX_GY] =
|
||||
{
|
||||
6.202f,
|
||||
1.926f, //right capturable GY
|
||||
3.917f, //left capturable GY
|
||||
3.104f, //center, capturable
|
||||
6.148f, //defender last GY
|
||||
};
|
||||
|
||||
struct BG_SA_RoundScore
|
||||
{
|
||||
TeamId winner;
|
||||
uint32 time;
|
||||
};
|
||||
|
||||
class BattleGroundSA : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
BattleGroundSA();
|
||||
~BattleGroundSA();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
virtual bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
virtual void EventPlayerDamagedGO(Player* plr, GameObject* go, uint8 hitType, uint32 destroyedEvent);
|
||||
virtual void HandleKillUnit(Creature* unit, Player* killer);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
||||
virtual void EventPlayerUsedGO(Player* Source, GameObject* object);
|
||||
uint32 GetGateIDFromDestroyEventID(uint32 id)
|
||||
{
|
||||
uint32 i = 0;
|
||||
switch(id)
|
||||
{
|
||||
case 19046: i = BG_SA_GREEN_GATE; break; //Green gate destroyed
|
||||
case 19045: i = BG_SA_BLUE_GATE; break; //blue gate
|
||||
case 19047: i = BG_SA_RED_GATE; break; //red gate
|
||||
case 19048: i = BG_SA_PURPLE_GATE; break; //purple gate
|
||||
case 19049: i = BG_SA_YELLOW_GATE; break; //yellow gate
|
||||
case 19837: i = BG_SA_ANCIENT_GATE; break; //ancient gate
|
||||
}
|
||||
return i;
|
||||
}
|
||||
uint32 GetWorldStateFromGateID(uint32 id)
|
||||
{
|
||||
uint32 uws = 0;
|
||||
switch(id)
|
||||
{
|
||||
case BG_SA_GREEN_GATE: uws = BG_SA_GREEN_GATEWS; break;
|
||||
case BG_SA_YELLOW_GATE: uws = BG_SA_YELLOW_GATEWS; break;
|
||||
case BG_SA_BLUE_GATE: uws = BG_SA_BLUE_GATEWS; break;
|
||||
case BG_SA_RED_GATE: uws = BG_SA_RED_GATEWS; break;
|
||||
case BG_SA_PURPLE_GATE: uws = BG_SA_PURPLE_GATEWS; break;
|
||||
case BG_SA_ANCIENT_GATE: uws = BG_SA_ANCIENT_GATEWS; break;
|
||||
}
|
||||
return uws;
|
||||
}
|
||||
void EndBattleGround(uint32 winner);
|
||||
|
||||
void RemovePlayer(Player *plr,uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
|
||||
|
||||
/* Scorekeeping */
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
private:
|
||||
bool ResetObjs();
|
||||
void StartShips();
|
||||
void TeleportPlayers();
|
||||
void OverrideGunFaction();
|
||||
void DemolisherStartState(bool start);
|
||||
void DestroyGate(Player* pl, GameObject* /*go*/, uint32 destroyedEvent);
|
||||
void SendTime();
|
||||
void CaptureGraveyard(BG_SA_Graveyards i, Player *Source);
|
||||
void ToggleTimer();
|
||||
void UpdateDemolisherSpawns();
|
||||
TeamId attackers;
|
||||
uint32 TotalTime;
|
||||
uint32 BG_SA_ENDROUNDTIME;
|
||||
bool ShipsStarted;
|
||||
BG_SA_GateState GateStatus[6];
|
||||
BG_SA_Status status;
|
||||
TeamId GraveyardStatus[BG_SA_MAX_GY];
|
||||
BG_SA_RoundScore RoundScores[2];
|
||||
bool TimerEnabled;
|
||||
uint32 UpdateWaitTimer;//5secs before starting the 1min countdown for second round
|
||||
bool SignaledRoundTwo;
|
||||
bool SignaledRoundTwoHalfMin;
|
||||
bool InitSecondRound;
|
||||
};
|
||||
#endif
|
||||
@@ -0,0 +1,843 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "BattleGround.h"
|
||||
#include "BattleGroundWS.h"
|
||||
#include "Creature.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "BattleGroundMgr.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
// these variables aren't used outside of this file, so declare them only here
|
||||
enum BG_WSG_Rewards
|
||||
{
|
||||
BG_WSG_WIN = 0,
|
||||
BG_WSG_FLAG_CAP,
|
||||
BG_WSG_MAP_COMPLETE,
|
||||
BG_WSG_REWARD_NUM
|
||||
};
|
||||
|
||||
uint32 BG_WSG_Honor[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
|
||||
{20,40,40}, // normal honor
|
||||
{60,40,80} // holiday
|
||||
};
|
||||
|
||||
uint32 BG_WSG_Reputation[BG_HONOR_MODE_NUM][BG_WSG_REWARD_NUM] = {
|
||||
{0,35,0}, // normal honor
|
||||
{0,45,0} // holiday
|
||||
};
|
||||
|
||||
BattleGroundWS::BattleGroundWS()
|
||||
{
|
||||
m_BgObjects.resize(BG_WS_OBJECT_MAX);
|
||||
m_BgCreatures.resize(BG_CREATURES_MAX_WS);
|
||||
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
}
|
||||
|
||||
BattleGroundWS::~BattleGroundWS()
|
||||
{
|
||||
}
|
||||
|
||||
void BattleGroundWS::Update(uint32 diff)
|
||||
{
|
||||
BattleGround::Update(diff);
|
||||
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
if (GetStartTime() >= 25*MINUTE*IN_MILLISECONDS)
|
||||
{
|
||||
if (GetTeamScore(ALLIANCE) == 0)
|
||||
{
|
||||
if (GetTeamScore(HORDE) == 0) // No one scored - result is tie
|
||||
EndBattleGround(NULL);
|
||||
else // Horde has more points and thus wins
|
||||
EndBattleGround(HORDE);
|
||||
}
|
||||
|
||||
else if (GetTeamScore(HORDE) == 0)
|
||||
EndBattleGround(ALLIANCE); // Alliance has > 0, Horde has 0, alliance wins
|
||||
|
||||
else if (GetTeamScore(HORDE) == GetTeamScore(ALLIANCE)) // Team score equal, winner is team that scored the last flag
|
||||
EndBattleGround(m_LastFlagCaptureTeam);
|
||||
|
||||
else if (GetTeamScore(HORDE) > GetTeamScore(ALLIANCE)) // Last but not least, check who has the higher score
|
||||
EndBattleGround(HORDE);
|
||||
else
|
||||
EndBattleGround(ALLIANCE);
|
||||
}
|
||||
else if (GetStartTime() > m_minutesElapsed*MINUTE*IN_MILLISECONDS)
|
||||
{
|
||||
++m_minutesElapsed;
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25-m_minutesElapsed);
|
||||
}
|
||||
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if (m_FlagsTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlag(ALLIANCE, true);
|
||||
}
|
||||
}
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] -= diff;
|
||||
|
||||
if (m_FlagsDropTimer[BG_TEAM_ALLIANCE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_ALLIANCE] = 0;
|
||||
RespawnFlagAfterDrop(ALLIANCE);
|
||||
m_BothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_WAIT_RESPAWN)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if (m_FlagsTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlag(HORDE, true);
|
||||
}
|
||||
}
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] -= diff;
|
||||
|
||||
if (m_FlagsDropTimer[BG_TEAM_HORDE] < 0)
|
||||
{
|
||||
m_FlagsDropTimer[BG_TEAM_HORDE] = 0;
|
||||
RespawnFlagAfterDrop(HORDE);
|
||||
m_BothFlagsKept = false;
|
||||
}
|
||||
}
|
||||
if (m_BothFlagsKept)
|
||||
{
|
||||
m_FlagSpellForceTimer += diff;
|
||||
if (m_FlagDebuffState == 0 && m_FlagSpellForceTimer >= 600000) //10 minutes
|
||||
{
|
||||
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
|
||||
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
|
||||
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
|
||||
plr->CastSpell(plr,WS_SPELL_FOCUSED_ASSAULT,true);
|
||||
m_FlagDebuffState = 1;
|
||||
}
|
||||
else if (m_FlagDebuffState == 1 && m_FlagSpellForceTimer >= 900000) //15 minutes
|
||||
{
|
||||
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[0]))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
|
||||
}
|
||||
if (Player * plr = objmgr.GetPlayer(m_FlagKeepers[1]))
|
||||
{
|
||||
plr->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
plr->CastSpell(plr,WS_SPELL_BRUTAL_ASSAULT,true);
|
||||
}
|
||||
m_FlagDebuffState = 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FlagSpellForceTimer = 0; //reset timer.
|
||||
m_FlagDebuffState = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundWS::StartingEventCloseDoors()
|
||||
{
|
||||
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_H_4; ++i)
|
||||
{
|
||||
DoorClose(i);
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i)
|
||||
SpawnBGObject(i, RESPAWN_ONE_DAY);
|
||||
|
||||
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, 25);
|
||||
}
|
||||
|
||||
void BattleGroundWS::StartingEventOpenDoors()
|
||||
{
|
||||
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i <= BG_WS_OBJECT_DOOR_A_4; ++i)
|
||||
DoorOpen(i);
|
||||
for (uint32 i = BG_WS_OBJECT_DOOR_H_1; i <= BG_WS_OBJECT_DOOR_H_2; ++i)
|
||||
DoorOpen(i);
|
||||
|
||||
SpawnBGObject(BG_WS_OBJECT_DOOR_A_5, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_WS_OBJECT_DOOR_A_6, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_WS_OBJECT_DOOR_H_3, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY);
|
||||
|
||||
for (uint32 i = BG_WS_OBJECT_A_FLAG; i <= BG_WS_OBJECT_BERSERKBUFF_2; ++i)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
void BattleGroundWS::AddPlayer(Player *plr)
|
||||
{
|
||||
BattleGround::AddPlayer(plr);
|
||||
//create score and add it to map, default values are set in constructor
|
||||
BattleGroundWGScore* sc = new BattleGroundWGScore;
|
||||
|
||||
m_PlayerScores[plr->GetGUID()] = sc;
|
||||
}
|
||||
|
||||
void BattleGroundWS::RespawnFlag(uint32 Team, bool captured)
|
||||
{
|
||||
if (Team == ALLIANCE)
|
||||
{
|
||||
sLog.outDebug("Respawn Alliance flag");
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outDebug("Respawn Horde flag");
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
}
|
||||
|
||||
if (captured)
|
||||
{
|
||||
//when map_update will be allowed for battlegrounds this code will be useless
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); // flag respawned sound...
|
||||
}
|
||||
m_BothFlagsKept = false;
|
||||
}
|
||||
|
||||
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
RespawnFlag(team,false);
|
||||
if (team == ALLIANCE)
|
||||
{
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
|
||||
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team));
|
||||
if (obj)
|
||||
obj->Delete();
|
||||
else
|
||||
sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team)));
|
||||
|
||||
SetDroppedFlagGUID(0,team);
|
||||
m_BothFlagsKept = false;
|
||||
}
|
||||
|
||||
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
uint32 winner = 0;
|
||||
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!this->IsHordeFlagPickedup())
|
||||
return;
|
||||
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// horde flag in base (but not respawned yet)
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Horde Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(ALLIANCE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this->IsAllianceFlagPickedup())
|
||||
return;
|
||||
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
|
||||
// alliance flag in base (but not respawned yet)
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN;
|
||||
// Drop Alliance Flag from Player
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE)
|
||||
AddPoint(HORDE, 1);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE);
|
||||
RewardReputationToTeam(889, m_ReputationCapture, HORDE);
|
||||
}
|
||||
//for flag capture is reward 2 honorable kills
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), Source->GetTeam());
|
||||
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
else
|
||||
SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
|
||||
UpdateFlagState(Source->GetTeam(), 1); // flag state none
|
||||
UpdateTeamScore(Source->GetTeam());
|
||||
// only flag capture should be updated
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
|
||||
// update last flag capture to be used if teamscore is equal
|
||||
SetLastFlagCapture(Source->GetTeam());
|
||||
|
||||
if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = ALLIANCE;
|
||||
|
||||
if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
winner = HORDE;
|
||||
|
||||
if (winner)
|
||||
{
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0);
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1);
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1);
|
||||
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0);
|
||||
|
||||
RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner);
|
||||
EndBattleGround(winner);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
{
|
||||
// if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages
|
||||
// just take off the aura
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!this->IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this->IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
bool set = false;
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (!IsHordeFlagPickedup())
|
||||
return;
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetHordeFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsAllianceFlagPickedup())
|
||||
return;
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
{
|
||||
SetAllianceFlagPicker(0);
|
||||
Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG);
|
||||
if (m_FlagDebuffState == 1)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (m_FlagDebuffState == 2)
|
||||
Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT);
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND;
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (set)
|
||||
{
|
||||
Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
UpdateFlagState(Source->GetTeam(), 1);
|
||||
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1));
|
||||
}
|
||||
|
||||
m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
int32 message_id = 0;
|
||||
ChatMsg type = CHAT_MSG_BG_SYSTEM_NEUTRAL;
|
||||
|
||||
//alliance flag picked up from base
|
||||
if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
&& this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
if (m_FlagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
m_BothFlagsKept = true;
|
||||
}
|
||||
|
||||
//horde flag picked up from base
|
||||
if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
|
||||
&& this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
//update world state to show correct flag carrier
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
if (m_FlagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
m_BothFlagsKept = true;
|
||||
}
|
||||
|
||||
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
|
||||
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
{
|
||||
if (Source->GetTeam() == ALLIANCE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_WAIT_RESPAWN);
|
||||
RespawnFlag(ALLIANCE, false);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
|
||||
m_BothFlagsKept = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_AF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_ONE_DAY);
|
||||
SetAllianceFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (m_FlagDebuffState == 1)
|
||||
Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true);
|
||||
if (m_FlagDebuffState == 2)
|
||||
Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
|
||||
}
|
||||
//called in HandleGameObjectUseOpcode:
|
||||
//target_obj->Delete();
|
||||
}
|
||||
|
||||
//Horde flag on ground(not in base) (returned or picked up again)
|
||||
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
|
||||
{
|
||||
if (Source->GetTeam() == HORDE)
|
||||
{
|
||||
message_id = LANG_BG_WS_RETURNED_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_HORDE;
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_WAIT_RESPAWN);
|
||||
RespawnFlag(HORDE, false);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
|
||||
m_BothFlagsKept = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
message_id = LANG_BG_WS_PICKEDUP_HF;
|
||||
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_ONE_DAY);
|
||||
SetHordeFlagPicker(Source->GetGUID());
|
||||
Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_PLAYER;
|
||||
UpdateFlagState(ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
if (m_FlagDebuffState == 1)
|
||||
Source->CastSpell(Source,WS_SPELL_FOCUSED_ASSAULT,true);
|
||||
if (m_FlagDebuffState == 2)
|
||||
Source->CastSpell(Source,WS_SPELL_BRUTAL_ASSAULT,true);
|
||||
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
|
||||
}
|
||||
//called in HandleGameObjectUseOpcode:
|
||||
//target_obj->Delete();
|
||||
}
|
||||
|
||||
if (!message_id)
|
||||
return;
|
||||
|
||||
SendMessageToAll(message_id, type, Source);
|
||||
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
}
|
||||
|
||||
void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
|
||||
{
|
||||
// sometimes flag aura not removed :(
|
||||
if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid)
|
||||
{
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
|
||||
this->SetAllianceFlagPicker(0);
|
||||
this->RespawnFlag(ALLIANCE, false);
|
||||
}
|
||||
else
|
||||
this->EventPlayerDroppedFlag(plr);
|
||||
}
|
||||
if (IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
|
||||
{
|
||||
if (!plr)
|
||||
{
|
||||
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
|
||||
this->SetHordeFlagPicker(0);
|
||||
this->RespawnFlag(HORDE, false);
|
||||
}
|
||||
else
|
||||
this->EventPlayerDroppedFlag(plr);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundWS::UpdateFlagState(uint32 team, uint32 value)
|
||||
{
|
||||
if (team == ALLIANCE)
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, value);
|
||||
else
|
||||
UpdateWorldState(BG_WS_FLAG_STATE_HORDE, value);
|
||||
}
|
||||
|
||||
void BattleGroundWS::UpdateTeamScore(uint32 team)
|
||||
{
|
||||
if (team == ALLIANCE)
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_ALLIANCE, GetTeamScore(team));
|
||||
else
|
||||
UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team));
|
||||
}
|
||||
|
||||
void BattleGroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger)
|
||||
{
|
||||
// this is wrong way to implement these things. On official it done by gameobject spell cast.
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
//uint32 SpellId = 0;
|
||||
//uint64 buff_guid = 0;
|
||||
switch(Trigger)
|
||||
{
|
||||
case 3686: // Alliance elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_1];
|
||||
break;
|
||||
case 3687: // Horde elixir of speed spawn. Trigger not working, because located inside other areatrigger, can be replaced by IsWithinDist(object, dist) in BattleGround::Update().
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_SPEEDBUFF_2];
|
||||
break;
|
||||
case 3706: // Alliance elixir of regeneration spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_1];
|
||||
break;
|
||||
case 3708: // Horde elixir of regeneration spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_REGENBUFF_2];
|
||||
break;
|
||||
case 3707: // Alliance elixir of berserk spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_1];
|
||||
break;
|
||||
case 3709: // Horde elixir of berserk spawn
|
||||
//buff_guid = m_BgObjects[BG_WS_OBJECT_BERSERKBUFF_2];
|
||||
break;
|
||||
case 3646: // Alliance Flag spawn
|
||||
if (m_FlagState[BG_TEAM_HORDE] && !m_FlagState[BG_TEAM_ALLIANCE])
|
||||
if (GetHordeFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
case 3647: // Horde Flag spawn
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] && !m_FlagState[BG_TEAM_HORDE])
|
||||
if (GetAllianceFlagPickerGUID() == Source->GetGUID())
|
||||
EventPlayerCapturedFlag(Source);
|
||||
break;
|
||||
case 3649: // unk1
|
||||
case 3688: // unk2
|
||||
case 4628: // unk3
|
||||
case 4629: // unk4
|
||||
break;
|
||||
default:
|
||||
sLog.outError("WARNING: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
Source->GetSession()->SendAreaTriggerMessage("Warning: Unhandled AreaTrigger in Battleground: %u", Trigger);
|
||||
break;
|
||||
}
|
||||
|
||||
//if (buff_guid)
|
||||
// HandleTriggerBuff(buff_guid,Source);
|
||||
}
|
||||
|
||||
bool BattleGroundWS::SetupBattleGround()
|
||||
{
|
||||
// flags
|
||||
if (!AddObject(BG_WS_OBJECT_A_FLAG, BG_OBJECT_A_FLAG_WS_ENTRY, 1540.423f, 1481.325f, 351.8284f, 3.089233f, 0, 0, 0.9996573f, 0.02617699f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
|| !AddObject(BG_WS_OBJECT_H_FLAG, BG_OBJECT_H_FLAG_WS_ENTRY, 916.0226f, 1434.405f, 345.413f, 0.01745329f, 0, 0, 0.008726535f, 0.9999619f, BG_WS_FLAG_RESPAWN_TIME/1000)
|
||||
// buffs
|
||||
|| !AddObject(BG_WS_OBJECT_SPEEDBUFF_1, BG_OBJECTID_SPEEDBUFF_ENTRY, 1449.93f, 1470.71f, 342.6346f, -1.64061f, 0, 0, 0.7313537f, -0.6819983f, BUFF_RESPAWN_TIME)
|
||||
|| !AddObject(BG_WS_OBJECT_SPEEDBUFF_2, BG_OBJECTID_SPEEDBUFF_ENTRY, 1005.171f, 1447.946f, 335.9032f, 1.64061f, 0, 0, 0.7313537f, 0.6819984f, BUFF_RESPAWN_TIME)
|
||||
|| !AddObject(BG_WS_OBJECT_REGENBUFF_1, BG_OBJECTID_REGENBUFF_ENTRY, 1317.506f, 1550.851f, 313.2344f, -0.2617996f, 0, 0, 0.1305263f, -0.9914448f, BUFF_RESPAWN_TIME)
|
||||
|| !AddObject(BG_WS_OBJECT_REGENBUFF_2, BG_OBJECTID_REGENBUFF_ENTRY, 1110.451f, 1353.656f, 316.5181f, -0.6806787f, 0, 0, 0.333807f, -0.9426414f, BUFF_RESPAWN_TIME)
|
||||
|| !AddObject(BG_WS_OBJECT_BERSERKBUFF_1, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1320.09f, 1378.79f, 314.7532f, 1.186824f, 0, 0, 0.5591929f, 0.8290376f, BUFF_RESPAWN_TIME)
|
||||
|| !AddObject(BG_WS_OBJECT_BERSERKBUFF_2, BG_OBJECTID_BERSERKERBUFF_ENTRY, 1139.688f, 1560.288f, 306.8432f, -2.443461f, 0, 0, 0.9396926f, -0.3420201f, BUFF_RESPAWN_TIME)
|
||||
// alliance gates
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_A_1, BG_OBJECT_DOOR_A_1_WS_ENTRY, 1503.335f, 1493.466f, 352.1888f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_A_2, BG_OBJECT_DOOR_A_2_WS_ENTRY, 1492.478f, 1457.912f, 342.9689f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_A_3, BG_OBJECT_DOOR_A_3_WS_ENTRY, 1468.503f, 1494.357f, 351.8618f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_A_4, BG_OBJECT_DOOR_A_4_WS_ENTRY, 1471.555f, 1458.778f, 362.6332f, 3.115414f, 0, 0, 0.9999143f, 0.01308903f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_A_5, BG_OBJECT_DOOR_A_5_WS_ENTRY, 1492.347f, 1458.34f, 342.3712f, -0.03490669f, 0, 0, 0.01745246f, -0.9998477f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_A_6, BG_OBJECT_DOOR_A_6_WS_ENTRY, 1503.466f, 1493.367f, 351.7352f, -0.03490669f, 0, 0, 0.01745246f, -0.9998477f, RESPAWN_IMMEDIATELY)
|
||||
// horde gates
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_H_1, BG_OBJECT_DOOR_H_1_WS_ENTRY, 949.1663f, 1423.772f, 345.6241f, -0.5756807f, -0.01673368f, -0.004956111f, -0.2839723f, 0.9586737f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_H_2, BG_OBJECT_DOOR_H_2_WS_ENTRY, 953.0507f, 1459.842f, 340.6526f, -1.99662f, -0.1971825f, 0.1575096f, -0.8239487f, 0.5073641f, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_H_3, BG_OBJECT_DOOR_H_3_WS_ENTRY, 949.9523f, 1422.751f, 344.9273f, 0.0f, 0, 0, 0, 1, RESPAWN_IMMEDIATELY)
|
||||
|| !AddObject(BG_WS_OBJECT_DOOR_H_4, BG_OBJECT_DOOR_H_4_WS_ENTRY, 950.7952f, 1459.583f, 342.1523f, 0.05235988f, 0, 0, 0.02617695f, 0.9996573f, RESPAWN_IMMEDIATELY)
|
||||
)
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundWS: Failed to spawn some object BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, HORDE))
|
||||
{
|
||||
sLog.outErrorDb("BatteGroundWS: Failed to spawn Horde spirit guide! BattleGround not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
sLog.outDebug("BatteGroundWS: BG objects and spirit guides spawned");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattleGroundWS::Reset()
|
||||
{
|
||||
//call parent's class reset
|
||||
BattleGround::Reset();
|
||||
|
||||
m_FlagKeepers[BG_TEAM_ALLIANCE] = 0;
|
||||
m_FlagKeepers[BG_TEAM_HORDE] = 0;
|
||||
m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0;
|
||||
m_DroppedFlagGUID[BG_TEAM_HORDE] = 0;
|
||||
m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
m_TeamScores[BG_TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[BG_TEAM_HORDE] = 0;
|
||||
bool isBGWeekend = sBattleGroundMgr.IsBGWeekend(GetTypeID());
|
||||
m_ReputationCapture = (isBGWeekend) ? 45 : 35;
|
||||
m_HonorWinKills = (isBGWeekend) ? 3 : 1;
|
||||
m_HonorEndKills = (isBGWeekend) ? 4 : 2;
|
||||
// For WorldState
|
||||
m_minutesElapsed = 0;
|
||||
m_LastFlagCaptureTeam = 0;
|
||||
|
||||
/* Spirit nodes is static at this BG and then not required deleting at BG reset.
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_ALLIANCE])
|
||||
DelCreature(WS_SPIRIT_MAIN_ALLIANCE);
|
||||
if (m_BgCreatures[WS_SPIRIT_MAIN_HORDE])
|
||||
DelCreature(WS_SPIRIT_MAIN_HORDE);
|
||||
*/
|
||||
}
|
||||
|
||||
void BattleGroundWS::EndBattleGround(uint32 winner)
|
||||
{
|
||||
//win reward
|
||||
if (winner == ALLIANCE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), ALLIANCE);
|
||||
if (winner == HORDE)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorWinKills), HORDE);
|
||||
//complete map_end rewards (even if no team wins)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), ALLIANCE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(m_HonorEndKills), HORDE);
|
||||
|
||||
BattleGround::EndBattleGround(winner);
|
||||
}
|
||||
|
||||
void BattleGroundWS::HandleKillPlayer(Player *player, Player *killer)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
EventPlayerDroppedFlag(player);
|
||||
|
||||
BattleGround::HandleKillPlayer(player, killer);
|
||||
}
|
||||
|
||||
void BattleGroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
|
||||
BattleGroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID());
|
||||
if (itr == m_PlayerScores.end()) // player not found
|
||||
return;
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case SCORE_FLAG_CAPTURES: // flags captured
|
||||
((BattleGroundWGScore*)itr->second)->FlagCaptures += value;
|
||||
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_CAPTURE_FLAG);
|
||||
break;
|
||||
case SCORE_FLAG_RETURNS: // flags returned
|
||||
((BattleGroundWGScore*)itr->second)->FlagReturns += value;
|
||||
Source->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, WS_OBJECTIVE_RETURN_FLAG);
|
||||
break;
|
||||
default:
|
||||
BattleGround::UpdatePlayerScore(Source, type, value, doAddHonor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattleGroundWS::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
//if status in progress, it returns main graveyards with spiritguides
|
||||
//else it will return the graveyard in the flagroom - this is especially good
|
||||
//if a player dies in preparation phase - then the player can't cheat
|
||||
//and teleport to the graveyard outside the flagroom
|
||||
//and start running around, while the doors are still closed
|
||||
if (player->GetTeam() == ALLIANCE)
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE);
|
||||
else
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_ALLIANCE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
else
|
||||
return sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_FLAGROOM_HORDE);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleGroundWS::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_ALLIANCE) << uint32(GetTeamScore(ALLIANCE));
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_HORDE) << uint32(GetTeamScore(HORDE));
|
||||
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_ALLIANCE) << uint32(0);
|
||||
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_GROUND)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(-1);
|
||||
else if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(1);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_UNK_HORDE) << uint32(0);
|
||||
|
||||
data << uint32(BG_WS_FLAG_CAPTURES_MAX) << uint32(BG_WS_MAX_TEAM_SCORE);
|
||||
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(1);
|
||||
data << uint32(BG_WS_STATE_TIMER) << uint32(25-m_minutesElapsed);
|
||||
}
|
||||
else
|
||||
data << uint32(BG_WS_STATE_TIMER_ACTIVE) << uint32(0);
|
||||
|
||||
if (m_FlagState[BG_TEAM_HORDE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(2);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_STATE_ALLIANCE) << uint32(1);
|
||||
|
||||
if (m_FlagState[BG_TEAM_ALLIANCE] == BG_WS_FLAG_STATE_ON_PLAYER)
|
||||
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(2);
|
||||
else
|
||||
data << uint32(BG_WS_FLAG_STATE_HORDE) << uint32(1);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*
|
||||
* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __BATTLEGROUNDWS_H
|
||||
#define __BATTLEGROUNDWS_H
|
||||
|
||||
#include "BattleGround.h"
|
||||
|
||||
enum BG_WS_TimerOrScore
|
||||
{
|
||||
BG_WS_MAX_TEAM_SCORE = 3,
|
||||
BG_WS_FLAG_RESPAWN_TIME = 23000,
|
||||
BG_WS_FLAG_DROP_TIME = 10000,
|
||||
BG_WS_SPELL_FORCE_TIME = 600000,
|
||||
BG_WS_SPELL_BRUTAL_TIME = 900000
|
||||
};
|
||||
|
||||
enum BG_WS_Sound
|
||||
{
|
||||
BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE = 8173,
|
||||
BG_WS_SOUND_FLAG_CAPTURED_HORDE = 8213,
|
||||
BG_WS_SOUND_FLAG_PLACED = 8232,
|
||||
BG_WS_SOUND_FLAG_RETURNED = 8192,
|
||||
BG_WS_SOUND_HORDE_FLAG_PICKED_UP = 8212,
|
||||
BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP = 8174,
|
||||
BG_WS_SOUND_FLAGS_RESPAWNED = 8232
|
||||
};
|
||||
|
||||
enum BG_WS_SpellId
|
||||
{
|
||||
BG_WS_SPELL_WARSONG_FLAG = 23333,
|
||||
BG_WS_SPELL_WARSONG_FLAG_DROPPED = 23334,
|
||||
BG_WS_SPELL_SILVERWING_FLAG = 23335,
|
||||
BG_WS_SPELL_SILVERWING_FLAG_DROPPED = 23336,
|
||||
BG_WS_SPELL_FOCUSED_ASSAULT = 46392,
|
||||
BG_WS_SPELL_BRUTAL_ASSAULT = 46393
|
||||
};
|
||||
|
||||
enum BG_WS_WorldStates
|
||||
{
|
||||
BG_WS_FLAG_UNK_ALLIANCE = 1545,
|
||||
BG_WS_FLAG_UNK_HORDE = 1546,
|
||||
// FLAG_UNK = 1547,
|
||||
BG_WS_FLAG_CAPTURES_ALLIANCE = 1581,
|
||||
BG_WS_FLAG_CAPTURES_HORDE = 1582,
|
||||
BG_WS_FLAG_CAPTURES_MAX = 1601,
|
||||
BG_WS_FLAG_STATE_HORDE = 2338,
|
||||
BG_WS_FLAG_STATE_ALLIANCE = 2339,
|
||||
BG_WS_STATE_TIMER = 4248,
|
||||
BG_WS_STATE_TIMER_ACTIVE = 4247
|
||||
};
|
||||
|
||||
enum BG_WS_ObjectTypes
|
||||
{
|
||||
BG_WS_OBJECT_DOOR_A_1 = 0,
|
||||
BG_WS_OBJECT_DOOR_A_2 = 1,
|
||||
BG_WS_OBJECT_DOOR_A_3 = 2,
|
||||
BG_WS_OBJECT_DOOR_A_4 = 3,
|
||||
BG_WS_OBJECT_DOOR_A_5 = 4,
|
||||
BG_WS_OBJECT_DOOR_A_6 = 5,
|
||||
BG_WS_OBJECT_DOOR_H_1 = 6,
|
||||
BG_WS_OBJECT_DOOR_H_2 = 7,
|
||||
BG_WS_OBJECT_DOOR_H_3 = 8,
|
||||
BG_WS_OBJECT_DOOR_H_4 = 9,
|
||||
BG_WS_OBJECT_A_FLAG = 10,
|
||||
BG_WS_OBJECT_H_FLAG = 11,
|
||||
BG_WS_OBJECT_SPEEDBUFF_1 = 12,
|
||||
BG_WS_OBJECT_SPEEDBUFF_2 = 13,
|
||||
BG_WS_OBJECT_REGENBUFF_1 = 14,
|
||||
BG_WS_OBJECT_REGENBUFF_2 = 15,
|
||||
BG_WS_OBJECT_BERSERKBUFF_1 = 16,
|
||||
BG_WS_OBJECT_BERSERKBUFF_2 = 17,
|
||||
BG_WS_OBJECT_MAX = 18
|
||||
};
|
||||
|
||||
enum BG_WS_ObjectEntry
|
||||
{
|
||||
BG_OBJECT_DOOR_A_1_WS_ENTRY = 179918,
|
||||
BG_OBJECT_DOOR_A_2_WS_ENTRY = 179919,
|
||||
BG_OBJECT_DOOR_A_3_WS_ENTRY = 179920,
|
||||
BG_OBJECT_DOOR_A_4_WS_ENTRY = 179921,
|
||||
BG_OBJECT_DOOR_A_5_WS_ENTRY = 180322,
|
||||
BG_OBJECT_DOOR_A_6_WS_ENTRY = 180322,
|
||||
BG_OBJECT_DOOR_H_1_WS_ENTRY = 179916,
|
||||
BG_OBJECT_DOOR_H_2_WS_ENTRY = 179917,
|
||||
BG_OBJECT_DOOR_H_3_WS_ENTRY = 180322,
|
||||
BG_OBJECT_DOOR_H_4_WS_ENTRY = 180322,
|
||||
BG_OBJECT_A_FLAG_WS_ENTRY = 179830,
|
||||
BG_OBJECT_H_FLAG_WS_ENTRY = 179831,
|
||||
BG_OBJECT_A_FLAG_GROUND_WS_ENTRY = 179785,
|
||||
BG_OBJECT_H_FLAG_GROUND_WS_ENTRY = 179786
|
||||
};
|
||||
|
||||
enum BG_WS_FlagState
|
||||
{
|
||||
BG_WS_FLAG_STATE_ON_BASE = 0,
|
||||
BG_WS_FLAG_STATE_WAIT_RESPAWN = 1,
|
||||
BG_WS_FLAG_STATE_ON_PLAYER = 2,
|
||||
BG_WS_FLAG_STATE_ON_GROUND = 3
|
||||
};
|
||||
|
||||
enum BG_WS_Graveyards
|
||||
{
|
||||
WS_GRAVEYARD_FLAGROOM_ALLIANCE = 769,
|
||||
WS_GRAVEYARD_FLAGROOM_HORDE = 770,
|
||||
WS_GRAVEYARD_MAIN_ALLIANCE = 771,
|
||||
WS_GRAVEYARD_MAIN_HORDE = 772
|
||||
};
|
||||
|
||||
enum BG_WS_CreatureTypes
|
||||
{
|
||||
WS_SPIRIT_MAIN_ALLIANCE = 0,
|
||||
WS_SPIRIT_MAIN_HORDE = 1,
|
||||
|
||||
BG_CREATURES_MAX_WS = 2
|
||||
};
|
||||
|
||||
enum BG_WS_CarrierDebuffs
|
||||
{
|
||||
WS_SPELL_FOCUSED_ASSAULT = 46392,
|
||||
WS_SPELL_BRUTAL_ASSAULT = 46393
|
||||
};
|
||||
|
||||
enum BG_WS_Objectives
|
||||
{
|
||||
WS_OBJECTIVE_CAPTURE_FLAG = 42,
|
||||
WS_OBJECTIVE_RETURN_FLAG = 44
|
||||
};
|
||||
|
||||
class BattleGroundWGScore : public BattleGroundScore
|
||||
{
|
||||
public:
|
||||
BattleGroundWGScore() : FlagCaptures(0), FlagReturns(0) {};
|
||||
virtual ~BattleGroundWGScore() {};
|
||||
uint32 FlagCaptures;
|
||||
uint32 FlagReturns;
|
||||
};
|
||||
|
||||
class BattleGroundWS : public BattleGround
|
||||
{
|
||||
friend class BattleGroundMgr;
|
||||
|
||||
public:
|
||||
/* Construction */
|
||||
BattleGroundWS();
|
||||
~BattleGroundWS();
|
||||
void Update(uint32 diff);
|
||||
|
||||
/* inherited from BattlegroundClass */
|
||||
virtual void AddPlayer(Player *plr);
|
||||
virtual void StartingEventCloseDoors();
|
||||
virtual void StartingEventOpenDoors();
|
||||
|
||||
/* BG Flags */
|
||||
uint64 GetAllianceFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_ALLIANCE]; }
|
||||
uint64 GetHordeFlagPickerGUID() const { return m_FlagKeepers[BG_TEAM_HORDE]; }
|
||||
void SetAllianceFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_ALLIANCE] = guid; }
|
||||
void SetHordeFlagPicker(uint64 guid) { m_FlagKeepers[BG_TEAM_HORDE] = guid; }
|
||||
bool IsAllianceFlagPickedup() const { return m_FlagKeepers[BG_TEAM_ALLIANCE] != 0; }
|
||||
bool IsHordeFlagPickedup() const { return m_FlagKeepers[BG_TEAM_HORDE] != 0; }
|
||||
void RespawnFlag(uint32 Team, bool captured);
|
||||
void RespawnFlagAfterDrop(uint32 Team);
|
||||
uint8 GetFlagState(uint32 team) { return m_FlagState[GetTeamIndexByTeamId(team)]; }
|
||||
void AddTimedAura(uint32 aura);
|
||||
void RemoveTimedAura(uint32 aura);
|
||||
bool IsBrutalTimerDone;
|
||||
bool IsForceTimerDone;
|
||||
|
||||
/* Battleground Events */
|
||||
virtual void EventPlayerDroppedFlag(Player *Source);
|
||||
virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj);
|
||||
virtual void EventPlayerCapturedFlag(Player *Source);
|
||||
|
||||
void RemovePlayer(Player *plr, uint64 guid);
|
||||
void HandleAreaTrigger(Player *Source, uint32 Trigger);
|
||||
void HandleKillPlayer(Player *player, Player *killer);
|
||||
bool SetupBattleGround();
|
||||
virtual void Reset();
|
||||
void EndBattleGround(uint32 winner);
|
||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||
|
||||
void UpdateFlagState(uint32 team, uint32 value);
|
||||
void SetLastFlagCapture(uint32 team) { m_LastFlagCaptureTeam = team; }
|
||||
void UpdateTeamScore(uint32 team);
|
||||
void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;}
|
||||
uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];}
|
||||
virtual void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
/* Scorekeeping */
|
||||
uint32 GetTeamScore(uint32 TeamID) const { return m_TeamScores[GetTeamIndexByTeamId(TeamID)]; }
|
||||
void AddPoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] += Points; }
|
||||
void SetTeamPoint(uint32 TeamID, uint32 Points = 0) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] = Points; }
|
||||
void RemovePoint(uint32 TeamID, uint32 Points = 1) { m_TeamScores[GetTeamIndexByTeamId(TeamID)] -= Points; }
|
||||
private:
|
||||
uint64 m_FlagKeepers[2]; // 0 - alliance, 1 - horde
|
||||
uint64 m_DroppedFlagGUID[2];
|
||||
uint8 m_FlagState[2]; // for checking flag state
|
||||
int32 m_FlagsTimer[2];
|
||||
int32 m_FlagsDropTimer[2];
|
||||
uint32 m_LastFlagCaptureTeam; // Winner is based on this if score is equal
|
||||
|
||||
uint32 m_ReputationCapture;
|
||||
uint32 m_HonorWinKills;
|
||||
uint32 m_HonorEndKills;
|
||||
int32 m_FlagSpellForceTimer;
|
||||
bool m_BothFlagsKept;
|
||||
uint8 m_FlagDebuffState; // 0 - no debuffs, 1 - focused assault, 2 - brutal assault
|
||||
uint8 m_minutesElapsed;
|
||||
};
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user