mirror of
https://github.com/SoDOff-Project/sodoff.git
synced 2025-10-11 08:18:49 -07:00
implement Petz system
This commit is contained in:
parent
6960aadcc3
commit
c842a2f3b2
@ -67,10 +67,53 @@ public class ContentController : Controller {
|
|||||||
//[Produces("application/xml")]
|
//[Produces("application/xml")]
|
||||||
[Route("ContentWebService.asmx/SetProduct")] // used by World Of Jumpstart
|
[Route("ContentWebService.asmx/SetProduct")] // used by World Of Jumpstart
|
||||||
[VikingSession]
|
[VikingSession]
|
||||||
public string? SetProduct(Viking viking, [FromForm] string contentXml) {
|
public bool SetProduct(Viking viking, [FromForm] string contentXml) {
|
||||||
viking.ProductData = contentXml;
|
viking.ProductData = contentXml;
|
||||||
ctx.SaveChanges();
|
ctx.SaveChanges();
|
||||||
return viking.ProductData;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: "Pet" (Petz) system (GetCurrentPetByUserID, GetCurrentPet, SetCurrentPet, DelCurrentPet) is a totally different system than "RaisedPet" (Dragons)
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
//[Produces("application/xml")]
|
||||||
|
[Route("ContentWebService.asmx/GetCurrentPetByUserID")] // used by World Of Jumpstart
|
||||||
|
public IActionResult GetCurrentPetByUserID([FromForm] Guid userId, [FromForm] bool isActive) {
|
||||||
|
string? petData = ctx.Vikings.FirstOrDefault(e => e.Uid == userId)?.PetSerialized;
|
||||||
|
if (petData is null)
|
||||||
|
return Ok(XmlUtil.SerializeXml<PetData>(null));
|
||||||
|
|
||||||
|
return Ok(petData);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
//[Produces("application/xml")]
|
||||||
|
[Route("ContentWebService.asmx/GetCurrentPet")] // used by World Of Jumpstart
|
||||||
|
public IActionResult GetCurrentPet(Viking viking, [FromForm] bool isActive) {
|
||||||
|
if (viking.PetSerialized is null)
|
||||||
|
return Ok(XmlUtil.SerializeXml<PetData>(null));
|
||||||
|
|
||||||
|
return Ok(viking.PetSerialized);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[Produces("application/xml")]
|
||||||
|
[Route("ContentWebService.asmx/SetCurrentPet")] // used by World Of Jumpstart
|
||||||
|
[VikingSession]
|
||||||
|
public bool SetCurrentPet(Viking viking, [FromForm] string contentXml) {
|
||||||
|
viking.PetSerialized = contentXml;
|
||||||
|
ctx.SaveChanges();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
[Produces("application/xml")]
|
||||||
|
[Route("ContentWebService.asmx/DelCurrentPet")] // used by World Of Jumpstart
|
||||||
|
[VikingSession]
|
||||||
|
public bool DelCurrentPet(Viking viking, [FromForm] bool isActive) {
|
||||||
|
viking.PetSerialized = null;
|
||||||
|
ctx.SaveChanges();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -656,20 +699,6 @@ public class ContentController : Controller {
|
|||||||
return filteredDragons.ToArray();
|
return filteredDragons.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
[Produces("application/xml")]
|
|
||||||
[Route("ContentWebService.asmx/GetCurrentPetByUserID")] // used by World Of Jumpstart
|
|
||||||
[VikingSession(UseLock=false)]
|
|
||||||
public PetData? GetCurrentPetByUserID(Viking viking, [FromForm] string userId, [FromForm] bool isActive) {
|
|
||||||
Console.WriteLine(string.Format("\n{0}", Request.Path));
|
|
||||||
foreach (var x in Request.Form)
|
|
||||||
Console.WriteLine(string.Format("{0}", x));
|
|
||||||
|
|
||||||
// TODO WoJS placeholder
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Produces("application/xml")]
|
[Produces("application/xml")]
|
||||||
[Route("ContentWebService.asmx/GetActiveRaisedPet")] // used by World Of Jumpstart
|
[Route("ContentWebService.asmx/GetActiveRaisedPet")] // used by World Of Jumpstart
|
||||||
|
@ -35,4 +35,5 @@ public class Viking {
|
|||||||
public virtual Dragon? SelectedDragon { get; set; }
|
public virtual Dragon? SelectedDragon { get; set; }
|
||||||
|
|
||||||
public string? ProductData { get; set; }
|
public string? ProductData { get; set; }
|
||||||
|
public string? PetSerialized { get; set; }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user