[0128] Add Outdoor PvP placeholders and string texts

This commit is contained in:
stfx 2012-08-17 19:41:26 +02:00 committed by Antz
parent 088ed3ff69
commit 392fc06762
22 changed files with 8901 additions and 8702 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
ALTER TABLE db_version CHANGE COLUMN required_0124_12094_01_mangos_creature_template required_0128_12097_01_mangos_mangos_string bit;
DELETE FROM mangos_string WHERE entry BETWEEN 1600 AND 1636;
INSERT INTO mangos_string VALUES
(1600,'|cffffff00Northpass Tower has been taken by the Horde!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1601,'|cffffff00Northpass Tower has been taken by the Alliance!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1602,'|cffffff00Crown Guard Tower has been taken by the Horde!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1603,'|cffffff00Crown Guard Tower has been taken by the Alliance!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1604,'|cffffff00Eastwall Tower has been taken by the Horde!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1605,'|cffffff00Eastwall Tower has been taken by the Alliance!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1606,'|cffffff00The Plaguewood Tower has been taken by the Horde!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1607,'|cffffff00The Plaguewood Tower has been taken by the Alliance!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1608,'|cffffff00The Overlook has been taken by the Horde!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1609,'|cffffff00The Overlook has been taken by the Alliance!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1610,'|cffffff00The Stadium has been taken by the Horde!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1611,'|cffffff00The Stadium has been taken by the Alliance!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1612,'|cffffff00Broken Hill has been taken by the Horde!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1613,'|cffffff00Broken Hill has been taken by the Alliance!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1614,'|cffffff00The Horde has taken control of the East Beacon!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1615,'|cffffff00The Alliance has taken control of the East Beacon!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1616,'|cffffff00The Horde has taken control of the West Beacon!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1617,'|cffffff00The Alliance has taken control of the West Beacon!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1618,'|cffffff00The Horde has taken control of both beacons!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1619,'|cffffff00The Alliance has taken control of both beacons!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1620,'|cffffff00The Horde Field Scout is now issuing battle standards.|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1621,'|cffffff00The Alliance Field Scout is now issuing battle standards.|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1622,'|cffffff00The Horde has taken control of Twin Spire Ruins!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1623,'|cffffff00The Alliance has taken control of Twin Spire Ruins!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1624,'|cffffff00The Horde has taken control of a Spirit Tower!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1625,'|cffffff00The Alliance has taken control of a Spirit Tower!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1626,'|cffffff00The Horde has lost control of a Spirit Tower!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1627,'|cffffff00The Alliance has lost control of a Spirit Tower!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1628,'|cffffff00The Horde has taken control of The Bone Wastes!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1629,'|cffffff00The Alliance has taken control of The Bone Wastes!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1630,'|cffffff00The Horde is gaining control of Halaa!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1631,'|cffffff00The Alliance is gaining control of Halaa!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1632,'|cffffff00The Horde has taken control of Halaa!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1633,'|cffffff00The Alliance has taken control of Halaa!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1634,'|cffffff00Halaa is defenseless!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1635,'|cffffff00The Horde has collected 200 silithyst!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(1636,'|cffffff00The Alliance has collected 200 silithyst!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);

View file

@ -15,149 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvP.h"
#include "../Language.h"
#include "../World.h"
#include "../ObjectMgr.h"
#include "../Object.h"
#include "../GameObject.h"
#include "../Player.h"
/**
Function that adds a player to the players of the affected outdoor pvp zones
@param player to add
@param whether zone is main outdoor pvp zone or a affected zone
*/
void OutdoorPvP::HandlePlayerEnterZone(Player* player, bool isMainZone)
{
m_zonePlayers[player->GetObjectGuid()] = isMainZone;
}
/**
Function that removes a player from the players of the affected outdoor pvp zones
@param player to remove
@param whether zone is main outdoor pvp zone or a affected zone
*/
void OutdoorPvP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
if (m_zonePlayers.erase(player->GetObjectGuid()))
{
// remove the world state information from the player
if (isMainZone && !player->GetSession()->PlayerLogout())
SendRemoveWorldStates(player);
sLog.outDebug("Player %s left an Outdoor PvP zone", player->GetName());
}
}
/**
Function that updates the world state for all the players of the outdoor pvp zone
@param world state to update
@param new world state value
*/
void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
{
for (GuidZoneMap::iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
{
// only send world state update to main zone
if (!itr->second)
continue;
if (Player* player = sObjectMgr.GetPlayer(itr->first))
player->SendUpdateWorldState(field, value);
}
}
/**
Function that handles player kills in the main outdoor pvp zones
@param player who killed another player
@param victim who was killed
*/
void OutdoorPvP::HandlePlayerKill(Player* killer, Unit* victim)
{
if (Group* group = killer->GetGroup())
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* groupMember = itr->getSource();
if (!groupMember)
continue;
// skip if too far away
if (!groupMember->IsAtGroupRewardDistance(victim))
continue;
// creature kills must be notified, even if not inside objective / not outdoor pvp active
// player kills only count if active and inside objective
if (groupMember->CanUseOutdoorCapturePoint())
HandlePlayerKillInsideArea(groupMember, victim);
}
}
else
{
// creature kills must be notified, even if not inside objective / not outdoor pvp active
if (killer && killer->CanUseOutdoorCapturePoint())
HandlePlayerKillInsideArea(killer, victim);
}
}
// apply a team buff for the main and affected zones
void OutdoorPvP::BuffTeam(Team team, uint32 spellId, bool remove /*= false*/)
{
for (GuidZoneMap::iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
{
Player* player = sObjectMgr.GetPlayer(itr->first);
if (player && player->GetTeam() == team)
{
if (remove)
player->RemoveAurasDueToSpell(spellId);
else
player->CastSpell(player, spellId, true);
}
}
}
uint32 OutdoorPvP::GetBannerArtKit(Team team, uint32 artKitAlliance /*= CAPTURE_ARTKIT_ALLIANCE*/, uint32 artKitHorde /*= CAPTURE_ARTKIT_HORDE*/, uint32 artKitNeutral /*= CAPTURE_ARTKIT_NEUTRAL*/)
{
switch (team)
{
case ALLIANCE:
return artKitAlliance;
case HORDE:
return artKitHorde;
default:
return artKitNeutral;
}
}
void OutdoorPvP::SetBannerVisual(const WorldObject* objRef, ObjectGuid goGuid, uint32 artKit, uint32 animId)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(goGuid))
SetBannerVisual(go, artKit, animId);
}
void OutdoorPvP::SetBannerVisual(GameObject* go, uint32 artKit, uint32 animId)
{
go->SendGameObjectCustomAnim(go->GetObjectGuid(), animId);
go->SetGoArtKit(artKit);
go->Refresh();
}
void OutdoorPvP::RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool respawn)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(goGuid))
{
go->SetRespawnTime(7 * DAY);
if (respawn)
go->Refresh();
else if (go->isSpawned())
go->SetLootState(GO_JUST_DEACTIVATED);
}
}

View file

@ -19,103 +19,4 @@
#ifndef OUTDOOR_PVP_H
#define OUTDOOR_PVP_H
#include "Common.h"
#include "../ObjectGuid.h"
#include "../SharedDefines.h"
#include "OutdoorPvPMgr.h"
class WorldPacket;
class WorldObject;
class Player;
class GameObject;
class Unit;
class Creature;
enum CapturePointArtKits
{
CAPTURE_ARTKIT_ALLIANCE = 2,
CAPTURE_ARTKIT_HORDE = 1,
CAPTURE_ARTKIT_NEUTRAL = 21
};
enum CapturePointAnimations
{
CAPTURE_ANIM_ALLIANCE = 1,
CAPTURE_ANIM_HORDE = 0,
CAPTURE_ANIM_NEUTRAL = 2
};
typedef std::map<ObjectGuid /*playerGuid*/, bool /*isMainZone*/> GuidZoneMap;
class OutdoorPvP
{
friend class OutdoorPvPMgr;
public:
OutdoorPvP() {}
~OutdoorPvP() {}
// called when the zone is initialized
virtual void FillInitialWorldStates(WorldPacket& /*data*/, uint32& /*count*/) {}
// Process Capture event
virtual bool HandleEvent(uint32 /*eventId*/, GameObject* /*go*/) { return false; }
// handle capture objective complete
virtual void HandleObjectiveComplete(uint32 /*eventId*/, std::list<Player*> /*players*/, Team /*team*/) {}
// Called when a creature or gameobject is created
virtual void HandleCreatureCreate(Creature* /*creature*/) {}
virtual void HandleGameObjectCreate(GameObject* /*go*/) {}
// Called on creature death
virtual void HandleCreatureDeath(Creature* /*creature*/) {}
// called when a player uses a gameobject related to outdoor pvp events
virtual bool HandleGameObjectUse(Player* /*player*/, GameObject* /*go*/) { return false; }
// called when a player triggers an areatrigger
virtual bool HandleAreaTrigger(Player* /*player*/, uint32 /*triggerId*/) { return false; }
// called when a player drops a flag
virtual bool HandleDropFlag(Player* /*player*/, uint32 /*spellId*/) { return false; }
// update - called by the OutdoorPvPMgr
virtual void Update(uint32 /*diff*/) {}
// handle npc/player kill
void HandlePlayerKill(Player* killer, Unit* victim);
protected:
// Player related stuff
virtual void HandlePlayerEnterZone(Player* /*player*/, bool /*isMainZone*/);
virtual void HandlePlayerLeaveZone(Player* /*player*/, bool /*isMainZone*/);
// remove world states
virtual void SendRemoveWorldStates(Player* /*player*/) {}
// handle npc/player kill
virtual void HandlePlayerKillInsideArea(Player* /*killer*/, Unit* /*victim*/) {}
// send world state update to all players present
void SendUpdateWorldState(uint32 field, uint32 value);
// applies buff to a team inside the specific zone
void BuffTeam(Team team, uint32 spellId, bool remove = false);
// get banner artkit based on controlling team
uint32 GetBannerArtKit(Team team, uint32 artKitAlliance = CAPTURE_ARTKIT_ALLIANCE, uint32 artKitHorde = CAPTURE_ARTKIT_HORDE, uint32 artKitNeutral = CAPTURE_ARTKIT_NEUTRAL);
// set banner visual
void SetBannerVisual(const WorldObject* objRef, ObjectGuid goGuid, uint32 artKit, uint32 animId);
void SetBannerVisual(GameObject* go, uint32 artKit, uint32 animId);
// Handle gameobject spawn / despawn
void RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool respawn);
// store the players inside the area
GuidZoneMap m_zonePlayers;
};
#endif

View file

@ -15,344 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPEP.h"
#include "WorldPacket.h"
#include "../World.h"
#include "../ObjectMgr.h"
#include "../Object.h"
#include "../Creature.h"
#include "../GameObject.h"
#include "../Player.h"
OutdoorPvPEP::OutdoorPvPEP() : OutdoorPvP(),
m_towersAlliance(0),
m_towersHorde(0)
{
m_towerWorldState[0] = WORLD_STATE_EP_NORTHPASS_NEUTRAL;
m_towerWorldState[1] = WORLD_STATE_EP_CROWNGUARD_NEUTRAL;
m_towerWorldState[2] = WORLD_STATE_EP_EASTWALL_NEUTRAL;
m_towerWorldState[3] = WORLD_STATE_EP_PLAGUEWOOD_NEUTRAL;
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
m_towerOwner[i] = TEAM_NONE;
// initially set graveyard owner to neither faction
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_EASTERN_PLAGUE, GRAVEYARD_ZONE_EASTERN_PLAGUE, TEAM_INVALID);
}
void OutdoorPvPEP::FillInitialWorldStates(WorldPacket& data, uint32& count)
{
FillInitialWorldState(data, count, WORLD_STATE_EP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
FillInitialWorldState(data, count, WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde);
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
}
void OutdoorPvPEP::SendRemoveWorldStates(Player* player)
{
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
}
void OutdoorPvPEP::HandlePlayerEnterZone(Player* player, bool isMainZone)
{
OutdoorPvP::HandlePlayerEnterZone(player, isMainZone);
// remove the buff from the player first; Sometimes on relog players still have the aura
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? plaguelandsTowerBuffs[i].spellIdAlliance : plaguelandsTowerBuffs[i].spellIdHorde);
// buff the player
switch (player->GetTeam())
{
case ALLIANCE:
if (m_towersAlliance > 0)
player->CastSpell(player, plaguelandsTowerBuffs[m_towersAlliance - 1].spellIdAlliance, true);
break;
case HORDE:
if (m_towersHorde > 0)
player->CastSpell(player, plaguelandsTowerBuffs[m_towersHorde - 1].spellIdHorde, true);
break;
default:
break;
}
}
void OutdoorPvPEP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the buff from the player
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? plaguelandsTowerBuffs[i].spellIdAlliance : plaguelandsTowerBuffs[i].spellIdHorde);
OutdoorPvP::HandlePlayerLeaveZone(player, isMainZone);
}
void OutdoorPvPEP::HandleCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
case NPC_SPECTRAL_FLIGHT_MASTER:
m_flightMaster = creature->GetObjectGuid();
creature->setFaction(m_towerOwner[TOWER_ID_PLAGUEWOOD] == ALLIANCE ? FACTION_FLIGHT_MASTER_ALLIANCE : FACTION_FLIGHT_MASTER_HORDE);
creature->CastSpell(creature, m_towerOwner[TOWER_ID_PLAGUEWOOD] == ALLIANCE ? SPELL_SPIRIT_PARTICLES_BLUE : SPELL_SPIRIT_PARTICLES_RED, true);
break;
case NPC_LORDAERON_COMMANDER:
case NPC_LORDAERON_SOLDIER:
case NPC_LORDAERON_VETERAN:
case NPC_LORDAERON_FIGHTER:
m_soldiers.push_back(creature->GetObjectGuid());
break;
}
}
void OutdoorPvPEP::HandleGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_TOWER_BANNER_NORTHPASS:
InitBanner(go, TOWER_ID_NORTHPASS);
break;
case GO_TOWER_BANNER_CROWNGUARD:
InitBanner(go, TOWER_ID_CROWNGUARD);
break;
case GO_TOWER_BANNER_EASTWALL:
InitBanner(go, TOWER_ID_EASTWALL);
break;
case GO_TOWER_BANNER_PLAGUEWOOD:
InitBanner(go, TOWER_ID_PLAGUEWOOD);
break;
case GO_TOWER_BANNER:
// sort banners
if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_NORTHPASS][0], plaguelandsTowerLocations[TOWER_ID_NORTHPASS][1], 50.0f))
InitBanner(go, TOWER_ID_NORTHPASS);
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][0], plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][1], 50.0f))
InitBanner(go, TOWER_ID_CROWNGUARD);
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_EASTWALL][0], plaguelandsTowerLocations[TOWER_ID_EASTWALL][1], 50.0f))
InitBanner(go, TOWER_ID_EASTWALL);
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][0], plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][1], 50.0f))
InitBanner(go, TOWER_ID_PLAGUEWOOD);
break;
case GO_LORDAERON_SHRINE_ALLIANCE:
m_lordaeronShrineAlliance = go->GetObjectGuid();
break;
case GO_LORDAERON_SHRINE_HORDE:
m_lordaeronShrineHorde = go->GetObjectGuid();
break;
}
}
void OutdoorPvPEP::HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team)
{
uint32 credit = 0;
switch (eventId)
{
case EVENT_CROWNGUARD_PROGRESS_ALLIANCE:
case EVENT_CROWNGUARD_PROGRESS_HORDE:
credit = NPC_CROWNGUARD_TOWER_QUEST_DOODAD;
break;
case EVENT_EASTWALL_PROGRESS_ALLIANCE:
case EVENT_EASTWALL_PROGRESS_HORDE:
credit = NPC_EASTWALL_TOWER_QUEST_DOODAD;
break;
case EVENT_NORTHPASS_PROGRESS_ALLIANCE:
case EVENT_NORTHPASS_PROGRESS_HORDE:
credit = NPC_NORTHPASS_TOWER_QUEST_DOODAD;
break;
case EVENT_PLAGUEWOOD_PROGRESS_ALLIANCE:
case EVENT_PLAGUEWOOD_PROGRESS_HORDE:
credit = NPC_PLAGUEWOOD_TOWER_QUEST_DOODAD;
break;
default:
return;
}
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
{
if ((*itr) && (*itr)->GetTeam() == team)
{
(*itr)->KilledMonsterCredit(credit);
(*itr)->RewardHonor(NULL, 1, HONOR_REWARD_PLAGUELANDS);
}
}
}
// process the capture events
bool OutdoorPvPEP::HandleEvent(uint32 eventId, GameObject* go)
{
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
{
if (plaguelandsBanners[i] == go->GetEntry())
{
for (uint8 j = 0; j < 4; ++j)
{
if (plaguelandsTowerEvents[i][j].eventEntry == eventId)
{
// prevent processing if the owner did not change (happens if progress event is called after contest event)
if (plaguelandsTowerEvents[i][j].team != m_towerOwner[i])
{
if (plaguelandsTowerEvents[i][j].defenseMessage)
sWorld.SendDefenseMessage(ZONE_ID_EASTERN_PLAGUELANDS, plaguelandsTowerEvents[i][j].defenseMessage);
return ProcessCaptureEvent(go, i, plaguelandsTowerEvents[i][j].team, plaguelandsTowerEvents[i][j].worldState);
}
// no need to iterate other events or towers
return false;
}
}
// no need to iterate other towers
return false;
}
}
return false;
}
bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState)
{
if (team == ALLIANCE)
{
// update banner
for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr)
SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE);
// update counter
++m_towersAlliance;
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
// buff players
BuffTeam(ALLIANCE, plaguelandsTowerBuffs[m_towersAlliance - 1].spellIdAlliance);
}
else if (team == HORDE)
{
// update banner
for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr)
SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
// update counter
++m_towersHorde;
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde);
// buff players
BuffTeam(HORDE, plaguelandsTowerBuffs[m_towersHorde - 1].spellIdHorde);
}
else
{
// update banner
for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr)
SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
if (m_towerOwner[towerId] == ALLIANCE)
{
// update counter
--m_towersAlliance;
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
if (m_towersAlliance == 0)
BuffTeam(ALLIANCE, plaguelandsTowerBuffs[0].spellIdAlliance, true);
}
else
{
// update counter
--m_towersHorde;
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde);
if (m_towersHorde == 0)
BuffTeam(HORDE, plaguelandsTowerBuffs[0].spellIdHorde, true);
}
}
bool eventHandled = true;
if (team != TEAM_NONE)
{
// update capture point owner before rewards are applied
m_towerOwner[towerId] = team;
// apply rewards of changed tower
switch (towerId)
{
case TOWER_ID_NORTHPASS:
RespawnGO(go, team == ALLIANCE ? m_lordaeronShrineAlliance : m_lordaeronShrineHorde, true);
break;
case TOWER_ID_CROWNGUARD:
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_EASTERN_PLAGUE, GRAVEYARD_ZONE_EASTERN_PLAGUE, team);
break;
case TOWER_ID_EASTWALL:
// Return false - allow the DB to handle summons
if (m_towerOwner[TOWER_ID_NORTHPASS] != team)
eventHandled = false;
break;
case TOWER_ID_PLAGUEWOOD:
// Return false - allow the DB to handle summons
eventHandled = false;
break;
}
}
else
{
// remove rewards of changed tower
switch (towerId)
{
case TOWER_ID_NORTHPASS:
RespawnGO(go, m_towerOwner[TOWER_ID_NORTHPASS] == ALLIANCE ? m_lordaeronShrineAlliance : m_lordaeronShrineHorde, false);
break;
case TOWER_ID_CROWNGUARD:
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_EASTERN_PLAGUE, GRAVEYARD_ZONE_EASTERN_PLAGUE, TEAM_INVALID);
break;
case TOWER_ID_EASTWALL:
UnsummonSoldiers(go);
break;
case TOWER_ID_PLAGUEWOOD:
UnsummonFlightMaster(go);
break;
}
// update capture point owner after rewards have been removed
m_towerOwner[towerId] = team;
}
// update tower state
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_REMOVE);
m_towerWorldState[towerId] = newWorldState;
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_ADD);
// there are some events which required further DB script
return eventHandled;
}
bool OutdoorPvPEP::HandleGameObjectUse(Player* /*player*/, GameObject* go)
{
// prevent despawning after go use
if (go->GetEntry() == GO_LORDAERON_SHRINE_ALLIANCE || go->GetEntry() == GO_LORDAERON_SHRINE_HORDE)
go->SetRespawnTime(0);
return false;
}
void OutdoorPvPEP::InitBanner(GameObject* go, uint32 towerId)
{
m_towerBanners[towerId].push_back(go->GetObjectGuid());
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[towerId]));
}
// Handle the unsummon of the spectral flight master when the Plaguewood tower is lost
void OutdoorPvPEP::UnsummonFlightMaster(const WorldObject* objRef)
{
if (Creature* flightMaster = objRef->GetMap()->GetCreature(m_flightMaster))
flightMaster->ForcedDespawn();
}
// Handle the unsummon of the soldiers when the Eastwall tower is lost
void OutdoorPvPEP::UnsummonSoldiers(const WorldObject* objRef)
{
for (GuidList::const_iterator itr = m_soldiers.begin(); itr != m_soldiers.end(); ++itr)
{
if (Creature* soldier = objRef->GetMap()->GetCreature(*itr))
soldier->ForcedDespawn();
}
m_soldiers.clear();
}

