Change automatic RaisedPet name to not happen for WoJS (#6)

* Change automatic RaisedPet name to not happen for WoJS

This is because Voltage Dragons get a name later, so this placeholder name currently gets assigned first. 

I've never done this before, so let me know if I did it wrong lol

* Added Max_OldJS to the previous PR
* Added HaiFire's suggestion
* Added [FromForm] string apiKey

Ty HaiFire again!
This commit is contained in:
YesntSoup 2024-09-03 16:48:06 -04:00 committed by GitHub
parent 2f5a589bd4
commit ca951d78e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -514,7 +514,7 @@ public class ContentController : Controller {
[Produces("application/xml")] [Produces("application/xml")]
[Route("ContentWebService.asmx/CreateRaisedPet")] // used by SoD 1.6 [Route("ContentWebService.asmx/CreateRaisedPet")] // used by SoD 1.6
[VikingSession] [VikingSession]
public RaisedPetData? CreateRaisedPet(Viking viking, int petTypeID) { public RaisedPetData? CreateRaisedPet([FromForm] string apiKey, Viking viking, int petTypeID) {
// Update the RaisedPetData with the info // Update the RaisedPetData with the info
String dragonId = Guid.NewGuid().ToString(); String dragonId = Guid.NewGuid().ToString();
@ -523,7 +523,9 @@ public class ContentController : Controller {
raisedPetData.PetTypeID = petTypeID; raisedPetData.PetTypeID = petTypeID;
raisedPetData.RaisedPetID = 0; // Initially make zero, so the db auto-fills raisedPetData.RaisedPetID = 0; // Initially make zero, so the db auto-fills
raisedPetData.EntityID = Guid.Parse(dragonId); raisedPetData.EntityID = Guid.Parse(dragonId);
raisedPetData.Name = string.Concat("Dragon-", dragonId.AsSpan(0, 8)); // Start off with a random name uint gameVersion = ClientVersion.GetVersion(apiKey);
if (gameVersion > ClientVersion.Max_OldJS || (gameVersion & ClientVersion.WoJS) == 0)
raisedPetData.Name = string.Concat("Dragon-", dragonId.AsSpan(0, 8)); // Start off with a random name (if game isn't WoJS)
raisedPetData.IsSelected = false; // The api returns false, not sure why raisedPetData.IsSelected = false; // The api returns false, not sure why
raisedPetData.CreateDate = new DateTime(DateTime.Now.Ticks); raisedPetData.CreateDate = new DateTime(DateTime.Now.Ticks);
raisedPetData.UpdateDate = new DateTime(DateTime.Now.Ticks); raisedPetData.UpdateDate = new DateTime(DateTime.Now.Ticks);