コード例 #1
0
        void JustDied(Unit *pKiller)
        {
            if (!pKiller->ToPlayer())
                return;

            TempSummon *Spawn = NULL;
            switch (urand(0,4))
            {
            case 0:
                Spawn = me->SummonCreature(Gjalerbron_Sleep_Watcher,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,120*IN_MILLISECONDS);
                break;
            case 1:
                Spawn = me->SummonCreature(Gjalerbron_Warrior,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,120*IN_MILLISECONDS);
                break;
            case 2:
                Spawn = me->SummonCreature(Gjalerbron_Rune_Caster,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,120*IN_MILLISECONDS);
                break;
            default:
                me->SummonCreature(Freed_Winterhoof_Longrunner,me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation(),TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,20*IN_MILLISECONDS);
                pKiller->ToPlayer()->KilledMonsterCredit(Freed_Winterhoof_Longrunner, pKiller->ToPlayer()->GetGUID());
                break;
            }
            if (Spawn)
                Spawn->AI()->AttackStart(pKiller);
        }
コード例 #2
0
        void ActivateCrystal()
        {
            // just to make things easier we'll get the gameobject from the map
            GameObject* invoker = instance->GetGameObject(uiActivationCrystal[0]);
            if (!invoker)
                return;

            SpellInfo const* spellInfoLightning = sSpellMgr->GetSpellInfo(SPELL_ARCANE_LIGHTNING);
            if (!spellInfoLightning)
                return;

            // the orb
            TempSummon* trigger = invoker->SummonCreature(NPC_DEFENSE_SYSTEM, ArcaneSphere, TEMPSUMMON_MANUAL_DESPAWN, 0);
            if (!trigger)
                return;

            // visuals
            trigger->CastSpell(trigger, spellInfoLightning, true, 0, 0, trigger->GetGUID());

            // Kill all mobs registered with SetGuidData(ADD_TRASH_MOB)
            for (GuidSet::const_iterator itr = trashMobs.begin(); itr != trashMobs.end();)
            {
                Creature* creature = instance->GetCreature(*itr);
                // Increment the iterator before killing the creature because the kill will remove itr from trashMobs
                ++itr;
                if (creature && creature->IsAlive())
                    trigger->Kill(creature);
            }
        }
コード例 #3
0
ファイル: Vehicle.cpp プロジェクト: MICHAL53Q/TrinityCore
void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime)
{
    /// @Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
    if (_status == STATUS_UNINSTALLING)
    {
        TC_LOG_ERROR(LOG_FILTER_VEHICLES, "Vehicle (GuidLow: %u, DB GUID: %u, Entry: %u) attempts to install accessory (Entry: %u) on seat %d with STATUS_UNINSTALLING! "
            "Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(),
            (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : _me->GetGUIDLow()), GetCreatureEntry(), entry, (int32)seatId);
        return;
    }

    TC_LOG_DEBUG(LOG_FILTER_VEHICLES, "Vehicle (GuidLow: %u, DB Guid: %u, Entry %u): installing accessory (Entry: %u) on seat: %d",
        _me->GetGUIDLow(), (_me->GetTypeId() == TYPEID_UNIT ? _me->ToCreature()->GetDBTableGUIDLow() : _me->GetGUIDLow()), GetCreatureEntry(),
        entry, (int32)seatId);

    TempSummon* accessory = _me->SummonCreature(entry, *_me, TempSummonType(type), summonTime);
    ASSERT(accessory);

    if (minion)
        accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);

    (void)_me->HandleSpellClick(accessory, seatId);

    /// If for some reason adding accessory to vehicle fails it will unsummon in
    /// @VehicleJoinEvent::Abort
}
コード例 #4
0
 boss_kuai_the_brute_AI(Creature* creature) : BossAI(creature, BOSS_KUAI_THE_BRUTE)
 {
     TempSummon* sum = me->SummonCreature(CREATURE_MU_SHIBA, me->GetPositionX() + 3 * cos(M_PI / 4), me->GetPositionY() + 3 * sin(M_PI / 4), me->GetPositionZ(), me->GetOrientation());
     if (sum)
     {
         pet_guid = sum->GetGUID();
         sum->setFaction(me->getFaction());
     }
 }
