Fix build: move CardSalvageValues to SOR.Database

SOR.Bazaar has no project reference to SOR.Collection, so the using
in BazaarGetSuggestedPriceHandler caused CS0234.

- Move CardSalvageValues class to SOR.Database (shared by both assemblies)
- Replace SOR.Collection/CardSalvageValues.cs with a global using alias
  so Collection handlers continue to work without changes
- Update BazaarGetSuggestedPriceHandler to use SOR.Database instead of SOR.Collection

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-06-04 09:47:28 -04:00
co-authored by Claude Happy
parent 47808074ef
commit ed300d4e4f
3 changed files with 40 additions and 49 deletions
@@ -1,7 +1,7 @@
namespace SOR.Bazaar.Handlers;
using Microsoft.EntityFrameworkCore;
using SOR.Collection;
using SOR.Database;
using SOR.Database.Contexts;
using SOR.Networking.Abstractions.Messaging;
using SOR.Networking.Abstractions.Transport;
+3 -48
View File
@@ -1,48 +1,3 @@
namespace SOR.Collection;
using SOR.Database.Enums;
/// <summary>
/// Canonical salvage (disenchant) value formula for player-owned cards.
///
/// Value = RarityBase[rarity] + (SpCost + StCost) * CostMultiplier[rarity]
/// Foil cards are worth 2× the standard value.
///
/// The cost multiplier scales with rarity so that a high-cost Rare is
/// proportionally more valuable than a high-cost Common without inflating
/// the lower end of the economy.
///
/// Cards with SpCost = 0 and StCost = 0 (tokens, passive terrain) return
/// only the RarityBase — they still have a floor value.
/// </summary>
public static class CardSalvageValues
{
private static readonly Dictionary<CardRarity, (int Base, int CostMultiplier)> Table = new()
{
[CardRarity.Common] = (5, 1),
[CardRarity.Uncommon] = (12, 2),
[CardRarity.Rare] = (40, 5),
[CardRarity.Epic] = (120, 12),
[CardRarity.Legendary] = (300, 25),
};
/// <summary>
/// Calculates the Origin Points awarded when a card is salvaged.
/// </summary>
/// <param name="rarity">The card's rarity.</param>
/// <param name="spCost">The card's Spirit Point (SP) play cost.</param>
/// <param name="stCost">The card's Stamina (ST) play cost.</param>
/// <param name="isFoil">Whether the card instance is a foil copy (doubles the reward).</param>
public static int Calculate(CardRarity rarity, int spCost, int stCost, bool isFoil)
{
var (rarityBase, costMult) = Table[rarity];
var value = rarityBase + (spCost + stCost) * costMult;
return isFoil ? value * 2 : value;
}
/// <summary>
/// Returns the rarity-base value without any cost contribution.
/// Used as a floor when cost data is not available (e.g. price suggestions).
/// </summary>
public static int BaseValue(CardRarity rarity) => Table[rarity].Base;
}
// CardSalvageValues lives in SOR.Database so SOR.Bazaar can also reference it.
// This alias lets existing SOR.Collection code use the name without qualification.
global using CardSalvageValues = SOR.Database.CardSalvageValues;
@@ -0,0 +1,36 @@
namespace SOR.Database;
using SOR.Database.Enums;
/// <summary>
/// Canonical salvage (disenchant) value formula for player-owned cards.
/// Placed in SOR.Database so both SOR.Collection and SOR.Bazaar can access it.
///
/// Value = RarityBase[rarity] + (SpCost + StCost) * CostMultiplier[rarity]
/// Foil cards are worth 2× the standard value.
/// </summary>
public static class CardSalvageValues
{
private static readonly Dictionary<CardRarity, (int Base, int CostMultiplier)> Table = new()
{
[CardRarity.Common] = (5, 1),
[CardRarity.Uncommon] = (12, 2),
[CardRarity.Rare] = (40, 5),
[CardRarity.Epic] = (120, 12),
[CardRarity.Legendary] = (300, 25),
};
/// <summary>Origin Points awarded when a card is salvaged.</summary>
public static int Calculate(CardRarity rarity, int spCost, int stCost, bool isFoil)
{
var (rarityBase, costMult) = Table[rarity];
var value = rarityBase + (spCost + stCost) * costMult;
return isFoil ? value * 2 : value;
}
/// <summary>
/// Rarity-base value without any cost contribution.
/// Used as a floor when cost data is not available (e.g. price suggestions).
/// </summary>
public static int BaseValue(CardRarity rarity) => Table[rarity].Base;
}