From ca951d78e8c5eab7fd7d3ea32db0bd48835f55e6 Mon Sep 17 00:00:00 2001 From: YesntSoup Date: Tue, 3 Sep 2024 16:48:06 -0400 Subject: [PATCH] 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! --- src/Controllers/Common/ContentController.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Controllers/Common/ContentController.cs b/src/Controllers/Common/ContentController.cs index 32b8ced..6b07c24 100644 --- a/src/Controllers/Common/ContentController.cs +++ b/src/Controllers/Common/ContentController.cs @@ -514,7 +514,7 @@ public class ContentController : Controller { [Produces("application/xml")] [Route("ContentWebService.asmx/CreateRaisedPet")] // used by SoD 1.6 [VikingSession] - public RaisedPetData? CreateRaisedPet(Viking viking, int petTypeID) { + public RaisedPetData? CreateRaisedPet([FromForm] string apiKey, Viking viking, int petTypeID) { // Update the RaisedPetData with the info String dragonId = Guid.NewGuid().ToString(); @@ -523,7 +523,9 @@ public class ContentController : Controller { raisedPetData.PetTypeID = petTypeID; raisedPetData.RaisedPetID = 0; // Initially make zero, so the db auto-fills 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.CreateDate = new DateTime(DateTime.Now.Ticks); raisedPetData.UpdateDate = new DateTime(DateTime.Now.Ticks);