New discord reward command.

This commit is contained in:
Eccentric 2024-02-19 01:49:14 +00:00
parent 028c1f5922
commit 2ce9e5ab15
16 changed files with 270 additions and 68 deletions

View File

@ -65,3 +65,12 @@ func (s *GenericSyncMap[T]) Len() int {
}) })
return count return count
} }
func (s *GenericSyncMap[T]) Snapshot() *map[string]*T {
m := make(map[string]*T)
s.Range(func(key string, value *T) bool {
m[key] = value
return true
})
return &m
}

View File

@ -4,7 +4,7 @@
; they will have max permissions with snow and will have no discord account linked ; they will have max permissions with snow and will have no discord account linked
gods=god,snow gods=god,snow
; comma separated list of usernames that are considered owner accounts ; comma separated list of usernames that are considered owner accounts
; these accounts will have max permissions with snow and can have a discord account linked ; these accounts must already exist in the database
owners=ectrc owners=ectrc
[database] [database]

View File

@ -8,13 +8,14 @@ import (
"github.com/ectrc/snow/aid" "github.com/ectrc/snow/aid"
"github.com/ectrc/snow/fortnite" "github.com/ectrc/snow/fortnite"
"github.com/ectrc/snow/person" "github.com/ectrc/snow/person"
"github.com/ectrc/snow/socket"
"github.com/ectrc/snow/storage" "github.com/ectrc/snow/storage"
) )
func informationHandler(s *discordgo.Session, i *discordgo.InteractionCreate) { func informationHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID) looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil { if looker == nil {
s.InteractionRespond(i.Interaction, &ErrorNoPermission) s.InteractionRespond(i.Interaction, &ErrorNoAccount)
return return
} }
@ -46,7 +47,7 @@ func informationHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
func whoHandler(s *discordgo.Session, i *discordgo.InteractionCreate) { func whoHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID) looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil { if looker == nil {
s.InteractionRespond(i.Interaction, &ErrorNoPermission) s.InteractionRespond(i.Interaction, &ErrorNoAccount)
return return
} }
@ -111,7 +112,7 @@ func whoHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
func bansHandler(s *discordgo.Session, i *discordgo.InteractionCreate) { func bansHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID) looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil { if looker == nil {
s.InteractionRespond(i.Interaction, &ErrorNoPermission) s.InteractionRespond(i.Interaction, &ErrorNoAccount)
return return
} }
@ -216,7 +217,7 @@ func listBansHandler(s *discordgo.Session, i *discordgo.InteractionCreate, looke
func itemsHandler(s *discordgo.Session, i *discordgo.InteractionCreate) { func itemsHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID) looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil { if looker == nil {
s.InteractionRespond(i.Interaction, &ErrorNoPermission) s.InteractionRespond(i.Interaction, &ErrorNoAccount)
return return
} }
@ -385,7 +386,7 @@ func fillItemsHandler(s *discordgo.Session, i *discordgo.InteractionCreate, look
func permissionHandler(s *discordgo.Session, i *discordgo.InteractionCreate) { func permissionHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID) looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil { if looker == nil {
s.InteractionRespond(i.Interaction, &ErrorNoPermission) s.InteractionRespond(i.Interaction, &ErrorNoAccount)
return return
} }
@ -456,3 +457,63 @@ func permissionHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
s.InteractionRespond(i.Interaction, &ErrorInvalidArguments) s.InteractionRespond(i.Interaction, &ErrorInvalidArguments)
} }
func rewardHandler(s *discordgo.Session, i *discordgo.InteractionCreate) {
looker := person.FindByDiscord(i.Member.User.ID)
if looker == nil {
s.InteractionRespond(i.Interaction, &ErrorNoAccount)
return
}
if !looker.HasPermission(person.PermissionItemControl) {
s.InteractionRespond(i.Interaction, &ErrorNoPermission)
return
}
if len(i.ApplicationCommandData().Options) <= 0 {
s.InteractionRespond(i.Interaction, &ErrorInvalidArguments)
return
}
packType := i.ApplicationCommandData().Options[0].StringValue()
if packType == "" {
s.InteractionRespond(i.Interaction, &ErrorInvalidArguments)
return
}
player := getPersonFromOptions(i.ApplicationCommandData().Options, s)
if player == nil {
s.InteractionRespond(i.Interaction, &ErrorInvalidDisplayOrDiscord)
return
}
funcLookup := map[string]func(*person.Person){
"twitch_prime_1": fortnite.GrantRewardTwitchPrime1,
"twitch_prime_2": fortnite.GrantRewardTwitchPrime2,
"samsung_galaxy": fortnite.GrantRewardSamsungGalaxy,
"samsung_ikonik": fortnite.GrantRewardSamsungIkonic,
"honor_guard": fortnite.GrantRewardHonorGuard,
"mfa": fortnite.GrantRewardTwoFactor,
}
nameLookup := map[string]string{
"twitch_prime_1": "Twitch Prime Drop 1",
"twitch_prime_2": "Twitch Prime Drop 2",
"samsung_galaxy": "Samsung Galaxy",
"samsung_ikonik": "Samsung IKONIK",
"honor_guard": "Honor Guard",
"mfa": "Multi Factor Authentication",
}
if handler, ok := funcLookup[packType]; ok {
handler(player)
socket.EmitGiftReceived(player)
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: player.DisplayName + " has been given the reward `" + nameLookup[packType] + "`.",
},
})
return
}
}

