Ejemplo n.º 1
0
        bool CheckPlayersInDistance()
        {
            bool returnValue = false;

            if (me->GetMap())
            {
                Map::PlayerList const& players = me->GetMap()->GetPlayers();

                if (me->GetMap()->IsDungeon() && !players.isEmpty())
                {
                    for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
                    {
                        Player* player = itr->getSource();

                        // Only apply to attackable, alive and in 70.0 yards players
                        if (player && !player->isGameMaster() && player->isAlive() && me->IsValidAttackTarget(player))
                        {
                            if (player->GetDistance(CenterPoint) <= 70.0f)
                                returnValue = true;

                            // In combat with that player, check, that player does not get too far away
                            if (DoGetThreat(player))
                            {
                                if (player->GetDistance(CenterPoint) > 40.0f)
                                {
                                    player->NearTeleportTo(CenterPoint.GetPositionX(), CenterPoint.GetPositionY(), CenterPoint.GetPositionZ(), CenterPoint.GetOrientation());
                                }
                            }
                        }
                    }
                }
            }

            return returnValue;
        }
Ejemplo n.º 2
0
            void IsSummonedBy(Unit* owner)
            {
                if (owner->GetTypeId() != TYPEID_UNIT)
                    return;

                Creature* creOwner = owner->ToCreature();
                Position pos;
                // random target case
                if (owner->HasAura(SPELL_BONE_STORM))
                {
                    if (MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, creOwner->AI()))
                    {
                        Position const* ownerPos = marrowgarAI->GetLastColdflamePosition();
                        float ang = me->GetAngle(ownerPos) - static_cast<float>(M_PI);
                        me->SetOrientation(ang);
                        owner->GetNearPosition(pos, 2.5f, 0.0f);
                    }
                }
                else
                {
                    Player* target = ObjectAccessor::GetPlayer(*owner, owner->GetAI()->GetGUID(DATA_COLDFLAME_GUID));
                    if (!target)
                    {
                        me->DespawnOrUnsummon();
                        return;
                    }

                    me->SetOrientation(owner->GetAngle(target));
                    owner->GetNearPosition(pos, owner->GetObjectSize() / 2.0f, 0.0f);
                }

                me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
            }
Ejemplo n.º 3
0
void Vehicle::Relocate(Position pos)
{
    sLog->outDebug(LOG_FILTER_VEHICLES, "Vehicle::Relocate %u", _me->GetEntry());

    std::set<Unit*> vehiclePlayers;
    for (int8 i = 0; i < 8; i++)
        vehiclePlayers.insert(GetPassenger(i));

    // passengers should be removed or they will have movement stuck
    RemoveAllPassengers();

    for (std::set<Unit*>::const_iterator itr = vehiclePlayers.begin(); itr != vehiclePlayers.end(); ++itr)
    {
        if (Unit* plr = (*itr))
        {
            // relocate/setposition doesn't work for player
            plr->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
            //plr->TeleportTo(pPlayer->GetMapId(), triggerPos.GetPositionX(), triggerPos.GetPositionY(), triggerPos.GetPositionZ(), triggerPos.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);
        }
    }

    _me->UpdatePosition(pos, true);
    // problems, and impossible to do delayed enter
    //pPlayer->EnterVehicle(veh);
}
        void AttackStart(Unit* attacker)
        {
            if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE)
                return;

            // we do this checks to see if the creature is one of the creatures that sorround the boss
            if (Creature* colossus = Unit::GetCreature(*me, instance ? instance->GetData64(DATA_DRAKKARI_COLOSSUS) : 0))
            {
                Position homePosition;
                me->GetHomePosition().GetPosition(&homePosition);

                Position colossusHomePosition;
                colossus->GetHomePosition().GetPosition(&colossusHomePosition);

                float distance = homePosition.GetExactDist(colossusHomePosition.GetPositionX(),colossusHomePosition.GetPositionY(),colossusHomePosition.GetPositionZ());

                if (distance < 12.0f)
                {
                    MoveMojos(colossus);
                    me->SetReactState(REACT_PASSIVE);
                }
                else
                    ScriptedAI::AttackStart(attacker);
            }
        }