コード例 #5
0
ファイル: zone_silithus.cpp プロジェクト: H4D3S/cataclysm
        void SummonNPC(GameObject* go, Player* player, uint32 npc, uint32 spell)
        {
            go->CastSpell(player, spell);
            TempSummon* summons = go->SummonCreature(npc, go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), player->GetOrientation() - M_PI, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 10 * 60 * 1000);
            summons->CastSpell(summons, SPELL_SPAWN_IN, false);
            switch (summons->GetEntry())
            {
                case NPC_TEMPLAR_FIRE:
                case NPC_TEMPLAR_WATER:
                case NPC_TEMPLAR_AIR:
                case NPC_TEMPLAR_EARTH:
                    summons->AI()->Talk(SAY_TEMPLAR_AGGRO);
                    break;

                case NPC_DUKE_FIRE:
                case NPC_DUKE_WATER:
                case NPC_DUKE_EARTH:
                case NPC_DUKE_AIR:
                    summons->AI()->Talk(SAY_DUKE_AGGRO);
                    break;
                case NPC_ROYAL_FIRE:
                case NPC_ROYAL_AIR:
                case NPC_ROYAL_EARTH:
                case NPC_ROYAL_WATER:
                    summons->AI()->Talk(YELL_ROYAL_AGGRO);
                    break;
            }
            summons->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            summons->SendMeleeAttackStart(player);
            summons->CombatStart(player);
        }
コード例 #6
0
 void SpawnPyramidWave(uint32 wave){
     for (int i = 0; i < pyramidSpawnTotal; i++)
     {
         if (pyramidSpawns[i][0] == (float)wave)
         {
             Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87f, 0};
             TempSummon* ts = instance->SummonCreature(uint32(pyramidSpawns[i][1]), pos);
             ts->GetMotionMaster()->MoveRandom(10);
             addsAtBase.push_back(ts->GetGUID());
         }
     }
 }
コード例 #7
0
            void OnPlayerEnter(Player* player)
            {
                if (!TeamInInstance)
                    TeamInInstance = player->GetTeam();

                if (_summonAlgalon)
                {
                    _summonAlgalon = false;
                    TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
                    if (_algalonTimer && _algalonTimer <= 60)
                        algalon->AI()->DoAction(ACTION_INIT_ALGALON);
                    else
                        algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
                }
            }
コード例 #8
0
        void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
        {
            if (me->HealthBelowPctDamaged(5, uiDamage))
            {
                if (lifei)
                {
                    lifei->UnSummon();
                    lifei = NULL;
                }

                uiDamage = 0;
                me->MonsterSay("I can't meditate!", LANG_UNIVERSAL, 0);
                me->SetFullHealth();
                me->SetReactState(REACT_DEFENSIVE);

                std::list<Creature*> unitlist;
                GetCreatureListWithEntryInGrid(unitlist, me, 59637, 50.0f);
                for (auto creature: unitlist)
                    me->Kill(creature);

                events.ScheduleEvent(EVENT_START, 20000);
                events.CancelEvent(EVENT_SPAWN_MOBS);
                events.CancelEvent(EVENT_PROGRESS);
                events.CancelEvent(EVENT_END);
            }
        }
コード例 #9
0
ファイル: instance_ulduar.cpp プロジェクト: Hlkz2/ACoreOld
        void OnPlayerEnter(Player* player)
        {
            if (!TeamInInstance)
                TeamInInstance = player->GetTeam();

            if (_summonAlgalon)
            {
                _summonAlgalon = false;
                TempSummon* algalon = instance->SummonCreature(NPC_ALGALON, AlgalonLandPos);
                if (_algalonTimer && _algalonTimer <= 60)
                    algalon->AI()->DoAction(ACTION_INIT_ALGALON);
                else
                    algalon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC);
            }

            // Keepers at Observation Ring
            if (GetBossState(BOSS_FREYA) == DONE && _summonObservationRingKeeper[0] && !KeeperGUIDs[0])
            {
                _summonObservationRingKeeper[0] = false;
                instance->SummonCreature(NPC_FREYA_OBSERVATION_RING, ObservationRingKeepersPos[0]);
            }
            if (GetBossState(BOSS_HODIR) == DONE && _summonObservationRingKeeper[1] && !KeeperGUIDs[1])
            {
                _summonObservationRingKeeper[1] = false;
                instance->SummonCreature(NPC_HODIR_OBSERVATION_RING, ObservationRingKeepersPos[1]);
            }
            if (GetBossState(BOSS_THORIM) == DONE && _summonObservationRingKeeper[2] && !KeeperGUIDs[2])
            {
                _summonObservationRingKeeper[2] = false;
                instance->SummonCreature(NPC_THORIM_OBSERVATION_RING, ObservationRingKeepersPos[2]);
            }
            if (GetBossState(BOSS_MIMIRON) == DONE && _summonObservationRingKeeper[3] && !KeeperGUIDs[3])
            {
                _summonObservationRingKeeper[3] = false;
                instance->SummonCreature(NPC_MIMIRON_OBSERVATION_RING, ObservationRingKeepersPos[3]);
            }

            // Keepers in Yogg-Saron's room
            if (_summonYSKeeper[0])
                instance->SummonCreature(NPC_FREYA_YS, YSKeepersPos[0]);
            if (_summonYSKeeper[1])
                instance->SummonCreature(NPC_HODIR_YS, YSKeepersPos[1]);
            if (_summonYSKeeper[2])
                instance->SummonCreature(NPC_THORIM_YS, YSKeepersPos[2]);
            if (_summonYSKeeper[3])
                instance->SummonCreature(NPC_MIMIRON_YS, YSKeepersPos[3]);
        }
