@quenty/gameconfig 5.23.0 → 5.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.24.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameconfig@5.23.0...@quenty/gameconfig@5.24.0) (2023-04-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add GameConfigPicker:PromisePriceInRobux(assetType, assetIdOrKey) ([5250175](https://github.com/Quenty/NevermoreEngine/commit/52501754a64f86e54c40f95ea746a1c078fd553b))
12
+
13
+
14
+
15
+
16
+
6
17
  # [5.23.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameconfig@5.22.1...@quenty/gameconfig@5.23.0) (2023-04-10)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/gameconfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/gameconfig",
3
- "version": "5.23.0",
3
+ "version": "5.24.0",
4
4
  "description": "Configuration service to specify Roblox badges, products, and other specific assets.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,7 +27,7 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@quenty/attributeutils": "^8.12.0",
30
+ "@quenty/attributeutils": "^8.13.0",
31
31
  "@quenty/badgeutils": "^6.5.0",
32
32
  "@quenty/baseobject": "^6.2.1",
33
33
  "@quenty/binder": "^8.14.0",
@@ -38,7 +38,7 @@
38
38
  "@quenty/loader": "^6.2.1",
39
39
  "@quenty/maid": "^2.5.0",
40
40
  "@quenty/marketplaceutils": "^6.6.0",
41
- "@quenty/observablecollection": "^5.13.0",
41
+ "@quenty/observablecollection": "^5.14.0",
42
42
  "@quenty/preferredparentutils": "^3.1.0",
43
43
  "@quenty/promise": "^6.5.0",
44
44
  "@quenty/pseudolocalize": "^3.2.0",
@@ -52,5 +52,5 @@
52
52
  "@quenty/table": "^3.2.0",
53
53
  "@quenty/valueobject": "^7.12.0"
54
54
  },
55
- "gitHead": "3306212248c310731931ad45d8b86dc7247f2a5d"
55
+ "gitHead": "15d1274fffdaef706f849fd5dca2f14364c1264e"
56
56
  }
@@ -10,6 +10,8 @@ local RxBinderUtils = require("RxBinderUtils")
10
10
  local ObservableMapSet = require("ObservableMapSet")
11
11
  local RxBrioUtils = require("RxBrioUtils")
12
12
  local GameConfigAssetTypeUtils = require("GameConfigAssetTypeUtils")
13
+ local Promise = require("Promise")
14
+ local GameConfigAssetUtils = require("GameConfigAssetUtils")
13
15
 
14
16
  local GameConfigPicker = setmetatable({}, BaseObject)
15
17
  GameConfigPicker.ClassName = "GameConfigPicker"
@@ -172,6 +174,44 @@ function GameConfigPicker:FindFirstActiveAssetOfId(assetType: string, assetId: n
172
174
  return nil
173
175
  end
174
176
 
177
+ --[=[
178
+ Find the first asset of a given key
179
+
180
+ @param assetType string
181
+ @param assetIdOrKey string | number
182
+ @return GameConfigAssetBase
183
+ ]=]
184
+ function GameConfigPicker:PromisePriceInRobux(assetType, assetIdOrKey)
185
+ assert(GameConfigAssetTypeUtils.isAssetType(assetType), "Bad assetType")
186
+ assert(type(assetIdOrKey) == "number" or type(assetIdOrKey) == "string", "Bad assetIdOrKey")
187
+
188
+ if type(assetIdOrKey) == "string" then
189
+ local asset = self:FindFirstActiveAssetOfKey(assetType, assetIdOrKey)
190
+ if asset then
191
+ return asset:PromiseCloudPriceInRobux()
192
+ end
193
+
194
+ return Promise.rejected(string.format("Could not turn %q into asset id", tostring(assetIdOrKey)))
195
+ elseif type(assetIdOrKey) == "number" then
196
+ local asset = self:FindFirstActiveAssetOfId(assetType, assetIdOrKey)
197
+ if asset then
198
+ -- TODO: Maybe cancel token
199
+ return asset:PromiseCloudPriceInRobux()
200
+ end
201
+
202
+ return GameConfigAssetUtils.promiseCloudDataForAssetType(assetType, assetIdOrKey)
203
+ :Then(function(cloudData)
204
+ if type(cloudData.PriceInRobux) == "number" then
205
+ return cloudData.PriceInRobux
206
+ else
207
+ return Promise.rejected()
208
+ end
209
+ end)
210
+ else
211
+ error("[GameConfigPicker.PromisePriceInRobux] - Bad assetIdOrKey")
212
+ end
213
+ end
214
+
175
215
  --[=[
176
216
  Find the first asset of a given key
177
217