Battlefield/Wintergrasp:
* Use correct spells on losing and winning factions * Enums renaming, lowerCamelCase wherever applicable * Rename some methods and class attributes for them to sound more English and less Engrish or even Frenglish (\o/) * Use correct spells when trying to build mechanical units at the Workshops.
This commit is contained in:
@@ -32,12 +32,11 @@
|
|||||||
#include "CreatureTextMgr.h"
|
#include "CreatureTextMgr.h"
|
||||||
#include "GroupMgr.h"
|
#include "GroupMgr.h"
|
||||||
|
|
||||||
|
|
||||||
Battlefield::Battlefield()
|
Battlefield::Battlefield()
|
||||||
{
|
{
|
||||||
m_Timer = 0;
|
m_Timer = 0;
|
||||||
m_enable = true;
|
m_IsEnabled = true;
|
||||||
m_BattlefieldActive = false;
|
m_isActive = false;
|
||||||
m_DefenderTeam = TEAM_NEUTRAL;
|
m_DefenderTeam = TEAM_NEUTRAL;
|
||||||
|
|
||||||
m_TypeId = 0;
|
m_TypeId = 0;
|
||||||
@@ -51,7 +50,7 @@ Battlefield::Battlefield()
|
|||||||
m_TimeForAcceptInvite = 20;
|
m_TimeForAcceptInvite = 20;
|
||||||
m_uiKickDontAcceptTimer = 1000;
|
m_uiKickDontAcceptTimer = 1000;
|
||||||
|
|
||||||
m_uiKickAfkTimer = 1000;
|
m_uiKickAfkPlayersTimer = 1000;
|
||||||
|
|
||||||
m_LastResurectTimer = 30 * IN_MILLISECONDS;
|
m_LastResurectTimer = 30 * IN_MILLISECONDS;
|
||||||
m_StartGroupingTimer = 0;
|
m_StartGroupingTimer = 0;
|
||||||
@@ -63,50 +62,49 @@ Battlefield::~Battlefield()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::HandlePlayerEnterZone(Player *player, uint32 /*zone */ )
|
// Called when a player enters the zone
|
||||||
|
void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||||
{
|
{
|
||||||
//If battle is start,
|
// If battle is started,
|
||||||
// if it not fully > invite player to join the war
|
// If not full of players > invite player to join the war
|
||||||
// if it fully > announce to player that BF is full and kick after few second if he dont leave
|
// 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())
|
if (IsWarTime())
|
||||||
{
|
{
|
||||||
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) //Not fully
|
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces
|
||||||
{
|
|
||||||
InvitePlayerToWar(player);
|
InvitePlayerToWar(player);
|
||||||
}
|
else // No more vacant places
|
||||||
else //Full
|
|
||||||
{
|
{
|
||||||
//TODO:Send packet for announce it to player
|
// TODO: Send a packet to announce it to player
|
||||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
||||||
InvitePlayerToQueue(player);
|
InvitePlayerToQueue(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//If time left is <15 minutes invite player to join queue
|
// If time left is < 15 minutes invite player to join queue
|
||||||
if (m_Timer <= m_StartGroupingTimer)
|
if (m_Timer <= m_StartGroupingTimer)
|
||||||
InvitePlayerToQueue(player);
|
InvitePlayerToQueue(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add player in list of player in zone
|
// Add player in the list of player in zone
|
||||||
m_players[player->GetTeamId()].insert(player->GetGUID());
|
m_players[player->GetTeamId()].insert(player->GetGUID());
|
||||||
OnPlayerEnterZone(player); //for scripting
|
OnPlayerEnterZone(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Called when a player leave the zone
|
// Called when a player leave the zone
|
||||||
void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ )
|
void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
|
||||||
{
|
{
|
||||||
if (IsWarTime())
|
if (IsWarTime())
|
||||||
{
|
{
|
||||||
//if player is in war list
|
// If the player is participating to the battle
|
||||||
if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end())
|
if (m_PlayersInWar[player->GetTeamId()].find(player->GetGUID()) != m_PlayersInWar[player->GetTeamId()].end())
|
||||||
{
|
{
|
||||||
m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
|
m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
|
||||||
player->GetSession()->SendBfLeaveMessage(m_BattleId);
|
player->GetSession()->SendBfLeaveMessage(m_BattleId);
|
||||||
if (Group* group = player->GetGroup()) // remove from raid group if player is member
|
if (Group* group = player->GetGroup()) // Remove the player from the raid group
|
||||||
group->RemoveMember(player->GetGUID());
|
group->RemoveMember(player->GetGUID());
|
||||||
|
|
||||||
OnPlayerLeaveWar(player); //For scripting
|
OnPlayerLeaveWar(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,55 +116,54 @@ void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ )
|
|||||||
m_players[player->GetTeamId()].erase(player->GetGUID());
|
m_players[player->GetTeamId()].erase(player->GetGUID());
|
||||||
SendRemoveWorldStates(player);
|
SendRemoveWorldStates(player);
|
||||||
RemovePlayerFromResurrectQueue(player->GetGUID());
|
RemovePlayerFromResurrectQueue(player->GetGUID());
|
||||||
OnPlayerLeaveZone(player); //For scripting
|
OnPlayerLeaveZone(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Battlefield::Update(uint32 diff)
|
bool Battlefield::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
//When global timer is end
|
|
||||||
if (m_Timer <= diff)
|
if (m_Timer <= diff)
|
||||||
{
|
{
|
||||||
//Here end of battle by timer
|
// Battlefield ends on time
|
||||||
if (IsWarTime())
|
if (IsWarTime())
|
||||||
EndBattle(true);
|
EndBattle(true);
|
||||||
//Start of battle
|
else // Time to start a new battle!
|
||||||
else
|
|
||||||
StartBattle();
|
StartBattle();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_Timer -= diff;
|
m_Timer -= diff;
|
||||||
|
|
||||||
//Some times before battle start invite player to queue
|
// Invite players a few minutes before the battle's beginning
|
||||||
if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer)
|
if (!m_StartGrouping && m_Timer <= m_StartGroupingTimer)
|
||||||
{
|
{
|
||||||
m_StartGrouping = true;
|
m_StartGrouping = true;
|
||||||
InvitePlayerInZoneToQueue();
|
InvitePlayersInZoneToQueue();
|
||||||
OnStartGrouping(); // for scripting
|
OnStartGrouping();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool objective_changed = false;
|
bool objective_changed = false;
|
||||||
if (IsWarTime())
|
if (IsWarTime())
|
||||||
{
|
{
|
||||||
if (m_uiKickAfkTimer <= diff)
|
if (m_uiKickAfkPlayersTimer <= diff)
|
||||||
{
|
{
|
||||||
m_uiKickAfkTimer = 1000;
|
m_uiKickAfkPlayersTimer = 1000;
|
||||||
KickAfk();
|
KickAfkPlayers();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_uiKickAfkTimer -= diff;
|
m_uiKickAfkPlayersTimer -= diff;
|
||||||
|
|
||||||
//Here kick player witch dont have accept invitation to join the war when time is end (time of windows)
|
// Kick players who chose not to accept invitation to the battle
|
||||||
if (m_uiKickDontAcceptTimer <= diff)
|
if (m_uiKickDontAcceptTimer <= diff)
|
||||||
{
|
{
|
||||||
for (int team = 0; team < 2; team++)
|
for (int team = 0; team < 2; team++)
|
||||||
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++)
|
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++)
|
||||||
if ((*itr).second <= time(NULL))
|
if ((*itr).second <= time(NULL))
|
||||||
KickPlayerFromBf((*itr).first);
|
KickPlayerFromBattlefield((*itr).first);
|
||||||
InvitePlayerInZoneToWar();
|
|
||||||
|
InvitePlayersInZoneToWar();
|
||||||
for (int team = 0; team < 2; team++)
|
for (int team = 0; team < 2; team++)
|
||||||
for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++)
|
for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++)
|
||||||
if ((*itr).second <= time(NULL))
|
if ((*itr).second <= time(NULL))
|
||||||
KickPlayerFromBf((*itr).first);
|
KickPlayerFromBattlefield((*itr).first);
|
||||||
|
|
||||||
m_uiKickDontAcceptTimer = 1000;
|
m_uiKickDontAcceptTimer = 1000;
|
||||||
}
|
}
|
||||||
@@ -181,9 +178,9 @@ bool Battlefield::Update(uint32 diff)
|
|||||||
|
|
||||||
if (m_LastResurectTimer <= diff)
|
if (m_LastResurectTimer <= diff)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < m_GraveYardList.size(); i++)
|
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||||
if (GetGraveYardById(i))
|
if (GetGraveyardById(i))
|
||||||
m_GraveYardList[i]->Resurrect();
|
m_GraveyardList[i]->Resurrect();
|
||||||
m_LastResurectTimer = RESURRECTION_INTERVAL;
|
m_LastResurectTimer = RESURRECTION_INTERVAL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -192,7 +189,7 @@ bool Battlefield::Update(uint32 diff)
|
|||||||
return objective_changed;
|
return objective_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::InvitePlayerInZoneToQueue()
|
void Battlefield::InvitePlayersInZoneToQueue()
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < 2; ++team)
|
for (uint8 team = 0; team < 2; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||||
@@ -200,16 +197,16 @@ void Battlefield::InvitePlayerInZoneToQueue()
|
|||||||
InvitePlayerToQueue(player);
|
InvitePlayerToQueue(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::InvitePlayerToQueue(Player *player)
|
void Battlefield::InvitePlayerToQueue(Player* player)
|
||||||
{
|
{
|
||||||
if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID()))
|
if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[player->GetTeam() == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE].size() >= m_MinPlayer)
|
if (m_PlayersInQueue[player->GetTeam()].size() <= m_MinPlayer || m_PlayersInQueue[GetOtherTeam(player->GetTeamId())].size() >= m_MinPlayer)
|
||||||
player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId);
|
player->GetSession()->SendBfInvitePlayerToQueue(m_BattleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::InvitePlayerInQueueToWar()
|
void Battlefield::InvitePlayersInQueueToWar()
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||||
{
|
{
|
||||||
@@ -229,7 +226,7 @@ void Battlefield::InvitePlayerInQueueToWar()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::InvitePlayerInZoneToWar()
|
void Battlefield::InvitePlayersInZoneToWar()
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||||
@@ -240,16 +237,13 @@ void Battlefield::InvitePlayerInZoneToWar()
|
|||||||
continue;
|
continue;
|
||||||
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
|
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
|
||||||
InvitePlayerToWar(player);
|
InvitePlayerToWar(player);
|
||||||
else
|
else // Battlefield is full of players
|
||||||
{
|
|
||||||
//full
|
|
||||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::InvitePlayerToWar(Player *player)
|
void Battlefield::InvitePlayerToWar(Player* player)
|
||||||
{
|
{
|
||||||
if (!player)
|
if (!player)
|
||||||
return;
|
return;
|
||||||
@@ -264,13 +258,15 @@ void Battlefield::InvitePlayerToWar(Player *player)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the player does not match minimal level requirements for the battlefield, kick him
|
||||||
if (player->getLevel() < m_MinLevel)
|
if (player->getLevel() < m_MinLevel)
|
||||||
{
|
{
|
||||||
if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
|
if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
|
||||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Check if player is not already in war
|
|
||||||
|
// Check if player is not already in war
|
||||||
if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
|
if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -287,16 +283,16 @@ void Battlefield::InitStalker(uint32 entry, float x, float y, float z, float o)
|
|||||||
sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
|
sLog->outError("Battlefield::InitStalker: could not spawn Stalker (Creature entry %u), zone messeges will be un-available", entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::KickAfk()
|
void Battlefield::KickAfkPlayers()
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||||
if (player->isAFK())
|
if (player->isAFK())
|
||||||
KickPlayerFromBf(*itr);
|
KickPlayerFromBattlefield(*itr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::KickPlayerFromBf(uint64 guid)
|
void Battlefield::KickPlayerFromBattlefield(uint64 guid)
|
||||||
{
|
{
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(guid))
|
if (Player* player = sObjectAccessor->FindPlayer(guid))
|
||||||
if (player->GetZoneId() == GetZoneId())
|
if (player->GetZoneId() == GetZoneId())
|
||||||
@@ -305,7 +301,7 @@ void Battlefield::KickPlayerFromBf(uint64 guid)
|
|||||||
|
|
||||||
void Battlefield::StartBattle()
|
void Battlefield::StartBattle()
|
||||||
{
|
{
|
||||||
if (m_BattlefieldActive)
|
if (m_isActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
||||||
@@ -315,41 +311,41 @@ void Battlefield::StartBattle()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Timer = m_BattleTime;
|
m_Timer = m_BattleTime;
|
||||||
m_BattlefieldActive = true;
|
m_isActive = true;
|
||||||
|
|
||||||
InvitePlayerInZoneToWar();
|
InvitePlayersInZoneToWar();
|
||||||
InvitePlayerInQueueToWar();
|
InvitePlayersInQueueToWar();
|
||||||
|
|
||||||
PlaySoundToAll(BF_START);
|
DoPlaySoundToAll(BF_START);
|
||||||
|
|
||||||
OnBattleStart();
|
OnBattleStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::EndBattle(bool endbytimer)
|
void Battlefield::EndBattle(bool endByTimer)
|
||||||
{
|
{
|
||||||
if (!m_BattlefieldActive)
|
if (!m_isActive)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_BattlefieldActive = false;
|
m_isActive = false;
|
||||||
|
|
||||||
m_StartGrouping = false;
|
m_StartGrouping = false;
|
||||||
|
|
||||||
if (!endbytimer)
|
if (!endByTimer)
|
||||||
SetDefenderTeam(GetAttackerTeam());
|
SetDefenderTeam(GetAttackerTeam());
|
||||||
|
|
||||||
if (GetDefenderTeam() == TEAM_ALLIANCE)
|
if (GetDefenderTeam() == TEAM_ALLIANCE)
|
||||||
PlaySoundToAll(BF_ALLIANCE_WINS); // alliance wins sound
|
DoPlaySoundToAll(BF_ALLIANCE_WINS);
|
||||||
else
|
else
|
||||||
PlaySoundToAll(BF_HORDE_WINS); // horde wins sound
|
DoPlaySoundToAll(BF_HORDE_WINS);
|
||||||
|
|
||||||
OnBattleEnd(endbytimer);
|
OnBattleEnd(endByTimer);
|
||||||
|
|
||||||
// reset bf timer
|
// Reset battlefield timer
|
||||||
m_Timer = m_NoWarBattleTime;
|
m_Timer = m_NoWarBattleTime;
|
||||||
SendInitWorldStatesToAll();
|
SendInitWorldStatesToAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::PlaySoundToAll(uint32 SoundID)
|
void Battlefield::DoPlaySoundToAll(uint32 SoundID)
|
||||||
{
|
{
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
data.Initialize(SMSG_PLAY_SOUND, 4);
|
data.Initialize(SMSG_PLAY_SOUND, 4);
|
||||||
@@ -357,34 +353,33 @@ void Battlefield::PlaySoundToAll(uint32 SoundID)
|
|||||||
|
|
||||||
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
{
|
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Battlefield::HasPlayer(Player *player) const
|
bool Battlefield::HasPlayer(Player* player) const
|
||||||
{
|
{
|
||||||
return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end();
|
return m_players[player->GetTeamId()].find(player->GetGUID()) != m_players[player->GetTeamId()].end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called in WorldSession::HandleBfQueueInviteResponse
|
// Called in WorldSession::HandleBfQueueInviteResponse
|
||||||
void Battlefield::PlayerAcceptInviteToQueue(Player *player)
|
void Battlefield::PlayerAcceptInviteToQueue(Player* player)
|
||||||
{
|
{
|
||||||
// Add player in queueVenez
|
// Add player in queue
|
||||||
m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
|
m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
|
||||||
// Send notification
|
// Send notification
|
||||||
player->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId);
|
player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called in WorldSession::HandleBfExitRequest
|
// Called in WorldSession::HandleBfExitRequest
|
||||||
void Battlefield::AskToLeaveQueue(Player *player)
|
void Battlefield::AskToLeaveQueue(Player* player)
|
||||||
{
|
{
|
||||||
// Remove player from queue
|
// Remove player from queue
|
||||||
m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
|
m_PlayersInQueue[player->GetTeamId()].erase(player->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called in WorldSession::HandleBfEntryInviteResponse
|
// Called in WorldSession::HandleBfEntryInviteResponse
|
||||||
void Battlefield::PlayerAcceptInviteToWar(Player *player)
|
void Battlefield::PlayerAcceptInviteToWar(Player* player)
|
||||||
{
|
{
|
||||||
if (!IsWarTime())
|
if (!IsWarTime())
|
||||||
return;
|
return;
|
||||||
@@ -394,7 +389,7 @@ void Battlefield::PlayerAcceptInviteToWar(Player *player)
|
|||||||
player->GetSession()->SendBfEntered(m_BattleId);
|
player->GetSession()->SendBfEntered(m_BattleId);
|
||||||
m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
|
m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
|
||||||
m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
|
m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
|
||||||
//Remove player AFK
|
|
||||||
if (player->isAFK())
|
if (player->isAFK())
|
||||||
player->ToggleAFK();
|
player->ToggleAFK();
|
||||||
|
|
||||||
@@ -407,14 +402,14 @@ 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)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||||
player->CastSpell(player, (uint32) spellId, true);
|
player->CastSpell(player, uint32(spellId), true);
|
||||||
else
|
else
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||||
player->RemoveAuraFromStack((uint32) - spellId);
|
player->RemoveAuraFromStack(uint32(-spellId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::BroadcastPacketZone(WorldPacket & data) const
|
void Battlefield::BroadcastPacketToZone(WorldPacket& data) const
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||||
@@ -422,7 +417,7 @@ void Battlefield::BroadcastPacketZone(WorldPacket & data) const
|
|||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::BroadcastPacketQueue(WorldPacket & data) const
|
void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInQueue[team].begin(); itr != m_PlayersInQueue[team].end(); ++itr)
|
||||||
@@ -430,7 +425,7 @@ void Battlefield::BroadcastPacketQueue(WorldPacket & data) const
|
|||||||
player->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::BroadcastPacketWar(WorldPacket & data) const
|
void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
|
||||||
{
|
{
|
||||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||||
@@ -477,14 +472,13 @@ void Battlefield::SendWarningToAllInZone(uint32 entry)
|
|||||||
WorldPacket data = BuildWarningAnnPacket(msg);
|
WorldPacket data = BuildWarningAnnPacket(msg);
|
||||||
BroadcastPacketWar(data);
|
BroadcastPacketWar(data);
|
||||||
}*/
|
}*/
|
||||||
void Battlefield::SendWarningToPlayer(Player *player, uint32 entry)
|
|
||||||
{
|
|
||||||
if (!player)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
|
void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
|
||||||
if (Creature* stalker = unit->ToCreature())
|
{
|
||||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
|
if (player)
|
||||||
|
if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
|
||||||
|
if (Creature* stalker = unit->ToCreature())
|
||||||
|
sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
|
void Battlefield::SendUpdateWorldState(uint32 field, uint32 value)
|
||||||
@@ -500,38 +494,37 @@ void Battlefield::RegisterZone(uint32 zoneId)
|
|||||||
sBattlefieldMgr->AddZone(zoneId, this);
|
sBattlefieldMgr->AddZone(zoneId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::HideNpc(Creature *p_Creature)
|
void Battlefield::HideNpc(Creature* creature)
|
||||||
{
|
{
|
||||||
p_Creature->CombatStop();
|
creature->CombatStop();
|
||||||
p_Creature->SetReactState(REACT_PASSIVE);
|
creature->SetReactState(REACT_PASSIVE);
|
||||||
p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||||
p_Creature->SetPhaseMask(2, true);
|
creature->SetPhaseMask(2, true);
|
||||||
p_Creature->DisappearAndDie();
|
creature->DisappearAndDie();
|
||||||
p_Creature->SetVisible(false);
|
creature->SetVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::ShowNpc(Creature *p_Creature, bool p_Aggressive)
|
void Battlefield::ShowNpc(Creature* creature, bool aggressive)
|
||||||
{
|
{
|
||||||
p_Creature->SetPhaseMask(1, true);
|
creature->SetPhaseMask(1, true);
|
||||||
p_Creature->SetVisible(true);
|
creature->SetVisible(true);
|
||||||
p_Creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||||
if (!p_Creature->isAlive())
|
if (!creature->isAlive())
|
||||||
p_Creature->Respawn(true);
|
creature->Respawn(true);
|
||||||
if (p_Aggressive)
|
if (aggressive)
|
||||||
p_Creature->SetReactState(REACT_AGGRESSIVE);
|
creature->SetReactState(REACT_AGGRESSIVE);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||||
p_Creature->SetReactState(REACT_PASSIVE);
|
creature->SetReactState(REACT_PASSIVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************
|
// ****************************************************
|
||||||
//*******************Group System**********************
|
// ******************* Group System *******************
|
||||||
//*****************************************************
|
// ****************************************************
|
||||||
Group *Battlefield::GetFreeBfRaid(TeamId TeamId)
|
Group* Battlefield::GetFreeBfRaid(TeamId TeamId)
|
||||||
{
|
{
|
||||||
//if found free group we return it
|
|
||||||
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||||
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
||||||
if (!group->IsFull())
|
if (!group->IsFull())
|
||||||
@@ -540,7 +533,7 @@ Group *Battlefield::GetFreeBfRaid(TeamId TeamId)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
|
Group* Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
|
||||||
{
|
{
|
||||||
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
for (GuidSet::const_iterator itr = m_Groups[TeamId].begin(); itr != m_Groups[TeamId].end(); ++itr)
|
||||||
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
||||||
@@ -550,7 +543,7 @@ Group *Battlefield::GetGroupPlayer(uint64 guid, TeamId TeamId)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player)
|
bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
|
||||||
{
|
{
|
||||||
if (!player->IsInWorld())
|
if (!player->IsInWorld())
|
||||||
return false;
|
return false;
|
||||||
@@ -583,97 +576,97 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player)
|
|||||||
//*****************************************************
|
//*****************************************************
|
||||||
//***************Spirit Guide System*******************
|
//***************Spirit Guide System*******************
|
||||||
//*****************************************************
|
//*****************************************************
|
||||||
|
|
||||||
//--------------------
|
//--------------------
|
||||||
//-Battlefield Method-
|
//-Battlefield Method-
|
||||||
//--------------------
|
//--------------------
|
||||||
BfGraveYard *Battlefield::GetGraveYardById(uint32 id)
|
BfGraveyard* Battlefield::GetGraveyardById(uint32 id)
|
||||||
{
|
{
|
||||||
if (id < m_GraveYardList.size())
|
if (id < m_GraveyardList.size())
|
||||||
{
|
{
|
||||||
if (m_GraveYardList[id])
|
if (m_GraveyardList[id])
|
||||||
return m_GraveYardList[id];
|
return m_GraveyardList[id];
|
||||||
else
|
else
|
||||||
sLog->outError("Battlefield::GetGraveYardById Id:%u not existed", id);
|
sLog->outError("Battlefield::GetGraveyardById Id:%u not existed", id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sLog->outError("Battlefield::GetGraveYardById Id:%u cant be found", id);
|
sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
WorldSafeLocsEntry const *Battlefield::GetClosestGraveYard(Player *player)
|
WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player)
|
||||||
{
|
{
|
||||||
BfGraveYard* closestGY = NULL;
|
BfGraveyard* closestGY = NULL;
|
||||||
float maxdist = -1;
|
float maxdist = -1;
|
||||||
for (uint8 i = 0; i < m_GraveYardList.size(); i++)
|
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||||
{
|
{
|
||||||
if (m_GraveYardList[i])
|
if (m_GraveyardList[i])
|
||||||
{
|
{
|
||||||
if (m_GraveYardList[i]->GetControlTeamId() != player->GetTeamId())
|
if (m_GraveyardList[i]->GetControlTeamId() != player->GetTeamId())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
float dist = m_GraveYardList[i]->GetDistance(player);
|
float dist = m_GraveyardList[i]->GetDistance(player);
|
||||||
if (dist < maxdist || maxdist < 0)
|
if (dist < maxdist || maxdist < 0)
|
||||||
{
|
{
|
||||||
closestGY = m_GraveYardList[i];
|
closestGY = m_GraveyardList[i];
|
||||||
maxdist = dist;
|
maxdist = dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (closestGY)
|
if (closestGY)
|
||||||
return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveYardId());
|
return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId());
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid)
|
void Battlefield::AddPlayerToResurrectQueue(uint64 npcGuid, uint64 playerGuid)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < m_GraveYardList.size(); i++)
|
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||||
{
|
{
|
||||||
if (!m_GraveYardList[i])
|
if (!m_GraveyardList[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m_GraveYardList[i]->HasNpc(npc_guid))
|
if (m_GraveyardList[i]->HasNpc(npcGuid))
|
||||||
{
|
{
|
||||||
m_GraveYardList[i]->AddPlayer(player_guid);
|
m_GraveyardList[i]->AddPlayer(playerGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::RemovePlayerFromResurrectQueue(uint64 player_guid)
|
void Battlefield::RemovePlayerFromResurrectQueue(uint64 playerGuid)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < m_GraveYardList.size(); i++)
|
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||||
{
|
{
|
||||||
if (!m_GraveYardList[i])
|
if (!m_GraveyardList[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m_GraveYardList[i]->HasPlayer(player_guid))
|
if (m_GraveyardList[i]->HasPlayer(playerGuid))
|
||||||
{
|
{
|
||||||
m_GraveYardList[i]->RemovePlayer(player_guid);
|
m_GraveyardList[i]->RemovePlayer(playerGuid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player *pl, const uint64 &guid)
|
void Battlefield::SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 &guid)
|
||||||
{
|
{
|
||||||
sLog->outError("SendAreaSpiritHealerQueryOpcode");
|
|
||||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||||
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
|
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
|
||||||
|
|
||||||
data << guid << time;
|
data << guid << time;
|
||||||
ASSERT(pl && pl->GetSession());
|
ASSERT(player && player->GetSession());
|
||||||
pl->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------
|
// ----------------------
|
||||||
//-BfGraveYard Method-
|
// - BfGraveyard Method -
|
||||||
//--------------------
|
// ----------------------
|
||||||
BfGraveYard::BfGraveYard(Battlefield *Bf)
|
BfGraveyard::BfGraveyard(Battlefield* battlefield)
|
||||||
{
|
{
|
||||||
m_Bf = Bf;
|
m_Bf = battlefield;
|
||||||
m_GraveyardId = 0;
|
m_GraveyardId = 0;
|
||||||
m_ControlTeam = TEAM_NEUTRAL;
|
m_ControlTeam = TEAM_NEUTRAL;
|
||||||
m_SpiritGuide[0] = NULL;
|
m_SpiritGuide[0] = NULL;
|
||||||
@@ -681,17 +674,17 @@ BfGraveYard::BfGraveYard(Battlefield *Bf)
|
|||||||
m_ResurrectQueue.clear();
|
m_ResurrectQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGraveYard::Initialize(TeamId startcontrol, uint32 gy)
|
void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
|
||||||
{
|
{
|
||||||
m_ControlTeam = startcontrol;
|
m_ControlTeam = startControl;
|
||||||
m_GraveyardId = gy;
|
m_GraveyardId = graveyardId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGraveYard::SetSpirit(Creature* spirit, TeamId team)
|
void BfGraveyard::SetSpirit(Creature* spirit, TeamId team)
|
||||||
{
|
{
|
||||||
if (!spirit)
|
if (!spirit)
|
||||||
{
|
{
|
||||||
sLog->outError("<Error - Wintergrasp>: Invalid Spirit.");
|
sLog->outError("BfGraveyard::SetSpirit: Invalid Spirit.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,32 +692,32 @@ void BfGraveYard::SetSpirit(Creature* spirit, TeamId team)
|
|||||||
spirit->SetReactState(REACT_PASSIVE);
|
spirit->SetReactState(REACT_PASSIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BfGraveYard::GetDistance(Player *player)
|
float BfGraveyard::GetDistance(Player* player)
|
||||||
{
|
{
|
||||||
const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
|
const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
|
||||||
return player->GetDistance2d(ws->x, ws->y);
|
return player->GetDistance2d(safeLoc->x, safeLoc->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGraveYard::AddPlayer(uint64 player_guid)
|
void BfGraveyard::AddPlayer(uint64 playerGuid)
|
||||||
{
|
{
|
||||||
if (!m_ResurrectQueue.count(player_guid))
|
if (!m_ResurrectQueue.count(playerGuid))
|
||||||
{
|
{
|
||||||
m_ResurrectQueue.insert(player_guid);
|
m_ResurrectQueue.insert(playerGuid);
|
||||||
|
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(player_guid))
|
if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
|
||||||
player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
|
player->CastSpell(player, SPELL_WAITING_FOR_RESURRECT, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGraveYard::RemovePlayer(uint64 player_guid)
|
void BfGraveyard::RemovePlayer(uint64 playerGuid)
|
||||||
{
|
{
|
||||||
m_ResurrectQueue.erase(m_ResurrectQueue.find(player_guid));
|
m_ResurrectQueue.erase(m_ResurrectQueue.find(playerGuid));
|
||||||
|
|
||||||
if (Player* player = sObjectAccessor->FindPlayer(player_guid))
|
if (Player* player = sObjectAccessor->FindPlayer(playerGuid))
|
||||||
player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
|
player->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGraveYard::Resurrect()
|
void BfGraveyard::Resurrect()
|
||||||
{
|
{
|
||||||
if (m_ResurrectQueue.empty())
|
if (m_ResurrectQueue.empty())
|
||||||
return;
|
return;
|
||||||
@@ -736,7 +729,7 @@ void BfGraveYard::Resurrect()
|
|||||||
if (!player)
|
if (!player)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Check player isinworld and player is on good graveyard
|
// Check if the player is in world and on the good graveyard
|
||||||
if (player->IsInWorld())
|
if (player->IsInWorld())
|
||||||
if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam]))
|
if (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam]))
|
||||||
spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
|
spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
|
||||||
@@ -754,7 +747,7 @@ void BfGraveYard::Resurrect()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// For changing graveyard control
|
// For changing graveyard control
|
||||||
void BfGraveYard::ChangeControl(TeamId team)
|
void BfGraveyard::GiveControlTo(TeamId team)
|
||||||
{
|
{
|
||||||
// Guide switching
|
// Guide switching
|
||||||
// Note: Visiblity changes are made by phasing
|
// Note: Visiblity changes are made by phasing
|
||||||
@@ -768,52 +761,51 @@ void BfGraveYard::ChangeControl(TeamId team)
|
|||||||
RelocateDeadPlayers();
|
RelocateDeadPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGraveYard::RelocateDeadPlayers()
|
void BfGraveyard::RelocateDeadPlayers()
|
||||||
{
|
{
|
||||||
WorldSafeLocsEntry const* ClosestGrave = NULL;
|
WorldSafeLocsEntry const* closestGrave = NULL;
|
||||||
for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
for (GuidSet::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr)
|
||||||
{
|
{
|
||||||
Player* player = sObjectAccessor->FindPlayer(*itr);
|
Player* player = sObjectAccessor->FindPlayer(*itr);
|
||||||
if (!player)
|
if (!player)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ClosestGrave)
|
if (closestGrave)
|
||||||
player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
|
player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClosestGrave = m_Bf->GetClosestGraveYard(player);
|
closestGrave = m_Bf->GetClosestGraveYard(player);
|
||||||
if (ClosestGrave)
|
if (closestGrave)
|
||||||
player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
|
player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************End Spirit Guide system***************
|
// *******************************************************
|
||||||
|
// *************** End Spirit Guide system ***************
|
||||||
|
// *******************************************************
|
||||||
|
// ********************** Misc ***************************
|
||||||
|
// *******************************************************
|
||||||
|
|
||||||
//*****************************************************
|
Creature* Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
|
||||||
//**********************Misc***************************
|
|
||||||
//*****************************************************
|
|
||||||
//Method for spawn creature on map
|
|
||||||
Creature *Battlefield::SpawnCreature(uint32 entry, Position pos, TeamId team)
|
|
||||||
{
|
{
|
||||||
return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team);
|
return SpawnCreature(entry, pos.m_positionX, pos.m_positionY, pos.m_positionZ, pos.m_orientation, team);
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team)
|
Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team)
|
||||||
{
|
{
|
||||||
//Get map object
|
//Get map object
|
||||||
Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId));
|
Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId));
|
||||||
if (!map)
|
if (!map)
|
||||||
{
|
{
|
||||||
sLog->outError("Can't create creature entry: %u map not found", entry);
|
sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u map not found", entry);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create creature
|
|
||||||
Creature* creature = new Creature;
|
Creature* creature = new Creature;
|
||||||
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o))
|
if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, team, x, y, z, o))
|
||||||
{
|
{
|
||||||
sLog->outError("Can't create creature entry: %u", entry);
|
sLog->outError("Battlefield::SpawnCreature: Can't create creature entry: %u", entry);
|
||||||
delete creature;
|
delete creature;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -823,7 +815,7 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
|||||||
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
|
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||||
if (!cinfo)
|
if (!cinfo)
|
||||||
{
|
{
|
||||||
sLog->outErrorDb("Battleground::AddCreature: entry %u does not exist.", entry);
|
sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// force using DB speeds -- do we really need this?
|
// force using DB speeds -- do we really need this?
|
||||||
@@ -838,10 +830,10 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Method for spawning gameobject on map
|
// Method for spawning gameobject on map
|
||||||
GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
|
GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
|
||||||
{
|
{
|
||||||
// Get map object
|
// Get map object
|
||||||
Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(571));
|
Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(571)); // *vomits*
|
||||||
if (!map)
|
if (!map)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -849,23 +841,24 @@ GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
|
|||||||
GameObject* go = new GameObject;
|
GameObject* go = new GameObject;
|
||||||
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
|
if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, PHASEMASK_NORMAL, x, y, z, o, 0, 0, 0, 0, 100, GO_STATE_READY))
|
||||||
{
|
{
|
||||||
sLog->outErrorDb("Gameobject template %u not found in database! Battleground not created!", entry);
|
sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
|
||||||
sLog->outError("Cannot create gameobject template %u! Battleground not created!", entry);
|
sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
|
||||||
delete go;
|
delete go;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add in the world
|
// Add to world
|
||||||
map->AddToMap(go);
|
map->AddToMap(go);
|
||||||
go->setActive(true);
|
go->setActive(true);
|
||||||
|
|
||||||
return go;
|
return go;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************
|
// *******************************************************
|
||||||
//*******************CapturePoint**********************
|
// ******************* CapturePoint **********************
|
||||||
//*****************************************************
|
// *******************************************************
|
||||||
|
|
||||||
BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL)
|
BfCapturePoint::BfCapturePoint(Battlefield* battlefield) : m_Bf(battlefield), m_capturePoint(NULL)
|
||||||
{
|
{
|
||||||
m_team = TEAM_NEUTRAL;
|
m_team = TEAM_NEUTRAL;
|
||||||
m_value = 0;
|
m_value = 0;
|
||||||
@@ -877,28 +870,28 @@ BfCapturePoint::BfCapturePoint(Battlefield *Bf):m_Bf(Bf), m_capturePoint(NULL)
|
|||||||
m_maxSpeed = 0;
|
m_maxSpeed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfCapturePoint::HandlePlayerEnter(Player *player)
|
bool BfCapturePoint::HandlePlayerEnter(Player* player)
|
||||||
{
|
{
|
||||||
if (m_capturePoint)
|
if (m_capturePoint)
|
||||||
{
|
{
|
||||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
|
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 1);
|
||||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, (uint32) ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f));
|
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate2, uint32(ceil((m_value + m_maxValue) / (2 * m_maxValue) * 100.0f)));
|
||||||
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
|
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldstate3, m_neutralValuePct);
|
||||||
}
|
}
|
||||||
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
|
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* plr)
|
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
||||||
{
|
{
|
||||||
if (m_capturePoint)
|
if (m_capturePoint)
|
||||||
plr->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
|
player->SendUpdateWorldState(m_capturePoint->GetGOInfo()->capturePoint.worldState1, 0);
|
||||||
|
|
||||||
GuidSet::iterator current = m_activePlayers[plr->GetTeamId()].find(plr->GetGUID());
|
GuidSet::iterator current = m_activePlayers[player->GetTeamId()].find(player->GetGUID());
|
||||||
|
|
||||||
if (current == m_activePlayers[plr->GetTeamId()].end())
|
if (current == m_activePlayers[player->GetTeamId()].end())
|
||||||
return current; // return end()
|
return current; // return end()
|
||||||
|
|
||||||
m_activePlayers[plr->GetTeamId()].erase(current++);
|
m_activePlayers[player->GetTeamId()].erase(current++);
|
||||||
return current;
|
return current;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -974,10 +967,10 @@ bool BfCapturePoint::Update(uint32 diff)
|
|||||||
{
|
{
|
||||||
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
for (GuidSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();)
|
||||||
{
|
{
|
||||||
if (Player* plr = sObjectAccessor->FindPlayer(*itr))
|
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||||
{
|
{
|
||||||
if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive())
|
if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
|
||||||
itr = HandlePlayerLeave(plr);
|
itr = HandlePlayerLeave(player);
|
||||||
else
|
else
|
||||||
++itr;
|
++itr;
|
||||||
}
|
}
|
||||||
@@ -1111,7 +1104,7 @@ void BfCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid)
|
|||||||
player->KilledMonsterCredit(id, guid);
|
player->KilledMonsterCredit(id, guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BfCapturePoint::IsInsideObjective(Player *player) const
|
bool BfCapturePoint::IsInsideObjective(Player* player) const
|
||||||
{
|
{
|
||||||
return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end();
|
return m_activePlayers[player->GetTeamId()].find(player->GetGUID()) != m_activePlayers[player->GetTeamId()].end();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,342 +68,363 @@ class Creature;
|
|||||||
class Unit;
|
class Unit;
|
||||||
|
|
||||||
class Battlefield;
|
class Battlefield;
|
||||||
class BfGraveYard;
|
class BfGraveyard;
|
||||||
|
|
||||||
typedef std::set < uint64 > GuidSet;
|
typedef std::set<uint64> GuidSet;
|
||||||
typedef std::vector < BfGraveYard * >GraveYardVect;
|
typedef std::vector<BfGraveyard*> GraveyardVect;
|
||||||
typedef std::map < uint64, uint32 > PlayerTimerMap;
|
typedef std::map<uint64, uint32> PlayerTimerMap;
|
||||||
|
|
||||||
class BfCapturePoint
|
class BfCapturePoint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BfCapturePoint(Battlefield * bf);
|
BfCapturePoint(Battlefield* bf);
|
||||||
|
|
||||||
virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {}
|
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||||
|
|
||||||
// send world state update to all players present
|
// Send world state update to all players present
|
||||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||||
|
|
||||||
// send kill notify to players in the controlling faction
|
// Send kill notify to players in the controlling faction
|
||||||
void SendObjectiveComplete(uint32 id, uint64 guid);
|
void SendObjectiveComplete(uint32 id, uint64 guid);
|
||||||
|
|
||||||
// used when player is activated/inactivated in the area
|
// Used when player is activated/inactivated in the area
|
||||||
virtual bool HandlePlayerEnter(Player* player);
|
virtual bool HandlePlayerEnter(Player* player);
|
||||||
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
|
virtual GuidSet::iterator HandlePlayerLeave(Player* player);
|
||||||
//virtual void HandlePlayerActivityChanged(Player * player);
|
//virtual void HandlePlayerActivityChanged(Player* player);
|
||||||
|
|
||||||
// checks if player is in range of a capture credit marker
|
// Checks if player is in range of a capture credit marker
|
||||||
bool IsInsideObjective(Player * player) const;
|
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.
|
// 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 bool Update(uint32 diff);
|
||||||
virtual void ChangeTeam(TeamId /*oldTeam */ ) {}
|
virtual void ChangeTeam(TeamId /*oldTeam*/) {}
|
||||||
virtual void SendChangePhase();
|
virtual void SendChangePhase();
|
||||||
|
|
||||||
bool SetCapturePointData(GameObject* capturePoint);
|
bool SetCapturePointData(GameObject* capturePoint);
|
||||||
GameObject* GetCapturePointGo() { return m_capturePoint; }
|
GameObject* GetCapturePointGo() { return m_capturePoint; }
|
||||||
|
|
||||||
TeamId GetTeamId() {return m_team;}
|
TeamId GetTeamId() { return m_team; }
|
||||||
protected:
|
protected:
|
||||||
bool DelCapturePoint();
|
bool DelCapturePoint();
|
||||||
|
|
||||||
// active players in the area of the objective, 0 - alliance, 1 - horde
|
// active Players in the area of the objective, 0 - alliance, 1 - horde
|
||||||
GuidSet m_activePlayers[2];
|
GuidSet m_activePlayers[2];
|
||||||
|
|
||||||
// total shift needed to capture the objective
|
// Total shift needed to capture the objective
|
||||||
float m_maxValue;
|
float m_maxValue;
|
||||||
float m_minValue;
|
float m_minValue;
|
||||||
|
|
||||||
// maximum speed of capture
|
// Maximum speed of capture
|
||||||
float m_maxSpeed;
|
float m_maxSpeed;
|
||||||
|
|
||||||
// the status of the objective
|
// The status of the objective
|
||||||
float m_value;
|
float m_value;
|
||||||
TeamId m_team;
|
TeamId m_team;
|
||||||
|
|
||||||
// objective states
|
// Objective states
|
||||||
BattlefieldObjectiveStates m_OldState;
|
BattlefieldObjectiveStates m_OldState;
|
||||||
BattlefieldObjectiveStates m_State;
|
BattlefieldObjectiveStates m_State;
|
||||||
|
|
||||||
// neutral value on capture bar
|
// Neutral value on capture bar
|
||||||
uint32 m_neutralValuePct;
|
uint32 m_neutralValuePct;
|
||||||
|
|
||||||
// pointer to the Battlefield this objective belongs to
|
// Pointer to the Battlefield this objective belongs to
|
||||||
Battlefield *m_Bf;
|
Battlefield* m_Bf;
|
||||||
uint32 m_capturePointEntry;
|
|
||||||
GameObject *m_capturePoint;
|
// Capture point entry
|
||||||
|
uint32 m_capturePointEntry;
|
||||||
|
|
||||||
|
// Gameobject related to that capture point
|
||||||
|
GameObject* m_capturePoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BfGraveYard
|
class BfGraveyard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BfGraveYard(Battlefield *Bf);
|
BfGraveyard(Battlefield* Bf);
|
||||||
|
|
||||||
// method for change who control the graveyard
|
// Method to changing who controls the graveyard
|
||||||
void ChangeControl(TeamId team);
|
void GiveControlTo(TeamId team);
|
||||||
TeamId GetControlTeamId() { return m_ControlTeam; }
|
TeamId GetControlTeamId() { return m_ControlTeam; }
|
||||||
|
|
||||||
// use for found the nearest graveyard
|
// Find the nearest graveyard to a player
|
||||||
float GetDistance(Player * player);
|
float GetDistance(Player* player);
|
||||||
void Initialize(TeamId startcontrol, uint32 gy);
|
|
||||||
void SetSpirit(Creature* spirit, TeamId team);
|
|
||||||
void AddPlayer(uint64 player_guid);
|
|
||||||
void RemovePlayer(uint64 player_guid);
|
|
||||||
|
|
||||||
void Resurrect();
|
// Initialize the graveyard
|
||||||
void RelocateDeadPlayers();
|
void Initialize(TeamId startcontrol, uint32 gy);
|
||||||
|
|
||||||
bool HasNpc(uint64 guid)
|
// Set spirit service for the graveyard
|
||||||
{
|
void SetSpirit(Creature* spirit, TeamId team);
|
||||||
// npcs could not be loaded in the map yet.
|
|
||||||
if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) ||
|
// Add a player to the graveyard
|
||||||
!sObjectAccessor->FindUnit(m_SpiritGuide[1]))
|
void AddPlayer(uint64 player_guid);
|
||||||
return false;
|
|
||||||
|
|
||||||
return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
|
// Remove a player from the graveyard
|
||||||
}
|
void RemovePlayer(uint64 player_guid);
|
||||||
bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
|
||||||
uint32 GetGraveYardId() { return m_GraveyardId; }
|
|
||||||
|
|
||||||
protected:
|
// Resurrect players
|
||||||
|
void Resurrect();
|
||||||
|
|
||||||
TeamId m_ControlTeam;
|
// Move players waiting to that graveyard on the nearest one
|
||||||
uint32 m_GraveyardId;
|
void RelocateDeadPlayers();
|
||||||
uint64 m_SpiritGuide[2];
|
|
||||||
GuidSet m_ResurrectQueue;
|
// Check if this graveyard has a spirit guide
|
||||||
Battlefield *m_Bf;
|
bool HasNpc(uint64 guid)
|
||||||
|
{
|
||||||
|
if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!sObjectAccessor->FindUnit(m_SpiritGuide[0]) ||
|
||||||
|
!sObjectAccessor->FindUnit(m_SpiritGuide[1]))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (m_SpiritGuide[0] == guid || m_SpiritGuide[1] == guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if a player is in this graveyard's ressurect queue
|
||||||
|
bool HasPlayer(uint64 guid) { return m_ResurrectQueue.find(guid) != m_ResurrectQueue.end(); }
|
||||||
|
|
||||||
|
// Get the graveyard's ID.
|
||||||
|
uint32 GetGraveyardId() { return m_GraveyardId; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TeamId m_ControlTeam;
|
||||||
|
uint32 m_GraveyardId;
|
||||||
|
uint64 m_SpiritGuide[2];
|
||||||
|
GuidSet m_ResurrectQueue;
|
||||||
|
Battlefield* m_Bf;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Battlefield : public ZoneScript
|
class Battlefield : public ZoneScript
|
||||||
{
|
{
|
||||||
friend class BattlefieldMgr;
|
friend class BattlefieldMgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
Battlefield();
|
Battlefield();
|
||||||
/// Destructor
|
/// Destructor
|
||||||
virtual ~Battlefield();
|
virtual ~Battlefield();
|
||||||
|
|
||||||
/// typedef of map witch store capturepoint and the associate gameobject entry
|
/// typedef of map witch store capturepoint and the associate gameobject entry
|
||||||
typedef std::map < uint32 /*lowguid */ , BfCapturePoint * >BfCapturePointMap;
|
typedef std::map<uint32 /*lowguid */, BfCapturePoint*> BfCapturePointMap;
|
||||||
|
|
||||||
/// Call this to init the Battlefield
|
/// Call this to init the Battlefield
|
||||||
virtual bool SetupBattlefield() { return true; }
|
virtual bool SetupBattlefield() { return true; }
|
||||||
|
|
||||||
/// Generate packet which contain all worldstatedata of area
|
/// Generate packet which contain all worldstatedata of area
|
||||||
virtual void FillInitialWorldStates(WorldPacket & /*data */ ) {}
|
virtual void FillInitialWorldStates(WorldPacket& /*data*/) {}
|
||||||
|
|
||||||
/// Update data of a worldstate to all players present in zone
|
/// Update data of a worldstate to all players present in zone
|
||||||
void SendUpdateWorldState(uint32 field, uint32 value);
|
void SendUpdateWorldState(uint32 field, uint32 value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Called every time for update bf data and time
|
* \brief Called every time for update bf data and time
|
||||||
* -Update timer for start/end battle
|
* - Update timer for start/end battle
|
||||||
* -Invite player in zone to queue x minutes before start (x = m_StartGroupingTimer)
|
* - Invite player in zone to queue m_StartGroupingTimer minutes before start
|
||||||
* -Kick Afk players
|
* - Kick Afk players
|
||||||
* \param diff : time ellapsed since last call (in ms)
|
* \param diff : time ellapsed since last call (in ms)
|
||||||
*/
|
*/
|
||||||
virtual bool Update(uint32 diff);
|
virtual bool Update(uint32 diff);
|
||||||
|
|
||||||
/// Invite all player in zone, to join the queue, called x minutes before battle start in Update()
|
/// Invite all players in zone to join the queue, called x minutes before battle start in Update()
|
||||||
void InvitePlayerInZoneToQueue();
|
void InvitePlayersInZoneToQueue();
|
||||||
/// Invite all player in queue to join battle on battle start
|
/// Invite all players in queue to join battle on battle start
|
||||||
void InvitePlayerInQueueToWar();
|
void InvitePlayersInQueueToWar();
|
||||||
/// Invite all player in zone to join battle on battle start
|
/// Invite all players in zone to join battle on battle start
|
||||||
void InvitePlayerInZoneToWar();
|
void InvitePlayersInZoneToWar();
|
||||||
|
|
||||||
/// Called when a Unit is kill in battlefield zone
|
/// Called when a Unit is kill in battlefield zone
|
||||||
virtual void HandleKill(Player * /*killer */ , Unit * /*killed */ ) {};
|
virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
|
||||||
|
|
||||||
uint32 GetTypeId() { return m_TypeId; }
|
uint32 GetTypeId() { return m_TypeId; }
|
||||||
uint32 GetZoneId() { return m_ZoneId; }
|
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
|
/// Return true if battle is start, false if battle is not started
|
||||||
bool IsWarTime() { return m_BattlefieldActive; }
|
bool IsWarTime() { return m_isActive; }
|
||||||
|
|
||||||
/// Enable or Disable battlefield
|
/// Enable or Disable battlefield
|
||||||
void SetEnable(bool enable) { m_enable = enable; }
|
void ToggleBattlefield(bool enable) { m_IsEnabled = enable; }
|
||||||
/// Return if battlefield is enable
|
/// Return if battlefield is enable
|
||||||
bool GetEnable() { return m_enable; }
|
bool IsEnabled() { return m_IsEnabled; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Kick player from battlefield and teleport him to kick-point location
|
* \brief Kick player from battlefield and teleport him to kick-point location
|
||||||
* \param guid : guid of player who must be kick
|
* \param guid : guid of player who must be kick
|
||||||
*/
|
*/
|
||||||
void KickPlayerFromBf(uint64 guid);
|
void KickPlayerFromBattlefield(uint64 guid);
|
||||||
|
|
||||||
/// Called when player (player) enter in zone
|
/// Called when player (player) enter in zone
|
||||||
void HandlePlayerEnterZone(Player * player, uint32 zone);
|
void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||||
/// Called when player (player) leave the zone
|
/// Called when player (player) leave the zone
|
||||||
void HandlePlayerLeaveZone(Player * player, uint32 zone);
|
void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||||
|
|
||||||
// All-purpose data storage 64 bit
|
// All-purpose data storage 64 bit
|
||||||
virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; }
|
virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; }
|
||||||
virtual void SetData64(uint32 DataId, uint64 Value) { m_Data64[DataId] = Value; }
|
virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
|
||||||
|
|
||||||
// All-purpose data storage 32 bit
|
// All-purpose data storage 32 bit
|
||||||
virtual uint32 GetData(uint32 DataId) { return m_Data32[DataId]; }
|
virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; }
|
||||||
virtual void SetData(uint32 DataId, uint32 Value) { m_Data32[DataId] = Value; }
|
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
|
// Battlefield - generic methods
|
||||||
TeamId GetDefenderTeam() { return m_DefenderTeam; }
|
TeamId GetDefenderTeam() { return m_DefenderTeam; }
|
||||||
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
|
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
|
||||||
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
|
TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
|
||||||
|
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
|
||||||
|
|
||||||
// Group methods
|
// Group methods
|
||||||
/**
|
/**
|
||||||
* \brief Find a not full battlefield group, if there is no, create one
|
* \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())
|
* \param TeamId : Id of player team for who we search a group (player->GetTeamId())
|
||||||
*/
|
*/
|
||||||
Group *GetFreeBfRaid(TeamId TeamId);
|
Group* GetFreeBfRaid(TeamId TeamId);
|
||||||
/// Return battlefield group where player is.
|
/// Return battlefield group where player is.
|
||||||
Group *GetGroupPlayer(uint64 guid, TeamId TeamId);
|
Group* GetGroupPlayer(uint64 guid, TeamId TeamId);
|
||||||
/// Force player to join a battlefield group
|
/// Force player to join a battlefield group
|
||||||
bool AddOrSetPlayerToCorrectBfGroup(Player * player);
|
bool AddOrSetPlayerToCorrectBfGroup(Player* player);
|
||||||
|
|
||||||
// Graveyard methods
|
// Graveyard methods
|
||||||
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
|
// Find which graveyard the player must be teleported to to be resurrected by spiritguide
|
||||||
WorldSafeLocsEntry const *GetClosestGraveYard(Player * player);
|
WorldSafeLocsEntry const * GetClosestGraveYard(Player* player);
|
||||||
|
|
||||||
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||||
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
||||||
void SetGraveyardNumber(uint32 number) { m_GraveYardList.resize(number); }
|
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
|
||||||
BfGraveYard *GetGraveYardById(uint32 id);
|
BfGraveyard* GetGraveyardById(uint32 id);
|
||||||
|
|
||||||
// Misc methods
|
// Misc methods
|
||||||
Creature *SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
|
Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
|
||||||
Creature *SpawnCreature(uint32 entry, Position pos, TeamId team);
|
Creature* SpawnCreature(uint32 entry, Position pos, TeamId team);
|
||||||
GameObject *SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
GameObject* SpawnGameObject(uint32 entry, float x, float y, float z, float o);
|
||||||
|
|
||||||
// Script-methods
|
// Script-methods
|
||||||
|
|
||||||
/// Called on start
|
/// Called on start
|
||||||
virtual void OnBattleStart() {};
|
virtual void OnBattleStart() {};
|
||||||
/// Called at the end of battle
|
/// Called at the end of battle
|
||||||
virtual void OnBattleEnd(bool /*endbytimer */ ) {};
|
virtual void OnBattleEnd(bool /*endByTimer*/) {};
|
||||||
/// Called x minutes before battle start when player in zone are invite to join queue
|
/// Called x minutes before battle start when player in zone are invite to join queue
|
||||||
virtual void OnStartGrouping() {};
|
virtual void OnStartGrouping() {};
|
||||||
/// Called when a player accept to join the battle
|
/// Called when a player accept to join the battle
|
||||||
virtual void OnPlayerJoinWar(Player * /*player */ ) {};
|
virtual void OnPlayerJoinWar(Player* /*player*/) {};
|
||||||
/// Called when a player leave the battle
|
/// Called when a player leave the battle
|
||||||
virtual void OnPlayerLeaveWar(Player * /*player */ ) {};
|
virtual void OnPlayerLeaveWar(Player* /*player*/) {};
|
||||||
/// Called when a player leave battlefield zone
|
/// Called when a player leave battlefield zone
|
||||||
virtual void OnPlayerLeaveZone(Player * /*player */ ) {};
|
virtual void OnPlayerLeaveZone(Player* /*player*/) {};
|
||||||
/// Called when a player enter in battlefield zone
|
/// Called when a player enter in battlefield zone
|
||||||
virtual void OnPlayerEnterZone(Player * /*player */ ) {};
|
virtual void OnPlayerEnterZone(Player* /*player*/) {};
|
||||||
|
|
||||||
WorldPacket BuildWarningAnnPacket(std::string msg);
|
WorldPacket BuildWarningAnnPacket(std::string msg);
|
||||||
void SendWarningToAllInZone(uint32 entry);
|
void SendWarningToAllInZone(uint32 entry);
|
||||||
//void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
|
//void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
|
||||||
void SendWarningToPlayer(Player * player, uint32 entry);
|
void SendWarningToPlayer(Player* player, uint32 entry);
|
||||||
|
|
||||||
void PlayerAcceptInviteToQueue(Player * player);
|
void PlayerAcceptInviteToQueue(Player* player);
|
||||||
void PlayerAcceptInviteToWar(Player * player);
|
void PlayerAcceptInviteToWar(Player* player);
|
||||||
uint32 GetBattleId() { return m_BattleId; }
|
uint32 GetBattleId() { return m_BattleId; }
|
||||||
void AskToLeaveQueue(Player * player);
|
void AskToLeaveQueue(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.
|
/// Send all worldstate data to all player in zone.
|
||||||
virtual void SendInitWorldStatesToAll() {};
|
virtual void SendInitWorldStatesToAll() {};
|
||||||
|
|
||||||
/// Return if we can use mount in battlefield
|
/// Return if we can use mount in battlefield
|
||||||
bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not
|
bool CanFlyIn() { return !m_isActive; }
|
||||||
void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid);
|
|
||||||
|
|
||||||
void StartBattle();
|
void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
|
||||||
void EndBattle(bool endbytimer);
|
|
||||||
|
|
||||||
void HideNpc(Creature * p_Creature);
|
void StartBattle();
|
||||||
void ShowNpc(Creature * p_Creature, bool p_Aggressive);
|
void EndBattle(bool endByTimer);
|
||||||
|
|
||||||
GraveYardVect GetGraveYardVect() { return m_GraveYardList; }
|
void HideNpc(Creature* creature);
|
||||||
|
void ShowNpc(Creature* creature, bool aggressive);
|
||||||
|
|
||||||
uint32 GetTimer() { return m_Timer; }
|
GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
|
||||||
void SetTimer(uint32 timer) { m_Timer = timer; }
|
|
||||||
|
|
||||||
void PlaySoundToAll(uint32 SoundID);
|
uint32 GetTimer() { return m_Timer; }
|
||||||
|
void SetTimer(uint32 timer) { m_Timer = timer; }
|
||||||
|
|
||||||
void InvitePlayerToQueue(Player * player);
|
void DoPlaySoundToAll(uint32 SoundID);
|
||||||
void InvitePlayerToWar(Player * player);
|
|
||||||
|
|
||||||
void InitStalker(uint32 entry, float x, float y, float z, float o);
|
void InvitePlayerToQueue(Player* player);
|
||||||
|
void InvitePlayerToWar(Player* player);
|
||||||
|
|
||||||
protected:
|
void InitStalker(uint32 entry, float x, float y, float z, float o);
|
||||||
uint64 StalkerGuid;
|
|
||||||
uint32 m_Timer; // Global timer for event
|
|
||||||
bool m_enable;
|
|
||||||
bool m_BattlefieldActive;
|
|
||||||
TeamId m_DefenderTeam;
|
|
||||||
|
|
||||||
// the map of the objectives belonging to this outdoorpvp
|
protected:
|
||||||
BfCapturePointMap m_capturePoints;
|
uint64 StalkerGuid;
|
||||||
|
uint32 m_Timer; // Global timer for event
|
||||||
|
bool m_IsEnabled;
|
||||||
|
bool m_isActive;
|
||||||
|
TeamId m_DefenderTeam;
|
||||||
|
|
||||||
// the set of player
|
// Map of the objectives belonging to this OutdoorPvP
|
||||||
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
BfCapturePointMap m_capturePoints;
|
||||||
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
|
// Players info maps
|
||||||
uint32 m_TypeId; // See enum BattlefieldTypes
|
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||||
uint32 m_BattleId; // BattleID (for packet)
|
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||||
uint32 m_ZoneId; // ZoneID of Wintergrasp = 4197
|
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||||
uint32 m_MapId; // MapId where is Battlefield
|
PlayerTimerMap m_InvitedPlayers[BG_TEAMS_COUNT];
|
||||||
uint32 m_MaxPlayer; // Maximum number of player that participated to Battlefield
|
PlayerTimerMap m_PlayersWillBeKick[BG_TEAMS_COUNT];
|
||||||
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 player is teleport if they switch to afk during battle or if they dont accept invitation
|
|
||||||
|
|
||||||
uint32 m_uiKickAfkTimer; // Timer for check Afk in war
|
// 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
|
||||||
|
|
||||||
//Graveyard variables
|
uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
|
||||||
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
|
// Graveyard variables
|
||||||
bool m_StartGrouping; // bool for know if all players in area has been invited
|
GraveyardVect m_GraveyardList; // Vector witch contain the different GY of the battle
|
||||||
|
uint32 m_LastResurectTimer; // Timer for resurect player every 30 sec
|
||||||
|
|
||||||
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
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
|
||||||
|
|
||||||
std::vector < uint64 > m_Data64;
|
GuidSet m_Groups[BG_TEAMS_COUNT]; // Contain different raid group
|
||||||
std::vector < uint32 > m_Data32;
|
|
||||||
|
|
||||||
void KickAfk();
|
std::vector<uint64> m_Data64;
|
||||||
// use for switch off all worldstate for client
|
std::vector<uint32> m_Data32;
|
||||||
virtual void SendRemoveWorldStates(Player * /*player */ ) {}
|
|
||||||
|
|
||||||
// use for send a packet for all player list
|
void KickAfkPlayers();
|
||||||
void BroadcastPacketZone(WorldPacket & data) const;
|
|
||||||
void BroadcastPacketQueue(WorldPacket & data) const;
|
|
||||||
void BroadcastPacketWar(WorldPacket & data) const;
|
|
||||||
|
|
||||||
//CapturePoint system
|
// use for switch off all worldstate for client
|
||||||
void AddCapturePoint(BfCapturePoint * cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
|
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||||
|
|
||||||
BfCapturePoint *GetCapturePoint(uint32 lowguid) const
|
// use for send a packet for all player list
|
||||||
{
|
void BroadcastPacketToZone(WorldPacket& data) const;
|
||||||
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
void BroadcastPacketToQueue(WorldPacket& data) const;
|
||||||
if (itr != m_capturePoints.end())
|
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||||
return itr->second;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RegisterZone(uint32 zoneid);
|
// CapturePoint system
|
||||||
bool HasPlayer(Player * player) const;
|
void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
|
||||||
void TeamCastSpell(TeamId team, int32 spellId);
|
|
||||||
|
|
||||||
|
BfCapturePoint* GetCapturePoint(uint32 lowguid) const
|
||||||
|
{
|
||||||
|
Battlefield::BfCapturePointMap::const_iterator itr = m_capturePoints.find(lowguid);
|
||||||
|
if (itr != m_capturePoints.end())
|
||||||
|
return itr->second;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegisterZone(uint32 zoneid);
|
||||||
|
bool HasPlayer(Player* player) const;
|
||||||
|
void TeamCastSpell(TeamId team, int32 spellId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
|
|||||||
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
|
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
|
||||||
//Param3:(CanQueue) if able to queue
|
//Param3:(CanQueue) if able to queue
|
||||||
//Param4:(Full) on log in is full
|
//Param4:(Full) on log in is full
|
||||||
void WorldSession::SendBfQueueInviteResponce(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);
|
WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_REQUEST_RESPONSE, 11);
|
||||||
data << uint32(BattleId);
|
data << uint32(BattleId);
|
||||||
@@ -132,7 +132,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (_player->GetZoneId() == Bf->GetZoneId())
|
if (_player->GetZoneId() == Bf->GetZoneId())
|
||||||
Bf->KickPlayerFromBf(_player->GetGUID());
|
Bf->KickPlayerFromBattlefield(_player->GetGUID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,10 +77,9 @@ void BattlefieldMgr::HandlePlayerEnterZone(Player * player, uint32 zoneid)
|
|||||||
if (itr == m_BattlefieldMap.end())
|
if (itr == m_BattlefieldMap.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (itr->second->HasPlayer(player))
|
if (itr->second->HasPlayer(player) || !itr->second->IsEnabled())
|
||||||
return;
|
|
||||||
if (itr->second->GetEnable() == false)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
itr->second->HandlePlayerEnterZone(player, zoneid);
|
itr->second->HandlePlayerEnterZone(player, zoneid);
|
||||||
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
sLog->outDebug(LOG_FILTER_BATTLEFIELD, "Player %u entered outdoorpvp id %u", player->GetGUIDLow(), itr->second->GetTypeId());
|
||||||
}
|
}
|
||||||
@@ -106,7 +105,7 @@ Battlefield *BattlefieldMgr::GetBattlefieldToZoneId(uint32 zoneid)
|
|||||||
// no handle for this zone, return
|
// no handle for this zone, return
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (itr->second->GetEnable() == false)
|
if (!itr->second->IsEnabled())
|
||||||
return NULL;
|
return NULL;
|
||||||
return itr->second;
|
return itr->second;
|
||||||
}
|
}
|
||||||
@@ -127,7 +126,7 @@ void BattlefieldMgr::Update(uint32 diff)
|
|||||||
if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
|
if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
|
||||||
{
|
{
|
||||||
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
|
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
|
||||||
if ((*itr)->GetEnable())
|
if ((*itr)->IsEnabled())
|
||||||
(*itr)->Update(m_UpdateTimer);
|
(*itr)->Update(m_UpdateTimer);
|
||||||
m_UpdateTimer = 0;
|
m_UpdateTimer = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -821,11 +821,6 @@ class ObjectMgr
|
|||||||
return &_creatureQuestRelations;
|
return &_creatureQuestRelations;
|
||||||
}
|
}
|
||||||
|
|
||||||
QuestRelations* GetCreatureQuestInvolvedRelation()
|
|
||||||
{
|
|
||||||
return &_creatureQuestInvolvedRelations;
|
|
||||||
}
|
|
||||||
|
|
||||||
QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry)
|
QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry)
|
||||||
{
|
{
|
||||||
return _creatureQuestRelations.equal_range(creature_entry);
|
return _creatureQuestRelations.equal_range(creature_entry);
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ class WorldSession
|
|||||||
// Battlefield
|
// Battlefield
|
||||||
void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
|
void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
|
||||||
void SendBfInvitePlayerToQueue(uint32 BattleId);
|
void SendBfInvitePlayerToQueue(uint32 BattleId);
|
||||||
void SendBfQueueInviteResponce(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
|
void SendBfQueueInviteResponse(uint32 BattleId,uint32 ZoneId, bool CanQueue = true, bool Full = false);
|
||||||
void SendBfEntered(uint32 BattleId);
|
void SendBfEntered(uint32 BattleId);
|
||||||
void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
|
void SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
|
||||||
void HandleBfQueueInviteResponse(WorldPacket &recv_data);
|
void HandleBfQueueInviteResponse(WorldPacket &recv_data);
|
||||||
|
|||||||
@@ -108,15 +108,15 @@ public:
|
|||||||
if (!bf)
|
if (!bf)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (bf->GetEnable())
|
if (bf->IsEnabled())
|
||||||
{
|
{
|
||||||
bf->SetEnable(false);
|
bf->ToggleBattlefield(false);
|
||||||
if (battleid == 1)
|
if (battleid == 1)
|
||||||
handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
|
handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bf->SetEnable(true);
|
bf->ToggleBattlefield(true);
|
||||||
if (battleid == 1)
|
if (battleid == 1)
|
||||||
handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
|
handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,372 +38,414 @@ enum eWGqueuenpctext
|
|||||||
WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507,
|
WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum WGscriptdata
|
enum Spells
|
||||||
{
|
{
|
||||||
// engineer spells
|
// Demolisher engineers spells
|
||||||
SPELL_BUILD_CATAPULT = 56663,
|
SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 = 61409, //
|
||||||
SPELL_BUILD_DEMOLISHER = 56575,
|
SPELL_BUILD_SIEGE_VEHICLE_FORCE_2 = 56662, // Which faction uses which ?
|
||||||
SPELL_BUILD_SIEGE_ENGINE = 61408,
|
SPELL_BUILD_CATAPULT_FORCE = 56664,
|
||||||
SPELL_BUILD_SIEGE_ENGINE2 = 56661, // does it's really needed here?
|
SPELL_BUILD_DEMOLISHER_FORCE = 56659,
|
||||||
SPELL_ACTIVATE_ROBOTIC_ARMS = 49899,
|
SPELL_ACTIVATE_CONTROL_ARMS = 49899,
|
||||||
|
|
||||||
// teleporter spells
|
SPELL_VEHICLE_TELEPORT = 49759,
|
||||||
SPELL_VEHICLE_TELEPORT = 49759,
|
|
||||||
|
|
||||||
// npcs
|
// Spirit guide
|
||||||
NPC_ROBOTIC_ARMS = 27852,
|
SPELL_CHANNEL_SPIRIT_HEAL = 22011,
|
||||||
NPC_WORLD_TRIGGER_WG = 23472,
|
};
|
||||||
|
|
||||||
|
enum CreatureIds
|
||||||
|
{
|
||||||
|
NPC_GOBLIN_MECHANIC = 30400,
|
||||||
|
NPC_GNOMISH_ENGINEER = 30499,
|
||||||
|
|
||||||
|
NPC_WINTERGRASP_CONTROL_ARMS = 27852,
|
||||||
|
|
||||||
|
NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC = 23742,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum QuestIds
|
||||||
|
{
|
||||||
|
QUEST_BONES_AND_ARROWS_HORDE_ATT = 13193,
|
||||||
|
QUEST_JINXING_THE_WALLS_HORDE_ATT = 13202,
|
||||||
|
QUEST_SLAY_THEM_ALL_HORDE_ATT = 13180,
|
||||||
|
QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT = 13200,
|
||||||
|
QUEST_HEALING_WITH_ROSES_HORDE_ATT = 13201,
|
||||||
|
QUEST_DEFEND_THE_SIEGE_HORDE_ATT = 13223,
|
||||||
|
|
||||||
|
QUEST_BONES_AND_ARROWS_HORDE_DEF = 13199,
|
||||||
|
QUEST_WARDING_THE_WALLS_HORDE_DEF = 13192,
|
||||||
|
QUEST_SLAY_THEM_ALL_HORDE_DEF = 13178,
|
||||||
|
QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF = 13191,
|
||||||
|
QUEST_HEALING_WITH_ROSES_HORDE_DEF = 13194,
|
||||||
|
QUEST_TOPPLING_THE_TOWERS_HORDE_DEF = 13539,
|
||||||
|
QUEST_STOP_THE_SIEGE_HORDE_DEF = 13185,
|
||||||
|
|
||||||
|
QUEST_BONES_AND_ARROWS_ALLIANCE_ATT = 13196,
|
||||||
|
QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT = 13198,
|
||||||
|
QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT = 13179,
|
||||||
|
QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT = 13222,
|
||||||
|
QUEST_A_RARE_HERB_ALLIANCE_ATT = 13195,
|
||||||
|
|
||||||
|
QUEST_BONES_AND_ARROWS_ALLIANCE_DEF = 13154,
|
||||||
|
QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF = 13153,
|
||||||
|
QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF = 13177,
|
||||||
|
QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF = 13538,
|
||||||
|
QUEST_STOP_THE_SIEGE_ALLIANCE_DEF = 13186,
|
||||||
|
QUEST_A_RARE_HERB_ALLIANCE_DEF = 13156,
|
||||||
|
};
|
||||||
|
|
||||||
|
uint8 const MAX_WINTERGRASP_VEHICLES = 4;
|
||||||
|
|
||||||
|
uint32 const vehiclesList[MAX_WINTERGRASP_VEHICLES] = {
|
||||||
|
NPC_WINTERGRASP_CATAPULT,
|
||||||
|
NPC_WINTERGRASP_DEMOLISHER,
|
||||||
|
NPC_WINTERGRASP_SIEGE_ENGINE_1,
|
||||||
|
NPC_WINTERGRASP_SIEGE_ENGINE_2
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_wg_demolisher_engineer : public CreatureScript
|
class npc_wg_demolisher_engineer : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer")
|
npc_wg_demolisher_engineer() : CreatureScript("npc_wg_demolisher_engineer") { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OnGossipHello(Player* player, Creature* creature)
|
bool OnGossipHello(Player* player, Creature* creature)
|
||||||
{
|
|
||||||
if (creature->isQuestGiver())
|
|
||||||
player->PrepareQuestMenu(creature->GetGUID());
|
|
||||||
|
|
||||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
|
||||||
|
|
||||||
if (!BfWG)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) >
|
|
||||||
BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A))
|
|
||||||
{
|
{
|
||||||
if (player->HasAura(SPELL_CORPORAL))
|
if (creature->isQuestGiver())
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
player->PrepareQuestMenu(creature->GetGUID());
|
||||||
else if (player->HasAura(SPELL_LIEUTENANT))
|
|
||||||
|
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1);
|
||||||
|
|
||||||
|
if (canBuild(creature))
|
||||||
{
|
{
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
if (player->HasAura(SPELL_CORPORAL))
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
|
else if (player->HasAura(SPELL_LIEUTENANT))
|
||||||
|
{
|
||||||
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||||
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
|
||||||
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
|
||||||
|
|
||||||
|
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action)
|
||||||
|
{
|
||||||
|
player->CLOSE_GOSSIP_MENU();
|
||||||
|
|
||||||
|
Battlefield* wintergrasp= sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||||
|
|
||||||
|
if (canBuild(creature))
|
||||||
|
{
|
||||||
|
switch (action - GOSSIP_ACTION_INFO_DEF)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
creature->CastSpell(player, SPELL_BUILD_CATAPULT_FORCE, true);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 : SPELL_BUILD_SIEGE_VEHICLE_FORCE_2, true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (Creature* controlArms = creature->FindNearestCreature(NPC_WINTERGRASP_CONTROL_ARMS, 30.0f, true))
|
||||||
|
creature->CastSpell(controlArms, SPELL_ACTIVATE_CONTROL_ARMS, true);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool canBuild(Creature* creature)
|
||||||
|
{
|
||||||
|
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||||
|
|
||||||
|
if (!wintergrasp)
|
||||||
|
return false;
|
||||||
|
switch (creature->GetEntry())
|
||||||
|
{
|
||||||
|
case NPC_GOBLIN_MECHANIC:
|
||||||
|
return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
|
||||||
|
case NPC_GNOMISH_ENGINEER:
|
||||||
|
return (wintergrasp->GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) > wintergrasp->GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 9);
|
|
||||||
|
|
||||||
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender */ , uint32 action)
|
|
||||||
{
|
|
||||||
player->CLOSE_GOSSIP_MENU();
|
|
||||||
|
|
||||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
|
||||||
|
|
||||||
if (!BfWG)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_MAX_VEHICLE_H : BATTLEFIELD_WG_DATA_MAX_VEHICLE_A) >
|
|
||||||
BfWG->GetData(creature->GetEntry() == 30400 ? BATTLEFIELD_WG_DATA_VEHICLE_H : BATTLEFIELD_WG_DATA_VEHICLE_A))
|
|
||||||
{
|
|
||||||
switch (action - GOSSIP_ACTION_INFO_DEF)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, creature->GetGUID());
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, creature->GetGUID());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, creature->GetGUID());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//spell 49899 Emote : 406 from sniff
|
|
||||||
//INSERT INTO `spell_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES ('49899', '0', '1', '406', '0', '0', '0', '0', '0', '0');
|
|
||||||
if (Creature* mechCreature = creature->FindNearestCreature(NPC_ROBOTIC_ARMS, 30.0f, true))
|
|
||||||
creature->CastSpell(mechCreature, SPELL_ACTIVATE_ROBOTIC_ARMS, true);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_wg_spirit_guide : public CreatureScript
|
class npc_wg_spirit_guide : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide")
|
npc_wg_spirit_guide() : CreatureScript("npc_wg_spirit_guide") { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OnGossipHello(Player* player, Creature* creature)
|
bool OnGossipHello(Player* player, Creature* creature)
|
||||||
{
|
|
||||||
if (creature->isQuestGiver())
|
|
||||||
player->PrepareQuestMenu(creature->GetGUID());
|
|
||||||
|
|
||||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
|
||||||
if (BfWG)
|
|
||||||
{
|
{
|
||||||
GraveYardVect gy = BfWG->GetGraveYardVect();
|
if (creature->isQuestGiver())
|
||||||
for (uint8 i = 0; i < gy.size(); i++)
|
player->PrepareQuestMenu(creature->GetGUID());
|
||||||
{
|
|
||||||
if (gy[i]->GetControlTeamId() == player->GetTeamId())
|
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||||
{
|
if (!wintergrasp)
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN,
|
return true;
|
||||||
GOSSIP_ACTION_INFO_DEF + i);
|
|
||||||
}
|
GraveyardVect graveyard = wintergrasp->GetGraveyardVector();
|
||||||
}
|
for (uint8 i = 0; i < graveyard.size(); i++)
|
||||||
|
if (graveyard[i]->GetControlTeamId() == player->GetTeamId())
|
||||||
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveyardWG*)graveyard[i])->GetTextId()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + i);
|
||||||
|
|
||||||
|
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action)
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 action)
|
|
||||||
{
|
|
||||||
player->CLOSE_GOSSIP_MENU();
|
|
||||||
|
|
||||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
|
||||||
if (BfWG)
|
|
||||||
{
|
{
|
||||||
GraveYardVect gy = BfWG->GetGraveYardVect();
|
player->CLOSE_GOSSIP_MENU();
|
||||||
for (uint8 i = 0; i < gy.size(); i++)
|
|
||||||
|
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||||
|
if (wintergrasp)
|
||||||
{
|
{
|
||||||
if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
|
GraveyardVect gy = wintergrasp->GetGraveyardVector();
|
||||||
{
|
for (uint8 i = 0; i < gy.size(); i++)
|
||||||
WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId());
|
if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
|
||||||
player->TeleportTo(ws->map_id, ws->x, ws->y, ws->z, 0);
|
if (WorldSafeLocsEntry const* safeLoc = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveyardId()))
|
||||||
}
|
player->TeleportTo(safeLoc->map_id, safeLoc->x, safeLoc->y, safeLoc->z, 0);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct npc_wg_spirit_guideAI : public ScriptedAI
|
||||||
|
{
|
||||||
|
npc_wg_spirit_guideAI(Creature* creature) : ScriptedAI(creature)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void UpdateAI(const uint32 /* diff */)
|
||||||
|
{
|
||||||
|
if (!me->HasUnitState(UNIT_STATE_CASTING))
|
||||||
|
DoCast(me, SPELL_CHANNEL_SPIRIT_HEAL);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CreatureAI *GetAI(Creature* creature) const
|
||||||
|
{
|
||||||
|
return new npc_wg_spirit_guideAI(creature);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_wg_queue : public CreatureScript
|
class npc_wg_queue : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
npc_wg_queue() : CreatureScript("npc_wg_queue")
|
npc_wg_queue() : CreatureScript("npc_wg_queue") { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OnGossipHello(Player* player, Creature* creature)
|
bool OnGossipHello(Player* player, Creature* creature)
|
||||||
{
|
|
||||||
if (creature->isQuestGiver())
|
|
||||||
player->PrepareQuestMenu(creature->GetGUID());
|
|
||||||
|
|
||||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
|
||||||
if (BfWG)
|
|
||||||
{
|
{
|
||||||
|
if (creature->isQuestGiver())
|
||||||
|
player->PrepareQuestMenu(creature->GetGUID());
|
||||||
|
|
||||||
if (BfWG->IsWarTime())
|
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||||
|
if (!wintergrasp)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (wintergrasp->IsWarTime())
|
||||||
{
|
{
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||||
player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID());
|
player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam()? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32 uiTime = BfWG->GetTimer() / 1000;
|
uint32 timer = wintergrasp->GetTimer() / 1000;
|
||||||
player->SendUpdateWorldState(4354, time(NULL) + uiTime);
|
player->SendUpdateWorldState(4354, time(NULL) + timer);
|
||||||
if (uiTime < 15 * MINUTE)
|
if (timer < 15 * MINUTE)
|
||||||
{
|
{
|
||||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||||
player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID());
|
player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
|
||||||
player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action */ )
|
bool OnGossipSelect(Player* player, Creature* /*creature */ , uint32 /*sender */ , uint32 /*action*/)
|
||||||
{
|
|
||||||
player->CLOSE_GOSSIP_MENU();
|
|
||||||
|
|
||||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
|
||||||
if (BfWG)
|
|
||||||
{
|
{
|
||||||
if (BfWG->IsWarTime())
|
player->CLOSE_GOSSIP_MENU();
|
||||||
{
|
|
||||||
BfWG->InvitePlayerToWar(player);
|
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||||
}
|
if (!wintergrasp)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (wintergrasp->IsWarTime())
|
||||||
|
wintergrasp->InvitePlayerToWar(player);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32 uiTime = BfWG->GetTimer() / 1000;
|
uint32 timer = wintergrasp->GetTimer() / 1000;
|
||||||
if (uiTime < 15 * MINUTE)
|
if (timer < 15 * MINUTE)
|
||||||
BfWG->InvitePlayerToQueue(player);
|
wintergrasp->InvitePlayerToQueue(player);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint32 Vehicules[4] = { 32627, 28312, 28094, 27881 };
|
|
||||||
|
|
||||||
class go_wg_vehicle_teleporter : public GameObjectScript
|
class go_wg_vehicle_teleporter : public GameObjectScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter")
|
go_wg_vehicle_teleporter() : GameObjectScript("go_wg_vehicle_teleporter") { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
struct go_wg_vehicle_teleporterAI : public GameObjectAI
|
struct go_wg_vehicle_teleporterAI : public GameObjectAI
|
||||||
{
|
|
||||||
go_wg_vehicle_teleporterAI(GameObject* g) : GameObjectAI(g)
|
|
||||||
{
|
{
|
||||||
uiCheckTimer = 1000;
|
go_wg_vehicle_teleporterAI(GameObject* gameObject) : GameObjectAI(gameObject),
|
||||||
}
|
_checkTimer(1000)
|
||||||
|
{ }
|
||||||
|
|
||||||
void UpdateAI(const uint32 diff)
|
void UpdateAI(const uint32 diff)
|
||||||
{
|
|
||||||
if (uiCheckTimer <= diff)
|
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < 4; i++)
|
if (_checkTimer <= diff)
|
||||||
if (Creature* vehicleCreature = go->FindNearestCreature(Vehicules[i], 3.0f, true))
|
{
|
||||||
if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT))
|
// Tabulation madness in the hole!
|
||||||
if (Vehicle* vehicle = vehicleCreature->GetVehicle())
|
for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++)
|
||||||
if (Unit* passenger = vehicle->GetPassenger(0))
|
if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true))
|
||||||
{
|
if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT))
|
||||||
uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION);
|
if (Vehicle* vehicle = vehicleCreature->GetVehicle())
|
||||||
uint32 plfaction = passenger->getFaction();
|
if (Unit* passenger = vehicle->GetPassenger(0))
|
||||||
if (gofaction == plfaction)
|
if (go->GetUInt32Value(GAMEOBJECT_FACTION) == passenger->getFaction())
|
||||||
{
|
if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true))
|
||||||
if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true))
|
teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
|
||||||
teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uiCheckTimer = 1000;
|
_checkTimer = 1000;
|
||||||
|
}
|
||||||
|
else _checkTimer -= diff;
|
||||||
}
|
}
|
||||||
else
|
private:
|
||||||
uiCheckTimer -= diff;
|
uint32 _checkTimer;
|
||||||
}
|
};
|
||||||
private:
|
|
||||||
uint32 uiCheckTimer;
|
|
||||||
};
|
|
||||||
|
|
||||||
GameObjectAI *GetAI(GameObject* go) const
|
GameObjectAI* GetAI(GameObject* go) const
|
||||||
{
|
{
|
||||||
return new go_wg_vehicle_teleporterAI(go);
|
return new go_wg_vehicle_teleporterAI(go);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class npc_wg_quest_giver : public CreatureScript
|
class npc_wg_quest_giver : public CreatureScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver")
|
npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") { }
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OnGossipHello(Player* player, Creature* creature)
|
bool OnGossipHello(Player* player, Creature* creature)
|
||||||
{
|
|
||||||
if (creature->isQuestGiver())
|
|
||||||
player->PrepareQuestMenu(creature->GetGUID());
|
|
||||||
|
|
||||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
|
||||||
if (BfWG)
|
|
||||||
{
|
{
|
||||||
if (creature->isQuestGiver())
|
if (creature->isQuestGiver())
|
||||||
{
|
player->PrepareQuestMenu(creature->GetGUID());
|
||||||
Object* object = (Object *) creature;
|
|
||||||
QuestRelations* objectQR = sObjectMgr->GetCreatureQuestRelationMap();
|
|
||||||
QuestRelations* objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation();
|
|
||||||
|
|
||||||
QuestMenu & qm = player->PlayerTalkClass->GetQuestMenu();
|
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||||
|
if (!wintergrasp)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (creature->isQuestGiver())
|
||||||
|
{
|
||||||
|
QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
|
||||||
|
QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
|
||||||
|
|
||||||
|
QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
|
||||||
qm.ClearMenu();
|
qm.ClearMenu();
|
||||||
|
|
||||||
for (QuestRelations::const_iterator i = objectQIR->lower_bound(object->GetEntry()); i != objectQIR->upper_bound(object->GetEntry()); ++i)
|
for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
|
||||||
{
|
{
|
||||||
uint32 quest_id = i->second;
|
uint32 quest_id = i->second;
|
||||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
QuestStatus status = player->GetQuestStatus(quest_id);
|
||||||
if (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id))
|
if (status == QUEST_STATUS_COMPLETE)
|
||||||
qm.AddMenuItem(quest_id, 4);
|
qm.AddMenuItem(quest_id, 4);
|
||||||
else if (status == QUEST_STATUS_INCOMPLETE)
|
else if (status == QUEST_STATUS_INCOMPLETE)
|
||||||
qm.AddMenuItem(quest_id, 4);
|
qm.AddMenuItem(quest_id, 4);
|
||||||
|
//else if (status == QUEST_STATUS_AVAILABLE)
|
||||||
|
// qm.AddMenuItem(quest_id, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QuestRelations::const_iterator i = objectQR->lower_bound(object->GetEntry()); i != objectQR->upper_bound(object->GetEntry()); ++i)
|
for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
|
||||||
{
|
{
|
||||||
uint32 quest_id = i->second;
|
uint32 questId = i->second;
|
||||||
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
|
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||||
if (!quest)
|
if (!quest)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (quest_id)
|
switch (questId)
|
||||||
{
|
{
|
||||||
// Horde attacker
|
// Horde attacker
|
||||||
case 13193:
|
case QUEST_BONES_AND_ARROWS_HORDE_ATT:
|
||||||
case 13202:
|
case QUEST_JINXING_THE_WALLS_HORDE_ATT:
|
||||||
case 13180:
|
case QUEST_SLAY_THEM_ALL_HORDE_ATT:
|
||||||
case 13200:
|
case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT:
|
||||||
case 13201:
|
case QUEST_HEALING_WITH_ROSES_HORDE_ATT:
|
||||||
case 13223:
|
case QUEST_DEFEND_THE_SIEGE_HORDE_ATT:
|
||||||
if (BfWG->GetAttackerTeam() == TEAM_HORDE)
|
if (wintergrasp->GetAttackerTeam() == TEAM_HORDE)
|
||||||
{
|
{
|
||||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
QuestStatus status = player->GetQuestStatus(questId);
|
||||||
|
|
||||||
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 4);
|
qm.AddMenuItem(questId, 4);
|
||||||
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 2);
|
qm.AddMenuItem(questId, 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Horde defender
|
// Horde defender
|
||||||
case 13199:
|
case QUEST_BONES_AND_ARROWS_HORDE_DEF:
|
||||||
case 13192:
|
case QUEST_WARDING_THE_WALLS_HORDE_DEF:
|
||||||
case 13178:
|
case QUEST_SLAY_THEM_ALL_HORDE_DEF:
|
||||||
case 13191:
|
case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF:
|
||||||
case 13194:
|
case QUEST_HEALING_WITH_ROSES_HORDE_DEF:
|
||||||
case 13539:
|
case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF:
|
||||||
case 13185:
|
case QUEST_STOP_THE_SIEGE_HORDE_DEF:
|
||||||
if (BfWG->GetDefenderTeam() == TEAM_HORDE)
|
if (wintergrasp->GetDefenderTeam() == TEAM_HORDE)
|
||||||
{
|
{
|
||||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
QuestStatus status = player->GetQuestStatus(questId);
|
||||||
|
|
||||||
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 4);
|
qm.AddMenuItem(questId, 4);
|
||||||
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 2);
|
qm.AddMenuItem(questId, 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Alliance attacker
|
// Alliance attacker
|
||||||
case 13196:
|
case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT:
|
||||||
case 13198:
|
case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT:
|
||||||
case 13179:
|
case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT:
|
||||||
case 13222:
|
case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT:
|
||||||
case 13195:
|
case QUEST_A_RARE_HERB_ALLIANCE_ATT:
|
||||||
if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE)
|
if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
QuestStatus status = player->GetQuestStatus(questId);
|
||||||
|
|
||||||
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 4);
|
qm.AddMenuItem(questId, 4);
|
||||||
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 2);
|
qm.AddMenuItem(questId, 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// Alliance defender
|
// Alliance defender
|
||||||
case 13154:
|
case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF:
|
||||||
case 13153:
|
case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF:
|
||||||
case 13177:
|
case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF:
|
||||||
case 13538:
|
case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF:
|
||||||
case 13186:
|
case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF:
|
||||||
case 13156:
|
case QUEST_A_RARE_HERB_ALLIANCE_DEF:
|
||||||
if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE)
|
if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
|
||||||
{
|
{
|
||||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
QuestStatus status = player->GetQuestStatus(questId);
|
||||||
|
|
||||||
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 4);
|
qm.AddMenuItem(questId, 4);
|
||||||
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 2);
|
qm.AddMenuItem(questId, 2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
QuestStatus status = player->GetQuestStatus(questId);
|
||||||
|
|
||||||
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 4);
|
qm.AddMenuItem(questId, 4);
|
||||||
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
|
||||||
qm.AddMenuItem(quest_id, 2);
|
qm.AddMenuItem(questId, 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,8 +453,43 @@ class npc_wg_quest_giver : public CreatureScript
|
|||||||
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
};
|
||||||
}
|
|
||||||
|
class spell_wintergrasp_force_building : public SpellScriptLoader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
spell_wintergrasp_force_building() : SpellScriptLoader("spell_wintergrasp_force_building") { }
|
||||||
|
|
||||||
|
class spell_wintergrasp_force_building_SpellScript : public SpellScript
|
||||||
|
{
|
||||||
|
PrepareSpellScript(spell_wintergrasp_force_building_SpellScript);
|
||||||
|
|
||||||
|
bool Validate(SpellInfo const* /*spell*/)
|
||||||
|
{
|
||||||
|
if (!sSpellMgr->GetSpellInfo(SPELL_BUILD_CATAPULT_FORCE)
|
||||||
|
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_DEMOLISHER_FORCE)
|
||||||
|
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_1)
|
||||||
|
|| !sSpellMgr->GetSpellInfo(SPELL_BUILD_SIEGE_VEHICLE_FORCE_2))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleScript(SpellEffIndex effIndex)
|
||||||
|
{
|
||||||
|
PreventHitDefaultEffect(effIndex);
|
||||||
|
GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register()
|
||||||
|
{
|
||||||
|
OnEffectHitTarget += SpellEffectFn(spell_wintergrasp_force_building_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
SpellScript* GetSpellScript() const
|
||||||
|
{
|
||||||
|
return new spell_wintergrasp_force_building_SpellScript();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
|
class achievement_wg_didnt_stand_a_chance : public AchievementCriteriaScript
|
||||||
@@ -444,7 +521,9 @@ void AddSC_wintergrasp()
|
|||||||
new npc_wg_queue();
|
new npc_wg_queue();
|
||||||
new npc_wg_spirit_guide();
|
new npc_wg_spirit_guide();
|
||||||
new npc_wg_demolisher_engineer();
|
new npc_wg_demolisher_engineer();
|
||||||
new go_wg_vehicle_teleporter();
|
|
||||||
new npc_wg_quest_giver();
|
new npc_wg_quest_giver();
|
||||||
new achievement_wg_didnt_stand_a_chance();
|
new achievement_wg_didnt_stand_a_chance();
|
||||||
|
new spell_wintergrasp_force_building();
|
||||||
|
|
||||||
|
new go_wg_vehicle_teleporter();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user