View file

@ -19,251 +19,4 @@
#ifndef WORLD_PVP_EP
#define WORLD_PVP_EP
#include "Common.h"
#include "OutdoorPvP.h"
#include "../Language.h"
enum
{
TOWER_ID_NORTHPASS = 0,
TOWER_ID_CROWNGUARD = 1,
TOWER_ID_EASTWALL = 2,
TOWER_ID_PLAGUEWOOD = 3,
MAX_EP_TOWERS = 4,
// spells
SPELL_ECHOES_OF_LORDAERON_ALLIANCE_1 = 11413,
SPELL_ECHOES_OF_LORDAERON_ALLIANCE_2 = 11414,
SPELL_ECHOES_OF_LORDAERON_ALLIANCE_3 = 11415,
SPELL_ECHOES_OF_LORDAERON_ALLIANCE_4 = 1386,
SPELL_ECHOES_OF_LORDAERON_HORDE_1 = 30880,
SPELL_ECHOES_OF_LORDAERON_HORDE_2 = 30683,
SPELL_ECHOES_OF_LORDAERON_HORDE_3 = 30682,
SPELL_ECHOES_OF_LORDAERON_HORDE_4 = 29520,
// graveyards
GRAVEYARD_ZONE_EASTERN_PLAGUE = 139,
GRAVEYARD_ID_EASTERN_PLAGUE = 927,
// misc
HONOR_REWARD_PLAGUELANDS = 18,
// npcs
NPC_SPECTRAL_FLIGHT_MASTER = 17209,
// flight master factions
FACTION_FLIGHT_MASTER_ALLIANCE = 774,
FACTION_FLIGHT_MASTER_HORDE = 775,
SPELL_SPIRIT_PARTICLES_BLUE = 17327,
SPELL_SPIRIT_PARTICLES_RED = 31309,
// quest
NPC_CROWNGUARD_TOWER_QUEST_DOODAD = 17689,
NPC_EASTWALL_TOWER_QUEST_DOODAD = 17690,
NPC_NORTHPASS_TOWER_QUEST_DOODAD = 17696,
NPC_PLAGUEWOOD_TOWER_QUEST_DOODAD = 17698,
// alliance
NPC_LORDAERON_COMMANDER = 17635,
NPC_LORDAERON_SOLDIER = 17647,
// horde
NPC_LORDAERON_VETERAN = 17995,
NPC_LORDAERON_FIGHTER = 17996,
// gameobjects
GO_LORDAERON_SHRINE_ALLIANCE = 181682,
GO_LORDAERON_SHRINE_HORDE = 181955,
GO_TOWER_FLAG = 182106,
// possible shrine auras - not used
//GO_ALLIANCE_BANNER_AURA = 180100,
//GO_HORDE_BANNER_AURA = 180101,
// capture points
GO_TOWER_BANNER_NORTHPASS = 181899,
GO_TOWER_BANNER_CROWNGUARD = 182096,
GO_TOWER_BANNER_EASTWALL = 182097,
GO_TOWER_BANNER_PLAGUEWOOD = 182098,
GO_TOWER_BANNER = 182106, // tower banners around
// events
//EVENT_NORTHPASS_WIN_ALLIANCE = 10568,
//EVENT_NORTHPASS_WIN_HORDE = 10556,
//EVENT_NORTHPASS_CONTEST_ALLIANCE = 10697,
//EVENT_NORTHPASS_CONTEST_HORDE = 10696,
EVENT_NORTHPASS_PROGRESS_ALLIANCE = 10699,
EVENT_NORTHPASS_PROGRESS_HORDE = 10698,
EVENT_NORTHPASS_NEUTRAL_ALLIANCE = 11151,
EVENT_NORTHPASS_NEUTRAL_HORDE = 11150,
//EVENT_CROWNGUARD_WIN_ALLIANCE = 10570,
//EVENT_CROWNGUARD_WIN_HORDE = 10566,
//EVENT_CROWNGUARD_CONTEST_ALLIANCE = 10703,
//EVENT_CROWNGUARD_CONTEST_HORDE = 10702,
EVENT_CROWNGUARD_PROGRESS_ALLIANCE = 10705,
EVENT_CROWNGUARD_PROGRESS_HORDE = 10704,
EVENT_CROWNGUARD_NEUTRAL_ALLIANCE = 11155,
EVENT_CROWNGUARD_NEUTRAL_HORDE = 11154,
//EVENT_EASTWALL_WIN_ALLIANCE = 10569,
//EVENT_EASTWALL_WIN_HORDE = 10565,
//EVENT_EASTWALL_CONTEST_ALLIANCE = 10689,
//EVENT_EASTWALL_CONTEST_HORDE = 10690,
EVENT_EASTWALL_PROGRESS_ALLIANCE = 10691,
EVENT_EASTWALL_PROGRESS_HORDE = 10692,
EVENT_EASTWALL_NEUTRAL_ALLIANCE = 11149,
EVENT_EASTWALL_NEUTRAL_HORDE = 11148,
//EVENT_PLAGUEWOOD_WIN_ALLIANCE = 10567,
//EVENT_PLAGUEWOOD_WIN_HORDE = 10564,
//EVENT_PLAGUEWOOD_CONTEST_ALLIANCE = 10687,
//EVENT_PLAGUEWOOD_CONTEST_HORDE = 10688,
EVENT_PLAGUEWOOD_PROGRESS_ALLIANCE = 10701,
EVENT_PLAGUEWOOD_PROGRESS_HORDE = 10700,
EVENT_PLAGUEWOOD_NEUTRAL_ALLIANCE = 11153,
EVENT_PLAGUEWOOD_NEUTRAL_HORDE = 11152,
// world states
WORLD_STATE_EP_TOWER_COUNT_ALLIANCE = 2327,
WORLD_STATE_EP_TOWER_COUNT_HORDE = 2328,
//WORLD_STATE_EP_PLAGUEWOOD_CONTEST_ALLIANCE = 2366,
//WORLD_STATE_EP_PLAGUEWOOD_CONTEST_HORDE = 2367,
//WORLD_STATE_EP_PLAGUEWOOD_PROGRESS_ALLIANCE = 2368,
//WORLD_STATE_EP_PLAGUEWOOD_PROGRESS_HORDE = 2369,
WORLD_STATE_EP_PLAGUEWOOD_ALLIANCE = 2370,
WORLD_STATE_EP_PLAGUEWOOD_HORDE = 2371,
WORLD_STATE_EP_PLAGUEWOOD_NEUTRAL = 2353,
//WORLD_STATE_EP_NORTHPASS_CONTEST_ALLIANCE = 2362,
//WORLD_STATE_EP_NORTHPASS_CONTEST_HORDE = 2363,
//WORLD_STATE_EP_NORTHPASS_PROGRESS_ALLIANCE = 2364,
//WORLD_STATE_EP_NORTHPASS_PROGRESS_HORDE = 2365,
WORLD_STATE_EP_NORTHPASS_ALLIANCE = 2372,
WORLD_STATE_EP_NORTHPASS_HORDE = 2373,
WORLD_STATE_EP_NORTHPASS_NEUTRAL = 2352,
//WORLD_STATE_EP_EASTWALL_CONTEST_ALLIANCE = 2359,
//WORLD_STATE_EP_EASTWALL_CONTEST_HORDE = 2360,
//WORLD_STATE_EP_EASTWALL_PROGRESS_ALLIANCE = 2357,
//WORLD_STATE_EP_EASTWALL_PROGRESS_HORDE = 2358,
WORLD_STATE_EP_EASTWALL_ALLIANCE = 2354,
WORLD_STATE_EP_EASTWALL_HORDE = 2356,
WORLD_STATE_EP_EASTWALL_NEUTRAL = 2361,
//WORLD_STATE_EP_CROWNGUARD_CONTEST_ALLIANCE = 2374,
//WORLD_STATE_EP_CROWNGUARD_CONTEST_HORDE = 2375,
//WORLD_STATE_EP_CROWNGUARD_PROGRESS_ALLIANCE = 2376,
//WORLD_STATE_EP_CROWNGUARD_PROGRESS_HORDE = 2377,
WORLD_STATE_EP_CROWNGUARD_ALLIANCE = 2378,
WORLD_STATE_EP_CROWNGUARD_HORDE = 2379,
WORLD_STATE_EP_CROWNGUARD_NEUTRAL = 2355
};
struct PlaguelandsTowerBuff
{
uint32 spellIdAlliance, spellIdHorde;
};
static const PlaguelandsTowerBuff plaguelandsTowerBuffs[MAX_EP_TOWERS] =
{
{SPELL_ECHOES_OF_LORDAERON_ALLIANCE_1, SPELL_ECHOES_OF_LORDAERON_HORDE_1},
{SPELL_ECHOES_OF_LORDAERON_ALLIANCE_2, SPELL_ECHOES_OF_LORDAERON_HORDE_2},
{SPELL_ECHOES_OF_LORDAERON_ALLIANCE_3, SPELL_ECHOES_OF_LORDAERON_HORDE_3},
{SPELL_ECHOES_OF_LORDAERON_ALLIANCE_4, SPELL_ECHOES_OF_LORDAERON_HORDE_4}
};
// capture points coordinates to sort the banners
static const float plaguelandsTowerLocations[MAX_EP_TOWERS][2] =
{
{3181.08f, -4379.36f}, // Northpass
{1860.85f, -3731.23f}, // Crownguard
{2574.51f, -4794.89f}, // Eastwall
{2962.71f, -3042.31f} // Plaguewood
};
struct PlaguelandsTowerEvent
{
uint32 eventEntry;
Team team;
uint32 defenseMessage;
uint32 worldState;
};
static const PlaguelandsTowerEvent plaguelandsTowerEvents[MAX_EP_TOWERS][4] =
{
{
{EVENT_NORTHPASS_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_EP_CAPTURE_NPT_A, WORLD_STATE_EP_NORTHPASS_ALLIANCE},
{EVENT_NORTHPASS_PROGRESS_HORDE, HORDE, LANG_OPVP_EP_CAPTURE_NPT_H, WORLD_STATE_EP_NORTHPASS_HORDE},
{EVENT_NORTHPASS_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_EP_NORTHPASS_NEUTRAL},
{EVENT_NORTHPASS_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_EP_NORTHPASS_NEUTRAL},
},
{
{EVENT_CROWNGUARD_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_EP_CAPTURE_CGT_A, WORLD_STATE_EP_CROWNGUARD_ALLIANCE},
{EVENT_CROWNGUARD_PROGRESS_HORDE, HORDE, LANG_OPVP_EP_CAPTURE_CGT_H, WORLD_STATE_EP_CROWNGUARD_HORDE},
{EVENT_CROWNGUARD_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_EP_CROWNGUARD_NEUTRAL},
{EVENT_CROWNGUARD_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_EP_CROWNGUARD_NEUTRAL},
},
{
{EVENT_EASTWALL_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_EP_CAPTURE_EWT_A, WORLD_STATE_EP_EASTWALL_ALLIANCE},
{EVENT_EASTWALL_PROGRESS_HORDE, HORDE, LANG_OPVP_EP_CAPTURE_EWT_H, WORLD_STATE_EP_EASTWALL_HORDE},
{EVENT_EASTWALL_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_EP_EASTWALL_NEUTRAL},
{EVENT_EASTWALL_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_EP_EASTWALL_NEUTRAL},
},
{
{EVENT_PLAGUEWOOD_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_EP_CAPTURE_PWT_A, WORLD_STATE_EP_PLAGUEWOOD_ALLIANCE},
{EVENT_PLAGUEWOOD_PROGRESS_HORDE, HORDE, LANG_OPVP_EP_CAPTURE_PWT_H, WORLD_STATE_EP_PLAGUEWOOD_HORDE},
{EVENT_PLAGUEWOOD_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_EP_PLAGUEWOOD_NEUTRAL},
{EVENT_PLAGUEWOOD_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_EP_PLAGUEWOOD_NEUTRAL},
},
};
static const uint32 plaguelandsBanners[MAX_EP_TOWERS] = {GO_TOWER_BANNER_NORTHPASS, GO_TOWER_BANNER_CROWNGUARD, GO_TOWER_BANNER_EASTWALL, GO_TOWER_BANNER_PLAGUEWOOD};
class OutdoorPvPEP : public OutdoorPvP
{
public:
OutdoorPvPEP();
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
void SendRemoveWorldStates(Player* player) override;
bool HandleEvent(uint32 eventId, GameObject* go) override;
void HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team) override;
void HandleCreatureCreate(Creature* creature) override;
void HandleGameObjectCreate(GameObject* go) override;
bool HandleGameObjectUse(Player* player, GameObject* go) override;
private:
// process capture events
bool ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState);
void InitBanner(GameObject* go, uint32 towerId);
// Plaguewood bonus - flight master
void UnsummonFlightMaster(const WorldObject* objRef);
// Eastwall bonus - soldiers
void UnsummonSoldiers(const WorldObject* objRef);
Team m_towerOwner[MAX_EP_TOWERS];
uint32 m_towerWorldState[MAX_EP_TOWERS];
uint8 m_towersAlliance;
uint8 m_towersHorde;
ObjectGuid m_flightMaster;
ObjectGuid m_lordaeronShrineAlliance;
ObjectGuid m_lordaeronShrineHorde;
GuidList m_soldiers;
GuidList m_towerBanners[MAX_EP_TOWERS];
};
#endif
#endif

View file

@ -15,139 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPGH.h"
#include "../Map.h"
#include "../Object.h"
#include "../Creature.h"
#include "../GameObject.h"
OutdoorPvPGH::OutdoorPvPGH() : OutdoorPvP(),
m_zoneOwner(TEAM_NONE)
{
}
void OutdoorPvPGH::HandleCreatureCreate(Creature* creature)
{
// only handle summoned creatures
if (!creature->IsTemporarySummon())
return;
switch (creature->GetEntry())
{
case NPC_HORSE:
case NPC_BLACKSMITH_JASON_RIGGINS:
case NPC_STABLE_MASTER_TIM:
case NPC_VENDOR_ADAMS:
case NPC_BLACKSMITH_KOLOTH:
case NPC_STABLE_MASTER_KOR:
case NPC_VENDOR_PURKOM:
case NPC_RIDING_WOLF:
m_teamVendors.push_back(creature->GetObjectGuid());
break;
}
}
void OutdoorPvPGH::HandleCreatureDeath(Creature* creature)
{
switch (creature->GetEntry())
{
// Note: even if some soldiers or vendors are killed, they don't respawn on timer.
// The only way to respawn them is to capture the zone from the other faction.
case NPC_COMMANDER_HOWSER:
case NPC_GENERAL_GORLOK:
UnlockLighthouse(creature);
break;
}
}
void OutdoorPvPGH::HandleGameObjectCreate(GameObject* go)
{
if (go->GetEntry() == GO_VENTURE_BAY_LIGHTHOUSE)
{
m_capturePoint = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_zoneOwner));
}
}
// process the capture events
bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go)
{
// If we are not using the lighthouse return
if (go->GetEntry() != GO_VENTURE_BAY_LIGHTHOUSE)
return false;
bool eventHandled = true;
switch (eventId)
{
case EVENT_LIGHTHOUSE_WIN_ALLIANCE:
// Ignore the event if the zone is already in alliance control
if (m_zoneOwner == ALLIANCE)
return true;
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
m_zoneOwner = ALLIANCE;
LockLighthouse(go);
DespawnVendors(go);
eventHandled = false;
break;
case EVENT_LIGHTHOUSE_WIN_HORDE:
// Ignore the event if the zone is already in horde control
if (m_zoneOwner == HORDE)
return true;
// Spawn the npcs only when the tower is fully controlled. Also allow the event to handle summons in DB.
m_zoneOwner = HORDE;
LockLighthouse(go);
DespawnVendors(go);
eventHandled = false;
break;
case EVENT_LIGHTHOUSE_PROGRESS_ALLIANCE:
SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE);
break;
case EVENT_LIGHTHOUSE_PROGRESS_HORDE:
SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
break;
case EVENT_LIGHTHOUSE_NEUTRAL_ALLIANCE:
case EVENT_LIGHTHOUSE_NEUTRAL_HORDE:
m_zoneOwner = TEAM_NONE;
SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
break;
}
// there are some events which required further DB script
return eventHandled;
}
// Despawn the vendors when the lighthouse is won by the opposite faction
void OutdoorPvPGH::DespawnVendors(const WorldObject* objRef)
{
// despawn all team vendors
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
{
if (Creature* vendor = objRef->GetMap()->GetCreature(*itr))
vendor->ForcedDespawn();
}
m_teamVendors.clear();
}
// Handle Lighthouse lock when all the soldiers and the commander are spawned
void OutdoorPvPGH::LockLighthouse(const WorldObject* objRef)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
go->SetLootState(GO_JUST_DEACTIVATED);
sOutdoorPvPMgr.SetCapturePointSlider(m_capturePoint, m_zoneOwner == ALLIANCE ? CAPTURE_SLIDER_ALLIANCE_LOCKED : CAPTURE_SLIDER_HORDE_LOCKED);
}
// Handle Lighthouse unlock when the commander is killed
void OutdoorPvPGH::UnlockLighthouse(const WorldObject* objRef)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
go->SetCapturePointSlider(m_zoneOwner == ALLIANCE ? CAPTURE_SLIDER_ALLIANCE : CAPTURE_SLIDER_HORDE);
// no banner visual update needed because it already has the correct one
else
// if grid is unloaded, resetting the slider value is enough
sOutdoorPvPMgr.SetCapturePointSlider(m_capturePoint, m_zoneOwner == ALLIANCE ? CAPTURE_SLIDER_ALLIANCE : CAPTURE_SLIDER_HORDE);
}

