void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node)
{
    DEBUG_LOG("BattleGroundAV: player destroyed point node %i", node);

    MANGOS_ASSERT(m_Nodes[node].Owner != BG_AV_TEAM_NEUTRAL)
    BattleGroundTeamIndex ownerTeamIdx = BattleGroundTeamIndex(m_Nodes[node].Owner);
    Team ownerTeam = ownerTeamIdx == BG_TEAM_ALLIANCE ? ALLIANCE : HORDE;

    // despawn banner
    DestroyNode(node);
    PopulateNode(node);
    UpdateNodeWorldState(node);

    if (IsTower(node))
    {
        uint8 tmp = node - BG_AV_NODES_DUNBALDAR_SOUTH;
        // despawn marshal (one of those guys protecting the boss)
        SpawnEvent(BG_AV_MARSHAL_A_SOUTH + tmp, 0, false);

        UpdateScore(GetOtherTeamIndex(ownerTeamIdx), (-1) * BG_AV_RES_TOWER);
        RewardReputationToTeam((ownerTeam == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, m_RepTowerDestruction, ownerTeam);
        RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), ownerTeam);
        SendYell2ToAll(LANG_BG_AV_TOWER_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), (ownerTeam == ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
    }
    else
    {
        SendYell2ToAll(LANG_BG_AV_GRAVE_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), (ownerTeam == ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
    }
}
예제 #2
0
void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node)
{
    // TODO implement quest 7101, 7081
    BattleGroundTeamIndex teamIdx  = GetTeamIndexByTeamId(player->GetTeam());
    DEBUG_LOG("BattleGroundAV: player assaults node %i", node);
    if (m_Nodes[node].Owner == BattleGroundAVTeamIndex(teamIdx) || BattleGroundAVTeamIndex(teamIdx) == m_Nodes[node].TotalOwner)
    {
        return;
    }

    AssaultNode(node, teamIdx);                             // update nodeinfo variables
    UpdateNodeWorldState(node);                             // send mapicon
    PopulateNode(node);

    if (IsTower(node))
    {
        SendYell2ToAll(LANG_BG_AV_TOWER_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
                       GetNodeName(node),
                       (teamIdx == BG_TEAM_ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
        UpdatePlayerScore(player, SCORE_TOWERS_ASSAULTED, 1);
    }
    else
    {
        SendYell2ToAll(LANG_BG_AV_GRAVE_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
                       GetNodeName(node),
                       (teamIdx == BG_TEAM_ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
        // update the statistic for the assaulting player
        UpdatePlayerScore(player, SCORE_GRAVEYARDS_ASSAULTED, 1);
    }

    PlaySoundToAll((teamIdx == BG_TEAM_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_ASSAULTS : BG_AV_SOUND_HORDE_ASSAULTS);
}
예제 #3
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;
    }
}
예제 #4
0
void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node)
{
    MANGOS_ASSERT(GetStatus() == STATUS_IN_PROGRESS);

    TeamIndex teamIdx = GetTeamIndex(player->GetTeam());

    if (m_Nodes[node].Owner == TeamIndex(teamIdx) || m_Nodes[node].State != POINT_ASSAULTED)
        return;
    if (m_Nodes[node].TotalOwner == TEAM_INDEX_NEUTRAL)     // initial snowfall capture
    {
        // until snowfall doesn't belong to anyone it is better handled in assault - code (best would be to have a special function
        // for neutral nodes.. but doing this just for snowfall will be a bit to much i think
        MANGOS_ASSERT(node == BG_AV_NODES_SNOWFALL_GRAVE);  // currently the only neutral grave
        EventPlayerAssaultsPoint(player, node);
        return;
    }

    DEBUG_LOG("BattleGroundAV: player defends node: %i", node);
    if (m_Nodes[node].PrevOwner != TeamIndex(teamIdx))
    {
        sLog.outError("BattleGroundAV: player defends point which doesn't belong to his team %i", node);
        return;
    }

    DefendNode(node, teamIdx);                              // set the right variables for nodeinfo
    PopulateNode(node);                                     // spawn node-creatures (defender for example)
    UpdateNodeWorldState(node);                             // send new mapicon to the player

    if (IsTower(node))
    {
        SendYell2ToAll(LANG_BG_AV_TOWER_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
                       GetNodeName(node),
                       (teamIdx == TEAM_INDEX_ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
        UpdatePlayerScore(player, SCORE_TOWERS_DEFENDED, 1);
        PlaySoundToAll(BG_AV_SOUND_BOTH_TOWER_DEFEND);
    }
    else
    {
        SendYell2ToAll(LANG_BG_AV_GRAVE_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
                       GetNodeName(node),
                       (teamIdx == TEAM_INDEX_ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE);
        UpdatePlayerScore(player, SCORE_GRAVEYARDS_DEFENDED, 1);
        player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, 1, 65);

        // update the statistic for the defending player
        PlaySoundToAll((teamIdx == TEAM_INDEX_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_GOOD : BG_AV_SOUND_HORDE_GOOD);
    }
}
예제 #5
0
void BattleGroundAV::ChangeMineOwner(uint8 mine, BattleGroundAVTeamIndex teamIdx)
{
    m_Mine_Timer[mine] = BG_AV_MINE_TICK_TIMER;
    // TODO implement quest 7122
    // mine=0 northmine, mine=1 southmine
    // TODO changing the owner should result in setting respawntime to infinite for current creatures (they should fight the new ones), spawning new mine owners creatures and changing the chest - objects so that the current owning team can use them
    MANGOS_ASSERT(mine == BG_AV_NORTH_MINE || mine == BG_AV_SOUTH_MINE);
    if (m_Mine_Owner[mine] == teamIdx)
        return;

    m_Mine_PrevOwner[mine] = m_Mine_Owner[mine];
    m_Mine_Owner[mine] = teamIdx;

    SendMineWorldStates(mine);

    SpawnEvent(BG_AV_MINE_EVENT + mine, teamIdx, true);
    SpawnEvent(BG_AV_MINE_BOSSES + mine, teamIdx, true);

    if (teamIdx != BG_AV_TEAM_NEUTRAL)
    {
        PlaySoundToAll((teamIdx == BG_AV_TEAM_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_GOOD : BG_AV_SOUND_HORDE_GOOD);
        m_Mine_Reclaim_Timer[mine] = BG_AV_MINE_RECLAIM_TIMER;
        SendYell2ToAll(LANG_BG_AV_MINE_TAKEN , LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0),
            (teamIdx == BG_AV_TEAM_ALLIANCE ) ? LANG_BG_ALLY : LANG_BG_HORDE,
            (mine == BG_AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH);
    }
}
예제 #6
0
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player)
{
    if (GetStatus() != STATUS_IN_PROGRESS)
        return;
    BattleGroundAVTeamIndex teamIdx = GetAVTeamIndexByTeamId(player->GetTeam());
    MANGOS_ASSERT(teamIdx != BG_AV_TEAM_NEUTRAL);

    uint32 reputation = 0;                                  // reputation for the whole team (other reputation must be done in db)
    // TODO add events (including quest not available anymore, next quest availabe, go/npc de/spawning)
    sLog.outError("BattleGroundAV: Quest %i completed", questid);
    switch(questid)
    {
    case BG_AV_QUEST_A_SCRAPS1:
    case BG_AV_QUEST_A_SCRAPS2:
    case BG_AV_QUEST_H_SCRAPS1:
    case BG_AV_QUEST_H_SCRAPS2:
        //ToDo: We have to handle the supply crates!
        m_Team_QuestStatus[teamIdx][0] += 20;
        reputation = 1;
        if( m_Team_QuestStatus[teamIdx][0] == 500 || m_Team_QuestStatus[teamIdx][0] == 1500 || m_Team_QuestStatus[teamIdx][0] == 3000)
        {
            //get team smith
            Creature* Smith = 0;
            if (teamIdx == BG_TEAM_ALLIANCE)
                Smith = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_Smith_A, 0));
            else if (teamIdx == BG_TEAM_HORDE)
                Smith = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_Smith_H, 0));

            //here we call the scriptevzero alterac valley.cpp to handle the smith gossip
            if (Smith)
                Smith->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);

            DEBUG_LOG("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid);
            for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
                if (m_Nodes[i].Owner == teamIdx && m_Nodes[i].State == POINT_CONTROLLED)
                    PopulateNode(i);
        }
        break;
    case BG_AV_QUEST_A_COMMANDER1:
    case BG_AV_QUEST_H_COMMANDER1:
        m_Team_QuestStatus[teamIdx][1]++;
        reputation = 1;
        if (m_Team_QuestStatus[teamIdx][1] == 120)
            DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
        break;
    case BG_AV_QUEST_A_COMMANDER2:
    case BG_AV_QUEST_H_COMMANDER2:
        m_Team_QuestStatus[teamIdx][2]++;
        reputation = 2;
        if (m_Team_QuestStatus[teamIdx][2] == 60)
            DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
        break;
    case BG_AV_QUEST_A_COMMANDER3:
    case BG_AV_QUEST_H_COMMANDER3:
        m_Team_QuestStatus[teamIdx][3]++;
        reputation = 5;
        if (m_Team_QuestStatus[teamIdx][1] == 30)
            DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
        break;
    case BG_AV_QUEST_A_BOSS1:
    case BG_AV_QUEST_H_BOSS1:
        m_Team_QuestStatus[teamIdx][4] += 4;               // there are 2 quests where you can turn in 5 or 1 item.. ( + 4 cause +1 will be done some lines below)
        reputation = 4;
    case BG_AV_QUEST_A_BOSS2:
    case BG_AV_QUEST_H_BOSS2:
        m_Team_QuestStatus[teamIdx][4]++;
        reputation += 1;
        //Zero: this feature isn't completly finished and stable
        if (m_Team_QuestStatus[teamIdx][4] >= 200)
        {
            //get team smith
            Creature* summonMaster = 0;
            if (teamIdx == BG_TEAM_ALLIANCE)
                summonMaster = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_BOSS_SUMMON_MASTER_A, 0));
            else if (teamIdx == BG_TEAM_HORDE)
                summonMaster = player->GetMap()->GetCreature(GetSingleCreatureGuid(BG_AV_BOSS_SUMMON_MASTER_H, 0));

            if (summonMaster)
                summonMaster->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_OUTDOORPVP);
        }
        break;
    case BG_AV_QUEST_A_NEAR_MINE:
    case BG_AV_QUEST_H_NEAR_MINE:
        m_Team_QuestStatus[teamIdx][5]++;
        reputation = 2;
        if (m_Team_QuestStatus[teamIdx][5] == 28)
        {
            DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
            if (m_Team_QuestStatus[teamIdx][6] == 7)
                DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid);
        }
        break;
    case BG_AV_QUEST_A_OTHER_MINE:
    case BG_AV_QUEST_H_OTHER_MINE:
        m_Team_QuestStatus[teamIdx][6]++;
        reputation = 3;
        if (m_Team_QuestStatus[teamIdx][6] == 7)
        {
            DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
            if (m_Team_QuestStatus[teamIdx][5] == 20)
                DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid);
        }
        break;
    case BG_AV_QUEST_A_RIDER_HIDE:
    case BG_AV_QUEST_H_RIDER_HIDE:
        m_Team_QuestStatus[teamIdx][7]++;
        reputation = 1;
        if (m_Team_QuestStatus[teamIdx][7] == 25)
        {
            DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
            if (m_Team_QuestStatus[teamIdx][8] == 25)
                DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid);
        }
        break;
    case BG_AV_QUEST_A_RIDER_TAME:
    case BG_AV_QUEST_H_RIDER_TAME:
        m_Team_QuestStatus[teamIdx][8]++;
        reputation = 1;
        if (m_Team_QuestStatus[teamIdx][8] == 25)
        {
            DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here", questid);
            if (m_Team_QuestStatus[teamIdx][7] == 25)
                DEBUG_LOG("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid);
        }
        break;
    default:
        DEBUG_LOG("BattleGroundAV: Quest %i completed but is not interesting for us", questid);
        return;
        break;
    }
    if (reputation)
        RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam());
}