コード例 #10
0
 void HandlePeriodic(AuraEffect const* /*eff*/)
 {
     TempSummon* me = GetTarget()->ToTempSummon();
     if (Creature* owner = me ? me->GetSummonerCreatureBase() : nullptr)
     {
         Unit* newTarget = owner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true);
         if (!newTarget)
             newTarget = owner->getAttackerForHelper();
         if (newTarget)
             me->GetMotionMaster()->MoveFollow(newTarget, 0.1f, 0.0f);
         else
         {
             me->StopMoving();
             me->GetMotionMaster()->Clear();
         }
     }
 }
コード例 #11
0
    void MoveInLineOfSight(Unit* pWho)
    {
        if (!pWho)
            return;

        if (Phase == IDLE && pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho) && m_creature->IsWithinDistInMap(pWho, 40))
        {
            Phase = INTRO;
            m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

            if (pArthas = m_creature->SummonCreature(CREATURE_ARTHAS, 295.81, -366.16, 92.57, 1.58, TEMPSUMMON_MANUAL_DESPAWN))
            {
                pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
                pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 5);
            }
        }
    }
コード例 #12
0
    void UpdateAI(const uint32 diff)
    {
        if (Phase != INTRO)
            return;

        if (uiIntroTimer <= diff)
        {
            if (!pArthas)
                return;

            switch (uiIntroPhase)
            {
                case 0:
                    DoScriptText(SAY_DIALOG_WITH_ARTHAS_1, m_creature);
                    ++uiIntroPhase;
                    uiIntroTimer = 3500;
                    break;
                case 1:
                    DoScriptText(SAY_DIALOG_OF_ARTHAS_1, pArthas);
                    ++uiIntroPhase;
                    uiIntroTimer = 3500;
                    break;
                case 2:
                    DoScriptText(SAY_DIALOG_WITH_ARTHAS_2, m_creature);
                    ++uiIntroPhase;
                    uiIntroTimer = 3500;
                    break;
                case 3:
                    DoScriptText(SAY_DIALOG_OF_ARTHAS_2, pArthas);
                    ++uiIntroPhase;
                    uiIntroTimer = 3500;
                    break;
                case 4:
                    DoScriptText(SAY_DIALOG_WITH_ARTHAS_3, m_creature);
                    DoCast(m_creature, SPELL_SVALA_TRANSFORMING1);
                    ++uiIntroPhase;
                    uiIntroTimer = 2800;
                    break;
                case 5:
                    DoCast(m_creature, SPELL_SVALA_TRANSFORMING2);
                    ++uiIntroPhase;
                    uiIntroTimer = 200;
                    break;
                case 6:
                    if (Creature* pSvalaSorrowgrave = m_creature->SummonCreature(CREATURE_SVALA_SORROWGRAVE, 296.632, -346.075, 90.6307, 1.58, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 60000))
                    {
                        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
                        m_creature->SetDisplayId(DATA_SVALA_DISPLAY_ID);
                        pArthas->UnSummon();
                        pArthas = NULL;
                        Phase = FINISHED;
                    }
                    else 
                        Reset();
                    break;
            }
        } else uiIntroTimer -= diff;
    }
コード例 #13
0
        void MoveInLineOfSight(Unit* who)
        {
            if (!who)
                return;

            if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40))
            {
                Phase = INTRO;
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                if (Creature* pArthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN))
                {
                    pArthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                    pArthas->SetFloatValue(OBJECT_FIELD_SCALE_X, 12);
                    uiArthasGUID = pArthas->GetGUID();
                }
            }
        }
コード例 #14
0
ファイル: boss_svala.cpp プロジェクト: 4m1g0/TrinityCore
        void MoveInLineOfSight(Unit* who)
        {
            if (!who)
                return;

            if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40))
            {
                Phase = INTRO;
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);

                if (GameObject* mirror = GetClosestGameObjectWithEntry(me, OBJECT_UTGARDE_MIRROR, 100.0f))
                    mirror->SetGoState(GO_STATE_READY);

                if (Creature* arthas = me->SummonCreature(CREATURE_ARTHAS, ArthasPos, TEMPSUMMON_MANUAL_DESPAWN))
                {
                    arthas->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
                    arthasGUID = arthas->GetGUID();
                }
            }
        }