View file

@ -19,65 +19,4 @@
#ifndef WORLD_PVP_GH
#define WORLD_PVP_GH
#include "Common.h"
#include "OutdoorPvP.h"
enum
{
// npcs
// alliance
NPC_WESTFALL_BRIGADE_DEFENDER = 27758,
NPC_COMMANDER_HOWSER = 27759,
NPC_BLACKSMITH_JASON_RIGGINS = 29252,
NPC_VENDOR_ADAMS = 27760,
NPC_STABLE_MASTER_TIM = 29250,
NPC_HORSE = 385,
// horde
NPC_CONQUEST_HOLD_DEFENDER = 27748,
NPC_GENERAL_GORLOK = 27708,
NPC_BLACKSMITH_KOLOTH = 29253,
NPC_VENDOR_PURKOM = 27730,
NPC_STABLE_MASTER_KOR = 29251,
NPC_RIDING_WOLF = 5774,
// gameobjects
GO_VENTURE_BAY_LIGHTHOUSE = 189310,
// events
EVENT_LIGHTHOUSE_WIN_ALLIANCE = 18035,
EVENT_LIGHTHOUSE_WIN_HORDE = 18036,
//EVENT_LIGHTHOUSE_CONTEST_ALLIANCE = 18037,
//EVENT_LIGHTHOUSE_CONTEST_HORDE = 18038,
EVENT_LIGHTHOUSE_PROGRESS_ALLIANCE = 18039,
EVENT_LIGHTHOUSE_PROGRESS_HORDE = 18040,
EVENT_LIGHTHOUSE_NEUTRAL_ALLIANCE = 18041,
EVENT_LIGHTHOUSE_NEUTRAL_HORDE = 18042,
};
class OutdoorPvPGH : public OutdoorPvP
{
public:
OutdoorPvPGH();
bool HandleEvent(uint32 eventId, GameObject* go) override;
void HandleCreatureCreate(Creature* creature) override;
void HandleCreatureDeath(Creature* creature) override;
void HandleGameObjectCreate(GameObject* go) override;
private:
// despawn team vendors, if not killed already
void DespawnVendors(const WorldObject* objRef);
void LockLighthouse(const WorldObject* objRef);
void UnlockLighthouse(const WorldObject* objRef);
Team m_zoneOwner;
GuidList m_teamVendors;
ObjectGuid m_capturePoint;
};
#endif

View file

@ -15,243 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPHP.h"
#include "WorldPacket.h"
#include "../World.h"
#include "../Object.h"
#include "../Creature.h"
#include "../GameObject.h"
#include "../Player.h"
OutdoorPvPHP::OutdoorPvPHP() : OutdoorPvP(),
m_towersAlliance(0),
m_towersHorde(0)
{
m_towerWorldState[0] = WORLD_STATE_HP_OVERLOOK_NEUTRAL;
m_towerWorldState[1] = WORLD_STATE_HP_STADIUM_NEUTRAL;
m_towerWorldState[2] = WORLD_STATE_HP_BROKEN_HILL_NEUTRAL;
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
m_towerOwner[i] = TEAM_NONE;
}
void OutdoorPvPHP::FillInitialWorldStates(WorldPacket& data, uint32& count)
{
FillInitialWorldState(data, count, WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
FillInitialWorldState(data, count, WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde);
FillInitialWorldState(data, count, WORLD_STATE_HP_TOWER_DISPLAY_A, WORLD_STATE_ADD);
FillInitialWorldState(data, count, WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_ADD);
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
}
void OutdoorPvPHP::SendRemoveWorldStates(Player* player)
{
player->SendUpdateWorldState(WORLD_STATE_HP_TOWER_DISPLAY_A, WORLD_STATE_REMOVE);
player->SendUpdateWorldState(WORLD_STATE_HP_TOWER_DISPLAY_H, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
}
void OutdoorPvPHP::HandlePlayerEnterZone(Player* player, bool isMainZone)
{
OutdoorPvP::HandlePlayerEnterZone(player, isMainZone);
// remove the buff from the player first; Sometimes on relog players still have the aura
player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? SPELL_HELLFIRE_SUPERIORITY_ALLIANCE : SPELL_HELLFIRE_SUPERIORITY_HORDE);
// buff the player if same team is controlling all capture points
if (m_towersAlliance == MAX_HP_TOWERS && player->GetTeam() == ALLIANCE)
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
else if (m_towersHorde == MAX_HP_TOWERS && player->GetTeam() == HORDE)
player->CastSpell(player, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
}
void OutdoorPvPHP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the buff from the player
player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? SPELL_HELLFIRE_SUPERIORITY_ALLIANCE : SPELL_HELLFIRE_SUPERIORITY_HORDE);
OutdoorPvP::HandlePlayerLeaveZone(player, isMainZone);
}
void OutdoorPvPHP::HandleGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_TOWER_BANNER_OVERLOOK:
m_banners[0] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[0], GO_ARTKIT_OVERLOOK_ALLIANCE, GO_ARTKIT_OVERLOOK_HORDE, GO_ARTKIT_OVERLOOK_NEUTRAL));
break;
case GO_TOWER_BANNER_STADIUM:
m_banners[1] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[1], GO_ARTKIT_STADIUM_ALLIANCE, GO_ARTKIT_STADIUM_HORDE, GO_ARTKIT_STADIUM_NEUTRAL));
break;
case GO_TOWER_BANNER_BROKEN_HILL:
m_banners[2] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[2], GO_ARTKIT_BROKEN_HILL_ALLIANCE, GO_ARTKIT_BROKEN_HILL_HORDE, GO_ARTKIT_BROKEN_HILL_NEUTRAL));
break;
case GO_HELLFIRE_BANNER_OVERLOOK:
m_towers[0] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[0]));
break;
case GO_HELLFIRE_BANNER_STADIUM:
m_towers[1] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[1]));
break;
case GO_HELLFIRE_BANNER_BROKEN_HILL:
m_towers[2] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[2]));
break;
}
}
void OutdoorPvPHP::HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team)
{
uint32 credit = 0;
switch (eventId)
{
case EVENT_OVERLOOK_PROGRESS_ALLIANCE:
case EVENT_OVERLOOK_PROGRESS_HORDE:
credit = NPC_CAPTURE_CREDIT_OVERLOOK;
break;
case EVENT_STADIUM_PROGRESS_ALLIANCE:
case EVENT_STADIUM_PROGRESS_HORDE:
credit = NPC_CAPTURE_CREDIT_STADIUM;
break;
case EVENT_BROKEN_HILL_PROGRESS_ALLIANCE:
case EVENT_BROKEN_HILL_PROGRESS_HORDE:
credit = NPC_CAPTURE_CREDIT_BROKEN_HILL;
break;
default:
return;
}
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
{
if ((*itr) && (*itr)->GetTeam() == team)
{
(*itr)->KilledMonsterCredit(credit);
(*itr)->RewardHonor(NULL, 1, HONOR_REWARD_HELLFIRE);
}
}
}
// Cast player spell on opponent kill
void OutdoorPvPHP::HandlePlayerKillInsideArea(Player* player, Unit* /*victim*/)
{
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
if (GameObject* capturePoint = player->GetMap()->GetGameObject(m_towers[i]))
{
// check capture point range
GameObjectInfo const* info = capturePoint->GetGOInfo();
if (info && player->IsWithinDistInMap(capturePoint, info->capturePoint.radius))
{
// check capture point team
if (player->GetTeam() == m_towerOwner[i])
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_HELLFIRE_TOWER_TOKEN_ALLIANCE : SPELL_HELLFIRE_TOWER_TOKEN_HORDE, true);
return;
}
}
}
}
// process the capture events
bool OutdoorPvPHP::HandleEvent(uint32 eventId, GameObject* go)
{
for (uint8 i = 0; i < MAX_HP_TOWERS; ++i)
{
if (hellfireBanners[i] == go->GetEntry())
{
for (uint8 j = 0; j < 4; ++j)
{
if (hellfireTowerEvents[i][j].eventEntry == eventId)
{
// prevent processing if the owner did not change (happens if progress event is called after contest event)
if (hellfireTowerEvents[i][j].team != m_towerOwner[i])
{
if (hellfireTowerEvents[i][j].defenseMessage)
sWorld.SendDefenseMessage(ZONE_ID_HELLFIRE_PENINSULA, hellfireTowerEvents[i][j].defenseMessage);
return ProcessCaptureEvent(go, i, hellfireTowerEvents[i][j].team, hellfireTowerEvents[i][j].worldState, hellfireTowerEvents[i][j].towerArtKit, hellfireTowerEvents[i][j].towerAnim);
}
// no need to iterate other events or towers
return false;
}
}
// no need to iterate other towers
return false;
}
}
return false;
}
bool OutdoorPvPHP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState, uint32 towerArtKit, uint32 towerAnim)
{
// set artkits and process buffs
if (team == ALLIANCE)
{
SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE);
// update counter state
++m_towersAlliance;
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
if (m_towersAlliance == MAX_HP_TOWERS)
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE);
}
else if (team == HORDE)
{
SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
// update counter
++m_towersHorde;
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde);
if (m_towersHorde == MAX_HP_TOWERS)
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE);
}
else
{
SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
if (m_towerOwner[towerId] == ALLIANCE)
{
if (m_towersAlliance == MAX_HP_TOWERS)
BuffTeam(ALLIANCE, SPELL_HELLFIRE_SUPERIORITY_ALLIANCE, true);
// update counter
--m_towersAlliance;
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
}
else
{
if (m_towersHorde == MAX_HP_TOWERS)
BuffTeam(HORDE, SPELL_HELLFIRE_SUPERIORITY_HORDE, true);
// update counter
--m_towersHorde;
SendUpdateWorldState(WORLD_STATE_HP_TOWER_COUNT_HORDE, m_towersHorde);
}
}
SetBannerVisual(go, m_banners[towerId], towerArtKit, towerAnim);
// update tower state
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_REMOVE);
m_towerWorldState[towerId] = newWorldState;
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_ADD);
// update capture point owner
m_towerOwner[towerId] = team;
// the are no DB exceptions in this case
return true;
}

View file

@ -19,159 +19,4 @@
#ifndef WORLD_PVP_HP
#define WORLD_PVP_HP
#include "Common.h"
#include "OutdoorPvP.h"
#include "../Language.h"
enum
{
MAX_HP_TOWERS = 3,
// spells
SPELL_HELLFIRE_TOWER_TOKEN_ALLIANCE = 32155,
SPELL_HELLFIRE_TOWER_TOKEN_HORDE = 32158,
SPELL_HELLFIRE_SUPERIORITY_ALLIANCE = 32071,
SPELL_HELLFIRE_SUPERIORITY_HORDE = 32049,
// npcs
NPC_CAPTURE_CREDIT_OVERLOOK = 19028,
NPC_CAPTURE_CREDIT_STADIUM = 19029,
NPC_CAPTURE_CREDIT_BROKEN_HILL = 19032,
// misc
HONOR_REWARD_HELLFIRE = 18,
// gameobjects
GO_TOWER_BANNER_OVERLOOK = 182525,
GO_TOWER_BANNER_STADIUM = 183515,
GO_TOWER_BANNER_BROKEN_HILL = 183514,
// capture points
GO_HELLFIRE_BANNER_OVERLOOK = 182174,
GO_HELLFIRE_BANNER_STADIUM = 182173,
GO_HELLFIRE_BANNER_BROKEN_HILL = 182175,
// events
//EVENT_OVERLOOK_WIN_ALLIANCE = 11398,
//EVENT_OVERLOOK_WIN_HORDE = 11397,
//EVENT_OVERLOOK_CONTEST_ALLIANCE = 11392,
//EVENT_OVERLOOK_CONTEST_HORDE = 11391,
EVENT_OVERLOOK_PROGRESS_ALLIANCE = 11396,
EVENT_OVERLOOK_PROGRESS_HORDE = 11395,
EVENT_OVERLOOK_NEUTRAL_ALLIANCE = 11394,
EVENT_OVERLOOK_NEUTRAL_HORDE = 11393,
//EVENT_STADIUM_WIN_ALLIANCE = 11390,
//EVENT_STADIUM_WIN_HORDE = 11389,
//EVENT_STADIUM_CONTEST_ALLIANCE = 11384,
//EVENT_STADIUM_CONTEST_HORDE = 11383,
EVENT_STADIUM_PROGRESS_ALLIANCE = 11388,
EVENT_STADIUM_PROGRESS_HORDE = 11387,
EVENT_STADIUM_NEUTRAL_ALLIANCE = 11386,
EVENT_STADIUM_NEUTRAL_HORDE = 11385,
//EVENT_BROKEN_HILL_WIN_ALLIANCE = 11406,
//EVENT_BROKEN_HILL_WIN_HORDE = 11405,
//EVENT_BROKEN_HILL_CONTEST_ALLIANCE = 11400,
//EVENT_BROKEN_HILL_CONTEST_HORDE = 11399,
EVENT_BROKEN_HILL_PROGRESS_ALLIANCE = 11404,
EVENT_BROKEN_HILL_PROGRESS_HORDE = 11403,
EVENT_BROKEN_HILL_NEUTRAL_ALLIANCE = 11402,
EVENT_BROKEN_HILL_NEUTRAL_HORDE = 11401,
// tower artkits
GO_ARTKIT_BROKEN_HILL_ALLIANCE = 65,
GO_ARTKIT_BROKEN_HILL_HORDE = 64,
GO_ARTKIT_BROKEN_HILL_NEUTRAL = 66,
GO_ARTKIT_OVERLOOK_ALLIANCE = 62,
GO_ARTKIT_OVERLOOK_HORDE = 61,
GO_ARTKIT_OVERLOOK_NEUTRAL = 63,
GO_ARTKIT_STADIUM_ALLIANCE = 67,
GO_ARTKIT_STADIUM_HORDE = 68,
GO_ARTKIT_STADIUM_NEUTRAL = 69,
// world states
WORLD_STATE_HP_TOWER_DISPLAY_A = 2490,
WORLD_STATE_HP_TOWER_DISPLAY_H = 2489,
WORLD_STATE_HP_TOWER_COUNT_ALLIANCE = 2476,
WORLD_STATE_HP_TOWER_COUNT_HORDE = 2478,
WORLD_STATE_HP_BROKEN_HILL_ALLIANCE = 2483,
WORLD_STATE_HP_BROKEN_HILL_HORDE = 2484,
WORLD_STATE_HP_BROKEN_HILL_NEUTRAL = 2485,
WORLD_STATE_HP_OVERLOOK_ALLIANCE = 2480,
WORLD_STATE_HP_OVERLOOK_HORDE = 2481,
WORLD_STATE_HP_OVERLOOK_NEUTRAL = 2482,
WORLD_STATE_HP_STADIUM_ALLIANCE = 2471,
WORLD_STATE_HP_STADIUM_HORDE = 2470,
WORLD_STATE_HP_STADIUM_NEUTRAL = 2472
};
struct HellfireTowerEvent
{
uint32 eventEntry;
Team team;
uint32 defenseMessage;
uint32 worldState;
uint32 towerArtKit;
uint32 towerAnim;
};
static const HellfireTowerEvent hellfireTowerEvents[MAX_HP_TOWERS][4] =
{
{
{EVENT_OVERLOOK_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_HP_CAPTURE_OVERLOOK_A, WORLD_STATE_HP_OVERLOOK_ALLIANCE, GO_ARTKIT_OVERLOOK_ALLIANCE, CAPTURE_ANIM_ALLIANCE},
{EVENT_OVERLOOK_PROGRESS_HORDE, HORDE, LANG_OPVP_HP_CAPTURE_OVERLOOK_H, WORLD_STATE_HP_OVERLOOK_HORDE, GO_ARTKIT_OVERLOOK_HORDE, CAPTURE_ANIM_HORDE},
{EVENT_OVERLOOK_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_HP_OVERLOOK_NEUTRAL, GO_ARTKIT_OVERLOOK_NEUTRAL, CAPTURE_ANIM_NEUTRAL},
{EVENT_OVERLOOK_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_HP_OVERLOOK_NEUTRAL, GO_ARTKIT_OVERLOOK_NEUTRAL, CAPTURE_ANIM_NEUTRAL},
},
{
{EVENT_STADIUM_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_HP_CAPTURE_STADIUM_A, WORLD_STATE_HP_STADIUM_ALLIANCE, GO_ARTKIT_STADIUM_ALLIANCE, CAPTURE_ANIM_ALLIANCE},
{EVENT_STADIUM_PROGRESS_HORDE, HORDE, LANG_OPVP_HP_CAPTURE_STADIUM_H, WORLD_STATE_HP_STADIUM_HORDE, GO_ARTKIT_STADIUM_HORDE, CAPTURE_ANIM_HORDE},
{EVENT_STADIUM_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_HP_STADIUM_NEUTRAL, GO_ARTKIT_STADIUM_NEUTRAL, CAPTURE_ANIM_NEUTRAL},
{EVENT_STADIUM_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_HP_STADIUM_NEUTRAL, GO_ARTKIT_STADIUM_NEUTRAL, CAPTURE_ANIM_NEUTRAL},
},
{
{EVENT_BROKEN_HILL_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_HP_CAPTURE_BROKENHILL_A, WORLD_STATE_HP_BROKEN_HILL_ALLIANCE, GO_ARTKIT_BROKEN_HILL_ALLIANCE, CAPTURE_ANIM_ALLIANCE},
{EVENT_BROKEN_HILL_PROGRESS_HORDE, HORDE, LANG_OPVP_HP_CAPTURE_BROKENHILL_H, WORLD_STATE_HP_BROKEN_HILL_HORDE, GO_ARTKIT_BROKEN_HILL_HORDE, CAPTURE_ANIM_HORDE},
{EVENT_BROKEN_HILL_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_HP_BROKEN_HILL_NEUTRAL, GO_ARTKIT_BROKEN_HILL_NEUTRAL, CAPTURE_ANIM_NEUTRAL},
{EVENT_BROKEN_HILL_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_HP_BROKEN_HILL_NEUTRAL, GO_ARTKIT_BROKEN_HILL_NEUTRAL, CAPTURE_ANIM_NEUTRAL},
},
};
static const uint32 hellfireBanners[MAX_HP_TOWERS] = {GO_HELLFIRE_BANNER_OVERLOOK, GO_HELLFIRE_BANNER_STADIUM, GO_HELLFIRE_BANNER_BROKEN_HILL};
class OutdoorPvPHP : public OutdoorPvP
{
public:
OutdoorPvPHP();
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
void SendRemoveWorldStates(Player* player) override;
bool HandleEvent(uint32 eventId, GameObject* go) override;
void HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team) override;
void HandleGameObjectCreate(GameObject* go) override;
void HandlePlayerKillInsideArea(Player* player, Unit* victim) override;
private:
// process capture events
bool ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState, uint32 towerArtKit, uint32 towerAnim);
Team m_towerOwner[MAX_HP_TOWERS];
uint32 m_towerWorldState[MAX_HP_TOWERS];
uint8 m_towersAlliance;
uint8 m_towersHorde;
ObjectGuid m_towers[MAX_HP_TOWERS];
ObjectGuid m_banners[MAX_HP_TOWERS];
};
#endif