Ejemplo n.º 5
0
bool AreaTrigger::CreateAreaTrigger(uint32 guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos)
{
    SetMap(caster->GetMap());
    Relocate(pos);
    if (!IsPositionValid())
    {
        TC_LOG_ERROR("misc", "AreaTrigger (spell %u) not created. Invalid coordinates (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY());
        return false;
    }

    WorldObject::_Create(guidlow, HIGHGUID_AREATRIGGER, caster->GetPhaseMask());

    SetEntry(triggerEntry);
    SetDuration(spell->GetDuration());
    SetObjectScale(1);

    SetUInt32Value(AREATRIGGER_SPELLID, spell->Id);
    SetUInt32Value(AREATRIGGER_SPELLVISUALID, spell->SpellVisual[0]);
    SetUInt32Value(AREATRIGGER_DURATION, spell->GetDuration());
    SetFloatValue(AREATRIGGER_FINAL_POS + 0, pos.GetPositionX());
    SetFloatValue(AREATRIGGER_FINAL_POS + 1, pos.GetPositionY());
    SetFloatValue(AREATRIGGER_FINAL_POS + 2, pos.GetPositionZ());

    if (!GetMap()->AddToMap(this))
        return false;

    return true;
}
Ejemplo n.º 6
0
        void SpawnAdds()
        {
            uint8 u = 0;

            for (uint8 i = 0; i < 30; ++i)
            {
                Position pos;
                me->GetPosition(&pos);
                me->GetRandomNearPosition(pos, 30.0f);
                pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;

                if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos))
                {
                    Creature* temp1 = trigger->FindNearestCreature(NPC_HEALTHY_MUSHROOM, 4.0f, true);
                    Creature* temp2 = trigger->FindNearestCreature(NPC_POISONOUS_MUSHROOM, 4.0f, true);
                    if (temp1 || temp2)
                    {
                        trigger->DisappearAndDie();
                    }
                    else
                    {
                        u = 1 - u;
                        trigger->DisappearAndDie();
                        me->SummonCreature(u > 0 ? NPC_POISONOUS_MUSHROOM : NPC_HEALTHY_MUSHROOM, pos, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60 * IN_MILLISECONDS);
                    }
                }
            }
        }
            void IsSummonedBy(Unit* owner) override
            {
                if (owner->GetTypeId() != TYPEID_UNIT)
                    return;

                Position pos;
                if (MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, owner->GetAI()))
                    pos.Relocate(marrowgarAI->GetLastColdflamePosition());
                else
                    pos.Relocate(owner);

                if (owner->HasAura(SPELL_BONE_STORM))
                {
                    float ang = Position::NormalizeOrientation(pos.GetAngle(me));
                    me->SetOrientation(ang);
                    owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetObjectSize(), ang);
                }
                else
                {
                    Player* target = ObjectAccessor::GetPlayer(*owner, owner->GetAI()->GetGUID(DATA_COLDFLAME_GUID));
                    if (!target)
                    {
                        me->DespawnOrUnsummon();
                        return;
                    }

                    float ang = Position::NormalizeOrientation(pos.GetAngle(target));
                    me->SetOrientation(ang);
                    owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetObjectSize(), ang);
                }

                me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                DoCast(SPELL_COLDFLAME_SUMMON);
                _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
            }
Ejemplo n.º 8
0
            TempSummon* SummonKrikThik(uint32 creatureId)
            {
                float angle = frand(0, 2*M_PI);
                float x = CenterPos.GetPositionX() + (RADIUS_CIRCLE * std::cos(angle));
                float y = CenterPos.GetPositionY() + (RADIUS_CIRCLE * std::sin(angle));

                return me->SummonCreature(creatureId, x, y, CenterPos.GetPositionZ());
            }
