bool OnGossipHello(Player* player, Creature* creature)
        {
            InstanceScript* instance = creature->GetInstanceScript();
            if (!instance)
                return true;

            char const* _message = "We are ready!";

            if (player->IsInCombat() || instance->IsEncounterInProgress() || instance->GetData(TYPE_EVENT))
                return true;

            uint8 i = 0;
            for (; i < NUM_MESSAGES; ++i)
            {
                if ((!_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) != DONE)
                    || (_GossipMessage[i].state && instance->GetBossState(_GossipMessage[i].encounter) == DONE))
                {
                    player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, _message, GOSSIP_SENDER_MAIN, _GossipMessage[i].id);
                    break;
                }
            }

            if (i >= NUM_MESSAGES)
                return false;

            player->SEND_GOSSIP_MENU(_GossipMessage[i].msgnum, creature->GetGUID());
            return true;
        }
Example #2
0
    bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
    {
        if (player->isGameMaster())
            return false;

        InstanceScript* instance = player->GetInstanceScript();
        if (!instance || instance->IsEncounterInProgress() || instance->GetBossState(BOSS_KELTHUZAD) == DONE)
            return false;

        Creature* pKelthuzad = Unit::GetCreature(*player, instance->GetData64(DATA_KELTHUZAD));
        if (!pKelthuzad)
            return false;

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

        pKelthuzadAI->AttackStart(player);
        if (GameObject* trigger = instance->instance->GetGameObject(instance->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;
    }
Example #3
0
        void UpdateAI(uint32 diff)
        {
            if( JustSummoned )
            {
                despawnTimer = 1;
                JustSummoned = false;
                if( m_pInstance )
                {
                    if( !m_pInstance->IsEncounterInProgress() || m_pInstance->GetData(DATA_EREGOS)==IN_PROGRESS )
                    {
                        if( me->GetVehicleKit() && me->IsSummon() )
                            if( !me->GetVehicleKit()->GetPassenger(0) )
                            {
                                TempSummon* ts = (TempSummon*)me;
                                if( Unit* summoner = ts->GetSummoner() )
                                {
                                    if( m_pInstance->GetData(DATA_UROM) == DONE )
                                    {
                                        switch( me->GetEntry() )
                                        {
                                            case 27692:
                                                me->m_spells[5] = 50344;
                                                break;
                                            case 27755:
                                                me->m_spells[5] = 49592;
                                                break;
                                            case 27756:
                                                me->m_spells[5] = 50253;
                                                break;
                                        }
                                    }

                                    uint32 spell = 0;
                                    switch (me->GetEntry())
                                    {
                                        case 27692: spell = 49427; break;
                                        case 27755: spell = 49459; break;
                                        case 27756: spell = 49463; break;
                                    }

                                    //summoner->EnterVehicle(me);
                                    if (spell)
                                        me->CastSpell(summoner, spell, true);
                                    me->SetCanFly(true);
                                    me->SetSpeed(MOVE_FLIGHT, me->GetSpeedRate(MOVE_RUN), true);
                                }
                            }
                    }
                    else
                    {
                        me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                        me->DisappearAndDie();
                        me->DespawnOrUnsummon(1);
                        return;
                    }
                }
            }

            if (despawnTimer)
            {
                if (despawnTimer >= 5000)
                {
                    despawnTimer = 0;
                    me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                    me->DisappearAndDie();
                    me->DespawnOrUnsummon(1);
                    return;
                }
                else
                    despawnTimer += diff;
            }

            VehicleAI::UpdateAI(diff);
        }