View file

@ -15,160 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPMgr.h"
#include "Policies/SingletonImp.h"
#include "OutdoorPvP.h"
#include "../GameObject.h"
#include "../World.h"
#include "Log.h"
#include "OutdoorPvPEP.h"
#include "OutdoorPvPGH.h"
#include "OutdoorPvPHP.h"
#include "OutdoorPvPNA.h"
#include "OutdoorPvPSI.h"
#include "OutdoorPvPTF.h"
#include "OutdoorPvPZM.h"
INSTANTIATE_SINGLETON_1(OutdoorPvPMgr);
OutdoorPvPMgr::OutdoorPvPMgr()
{
m_updateTimer.SetInterval(TIMER_OPVP_MGR_UPDATE);
memset(&m_scripts, 0, sizeof(m_scripts));
}
OutdoorPvPMgr::~OutdoorPvPMgr()
{
for (uint8 i = 0; i < MAX_OPVP_ID; ++i)
delete m_scripts[i];
}
/**
Function which loads all outdoor pvp scripts
*/
void OutdoorPvPMgr::InitOutdoorPvP()
{
m_scripts[OPVP_ID_SI] = new OutdoorPvPSI();
m_scripts[OPVP_ID_EP] = new OutdoorPvPEP();
m_scripts[OPVP_ID_HP] = new OutdoorPvPHP();
m_scripts[OPVP_ID_ZM] = new OutdoorPvPZM();
m_scripts[OPVP_ID_TF] = new OutdoorPvPTF();
m_scripts[OPVP_ID_NA] = new OutdoorPvPNA();
m_scripts[OPVP_ID_GH] = new OutdoorPvPGH();
sLog.outString();
sLog.outString(">> Loaded %u Outdoor PvP zones", MAX_OPVP_ID);
}
OutdoorPvP* OutdoorPvPMgr::GetScript(uint32 zoneId)
{
switch (zoneId)
{
case ZONE_ID_SILITHUS:
return m_scripts[OPVP_ID_SI];
case ZONE_ID_EASTERN_PLAGUELANDS:
return m_scripts[OPVP_ID_EP];
case ZONE_ID_HELLFIRE_PENINSULA:
return m_scripts[OPVP_ID_HP];
case ZONE_ID_ZANGARMARSH:
return m_scripts[OPVP_ID_ZM];
case ZONE_ID_TEROKKAR_FOREST:
return m_scripts[OPVP_ID_TF];
case ZONE_ID_NAGRAND:
return m_scripts[OPVP_ID_NA];
case ZONE_ID_GRIZZLY_HILLS:
return m_scripts[OPVP_ID_GH];
default:
return NULL;
}
}
OutdoorPvP* OutdoorPvPMgr::GetScriptOfAffectedZone(uint32 zoneId)
{
switch (zoneId)
{
case ZONE_ID_TEMPLE_OF_AQ:
case ZONE_ID_RUINS_OF_AQ:
case ZONE_ID_GATES_OF_AQ:
return m_scripts[OPVP_ID_SI];
case ZONE_ID_STRATHOLME:
case ZONE_ID_SCHOLOMANCE:
return m_scripts[OPVP_ID_EP];
case ZONE_ID_HELLFIRE_RAMPARTS:
case ZONE_ID_HELLFIRE_CITADEL:
case ZONE_ID_BLOOD_FURNACE:
case ZONE_ID_SHATTERED_HALLS:
case ZONE_ID_MAGTHERIDON_LAIR:
return m_scripts[OPVP_ID_HP];
case ZONE_ID_SERPENTSHRINE_CAVERN:
case ZONE_ID_STREAMVAULT:
case ZONE_ID_UNDERBOG:
case ZONE_ID_SLAVE_PENS:
return m_scripts[OPVP_ID_ZM];
case ZONE_ID_SHADOW_LABYRINTH:
case ZONE_ID_AUCHENAI_CRYPTS:
case ZONE_ID_SETHEKK_HALLS:
case ZONE_ID_MANA_TOMBS:
return m_scripts[OPVP_ID_TF];
default:
return NULL;
}
}
/**
Function that handles the players which enters a specific zone
@param player to be handled in the event
@param zone id used for the current outdoor pvp script
*/
void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneId)
{
if (OutdoorPvP* script = GetScript(zoneId))
script->HandlePlayerEnterZone(player, true);
else if (OutdoorPvP* script = GetScriptOfAffectedZone(zoneId))
script->HandlePlayerEnterZone(player, false);
}
/**
Function that handles the player who leaves a specific zone
@param player to be handled in the event
@param zone id used for the current outdoor pvp script
*/
void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneId)
{
// teleport: called once from Player::CleanupsBeforeDelete, once from Player::UpdateZone
if (OutdoorPvP* script = GetScript(zoneId))
script->HandlePlayerLeaveZone(player, true);
else if (OutdoorPvP* script = GetScriptOfAffectedZone(zoneId))
script->HandlePlayerLeaveZone(player, false);
}
void OutdoorPvPMgr::Update(uint32 diff)
{
m_updateTimer.Update(diff);
if (!m_updateTimer.Passed())
return;
for (uint8 i = 0; i < MAX_OPVP_ID; ++i)
(*m_scripts[i]).Update(m_updateTimer.GetCurrent());
m_updateTimer.Reset();
}
/**
Function that gets the capture point slider value
@param capture point entry
*/
int8 OutdoorPvPMgr::GetCapturePointSliderValue(uint32 entry)
{
std::map<uint32, int8>::iterator itr = m_capturePointSlider.find(entry);
if (itr != m_capturePointSlider.end())
return itr->second;
// return default value if we can't find any
return CAPTURE_SLIDER_NEUTRAL;
}

View file

@ -19,105 +19,4 @@
#ifndef WORLD_PVP_MGR_H
#define WORLD_PVP_MGR_H
#include "Common.h"
#include "Policies/Singleton.h"
#include "Timer.h"
enum
{
TIMER_OPVP_MGR_UPDATE = MINUTE * IN_MILLISECONDS // 1 minute is enough for us but this might change with wintergrasp support
};
enum OutdoorPvPTypes
{
OPVP_ID_SI = 0,
OPVP_ID_EP,
OPVP_ID_HP,
OPVP_ID_ZM,
OPVP_ID_TF,
OPVP_ID_NA,
OPVP_ID_GH,
MAX_OPVP_ID
};
enum OutdoorPvPZones
{
ZONE_ID_SILITHUS = 1377,
ZONE_ID_TEMPLE_OF_AQ = 3428,
ZONE_ID_RUINS_OF_AQ = 3429,
ZONE_ID_GATES_OF_AQ = 3478,
ZONE_ID_EASTERN_PLAGUELANDS = 139,
ZONE_ID_STRATHOLME = 2017,
ZONE_ID_SCHOLOMANCE = 2057,
ZONE_ID_HELLFIRE_PENINSULA = 3483,
ZONE_ID_HELLFIRE_RAMPARTS = 3562,
ZONE_ID_HELLFIRE_CITADEL = 3563,
ZONE_ID_BLOOD_FURNACE = 3713,
ZONE_ID_SHATTERED_HALLS = 3714,
ZONE_ID_MAGTHERIDON_LAIR = 3836,
ZONE_ID_ZANGARMARSH = 3521,
ZONE_ID_SERPENTSHRINE_CAVERN = 3607,
ZONE_ID_STREAMVAULT = 3715,
ZONE_ID_UNDERBOG = 3716,
ZONE_ID_SLAVE_PENS = 3717,
ZONE_ID_TEROKKAR_FOREST = 3519,
ZONE_ID_SHADOW_LABYRINTH = 3789,
ZONE_ID_AUCHENAI_CRYPTS = 3790,
ZONE_ID_SETHEKK_HALLS = 3791,
ZONE_ID_MANA_TOMBS = 3792,
ZONE_ID_NAGRAND = 3518,
ZONE_ID_GRIZZLY_HILLS = 394
};
class Player;
class GameObject;
class Creature;
class OutdoorPvP;
class OutdoorPvPMgr
{
public:
OutdoorPvPMgr();
~OutdoorPvPMgr();
// load all outdoor pvp scripts
void InitOutdoorPvP();
// called when a player enters an outdoor pvp area
void HandlePlayerEnterZone(Player* player, uint32 zoneId);
// called when player leaves an outdoor pvp area
void HandlePlayerLeaveZone(Player* player, uint32 zoneId);
// return assigned outdoor pvp script
OutdoorPvP* GetScript(uint32 zoneId);
void Update(uint32 diff);
// Handle capture point stuff
int8 GetCapturePointSliderValue(uint32 entry);
void SetCapturePointSlider(uint32 entry, int8 value) { m_capturePointSlider[entry] = value; }
private:
// return assigned outdoor pvp script
OutdoorPvP* GetScriptOfAffectedZone(uint32 zoneId);
// contains all outdoor pvp scripts
OutdoorPvP* m_scripts[MAX_OPVP_ID];
std::map<uint32 /*capture point entry*/, int8 /*slider value*/> m_capturePointSlider;
// update interval
ShortIntervalTimer m_updateTimer;
};
#define sOutdoorPvPMgr MaNGOS::Singleton<OutdoorPvPMgr>::Instance()
#endif

View file

