public static void AchievementsReceived(ClientStructure client, ShareProgressAchievementsMsgData data) { LunaLog.Debug($"Achievements data received: {data.Id}"); //send the achievements update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteAchievementDataToFile(data); }
public static void UpgradeReceived(ClientStructure client, ShareProgressFacilityUpgradeMsgData data) { LunaLog.Debug($"{client.PlayerName} Upgraded facility {data.FacilityId} To level: {data.Level}"); //send the upgrade facility update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteFacilityLevelDataToFile(data.FacilityId, data.Level); }
public static void FundsReceived(ClientStructure client, ShareProgressFundsMsgData data) { LunaLog.Debug($"Funds received: {data.Funds} Reason: {data.Reason}"); //send the funds update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteFundsDataToFile(data.Funds); }
public static void ScienceSubjectReceived(ClientStructure client, ShareProgressScienceSubjectMsgData data) { LunaLog.Debug($"Science experiment received: {data.ScienceSubject.Id}"); //send the science subject update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteScienceSubjectDataToFile(data.ScienceSubject); }
public static void PurchaseReceived(ClientStructure client, ShareProgressPartPurchaseMsgData data) { LunaLog.Debug($"Part purchased: {data.PartName} Tech: {data.TechId}"); //send the part purchase to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WritePartPurchaseDataToFile(data); }
public static void ExperimentalPartReceived(ClientStructure client, ShareProgressExperimentalPartMsgData data) { LunaLog.Debug($"Experimental part received: {data.PartName} Count: {data.Count}"); //send the experimental part to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteExperimentalPartDataToFile(data); }
public static void ReputationReceived(ClientStructure client, ShareProgressReputationMsgData data) { LunaLog.Debug($"Reputation received: {data.Reputation} Reason: {data.Reason}"); //send the reputation update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteReputationDataToFile(data.Reputation); }
public static void StrategyReceived(ClientStructure client, ShareProgressStrategyMsgData data) { LunaLog.Debug($"strategy changed: {data.Strategy.Name}"); //Send the strategy update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteStrategyDataToFile(data.Strategy); }
public static void ScienceReceived(ClientStructure client, ShareProgressScienceMsgData data) { LunaLog.Debug($"Science received: {data.Science} Reason: {data.Reason}"); //send the science update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteScienceDataToFile(data.Science); }
public static void TechnologyReceived(ClientStructure client, ShareProgressTechnologyMsgData data) { LunaLog.Debug($"Technology unlocked: {data.TechNode.Id}"); //Send the technology update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteTechnologyDataToFile(data); }
public static void ParseReceivedScenarioData(ClientStructure client, ScenarioBaseMsgData messageData) { var data = (ScenarioDataMsgData)messageData; LunaLog.Debug($"Saving {data.ScenarioCount} scenario modules from {client.PlayerName}"); for (var i = 0; i < data.ScenarioCount; i++) { var scenarioAsConfigNode = Encoding.UTF8.GetString(data.ScenariosData[i].Data, 0, data.ScenariosData[i].NumBytes); ScenarioDataUpdater.RawConfigNodeInsertOrUpdate(data.ScenariosData[i].Module, scenarioAsConfigNode); } }
public static void ContractsReceived(ClientStructure client, ShareProgressContractsMsgData data) { LunaLog.Debug("Contract data received:"); foreach (var item in data.Contracts) { LunaLog.Debug(item.ContractGuid.ToString()); } //send the contract update to all other clients MessageQueuer.RelayMessage <ShareProgressSrvMsg>(client, data); ScenarioDataUpdater.WriteContractDataToFile(data); }
//Sets given funds value private static void SetFunds(double funds) { //Fund update to server ScenarioDataUpdater.WriteFundsDataToFile(funds); //Fund update to all other clients var data = ServerContext.ServerMessageFactory.CreateNewMessageData <ShareProgressFundsMsgData>(); data.Funds = funds; data.Reason = "Server Command"; MessageQueuer.SendToAllClients <ShareProgressSrvMsg>(data); LunaLog.Debug($"Funds received: {data.Funds} Reason: {data.Reason}"); ScenarioDataUpdater.WriteFundsDataToFile(data.Funds); //var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData<ChatMsgData>(); //msgData.From = GeneralSettings.SettingsStore.ConsoleIdentifier; //msgData.Text = "Funds were changed to " + funds.ToString(); //MessageQueuer.SendToAllClients<ChatSrvMsg>(msgData); }
//Sets given science value private static void SetScience(float science) { //Science update to server ScenarioDataUpdater.WriteScienceDataToFile(science); //Science update to all other clients var data = ServerContext.ServerMessageFactory.CreateNewMessageData <ShareProgressScienceMsgData>(); data.Science = science; data.Reason = "Server Command"; MessageQueuer.SendToAllClients <ShareProgressSrvMsg>(data); LunaLog.Debug($"Science received: {data.Science} Reason: {data.Reason}"); ScenarioDataUpdater.WriteScienceDataToFile(data.Science); //var msgData = ServerContext.ServerMessageFactory.CreateNewMessageData<ChatMsgData>(); //msgData.From = GeneralSettings.SettingsStore.ConsoleIdentifier; //msgData.Text = "Science was changed to " + science.ToString(); //MessageQueuer.SendToAllClients<ChatSrvMsg>(msgData); }
/// <summary> /// Load the stored scenarios into the dictionary /// </summary> public static void LoadExistingScenarios(bool createdFromScratch) { ChangeExistingScenarioFormats(); lock (BackupLock) { foreach (var file in Directory.GetFiles(ScenarioSystem.ScenariosPath).Where(f => Path.GetExtension(f) == ScenarioSystem.ScenarioFileFormat)) { CurrentScenarios.TryAdd(Path.GetFileNameWithoutExtension(file), new ConfigNode(File.ReadAllText(file))); } if (createdFromScratch) { ScenarioDataUpdater.WriteScienceDataToFile(GameplaySettings.SettingsStore.StartingScience); ScenarioDataUpdater.WriteReputationDataToFile(GameplaySettings.SettingsStore.StartingReputation); ScenarioDataUpdater.WriteFundsDataToFile(GameplaySettings.SettingsStore.StartingFunds); } } }
public override void HandleMessage(ClientStructure client, IClientMessageBase message) { var data = (FacilityBaseMsgData)message.Data; switch (data.FacilityMessageType) { case FacilityMessageType.Repair: LunaLog.Normal($"{client.PlayerName} REPAIRED facility {data.ObjectId}"); ScenarioDataUpdater.WriteRepairedDestroyedDataToFile(data.ObjectId, true); break; case FacilityMessageType.Collapse: LunaLog.Normal($"{client.PlayerName} DESTROYED facility {data.ObjectId}"); ScenarioDataUpdater.WriteRepairedDestroyedDataToFile(data.ObjectId, false); break; default: throw new ArgumentOutOfRangeException(); } //We don't do anything on the server side with this messages so just relay them. MessageQueuer.RelayMessage <FacilitySrvMsg>(client, message.Data); }