コード例 #15
0
ファイル: spell_mage.cpp プロジェクト: Drasgon/WoD
            void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
            {
                std::list<Creature*> MinionList;
                GetTarget()->GetAllMinionsByEntry(MinionList, GetSpellInfo()->Effects[EFFECT_0].MiscValue);

                // Get the last summoned RoF, save it and despawn older ones
                for (std::list<Creature*>::iterator itr = MinionList.begin(); itr != MinionList.end(); itr++)
                {
                    TempSummon* summon = (*itr)->ToTempSummon();

                    if (ringOfFrost && summon)
                    {
                        if (summon->GetTimer() > ringOfFrost->GetTimer())
                        {
                            ringOfFrost->DespawnOrUnsummon();
                            ringOfFrost = summon;
                        }
                        else
                            summon->DespawnOrUnsummon();
                    }
                    else if (summon)
                        ringOfFrost = summon;
                }
            }
コード例 #16
0
ファイル: mounts.cpp プロジェクト: madisodr/legacy-core
        void OnDismount(Player* player, uint32 entry)
        {
            QueryResult result =  WorldDatabase.PQuery("SELECT summon_entry FROM mount_template WHERE entry='%u'", entry);

            std::cout << "\n" << entry << "\n";

            if(!result)
                return;

            Field* fields = result->Fetch();


            TempSummon* mount = player->SummonCreature(fields[0].GetUInt32(), player->GetPositionX() + 5, player->GetPositionY() + 5, player->GetPositionZ());

            player->setMountPlaced(mount);
            player->getMountPlaced()->GetMotionMaster()->MoveFollow(player, PET_FOLLOW_DIST, mount->GetFollowAngle());

        }
