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))]
}
func GetRandomSet() *FortniteSet {
sets := []FortniteSet{}
for _, set := range External.FortniteSets {

View File

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

View File

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