namespace BlueLaminate.Core.Tradeups;
///
/// The ordered weapon-skin rarity tiers that participate in a 10-input tradeup.
/// The ordinal value IS the tier order: a tradeup consumes 10 inputs of tier T and
/// produces an output at the next tier present in the same collection.
///
/// Only the six weapon tiers are modelled. The catalogue also carries
/// Contraband (the Howl) and Extraordinary (gloves), and knives are
/// stored as Covert; none of those are weapon tradeup tiers, so
/// reports them as "not a weapon tier" rather than mapping
/// them. See the eligibility rules in .
///
///
public enum WeaponRarity
{
Consumer = 1,
Industrial = 2,
MilSpec = 3,
Restricted = 4,
Classified = 5,
Covert = 6,
}
public static class WeaponRarityExtensions
{
///
/// Maps a skins.rarity string literal to its weapon tier.
///
///
/// true with set when the literal is one of the
/// six weapon tiers; false for Contraband/Extraordinary
/// (valid catalogue rarities that are not weapon tradeup tiers).
///
///
/// The literal is none of the known catalogue rarities. Thrown deliberately so a
/// catalogue rename surfaces loudly instead of silently dropping a whole tier.
///
public static bool TryParse(string rarity, out WeaponRarity result)
{
switch (rarity)
{
case "Consumer Grade":
result = WeaponRarity.Consumer;
return true;
case "Industrial Grade":
result = WeaponRarity.Industrial;
return true;
case "Mil-Spec Grade":
result = WeaponRarity.MilSpec;
return true;
case "Restricted":
result = WeaponRarity.Restricted;
return true;
case "Classified":
result = WeaponRarity.Classified;
return true;
case "Covert":
result = WeaponRarity.Covert;
return true;
// Known, valid catalogue rarities that are not weapon tradeup tiers.
case "Contraband": // The Howl
case "Extraordinary": // Gloves
result = default;
return false;
default:
throw new ArgumentException(
$"Unknown skin rarity literal '{rarity}'. The catalogue may have renamed a "
+ "rarity; update WeaponRarityExtensions.TryParse so a tier isn't silently dropped.",
nameof(rarity));
}
}
}