コード例 #17
0
        void UpdateAI(uint32 diff) override
        {
            events.Update(diff);
            while (uint32 eventId = events.ExecuteEvent())
            {
                switch(eventId)
                {
                case EVENT_START: //Begin script if playersInvolved is not empty
                {
                    updatePlayerList();
                    if (playersInvolved.empty())
                        events.ScheduleEvent(1, 600);
                    else
                    {
                        me->MonsterSay("Keep those creatures at bay while I meditate. We'll soon have the answers we seek...", LANG_UNIVERSAL, 0);
                        me->SetReactState(REACT_PASSIVE);
                        timer = 0;
                        events.ScheduleEvent(EVENT_SPAWN_MOBS, 5000); //spawn mobs
                        events.ScheduleEvent(EVENT_PROGRESS, 1000); //update time
                        events.ScheduleEvent(EVENT_END, 90000); //end quest
                    }
                    break;
                }
                case EVENT_SPAWN_MOBS: //Spawn 3 mobs
                {
                    updatePlayerList();
                    for(int i = 0; i < std::max((int)playersInvolved.size()*3,3); i++)
                    {
                        if (TempSummon* temp = me->SummonCreature(59637, 1144.55f, 3435.65f, 104.97f, 3.3f,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000))
                        {
                            if (temp->AI())
                                temp->AI()->AttackStart(me);

                            temp->AddThreat(me, 250.0f);
                            temp->GetMotionMaster()->Clear();
                            temp->GetMotionMaster()->MoveChase(me);
                        }
                    }
                    events.ScheduleEvent(EVENT_SPAWN_MOBS, 20000); //spawn mobs
                    break;
                }
                case EVENT_PROGRESS: //update energy
                {
                    timer++;

                    if (timer == 25 && !lifei)
                    {
                        if (lifei = me->SummonCreature(54856, 1130.162231f, 3435.905518f, 105.496597f, 0.0f,TEMPSUMMON_MANUAL_DESPAWN))
                            lifei->MonsterSay("The way of the Tushui... enlightenment through patience and mediation... the principled life", LANG_UNIVERSAL, 0);
                    }

                    if (timer == 30)
                        if (lifei)
                            lifei->MonsterSay("It is good to see you again, Aysa. You've come with respect, and so I shall give you the answers you seek.", LANG_UNIVERSAL, 0);

                    if (timer == 42)
                        if (lifei)
                            lifei->MonsterSay("Huo, the spirit of fire, is known for his hunger. He wants for tinder to eat. He needs the caress of the wind to rouse him.", LANG_UNIVERSAL, 0);

                    if (timer == 54)
                        if (lifei)
                            lifei->MonsterSay("If you find these things and bring them to his cave, on the far side of Wu-Song Village, you will face a challenge within.", LANG_UNIVERSAL, 0);

                    if (timer == 66)
                        if (lifei)
                            lifei->MonsterSay("Overcome that challenge, and you shall be graced by Huo's presence. Rekindle his flame, and if your spirit is pure, he shall follow you.", LANG_UNIVERSAL, 0);

                    if (timer == 78)
                        if (lifei)
                            lifei->MonsterSay("Go, children. We shall meet again very soon.", LANG_UNIVERSAL, 0);

                    if (timer == 85)
                    {
                        if (lifei)
                            lifei->UnSummon();

                        lifei = NULL;
                    }

                    updatePlayerList();
                    for (auto player: playersInvolved)
                    {
                        if (!player->HasAura(116421))
                            player->CastSpell(player, 116421);

                        player->ModifyPower(POWER_ALTERNATE_POWER, timer/25);
                        player->SetMaxPower(POWER_ALTERNATE_POWER, 90);
                    }

                    events.ScheduleEvent(EVENT_PROGRESS, 1000);
                    break;
                }
                case EVENT_END: //script end
                {
                    if (lifei)
                    {
                        lifei->UnSummon();
                        lifei = NULL;
                    }
                    events.ScheduleEvent(EVENT_START, 10000);
                    events.CancelEvent(EVENT_SPAWN_MOBS);
                    events.CancelEvent(EVENT_PROGRESS);
                    me->MonsterSay("And so our path lays before us. Speak to Master Shang Xi, he will tell you what comes next.", LANG_UNIVERSAL, 0);
                    updatePlayerList();
                    me->SetReactState(REACT_DEFENSIVE);
                    for(auto player: playersInvolved)
                    {
                        player->KilledMonsterCredit(54856, 0);
                        player->RemoveAura(116421);
                    }
                    break;
                }
                }
            }
        }
            void UpdateAI(const uint32 diff)
            {
                events.Update(diff);

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_TALK_LOREWALKER_DESPAWN:
                            me->ForcedDespawn();
                            break;
                        // This is the first speech when Lorewalker stonestep sees you for the first time.
                        case EVENT_INTRO_0:
                            Talk(EVENT_TALK_INTRO_0); //419621722
                            events.ScheduleEvent(EVENT_INTRO_1, 8019);
                            break;
                        case EVENT_INTRO_1:
                            Talk(EVENT_TALK_INTRO_1); //419629741
                            events.ScheduleEvent(EVENT_INTRO_2, 16162);
                            break;
                        case EVENT_INTRO_2:
                            Talk(EVENT_TALK_INTRO_2); //419645903
                            events.ScheduleEvent(EVENT_INTRO_3, 9578);
                            break;
                        case EVENT_INTRO_3:
                            Talk(EVENT_TALK_INTRO_3); //419655481
                            break;
                        // End of the first speech.

                        // TRIAL: Speech when the scroll is destroyed.
                        case EVENT_SUN_0:
                            me->RemoveAura(SPELL_ROOT_SELF);
                            Talk(EVENT_TALK_ZAO_APPEARS_0); //419667540
                            events.ScheduleEvent(EVENT_SUN_1, 9641);
                            break;
                        case EVENT_SUN_1:
                            Talk(EVENT_TALK_ZAO_APPEARS_1); //419677181
                            me->GetMotionMaster()->MovePoint(0, 838.033f, -2480.518f, 176.744f);
                            events.ScheduleEvent(EVENT_SUN_2, 811);
                            break;
                        case EVENT_SUN_2:
                            Talk(EVENT_TALK_ZAO_APPEARS_2); //419677992
                            me->GetMotionMaster()->MovePoint(0, 834.643f, -2490.361f, 179.897f);
                            events.ScheduleEvent(EVENT_SUN_3, 2792);
                            break;
                        case EVENT_SUN_3:
                            Talk(EVENT_TALK_ZAO_APPEARS_3); //419680784
                            me->SetFacingTo(1.239f);
                            instance->SetData(TYPE_SET_SUNS_SELECTABLE, 0);
                            events.ScheduleEvent(EVENT_SUN_4, 4214);
                            break;
                        case EVENT_SUN_4:
                            me->CastSpell(me, SPELL_MEDITATION, false);
                            Talk(EVENT_TALK_ZAO_APPEARS_4); //419722998
                            break;
                        // TRIAL: End of speech for destroyed scroll.

                        // ZAO: Speech when the scroll is destroyed.
                        case EVENT_STRIFE_0:
                            me->RemoveAura(SPELL_ROOT_SELF);
                            Talk(EVENT_TALK_STRIFE_0); //419667540
                            events.ScheduleEvent(EVENT_STRIFE_1, 9641);
                            break;
                        case EVENT_STRIFE_1:
                            Talk(EVENT_TALK_STRIFE_1); //419677181
                            me->GetMotionMaster()->MovePoint(0, 838.033f, -2480.518f, 176.744f);
                            events.ScheduleEvent(EVENT_STRIFE_2, 8011);
                            break;
                        case EVENT_STRIFE_2:
                            Talk(EVENT_TALK_STRIFE_2); //419677992
                            me->GetMotionMaster()->MovePoint(0, 834.643f, -2490.361f, 179.897f);
                            events.ScheduleEvent(EVENT_STRIFE_3, 5092);
                            break;
                        case EVENT_STRIFE_3:
                            {
                                Talk(EVENT_TALK_STRIFE_3); //419680784
                                me->SetFacingTo(1.239f);
                                events.ScheduleEvent(EVENT_STRIFE_4, 6014);
                                TempSummon* temp = me->SummonCreature(CREATURE_OSONG, 842.752f, -2468.911f, 174.959f);
                                if (!temp)
                                    break;
                                temp->setFaction(14);
                                temp->Attack(SelectTarget(SELECT_TARGET_RANDOM), true);
                                temp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                                temp->SetFacingTo(1.239f);
                                sCreatureTextMgr->SendChat(temp, 0, 0);
                            }
                            break;
                        case EVENT_STRIFE_4:
                            me->CastSpell(me, SPELL_MEDITATION, false);
                            Talk(EVENT_TALK_STRIFE_4); //419722998
                            events.ScheduleEvent(EVENT_TALK_LOREWALKER_DESPAWN, 3000);
                            break;
                        // ZAO: End of speech for destroyed scroll.
                    }
                }

            }
