public static async Task OnPlayerMovePrototype(PacketHandlerContext c) { var request = new MSG_MOVE_GENERIC(c.Packet, c.Client.Build); var character = c.GetCharacter(); // Always trust the client (for now..) character.Position.X = request.MapX; character.Position.Y = request.MapY; character.Position.Z = request.MapZ; character.Position.Orientation = request.MapO; foreach (var client in c.World.Connections) { if (!client.IsInWorld) { continue; } if (client.CharacterId == c.Client.CharacterId) { continue; } // Put that in a queue and dont await it? await client.SendPacket(new MovementUpdate(character, request, c.Opcode, client.Build)); } }
public static Task OnPlayerMovePrototype(WorldClient client, byte[] data) { var request = new MSG_MOVE_GENERIC(data); // Always trust the client (for now..) client.Character.Position.X = request.MapX; client.Character.Position.Y = request.MapY; client.Character.Position.Z = request.MapZ; client.Character.Position.Orientation = request.MapO; return(Task.CompletedTask); }
public MovementUpdate(ulong characterId, MSG_MOVE_GENERIC original, Opcode opcode, int build) : base(opcode) { this.characterId = characterId; this.original = original; this.build = build; }