#include "../include/sc_gossip.h" #include "../include/sc_creature.h" #include "../include/sc_instance.h" #include "../../../../game/Player.h" #include "../../../../game/World.h" #include "../../../../game/Object.h" #include "../../../../game/WorldSession.h" #define DISTANCE 1.0f struct MANGOS_DLL_DECL npc_teleAI : public ScriptedAI { npc_teleAI(Creature *c) : ScriptedAI(c) {Reset();} bool InCombat; void Reset() { m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } void AttackStart(Unit *who) { } void MoveInLineOfSight(Unit *who) { if (!who || who->GetTypeId() != TYPEID_PLAYER) return; if (m_creature->GetDistance2d(who) < DISTANCE) if (who->getLevel() >= 100) { ((Player*)who)->TeleportTo(0, -11087.809570f, -1785.962402f, 52.730453f, 1.634163f); } else { ((Player*)who)->GetSession()->SendAreaTriggerMessage( "You must be level 100 to enter! Begone you are not ready!!" ); } } void UpdateAI(const uint32 diff) { } }; CreatureAI* GetAI_npc_tele(Creature *_Creature) { return new npc_teleAI (_Creature); } void AddSC_npc_tele() { Script *newscript; newscript = new Script; newscript->Name="npc_tele"; newscript->GetAI = GetAI_npc_tele; m_scripts[nrscripts++] = newscript; }