コード例 #1
0
    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);
    }
コード例 #2
0
ファイル: Quest_BloodmystIsle.cpp プロジェクト: AscEmu/AscEmu
    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);
                }
            }
        }
    }