void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
{
    if (!IsFlagPickedUp())
        return;

    if (GetFlagCarrierGuid() != source->GetObjectGuid())
        return;

    ClearFlagCarrier();
    source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);

    if (GetStatus() != STATUS_IN_PROGRESS)
    {
        // do not cast auras or send messages after match has ended
        return;
    }

    m_flagState = EY_FLAG_STATE_ON_GROUND;
    m_flagRespawnTimer = EY_FLAG_RESPAWN_TIME;
    source->CastSpell(source, SPELL_RECENTLY_DROPPED_FLAG, true);
    source->CastSpell(source, EY_PLAYER_DROPPED_FLAG_SPELL, true);

    if (source->GetTeam() == ALLIANCE)
    {
        UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_STATE_ALLIANCE, 1);
        SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, nullptr);
    }
    else
    {
        UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_STATE_HORDE, 1);
        SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, nullptr);
    }
}
Exemple #2
0
void BattleGroundEY::EventPlayerDroppedFlag(Player* source)
{
    if (GetStatus() != STATUS_IN_PROGRESS)
    {
        // if not running, do not cast things at the dropper player, neither send unnecessary messages
        // just take off the aura
        if (IsFlagPickedUp() && GetFlagCarrierGuid() == source->GetObjectGuid())
        {
            ClearFlagCarrier();
            source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);
        }
        return;
    }

    if (!IsFlagPickedUp())
        return;

    if (GetFlagCarrierGuid() != source->GetObjectGuid())
        return;

    ClearFlagCarrier();
    source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);
    m_flagState = EY_FLAG_STATE_ON_GROUND;
    m_flagRespawnTimer = EY_FLAG_RESPAWN_TIME;
    source->CastSpell(source, SPELL_RECENTLY_DROPPED_FLAG, true);
    source->CastSpell(source, EY_PLAYER_DROPPED_FLAG_SPELL, true);

    if (source->GetTeam() == ALLIANCE)
    {
        UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_STATE_ALLIANCE, 1);
        SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL);
    }
    else
    {
        UpdateWorldState(WORLD_STATE_EY_NETHERSTORM_FLAG_STATE_HORDE, 1);
        SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL);
    }
}
Exemple #3
0
void BattleGroundEY::RemovePlayer(Player* plr, ObjectGuid guid)
{
    // sometimes flag aura not removed :(
    if (IsFlagPickedUp())
    {
        if (m_flagCarrier == guid)
        {
            if (plr)
                EventPlayerDroppedFlag(plr);
            else
            {
                ClearFlagCarrier();
                RespawnFlag();
            }
        }
    }
}
Exemple #4
0
void BattleGroundEY::EventPlayerCapturedFlag(Player* source, EYNodes node)
{
    if (GetStatus() != STATUS_IN_PROGRESS || GetFlagCarrierGuid() != source->GetObjectGuid())
        return;

    ClearFlagCarrier();

    m_flagState = EY_FLAG_STATE_WAIT_RESPAWN;
    m_flagRespawnTimer = EY_FLAG_RESPAWN_TIME;

    source->RemoveAurasDueToSpell(EY_NETHERSTORM_FLAG_SPELL);
    source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);

    if (source->GetTeam() == ALLIANCE)
    {
        PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_ALLIANCE);

        if (m_towersAlliance > 0)
            AddPoints(ALLIANCE, eyFlagPoints[m_towersAlliance - 1]);

        SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, source);
    }
    else
    {
        PlaySoundToAll(EY_SOUND_FLAG_CAPTURED_HORDE);

        if (m_towersHorde > 0)
            AddPoints(HORDE, eyFlagPoints[m_towersHorde - 1]);

        SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, source);
    }

    SpawnEvent(EY_EVENT_CAPTURE_FLAG, node, true);

    UpdatePlayerScore(source, SCORE_FLAG_CAPTURES, 1);
}