diff --git a/CHANGELOG.md b/CHANGELOG.md index e069eda..566a6cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr ### Changed - Use "omitempty" in marshaler settings with data definition structs. +### Fixed +- Fixed unrecognized Inventory system type in storage personalizer. + ## [1.9.0] - 2024-02-04 ### Added - New option "max_repeat_rolls" to set how many duplicate rows of rolled rewards can occur. @@ -151,7 +154,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Add ChannelMessageAck message to proto definition. ### Fixed -- Expose server functions for reward and roll in Hiro. +- Expose server functions for reward and roll in Hiro. ## [1.0.3] - 2023-08-10 ### Added diff --git a/personalizer_storage.go b/personalizer_storage.go index 2f35022..fa3726c 100644 --- a/personalizer_storage.go +++ b/personalizer_storage.go @@ -33,6 +33,7 @@ const ( storagePersonalizerKeyAchievements = "achievements" storagePersonalizerKeyEconomy = "economy" storagePersonalizerKeyEnergy = "energy" + storagePersonalizerKeyInventory = "inventory" storagePersonalizerKeyEventLeaderboards = "event_leaderboards" storagePersonalizerKeyIncentives = "incentives" storagePersonalizerKeyLeaderboards = "leaderboards" @@ -63,6 +64,7 @@ type storagePersonalizerUploadRequest struct { Achievements *AchievementsConfig `json:"achievements"` Economy *EconomyConfig `json:"economy"` Energy *EnergyConfig `json:"energy"` + Inventory *InventoryConfig `json:"inventory"` EventLeaderboard *EventLeaderboardsConfig `json:"event_leaderboards"` Incentives *IncentivesConfig `json:"incentives"` Leaderboards *LeaderboardConfig `json:"leaderboards"` @@ -141,6 +143,16 @@ func rpcStoragePersonalizerUpload(initializer runtime.Initializer, p *StoragePer writes = append(writes, write) } + if req.Inventory != nil { + write, err := p.newStorageWrite(req.Inventory, storagePersonalizerKeyInventory) + if err != nil { + logger.WithField("error", err.Error()).Error("Error creating inventory storage object.") + return "", ErrInternal + } + + writes = append(writes, write) + } + if req.EventLeaderboard != nil { write, err := p.newStorageWrite(req.EventLeaderboard, storagePersonalizerKeyEventLeaderboards) if err != nil { @@ -257,6 +269,8 @@ func (p *StoragePersonalizer) GetValue(ctx context.Context, logger runtime.Logge readOp = &runtime.StorageRead{Collection: p.collection, Key: storagePersonalizerKeyEconomy} case SystemTypeEnergy: readOp = &runtime.StorageRead{Collection: p.collection, Key: storagePersonalizerKeyEnergy} + case SystemTypeInventory: + readOp = &runtime.StorageRead{Collection: p.collection, Key: storagePersonalizerKeyInventory} case SystemTypeEventLeaderboards: readOp = &runtime.StorageRead{Collection: p.collection, Key: storagePersonalizerKeyEventLeaderboards} case SystemTypeIncentives: