// // InPacket.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using NosSmooth.Packets.Attributes; using NosSmooth.Packets.Common; using NosSmooth.Packets.Enums; namespace NosSmooth.Packets.Packets.Server.Entities; /// /// There is a new entity on the map present. /// /// The type of the entity. /// The name of the entity, present only for players. /// The vnum of the entity, present only for non players. /// Unknown value present only for players. It's always "-". /// The id of the entity. /// The x coordinate the entity is at. /// The y coordinate the entity is at. /// The direction the entity is looking, present only for non-objects. /// The player data sub packet present only for players. /// The item data sub packet present only for objects. /// The non player data sub packet present only for npcs and monsters. [PacketHeader("in", PacketSource.Server)] [GenerateSerializer] public record InPacket ( [PacketIndex(0)] EntityType EntityType, [PacketConditionalIndex(1, "EntityType", false, EntityType.Player)] NameString? Name, [PacketConditionalIndex(2, "EntityType", true, EntityType.Player)] long? VNum, [PacketConditionalIndex(3, "EntityType", false, EntityType.Player)] string? Unknown, [PacketIndex(4)] long EntityId, [PacketIndex(5)] short PositionX, [PacketIndex(6)] short PositionY, [PacketConditionalIndex(7, "EntityType", true, EntityType.Object)] byte Direction, [PacketConditionalIndex(8, "EntityType", false, EntityType.Player, InnerSeparator = ' ')] InPlayerSubPacket? PlayerSubPacket, [PacketConditionalIndex(9, "EntityType", false, EntityType.Object, InnerSeparator = ' ')] InItemSubPacket? ItemSubPacket, [PacketConditionalIndex(10, "EntityType", true, EntityType.Player, EntityType.Object, InnerSeparator = ' ')] InNonPlayerSubPacket? NonPlayerSubPacket ) : IPacket;