github.com/df-mc/dragonfly@v0.9.13/server/item/enchantment_rarity.go (about) 1 package item 2 3 // EnchantmentRarity represents an enchantment rarity for enchantments. These rarities may inhibit certain properties, 4 // such as anvil costs or enchanting table weights. 5 type EnchantmentRarity interface { 6 // Name returns the name of the enchantment rarity. 7 Name() string 8 // Cost returns the cost of the enchantment rarity. 9 Cost() int 10 // Weight returns the weight of the enchantment rarity. 11 Weight() int 12 } 13 14 var ( 15 // EnchantmentRarityCommon represents the common enchantment rarity. 16 EnchantmentRarityCommon enchantmentRarityCommon 17 // EnchantmentRarityUncommon represents the uncommon enchantment rarity. 18 EnchantmentRarityUncommon enchantmentRarityUncommon 19 // EnchantmentRarityRare represents the rare enchantment rarity. 20 EnchantmentRarityRare enchantmentRarityRare 21 // EnchantmentRarityVeryRare represents the very rare enchantment rarity. 22 EnchantmentRarityVeryRare enchantmentRarityVeryRare 23 ) 24 25 // enchantmentRarityCommon represents the common enchantment rarity. 26 type enchantmentRarityCommon struct{} 27 28 func (enchantmentRarityCommon) Name() string { return "Common" } 29 func (enchantmentRarityCommon) Cost() int { return 1 } 30 func (enchantmentRarityCommon) Weight() int { return 10 } 31 32 // enchantmentRarityUncommon represents the uncommon enchantment rarity. 33 type enchantmentRarityUncommon struct{} 34 35 func (enchantmentRarityUncommon) Name() string { return "Uncommon" } 36 func (enchantmentRarityUncommon) Cost() int { return 2 } 37 func (enchantmentRarityUncommon) Weight() int { return 5 } 38 39 // enchantmentRarityRare represents the rare enchantment rarity. 40 type enchantmentRarityRare struct{} 41 42 func (enchantmentRarityRare) Name() string { return "Rare" } 43 func (enchantmentRarityRare) Cost() int { return 4 } 44 func (enchantmentRarityRare) Weight() int { return 2 } 45 46 // enchantmentRarityVeryRare represents the very rare enchantment rarity. 47 type enchantmentRarityVeryRare struct{} 48 49 func (enchantmentRarityVeryRare) Name() string { return "Very Rare" } 50 func (enchantmentRarityVeryRare) Cost() int { return 8 } 51 func (enchantmentRarityVeryRare) Weight() int { return 1 }