mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
initial support for World Of Jumpstart
This commit is contained in:
parent
58a9c2ebd3
commit
f5c7bc0fca
@ -90,6 +90,20 @@ public class AchievementController : Controller {
|
||||
return Ok("OK");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("AchievementWebService.asmx/GetUserAchievementInfo")]
|
||||
public IActionResult GetUserAchievementInfo([FromForm] string apiToken) {
|
||||
Viking? viking = ctx.Sessions.FirstOrDefault(x => x.ApiToken == apiToken).Viking;
|
||||
|
||||
if (viking != null) {
|
||||
return Ok(
|
||||
achievementService.CreateUserAchievementInfo(viking, AchievementPointTypes.PlayerXP)
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("AchievementWebService.asmx/GetAchievementsByUserID")]
|
||||
|
@ -33,11 +33,18 @@ public class AuthenticationController : Controller {
|
||||
[Route("v3/AuthenticationWebService.asmx/LoginParent")]
|
||||
[DecryptRequest("parentLoginData")]
|
||||
[EncryptResponse]
|
||||
public IActionResult LoginParent() {
|
||||
public IActionResult LoginParent([FromForm] string apiKey) {
|
||||
ParentLoginData data = XmlUtil.DeserializeXml<ParentLoginData>(Request.Form["parentLoginData"]);
|
||||
|
||||
// Authenticate the user
|
||||
User? user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName);
|
||||
User? user = null;
|
||||
uint gameVersion = ClientVersion.GetVersion(apiKey);
|
||||
if (gameVersion == ClientVersion.WoJS) {
|
||||
user = ctx.Users.FirstOrDefault(e => e.Email == data.UserName);
|
||||
} else {
|
||||
user = ctx.Users.FirstOrDefault(e => e.Username == data.UserName);
|
||||
}
|
||||
|
||||
if (user is null || new PasswordHasher<object>().VerifyHashedPassword(null, user.Password, data.Password) != PasswordVerificationResult.Success) {
|
||||
return Ok(new ParentLoginInfo { Status = MembershipUserStatus.InvalidPassword });
|
||||
}
|
||||
@ -52,6 +59,11 @@ public class AuthenticationController : Controller {
|
||||
ctx.Sessions.Add(session);
|
||||
ctx.SaveChanges();
|
||||
|
||||
var childList = new List<sodoff.Schema.UserLoginInfo>();
|
||||
foreach (var viking in user.Vikings) {
|
||||
childList.Add(new sodoff.Schema.UserLoginInfo{UserName = viking.Name, UserID = viking.Uid.ToString()});
|
||||
}
|
||||
|
||||
var response = new ParentLoginInfo {
|
||||
UserName = user.Username,
|
||||
//Email = user.Email, /* disabled to avoid put email in client debug logs */
|
||||
@ -59,7 +71,8 @@ public class AuthenticationController : Controller {
|
||||
UserID = user.Id.ToString(),
|
||||
Status = MembershipUserStatus.Success,
|
||||
SendActivationReminder = false,
|
||||
UnAuthorized = false
|
||||
UnAuthorized = false,
|
||||
ChildList = childList.ToArray()
|
||||
};
|
||||
|
||||
return Ok(response);
|
||||
@ -124,7 +137,9 @@ public class AuthenticationController : Controller {
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("AuthenticationWebService.asmx/IsValidApiToken_V2")]
|
||||
public IActionResult IsValidApiToken([FromForm] Guid apiToken) {
|
||||
public IActionResult IsValidApiToken([FromForm] Guid? apiToken) {
|
||||
if (apiToken is null)
|
||||
return Ok(ApiTokenStatus.TokenNotFound);
|
||||
User? user = ctx.Sessions.FirstOrDefault(e => e.ApiToken == apiToken)?.User;
|
||||
Viking? viking = ctx.Sessions.FirstOrDefault(e => e.ApiToken == apiToken)?.Viking;
|
||||
if (user is null && viking is null)
|
||||
|
@ -315,8 +315,21 @@ public class ContentController : Controller {
|
||||
return 0;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
//[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetAvatar")] // used by World Of Jumpstart
|
||||
public IActionResult GetAvatar([FromForm] string apiToken) {
|
||||
Viking? viking = ctx.Sessions.FirstOrDefault(e => e.ApiToken == apiToken)?.Viking;
|
||||
if (viking is null || viking.AvatarSerialized is null) {
|
||||
// TODO: result for invalid session
|
||||
return Ok();
|
||||
}
|
||||
return Ok(viking.AvatarSerialized);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/SetAvatar")] // used by World Of Jumpstart
|
||||
[Route("V2/ContentWebService.asmx/SetAvatar")]
|
||||
[VikingSession]
|
||||
public IActionResult SetAvatar(Viking viking, [FromForm] string contentXML) {
|
||||
@ -577,6 +590,8 @@ public class ContentController : Controller {
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetSelectedRaisedPet")]
|
||||
[Route("ContentWebService.asmx/GetCurrentPetByUserID")] // used by World Of Jumpstart
|
||||
[Route("ContentWebService.asmx/GetActiveRaisedPet")] // used by World Of Jumpstart
|
||||
[VikingSession(UseLock=false)]
|
||||
public RaisedPetData[]? GetSelectedRaisedPet(Viking viking, [FromForm] string userId, [FromForm] bool isActive) {
|
||||
Dragon? dragon = viking.SelectedDragon;
|
||||
@ -1156,6 +1171,22 @@ public class ContentController : Controller {
|
||||
return Ok(roomService.NextItemState(item, request.OverrideStateCriteria));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
//[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetDisplayNames")] // used by World Of Jumpstart
|
||||
public IActionResult GetDisplayNames() {
|
||||
// TODO: This is a placeholder
|
||||
return Ok("<?xml version=\"1.0\" encoding=\"utf-8\"?> <DisplayNames xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"> <DisplayName> <ID>1</ID> <Name>Aaliyah</Name> <Ordinal>1</Ordinal> </DisplayName> <DisplayName> <ID>2</ID> <Name>Abby</Name> <Ordinal>1</Ordinal> </DisplayName> <DisplayName> <ID>3</ID> <Name>Adrian</Name> <Ordinal>1</Ordinal> </DisplayName> <DisplayName> <ID>261</ID> <Name>Alan</Name> <Ordinal>1</Ordinal> </DisplayName> </DisplayNames>");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
//[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetScene")] // used by World Of Jumpstart
|
||||
public IActionResult GetScene() {
|
||||
// TODO: This is a placeholder
|
||||
return Ok("<?xml version=\"1.0\" encoding=\"utf-8\"?><SceneData xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("V2/ContentWebService.asmx/GetGameData")]
|
||||
|
@ -46,6 +46,13 @@ public class ItemStoreController : Controller {
|
||||
return Ok(itemService.GetItem(itemId));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ItemStoreWebService.asmx/GetItemsInStore")] // used by World Of Jumpstart
|
||||
public IActionResult GetItemsInStore([FromForm] int storeId) {
|
||||
return Ok(storeService.GetStore(storeId));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
//[Produces("application/xml")]
|
||||
[Route("ItemStoreWebService.asmx/GetRankAttributeData")]
|
||||
|
@ -63,6 +63,12 @@ public class RegistrationController : Controller {
|
||||
};
|
||||
|
||||
// Check if user exists
|
||||
uint gameVersion = ClientVersion.GetVersion(apiKey);
|
||||
if (gameVersion == ClientVersion.WoJS || gameVersion == ClientVersion.MB) {
|
||||
if (ctx.Users.Count(e => e.Email == u.Email) > 0) {
|
||||
return Ok(new RegistrationResult { Status = MembershipUserStatus.DuplicateEmail });
|
||||
}
|
||||
}
|
||||
if (ctx.Users.Count(e => e.Username== u.Username) > 0) {
|
||||
return Ok(new RegistrationResult { Status = MembershipUserStatus.DuplicateUserName });
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user