refactor: type reward_type columns as UserGoodsType enum
Replace bare `int RewardType` on 12 catalog/reward entities and GrantedReward
with the existing UserGoodsType enum. Verified against the decompiled client:
every wire reward_type decodes through the single Wizard.UserGoods.Type enum, so
one enum is correct across all endpoint families (item_type is a separate
Item.Type axis, left untouched). EF stores the enum as the same int column, so
there is no migration.
- Importers cast seed int -> UserGoodsType at the ingest boundary.
- New GrantedReward.ToRewardList() extension replaces 8 copy-pasted
GrantedReward -> RewardListEntry projections.
- Fix 3 .ToString() sites that would otherwise emit enum names ("Crystal")
instead of the int wire value ("2").
- Wire DTOs keep int; the enum is widened to int at the wire boundary only.
Build green; 962/962 tests pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -110,11 +110,11 @@ public class ArenaTwoPickServiceWeightedRewardsTests
|
||||
// Seed catalog: two rows, same group, same WinCount=3.
|
||||
db.ArenaTwoPickRewards.Add(new ArenaTwoPickReward
|
||||
{
|
||||
WinCount = 3, RewardGroup = 1, Weight = 1, RewardType = 9, RewardId = 0, RewardNum = 100
|
||||
WinCount = 3, RewardGroup = 1, Weight = 1, RewardType = (UserGoodsType)9, RewardId = 0, RewardNum = 100
|
||||
});
|
||||
db.ArenaTwoPickRewards.Add(new ArenaTwoPickReward
|
||||
{
|
||||
WinCount = 3, RewardGroup = 1, Weight = 9, RewardType = 9, RewardId = 0, RewardNum = 999
|
||||
WinCount = 3, RewardGroup = 1, Weight = 9, RewardType = (UserGoodsType)9, RewardId = 0, RewardNum = 999
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
@@ -134,11 +134,11 @@ public class ArenaTwoPickServiceWeightedRewardsTests
|
||||
|
||||
db.ArenaTwoPickRewards.Add(new ArenaTwoPickReward
|
||||
{
|
||||
WinCount = 2, RewardGroup = 1, Weight = 0, RewardType = 9, RewardId = 0, RewardNum = 9999
|
||||
WinCount = 2, RewardGroup = 1, Weight = 0, RewardType = (UserGoodsType)9, RewardId = 0, RewardNum = 9999
|
||||
});
|
||||
db.ArenaTwoPickRewards.Add(new ArenaTwoPickReward
|
||||
{
|
||||
WinCount = 2, RewardGroup = 1, Weight = 1, RewardType = 9, RewardId = 0, RewardNum = 500
|
||||
WinCount = 2, RewardGroup = 1, Weight = 1, RewardType = (UserGoodsType)9, RewardId = 0, RewardNum = 500
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ArenaTwoPickServiceWeightedRewardsTests
|
||||
|
||||
db.ArenaTwoPickRewards.Add(new ArenaTwoPickReward
|
||||
{
|
||||
WinCount = 1, RewardGroup = 1, Weight = 1, RewardType = 9, RewardId = 0, RewardNum = 0
|
||||
WinCount = 1, RewardGroup = 1, Weight = 1, RewardType = (UserGoodsType)9, RewardId = 0, RewardNum = 0
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
@@ -189,7 +189,7 @@ public class ArenaTwoPickServiceWeightedRewardsTests
|
||||
// still satisfies the >=5 check so Retire works regardless).
|
||||
db.ArenaTwoPickRewards.Add(new ArenaTwoPickReward
|
||||
{
|
||||
WinCount = 0, RewardGroup = 1, Weight = 1, RewardType = 9, RewardId = 0, RewardNum = 50
|
||||
WinCount = 0, RewardGroup = 1, Weight = 1, RewardType = (UserGoodsType)9, RewardId = 0, RewardNum = 50
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user