public static void AnimateCreature(Creature creature, byte animId) { var Out = new PacketOut((byte)Opcodes.F_ANIMATION); Out.WriteUInt16(creature.Oid); Out.WriteByte(0); Out.WriteByte(0); Out.WriteUInt16((ushort)animId); creature.DispatchPacket(Out, true); }
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; }