예제 #1
0
        /// <inheritdoc />
        protected override Task HandleSubMessage(IPeerMessageContext <PSOBBGamePacketPayloadClient> context, Sub60FinishedWarpAckCommand command)
        {
            //Clients do a full broadcast and we already know about this client
            //so we should just return
            if (PlayerCollection.ContainsId(command.Identifier))
            {
                return(Task.CompletedTask);
            }

            if (Logger.IsInfoEnabled)
            {
                Logger.Info($"Client broadcasted existence Id: {command.Identifier} ZoneId: {command.ZoneId}");
            }

            float   rotation = UnitScaler.ScaleYRotation(command.YAxisRotation);
            Vector3 position = UnitScaler.Scale(command.Position);

            //TODO: We should check the ZoneId being sent AND if we already know the player. We shouldn't but we should still verify
            PlayerFactory.CreateEntity(command.Identifier, position, Quaternion.AngleAxis(rotation, Vector3.up));

            return(Task.CompletedTask);
        }