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]
|
[HttpPost]
|
||||||
[Produces("application/xml")]
|
[Produces("application/xml")]
|
||||||
[Route("V2/ContentWebService.asmx/GetCommonInventory")]
|
[Route("V2/ContentWebService.asmx/GetCommonInventory")]
|
||||||
@ -1405,6 +1414,18 @@ public class ContentController : Controller {
|
|||||||
return Ok(XmlUtil.ReadResourceXmlString("displaynames"));
|
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]
|
[HttpPost]
|
||||||
//[Produces("application/xml")]
|
//[Produces("application/xml")]
|
||||||
[Route("ContentWebService.asmx/SetDisplayName")] // used by World Of Jumpstart
|
[Route("ContentWebService.asmx/SetDisplayName")] // used by World Of Jumpstart
|
||||||
@ -1443,6 +1464,18 @@ public class ContentController : Controller {
|
|||||||
return Ok(achievementService.GetUserCurrency(viking));
|
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]
|
[HttpPost]
|
||||||
[Produces("application/xml")]
|
[Produces("application/xml")]
|
||||||
[Route("V2/ContentWebService.asmx/RerollUserItem")]
|
[Route("V2/ContentWebService.asmx/RerollUserItem")]
|
||||||
@ -1863,6 +1896,15 @@ public class ContentController : Controller {
|
|||||||
return Ok(0);
|
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) {
|
private static RaisedPetData GetRaisedPetDataFromDragon (Dragon dragon, int? selectedDragonId = null) {
|
||||||
if (selectedDragonId is null)
|
if (selectedDragonId is null)
|
||||||
selectedDragonId = dragon.Viking.SelectedDragonId;
|
selectedDragonId = dragon.Viking.SelectedDragonId;
|
||||||
|
@ -27,4 +27,13 @@ public class MessagingController : Controller {
|
|||||||
// TODO: this is a placeholder
|
// TODO: this is a placeholder
|
||||||
return Ok(false);
|
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
|
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]
|
[HttpPost]
|
||||||
[Produces("application/xml")]
|
[Produces("application/xml")]
|
||||||
[Route("V2/Ratingwebservice.asmx/GetAverageRatingForRoom")]
|
[Route("V2/Ratingwebservice.asmx/GetAverageRatingForRoom")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user