Example #1
0
void BattleGroundAV::Update(uint32 diff)
{
    BattleGround::Update(diff);

    if (GetStatus() != STATUS_IN_PROGRESS)
    {
        return;
    }

    // add points from mine owning, and look if the neutral team can reclaim the mine
    for (uint8 mine = 0; mine < BG_AV_MAX_MINES; ++mine)
    {
        if (m_Mine_Owner[mine] != BG_AV_TEAM_NEUTRAL)
        {
            m_Mine_Timer[mine] -= diff;
            if (m_Mine_Timer[mine] <= 0)
            {
                UpdateScore(BattleGroundTeamIndex(m_Mine_Owner[mine]), WORLD_STATE_ADD);
                m_Mine_Timer[mine] = BG_AV_MINE_TICK_TIMER;
            }

            if (m_Mine_Reclaim_Timer[mine] > diff)
            {
                m_Mine_Reclaim_Timer[mine] -= diff;
            }
            else
            {
                ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL);
            }
        }
    }

    // looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
    for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
    {
        if (m_Nodes[i].State == POINT_ASSAULTED)
        {
            if (m_Nodes[i].Timer > diff)
            {
                m_Nodes[i].Timer -= diff;
            }
            else
            {
                EventPlayerDestroyedPoint(i);
            }
        }
    }
}
Example #2
0
void BattleGroundAV::Update(uint32 diff)
{
    BattleGround::Update(diff);

    if (GetStatus() == STATUS_WAIT_JOIN && GetPlayersSize())
    {
        ModifyStartDelayTime(diff);

        if (!(m_Events & 0x01))
        {
            m_Events |= 0x01;

            if(!SetupBattleGround())
            {
                EndNow();
                return;
            }

            sLog.outDebug("Alterac Valley: entering state STATUS_WAIT_JOIN ...");
            SetStartDelayTime(START_DELAY0);
        }
        // After 1 minute, warning is signalled
        else if (GetStartDelayTime() <= START_DELAY1 && !(m_Events & 0x04))
        {
            m_Events |= 0x04;
            SendMessageToAll(GetMangosString(LANG_BG_AV_START_ONE_MINUTE));
        }
        // After 1,5 minute, warning is signalled
        else if (GetStartDelayTime() <= START_DELAY2 && !(m_Events & 0x08))
        {
            m_Events |= 0x08;
            SendMessageToAll(GetMangosString(LANG_BG_AV_START_HALF_MINUTE));
        }
        // After 2 minutes, gates OPEN ! x)
        else if (GetStartDelayTime() <= 0 && !(m_Events & 0x10))
        {
            UpdateWorldState(BG_AV_SHOW_H_SCORE, 1);
            UpdateWorldState(BG_AV_SHOW_A_SCORE, 1);

            m_Events |= 0x10;

            SendMessageToAll(GetMangosString(LANG_BG_AV_HAS_BEGUN));
            PlaySoundToAll(SOUND_BG_START);
            SetStatus(STATUS_IN_PROGRESS);

            OpenDoorEvent(BG_EVENT_DOOR);

            for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
                if(Player* plr = sObjectMgr.GetPlayer(itr->first))
                    plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
        }
    }


    if (GetStatus() != STATUS_IN_PROGRESS)
        return;

    // add points from mine owning, and look if the neutral team can reclaim the mine
    for(uint8 mine = 0; mine < BG_AV_MAX_MINES; mine++)
    {
        if (m_Mine_Owner[mine] == BG_TEAM_ALLIANCE || m_Mine_Owner[mine] == BG_TEAM_HORDE)
        {
            m_Mine_Timer[mine] -=diff;
            if (m_Mine_Timer[mine] <= 0)
            {
                UpdateScore(BattleGroundTeamId(m_Mine_Owner[mine]), 1);
                m_Mine_Timer[mine] = BG_AV_MINE_TICK_TIMER;
            }

            if (m_Mine_Reclaim_Timer[mine] > diff)
                m_Mine_Reclaim_Timer[mine] -= diff;
            else
                ChangeMineOwner(mine, BG_AV_NEUTRAL_TEAM);
        }
    }

    // looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
    for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
    {
        if (m_Nodes[i].State == POINT_ASSAULTED)
        {
            if (m_Nodes[i].Timer > diff)
                m_Nodes[i].Timer -= diff;
            else
                 EventPlayerDestroyedPoint(i);
        }
    }
}
Example #3
0
void BattleGroundAV::Update(uint32 diff)
{
    BattleGround::Update(diff);

    if (GetStatus() != STATUS_IN_PROGRESS)
        return;

    if (m_PlayerCheckTimer < diff)
    {
        BattleGroundAV::CheckPlayerSize();
        m_PlayerCheckTimer = 1000;
    }
    else
        m_PlayerCheckTimer -= diff;

    // add points from mine owning, and look if the neutral team can reclaim the mine
    for(uint8 mine = 0; mine < BG_AV_MAX_MINES; mine++)
    {
        if (m_Mine_Owner[mine] != BG_AV_TEAM_NEUTRAL)
        {
            m_Mine_Timer[mine] -=diff;
            if (m_Mine_Timer[mine] <= 0)
            {
                m_Mine_Timer[mine] = BG_AV_MINE_TICK_TIMER;
            }

            if (m_Mine_Reclaim_Timer[mine] > diff)
                m_Mine_Reclaim_Timer[mine] -= diff;
            else
                ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL);
        }
    }

    // looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team
    for(BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i)
    {
        if (m_Nodes[i].State == POINT_ASSAULTED)
        {
            if (m_Nodes[i].Timer > diff)
                m_Nodes[i].Timer -= diff;
            else
                EventPlayerDestroyedPoint(i);
        }
    }

    for (uint8 i = 0; i < 2; i++)
    {
        //handle team captain buffs every 3 + random minutes until they are dead
        if (m_CaptainBuffTimer[i] != 0)
        {
            if (m_CaptainBuffTimer[i] <= diff)
            {
                if (i > 0)
                {
                    if(!IsActiveEvent(BG_AV_NodeEventCaptainDead_H, 0))
                    {
                        //text is missing / we cannot handle DoScriptText in core -> alterac valley/galvangar -> yell_buff
                        CastSpellOnTeam(BG_AV_CAPTAIN_H_BUFF, HORDE);
                        //PlaySoundToAll(); //probably wrong sound
                    }
                }
                else
                {
                    if(!IsActiveEvent(BG_AV_NodeEventCaptainDead_A, 0))
                    {
                        //text is missing / we cannot handle DoScriptText in core -> alterac valley/balinda -> yell_buff
                        CastSpellOnTeam(BG_AV_CAPTAIN_A_BUFF, ALLIANCE);
                        //PlaySoundToAll(); //probably wrong sound
                    }
                }

                m_CaptainBuffTimer[i] = (180000 + (urand(0,6) * 10000));
            }
            else
                m_CaptainBuffTimer[i] -= diff;
        }

        //handle general warcry buff every 3 minutes + random if enough armor scraps are gathered
        if (m_GeneralBuffTimer[i] != 0)
        {
            if (m_GeneralBuffTimer[i] <= diff)
            {
                Team team[2] = {ALLIANCE, HORDE};
                GossipIndex Channel;
                if (i > 0)
                {
                    //text is missing / we cannot handle DoScriptText in core -> alterac valley/drekthar -> yell_random
                    //PlaySoundToAll(); //probably wrong sound
                    Channel = GOSSIP_CHANNEL2;
                }
                else
                {
                    //text is missing / we cannot handle DoScriptText in core -> alterac valley/vanndar -> yell_random
                    //PlaySoundToAll(); //probably wrong sound
                    Channel = GOSSIP_CHANNEL1;
                }

                if (GetGossipStatus(Channel) == STATUS_ACTION1)
                    CastSpellOnTeam(BG_AV_WARCRY_BUFF_1, team[i]);
                else if (GetGossipStatus(Channel) == STATUS_ACTION2)
                    CastSpellOnTeam(BG_AV_WARCRY_BUFF_2, team[i]);
                else if (GetGossipStatus(Channel) == STATUS_ACTION3)
                    CastSpellOnTeam(BG_AV_WARCRY_BUFF_3, team[i]);

                m_GeneralBuffTimer[i] = (180000 + (urand(0,6) * 10000));
            }
            else
                m_GeneralBuffTimer[i] -= diff;
        }
    }
}