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 "GroupMgr.h"
|
||||
|
||||
|
||||
Battlefield::Battlefield()
|
||||
{
|
||||
m_Timer = 0;
|
||||
m_enable = true;
|
||||
m_BattlefieldActive = false;
|
||||
m_IsEnabled = true;
|
||||
m_isActive = false;
|
||||
m_DefenderTeam = TEAM_NEUTRAL;
|
||||
|
||||
m_TypeId = 0;
|
||||
@@ -51,7 +50,7 @@ Battlefield::Battlefield()
|
||||
m_TimeForAcceptInvite = 20;
|
||||
m_uiKickDontAcceptTimer = 1000;
|
||||
|
||||
m_uiKickAfkTimer = 1000;
|
||||
m_uiKickAfkPlayersTimer = 1000;
|
||||
|
||||
m_LastResurectTimer = 30 * IN_MILLISECONDS;
|
||||
m_StartGroupingTimer = 0;
|
||||
@@ -63,20 +62,19 @@ Battlefield::~Battlefield()
|
||||
{
|
||||
}
|
||||
|
||||
// Called when a player enters the zone
|
||||
void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
|
||||
{
|
||||
//If battle is start,
|
||||
// if it not fully > 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 battle is started,
|
||||
// If not full of players > invite player to join the war
|
||||
// If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
|
||||
if (IsWarTime())
|
||||
{
|
||||
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);
|
||||
}
|
||||
else //Full
|
||||
else // No more vacant places
|
||||
{
|
||||
//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;
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
@@ -88,9 +86,9 @@ void Battlefield::HandlePlayerEnterZone(Player *player, uint32 /*zone */ )
|
||||
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());
|
||||
OnPlayerEnterZone(player); //for scripting
|
||||
OnPlayerEnterZone(player);
|
||||
}
|
||||
|
||||
// Called when a player leave the zone
|
||||
@@ -98,15 +96,15 @@ void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ )
|
||||
{
|
||||
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())
|
||||
{
|
||||
m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
|
||||
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());
|
||||
|
||||
OnPlayerLeaveWar(player); //For scripting
|
||||
OnPlayerLeaveWar(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,55 +116,54 @@ void Battlefield::HandlePlayerLeaveZone(Player *player, uint32 /*zone */ )
|
||||
m_players[player->GetTeamId()].erase(player->GetGUID());
|
||||
SendRemoveWorldStates(player);
|
||||
RemovePlayerFromResurrectQueue(player->GetGUID());
|
||||
OnPlayerLeaveZone(player); //For scripting
|
||||
OnPlayerLeaveZone(player);
|
||||
}
|
||||
|
||||
bool Battlefield::Update(uint32 diff)
|
||||
{
|
||||
//When global timer is end
|
||||
if (m_Timer <= diff)
|
||||
{
|
||||
//Here end of battle by timer
|
||||
// Battlefield ends on time
|
||||
if (IsWarTime())
|
||||
EndBattle(true);
|
||||
//Start of battle
|
||||
else
|
||||
else // Time to start a new battle!
|
||||
StartBattle();
|
||||
}
|
||||
else
|
||||
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)
|
||||
{
|
||||
m_StartGrouping = true;
|
||||
InvitePlayerInZoneToQueue();
|
||||
OnStartGrouping(); // for scripting
|
||||
InvitePlayersInZoneToQueue();
|
||||
OnStartGrouping();
|
||||
}
|
||||
|
||||
bool objective_changed = false;
|
||||
if (IsWarTime())
|
||||
{
|
||||
if (m_uiKickAfkTimer <= diff)
|
||||
if (m_uiKickAfkPlayersTimer <= diff)
|
||||
{
|
||||
m_uiKickAfkTimer = 1000;
|
||||
KickAfk();
|
||||
m_uiKickAfkPlayersTimer = 1000;
|
||||
KickAfkPlayers();
|
||||
}
|
||||
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)
|
||||
{
|
||||
for (int team = 0; team < 2; team++)
|
||||
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); itr++)
|
||||
if ((*itr).second <= time(NULL))
|
||||
KickPlayerFromBf((*itr).first);
|
||||
InvitePlayerInZoneToWar();
|
||||
KickPlayerFromBattlefield((*itr).first);
|
||||
|
||||
InvitePlayersInZoneToWar();
|
||||
for (int team = 0; team < 2; team++)
|
||||
for (PlayerTimerMap::iterator itr = m_PlayersWillBeKick[team].begin(); itr != m_PlayersWillBeKick[team].end(); itr++)
|
||||
if ((*itr).second <= time(NULL))
|
||||
KickPlayerFromBf((*itr).first);
|
||||
KickPlayerFromBattlefield((*itr).first);
|
||||
|
||||
m_uiKickDontAcceptTimer = 1000;
|
||||
}
|
||||
@@ -181,9 +178,9 @@ bool Battlefield::Update(uint32 diff)
|
||||
|
||||
if (m_LastResurectTimer <= diff)
|
||||
{
|
||||
for (uint8 i = 0; i < m_GraveYardList.size(); i++)
|
||||
if (GetGraveYardById(i))
|
||||
m_GraveYardList[i]->Resurrect();
|
||||
for (uint8 i = 0; i < m_GraveyardList.size(); i++)
|
||||
if (GetGraveyardById(i))
|
||||
m_GraveyardList[i]->Resurrect();
|
||||
m_LastResurectTimer = RESURRECTION_INTERVAL;
|
||||
}
|
||||
else
|
||||
@@ -192,7 +189,7 @@ bool Battlefield::Update(uint32 diff)
|
||||
return objective_changed;
|
||||
}
|
||||
|
||||
void Battlefield::InvitePlayerInZoneToQueue()
|
||||
void Battlefield::InvitePlayersInZoneToQueue()
|
||||
{
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
@@ -205,11 +202,11 @@ void Battlefield::InvitePlayerToQueue(Player *player)
|
||||
if (m_PlayersInQueue[player->GetTeamId()].count(player->GetGUID()))
|
||||
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);
|
||||
}
|
||||
|
||||
void Battlefield::InvitePlayerInQueueToWar()
|
||||
void Battlefield::InvitePlayersInQueueToWar()
|
||||
{
|
||||
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 (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
@@ -240,14 +237,11 @@ void Battlefield::InvitePlayerInZoneToWar()
|
||||
continue;
|
||||
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
|
||||
InvitePlayerToWar(player);
|
||||
else
|
||||
{
|
||||
//full
|
||||
else // Battlefield is full of players
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Battlefield::InvitePlayerToWar(Player* player)
|
||||
{
|
||||
@@ -264,12 +258,14 @@ void Battlefield::InvitePlayerToWar(Player *player)
|
||||
return;
|
||||
}
|
||||
|
||||
// If the player does not match minimal level requirements for the battlefield, kick him
|
||||
if (player->getLevel() < m_MinLevel)
|
||||
{
|
||||
if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if player is not already in war
|
||||
if (m_PlayersInWar[player->GetTeamId()].count(player->GetGUID()) || m_InvitedPlayers[player->GetTeamId()].count(player->GetGUID()))
|
||||
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);
|
||||
}
|
||||
|
||||
void Battlefield::KickAfk()
|
||||
void Battlefield::KickAfkPlayers()
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
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->GetZoneId() == GetZoneId())
|
||||
@@ -305,7 +301,7 @@ void Battlefield::KickPlayerFromBf(uint64 guid)
|
||||
|
||||
void Battlefield::StartBattle()
|
||||
{
|
||||
if (m_BattlefieldActive)
|
||||
if (m_isActive)
|
||||
return;
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
||||
@@ -315,41 +311,41 @@ void Battlefield::StartBattle()
|
||||
}
|
||||
|
||||
m_Timer = m_BattleTime;
|
||||
m_BattlefieldActive = true;
|
||||
m_isActive = true;
|
||||
|
||||
InvitePlayerInZoneToWar();
|
||||
InvitePlayerInQueueToWar();
|
||||
InvitePlayersInZoneToWar();
|
||||
InvitePlayersInQueueToWar();
|
||||
|
||||
PlaySoundToAll(BF_START);
|
||||
DoPlaySoundToAll(BF_START);
|
||||
|
||||
OnBattleStart();
|
||||
}
|
||||
|
||||
void Battlefield::EndBattle(bool endbytimer)
|
||||
void Battlefield::EndBattle(bool endByTimer)
|
||||
{
|
||||
if (!m_BattlefieldActive)
|
||||
if (!m_isActive)
|
||||
return;
|
||||
|
||||
m_BattlefieldActive = false;
|
||||
m_isActive = false;
|
||||
|
||||
m_StartGrouping = false;
|
||||
|
||||
if (!endbytimer)
|
||||
if (!endByTimer)
|
||||
SetDefenderTeam(GetAttackerTeam());
|
||||
|
||||
if (GetDefenderTeam() == TEAM_ALLIANCE)
|
||||
PlaySoundToAll(BF_ALLIANCE_WINS); // alliance wins sound
|
||||
DoPlaySoundToAll(BF_ALLIANCE_WINS);
|
||||
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;
|
||||
SendInitWorldStatesToAll();
|
||||
}
|
||||
|
||||
void Battlefield::PlaySoundToAll(uint32 SoundID)
|
||||
void Battlefield::DoPlaySoundToAll(uint32 SoundID)
|
||||
{
|
||||
WorldPacket data;
|
||||
data.Initialize(SMSG_PLAY_SOUND, 4);
|
||||
@@ -357,11 +353,9 @@ void Battlefield::PlaySoundToAll(uint32 SoundID)
|
||||
|
||||
for (int team = 0; team < BG_TEAMS_COUNT; team++)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
{
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
bool Battlefield::HasPlayer(Player* player) const
|
||||
{
|
||||
@@ -371,11 +365,12 @@ bool Battlefield::HasPlayer(Player *player) const
|
||||
// Called in WorldSession::HandleBfQueueInviteResponse
|
||||
void Battlefield::PlayerAcceptInviteToQueue(Player* player)
|
||||
{
|
||||
// Add player in queueVenez
|
||||
// Add player in queue
|
||||
m_PlayersInQueue[player->GetTeamId()].insert(player->GetGUID());
|
||||
// Send notification
|
||||
player->GetSession()->SendBfQueueInviteResponce(m_BattleId, m_ZoneId);
|
||||
player->GetSession()->SendBfQueueInviteResponse(m_BattleId, m_ZoneId);
|
||||
}
|
||||
|
||||
// Called in WorldSession::HandleBfExitRequest
|
||||
void Battlefield::AskToLeaveQueue(Player* player)
|
||||
{
|
||||
@@ -394,7 +389,7 @@ void Battlefield::PlayerAcceptInviteToWar(Player *player)
|
||||
player->GetSession()->SendBfEntered(m_BattleId);
|
||||
m_PlayersInWar[player->GetTeamId()].insert(player->GetGUID());
|
||||
m_InvitedPlayers[player->GetTeamId()].erase(player->GetGUID());
|
||||
//Remove player AFK
|
||||
|
||||
if (player->isAFK())
|
||||
player->ToggleAFK();
|
||||
|
||||
@@ -407,14 +402,14 @@ void Battlefield::TeamCastSpell(TeamId team, int32 spellId)
|
||||
if (spellId > 0)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
player->CastSpell(player, (uint32) spellId, true);
|
||||
player->CastSpell(player, uint32(spellId), true);
|
||||
else
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++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 (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);
|
||||
}
|
||||
|
||||
void Battlefield::BroadcastPacketQueue(WorldPacket & data) const
|
||||
void Battlefield::BroadcastPacketToQueue(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
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);
|
||||
}
|
||||
|
||||
void Battlefield::BroadcastPacketWar(WorldPacket & data) const
|
||||
void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
|
||||
{
|
||||
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
@@ -477,11 +472,10 @@ void Battlefield::SendWarningToAllInZone(uint32 entry)
|
||||
WorldPacket data = BuildWarningAnnPacket(msg);
|
||||
BroadcastPacketWar(data);
|
||||
}*/
|
||||
|
||||
void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
if (player)
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(StalkerGuid))
|
||||
if (Creature* stalker = unit->ToCreature())
|
||||
sCreatureTextMgr->SendChat(stalker, (uint8)entry, player->GetGUID());
|
||||
@@ -500,38 +494,37 @@ void Battlefield::RegisterZone(uint32 zoneId)
|
||||
sBattlefieldMgr->AddZone(zoneId, this);
|
||||
}
|
||||
|
||||
void Battlefield::HideNpc(Creature *p_Creature)
|
||||
void Battlefield::HideNpc(Creature* creature)
|
||||
{
|
||||
p_Creature->CombatStop();
|
||||
p_Creature->SetReactState(REACT_PASSIVE);
|
||||
p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
p_Creature->SetPhaseMask(2, true);
|
||||
p_Creature->DisappearAndDie();
|
||||
p_Creature->SetVisible(false);
|
||||
creature->CombatStop();
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
creature->SetPhaseMask(2, true);
|
||||
creature->DisappearAndDie();
|
||||
creature->SetVisible(false);
|
||||
}
|
||||
|
||||
void Battlefield::ShowNpc(Creature *p_Creature, bool p_Aggressive)
|
||||
void Battlefield::ShowNpc(Creature* creature, bool aggressive)
|
||||
{
|
||||
p_Creature->SetPhaseMask(1, true);
|
||||
p_Creature->SetVisible(true);
|
||||
p_Creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
if (!p_Creature->isAlive())
|
||||
p_Creature->Respawn(true);
|
||||
if (p_Aggressive)
|
||||
p_Creature->SetReactState(REACT_AGGRESSIVE);
|
||||
creature->SetPhaseMask(1, true);
|
||||
creature->SetVisible(true);
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
if (!creature->isAlive())
|
||||
creature->Respawn(true);
|
||||
if (aggressive)
|
||||
creature->SetReactState(REACT_AGGRESSIVE);
|
||||
else
|
||||
{
|
||||
p_Creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
p_Creature->SetReactState(REACT_PASSIVE);
|
||||
creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
creature->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************************************
|
||||
//*******************Group System**********************
|
||||
//*****************************************************
|
||||
// ****************************************************
|
||||
// ******************* Group System *******************
|
||||
// ****************************************************
|
||||
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)
|
||||
if (Group* group = sGroupMgr->GetGroupByGUID(*itr))
|
||||
if (!group->IsFull())
|
||||
@@ -583,97 +576,97 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player *player)
|
||||
//*****************************************************
|
||||
//***************Spirit Guide System*******************
|
||||
//*****************************************************
|
||||
|
||||
//--------------------
|
||||
//-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])
|
||||
return m_GraveYardList[id];
|
||||
if (m_GraveyardList[id])
|
||||
return m_GraveyardList[id];
|
||||
else
|
||||
sLog->outError("Battlefield::GetGraveYardById Id:%u not existed", id);
|
||||
sLog->outError("Battlefield::GetGraveyardById Id:%u not existed", id);
|
||||
}
|
||||
else
|
||||
sLog->outError("Battlefield::GetGraveYardById Id:%u cant be found", id);
|
||||
sLog->outError("Battlefield::GetGraveyardById Id:%u cant be found", id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const * Battlefield::GetClosestGraveYard(Player* player)
|
||||
{
|
||||
BfGraveYard* closestGY = NULL;
|
||||
BfGraveyard* closestGY = NULL;
|
||||
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;
|
||||
|
||||
float dist = m_GraveYardList[i]->GetDistance(player);
|
||||
float dist = m_GraveyardList[i]->GetDistance(player);
|
||||
if (dist < maxdist || maxdist < 0)
|
||||
{
|
||||
closestGY = m_GraveYardList[i];
|
||||
closestGY = m_GraveyardList[i];
|
||||
maxdist = dist;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closestGY)
|
||||
return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveYardId());
|
||||
return sWorldSafeLocsStore.LookupEntry(closestGY->GetGraveyardId());
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
uint32 time = m_LastResurectTimer; // resurrect every 30 seconds
|
||||
|
||||
data << guid << time;
|
||||
ASSERT(pl && pl->GetSession());
|
||||
pl->GetSession()->SendPacket(&data);
|
||||
ASSERT(player && player->GetSession());
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
//--------------------
|
||||
//-BfGraveYard Method-
|
||||
//--------------------
|
||||
BfGraveYard::BfGraveYard(Battlefield *Bf)
|
||||
// ----------------------
|
||||
// - BfGraveyard Method -
|
||||
// ----------------------
|
||||
BfGraveyard::BfGraveyard(Battlefield* battlefield)
|
||||
{
|
||||
m_Bf = Bf;
|
||||
m_Bf = battlefield;
|
||||
m_GraveyardId = 0;
|
||||
m_ControlTeam = TEAM_NEUTRAL;
|
||||
m_SpiritGuide[0] = NULL;
|
||||
@@ -681,17 +674,17 @@ BfGraveYard::BfGraveYard(Battlefield *Bf)
|
||||
m_ResurrectQueue.clear();
|
||||
}
|
||||
|
||||
void BfGraveYard::Initialize(TeamId startcontrol, uint32 gy)
|
||||
void BfGraveyard::Initialize(TeamId startControl, uint32 graveyardId)
|
||||
{
|
||||
m_ControlTeam = startcontrol;
|
||||
m_GraveyardId = gy;
|
||||
m_ControlTeam = startControl;
|
||||
m_GraveyardId = graveyardId;
|
||||
}
|
||||
|
||||
void BfGraveYard::SetSpirit(Creature* spirit, TeamId team)
|
||||
void BfGraveyard::SetSpirit(Creature* spirit, TeamId team)
|
||||
{
|
||||
if (!spirit)
|
||||
{
|
||||
sLog->outError("<Error - Wintergrasp>: Invalid Spirit.");
|
||||
sLog->outError("BfGraveyard::SetSpirit: Invalid Spirit.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -699,32 +692,32 @@ void BfGraveYard::SetSpirit(Creature* spirit, TeamId team)
|
||||
spirit->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
float BfGraveYard::GetDistance(Player *player)
|
||||
float BfGraveyard::GetDistance(Player* player)
|
||||
{
|
||||
const WorldSafeLocsEntry* ws = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
|
||||
return player->GetDistance2d(ws->x, ws->y);
|
||||
const WorldSafeLocsEntry* safeLoc = sWorldSafeLocsStore.LookupEntry(m_GraveyardId);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void BfGraveYard::Resurrect()
|
||||
void BfGraveyard::Resurrect()
|
||||
{
|
||||
if (m_ResurrectQueue.empty())
|
||||
return;
|
||||
@@ -736,7 +729,7 @@ void BfGraveYard::Resurrect()
|
||||
if (!player)
|
||||
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 (Unit* spirit = sObjectAccessor->FindUnit(m_SpiritGuide[m_ControlTeam]))
|
||||
spirit->CastSpell(spirit, SPELL_SPIRIT_HEAL, true);
|
||||
@@ -754,7 +747,7 @@ void BfGraveYard::Resurrect()
|
||||
}
|
||||
|
||||
// For changing graveyard control
|
||||
void BfGraveYard::ChangeControl(TeamId team)
|
||||
void BfGraveyard::GiveControlTo(TeamId team)
|
||||
{
|
||||
// Guide switching
|
||||
// Note: Visiblity changes are made by phasing
|
||||
@@ -768,32 +761,32 @@ void BfGraveYard::ChangeControl(TeamId team)
|
||||
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)
|
||||
{
|
||||
Player* player = sObjectAccessor->FindPlayer(*itr);
|
||||
if (!player)
|
||||
continue;
|
||||
|
||||
if (ClosestGrave)
|
||||
player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
|
||||
if (closestGrave)
|
||||
player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
|
||||
else
|
||||
{
|
||||
ClosestGrave = m_Bf->GetClosestGraveYard(player);
|
||||
if (ClosestGrave)
|
||||
player->TeleportTo(player->GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
|
||||
closestGrave = m_Bf->GetClosestGraveYard(player);
|
||||
if (closestGrave)
|
||||
player->TeleportTo(player->GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// *******************************************************
|
||||
// *************** End Spirit Guide system ***************
|
||||
|
||||
//*****************************************************
|
||||
// *******************************************************
|
||||
// ********************** 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);
|
||||
@@ -805,15 +798,14 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(m_MapId));
|
||||
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;
|
||||
}
|
||||
|
||||
//Create creature
|
||||
Creature* creature = new Creature;
|
||||
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;
|
||||
return NULL;
|
||||
}
|
||||
@@ -823,7 +815,7 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (!cinfo)
|
||||
{
|
||||
sLog->outErrorDb("Battleground::AddCreature: entry %u does not exist.", entry);
|
||||
sLog->outErrorDb("Battlefield::SpawnCreature: entry %u does not exist.", entry);
|
||||
return NULL;
|
||||
}
|
||||
// force using DB speeds -- do we really need this?
|
||||
@@ -841,7 +833,7 @@ Creature *Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
|
||||
GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z, float o)
|
||||
{
|
||||
// Get map object
|
||||
Map* map = const_cast < Map * >(sMapMgr->CreateBaseMap(571));
|
||||
Map* map = const_cast<Map*>(sMapMgr->CreateBaseMap(571)); // *vomits*
|
||||
if (!map)
|
||||
return 0;
|
||||
|
||||
@@ -849,23 +841,24 @@ GameObject *Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
|
||||
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))
|
||||
{
|
||||
sLog->outErrorDb("Gameobject template %u not found in database! Battleground not created!", entry);
|
||||
sLog->outError("Cannot create gameobject template %u! Battleground not created!", entry);
|
||||
sLog->outErrorDb("Battlefield::SpawnGameObject: Gameobject template %u not found in database! Battlefield not created!", entry);
|
||||
sLog->outError("Battlefield::SpawnGameObject: Cannot create gameobject template %u! Battlefield not created!", entry);
|
||||
delete go;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Add in the world
|
||||
// Add to world
|
||||
map->AddToMap(go);
|
||||
go->setActive(true);
|
||||
|
||||
return go;
|
||||
}
|
||||
|
||||
//*****************************************************
|
||||
// *******************************************************
|
||||
// ******************* 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_value = 0;
|
||||
@@ -882,23 +875,23 @@ bool BfCapturePoint::HandlePlayerEnter(Player *player)
|
||||
if (m_capturePoint)
|
||||
{
|
||||
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);
|
||||
}
|
||||
return m_activePlayers[player->GetTeamId()].insert(player->GetGUID()).second;
|
||||
}
|
||||
|
||||
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* plr)
|
||||
GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
|
||||
{
|
||||
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()
|
||||
|
||||
m_activePlayers[plr->GetTeamId()].erase(current++);
|
||||
m_activePlayers[player->GetTeamId()].erase(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();)
|
||||
{
|
||||
if (Player* plr = sObjectAccessor->FindPlayer(*itr))
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
{
|
||||
if (!m_capturePoint->IsWithinDistInMap(plr, radius) || !plr->IsOutdoorPvPActive())
|
||||
itr = HandlePlayerLeave(plr);
|
||||
if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive())
|
||||
itr = HandlePlayerLeave(player);
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ class Creature;
|
||||
class Unit;
|
||||
|
||||
class Battlefield;
|
||||
class BfGraveYard;
|
||||
class BfGraveyard;
|
||||
|
||||
typedef std::set<uint64> GuidSet;
|
||||
typedef std::vector < BfGraveYard * >GraveYardVect;
|
||||
typedef std::vector<BfGraveyard*> GraveyardVect;
|
||||
typedef std::map<uint64, uint32> PlayerTimerMap;
|
||||
|
||||
class BfCapturePoint
|
||||
@@ -81,21 +81,21 @@ public:
|
||||
|
||||
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);
|
||||
|
||||
// send kill notify to players in the controlling faction
|
||||
// Send kill notify to players in the controlling faction
|
||||
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 GuidSet::iterator HandlePlayerLeave(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;
|
||||
|
||||
// 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 void ChangeTeam(TeamId /*oldTeam*/) {}
|
||||
virtual void SendChangePhase();
|
||||
@@ -107,55 +107,70 @@ public:
|
||||
protected:
|
||||
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];
|
||||
|
||||
// total shift needed to capture the objective
|
||||
// Total shift needed to capture the objective
|
||||
float m_maxValue;
|
||||
float m_minValue;
|
||||
|
||||
// maximum speed of capture
|
||||
// Maximum speed of capture
|
||||
float m_maxSpeed;
|
||||
|
||||
// the status of the objective
|
||||
// The status of the objective
|
||||
float m_value;
|
||||
TeamId m_team;
|
||||
|
||||
// objective states
|
||||
// Objective states
|
||||
BattlefieldObjectiveStates m_OldState;
|
||||
BattlefieldObjectiveStates m_State;
|
||||
|
||||
// neutral value on capture bar
|
||||
// Neutral value on capture bar
|
||||
uint32 m_neutralValuePct;
|
||||
|
||||
// pointer to the Battlefield this objective belongs to
|
||||
// Pointer to the Battlefield this objective belongs to
|
||||
Battlefield* m_Bf;
|
||||
|
||||
// Capture point entry
|
||||
uint32 m_capturePointEntry;
|
||||
|
||||
// Gameobject related to that capture point
|
||||
GameObject* m_capturePoint;
|
||||
};
|
||||
|
||||
class BfGraveYard
|
||||
class BfGraveyard
|
||||
{
|
||||
public:
|
||||
BfGraveYard(Battlefield *Bf);
|
||||
BfGraveyard(Battlefield* Bf);
|
||||
|
||||
// method for change who control the graveyard
|
||||
void ChangeControl(TeamId team);
|
||||
// Method to changing who controls the graveyard
|
||||
void GiveControlTo(TeamId team);
|
||||
TeamId GetControlTeamId() { return m_ControlTeam; }
|
||||
|
||||
// use for found the nearest graveyard
|
||||
// Find the nearest graveyard to a player
|
||||
float GetDistance(Player* player);
|
||||
|
||||
// Initialize the graveyard
|
||||
void Initialize(TeamId startcontrol, uint32 gy);
|
||||
|
||||
// Set spirit service for the graveyard
|
||||
void SetSpirit(Creature* spirit, TeamId team);
|
||||
|
||||
// Add a player to the graveyard
|
||||
void AddPlayer(uint64 player_guid);
|
||||
|
||||
// Remove a player from the graveyard
|
||||
void RemovePlayer(uint64 player_guid);
|
||||
|
||||
// Resurrect players
|
||||
void Resurrect();
|
||||
|
||||
// Move players waiting to that graveyard on the nearest one
|
||||
void RelocateDeadPlayers();
|
||||
|
||||
// Check if this graveyard has a spirit guide
|
||||
bool HasNpc(uint64 guid)
|
||||
{
|
||||
// npcs could not be loaded in the map yet.
|
||||
if (!m_SpiritGuide[0] || !m_SpiritGuide[1])
|
||||
return false;
|
||||
|
||||
@@ -165,11 +180,14 @@ public:
|
||||
|
||||
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(); }
|
||||
uint32 GetGraveYardId() { return m_GraveyardId; }
|
||||
|
||||
// Get the graveyard's ID.
|
||||
uint32 GetGraveyardId() { return m_GraveyardId; }
|
||||
|
||||
protected:
|
||||
|
||||
TeamId m_ControlTeam;
|
||||
uint32 m_GraveyardId;
|
||||
uint64 m_SpiritGuide[2];
|
||||
@@ -202,18 +220,18 @@ class Battlefield : public ZoneScript
|
||||
/**
|
||||
* \brief Called every time for update bf data and time
|
||||
* - 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
|
||||
* \param diff : time ellapsed since last call (in ms)
|
||||
*/
|
||||
virtual bool Update(uint32 diff);
|
||||
|
||||
/// Invite all player in zone, to join the queue, called x minutes before battle start in Update()
|
||||
void InvitePlayerInZoneToQueue();
|
||||
/// Invite all player in queue to join battle on battle start
|
||||
void InvitePlayerInQueueToWar();
|
||||
/// Invite all player in zone to join battle on battle start
|
||||
void InvitePlayerInZoneToWar();
|
||||
/// Invite all players in zone to join the queue, called x minutes before battle start in Update()
|
||||
void InvitePlayersInZoneToQueue();
|
||||
/// Invite all players in queue to join battle on battle start
|
||||
void InvitePlayersInQueueToWar();
|
||||
/// Invite all players in zone to join battle on battle start
|
||||
void InvitePlayersInZoneToWar();
|
||||
|
||||
/// Called when a Unit is kill in battlefield zone
|
||||
virtual void HandleKill(Player* /*killer*/, Unit* /*killed*/) {};
|
||||
@@ -224,18 +242,18 @@ class Battlefield : public ZoneScript
|
||||
void TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2 = 0);
|
||||
|
||||
/// Return true if battle is start, false if battle is not started
|
||||
bool IsWarTime() { return m_BattlefieldActive; }
|
||||
bool IsWarTime() { return m_isActive; }
|
||||
|
||||
/// Enable or Disable battlefield
|
||||
void SetEnable(bool enable) { m_enable = enable; }
|
||||
void ToggleBattlefield(bool enable) { m_IsEnabled = 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
|
||||
* \param guid : guid of player who must be kick
|
||||
*/
|
||||
void KickPlayerFromBf(uint64 guid);
|
||||
void KickPlayerFromBattlefield(uint64 guid);
|
||||
|
||||
/// Called when player (player) enter in zone
|
||||
void HandlePlayerEnterZone(Player* player, uint32 zone);
|
||||
@@ -243,16 +261,18 @@ class Battlefield : public ZoneScript
|
||||
void HandlePlayerLeaveZone(Player* player, uint32 zone);
|
||||
|
||||
// All-purpose data storage 64 bit
|
||||
virtual uint64 GetData64(uint32 DataId) { return m_Data64[DataId]; }
|
||||
virtual void SetData64(uint32 DataId, uint64 Value) { m_Data64[DataId] = Value; }
|
||||
virtual uint64 GetData64(uint32 dataId) { return m_Data64[dataId]; }
|
||||
virtual void SetData64(uint32 dataId, uint64 value) { m_Data64[dataId] = value; }
|
||||
|
||||
// All-purpose data storage 32 bit
|
||||
virtual uint32 GetData(uint32 DataId) { return m_Data32[DataId]; }
|
||||
virtual void SetData(uint32 DataId, uint32 Value) { m_Data32[DataId] = Value; }
|
||||
virtual uint32 GetData(uint32 dataId) { return m_Data32[dataId]; }
|
||||
virtual void SetData(uint32 dataId, uint32 value) { m_Data32[dataId] = value; }
|
||||
virtual void UpdateData(uint32 index, int32 pad) { m_Data32[index] += pad; }
|
||||
|
||||
// Battlefield - generic methods
|
||||
TeamId GetDefenderTeam() { return m_DefenderTeam; }
|
||||
TeamId GetAttackerTeam() { return TeamId(1 - m_DefenderTeam); }
|
||||
TeamId GetOtherTeam(TeamId team) { return (team == TEAM_HORDE ? TEAM_ALLIANCE : TEAM_HORDE); }
|
||||
void SetDefenderTeam(TeamId team) { m_DefenderTeam = team; }
|
||||
|
||||
// Group methods
|
||||
@@ -272,8 +292,8 @@ class Battlefield : public ZoneScript
|
||||
|
||||
virtual void AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid);
|
||||
void RemovePlayerFromResurrectQueue(uint64 player_guid);
|
||||
void SetGraveyardNumber(uint32 number) { m_GraveYardList.resize(number); }
|
||||
BfGraveYard *GetGraveYardById(uint32 id);
|
||||
void SetGraveyardNumber(uint32 number) { m_GraveyardList.resize(number); }
|
||||
BfGraveyard* GetGraveyardById(uint32 id);
|
||||
|
||||
// Misc methods
|
||||
Creature* SpawnCreature(uint32 entry, float x, float y, float z, float o, TeamId team);
|
||||
@@ -285,7 +305,7 @@ class Battlefield : public ZoneScript
|
||||
/// Called on start
|
||||
virtual void OnBattleStart() {};
|
||||
/// 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
|
||||
virtual void OnStartGrouping() {};
|
||||
/// Called when a player accept to join the battle
|
||||
@@ -313,21 +333,22 @@ class Battlefield : public ZoneScript
|
||||
virtual void SendInitWorldStatesToAll() {};
|
||||
|
||||
/// Return if we can use mount in battlefield
|
||||
bool CanFlyIn() { return !m_BattlefieldActive; } // Used for check if we can use flying mount or not
|
||||
void SendAreaSpiritHealerQueryOpcode(Player * pl, const uint64 & guid);
|
||||
bool CanFlyIn() { return !m_isActive; }
|
||||
|
||||
void SendAreaSpiritHealerQueryOpcode(Player* player, const uint64 & guid);
|
||||
|
||||
void StartBattle();
|
||||
void EndBattle(bool endbytimer);
|
||||
void EndBattle(bool endByTimer);
|
||||
|
||||
void HideNpc(Creature * p_Creature);
|
||||
void ShowNpc(Creature * p_Creature, bool p_Aggressive);
|
||||
void HideNpc(Creature* creature);
|
||||
void ShowNpc(Creature* creature, bool aggressive);
|
||||
|
||||
GraveYardVect GetGraveYardVect() { return m_GraveYardList; }
|
||||
GraveyardVect GetGraveyardVector() { return m_GraveyardList; }
|
||||
|
||||
uint32 GetTimer() { return m_Timer; }
|
||||
void SetTimer(uint32 timer) { m_Timer = timer; }
|
||||
|
||||
void PlaySoundToAll(uint32 SoundID);
|
||||
void DoPlaySoundToAll(uint32 SoundID);
|
||||
|
||||
void InvitePlayerToQueue(Player* player);
|
||||
void InvitePlayerToWar(Player* player);
|
||||
@@ -337,14 +358,14 @@ class Battlefield : public ZoneScript
|
||||
protected:
|
||||
uint64 StalkerGuid;
|
||||
uint32 m_Timer; // Global timer for event
|
||||
bool m_enable;
|
||||
bool m_BattlefieldActive;
|
||||
bool m_IsEnabled;
|
||||
bool m_isActive;
|
||||
TeamId m_DefenderTeam;
|
||||
|
||||
// the map of the objectives belonging to this outdoorpvp
|
||||
// Map of the objectives belonging to this OutdoorPvP
|
||||
BfCapturePointMap m_capturePoints;
|
||||
|
||||
// the set of player
|
||||
// Players info maps
|
||||
GuidSet m_players[BG_TEAMS_COUNT]; // Players in zone
|
||||
GuidSet m_PlayersInQueue[BG_TEAMS_COUNT]; // Players in the queue
|
||||
GuidSet m_PlayersInWar[BG_TEAMS_COUNT]; // Players in WG combat
|
||||
@@ -364,12 +385,12 @@ protected:
|
||||
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
|
||||
WorldLocation KickPosition; // Position where players are teleported if they switch to afk during the battle or if they don't accept invitation
|
||||
|
||||
uint32 m_uiKickAfkTimer; // Timer for check Afk in war
|
||||
uint32 m_uiKickAfkPlayersTimer; // Timer for check Afk in war
|
||||
|
||||
// Graveyard variables
|
||||
GraveYardVect m_GraveYardList; // Vector witch contain the different GY of the battle
|
||||
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
|
||||
@@ -380,14 +401,15 @@ protected:
|
||||
std::vector<uint64> m_Data64;
|
||||
std::vector<uint32> m_Data32;
|
||||
|
||||
void KickAfk();
|
||||
void KickAfkPlayers();
|
||||
|
||||
// use for switch off all worldstate for client
|
||||
virtual void SendRemoveWorldStates(Player* /*player*/) {}
|
||||
|
||||
// use for send a packet for all player list
|
||||
void BroadcastPacketZone(WorldPacket & data) const;
|
||||
void BroadcastPacketQueue(WorldPacket & data) const;
|
||||
void BroadcastPacketWar(WorldPacket & data) const;
|
||||
void BroadcastPacketToZone(WorldPacket& data) const;
|
||||
void BroadcastPacketToQueue(WorldPacket& data) const;
|
||||
void BroadcastPacketToWar(WorldPacket& data) const;
|
||||
|
||||
// CapturePoint system
|
||||
void AddCapturePoint(BfCapturePoint* cp) { m_capturePoints[cp->GetCapturePointGo()->GetEntry()] = cp; }
|
||||
@@ -403,7 +425,6 @@ protected:
|
||||
void RegisterZone(uint32 zoneid);
|
||||
bool HasPlayer(Player* player) const;
|
||||
void TeamCastSpell(TeamId team, int32 spellId);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -60,7 +60,7 @@ void WorldSession::SendBfInvitePlayerToQueue(uint32 BattleId)
|
||||
//Param2:(ZoneId) the zone where the battle is (4197 for wg)
|
||||
//Param3:(CanQueue) if able to queue
|
||||
//Param4:(Full) on log in is full
|
||||
void WorldSession::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);
|
||||
data << uint32(BattleId);
|
||||
@@ -132,7 +132,7 @@ void WorldSession::HandleBfEntryInviteResponse(WorldPacket & recv_data)
|
||||
else
|
||||
{
|
||||
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())
|
||||
return;
|
||||
|
||||
if (itr->second->HasPlayer(player))
|
||||
return;
|
||||
if (itr->second->GetEnable() == false)
|
||||
if (itr->second->HasPlayer(player) || !itr->second->IsEnabled())
|
||||
return;
|
||||
|
||||
itr->second->HandlePlayerEnterZone(player, zoneid);
|
||||
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
|
||||
return NULL;
|
||||
}
|
||||
if (itr->second->GetEnable() == false)
|
||||
if (!itr->second->IsEnabled())
|
||||
return NULL;
|
||||
return itr->second;
|
||||
}
|
||||
@@ -127,7 +126,7 @@ void BattlefieldMgr::Update(uint32 diff)
|
||||
if (m_UpdateTimer > BATTLEFIELD_OBJECTIVE_UPDATE_INTERVAL)
|
||||
{
|
||||
for (BattlefieldSet::iterator itr = m_BattlefieldSet.begin(); itr != m_BattlefieldSet.end(); ++itr)
|
||||
if ((*itr)->GetEnable())
|
||||
if ((*itr)->IsEnabled())
|
||||
(*itr)->Update(m_UpdateTimer);
|
||||
m_UpdateTimer = 0;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "SpellAuras.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
enum WGBfData
|
||||
enum WintergrastData
|
||||
{
|
||||
BATTLEFIELD_WG_ZONEID = 4197, // Wintergrasp
|
||||
BATTLEFIELD_WG_MAPID = 571, // Northrend
|
||||
@@ -49,7 +49,7 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
m_MapId = BATTLEFIELD_WG_MAPID;
|
||||
|
||||
m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
|
||||
m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
|
||||
m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
|
||||
m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN);
|
||||
m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MIN_LVL);
|
||||
m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS;
|
||||
@@ -72,39 +72,39 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
m_saveTimer = 60000;
|
||||
|
||||
// Init GraveYards
|
||||
SetGraveyardNumber(BATTLEFIELD_WG_GY_MAX);
|
||||
SetGraveyardNumber(BATTLEFIELD_WG_GRAVEYARD_MAX);
|
||||
|
||||
// Load from db
|
||||
if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0)
|
||||
&& (sWorld->getWorldState(ClockWorldState[0]) == 0))
|
||||
{
|
||||
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, false);
|
||||
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, urand(0, 1));
|
||||
sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime);
|
||||
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, uint64(false));
|
||||
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, uint64(urand(0, 1)));
|
||||
sWorld->setWorldState(ClockWorldState[0], uint64(m_NoWarBattleTime));
|
||||
}
|
||||
|
||||
m_BattlefieldActive = sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE);
|
||||
m_isActive = bool(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE));
|
||||
m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER));
|
||||
|
||||
m_Timer = sWorld->getWorldState(ClockWorldState[0]);
|
||||
if (m_BattlefieldActive)
|
||||
if (m_isActive)
|
||||
{
|
||||
m_BattlefieldActive = false;
|
||||
m_isActive = false;
|
||||
m_Timer = m_RestartAfterCrash;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++)
|
||||
for (uint8 i = 0; i < BATTLEFIELD_WG_GRAVEYARD_MAX; i++)
|
||||
{
|
||||
BfGraveYardWG *gy = new BfGraveYardWG(this);
|
||||
BfGraveyardWG* graveyard = new BfGraveyardWG(this);
|
||||
|
||||
// When between games, the graveyard is controlled by the defending team
|
||||
if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL)
|
||||
gy->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
|
||||
graveyard->Initialize(m_DefenderTeam, WGGraveYard[i].gyid);
|
||||
else
|
||||
gy->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
|
||||
graveyard->Initialize(WGGraveYard[i].startcontrol, WGGraveYard[i].gyid);
|
||||
|
||||
gy->SetTextId(WGGraveYard[i].textid);
|
||||
m_GraveYardList[i] = gy;
|
||||
graveyard->SetTextId(WGGraveYard[i].textid);
|
||||
m_GraveyardList[i] = graveyard;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,61 +113,68 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
{
|
||||
WGWorkshop* workshop = new WGWorkshop(this, i);
|
||||
if (i < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
workshop->ChangeControl(GetAttackerTeam(), true);
|
||||
workshop->GiveControlTo(GetAttackerTeam(), true);
|
||||
else
|
||||
workshop->ChangeControl(GetDefenderTeam(), true);
|
||||
workshop->GiveControlTo(GetDefenderTeam(), true);
|
||||
|
||||
// Note: Capture point is added once the gameobject is created.
|
||||
|
||||
WorkshopsList.insert(workshop);
|
||||
}
|
||||
|
||||
// Spawning npc in keep
|
||||
// Spawn NPCs in the defender's keep, both Horde and Alliance
|
||||
for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++)
|
||||
{
|
||||
// Horde npc
|
||||
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
|
||||
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryHorde, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE))
|
||||
KeepCreature[TEAM_HORDE].insert(creature->GetGUID());
|
||||
// Alliance npc
|
||||
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
|
||||
if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryAlliance, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE))
|
||||
KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
}
|
||||
// Hide keep npc
|
||||
|
||||
// Hide NPCs from the Attacker's team in the keep
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
// Spawn out of keep npc
|
||||
// Horde npc
|
||||
|
||||
// Spawn Horde NPCs outside the keep
|
||||
for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++)
|
||||
if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
|
||||
if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryHorde, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE))
|
||||
OutsideCreature[TEAM_HORDE].insert(creature->GetGUID());
|
||||
// Alliance npc
|
||||
|
||||
// Spawn Alliance NPCs outside the keep
|
||||
for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++)
|
||||
if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
|
||||
if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryAlliance, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE))
|
||||
OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
// Hide outside npc
|
||||
|
||||
// Hide units outside the keep that are defenders
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
|
||||
// Spawn turrets and hide them per default
|
||||
for (uint8 i = 0; i < WG_MAX_TURRET; i++)
|
||||
{
|
||||
if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0)))
|
||||
Position towerCannonPos;
|
||||
WGTurret[i].GetPosition(&towerCannonPos);
|
||||
if (Creature* creature = SpawnCreature(NPC_TOWER_CANNON, towerCannonPos, TEAM_ALLIANCE))
|
||||
{
|
||||
CanonList.insert(creature->GetGUID());
|
||||
HideNpc(creature);
|
||||
}
|
||||
}
|
||||
// Spawning Buiding
|
||||
|
||||
// Spawn all gameobjects
|
||||
for (uint8 i = 0; i < WG_MAX_OBJ; i++)
|
||||
{
|
||||
GameObject* go =
|
||||
SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o);
|
||||
GameObject* go = SpawnGameObject(WGGameObjectBuilding[i].entry, WGGameObjectBuilding[i].x, WGGameObjectBuilding[i].y, WGGameObjectBuilding[i].z, WGGameObjectBuilding[i].o);
|
||||
BfWGGameObjectBuilding* b = new BfWGGameObjectBuilding(this);
|
||||
b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid);
|
||||
b->Init(go, WGGameObjectBuilding[i].type, WGGameObjectBuilding[i].WorldState, WGGameObjectBuilding[i].nameId);
|
||||
BuildingsInZone.insert(b);
|
||||
}
|
||||
|
||||
// Spawning portal defender
|
||||
for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++)
|
||||
{
|
||||
@@ -176,15 +183,15 @@ bool BattlefieldWG::SetupBattlefield()
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]);
|
||||
}
|
||||
|
||||
// Spawn banner in keep
|
||||
// Spawn banners in the keep
|
||||
for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++)
|
||||
{
|
||||
if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryHorde, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
{
|
||||
go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY);
|
||||
m_KeepGameObject[1].insert(go);
|
||||
}
|
||||
if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryAlliance, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o))
|
||||
{
|
||||
go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY);
|
||||
m_KeepGameObject[0].insert(go);
|
||||
@@ -208,7 +215,7 @@ bool BattlefieldWG::Update(uint32 diff)
|
||||
bool m_return = Battlefield::Update(diff);
|
||||
if (m_saveTimer <= diff)
|
||||
{
|
||||
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_BattlefieldActive);
|
||||
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, m_isActive);
|
||||
sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, m_DefenderTeam);
|
||||
sWorld->setWorldState(ClockWorldState[0], m_Timer);
|
||||
m_saveTimer = 60 * IN_MILLISECONDS;
|
||||
@@ -222,13 +229,13 @@ bool BattlefieldWG::Update(uint32 diff)
|
||||
void BattlefieldWG::OnBattleStart()
|
||||
{
|
||||
// Spawn titan relic
|
||||
m_relic = SpawnGameObject(BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
|
||||
if (m_relic)
|
||||
m_titansRelic = SpawnGameObject(GO_WINTERGRASP_TITAN_S_RELIC, 5440.0f, 2840.8f, 430.43f, 0);
|
||||
if (m_titansRelic)
|
||||
{
|
||||
// Update faction of relic, only attacker can click on
|
||||
m_relic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
|
||||
m_titansRelic->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetAttackerTeam()]);
|
||||
// Set in use (not allow to click on before last door is broken)
|
||||
m_relic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
m_titansRelic->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
}
|
||||
else
|
||||
sLog->outError("WG: Failed to spawn titan relic.");
|
||||
@@ -257,17 +264,15 @@ void BattlefieldWG::OnBattleStart()
|
||||
}
|
||||
}
|
||||
|
||||
m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] = 0;
|
||||
m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] = 0;
|
||||
m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT] = 0;
|
||||
m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF] = 0;
|
||||
SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0);
|
||||
SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 0);
|
||||
SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0);
|
||||
SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 0);
|
||||
|
||||
// Update graveyard (in no war time all graveyard is to deffender, in war time, depend of base)
|
||||
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
|
||||
{
|
||||
if (*itr)
|
||||
(*itr)->UpdateGraveYardAndWorkshop();
|
||||
}
|
||||
(*itr)->UpdateGraveyardAndWorkshop();
|
||||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
for (GuidSet::const_iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr)
|
||||
@@ -292,32 +297,32 @@ void BattlefieldWG::UpdateCounterVehicle(bool init)
|
||||
{
|
||||
if (init)
|
||||
{
|
||||
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H] = 0;
|
||||
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A] = 0;
|
||||
SetData(BATTLEFIELD_WG_DATA_VEHICLE_H, 0);
|
||||
SetData(BATTLEFIELD_WG_DATA_VEHICLE_A, 0);
|
||||
}
|
||||
m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = 0;
|
||||
m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = 0;
|
||||
SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 0);
|
||||
SetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 0);
|
||||
|
||||
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
|
||||
{
|
||||
if (WGWorkshop* workshop = (*itr))
|
||||
{
|
||||
if (workshop->teamControl == TEAM_ALLIANCE)
|
||||
m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_A] + 4;
|
||||
UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A, 4);
|
||||
else if (workshop->teamControl == TEAM_HORDE)
|
||||
m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] = m_Data32[BATTLEFIELD_WG_DATA_MAX_VEHICLE_H] + 4;
|
||||
UpdateData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H, 4);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
||||
void BattlefieldWG::OnBattleEnd(bool endByTimer)
|
||||
{
|
||||
// Remove relic
|
||||
if (m_relic)
|
||||
m_relic->RemoveFromWorld();
|
||||
m_relic = NULL;
|
||||
if (m_titansRelic)
|
||||
m_titansRelic->RemoveFromWorld();
|
||||
m_titansRelic = NULL;
|
||||
|
||||
// Remove turret
|
||||
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
|
||||
@@ -326,52 +331,42 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
||||
{
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
if (!endbytimer)
|
||||
if (!endByTimer)
|
||||
creature->setFaction(WintergraspFaction[GetDefenderTeam()]);
|
||||
HideNpc(creature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If endbytimer is false, battle is end by clicking on relic
|
||||
if (!endbytimer)
|
||||
if (!endByTimer) // One player triggered the relic
|
||||
{
|
||||
// Change all npc in keep
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetDefenderTeam()].begin(); itr != KeepCreature[GetDefenderTeam()].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
ShowNpc(creature, true);
|
||||
}
|
||||
|
||||
// Change all npc out of keep
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
HideNpc(creature);
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = OutsideCreature[GetAttackerTeam()].begin(); itr != OutsideCreature[GetAttackerTeam()].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
ShowNpc(creature, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Update all graveyard, control is to defender when no wartime
|
||||
for (uint8 i = 0; i < BATTLEFIELD_WG_GY_HORDE; i++)
|
||||
{
|
||||
if (GetGraveYardById(i))
|
||||
{
|
||||
GetGraveYardById(i)->ChangeControl(GetDefenderTeam());
|
||||
}
|
||||
}
|
||||
if (BfGraveyard* graveyard = GetGraveyardById(i))
|
||||
graveyard->GiveControlTo(GetDefenderTeam());
|
||||
|
||||
for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr)
|
||||
(*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY);
|
||||
@@ -389,58 +384,23 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
||||
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
|
||||
(*itr)->Save();
|
||||
|
||||
uint32 WinHonor = 0;
|
||||
uint32 LossHonor = 0;
|
||||
|
||||
if (!endbytimer)
|
||||
{
|
||||
WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF];
|
||||
LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT];
|
||||
}
|
||||
else
|
||||
{
|
||||
WinHonor = 3000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT];
|
||||
LossHonor = 1000 + 400 * m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF] + 100 * m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF];
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||
{
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
{
|
||||
player->AddAura(SPELL_ESSENCE_OF_WINTERGRASP, player);
|
||||
if (player->HasAura(SPELL_LIEUTENANT))
|
||||
{
|
||||
player->RewardHonor(NULL, 1, WinHonor);
|
||||
RewardMarkOfHonor(player, 3);
|
||||
}
|
||||
else if (player->HasAura(SPELL_CORPORAL))
|
||||
{
|
||||
player->RewardHonor(NULL, 1, WinHonor);
|
||||
RewardMarkOfHonor(player, 2);
|
||||
}
|
||||
player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
|
||||
player->CastSpell(player, SPELL_VICTORY_REWARD, true);
|
||||
// Send Wintergrasp victory achievement
|
||||
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG, player);
|
||||
// Award achievement for succeeding in Wintergrasp in 10 minutes or less
|
||||
if (!endbytimer && GetTimer() <= 10000)
|
||||
if (!endByTimer && GetTimer() <= 10000)
|
||||
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WIN_WG_TIMER_10, player);
|
||||
}
|
||||
}
|
||||
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
{
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
{
|
||||
if (player->HasAura(SPELL_LIEUTENANT))
|
||||
{
|
||||
player->RewardHonor(NULL, 1, LossHonor);
|
||||
RewardMarkOfHonor(player, 1);
|
||||
}
|
||||
else if (player->HasAura(SPELL_CORPORAL))
|
||||
{
|
||||
player->RewardHonor(NULL, 1, LossHonor);
|
||||
RewardMarkOfHonor(player, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
|
||||
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
{
|
||||
@@ -451,16 +411,15 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
||||
m_PlayersInWar[team].clear();
|
||||
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
if (creature->IsVehicle())
|
||||
creature->GetVehicleKit()->Dismiss();
|
||||
}
|
||||
|
||||
m_vehicles[team].clear();
|
||||
}
|
||||
|
||||
if (!endbytimer)
|
||||
if (!endByTimer)
|
||||
{
|
||||
for (uint8 team = 0; team < 2; ++team)
|
||||
{
|
||||
@@ -475,22 +434,21 @@ void BattlefieldWG::OnBattleEnd(bool endbytimer)
|
||||
}
|
||||
}
|
||||
|
||||
if (!endbytimer)
|
||||
{ // win alli/horde
|
||||
if (!endByTimer) // win alli/horde
|
||||
SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : BATTLEFIELD_WG_TEXT_WIN_KEEP + 1);
|
||||
}
|
||||
else
|
||||
{ // defend alli/horde
|
||||
else // defend alli/horde
|
||||
SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_DEFEND_KEEP : BATTLEFIELD_WG_TEXT_DEFEND_KEEP + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// *****************************************************
|
||||
// *******************************************************
|
||||
// ******************* Reward System *********************
|
||||
// *****************************************************
|
||||
// *******************************************************
|
||||
void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 /*incrementNumber*/)
|
||||
{
|
||||
AchievementEntry const* AE = sAchievementStore.LookupEntry(achievement);
|
||||
AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievement);
|
||||
|
||||
if (!achievementEntry)
|
||||
return;
|
||||
|
||||
switch (achievement)
|
||||
{
|
||||
@@ -501,46 +459,20 @@ void BattlefieldWG::DoCompleteOrIncrementAchievement(uint32 achievement, Player
|
||||
default:
|
||||
{
|
||||
if (player)
|
||||
player->CompletedAchievement(AE);
|
||||
}
|
||||
player->CompletedAchievement(achievementEntry);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BattlefieldWG::RewardMarkOfHonor(Player* player, uint32 count)
|
||||
{
|
||||
// 'Inactive' this aura prevents the player from gaining honor points and battleground tokens
|
||||
if (count == 0)
|
||||
return;
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint32 no_space_count = 0;
|
||||
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, WG_MARK_OF_HONOR, count, &no_space_count);
|
||||
|
||||
if (msg == EQUIP_ERR_ITEM_NOT_FOUND)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (msg != EQUIP_ERR_OK) // convert to possible store amount
|
||||
count -= no_space_count;
|
||||
|
||||
if (count != 0 && !dest.empty()) // can add some
|
||||
if (Item * item = player->StoreNewItem(dest, WG_MARK_OF_HONOR, true, 0))
|
||||
player->SendNewItem(item, count, true, false);
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnStartGrouping()
|
||||
{
|
||||
// Warn
|
||||
SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
|
||||
}
|
||||
|
||||
uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId)
|
||||
{
|
||||
uint8 graveyardId = 0;
|
||||
|
||||
switch (areaId)
|
||||
{
|
||||
case AREA_WINTERGRASP_FORTRESS:
|
||||
@@ -558,11 +490,11 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId)
|
||||
case AREA_THE_CHILLED_QUAGMIRE:
|
||||
return BATTLEFIELD_WG_GY_HORDE;
|
||||
default:
|
||||
sLog->outError("<Error - Wintergrasp>: Unexpected Area Id %u", areaId);
|
||||
sLog->outError("BattlefieldWG::GetSpiritGraveyardId: Unexpected Area Id %u", areaId);
|
||||
break;
|
||||
}
|
||||
|
||||
return graveyardId;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BattlefieldWG::OnCreatureCreate(Creature* creature)
|
||||
@@ -570,28 +502,26 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature)
|
||||
// Accessing to db spawned creatures
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
// Alliance Spirit
|
||||
case NPC_DWARVEN_SPIRIT_GUIDE:
|
||||
// Horde Spirit
|
||||
case NPC_TAUNKA_SPIRIT_GUIDE:
|
||||
{
|
||||
TeamId teamId = creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId());
|
||||
if (m_GraveYardList[graveyardId])
|
||||
m_GraveYardList[graveyardId]->SetSpirit(creature, teamId);
|
||||
}
|
||||
if (m_GraveyardList[graveyardId])
|
||||
m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// untested code - not sure if it is valid.
|
||||
if (IsWarTime())
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_WG_SEIGE_ENGINE_ALLIANCE:
|
||||
case NPC_WG_SEIGE_ENGINE_HORDE:
|
||||
case NPC_WG_CATAPULT:
|
||||
case NPC_WG_DEMOLISHER:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_1:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_2:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
{
|
||||
uint8 team;
|
||||
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||
@@ -605,7 +535,7 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature)
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_H) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H))
|
||||
{
|
||||
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]++;
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, 1);
|
||||
creature->CastSpell(creature, SPELL_HORDE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
@@ -621,8 +551,8 @@ void BattlefieldWG::OnCreatureCreate(Creature *creature)
|
||||
{
|
||||
if (GetData(BATTLEFIELD_WG_DATA_VEHICLE_A) <= GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A))
|
||||
{
|
||||
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]++;
|
||||
creature->CastSpell(creature, SPELL_ALLIANCE_FLAG, true);
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, 1);
|
||||
creature->CastSpell(creature, SPELL_HORDE_FLAG, true);
|
||||
m_vehicles[team].insert(creature->GetGUID());
|
||||
UpdateVehicleCountWG();
|
||||
}
|
||||
@@ -645,10 +575,10 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature)
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_WG_SEIGE_ENGINE_ALLIANCE:
|
||||
case NPC_WG_SEIGE_ENGINE_HORDE:
|
||||
case NPC_WG_CATAPULT:
|
||||
case NPC_WG_DEMOLISHER:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_1:
|
||||
case NPC_WINTERGRASP_SIEGE_ENGINE_2:
|
||||
case NPC_WINTERGRASP_CATAPULT:
|
||||
case NPC_WINTERGRASP_DEMOLISHER:
|
||||
{
|
||||
uint8 team;
|
||||
if (creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
|
||||
@@ -660,9 +590,9 @@ void BattlefieldWG::OnCreatureRemove(Creature* creature)
|
||||
|
||||
m_vehicles[team].erase(creature->GetGUID());
|
||||
if (team == TEAM_HORDE)
|
||||
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_H]--;
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_H, -1);
|
||||
else
|
||||
m_Data32[BATTLEFIELD_WG_DATA_VEHICLE_A]--;
|
||||
UpdateData(BATTLEFIELD_WG_DATA_VEHICLE_A, -1);
|
||||
UpdateVehicleCountWG();
|
||||
|
||||
break;
|
||||
@@ -678,44 +608,44 @@ void BattlefieldWG::OnGameObjectCreate(GameObject* go)
|
||||
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE:
|
||||
case GO_WINTERGRASP_FACTORY_BANNER_NE:
|
||||
isWorkshop = true;
|
||||
workshopId = BATTLEFIELD_WG_WORKSHOP_NE;
|
||||
break;
|
||||
case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW:
|
||||
case GO_WINTERGRASP_FACTORY_BANNER_NW:
|
||||
isWorkshop = true;
|
||||
workshopId = BATTLEFIELD_WG_WORKSHOP_NW;
|
||||
break;
|
||||
case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE:
|
||||
case GO_WINTERGRASP_FACTORY_BANNER_SE:
|
||||
isWorkshop = true;
|
||||
workshopId = BATTLEFIELD_WG_WORKSHOP_SE;
|
||||
break;
|
||||
case BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW:
|
||||
case GO_WINTERGRASP_FACTORY_BANNER_SW:
|
||||
isWorkshop = true;
|
||||
workshopId = BATTLEFIELD_WG_WORKSHOP_SW;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (isWorkshop)
|
||||
{
|
||||
if (!isWorkshop)
|
||||
return;
|
||||
|
||||
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
|
||||
{
|
||||
if (WGWorkshop* workshop = (*itr))
|
||||
{
|
||||
if (workshop->workshopId == workshopId)
|
||||
{
|
||||
BfCapturePointWG* capturePoint = new BfCapturePointWG(this, GetAttackerTeam());
|
||||
WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam());
|
||||
|
||||
capturePoint->SetCapturePointData(go);
|
||||
capturePoint->LinkToWorkShop(workshop);
|
||||
capturePoint->LinkToWorkshop(workshop);
|
||||
AddCapturePoint(capturePoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called when player kill a unit in wg zone
|
||||
void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
||||
@@ -727,29 +657,20 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[killer->GetTeamId()].begin(); itr != m_PlayersInWar[killer->GetTeamId()].end(); ++itr)
|
||||
{
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
if (player->GetDistance2d(killer) < 40)
|
||||
PromotePlayer(player);
|
||||
}
|
||||
return;
|
||||
}
|
||||
for (GuidSet::const_iterator itr = m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin();
|
||||
itr != m_vehicles[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr)
|
||||
{
|
||||
|
||||
for (GuidSet::const_iterator itr = m_vehicles[GetOtherTeam(killer->GetTeamId())].begin(); itr != m_vehicles[GetOtherTeam(killer->GetTeamId())].end(); ++itr)
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
{
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
{
|
||||
if (victim->GetEntry() == creature->GetEntry() && !again)
|
||||
{
|
||||
again = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (GuidSet::const_iterator itr = KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].begin();
|
||||
itr != KeepCreature[killer->GetTeamId()? TEAM_ALLIANCE : TEAM_HORDE].end(); ++itr)
|
||||
|
||||
for (GuidSet::const_iterator itr = KeepCreature[GetOtherTeam(killer->GetTeamId())].begin();
|
||||
itr != KeepCreature[GetOtherTeam(killer->GetTeamId())].end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
{
|
||||
@@ -759,27 +680,25 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
||||
{
|
||||
again = true;
|
||||
for (GuidSet::const_iterator iter = m_PlayersInWar[killer->GetTeamId()].begin(); iter != m_PlayersInWar[killer->GetTeamId()].end(); ++iter)
|
||||
{
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*iter))
|
||||
if (player->GetDistance2d(killer) < 40)
|
||||
if (player->GetDistance2d(killer) < 40.0f)
|
||||
PromotePlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO:Recent PvP activity worldstate
|
||||
}
|
||||
|
||||
// Update rank for player
|
||||
void BattlefieldWG::PromotePlayer(Player* killer)
|
||||
{
|
||||
if (!m_BattlefieldActive)
|
||||
if (!m_isActive)
|
||||
return;
|
||||
// Updating rank of player
|
||||
if (Aura* aur = killer->GetAura(SPELL_RECRUIT))
|
||||
{
|
||||
if (aur->GetStackAmount() >= 5) // 7 or more TODO:
|
||||
if (aur->GetStackAmount() >= 5)
|
||||
{
|
||||
killer->RemoveAura(SPELL_RECRUIT);
|
||||
killer->CastSpell(killer, SPELL_CORPORAL, true);
|
||||
@@ -790,7 +709,7 @@ void BattlefieldWG::PromotePlayer(Player* killer)
|
||||
}
|
||||
else if (Aura* aur = killer->GetAura(SPELL_CORPORAL))
|
||||
{
|
||||
if (aur->GetStackAmount() >= 5) // 7 or more TODO:
|
||||
if (aur->GetStackAmount() >= 5)
|
||||
{
|
||||
killer->RemoveAura(SPELL_CORPORAL);
|
||||
killer->CastSpell(killer, SPELL_LIEUTENANT, true);
|
||||
@@ -822,9 +741,7 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player)
|
||||
if (player->GetZoneId() != m_ZoneId)
|
||||
{
|
||||
if (player->GetTeamId() == GetDefenderTeam())
|
||||
{
|
||||
player->TeleportTo(571, 5345, 2842, 410, 3.14f);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->GetTeamId() == TEAM_HORDE)
|
||||
@@ -838,13 +755,13 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player)
|
||||
|
||||
if (player->GetTeamId() == GetAttackerTeam())
|
||||
{
|
||||
if (3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0)
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]);
|
||||
if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) < 3)
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, 3 - GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] > 0)
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]);
|
||||
if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) > 0)
|
||||
player->SetAuraStack(SPELL_TOWER_CONTROL, player, GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT));
|
||||
}
|
||||
SendInitWorldStatesTo(player);
|
||||
}
|
||||
@@ -858,6 +775,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player)
|
||||
player->GetVehicle()->Dismiss();
|
||||
RemoveAurasFromPlayer(player);
|
||||
}
|
||||
|
||||
player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||
player->RemoveAurasDueToSpell(SPELL_ALLIANCE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||
player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROL_PHASE_SHIFT);
|
||||
@@ -866,7 +784,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player)
|
||||
|
||||
void BattlefieldWG::OnPlayerLeaveZone(Player* player)
|
||||
{
|
||||
if (!m_BattlefieldActive)
|
||||
if (!m_isActive)
|
||||
RemoveAurasFromPlayer(player);
|
||||
|
||||
player->RemoveAurasDueToSpell(SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT);
|
||||
@@ -877,7 +795,7 @@ void BattlefieldWG::OnPlayerLeaveZone(Player* player)
|
||||
|
||||
void BattlefieldWG::OnPlayerEnterZone(Player* player)
|
||||
{
|
||||
if (!m_BattlefieldActive)
|
||||
if (!m_isActive)
|
||||
RemoveAurasFromPlayer(player);
|
||||
|
||||
player->AddAura(m_DefenderTeam == TEAM_HORDE ? SPELL_HORDE_CONTROL_PHASE_SHIFT : SPELL_ALLIANCE_CONTROL_PHASE_SHIFT, player);
|
||||
@@ -896,11 +814,8 @@ uint32 BattlefieldWG::GetData(uint32 data)
|
||||
case AREA_WESTPARK_WORKSHOP:
|
||||
case AREA_EASTPARK_WORKSHOP:
|
||||
// Graveyards and Workshops are controlled by the same team.
|
||||
if (m_GraveYardList[GetSpiritGraveyardId(data)])
|
||||
return m_GraveYardList[GetSpiritGraveyardId(data)]->GetControlTeamId();
|
||||
default:
|
||||
if (m_Data32[data])
|
||||
return m_Data32[data];
|
||||
if (m_GraveyardList[GetSpiritGraveyardId(data)])
|
||||
return m_GraveyardList[GetSpiritGraveyardId(data)]->GetControlTeamId();
|
||||
}
|
||||
|
||||
return Battlefield::GetData(data);
|
||||
@@ -918,8 +833,8 @@ WorldPacket BattlefieldWG::BuildInitWorldStates()
|
||||
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_ATTACKER) << uint32(GetAttackerTeam());
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) << uint32(GetDefenderTeam());
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1);
|
||||
data << uint32(3710) << uint32(IsWarTime()? 1 : 0);
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) << uint32(IsWarTime()? 0 : 1); // Note: cleanup these two, their names look awkward
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime()? 1 : 0);
|
||||
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000));
|
||||
@@ -930,16 +845,12 @@ WorldPacket BattlefieldWG::BuildInitWorldStates()
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A);
|
||||
|
||||
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
|
||||
{
|
||||
data << (*itr)->m_WorldState << (*itr)->m_State;
|
||||
}
|
||||
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
|
||||
{
|
||||
if (!*itr)
|
||||
continue;
|
||||
|
||||
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
|
||||
if (*itr)
|
||||
data << WorkshopsData[(*itr)->workshopId].worldstate << (*itr)->state;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -970,47 +881,44 @@ void BattlefieldWG::BrokenWallOrTower(TeamId team)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// Called when a tower is broke
|
||||
void BattlefieldWG::AddBrokenTower(TeamId team)
|
||||
void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team)
|
||||
{
|
||||
// Destroy an attack tower
|
||||
if (team == GetAttackerTeam())
|
||||
{
|
||||
// Update counter
|
||||
m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]--;
|
||||
m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT]++;
|
||||
UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, -1);
|
||||
UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 1);
|
||||
|
||||
// Remove buff stack
|
||||
// Remove buff stack on attackers
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
player->RemoveAuraFromStack(SPELL_TOWER_CONTROL);
|
||||
|
||||
// Add buff stack
|
||||
// Add buff stack to defenders
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
{
|
||||
player->CastSpell(player, SPELL_TOWER_CONTROL, true);
|
||||
DoCompleteOrIncrementAchievement(ACHIEVEMENTS_WG_TOWER_DESTROY, player);
|
||||
}
|
||||
// If the threw south tower is destroy
|
||||
if (m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT] == 3)
|
||||
|
||||
// If all three south towers are destroyed (ie. all attack towers), remove ten minutes from battle time
|
||||
if (GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT) == 3)
|
||||
{
|
||||
// Remove 10 minutes to battle time
|
||||
if (int32(m_Timer - 600000) < 0)
|
||||
{
|
||||
m_Timer = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Timer -= 600000;
|
||||
}
|
||||
SendInitWorldStatesToAll();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]--;
|
||||
m_Data32[BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF]++;
|
||||
UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, -1);
|
||||
UpdateData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1025,13 +933,12 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
|
||||
return;
|
||||
|
||||
// On click on titan relic
|
||||
if (go->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC)
|
||||
if (go->GetEntry() == GO_WINTERGRASP_TITAN_S_RELIC)
|
||||
{
|
||||
// Check that the door is break
|
||||
if (m_CanClickOnOrb)
|
||||
if (CanInteractWithRelic())
|
||||
EndBattle(false);
|
||||
else // if door is not break, respawn relic.
|
||||
m_relic->SetRespawnTime(RESPAWN_IMMEDIATELY);
|
||||
else
|
||||
GetRelic()->SetRespawnTime(RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
// if destroy or damage event, search the wall/tower and update worldstate/send warning message
|
||||
@@ -1051,16 +958,12 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
|
||||
}
|
||||
|
||||
// Called when a tower is damaged, used for honor reward calcul
|
||||
void BattlefieldWG::AddDamagedTower(TeamId team)
|
||||
void BattlefieldWG::UpdateDamagedTowerCount(TeamId team)
|
||||
{
|
||||
if (team == GetAttackerTeam())
|
||||
{
|
||||
m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT]++;
|
||||
}
|
||||
UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1);
|
||||
else
|
||||
{
|
||||
m_Data32[BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF]++;
|
||||
}
|
||||
UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF, 1);
|
||||
}
|
||||
|
||||
// Update vehicle count WorldState to player
|
||||
@@ -1075,16 +978,16 @@ void BattlefieldWG::UpdateVehicleCountWG()
|
||||
void BattlefieldWG::UpdateTenacity()
|
||||
{
|
||||
TeamId team = TEAM_NEUTRAL;
|
||||
uint32 allianceNum = m_PlayersInWar[TEAM_ALLIANCE].size();
|
||||
uint32 hordeNum = m_PlayersInWar[TEAM_HORDE].size();
|
||||
uint32 alliancePlayers = m_PlayersInWar[TEAM_ALLIANCE].size();
|
||||
uint32 hordePlayers = m_PlayersInWar[TEAM_HORDE].size();
|
||||
int32 newStack = 0;
|
||||
|
||||
if (allianceNum && hordeNum)
|
||||
if (alliancePlayers && hordePlayers)
|
||||
{
|
||||
if (allianceNum < hordeNum)
|
||||
newStack = int32((float (hordeNum) / float (allianceNum) - 1) *4); // positive, should cast on alliance
|
||||
else if (allianceNum > hordeNum)
|
||||
newStack = int32((1 - float (allianceNum) / float (hordeNum)) *4); // negative, should cast on horde
|
||||
if (alliancePlayers < hordePlayers)
|
||||
newStack = int32((float(hordePlayers / alliancePlayers) - 1) * 4); // positive, should cast on alliance
|
||||
else if (alliancePlayers > hordePlayers)
|
||||
newStack = int32((1 - float(alliancePlayers / hordePlayers)) * 4); // negative, should cast on horde
|
||||
}
|
||||
|
||||
if (newStack == int32(m_tenacityStack))
|
||||
@@ -1121,13 +1024,17 @@ void BattlefieldWG::UpdateTenacity()
|
||||
newStack = 20;
|
||||
|
||||
uint32 buff_honor = SPELL_GREATEST_HONOR;
|
||||
buff_honor = (newStack < 15) ? (uint32) SPELL_GREATER_HONOR : buff_honor;
|
||||
buff_honor = (newStack < 10) ? (uint32) SPELL_GREAT_HONOR : buff_honor;
|
||||
buff_honor = (newStack < 5) ? 0 : buff_honor;
|
||||
if (newStack < 15)
|
||||
buff_honor = SPELL_GREATER_HONOR;
|
||||
if (newStack < 10)
|
||||
buff_honor = SPELL_GREAT_HONOR;
|
||||
if (newStack < 5)
|
||||
buff_honor = 0;
|
||||
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
player->SetAuraStack(SPELL_TENACITY, player, newStack);
|
||||
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
@@ -1137,27 +1044,27 @@ void BattlefieldWG::UpdateTenacity()
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
|
||||
if (Player* player = sObjectAccessor->FindPlayer(*itr))
|
||||
player->AddAura(buff_honor, player);
|
||||
player->CastSpell(player, buff_honor, true);
|
||||
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
if (Creature* creature = unit->ToCreature())
|
||||
creature->AddAura(buff_honor, creature);
|
||||
creature->CastSpell(creature, buff_honor, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BfCapturePointWG::ChangeTeam(TeamId /*oldTeam */ )
|
||||
WintergraspCapturePoint::WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl) : BfCapturePoint(battlefield)
|
||||
{
|
||||
m_WorkShop->ChangeControl(m_team, false);
|
||||
m_Bf = battlefield;
|
||||
m_team = teamInControl;
|
||||
}
|
||||
|
||||
BfCapturePointWG::BfCapturePointWG(BattlefieldWG* bf, TeamId control) : BfCapturePoint(bf)
|
||||
void WintergraspCapturePoint::ChangeTeam(TeamId /*oldTeam*/)
|
||||
{
|
||||
m_Bf = bf;
|
||||
m_team = control;
|
||||
m_Workshop->GiveControlTo(m_team, false);
|
||||
}
|
||||
|
||||
BfGraveYardWG::BfGraveYardWG(BattlefieldWG* bf) : BfGraveYard(bf)
|
||||
BfGraveyardWG::BfGraveyardWG(BattlefieldWG* battlefield) : BfGraveyard(battlefield)
|
||||
{
|
||||
m_Bf = bf;
|
||||
m_Bf = battlefield;
|
||||
}
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "Battlefield.h"
|
||||
|
||||
const uint32 VehNumWorldState[2] = { 3680, 3490 };
|
||||
const uint32 MaxVehNumWorldState[2] = { 3681, 3491 };
|
||||
const uint32 ClockWorldState[2] = { 3781, 4354 };
|
||||
const uint32 WintergraspFaction[3] = { 1, 116, 35 };
|
||||
|
||||
const float WintergraspStalkerPos[4] = { 0, 0, 0, 0 };
|
||||
|
||||
class BattlefieldWG;
|
||||
class BfCapturePointWG;
|
||||
class WintergraspCapturePoint;
|
||||
|
||||
struct BfWGGameObjectBuilding;
|
||||
struct WGWorkshop;
|
||||
@@ -41,20 +41,12 @@ struct WGWorkshop;
|
||||
typedef std::set<GameObject*> GameObjectSet;
|
||||
typedef std::set<BfWGGameObjectBuilding*> GameObjectBuilding;
|
||||
typedef std::set<WGWorkshop*> Workshop;
|
||||
//typedef std::set<BfCapturePointWG *> CapturePointSet; unused ?
|
||||
typedef std::set<Group*> GroupSet;
|
||||
//typedef std::set<WintergraspCapturePoint *> CapturePointSet; unused ?
|
||||
|
||||
enum eWGItem
|
||||
enum WintergraspSpells
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
WG_MARK_OF_HONOR = 43589,
|
||||
// *INDENT-ON*
|
||||
};
|
||||
|
||||
enum eWGSpell
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
// AWartime auras
|
||||
// Wartime auras
|
||||
SPELL_RECRUIT = 37795,
|
||||
SPELL_CORPORAL = 33280,
|
||||
SPELL_LIEUTENANT = 55629,
|
||||
@@ -93,11 +85,9 @@ enum eWGSpell
|
||||
|
||||
SPELL_HORDE_CONTROL_PHASE_SHIFT = 55773,// ADDS PHASE 64
|
||||
SPELL_ALLIANCE_CONTROL_PHASE_SHIFT = 55774,// ADDS PHASE 128
|
||||
|
||||
// *INDENT-ON*
|
||||
};
|
||||
|
||||
enum eWGData32
|
||||
enum WintergraspData
|
||||
{
|
||||
BATTLEFIELD_WG_DATA_DAMAGED_TOWER_DEF,
|
||||
BATTLEFIELD_WG_DATA_BROKEN_TOWER_DEF,
|
||||
@@ -110,9 +100,8 @@ enum eWGData32
|
||||
BATTLEFIELD_WG_DATA_MAX,
|
||||
};
|
||||
|
||||
enum WB_ACHIEVEMENTS
|
||||
enum WintergraspAchievements
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
ACHIEVEMENTS_WIN_WG = 1717,
|
||||
ACHIEVEMENTS_WIN_WG_100 = 1718, // todo
|
||||
ACHIEVEMENTS_WG_GNOMESLAUGHTER = 1723, // todo
|
||||
@@ -129,10 +118,9 @@ enum WB_ACHIEVEMENTS
|
||||
ACHIEVEMENTS_WG_RANGER = 2199, // todo
|
||||
ACHIEVEMENTS_DESTRUCTION_DERBY_H = 2476, // todo
|
||||
ACHIEVEMENTS_WG_MASTER_H = 2776, // todo
|
||||
// *INDENT-ON*
|
||||
};
|
||||
|
||||
enum eWGWorldStates
|
||||
enum WintergraspWorldStates
|
||||
{
|
||||
BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H = 3490,
|
||||
BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H = 3491,
|
||||
@@ -141,9 +129,10 @@ enum eWGWorldStates
|
||||
BATTLEFIELD_WG_WORLD_STATE_ACTIVE = 3801,
|
||||
BATTLEFIELD_WG_WORLD_STATE_DEFENDER = 3802,
|
||||
BATTLEFIELD_WG_WORLD_STATE_ATTACKER = 3803,
|
||||
BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE = 3710,
|
||||
};
|
||||
|
||||
enum WGAreaIds
|
||||
enum WintergraspAreaIds
|
||||
{
|
||||
AREA_WINTERGRASP_FORTRESS = 4575,
|
||||
AREA_THE_SUNKEN_RING = 4538,
|
||||
@@ -155,13 +144,13 @@ enum WGAreaIds
|
||||
};
|
||||
|
||||
/*#########################
|
||||
*####### Graveyards ######*
|
||||
#########################*/
|
||||
*####### Graveyards ######
|
||||
*#########################*/
|
||||
|
||||
class BfGraveYardWG : public BfGraveYard
|
||||
class BfGraveyardWG : public BfGraveyard
|
||||
{
|
||||
public:
|
||||
BfGraveYardWG(BattlefieldWG *Bf);
|
||||
BfGraveyardWG(BattlefieldWG *Bf);
|
||||
|
||||
void SetTextId(uint32 textid) { m_GossipTextId = textid; }
|
||||
uint32 GetTextId() { return m_GossipTextId; }
|
||||
@@ -178,12 +167,11 @@ enum WGGraveyardId
|
||||
BATTLEFIELD_WG_GY_KEEP,
|
||||
BATTLEFIELD_WG_GY_HORDE,
|
||||
BATTLEFIELD_WG_GY_ALLIANCE,
|
||||
BATTLEFIELD_WG_GY_MAX,
|
||||
BATTLEFIELD_WG_GRAVEYARD_MAX,
|
||||
};
|
||||
|
||||
enum eWGGossipText
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501,
|
||||
BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502,
|
||||
BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504,
|
||||
@@ -191,12 +179,10 @@ enum eWGGossipText
|
||||
BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500,
|
||||
BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505,
|
||||
BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506,
|
||||
// *INDENT-ON*
|
||||
};
|
||||
|
||||
enum eWGNpc
|
||||
enum WintergraspNpcs
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
BATTLEFIELD_WG_NPC_GUARD_H = 30739,
|
||||
BATTLEFIELD_WG_NPC_GUARD_A = 30740,
|
||||
BATTLEFIELD_WG_NPC_STALKER = 15214,
|
||||
@@ -223,7 +209,13 @@ enum eWGNpc
|
||||
|
||||
NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
|
||||
NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
|
||||
// *INDENT-ON*
|
||||
NPC_TOWER_CANNON = 28366,
|
||||
|
||||
NPC_WINTERGRASP_SIEGE_ENGINE_1 = 28312,
|
||||
NPC_WINTERGRASP_SIEGE_ENGINE_2 = 32627,
|
||||
NPC_WINTERGRASP_CATAPULT = 27881,
|
||||
NPC_WINTERGRASP_DEMOLISHER = 28094,
|
||||
NPC_WINTERGRASP_TOWER_CANNON = 28366,
|
||||
};
|
||||
|
||||
struct BfWGCoordGY
|
||||
@@ -243,7 +235,7 @@ const uint32 WGQuest[2][6] = {
|
||||
{ 13185, 13183, 13223, 13539, 13178, 13180 },
|
||||
};
|
||||
// 7 in sql, 7 in header
|
||||
const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = {
|
||||
const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GRAVEYARD_MAX] = {
|
||||
{ 5104.750f, 2300.940f, 368.579f, 0.733038f, 1329, BATTLEFIELD_WG_GY_WORKSHOP_NE, BATTLEFIELD_WG_GOSSIPTEXT_GY_NE, TEAM_NEUTRAL },
|
||||
{ 5099.120f, 3466.036f, 368.484f, 5.317802f, 1330, BATTLEFIELD_WG_GY_WORKSHOP_NW, BATTLEFIELD_WG_GOSSIPTEXT_GY_NW, TEAM_NEUTRAL },
|
||||
{ 4314.648f, 2408.522f, 392.642f, 6.268125f, 1333, BATTLEFIELD_WG_GY_WORKSHOP_SE, BATTLEFIELD_WG_GOSSIPTEXT_GY_SE, TEAM_NEUTRAL },
|
||||
@@ -253,33 +245,27 @@ const BfWGCoordGY WGGraveYard[BATTLEFIELD_WG_GY_MAX] = {
|
||||
{ 5140.790f, 2179.120f, 390.950f, 1.972220f, 1332, BATTLEFIELD_WG_GY_ALLIANCE, BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE, TEAM_ALLIANCE },
|
||||
};
|
||||
|
||||
/*#########################
|
||||
* BfCapturePointWG *
|
||||
#########################*/
|
||||
/* ######################### *
|
||||
* WintergraspCapturePoint *
|
||||
* ######################### */
|
||||
|
||||
class BfCapturePointWG : public BfCapturePoint
|
||||
class WintergraspCapturePoint : public BfCapturePoint
|
||||
{
|
||||
public:
|
||||
BfCapturePointWG(BattlefieldWG* bf, TeamId control);
|
||||
WintergraspCapturePoint(BattlefieldWG* battlefield, TeamId teamInControl);
|
||||
|
||||
void LinkToWorkShop(WGWorkshop* ws)
|
||||
{
|
||||
m_WorkShop = ws;
|
||||
}
|
||||
void LinkToWorkshop(WGWorkshop* workshop) { m_Workshop = workshop; }
|
||||
|
||||
void ChangeTeam(TeamId oldteam);
|
||||
TeamId GetTeam() const
|
||||
{
|
||||
return m_team;
|
||||
}
|
||||
TeamId GetTeam() const { return m_team; }
|
||||
|
||||
protected:
|
||||
WGWorkshop *m_WorkShop;
|
||||
WGWorkshop* m_Workshop;
|
||||
};
|
||||
|
||||
/*#########################
|
||||
/* ######################### *
|
||||
* WinterGrasp Battlefield *
|
||||
#########################*/
|
||||
* ######################### */
|
||||
|
||||
class BattlefieldWG : public Battlefield
|
||||
{
|
||||
@@ -299,12 +285,12 @@ class BattlefieldWG : public Battlefield
|
||||
* - Saving battlestate
|
||||
* - Reward honor/mark to player
|
||||
* - Remove vehicle
|
||||
* \param endbytimer : true if battle end when timer is at 00:00, false if battle end by clicking on relic
|
||||
* \param endByTimer : true if battle ended when timer is at 00:00, false if battle ended by clicking on relic
|
||||
*/
|
||||
void OnBattleEnd(bool endbytimer);
|
||||
void OnBattleEnd(bool endByTimer);
|
||||
|
||||
/**
|
||||
* \brief Called when grouping start (15 minutes before battlestart)
|
||||
* \brief Called when grouping starts (15 minutes before battlestart)
|
||||
* - Invite all player in zone to join queue
|
||||
*/
|
||||
void OnStartGrouping();
|
||||
@@ -315,28 +301,28 @@ class BattlefieldWG : public Battlefield
|
||||
* - Teleport if it needed
|
||||
* - Update worldstate
|
||||
* - Update tenacity
|
||||
* \param player: Player who accept invite
|
||||
* \param player: Player who accepted invite
|
||||
*/
|
||||
void OnPlayerJoinWar(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player leave battle
|
||||
* \brief Called when player left the battle
|
||||
* - Update player aura
|
||||
* \param player : Player who leave battle
|
||||
* \param player : Player who left the battle
|
||||
*/
|
||||
void OnPlayerLeaveWar(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player leave WG zone
|
||||
* \param player : Player who leave zone
|
||||
* \brief Called when player left the WG zone
|
||||
* \param player : Player who left the zone
|
||||
*/
|
||||
void OnPlayerLeaveZone(Player* player);
|
||||
|
||||
/**
|
||||
* \brief Called when player enter in WG zone
|
||||
* \brief Called when player enters in WG zone
|
||||
* - Update aura
|
||||
* - Update worldstate
|
||||
* \param player : Player who leave zone
|
||||
* \param player : Player who enters the zone
|
||||
*/
|
||||
void OnPlayerEnterZone(Player* player);
|
||||
|
||||
@@ -344,8 +330,7 @@ class BattlefieldWG : public Battlefield
|
||||
* \brief Called for update battlefield data
|
||||
* - Save battle timer in database every minutes
|
||||
* - Update imunity aura from graveyard
|
||||
* -Update water aura, if player is in water (HACK)
|
||||
* \param diff : time ellapsed since the last call (in ms)
|
||||
* \param diff : time elapsed since the last call (in ms)
|
||||
*/
|
||||
bool Update(uint32 diff);
|
||||
|
||||
@@ -361,6 +346,9 @@ class BattlefieldWG : public Battlefield
|
||||
*/
|
||||
void OnCreatureRemove(Creature* creature);
|
||||
|
||||
/**
|
||||
* \brief Called when a gameobject is created
|
||||
*/
|
||||
void OnGameObjectCreate(GameObject* go);
|
||||
|
||||
/**
|
||||
@@ -373,14 +361,14 @@ class BattlefieldWG : public Battlefield
|
||||
* \brief Called when a tower is damaged
|
||||
* - Update tower count (for reward calcul)
|
||||
*/
|
||||
void AddDamagedTower(TeamId team);
|
||||
void UpdateDamagedTowerCount(TeamId team);
|
||||
|
||||
/**
|
||||
* \brief Called when tower is broken
|
||||
* - Update tower buff
|
||||
* - check if three south tower is down for remove 10 minutes to wg
|
||||
*/
|
||||
void AddBrokenTower(TeamId team);
|
||||
void UpdatedDestroyedTowerCount(TeamId team);
|
||||
|
||||
void DoCompleteOrIncrementAchievement(uint32 achievement, Player* player, uint8 incrementNumber = 1);
|
||||
|
||||
@@ -392,30 +380,16 @@ class BattlefieldWG : public Battlefield
|
||||
bool SetupBattlefield();
|
||||
|
||||
/// Return pointer to relic object
|
||||
GameObject* GetRelic()
|
||||
{
|
||||
return m_relic;
|
||||
}
|
||||
GameObject* GetRelic() { return m_titansRelic; }
|
||||
|
||||
/// Define relic object
|
||||
void SetRelic(GameObject* relic)
|
||||
{
|
||||
m_relic = relic;
|
||||
}
|
||||
void SetRelic(GameObject* relic) { m_titansRelic = relic; }
|
||||
|
||||
/// Say if player can click or not on orb (last door broken)
|
||||
bool CanClickOnOrb()
|
||||
{
|
||||
return m_CanClickOnOrb;
|
||||
}
|
||||
/// Check if players can interact with the relic (Only if the last door has been broken)
|
||||
bool CanInteractWithRelic() { return m_isRelicInteractible; }
|
||||
|
||||
/// Define if player can click or not on orb (if last door broken)
|
||||
void AllowToClickOnOrb(bool allow)
|
||||
{
|
||||
m_CanClickOnOrb = allow;
|
||||
}
|
||||
|
||||
void RewardMarkOfHonor(Player *player, uint32 count);
|
||||
/// Define if player can interact with the relic
|
||||
void SetRelicInteractible(bool allow) { m_isRelicInteractible = allow; }
|
||||
|
||||
void UpdateVehicleCountWG();
|
||||
void UpdateCounterVehicle(bool init);
|
||||
@@ -435,23 +409,35 @@ class BattlefieldWG : public Battlefield
|
||||
|
||||
uint32 GetData(uint32 data);
|
||||
protected:
|
||||
bool m_CanClickOnOrb;
|
||||
GameObject* m_relic;
|
||||
GameObjectBuilding BuildingsInZone;
|
||||
GuidSet KeepCreature[2];
|
||||
GuidSet OutsideCreature[2];
|
||||
bool m_isRelicInteractible;
|
||||
|
||||
Workshop WorkshopsList;
|
||||
GuidSet CanonList;
|
||||
|
||||
GameObjectSet DefenderPortalList;
|
||||
GameObjectSet m_KeepGameObject[2];
|
||||
GameObjectBuilding BuildingsInZone;
|
||||
|
||||
GuidSet m_vehicles[2];
|
||||
GuidSet CanonList;
|
||||
GuidSet KeepCreature[2];
|
||||
GuidSet OutsideCreature[2];
|
||||
|
||||
uint32 m_tenacityStack;
|
||||
uint32 m_saveTimer;
|
||||
|
||||
GameObject* m_titansRelic;
|
||||
};
|
||||
|
||||
#define NORTHREND_WINTERGRASP 4197
|
||||
const uint32 NORTHREND_WINTERGRASP = 4197;
|
||||
const uint8 WG_MAX_OBJ = 32;
|
||||
const uint8 WG_KEEPGAMEOBJECT_MAX = 44;
|
||||
const uint8 WG_MAX_TURRET = 15;
|
||||
const uint8 WG_MAX_KEEP_NPC = 39;
|
||||
const uint8 WG_MAX_OUTSIDE_NPC = 14;
|
||||
const uint8 WG_OUTSIDE_ALLIANCE_NPC = 7;
|
||||
const uint8 WG_MAX_TELEPORTER = 12;
|
||||
|
||||
enum eWGGameObjectBuildingType
|
||||
enum WintergraspGameObjectBuildingType
|
||||
{
|
||||
BATTLEFIELD_WG_OBJECTTYPE_DOOR,
|
||||
BATTLEFIELD_WG_OBJECTTYPE_TITANRELIC,
|
||||
@@ -461,7 +447,7 @@ enum eWGGameObjectBuildingType
|
||||
BATTLEFIELD_WG_OBJECTTYPE_TOWER,
|
||||
};
|
||||
|
||||
enum eWGGameObjectState
|
||||
enum WintergraspGameObjectState
|
||||
{
|
||||
BATTLEFIELD_WG_OBJECTSTATE_NONE,
|
||||
BATTLEFIELD_WG_OBJECTSTATE_NEUTRAL_INTACT,
|
||||
@@ -475,7 +461,7 @@ enum eWGGameObjectState
|
||||
BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY,
|
||||
};
|
||||
|
||||
enum WGWorkshopId
|
||||
enum WintergraspWorkshopIds
|
||||
{
|
||||
BATTLEFIELD_WG_WORKSHOP_NE,
|
||||
BATTLEFIELD_WG_WORKSHOP_NW,
|
||||
@@ -485,7 +471,7 @@ enum WGWorkshopId
|
||||
BATTLEFIELD_WG_WORKSHOP_KEEP_EAST,
|
||||
};
|
||||
|
||||
enum WGWorldstate
|
||||
enum WintergraspWorldstates
|
||||
{
|
||||
WORLDSTATE_WORKSHOP_NE = 3701,
|
||||
WORLDSTATE_WORKSHOP_NW = 3700,
|
||||
@@ -494,6 +480,7 @@ enum WGWorldstate
|
||||
WORLDSTATE_WORKSHOP_K_W = 3698,
|
||||
WORLDSTATE_WORKSHOP_K_E = 3699
|
||||
};
|
||||
|
||||
enum eWGTeamControl
|
||||
{
|
||||
BATTLEFIELD_WG_TEAM_ALLIANCE,
|
||||
@@ -504,7 +491,6 @@ enum eWGTeamControl
|
||||
// TODO: Handle this with creature_text ?
|
||||
enum eWGText
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NE = 12055,
|
||||
BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_NW = 12052,
|
||||
BATTLEFIELD_WG_TEXT_WORKSHOP_NAME_SE = 12053,
|
||||
@@ -528,34 +514,42 @@ enum eWGText
|
||||
BATTLEFIELD_WG_TEXT_TOWER_NAME_W = 12071,
|
||||
BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 12068,
|
||||
BATTLEFIELD_WG_TEXT_WIN_KEEP = 12072,
|
||||
// *INDENT-ON*
|
||||
};
|
||||
|
||||
enum WGObject
|
||||
enum WintergraspGameObject
|
||||
{
|
||||
// *INDENT-OFF*
|
||||
BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NE = 190475,
|
||||
BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_NW = 190487,
|
||||
BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SE = 194959,
|
||||
BATTLEFIELD_WG_GAMEOBJECT_FACTORY_BANNER_SW = 194962,
|
||||
BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC = 192829,
|
||||
// *INDENT-ON*
|
||||
GO_WINTERGRASP_FACTORY_BANNER_NE = 190475,
|
||||
GO_WINTERGRASP_FACTORY_BANNER_NW = 190487,
|
||||
GO_WINTERGRASP_FACTORY_BANNER_SE = 194959,
|
||||
GO_WINTERGRASP_FACTORY_BANNER_SW = 194962,
|
||||
|
||||
GO_WINTERGRASP_TITAN_S_RELIC = 192829,
|
||||
|
||||
GO_WINTERGRASP_FORTRESS_TOWER_1 = 190221,
|
||||
GO_WINTERGRASP_FORTRESS_TOWER_2 = 190373,
|
||||
GO_WINTERGRASP_FORTRESS_TOWER_3 = 190377,
|
||||
GO_WINTERGRASP_FORTRESS_TOWER_4 = 190378,
|
||||
|
||||
GO_WINTERGRASP_SHADOWSIGHT_TOWER = 190356,
|
||||
GO_WINTERGRASP_WINTER_S_EDGE_TOWER = 190357,
|
||||
GO_WINTERGRASP_FLAMEWATCH_TOWER = 190358,
|
||||
};
|
||||
struct BfWGObjectPosition
|
||||
|
||||
struct WintergraspObjectPositionData
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float o;
|
||||
uint32 entryh;
|
||||
uint32 entrya;
|
||||
uint32 entryHorde;
|
||||
uint32 entryAlliance;
|
||||
};
|
||||
|
||||
// *********************************************************
|
||||
// ************Destructible (Wall,Tower..)******************
|
||||
// *********************************************************
|
||||
// *****************************************************
|
||||
// ************ Destructible (Wall,Tower..) ************
|
||||
// *****************************************************
|
||||
|
||||
struct BfWGBuildingSpawnData
|
||||
struct WintergraspBuildingSpawnData
|
||||
{
|
||||
uint32 entry;
|
||||
uint32 WorldState;
|
||||
@@ -564,11 +558,10 @@ struct BfWGBuildingSpawnData
|
||||
float z;
|
||||
float o;
|
||||
uint32 type;
|
||||
uint32 nameid;
|
||||
uint32 nameId;
|
||||
};
|
||||
|
||||
#define WG_MAX_OBJ 32
|
||||
const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = {
|
||||
const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = {
|
||||
// Wall (Not spawned in db)
|
||||
// Entry WS X Y Z O type NameID
|
||||
{ 190219, 3749, 5371.46f, 3047.47f, 407.571f, 3.14159f, BATTLEFIELD_WG_OBJECTTYPE_WALL, 0 },
|
||||
@@ -660,8 +653,7 @@ const BfWGBuildingSpawnData WGGameObjectBuillding[WG_MAX_OBJ] = {
|
||||
// 192357 : 1 in sql, 1 in header
|
||||
// 192350 : 1 in sql, 1 in header
|
||||
// 192351 : 1 in sql, 1 in header
|
||||
#define WG_KEEPGAMEOBJECT_MAX 44
|
||||
const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = {
|
||||
const WintergraspObjectPositionData WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = {
|
||||
{ 5262.540039f, 3047.949951f, 432.054993f, 3.106650f, 192488, 192501 }, // Flag on tower
|
||||
{ 5272.939941f, 2976.550049f, 444.492004f, 3.124120f, 192374, 192416 }, // Flag on Wall Intersect
|
||||
{ 5235.189941f, 2941.899902f, 444.278015f, 1.588250f, 192375, 192416 }, // Flag on Wall Intersect
|
||||
@@ -708,17 +700,7 @@ const BfWGObjectPosition WGKeepGameObject[WG_KEEPGAMEOBJECT_MAX] = {
|
||||
{ 5271.279785f, 2820.159912f, 445.200989f, -3.13286f, 192351, 192416 } // Flag on wall intersect
|
||||
};
|
||||
|
||||
// Keep turret
|
||||
struct BfWGTurretPos
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float o;
|
||||
};
|
||||
|
||||
#define WG_MAX_TURRET 15
|
||||
const BfWGTurretPos WGTurret[WG_MAX_TURRET] = {
|
||||
const Position WGTurret[WG_MAX_TURRET] = {
|
||||
{ 5391.19f, 3060.8f, 419.616f, 1.69557f },
|
||||
{ 5266.75f, 2976.5f, 421.067f, 3.20354f },
|
||||
{ 5234.86f, 2948.8f, 420.88f, 1.61311f },
|
||||
@@ -736,14 +718,13 @@ const BfWGTurretPos WGTurret[WG_MAX_TURRET] = {
|
||||
{ 5147.98f, 2861.93f, 421.63f, 3.18792f },
|
||||
};
|
||||
|
||||
|
||||
// Here there is all npc keeper spawn point
|
||||
#define WG_MAX_KEEP_NPC 39
|
||||
const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = {
|
||||
const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] =
|
||||
{
|
||||
// X Y Z O horde alliance
|
||||
// North East
|
||||
{ 5326.203125f, 2660.026367f, 409.100891f, 2.543383f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Roaming Guard
|
||||
{ 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Plumembrase
|
||||
{ 5298.430176f, 2738.760010f, 409.316010f, 3.971740f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH }, // Vieron Blazefeather
|
||||
{ 5335.310059f, 2764.110107f, 409.274994f, 4.834560f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
|
||||
{ 5349.810059f, 2763.629883f, 409.333008f, 4.660030f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
|
||||
// North
|
||||
@@ -789,9 +770,7 @@ const BfWGObjectPosition WGKeepNPC[WG_MAX_KEEP_NPC] = {
|
||||
{ 5316.770996f, 2619.430176f, 409.027740f, 5.363431f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A } // Standing Guard
|
||||
};
|
||||
|
||||
#define WG_MAX_OUTSIDE_NPC 14
|
||||
#define WG_OUTSIDE_ALLIANCE_NPC 7
|
||||
const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
|
||||
const WintergraspObjectPositionData WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
|
||||
{
|
||||
{ 5032.04f, 3681.79f, 362.980f, 4.210f, BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER, 0 },
|
||||
{ 5020.71f, 3626.19f, 360.150f, 4.640f, BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN, 0 },
|
||||
@@ -809,17 +788,16 @@ const BfWGObjectPosition WGOutsideNPC[WG_MAX_OUTSIDE_NPC] =
|
||||
{ 5080.40f, 2199.00f, 359.489f, 2.967f, 0, BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO },
|
||||
};
|
||||
|
||||
struct BfWGWGTeleporterData
|
||||
struct WintergraspTeleporterData
|
||||
{
|
||||
uint32 entry; // gameobject entry
|
||||
uint32 entry;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float o;
|
||||
};
|
||||
|
||||
#define WG_MAX_TELEPORTER 12
|
||||
const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] =
|
||||
const WintergraspTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] =
|
||||
{
|
||||
// Player teleporter
|
||||
{ 190763, 5153.41f, 2901.35f, 409.191f, -0.069f },
|
||||
@@ -841,23 +819,23 @@ const BfWGWGTeleporterData WGPortalDefenderData[WG_MAX_TELEPORTER] =
|
||||
// **********Tower Element(GameObject,Creature)*************
|
||||
// *********************************************************
|
||||
|
||||
struct BfWGTowerData
|
||||
struct WintergraspTowerData
|
||||
{
|
||||
uint32 towerentry; // Gameobject id of tower
|
||||
uint32 towerEntry; // Gameobject id of tower
|
||||
uint8 nbObject; // Number of gameobjects spawned on this point
|
||||
BfWGObjectPosition GameObject[6]; // Gameobject position and entry (Horde/Alliance)
|
||||
WintergraspObjectPositionData GameObject[6]; // Gameobject position and entry (Horde/Alliance)
|
||||
|
||||
// Creature : Turrets and Guard, TODO: check if killed on tower destruction? tower damage?
|
||||
uint8 nbCreatureBottom;
|
||||
BfWGObjectPosition CreatureBottom[9];
|
||||
WintergraspObjectPositionData CreatureBottom[9];
|
||||
uint8 nbCreatureTop;
|
||||
BfWGObjectPosition CreatureTop[5];
|
||||
WintergraspObjectPositionData CreatureTop[5];
|
||||
};
|
||||
|
||||
#define WG_MAX_ATTACKTOWERS 3
|
||||
uint8 const WG_MAX_ATTACKTOWERS = 3;
|
||||
// 192414 : 0 in sql, 1 in header
|
||||
// 192278 : 0 in sql, 3 in header
|
||||
const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = {
|
||||
const WintergraspTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = {
|
||||
// West tower
|
||||
{
|
||||
190356,
|
||||
@@ -961,18 +939,18 @@ const BfWGTowerData AttackTowers[WG_MAX_ATTACKTOWERS] = {
|
||||
},
|
||||
};
|
||||
|
||||
struct BfWGTurretData
|
||||
struct WintergraspTowerCannonData
|
||||
{
|
||||
uint32 towerentry;
|
||||
uint8 nbTurretBottom;
|
||||
BfWGTurretPos TurretBottom[5];
|
||||
uint32 towerEntry;
|
||||
uint8 nbTowerCannonBottom;
|
||||
Position TowerCannonBottom[5];
|
||||
uint8 nbTurretTop;
|
||||
BfWGTurretPos TurretTop[5];
|
||||
Position TurretTop[5];
|
||||
};
|
||||
|
||||
#define WG_MAX_TOWERTURRET 7
|
||||
const uint8 WG_MAX_TOWER_CANNON = 7;
|
||||
|
||||
const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] =
|
||||
const WintergraspTowerCannonData TowerCannon[WG_MAX_TOWER_CANNON] =
|
||||
{
|
||||
{
|
||||
190221,
|
||||
@@ -1113,7 +1091,7 @@ const BfWGTurretData TowerTurret[WG_MAX_TOWERTURRET] =
|
||||
// *****************WorkShop Data & Element*****************
|
||||
// *********************************************************
|
||||
|
||||
#define WG_MAX_WORKSHOP 6
|
||||
uint8 const WG_MAX_WORKSHOP = 6;
|
||||
|
||||
struct WGWorkshopData
|
||||
{
|
||||
@@ -1182,7 +1160,7 @@ struct BfWGGameObjectBuilding
|
||||
// Creature associations
|
||||
GuidSet m_CreatureBottomList[2];
|
||||
GuidSet m_CreatureTopList[2];
|
||||
GuidSet m_TurretBottomList;
|
||||
GuidSet m_TowerCannonBottomList;
|
||||
GuidSet m_TurretTopList;
|
||||
|
||||
void Rebuild()
|
||||
@@ -1235,9 +1213,9 @@ struct BfWGGameObjectBuilding
|
||||
m_WG->HideNpc(creature);
|
||||
|
||||
if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER)
|
||||
m_WG->AddDamagedTower(m_WG->GetDefenderTeam());
|
||||
m_WG->UpdateDamagedTowerCount(m_WG->GetDefenderTeam());
|
||||
else if (m_Type == BATTLEFIELD_WG_OBJECTTYPE_TOWER)
|
||||
m_WG->AddDamagedTower(m_WG->GetAttackerTeam());
|
||||
m_WG->UpdateDamagedTowerCount(m_WG->GetAttackerTeam());
|
||||
}
|
||||
|
||||
// Called when associated gameobject is destroyed
|
||||
@@ -1256,14 +1234,14 @@ struct BfWGGameObjectBuilding
|
||||
// Inform the global wintergrasp script of the destruction of this object
|
||||
case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
|
||||
case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
|
||||
m_WG->AddBrokenTower(TeamId(m_Team));
|
||||
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team));
|
||||
break;
|
||||
case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
|
||||
m_WG->AllowToClickOnOrb(true);
|
||||
m_WG->SetRelicInteractible(true);
|
||||
if (m_WG->GetRelic())
|
||||
m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
else
|
||||
sLog->outError("BATTLEFIELD: WG: Relic cant be clickable");
|
||||
sLog->outError("BattlefieldWG: Relic not found.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1323,58 +1301,58 @@ struct BfWGGameObjectBuilding
|
||||
int32 towerid = -1;
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case 190221:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_1:
|
||||
towerid = 0;
|
||||
break;
|
||||
case 190373:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_2:
|
||||
towerid = 1;
|
||||
break;
|
||||
case 190377:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_3:
|
||||
towerid = 2;
|
||||
break;
|
||||
case 190378:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_4:
|
||||
towerid = 3;
|
||||
break;
|
||||
case 190356:
|
||||
case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
|
||||
towerid = 4;
|
||||
break;
|
||||
case 190357:
|
||||
case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
|
||||
towerid = 5;
|
||||
break;
|
||||
case 190358:
|
||||
case GO_WINTERGRASP_FLAMEWATCH_TOWER:
|
||||
towerid = 6;
|
||||
break;
|
||||
}
|
||||
|
||||
if (towerid > 3)
|
||||
if (towerid > 3) // Attacker towers
|
||||
{
|
||||
// Spawn associate gameobjects
|
||||
for (uint8 i = 0; i < AttackTowers[towerid - 4].nbObject; i++)
|
||||
{
|
||||
BfWGObjectPosition gob = AttackTowers[towerid - 4].GameObject[i];
|
||||
if (GameObject *go = m_WG->SpawnGameObject(gob.entryh, gob.x, gob.y, gob.z, gob.o))
|
||||
WintergraspObjectPositionData gobData = AttackTowers[towerid - 4].GameObject[i];
|
||||
if (GameObject* go = m_WG->SpawnGameObject(gobData.entryHorde, gobData.x, gobData.y, gobData.z, gobData.o))
|
||||
m_GameObjectList[TEAM_HORDE].insert(go);
|
||||
if (GameObject *go = m_WG->SpawnGameObject(gob.entrya, gob.x, gob.y, gob.z, gob.o))
|
||||
if (GameObject* go = m_WG->SpawnGameObject(gobData.entryAlliance, gobData.x, gobData.y, gobData.z, gobData.o))
|
||||
m_GameObjectList[TEAM_ALLIANCE].insert(go);
|
||||
}
|
||||
|
||||
// Spawn associate npc bottom
|
||||
for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureBottom; i++)
|
||||
{
|
||||
BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureBottom[i];
|
||||
if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE))
|
||||
WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureBottom[i];
|
||||
if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
|
||||
m_CreatureBottomList[TEAM_HORDE].insert(creature->GetGUID());
|
||||
if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE))
|
||||
if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
|
||||
m_CreatureBottomList[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
}
|
||||
|
||||
// Spawn associate npc top
|
||||
for (uint8 i = 0; i < AttackTowers[towerid - 4].nbCreatureTop; i++)
|
||||
{
|
||||
BfWGObjectPosition crea = AttackTowers[towerid - 4].CreatureTop[i];
|
||||
if (Creature *creature = m_WG->SpawnCreature(crea.entryh, crea.x, crea.y, crea.z, crea.o, TEAM_HORDE))
|
||||
WintergraspObjectPositionData creatureData = AttackTowers[towerid - 4].CreatureTop[i];
|
||||
if (Creature* creature = m_WG->SpawnCreature(creatureData.entryHorde, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_HORDE))
|
||||
m_CreatureTopList[TEAM_HORDE].insert(creature->GetGUID());
|
||||
if (Creature *creature = m_WG->SpawnCreature(crea.entrya, crea.x, crea.y, crea.z, crea.o, TEAM_ALLIANCE))
|
||||
if (Creature* creature = m_WG->SpawnCreature(creatureData.entryAlliance, creatureData.x, creatureData.y, creatureData.z, creatureData.o, TEAM_ALLIANCE))
|
||||
m_CreatureTopList[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
}
|
||||
}
|
||||
@@ -1382,59 +1360,53 @@ struct BfWGGameObjectBuilding
|
||||
if (towerid >= 0)
|
||||
{
|
||||
// Spawn Turret bottom
|
||||
for (uint8 i = 0; i < TowerTurret[towerid].nbTurretBottom; i++)
|
||||
for (uint8 i = 0; i < TowerCannon[towerid].nbTowerCannonBottom; i++)
|
||||
{
|
||||
BfWGTurretPos turretpos = TowerTurret[towerid].TurretBottom[i];
|
||||
if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0)))
|
||||
Position turretPos;
|
||||
TowerCannon[towerid].TowerCannonBottom[i].GetPosition(&turretPos);
|
||||
if (Creature* turret = m_WG->SpawnCreature(NPC_WINTERGRASP_TOWER_CANNON, turretPos, TEAM_ALLIANCE))
|
||||
{
|
||||
m_TurretBottomList.insert(turret->GetGUID());
|
||||
m_TowerCannonBottomList.insert(turret->GetGUID());
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case 190221:
|
||||
case 190373:
|
||||
case 190377:
|
||||
case 190378:
|
||||
{
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_1:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_2:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_3:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_4:
|
||||
turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
|
||||
break;
|
||||
}
|
||||
case 190356:
|
||||
case 190357:
|
||||
case 190358:
|
||||
{
|
||||
case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
|
||||
case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
|
||||
case GO_WINTERGRASP_FLAMEWATCH_TOWER:
|
||||
turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_WG->HideNpc(turret);
|
||||
}
|
||||
}
|
||||
|
||||
// Spawn Turret top
|
||||
for (uint8 i = 0; i < TowerTurret[towerid].nbTurretTop; i++)
|
||||
for (uint8 i = 0; i < TowerCannon[towerid].nbTurretTop; i++)
|
||||
{
|
||||
BfWGTurretPos turretpos = TowerTurret[towerid].TurretTop[i];
|
||||
if (Creature *turret = m_WG->SpawnCreature(28366, turretpos.x, turretpos.y, turretpos.z, turretpos.o, TeamId(0)))
|
||||
Position towerCannonPos;
|
||||
TowerCannon[towerid].TurretTop[i].GetPosition(&towerCannonPos);
|
||||
if (Creature *turret = m_WG->SpawnCreature(28366, towerCannonPos, TeamId(0)))
|
||||
{
|
||||
m_TurretTopList.insert(turret->GetGUID());
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case 190221:
|
||||
case 190373:
|
||||
case 190377:
|
||||
case 190378:
|
||||
{
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_1:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_2:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_3:
|
||||
case GO_WINTERGRASP_FORTRESS_TOWER_4:
|
||||
turret->setFaction(WintergraspFaction[m_WG->GetDefenderTeam()]);
|
||||
break;
|
||||
}
|
||||
case 190356:
|
||||
case 190357:
|
||||
case 190358:
|
||||
{
|
||||
case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
|
||||
case GO_WINTERGRASP_WINTER_S_EDGE_TOWER:
|
||||
case GO_WINTERGRASP_FLAMEWATCH_TOWER:
|
||||
turret->setFaction(WintergraspFaction[m_WG->GetAttackerTeam()]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_WG->HideNpc(turret);
|
||||
}
|
||||
}
|
||||
@@ -1473,7 +1445,7 @@ struct BfWGGameObjectBuilding
|
||||
|
||||
void UpdateTurretAttack(bool disable)
|
||||
{
|
||||
for (GuidSet::const_iterator itr = m_TurretBottomList.begin(); itr != m_TurretBottomList.end(); ++itr)
|
||||
for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
|
||||
{
|
||||
if (Unit* unit = sObjectAccessor->FindUnit(*itr))
|
||||
{
|
||||
@@ -1607,14 +1579,13 @@ struct WGWorkshop
|
||||
|
||||
WGWorkshop(BattlefieldWG* _bf, uint8 _workshopId)
|
||||
{
|
||||
ASSERT(_bf);
|
||||
ASSERT(_workshopId < WG_MAX_WORKSHOP);
|
||||
ASSERT(_bf || _workshopId < WG_MAX_WORKSHOP);
|
||||
|
||||
bf = _bf;
|
||||
workshopId = _workshopId;
|
||||
}
|
||||
|
||||
void ChangeControl(uint8 team, bool init /* for first call in setup */ )
|
||||
void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
|
||||
{
|
||||
switch (team)
|
||||
{
|
||||
@@ -1638,8 +1609,8 @@ struct WGWorkshop
|
||||
|
||||
// Found associate graveyard and update it
|
||||
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
if (bf->GetGraveYardById(workshopId))
|
||||
bf->GetGraveYardById(workshopId)->ChangeControl(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
if (bf->GetGraveyardById(workshopId))
|
||||
bf->GetGraveyardById(workshopId)->GiveControlTo(team == BATTLEFIELD_WG_TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
|
||||
teamControl = team;
|
||||
break;
|
||||
@@ -1650,12 +1621,12 @@ struct WGWorkshop
|
||||
bf->UpdateCounterVehicle(false);
|
||||
}
|
||||
|
||||
void UpdateGraveYardAndWorkshop()
|
||||
void UpdateGraveyardAndWorkshop()
|
||||
{
|
||||
if (workshopId < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
bf->GetGraveYardById(workshopId)->ChangeControl(TeamId(teamControl));
|
||||
bf->GetGraveyardById(workshopId)->GiveControlTo(TeamId(teamControl));
|
||||
else
|
||||
ChangeControl(bf->GetDefenderTeam(), true);
|
||||
GiveControlTo(bf->GetDefenderTeam(), true);
|
||||
}
|
||||
|
||||
void Save()
|
||||
@@ -1665,9 +1636,9 @@ struct WGWorkshop
|
||||
};
|
||||
|
||||
// Structure for the 6 workshop
|
||||
struct BfWGWorkShopData
|
||||
struct WintergraspWorkshopData
|
||||
{
|
||||
BattlefieldWG* m_WG; // Object du joug
|
||||
BattlefieldWG* m_WG; // Pointer to wintergrasp
|
||||
GameObject* m_Build;
|
||||
uint32 m_Type;
|
||||
uint32 m_State; // For worldstate
|
||||
@@ -1677,7 +1648,7 @@ struct BfWGWorkShopData
|
||||
GameObjectSet m_GameObjectOnPoint[2]; // Contain all Gameobject associate to this point
|
||||
uint32 m_NameId; // Id of trinity_string witch contain name of this node, using for alert message
|
||||
|
||||
BfWGWorkShopData(BattlefieldWG * WG)
|
||||
WintergraspWorkshopData(BattlefieldWG * WG)
|
||||
{
|
||||
m_WG = WG;
|
||||
m_Build = NULL;
|
||||
@@ -1689,22 +1660,21 @@ struct BfWGWorkShopData
|
||||
}
|
||||
|
||||
// Spawning associate creature and store them
|
||||
void AddCreature(BfWGObjectPosition obj)
|
||||
void AddCreature(WintergraspObjectPositionData obj)
|
||||
{
|
||||
if (Creature *creature = m_WG->SpawnCreature(obj.entryh, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
|
||||
if (Creature* creature = m_WG->SpawnCreature(obj.entryHorde, obj.x, obj.y, obj.z, obj.o, TEAM_HORDE))
|
||||
m_CreatureOnPoint[TEAM_HORDE].insert(creature->GetGUID());
|
||||
|
||||
if (Creature *creature = m_WG->SpawnCreature(obj.entrya, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE))
|
||||
if (Creature* creature = m_WG->SpawnCreature(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o, TEAM_ALLIANCE))
|
||||
m_CreatureOnPoint[TEAM_ALLIANCE].insert(creature->GetGUID());
|
||||
|
||||
}
|
||||
|
||||
// Spawning Associate gameobject and store them
|
||||
void AddGameObject(BfWGObjectPosition obj)
|
||||
void AddGameObject(WintergraspObjectPositionData obj)
|
||||
{
|
||||
if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryh, obj.x, obj.y, obj.z, obj.o))
|
||||
if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryHorde, obj.x, obj.y, obj.z, obj.o))
|
||||
m_GameObjectOnPoint[TEAM_HORDE].insert(gameobject);
|
||||
if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entrya, obj.x, obj.y, obj.z, obj.o))
|
||||
if (GameObject *gameobject = m_WG->SpawnGameObject(obj.entryAlliance, obj.x, obj.y, obj.z, obj.o))
|
||||
m_GameObjectOnPoint[TEAM_ALLIANCE].insert(gameobject);
|
||||
}
|
||||
|
||||
@@ -1717,7 +1687,7 @@ struct BfWGWorkShopData
|
||||
}
|
||||
|
||||
// Called on change faction in CapturePoint class
|
||||
void ChangeControl(uint8 team, bool init /* for first call in setup */ )
|
||||
void GiveControlTo(uint8 team, bool init /* for first call in setup*/)
|
||||
{
|
||||
switch (team)
|
||||
{
|
||||
@@ -1761,8 +1731,8 @@ struct BfWGWorkShopData
|
||||
|
||||
// Found associate graveyard and update it
|
||||
if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
if (m_WG && m_WG->GetGraveYardById(m_Type))
|
||||
m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_ALLIANCE);
|
||||
if (m_WG && m_WG->GetGraveyardById(m_Type))
|
||||
m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_ALLIANCE);
|
||||
|
||||
m_TeamControl = team;
|
||||
break;
|
||||
@@ -1799,8 +1769,8 @@ struct BfWGWorkShopData
|
||||
|
||||
// Update graveyard control
|
||||
if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
if (m_WG && m_WG->GetGraveYardById(m_Type))
|
||||
m_WG->GetGraveYardById(m_Type)->ChangeControl(TEAM_HORDE);
|
||||
if (m_WG && m_WG->GetGraveyardById(m_Type))
|
||||
m_WG->GetGraveyardById(m_Type)->GiveControlTo(TEAM_HORDE);
|
||||
|
||||
m_TeamControl = team;
|
||||
break;
|
||||
@@ -1810,12 +1780,12 @@ struct BfWGWorkShopData
|
||||
m_WG->UpdateCounterVehicle(false);
|
||||
}
|
||||
|
||||
void UpdateGraveYardAndWorkshop()
|
||||
void UpdateGraveyardAndWorkshop()
|
||||
{
|
||||
if (m_Type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST)
|
||||
m_WG->GetGraveYardById(m_Type)->ChangeControl(TeamId(m_TeamControl));
|
||||
m_WG->GetGraveyardById(m_Type)->GiveControlTo(TeamId(m_TeamControl));
|
||||
else
|
||||
ChangeControl(m_WG->GetDefenderTeam(), true);
|
||||
GiveControlTo(m_WG->GetDefenderTeam(), true);
|
||||
}
|
||||
|
||||
void Save()
|
||||
|
||||
@@ -821,11 +821,6 @@ class ObjectMgr
|
||||
return &_creatureQuestRelations;
|
||||
}
|
||||
|
||||
QuestRelations* GetCreatureQuestInvolvedRelation()
|
||||
{
|
||||
return &_creatureQuestInvolvedRelations;
|
||||
}
|
||||
|
||||
QuestRelationBounds GetCreatureQuestRelationBounds(uint32 creature_entry)
|
||||
{
|
||||
return _creatureQuestRelations.equal_range(creature_entry);
|
||||
|
||||
@@ -800,7 +800,7 @@ class WorldSession
|
||||
// Battlefield
|
||||
void SendBfInvitePlayerToWar(uint32 BattleId,uint32 ZoneId,uint32 time);
|
||||
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 SendBfLeaveMessage(uint32 BattleId, BFLeaveReason reason = BF_LEAVE_REASON_EXITED);
|
||||
void HandleBfQueueInviteResponse(WorldPacket &recv_data);
|
||||
|
||||
@@ -108,15 +108,15 @@ public:
|
||||
if (!bf)
|
||||
return false;
|
||||
|
||||
if (bf->GetEnable())
|
||||
if (bf->IsEnabled())
|
||||
{
|
||||
bf->SetEnable(false);
|
||||
bf->ToggleBattlefield(false);
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp is disabled");
|
||||
}
|
||||
else
|
||||
{
|
||||
bf->SetEnable(true);
|
||||
bf->ToggleBattlefield(true);
|
||||
if (battleid == 1)
|
||||
handler->SendGlobalGMSysMessage("Wintergrasp is enabled");
|
||||
}
|
||||
|
||||
@@ -38,42 +38,84 @@ enum eWGqueuenpctext
|
||||
WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507,
|
||||
};
|
||||
|
||||
enum WGscriptdata
|
||||
enum Spells
|
||||
{
|
||||
// engineer spells
|
||||
SPELL_BUILD_CATAPULT = 56663,
|
||||
SPELL_BUILD_DEMOLISHER = 56575,
|
||||
SPELL_BUILD_SIEGE_ENGINE = 61408,
|
||||
SPELL_BUILD_SIEGE_ENGINE2 = 56661, // does it's really needed here?
|
||||
SPELL_ACTIVATE_ROBOTIC_ARMS = 49899,
|
||||
// Demolisher engineers spells
|
||||
SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 = 61409, //
|
||||
SPELL_BUILD_SIEGE_VEHICLE_FORCE_2 = 56662, // Which faction uses which ?
|
||||
SPELL_BUILD_CATAPULT_FORCE = 56664,
|
||||
SPELL_BUILD_DEMOLISHER_FORCE = 56659,
|
||||
SPELL_ACTIVATE_CONTROL_ARMS = 49899,
|
||||
|
||||
// teleporter spells
|
||||
SPELL_VEHICLE_TELEPORT = 49759,
|
||||
|
||||
// npcs
|
||||
NPC_ROBOTIC_ARMS = 27852,
|
||||
NPC_WORLD_TRIGGER_WG = 23472,
|
||||
// Spirit guide
|
||||
SPELL_CHANNEL_SPIRIT_HEAL = 22011,
|
||||
};
|
||||
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (creature->isQuestGiver())
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
|
||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(1);
|
||||
|
||||
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 (canBuild(creature))
|
||||
{
|
||||
if (player->HasAura(SPELL_CORPORAL))
|
||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_DEMO1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||
@@ -95,60 +137,65 @@ class npc_wg_demolisher_engineer : public CreatureScript
|
||||
{
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
|
||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
Battlefield* wintergrasp= 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 (canBuild(creature))
|
||||
{
|
||||
switch (action - GOSSIP_ACTION_INFO_DEF)
|
||||
{
|
||||
case 0:
|
||||
player->CastSpell(player, SPELL_BUILD_CATAPULT, false, NULL, NULL, creature->GetGUID());
|
||||
creature->CastSpell(player, SPELL_BUILD_CATAPULT_FORCE, true);
|
||||
break;
|
||||
case 1:
|
||||
player->CastSpell(player, SPELL_BUILD_DEMOLISHER, false, NULL, NULL, creature->GetGUID());
|
||||
creature->CastSpell(player, SPELL_BUILD_DEMOLISHER_FORCE, true);
|
||||
break;
|
||||
case 2:
|
||||
player->CastSpell(player, player->GetTeamId() ? SPELL_BUILD_SIEGE_ENGINE : SPELL_BUILD_SIEGE_ENGINE2, false, NULL, NULL, creature->GetGUID());
|
||||
creature->CastSpell(player, player->GetTeamId() == TEAM_ALLIANCE ? SPELL_BUILD_SIEGE_VEHICLE_FORCE_1 : SPELL_BUILD_SIEGE_VEHICLE_FORCE_2, true);
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class npc_wg_spirit_guide : public CreatureScript
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (creature->isQuestGiver())
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
|
||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (BfWG)
|
||||
{
|
||||
GraveYardVect gy = BfWG->GetGraveYardVect();
|
||||
for (uint8 i = 0; i < gy.size(); i++)
|
||||
{
|
||||
if (gy[i]->GetControlTeamId() == player->GetTeamId())
|
||||
{
|
||||
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, sObjectMgr->GetTrinityStringForDBCLocale(((BfGraveYardWG *) gy[i])->GetTextId()), GOSSIP_SENDER_MAIN,
|
||||
GOSSIP_ACTION_INFO_DEF + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (!wintergrasp)
|
||||
return true;
|
||||
|
||||
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;
|
||||
@@ -158,58 +205,66 @@ class npc_wg_spirit_guide : public CreatureScript
|
||||
{
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
|
||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (BfWG)
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (wintergrasp)
|
||||
{
|
||||
GraveYardVect gy = BfWG->GetGraveYardVect();
|
||||
GraveyardVect gy = wintergrasp->GetGraveyardVector();
|
||||
for (uint8 i = 0; i < gy.size(); i++)
|
||||
{
|
||||
if (action - GOSSIP_ACTION_INFO_DEF == i && gy[i]->GetControlTeamId() == player->GetTeamId())
|
||||
{
|
||||
WorldSafeLocsEntry const* ws = sWorldSafeLocsStore.LookupEntry(gy[i]->GetGraveYardId());
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_wg_queue : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_wg_queue() : CreatureScript("npc_wg_queue")
|
||||
{
|
||||
}
|
||||
npc_wg_queue() : CreatureScript("npc_wg_queue") { }
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature)
|
||||
{
|
||||
if (creature->isQuestGiver())
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
|
||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (BfWG)
|
||||
{
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (!wintergrasp)
|
||||
return true;
|
||||
|
||||
if (BfWG->IsWarTime())
|
||||
if (wintergrasp->IsWarTime())
|
||||
{
|
||||
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
|
||||
{
|
||||
uint32 uiTime = BfWG->GetTimer() / 1000;
|
||||
player->SendUpdateWorldState(4354, time(NULL) + uiTime);
|
||||
if (uiTime < 15 * MINUTE)
|
||||
uint32 timer = wintergrasp->GetTimer() / 1000;
|
||||
player->SendUpdateWorldState(4354, time(NULL) + timer);
|
||||
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->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
|
||||
{
|
||||
player->SEND_GOSSIP_MENU(BfWG->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
|
||||
}
|
||||
}
|
||||
player->SEND_GOSSIP_MENU(wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_NOWAR : WG_NPCQUEUE_TEXT_A_NOWAR, creature->GetGUID());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -218,66 +273,53 @@ class npc_wg_queue : public CreatureScript
|
||||
{
|
||||
player->CLOSE_GOSSIP_MENU();
|
||||
|
||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (BfWG)
|
||||
{
|
||||
if (BfWG->IsWarTime())
|
||||
{
|
||||
BfWG->InvitePlayerToWar(player);
|
||||
}
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (!wintergrasp)
|
||||
return true;
|
||||
|
||||
if (wintergrasp->IsWarTime())
|
||||
wintergrasp->InvitePlayerToWar(player);
|
||||
else
|
||||
{
|
||||
uint32 uiTime = BfWG->GetTimer() / 1000;
|
||||
if (uiTime < 15 * MINUTE)
|
||||
BfWG->InvitePlayerToQueue(player);
|
||||
}
|
||||
uint32 timer = wintergrasp->GetTimer() / 1000;
|
||||
if (timer < 15 * MINUTE)
|
||||
wintergrasp->InvitePlayerToQueue(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
const uint32 Vehicules[4] = { 32627, 28312, 28094, 27881 };
|
||||
|
||||
class go_wg_vehicle_teleporter : public GameObjectScript
|
||||
{
|
||||
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
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (uiCheckTimer <= diff)
|
||||
if (_checkTimer <= diff)
|
||||
{
|
||||
for (uint8 i = 0; i < 4; i++)
|
||||
if (Creature* vehicleCreature = go->FindNearestCreature(Vehicules[i], 3.0f, true))
|
||||
// Tabulation madness in the hole!
|
||||
for (uint8 i = 0; i < MAX_WINTERGRASP_VEHICLES; i++)
|
||||
if (Creature* vehicleCreature = go->FindNearestCreature(vehiclesList[i], 3.0f, true))
|
||||
if (!vehicleCreature->HasAura(SPELL_VEHICLE_TELEPORT))
|
||||
if (Vehicle* vehicle = vehicleCreature->GetVehicle())
|
||||
if (Unit* passenger = vehicle->GetPassenger(0))
|
||||
{
|
||||
uint32 gofaction = go->GetUInt32Value(GAMEOBJECT_FACTION);
|
||||
uint32 plfaction = passenger->getFaction();
|
||||
if (gofaction == plfaction)
|
||||
{
|
||||
if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_WG,100.0f,true))
|
||||
if (go->GetUInt32Value(GAMEOBJECT_FACTION) == passenger->getFaction())
|
||||
if (Creature* teleportTrigger = vehicleCreature->FindNearestCreature(NPC_WORLD_TRIGGER_LARGE_AOI_NOT_IMMUNE_PC_NPC, 100.0f, true))
|
||||
teleportTrigger->CastSpell(vehicleCreature, SPELL_VEHICLE_TELEPORT, true);
|
||||
}
|
||||
}
|
||||
|
||||
uiCheckTimer = 1000;
|
||||
_checkTimer = 1000;
|
||||
}
|
||||
else
|
||||
uiCheckTimer -= diff;
|
||||
else _checkTimer -= diff;
|
||||
}
|
||||
private:
|
||||
uint32 uiCheckTimer;
|
||||
uint32 _checkTimer;
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* go) const
|
||||
@@ -289,121 +331,121 @@ class go_wg_vehicle_teleporter : public GameObjectScript
|
||||
class npc_wg_quest_giver : public CreatureScript
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (creature->isQuestGiver())
|
||||
player->PrepareQuestMenu(creature->GetGUID());
|
||||
|
||||
Battlefield* BfWG = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (BfWG)
|
||||
{
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (!wintergrasp)
|
||||
return true;
|
||||
|
||||
if (creature->isQuestGiver())
|
||||
{
|
||||
Object* object = (Object *) creature;
|
||||
QuestRelations* objectQR = sObjectMgr->GetCreatureQuestRelationMap();
|
||||
QuestRelations* objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelation();
|
||||
QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
|
||||
QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
|
||||
|
||||
QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
|
||||
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;
|
||||
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);
|
||||
else if (status == QUEST_STATUS_INCOMPLETE)
|
||||
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;
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
|
||||
uint32 questId = i->second;
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||
if (!quest)
|
||||
continue;
|
||||
|
||||
switch (quest_id)
|
||||
switch (questId)
|
||||
{
|
||||
// Horde attacker
|
||||
case 13193:
|
||||
case 13202:
|
||||
case 13180:
|
||||
case 13200:
|
||||
case 13201:
|
||||
case 13223:
|
||||
if (BfWG->GetAttackerTeam() == TEAM_HORDE)
|
||||
case QUEST_BONES_AND_ARROWS_HORDE_ATT:
|
||||
case QUEST_JINXING_THE_WALLS_HORDE_ATT:
|
||||
case QUEST_SLAY_THEM_ALL_HORDE_ATT:
|
||||
case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT:
|
||||
case QUEST_HEALING_WITH_ROSES_HORDE_ATT:
|
||||
case QUEST_DEFEND_THE_SIEGE_HORDE_ATT:
|
||||
if (wintergrasp->GetAttackerTeam() == TEAM_HORDE)
|
||||
{
|
||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
||||
QuestStatus status = player->GetQuestStatus(questId);
|
||||
|
||||
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))
|
||||
qm.AddMenuItem(quest_id, 2);
|
||||
qm.AddMenuItem(questId, 2);
|
||||
}
|
||||
break;
|
||||
// Horde defender
|
||||
case 13199:
|
||||
case 13192:
|
||||
case 13178:
|
||||
case 13191:
|
||||
case 13194:
|
||||
case 13539:
|
||||
case 13185:
|
||||
if (BfWG->GetDefenderTeam() == TEAM_HORDE)
|
||||
case QUEST_BONES_AND_ARROWS_HORDE_DEF:
|
||||
case QUEST_WARDING_THE_WALLS_HORDE_DEF:
|
||||
case QUEST_SLAY_THEM_ALL_HORDE_DEF:
|
||||
case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF:
|
||||
case QUEST_HEALING_WITH_ROSES_HORDE_DEF:
|
||||
case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF:
|
||||
case QUEST_STOP_THE_SIEGE_HORDE_DEF:
|
||||
if (wintergrasp->GetDefenderTeam() == TEAM_HORDE)
|
||||
{
|
||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
||||
QuestStatus status = player->GetQuestStatus(questId);
|
||||
|
||||
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))
|
||||
qm.AddMenuItem(quest_id, 2);
|
||||
qm.AddMenuItem(questId, 2);
|
||||
}
|
||||
break;
|
||||
// Alliance attacker
|
||||
case 13196:
|
||||
case 13198:
|
||||
case 13179:
|
||||
case 13222:
|
||||
case 13195:
|
||||
if (BfWG->GetAttackerTeam() == TEAM_ALLIANCE)
|
||||
case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT:
|
||||
case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT:
|
||||
case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT:
|
||||
case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT:
|
||||
case QUEST_A_RARE_HERB_ALLIANCE_ATT:
|
||||
if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE)
|
||||
{
|
||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
||||
QuestStatus status = player->GetQuestStatus(questId);
|
||||
|
||||
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))
|
||||
qm.AddMenuItem(quest_id, 2);
|
||||
qm.AddMenuItem(questId, 2);
|
||||
}
|
||||
break;
|
||||
// Alliance defender
|
||||
case 13154:
|
||||
case 13153:
|
||||
case 13177:
|
||||
case 13538:
|
||||
case 13186:
|
||||
case 13156:
|
||||
if (BfWG->GetDefenderTeam() == TEAM_ALLIANCE)
|
||||
case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF:
|
||||
case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF:
|
||||
case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF:
|
||||
case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF:
|
||||
case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF:
|
||||
case QUEST_A_RARE_HERB_ALLIANCE_DEF:
|
||||
if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
|
||||
{
|
||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
||||
QuestStatus status = player->GetQuestStatus(questId);
|
||||
|
||||
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))
|
||||
qm.AddMenuItem(quest_id, 2);
|
||||
qm.AddMenuItem(questId, 2);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
QuestStatus status = player->GetQuestStatus(quest_id);
|
||||
QuestStatus status = player->GetQuestStatus(questId);
|
||||
|
||||
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))
|
||||
qm.AddMenuItem(quest_id, 2);
|
||||
qm.AddMenuItem(questId, 2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -411,8 +453,43 @@ class npc_wg_quest_giver : public CreatureScript
|
||||
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
|
||||
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
|
||||
@@ -444,7 +521,9 @@ void AddSC_wintergrasp()
|
||||
new npc_wg_queue();
|
||||
new npc_wg_spirit_guide();
|
||||
new npc_wg_demolisher_engineer();
|
||||
new go_wg_vehicle_teleporter();
|
||||
new npc_wg_quest_giver();
|
||||
new achievement_wg_didnt_stand_a_chance();
|
||||
new spell_wintergrasp_force_building();
|
||||
|
||||
new go_wg_vehicle_teleporter();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user