diff --git a/Server/src/SOR.Bazaar/Handlers/BazaarGetSuggestedPriceHandler.cs b/Server/src/SOR.Bazaar/Handlers/BazaarGetSuggestedPriceHandler.cs index ee7ea1a..7fccb91 100644 --- a/Server/src/SOR.Bazaar/Handlers/BazaarGetSuggestedPriceHandler.cs +++ b/Server/src/SOR.Bazaar/Handlers/BazaarGetSuggestedPriceHandler.cs @@ -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; diff --git a/Server/src/SOR.Collection/CardSalvageValues.cs b/Server/src/SOR.Collection/CardSalvageValues.cs index e61cb17..1c2bf91 100644 --- a/Server/src/SOR.Collection/CardSalvageValues.cs +++ b/Server/src/SOR.Collection/CardSalvageValues.cs @@ -1,48 +1,3 @@ -namespace SOR.Collection; - -using SOR.Database.Enums; - -/// -/// 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. -/// -public static class CardSalvageValues -{ - private static readonly Dictionary Table = new() - { - [CardRarity.Common] = (5, 1), - [CardRarity.Uncommon] = (12, 2), - [CardRarity.Rare] = (40, 5), - [CardRarity.Epic] = (120, 12), - [CardRarity.Legendary] = (300, 25), - }; - - /// - /// Calculates the Origin Points awarded when a card is salvaged. - /// - /// The card's rarity. - /// The card's Spirit Point (SP) play cost. - /// The card's Stamina (ST) play cost. - /// Whether the card instance is a foil copy (doubles the reward). - 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; - } - - /// - /// Returns the rarity-base value without any cost contribution. - /// Used as a floor when cost data is not available (e.g. price suggestions). - /// - 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; diff --git a/Server/src/SOR.Database/CardSalvageValues.cs b/Server/src/SOR.Database/CardSalvageValues.cs new file mode 100644 index 0000000..43e568f --- /dev/null +++ b/Server/src/SOR.Database/CardSalvageValues.cs @@ -0,0 +1,36 @@ +namespace SOR.Database; + +using SOR.Database.Enums; + +/// +/// 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. +/// +public static class CardSalvageValues +{ + private static readonly Dictionary Table = new() + { + [CardRarity.Common] = (5, 1), + [CardRarity.Uncommon] = (12, 2), + [CardRarity.Rare] = (40, 5), + [CardRarity.Epic] = (120, 12), + [CardRarity.Legendary] = (300, 25), + }; + + /// Origin Points awarded when a card is salvaged. + 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; + } + + /// + /// Rarity-base value without any cost contribution. + /// Used as a floor when cost data is not available (e.g. price suggestions). + /// + public static int BaseValue(CardRarity rarity) => Table[rarity].Base; +}