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).
This commit is contained in:
Hipposgrumm 2024-07-16 02:39:47 -06:00 committed by Robert Paciorek
parent 10d0fed889
commit 28e275bcaa

View File

@ -1441,7 +1441,7 @@ public class ContentController : Controller {
[HttpPost] [HttpPost]
[Produces("application/xml")] [Produces("application/xml")]
[Route("ContentWebService.asmx/GetActiveParties")] // used by World Of Jumpstart [Route("ContentWebService.asmx/GetActiveParties")] // used by World Of Jumpstart
public IActionResult GetActiveParties() public IActionResult GetActiveParties([FromForm] string apiKey)
{ {
List<Party> allParties = ctx.Parties.ToList(); List<Party> allParties = ctx.Parties.ToList();
List<UserParty> userParties = new List<UserParty>(); List<UserParty> userParties = new List<UserParty>();
@ -1456,6 +1456,7 @@ public class ContentController : Controller {
continue; continue;
} }
Viking viking = ctx.Vikings.FirstOrDefault(e => e.Id == party.VikingId); Viking viking = ctx.Vikings.FirstOrDefault(e => e.Id == party.VikingId);
AvatarData avatarData = XmlUtil.DeserializeXml<AvatarData>(viking.AvatarSerialized); AvatarData avatarData = XmlUtil.DeserializeXml<AvatarData>(viking.AvatarSerialized);
UserParty userParty = new UserParty 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 == "MyNeighborhood") userParty.DisplayName = $"{userParty.UserName}'s Block Party";
if (party.Location == "MyVIPRoomInt") userParty.DisplayName = $"{userParty.UserName}'s VIP 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";
}
}
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); 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() }); return Ok(new UserPartyData { NonBuddyParties = userParties.ToArray() });
@ -1526,7 +1545,7 @@ public class ContentController : Controller {
[Produces("application/xml")] [Produces("application/xml")]
[Route("ContentWebService.asmx/PurchaseParty")] // used by World Of Jumpstart [Route("ContentWebService.asmx/PurchaseParty")] // used by World Of Jumpstart
[VikingSession] [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); ItemData itemData = itemService.GetItem(itemId);
@ -1542,14 +1561,25 @@ public class ContentController : Controller {
return Ok(null); return Ok(null);
} }
uint gameVersion = ClientVersion.GetVersion(apiKey);
if (partyType == "Default") { if (partyType == "Default") {
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.Location = "MyNeighborhood";
party.LocationIconAsset = "RS_DATA/PfUiPartiesList.unity3d/IcoPartyLocationMyNeighborhood"; party.LocationIconAsset = "RS_DATA/PfUiPartiesList.unity3d/IcoPartyLocationMyNeighborhood";
party.AssetBundle = "RS_DATA/PfMyNeighborhoodParty.unity3d/PfMyNeighborhoodParty"; party.AssetBundle = "RS_DATA/PfMyNeighborhoodParty.unity3d/PfMyNeighborhoodParty";
}
} else if (partyType == "VIPRoom") { } else if (partyType == "VIPRoom") {
party.Location = "MyVIPRoomInt"; party.Location = "MyVIPRoomInt";
party.LocationIconAsset = "RS_DATA/PfUiPartiesList.unity3d/IcoPartyDefault"; party.LocationIconAsset = "RS_DATA/PfUiPartiesList.unity3d/IcoPartyDefault";
party.AssetBundle = "RS_DATA/PfMyVIPRoomIntPartyGroup.unity3d/PfMyVIPRoomIntPartyGroup"; 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 { } else {
Console.WriteLine($"Unsupported partyType = {partyType}"); Console.WriteLine($"Unsupported partyType = {partyType}");
return Ok(null); return Ok(null);