Exemple #1
0
        void HandleFlightSequence()
        {
            switch(FlightCount)
            {
            case 0:
                //me->AttackStop();
                sLog->outError("prevent fly phase");
                me->GetMotionMaster()->Clear(false);
                me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
                me->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT);
                me->StopMoving();
                DoScriptText(YELL_TAKEOFF, me);
                Timer[EVENT_FLIGHT_SEQUENCE] = 2000;
                break;
            case 1:
                sLog->outError("Move to Fly point");
                me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10);
                Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                break;
            case 2:
            {
                sLog->outError("Summon Vapor case 2");
                Unit* target;
                target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                if(!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID));
                if(target)
                {
                    Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
                    if(Vapor)
                    {
                        Vapor->AI()->AttackStart(target);
                        me->InterruptNonMeleeSpells(false);
                        me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                        Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
                    }
                }
                else
                {
                    //EnterEvadeMode();
                    //return;
                }
                Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                break;
            }
            case 3:
            {
                DespawnSummons(MOB_VAPOR_TRAIL);
                sLog->outError("Summon Vapor case3");
                //me->CastSpell(me, SPELL_VAPOR_SELECT); need core support
                Unit* target;
                target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                if(!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID));
                if(target)
                {
                    //target->CastSpell(target, SPELL_VAPOR_SUMMON, true); need core support
                    Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
                    if(Vapor)
                    {
                        Vapor->AI()->AttackStart(target);
                        me->InterruptNonMeleeSpells(false);
                        me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                        Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
                    }
                }
                else
                {
                    //EnterEvadeMode();
                    //return;
                }
                Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                break;
            }
            case 4:
                DespawnSummons(MOB_VAPOR_TRAIL);
                Timer[EVENT_FLIGHT_SEQUENCE] = 1;
                break;
            case 5:
            {
                //Unit* target;
                //target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                //if(!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID));
                //if(target)
                //{
                    //BreathX = target->GetPositionX();
                    //BreathY = target->GetPositionY();
                    float x, y, z;
                    //target->GetContactPoint(me, x, y, z, 70);
                    GetRandFlyPos(x,y,z);
                    me->GetMotionMaster()->MovePoint(0, x,y,z);
                    //if(rand()%2 == 0)
                    //    me->GetMotionMaster()->MovePoint(0, FLIGHT_1_X , FLIGHT_1_Y, FLIGHT_1_Z);
                    //else
                    //    me->GetMotionMaster()->MovePoint(0, FLIGHT_2_X , FLIGHT_2_Y, FLIGHT_2_Z);
                //}else
                //{
                //    EnterEvadeMode();
                //    return;
                //}
                Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                break;
            }
            case 6:
                //me->SetOrientation(me->GetAngle(BreathX, BreathY));
                me->SetOrientation(me->GetAngle(me->GetPositionX(), MIDDLE_Y));
                me->StopMoving();
                //DoTextEmote("takes a deep breath.", NULL);
                Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                break;
            case 7:
                me->CastSpell(me, SPELL_FOG_BREATH, true);
                {
                    float x, y, z;
                    GetNextFlyPos(x,y,z);
                    //me->GetPosition(x, y, z);
                    //x = 2 * BreathX - x;
                    //y = 2 * BreathY - y;
                    //if(me->GetPositionY() > 600)
                    //    me->GetMotionMaster()->MovePoint(0, FLIGHT_1_X , FLIGHT_1_Y, FLIGHT_1_Z);
                    //else
                    //    me->GetMotionMaster()->MovePoint(0, FLIGHT_2_X , FLIGHT_2_Y, FLIGHT_2_Z);
                    me->GetMotionMaster()->MovePoint(5, x,y,z);
                }
                Timer[EVENT_SUMMON_FOG] = 1;
                Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                break;
            case 8:
                me->RemoveAurasDueToSpell(SPELL_FOG_BREATH);
                BreathCount++;
                Timer[EVENT_SUMMON_FOG] = 0;
                Timer[EVENT_FLIGHT_SEQUENCE] = 1;
                if(BreathCount < 3) FlightCount = 5;
                break;
            case 9:
                if(Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
                {
                    float x, y, z;
                    target->GetContactPoint(me, x, y, z);
                    me->GetMotionMaster()->MovePoint(0, x, y, z);
                }
                else
                {
                    float x,y,z;

                    x = 1435;
                    y = MIDDLE_Y;
                    z = 0;
                    me->UpdateGroundPositionZ(x, y, z);
                    me->GetMotionMaster()->MovePoint(0, x, y, z);
                    //EnterEvadeMode();
                    //return;
                }
                Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                break;
            case 10:
                me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING + MOVEMENTFLAG_ONTRANSPORT);
                me->StopMoving();
                me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                EnterPhase(PHASE_GROUND);
                //me->AI()->AttackStart(SelectTarget(SELECT_TARGET_TOPAGGRO, 0));
                DoStartMovement(SelectTarget(SELECT_TARGET_TOPAGGRO, 0));
                break;
            default:
                break;
            }
            FlightCount++;
        }
Exemple #2
0
        void HandleFlightSequence()
        {
            switch (FlightCount)
            {
                case 0:
                    sLog->outError(LOG_FILTER_TSCR, "prevent fly phase");
                    me->GetMotionMaster()->Clear(false);
                    me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
                    me->SetUnitMovementFlags(MOVEMENTFLAG_DISABLE_GRAVITY + MOVEMENTFLAG_ONTRANSPORT);
                    me->StopMoving();
                    Talk(YELL_TAKEOFF);
                    Timer[EVENT_FLIGHT_SEQUENCE] = 2000;
                    break;
                case 1:
                    sLog->outError(LOG_FILTER_TSCR, "Move to Fly point");
                    me->GetMotionMaster()->MovePoint(0, me->GetPositionX()+1, me->GetPositionY(), me->GetPositionZ()+10);
                    Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                    break;
                case 2:
                {
                    sLog->outError(LOG_FILTER_TSCR, "Summon Vapor case 2");
                    Unit* target;
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                    if (!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID));
                    if (target)
                    {
                        Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
                        if (Vapor)
                        {
                            Vapor->AI()->AttackStart(target);
                            me->InterruptNonMeleeSpells(false);
                            me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                            Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
                        }
                    }
                    else
                        Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                    break;
                }
                case 3:
                {
                    DespawnSummons(MOB_VAPOR_TRAIL);
                    sLog->outError(LOG_FILTER_TSCR, "Summon Vapor case3");
                    Unit* target;
                    target = SelectTarget(SELECT_TARGET_RANDOM, 0, 150, true);
                    if (!target) target = Unit::GetUnit((*me), pInstance->GetData64(DATA_PLAYER_GUID));
                    if (target)
                    {
                        Creature* Vapor = me->SummonCreature(MOB_VAPOR, target->GetPositionX()-5+rand()%10, target->GetPositionY()-5+rand()%10, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 9000);
                        if (Vapor)
                        {
                            Vapor->AI()->AttackStart(target);
                            me->InterruptNonMeleeSpells(false);
                            me->CastSpell(Vapor, SPELL_VAPOR_CHANNEL, false); // core bug
                            Vapor->CastSpell(Vapor, SPELL_VAPOR_TRIGGER, true);
                        }
                    }
                    else
                        Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                    break;
                }
                case 4:
                    DespawnSummons(MOB_VAPOR_TRAIL);
                    Timer[EVENT_FLIGHT_SEQUENCE] = 1;
                    break;
                case 5:
                {
                    float x, y, z;
                    GetRandFlyPos(x,y,z);
                    me->GetMotionMaster()->MovePoint(0, x,y,z);
                    Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                    break;
                }
                case 6:
                    me->SetOrientation(me->GetAngle(me->GetPositionX(), MIDDLE_Y));
                    me->StopMoving();
                    Timer[EVENT_FLIGHT_SEQUENCE] = 10000;
                    break;
                case 7:
                    me->CastSpell(me, SPELL_FOG_BREATH, true);
                    {
                        float x, y, z;
                        GetNextFlyPos(x,y,z);
                        me->GetMotionMaster()->MovePoint(5, x, y, z);
                    }
                    Timer[EVENT_SUMMON_FOG] = 1;
                    Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                    break;
                case 8:
                    me->RemoveAurasDueToSpell(SPELL_FOG_BREATH);
                    BreathCount++;
                    Timer[EVENT_SUMMON_FOG] = 0;
                    Timer[EVENT_FLIGHT_SEQUENCE] = 1;
                    if (BreathCount < 3) FlightCount = 5;
                    break;
                case 9:
                    if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0))
                    {
                        float x, y, z;
                        target->GetContactPoint(me, x, y, z);
                        me->GetMotionMaster()->MovePoint(0, x, y, z);
                    }
                    else
                    {
                        float x,y,z;

                        x = 1435;
                        y = MIDDLE_Y;
                        z = 0;
                        me->UpdateGroundPositionZ(x, y, z);
                        me->GetMotionMaster()->MovePoint(0, x, y, z);
                    }
                    Timer[EVENT_FLIGHT_SEQUENCE] = 0;
                    break;
                case 10:
                    me->SetDisableGravity(true);
                    me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
                    EnterPhase(PHASE_GROUND);
                    DoStartMovement(SelectTarget(SELECT_TARGET_TOPAGGRO, 0));
                    break;
                default:
                    break;
            }
            FlightCount++;
        }