2023-11-05 22:08:53 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
2023-11-09 18:53:19 +00:00
|
|
|
"github.com/goccy/go-json"
|
2023-11-09 18:42:28 +00:00
|
|
|
|
2023-11-05 22:08:53 +00:00
|
|
|
"github.com/ectrc/snow/aid"
|
2023-11-21 23:42:39 +00:00
|
|
|
"github.com/ectrc/snow/fortnite"
|
|
|
|
"github.com/ectrc/snow/person"
|
2023-11-09 18:42:28 +00:00
|
|
|
"github.com/ectrc/snow/storage"
|
2023-11-05 22:08:53 +00:00
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
func GetStorefrontCatalog(c *fiber.Ctx) error {
|
2023-11-21 23:42:39 +00:00
|
|
|
person := c.Locals("person").(*person.Person)
|
|
|
|
storefront := fortnite.NewCatalog()
|
|
|
|
|
|
|
|
bundleStorefront := fortnite.NewStorefront("bundles")
|
|
|
|
{
|
|
|
|
bundle := fortnite.NewBundleEntry("v2:/hello_og", "OG Bundle", 300)
|
|
|
|
bundle.Asset = "/Game/Catalog/NewDisplayAssets/DAv2_CID_A_183_M_AntiquePal_S7A9W.DAv2_CID_A_183_M_AntiquePal_S7A9W"
|
|
|
|
bundle.AddBundleGrant(*fortnite.NewBundleItem("AthenaCharacter:CID_028_Athena_Commando_F", 1000, 500, 800))
|
|
|
|
bundle.AddBundleGrant(*fortnite.NewBundleItem("AthenaCharacter:CID_001_Athena_Commando_F", 1000, 500, 800))
|
|
|
|
bundle.AddMeta("AnalyticOfferGroupId", "3")
|
|
|
|
bundle.AddMeta("SectionId", "OGBundles")
|
|
|
|
bundle.AddMeta("TileSize", "DoubleWide")
|
|
|
|
bundle.AddMeta("NewDisplayAssetPath", bundle.Asset)
|
|
|
|
bundleStorefront.Add(*bundle)
|
|
|
|
|
|
|
|
random := fortnite.NewItemEntry("v2:/random", "Random Bundle", 300)
|
|
|
|
random.AddGrant("AthenaCharacter:CID_Random")
|
|
|
|
random.AddMeta("AnalyticOfferGroupId", "3")
|
|
|
|
random.AddMeta("SectionId", "OGBundles")
|
|
|
|
random.AddMeta("TileSize", "DoubleWide")
|
|
|
|
|
|
|
|
bundleStorefront.Add(*random)
|
2023-11-09 18:42:28 +00:00
|
|
|
}
|
2023-11-21 23:42:39 +00:00
|
|
|
storefront.Add(bundleStorefront)
|
2023-11-09 18:42:28 +00:00
|
|
|
|
2023-11-21 23:42:39 +00:00
|
|
|
return c.Status(fiber.StatusOK).JSON(storefront.GenerateFortniteCatalog(person))
|
2023-11-05 22:08:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func GetStorefrontKeychain(c *fiber.Ctx) error {
|
2023-11-09 18:42:28 +00:00
|
|
|
var keychain []string
|
|
|
|
err := json.Unmarshal(*storage.Asset("keychain.json"), &keychain)
|
|
|
|
if err != nil {
|
|
|
|
return c.Status(fiber.StatusInternalServerError).JSON(aid.JSON{"error":err.Error()})
|
|
|
|
}
|
|
|
|
|
|
|
|
return c.Status(fiber.StatusOK).JSON(keychain)
|
2023-11-05 22:08:53 +00:00
|
|
|
}
|