Maps are unordered duh

This commit is contained in:
Eccentric 2024-02-18 03:19:36 +00:00
parent 3fcda14f1a
commit 028c1f5922
3 changed files with 30 additions and 25 deletions

View File

@ -241,7 +241,6 @@ func GetRandomItemWithDisplayAssetOfNotType(notType string) *FortniteItem {
return &flat[aid.RandomInt(0, len(flat))] return &flat[aid.RandomInt(0, len(flat))]
} }
func GetRandomSet() *FortniteSet { func GetRandomSet() *FortniteSet {
sets := []FortniteSet{} sets := []FortniteSet{}
for _, set := range External.FortniteSets { for _, set := range External.FortniteSets {

View File

@ -52,17 +52,23 @@ var (
}, },
} }
dailyItemLookup = map[int]int{ dailyItemLookup = []struct {
2: 4, Season int
4: 6, Items int
13: 10, }{
{2, 4},
{4, 6},
{13, 10},
} }
weeklySetLookup = map[int]int{ weeklySetLookup = []struct {
2: 2, Season int
4: 3, Sets int
11: 4, }{
13: 3, {2, 2},
{4, 3},
{11, 4},
{13, 3},
} }
) )
@ -71,27 +77,31 @@ func price(rarity, type_ string) int {
} }
func dailyItems(season int) int { func dailyItems(season int) int {
var items int currentValue := 4
for s, i := range dailyItemLookup { for _, item := range dailyItemLookup {
if season >= s { if item.Season > season {
items = i continue
} }
currentValue = item.Items
} }
return items return currentValue
} }
func weeklySets(season int) int { func weeklySets(season int) int {
var sets int currentValue := 2
for s, i := range weeklySetLookup { for _, set := range weeklySetLookup {
if season >= s { if set.Season > season {
sets = i continue
} }
currentValue = set.Sets
} }
return sets return currentValue
} }
type FortniteCatalogSectionOffer struct { type FortniteCatalogSectionOffer struct {

View File

@ -84,9 +84,5 @@ func GetDiscordOAuthURL(c *fiber.Ctx) error {
return c.Status(fiber.StatusInternalServerError).JSON(aid.ErrorInternalServer) return c.Status(fiber.StatusInternalServerError).JSON(aid.ErrorInternalServer)
} }
c.Cookie(&fiber.Cookie{ return c.Redirect("snow://auth:" + access)
Name: "access_token",
Value: access,
})
return c.Redirect("http://" + aid.Config.API.Host + aid.Config.API.FrontendPort + "/attempt")
} }