From cf936152c0687800f9a3047308d1dda25ddf1fa9 Mon Sep 17 00:00:00 2001 From: Eccentric Date: Sat, 10 Feb 2024 15:22:18 +0000 Subject: [PATCH] Add more mcp actions --- handlers/client.go | 21 +++++++++++++++++++++ readme.md | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/handlers/client.go b/handlers/client.go index 164416c..2b1c180 100644 --- a/handlers/client.go +++ b/handlers/client.go @@ -32,6 +32,7 @@ var ( "GiftCatalogEntry": clientGiftCatalogEntryAction, "RemoveGiftBox": clientRemoveGiftBoxAction, "SetAffiliateName": clientSetAffiliateNameAction, + "SetReceiveGiftsEnabled": clientSetReceiveGiftsEnabledAction, } ) @@ -845,5 +846,25 @@ func clientSetAffiliateNameAction(c *fiber.Ctx, person *p.Person, profile *p.Pro setTime.ValueJSON = aid.JSONStringify(time.Now().Format("2006-01-02T15:04:05.999Z")) setTime.Save() + return nil +} + +func clientSetReceiveGiftsEnabledAction(c *fiber.Ctx, person *p.Person, profile *p.Profile, notifications *[]aid.JSON) error { + var body struct { + ReceiveGifts bool `json:"bReceiveGifts" binding:"required"` + } + + if err := c.BodyParser(&body); err != nil { + return fmt.Errorf("invalid Body") + } + + attribute := profile.Attributes.GetAttributeByKey("allowed_to_receive_gifts") + if attribute == nil { + return fmt.Errorf("attribute not found") + } + + attribute.ValueJSON = aid.JSONStringify(body.ReceiveGifts) + go attribute.Save() + return nil } \ No newline at end of file diff --git a/readme.md b/readme.md index f8f8c10..025a499 100644 --- a/readme.md +++ b/readme.md @@ -25,7 +25,7 @@ And once battle royale is completed ... ## Supported MCP Actions -`QueryProfile`, `ClientQuestLogin`, `MarkItemSeen`, `SetItemFavoriteStatusBatch`, `EquipBattleRoyaleCustomization`, `SetBattleRoyaleBanner`, `SetCosmeticLockerSlot`, `SetCosmeticLockerBanner`, `SetCosmeticLockerName`, `CopyCosmeticLoadout`, `DeleteCosmeticLoadout`, `PurchaseCatalogEntry`, `GiftCatalogEntry`, `RemoveGiftBox`, `RefundMtxPurchase`, `SetAffiliateName` +`QueryProfile`, `ClientQuestLogin`, `MarkItemSeen`, `SetItemFavoriteStatusBatch`, `EquipBattleRoyaleCustomization`, `SetBattleRoyaleBanner`, `SetCosmeticLockerSlot`, `SetCosmeticLockerBanner`, `SetCosmeticLockerName`, `CopyCosmeticLoadout`, `DeleteCosmeticLoadout`, `PurchaseCatalogEntry`, `GiftCatalogEntry`, `RemoveGiftBox`, `RefundMtxPurchase`, `SetAffiliateName`, `SetReceiveGiftsEnabled` ## Support