コード例 #19
0
ファイル: oculus.cpp プロジェクト: boom8866/azerothcore-wotlk
        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);
        }
コード例 #20
0
ファイル: Transport.cpp プロジェクト: Asandru/TrinityCore
TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSummonType summonType, SummonPropertiesEntry const* properties /*= NULL*/, uint32 duration /*= 0*/, Unit* summoner /*= NULL*/, uint32 spellId /*= 0*/, uint32 vehId /*= 0*/)
{
    Map* map = FindMap();
    if (!map)
        return NULL;

    uint32 mask = UNIT_MASK_SUMMON;
    if (properties)
    {
        switch (properties->Control)
        {
            case SUMMON_CATEGORY_PET:
                mask = UNIT_MASK_GUARDIAN;
                break;
            case SUMMON_CATEGORY_PUPPET:
                mask = UNIT_MASK_PUPPET;
                break;
            case SUMMON_CATEGORY_VEHICLE:
                mask = UNIT_MASK_MINION;
                break;
            case SUMMON_CATEGORY_WILD:
            case SUMMON_CATEGORY_ALLY:
            case SUMMON_CATEGORY_UNK:
            {
                switch (properties->Title)
                {
                    case SUMMON_TYPE_MINION:
                    case SUMMON_TYPE_GUARDIAN:
                    case SUMMON_TYPE_GUARDIAN2:
                        mask = UNIT_MASK_GUARDIAN;
                        break;
                    case SUMMON_TYPE_TOTEM:
                    case SUMMON_TYPE_LIGHTWELL:
                        mask = UNIT_MASK_TOTEM;
                        break;
                    case SUMMON_TYPE_VEHICLE:
                    case SUMMON_TYPE_VEHICLE2:
                        mask = UNIT_MASK_SUMMON;
                        break;
                    case SUMMON_TYPE_MINIPET:
                        mask = UNIT_MASK_MINION;
                        break;
                    default:
                        if (properties->Flags & 512) // Mirror Image, Summon Gargoyle
                            mask = UNIT_MASK_GUARDIAN;
                        break;
                }
                break;
            }
            default:
                return NULL;
        }
    }

    TempSummon* summon = nullptr;
    switch (mask)
    {
        case UNIT_MASK_SUMMON:
            summon = new TempSummon(properties, summoner, false);
            break;
        case UNIT_MASK_GUARDIAN:
            summon = new Guardian(properties, summoner, false);
            break;
        case UNIT_MASK_PUPPET:
            summon = new Puppet(properties, summoner);
            break;
        case UNIT_MASK_TOTEM:
            summon = new Totem(properties, summoner);
            break;
        case UNIT_MASK_MINION:
            summon = new Minion(properties, summoner, false);
            break;
    }

    float x, y, z, o;
    pos.GetPosition(x, y, z, o);
    CalculatePassengerPosition(x, y, z, &o);

    if (!summon->Create(map->GenerateLowGuid<HighGuid::Creature>(), map, entry, x, y, z, o, nullptr, vehId))
    {
        delete summon;
        return nullptr;
    }

    PhasingHandler::InheritPhaseShift(summon, summoner ? static_cast<WorldObject*>(summoner) : static_cast<WorldObject*>(this));

    summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellId);

    summon->SetTransport(this);
    summon->m_movementInfo.transport.guid = GetGUID();
    summon->m_movementInfo.transport.pos.Relocate(pos);
    summon->Relocate(x, y, z, o);
    summon->SetHomePosition(x, y, z, o);
    summon->SetTransportHomePosition(pos);

    /// @HACK - transport models are not added to map's dynamic LoS calculations
    ///         because the current GameObjectModel cannot be moved without recreating
    summon->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING);

    summon->InitStats(duration);

    if (!map->AddToMap<Creature>(summon))
    {
        delete summon;
        return nullptr;
    }

    _staticPassengers.insert(summon);

    summon->InitSummon();
    summon->SetTempSummonType(summonType);

    return summon;
}
コード例 #21
0
		void UpdateAI(uint32 diff)
		{
			if (wipe_timer <= diff)
			{
				if (me->GetInstanceScript() && me->GetInstanceScript()->GetData(TYPE_IS_WIPE))
				{
					me->GetInstanceScript()->SetData(TYPE_IS_WIPE, 1);
					wipe_timer = 2000;
				}
			}
			else
				wipe_timer -= diff;

			if (!UpdateVictim())
				return;

			events.Update(diff);

			if (me->GetHealthPct() < 70.f && status == PHASE_1)
			{
				me->AddAura(SPELL_JADE_ESSENCE, me);

				events.Reset();
				events.ScheduleEvent(EVENT_JADE_SERPENT_STRIKE, 5000);
				events.ScheduleEvent(EVENT_JADE_SERPENT_KICK, 10000);
				Talk(TALK_EVENT_01);
				status = PHASE_2;
			}
			if (me->GetHealthPct() < 30.f && status == PHASE_2)
			{
				events.Reset();
				events.ScheduleEvent(EVENT_SUMMON_YULON, 500);
				Talk(TALK_EVENT_02);
				status = PHASE_3;
			}

			while (uint32 eventId = events.ExecuteEvent())
			{
				switch (eventId)
				{
				case EVENT_SERPENT_STRIKE:
				{
					me->CastSpell(me->GetVictim(), SPELL_SERPENT_STRIKE, false);
					Map::PlayerList const& PlayerList = me->GetInstanceScript()->instance->GetPlayers();

					if (!PlayerList.isEmpty())
					{
						for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
						{
							Player* plr = i->GetSource();
							if (!plr)
								continue;
							if (plr->GetDistance2d(me) < 10.f)
								plr->KnockbackFrom(me->GetPositionX(), me->GetPositionY(), 10, 10);
						}
					}
					events.ScheduleEvent(EVENT_SERPENT_STRIKE, 10000);
					events.ScheduleEvent(EVENT_SERPENT_WAVE, 4000);
				}
				break;
				case EVENT_SERPENT_KICK:
					me->CastSpell(me->GetVictim(), SPELL_SERPENT_KICK, false);
					events.ScheduleEvent(EVENT_SERPENT_KICK, 10000);
					break;
				case EVENT_SERPENT_WAVE:
				{
					TempSummon* sum = nullptr;
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 932.775f, -2548.743f, 179.821f, 1.254f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 939.796f, -2530.586f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 940.014f, -2564.114f, 179.821f, 5.978f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 957.711f, -2570.030f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 925.971f, -2572.423f, 179.821f, 4.395f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 919.606f, -2591.245f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 918.923f, -2557.356f, 179.821f, 2.821f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 901.839f, -2551.843f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
				}
				break;
				case EVENT_JADE_SERPENT_STRIKE:
				{
					me->CastSpell(me->GetVictim(), SPELL_JADE_SERPENT_STRIKE, false);

					Map::PlayerList const& PlayerList = me->GetInstanceScript()->instance->GetPlayers();

					if (!PlayerList.isEmpty())
					{
						for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
						{
							Player* plr = i->GetSource();
							if (!plr)
								continue;
							if (plr->GetDistance2d(me) < 10.f)
								plr->KnockbackFrom(me->GetPositionX(), me->GetPositionY(), 10, 10);
						}
					}
					events.ScheduleEvent(EVENT_JADE_SERPENT_STRIKE, 10000);
					events.ScheduleEvent(EVENT_JADE_SERPENT_WAVE, 4000);
				}
				break;
				case EVENT_JADE_SERPENT_KICK:
					me->CastSpell(me->GetVictim(), SPELL_JADE_SERPENT_KICK, false);
					events.ScheduleEvent(EVENT_JADE_SERPENT_KICK, 10000);
					break;
				case EVENT_JADE_SERPENT_WAVE:
				{
					TempSummon* sum = nullptr;
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 932.775f, -2548.743f, 179.821f, 1.254f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 939.796f, -2530.586f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 940.014f, -2564.114f, 179.821f, 5.978f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 957.711f, -2570.030f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 925.971f, -2572.423f, 179.821f, 4.395f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 919.606f, -2591.245f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
					sum = me->SummonCreature(CREATURE_TRIGGER_WAVE, 918.923f, -2557.356f, 179.821f, 2.821f);
					if (sum)
					{
						sum->SetDisplayId(11686);
						sum->CastSpell(sum, SPELL_JADE_SERPENT_WAVE_VISUAL, false);
						sum->CastSpell(sum, SPELL_SERPENT_WAVE_PERIODIC, false);
						sum->GetMotionMaster()->MovePoint(0, 901.839f, -2551.843f, 179.941f);
						sum->DespawnOrUnsummon(3200);
					}
				}
				break;
				case EVENT_SUMMON_YULON:
					me->CastSpell(me, SPELL_SUMMON_JADE_SERPENT, false);
					me->CastSpell(me, SPELL_JADE_SOUL, false);
					me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
					me->ApplySpellImmune(SPELL_JADE_SOUL, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true);
					me->ApplySpellImmune(SPELL_JADE_SOUL, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true);
					me->SetReactState(REACT_PASSIVE);
					me->AddUnitState(UNIT_STATE_ROOT);
					events.ScheduleEvent(EVENT_AURA_JADE, 3000);
					break;

				case EVENT_AURA_JADE:
					me->CastSpell(me, SPELL_JADE_SOUL, false);
					events.ScheduleEvent(EVENT_AURA_JADE, 2500);
					break;
				}
			}

			DoMeleeAttackIfReady();
		}
