Prebuilt deck purchasing and fixes

This commit is contained in:
gamer147
2026-05-26 09:16:21 -04:00
parent fa0901b776
commit b6966ece6e
39 changed files with 7392 additions and 15 deletions

View File

@@ -0,0 +1,21 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.BuildDeck;
/// <summary>
/// /build_deck/buy request body. sales_type is ShopCommonUtility.SalesType:
/// 0=free, 1=crystal, 2=rupy, 3=ticket (v1: 3 returns 501).
/// </summary>
[MessagePackObject]
public class BuildDeckBuyRequest : BaseRequest
{
[JsonPropertyName("product_id")]
[Key("product_id")]
public int ProductId { get; set; }
[JsonPropertyName("sales_type")]
[Key("sales_type")]
public int SalesType { get; set; }
}

View File

@@ -0,0 +1,13 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.BuildDeck;
[MessagePackObject]
public class BuildDeckGetPurchaseCountRequest : BaseRequest
{
[JsonPropertyName("product_id")]
[Key("product_id")]
public int ProductId { get; set; }
}

View File

@@ -0,0 +1,17 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.BuildDeck;
/// <summary>
/// /build_deck/info request body. <c>add_series_id == 0</c> means "return all"; non-zero filters
/// to the single matching series (used by the client to re-fetch after a purchase).
/// </summary>
[MessagePackObject]
public class BuildDeckInfoRequest : BaseRequest
{
[JsonPropertyName("add_series_id")]
[Key("add_series_id")]
public int AddSeriesId { get; set; }
}

View File

@@ -0,0 +1,33 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Requests.LeaderSkin;
/// <summary>
/// POST /leader_skin/set — the per-class "current leader skin" preference used as a fallback
/// when a deck has <c>leader_skin_id == 0</c>. Two modes:
/// - Non-random: <c>is_random_leader_skin=false</c>, <c>leader_skin_id</c> is the chosen skin id.
/// - Random: <c>is_random_leader_skin=true</c>, <c>leader_skin_id_list</c> is the shuffle pool
/// (server picks per-match). Random mode is not implemented in v1 (returns 501).
/// Source: <c>Wizard/LeaderSkinUpdateTask.cs</c>.
/// </summary>
[MessagePackObject]
public class LeaderSkinSetRequest : BaseRequest
{
[JsonPropertyName("class_id")]
[Key("class_id")]
public int ClassId { get; set; }
[JsonPropertyName("leader_skin_id")]
[Key("leader_skin_id")]
public int LeaderSkinId { get; set; }
[JsonPropertyName("is_random_leader_skin")]
[Key("is_random_leader_skin")]
public bool IsRandomLeaderSkin { get; set; }
[JsonPropertyName("leader_skin_id_list")]
[Key("leader_skin_id_list")]
public int[] LeaderSkinIdList { get; set; } = Array.Empty<int>();
}

View File

@@ -0,0 +1,22 @@
using System.Text.Json.Serialization;
using MessagePack;
using SVSim.EmulatedEntrypoint.Models.Dtos;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.BuildDeck;
/// <summary>
/// /build_deck/buy response. reward_list items use reward_id/reward_num (driven by
/// PlayerStaticData.UpdateHaveUserGoodsNumByJsonData with POST-STATE-TOTAL semantics);
/// series_rewards items use reward_detail_id/reward_number — different naming, intentional.
/// </summary>
[MessagePackObject]
public class BuildDeckBuyResponse
{
[JsonPropertyName("reward_list")]
[Key("reward_list")]
public List<RewardListEntry> RewardList { get; set; } = new();
[JsonPropertyName("series_rewards")]
[Key("series_rewards")]
public List<BuildDeckProductRewardDto> SeriesRewards { get; set; } = new();
}

View File

@@ -0,0 +1,16 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.BuildDeck;
[MessagePackObject]
public class BuildDeckGetPurchaseCountResponse
{
[JsonPropertyName("purchase_num_current")]
[Key("purchase_num_current")]
public int PurchaseNumCurrent { get; set; }
[JsonPropertyName("purchase_num_max")]
[Key("purchase_num_max")]
public int PurchaseNumMax { get; set; }
}

View File

