From 28e275bcaa70892a24a07701efdbfc67c228fcd2 Mon Sep 17 00:00:00 2001 From: Hipposgrumm <60556345+Hipposgrumm@users.noreply.github.com> Date: Tue, 16 Jul 2024 02:39:47 -0600 Subject: [PATCH] Math Blaster Pod Parties and Birthday Pod Parties (#10) * Added support for Math Blaster Pod and Birthday parties. * Now sends only the appropriate parties for each game. Math Blaster only gets parties in MyPodInt. JumpStart only gets parties in MyNeighborhood or MyVIPRoomInt. Parties in any other rooms don't get sent. Any other games don't get sent parties (I couldn't work out how to set up SuperSecret for testing). --- src/Controllers/Common/ContentController.cs | 42 ++++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/src/Controllers/Common/ContentController.cs b/src/Controllers/Common/ContentController.cs index fd337fe..d281168 100644 --- a/src/Controllers/Common/ContentController.cs +++ b/src/Controllers/Common/ContentController.cs @@ -1441,7 +1441,7 @@ public class ContentController : Controller { [HttpPost] [Produces("application/xml")] [Route("ContentWebService.asmx/GetActiveParties")] // used by World Of Jumpstart - public IActionResult GetActiveParties() + public IActionResult GetActiveParties([FromForm] string apiKey) { List allParties = ctx.Parties.ToList(); List userParties = new List(); @@ -1456,6 +1456,7 @@ public class ContentController : Controller { continue; } + Viking viking = ctx.Vikings.FirstOrDefault(e => e.Id == party.VikingId); AvatarData avatarData = XmlUtil.DeserializeXml(viking.AvatarSerialized); UserParty userParty = new UserParty @@ -1471,8 +1472,26 @@ public class ContentController : Controller { if (party.Location == "MyNeighborhood") userParty.DisplayName = $"{userParty.UserName}'s Block Party"; if (party.Location == "MyVIPRoomInt") userParty.DisplayName = $"{userParty.UserName}'s VIP Party"; + if (party.Location == "MyPodInt") { + // Only way to do this without adding another column to the table. + if (party.AssetBundle == "RS_DATA/PfMyPodBirthdayParty.unity3d/PfMyPodBirthdayParty") { + userParty.DisplayName = $"{userParty.UserName}'s Pod Birthday Party"; + } else { + userParty.DisplayName = $"{userParty.UserName}'s Pod Party"; + } + } - userParties.Add(userParty); + uint gameVersion = ClientVersion.GetVersion(apiKey); + // Send only JumpStart parties to JumpStart + if (gameVersion <= ClientVersion.Max_OldJS && (gameVersion & ClientVersion.WoJS) != 0 + && (party.Location == "MyNeighborhood" + || party.Location == "MyVIPRoomInt")) { + userParties.Add(userParty); + // Send only Math Blaster parties to Math Blaster + } else if (gameVersion == ClientVersion.MB + && party.Location == "MyPodInt") { + userParties.Add(userParty); + } } return Ok(new UserPartyData { NonBuddyParties = userParties.ToArray() }); @@ -1526,7 +1545,7 @@ public class ContentController : Controller { [Produces("application/xml")] [Route("ContentWebService.asmx/PurchaseParty")] // used by World Of Jumpstart [VikingSession] - public IActionResult PurchaseParty(Viking viking, [FromForm] int itemId) + public IActionResult PurchaseParty(Viking viking, [FromForm] int itemId, [FromForm] string apiKey) { ItemData itemData = itemService.GetItem(itemId); @@ -1542,14 +1561,25 @@ public class ContentController : Controller { return Ok(null); } + uint gameVersion = ClientVersion.GetVersion(apiKey); if (partyType == "Default") { - party.Location = "MyNeighborhood"; - party.LocationIconAsset = "RS_DATA/PfUiPartiesList.unity3d/IcoPartyLocationMyNeighborhood"; - party.AssetBundle = "RS_DATA/PfMyNeighborhoodParty.unity3d/PfMyNeighborhoodParty"; + if (gameVersion == ClientVersion.MB) { + party.Location = "MyPodInt"; + party.LocationIconAsset = "RS_DATA/PfUiPartiesListMB.unity3d/IcoMbPartyDefault"; + party.AssetBundle = "RS_DATA/PfMyPodParty.unity3d/PfMyPodParty"; + } else { + party.Location = "MyNeighborhood"; + party.LocationIconAsset = "RS_DATA/PfUiPartiesList.unity3d/IcoPartyLocationMyNeighborhood"; + party.AssetBundle = "RS_DATA/PfMyNeighborhoodParty.unity3d/PfMyNeighborhoodParty"; + } } else if (partyType == "VIPRoom") { party.Location = "MyVIPRoomInt"; party.LocationIconAsset = "RS_DATA/PfUiPartiesList.unity3d/IcoPartyDefault"; party.AssetBundle = "RS_DATA/PfMyVIPRoomIntPartyGroup.unity3d/PfMyVIPRoomIntPartyGroup"; + } else if (partyType == "Birthday") { + party.Location = "MyPodInt"; + party.LocationIconAsset = "RS_DATA/PfUiPartiesListMB.unity3d/IcoMbPartyBirthday"; + party.AssetBundle = "RS_DATA/PfMyPodBirthdayParty.unity3d/PfMyPodBirthdayParty"; } else { Console.WriteLine($"Unsupported partyType = {partyType}"); return Ok(null);