SetRaisedPetInactive -> support for releasing pet

This commit is contained in:
Robert Paciorek 2023-09-09 00:04:16 +00:00
parent 6dde75fbc7
commit 7189f049e8

View File

@ -571,6 +571,17 @@ public class ContentController : Controller {
}); });
} }
[HttpPost]
[Produces("application/xml")]
[Route("ContentWebService.asmx/SetRaisedPetInactive")] // used by World Of Jumpstart
[VikingSession]
public IActionResult SetRaisedPetInactive(Viking viking, [FromForm] int raisedPetID) {
viking.SelectedDragonId = null;
ctx.SaveChanges();
return Ok(true);
}
[HttpPost] [HttpPost]
[Produces("application/xml")] [Produces("application/xml")]
[Route("ContentWebService.asmx/SetSelectedPet")] [Route("ContentWebService.asmx/SetSelectedPet")]
@ -665,6 +676,7 @@ public class ContentController : Controller {
return new RaisedPetData[0]; return new RaisedPetData[0];
} }
// NOTE: returned dragon PetTypeID should be equal value of pair 1967 → CurrentRaisedPetType
return new RaisedPetData[] {GetRaisedPetDataFromDragon(dragon)}; return new RaisedPetData[] {GetRaisedPetDataFromDragon(dragon)};
} }
@ -685,10 +697,15 @@ public class ContentController : Controller {
[HttpPost] [HttpPost]
[Produces("application/xml")] [Produces("application/xml")]
[Route("ContentWebService.asmx/GetInactiveRaisedPet")] // used by World Of Jumpstart [Route("ContentWebService.asmx/GetInactiveRaisedPet")] // used by World Of Jumpstart 1.1
[VikingSession(UseLock=false)] [VikingSession(UseLock=false)]
public RaisedPetData[] GetInactiveRaisedPet(Viking viking) { public RaisedPetData[] GetInactiveRaisedPet(Viking viking) {
return new RaisedPetData[0]; // FIXME should return real inactive pets list RaisedPetData[] dragons = viking.Dragons
.Where(d => d.RaisedPetData is not null && d.Id != viking.SelectedDragonId)
.Select(d => GetRaisedPetDataFromDragon(d, viking.SelectedDragonId))
.ToArray();
return dragons;
} }
[HttpPost] [HttpPost]