diff --git a/config.default.json b/config.default.json index 3bbfa2f..bbb034f 100644 --- a/config.default.json +++ b/config.default.json @@ -3,6 +3,7 @@ "cdnBaseUrl": "https://zunivers-cdn.zerator.com/zunivers-prod", "api": { "baseUrl": "https://zunivers-api.zerator.com", + "rulesettype": "NORMAL", "timeout": 10 }, "webhooks": [], diff --git a/structures/Shop.go b/structures/Shop.go index cca377a..f6c28de 100644 --- a/structures/Shop.go +++ b/structures/Shop.go @@ -13,7 +13,7 @@ type ShopEntry struct { type ShopInventory struct { Balance int `json:"balance"` - Golden bool `json:"isGolden"` + ShinyLevel int `json:"shinyLevel"` UpgradeLevel int `json:"upgradeLevel"` Item *Item `json:"item"` } diff --git a/tasks/checkShopEntries.go b/tasks/checkShopEntries.go index 57fc8a8..a039542 100644 --- a/tasks/checkShopEntries.go +++ b/tasks/checkShopEntries.go @@ -65,12 +65,21 @@ func makeShopEmbed(entries []structures.ShopEntry) *discord.Embed { } for _, entry := range entries { - golden := "" - if entry.ShopInventory.Golden { - golden = " (dorée)" + shiny := "" + + switch entry.ShopInventory.ShinyLevel { + case 0: + shiny = "" + break + case 1: + shiny = " (dorée)" + break + case 2: + shiny = " (chroma)" + break } - namesField.Value += fmt.Sprintf("`%s%s`\n", entry.ShopInventory.Item.Name, golden) + namesField.Value += fmt.Sprintf("`%s%s`\n", entry.ShopInventory.Item.Name, shiny) raritiesField.Value += fmt.Sprintf("`%s`\n", strings.Repeat("★", entry.ShopInventory.Item.Rarity)) pricesField.Value += fmt.Sprintf("`%d`\n", entry.ShopInventory.Balance) } diff --git a/utils/api.go b/utils/api.go index 76a4976..7c7b886 100644 --- a/utils/api.go +++ b/utils/api.go @@ -30,6 +30,7 @@ func Request(uri, method string, body []byte, structure interface{}) (err error) req.Header.Set("sec-fetch-mode", "cors") req.Header.Set("sec-fetch-site", "same-site") req.Header.Set("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36") + req.Header.Set("x-zunivers-rulesettype", viper.GetString("api.rulesettype")) r, err := client.Do(req) if err != nil {