@ -15,546 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPNA.h"
#include "WorldPacket.h"
#include "../World.h"
#include "../ObjectMgr.h"
#include "../Object.h"
#include "../Creature.h"
#include "../GameObject.h"
#include "../Player.h"
OutdoorPvPNA::OutdoorPvPNA() : OutdoorPvP(),
m_zoneOwner(TEAM_NONE),
m_soldiersRespawnTimer(0),
m_zoneWorldState(0),
m_zoneMapState(WORLD_STATE_NA_HALAA_NEUTRAL),
m_guardsLeft(0),
m_isUnderSiege(false)
{
// initially set graveyard owner to neither faction
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_HALAA, GRAVEYARD_ZONE_ID_HALAA, TEAM_INVALID);
}
void OutdoorPvPNA::FillInitialWorldStates(WorldPacket& data, uint32& count)
{
if (m_zoneOwner != TEAM_NONE)
{
FillInitialWorldState(data, count, m_zoneWorldState, WORLD_STATE_ADD);
// map states
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
FillInitialWorldState(data, count, m_roostWorldState[i], WORLD_STATE_ADD);
}
FillInitialWorldState(data, count, m_zoneMapState, WORLD_STATE_ADD);
FillInitialWorldState(data, count, WORLD_STATE_NA_GUARDS_MAX, MAX_NA_GUARDS);
FillInitialWorldState(data, count, WORLD_STATE_NA_GUARDS_LEFT, m_guardsLeft);
}
void OutdoorPvPNA::SendRemoveWorldStates(Player* player)
{
player->SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE);
player->SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
player->SendUpdateWorldState(m_roostWorldState[i], WORLD_STATE_REMOVE);
}
void OutdoorPvPNA::HandlePlayerEnterZone(Player* player, bool isMainZone)
{
OutdoorPvP::HandlePlayerEnterZone(player, isMainZone);
// remove the buff from the player first because there are some issues at relog
player->RemoveAurasDueToSpell(SPELL_STRENGTH_HALAANI);
// buff the player if same team is controlling the zone
if (player->GetTeam() == m_zoneOwner)
player->CastSpell(player, SPELL_STRENGTH_HALAANI, true);
}
void OutdoorPvPNA::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the buff from the player
player->RemoveAurasDueToSpell(SPELL_STRENGTH_HALAANI);
OutdoorPvP::HandlePlayerLeaveZone(player, isMainZone);
}
void OutdoorPvPNA::HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team)
{
if (eventId == EVENT_HALAA_BANNER_WIN_ALLIANCE || eventId == EVENT_HALAA_BANNER_WIN_HORDE)
{
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
{
if ((*itr) && (*itr)->GetTeam() == team)
(*itr)->KilledMonsterCredit(NPC_HALAA_COMBATANT);
}
}
}
// Cast player spell on opponent kill
void OutdoorPvPNA::HandlePlayerKillInsideArea(Player* player, Unit* /*victim*/)
{
if (GameObject* capturePoint = player->GetMap()->GetGameObject(m_capturePoint))
{
// check capture point range
GameObjectInfo const* info = capturePoint->GetGOInfo();
if (info && player->IsWithinDistInMap(capturePoint, info->capturePoint.radius))
{
// check capture point team
if (player->GetTeam() == m_zoneOwner)
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_NAGRAND_TOKEN_ALLIANCE : SPELL_NAGRAND_TOKEN_HORDE, true);
return;
}
}
}
void OutdoorPvPNA::HandleCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
case NPC_RESEARCHER_KARTOS:
case NPC_QUARTERMASTER_DAVIAN:
case NPC_MERCHANT_ALDRAAN:
case NPC_VENDOR_CENDRII:
case NPC_AMMUNITIONER_BANRO:
case NPC_RESEARCHER_AMERELDINE:
case NPC_QUARTERMASTER_NORELIQE:
case NPC_MERCHANT_COREIEL:
case NPC_VENDOR_EMBELAR:
case NPC_AMMUNITIONER_TASALDAN:
m_teamVendors.push_back(creature->GetObjectGuid());
break;
case NPC_HORDE_HALAANI_GUARD:
case NPC_ALLIANCE_HANAANI_GUARD:
// prevent updating guard counter on owner take over
if (m_guardsLeft == MAX_NA_GUARDS)
return;
if (m_guardsLeft == 0)
{
LockHalaa(creature);
// update world state
SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE);
m_zoneMapState = m_zoneOwner == ALLIANCE ? WORLD_STATE_NA_HALAA_ALLIANCE : WORLD_STATE_NA_HALAA_HORDE;
SendUpdateWorldState(m_zoneMapState, WORLD_STATE_ADD);
}
++m_guardsLeft;
SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_guardsLeft);
break;
}
}
void OutdoorPvPNA::HandleCreatureDeath(Creature* creature)
{
if (creature->GetEntry() != NPC_HORDE_HALAANI_GUARD && creature->GetEntry() != NPC_ALLIANCE_HANAANI_GUARD)
return;
// get the location of the dead guard for future respawn
float x, y, z, o;
creature->GetRespawnCoord(x, y, z, &o);
HalaaSoldiersSpawns location = {x, y, z, o};
m_deadSoldiers.push(location);
// set the respawn timer after the last guard died - 5 min for the first time, or 1 hour if the city is under siege
if (!m_soldiersRespawnTimer)
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
// decrease the counter
--m_guardsLeft;
SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_guardsLeft);
if (m_guardsLeft == 0)
{
// set the zone under siege and increase the respawn timer
m_isUnderSiege = true;
m_soldiersRespawnTimer = HOUR * IN_MILLISECONDS;
// make capturable
UnlockHalaa(creature);
// update world state
SendUpdateWorldState(m_zoneMapState, WORLD_STATE_REMOVE);
m_zoneMapState = m_zoneOwner == ALLIANCE ? WORLD_STATE_NA_HALAA_NEUTRAL_A : WORLD_STATE_NA_HALAA_NEUTRAL_H;
SendUpdateWorldState(m_zoneMapState, WORLD_STATE_ADD);
sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, LANG_OPVP_NA_DEFENSELESS);
}
}
void OutdoorPvPNA::HandleGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_HALAA_BANNER:
m_capturePoint = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_zoneOwner));
break;
case GO_WYVERN_ROOST_ALLIANCE_SOUTH:
m_roostsAlliance[0] = go->GetObjectGuid();
break;
case GO_WYVERN_ROOST_ALLIANCE_NORTH:
m_roostsAlliance[1] = go->GetObjectGuid();
break;
case GO_WYVERN_ROOST_ALLIANCE_EAST:
m_roostsAlliance[2] = go->GetObjectGuid();
break;
case GO_WYVERN_ROOST_ALLIANCE_WEST:
m_roostsAlliance[3] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_HORDE_SOUTH:
m_wagonsHorde[0] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_HORDE_NORTH:
m_wagonsHorde[1] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_HORDE_EAST:
m_wagonsHorde[2] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_HORDE_WEST:
m_wagonsHorde[3] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_ALLIANCE_SOUTH:
m_roostsBrokenAlliance[0] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_ALLIANCE_NORTH:
m_roostsBrokenAlliance[1] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_ALLIANCE_EAST:
m_roostsBrokenAlliance[2] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_ALLIANCE_WEST:
m_roostsBrokenAlliance[3] = go->GetObjectGuid();
break;
case GO_WYVERN_ROOST_HORDE_SOUTH:
m_roostsHorde[0] = go->GetObjectGuid();
break;
case GO_WYVERN_ROOST_HORDE_NORTH:
m_roostsHorde[1] = go->GetObjectGuid();
break;
case GO_WYVERN_ROOST_HORDE_EAST:
m_roostsHorde[2] = go->GetObjectGuid();
break;
case GO_WYVERN_ROOST_HORDE_WEST:
m_roostsHorde[3] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_ALLIANCE_SOUTH:
m_wagonsAlliance[0] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_ALLIANCE_NORTH:
m_wagonsAlliance[1] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_ALLIANCE_EAST:
m_wagonsAlliance[2] = go->GetObjectGuid();
break;
case GO_BOMB_WAGON_ALLIANCE_WEST:
m_wagonsAlliance[3] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_HORDE_SOUTH:
m_roostsBrokenHorde[0] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_HORDE_NORTH:
m_roostsBrokenHorde[1] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_HORDE_EAST:
m_roostsBrokenHorde[2] = go->GetObjectGuid();
break;
case GO_DESTROYED_ROOST_HORDE_WEST:
m_roostsBrokenHorde[3] = go->GetObjectGuid();
break;
}
}
void OutdoorPvPNA::UpdateWorldState(uint32 value)
{
SendUpdateWorldState(m_zoneWorldState, value);
SendUpdateWorldState(m_zoneMapState, value);
UpdateWyvernsWorldState(value);
}
void OutdoorPvPNA::UpdateWyvernsWorldState(uint32 value)
{
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
SendUpdateWorldState(m_roostWorldState[i], value);
}
// process the capture events
bool OutdoorPvPNA::HandleEvent(uint32 eventId, GameObject* go)
{
// If we are not using the Halaa banner return
if (go->GetEntry() != GO_HALAA_BANNER)
return false;
bool eventHandled = true;
switch (eventId)
{
case EVENT_HALAA_BANNER_WIN_ALLIANCE:
ProcessCaptureEvent(go, ALLIANCE);
eventHandled = false;
break;
case EVENT_HALAA_BANNER_WIN_HORDE:
ProcessCaptureEvent(go, HORDE);
eventHandled = false;
break;
case EVENT_HALAA_BANNER_PROGRESS_ALLIANCE:
SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE);
sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, LANG_OPVP_NA_PROGRESS_A);
break;
case EVENT_HALAA_BANNER_PROGRESS_HORDE:
SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, LANG_OPVP_NA_PROGRESS_H);
break;
}
// there are some events which required further DB script
return eventHandled;
}
void OutdoorPvPNA::ProcessCaptureEvent(GameObject* go, Team team)
{
BuffTeam(m_zoneOwner, SPELL_STRENGTH_HALAANI, true);
// update capture point owner
m_zoneOwner = team;
LockHalaa(go);
m_guardsLeft = MAX_NA_GUARDS;
m_isUnderSiege = false;
m_soldiersRespawnTimer = 0;
UpdateWorldState(WORLD_STATE_REMOVE);
DespawnVendors(go);
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_HALAA, GRAVEYARD_ZONE_ID_HALAA, m_zoneOwner);
if (m_zoneOwner == ALLIANCE)
{
m_zoneWorldState = WORLD_STATE_NA_GUARDS_ALLIANCE;
m_zoneMapState = WORLD_STATE_NA_HALAA_ALLIANCE;
}
else
{
m_zoneWorldState = WORLD_STATE_NA_GUARDS_HORDE;
m_zoneMapState = WORLD_STATE_NA_HALAA_HORDE;
}
HandleFactionObjects(go);
UpdateWorldState(WORLD_STATE_ADD);
SendUpdateWorldState(WORLD_STATE_NA_GUARDS_LEFT, m_guardsLeft);
BuffTeam(m_zoneOwner, SPELL_STRENGTH_HALAANI);
sWorld.SendDefenseMessage(ZONE_ID_NAGRAND, m_zoneOwner == ALLIANCE ? LANG_OPVP_NA_CAPTURE_A: LANG_OPVP_NA_CAPTURE_H);
}
// Handle the gameobjects spawn/despawn depending on the controller faction
void OutdoorPvPNA::HandleFactionObjects(const WorldObject* objRef)
{
if (m_zoneOwner == ALLIANCE)
{
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
RespawnGO(objRef, m_wagonsHorde[i], false);
RespawnGO(objRef, m_roostsBrokenAlliance[i], false);
RespawnGO(objRef, m_roostsAlliance[i], false);
RespawnGO(objRef, m_wagonsAlliance[i], false);
RespawnGO(objRef, m_roostsBrokenHorde[i], true);
m_roostWorldState[i] = nagrandRoostStatesHordeNeutral[i];
}
}
else
{
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
RespawnGO(objRef, m_wagonsAlliance[i], false);
RespawnGO(objRef, m_roostsBrokenHorde[i], false);
RespawnGO(objRef, m_roostsHorde[i], false);
RespawnGO(objRef, m_wagonsHorde[i], false);
RespawnGO(objRef, m_roostsBrokenAlliance[i], true);
m_roostWorldState[i] = nagrandRoostStatesAllianceNeutral[i];
}
}
}
// Handle vendors despawn when the city is captured by the other faction
void OutdoorPvPNA::DespawnVendors(const WorldObject* objRef)
{
// despawn all team vendors
for (GuidList::const_iterator itr = m_teamVendors.begin(); itr != m_teamVendors.end(); ++itr)
{
if (Creature* soldier = objRef->GetMap()->GetCreature(*itr))
soldier->ForcedDespawn();
}
m_teamVendors.clear();
}
bool OutdoorPvPNA::HandleGameObjectUse(Player* player, GameObject* go)
{
if (player->GetTeam() == ALLIANCE)
{
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
if (go->GetEntry() == nagrandWagonsAlliance[i])
{
// update roost states
UpdateWyvernsWorldState(WORLD_STATE_REMOVE);
m_roostWorldState[i] = nagrandRoostStatesHordeNeutral[i];
UpdateWyvernsWorldState(WORLD_STATE_ADD);
// spawn the broken roost and despawn the other one
RespawnGO(go, m_roostsHorde[i], false);
RespawnGO(go, m_roostsBrokenHorde[i], true);
// no need to iterate the other roosts
return false;
}
else if (go->GetEntry() == nagrandRoostsBrokenAlliance[i])
{
// update roost states
UpdateWyvernsWorldState(WORLD_STATE_REMOVE);
m_roostWorldState[i] = nagrandRoostStatesAlliance[i];
UpdateWyvernsWorldState(WORLD_STATE_ADD);
// spawn the repaired one along with the explosive wagon - the broken one despawns by self
RespawnGO(go, m_wagonsHorde[i], true);
RespawnGO(go, m_roostsAlliance[i], true);
// no need to iterate the other roosts
return false;
}
else if (go->GetEntry() == nagrandRoostsAlliance[i])
{
// mark player as pvp
player->UpdatePvP(true, true);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP);
// prevent despawning after go use
go->SetRespawnTime(0);
// no need to iterate the other roosts
return false;
}
}
}
else if (player->GetTeam() == HORDE)
{
for (uint8 i = 0; i < MAX_NA_ROOSTS; ++i)
{
if (go->GetEntry() == nagrandWagonsHorde[i])
{
// update roost states
UpdateWyvernsWorldState(WORLD_STATE_REMOVE);
m_roostWorldState[i] = nagrandRoostStatesAllianceNeutral[i];
UpdateWyvernsWorldState(WORLD_STATE_ADD);
// spawn the broken roost and despawn the other one
RespawnGO(go, m_roostsAlliance[i], false);
RespawnGO(go, m_roostsBrokenAlliance[i], true);
// no need to iterate the other roosts
return false;
}
else if (go->GetEntry() == nagrandRoostsBrokenHorde[i])
{
// update roost states
UpdateWyvernsWorldState(WORLD_STATE_REMOVE);
m_roostWorldState[i] = nagrandRoostStatesHorde[i];
UpdateWyvernsWorldState(WORLD_STATE_ADD);
// spawn the repaired one along with the explosive wagon - the broken one despawns by self
RespawnGO(go, m_wagonsAlliance[i], true);
RespawnGO(go, m_roostsHorde[i], true);
// no need to iterate the other roosts
return false;
}
else if (go->GetEntry() == nagrandRoostsHorde[i])
{
// mark player as pvp
player->UpdatePvP(true, true);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP);
// prevent despawning after go use
go->SetRespawnTime(0);
// no need to iterate the other roosts
return false;
}
}
}
return false;
}
void OutdoorPvPNA::Update(uint32 diff)
{
if (m_soldiersRespawnTimer)
{
if (m_soldiersRespawnTimer < diff)
{
RespawnSoldier();
// if all the guards are respawned, stop the timer, else resume the timer depending on the siege state
if (m_guardsLeft == MAX_NA_GUARDS)
m_soldiersRespawnTimer = 0;
else
m_soldiersRespawnTimer = m_isUnderSiege ? HOUR * IN_MILLISECONDS : 5 * MINUTE * IN_MILLISECONDS;
}
else
m_soldiersRespawnTimer -= diff;
}
}
// Handle soldiers respawn on timer - this will summon a replacement for the dead soldier
void OutdoorPvPNA::RespawnSoldier()
{
for (GuidZoneMap::iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
{
// Find player who is in main zone (Nagrand) to get correct map reference
if (!itr->second)
continue;
if (Player* player = sObjectMgr.GetPlayer(itr->first))
{
// summon a soldier replacement in the order they were set in the deque. delete the element after summon
player->SummonCreature(m_zoneOwner == ALLIANCE ? NPC_ALLIANCE_HANAANI_GUARD : NPC_HORDE_HALAANI_GUARD, m_deadSoldiers.front().x, m_deadSoldiers.front().y, m_deadSoldiers.front().z, m_deadSoldiers.front().o, TEMPSUMMON_DEAD_DESPAWN, 0, true);
m_deadSoldiers.pop();
break;
}
}
}
// Lock Halaa when captured
void OutdoorPvPNA::LockHalaa(const WorldObject* objRef)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
go->SetLootState(GO_JUST_DEACTIVATED);
sOutdoorPvPMgr.SetCapturePointSlider(m_capturePoint, m_zoneOwner == ALLIANCE ? CAPTURE_SLIDER_ALLIANCE_LOCKED : CAPTURE_SLIDER_HORDE_LOCKED);
}
// Unlock Halaa when all the soldiers are killed
void OutdoorPvPNA::UnlockHalaa(const WorldObject* objRef)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(m_capturePoint))
go->SetCapturePointSlider(m_zoneOwner == ALLIANCE ? CAPTURE_SLIDER_ALLIANCE : CAPTURE_SLIDER_HORDE);
// no banner visual update needed because it already has the correct one
else
// if grid is unloaded, resetting the slider value is enough
sOutdoorPvPMgr.SetCapturePointSlider(m_capturePoint, m_zoneOwner == ALLIANCE ? CAPTURE_SLIDER_ALLIANCE : CAPTURE_SLIDER_HORDE);
}

View file

@ -19,201 +19,4 @@
#ifndef WORLD_PVP_NA
#define WORLD_PVP_NA
#include "Common.h"
#include "OutdoorPvP.h"
#include "../Language.h"
enum
{
MAX_NA_GUARDS = 15,
MAX_NA_ROOSTS = 4, // roosts for each type and team
MAX_FIRE_BOMBS = 10,
// spells
SPELL_STRENGTH_HALAANI = 33795,
SPELL_NAGRAND_TOKEN_ALLIANCE = 33005,
SPELL_NAGRAND_TOKEN_HORDE = 33004,
// npcs
// quest credit
NPC_HALAA_COMBATANT = 24867,
GRAVEYARD_ID_HALAA = 993,
GRAVEYARD_ZONE_ID_HALAA = 3518,
ITEM_ID_FIRE_BOMB = 24538,
// gameobjects
GO_HALAA_BANNER = 182210,
// spawned when horde is in control - alliance is attacking
GO_WYVERN_ROOST_ALLIANCE_SOUTH = 182267,
GO_WYVERN_ROOST_ALLIANCE_WEST = 182280,
GO_WYVERN_ROOST_ALLIANCE_NORTH = 182281,
GO_WYVERN_ROOST_ALLIANCE_EAST = 182282,
GO_BOMB_WAGON_HORDE_SOUTH = 182222,
GO_BOMB_WAGON_HORDE_WEST = 182272,
GO_BOMB_WAGON_HORDE_NORTH = 182273,
GO_BOMB_WAGON_HORDE_EAST = 182274,
GO_DESTROYED_ROOST_ALLIANCE_SOUTH = 182266,
GO_DESTROYED_ROOST_ALLIANCE_WEST = 182275,
GO_DESTROYED_ROOST_ALLIANCE_NORTH = 182276,
GO_DESTROYED_ROOST_ALLIANCE_EAST = 182277,
// spawned when alliance is in control - horde is attacking
GO_WYVERN_ROOST_HORDE_SOUTH = 182301,
GO_WYVERN_ROOST_HORDE_WEST = 182302,
GO_WYVERN_ROOST_HORDE_NORTH = 182303,
GO_WYVERN_ROOST_HORDE_EAST = 182304,
GO_BOMB_WAGON_ALLIANCE_SOUTH = 182305,
GO_BOMB_WAGON_ALLIANCE_WEST = 182306,
GO_BOMB_WAGON_ALLIANCE_NORTH = 182307,
GO_BOMB_WAGON_ALLIANCE_EAST = 182308,
GO_DESTROYED_ROOST_HORDE_SOUTH = 182297,
GO_DESTROYED_ROOST_HORDE_WEST = 182298,
GO_DESTROYED_ROOST_HORDE_NORTH = 182299,
GO_DESTROYED_ROOST_HORDE_EAST = 182300,
// npcs
// alliance
NPC_RESEARCHER_KARTOS = 18817,
NPC_QUARTERMASTER_DAVIAN = 18822,
NPC_MERCHANT_ALDRAAN = 21485,
NPC_VENDOR_CENDRII = 21487,
NPC_AMMUNITIONER_BANRO = 21488,
NPC_ALLIANCE_HANAANI_GUARD = 18256,
// horde
NPC_RESEARCHER_AMERELDINE = 18816,
NPC_QUARTERMASTER_NORELIQE = 18821,
NPC_MERCHANT_COREIEL = 21474,
NPC_VENDOR_EMBELAR = 21484,
NPC_AMMUNITIONER_TASALDAN = 21483,
NPC_HORDE_HALAANI_GUARD = 18192,
// events
EVENT_HALAA_BANNER_WIN_ALLIANCE = 11504,
EVENT_HALAA_BANNER_WIN_HORDE = 11503,
EVENT_HALAA_BANNER_CONTEST_ALLIANCE = 11559,
EVENT_HALAA_BANNER_CONTEST_HORDE = 11558,
EVENT_HALAA_BANNER_PROGRESS_ALLIANCE = 11821,
EVENT_HALAA_BANNER_PROGRESS_HORDE = 11822,
// world states
WORLD_STATE_NA_GUARDS_HORDE = 2503,
WORLD_STATE_NA_GUARDS_ALLIANCE = 2502,
WORLD_STATE_NA_GUARDS_MAX = 2493,
WORLD_STATE_NA_GUARDS_LEFT = 2491,
// map states
WORLD_STATE_NA_WYVERN_NORTH_NEUTRAL_H = 2762,
WORLD_STATE_NA_WYVERN_NORTH_NEUTRAL_A = 2662,
WORLD_STATE_NA_WYVERN_NORTH_H = 2663,
WORLD_STATE_NA_WYVERN_NORTH_A = 2664,
WORLD_STATE_NA_WYVERN_SOUTH_NEUTRAL_H = 2760,
WORLD_STATE_NA_WYVERN_SOUTH_NEUTRAL_A = 2670,
WORLD_STATE_NA_WYVERN_SOUTH_H = 2668,
WORLD_STATE_NA_WYVERN_SOUTH_A = 2669,
WORLD_STATE_NA_WYVERN_WEST_NEUTRAL_H = 2761,
WORLD_STATE_NA_WYVERN_WEST_NEUTRAL_A = 2667,
WORLD_STATE_NA_WYVERN_WEST_H = 2665,
WORLD_STATE_NA_WYVERN_WEST_A = 2666,
WORLD_STATE_NA_WYVERN_EAST_NEUTRAL_H = 2763,
WORLD_STATE_NA_WYVERN_EAST_NEUTRAL_A = 2659,
WORLD_STATE_NA_WYVERN_EAST_H = 2660,
WORLD_STATE_NA_WYVERN_EAST_A = 2661,
WORLD_STATE_NA_HALAA_NEUTRAL = 2671,
WORLD_STATE_NA_HALAA_NEUTRAL_A = 2676,
WORLD_STATE_NA_HALAA_NEUTRAL_H = 2677,
WORLD_STATE_NA_HALAA_HORDE = 2672,
WORLD_STATE_NA_HALAA_ALLIANCE = 2673,
};
struct HalaaSoldiersSpawns
{
float x, y, z, o;
};
static const uint32 nagrandRoostsAlliance[MAX_NA_ROOSTS] = {GO_WYVERN_ROOST_ALLIANCE_SOUTH, GO_WYVERN_ROOST_ALLIANCE_NORTH, GO_WYVERN_ROOST_ALLIANCE_EAST, GO_WYVERN_ROOST_ALLIANCE_WEST};
static const uint32 nagrandRoostsHorde[MAX_NA_ROOSTS] = {GO_WYVERN_ROOST_HORDE_SOUTH, GO_WYVERN_ROOST_HORDE_NORTH, GO_WYVERN_ROOST_HORDE_EAST, GO_WYVERN_ROOST_HORDE_WEST};
static const uint32 nagrandRoostsBrokenAlliance[MAX_NA_ROOSTS] = {GO_DESTROYED_ROOST_ALLIANCE_SOUTH, GO_DESTROYED_ROOST_ALLIANCE_NORTH, GO_DESTROYED_ROOST_ALLIANCE_EAST, GO_DESTROYED_ROOST_ALLIANCE_WEST};
static const uint32 nagrandRoostsBrokenHorde[MAX_NA_ROOSTS] = {GO_DESTROYED_ROOST_HORDE_SOUTH, GO_DESTROYED_ROOST_HORDE_NORTH, GO_DESTROYED_ROOST_HORDE_EAST, GO_DESTROYED_ROOST_HORDE_WEST};
static const uint32 nagrandWagonsAlliance[MAX_NA_ROOSTS] = {GO_BOMB_WAGON_ALLIANCE_SOUTH, GO_BOMB_WAGON_ALLIANCE_NORTH, GO_BOMB_WAGON_ALLIANCE_EAST, GO_BOMB_WAGON_ALLIANCE_WEST};
static const uint32 nagrandWagonsHorde[MAX_NA_ROOSTS] = {GO_BOMB_WAGON_HORDE_SOUTH, GO_BOMB_WAGON_HORDE_NORTH, GO_BOMB_WAGON_HORDE_EAST, GO_BOMB_WAGON_HORDE_WEST};
static const uint32 nagrandRoostStatesAlliance[MAX_NA_ROOSTS] = {WORLD_STATE_NA_WYVERN_SOUTH_A, WORLD_STATE_NA_WYVERN_NORTH_A, WORLD_STATE_NA_WYVERN_EAST_A, WORLD_STATE_NA_WYVERN_WEST_A};
static const uint32 nagrandRoostStatesHorde[MAX_NA_ROOSTS] = {WORLD_STATE_NA_WYVERN_SOUTH_H, WORLD_STATE_NA_WYVERN_NORTH_H, WORLD_STATE_NA_WYVERN_EAST_H, WORLD_STATE_NA_WYVERN_WEST_H};
static const uint32 nagrandRoostStatesAllianceNeutral[MAX_NA_ROOSTS] = {WORLD_STATE_NA_WYVERN_SOUTH_NEUTRAL_A, WORLD_STATE_NA_WYVERN_NORTH_NEUTRAL_A, WORLD_STATE_NA_WYVERN_EAST_NEUTRAL_A, WORLD_STATE_NA_WYVERN_WEST_NEUTRAL_A};
static const uint32 nagrandRoostStatesHordeNeutral[MAX_NA_ROOSTS] = {WORLD_STATE_NA_WYVERN_SOUTH_NEUTRAL_H, WORLD_STATE_NA_WYVERN_NORTH_NEUTRAL_H, WORLD_STATE_NA_WYVERN_EAST_NEUTRAL_H, WORLD_STATE_NA_WYVERN_WEST_NEUTRAL_H};
class OutdoorPvPNA : public OutdoorPvP
{
public:
OutdoorPvPNA();
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
void SendRemoveWorldStates(Player* player) override;
bool HandleEvent(uint32 eventId, GameObject* go) override;
void HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team) override;
void HandleCreatureCreate(Creature* creature) override;
void HandleGameObjectCreate(GameObject* go) override;
void HandleCreatureDeath(Creature* creature) override;
void HandlePlayerKillInsideArea(Player* player, Unit* victim) override;
bool HandleGameObjectUse(Player* player, GameObject* go) override;
void Update(uint32 diff) override;
private:
// world states handling
void UpdateWorldState(uint32 value);
void UpdateWyvernsWorldState(uint32 value);
// process capture events
void ProcessCaptureEvent(GameObject* go, Team team);
// set specific team vendors and objects after capture
void DespawnVendors(const WorldObject* objRef);
void HandleFactionObjects(const WorldObject* objRef);
// handle a specific game objects
void LockHalaa(const WorldObject* objRef);
void UnlockHalaa(const WorldObject* objRef);
// handle soldier respawn on timer
void RespawnSoldier();
Team m_zoneOwner;
uint32 m_soldiersRespawnTimer;
uint32 m_zoneWorldState;
uint32 m_zoneMapState;
uint32 m_roostWorldState[MAX_NA_ROOSTS];
uint8 m_guardsLeft;
bool m_isUnderSiege;
ObjectGuid m_capturePoint;
ObjectGuid m_roostsAlliance[MAX_NA_ROOSTS];
ObjectGuid m_roostsHorde[MAX_NA_ROOSTS];
ObjectGuid m_roostsBrokenAlliance[MAX_NA_ROOSTS];
ObjectGuid m_roostsBrokenHorde[MAX_NA_ROOSTS];
ObjectGuid m_wagonsAlliance[MAX_NA_ROOSTS];
ObjectGuid m_wagonsHorde[MAX_NA_ROOSTS];
GuidList m_teamVendors;
std::queue<HalaaSoldiersSpawns> m_deadSoldiers;
};
#endif

