protected override void SendCreateMonster(Player plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER, 100 + Name.Length); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16(Heading); Out.WriteUInt16((ushort)WorldPosition.Z); Out.WriteUInt32((uint)WorldPosition.X); Out.WriteUInt32((uint)WorldPosition.Y); Out.WriteUInt16(0); // Speed Z // 18 if (Spawn.Proto.Model2 != 0) { Out.WriteUInt16(StaticRandom.Instance.Next(0, 100) < 50 ? Spawn.Proto.Model1 : Spawn.Proto.Model2); } else { Out.WriteUInt16(Spawn.Proto.Model1); } Out.WriteByte(Scale); 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.Proto.Title); // States region Out.WriteByte(1); Out.WriteByte(0x19); Out.WriteByte(0); // 47 Out.WriteCString(Name); Out.WriteUInt16(0x010A); // Fig leaf data Out.WriteByte(0); Out.WriteUInt16(Owner.Oid); // Need to write OBJECT_STATE length here long objStateLenPos = Out.Position; Out.WriteByte(0); Out.WriteByte(5); // F_PLAYER_INVENTORY length Out.WriteByte(0); // unk MvtInterface.WriteMovementState(Out); long latestPos = Out.Position; Out.Position = objStateLenPos; Out.WriteByte((byte)(latestPos - (objStateLenPos + 3))); Out.Position = latestPos; // F_PLAYER_INVENTORY Out.WriteUInt16(Oid); Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(0); plr.SendPacket(Out); }
protected override void SendCreateMonster(Player plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER, 110 + States.Count + (Name?.Length ?? Spawn.Proto.Name.Length)); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16(Heading); Out.WriteUInt16((ushort)WorldPosition.Z); Out.WriteUInt32((uint)WorldPosition.X); Out.WriteUInt32((uint)WorldPosition.Y); Out.WriteUInt16(0); // Speed Z Out.WriteUInt16(Spawn.Proto.Model1); Out.WriteByte(Scale); Out.WriteByte(Level); Out.WriteByte(Faction); Out.WriteByte(0); Out.WriteByte(SiegeInterface != null && SiegeInterface.IsDeployed ? (byte)1 : (byte)0); Out.Fill(0, 2); 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.Proto.Title); Out.WriteByte((byte)States.Count); Out.Write(States.ToArray(), 0, States.Count); Out.WriteByte(0); Out.WriteCString(Name ?? Spawn.Proto.Name); // Fig leaf data if (Spawn.Proto.CreatureType == (byte)GameData.CreatureTypes.SIEGE) { Out.Fill(0, 3); Out.WriteByte(0x8); // Player-placed Siege Out.WriteByte(0x1); Out.WriteByte(0x0A); } // End fig leaf data Out.WriteByte(0); Out.WriteUInt16(0); // Owner OID // Need to write OBJECT_STATE length here long objStateLenPos = Out.Position; Out.WriteByte(0); Out.WriteByte(5); // F_PLAYER_INVENTORY length Out.WriteByte(0); // unk MvtInterface.WriteMovementState(Out); long latestPos = Out.Position; Out.Position = objStateLenPos; Out.WriteByte((byte)(latestPos - (objStateLenPos + 3))); Out.Position = latestPos; // F_PLAYER_INVENTORY Out.WriteUInt16(Oid); Out.WriteByte(0); Out.WriteByte(0); Out.WriteByte(0); plr.SendPacket(Out); }