@@ -0,0 +1,118 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.BuildDeck;
// /build_deck/info wire shape: the controller returns `List<BuildDeckSeriesDto>` directly so
// `data` becomes a bare array `[{series_id:...},...]`. The client iterates `data` via numeric
// indexer; a wrapper object like `{series_list:[...]}` would put the array one level deeper
// and break the iteration. There is no BuildDeckInfoResponse wrapper type — the response IS
// the series list.
[MessagePackObject]
public class BuildDeckSeriesDto
{
[JsonPropertyName("series_id")]
[Key("series_id")]
public int SeriesId { get; set; }
[JsonPropertyName("order_id")]
[Key("order_id")]
public int OrderId { get; set; }
[JsonPropertyName("is_new")]
[Key("is_new")]
public bool IsNew { get; set; }
[JsonPropertyName("products")]
[Key("products")]
public List<BuildDeckProductDto> Products { get; set; } = new();
[JsonPropertyName("series_rewards")]
[Key("series_rewards")]
public List<BuildDeckSeriesRewardTierDto> SeriesRewards { get; set; } = new();
}
[MessagePackObject]
public class BuildDeckProductDto
{
[JsonPropertyName("product_id")]
[Key("product_id")]
public int ProductId { get; set; }
[JsonPropertyName("product_name")]
[Key("product_name")]
public string ProductName { get; set; } = string.Empty;
[JsonPropertyName("leader_id")]
[Key("leader_id")]
public int LeaderId { get; set; }
[JsonPropertyName("deck_code")]
[Key("deck_code")]
public string DeckCode { get; set; } = string.Empty;
[JsonPropertyName("featured_card_id")]
[Key("featured_card_id")]
public long FeaturedCardId { get; set; }
[JsonPropertyName("purchase_num_max")]
[Key("purchase_num_max")]
public int PurchaseNumMax { get; set; }
[JsonPropertyName("purchase_num_current")]
[Key("purchase_num_current")]
public int PurchaseNumCurrent { get; set; }
[JsonPropertyName("is_first_price")]
[Key("is_first_price")]
public bool IsFirstPrice { get; set; }
[JsonPropertyName("rewards")]
[Key("rewards")]
public List<BuildDeckProductRewardDto> Rewards { get; set; } = new();
[JsonPropertyName("sales_period_info")]
[Key("sales_period_info")]
public List<object> SalesPeriodInfo { get; set; } = new(); // always [] in v1
[JsonPropertyName("price_crystal")]
[Key("price_crystal")]
public int? PriceCrystal { get; set; }
[JsonPropertyName("price_rupy")]
[Key("price_rupy")]
public int? PriceRupy { get; set; }
}
[MessagePackObject]
public class BuildDeckProductRewardDto
{
[JsonPropertyName("reward_type")]
[Key("reward_type")]
public int RewardType { get; set; }
[JsonPropertyName("reward_detail_id")]
[Key("reward_detail_id")]
public long RewardDetailId { get; set; }
[JsonPropertyName("reward_number")]
[Key("reward_number")]
public int RewardNumber { get; set; }
[JsonPropertyName("message_id")]
[Key("message_id")]
public int MessageId { get; set; }
}
[MessagePackObject]
public class BuildDeckSeriesRewardTierDto
{
[JsonPropertyName("reward_list")]
[Key("reward_list")]
public List<BuildDeckProductRewardDto> RewardList { get; set; } = new();
[JsonPropertyName("is_get")]
[Key("is_get")]
public bool IsGet { get; set; }
}

View File

@@ -0,0 +1,27 @@
using System.Text.Json.Serialization;
using MessagePack;
namespace SVSim.EmulatedEntrypoint.Models.Dtos.Responses.LeaderSkin;
/// <summary>
/// Response shape for POST /leader_skin/set. Per <c>LeaderSkinUpdateTask.Parse</c>:
/// - <c>is_random_leader_skin</c> echoes the mode the server actually applied.
/// - <c>leader_skin_id</c> is only consumed by the client when random mode is on (it picks
/// one of the pool to display). In non-random mode the client uses the request's id.
/// - <c>leader_skin_id_list</c> is the active shuffle pool (empty for non-random).
/// </summary>
[MessagePackObject]
public class LeaderSkinSetResponse
{
[JsonPropertyName("is_random_leader_skin")]
[Key("is_random_leader_skin")]
public bool IsRandomLeaderSkin { get; set; }
[JsonPropertyName("leader_skin_id")]
[Key("leader_skin_id")]
public int LeaderSkinId { get; set; }
[JsonPropertyName("leader_skin_id_list")]
[Key("leader_skin_id_list")]
public List<int> LeaderSkinIdList { get; set; } = new();
}