mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 16:43:47 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -67,7 +67,7 @@ void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||
// Xinef: do not invite players on taxi
|
||||
if (!player->IsInFlight())
|
||||
{
|
||||
// If battle is started,
|
||||
// If battle is started,
|
||||
// If not full of players > invite player to join the war
|
||||
// If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
|
||||
if (IsWarTime())
|
||||
@@ -77,7 +77,7 @@ void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||
else // No more vacant places
|
||||
{
|
||||
// TODO: Send a packet to announce it to player
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + (player->IsGameMaster() ? 30*MINUTE : 10);
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + (player->IsGameMaster() ? 30 * MINUTE : 10);
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
}
|
||||
@@ -424,11 +424,14 @@ void Battlefield::PlayerAcceptInviteToWar(Player* player)
|
||||
|
||||
void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
||||
{
|
||||
if (spellId > 0) {
|
||||
if (spellId > 0)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->CastSpell(player, uint32(spellId), true);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
player->RemoveAuraFromStack(uint32(-spellId));
|
||||
@@ -591,7 +594,7 @@ BfGraveyard* Battlefield::GetGraveyardById(uint32 id) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GraveyardStruct const * Battlefield::GetClosestGraveyard(Player* player)
|
||||
GraveyardStruct const* Battlefield::GetClosestGraveyard(Player* player)
|
||||
{
|
||||
BfGraveyard* closestGY = nullptr;
|
||||
float maxdist = -1;
|
||||
@@ -647,7 +650,7 @@ void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
|
||||
}
|
||||
}
|
||||
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid)
|
||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64& guid)
|
||||
{
|
||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
|
||||
@@ -875,9 +878,9 @@ GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
||||
{
|
||||
if (GameObject* go = GetCapturePointGo(player))
|
||||
player->SendUpdateWorldState(go->GetGOInfo()->capturePoint.worldState1, 0);
|
||||
|
||||
|
||||
GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
|
||||
|
||||
|
||||
if (current == m_activePlayers[player->GetTeamId()].end())
|
||||
return current; // return end()
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ enum BattlefieldTypes
|
||||
|
||||
enum BattlefieldIDs
|
||||
{
|
||||
BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle
|
||||
BATTLEFIELD_BATTLEID_WG = 1, // Wintergrasp battle
|
||||
};
|
||||
|
||||
enum BattlefieldObjectiveStates
|
||||
@@ -72,356 +72,356 @@ typedef std::map<uint64, time_t> PlayerTimerMap;
|
||||
|
||||
class BfCapturePoint
|
||||
{
|
||||
public:
|
||||
BfCapturePoint(Battlefield* bf);
|
||||
public:
|
||||
BfCapturePoint(Battlefield* bf);
|
||||
|
||||
virtual ~BfCapturePoint() { }
|
||||
virtual ~BfCapturePoint() { }
|
||||
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||
|
||||
// Send world state update to all players present
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
// Send world state update to all players present
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
|
||||
// Send kill notify to players in the controlling faction
|
||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||
// Send kill notify to players in the controlling faction
|
||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||
|
||||
// Used when player is activated/inactivated in the area
|
||||
virtual bool HandlePlayerEnter(Player* player);
|
||||
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
|
||||
//virtual void HandlePlayerActivityChanged(Player* player);
|
||||
// Used when player is activated/inactivated in the area
|
||||
virtual bool HandlePlayerEnter(Player* player);
|
||||
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
|
||||
//virtual void HandlePlayerActivityChanged(Player* player);
|
||||
|
||||
// Checks if player is in range of a capture credit marker
|
||||
bool IsInsideObjective(Player* player) const;
|
||||
// Checks if player is in range of a capture credit marker
|
||||
bool IsInsideObjective(Player* player) const;
|
||||
|
||||
// Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
|
||||
virtual bool Update(uint32 diff);
|
||||
virtual void ChangeTeam(TeamId /*oldTeam*/) {}
|
||||
virtual void SendChangePhase();
|
||||
// Returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update.
|
||||
virtual bool Update(uint32 diff);
|
||||
virtual void ChangeTeam(TeamId /*oldTeam*/) {}
|
||||
virtual void SendChangePhase();
|
||||
|
||||
bool SetCapturePointData(GameObject* capturePoint);
|
||||
GameObject* GetCapturePointGo() { return ObjectAccessor::GetObjectInWorld(m_capturePoint, (GameObject*)NULL); }
|
||||
GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); }
|
||||
bool SetCapturePointData(GameObject* capturePoint);
|
||||
GameObject* GetCapturePointGo() { return ObjectAccessor::GetObjectInWorld(m_capturePoint, (GameObject*)NULL); }
|
||||
GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); }
|
||||
|
||||
TeamId GetTeamId() { return m_team; }
|
||||
protected:
|
||||
bool DelCapturePoint();
|
||||
TeamId GetTeamId() { return m_team; }
|
||||
protected:
|
||||
bool DelCapturePoint();
|
||||
|
||||
// active Players in the area of the objective, 0 - alliance, 1 - horde
|
||||
GuidSet m_activePlayers[2];
|
||||
// active Players in the area of the objective, 0 - alliance, 1 - horde
|
||||
GuidSet m_activePlayers[2];
|
||||
|
||||
// Total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
float m_minValue;
|
||||
// Total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
float m_minValue;
|
||||
|
||||
// Maximum speed of capture
|
||||
float m_maxSpeed;
|
||||
// Maximum speed of capture
|
||||
float m_maxSpeed;
|
||||
|
||||
// The status of the objective
|
||||
float m_value;
|
||||
TeamId m_team;
|
||||
// The status of the objective
|
||||
float m_value;
|
||||
TeamId m_team;
|
||||
|
||||
// Objective states
|
||||
BattlefieldObjectiveStates m_OldState;
|
||||
BattlefieldObjectiveStates m_State;
|
||||
// Objective states
|
||||
BattlefieldObjectiveStates m_OldState;
|
||||
BattlefieldObjectiveStates m_State;
|
||||
|
||||
// Neutral value on capture bar
|
||||
uint32 m_neutralValuePct;
|
||||
// Neutral value on capture bar
|
||||
uint32 m_neutralValuePct;
|
||||
|
||||
// Pointer to the Battlefield this objective belongs to
|
||||
Battlefield* m_Bf;
|
||||
// Pointer to the Battlefield this objective belongs to
|
||||
Battlefield* m_Bf;
|
||||
|
||||
// Capture point entry
|
||||
uint32 m_capturePointEntry;
|
||||
// Capture point entry
|
||||
uint32 m_capturePointEntry;
|
||||
|
||||
// Gameobject related to that capture point
|
||||
uint64 m_capturePoint;
|
||||
// Gameobject related to that capture point
|
||||
uint64 m_capturePoint;
|
||||
};
|
||||
|
||||
class BfGraveyard
|
||||
{
|
||||
public:
|
||||
BfGraveyard(Battlefield* Bf);
|
||||
public:
|
||||
BfGraveyard(Battlefield* Bf);
|
||||
|
||||
// Method to changing who controls the graveyard
|
||||
void GiveControlTo(TeamId team);
|
||||
TeamId GetControlTeamId() const { return m_ControlTeam; }
|
||||
// Method to changing who controls the graveyard
|
||||
void GiveControlTo(TeamId team);
|
||||
TeamId GetControlTeamId() const { return m_ControlTeam; }
|
||||
|
||||
// Find the nearest graveyard to a player
|
||||
float GetDistance(Player* player);
|
||||
// Find the nearest graveyard to a player
|
||||
float GetDistance(Player* player);
|
||||
|
||||
// Initialize the graveyard
|
||||
void Initialize(TeamId startcontrol, uint32 gy);
|
||||
// Initialize the graveyard
|
||||
void Initialize(TeamId startcontrol, uint32 gy);
|
||||
|
||||
// Set spirit service for the graveyard
|
||||
void SetSpirit(Creature* spirit, TeamId team);
|
||||
// Set spirit service for the graveyard
|
||||
void SetSpirit(Creature* spirit, TeamId team);
|
||||
|
||||
// Add a player to the graveyard
|
||||
void AddPlayer(uint64 player_guid);
|
||||
// Add a player to the graveyard
|
||||
void AddPlayer(uint64 player_guid);
|
||||
|
||||
// Remove a player from the graveyard
|
||||
void RemovePlayer(uint64 player_guid);
|
||||
// Remove a player from the graveyard
|
||||
void RemovePlayer(uint64 player_guid);
|
||||
|
||||
// Resurrect players
|
||||
void Resurrect();
|
||||
// Resurrect players
|
||||
void Resurrect();
|
||||
|
||||
// Move players waiting to that graveyard on the nearest one
|
||||
void RelocateDeadPlayers();
|
||||
// Move players waiting to that graveyard on the nearest one
|
||||
void RelocateDeadPlayers();
|
||||
|
||||
// Check if this graveyard has a spirit guide
|
||||
bool HasNpc(uint64 guid)
|
||||
{
|
||||
if (!m_SpiritGuide[0] && !m_SpiritGuide[1])
|
||||
return false;
|
||||
// Check if this graveyard has a spirit guide
|
||||
bool HasNpc(uint64 guid)
|
||||
{
|
||||
if (!m_SpiritGuide[0] && !m_SpiritGuide[1])
|
||||
return false;
|
||||
|
||||
// performance
|
||||
/*if (!ObjectAccessor::FindUnit(m_SpiritGuide[0]) &&
|
||||
!ObjectAccessor::FindUnit(m_SpiritGuide[1]))
|
||||
return false;*/
|
||||
// performance
|
||||
/*if (!ObjectAccessor::FindUnit(m_SpiritGuide[0]) &&
|
||||
!ObjectAccessor::FindUnit(m_SpiritGuide[1]))
|
||||
return false;*/
|
||||
|
||||
return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
|
||||
}
|
||||
return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
|
||||
}
|
||||
|
||||
// Check if a player is in this graveyard's resurrect queue
|
||||
bool HasPlayer(uint64 guid) const { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
||||
// Check if a player is in this graveyard's resurrect queue
|
||||
bool HasPlayer(uint64 guid) const { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
||||
|
||||
// Get the graveyard's ID.
|
||||
uint32 GetGraveyardId() const { return m_GraveyardId; }
|
||||
// Get the graveyard's ID.
|
||||
uint32 GetGraveyardId() const { return m_GraveyardId; }
|
||||
|
||||
protected:
|
||||
TeamId m_ControlTeam;
|
||||
uint32 m_GraveyardId;
|
||||
uint64 m_SpiritGuide[2];
|
||||
GuidSet m_ResurrectQueue;
|
||||
Battlefield* m_Bf;
|
||||
protected:
|
||||
TeamId m_ControlTeam;
|
||||
uint32 m_GraveyardId;
|
||||
uint64 m_SpiritGuide[2];
|
||||
GuidSet m_ResurrectQueue;
|
||||
Battlefield* m_Bf;
|
||||
};
|
||||
|
||||
class Battlefield : public ZoneScript
|
||||
{
|
||||
friend class BattlefieldMgr;
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
Battlefield();
|
||||
/// Destructor
|
||||
virtual ~Battlefield();
|
||||
public:
|
||||
/// Constructor
|
||||
Battlefield();
|
||||
/// Destructor
|
||||
virtual ~Battlefield();
|
||||
|
||||
/// typedef of map witch store capturepoint and the associate gameobject entry
|
||||
typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
|
||||
/// typedef of map witch store capturepoint and the associate gameobject entry
|
||||
typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
|
||||
|
||||
/// Call this to init the Battlefield
|
||||
virtual bool SetupBattlefield() { return true; }
|
||||
/// Call this to init the Battlefield
|
||||
virtual bool SetupBattlefield() { return true; }
|
||||
|
||||
/// Update data of a worldstate to all players present in zone
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
/// Update data of a worldstate to all players present in zone
|
||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||
|
||||
/**
|
||||
* \brief Called every time for update bf data and time
|
||||
* - Update timer for start/end battle
|
||||
* - Invite player in zone to queue m_StartGroupingTimer minutes before start
|
||||
* - Kick Afk players
|
||||
* \param diff : time ellapsed since last call (in ms)
|
||||
*/
|
||||
virtual bool Update(uint32 diff);
|
||||
/**
|
||||
* \brief Called every time for update bf data and time
|
||||
* - Update timer for start/end battle
|
||||
* - Invite player in zone to queue m_StartGroupingTimer minutes before start
|
||||
* - Kick Afk players
|
||||
* \param diff : time ellapsed since last call (in ms)
|
||||
*/
|
||||
virtual bool Update(uint32 diff);
|
||||
|
||||
/// Invite all players in zone to join the queue, called x minutes before battle start in Update()
|
||||
void InvitePlayersInZoneToQueue();
|
||||
/// Invite all players in queue to join battle on battle start
|
||||
void InvitePlayersInQueueToWar();
|
||||
/// Invite all players in zone to join battle on battle start
|
||||
void InvitePlayersInZoneToWar();
|
||||
/// Invite all players in zone to join the queue, called x minutes before battle start in Update()
|
||||
void InvitePlayersInZoneToQueue();
|
||||
/// Invite all players in queue to join battle on battle start
|
||||
void InvitePlayersInQueueToWar();
|
||||
/// Invite all players in zone to join battle on battle start
|
||||
void InvitePlayersInZoneToWar();
|
||||
|
||||
/// Called when a Unit is kill in battlefield zone
|
||||
virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
|
||||
/// Called when a Unit is kill in battlefield zone
|
||||
virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
|
||||
|
||||
uint32 GetTypeId() { return m_TypeId; }
|
||||
uint32 GetZoneId() { return m_ZoneId; }
|
||||
uint32 GetTypeId() { return m_TypeId; }
|
||||
uint32 GetZoneId() { return m_ZoneId; }
|
||||
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
|
||||
/// Return true if battle is start, false if battle is not started
|
||||
bool IsWarTime() { return m_isActive; }
|
||||
/// Return true if battle is start, false if battle is not started
|
||||
bool IsWarTime() { return m_isActive; }
|
||||
|
||||
/// Enable or Disable battlefield
|
||||
void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
|
||||
/// Return if battlefield is enable
|
||||
bool IsEnabled() { return m_IsEnabled; }
|
||||
/// Enable or Disable battlefield
|
||||
void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
|
||||
/// Return if battlefield is enable
|
||||
bool IsEnabled() { return m_IsEnabled; }
|
||||
|
||||
/**
|
||||
* \brief Kick player from battlefield and teleport him to kick-point location
|
||||
* \param guid : guid of player who must be kick
|
||||
*/
|
||||
void KickPlayerFromBattlefield(uint64 guid);
|
||||
/**
|
||||
* \brief Kick player from battlefield and teleport him to kick-point location
|
||||
* \param guid : guid of player who must be kick
|
||||
*/
|
||||
void KickPlayerFromBattlefield(uint64 guid);
|
||||
|
||||
/// Called when player (player) enter in zone
|
||||
void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
/// Called when player (player) leave the zone
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||
/// Called when player (player) enter in zone
|
||||
void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
/// Called when player (player) leave the zone
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||
|
||||
// All-purpose data storage 64 bit
|
||||
virtual uint64 GetData64(uint32 dataId) const { return m_Data64[dataId]; }
|
||||
virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
|
||||
// All-purpose data storage 64 bit
|
||||
virtual uint64 GetData64(uint32 dataId) const { return m_Data64[dataId]; }
|
||||
virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
|
||||
|
||||
// All-purpose data storage 32 bit
|
||||
virtual uint32 GetData(uint32 dataId) const { return m_Data32[dataId]; }
|
||||
virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
|
||||
virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
|
||||
// All-purpose data storage 32 bit
|
||||
virtual uint32 GetData(uint32 dataId) const { return m_Data32[dataId]; }
|
||||
virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
|
||||
virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
|
||||
|
||||
// Battlefield - generic methods
|
||||
TeamId GetDefenderTeam() { return m_DefenderTeam; }
|
||||
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
|
||||
TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
|
||||
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
|
||||
// Battlefield - generic methods
|
||||
TeamId GetDefenderTeam() { return m_DefenderTeam; }
|
||||
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
|
||||
TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
|
||||
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
|
||||
|
||||
// Group methods
|
||||
/**
|
||||
* \brief Find a not full battlefield group, if there is no, create one
|
||||
* \param TeamId : Id of player team for who we search a group (player->GetTeamId())
|
||||
*/
|
||||
Group* GetFreeBfRaid(TeamId TeamId);
|
||||
/// Return battlefield group where player is.
|
||||
Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
|
||||
/// Force player to join a battlefield group
|
||||
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
|
||||
// Group methods
|
||||
/**
|
||||
* \brief Find a not full battlefield group, if there is no, create one
|
||||
* \param TeamId : Id of player team for who we search a group (player->GetTeamId())
|
||||
*/
|
||||
Group* GetFreeBfRaid(TeamId TeamId);
|
||||
/// Return battlefield group where player is.
|
||||
Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
|
||||
/// Force player to join a battlefield group
|
||||
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
|
||||
|
||||
// Graveyard methods
|
||||
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
|
||||
GraveyardStruct const * GetClosestGraveyard(Player* player);
|
||||
// Graveyard methods
|
||||
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
|
||||
GraveyardStruct const* GetClosestGraveyard(Player* player);
|
||||
|
||||
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
||||
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
|
||||
BfGraveyard* GetGraveyardById(uint32 id) const;
|
||||
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
||||
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
|
||||
BfGraveyard* GetGraveyardById(uint32 id) const;
|
||||
|
||||
// Misc methods
|
||||
Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId teamId);
|
||||
Creature* SpawnCreature(uint32 entry, Position pos, TeamId teamId);
|
||||
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
||||
// Misc methods
|
||||
Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId teamId);
|
||||
Creature* SpawnCreature(uint32 entry, Position pos, TeamId teamId);
|
||||
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
||||
|
||||
// Script-methods
|
||||
// Script-methods
|
||||
|
||||
/// Called on start
|
||||
virtual void OnBattleStart() {};
|
||||
/// Called at the end of battle
|
||||
virtual void OnBattleEnd(bool /*endByTimer*/) {};
|
||||
/// Called x minutes before battle start when player in zone are invite to join queue
|
||||
virtual void OnStartGrouping() {};
|
||||
/// Called when a player accept to join the battle
|
||||
virtual void OnPlayerJoinWar(Player* /*player*/) {};
|
||||
/// Called when a player leave the battle
|
||||
virtual void OnPlayerLeaveWar(Player* /*player*/) {};
|
||||
/// Called when a player leave battlefield zone
|
||||
virtual void OnPlayerLeaveZone(Player* /*player*/) {};
|
||||
/// Called when a player enter in battlefield zone
|
||||
virtual void OnPlayerEnterZone(Player* /*player*/) {};
|
||||
/// Called on start
|
||||
virtual void OnBattleStart() {};
|
||||
/// Called at the end of battle
|
||||
virtual void OnBattleEnd(bool /*endByTimer*/) {};
|
||||
/// Called x minutes before battle start when player in zone are invite to join queue
|
||||
virtual void OnStartGrouping() {};
|
||||
/// Called when a player accept to join the battle
|
||||
virtual void OnPlayerJoinWar(Player* /*player*/) {};
|
||||
/// Called when a player leave the battle
|
||||
virtual void OnPlayerLeaveWar(Player* /*player*/) {};
|
||||
/// Called when a player leave battlefield zone
|
||||
virtual void OnPlayerLeaveZone(Player* /*player*/) {};
|
||||
/// Called when a player enter in battlefield zone
|
||||
virtual void OnPlayerEnterZone(Player* /*player*/) {};
|
||||
|
||||
void SendWarningToAllInZone(uint32 entry);
|
||||
void SendWarningToPlayer(Player* player, uint32 entry);
|
||||
void SendWarningToAllInZone(uint32 entry);
|
||||
void SendWarningToPlayer(Player* player, uint32 entry);
|
||||
|
||||
void PlayerAcceptInviteToQueue(Player* player);
|
||||
void PlayerAcceptInviteToWar(Player* player);
|
||||
uint32 GetBattleId() { return m_BattleId; }
|
||||
void AskToLeaveQueue(Player* player);
|
||||
void PlayerAskToLeave(Player* player);
|
||||
void PlayerAcceptInviteToQueue(Player* player);
|
||||
void PlayerAcceptInviteToWar(Player* player);
|
||||
uint32 GetBattleId() { return m_BattleId; }
|
||||
void AskToLeaveQueue(Player* player);
|
||||
void PlayerAskToLeave(Player* player);
|
||||
|
||||
//virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
|
||||
//virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
|
||||
|
||||
/// Send all worldstate data to all player in zone.
|
||||
virtual void SendInitWorldStatesToAll() = 0;
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0;
|
||||
/// Send all worldstate data to all player in zone.
|
||||
virtual void SendInitWorldStatesToAll() = 0;
|
||||
virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0;
|
||||
|
||||
/// Return if we can use mount in battlefield
|
||||
bool CanFlyIn() { return !m_isActive; }
|
||||
/// Return if we can use mount in battlefield
|
||||
bool CanFlyIn() { return !m_isActive; }
|
||||
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64& guid);
|
||||
|
||||
void StartBattle();
|
||||
void EndBattle(bool endByTimer);
|
||||
void StartBattle();
|
||||
void EndBattle(bool endByTimer);
|
||||
|
||||
void HideNpc(Creature* creature);
|
||||
void ShowNpc(Creature* creature, bool aggressive);
|
||||
void HideNpc(Creature* creature);
|
||||
void ShowNpc(Creature* creature, bool aggressive);
|
||||
|
||||
GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
|
||||
GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
|
||||
|
||||
uint32 GetTimer() { return m_Timer; }
|
||||
void SetTimer(uint32 timer) { m_Timer = timer; }
|
||||
uint32 GetTimer() { return m_Timer; }
|
||||
void SetTimer(uint32 timer) { m_Timer = timer; }
|
||||
|
||||
void DoPlaySoundToAll(uint32 SoundID);
|
||||
void DoPlaySoundToAll(uint32 SoundID);
|
||||
|
||||
void InvitePlayerToQueue(Player* player);
|
||||
void InvitePlayerToWar(Player* player);
|
||||
void InvitePlayerToQueue(Player* player);
|
||||
void InvitePlayerToWar(Player* player);
|
||||
|
||||
void InitStalker(uint32 entry, float x, float y, float z, float o);
|
||||
void InitStalker(uint32 entry, float x, float y, float z, float o);
|
||||
|
||||
protected:
|
||||
uint64 StalkerGuid;
|
||||
uint32 m_Timer; // Global timer for event
|
||||
bool m_IsEnabled;
|
||||
bool m_isActive;
|
||||
TeamId m_DefenderTeam;
|
||||
protected:
|
||||
uint64 StalkerGuid;
|
||||
uint32 m_Timer; // Global timer for event
|
||||
bool m_IsEnabled;
|
||||
bool m_isActive;
|
||||
TeamId m_DefenderTeam;
|
||||
|
||||
// Map of the objectives belonging to this OutdoorPvP
|
||||
BfCapturePointMap m_capturePoints;
|
||||
// Map of the objectives belonging to this OutdoorPvP
|
||||
BfCapturePointMap m_capturePoints;
|
||||
|
||||
// Players info maps
|
||||
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
|
||||
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
|
||||
// Players info maps
|
||||
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
|
||||
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
|
||||
|
||||
// Variables that must exist for each battlefield
|
||||
uint32 m_TypeId; // See enum BattlefieldTypes
|
||||
uint32 m_BattleId; // BattleID (for packet)
|
||||
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
|
||||
uint32 m_MapId; // MapId where is Battlefield
|
||||
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
|
||||
uint32 m_MinPlayer; // Minimum number of player for Battlefield start
|
||||
uint32 m_MinLevel; // Required level to participate at Battlefield
|
||||
uint32 m_BattleTime; // Length of a battle
|
||||
uint32 m_NoWarBattleTime; // Time between two battles
|
||||
uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
|
||||
uint32 m_TimeForAcceptInvite;
|
||||
uint32 m_uiKickDontAcceptTimer;
|
||||
WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
|
||||
// Variables that must exist for each battlefield
|
||||
uint32 m_TypeId; // See enum BattlefieldTypes
|
||||
uint32 m_BattleId; // BattleID (for packet)
|
||||
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
|
||||
uint32 m_MapId; // MapId where is Battlefield
|
||||
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
|
||||
uint32 m_MinPlayer; // Minimum number of player for Battlefield start
|
||||
uint32 m_MinLevel; // Required level to participate at Battlefield
|
||||
uint32 m_BattleTime; // Length of a battle
|
||||
uint32 m_NoWarBattleTime; // Time between two battles
|
||||
uint32 m_RestartAfterCrash; // Delay to restart Wintergrasp if the server crashed during a running battle.
|
||||
uint32 m_TimeForAcceptInvite;
|
||||
uint32 m_uiKickDontAcceptTimer;
|
||||
WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
|
||||
|
||||
uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
|
||||
uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
|
||||
|
||||
// Graveyard variables
|
||||
GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
|
||||
uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
|
||||
// Graveyard variables
|
||||
GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
|
||||
uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
|
||||
|
||||
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
|
||||
bool m_StartGrouping; // bool for know if all players in area has been invited
|
||||
uint32 m_StartGroupingTimer; // Timer for invite players in area 15 minute before start battle
|
||||
bool m_StartGrouping; // bool for know if all players in area has been invited
|
||||
|
||||
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
||||
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
||||
|
||||
std::vector<uint64> m_Data64;
|
||||
std::vector<uint32> m_Data32;
|
||||
std::vector<uint64> m_Data64;
|
||||
std::vector<uint32> m_Data32;
|
||||
|
||||
void KickAfkPlayers();
|
||||
void KickAfkPlayers();
|
||||
|
||||
// use for switch off all worldstate for client
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
// use for switch off all worldstate for client
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
|
||||
// use for send a packet for all player list
|
||||
void BroadcastPacketToZone(WorldPacket& data) const;
|
||||
void BroadcastPacketToQueue(WorldPacket& data) const;
|
||||
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||
// use for send a packet for all player list
|
||||
void BroadcastPacketToZone(WorldPacket& data) const;
|
||||
void BroadcastPacketToQueue(WorldPacket& data) const;
|
||||
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||
|
||||
// CapturePoint system
|
||||
void AddCapturePoint(BfCapturePoint* cp, GameObject* go) { m_capturePoints[go->GetEntry()] = cp; }
|
||||
// CapturePoint system
|
||||
void AddCapturePoint(BfCapturePoint* cp, GameObject* go) { m_capturePoints[go->GetEntry()] = cp; }
|
||||
|
||||
BfCapturePoint* GetCapturePoint(uint32 lowguid) const
|
||||
{
|
||||
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
||||
if (itr != m_capturePoints.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
BfCapturePoint* GetCapturePoint(uint32 lowguid) const
|
||||
{
|
||||
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
||||
if (itr != m_capturePoints.end())
|
||||
return itr->second;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void RegisterZone(uint32 zoneid);
|
||||
bool HasPlayer(Player* player) const;
|
||||
void TeamCastSpell(TeamId team, int32 spellId);
|
||||
void RegisterZone(uint32 zoneid);
|
||||
bool HasPlayer(Player* player) const;
|
||||
void TeamCastSpell(TeamId team, int32 spellId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
//Param3:(time) Time in second that the player have for accept
|
||||
void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint32 p_time)
|
||||
{
|
||||
//Send packet
|
||||
//Send packet
|
||||
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
|
||||
data << uint32(BattleId);
|
||||
data << uint32(ZoneId);
|
||||
@@ -49,22 +49,22 @@ void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
|
||||
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
|
||||
//Param3:(CanQueue) if able to queue
|
||||
//Param4:(Full) on log in is full
|
||||
void WorldSession::SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue, bool Full)
|
||||
void WorldSession::SendBfQueueInviteResponse(uint32 BattleId, uint32 ZoneId, bool CanQueue, bool Full)
|
||||
{
|
||||
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
|
||||
data << uint32(BattleId);
|
||||
data << uint32(ZoneId);
|
||||
data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
|
||||
data << uint8((CanQueue ? 1 : 0)); //Accepted //0 you cannot queue wg //1 you are queued
|
||||
data << uint8((Full ? 0 : 1)); //Logging In //0 wg full //1 queue for upcoming
|
||||
data << uint8(1); //Warmup
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
//This is call when player accept to join war
|
||||
//This is call when player accept to join war
|
||||
//Param1:(BattleId) the BattleId of Bf
|
||||
void WorldSession::SendBfEntered(uint32 BattleId)
|
||||
{
|
||||
// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
|
||||
// m_PlayerInWar[player->GetTeamId()].insert(player->GetGUID());
|
||||
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7);
|
||||
data << uint32(BattleId);
|
||||
data << uint8(1); //unk
|
||||
@@ -84,7 +84,7 @@ void WorldSession::SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason)
|
||||
}
|
||||
|
||||
//Send by client when he click on accept for queue
|
||||
void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recvData)
|
||||
void WorldSession::HandleBfQueueInviteResponse(WorldPacket& recvData)
|
||||
{
|
||||
uint32 BattleId;
|
||||
uint8 Accepted;
|
||||
@@ -102,7 +102,7 @@ void WorldSession::HandleBfQueueInviteResponse(WorldPacket & recvData)
|
||||
}
|
||||
|
||||
//Send by client on clicking in accept or refuse of invitation windows for join game
|
||||
void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recvData)
|
||||
void WorldSession::HandleBfEntryInviteResponse(WorldPacket& recvData)
|
||||
{
|
||||
uint32 BattleId;
|
||||
uint8 Accepted;
|
||||
@@ -125,7 +125,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recvData)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleBfExitRequest(WorldPacket & recvData)
|
||||
void WorldSession::HandleBfExitRequest(WorldPacket& recvData)
|
||||
{
|
||||
uint32 BattleId;
|
||||
|
||||
|
||||
@@ -50,26 +50,26 @@ void BattlefieldMgr::InitBattlefield()
|
||||
// respawn, init variables
|
||||
if(!pBf->SetupBattlefield())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad init failed.");
|
||||
#endif
|
||||
#endif
|
||||
delete pBf;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_BattlefieldSet.push_back(pBf);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Battlefield : Tol Barad successfully initiated.");
|
||||
#endif
|
||||
#endif
|
||||
} */
|
||||
}
|
||||
|
||||
void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield *handle)
|
||||
void BattlefieldMgr::AddZone(uint32 zoneid, Battlefield* handle)
|
||||
{
|
||||
m_BattlefieldMap[zoneid] = handle;
|
||||
}
|
||||
|
||||
void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
|
||||
void BattlefieldMgr::HandlePlayerEnterZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
|
||||
if (itr == m_BattlefieldMap.end())
|
||||
@@ -84,7 +84,7 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
|
||||
#endif
|
||||
}
|
||||
|
||||
void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
|
||||
void BattlefieldMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneid)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
|
||||
if (itr == m_BattlefieldMap.end())
|
||||
@@ -99,7 +99,7 @@ void BattlefieldMgr::HandlePlayerLeaveZone(Player * player, uint32 zoneid)
|
||||
#endif
|
||||
}
|
||||
|
||||
Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
|
||||
Battlefield* BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneid);
|
||||
if (itr == m_BattlefieldMap.end())
|
||||
@@ -112,7 +112,7 @@ Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
Battlefield *BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
|
||||
Battlefield* BattlefieldMgr::GetBattlefieldByBattleId(uint32 battleid)
|
||||
{
|
||||
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
|
||||
{
|
||||
@@ -129,12 +129,12 @@ void BattlefieldMgr::Update(uint32 diff)
|
||||
{
|
||||
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
|
||||
//if ((*itr)->IsEnabled())
|
||||
(*itr)->Update(m_UpdateTimer);
|
||||
(*itr)->Update(m_UpdateTimer);
|
||||
m_UpdateTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ZoneScript *BattlefieldMgr::GetZoneScript(uint32 zoneId)
|
||||
ZoneScript* BattlefieldMgr::GetZoneScript(uint32 zoneId)
|
||||
{
|
||||
BattlefieldMap::iterator itr = m_BattlefieldMap.find(zoneId);
|
||||
if (itr != m_BattlefieldMap.end())
|
||||
|
||||
@@ -18,7 +18,7 @@ struct GossipMenuItems;
|
||||
// class to handle player enter / leave / areatrigger / GO use events
|
||||
class BattlefieldMgr
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// ctor
|
||||
BattlefieldMgr();
|
||||
// dtor
|
||||
@@ -29,33 +29,33 @@ class BattlefieldMgr
|
||||
// create battlefield events
|
||||
void InitBattlefield();
|
||||
// called when a player enters an battlefield area
|
||||
void HandlePlayerEnterZone(Player * player, uint32 areaflag);
|
||||
void HandlePlayerEnterZone(Player* player, uint32 areaflag);
|
||||
// called when player leaves an battlefield area
|
||||
void HandlePlayerLeaveZone(Player * player, uint32 areaflag);
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 areaflag);
|
||||
// called when player resurrects
|
||||
void HandlePlayerResurrects(Player * player, uint32 areaflag);
|
||||
void HandlePlayerResurrects(Player* player, uint32 areaflag);
|
||||
// return assigned battlefield
|
||||
Battlefield* GetBattlefieldToZoneId(uint32 zoneid);
|
||||
Battlefield* GetBattlefieldByBattleId(uint32 battleid);
|
||||
|
||||
ZoneScript* GetZoneScript(uint32 zoneId);
|
||||
|
||||
void AddZone(uint32 zoneid, Battlefield * handle);
|
||||
void AddZone(uint32 zoneid, Battlefield* handle);
|
||||
|
||||
void Update(uint32 diff);
|
||||
|
||||
void HandleGossipOption(Player * player, uint64 guid, uint32 gossipid);
|
||||
void HandleGossipOption(Player* player, uint64 guid, uint32 gossipid);
|
||||
|
||||
bool CanTalkTo(Player * player, Creature * creature, GossipMenuItems gso);
|
||||
bool CanTalkTo(Player* player, Creature* creature, GossipMenuItems gso);
|
||||
|
||||
void HandleDropFlag(Player * player, uint32 spellId);
|
||||
void HandleDropFlag(Player* player, uint32 spellId);
|
||||
|
||||
typedef std::vector < Battlefield * >BattlefieldSet;
|
||||
typedef std::map < uint32 /* zoneid */ , Battlefield * >BattlefieldMap;
|
||||
private:
|
||||
typedef std::vector < Battlefield* >BattlefieldSet;
|
||||
typedef std::map < uint32 /* zoneid */, Battlefield* >BattlefieldMap;
|
||||
private:
|
||||
// contains all initiated battlefield events
|
||||
// used when initing / cleaning up
|
||||
BattlefieldSet m_BattlefieldSet;
|
||||
BattlefieldSet m_BattlefieldSet;
|
||||
// maps the zone ids to an battlefield event
|
||||
// used in player event handling
|
||||
BattlefieldMap m_BattlefieldMap;
|
||||
|
||||
@@ -386,7 +386,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
||||
// Update portal defender faction
|
||||
for (GameObjectSet::const_iterator itr = DefenderPortalList.begin(); itr != DefenderPortalList.end(); ++itr)
|
||||
(*itr)->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
|
||||
|
||||
|
||||
// Saving data
|
||||
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
|
||||
{
|
||||
@@ -433,7 +433,7 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
||||
{
|
||||
// Victory in Wintergrasp
|
||||
player->AreaExploredOrEventHappens(GetDefenderTeam() ? 13183 : 13181); // HORDE / ALLY win wg quest id
|
||||
|
||||
|
||||
player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
|
||||
player->CastSpell(player, SPELL_VICTORY_REWARD, true);
|
||||
RemoveAurasFromPlayer(player);
|
||||
@@ -542,17 +542,17 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
|
||||
{
|
||||
case NPC_DWARVEN_SPIRIT_GUIDE:
|
||||
case NPC_TAUNKA_SPIRIT_GUIDE:
|
||||
{
|
||||
TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId(true));
|
||||
// xinef: little workaround, there are 2 spirit guides in same area
|
||||
if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f))
|
||||
graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW;
|
||||
{
|
||||
TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId(true));
|
||||
// xinef: little workaround, there are 2 spirit guides in same area
|
||||
if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f))
|
||||
graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW;
|
||||
|
||||
if (m_GraveyardList[graveyardId])
|
||||
m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
|
||||
break;
|
||||
}
|
||||
if (m_GraveyardList[graveyardId])
|
||||
m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// untested code - not sure if it is valid.
|
||||
@@ -564,92 +564,92 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
{
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
|
||||
Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
|
||||
if (!creator)
|
||||
return;
|
||||
TeamId team = creator->GetTeamId();
|
||||
|
||||
if (team == TEAM_HORDE)
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
|
||||
Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
|
||||
if (!creator)
|
||||
return;
|
||||
TeamId team = creator->GetTeamId();
|
||||
|
||||
if (team == TEAM_HORDE)
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
|
||||
creature->CastSpell(creature, SPELL_HORDE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
|
||||
creature->CastSpell(creature, SPELL_HORDE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
|
||||
creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) < GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
|
||||
{
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
|
||||
creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
else
|
||||
{
|
||||
creature->DespawnOrUnsummon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE:
|
||||
{
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
{
|
||||
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
|
||||
return;
|
||||
|
||||
if (Unit* owner = creature->ToTempSummon()->GetSummoner())
|
||||
creature->setFaction(owner->getFaction());
|
||||
break;
|
||||
}
|
||||
if (Unit* owner = creature->ToTempSummon()->GetSummoner())
|
||||
creature->setFaction(owner->getFaction());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnCreatureRemove(Creature* /*creature*/)
|
||||
{
|
||||
/* possibly can be used later
|
||||
if (IsWarTime())
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
/* possibly can be used later
|
||||
if (IsWarTime())
|
||||
{
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
uint8 team;
|
||||
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||
team = TEAM_ALLIANCE;
|
||||
else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
|
||||
team = TEAM_HORDE;
|
||||
else
|
||||
return;
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_HORDE:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
{
|
||||
uint8 team;
|
||||
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||
team = TEAM_ALLIANCE;
|
||||
else if (creature->getFaction() == WintergraspFaction[TEAM_HORDE])
|
||||
team = TEAM_HORDE;
|
||||
else
|
||||
return;
|
||||
|
||||
m_vehicles[team].erase(creature->GetGUID());
|
||||
if (team == TEAM_HORDE)
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
|
||||
else
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
|
||||
UpdateVehicleCountWG();
|
||||
m_vehicles[team].erase(creature->GetGUID());
|
||||
if (team == TEAM_HORDE)
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
|
||||
else
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
|
||||
UpdateVehicleCountWG();
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}*/
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnGameObjectCreate(GameObject* go)
|
||||
@@ -729,9 +729,9 @@ bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
|
||||
{
|
||||
//m_vehicles[itr].erase(vehicle->GetGUID());
|
||||
if (itr == TEAM_HORDE)
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H,-1);
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
|
||||
else
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A,-1);
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -813,7 +813,7 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player)
|
||||
else
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0)
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
|
||||
}
|
||||
SendInitWorldStatesTo(player);
|
||||
}
|
||||
@@ -927,15 +927,15 @@ void BattlefieldWG::SendInitWorldStatesToAll()
|
||||
|
||||
void BattlefieldWG::BrokenWallOrTower(TeamId /*team*/)
|
||||
{
|
||||
// might be some use for this in the future. old code commented out below. KL
|
||||
/* if (team == GetDefenderTeam())
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
// might be some use for this in the future. old code commented out below. KL
|
||||
/* if (team == GetDefenderTeam())
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
|
||||
}
|
||||
}*/
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
{
|
||||
if (Player* player = ObjectAccessor::FindPlayer(*itr))
|
||||
IncrementQuest(player, WGQuest[player->GetTeamId()][2], true);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// Called when a tower is broke
|
||||
@@ -989,7 +989,7 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go)
|
||||
}
|
||||
}
|
||||
|
||||
void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
|
||||
void BattlefieldWG::ProcessEvent(WorldObject* obj, uint32 eventId)
|
||||
{
|
||||
if (!obj || !IsWarTime())
|
||||
return;
|
||||
@@ -1004,7 +1004,7 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
|
||||
{
|
||||
if (CanInteractWithRelic())
|
||||
EndBattle(false);
|
||||
else if (GameObject*go = GetRelic())
|
||||
else if (GameObject* go = GetRelic())
|
||||
go->SetRespawnTime(RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,13 +122,13 @@ enum WintergraspAreaIds
|
||||
|
||||
class BfGraveyardWG : public BfGraveyard
|
||||
{
|
||||
public:
|
||||
BfGraveyardWG(BattlefieldWG *Bf);
|
||||
public:
|
||||
BfGraveyardWG(BattlefieldWG* Bf);
|
||||
|
||||
void SetTextId(uint32 textid) { m_GossipTextId = textid; }
|
||||
uint32 GetTextId() { return m_GossipTextId; }
|
||||
protected:
|
||||
uint32 m_GossipTextId;
|
||||
void SetTextId(uint32 textid) { m_GossipTextId = textid; }
|
||||
uint32 GetTextId() { return m_GossipTextId; }
|
||||
protected:
|
||||
uint32 m_GossipTextId;
|
||||
};
|
||||
|
||||
enum WGGraveyardId
|
||||
@@ -222,12 +222,14 @@ struct BfWGCoordGY
|
||||
TeamId startcontrol;
|
||||
};
|
||||
|
||||
const uint32 WGQuest[2][6] = {
|
||||
const uint32 WGQuest[2][6] =
|
||||
{
|
||||
{ 13186, 13181, 13222, 13538, 13177, 13179 },
|
||||
{ 13185, 13183, 13223, 13539, 13178, 13180 },
|
||||
};
|
||||
// 7 in sql, 7 in header
|
||||
const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = {
|
||||
const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] =
|
||||
{
|
||||
{ 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL },
|
||||
{ 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL },
|
||||
{ 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL },
|
||||
@@ -243,16 +245,16 @@ const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = {
|
||||
|
||||
class WintergraspCapturePoint : public BfCapturePoint
|
||||
{
|
||||
public:
|
||||
WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
|
||||
public:
|
||||
WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
|
||||
|
||||
void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
|
||||
void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
|
||||
|
||||
void ChangeTeam(TeamId oldteam);
|
||||
TeamId GetTeam() const { return m_team; }
|
||||
void ChangeTeam(TeamId oldteam);
|
||||
TeamId GetTeam() const { return m_team; }
|
||||
|
||||
protected:
|
||||
WGWorkshop* m_Workshop;
|
||||
protected:
|
||||
WGWorkshop* m_Workshop;
|
||||
};
|
||||
|
||||
/* ######################### *
|
||||
@@ -261,206 +263,206 @@ class WintergraspCapturePoint : public BfCapturePoint
|
||||
|
||||
class BattlefieldWG : public Battlefield
|
||||
{
|
||||
public:
|
||||
~BattlefieldWG();
|
||||
/**
|
||||
* \brief Called when the battle start
|
||||
* - Spawn relic and turret
|
||||
* - Rebuild tower and wall
|
||||
* - Invite player to war
|
||||
*/
|
||||
void OnBattleStart();
|
||||
public:
|
||||
~BattlefieldWG();
|
||||
/**
|
||||
* \brief Called when the battle start
|
||||
* - Spawn relic and turret
|
||||
* - Rebuild tower and wall
|
||||
* - Invite player to war
|
||||
*/
|
||||
void OnBattleStart();
|
||||
|
||||
/**
|
||||
* \brief Called when battle end
|
||||
* - Remove relic and turret
|
||||
* - Change banner/npc in keep if it needed
|
||||
* - Saving battlestate
|
||||
* - Reward honor/mark to player
|
||||
* - Remove vehicle
|
||||
* \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
|
||||
*/
|
||||
void OnBattleEnd(bool endByTimer);
|
||||
/**
|
||||
* \brief Called when battle end
|
||||
* - Remove relic and turret
|
||||
* - Change banner/npc in keep if it needed
|
||||
* - Saving battlestate
|
||||
* - Reward honor/mark to player
|
||||
* - Remove vehicle
|
||||
* \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
|
||||
*/
|
||||
void OnBattleEnd(bool endByTimer);
|
||||
|
||||
/**
|
||||
* \brief Called when grouping starts (15 minutes before battlestart)
|
||||
* - Invite all player in zone to join queue
|
||||
*/
|
||||
void OnStartGrouping();
|
||||
/**
|
||||
* \brief Called when grouping starts (15 minutes before battlestart)
|
||||
* - Invite all player in zone to join queue
|
||||
*/
|
||||
void OnStartGrouping();
|
||||
|
||||
/**
|
||||
* \brief Called when player accept invite to join battle
|
||||
* - Update aura
|
||||
* - Teleport if it needed
|
||||
* - Update worldstate
|
||||
* - Update tenacity
|
||||
* \param player: Player who accepted invite
|
||||
*/
|
||||
void OnPlayerJoinWar(Player* player);
|
||||
/**
|
||||
* \brief Called when player accept invite to join battle
|
||||
* - Update aura
|
||||
* - Teleport if it needed
|
||||
* - Update worldstate
|
||||
* - Update tenacity
|
||||
* \param player: Player who accepted invite
|
||||
*/
|
||||
void OnPlayerJoinWar(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player left the battle
|
||||
* - Update player aura
|
||||
* \param player : Player who left the battle
|
||||
*/
|
||||
void OnPlayerLeaveWar(Player* player);
|
||||
/**
|
||||
* \brief Called when player left the battle
|
||||
* - Update player aura
|
||||
* \param player : Player who left the battle
|
||||
*/
|
||||
void OnPlayerLeaveWar(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player left the WG zone
|
||||
* \param player : Player who left the zone
|
||||
*/
|
||||
void OnPlayerLeaveZone(Player* player);
|
||||
/**
|
||||
* \brief Called when player left the WG zone
|
||||
* \param player : Player who left the zone
|
||||
*/
|
||||
void OnPlayerLeaveZone(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player enters in WG zone
|
||||
* - Update aura
|
||||
* - Update worldstate
|
||||
* \param player : Player who enters the zone
|
||||
*/
|
||||
void OnPlayerEnterZone(Player* player);
|
||||
/**
|
||||
* \brief Called when player enters in WG zone
|
||||
* - Update aura
|
||||
* - Update worldstate
|
||||
* \param player : Player who enters the zone
|
||||
*/
|
||||
void OnPlayerEnterZone(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called for update battlefield data
|
||||
* - Save battle timer in database every minutes
|
||||
* - Update imunity aura from graveyard
|
||||
* \param diff : time elapsed since the last call (in ms)
|
||||
*/
|
||||
bool Update(uint32 diff);
|
||||
/**
|
||||
* \brief Called for update battlefield data
|
||||
* - Save battle timer in database every minutes
|
||||
* - Update imunity aura from graveyard
|
||||
* \param diff : time elapsed since the last call (in ms)
|
||||
*/
|
||||
bool Update(uint32 diff);
|
||||
|
||||
/**
|
||||
* \brief Called when a creature is created
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureCreate(Creature* creature);
|
||||
/**
|
||||
* \brief Called when a creature is created
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureCreate(Creature* creature);
|
||||
|
||||
/**
|
||||
* \brief Called when a creature is removed
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureRemove(Creature* creature);
|
||||
/**
|
||||
* \brief Called when a creature is removed
|
||||
* - Update vehicle count
|
||||
*/
|
||||
void OnCreatureRemove(Creature* creature);
|
||||
|
||||
/**
|
||||
* \brief Called when a gameobject is created
|
||||
*/
|
||||
void OnGameObjectCreate(GameObject* go);
|
||||
/**
|
||||
* \brief Called when a gameobject is created
|
||||
*/
|
||||
void OnGameObjectCreate(GameObject* go);
|
||||
|
||||
/**
|
||||
* \brief Called when a wall/tower is broken
|
||||
* - Update quest
|
||||
*/
|
||||
void BrokenWallOrTower(TeamId team);
|
||||
/**
|
||||
* \brief Called when a wall/tower is broken
|
||||
* - Update quest
|
||||
*/
|
||||
void BrokenWallOrTower(TeamId team);
|
||||
|
||||
/**
|
||||
* \brief Called when a tower is damaged
|
||||
* - Update tower count (for reward calcul)
|
||||
*/
|
||||
void UpdateDamagedTowerCount(TeamId team);
|
||||
/**
|
||||
* \brief Called when a tower is damaged
|
||||
* - Update tower count (for reward calcul)
|
||||
*/
|
||||
void UpdateDamagedTowerCount(TeamId team);
|
||||
|
||||
/**
|
||||
* \brief Called when tower is broken
|
||||
* - Update tower buff
|
||||
* - check if three south tower is down for remove 10 minutes to wg
|
||||
*/
|
||||
void UpdatedDestroyedTowerCount(TeamId team, GameObject* go);
|
||||
/**
|
||||
* \brief Called when tower is broken
|
||||
* - Update tower buff
|
||||
* - check if three south tower is down for remove 10 minutes to wg
|
||||
*/
|
||||
void UpdatedDestroyedTowerCount(TeamId team, GameObject* go);
|
||||
|
||||
//void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
|
||||
|
||||
void RemoveAurasFromPlayer(Player* player);
|
||||
//void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
|
||||
|
||||
/**
|
||||
* \brief Called when battlefield is setup, at server start
|
||||
*/
|
||||
bool SetupBattlefield();
|
||||
void RemoveAurasFromPlayer(Player* player);
|
||||
|
||||
/// Return pointer to relic object
|
||||
GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); }
|
||||
/**
|
||||
* \brief Called when battlefield is setup, at server start
|
||||
*/
|
||||
bool SetupBattlefield();
|
||||
|
||||
/// Define relic object
|
||||
//void SetRelic(GameObject* relic) { m_titansRelic = relic; }
|
||||
/// Return pointer to relic object
|
||||
GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); }
|
||||
|
||||
/// Check if players can interact with the relic (Only if the last door has been broken)
|
||||
bool CanInteractWithRelic() { return m_isRelicInteractible; }
|
||||
/// Define relic object
|
||||
//void SetRelic(GameObject* relic) { m_titansRelic = relic; }
|
||||
|
||||
/// Define if player can interact with the relic
|
||||
void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
|
||||
/// Check if players can interact with the relic (Only if the last door has been broken)
|
||||
bool CanInteractWithRelic() { return m_isRelicInteractible; }
|
||||
|
||||
/// Vehicle world states update
|
||||
void UpdateCounterVehicle(bool init);
|
||||
void UpdateVehicleCountWG();
|
||||
void CapturePointTaken(uint32 areaId);
|
||||
/// Define if player can interact with the relic
|
||||
void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
|
||||
|
||||
void SendInitWorldStatesTo(Player* player);
|
||||
void SendInitWorldStatesToAll();
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
/// Vehicle world states update
|
||||
void UpdateCounterVehicle(bool init);
|
||||
void UpdateVehicleCountWG();
|
||||
void CapturePointTaken(uint32 areaId);
|
||||
|
||||
void HandleKill(Player* killer, Unit* victim);
|
||||
void OnUnitDeath(Unit* unit);
|
||||
void PromotePlayer(Player* killer);
|
||||
void SendInitWorldStatesTo(Player* player);
|
||||
void SendInitWorldStatesToAll();
|
||||
void FillInitialWorldStates(WorldPacket& data);
|
||||
|
||||
uint32 GetHonorBuff(int32 stack) const;
|
||||
void UpdateTenacity();
|
||||
void AddUpdateTenacity(Player* player);
|
||||
void RemoveUpdateTenacity(Player* player);
|
||||
void ProcessEvent(WorldObject *obj, uint32 eventId);
|
||||
void HandleKill(Player* killer, Unit* victim);
|
||||
void OnUnitDeath(Unit* unit);
|
||||
void PromotePlayer(Player* killer);
|
||||
|
||||
bool FindAndRemoveVehicleFromList(Unit* vehicle);
|
||||
uint32 GetHonorBuff(int32 stack) const;
|
||||
void UpdateTenacity();
|
||||
void AddUpdateTenacity(Player* player);
|
||||
void RemoveUpdateTenacity(Player* player);
|
||||
void ProcessEvent(WorldObject* obj, uint32 eventId);
|
||||
|
||||
// returns the graveyardId in the specified area.
|
||||
uint8 GetSpiritGraveyardId(uint32 areaId) const;
|
||||
uint32 GetAreaByGraveyardId(uint8 gId) const;
|
||||
bool FindAndRemoveVehicleFromList(Unit* vehicle);
|
||||
|
||||
uint32 GetData(uint32 data) const;
|
||||
// returns the graveyardId in the specified area.
|
||||
uint8 GetSpiritGraveyardId(uint32 areaId) const;
|
||||
uint32 GetAreaByGraveyardId(uint8 gId) const;
|
||||
|
||||
bool IsKeepNpc(uint32 entry)
|
||||
uint32 GetData(uint32 data) const;
|
||||
|
||||
bool IsKeepNpc(uint32 entry)
|
||||
{
|
||||
switch (entry)
|
||||
{
|
||||
switch (entry)
|
||||
{
|
||||
case BATTLEFIELD_WG_NPC_GUARD_H:
|
||||
case BATTLEFIELD_WG_NPC_GUARD_A:
|
||||
case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER:
|
||||
case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH:
|
||||
case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR:
|
||||
case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON:
|
||||
case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN:
|
||||
case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA:
|
||||
case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI:
|
||||
case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS:
|
||||
case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER:
|
||||
case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL:
|
||||
case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF:
|
||||
case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE:
|
||||
case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT:
|
||||
case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA:
|
||||
case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP:
|
||||
case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case BATTLEFIELD_WG_NPC_GUARD_H:
|
||||
case BATTLEFIELD_WG_NPC_GUARD_A:
|
||||
case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER:
|
||||
case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH:
|
||||
case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR:
|
||||
case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON:
|
||||
case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN:
|
||||
case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA:
|
||||
case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI:
|
||||
case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH:
|
||||
case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH:
|
||||
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS:
|
||||
case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER:
|
||||
case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL:
|
||||
case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF:
|
||||
case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE:
|
||||
case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT:
|
||||
case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA:
|
||||
case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP:
|
||||
case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO:
|
||||
return true;
|
||||
}
|
||||
protected:
|
||||
bool m_isRelicInteractible;
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
bool m_isRelicInteractible;
|
||||
|
||||
Workshop WorkshopsList;
|
||||
Workshop WorkshopsList;
|
||||
|
||||
GameObjectSet DefenderPortalList;
|
||||
GameObjectSet m_KeepGameObject[2];
|
||||
GameObjectBuilding BuildingsInZone;
|
||||
GameObjectSet DefenderPortalList;
|
||||
GameObjectSet m_KeepGameObject[2];
|
||||
GameObjectBuilding BuildingsInZone;
|
||||
|
||||
GuidSet m_vehicles[2];
|
||||
GuidSet CanonList;
|
||||
GuidSet KeepCreature[2];
|
||||
GuidSet OutsideCreature[2];
|
||||
GuidSet m_updateTenacityList;
|
||||
GuidSet m_vehicles[2];
|
||||
GuidSet CanonList;
|
||||
GuidSet KeepCreature[2];
|
||||
GuidSet OutsideCreature[2];
|
||||
GuidSet m_updateTenacityList;
|
||||
|
||||
int32 m_tenacityStack;
|
||||
uint32 m_tenacityUpdateTimer;
|
||||
uint32 m_saveTimer;
|
||||
int32 m_tenacityStack;
|
||||
uint32 m_tenacityUpdateTimer;
|
||||
uint32 m_saveTimer;
|
||||
|
||||
uint64 m_titansRelic;
|
||||
uint64 m_titansRelic;
|
||||
};
|
||||
|
||||
const uint8 WG_MAX_OBJ = 32;
|
||||
@@ -593,7 +595,8 @@ struct WintergraspBuildingSpawnData
|
||||
uint32 destroyText;
|
||||
};
|
||||
|
||||
const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = {
|
||||
const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] =
|
||||
{
|
||||
// Wall (Not spawned in db)
|
||||
// Entry WS X Y Z O type NameID
|
||||
{ 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0, 0 },
|
||||
@@ -640,7 +643,8 @@ const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = {
|
||||
{ 191810, 3773, 5397.11f, 2841.54f, 425.899f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST, 0, 0 },
|
||||
};
|
||||
|
||||
const Position WGTurret[WG_MAX_TURRET] = {
|
||||
const Position WGTurret[WG_MAX_TURRET] =
|
||||
{
|
||||
{ 5391.19f, 3060.8f, 419.616f, 1.69557f },
|
||||
{ 5266.75f, 2976.5f, 421.067f, 3.20354f },
|
||||
{ 5234.86f, 2948.8f, 420.88f, 1.61311f },
|
||||
@@ -784,7 +788,8 @@ struct WintergraspTowerData
|
||||
uint8 const WG_MAX_ATTACKTOWERS = 3;
|
||||
// 192414 : 0 in sql, 1 in header
|
||||
// 192278 : 0 in sql, 3 in header
|
||||
const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = {
|
||||
const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] =
|
||||
{
|
||||
// West tower
|
||||
{
|
||||
190356,
|
||||
@@ -1072,7 +1077,7 @@ const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] =
|
||||
// Structure for different buildings that can be destroyed during battle
|
||||
struct BfWGGameObjectBuilding
|
||||
{
|
||||
BfWGGameObjectBuilding(BattlefieldWG *WG)
|
||||
BfWGGameObjectBuilding(BattlefieldWG* WG)
|
||||
{
|
||||
m_WG = WG;
|
||||
m_Team = TEAM_ALLIANCE;
|
||||
@@ -1088,7 +1093,7 @@ struct BfWGGameObjectBuilding
|
||||
TeamId m_Team;
|
||||
|
||||
// WG object
|
||||
BattlefieldWG *m_WG;
|
||||
BattlefieldWG* m_WG;
|
||||
|
||||
// Linked gameobject
|
||||
uint64 m_Build;
|
||||
@@ -1206,7 +1211,7 @@ struct BfWGGameObjectBuilding
|
||||
m_WG->BrokenWallOrTower(TeamId(m_Team));
|
||||
}
|
||||
|
||||
void Init(GameObject *gobj, uint32 type, uint32 worldstate, uint8 damageText, uint8 destroyText)
|
||||
void Init(GameObject* gobj, uint32 type, uint32 worldstate, uint8 damageText, uint8 destroyText)
|
||||
{
|
||||
// GameObject associated to object
|
||||
m_Build = gobj->GetGUID();
|
||||
@@ -1335,7 +1340,7 @@ struct BfWGGameObjectBuilding
|
||||
{
|
||||
Position towerCannonPos;
|
||||
TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos);
|
||||
if (Creature *turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
|
||||
if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
|
||||
{
|
||||
m_TurretTopList.insert(turret->GetGUID());
|
||||
m_WG->HideNpc(turret);
|
||||
@@ -1459,31 +1464,31 @@ struct WGWorkshop
|
||||
switch (team)
|
||||
{
|
||||
case TEAM_NEUTRAL:
|
||||
{
|
||||
// Send warning message to all player to inform a faction attack to a workshop
|
||||
// alliance / horde attacking a workshop
|
||||
bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
|
||||
break;
|
||||
}
|
||||
{
|
||||
// Send warning message to all player to inform a faction attack to a workshop
|
||||
// alliance / horde attacking a workshop
|
||||
bf->SendWarningToAllInZone(teamControl ? WorkshopsData[workshopId].attackText : (WorkshopsData[workshopId].attackText + 2));
|
||||
break;
|
||||
}
|
||||
case TEAM_ALLIANCE:
|
||||
case TEAM_HORDE:
|
||||
{
|
||||
// Updating worldstate
|
||||
state = team == TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
|
||||
bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
|
||||
{
|
||||
// Updating worldstate
|
||||
state = team == TEAM_ALLIANCE ? BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT : BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT;
|
||||
bf->SendUpdateWorldState(WorkshopsData[workshopId].worldstate, state);
|
||||
|
||||
// Warning message
|
||||
if (!init) // workshop taken - alliance
|
||||
bf->SendWarningToAllInZone(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
|
||||
// Warning message
|
||||
if (!init) // workshop taken - alliance
|
||||
bf->SendWarningToAllInZone(team == TEAM_ALLIANCE ? WorkshopsData[workshopId].takenText : (WorkshopsData[workshopId].takenText + 2));
|
||||
|
||||
// Found associate graveyard and update it
|
||||
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
if (bf->GetGraveyardById(workshopId))
|
||||
bf->GetGraveyardById(workshopId)->GiveControlTo(team);
|
||||
// Found associate graveyard and update it
|
||||
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
if (bf->GetGraveyardById(workshopId))
|
||||
bf->GetGraveyardById(workshopId)->GiveControlTo(team);
|
||||
|
||||
teamControl = team;
|
||||
break;
|
||||
}
|
||||
teamControl = team;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!init)
|
||||
|
||||
Reference in New Issue
Block a user