Esempio n. 1
0
// process the capture events
bool OutdoorPvPGH::HandleEvent(uint32 eventId, GameObject* go, Unit* invoker)
{
    // 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;
}
Esempio n. 2
0
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);
}