View file

@ -15,189 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPSI.h"
#include "WorldPacket.h"
#include "../World.h"
#include "../ObjectMgr.h"
#include "../Object.h"
#include "../Creature.h"
#include "../GameObject.h"
#include "../Player.h"
OutdoorPvPSI::OutdoorPvPSI() : OutdoorPvP(),
m_resourcesAlliance(0),
m_resourcesHorde(0),
m_zoneOwner(TEAM_NONE)
{
}
// Send initial world states
void OutdoorPvPSI::FillInitialWorldStates(WorldPacket& data, uint32& count)
{
FillInitialWorldState(data, count, WORLD_STATE_SI_GATHERED_A, m_resourcesAlliance);
FillInitialWorldState(data, count, WORLD_STATE_SI_GATHERED_H, m_resourcesHorde);
FillInitialWorldState(data, count, WORLD_STATE_SI_SILITHYST_MAX, MAX_SILITHYST);
}
// Handle buffs when player enters the zone
void OutdoorPvPSI::HandlePlayerEnterZone(Player* player, bool isMainZone)
{
OutdoorPvP::HandlePlayerEnterZone(player, isMainZone);
// remove the buff from the player first; Sometimes on relog players still have the aura
player->RemoveAurasDueToSpell(SPELL_CENARION_FAVOR);
// buff the player if same team is controlling the zone
if (player->GetTeam() == m_zoneOwner)
player->CastSpell(player, SPELL_CENARION_FAVOR, true);
}
// Remove buffs when player leaves zone
void OutdoorPvPSI::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the buff from the player
player->RemoveAurasDueToSpell(SPELL_CENARION_FAVOR);
OutdoorPvP::HandlePlayerLeaveZone(player, isMainZone);
}
// Handle case when player returns a silithyst
bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
{
if (player->isGameMaster() || player->isDead())
return false;
switch (triggerId)
{
case AREATRIGGER_SILITHUS_ALLIANCE:
if (player->GetTeam() != ALLIANCE || !player->HasAura(SPELL_SILITHYST))
return false;
// update counter
++ m_resourcesAlliance;
SendUpdateWorldState(WORLD_STATE_SI_GATHERED_A, m_resourcesAlliance);
// handle the case when the faction has reached maximum resources allowed
if (m_resourcesAlliance == MAX_SILITHYST)
{
// NOTE: On retail it would not reset until server restart but we do not support weekly restart :)
m_zoneOwner = ALLIANCE;
m_resourcesAlliance = 0;
m_resourcesHorde = 0;
// also update the horde counter if resources were reset
SendUpdateWorldState(WORLD_STATE_SI_GATHERED_H, m_resourcesHorde);
// apply buff to owner team
BuffTeam(ALLIANCE, SPELL_CENARION_FAVOR);
// Send defense message
sWorld.SendDefenseMessage(ZONE_ID_SILITHUS, LANG_OPVP_SI_CAPTURE_A);
}
// give quest credit if necessary
if (player->GetQuestStatus(QUEST_SCOURING_DESERT_ALLIANCE) == QUEST_STATUS_INCOMPLETE)
player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_ALLIANCE);
break;
case AREATRIGGER_SILITHUS_HORDE:
if (player->GetTeam() != HORDE || !player->HasAura(SPELL_SILITHYST))
return false;
// update counter
++ m_resourcesHorde;
SendUpdateWorldState(WORLD_STATE_SI_GATHERED_H, m_resourcesHorde);
// handle the case when the faction has reached maximum resources allowed
if (m_resourcesHorde == MAX_SILITHYST)
{
// NOTE: On retail it would not reset until server restart but we do not support weekly restart :)
m_zoneOwner = HORDE;
m_resourcesAlliance = 0;
m_resourcesHorde = 0;
// also update the alliance counter if resources were reset
SendUpdateWorldState(WORLD_STATE_SI_GATHERED_A, m_resourcesAlliance);
// apply buff to owner team
BuffTeam(HORDE, SPELL_CENARION_FAVOR);
// Send defense message
sWorld.SendDefenseMessage(ZONE_ID_SILITHUS, LANG_OPVP_SI_CAPTURE_H);
}
// give quest credit if necessary
if (player->GetQuestStatus(QUEST_SCOURING_DESERT_HORDE) == QUEST_STATUS_INCOMPLETE)
player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_HORDE);
break;
default:
return false;
}
// remove silithyst aura
player->RemoveAurasDueToSpell(SPELL_SILITHYST);
// reward the player
player->CastSpell(player, SPELL_TRACES_OF_SILITHYST, true);
player->RewardHonor(NULL, 1, HONOR_REWARD_SILITHYST);
player->GetReputationMgr().ModifyReputation(sFactionStore.LookupEntry(FACTION_CENARION_CIRCLE), REPUTATION_REWARD_SILITHYST);
return true;
}
// Handle case when player drops flag
// TODO - fix this workaround!
struct SilithusSpawnLocation
{
float x, y, z;
};
// Area trigger location - workaround to check the flag drop handling
static SilithusSpawnLocation silithusFlagDropLocations[2] =
{
{-7142.04f, 1397.92f, 4.327f}, // alliance
{-7588.48f, 756.806f, -16.425f} // horde
};
bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
{
if (spellId != SPELL_SILITHYST)
return false;
// don't drop flag at area trigger
// we are checking distance from the AT hard-coded coordinates because it's much faster than checking the area trigger store
switch (player->GetTeam())
{
case ALLIANCE:
if (player->IsWithinDist3d(silithusFlagDropLocations[0].x, silithusFlagDropLocations[0].y, silithusFlagDropLocations[0].z, 5.0f))
return false;
break;
case HORDE:
if (player->IsWithinDist3d(silithusFlagDropLocations[1].x, silithusFlagDropLocations[1].y, silithusFlagDropLocations[1].z, 5.0f))
return false;
break;
default:
break;
}
// drop the flag in other case
player->CastSpell(player, SPELL_SILITHYST_FLAG_DROP, true);
return true;
}
// Handle the case when player picks a silithyst mound or geyser
// This needs to be done because the spells used by these objects are missing
bool OutdoorPvPSI::HandleGameObjectUse(Player* player, GameObject* go)
{
if (go->GetEntry() == GO_SILITHYST_MOUND || go->GetEntry() == GO_SILITHYST_GEYSER)
{
// Also mark player with pvp on
player->CastSpell(player, SPELL_SILITHYST, true);
player->UpdatePvP(true, true);
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP);
// Despawn the gameobject (workaround)
go->SetLootState(GO_JUST_DEACTIVATED);
return true;
}
return false;
}

View file

@ -19,64 +19,4 @@
#ifndef WORLD_PVP_SI
#define WORLD_PVP_SI
#include "Common.h"
#include "OutdoorPvP.h"
#include "../Language.h"
enum
{
// npcs
NPC_SILITHUS_DUST_QUEST_ALLIANCE = 17090, // dummy npcs for quest credit
NPC_SILITHUS_DUST_QUEST_HORDE = 18199,
// game objects
GO_SILITHYST_MOUND = 181597, // created when a player drops the flag
GO_SILITHYST_GEYSER = 181598, // spawn on the map by default
// spells
//SPELL_SILITHYST_OBJECT = 29518, // unknown, related to the GO
SPELL_SILITHYST = 29519, // buff received when you are carrying a silithyst
SPELL_TRACES_OF_SILITHYST = 29534, // individual buff received when successfully delivered a silithyst
SPELL_CENARION_FAVOR = 30754, // zone buff received when a team gathers 200 silithyst
SPELL_SILITHYST_FLAG_DROP = 29533, // drop the flag
// quests
QUEST_SCOURING_DESERT_ALLIANCE = 9419,
QUEST_SCOURING_DESERT_HORDE = 9422,
// area triggers
AREATRIGGER_SILITHUS_ALLIANCE = 4162,
AREATRIGGER_SILITHUS_HORDE = 4168,
// misc
FACTION_CENARION_CIRCLE = 609,
HONOR_REWARD_SILITHYST = 19,
REPUTATION_REWARD_SILITHYST = 20,
MAX_SILITHYST = 200,
// world states
WORLD_STATE_SI_GATHERED_A = 2313,
WORLD_STATE_SI_GATHERED_H = 2314,
WORLD_STATE_SI_SILITHYST_MAX = 2317
};
class OutdoorPvPSI : public OutdoorPvP
{
public:
OutdoorPvPSI();
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
bool HandleAreaTrigger(Player* player, uint32 triggerId) override;
bool HandleGameObjectUse(Player* player, GameObject* go) override;
bool HandleDropFlag(Player* player, uint32 spellId) override;
private:
uint8 m_resourcesAlliance;
uint8 m_resourcesHorde;
Team m_zoneOwner;
};
#endif

View file

@ -15,353 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPTF.h"
#include "WorldPacket.h"
#include "../World.h"
#include "../ObjectMgr.h"
#include "../Object.h"
#include "../Creature.h"
#include "../GameObject.h"
#include "../Player.h"
OutdoorPvPTF::OutdoorPvPTF() : OutdoorPvP(),
m_zoneWorldState(WORLD_STATE_TF_TOWERS_CONTROLLED),
m_zoneOwner(TEAM_NONE),
//m_zoneUpdateTimer(TIMER_TF_UPDATE_TIME),
m_zoneLockTimer(0),
m_towersAlliance(0),
m_towersHorde(0)
{
m_towerWorldState[0] = WORLD_STATE_TF_WEST_TOWER_NEUTRAL;
m_towerWorldState[1] = WORLD_STATE_TF_NORTH_TOWER_NEUTRAL;
m_towerWorldState[2] = WORLD_STATE_TF_EAST_TOWER_NEUTRAL;
m_towerWorldState[3] = WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL;
m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL;
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
m_towerOwner[i] = TEAM_NONE;
}
void OutdoorPvPTF::FillInitialWorldStates(WorldPacket& data, uint32& count)
{
FillInitialWorldState(data, count, m_zoneWorldState, WORLD_STATE_ADD);
if (m_zoneWorldState == WORLD_STATE_TF_TOWERS_CONTROLLED)
{
FillInitialWorldState(data, count, WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde);
FillInitialWorldState(data, count, WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance);
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
}
else
UpdateTimerWorldState();
}
void OutdoorPvPTF::SendRemoveWorldStates(Player* player)
{
player->SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
}
void OutdoorPvPTF::HandlePlayerEnterZone(Player* player, bool isMainZone)
{
OutdoorPvP::HandlePlayerEnterZone(player, isMainZone);
// remove the buff from the player first because there are some issues at relog
player->RemoveAurasDueToSpell(SPELL_AUCHINDOUN_BLESSING);
// Handle the buffs
if (player->GetTeam() == m_zoneOwner)
player->CastSpell(player, SPELL_AUCHINDOUN_BLESSING, true);
}
void OutdoorPvPTF::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the buff from the player
player->RemoveAurasDueToSpell(SPELL_AUCHINDOUN_BLESSING);
OutdoorPvP::HandlePlayerLeaveZone(player, isMainZone);
}
void OutdoorPvPTF::HandleGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_TOWER_BANNER_WEST:
m_towerBanners[0] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[0]));
break;
case GO_TOWER_BANNER_NORTH:
m_towerBanners[1] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[1]));
break;
case GO_TOWER_BANNER_EAST:
m_towerBanners[2] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[2]));
break;
case GO_TOWER_BANNER_SOUTH_EAST:
m_towerBanners[3] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[3]));
break;
case GO_TOWER_BANNER_SOUTH:
m_towerBanners[4] = go->GetObjectGuid();
go->SetGoArtKit(GetBannerArtKit(m_towerOwner[4]));
break;
}
}
void OutdoorPvPTF::HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team)
{
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
for (uint8 j = 0; j < 4; ++j)
{
if (terokkarTowerEvents[i][j].eventEntry == eventId)
{
for (std::list<Player*>::iterator itr = players.begin(); itr != players.end(); ++itr)
{
if ((*itr) && (*itr)->GetTeam() == team)
(*itr)->AreaExploredOrEventHappens(team == ALLIANCE ? QUEST_SPIRITS_OF_AUCHINDOUM_ALLIANCE : QUEST_SPIRITS_OF_AUCHINDOUM_HORDE);
}
return;
}
}
}
}
// process the capture events
bool OutdoorPvPTF::HandleEvent(uint32 eventId, GameObject* go)
{
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
if (terokkarTowers[i] == go->GetEntry())
{
for (uint8 j = 0; j < 4; ++j)
{
if (terokkarTowerEvents[i][j].eventEntry == eventId)
{
// prevent processing if the owner did not change (happens if progress event is called after contest event)
if (terokkarTowerEvents[i][j].team != m_towerOwner[i])
{
sWorld.SendDefenseMessage(ZONE_ID_TEROKKAR_FOREST, terokkarTowerEvents[i][j].defenseMessage);
return ProcessCaptureEvent(go, i, terokkarTowerEvents[i][j].team, terokkarTowerEvents[i][j].worldState);
}
// no need to iterate other events or towers
return false;
}
}
// no need to iterate other towers
return false;
}
}
return false;
}
bool OutdoorPvPTF::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState)
{
if (team == ALLIANCE)
{
// update banner
SetBannerVisual(go, CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE);
// update tower count
++m_towersAlliance;
// if all towers are captured then process event
if (m_towersAlliance == MAX_TF_TOWERS)
{
LockZone(go, towerId, team, newWorldState);
return true;
}
// update tower count world state
SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance);
}
else if (team == HORDE)
{
// update banner
SetBannerVisual(go, CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
// update tower count
++m_towersHorde;
// if all towers are captured then process event
if (m_towersHorde == MAX_TF_TOWERS)
{
LockZone(go, towerId, team, newWorldState);
return true;
}
// update tower count world state
SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde);
}
else
{
// update banner
SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
// update tower count
if (m_towerOwner[towerId] == ALLIANCE)
{
--m_towersAlliance;
SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance);
}
else
{
--m_towersHorde;
SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde);
}
}
// update tower state
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_REMOVE);
m_towerWorldState[towerId] = newWorldState;
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_ADD);
// update capture point owner
m_towerOwner[towerId] = team;
// the are no DB exceptions in this case
return true;
}
// Handle the zone lock when the timer is activated
void OutdoorPvPTF::LockZone(GameObject* go, uint32 towerId, Team team, uint32 newWorldState)
{
SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE);
m_zoneWorldState = team == ALLIANCE ? WORLD_STATE_TF_LOCKED_ALLIANCE : WORLD_STATE_TF_LOCKED_HORDE;
SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_ADD);
m_zoneLockTimer = TIMER_TF_LOCK_TIME;
UpdateTimerWorldState();
m_zoneOwner = team;
BuffTeam(team, SPELL_AUCHINDOUN_BLESSING);
// lock the towers
LockTowers(go);
sWorld.SendDefenseMessage(ZONE_ID_TEROKKAR_FOREST, team == ALLIANCE ? LANG_OPVP_TF_CAPTURE_ALL_TOWERS_A : LANG_OPVP_TF_CAPTURE_ALL_TOWERS_H);
// remove tower states when zone has been captured and locked
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
m_towerWorldState[towerId] = newWorldState;
}
// Handle the zone reset when the timer expires
void OutdoorPvPTF::UnlockZone()
{
// remove buffs
BuffTeam(m_zoneOwner, SPELL_AUCHINDOUN_BLESSING, true);
m_zoneOwner = TEAM_NONE;
// reset world states and towers
SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_REMOVE);
m_zoneWorldState = WORLD_STATE_TF_TOWERS_CONTROLLED;
SendUpdateWorldState(m_zoneWorldState, WORLD_STATE_ADD);
// reset tower states
m_towerWorldState[0] = WORLD_STATE_TF_WEST_TOWER_NEUTRAL;
m_towerWorldState[1] = WORLD_STATE_TF_NORTH_TOWER_NEUTRAL;
m_towerWorldState[2] = WORLD_STATE_TF_EAST_TOWER_NEUTRAL;
m_towerWorldState[3] = WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL;
m_towerWorldState[4] = WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL;
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_ADD);
// update tower count
m_towersAlliance = 0;
m_towersHorde = 0;
SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_A, m_towersAlliance);
SendUpdateWorldState(WORLD_STATE_TF_TOWER_COUNT_H, m_towersHorde);
for (GuidZoneMap::iterator itr = m_zonePlayers.begin(); itr != m_zonePlayers.end(); ++itr)
{
// Find player who is in main zone (Terokkar Forest) to get correct map reference
if (!itr->second)
continue;
if (Player* player = sObjectMgr.GetPlayer(itr->first))
{
ResetTowers(player);
break;
}
}
}
void OutdoorPvPTF::Update(uint32 diff)
{
if (m_zoneLockTimer)
{
if (m_zoneLockTimer < diff)
{
UnlockZone();
m_zoneLockTimer = 0;
}
else
{
// update timer - if OutdoorPvPMgr update timer interval needs to be lowered replace this line with the commented-out ones below
UpdateTimerWorldState();
/*if (m_zoneUpdateTimer < diff)
{
// update timer
UpdateTimerWorldState();
m_zoneUpdateTimer = TIMER_TF_UPDATE_TIME;
}
else
m_zoneUpdateTimer -= diff;*/
m_zoneLockTimer -= diff;
}
}
}
void OutdoorPvPTF::UpdateTimerWorldState()
{
// Calculate time
uint32 minutesLeft = m_zoneLockTimer / 60000;
uint32 hoursLeft = minutesLeft / 60;
minutesLeft -= hoursLeft * 60;
uint32 firstDigit = minutesLeft / 10;
SendUpdateWorldState(WORLD_STATE_TF_TIME_MIN_FIRST_DIGIT, firstDigit);
SendUpdateWorldState(WORLD_STATE_TF_TIME_MIN_SECOND_DIGIT, minutesLeft - firstDigit * 10);
SendUpdateWorldState(WORLD_STATE_TF_TIME_HOURS, hoursLeft);
}
// Handle the Terokkar towers lock during the update timer
void OutdoorPvPTF::LockTowers(const WorldObject* objRef)
{
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(m_towerBanners[i]))
go->SetLootState(GO_JUST_DEACTIVATED);
sOutdoorPvPMgr.SetCapturePointSlider(terokkarTowers[i], m_zoneOwner == ALLIANCE ? CAPTURE_SLIDER_ALLIANCE_LOCKED : CAPTURE_SLIDER_HORDE_LOCKED);
}
}
// Handle towers reset when the timer expires
void OutdoorPvPTF::ResetTowers(const WorldObject* objRef)
{
for (uint8 i = 0; i < MAX_TF_TOWERS; ++i)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(m_towerBanners[i]))
{
go->SetCapturePointSlider(CAPTURE_SLIDER_NEUTRAL);
SetBannerVisual(go, CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
}
else
// if grid is unloaded, resetting the slider value is enough
sOutdoorPvPMgr.SetCapturePointSlider(terokkarTowers[i], CAPTURE_SLIDER_NEUTRAL);
}
}