Ejemplo n.º 9
0
// uniformly distribute on the circle
static Position GetRandomPositionOnCircle(Position const& center, float radius)
{
    double angle = rand_norm() * 2.0 * M_PI;
    double relDistance = rand_norm() + rand_norm();
    if (relDistance > 1)
        relDistance = 1 - relDistance;
    return Position(center.GetPositionX() + std::sin(angle)*relDistance*radius, center.GetPositionY() + std::cos(angle)*relDistance*radius, center.GetPositionZ());
}
Ejemplo n.º 10
0
        void UpdateAI (const uint32 diff)
        {
            if (!UpdateVictim() || me->HasUnitState(UNIT_STAT_CASTING))
                return;

            if ((me->HealthBelowPct(69) && Phase == 0) || (me->HealthBelowPct(34) && Phase == 1))
            {
                Phase++;

                // Switch Position with a random Shadow of Obsidius and empty Threat list

                Creature* target = ShadowOfObsidiusList[urand(0, RAID_MODE(1, 2))];
                Position telePos;

                me->GetPosition(&telePos);

                // Switch Positions
                me->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0);
                target->NearTeleportTo(telePos.GetPositionX(), telePos.GetPositionY(), telePos.GetPositionZ(), 0);

                // Resetts Aggro
                me->getThreatManager().resetAllAggro();

                me->MonsterYell("Your kind has no place in the master's world.", LANG_UNIVERSAL, NULL);

                return;
            }

            events.Update(diff);

            while (uint32 eventId = events.ExecuteEvent())
            {
                switch (eventId)
                {
                case EVENT_THUNDERCLAP:
                    DoCastAOE(SPELL_THUNDERCLAP);
                    events.ScheduleEvent(EVENT_THUNDERCLAP, 7000);
                    break;

                case EVENT_TWILIGHT_CORRUPTION:
                    if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 200, true))
                        DoCast(pTarget, SPELL_TWILIGHT_CORRUPTION);

                    events.ScheduleEvent(EVENT_TWILIGHT_CORRUPTION, 10000);
                    break;

                case EVENT_STONE_BLOW:
                    DoCastVictim(SPELL_STONE_BLOW);
                    events.ScheduleEvent(EVENT_STONE_BLOW, 13000);
                    break;

                default:
                    break;
                }
            }

            DoMeleeAttackIfReady();
        }
Ejemplo n.º 11
0
 bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/)
 {
     player->GetMap()->LoadGrid(GuardSummonPos.GetPositionX(), GuardSummonPos.GetPositionY());
     if (InstanceScript* instance = player->GetInstanceScript())
         if (instance->GetBossState(DATA_ANUBREKHAN) != DONE)
             if (Creature* Anub = Unit::GetCreature(*player, instance->GetData64(DATA_ANUBREKHAN)))
                 Anub->AI()->DoAction(ACTION_INTRO);
     return true;
 }
Ejemplo n.º 12
0
 void SpawnMobs()
 {
     for (uint8 i = 0; i < DUNGEON_MODE(5,6); ++i)
     {
         switch (urand(0,2))
         {
         case 0:
             me->SummonCreature(CREATURE_YMIRJAR_WARRIOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
             break;
         case 1:
             me->SummonCreature(CREATURE_YMIRJAR_WITCH_DOCTOR, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
             break;
         case 2:
             me->SummonCreature(CREATURE_YMIRJAR_HARPOONER, SpawnLoc.GetPositionX()+rand()%5, SpawnLoc.GetPositionY()+rand()%5, SpawnLoc.GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
             break;
         }
     }
 }
void FleeingMovementGenerator<T>::SetTargetLocation(T* owner)
{
    if (!owner || !owner->IsAlive())
        return;

    if (owner->HasUnitState(UNIT_STATE_NOT_MOVE) || owner->IsMovementPreventedByCasting())
    {
        MovementGenerator::AddFlag(MOVEMENTGENERATOR_FLAG_INTERRUPTED);
        owner->StopMoving();
        _path = nullptr;
        return;
    }

    Position destination = owner->GetPosition();
    GetPoint(owner, destination);

    // Add LOS check for target point
    if (!owner->IsWithinLOS(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ()))
    {
        _timer.Reset(200);
        return;
    }

    if (!_path)
    {
        _path = std::make_unique<PathGenerator>(owner);
        _path->SetPathLengthLimit(30.0f);
    }

    bool result = _path->CalculatePath(destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ());
    if (!result || (_path->GetPathType() & PATHFIND_NOPATH))
    {
        _timer.Reset(100);
        return;
    }

    owner->AddUnitState(UNIT_STATE_FLEEING_MOVE);

    Movement::MoveSplineInit init(owner);
    init.MovebyPath(_path->GetPath());
    init.SetWalk(false);
    int32 traveltime = init.Launch();
    _timer.Reset(traveltime + urand(800, 1500));
}
Ejemplo n.º 14
0
    void SelectNextWaypoint(float& x, float& y)
    {
        if (direction)
            actualAngle -= M_PI / 8;
        else
            actualAngle += M_PI / 8;

        x = CenterPos.GetPositionX() + (me->GetObjectSize() + RADIUS_CIRCLE) * std::cos(actualAngle);
        y = CenterPos.GetPositionY() + (me->GetObjectSize() + RADIUS_CIRCLE) * std::sin(actualAngle);
    }
Ejemplo n.º 15
0
void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset) const
{
    float dx = endPos.GetPositionX() - GetPositionX();
    float dy = endPos.GetPositionY() - GetPositionY();

    retOffset.m_positionX = dx * std::cos(GetOrientation()) + dy * std::sin(GetOrientation());
    retOffset.m_positionY = dy * std::cos(GetOrientation()) - dx * std::sin(GetOrientation());
    retOffset.m_positionZ = endPos.GetPositionZ() - GetPositionZ();
    retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation());
}
Ejemplo n.º 16
0
            void PeriodicTick(constAuraEffectPtr aurEff)
            {
                if (!GetCaster())
                    return;

                count++;
                Position pos;
                GetCaster()->GetNearPosition(pos, 4.0f * count, 0.0f);
                GetCaster()->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SPELL_FLAME_BREATH_1, true);
            }
