fix(pack): emit one gacha-point entry per emblem cosmetic + clean stale docstring
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.Globalization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SVSim.Database;
|
||||
using SVSim.Database.Enums;
|
||||
@@ -58,11 +59,11 @@ public sealed class GachaPointService : IGachaPointService
|
||||
.OrderBy(c => c.Class?.Id ?? 0).ThenBy(c => c.Id))
|
||||
{
|
||||
if (!cosmeticLookup.TryGetValue(card.Id, out var cosmetics)) continue;
|
||||
var emblem = cosmetics.FirstOrDefault(c => c.Type == CosmeticType.Emblem);
|
||||
var emblems = cosmetics.Where(c => c.Type == CosmeticType.Emblem).ToList();
|
||||
var skin = cosmetics.FirstOrDefault(c => c.Type == CosmeticType.Skin);
|
||||
if (emblem is null) continue; // every gacha-point entry has an emblem
|
||||
if (emblems.Count == 0) continue; // every gacha-point entry has at least one emblem
|
||||
|
||||
var classId = (card.Class?.Id ?? 0).ToString();
|
||||
var classId = (card.Class?.Id ?? 0).ToString(CultureInfo.InvariantCulture);
|
||||
var isReceived = receivedCardIds.Contains(card.Id);
|
||||
|
||||
if (IsLeaderCard(skin))
|
||||
@@ -70,7 +71,11 @@ public sealed class GachaPointService : IGachaPointService
|
||||
// Leader card — 3 entries in capture order: Sleeve/Card-cosmetic (type 6),
|
||||
// Skin (type 10), Emblem (type 7). The reward_type=6 entry's detail id is the
|
||||
// card_id itself, mirroring the prod capture exactly (no Sleeve cosmetic row
|
||||
// is required — synthesizing from card.Id is robust to missing rows).
|
||||
// is required — synthesizing from card.Id is robust to missing rows). For the
|
||||
// emblem we take the first row only; no capture has shown leader cards with
|
||||
// multiple emblems, and the verified shape is exactly 1 Sleeve + 1 Skin + 1
|
||||
// Emblem. Revisit if such a capture lands.
|
||||
var emblem = emblems[0];
|
||||
leader.Add(new GachaPointRewardDto
|
||||
{
|
||||
ClassId = classId, CardId = card.Id, IsReceived = isReceived,
|
||||
@@ -95,19 +100,23 @@ public sealed class GachaPointService : IGachaPointService
|
||||
}
|
||||
else
|
||||
{
|
||||
standard.Add(new GachaPointRewardDto
|
||||
// Standard legendaries can have multiple emblem cosmetics (e.g. prod capture
|
||||
// pack 10008 card 108044010 has emblem ids 900041040 and 900041050). Emit one
|
||||
// reward_list entry per emblem.
|
||||
var dto = new GachaPointRewardDto
|
||||
{
|
||||
ClassId = classId, CardId = card.Id, IsReceived = isReceived,
|
||||
RewardList =
|
||||
};
|
||||
foreach (var emblem in emblems)
|
||||
{
|
||||
dto.RewardList.Add(new GachaPointRewardDetailEntry
|
||||
{
|
||||
new GachaPointRewardDetailEntry
|
||||
{
|
||||
RewardType = (int)UserGoodsType.Emblem,
|
||||
RewardDetailId = emblem.CosmeticId,
|
||||
RewardNumber = 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
RewardType = (int)UserGoodsType.Emblem,
|
||||
RewardDetailId = emblem.CosmeticId,
|
||||
RewardNumber = 1,
|
||||
});
|
||||
}
|
||||
standard.Add(dto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ public interface IGachaPointService
|
||||
|
||||
/// <summary>
|
||||
/// Increment the viewer's balance for <paramref name="pack"/> by
|
||||
/// <c>child.OverrideIncreaseGachaPoint ?? pack.GachaPointConfig.IncreaseGachaPoint</c>
|
||||
/// <c>child.OverrideIncreaseGachaPoint > 0 ? child.OverrideIncreaseGachaPoint : pack.GachaPointConfig.IncreaseGachaPoint</c>
|
||||
/// times <paramref name="packNumber"/>. No-op when the pack lacks a GachaPointConfig.
|
||||
/// Caller is responsible for SaveChangesAsync.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user