View file

@ -19,183 +19,4 @@
#ifndef WORLD_PVP_TF
#define WORLD_PVP_TF
#include "Common.h"
#include "OutdoorPvP.h"
#include "../Language.h"
enum
{
MAX_TF_TOWERS = 5,
// gameobjects
GO_TOWER_BANNER_WEST = 183104,
GO_TOWER_BANNER_NORTH = 183411,
GO_TOWER_BANNER_EAST = 183412,
GO_TOWER_BANNER_SOUTH_EAST = 183413,
GO_TOWER_BANNER_SOUTH = 183414,
// spells
SPELL_AUCHINDOUN_BLESSING = 33377,
// timers
TIMER_TF_LOCK_TIME = 6 * HOUR * IN_MILLISECONDS,
//TIMER_TF_UPDATE_TIME = MINUTE * IN_MILLISECONDS,
// quests
QUEST_SPIRITS_OF_AUCHINDOUM_ALLIANCE = 11505,
QUEST_SPIRITS_OF_AUCHINDOUM_HORDE = 11506,
// events
EVENT_WEST_TOWER_PROGRESS_ALLIANCE = 12226,
EVENT_WEST_TOWER_PROGRESS_HORDE = 12225,
EVENT_WEST_TOWER_NEUTRAL_ALLIANCE = 12228,
EVENT_WEST_TOWER_NEUTRAL_HORDE = 12227,
EVENT_NORTH_TOWER_PROGRESS_ALLIANCE = 12497,
EVENT_NORTH_TOWER_PROGRESS_HORDE = 12496,
EVENT_NORTH_TOWER_NEUTRAL_ALLIANCE = 12490,
EVENT_NORTH_TOWER_NEUTRAL_HORDE = 12491,
EVENT_EAST_TOWER_PROGRESS_ALLIANCE = 12486,
EVENT_EAST_TOWER_PROGRESS_HORDE = 12487,
EVENT_EAST_TOWER_NEUTRAL_ALLIANCE = 12488,
EVENT_EAST_TOWER_NEUTRAL_HORDE = 12489,
EVENT_SOUTH_EAST_TOWER_PROGRESS_ALLIANCE = 12499,
EVENT_SOUTH_EAST_TOWER_PROGRESS_HORDE = 12498,
EVENT_SOUTH_EAST_TOWER_NEUTRAL_ALLIANCE = 12492,
EVENT_SOUTH_EAST_TOWER_NEUTRAL_HORDE = 12493,
EVENT_SOUTH_TOWER_PROGRESS_ALLIANCE = 12501,
EVENT_SOUTH_TOWER_PROGRESS_HORDE = 12500,
EVENT_SOUTH_TOWER_NEUTRAL_ALLIANCE = 12494,
EVENT_SOUTH_TOWER_NEUTRAL_HORDE = 12495,
// world states
// tower counter before the lock event
WORLD_STATE_TF_TOWER_COUNT_H = 2622,
WORLD_STATE_TF_TOWER_COUNT_A = 2621,
WORLD_STATE_TF_TOWERS_CONTROLLED = 2620,
// timer for the lock event
WORLD_STATE_TF_TIME_MIN_FIRST_DIGIT = 2512,
WORLD_STATE_TF_TIME_MIN_SECOND_DIGIT = 2510,
WORLD_STATE_TF_TIME_HOURS = 2509,
// lock period - factions
WORLD_STATE_TF_LOCKED_NEUTRAL = 2508,
WORLD_STATE_TF_LOCKED_HORDE = 2768,
WORLD_STATE_TF_LOCKED_ALLIANCE = 2767,
// tower world states
WORLD_STATE_TF_WEST_TOWER_ALLIANCE = 2683,
WORLD_STATE_TF_WEST_TOWER_HORDE = 2682,
WORLD_STATE_TF_WEST_TOWER_NEUTRAL = 2681,
WORLD_STATE_TF_NORTH_TOWER_ALLIANCE = 2684,
WORLD_STATE_TF_NORTH_TOWER_HORDE = 2685,
WORLD_STATE_TF_NORTH_TOWER_NEUTRAL = 2686,
WORLD_STATE_TF_EAST_TOWER_ALLIANCE = 2688,
WORLD_STATE_TF_EAST_TOWER_HORDE = 2689,
WORLD_STATE_TF_EAST_TOWER_NEUTRAL = 2690,
WORLD_STATE_TF_SOUTH_EAST_TOWER_ALLIANCE = 2694,
WORLD_STATE_TF_SOUTH_EAST_TOWER_HORDE = 2695,
WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL = 2696,
WORLD_STATE_TF_SOUTH_TOWER_ALLIANCE = 2691,
WORLD_STATE_TF_SOUTH_TOWER_HORDE = 2692,
WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL = 2693
};
struct TerokkarTowerEvent
{
uint32 eventEntry;
Team team;
uint32 defenseMessage;
uint32 worldState;
};
static const TerokkarTowerEvent terokkarTowerEvents[MAX_TF_TOWERS][4] =
{
{
{EVENT_WEST_TOWER_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_TF_CAPTURE_TOWER_A, WORLD_STATE_TF_WEST_TOWER_ALLIANCE},
{EVENT_WEST_TOWER_PROGRESS_HORDE, HORDE, LANG_OPVP_TF_CAPTURE_TOWER_H, WORLD_STATE_TF_WEST_TOWER_HORDE},
{EVENT_WEST_TOWER_NEUTRAL_HORDE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_A, WORLD_STATE_TF_WEST_TOWER_NEUTRAL},
{EVENT_WEST_TOWER_NEUTRAL_ALLIANCE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_H, WORLD_STATE_TF_WEST_TOWER_NEUTRAL},
},
{
{EVENT_NORTH_TOWER_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_TF_CAPTURE_TOWER_A, WORLD_STATE_TF_NORTH_TOWER_ALLIANCE},
{EVENT_NORTH_TOWER_PROGRESS_HORDE, HORDE, LANG_OPVP_TF_CAPTURE_TOWER_H, WORLD_STATE_TF_NORTH_TOWER_HORDE},
{EVENT_NORTH_TOWER_NEUTRAL_HORDE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_A, WORLD_STATE_TF_NORTH_TOWER_NEUTRAL},
{EVENT_NORTH_TOWER_NEUTRAL_ALLIANCE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_H, WORLD_STATE_TF_NORTH_TOWER_NEUTRAL},
},
{
{EVENT_EAST_TOWER_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_TF_CAPTURE_TOWER_A, WORLD_STATE_TF_EAST_TOWER_ALLIANCE},
{EVENT_EAST_TOWER_PROGRESS_HORDE, HORDE, LANG_OPVP_TF_CAPTURE_TOWER_H, WORLD_STATE_TF_EAST_TOWER_HORDE},
{EVENT_EAST_TOWER_NEUTRAL_HORDE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_A, WORLD_STATE_TF_EAST_TOWER_NEUTRAL},
{EVENT_EAST_TOWER_NEUTRAL_ALLIANCE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_H, WORLD_STATE_TF_EAST_TOWER_NEUTRAL},
},
{
{EVENT_SOUTH_EAST_TOWER_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_TF_CAPTURE_TOWER_A, WORLD_STATE_TF_SOUTH_EAST_TOWER_ALLIANCE},
{EVENT_SOUTH_EAST_TOWER_PROGRESS_HORDE, HORDE, LANG_OPVP_TF_CAPTURE_TOWER_H, WORLD_STATE_TF_SOUTH_EAST_TOWER_HORDE},
{EVENT_SOUTH_EAST_TOWER_NEUTRAL_HORDE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_A, WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL},
{EVENT_SOUTH_EAST_TOWER_NEUTRAL_ALLIANCE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_H, WORLD_STATE_TF_SOUTH_EAST_TOWER_NEUTRAL},
},
{
{EVENT_SOUTH_TOWER_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_TF_CAPTURE_TOWER_A, WORLD_STATE_TF_SOUTH_TOWER_ALLIANCE},
{EVENT_SOUTH_TOWER_PROGRESS_HORDE, HORDE, LANG_OPVP_TF_CAPTURE_TOWER_H, WORLD_STATE_TF_SOUTH_TOWER_HORDE},
{EVENT_SOUTH_TOWER_NEUTRAL_HORDE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_A, WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL},
{EVENT_SOUTH_TOWER_NEUTRAL_ALLIANCE, TEAM_NONE, LANG_OPVP_TF_LOSE_TOWER_H, WORLD_STATE_TF_SOUTH_TOWER_NEUTRAL},
},
};
static const uint32 terokkarTowers[MAX_TF_TOWERS] = {GO_TOWER_BANNER_WEST, GO_TOWER_BANNER_NORTH, GO_TOWER_BANNER_EAST, GO_TOWER_BANNER_SOUTH_EAST, GO_TOWER_BANNER_SOUTH};
class OutdoorPvPTF : public OutdoorPvP
{
friend class OutdoorPvPMgr;
public:
OutdoorPvPTF();
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
void SendRemoveWorldStates(Player* player) override;
bool HandleEvent(uint32 eventId, GameObject* go) override;
void HandleObjectiveComplete(uint32 eventId, std::list<Player*> players, Team team) override;
void HandleGameObjectCreate(GameObject* go) override;
void Update(uint32 diff) override;
private:
void UpdateTimerWorldState();
// process capture events
bool ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState);
void LockZone(GameObject* go, uint32 towerId, Team team, uint32 newWorldState);
void UnlockZone();
void LockTowers(const WorldObject* objRef);
void ResetTowers(const WorldObject* objRef);
uint32 m_towerWorldState[MAX_TF_TOWERS];
uint32 m_zoneWorldState;
Team m_towerOwner[MAX_TF_TOWERS];
Team m_zoneOwner;
uint32 m_zoneLockTimer;
//uint32 m_zoneUpdateTimer;
uint8 m_towersAlliance;
uint8 m_towersHorde;
ObjectGuid m_towerBanners[MAX_TF_TOWERS];
};
#endif

View file

