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


C++ Player::AddQuestKill方法代码示例

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


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

示例1: OnDied

    void OnDied(Unit* mKiller)
    {
        if (!mKiller->isPlayer())
            return;

        Player* plr = static_cast<Player*>(mKiller);
        uint8 chance = (uint8)Util::getRandomUInt(5);
        uint32 spawn = 0;

        switch (chance)
        {
            case 0:
            case 1:
                spawn = 22459; //Freed Shat'ar Warrior
                break;

            case 2:
                spawn = 21661; //Cabal Skirmisher
                break;

            case 3:
                spawn = 16805; //Broken Skeleton
                break;

            case 4:
                spawn = 18470; //Bonelasher
                break;

            case 5:
                spawn = 22045; //Vengeful Husk
                break;
        }

        Creature* creat = plr->GetMapMgr()->CreateAndSpawnCreature(spawn, getCreature()->GetPositionX(), getCreature()->GetPositionY(), getCreature()->GetPositionZ(), 0);
        if (creat == nullptr)
            return;

        creat->Despawn(1 * 60 * 1000, 0);

        if (spawn != 22459)
            return;

        creat->GetAIInterface()->m_canMove = false;
        creat->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "Finally! I'm free!");

        plr->AddQuestKill(10873, 0, 0);
    }
开发者ID:armm77,项目名称:AscEmu,代码行数:47,代码来源:Quest_Terrokar_Forest.cpp

示例2: OnDied

    void OnDied(Unit* pKiller) override
    {
        Player* QuestHolder = NULL;
        if (pKiller->isPlayer())
            QuestHolder = static_cast<Player*>(pKiller);
        else if (pKiller->isPet() && static_cast<Pet*>(pKiller)->getPlayerOwner() != nullptr)
            QuestHolder = dynamic_cast<Player*>(static_cast<Pet*>(pKiller)->getPlayerOwner());

        if (QuestHolder == NULL)
            return;

        // M4ksiu: I don't think the method is correct, but it can stay the way it was until someone gives proper infos
        QuestLogEntry* qle = QuestHolder->GetQuestLogForEntry(9670);
        LocationVector pos = getCreature()->GetPosition();
        Creature* RandomCreature = NULL;
        if (qle == nullptr)
        {
            // Creatures from Bloodmyst Isle
            uint32 Id[51] = { 17681, 17887, 17550, 17323, 17338, 17341, 17333, 17340, 17353, 17320, 17339, 17337, 17715, 17322, 17494, 17654, 17342, 17328, 17331, 17325, 17321, 17330, 17522, 17329, 17524, 17327, 17661, 17352, 17334, 17326, 17324, 17673, 17336, 17346, 17589, 17609, 17608, 17345, 17527, 17344, 17347, 17525, 17713, 17523, 17348, 17606, 17604, 17607, 17610, 17358, 17588 };
            RandomCreature = getCreature()->GetMapMgr()->GetInterface()->SpawnCreature(Id[Util::getRandomUInt(50)], pos.x, pos.y, pos.z, pos.o, true, false, 0, 0);
            if (RandomCreature != NULL)
            {
                RandomCreature->m_noRespawn = true;
                RandomCreature->Despawn(60000, 0);
            }
        }
        else
        {
            uint32 Id[8] = { 17681, 17321, 17330, 17522, 17673, 17336, 17346, 17589 };
            RandomCreature = getCreature()->GetMapMgr()->GetInterface()->SpawnCreature(Id[Util::getRandomUInt(7)], pos.x, pos.y, pos.z, pos.o, true, false, 0, 0);
            if (RandomCreature != NULL)
            {
                RandomCreature->m_noRespawn = true;
                RandomCreature->Despawn(60000, 0);
                if (RandomCreature->getEntry() == 17681)
                {
                    QuestHolder->AddQuestKill(9670, 0, 0);
                }
            }
        }
    }
开发者ID:AscEmu,项目名称:AscEmu,代码行数:41,代码来源:Quest_BloodmystIsle.cpp


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