public override void SendMeTo(Player Plr) { List <byte> TmpState = new List <byte>(); if (QtsInterface.CreatureHasStartQuest(Plr)) { TmpState.Add(5); } else if (QtsInterface.CreatureHasQuestToComplete(Plr)) { TmpState.Add(7); } PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16((UInt16)Heading); Out.WriteUInt16((UInt16)WorldPosition.Z); Out.WriteUInt32((UInt32)WorldPosition.X); Out.WriteUInt32((UInt32)WorldPosition.Y); Out.WriteUInt16(0); // Speed Z // 18 Out.WriteUInt16(Spawn.Proto.Model1); Out.WriteByte((byte)Spawn.Proto.MinScale); Out.WriteByte(Spawn.Proto.MinLevel); Out.WriteByte(Faction); Out.Fill(0, 4); Out.WriteByte(Spawn.Emote); Out.WriteByte(0); // ? Out.WriteUInt16(Spawn.Proto._Unks[1]); Out.WriteByte(0); Out.WriteUInt16(Spawn.Proto._Unks[2]); Out.WriteUInt16(Spawn.Proto._Unks[3]); Out.WriteUInt16(Spawn.Proto._Unks[4]); Out.WriteUInt16(Spawn.Proto._Unks[5]); Out.WriteUInt16(Spawn.Proto._Unks[6]); Out.WriteUInt16(Spawn.Title); Out.WriteByte((byte)(Spawn.bBytes.Length + States.Count + TmpState.Count)); Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length); Out.Write(States.ToArray(), 0, States.Count); Out.Write(TmpState.ToArray(), 0, TmpState.Count); Out.WriteByte(0); Out.WriteStringBytes(Name); Out.WriteByte(0); // ? Out.WriteByte(1); // ? Out.WriteByte(10); // ? Out.WriteByte(0); // ? Out.WriteUInt16(0); // ? Out.WriteByte(Spawn.Icone); Out.WriteByte((byte)Spawn.Proto._Unks[0]); Out.WriteByte(0); Out.Fill(0, 8); // Flags; Out.WriteByte(100); // Health % Out.WriteUInt16(Zone.ZoneId); Out.Fill(0, 48); Plr.SendPacket(Out); base.SendMeTo(Plr); }
public override void SendMeTo(Player Plr) { //Log.Success("Creature", "SendMe " + Name); PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16((UInt16)Heading); Out.WriteUInt16((UInt16)WorldPosition.Z); Out.WriteUInt32((UInt32)WorldPosition.X); Out.WriteUInt32((UInt32)WorldPosition.Y); Out.WriteUInt16(0); // Speed Z // 18 Out.WriteUInt16(Spawn.Proto.Model1); Out.WriteByte((byte)Spawn.Proto.MinScale); Out.WriteByte(Level); Out.WriteByte(Faction); Out.Fill(0, 4); Out.WriteByte(Spawn.Emote); Out.WriteByte(0); // ? Out.WriteUInt16(Spawn.Proto._Unks[1]); Out.WriteByte(0); Out.WriteUInt16(Spawn.Proto._Unks[2]); Out.WriteUInt16(Spawn.Proto._Unks[3]); Out.WriteUInt16(Spawn.Proto._Unks[4]); Out.WriteUInt16(Spawn.Proto._Unks[5]); Out.WriteUInt16(Spawn.Proto._Unks[6]); Out.WriteUInt16(Spawn.Title); long TempPos = Out.Position; byte TempLen = (byte)(Spawn.bBytes.Length + States.Count); Out.WriteByte(TempLen); Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length); Out.Write(States.ToArray(), 0, States.Count); if (QtsInterface.CreatureHasStartQuest(Plr)) { Out.WriteByte(5); Out.Position = TempPos; Out.WriteByte((byte)(TempLen + 1)); } else if (QtsInterface.CreatureHasQuestToAchieve(Plr)) { Out.WriteByte(4); Out.Position = TempPos; Out.WriteByte((byte)(TempLen + 1)); } else if (QtsInterface.CreatureHasQuestToComplete(Plr)) { Out.WriteByte(7); Out.Position = TempPos; Out.WriteByte((byte)(TempLen + 1)); } Out.Position = Out.Length; Out.WriteByte(0); Out.WriteStringBytes(Name); Out.Fill(0, 48); Plr.SendPacket(Out); base.SendMeTo(Plr); }
public override void SendMeTo(Player Plr) { // Log.Success("Creature", "SendMe " + Name); //Log.Info("Creature", "npc = " + Name + " Oid = " + Oid + " X= " + Spawn.WorldX + " Y= " + Spawn.WorldY + " Z= " + Spawn.WorldZ); PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16((UInt16)Heading); Out.WriteUInt16((UInt16)WorldPosition.Z); Out.WriteUInt32((UInt32)WorldPosition.X); Out.WriteUInt32((UInt32)WorldPosition.Y); Out.WriteUInt16(0); // Speed Z // 18 if (Spawn.Proto.Model2 != 0) { if (RandomMgr.Next(0, 100) < 50) { Out.WriteUInt16(Spawn.Proto.Model2); } else { Out.WriteUInt16(Spawn.Proto.Model1); } } else { Out.WriteUInt16(Spawn.Proto.Model1); } Out.WriteByte((byte)RandomMgr.Next(Spawn.Proto.MinScale, Spawn.Proto.MaxScale)); Out.WriteByte(Level); Out.WriteByte(Faction); Out.WriteByte(0); Out.WriteByte(Spawn.Val); Out.WriteUInt16(0); Out.WriteByte(Spawn.Emote); Out.WriteByte(0); // ? Out.WriteUInt16(Spawn.Proto._Unks[1]); Out.WriteByte(0); Out.WriteUInt16(Spawn.Proto._Unks[2]); Out.WriteUInt16(Spawn.Proto._Unks[3]); Out.WriteUInt16(Spawn.Proto._Unks[4]); Out.WriteUInt16(Spawn.Proto._Unks[5]); Out.WriteUInt16(Spawn.Proto._Unks[6]); Out.WriteUInt16(Spawn.Title); long TempPos = Out.Position; byte TempLen = (byte)(Spawn.bBytes.Length + States.Count); Out.WriteByte(TempLen); Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length); Out.Write(States.ToArray(), 0, States.Count); if (QtsInterface.CreatureHasStartQuest(Plr)) { Out.WriteByte(5); Out.Position = TempPos; Out.WriteByte((byte)(TempLen + 1)); } else if (QtsInterface.CreatureHasQuestToAchieve(Plr)) { Out.WriteByte(4); Out.Position = TempPos; Out.WriteByte((byte)(TempLen + 1)); } else if (QtsInterface.CreatureHasQuestToComplete(Plr)) { Out.WriteByte(7); Out.Position = TempPos; Out.WriteByte((byte)(TempLen + 1)); } Out.Position = Out.Length; Out.WriteByte(0); Out.WriteStringBytes(Name); Out.WriteByte(Spawn.D1); Out.WriteByte(Spawn.D2); Out.WriteUInt16(0); //00 00 Out.WriteUInt16(0); // 00 00 Out.WriteByte(Spawn.Unk1); Out.WriteByte(0); Out.WriteByte(48); Out.WriteByte(0x01); Out.WriteByte(0x0A); Out.WriteUInt16(0); Out.WriteByte(0); Out.WriteByte(Spawn.Icone); Out.WriteByte((byte)Spawn.Proto._Unks[0]); Out.WriteByte(0); Out.WriteUInt16(Oid); Out.WriteUInt32((UInt32)Spawn.Flag); Out.WriteUInt16((UInt16)Spawn.WorldZ); Out.WriteByte(100); Out.WriteUInt16(Spawn.ZoneId); Out.WriteUInt32(0); Out.WriteByte(Spawn.Head0); Out.WriteUInt16R((UInt16)Heading); Out.WriteUInt16(Oid); Out.WriteByte(0); Out.WriteByte(7); Plr.SendPacket(Out); Out = new PacketOut((byte)Opcodes.F_PLAY_SOUND); Out.WriteByte(0); Out.WriteUInt32((UInt32)Spawn.Sound1); Out.WriteUInt32((UInt32)Spawn.Flag); Out.WriteUInt16((UInt16)Spawn.WorldZ); Out.WriteUInt16(0); Plr.SendPacket(Out); Out = new PacketOut((byte)Opcodes.F_PLAY_SOUND); Out.WriteByte(0); Out.WriteUInt32((UInt32)Spawn.Sound2); Out.WriteUInt32((UInt32)Spawn.Flag); Out.WriteUInt16((UInt16)Spawn.WorldZ); Out.WriteUInt16(0); Plr.SendPacket(Out); base.SendMeTo(Plr); }