diff --git a/fortnite/person.go b/fortnite/person.go new file mode 100644 index 0000000..80195df --- /dev/null +++ b/fortnite/person.go @@ -0,0 +1,128 @@ +package fortnite + +import ( + "encoding/json" + "strconv" + + "github.com/ectrc/snow/aid" + p "github.com/ectrc/snow/person" + "github.com/ectrc/snow/storage" +) + +var ( + defaultAthenaItems = []string{ + "AthenaCharacter:CID_001_Athena_Commando_F_Default", + "AthenaPickaxe:DefaultPickaxe", + "AthenaGlider:DefaultGlider", + "AthenaDance:EID_DanceMoves", + } + defaultCommonCoreItems = []string{ + "Currency:MtxPurchased", + "HomebaseBannerIcon:StandardBanner", + "HomebaseBannerColor:DefaultColor", + } +) + +func NewFortnitePerson(displayName string, key string) *p.Person { + person := p.NewPerson() + person.DisplayName = displayName + person.AccessKey = key + + for _, item := range defaultAthenaItems { + person.AthenaProfile.Items.AddItem(p.NewItem(item, 1)) + } + + for _, item := range defaultCommonCoreItems { + if item == "HomebaseBannerIcon:StandardBanner" { + for i := 1; i < 32; i++ { + person.CommonCoreProfile.Items.AddItem(p.NewItem(item+strconv.Itoa(i), 1)).Save() + } + continue + } + + if item == "HomebaseBannerColor:DefaultColor" { + for i := 1; i < 22; i++ { + person.CommonCoreProfile.Items.AddItem(p.NewItem(item+strconv.Itoa(i), 1)).Save() + } + continue + } + + if item == "Currency:MtxPurchased" { + person.CommonCoreProfile.Items.AddItem(p.NewItem(item, 0)).Save() + person.Profile0Profile.Items.AddItem(p.NewItem(item, 0)).Save() + continue + } + + person.CommonCoreProfile.Items.AddItem(p.NewItem(item, 1)).Save() + } + + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("mfa_reward_claimed", true)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("rested_xp_overflow", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("lifetime_wins", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("party_assist_quest", "")).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("quest_manager", aid.JSON{})).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("inventory_limit_bonus", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("daily_rewards", []aid.JSON{})).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("competitive_identity", aid.JSON{})).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("season_update", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("season_num", aid.Config.Fortnite.Season)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("permissions", []aid.JSON{})).Save() + + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("accountLevel", 1)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("level", 1)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("xp", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("xp_overflow", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("rested_xp", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("rested_xp_mult", 0)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("rested_xp_exchange", 0)).Save() + + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("book_purchased", false)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("book_level", 1)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("book_xp", 0)).Save() + + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_character", person.AthenaProfile.Items.GetItemByTemplateID("AthenaCharacter:CID_001_Athena_Commando_F_Default").ID)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_backpack", "")).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_pickaxe", person.AthenaProfile.Items.GetItemByTemplateID("AthenaPickaxe:DefaultPickaxe").ID)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_glider", person.AthenaProfile.Items.GetItemByTemplateID("AthenaGlider:DefaultGlider").ID)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_skydivecontrail", "")).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_dance", make([]string, 6))).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_itemwraps", make([]string, 7))).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_loadingscreen", "")).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("favorite_musicpack", "")).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("banner_icon", "")).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("banner_color", "")).Save() + + person.CommonCoreProfile.Attributes.AddAttribute(p.NewAttribute("mfa_enabled", true)).Save() + person.CommonCoreProfile.Attributes.AddAttribute(p.NewAttribute("mtx_affiliate", "")).Save() + person.CommonCoreProfile.Attributes.AddAttribute(p.NewAttribute("mtx_purchase_history", aid.JSON{ + "refundsUsed": 0, + "refundCredits": 3, + "purchases": []any{}, + })).Save() + person.CommonCoreProfile.Attributes.AddAttribute(p.NewAttribute("current_mtx_platform", "EpicPC")).Save() + person.CommonCoreProfile.Attributes.AddAttribute(p.NewAttribute("allowed_to_receive_gifts", true)).Save() + person.CommonCoreProfile.Attributes.AddAttribute(p.NewAttribute("allowed_to_send_gifts", true)).Save() + person.CommonCoreProfile.Attributes.AddAttribute(p.NewAttribute("gift_history", aid.JSON{})).Save() + + loadout := p.NewLoadout("sandbox_loadout", person.AthenaProfile) + person.AthenaProfile.Loadouts.AddLoadout(loadout).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("loadouts", []string{ + loadout.ID, + })).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("last_applied_loadout", loadout.ID)).Save() + person.AthenaProfile.Attributes.AddAttribute(p.NewAttribute("active_loadout_index", 0)).Save() + + if aid.Config.Fortnite.Everything { + allItemsBytes := storage.Asset("cosmetics.json") + var allItems []string + json.Unmarshal(*allItemsBytes, &allItems) + + for _, item := range allItems { + person.AthenaProfile.Items.AddItem(p.NewItem(item, 1)).Save() + } + } + + person.Save() + + return person +} \ No newline at end of file diff --git a/fortnite/shop.go b/fortnite/shop.go new file mode 100644 index 0000000..a324e57 --- /dev/null +++ b/fortnite/shop.go @@ -0,0 +1,258 @@ +package fortnite + +import ( + "github.com/ectrc/snow/aid" + "github.com/ectrc/snow/person" +) + +type Catalog struct { + RefreshIntervalHrs int `json:"refreshIntervalHrs"` + DailyPurchaseHrs int `json:"dailyPurchaseHrs"` + Expiration string `json:"expiration"` + Storefronts []Storefront `json:"storefronts"` +} + +func NewCatalog() *Catalog { + return &Catalog{ + RefreshIntervalHrs: 24, + DailyPurchaseHrs: 24, + Expiration: aid.TimeEndOfDay(), + Storefronts: []Storefront{}, + } +} + +func (c *Catalog) Add(storefront *Storefront) { + c.Storefronts = append(c.Storefronts, *storefront) +} + +func (c *Catalog) GenerateFortniteCatalog(p *person.Person) aid.JSON { + json := aid.JSON{ + "refreshIntervalHrs": c.RefreshIntervalHrs, + "dailyPurchaseHrs": c.DailyPurchaseHrs, + "expiration": c.Expiration, + "storefronts": []aid.JSON{}, + } + + for _, storefront := range c.Storefronts { + json["storefronts"] = append(json["storefronts"].([]aid.JSON), storefront.GenerateResponse(p)) + } + + return json + +} + +type Storefront struct { + Name string `json:"name"` + CatalogEntries []Entry `json:"catalogEntries"` +} + +func NewStorefront(name string) *Storefront { + return &Storefront{ + Name: name, + CatalogEntries: []Entry{}, + } +} + +func (s *Storefront) Add(entry Entry) { + s.CatalogEntries = append(s.CatalogEntries, entry) +} + +func (s *Storefront) GenerateResponse(p *person.Person) aid.JSON { + json := aid.JSON{ + "name": s.Name, + "catalogEntries": []aid.JSON{}, + } + + for _, entry := range s.CatalogEntries { + json["catalogEntries"] = append(json["catalogEntries"].([]aid.JSON), entry.GenerateResponse(p)) + } + + return json +} + +type Entry struct { + Price int + ID string + Name string + Title string + Description string + Type string + Meta []aid.JSON + Panel string + Priority int + Asset string + Grants []string + IsBundle bool + BundleMeta BundleMeta +} + +func NewItemEntry(id string, name string, price int) *Entry { + return &Entry{ + Price: price, + ID: id, + Name: name, + Type: "StaticPrice", + } +} + +func NewBundleEntry(id string, name string, price int) *Entry { + return &Entry{ + Price: price, + ID: id, + Name: name, + Type: "DynamicBundle", + IsBundle: true, + BundleMeta: BundleMeta{ + FloorPrice: price, + RegularBasePrice: price, + DiscountedBasePrice: price, + }, + } +} + +type BundleMeta struct { + FloorPrice int + RegularBasePrice int + DiscountedBasePrice int + DisplayType string // "AmountOff" or "PercentOff" + BundleItems []BundleItem +} + +type BundleItem struct { + TemplateID string + RegularPrice int + DiscountedPrice int + AlreadyOwnedPriceReduction int +} + +func NewBundleItem(templateId string, regularPrice int, discountedPrice int, alreadyOwnedPriceReduction int) *BundleItem { + return &BundleItem{ + TemplateID: templateId, + RegularPrice: regularPrice, + DiscountedPrice: discountedPrice, + AlreadyOwnedPriceReduction: alreadyOwnedPriceReduction, + } +} + +func (e *Entry) AddGrant(templateId string) *Entry { + e.Grants = append(e.Grants, templateId) + return e +} + +func (e *Entry) AddBundleGrant(B BundleItem) *Entry { + e.BundleMeta.BundleItems = append(e.BundleMeta.BundleItems, B) + return e +} + +func (e *Entry) AddMeta(key string, value interface{}) *Entry { + e.Meta = append(e.Meta, aid.JSON{ + "Key": key, + "Value": value, + }) + return e +} + +func (e *Entry) GenerateResponse(p *person.Person) aid.JSON { + json := aid.JSON{ + "offerId": e.ID, + "devName": e.Name, + "offerType": e.Type, + "prices": []aid.JSON{ + { + "currencyType": "MtxCurrency", + "currencySubType": "Currency", + "regularPrice": e.Price, + "dynamicRegularPrice": e.Price, + "finalPrice": e.Price, + "basePrice": e.Price, + "saleExpiration": aid.TimeEndOfDay(), + }, + }, + "categories": []string{}, + "catalogGroupPriority": e.Priority, + "dailyLimit": -1, + "weeklyLimit": -1, + "monthlyLimit": -1, + "fufillmentIds": []string{}, + "filterWeight": 0, + "appStoreId": []string{}, + "refundable": false, + "itemGrants": []aid.JSON{}, + "metaInfo": e.Meta, + "meta": aid.JSON{}, + "displayAssetPath": e.Asset, + } + + grants := []aid.JSON{} + requirements := []aid.JSON{} + meta := []aid.JSON{} + + for _, templateId := range e.Grants { + grants = append(grants, aid.JSON{ + "templateId": templateId, + "quantity": 1, + }) + + if item := p.AthenaProfile.Items.GetItemByTemplateID(templateId); item != nil { + requirements = append(requirements, aid.JSON{ + "requirementType": "DenyOnItemOwnership", + "requiredId": item.ID, + "minQuantity": 1, + }) + } + } + + for _, m := range e.Meta { + meta = append(meta, m) + json["meta"].(aid.JSON)[m["Key"].(string)] = m["Value"] + } + + if e.Panel != "" { + json["categories"] = []string{e.Panel} + } + + if e.IsBundle { + json["dynamicBundleInfo"] = aid.JSON{ + "discountedBasePrice": e.BundleMeta.DiscountedBasePrice, + "regularBasePrice": e.BundleMeta.RegularBasePrice, + "floorPrice": e.BundleMeta.FloorPrice, + "currencyType": "MtxCurrency", + "currencySubType": "Currency", + "displayType": "AmountOff", + "bundleItems": []aid.JSON{}, + } + + for _, bundleItem := range e.BundleMeta.BundleItems { + json["prices"] = []aid.JSON{} + + json["dynamicBundleInfo"].(aid.JSON)["bundleItems"] = append(json["dynamicBundleInfo"].(aid.JSON)["bundleItems"].([]aid.JSON), aid.JSON{ + "regularPrice": bundleItem.RegularPrice, + "discountedPrice": bundleItem.DiscountedPrice, + "alreadyOwnedPriceReduction": bundleItem.AlreadyOwnedPriceReduction, + "item": aid.JSON{ + "templateId": bundleItem.TemplateID, + "quantity": 1, + }, + }) + + grants = append(grants, aid.JSON{ + "templateId": bundleItem.TemplateID, + "quantity": 1, + }) + + if item := p.AthenaProfile.Items.GetItemByTemplateID(bundleItem.TemplateID); item != nil { + requirements = append(requirements, aid.JSON{ + "requirementType": "DenyOnItemOwnership", + "requiredId": item.ID, + "minQuantity": 1, + }) + } + } + } + + json["itemGrants"] = grants + json["requirements"] = requirements + json["metaInfo"] = meta + + return json +} \ No newline at end of file diff --git a/handlers/common.go b/handlers/common.go index 05f4fb2..676ab59 100644 --- a/handlers/common.go +++ b/handlers/common.go @@ -106,6 +106,98 @@ func GetContentPages(c *fiber.Ctx) error { }}, "lastModified": "0000-00-00T00:00:00.000Z", }, + "shopSections": aid.JSON{ + "sectionList": aid.JSON{ + "sections": []aid.JSON{ + { + "bSortOffersByOwnership": false, + "bShowIneligibleOffersIfGiftable": false, + "bEnableToastNotification": true, + "background": aid.JSON{ + "stage": "default", + "_type": "DynamicBackground", + "key": "vault", + }, + "_type": "ShopSection", + "landingPriority": 0, + "bHidden": false, + "sectionId": "Featured", + "bShowTimer": true, + "sectionDisplayName": "Featured", + "bShowIneligibleOffers": true, + }, + { + "bSortOffersByOwnership": false, + "bShowIneligibleOffersIfGiftable": false, + "bEnableToastNotification": true, + "background": aid.JSON{ + "stage": "default", + "_type": "DynamicBackground", + "key": "vault", + }, + "_type": "ShopSection", + "landingPriority": 1, + "bHidden": false, + "sectionId": "Daily", + "bShowTimer": true, + "sectionDisplayName": "Daily", + "bShowIneligibleOffers": true, + }, + { + "bSortOffersByOwnership": false, + "bShowIneligibleOffersIfGiftable": false, + "bEnableToastNotification": false, + "background": aid.JSON{ + "stage": "default", + "_type": "DynamicBackground", + "key": "vault", + }, + "_type": "ShopSection", + "landingPriority": 2, + "bHidden": false, + "sectionId": "Battlepass", + "bShowTimer": false, + "sectionDisplayName": "Battle Pass", + "bShowIneligibleOffers": false, + }, + { + "bSortOffersByOwnership": false, + "bShowIneligibleOffersIfGiftable": false, + "bEnableToastNotification": false, + "background": aid.JSON{ + "stage": "default", + "_type": "DynamicBackground", + "key": "vault", + }, + "_type": "ShopSection", + "landingPriority": 3, + "bHidden": false, + "sectionId": "SnowSection", + "bShowTimer": false, + "sectionDisplayName": "Snow Specials", + "bShowIneligibleOffers": false, + }, + { + "bSortOffersByOwnership": false, + "bShowIneligibleOffersIfGiftable": false, + "bEnableToastNotification": false, + "background": aid.JSON{ + "stage": "default", + "_type": "DynamicBackground", + "key": "vault", + }, + "_type": "ShopSection", + "landingPriority": 3, + "bHidden": false, + "sectionId": "OGBundles", + "bShowTimer": false, + "sectionDisplayName": "OG Bundles", + "bShowIneligibleOffers": false, + }, + }, + }, + "lastModified": "0000-00-00T00:00:00.000Z", + }, "lastModified": "0000-00-00T00:00:00.000Z", }) } \ No newline at end of file diff --git a/handlers/storefront.go b/handlers/storefront.go index 1a0a081..5680c2d 100644 --- a/handlers/storefront.go +++ b/handlers/storefront.go @@ -4,19 +4,39 @@ import ( "github.com/goccy/go-json" "github.com/ectrc/snow/aid" + "github.com/ectrc/snow/fortnite" + "github.com/ectrc/snow/person" "github.com/ectrc/snow/storage" "github.com/gofiber/fiber/v2" ) func GetStorefrontCatalog(c *fiber.Ctx) error { - storefront := aid.JSON{ - "refreshIntervalHrs": 24, - "dailyPurchaseHrs": 24, - "expiration": aid.TimeEndOfDay(), - "storefronts": []aid.JSON{}, - } + person := c.Locals("person").(*person.Person) + storefront := fortnite.NewCatalog() - return c.Status(fiber.StatusOK).JSON(storefront) + 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) + } + storefront.Add(bundleStorefront) + + return c.Status(fiber.StatusOK).JSON(storefront.GenerateFortniteCatalog(person)) } func GetStorefrontKeychain(c *fiber.Ctx) error { diff --git a/main.go b/main.go index cf3ca49..023b17e 100644 --- a/main.go +++ b/main.go @@ -2,8 +2,8 @@ package main import ( "github.com/ectrc/snow/aid" + "github.com/ectrc/snow/fortnite" "github.com/ectrc/snow/handlers" - "github.com/ectrc/snow/person" "github.com/ectrc/snow/storage" "github.com/goccy/go-json" @@ -29,7 +29,7 @@ func init() { func init() { if aid.Config.Database.DropAllTables { - person.NewFortnitePerson("ac", "1") + fortnite.NewFortnitePerson("ac", "1") } } @@ -49,11 +49,6 @@ func main() { r.Get("/region", handlers.GetRegion) r.Put("/profile/play_region", handlers.AnyNoContent) - r.Get("/snow/cache", func(c *fiber.Ctx) error { - cache := person.AllFromCache() - return c.JSON(cache) - }) - account := r.Group("/account/api") account.Get("/public/account", handlers.GetPublicAccounts) account.Get("/public/account/:accountId", handlers.GetPublicAccount) diff --git a/person/fortnite.go b/person/fortnite.go deleted file mode 100644 index fe55987..0000000 --- a/person/fortnite.go +++ /dev/null @@ -1,127 +0,0 @@ -package person - -import ( - "encoding/json" - "strconv" - - "github.com/ectrc/snow/aid" - "github.com/ectrc/snow/storage" -) - -var ( - defaultAthenaItems = []string{ - "AthenaCharacter:CID_001_Athena_Commando_F_Default", - "AthenaPickaxe:DefaultPickaxe", - "AthenaGlider:DefaultGlider", - "AthenaDance:EID_DanceMoves", - } - defaultCommonCoreItems = []string{ - "Currency:MtxPurchased", - "HomebaseBannerIcon:StandardBanner", - "HomebaseBannerColor:DefaultColor", - } -) - -func NewFortnitePerson(displayName string, key string) *Person { - person := NewPerson() - person.DisplayName = displayName - person.AccessKey = key - - for _, item := range defaultAthenaItems { - person.AthenaProfile.Items.AddItem(NewItem(item, 1)) - } - - for _, item := range defaultCommonCoreItems { - if item == "HomebaseBannerIcon:StandardBanner" { - for i := 1; i < 32; i++ { - person.CommonCoreProfile.Items.AddItem(NewItem(item+strconv.Itoa(i), 1)).Save() - } - continue - } - - if item == "HomebaseBannerColor:DefaultColor" { - for i := 1; i < 22; i++ { - person.CommonCoreProfile.Items.AddItem(NewItem(item+strconv.Itoa(i), 1)).Save() - } - continue - } - - if item == "Currency:MtxPurchased" { - person.CommonCoreProfile.Items.AddItem(NewItem(item, 0)).Save() - person.Profile0Profile.Items.AddItem(NewItem(item, 0)).Save() - continue - } - - person.CommonCoreProfile.Items.AddItem(NewItem(item, 1)).Save() - } - - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("mfa_reward_claimed", true)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("rested_xp_overflow", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("lifetime_wins", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("party_assist_quest", "")).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("quest_manager", aid.JSON{})).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("inventory_limit_bonus", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("daily_rewards", []aid.JSON{})).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("competitive_identity", aid.JSON{})).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("season_update", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("season_num", aid.Config.Fortnite.Season)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("permissions", []aid.JSON{})).Save() - - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("accountLevel", 1)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("level", 1)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("xp", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("xp_overflow", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("rested_xp", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("rested_xp_mult", 0)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("rested_xp_exchange", 0)).Save() - - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("book_purchased", false)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("book_level", 1)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("book_xp", 0)).Save() - - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_character", person.AthenaProfile.Items.GetItemByTemplateID("AthenaCharacter:CID_001_Athena_Commando_F_Default").ID)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_backpack", "")).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_pickaxe", person.AthenaProfile.Items.GetItemByTemplateID("AthenaPickaxe:DefaultPickaxe").ID)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_glider", person.AthenaProfile.Items.GetItemByTemplateID("AthenaGlider:DefaultGlider").ID)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_skydivecontrail", "")).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_dance", make([]string, 6))).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_itemwraps", make([]string, 7))).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_loadingscreen", "")).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("favorite_musicpack", "")).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("banner_icon", "")).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("banner_color", "")).Save() - - person.CommonCoreProfile.Attributes.AddAttribute(NewAttribute("mfa_enabled", true)).Save() - person.CommonCoreProfile.Attributes.AddAttribute(NewAttribute("mtx_affiliate", "")).Save() - person.CommonCoreProfile.Attributes.AddAttribute(NewAttribute("mtx_purchase_history", aid.JSON{ - "refundsUsed": 0, - "refundCredits": 3, - "purchases": []any{}, - })).Save() - person.CommonCoreProfile.Attributes.AddAttribute(NewAttribute("current_mtx_platform", "EpicPC")).Save() - person.CommonCoreProfile.Attributes.AddAttribute(NewAttribute("allowed_to_receive_gifts", true)).Save() - person.CommonCoreProfile.Attributes.AddAttribute(NewAttribute("allowed_to_send_gifts", true)).Save() - person.CommonCoreProfile.Attributes.AddAttribute(NewAttribute("gift_history", aid.JSON{})).Save() - - loadout := NewLoadout("sandbox_loadout", person.AthenaProfile) - person.AthenaProfile.Loadouts.AddLoadout(loadout).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("loadouts", []string{ - loadout.ID, - })).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("last_applied_loadout", loadout.ID)).Save() - person.AthenaProfile.Attributes.AddAttribute(NewAttribute("active_loadout_index", 0)).Save() - - if aid.Config.Fortnite.Everything { - allItemsBytes := storage.Asset("cosmetics.json") - var allItems []string - json.Unmarshal(*allItemsBytes, &allItems) - - for _, item := range allItems { - person.AthenaProfile.Items.AddItem(NewItem(item, 1)).Save() - } - } - - person.Save() - - return person -} \ No newline at end of file diff --git a/person/loadout.go b/person/loadout.go index 8854686..a122b10 100644 --- a/person/loadout.go +++ b/person/loadout.go @@ -1,6 +1,7 @@ package person import ( + "fmt" "strings" "github.com/ectrc/snow/aid" @@ -144,9 +145,13 @@ func (l *Loadout) GetAttribute(attribute string) interface{} { bannerColorItem := Find(l.PersonID).CommonCoreProfile.Items.GetItem(l.BannerColorID) if bannerColorItem == nil { - return nil + bannerColorItem = &Item{ + TemplateID: "HomebaseBannerColor:DefaultColor1", + } } + fmt.Println(attribute) + switch attribute { case "locker_name": return l.LockerName @@ -158,6 +163,7 @@ func (l *Loadout) GetAttribute(attribute string) interface{} { return l.GenerateFortniteLockerSlotsData() } + return nil }