@ -15,389 +15,3 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "OutdoorPvPZM.h"
#include "WorldPacket.h"
#include "../World.h"
#include "../ObjectMgr.h"
#include "../Object.h"
#include "../Creature.h"
#include "../GameObject.h"
#include "../Player.h"
OutdoorPvPZM::OutdoorPvPZM() : OutdoorPvP(),
m_graveyardOwner(TEAM_NONE),
m_graveyardWorldState(WORLD_STATE_ZM_GRAVEYARD_NEUTRAL),
m_scoutWorldStateAlliance(WORLD_STATE_ZM_FLAG_NOT_READY_ALLIANCE),
m_scoutWorldStateHorde(WORLD_STATE_ZM_FLAG_NOT_READY_HORDE),
m_towersAlliance(0),
m_towersHorde(0)
{
// init world states
m_towerWorldState[0] = WORLD_STATE_ZM_BEACON_EAST_UI_NEUTRAL;
m_towerWorldState[1] = WORLD_STATE_ZM_BEACON_WEST_UI_NEUTRAL;
m_towerMapState[0] = WORLD_STATE_ZM_BEACON_EAST_NEUTRAL;
m_towerMapState[1] = WORLD_STATE_ZM_BEACON_WEST_NEUTRAL;
for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i)
m_towerOwner[i] = TEAM_NONE;
// initially set graveyard owner to neither faction
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_TWIN_SPIRE, GRAVEYARD_ZONE_TWIN_SPIRE, TEAM_INVALID);
}
void OutdoorPvPZM::FillInitialWorldStates(WorldPacket& data, uint32& count)
{
FillInitialWorldState(data, count, m_scoutWorldStateAlliance, WORLD_STATE_ADD);
FillInitialWorldState(data, count, m_scoutWorldStateHorde, WORLD_STATE_ADD);
FillInitialWorldState(data, count, m_graveyardWorldState, WORLD_STATE_ADD);
for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i)
{
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
FillInitialWorldState(data, count, m_towerMapState[i], WORLD_STATE_ADD);
}
}
void OutdoorPvPZM::SendRemoveWorldStates(Player* player)
{
player->SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_REMOVE);
player->SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_REMOVE);
player->SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_REMOVE);
for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i)
{
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
player->SendUpdateWorldState(m_towerMapState[i], WORLD_STATE_REMOVE);
}
}
void OutdoorPvPZM::HandlePlayerEnterZone(Player* player, bool isMainZone)
{
OutdoorPvP::HandlePlayerEnterZone(player, isMainZone);
// remove the buff from the player first; Sometimes on relog players still have the aura
player->RemoveAurasDueToSpell(SPELL_TWIN_SPIRE_BLESSING);
// cast buff the the player which enters the zone
if (player->GetTeam() == m_graveyardOwner)
player->CastSpell(player, SPELL_TWIN_SPIRE_BLESSING, true);
}
void OutdoorPvPZM::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the buff from the player
player->RemoveAurasDueToSpell(SPELL_TWIN_SPIRE_BLESSING);
OutdoorPvP::HandlePlayerLeaveZone(player, isMainZone);
}
void OutdoorPvPZM::HandleCreatureCreate(Creature* creature)
{
switch (creature->GetEntry())
{
case NPC_PVP_BEAM_RED:
if (creature->GetPositionY() < 7000.0f) // East Beam
m_beamTowerRed[0] = creature->GetObjectGuid();
else if (creature->GetPositionY() < 7300.0f) // Center Beam
m_beamGraveyardRed = creature->GetObjectGuid();
else // West Beam
m_beamTowerRed[1] = creature->GetObjectGuid();
break;
case NPC_PVP_BEAM_BLUE:
if (creature->GetPositionY() < 7000.0f) // East Beam
m_beamTowerBlue[0] = creature->GetObjectGuid();
else if (creature->GetPositionY() < 7300.0f) // Center Beam
m_beamGraveyardBlue = creature->GetObjectGuid();
else // West Beam
m_beamTowerBlue[1] = creature->GetObjectGuid();
break;
}
}
void OutdoorPvPZM::HandleGameObjectCreate(GameObject* go)
{
switch (go->GetEntry())
{
case GO_ZANGA_BANNER_EAST:
m_towerBanners[0] = go->GetObjectGuid();
break;
case GO_ZANGA_BANNER_WEST:
m_towerBanners[1] = go->GetObjectGuid();
break;
case GO_ZANGA_BANNER_CENTER_ALLIANCE:
m_graveyardBannerAlliance = go->GetObjectGuid();
break;
case GO_ZANGA_BANNER_CENTER_HORDE:
m_graveyardBannerHorde = go->GetObjectGuid();
break;
case GO_ZANGA_BANNER_CENTER_NEUTRAL:
m_graveyardBannerNeutral = go->GetObjectGuid();
break;
}
}
// Cast player spell on opponent kill
void OutdoorPvPZM::HandlePlayerKillInsideArea(Player* player, Unit* /*victim*/)
{
for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i)
{
if (GameObject* capturePoint = player->GetMap()->GetGameObject(m_towerBanners[i]))
{
// check capture point range
GameObjectInfo const* info = capturePoint->GetGOInfo();
if (info && player->IsWithinDistInMap(capturePoint, info->capturePoint.radius))
{
// check capture point team
if (player->GetTeam() == m_towerOwner[i])
player->CastSpell(player, player->GetTeam() == ALLIANCE ? SPELL_ZANGA_TOWER_TOKEN_ALLIANCE : SPELL_ZANGA_TOWER_TOKEN_HORDE, true);
return;
}
}
}
}
// process the capture events
bool OutdoorPvPZM::HandleEvent(uint32 eventId, GameObject* go)
{
for (uint8 i = 0; i < MAX_ZM_TOWERS; ++i)
{
if (zangarmarshTowers[i] == go->GetEntry())
{
for (uint8 j = 0; j < 4; ++j)
{
if (zangarmarshTowerEvents[i][j].eventEntry == eventId)
{
// prevent processing if the owner did not change (happens if progress event is called after contest event)
if (zangarmarshTowerEvents[i][j].team != m_towerOwner[i])
{
if (zangarmarshTowerEvents[i][j].defenseMessage)
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, zangarmarshTowerEvents[i][j].defenseMessage);
return ProcessCaptureEvent(go, i, zangarmarshTowerEvents[i][j].team, zangarmarshTowerEvents[i][j].worldState, zangarmarshTowerEvents[i][j].mapState);
}
// no need to iterate other events or towers
return false;
}
}
// no need to iterate other towers
return false;
}
}
return false;
}
bool OutdoorPvPZM::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState, uint32 newMapState)
{
if (team == ALLIANCE)
{
// update counter
SetBeaconArtKit(go, m_beamTowerBlue[towerId], SPELL_BEAM_BLUE);
++m_towersAlliance;
if (m_towersAlliance == MAX_ZM_TOWERS)
{
// Send this defense message before updating scout state as this sends another
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_CAPTURE_BOTH_BEACONS_A);
// only add flag to scouts if team does not have captured graveyard already
if (m_graveyardOwner != ALLIANCE)
UpdateScoutState(ALLIANCE, true);
}
}
else if (team == HORDE)
{
// update counter
SetBeaconArtKit(go, m_beamTowerRed[towerId], SPELL_BEAM_RED);
++m_towersHorde;
if (m_towersHorde == MAX_ZM_TOWERS)
{
// Send this defense message before updating scout state as this sends another
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_CAPTURE_BOTH_BEACONS_H);
// only add flag to scouts if team does not already have captured graveyard
if (m_graveyardOwner != HORDE)
UpdateScoutState(HORDE, true);
}
}
else
{
if (m_towerOwner[towerId] == ALLIANCE)
{
SetBeaconArtKit(go, m_beamTowerBlue[towerId], 0);
// only remove flag from scouts if team does not already have captured graveyard
if (m_towersAlliance == MAX_ZM_TOWERS && m_graveyardOwner != ALLIANCE)
UpdateScoutState(ALLIANCE, false);
// update counter
--m_towersAlliance;
}
else
{
SetBeaconArtKit(go, m_beamTowerRed[towerId], 0);
// only remove flag from scouts if team does not already have captured graveyard
if (m_towersHorde == MAX_ZM_TOWERS && m_graveyardOwner != HORDE)
UpdateScoutState(HORDE, false);
// update counter
--m_towersHorde;
}
}
// update tower state
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_REMOVE);
m_towerWorldState[towerId] = newWorldState;
SendUpdateWorldState(m_towerWorldState[towerId], WORLD_STATE_ADD);
SendUpdateWorldState(m_towerMapState[towerId], WORLD_STATE_REMOVE);
m_towerMapState[towerId] = newMapState;
SendUpdateWorldState(m_towerMapState[towerId], WORLD_STATE_ADD);;
// update capture point owner
m_towerOwner[towerId] = team;
// the are no DB exceptions in this case
return true;
}
// Handle scout activation, when both beacons are captured
void OutdoorPvPZM::UpdateScoutState(Team team, bool spawned)
{
if (team == ALLIANCE)
{
SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_REMOVE);
m_scoutWorldStateAlliance = spawned ? WORLD_STATE_ZM_FLAG_READY_ALLIANCE : WORLD_STATE_ZM_FLAG_NOT_READY_ALLIANCE;
SendUpdateWorldState(m_scoutWorldStateAlliance, WORLD_STATE_ADD);
if (spawned)
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_A);
}
else
{
SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_REMOVE);
m_scoutWorldStateHorde = spawned ? WORLD_STATE_ZM_FLAG_READY_HORDE : WORLD_STATE_ZM_FLAG_NOT_READY_HORDE;
SendUpdateWorldState(m_scoutWorldStateHorde, WORLD_STATE_ADD);
if (spawned)
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_SPAWN_FIELD_SCOUT_H);
}
}
// Handle the graveyard banner use
bool OutdoorPvPZM::HandleGameObjectUse(Player* player, GameObject* go)
{
Team team = player->GetTeam();
switch (go->GetEntry())
{
case GO_ZANGA_BANNER_CENTER_NEUTRAL:
break;
case GO_ZANGA_BANNER_CENTER_ALLIANCE:
if (team == ALLIANCE || !player->HasAura(SPELL_BATTLE_STANDARD_HORDE))
return false;
break;
case GO_ZANGA_BANNER_CENTER_HORDE:
if (team == HORDE || !player->HasAura(SPELL_BATTLE_STANDARD_ALLIANCE))
return false;
break;
default:
return false;
}
// disable old banners - note the alliance and horde banners can despawn by self
if (m_graveyardOwner == ALLIANCE)
{
//RespawnGO(go, m_graveyardBannerAlliance, false);
SetBeaconArtKit(go, m_beamGraveyardBlue, 0);
}
else if (m_graveyardOwner == HORDE)
{
//RespawnGO(go, m_graveyardBannerHorde, false);
SetBeaconArtKit(go, m_beamGraveyardRed, 0);
}
else
RespawnGO(go, m_graveyardBannerNeutral, false);
if (team == ALLIANCE)
{
// change banners
RespawnGO(go, m_graveyardBannerAlliance, true);
SetBeaconArtKit(go, m_beamGraveyardBlue, SPELL_BEAM_BLUE);
// update world state
SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_REMOVE);
m_graveyardWorldState = WORLD_STATE_ZM_GRAVEYARD_ALLIANCE;
SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_ADD);
// remove player flag aura
player->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_ALLIANCE);
// send defense message
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_CAPTURE_GRAVEYARD_A);
}
else
{
// change banners
RespawnGO(go, m_graveyardBannerHorde, true);
SetBeaconArtKit(go, m_beamGraveyardRed, SPELL_BEAM_RED);
// update world state
SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_REMOVE);
m_graveyardWorldState = WORLD_STATE_ZM_GRAVEYARD_HORDE;
SendUpdateWorldState(m_graveyardWorldState, WORLD_STATE_ADD);
// remove player flag aura
player->RemoveAurasDueToSpell(SPELL_BATTLE_STANDARD_HORDE);
// send defense message
sWorld.SendDefenseMessage(ZONE_ID_ZANGARMARSH, LANG_OPVP_ZM_CAPTURE_GRAVEYARD_H);
}
// change the graveyard link
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_TWIN_SPIRE, GRAVEYARD_ZONE_TWIN_SPIRE, team);
// apply zone buff
if (m_graveyardOwner != TEAM_NONE)
BuffTeam(m_graveyardOwner, SPELL_TWIN_SPIRE_BLESSING, true);
BuffTeam(team, SPELL_TWIN_SPIRE_BLESSING);
// reset scout so that team cannot take flag
UpdateScoutState(team, false);
// update graveyard owner
m_graveyardOwner = team;
return false;
}
// ToDo: Handle the case when the player drops the flag
//bool OutdoorPvPZM::HandleDropFlag(Player* player, uint32 spellId)
//{
// if (spellId == SPELL_BATTLE_STANDARD_HORDE || spellId == SPELL_BATTLE_STANDARD_ALLIANCE)
// {
// // ToDo: implement this when the scout DB conditions are implemented
// // The scouts gossip options should check a DB condition if the gossip is pvp available
// // The idea is to set the Outdoor PvP condition to false on flag take - this will allow only one player to use the flag
// // on flag drop the condition can be set back to true if necessary, so the players can retake the flag
// return true;
// }
//
// return false;
//}
// Handle the ZM beacons - this is done by npcs which have certain auras
void OutdoorPvPZM::SetBeaconArtKit(const WorldObject* objRef, ObjectGuid creatureGuid, uint32 auraId)
{
if (Creature* beam = objRef->GetMap()->GetCreature(creatureGuid))
{
if (auraId)
beam->CastSpell(beam, auraId, true);
else
beam->RemoveAllAuras();
}
}

View file

@ -19,165 +19,4 @@
#ifndef WORLD_PVP_ZM
#define WORLD_PVP_ZM
#include "Common.h"
#include "OutdoorPvP.h"
#include "../Language.h"
enum
{
MAX_ZM_TOWERS = 2,
// npcs
//NPC_ALLIANCE_FIELD_SCOUT = 18581,
//NPC_HORDE_FIELD_SCOUT = 18564,
// these 2 npcs act as an artkit
NPC_PVP_BEAM_RED = 18757,
NPC_PVP_BEAM_BLUE = 18759,
// gameobjects
GO_ZANGA_BANNER_WEST = 182522,
GO_ZANGA_BANNER_EAST = 182523,
GO_ZANGA_BANNER_CENTER_ALLIANCE = 182527,
GO_ZANGA_BANNER_CENTER_HORDE = 182528,
GO_ZANGA_BANNER_CENTER_NEUTRAL = 182529,
// spells
SPELL_TWIN_SPIRE_BLESSING = 33779,
SPELL_BATTLE_STANDARD_ALLIANCE = 32430,
SPELL_BATTLE_STANDARD_HORDE = 32431,
SPELL_ZANGA_TOWER_TOKEN_ALLIANCE = 32155,
SPELL_ZANGA_TOWER_TOKEN_HORDE = 32158,
SPELL_BEAM_RED = 32839,
SPELL_BEAM_BLUE = 32840,
// misc
GRAVEYARD_ID_TWIN_SPIRE = 969,
GRAVEYARD_ZONE_TWIN_SPIRE = 3521,
// events
//EVENT_EAST_BEACON_CONTEST_ALLIANCE = 11816,
//EVENT_EAST_BEACON_CONTEST_HORDE = 11817,
EVENT_EAST_BEACON_PROGRESS_ALLIANCE = 11807,
EVENT_EAST_BEACON_PROGRESS_HORDE = 11806,
EVENT_EAST_BEACON_NEUTRAL_ALLIANCE = 11814,
EVENT_EAST_BEACON_NEUTRAL_HORDE = 11815,
//EVENT_WEST_BEACON_CONTEST_ALLIANCE = 11813,
//EVENT_WEST_BEACON_CONTEST_HORDE = 11812,
EVENT_WEST_BEACON_PROGRESS_ALLIANCE = 11805,
EVENT_WEST_BEACON_PROGRESS_HORDE = 11804,
EVENT_WEST_BEACON_NEUTRAL_ALLIANCE = 11808,
EVENT_WEST_BEACON_NEUTRAL_HORDE = 11809,
// world states
WORLD_STATE_ZM_BEACON_EAST_UI_ALLIANCE = 2558,
WORLD_STATE_ZM_BEACON_EAST_UI_HORDE = 2559,
WORLD_STATE_ZM_BEACON_EAST_UI_NEUTRAL = 2560,
WORLD_STATE_ZM_BEACON_WEST_UI_ALLIANCE = 2555,
WORLD_STATE_ZM_BEACON_WEST_UI_HORDE = 2556,
WORLD_STATE_ZM_BEACON_WEST_UI_NEUTRAL = 2557,
WORLD_STATE_ZM_BEACON_EAST_ALLIANCE = 2650,
WORLD_STATE_ZM_BEACON_EAST_HORDE = 2651,
WORLD_STATE_ZM_BEACON_EAST_NEUTRAL = 2652,
WORLD_STATE_ZM_BEACON_WEST_ALLIANCE = 2644,
WORLD_STATE_ZM_BEACON_WEST_HORDE = 2645,
WORLD_STATE_ZM_BEACON_WEST_NEUTRAL = 2646,
WORLD_STATE_ZM_GRAVEYARD_ALLIANCE = 2648,
WORLD_STATE_ZM_GRAVEYARD_HORDE = 2649,
WORLD_STATE_ZM_GRAVEYARD_NEUTRAL = 2647,
WORLD_STATE_ZM_FLAG_READY_HORDE = 2658,
WORLD_STATE_ZM_FLAG_NOT_READY_HORDE = 2657,
WORLD_STATE_ZM_FLAG_READY_ALLIANCE = 2655,
WORLD_STATE_ZM_FLAG_NOT_READY_ALLIANCE = 2656
//WORLD_STATE_ZM_UNK = 2653
};
struct ZangarmarshTowerEvent
{
uint32 eventEntry;
Team team;
uint32 defenseMessage;
uint32 worldState;
uint32 mapState;
};
static const ZangarmarshTowerEvent zangarmarshTowerEvents[MAX_ZM_TOWERS][4] =
{
{
{EVENT_EAST_BEACON_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_ZM_CAPTURE_EAST_BEACON_A, WORLD_STATE_ZM_BEACON_EAST_UI_ALLIANCE, WORLD_STATE_ZM_BEACON_EAST_ALLIANCE},
{EVENT_EAST_BEACON_PROGRESS_HORDE, HORDE, LANG_OPVP_ZM_CAPTURE_EAST_BEACON_H, WORLD_STATE_ZM_BEACON_EAST_UI_HORDE, WORLD_STATE_ZM_BEACON_EAST_HORDE},
{EVENT_EAST_BEACON_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_ZM_BEACON_EAST_UI_NEUTRAL, WORLD_STATE_ZM_BEACON_EAST_NEUTRAL},
{EVENT_EAST_BEACON_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_ZM_BEACON_EAST_UI_NEUTRAL, WORLD_STATE_ZM_BEACON_EAST_NEUTRAL},
},
{
{EVENT_WEST_BEACON_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_ZM_CAPTURE_WEST_BEACON_A, WORLD_STATE_ZM_BEACON_WEST_UI_ALLIANCE, WORLD_STATE_ZM_BEACON_WEST_ALLIANCE},
{EVENT_WEST_BEACON_PROGRESS_HORDE, HORDE, LANG_OPVP_ZM_CAPTURE_WEST_BEACON_H, WORLD_STATE_ZM_BEACON_WEST_UI_HORDE, WORLD_STATE_ZM_BEACON_WEST_HORDE},
{EVENT_WEST_BEACON_NEUTRAL_HORDE, TEAM_NONE, 0, WORLD_STATE_ZM_BEACON_WEST_UI_NEUTRAL, WORLD_STATE_ZM_BEACON_WEST_NEUTRAL},
{EVENT_WEST_BEACON_NEUTRAL_ALLIANCE, TEAM_NONE, 0, WORLD_STATE_ZM_BEACON_WEST_UI_NEUTRAL, WORLD_STATE_ZM_BEACON_WEST_NEUTRAL},
},
};
static const uint32 zangarmarshTowers[MAX_ZM_TOWERS] = {GO_ZANGA_BANNER_EAST, GO_ZANGA_BANNER_WEST};
class OutdoorPvPZM : public OutdoorPvP
{
public:
OutdoorPvPZM();
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
void SendRemoveWorldStates(Player* player) override;
bool HandleEvent(uint32 eventId, GameObject* go) override;
void HandleCreatureCreate(Creature* creature) override;
void HandleGameObjectCreate(GameObject* go) override;
void HandlePlayerKillInsideArea(Player* player, Unit* victim) override;
bool HandleGameObjectUse(Player* player, GameObject* go) override;
//bool HandleDropFlag(Player* player, uint32 spellId) override;
private:
// process capture events
bool ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState, uint32 newMapState);
// handles scout world states
void UpdateScoutState(Team team, bool spawned);
// respawn npcs which act as an artkit visual
void SetBeaconArtKit(const WorldObject* objRef, ObjectGuid creatureGuid, uint32 auraId);
uint32 m_towerWorldState[MAX_ZM_TOWERS];
uint32 m_towerMapState[MAX_ZM_TOWERS];
Team m_towerOwner[MAX_ZM_TOWERS];
Team m_graveyardOwner;
uint32 m_graveyardWorldState;
uint32 m_scoutWorldStateAlliance;
uint32 m_scoutWorldStateHorde;
uint8 m_towersAlliance;
uint8 m_towersHorde;
ObjectGuid m_towerBanners[MAX_ZM_TOWERS];
ObjectGuid m_graveyardBannerAlliance;
ObjectGuid m_graveyardBannerHorde;
ObjectGuid m_graveyardBannerNeutral;
ObjectGuid m_beamTowerBlue[MAX_ZM_TOWERS];
ObjectGuid m_beamTowerRed[MAX_ZM_TOWERS];
ObjectGuid m_beamGraveyardBlue;
ObjectGuid m_beamGraveyardRed;
};
#endif

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12100"
#define REVISION_NR "0128"
#endif // __REVISION_NR_H__

View file

@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_11785_02_characters_instance"
#define REVISION_DB_MANGOS "required_12097_01_mangos_mangos_string"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#define REVISION_DB_CHARACTERS "required_0099_xxxxx_01_characters_character_phase_data"
#define REVISION_DB_MANGOS "required_0128_12097_01_mangos_mangos_string"
#define REVISION_DB_REALMD "required_0014_xxxxx_01_realmd_account_access"
#endif // __REVISION_SQL_H__