Better shop prices

This commit is contained in:
Eccentric 2024-01-21 00:46:06 +00:00
parent 586dcc22f9
commit 9b29743764
2 changed files with 47 additions and 12 deletions

View File

@ -9,18 +9,53 @@ import (
) )
var ( var (
Rarities = map[string]int{ Rarities = map[string]map[string]int{
"EFortRarity::Legendary": 2000, "EFortRarity::Legendary": map[string]int{
"EFortRarity::Epic": 1500, "AthenaCharacter": 2000,
"EFortRarity::Rare": 1200, "AthenaBackpack": 1500,
"EFortRarity::Uncommon": 800, "AthenaPickaxe": 1500,
"EFortRarity::Common": 500, "AthenaGlider": 1800,
"AthenaDance": 500,
"AthenaItemWrap": 800,
},
"EFortRarity::Epic": map[string]int{
"AthenaCharacter": 1500,
"AthenaBackpack": 1200,
"AthenaPickaxe": 1200,
"AthenaGlider": 1500,
"AthenaDance": 800,
"AthenaItemWrap": 800,
},
"EFortRarity::Rare": map[string]int{
"AthenaCharacter": 1200,
"AthenaBackpack": 800,
"AthenaPickaxe": 800,
"AthenaGlider": 800,
"AthenaDance": 500,
"AthenaItemWrap": 600,
},
"EFortRarity::Uncommon": map[string]int{
"AthenaCharacter": 800,
"AthenaBackpack": 200,
"AthenaPickaxe": 500,
"AthenaGlider": 500,
"AthenaDance": 200,
"AthenaItemWrap": 300,
},
"EFortRarity::Common": map[string]int{
"AthenaCharacter": 500,
"AthenaBackpack": 200,
"AthenaPickaxe": 500,
"AthenaGlider": 500,
"AthenaDance": 200,
"AthenaItemWrap": 300,
},
} }
StaticCatalog = NewCatalog() StaticCatalog = NewCatalog()
) )
func GetPriceForRarity(rarity string) int { func GetPriceForRarity(rarity string, backendType string) int {
return Rarities[rarity] return Rarities[rarity][backendType]
} }
type Catalog struct { type Catalog struct {
@ -324,7 +359,7 @@ func GenerateRandomStorefront() {
if item.DisplayAssetPath != "" { if item.DisplayAssetPath != "" {
entry.SetDisplayAssetPath(item.DisplayAssetPath) entry.SetDisplayAssetPath(item.DisplayAssetPath)
} }
entry.SetPrice(GetPriceForRarity(item.Rarity.BackendValue)) entry.SetPrice(GetPriceForRarity(item.Rarity.BackendValue, item.Type.BackendValue))
entry.AddGrant(item.Type.BackendValue + ":" + item.ID) entry.AddGrant(item.Type.BackendValue + ":" + item.ID)
entry.SetTileSize("Normal") entry.SetTileSize("Normal")
entry.Priority = 1 entry.Priority = 1
@ -354,7 +389,7 @@ func GenerateRandomStorefront() {
if item.DisplayAssetPath != "" { if item.DisplayAssetPath != "" {
entry.SetDisplayAssetPath(item.DisplayAssetPath) entry.SetDisplayAssetPath(item.DisplayAssetPath)
} }
entry.SetPrice(GetPriceForRarity(item.Rarity.BackendValue)) entry.SetPrice(GetPriceForRarity(item.Rarity.BackendValue, item.Type.BackendValue))
entry.AddGrant(item.Type.BackendValue + ":" + item.ID) entry.AddGrant(item.Type.BackendValue + ":" + item.ID)
entry.SetTileSize("Small") entry.SetTileSize("Small")
@ -407,7 +442,7 @@ func GenerateRandomStorefront() {
if item.DisplayAssetPath != "" { if item.DisplayAssetPath != "" {
entry.SetDisplayAssetPath(item.DisplayAssetPath) entry.SetDisplayAssetPath(item.DisplayAssetPath)
} }
entry.SetPrice(GetPriceForRarity(item.Rarity.BackendValue)) entry.SetPrice(GetPriceForRarity(item.Rarity.BackendValue, item.Type.BackendValue))
entry.AddGrant(item.Type.BackendValue + ":" + item.ID) entry.AddGrant(item.Type.BackendValue + ":" + item.ID)
itemsToAdd = append(itemsToAdd, entry) itemsToAdd = append(itemsToAdd, entry)

View File

@ -124,7 +124,7 @@ func PostTokenExchangeCode(c *fiber.Ctx, body *FortniteTokenBody) error {
func PostTokenPassword(c *fiber.Ctx, body *FortniteTokenBody) error { func PostTokenPassword(c *fiber.Ctx, body *FortniteTokenBody) error {
if aid.Config.Fortnite.Password { if aid.Config.Fortnite.Password {
return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Password Login is disabled for security reasons. Please use an Exchange Code given by the discord bot.")) return c.Status(fiber.StatusBadRequest).JSON(aid.ErrorBadRequest("Username and password authentication is disabled for security reasons. Please use an exchange code given by the discord bot."))
} }
if body.Username == "" || body.Password == "" { if body.Username == "" || body.Password == "" {