예제 #1
0
        public override void OnDie(Object Obj)
        {
            // Spawn the bad npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)135);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO  = Obj.Heading;
            Spawn.WorldY  = Obj.WorldPosition.Y;
            Spawn.WorldZ  = Obj.WorldPosition.Z;
            Spawn.WorldX  = Obj.WorldPosition.X;
            Spawn.ZoneId  = Obj.Zone.ZoneId;
            Spawn.Faction = 72;
            Spawn.Emote   = 53;

            Creature c = Obj.Region.CreateCreature(Spawn);

            //  The villager will be disposed in 20 secs
            c.EvtInterface.AddEvent(c.Destroy, 20000, 1);
        }
예제 #2
0
        public override void OnDie(Object Obj)
        {
            // Respawn the orginal npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)32);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Proto.Model1 = Obj.GetCreature().Spawn.Proto.Model1;
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO = O;
            Spawn.WorldY = Y;
            Spawn.WorldZ = Z;
            Spawn.WorldX = X;
            Spawn.ZoneId = Obj.Zone.ZoneId;
            //Spawn.Faction = 65;

            Creature c = Obj.Region.CreateCreature(Spawn);

            //  Set the new NPC to dead, there should be a method to do this perhaps.
            c.Health = 0;

            c.States.Add(3); // Death State

            PacketOut Out = new PacketOut((byte)Opcodes.F_OBJECT_DEATH);

            Out.WriteUInt16(c.Oid);
            Out.WriteByte(1);
            Out.WriteByte(0);
            Out.WriteUInt16(0);
            Out.Fill(0, 6);
            c.DispatchPacket(Out, true);

            //  Make it respawn
            //var prms = new List<object>() { c };

            //c.EvtInterface.AddEvent(TeleportToSpawnPlace, 29000 + c.Level * 1000, 1, prms);
            c.EvtInterface.AddEvent(c.RezUnit, 30000 + c.Level * 1000, 1); // 30 seconde Rez

            // Remove the old npc
            Obj.Destroy();

            return;
        }
예제 #3
0
        public override void OnInteract(Object Obj, Player Target, InteractMenu Menu)
        {
            // Make sure the player has the quest and hasn't already finished the objectives.
            if (!Target.GetPlayer().QtsInterface.HasQuest(30003) || Target.GetPlayer().QtsInterface.HasFinishQuest(30003))
            {
                return;
            }

            // Spawn the bad npc
            Creature_proto Proto = CreatureService.GetCreatureProto((uint)31);

            if (Proto == null)
            {
                return;
            }

            Obj.UpdateWorldPosition();

            Creature_spawn Spawn = new Creature_spawn();

            Spawn.Guid   = (uint)CreatureService.GenerateCreatureSpawnGUID();
            Proto.Model1 = Obj.GetCreature().Spawn.Proto.Model1;
            Proto.Model2 = Obj.GetCreature().Spawn.Proto.Model2;
            Spawn.BuildFromProto(Proto);
            Spawn.WorldO  = Obj.Heading;
            Spawn.WorldY  = Obj.WorldPosition.Y;
            Spawn.WorldZ  = Obj.WorldPosition.Z;
            Spawn.WorldX  = Obj.WorldPosition.X;
            Spawn.ZoneId  = Obj.Zone.ZoneId;
            Spawn.Faction = 129;

            Creature c = Obj.Region.CreateCreature(Spawn);

            c.EvtInterface.AddEventNotify(EventName.OnDie, RemoveAdds);

            // Remove the old npc
            Obj.Destroy();

            return;
        }