View File

@ -288,6 +288,51 @@ func addCommands() {
Handler: permissionHandler, Handler: permissionHandler,
AdminOnly: true, AdminOnly: true,
}) })
rewardOptions := append([]*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "reward",
Description: "The reward bundle to give to the player.",
Required: true,
Choices: []*discordgo.ApplicationCommandOptionChoice{
{
Name: "Twitch Prime Drop 1",
Value: "twitch_prime_1",
},
{
Name: "Twitch Prime Drop 2",
Value: "twitch_prime_2",
},
{
Name: "Samsung Galaxy",
Value: "samsung_galaxy",
},
{
Name: "Samsung IKONIK",
Value: "samsung_ikonik",
},
{
Name: "Honor Guard",
Value: "honor_guard",
},
{
Name: "Multi Factor Authentication",
Value: "mfa",
},
},
},
}, personOptions...)
addCommand(&DiscordCommand{
Command: &discordgo.ApplicationCommand{
Name: "reward",
Description: "Gift a player a item reward bundle!",
Options: rewardOptions,
},
Handler: rewardHandler,
AdminOnly: true,
})
} }
func getPersonFromOptions(opts []*discordgo.ApplicationCommandInteractionDataOption, s *discordgo.Session) *person.Person { func getPersonFromOptions(opts []*discordgo.ApplicationCommandInteractionDataOption, s *discordgo.Session) *person.Person {

View File

@ -24,7 +24,7 @@ type ExternalDataClient struct {
FortniteItemsWithFeaturedImage []*FortniteItem `json:"-"` FortniteItemsWithFeaturedImage []*FortniteItem `json:"-"`
TypedFortniteItems map[string][]*FortniteItem `json:"-"` TypedFortniteItems map[string][]*FortniteItem `json:"-"`
TypedFortniteItemsWithDisplayAssets map[string][]*FortniteItem `json:"-"` TypedFortniteItemsWithDisplayAssets map[string][]*FortniteItem `json:"-"`
SnowVariantTokens map[string]SnowCosmeticVariantToken `json:"-"` SnowVariantTokens map[string]*FortniteVariantToken `json:"variants"`
} }
func NewExternalDataClient() *ExternalDataClient { func NewExternalDataClient() *ExternalDataClient {
@ -36,7 +36,7 @@ func NewExternalDataClient() *ExternalDataClient {
FortniteItemsWithFeaturedImage: []*FortniteItem{}, FortniteItemsWithFeaturedImage: []*FortniteItem{},
TypedFortniteItems: make(map[string][]*FortniteItem), TypedFortniteItems: make(map[string][]*FortniteItem),
TypedFortniteItemsWithDisplayAssets: make(map[string][]*FortniteItem), TypedFortniteItemsWithDisplayAssets: make(map[string][]*FortniteItem),
SnowVariantTokens: make(map[string]SnowCosmeticVariantToken), SnowVariantTokens: make(map[string]*FortniteVariantToken),
} }
} }
@ -70,7 +70,7 @@ func (c *ExternalDataClient) LoadExternalData() {
c.AddBackpackToItem(item) c.AddBackpackToItem(item)
} }
displayAssets := storage.HttpAsset[[]string]("QKnwROGzQjYm1W9xu9uL3VrbSA0tnVj6NJJtEChUdAb3DF8uN.json") displayAssets := storage.HttpAsset[[]string]("assets.snow.json")
if displayAssets == nil { if displayAssets == nil {
return return
} }
@ -79,11 +79,26 @@ func (c *ExternalDataClient) LoadExternalData() {
c.AddDisplayAssetToItem(displayAsset) c.AddDisplayAssetToItem(displayAsset)
} }
variantTokens := storage.HttpAsset[map[string]SnowCosmeticVariantToken]("QF3nHCFt1vhELoU4q1VKTmpxnk20c2iAiBEBzlbzQAY.json") variantTokens := storage.HttpAsset[map[string]SnowCosmeticVariantToken]("variants.snow.json")
if variantTokens == nil { if variantTokens == nil {
return return
} }
c.SnowVariantTokens = *variantTokens
for k, v := range *variantTokens {
item := c.FortniteItems[v.Item]
if item == nil {
continue
}
c.SnowVariantTokens[k] = &FortniteVariantToken{
Grants: v.Grants,
Item: item,
Name: v.Name,
Gift: v.Gift,
Equip: v.Equip,
Unseen: v.Unseen,
}
}
addNumericStylesToSets := []string{"Soccer", "Football", "ScaryBall"} addNumericStylesToSets := []string{"Soccer", "Football", "ScaryBall"}
for _, setValue := range addNumericStylesToSets { for _, setValue := range addNumericStylesToSets {

53
fortnite/rewards.go Normal file
View File

@ -0,0 +1,53 @@
package fortnite
import p "github.com/ectrc/snow/person"
func GrantRewardTwitchPrime1(person *p.Person) {
gift := p.NewGift("GiftBox:GB_Twitch", 1, "", "")
gift.AddLoot(p.NewItemWithType("AthenaCharacter:CID_089_Athena_Commando_M_RetroGrey", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaCharacter:CID_085_Athena_Commando_M_Twitch", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaBackpack:BID_029_RetroGrey", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaGlider:Glider_ID_018_Twitch", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaPickaxe:Pickaxe_ID_039_TacticalBlack", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaDance:Emoji_VictoryRoyale", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaDance:Emoji_Wow", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaDance:Emoji_Bush ", 1, "athena"))
person.CommonCoreProfile.Gifts.AddGift(gift).Save()
}
func GrantRewardTwitchPrime2(person *p.Person) {
gift := p.NewGift("GiftBox:GB_Twitch", 1, "", "")
gift.AddLoot(p.NewItemWithType("AthenaCharacter:CID_114_Athena_Commando_F_TacticalWoodland", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaBackpack:BID_049_TacticalWoodland", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaPickaxe:Pickaxe_ID_044_TacticalUrbanHammer", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaDance:EID_HipHop01", 1, "athena"))
person.CommonCoreProfile.Gifts.AddGift(gift).Save()
}
func GrantRewardSamsungGalaxy(person *p.Person) {
gift := p.NewGift("GiftBox:GB_SamsungPromo", 1, "", "")
gift.AddLoot(p.NewItemWithType("AthenaCharacter:CID_175_Athena_Commando_M_Celestial", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaBackpack:BID_138_Celestial", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaGlider:Glider_ID_090_Celestial", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaPickaxe:Pickaxe_ID_116_Celestial", 1, "athena"))
person.CommonCoreProfile.Gifts.AddGift(gift).Save()
}
func GrantRewardSamsungIkonic(person *p.Person) {
gift := p.NewGift("GiftBox:GB_SamsungPromo", 1, "", "")
gift.AddLoot(p.NewItemWithType("AthenaCharacter:CID_313_Athena_Commando_M_KpopFashion", 1, "athena"))
gift.AddLoot(p.NewItemWithType("AthenaDance:EID_KPopDance03", 1, "athena"))
person.CommonCoreProfile.Gifts.AddGift(gift).Save()
}
func GrantRewardHonorGuard(person *p.Person) {
gift := p.NewGift("GiftBox:GB_HonorPromo", 1, "", "")
gift.AddLoot(p.NewItemWithType("AthenaCharacter:CID_342_Athena_Commando_M_StreetRacerMetallic", 1, "athena"))
person.CommonCoreProfile.Gifts.AddGift(gift).Save()
}
func GrantRewardTwoFactor(person *p.Person) {
gift := p.NewGift("GiftBox:GB_MfaReward", 1, "", "")
gift.AddLoot(p.NewItemWithType("AthenaDance:EID_BoogieDown", 1, "athena"))
person.CommonCoreProfile.Gifts.AddGift(gift).Save()
}

View File

@ -80,8 +80,21 @@ type SnowCosmeticVariantToken struct {
Channel string `json:"channel"` Channel string `json:"channel"`
Value string `json:"value"` Value string `json:"value"`
} `json:"grants"` } `json:"grants"`
Item string `json:"item"`
Name string `json:"name"` Name string `json:"name"`
Gift bool `json:"gift"` Gift bool `json:"gift"`
Equip bool `json:"equip"` Equip bool `json:"equip"`
Unseen bool `json:"unseen"` Unseen bool `json:"unseen"`
} }
type FortniteVariantToken struct {
Grants []struct {
Channel string `json:"channel"`
Value string `json:"value"`
} `json:"grants"`
Item *FortniteItem `json:"item"`
Name string `json:"name"`
Gift bool `json:"gift"`
Equip bool `json:"equip"`
Unseen bool `json:"unseen"`
}

View File

@ -251,12 +251,12 @@ func MiddlewareFortnite(c *fiber.Ctx) error {
func MiddlewareWeb(c *fiber.Ctx) error { func MiddlewareWeb(c *fiber.Ctx) error {
snowId, err := aid.GetSnowFromToken(c.Get("Authorization")) snowId, err := aid.GetSnowFromToken(c.Get("Authorization"))
if err != nil { if err != nil {
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token")) return c.Status(fiber.StatusForbidden).JSON(aid.JSON{"error":"Invalid Access Token"})
} }
person := p.Find(snowId) person := p.Find(snowId)
if person == nil { if person == nil {
return c.Status(fiber.StatusForbidden).JSON(aid.ErrorBadRequest("Invalid Access Token")) return c.Status(fiber.StatusForbidden).JSON(aid.JSON{"error":"Invalid Access Token"})
} }
c.Locals("person", person) c.Locals("person", person)

View File

@ -800,15 +800,7 @@ func clientGiftCatalogEntryAction(c *fiber.Ctx, person *p.Person, profile *p.Pro
} }
receiverPerson.CommonCoreProfile.Gifts.AddGift(gift).Save() receiverPerson.CommonCoreProfile.Gifts.AddGift(gift).Save()
socket.EmitGiftReceived(receiverPerson)
socket, ok := socket.JabberSockets.Get(receiverPerson.ID)
if ok {
socket.JabberSendMessageToPerson(aid.JSON{
"payload": aid.JSON{},
"type": "com.epicgames.gift.received",
"timestamp": time.Now().Format("2006-01-02T15:04:05.999Z"),
})
}
} }
return nil return nil
@ -823,17 +815,18 @@ func clientRemoveGiftBoxAction(c *fiber.Ctx, person *p.Person, profile *p.Profil
return fmt.Errorf("invalid Body") return fmt.Errorf("invalid Body")
} }
gift := profile.Gifts.GetGift(body.GiftBoxItemId) gift := person.CommonCoreProfile.Gifts.GetGift(body.GiftBoxItemId)
if gift == nil { if gift == nil {
return fmt.Errorf("gift not found") return fmt.Errorf("gift not found")
} }
aid.Print(gift.TemplateID)
for _, item := range gift.Loot { for _, item := range gift.Loot {
person.GetProfileFromType(item.ProfileType).Items.AddItem(item).Save() person.GetProfileFromType(item.ProfileType).Items.AddItem(item).Save()
} }
profile.Gifts.DeleteGift(gift.ID) person.CommonCoreProfile.Gifts.DeleteGift(gift.ID)
return nil return nil
} }

View File

@ -4,7 +4,6 @@ import (
"github.com/ectrc/snow/aid" "github.com/ectrc/snow/aid"
"github.com/ectrc/snow/fortnite" "github.com/ectrc/snow/fortnite"
p "github.com/ectrc/snow/person" p "github.com/ectrc/snow/person"
"github.com/ectrc/snow/storage"
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
) )
@ -20,28 +19,6 @@ func GetSnowPreloadedCosmetics(c *fiber.Ctx) error {
return c.JSON(fortnite.External) return c.JSON(fortnite.External)
} }
func GetPlayerLocker(c *fiber.Ctx) error {
person := c.Locals("person").(*p.Person)
items := make([]p.Item, 0)
person.AthenaProfile.Items.RangeItems(func(key string, value *p.Item) bool {
items = append(items, *value)
return true
})
return c.JSON(items)
}
func GetPlayer(c *fiber.Ctx) error {
person := c.Locals("person").(*p.Person)
return c.JSON(aid.JSON{
"id": person.ID,
"displayName": person.DisplayName,
"discord": person.Discord,
})
}
func GetSnowCachedPlayers(c *fiber.Ctx) error { func GetSnowCachedPlayers(c *fiber.Ctx) error {
persons := p.AllFromCache() persons := p.AllFromCache()
players := make([]p.PersonSnapshot, len(persons)) players := make([]p.PersonSnapshot, len(persons))
@ -50,14 +27,7 @@ func GetSnowCachedPlayers(c *fiber.Ctx) error {
players[i] = *person.Snapshot() players[i] = *person.Snapshot()
} }
return c.JSON(players) return c.Status(200).JSON(players)
}
func GetSnowConfig(c *fiber.Ctx) error {
return c.JSON(aid.JSON{
"basic": aid.Config,
"amazon": storage.Repo.Amazon,
})
} }
func GetSnowParties(c *fiber.Ctx) error { func GetSnowParties(c *fiber.Ctx) error {
@ -75,3 +45,14 @@ func GetSnowShop(c *fiber.Ctx) error {
shop := fortnite.NewRandomFortniteCatalog() shop := fortnite.NewRandomFortniteCatalog()
return c.JSON(shop.GenerateFortniteCatalog()) return c.JSON(shop.GenerateFortniteCatalog())
} }
//
func GetPlayer(c *fiber.Ctx) error {
person := c.Locals("person").(*p.Person)
return c.Status(200).JSON(person.Snapshot())
}
func GetPlayerOkay(c *fiber.Ctx) error {
return c.Status(200).SendString("okay")
}

22
main.go
View File

@ -50,7 +50,7 @@ func init() {
for _, username := range aid.Config.Accounts.Gods { for _, username := range aid.Config.Accounts.Gods {
found := person.FindByDisplay(username) found := person.FindByDisplay(username)
if found == nil { if found == nil {
found = fortnite.NewFortnitePersonWithId(username, username, true) found = fortnite.NewFortnitePersonWithId(username, username, aid.Config.Fortnite.Everything)
} }
found.AddPermission(person.PermissionAllWithRoles) found.AddPermission(person.PermissionAllWithRoles)
@ -63,7 +63,7 @@ func init() {
continue continue
} }
found.AddPermission(person.PermissionOwner) found.AddPermission(person.PermissionAllWithRoles)
aid.Print("(snow) owner account " + username + " loaded") aid.Print("(snow) owner account " + username + " loaded")
} }
} }
@ -168,21 +168,21 @@ func main() {
party.Post("/members/:friendId/intentions/:accountId", handlers.PostPartyCreateIntention) party.Post("/members/:friendId/intentions/:accountId", handlers.PostPartyCreateIntention)
snow := r.Group("/snow") snow := r.Group("/snow")
snow.Use(handlers.MiddlewareOnlyDebug)
snow.Get("/cache", handlers.GetSnowCachedPlayers)
snow.Get("/config", handlers.GetSnowConfig)
snow.Get("/sockets", handlers.GetSnowConnectedSockets)
snow.Get("/cosmetics", handlers.GetSnowPreloadedCosmetics)
snow.Get("/parties", handlers.GetSnowParties)
snow.Get("/shop", handlers.GetSnowShop)
discord := snow.Group("/discord") discord := snow.Group("/discord")
discord.Get("/", handlers.GetDiscordOAuthURL) discord.Get("/", handlers.GetDiscordOAuthURL)
player := snow.Group("/player") player := snow.Group("/player")
player.Use(handlers.MiddlewareWeb) player.Use(handlers.MiddlewareWeb)
player.Get("/", handlers.GetPlayer) player.Get("/", handlers.GetPlayer)
player.Get("/locker", handlers.GetPlayerLocker) player.Get("/okay", handlers.GetPlayerOkay)
debug := snow.Group("/")
debug.Use(handlers.MiddlewareOnlyDebug)
debug.Get("/cache", handlers.GetSnowCachedPlayers)
debug.Get("/sockets", handlers.GetSnowConnectedSockets)
debug.Get("/cosmetics", handlers.GetSnowPreloadedCosmetics)
debug.Get("/parties", handlers.GetSnowParties)
debug.Get("/shop", handlers.GetSnowShop)
r.Hooks().OnListen(func(ld fiber.ListenData) error { r.Hooks().OnListen(func(ld fiber.ListenData) error {
aid.Print("(fiber) listening on " + aid.Config.API.Host + ":" + ld.Port) aid.Print("(fiber) listening on " + aid.Config.API.Host + ":" + ld.Port)

View File

@ -120,6 +120,9 @@ func (g *Gift) Save() {
} }
storage.Repo.SaveGift(g.ToDatabase(g.ProfileID)) storage.Repo.SaveGift(g.ToDatabase(g.ProfileID))
for _, item := range g.Loot {
item.SaveLoot(g.ID)
}
} }
func (g *Gift) Snapshot() GiftSnapshot { func (g *Gift) Snapshot() GiftSnapshot {

View File

@ -227,6 +227,7 @@ func findHelper(databasePerson *storage.DB_Person, shallow bool, save bool) *Per
if save { if save {
cache.SavePerson(person) cache.SavePerson(person)
} }
return person return person
} }
@ -448,6 +449,7 @@ func (p *Person) Snapshot() *PersonSnapshot {
snapshot := &PersonSnapshot{ snapshot := &PersonSnapshot{
ID: p.ID, ID: p.ID,
DisplayName: p.DisplayName, DisplayName: p.DisplayName,
RefundTickets: p.RefundTickets,
Permissions: int64(p.Permissions), Permissions: int64(p.Permissions),
AthenaProfile: *p.AthenaProfile.Snapshot(), AthenaProfile: *p.AthenaProfile.Snapshot(),
CommonCoreProfile: *p.CommonCoreProfile.Snapshot(), CommonCoreProfile: *p.CommonCoreProfile.Snapshot(),
@ -457,6 +459,10 @@ func (p *Person) Snapshot() *PersonSnapshot {
CreativeProfile: *p.CreativeProfile.Snapshot(), CreativeProfile: *p.CreativeProfile.Snapshot(),
BanHistory: []storage.DB_BanStatus{}, BanHistory: []storage.DB_BanStatus{},
Discord: *p.Discord, Discord: *p.Discord,
Relationships: *p.Relationships.Snapshot(),
Parties: *p.Parties.Snapshot(),
Invites: *p.Invites.Snapshot(),
Intentions: *p.Intentions.Snapshot(),
} }
p.BanHistory.Range(func(key string, ban *storage.DB_BanStatus) bool { p.BanHistory.Range(func(key string, ban *storage.DB_BanStatus) bool {

View File

@ -5,6 +5,7 @@ import "github.com/ectrc/snow/storage"
type PersonSnapshot struct { type PersonSnapshot struct {
ID string ID string
DisplayName string DisplayName string
RefundTickets int
Permissions int64 Permissions int64
AthenaProfile ProfileSnapshot AthenaProfile ProfileSnapshot
CommonCoreProfile ProfileSnapshot CommonCoreProfile ProfileSnapshot
@ -14,6 +15,10 @@ type PersonSnapshot struct {
CreativeProfile ProfileSnapshot CreativeProfile ProfileSnapshot
BanHistory []storage.DB_BanStatus BanHistory []storage.DB_BanStatus
Discord storage.DB_DiscordPerson Discord storage.DB_DiscordPerson
Relationships map[string]*Relationship
Parties map[string]*Party
Invites map[string]*PartyInvite
Intentions map[string]*PartyIntention
} }
type ProfileSnapshot struct { type ProfileSnapshot struct {

View File

@ -7,6 +7,19 @@ import (
"github.com/ectrc/snow/person" "github.com/ectrc/snow/person"
) )
func EmitGiftReceived(person *person.Person) {
s, ok := JabberSockets.Get(person.ID)
if !ok {
return
}
s.JabberSendMessageToPerson(aid.JSON{
"payload": aid.JSON{},
"type": "com.epicgames.gift.received",
"timestamp": time.Now().Format("2006-01-02T15:04:05.999Z"),
})
}
func EmitPartyMemberJoined(party *person.Party, joiningMember *person.PartyMember) { func EmitPartyMemberJoined(party *person.Party, joiningMember *person.PartyMember) {
for _, partyMember := range party.Members { for _, partyMember := range party.Members {
s, ok := JabberSockets.Get(partyMember.Person.ID) s, ok := JabberSockets.Get(partyMember.Person.ID)

View File

@ -103,6 +103,11 @@ bShouldCheckIfPlatformAllowed=false`)
func GetDefaultRuntime() []byte { func GetDefaultRuntime() []byte {
return []byte(` return []byte(`
[/Script/FortniteGame.FortRuntimeOptions] [/Script/FortniteGame.FortRuntimeOptions]
!DisabledFrontendNavigationTabs=ClearArray
;+DisabledFrontendNavigationTabs=(TabName="AthenaChallenges",TabState=EFortRuntimeOptionTabState::Hidden)
;+DisabledFrontendNavigationTabs=(TabName="Showdown",TabState=EFortRuntimeOptionTabState::Hidden)
;+DisabledFrontendNavigationTabs=(TabName="AthenaStore",TabState=EFortRuntimeOptionTabState::Hidden)
bEnableGlobalChat=true bEnableGlobalChat=true
bDisableGifting=false bDisableGifting=false
bDisableGiftingPC=false bDisableGiftingPC=false