Ejemplo n.º 17
0
        void DoAction(const int32 actionId)
        {
            switch(actionId)
            {
                case ACTION_OUTRO:
                {
                    Position pos;
                    if (Creature* pIck = GetIck())
                    {
                        // TODO: tele on Ick then run some distance.
                        pIck->GetNearPosition(pos, 5.0f, 3.14f);
                        me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), 0.0f);
                    }
                    me->SetVisibility(VISIBILITY_ON);

                    Creature* pJainaOrSylvanas = me->GetCreature(*me, pInstance->GetData64(DATA_JAINA_SYLVANAS_1));
                    if (pJainaOrSylvanas) {
                        Position pos;
                        me->GetNearPosition(pos, 5.0f, 0);
                        pJainaOrSylvanas->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(),
                            pos.GetAngle(me->GetPositionX(), me->GetPositionY()));
                    }
                    else {
                        if (pInstance->GetData(DATA_TEAM_IN_INSTANCE) == TEAM_ALLIANCE)
                            pJainaOrSylvanas = me->SummonCreature(NPC_SYLVANAS_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN);
                        else
                            pJainaOrSylvanas = me->SummonCreature(NPC_JAINA_PART1, *me, TEMPSUMMON_MANUAL_DESPAWN);
                    }

                    if (pJainaOrSylvanas)
                    {
                        pJainaOrSylvanas->SetOrientation(pJainaOrSylvanas->GetAngle(me->GetPositionX(), me->GetPositionY()));
                        me->SetOrientation(me->GetAngle(pJainaOrSylvanas->GetPositionX(), pJainaOrSylvanas->GetPositionY()));
                        uiNpcOutroDialog = pJainaOrSylvanas->GetGUID();
                    }

                    phase = PHASE_OUTRO;
                    events.Reset();
                    events.ScheduleEvent(EVENT_OUTRO_1, 1000);
                    break;
                }
            }
        }
Ejemplo n.º 18
0
    void UpdateAI(const uint32 diff)
    {
        //Return since we have no target
        if (!UpdateVictim())
            return;

        if (uiSpawnTimer <= diff)
        {
            for (uint8 i = 0; i < urand(2,HEROIC(3,5)); ++i)
                DoSpawnCreature(RAND(NPC_DRAKKARI_INVADER_1,NPC_DRAKKARI_INVADER_2), AddSpawnPoint.GetPositionX(), AddSpawnPoint.GetPositionY(), AddSpawnPoint.GetPositionZ(), AddSpawnPoint.GetOrientation(), TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000);
            uiSpawnTimer = urand(30000,40000);
        } else uiSpawnTimer -= diff;

        if (uiConsumeTimer <= diff)
        {
            DoScriptText(SAY_CONSUME, m_creature);
            DoCast(HEROIC(SPELL_CONSUME, H_SPELL_CONSUME));
            uiConsumeTimer = 15000;
        } else uiConsumeTimer -= diff;

        if (bAchiev)
        {
            if (uiAuraCountTimer <= diff)
            {
                if (m_creature->HasAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME)))
                {
                    Aura *pConsumeAura = m_creature->GetAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME));
                    if (pConsumeAura && pConsumeAura->GetStackAmount() > 9)
                        bAchiev = false;
                }
                uiAuraCountTimer = 16000;
            } else uiAuraCountTimer -= diff;
        }

        if (uiCrushTimer <= diff)
        {
            DoCastVictim(SPELL_CRUSH);
            uiCrushTimer = urand(10000,15000);
        } else uiCrushTimer -= diff;

        if (uiInfectedWoundTimer <= diff)
        {
            DoCastVictim(SPELL_INFECTED_WOUND);
            uiInfectedWoundTimer = urand(25000,35000);
        } else uiInfectedWoundTimer -= diff;

        if (uiExplodeCorpseTimer <= diff)
        {
            DoCast(HEROIC(SPELL_CORPSE_EXPLODE, H_SPELL_CORPSE_EXPLODE));
            DoScriptText(SAY_EXPLODE, m_creature);
            uiExplodeCorpseTimer = urand(15000,19000);
        } else uiExplodeCorpseTimer -= diff;

        DoMeleeAttackIfReady();
    }
