mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
Implement Grizzly Hills - Venture Bay Outdoor PvP script
This commit is contained in:
parent
85a9dd0041
commit
dfb7937c58
3 changed files with 198 additions and 0 deletions
|
|
@ -15,3 +15,139 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* 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);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,65 @@
|
||||||
#ifndef WORLD_PVP_GH
|
#ifndef WORLD_PVP_GH
|
||||||
#define 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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ void OutdoorPvPMgr::InitOutdoorPvP()
|
||||||
m_scripts[OPVP_ID_ZM] = new OutdoorPvPZM();
|
m_scripts[OPVP_ID_ZM] = new OutdoorPvPZM();
|
||||||
m_scripts[OPVP_ID_TF] = new OutdoorPvPTF();
|
m_scripts[OPVP_ID_TF] = new OutdoorPvPTF();
|
||||||
m_scripts[OPVP_ID_NA] = new OutdoorPvPNA();
|
m_scripts[OPVP_ID_NA] = new OutdoorPvPNA();
|
||||||
|
m_scripts[OPVP_ID_GH] = new OutdoorPvPGH();
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u Outdoor PvP zones", MAX_OPVP_ID);
|
sLog.outString(">> Loaded %u Outdoor PvP zones", MAX_OPVP_ID);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue