diff --git a/src/Controllers/Common/ContentController.cs b/src/Controllers/Common/ContentController.cs index b50138e..32b8ced 100644 --- a/src/Controllers/Common/ContentController.cs +++ b/src/Controllers/Common/ContentController.cs @@ -2134,6 +2134,34 @@ public class ContentController : Controller { return Ok(random.Next(1, 15)); } + [HttpPost] + //[Produces("application/xml")] + [Route("ContentWebService.asmx/GetGameProgress")] // used by Math Blaster (Ice Cubed) + [VikingSession] + public string GetGameProgress(Viking viking, [FromForm] int gameId) { + string? ret = Util.SavedData.Get( + viking, + (uint)gameId + ); + if (ret is null) + return XmlUtil.SerializeXml(null); + return ret; + } + + [HttpPost] + [Produces("application/xml")] + [Route("ContentWebService.asmx/SetGameProgress")] // used by Math Blaster (Ice Cubed) + [VikingSession] + public IActionResult SetGameProgress(Viking viking, [FromForm] int gameId, [FromForm] string xmlDocumentData) { + Util.SavedData.Set( + viking, + (uint)gameId, + xmlDocumentData + ); + ctx.SaveChanges(); + return Ok(); + } + private static RaisedPetData GetRaisedPetDataFromDragon (Dragon dragon, int? selectedDragonId = null) { if (selectedDragonId is null) selectedDragonId = dragon.Viking.SelectedDragonId; diff --git a/src/Schema/GameProgress.cs b/src/Schema/GameProgress.cs new file mode 100644 index 0000000..dbcffac --- /dev/null +++ b/src/Schema/GameProgress.cs @@ -0,0 +1,20 @@ +using System.Xml.Serialization; + +namespace sodoff.Schema; + +[XmlRoot(ElementName = "progress", Namespace = "")] +[Serializable] +public class GameProgress { + [XmlElement(ElementName = "name")] + public string Name; + + [XmlElement(ElementName = "version")] + public string Version; + + [XmlElement(ElementName = "chapter")] + public string[] Chapter; + + [XmlElement(ElementName = "custom")] + public string? Custom; +} +