Ejemplo n.º 19
0
            void UpdateAI(uint32 diff) override
            {
                if (!UpdateVictim())
                    return;

                events.Update(diff);

                if (me->HasUnitState(UNIT_STATE_CASTING))
                    return;

                while (uint32 eventId = events.ExecuteEvent())
                {
                    switch (eventId)
                    {
                        case EVENT_SHADOWBOLT_VOLLEY:
                            DoCast(me, SPELL_SHADOWBOLT_VOLLEY);
                            events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, urand(15000, 30000));
                            break;
                        case EVENT_BANISH:
                            if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, false))
                                 DoCast(target, SPELL_BANISH);
                            events.ScheduleEvent(EVENT_BANISH, 16000);
                            break;
                        case EVENT_DRAW_SHADOWS:
                            {
                                Map::PlayerList const &PlayerList = me->GetMap()->GetPlayers();
                                for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
                                    if (Player* i_pl = i->GetSource())
                                        if (i_pl->IsAlive() && !i_pl->HasAura(SPELL_BANISH))
                                            i_pl->TeleportTo(me->GetMapId(), VorpilPosition.GetPositionX(), VorpilPosition.GetPositionY(), VorpilPosition.GetPositionZ(), VorpilPosition.GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT);

                                me->SetPosition(VorpilPosition);
                                DoCast(me, SPELL_DRAW_SHADOWS, true);
                                DoCast(me, SPELL_RAIN_OF_FIRE);
                                events.ScheduleEvent(EVENT_SHADOWBOLT_VOLLEY, 6000);
                                events.ScheduleEvent(EVENT_DRAW_SHADOWS, 30000);
                                break;
                            }
                        case EVENT_SUMMON_TRAVELER:
                            spawnVoidTraveler();
                            events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 10000);
                            // enrage at 20%
                            if (HealthBelowPct(20))
                                events.ScheduleEvent(EVENT_SUMMON_TRAVELER, 5000);
                            break;
                    }

                    if (me->HasUnitState(UNIT_STATE_CASTING))
                        return;
                }

                DoMeleeAttackIfReady();
            }
Ejemplo n.º 20
0
            void UpdateAI(uint32 diff) override
            {
                _events.Update(diff);

                if (_events.ExecuteEvent() == EVENT_COLDFLAME_TRIGGER)
                {
                    Position newPos = me->GetNearPosition(5.0f, 0.0f);
                    me->NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                    DoCast(SPELL_COLDFLAME_SUMMON);
                    _events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 500);
                }
            }
 /// @todo this should be handled in map, maybe add a summon function in map
 // There is no other way afaik...
 void SpawnGameObject(uint32 entry, Position const& pos)
 {
     GameObject* go = new GameObject();
     if (!go->Create(instance->GenerateLowGuid<HighGuid::GameObject>(), entry, instance,
         PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
         0, 0, 0, 0, 120, GO_STATE_READY))
     {
         delete go;
         return;
     }
     instance->AddToMap(go);
 }
Ejemplo n.º 22
0
    bool OnGossipSelect(Player* player, GameObject* /*go*/, uint32 sender, uint32 action)
    {
        player->PlayerTalkClass->ClearMenus();
        player->CLOSE_GOSSIP_MENU();

        if (action >= 4)
            return false;

        Position loc = blackrock_depths_locs[action];
        if (!player->isInCombat())
            player->NearTeleportTo(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation(), false);
        return true;
    }
        /// @todo this should be handled in map, maybe add a summon function in map
        // There is no other way afaik...
        void SpawnGameObject(uint32 entry, Position& pos)
        {
            GameObject* go = new GameObject;
            if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, instance,
                PHASEMASK_NORMAL, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(),
                0, 0, 0, 0, 120, GO_STATE_READY))
            {
                delete go;
                return;
            }

            instance->AddToMap(go);
        }
