forked from SoDOff-Project/sodoff
add endpoints for WoJS
add: - SetGameCurrency - GetDisplayNameByUserId - GetCommonInventoryByUserId and some placeholders - Reimplement Currency System (WoJS) - Implement ``GetDisplayNameByUserId`` - Move ``GetCombinedListMessage`` To Messaging Controller - Add More Placeholders For MMO - ``SetScore`` Placeholder - Add ``GetRevealIndex`` For Learning Games Co-authored-by: Robert Paciorek <robert@opcode.eu.org>
This commit is contained in:
parent
d8b996c6d7
commit
93361c5e84
@ -273,6 +273,15 @@ public class ContentController : Controller {
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetCommonInventoryByUserId")] // used by World Of Jumpstart (?)
|
||||
public IActionResult GetCommonInventoryByUserId([FromForm] Guid userId, [FromForm] int ContainerId)
|
||||
{
|
||||
Viking? viking = ctx.Vikings.FirstOrDefault(e => e.Uid == userId);
|
||||
return GetCommonInventory(null, viking);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("V2/ContentWebService.asmx/GetCommonInventory")]
|
||||
@ -1405,6 +1414,18 @@ public class ContentController : Controller {
|
||||
return Ok(XmlUtil.ReadResourceXmlString("displaynames"));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetDisplayNameByUserId")] // used by World Of Jumpstart
|
||||
public IActionResult GetDisplayNameByUserId([FromForm] Guid userId)
|
||||
{
|
||||
Viking? idViking = ctx.Vikings.FirstOrDefault(e => e.Uid == userId);
|
||||
if (idViking is null) return Ok("???");
|
||||
|
||||
// return display name
|
||||
return Ok(XmlUtil.DeserializeXml<AvatarData>(idViking.AvatarSerialized!).DisplayName);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
//[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/SetDisplayName")] // used by World Of Jumpstart
|
||||
@ -1443,6 +1464,18 @@ public class ContentController : Controller {
|
||||
return Ok(achievementService.GetUserCurrency(viking));
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/SetGameCurrency")] // used by World Of Jumpstart
|
||||
[VikingSession]
|
||||
public IActionResult SetUserGameCurrency(Viking viking, [FromForm] int amount)
|
||||
{
|
||||
achievementService.AddAchievementPoints(viking, AchievementPointTypes.GameCurrency, amount);
|
||||
|
||||
ctx.SaveChanges();
|
||||
return Ok(achievementService.GetUserCurrency(viking).GameCurrency ?? 0);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("V2/ContentWebService.asmx/RerollUserItem")]
|
||||
@ -1863,6 +1896,15 @@ public class ContentController : Controller {
|
||||
return Ok(0);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ContentWebService.asmx/GetRevealIndex")] // used by World Of Jumpstart (Learning Games)
|
||||
public IActionResult GetRevealIndex()
|
||||
{
|
||||
// TODO - figure out proper way of doing this, if any
|
||||
return Ok(random.Next(1, 15));
|
||||
}
|
||||
|
||||
private static RaisedPetData GetRaisedPetDataFromDragon (Dragon dragon, int? selectedDragonId = null) {
|
||||
if (selectedDragonId is null)
|
||||
selectedDragonId = dragon.Viking.SelectedDragonId;
|
||||
|
@ -27,4 +27,13 @@ public class MessagingController : Controller {
|
||||
// TODO: this is a placeholder
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("MessageWebService.asmx/GetCombinedListMessage")]
|
||||
public IActionResult GetCombinedListMessage()
|
||||
{
|
||||
// TODO - placeholder
|
||||
return Ok(new ArrayOfMessageInfo());
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,15 @@ namespace sodoff.Controllers.Common;
|
||||
public class RatingController : Controller
|
||||
{
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("ScoreWebService.asmx/SetScore")] // used by World Of Jumpstart
|
||||
public IActionResult SetScore()
|
||||
{
|
||||
// TODO - placeholder
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Produces("application/xml")]
|
||||
[Route("V2/Ratingwebservice.asmx/GetAverageRatingForRoom")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user