mirror of
https://github.com/mangosfour/server.git
synced 2025-12-18 19:37:01 +00:00
Add Outdoor PvP handlers to various files
This commit is contained in:
parent
525ec3ea4c
commit
e955c3bc8f
6 changed files with 68 additions and 4 deletions
|
|
@ -172,6 +172,10 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
|
|||
if (InstanceData* iData = map->GetInstanceData())
|
||||
iData->OnObjectCreate(this);
|
||||
|
||||
// Notify the outdoor pvp script
|
||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
|
||||
outdoorPvP->HandleGameObjectCreate(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1152,6 +1156,15 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
case GAMEOBJECT_TYPE_GOOBER: // 10
|
||||
{
|
||||
// Handle OutdoorPvP use cases
|
||||
// Note: this may be also handled by DB spell scripts in the future, when the world state manager is implemented
|
||||
if (user->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* player = (Player*)user;
|
||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(player->GetCachedZoneId()))
|
||||
outdoorPvP->HandleGameObjectUse(player, this);
|
||||
}
|
||||
|
||||
GameObjectInfo const* info = GetGOInfo();
|
||||
|
||||
TriggerLinkedGameObject(user);
|
||||
|
|
@ -2092,7 +2105,10 @@ void GameObject::TickCapturePoint()
|
|||
{
|
||||
eventId = info->capturePoint.progressEventID1;
|
||||
|
||||
// TODO handle objective complete
|
||||
// handle objective complete
|
||||
if (m_captureState == CAPTURE_STATE_NEUTRAL)
|
||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript((*capturingPlayers.begin())->GetCachedZoneId()))
|
||||
outdoorPvP->HandleObjectiveComplete(eventId, capturingPlayers, progressFaction);
|
||||
|
||||
// set capture state to alliance
|
||||
m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE;
|
||||
|
|
@ -2102,7 +2118,10 @@ void GameObject::TickCapturePoint()
|
|||
{
|
||||
eventId = info->capturePoint.progressEventID2;
|
||||
|
||||
// TODO handle objective complete
|
||||
// handle objective complete
|
||||
if (m_captureState == CAPTURE_STATE_NEUTRAL)
|
||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript((*capturingPlayers.begin())->GetCachedZoneId()))
|
||||
outdoorPvP->HandleObjectiveComplete(eventId, capturingPlayers, progressFaction);
|
||||
|
||||
// set capture state to horde
|
||||
m_captureState = CAPTURE_STATE_PROGRESS_HORDE;
|
||||
|
|
@ -2138,6 +2157,14 @@ void GameObject::TickCapturePoint()
|
|||
|
||||
if (eventId)
|
||||
{
|
||||
// Notify the outdoor pvp script
|
||||
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript((*capturingPlayers.begin())->GetCachedZoneId()))
|
||||
{
|
||||
// Allow only certain events to be handled by other script engines
|
||||
if (outdoorPvP->HandleEvent(eventId, this))
|
||||
return;
|
||||
}
|
||||
|
||||
// Send script event to SD2 and database as well - this can be used for summoning creatures, casting specific spells or spawning GOs
|
||||
if (!sScriptMgr.OnProcessEvent(eventId, this, this, true))
|
||||
GetMap()->ScriptsStart(sEventScripts, eventId, this, this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue