Code Monkey home page Code Monkey logo

Comments (3)

zTerragor avatar zTerragor commented on July 17, 2024

`/*######

npc_eye_of_acherus

######*/

enum EyeOfAcherus
{
DISPLAYID_EYE_HUGE = 26320,
DISPLAYID_EYE_SMALL = 25499,

SPELL_EYE_PHASEMASK         = 70889,
SPELL_EYE_VISUAL            = 51892,
SPELL_EYE_FL_BOOST_RUN      = 51923,
SPELL_EYE_FL_BOOST_FLY      = 51890,
SPELL_EYE_CONTROL           = 51852,

};

enum Texts
{
SAY_EYE_LAUNCHED = 1,
SAY_EYE_UNDER_CONTROL = 2,
};

//#define SAY_START "The Eye of Acherus launches towards its destination"
//#define SAY_STOP "The Eye of Acherus is in your control"

static Position Center[]= // played by eye on this, it's a floating position.
{
{ 2361.21f, -5660.45f, 496.7444f, 0.0f },
};

class npc_eye_of_acherus : public CreatureScript
{
public:
npc_eye_of_acherus() : CreatureScript("npc_eye_of_acherus") { }

CreatureAI* GetAI(Creature* creature) const
{
    return new npc_eye_of_acherusAI(creature);
}

struct npc_eye_of_acherusAI : public ScriptedAI
{
    npc_eye_of_acherusAI(Creature* creature) : ScriptedAI(creature)
    {
        Reset();
    }

    uint32 startTimer;
    bool IsActive;

    void Reset()
    {
        if (Unit* controller = me->GetCharmer())
            me->SetLevel(controller->getLevel());

            me->CastSpell(me, SPELL_EYE_FL_BOOST_FLY, true);
            me->SetDisplayId(DISPLAYID_EYE_HUGE);
            Talk(SAY_EYE_LAUNCHED);
            // Sniff calls for SMSG_MESSAGECHAT | Type: RaidBossWhisper (42) | Language: Universal (0).
            //me->MonsterSay(SAY_START, LANG_UNIVERSAL, 0);
            me->SetHomePosition(2361.21f, -5660.45f, 496.7444f, 0);
            me->GetMotionMaster()->MoveCharge(1758.007f, -5876.785f, 166.8667f, 0); //position center
            me->SetReactState(REACT_AGGRESSIVE);
            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_STUNNED);

        IsActive   = false;
        startTimer = 2000;
    }

    void AttackStart(Unit *) {}
    void MoveInLineOfSight(Unit *) {}

    void JustDied(Unit* /*killer*/)
    {
        if (Unit* charmer = me->GetCharmer())
           charmer->RemoveAurasDueToSpell(SPELL_EYE_CONTROL);
    }

    void UpdateAI(const uint32 diff)
    {
        if (me->isCharmed())
        {
            if (startTimer <=  diff && !IsActive)    // fly to start point
            {
                me->CastSpell(me, SPELL_EYE_PHASEMASK, true);
                me->CastSpell(me, SPELL_EYE_VISUAL, true);
                me->CastSpell(me, SPELL_EYE_FL_BOOST_FLY, true);

                me->CastSpell(me, SPELL_EYE_FL_BOOST_RUN, true);
                me->SetSpeed(MOVE_FLIGHT, 4.5f, true);
                me->GetMotionMaster()->MovePoint(0, 1758.0f, -5876.7f, 166.8f);
                return;
            }
            else
                startTimer -= diff;
        }
        else
            me->DespawnOrUnsummon();
    }

    void MovementInform(uint32 type, uint32 pointId)
    {
        if (type != POINT_MOTION_TYPE || pointId != 0)
           return;

        // this should never happen
        me->SetDisplayId(DISPLAYID_EYE_SMALL);

        // this spell does not work if casted before the wp movement.
        me->CastSpell(me, SPELL_EYE_VISUAL, true);
        me->CastSpell(me, SPELL_EYE_FL_BOOST_FLY, true);
        Talk(SAY_EYE_UNDER_CONTROL);
        //me->MonsterSay(SAY_STOP, LANG_UNIVERSAL, 0);
        ((Player*)(me->GetCharmer()))->SetClientControl(me, 1);
    }
};

};
`

from legends-of-azeroth-pandaria-5.4.8.

zTerragor avatar zTerragor commented on July 17, 2024

me->SetLevel(controller->getLevel()); - error in this row

from legends-of-azeroth-pandaria-5.4.8.

zTerragor avatar zTerragor commented on July 17, 2024
        if (me->isCharmed()) - and this

from legends-of-azeroth-pandaria-5.4.8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.