Ejemplo n.º 1
0
        public override void HandleMessage(ClientStructure client, IClientMessageBase message)
        {
            var messageData = (AdminBaseMsgData)message.Data;

            if (!string.IsNullOrEmpty(GeneralSettings.SettingsStore.AdminPassword) && GeneralSettings.SettingsStore.AdminPassword == messageData.AdminPassword)
            {
                var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <AdminReplyMsgData>();
                switch (messageData.AdminMessageType)
                {
                case AdminMessageType.Ban:
                    var banMsg = (AdminBanMsgData)message.Data;
                    LunaLog.Debug($"{client.PlayerName}: Requested a ban against {banMsg.PlayerName}. Reason: {banMsg.Reason}");
                    msgData.Response = CommandHandler.Commands["ban"].Func($"{banMsg.PlayerName} {banMsg.Reason}") ? AdminResponse.Ok : AdminResponse.Error;
                    break;

                case AdminMessageType.Kick:
                    var kickMsg = (AdminKickMsgData)message.Data;
                    LunaLog.Debug($"{client.PlayerName}: Requested a kick against {kickMsg.PlayerName}. Reason: {kickMsg.Reason}");
                    msgData.Response = CommandHandler.Commands["kick"].Func($"{kickMsg.PlayerName} {kickMsg.Reason}") ? AdminResponse.Ok : AdminResponse.Error;
                    break;

                case AdminMessageType.Dekessler:
                    LunaLog.Debug($"{client.PlayerName}: Requested a dekessler");
                    CommandHandler.Commands["dekessler"].Func(null);
                    msgData.Response = AdminResponse.Ok;
                    break;

                case AdminMessageType.Nuke:
                    LunaLog.Debug($"{client.PlayerName}: Requested a nuke");
                    CommandHandler.Commands["nukeksc"].Func(null);
                    msgData.Response = AdminResponse.Ok;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                MessageQueuer.SendToClient <AdminSrvMsg>(client, msgData);
            }
            else
            {
                LunaLog.Warning($"{client.PlayerName}: Tried to run an admin command with an invalid password");

                var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <AdminReplyMsgData>();
                msgData.Response = AdminResponse.InvalidPassword;
                MessageQueuer.SendToClient <AdminSrvMsg>(client, msgData);
            }
        }
Ejemplo n.º 2
0
        private static void SendAllPlayerColors(ClientStructure client)
        {
            var sendColors = new Dictionary <string, string>();

            foreach (var otherClient in ClientRetriever.GetAuthenticatedClients().Where(c => !Equals(c, client) && c.PlayerColor != null))
            {
                sendColors[otherClient.PlayerName] = otherClient.PlayerColor;
            }

            var newMessageData = new PlayerColorReplyMsgData
            {
                Count         = sendColors.Count,
                PlayersColors = sendColors.ToArray()
            };

            MessageQueuer.SendToClient <PlayerColorSrvMsg>(client, newMessageData);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Send the craft folders that exist on the server
        /// </summary>
        public static void SendCraftFolders(ClientStructure client)
        {
            Task.Run(() =>
            {
                var msgData     = ServerContext.ServerMessageFactory.CreateNewMessageData <CraftLibraryFoldersReplyMsgData>();
                msgData.Folders = Directory.GetDirectories(CraftFolder)
                                  .Where(d => Directory.GetFiles(d, "*.craft", SearchOption.AllDirectories).Length > 0)
                                  .Select(d => new DirectoryInfo(d).Name).ToArray();

                msgData.NumFolders = msgData.Folders.Length;

                MessageQueuer.SendToClient <CraftLibrarySrvMsg>(client, msgData);
                if (msgData.NumFolders > 0)
                {
                    LunaLog.Debug($"Sending {msgData.NumFolders} craft folders to: {client.PlayerName}");
                }
            });
        }
Ejemplo n.º 4
0
        public override void HandleMessage(ClientStructure client, IClientMessageBase message)
        {
            //We don't use this message anymore so we can recycle it
            message.Recycle();

            var newMotd = GeneralSettings.SettingsStore.ServerMotd;

            if (newMotd.Length > 255)
            {
                newMotd = newMotd.Substring(0, 255); //We don't wanna send a huuuge message!
            }
            newMotd = newMotd.Replace("%Name%", client.PlayerName).Replace(@"\n", Environment.NewLine);

            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <MotdReplyMsgData>();

            msgData.MessageOfTheDay = newMotd;

            MessageQueuer.SendToClient <MotdSrvMsg>(client, msgData);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sends the requested screenshot
        /// </summary>
        public static void SendScreenshot(ClientStructure client, ScreenshotDownloadRequestMsgData data)
        {
            var file = Path.Combine(ScreenshotPath, data.FolderName, $"{data.DateTaken}.png");

            if (FileHandler.FileExists(file))
            {
                var contents = FileHandler.ReadFile(file);
                var msgData  = ServerContext.ServerMessageFactory.CreateNewMessageData <ScreenshotDataMsgData>();
                msgData.Screenshot.DateTaken  = data.DateTaken;
                msgData.Screenshot.Data       = contents;
                msgData.Screenshot.NumBytes   = msgData.Screenshot.Data.Length;
                msgData.Screenshot.Height     = LunaMath.UShortFromBytes(contents[18], contents[19]);
                msgData.Screenshot.Width      = LunaMath.UShortFromBytes(contents[22], contents[23]);
                msgData.Screenshot.FolderName = data.FolderName;

                LunaLog.Debug($"Sending screenshot ({ByteSize.FromBytes(msgData.Screenshot.NumBytes).KiloBytes}{ByteSize.KiloByteSymbol}): {data.DateTaken} to: {client.PlayerName}.");
                MessageQueuer.SendToClient <ScreenshotSrvMsg>(client, msgData);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Sends the screenshots in a folder
        /// </summary>
        public static void SendScreenshotList(ClientStructure client, ScreenshotListRequestMsgData data)
        {
            Task.Run(() =>
            {
                var screenshots = new List <ScreenshotInfo>();
                var folder      = Path.Combine(ScreenshotFolder, data.FolderName);

                var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <ScreenshotListReplyMsgData>();
                foreach (var file in Directory.GetFiles(folder).Where(f => Path.GetFileNameWithoutExtension(f).StartsWith(SmallFilePrefix)))
                {
                    if (long.TryParse(Path.GetFileNameWithoutExtension(file).Substring(SmallFilePrefix.Length), out var dateTaken))
                    {
                        if (data.AlreadyOwnedPhotoIds.Contains(dateTaken))
                        {
                            continue;
                        }

                        var bitmap   = new Bitmap(file);
                        var contents = File.ReadAllBytes(file);
                        screenshots.Add(new ScreenshotInfo
                        {
                            Data       = contents,
                            DateTaken  = dateTaken,
                            NumBytes   = contents.Length,
                            Height     = (ushort)bitmap.Height,
                            Width      = (ushort)bitmap.Width,
                            FolderName = data.FolderName,
                        });
                    }
                }

                msgData.FolderName     = data.FolderName;
                msgData.Screenshots    = screenshots.ToArray();
                msgData.NumScreenshots = screenshots.Count;

                MessageQueuer.SendToClient <ScreenshotSrvMsg>(client, msgData);
                if (msgData.NumScreenshots > 0)
                {
                    LunaLog.Debug($"Sending {msgData.NumScreenshots} ({data.FolderName}) screenshots to: {client.PlayerName}");
                }
            });
        }
Ejemplo n.º 7
0
        public void HandleChannelMessage(ClientStructure client, ChatChannelMsgData message)
        {
            if (message.SendToAll)
            {
                //send it to the player and send it to the other players too
                MessageQueuer.SendToAllClients <ChatSrvMsg>(message);
                LunaLog.ChatMessage($"{message.From} -> #Global: {message.Text}");
            }
            else //Is a channel message
            {
                //send it to the player
                MessageQueuer.SendToClient <ChatSrvMsg>(client, message);

                foreach (var player in GetClientsInChannel(message.Channel))
                {
                    MessageQueuer.SendToClient <ChatSrvMsg>(player, message);
                }
                LunaLog.ChatMessage($"{message.From} -> #{message.Channel}: {message.Text}");
            }
        }
        public static void SendHandshakeReply(ClientStructure client, HandshakeReply enumResponse, string reason)
        {
            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <HandshakeReplyMsgData>();

            msgData.Response = enumResponse;
            msgData.Reason   = reason;

            if (enumResponse == HandshakeReply.HandshookSuccessfully)
            {
                msgData.ModControl      = GeneralSettings.SettingsStore.ModControl;
                msgData.ServerStartTime = TimeContext.StartTime.Ticks;

                if (GeneralSettings.SettingsStore.ModControl)
                {
                    msgData.ModFileData = LunaXmlSerializer.SerializeToXml(ModFileSystem.ModControl);
                }
            }

            MessageQueuer.SendToClient <HandshakeSrvMsg>(client, msgData);
        }
Ejemplo n.º 9
0
        public static void SendHandshakeReply(ClientStructure client, HandshakeReply enumResponse, string reason)
        {
            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <HandshakeReplyMsgData>();

            msgData.Response = enumResponse;
            msgData.Reason   = reason;

            if (enumResponse == HandshakeReply.HandshookSuccessfully)
            {
                msgData.ModControl      = GeneralSettings.SettingsStore.ModControl;
                msgData.ServerStartTime = ServerContext.StartTime;

                if (GeneralSettings.SettingsStore.ModControl)
                {
                    msgData.ModFileData = FileHandler.ReadFileText(ServerContext.ModFilePath);
                }
            }

            MessageQueuer.SendToClient <HandshakeSrvMsg>(client, msgData);
        }
Ejemplo n.º 10
0
        private static void SendScenarioModules(ClientStructure client)
        {
            var scenarioDataArray = FileHandler.GetFilesInPath(Path.Combine(ServerContext.UniverseDirectory, "Scenarios", client.PlayerName))
                                    .Select(f =>
            {
                var data = FileHandler.ReadFile(f);
                return(new ScenarioInfo
                {
                    Data = data,
                    NumBytes = data.Length,
                    Module = Path.GetFileNameWithoutExtension(f)
                });
            }).ToArray();

            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <ScenarioDataMsgData>();

            msgData.ScenariosData = scenarioDataArray;
            msgData.ScenarioCount = scenarioDataArray.Length;

            MessageQueuer.SendToClient <ScenarioSrvMsg>(client, msgData);
        }
Ejemplo n.º 11
0
        public static void SendScenarioModules(ClientStructure client)
        {
            var scenarioDataArray = ScenarioStoreSystem.CurrentScenariosInXmlFormat.Keys.Select(s =>
            {
                var scenarioConfigNode = ScenarioStoreSystem.GetScenarioInConfigNodeFormat(s);
                var serializedData     = Encoding.UTF8.GetBytes(scenarioConfigNode);
                return(new ScenarioInfo
                {
                    Data = serializedData,
                    NumBytes = serializedData.Length,
                    Module = Path.GetFileNameWithoutExtension(s)
                });
            }).ToArray();

            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <ScenarioDataMsgData>();

            msgData.ScenariosData = scenarioDataArray;
            msgData.ScenarioCount = scenarioDataArray.Length;

            MessageQueuer.SendToClient <ScenarioSrvMsg>(client, msgData);
        }
Ejemplo n.º 12
0
        public void HandleRequestFileMessage(ClientStructure client, CraftLibraryRequestMsgData message)
        {
            var playerPath = Path.Combine(Path.Combine(ServerContext.UniverseDirectory, "Crafts"), message.CraftOwner);
            var typePath   = Path.Combine(playerPath, message.RequestedType.ToString());
            var craftFile  = Path.Combine(typePath, $"{message.RequestedName}.craft");

            var hasCraft = FileHandler.FolderExists(playerPath) && FileHandler.FolderExists(typePath) &&
                           FileHandler.FileExists(craftFile);

            if (hasCraft)
            {
                var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <CraftLibraryRespondMsgData>();
                msgData.CraftOwner    = message.CraftOwner;
                msgData.RequestedName = message.RequestedName;
                msgData.RequestedType = message.RequestedType;
                msgData.CraftData     = FileHandler.ReadFile(craftFile);
                msgData.NumBytes      = msgData.CraftData.Length;

                MessageQueuer.SendToClient <CraftLibrarySrvMsg>(client, msgData);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Sends the screenshots in a folder
        /// </summary>
        public static void SendScreenshotList(ClientStructure client, ScreenshotListRequestMsgData data)
        {
            var screenshots = new List <ScreenshotInfo>();

            foreach (var file in FileHandler.GetFilesInPath(Path.Combine(ScreenshotPath, data.FolderName)).Where(f => thumbnail_handler(f)))
            {
                if (long.TryParse(Path.GetFileNameWithoutExtension(file).Replace("small_", string.Empty), out var dateTaken))
                {
                    if (data.AlreadyOwnedPhotoIds.Contains(dateTaken))
                    {
                        continue;
                    }

                    var contents = FileHandler.ReadFile(file);
                    LunaLog.Debug("IMG: " + LunaMath.UShortFromBytes(contents[18], contents[19]) + " X " + LunaMath.UShortFromBytes(contents[22], contents[23]));
                    screenshots.Add(new ScreenshotInfo
                    {
                        Data       = contents,
                        DateTaken  = dateTaken,
                        NumBytes   = contents.Length,
                        Height     = LunaMath.UShortFromBytes(contents[18], contents[19]),
                        Width      = LunaMath.UShortFromBytes(contents[22], contents[23]),
                        FolderName = data.FolderName,
                    });
                }
                else
                {
                    LunaLog.Error("Failed to parse data on screenshot: " + file);
                }
            }

            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <ScreenshotListReplyMsgData>();

            msgData.FolderName     = data.FolderName;
            msgData.Screenshots    = screenshots.ToArray();
            msgData.NumScreenshots = screenshots.Count;

            LunaLog.Debug($"Sending {msgData.NumScreenshots} ({data.FolderName}) screenshots to: {client.PlayerName}");
            MessageQueuer.SendToClient <ScreenshotSrvMsg>(client, msgData);
        }
Ejemplo n.º 14
0
        private static void SendQuicksaveList(ClientStructure client, Guid vesselId)
        {
            var vesselFolder = GetVesselFolder(vesselId);
            var files        = Directory.GetFiles(vesselFolder);

            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <QuicksaveListReplyMsgData>();

            msgData.QuicksavesCount = files.Length;
            msgData.Quicksaves      = new QuicksaveBasicInfo[files.Length];
            for (var i = 0; i < files.Length; i++)
            {
                msgData.Quicksaves[i] = new QuicksaveBasicInfo
                {
                    Name     = Path.GetFileNameWithoutExtension(files[i]),
                    Date     = File.GetCreationTime(files[i]),
                    VesselId = vesselId
                }
            }
            ;

            MessageQueuer.SendToClient <QuicksaveSrvMsg>(client, msgData);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Sends the requested screenshot
        /// </summary>
        public static void SendScreenshot(ClientStructure client, ScreenshotDownloadRequestMsgData data)
        {
            Task.Run(() =>
            {
                var file = Path.Combine(ScreenshotFolder, data.FolderName, $"{data.DateTaken}.png");
                if (File.Exists(file))
                {
                    var bitmap = new Bitmap(file);

                    var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <ScreenshotDataMsgData>();
                    msgData.Screenshot.DateTaken  = data.DateTaken;
                    msgData.Screenshot.Data       = File.ReadAllBytes(file);
                    msgData.Screenshot.NumBytes   = msgData.Screenshot.Data.Length;
                    msgData.Screenshot.Height     = (ushort)bitmap.Height;
                    msgData.Screenshot.Width      = (ushort)bitmap.Width;
                    msgData.Screenshot.FolderName = data.FolderName;

                    LunaLog.Debug($"Sending screenshot ({msgData.Screenshot.NumBytes} bytes): {data.DateTaken} to: {client.PlayerName}.");
                    MessageQueuer.SendToClient <ScreenshotSrvMsg>(client, msgData);
                }
            });
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Sends the crafts in a folder
        /// </summary>
        public static void SendCraftList(ClientStructure client, CraftLibraryListRequestMsgData data)
        {
            Task.Run(() =>
            {
                var crafts       = new List <CraftBasicInfo>();
                var playerFolder = Path.Combine(CraftFolder, data.FolderName);

                foreach (var craftType in Enum.GetNames(typeof(CraftType)))
                {
                    var craftTypeFolder = Path.Combine(playerFolder, craftType);
                    if (Directory.Exists(craftTypeFolder))
                    {
                        foreach (var file in Directory.GetFiles(craftTypeFolder))
                        {
                            var craftName = Path.GetFileNameWithoutExtension(file);
                            crafts.Add(new CraftBasicInfo
                            {
                                CraftName  = craftName,
                                CraftType  = (CraftType)Enum.Parse(typeof(CraftType), craftType),
                                FolderName = data.FolderName
                            });
                        }
                    }
                }

                var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <CraftLibraryListReplyMsgData>();

                msgData.FolderName        = data.FolderName;
                msgData.PlayerCrafts      = crafts.ToArray();
                msgData.PlayerCraftsCount = crafts.Count;

                MessageQueuer.SendToClient <CraftLibrarySrvMsg>(client, msgData);
                if (msgData.PlayerCraftsCount > 0)
                {
                    LunaLog.Debug($"Sending {msgData.PlayerCraftsCount} ({data.FolderName}) crafts to: {client.PlayerName}");
                }
            });
        }
Ejemplo n.º 17
0
        public static void SendHandshakeReply(ClientStructure client, HandshakeReply enumResponse, string reason)
        {
            var messageData = new HandshakeReplyMsgData
            {
                Response = enumResponse,
                Reason   = reason
            };

            if (enumResponse == HandshakeReply.HANDSHOOK_SUCCESSFULLY)
            {
                messageData.ModControlMode = GeneralSettings.SettingsStore.ModControl;
                if (GeneralSettings.SettingsStore.ModControl != ModControlMode.DISABLED)
                {
                    if (!FileHandler.FileExists(ServerContext.ModFilePath))
                    {
                        ModFileSystem.GenerateNewModFile();
                    }
                    messageData.ModFileData = FileHandler.ReadFile(ServerContext.ModFilePath);
                }
            }

            MessageQueuer.SendToClient <HandshakeSrvMsg>(client, messageData);
        }
Ejemplo n.º 18
0
 public void HandlePrivateMessage(ClientStructure client, ChatPrivateMsgData message)
 {
     if (message.To != GeneralSettings.SettingsStore.ConsoleIdentifier)
     {
         var findClient = ClientRetriever.GetClientByName(message.To);
         if (findClient != null)
         {
             MessageQueuer.SendToClient <ChatSrvMsg>(client, message);     //Send it to the sender
             MessageQueuer.SendToClient <ChatSrvMsg>(findClient, message); //Send it to destination
             LunaLog.ChatMessage($"{message.From} -> @{message.To}: {message.Text}");
         }
         else
         {
             LunaLog.ChatMessage($"{message.From} -X-> @{message.To}: {message.Text}");
         }
     }
     else
     {
         //Send it to the sender only as we as server already received it
         MessageQueuer.SendToClient <ChatSrvMsg>(client, message);
         LunaLog.ChatMessage($"{message.From} -> @{message.To}: {message.Text}");
     }
 }
Ejemplo n.º 19
0
        public static void HandleKerbalsRequest(ClientStructure client)
        {
            var kerbalFiles = FileHandler.GetFilesInPath(KerbalsPath);
            var kerbalsData = kerbalFiles.Select(k =>
            {
                var kerbalData = FileHandler.ReadFile(k);
                return(new KerbalInfo
                {
                    KerbalData = kerbalData,
                    NumBytes = kerbalData.Length,
                    KerbalName = Path.GetFileNameWithoutExtension(k)
                });
            });

            LunaLog.Debug($"Sending {client.PlayerName} {kerbalFiles.Length} kerbals...");

            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <KerbalReplyMsgData>();

            msgData.Kerbals      = kerbalsData.ToArray();
            msgData.KerbalsCount = msgData.Kerbals.Length;

            MessageQueuer.SendToClient <KerbalSrvMsg>(client, msgData);
        }
Ejemplo n.º 20
0
        public override void HandleMessage(ClientStructure client, IMessageData messageData)
        {
            var message = messageData as KerbalBaseMsgData;

            switch (message?.KerbalMessageType)
            {
            case KerbalMessageType.REQUEST:
                var kerbalFiles = FileHandler.GetFilesInPath(Path.Combine(ServerContext.UniverseDirectory, "Kerbals"));
                var kerbalsData = kerbalFiles.Select(k => new KeyValuePair <string, byte[]>(Path.GetFileNameWithoutExtension(k),
                                                                                            FileHandler.ReadFile(k)));

                LunaLog.Debug($"Sending {client.PlayerName} {kerbalFiles.Length} kerbals...");

                var newMessageData = new KerbalReplyMsgData
                {
                    KerbalsData = kerbalsData.ToArray()
                };

                MessageQueuer.SendToClient <KerbalSrvMsg>(client, newMessageData);
                break;

            case KerbalMessageType.PROTO:
                var data = (KerbalProtoMsgData)message;

                LunaLog.Debug($"Saving kerbal {data.KerbalName} from {client.PlayerName}");

                var path = Path.Combine(ServerContext.UniverseDirectory, "Kerbals", data.KerbalName + ".txt");
                FileHandler.WriteToFile(path, data.KerbalData);

                MessageQueuer.RelayMessage <KerbalSrvMsg>(client, data);
                break;

            default:
                throw new NotImplementedException("Kerbal type not implemented");
            }
        }
Ejemplo n.º 21
0
        public void HandleRequestFileMessage(ClientStructure client, CraftLibraryRequestMsgData message)
        {
            var playerPath = Path.Combine(Path.Combine(ServerContext.UniverseDirectory, "Crafts"), message.CraftOwner);
            var typePath   = Path.Combine(playerPath, message.RequestedType.ToString());
            var craftFile  = Path.Combine(typePath, $"{message.RequestedName}.craft");

            var hasCraft = FileHandler.FolderExists(playerPath) && FileHandler.FolderExists(typePath) &&
                           FileHandler.FileExists(craftFile);

            var respondMessageData = new CraftLibraryRespondMsgData
            {
                CraftOwner    = message.CraftOwner,
                RequestedType = message.RequestedType,
                RequestedName = message.RequestedName,
                HasCraft      = hasCraft
            };

            if (hasCraft)
            {
                respondMessageData.CraftData = FileHandler.ReadFile(craftFile);
            }

            MessageQueuer.SendToClient <CraftLibrarySrvMsg>(client, respondMessageData);
        }
Ejemplo n.º 22
0
        public override void Execute(string commandArgs)
        {
            var splittedCommand = commandArgs.Trim().Split(' ');

            if (splittedCommand.Length == 2)
            {
                var playerName = splittedCommand[0];
                var client     = ClientRetriever.GetAuthenticatedClients().FirstOrDefault(p => p.PlayerName == playerName);

                if (client != null)
                {
                    var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <ChatPrivateMsgData>();
                    msgData.From = GeneralSettings.SettingsStore.ConsoleIdentifier;
                    msgData.To   = client.PlayerName;
                    msgData.Text = commandArgs.Substring(client.PlayerName.Length + 1);

                    MessageQueuer.SendToClient <ChatSrvMsg>(client, msgData);
                }
                else
                {
                    LunaLog.Normal("Player not found!");
                }
            }
        }
Ejemplo n.º 23
0
        public static void HandleListFlagMessage(ClientStructure client, FlagListMsgData message)
        {
            //Send the list back
            var serverFlagFileNames = new List <string>();
            var serverFlagOwners    = new List <string>();
            var serverFlagShaSums   = new List <string>();
            var serverFlags         = FileHandler.GetFilesInPath(FlagPath, SearchOption.AllDirectories);

            foreach (var serverFlag in serverFlags)
            {
                var trimmedName   = Path.GetFileName(serverFlag);
                var flagOwnerPath = Path.GetDirectoryName(serverFlag);

                var flagOwner    = flagOwnerPath.Substring(Path.GetDirectoryName(flagOwnerPath).Length + 1);
                var isMatched    = false;
                var shaDifferent = false;
                for (var i = 0; i < message.FlagFileNames.Length; i++)
                {
                    if (message.FlagFileNames[i].ToLower() == trimmedName.ToLower())
                    {
                        isMatched    = true;
                        shaDifferent = Common.CalculateSha256Hash(serverFlag) != message.FlagShaSums[i];
                    }
                }
                if (!isMatched || shaDifferent)
                {
                    if (flagOwner == client.PlayerName)
                    {
                        LunaLog.Debug("Deleting flag " + trimmedName);
                        FileHandler.FileDelete(serverFlag);

                        MessageQueuer.RelayMessage <FlagSrvMsg>(client,
                                                                new FlagDeleteMsgData {
                            FlagName = trimmedName
                        });

                        if (FileHandler.GetFilesInPath(flagOwnerPath).Length == 0)
                        {
                            FileHandler.FolderDelete(flagOwnerPath);
                        }
                    }
                    else
                    {
                        LunaLog.Debug($"Sending flag {serverFlag} from {flagOwner} to {client.PlayerName}");

                        var newMessageData = new FlagDataMsgData
                        {
                            FlagName        = trimmedName,
                            OwnerPlayerName = flagOwner,
                            FlagData        = FileHandler.ReadFile(serverFlag)
                        };

                        MessageQueuer.SendToClient <FlagSrvMsg>(client, newMessageData);
                    }
                }
                //Don't tell the client we have a different copy of the flag so it is reuploaded
                if (FileHandler.FileExists(serverFlag))
                {
                    serverFlagFileNames.Add(trimmedName);
                    serverFlagOwners.Add(flagOwner);
                    serverFlagShaSums.Add(Common.CalculateSha256Hash(serverFlag));
                }
            }

            var listMessageData = new FlagListMsgData
            {
                FlagFileNames = serverFlagFileNames.ToArray(),
                FlagOwners    = serverFlagOwners.ToArray(),
                FlagShaSums   = serverFlagShaSums.ToArray()
            };

            MessageQueuer.SendToClient <FlagSrvMsg>(client, listMessageData);
        }
Ejemplo n.º 24
0
        public static void SendCraftList(ClientStructure client)
        {
            var craftDirectory = Path.Combine(ServerContext.UniverseDirectory, "Crafts");

            if (!FileHandler.FolderExists(craftDirectory))
            {
                FileHandler.FolderCreate(craftDirectory);
            }
            var players = FileHandler.GetDirectoriesInPath(craftDirectory);

            for (var i = 0; i < players.Length; i++)
            {
                players[i] = players[i].Substring(players[i].LastIndexOf(Path.DirectorySeparatorChar) + 1);
            }

            var newMessageData = new CraftLibraryListReplyMsgData {
                Players = players
            };

            var playerCrafts = new List <KeyValuePair <string, CraftListInfo> >();

            foreach (var player in players)
            {
                var playerPath            = Path.Combine(craftDirectory, player);
                var vabPath               = Path.Combine(playerPath, "VAB");
                var sphPath               = Path.Combine(playerPath, "SPH");
                var subassemplyPath       = Path.Combine(playerPath, "SUBASSEMBLY");
                var vabCraftNames         = new List <string>();
                var sphCraftNames         = new List <string>();
                var subassemblyCraftNames = new List <string>();

                var newPlayerCraft = new CraftListInfo
                {
                    SphExists         = FileHandler.FolderExists(sphPath),
                    VabExists         = FileHandler.FolderExists(vabPath),
                    SubassemblyExists = FileHandler.FolderExists(subassemplyPath)
                };

                if (newPlayerCraft.VabExists)
                {
                    vabCraftNames.AddRange(
                        FileHandler.GetFilesInPath(vabPath).Select(Path.GetFileNameWithoutExtension));
                }
                if (newPlayerCraft.VabExists)
                {
                    sphCraftNames.AddRange(
                        FileHandler.GetFilesInPath(sphPath).Select(Path.GetFileNameWithoutExtension));
                }
                if (newPlayerCraft.VabExists)
                {
                    subassemblyCraftNames.AddRange(
                        FileHandler.GetFilesInPath(subassemplyPath).Select(Path.GetFileNameWithoutExtension));
                }

                newPlayerCraft.VabCraftNames         = vabCraftNames.ToArray();
                newPlayerCraft.SphCraftNames         = sphCraftNames.ToArray();
                newPlayerCraft.SubassemblyCraftNames = subassemblyCraftNames.ToArray();

                playerCrafts.Add(new KeyValuePair <string, CraftListInfo>(player, newPlayerCraft));
            }

            newMessageData.PlayerCrafts = playerCrafts.ToArray();
            MessageQueuer.SendToClient <CraftLibrarySrvMsg>(client, newMessageData);
        }
Ejemplo n.º 25
0
 public static void SendAllLocks(ClientStructure client)
 {
     MessageQueuer.SendToClient <LockSrvMsg>(client, new LockListReplyMsgData {
         Locks = LockSystem.GetLockList().ToArray()
     });
 }
Ejemplo n.º 26
0
        public override void HandleMessage(ClientStructure client, IMessageData message)
        {
            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <SettingsReplyMsgData>();

            msgData.WarpMode                             = GeneralSettings.SettingsStore.WarpMode;
            msgData.GameMode                             = GeneralSettings.SettingsStore.GameMode;
            msgData.TerrainQuality                       = GeneralSettings.SettingsStore.TerrainQuality;
            msgData.AllowCheats                          = GeneralSettings.SettingsStore.Cheats;
            msgData.AllowSackKerbals                     = GeneralSettings.SettingsStore.AllowSackKerbals;
            msgData.MaxNumberOfAsteroids                 = GeneralSettings.SettingsStore.NumberOfAsteroids;
            msgData.ConsoleIdentifier                    = GeneralSettings.SettingsStore.ConsoleIdentifier;
            msgData.GameDifficulty                       = GeneralSettings.SettingsStore.GameDifficulty;
            msgData.SafetyBubbleDistance                 = GeneralSettings.SettingsStore.SafetyBubbleDistance;
            msgData.VesselUpdatesSendMsInterval          = GeneralSettings.SettingsStore.VesselUpdatesSendMsInterval;
            msgData.SecondaryVesselUpdatesSendMsInterval = GeneralSettings.SettingsStore.SecondaryVesselUpdatesSendMsInterval;
            msgData.DropControlOnVesselSwitching         = GeneralSettings.SettingsStore.DropControlOnVesselSwitching;
            msgData.DropControlOnExitFlight              = GeneralSettings.SettingsStore.DropControlOnExitFlight;
            msgData.DropControlOnExit                    = GeneralSettings.SettingsStore.DropControlOnExit;
            msgData.VesselDefinitionSendMsInterval       = GeneralSettings.SettingsStore.VesselDefinitionSendMsInterval;
            msgData.ShowVesselsInThePast                 = GeneralSettings.SettingsStore.ShowVesselsInThePast;
            msgData.WarpMaster                           = GeneralSettings.SettingsStore.WarpMaster;

            if (GeneralSettings.SettingsStore.GameDifficulty == GameDifficulty.Custom && GameplaySettings.SettingsStore != null)
            {
                msgData.EnableCommNet     = GameplaySettings.SettingsStore.CommNetwork;
                msgData.RespawnTimer      = GameplaySettings.SettingsStore.RespawnTime;
                msgData.AllowStockVessels = GameplaySettings.SettingsStore.AllowStockVessels;
                msgData.AutoHireCrews     = GameplaySettings.SettingsStore.AutoHireCrews;
                msgData.BypassEntryPurchaseAfterResearch = GameplaySettings.SettingsStore.BypassEntryPurchaseAfterResearch;
                msgData.IndestructibleFacilities         = GameplaySettings.SettingsStore.IndestructibleFacilities;
                msgData.MissingCrewsRespawn   = GameplaySettings.SettingsStore.MissingCrewsRespawn;
                msgData.ReentryHeatScale      = GameplaySettings.SettingsStore.ReentryHeatScale;
                msgData.ResourceAbundance     = GameplaySettings.SettingsStore.ResourceAbundance;
                msgData.FundsGainMultiplier   = GameplaySettings.SettingsStore.FundsGainMultiplier;
                msgData.CanQuickLoad          = GameplaySettings.SettingsStore.CanQuickLoad;
                msgData.RepLossDeclined       = GameplaySettings.SettingsStore.RepLossDeclined;
                msgData.FundsLossMultiplier   = GameplaySettings.SettingsStore.FundsLossMultiplier;
                msgData.RepGainMultiplier     = GameplaySettings.SettingsStore.RepGainMultiplier;
                msgData.RepLossMultiplier     = GameplaySettings.SettingsStore.RepLossMultiplier;
                msgData.ScienceGainMultiplier = GameplaySettings.SettingsStore.ScienceGainMultiplier;
                msgData.StartingFunds         = GameplaySettings.SettingsStore.StartingFunds;
                msgData.StartingReputation    = GameplaySettings.SettingsStore.StartingReputation;
                msgData.StartingScience       = GameplaySettings.SettingsStore.StartingScience;
                //Advanced
                msgData.ActionGroupsAlways             = GameplaySettings.SettingsStore.ActionGroupsAlways;
                msgData.GKerbalLimits                  = GameplaySettings.SettingsStore.GKerbalLimits;
                msgData.GPartLimits                    = GameplaySettings.SettingsStore.GPartLimits;
                msgData.KerbalGToleranceMult           = GameplaySettings.SettingsStore.KerbalGToleranceMult;
                msgData.PressurePartLimits             = GameplaySettings.SettingsStore.PressurePartLimits;
                msgData.EnableKerbalExperience         = GameplaySettings.SettingsStore.KerbalExp;
                msgData.ImmediateLevelUp               = GameplaySettings.SettingsStore.ImmediateLevelUp;
                msgData.AllowNegativeCurrency          = GameplaySettings.SettingsStore.AllowNegativeCurrency;
                msgData.ResourceTransferObeyCrossfeed  = GameplaySettings.SettingsStore.ObeyCrossfeedRules;
                msgData.BuildingImpactDamageMult       = GameplaySettings.SettingsStore.BuildingDamageMultiplier;
                msgData.PartUpgradesInCareerAndSandbox = GameplaySettings.SettingsStore.PartUpgrades;
                //Commnet
                msgData.RequireSignalForControl = GameplaySettings.SettingsStore.RequireSignalForControl;
                msgData.DsnModifier             = GameplaySettings.SettingsStore.DsnModifier;
                msgData.RangeModifier           = GameplaySettings.SettingsStore.RangeModifier;
                msgData.OcclusionMultiplierVac  = GameplaySettings.SettingsStore.OcclusionModifierVac;
                msgData.OcclusionMultiplierAtm  = GameplaySettings.SettingsStore.OcclusionModifierAtm;
                msgData.EnableGroundStations    = GameplaySettings.SettingsStore.ExtraGroundstations;
                msgData.PlasmaBlackout          = GameplaySettings.SettingsStore.ReentryBlackout;
            }

            MessageQueuer.SendToClient <SetingsSrvMsg>(client, msgData);
        }
Ejemplo n.º 27
0
        public override void HandleMessage(ClientStructure client, IMessageData messageData)
        {
            var data = (GroupBaseMsgData)messageData;

            switch (data.GroupMessageType)
            {
            case GroupMessageType.Invite:
            {
                var info = (GroupInviteMsgData)data;
                if (GroupSystem.IsOwner(info.GroupName, client.PlayerName))
                {
                    GroupSystem.Invite(info.GroupName, info.AddressedTo);
                    MessageQueuer.SendToClient <GroupSrvMsg>(client, info);
                }
            }
            break;

            case GroupMessageType.Accept:
            {
                var info = (GroupAcceptMsgData)data;
                if (GroupSystem.IsPendingInvitation(info.GroupName, client.PlayerName))
                {
                    GroupSystem.AddPlayerToGroup(info.GroupName, client.PlayerName);
                    MessageQueuer.SendToClient <GroupSrvMsg>(client, info);
                }
            }
            break;

            case GroupMessageType.Remove:
            {
                var info = (GroupRemoveMsgData)data;
                if (GroupSystem.IsOwner(info.GroupName, client.PlayerName))
                {
                    GroupSystem.DeregisterGroup(info.GroupName);
                    MessageQueuer.SendToClient <GroupSrvMsg>(client, info);
                }
            }
            break;

            case GroupMessageType.Add:
            {
                var info = (GroupAddMsgData)data;
                if (GroupSystem.NumGroups(client.PlayerName) < 2)
                {
                    var newMessage = new GroupAddMsgData
                    {
                        GroupName = info.GroupName,
                        Owner     = client.PlayerName
                    };
                    GroupSystem.RegisterGroup(info.GroupName, client.PlayerName);
                    MessageQueuer.SendToClient <GroupSrvMsg>(client, newMessage);
                }
            }
            break;

            case GroupMessageType.Kick:
            {
                var info = (GroupKickMsgData)data;
                if (GroupSystem.IsOwner(info.GroupName, client.PlayerName))
                {
                    GroupSystem.KickPlayerFromGroup(info.GroupName, info.Player);
                    MessageQueuer.SendToClient <GroupSrvMsg>(client, info);
                }
            }
            break;

            case GroupMessageType.ListRequest:
            {
                var groupsAndOwners = GroupSystem.GroupsAndOwners();
                var newMessage      = new GroupListResponseMsgData
                {
                    Groups = groupsAndOwners.Key,
                    Owners = groupsAndOwners.Value
                };
                MessageQueuer.SendToClient <GroupSrvMsg>(client, newMessage);
            }
            break;

            case GroupMessageType.UpdateRequest:
            {
                var info       = (GroupUpdateRequestMsgData)data;
                var g          = GroupSystem.GetGroup(info.GroupName);
                var newMessage = new GroupUpdateResponseMsgData
                {
                    Owner   = g.Owner,
                    Members = g.GetMembers(),
                    Name    = g.Name
                };
                MessageQueuer.SendToClient <GroupSrvMsg>(client, newMessage);
            }
            break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 28
0
        public override void HandleMessage(ClientStructure client, IClientMessageBase message)
        {
            //We don't use this message anymore so we can recycle it
            message.Recycle();

            var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData <SettingsReplyMsgData>();

            msgData.WarpMode                         = WarpSettings.SettingsStore.WarpMode;
            msgData.GameMode                         = GeneralSettings.SettingsStore.GameMode;
            msgData.TerrainQuality                   = GeneralSettings.SettingsStore.TerrainQuality;
            msgData.AllowCheats                      = GeneralSettings.SettingsStore.Cheats;
            msgData.AllowAdmin                       = !string.IsNullOrEmpty(GeneralSettings.SettingsStore.AdminPassword);
            msgData.AllowSackKerbals                 = GeneralSettings.SettingsStore.AllowSackKerbals;
            msgData.AllowQuicksaves                  = GeneralSettings.SettingsStore.AllowQuicksaves;
            msgData.MaxNumberOfAsteroids             = GeneralSettings.SettingsStore.NumberOfAsteroids;
            msgData.ConsoleIdentifier                = GeneralSettings.SettingsStore.ConsoleIdentifier;
            msgData.GameDifficulty                   = GeneralSettings.SettingsStore.GameDifficulty;
            msgData.SafetyBubbleDistance             = GeneralSettings.SettingsStore.SafetyBubbleDistance;
            msgData.MaxVesselParts                   = GeneralSettings.SettingsStore.MaxVesselParts;
            msgData.VesselUpdatesMsInterval          = IntervalSettings.SettingsStore.VesselUpdatesMsInterval;
            msgData.SecondaryVesselUpdatesMsInterval = IntervalSettings.SettingsStore.SecondaryVesselUpdatesMsInterval;
            msgData.MinScreenshotIntervalMs          = ScreenshotSettings.SettingsStore.MinScreenshotIntervalMs;
            msgData.MaxScreenshotWidth               = ScreenshotSettings.SettingsStore.MaxScreenshotWidth;
            msgData.MaxScreenshotHeight              = ScreenshotSettings.SettingsStore.MaxScreenshotHeight;
            msgData.MinCraftLibraryRequestIntervalMs = CraftSettings.SettingsStore.MinCraftLibraryRequestIntervalMs;
            msgData.PrintMotdInChat                  = GeneralSettings.SettingsStore.PrintMotdInChat;

            if (GeneralSettings.SettingsStore.GameDifficulty == GameDifficulty.Custom && GameplaySettings.SettingsStore != null)
            {
                msgData.EnableCommNet                    = GameplaySettings.SettingsStore.CommNetwork;
                msgData.RespawnTimer                     = GameplaySettings.SettingsStore.RespawnTime;
                msgData.AllowOtherLaunchSites            = GameplaySettings.SettingsStore.AllowOtherLaunchSites;
                msgData.AllowStockVessels                = GameplaySettings.SettingsStore.AllowStockVessels;
                msgData.AutoHireCrews                    = GameplaySettings.SettingsStore.AutoHireCrews;
                msgData.BypassEntryPurchaseAfterResearch = GameplaySettings.SettingsStore.BypassEntryPurchaseAfterResearch;
                msgData.IndestructibleFacilities         = GameplaySettings.SettingsStore.IndestructibleFacilities;
                msgData.MissingCrewsRespawn              = GameplaySettings.SettingsStore.MissingCrewsRespawn;
                msgData.ReentryHeatScale                 = GameplaySettings.SettingsStore.ReentryHeatScale;
                msgData.ResourceAbundance                = GameplaySettings.SettingsStore.ResourceAbundance;
                msgData.FundsGainMultiplier              = GameplaySettings.SettingsStore.FundsGainMultiplier;
                msgData.CanRevert             = GameplaySettings.SettingsStore.CanRevert;
                msgData.RepLossDeclined       = GameplaySettings.SettingsStore.RepLossDeclined;
                msgData.FundsLossMultiplier   = GameplaySettings.SettingsStore.FundsLossMultiplier;
                msgData.RepGainMultiplier     = GameplaySettings.SettingsStore.RepGainMultiplier;
                msgData.RepLossMultiplier     = GameplaySettings.SettingsStore.RepLossMultiplier;
                msgData.ScienceGainMultiplier = GameplaySettings.SettingsStore.ScienceGainMultiplier;
                msgData.StartingFunds         = GameplaySettings.SettingsStore.StartingFunds;
                msgData.StartingReputation    = GameplaySettings.SettingsStore.StartingReputation;
                msgData.StartingScience       = GameplaySettings.SettingsStore.StartingScience;
                //Advanced
                msgData.ActionGroupsAlways             = GameplaySettings.SettingsStore.ActionGroupsAlways;
                msgData.GKerbalLimits                  = GameplaySettings.SettingsStore.GKerbalLimits;
                msgData.GPartLimits                    = GameplaySettings.SettingsStore.GPartLimits;
                msgData.KerbalGToleranceMult           = GameplaySettings.SettingsStore.KerbalGToleranceMult;
                msgData.PressurePartLimits             = GameplaySettings.SettingsStore.PressurePartLimits;
                msgData.EnableKerbalExperience         = GameplaySettings.SettingsStore.KerbalExp;
                msgData.ImmediateLevelUp               = GameplaySettings.SettingsStore.ImmediateLevelUp;
                msgData.AllowNegativeCurrency          = GameplaySettings.SettingsStore.AllowNegativeCurrency;
                msgData.ResourceTransferObeyCrossfeed  = GameplaySettings.SettingsStore.ObeyCrossfeedRules;
                msgData.BuildingImpactDamageMult       = GameplaySettings.SettingsStore.BuildingDamageMultiplier;
                msgData.PartUpgradesInCareerAndSandbox = GameplaySettings.SettingsStore.PartUpgrades;
                //Commnet
                msgData.RequireSignalForControl = GameplaySettings.SettingsStore.RequireSignalForControl;
                msgData.DsnModifier             = GameplaySettings.SettingsStore.DsnModifier;
                msgData.RangeModifier           = GameplaySettings.SettingsStore.RangeModifier;
                msgData.OcclusionMultiplierVac  = GameplaySettings.SettingsStore.OcclusionModifierVac;
                msgData.OcclusionMultiplierAtm  = GameplaySettings.SettingsStore.OcclusionModifierAtm;
                msgData.EnableGroundStations    = GameplaySettings.SettingsStore.ExtraGroundstations;
                msgData.PlasmaBlackout          = GameplaySettings.SettingsStore.ReentryBlackout;
            }

            MessageQueuer.SendToClient <SetingsSrvMsg>(client, msgData);
        }
Ejemplo n.º 29
0
        public override void HandleMessage(ClientStructure client, IMessageData message)
        {
            var settingsData = new SettingsReplyMsgData
            {
                WarpMode                             = GeneralSettings.SettingsStore.WarpMode,
                GameMode                             = GeneralSettings.SettingsStore.GameMode,
                AllowCheats                          = GeneralSettings.SettingsStore.Cheats,
                MaxNumberOfAsteroids                 = GeneralSettings.SettingsStore.NumberOfAsteroids,
                ConsoleIdentifier                    = GeneralSettings.SettingsStore.ConsoleIdentifier,
                GameDifficulty                       = GeneralSettings.SettingsStore.GameDifficulty,
                SafetyBubbleDistance                 = GeneralSettings.SettingsStore.SafetyBubbleDistance,
                VesselUpdatesSendMsInterval          = GeneralSettings.SettingsStore.VesselUpdatesSendMsInterval,
                SecondaryVesselUpdatesSendMsInterval = GeneralSettings.SettingsStore.SecondaryVesselUpdatesSendMsInterval,
                DropControlOnVesselSwitching         = GeneralSettings.SettingsStore.DropControlOnVesselSwitching,
                DropControlOnExitFlight              = GeneralSettings.SettingsStore.DropControlOnExitFlight,
                DropControlOnExit                    = GeneralSettings.SettingsStore.DropControlOnExit,
                SendScenarioDataMsInterval           = GeneralSettings.SettingsStore.SendScenarioDataMsInterval,
                VesselKillCheckMsInterval            = GeneralSettings.SettingsStore.VesselKillCheckMsInterval,
                StrandedVesselsCheckMsInterval       = GeneralSettings.SettingsStore.StrandedVesselsCheckMsInterval,
                VesselDefinitionSendMsInterval       = GeneralSettings.SettingsStore.VesselDefinitionSendMsInterval,
                VesselDefinitionSendFarMsInterval    = GeneralSettings.SettingsStore.VesselDefinitionSendFarMsInterval,
                AbandonedVesselsUpdateMsInterval     = GeneralSettings.SettingsStore.AbandonedVesselsUpdateMsInterval,
                ShowVesselsInThePast                 = GeneralSettings.SettingsStore.ShowVesselsInThePast,
                ClockSetMsInterval                   = GeneralSettings.SettingsStore.ClockSetMsInterval,
                WarpMaster                           = GeneralSettings.SettingsStore.WarpMaster
            };

            if (GeneralSettings.SettingsStore.GameDifficulty == GameDifficulty.Custom)
            {
                settingsData.EnableCommNet     = GameplaySettings.SettingsStore.CommNetwork;
                settingsData.RespawnTimer      = GameplaySettings.SettingsStore.RespawnTime;
                settingsData.AllowStockVessels = GameplaySettings.SettingsStore.AllowStockVessels;
                settingsData.AutoHireCrews     = GameplaySettings.SettingsStore.AutoHireCrews;
                settingsData.BypassEntryPurchaseAfterResearch = GameplaySettings.SettingsStore.BypassEntryPurchaseAfterResearch;
                settingsData.IndestructibleFacilities         = GameplaySettings.SettingsStore.IndestructibleFacilities;
                settingsData.MissingCrewsRespawn   = GameplaySettings.SettingsStore.MissingCrewsRespawn;
                settingsData.ReentryHeatScale      = GameplaySettings.SettingsStore.ReentryHeatScale;
                settingsData.ResourceAbundance     = GameplaySettings.SettingsStore.ResourceAbundance;
                settingsData.FundsGainMultiplier   = GameplaySettings.SettingsStore.FundsGainMultiplier;
                settingsData.CanQuickLoad          = GameplaySettings.SettingsStore.CanQuickLoad;
                settingsData.RepLossDeclined       = GameplaySettings.SettingsStore.RepLossDeclined;
                settingsData.FundsLossMultiplier   = GameplaySettings.SettingsStore.FundsLossMultiplier;
                settingsData.RepGainMultiplier     = GameplaySettings.SettingsStore.RepGainMultiplier;
                settingsData.RepLossMultiplier     = GameplaySettings.SettingsStore.RepLossMultiplier;
                settingsData.ScienceGainMultiplier = GameplaySettings.SettingsStore.ScienceGainMultiplier;
                settingsData.StartingFunds         = GameplaySettings.SettingsStore.StartingFunds;
                settingsData.StartingReputation    = GameplaySettings.SettingsStore.StartingReputation;
                settingsData.StartingScience       = GameplaySettings.SettingsStore.StartingScience;
                //Advanced
                settingsData.ActionGroupsAlways             = GameplaySettings.SettingsStore.ActionGroupsAlways;
                settingsData.GKerbalLimits                  = GameplaySettings.SettingsStore.GKerbalLimits;
                settingsData.GPartLimits                    = GameplaySettings.SettingsStore.GPartLimits;
                settingsData.KerbalGToleranceMult           = GameplaySettings.SettingsStore.KerbalGToleranceMult;
                settingsData.PressurePartLimits             = GameplaySettings.SettingsStore.PressurePartLimits;
                settingsData.EnableKerbalExperience         = GameplaySettings.SettingsStore.KerbalExp;
                settingsData.ImmediateLevelUp               = GameplaySettings.SettingsStore.ImmediateLevelUp;
                settingsData.AllowNegativeCurrency          = GameplaySettings.SettingsStore.AllowNegativeCurrency;
                settingsData.ResourceTransferObeyCrossfeed  = GameplaySettings.SettingsStore.ObeyCrossfeedRules;
                settingsData.BuildingImpactDamageMult       = GameplaySettings.SettingsStore.BuildingDamageMultiplier;
                settingsData.PartUpgradesInCareerAndSandbox = GameplaySettings.SettingsStore.PartUpgrades;
                //Commnet
                settingsData.RequireSignalForControl = GameplaySettings.SettingsStore.RequireSignalForControl;
                settingsData.DsnModifier             = GameplaySettings.SettingsStore.DsnModifier;
                settingsData.RangeModifier           = GameplaySettings.SettingsStore.RangeModifier;
                settingsData.OcclusionMultiplierVac  = GameplaySettings.SettingsStore.OcclusionModifierVac;
                settingsData.OcclusionMultiplierAtm  = GameplaySettings.SettingsStore.OcclusionModifierAtm;
                settingsData.EnableGroundStations    = GameplaySettings.SettingsStore.ExtraGroundstations;
                settingsData.PlasmaBlackout          = GameplaySettings.SettingsStore.ReentryBlackout;
            }

            MessageQueuer.SendToClient <SetingsSrvMsg>(client, settingsData);
        }