diff --git a/README.md b/README.md index 8577c5e..a261605 100644 --- a/README.md +++ b/README.md @@ -97,3 +97,4 @@ Then run School of Dragons. - GetAchievementsByUserID (returns an achievement with the provided user ID) - SetAchievementAndGetReward (returns 5 gems) - SetUserAchievementTask (returns a placeholder achievement) +- GetAnnouncementsByUser (returns no announcements, but that might be sufficient) diff --git a/mitm-redirect.py b/mitm-redirect.py index f22355e..d72581a 100644 --- a/mitm-redirect.py +++ b/mitm-redirect.py @@ -56,7 +56,8 @@ methods = [ 'AcceptMission', 'GetUserMissionState', 'SetAchievementAndGetReward', - 'SetUserAchievementTask' + 'SetUserAchievementTask', + 'GetAnnouncementsByUser' ] def routable(path): diff --git a/src/Controllers/Common/ItemStoreController.cs b/src/Controllers/Common/ItemStoreController.cs index b87219b..f0aadf5 100644 --- a/src/Controllers/Common/ItemStoreController.cs +++ b/src/Controllers/Common/ItemStoreController.cs @@ -41,4 +41,12 @@ public class ItemStoreController : Controller { // TODO return Ok(XmlUtil.ReadResourceXmlString("rankattrib")); } + + [HttpPost] + [Produces("application/xml")] + [Route("ItemStoreWebService.asmx/GetAnnouncementsByUser")] + public IActionResult GetAnnouncements([FromForm] string apiToken, [FromForm] int worldObjectID) { + // TODO: This is a placeholder, although this endpoint seems to be only used to send announcements to the user (such as the server shutdown), so this might be sufficient. + return Ok(new AnnouncementList()); + } } diff --git a/src/Schema/Announcement.cs b/src/Schema/Announcement.cs new file mode 100644 index 0000000..87e14c9 --- /dev/null +++ b/src/Schema/Announcement.cs @@ -0,0 +1,26 @@ +using System.Xml.Serialization; + +namespace sodoff.Schema; + +[XmlRoot(ElementName = "Announcement")] +[Serializable] +public class Announcement +{ + [XmlElement(ElementName = "AnnouncementID")] + public int AnnouncementID; + + [XmlElement(ElementName = "Description")] + public string Description; + + [XmlElement(ElementName = "AnnouncementText")] + public string AnnouncementText; + + [XmlElement(ElementName = "Type")] + public AnnouncementType Type; + + [XmlElement(ElementName = "StartDate")] + public DateTime StartDate; + + [XmlElement(ElementName = "EndDate", IsNullable = true)] + public DateTime? EndDate; +} \ No newline at end of file diff --git a/src/Schema/AnnouncementList.cs b/src/Schema/AnnouncementList.cs new file mode 100644 index 0000000..95a8e57 --- /dev/null +++ b/src/Schema/AnnouncementList.cs @@ -0,0 +1,11 @@ +using System.Xml.Serialization; + +namespace sodoff.Schema; + +[XmlRoot(ElementName = "Announcements", Namespace = "")] +[Serializable] +public class AnnouncementList +{ + [XmlElement(ElementName = "Announcement")] + public Announcement[] Announcements; +} \ No newline at end of file diff --git a/src/Schema/AnnouncementType.cs b/src/Schema/AnnouncementType.cs new file mode 100644 index 0000000..7792ed1 --- /dev/null +++ b/src/Schema/AnnouncementType.cs @@ -0,0 +1,22 @@ +using System.Xml.Serialization; + +namespace sodoff.Schema; + +[Flags] +public enum AnnouncementType +{ + [XmlEnum("0")] + Unknown = 0, + [XmlEnum("1")] + Text = 1, + [XmlEnum("2")] + VoiceOver = 2, + [XmlEnum("3")] + GeneralText = 3, + [XmlEnum("4")] + ScavengerText = 4, + [XmlEnum("5")] + Video = 5, + [XmlEnum("6")] + EggNapping = 6 +} \ No newline at end of file