コード例 #22
0
TempSummon* Transport::SummonPassenger(uint32 entry, Position const& pos, TempSummonType summonType, SummonPropertiesEntry const* properties /*= NULL*/, uint32 duration /*= 0*/, Unit* summoner /*= NULL*/, uint32 spellId /*= 0*/, uint32 vehId /*= 0*/)
{
    Map* map = FindMap();
    if (!map)
        return NULL;

    uint32 mask = UNIT_MASK_SUMMON;
    if (properties)
    {
        switch (properties->Category)
        {
            case SUMMON_CATEGORY_PET:
                mask = UNIT_MASK_GUARDIAN;
                break;
            case SUMMON_CATEGORY_PUPPET:
                mask = UNIT_MASK_PUPPET;
                break;
            case SUMMON_CATEGORY_VEHICLE:
                mask = UNIT_MASK_MINION;
                break;
            case SUMMON_CATEGORY_WILD:
            case SUMMON_CATEGORY_ALLY:
            case SUMMON_CATEGORY_UNK:
            {
                switch (properties->Type)
                {
                    case SUMMON_TYPE_MINION:
                    case SUMMON_TYPE_GUARDIAN:
                    case SUMMON_TYPE_GUARDIAN2:
                        mask = UNIT_MASK_GUARDIAN;
                        break;
                    case SUMMON_TYPE_TOTEM:
                    case SUMMON_TYPE_LIGHTWELL:
                        mask = UNIT_MASK_TOTEM;
                        break;
                    case SUMMON_TYPE_VEHICLE:
                    case SUMMON_TYPE_VEHICLE2:
                        mask = UNIT_MASK_SUMMON;
                        break;
                    case SUMMON_TYPE_MINIPET:
                        mask = UNIT_MASK_MINION;
                        break;
                    default:
                        if (properties->Flags & 512) // Mirror Image, Summon Gargoyle
                            mask = UNIT_MASK_GUARDIAN;
                        break;
                }
                break;
            }
            default:
                return NULL;
        }
    }

    uint32 phase = PHASEMASK_NORMAL;
    uint32 team = 0;
    if (summoner)
    {
        phase = summoner->GetPhaseMask();
        if (summoner->GetTypeId() == TYPEID_PLAYER)
            team = summoner->ToPlayer()->GetTeam();
    }

    TempSummon* summon = NULL;
    switch (mask)
    {
        case UNIT_MASK_SUMMON:
            summon = new TempSummon(properties, summoner, false);
            break;
        case UNIT_MASK_GUARDIAN:
            summon = new Guardian(properties, summoner, false);
            break;
        case UNIT_MASK_PUPPET:
            summon = new Puppet(properties, summoner);
            break;
        case UNIT_MASK_TOTEM:
            summon = new Totem(properties, summoner);
            break;
        case UNIT_MASK_MINION:
            summon = new Minion(properties, summoner, false);
            break;
    }

    float x, y, z, o;
    pos.GetPosition(x, y, z, o);
    CalculatePassengerPosition(x, y, z, &o);

    if (!summon->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, phase, entry, vehId, team, x, y, z, o))
    {
        delete summon;
        return NULL;
    }

    summon->SetUInt32Value(UNIT_CREATED_BY_SPELL, spellId);

    summon->SetTransport(this);
    summon->m_movementInfo.transport.guid = GetGUID();
    summon->m_movementInfo.transport.pos.Relocate(pos);
    summon->Relocate(x, y, z, o);
    summon->SetHomePosition(x, y, z, o);
    summon->SetTransportHomePosition(pos);

    /// @HACK - transport models are not added to map's dynamic LoS calculations
    ///         because the current GameObjectModel cannot be moved without recreating
    summon->AddUnitState(UNIT_STATE_IGNORE_PATHFINDING);

    summon->InitStats(duration);

    if (!map->AddToMap<Creature>(summon))
    {
        delete summon;
        return NULL;
    }

    _staticPassengers.insert(summon);

    summon->InitSummon();
    summon->SetTempSummonType(summonType);

    return summon;
}