2022-01-08 15:04:52 +00:00
|
|
|
|
using QSB.ConversationSync.Messages;
|
|
|
|
|
using QSB.ConversationSync.Patches;
|
|
|
|
|
using QSB.Messaging;
|
|
|
|
|
using System.Linq;
|
2021-12-22 22:44:31 -08:00
|
|
|
|
|
2021-12-23 02:17:56 -08:00
|
|
|
|
namespace QSB.SaveSync.Messages
|
2021-12-22 22:44:31 -08:00
|
|
|
|
{
|
2021-12-24 22:33:29 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// always sent to host
|
|
|
|
|
/// </summary>
|
2021-12-22 22:44:31 -08:00
|
|
|
|
internal class RequestGameStateMessage : QSBMessage
|
|
|
|
|
{
|
|
|
|
|
public RequestGameStateMessage() => To = 0;
|
|
|
|
|
|
2022-01-08 11:41:55 +00:00
|
|
|
|
public override void OnReceiveRemote()
|
|
|
|
|
{
|
|
|
|
|
new GameStateMessage(From).Send();
|
|
|
|
|
|
2022-01-18 17:34:26 -08:00
|
|
|
|
var gameSave = QSBCore.ProfileManager.currentProfileGameSave;
|
2022-01-08 11:41:55 +00:00
|
|
|
|
|
|
|
|
|
var factSaves = gameSave.shipLogFactSaves;
|
|
|
|
|
foreach (var item in factSaves)
|
|
|
|
|
{
|
|
|
|
|
new ShipLogFactSaveMessage(item.Value).Send();
|
|
|
|
|
}
|
2022-01-08 15:04:52 +00:00
|
|
|
|
|
|
|
|
|
var dictConditions = gameSave.dictConditions;
|
|
|
|
|
var dictConditionsToSend = dictConditions.Where(x => ConversationPatches.PersistentConditionsToSync.Contains(x.Key));
|
|
|
|
|
foreach (var item in dictConditionsToSend)
|
|
|
|
|
{
|
|
|
|
|
new PersistentConditionMessage(item.Key, item.Value).Send();
|
|
|
|
|
}
|
2022-01-08 11:41:55 +00:00
|
|
|
|
}
|
2021-12-22 22:44:31 -08:00
|
|
|
|
}
|
|
|
|
|
}
|