当前位置: 首页>>代码示例>>C++>>正文


C++ Battlefield::GetAttackerTeam方法代码示例

本文整理汇总了C++中Battlefield::GetAttackerTeam方法的典型用法代码示例。如果您正苦于以下问题:C++ Battlefield::GetAttackerTeam方法的具体用法?C++ Battlefield::GetAttackerTeam怎么用?C++ Battlefield::GetAttackerTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Battlefield的用法示例。


在下文中一共展示了Battlefield::GetAttackerTeam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnGossipHello

        bool OnGossipHello(Player* player, Creature* creature)
        {
            if (creature->isQuestGiver())
                player->PrepareQuestMenu(creature->GetGUID());

            Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
            if (!wintergrasp)
                return true;

            if (creature->isQuestGiver())
            {
                QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
                QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());

                QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
                qm.ClearMenu();

                for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
                {
                    uint32 questId = i->second;
                    QuestStatus status = player->GetQuestStatus(questId);
                    if (status == QUEST_STATUS_COMPLETE)
                        qm.AddMenuItem(questId, 4);
                    else if (status == QUEST_STATUS_INCOMPLETE)
                        qm.AddMenuItem(questId, 4);
                    //else if (status == QUEST_STATUS_AVAILABLE)
                    //    qm.AddMenuItem(quest_id, 2);
                }

                for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
                {
                    uint32 questId = i->second;
                    Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
                    if (!quest)
                        continue;

                    switch (questId)
                    {
                        // Horde attacker
                        case QUEST_BONES_AND_ARROWS_HORDE_ATT:
                        case QUEST_JINXING_THE_WALLS_HORDE_ATT:
                        case QUEST_SLAY_THEM_ALL_HORDE_ATT:
                        case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT:
                        case QUEST_HEALING_WITH_ROSES_HORDE_ATT:
                        case QUEST_DEFEND_THE_SIEGE_HORDE_ATT:
                            if (wintergrasp->GetAttackerTeam() == TEAM_HORDE)
                            {
                                QuestStatus status = player->GetQuestStatus(questId);

                                if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
                                    qm.AddMenuItem(questId, 4);
                                else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
                                    qm.AddMenuItem(questId, 2);
                            }
                            break;
                        // Horde defender
                        case QUEST_BONES_AND_ARROWS_HORDE_DEF:
                        case QUEST_WARDING_THE_WALLS_HORDE_DEF:
                        case QUEST_SLAY_THEM_ALL_HORDE_DEF:
                        case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF:
                        case QUEST_HEALING_WITH_ROSES_HORDE_DEF:
                        case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF:
                        case QUEST_STOP_THE_SIEGE_HORDE_DEF:
                            if (wintergrasp->GetDefenderTeam() == TEAM_HORDE)
                            {
                                QuestStatus status = player->GetQuestStatus(questId);

                                if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
                                    qm.AddMenuItem(questId, 4);
                                else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
                                    qm.AddMenuItem(questId, 2);
                            }
                            break;
                        // Alliance attacker
                        case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT:
                        case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT:
                        case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT:
                        case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT:
                        case QUEST_A_RARE_HERB_ALLIANCE_ATT:
                            if (wintergrasp->GetAttackerTeam() == TEAM_ALLIANCE)
                            {
                                QuestStatus status = player->GetQuestStatus(questId);

                                if (quest->IsAutoComplete() && player->CanTakeQuest(quest, false))
                                    qm.AddMenuItem(questId, 4);
                                else if (status == QUEST_STATUS_NONE && player->CanTakeQuest(quest, false))
                                    qm.AddMenuItem(questId, 2);
                            }
                            break;
                        // Alliance defender
                        case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF:
                        case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF:
                        case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF:
                        case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF:
                        case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF:
                        case QUEST_A_RARE_HERB_ALLIANCE_DEF:
                            if (wintergrasp->GetDefenderTeam() == TEAM_ALLIANCE)
                            {
                                QuestStatus status = player->GetQuestStatus(questId);

//.........这里部分代码省略.........
开发者ID:AlucardVoss,项目名称:Patchs,代码行数:101,代码来源:zone_wintergrasp.cpp


注:本文中的Battlefield::GetAttackerTeam方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。