initial support for older clients, tested with 2.9 (#11)

- add GetChildList method
- add placeholder fields to respond in GetUserInfoByApiToken and GetUserProfile
This commit is contained in:
rpaciorek 2023-07-25 21:25:37 +00:00 committed by GitHub
parent 207e56602f
commit 4c2dd92969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 0 deletions

View File

@ -66,6 +66,7 @@ Then run School of Dragons.
- GetUserActiveMissionState - GetUserActiveMissionState
- GetUserUpcomingMissionState - GetUserUpcomingMissionState
- GetUserCompletedMissionState - GetUserCompletedMissionState
- GetChildList
#### Implemented enough (probably) #### Implemented enough (probably)
- GetRules (doesn't return any rules, probably doesn't need to) - GetRules (doesn't return any rules, probably doesn't need to)

View File

@ -65,6 +65,7 @@ methods = [
'GetUserActivityByUserID', 'GetUserActivityByUserID',
'SetNextItemState', 'SetNextItemState',
'SetUserRoom', 'SetUserRoom',
'GetChildList',
'GetUserGameCurrency', 'GetUserGameCurrency',
'SetAchievementByEntityIDs' 'SetAchievementByEntityIDs'
] ]

View File

@ -92,6 +92,8 @@ public class AuthenticationController : Controller {
return Ok(new UserInfo { return Ok(new UserInfo {
UserID = user.Id, UserID = user.Id,
Username = user.Username, Username = user.Username,
MembershipID = "ef84db9-59c6-4950-b8ea-bbc1521f899b", // placeholder
FacebookUserID = 0,
MultiplayerEnabled = true, MultiplayerEnabled = true,
Age = 24, Age = 24,
OpenChatEnabled = true OpenChatEnabled = true

View File

@ -21,4 +21,22 @@ public class MembershipController : Controller {
SubscriptionEndDate = new DateTime(2033, 6, 13, 16, 17, 18) SubscriptionEndDate = new DateTime(2033, 6, 13, 16, 17, 18)
}); });
} }
[HttpPost]
[Produces("application/xml")]
[Route("MembershipWebService.asmx/GetChildList")]
public IActionResult GetChildList([FromForm] string apiToken) {
User? user = ctx.Sessions.FirstOrDefault(e => e.ApiToken == apiToken)?.User;
if (user is null)
// TODO: what response for not logged in?
return null;
if (user.Vikings.Count <= 0)
return null;
ChildList profiles = new ChildList();
profiles.strings = user.Vikings.Select(viking => viking.Id + ", " + viking.Name).ToArray();
return Ok(profiles);
}
} }

View File

@ -171,6 +171,7 @@ public class ProfileController : Controller {
GameCurrency = 1000, GameCurrency = 1000,
CashCurrency = 1000, CashCurrency = 1000,
ActivityCount = 0, ActivityCount = 0,
BuddyCount = 0,
UserGradeData = new UserGrade { UserGradeID = 0 } UserGradeData = new UserGrade { UserGradeID = 0 }
}; };
} }

10
src/Schema/ChildList.cs Normal file
View File

@ -0,0 +1,10 @@
using System.Xml.Serialization;
namespace sodoff.Schema;
[XmlRoot(ElementName = "ArrayOfString", Namespace = "http://api.jumpstart.com/")]
[Serializable]
public class ChildList {
[XmlElement(ElementName = "string")]
public string[] strings;
}