Ejemplo n.º 24
0
            void HandleDummy(SpellEffIndex effIndex)
            {
                PreventHitDefaultEffect(effIndex);
                if (Unit* target = GetHitUnit())
                {
                    Position pos;
                    target->GetFirstCollisionPosition(pos, 5.0f, M_PI);
                    GetCaster()->CastSpell(target, SPELL_GARROTE_DUMMY, true);
                    GetCaster()->RemoveAurasDueToSpell(SPELL_VANISH);
                    GetCaster()->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), target->GetOrientation());
                }

            }
Ejemplo n.º 25
0
            void UpdateAI(const uint32 diff)
            {
                events.Update(diff);

                if (events.ExecuteEvent() == EVENT_COLDFLAME_TRIGGER)
                {
                    Position newPos;
                    me->GetNearPosition(newPos, 5.5f, 0.0f);
                    me->NearTeleportTo(newPos.GetPositionX(), newPos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
                    DoCast(SPELL_COLDFLAME_SUMMON);
                    events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 200);
                }
            }
Ejemplo n.º 26
0
        void SpawnAdds()
        {
            summons.DespawnAll();
            Position center;
            center.Relocate(362.6f, -870, -75);

            for (uint8 i = 0; i < 25; ++i)
            {
                float orientation = 2*rand_norm()*M_PI;
                float x = center.GetPositionX() + i*2*cos(orientation);
                float y = center.GetPositionY() + i*2*sin(orientation);
                me->SummonCreature(NPC_POISONOUS_MUSHROOM, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT));
            }

            for (uint8 i = 0; i < 25; ++i)
            {
                float orientation = 2*rand_norm()*M_PI;
                float x = center.GetPositionX() + i*2*cos(orientation);
                float y = center.GetPositionY() + i*2*sin(orientation);
                me->SummonCreature(NPC_HEALTHY_MUSHROOM, x, y, me->GetMap()->GetHeight(x, y, MAX_HEIGHT));
            }
        }
Ejemplo n.º 27
0
            void HandleDummy(SpellEffIndex effIndex)
            {
                int32 damage = GetEffectValue();
                Spell* baseSpell = GetSpell();
                Position pos;
                Unit* caster = GetCaster();
                if (Unit* target = GetHitUnit())
                {
                    GetSummonPosition(effIndex, pos, 0.0f, 0);

                    if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
                        target->CastSpell(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), damage, true);
                }
            }
Ejemplo n.º 28
0
void AreaTrigger::UpdateCircularMovementPosition(uint32 /*diff*/)
{
    if (_circularMovementInfo->StartDelay > GetElapsedTimeForMovement())
        return;

    _circularMovementInfo->ElapsedTimeForMovement = GetElapsedTimeForMovement() - _circularMovementInfo->StartDelay;

    Position pos = CalculateCircularMovementPosition();

    GetMap()->AreaTriggerRelocation(this, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
#ifdef TRINITY_DEBUG
    DebugVisualizePosition();
#endif
}
Ejemplo n.º 29
0
            npc_eye_of_acherusAI(Creature* creature) : ScriptedAI(creature)
            {
                me->SetDisplayId(me->GetCreatureTemplate()->Modelid1);
                if (Player* owner = me->GetCharmerOrOwner()->ToPlayer())
                    owner->SendAutoRepeatCancel(me);

                me->SetReactState(REACT_PASSIVE);

                me->GetMotionMaster()->MovePoint(POINT_EYE_FALL, EyeOFAcherusFallPoint, false);

                Movement::MoveSplineInit init(me);
                init.MoveTo(EyeOFAcherusFallPoint.GetPositionX(), EyeOFAcherusFallPoint.GetPositionY(), EyeOFAcherusFallPoint.GetPositionZ(), false);
                init.SetFall();
                init.Launch();
            }
Ejemplo n.º 30
0
    void Reset()
    {
        nextMovementTimer = 0;
        actualAngle = me->GetAngle(CenterPos.GetPositionX(), CenterPos.GetPositionY());
        direction = urand(0, 1);

        if (direction)
            myPositionZ = 435.0f;
        else
            myPositionZ = 440.0f;

        // Enable Movements
        MovementInform(POINT_MOTION_TYPE, POINT_KRIKTHIK_CIRCLE);

        me->setActive(true);
    }