Пример #1
0
void BattleGroundAV::HandleKillUnit(Creature* creature, Player* killer)
{
    DEBUG_LOG("BattleGroundAV: HandleKillUnit %i", creature->GetEntry());
    if (GetStatus() != STATUS_IN_PROGRESS)
    {
        return;
    }
    uint8 event1 = (sBattleGroundMgr.GetCreatureEventIndex(creature->GetGUIDLow())).event1;
    if (event1 == BG_EVENT_NONE)
    {
        return;
    }
    switch (event1)
    {
    case BG_AV_BOSS_A:
        CastSpellOnTeam(BG_AV_BOSS_KILL_QUEST_SPELL, HORDE);   // this is a spell which finishes a quest where a player has to kill the boss
        RewardReputationToTeam(BG_AV_FACTION_H, m_RepBoss, HORDE);
        RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), HORDE);
        SendYellToAll(LANG_BG_AV_A_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0));
        EndBattleGround(HORDE);
        break;
    case BG_AV_BOSS_H:
        CastSpellOnTeam(BG_AV_BOSS_KILL_QUEST_SPELL, ALLIANCE); // this is a spell which finishes a quest where a player has to kill the boss
        RewardReputationToTeam(BG_AV_FACTION_A, m_RepBoss, ALLIANCE);
        RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_BOSS), ALLIANCE);
        SendYellToAll(LANG_BG_AV_H_GENERAL_DEAD, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0));
        EndBattleGround(ALLIANCE);
        break;
    case BG_AV_CAPTAIN_A:
        if (IsActiveEvent(BG_AV_NodeEventCaptainDead_A, 0))
        {
            return;
        }
        RewardReputationToTeam(BG_AV_FACTION_H, m_RepCaptain, HORDE);
        RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), HORDE);
        UpdateScore(BG_TEAM_ALLIANCE, (-1) * BG_AV_RES_CAPTAIN);
        // spawn destroyed aura
        SpawnEvent(BG_AV_NodeEventCaptainDead_A, 0, true);
        break;
    case BG_AV_CAPTAIN_H:
        if (IsActiveEvent(BG_AV_NodeEventCaptainDead_H, 0))
        {
            return;
        }
        RewardReputationToTeam(BG_AV_FACTION_A, m_RepCaptain, ALLIANCE);
        RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_CAPTAIN), ALLIANCE);
        UpdateScore(BG_TEAM_HORDE, (-1) * BG_AV_RES_CAPTAIN);
        // spawn destroyed aura
        SpawnEvent(BG_AV_NodeEventCaptainDead_H, 0, true);
        break;
    case BG_AV_MINE_BOSSES_NORTH:
        ChangeMineOwner(BG_AV_NORTH_MINE, GetAVTeamIndexByTeamId(killer->GetTeam()));
        break;
    case BG_AV_MINE_BOSSES_SOUTH:
        ChangeMineOwner(BG_AV_SOUTH_MINE, GetAVTeamIndexByTeamId(killer->GetTeam()));
        break;
    }
}
Пример #2
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);
            }
        }
    }
}
Пример #3
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);
        }
    }
}
Пример #4
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;
        }
    }
}