コード例 #1
0
bool GossipHello_npc_crusader_announcer(Player *player, Creature *creature)
{
    ScriptedInstance *pInstance = (ScriptedInstance *) creature->GetInstanceData();
    if(!pInstance)
        return true;
    if(pInstance->IsEncounterInProgress())
        return true;
    Difficulty diff = creature->GetMap()->GetDifficulty();

    if(diff!=RAID_DIFFICULTY_10MAN_NORMAL && diff!=RAID_DIFFICULTY_25MAN_NORMAL)
        return true;

    if(pInstance->GetData(TYPE_NORTHREND_BEASTS) != DONE)
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Northrend Beasts", GOSSIP_SENDER_MAIN, BEASTS);
    else if(pInstance->GetData(TYPE_JARAXXUS) != DONE)
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Lord Jaraxxus", GOSSIP_SENDER_MAIN, JARAXXUS);
    else if(pInstance->GetData(TYPE_FACTION_CHAMPIONS) != DONE)
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Faction Champions", GOSSIP_SENDER_MAIN, CHAMPIONS);
    else if(pInstance->GetData(TYPE_TWIN_VALKYR) != DONE)
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Twin Val'kyr", GOSSIP_SENDER_MAIN, TWINS);
    else
        player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Anub'arak", GOSSIP_SENDER_MAIN, ANUBARAK);


    player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());

    return true;
}
コード例 #2
0
bool AreaTrigger_at_kelthuzad_center(Player* pPlayer, const AreaTriggerEntry *at)
{
    if (pPlayer->isGameMaster())
        return false;

    ScriptedInstance* pInstance = pPlayer->GetInstanceData();
    if (!pInstance || pInstance->IsEncounterInProgress() || pInstance->GetBossState(BOSS_KELTHUZAD) == DONE)
        return false;

    Creature* pKelthuzad = CAST_CRE(Unit::GetUnit(*pPlayer, pInstance->GetData64(DATA_KELTHUZAD)));
    if (!pKelthuzad)
        return false;

    boss_kelthuzadAI* pKelthuzadAI = CAST_AI(boss_kelthuzadAI, pKelthuzad->AI());
    if (!pKelthuzadAI)
        return false;

    pKelthuzadAI->AttackStart(pPlayer);
    if (GameObject* trigger = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_KELTHUZAD_TRIGGER)))
    {
        if (trigger->getLootState() == GO_READY)
            trigger->UseDoorOrButton();

        // Note: summon must be done by trigger and not by KT. 
        // Otherwise, they attack immediately as KT is in combat.
        for (uint8 i = 0; i <= MAX_ABOMINATIONS; ++i)
        {
            if (Creature* sum = trigger->SummonCreature(NPC_ABOMINATION, PosAbominations[i]))
            {
                pKelthuzadAI->spawns.Summon(sum);
                sum->GetMotionMaster()->MoveRandom(9.0f);
                sum->SetReactState(REACT_DEFENSIVE);
            }
        }
        for (uint8 i = 0; i <= MAX_WASTES; ++i)
        {
            if (Creature* sum = trigger->SummonCreature(NPC_WASTE, PosWastes[i]))
            {
                pKelthuzadAI->spawns.Summon(sum);
                sum->GetMotionMaster()->MoveRandom(5.0f);
                sum->SetReactState(REACT_DEFENSIVE);
            }
        }
        for (uint8 i = 0; i <= MAX_WEAVERS; ++i)
        {
            if (Creature* sum = trigger->SummonCreature(NPC_WEAVER, PosWeavers[i]))
            {
                pKelthuzadAI->spawns.Summon(sum);
                sum->GetMotionMaster()->MoveRandom(9.0f);
                sum->SetReactState(REACT_DEFENSIVE);
            }
        }
    }

    return true;
}