@quenty/gameproductservice 7.4.0 → 7.5.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,23 @@
|
|
|
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
|
+
# [7.5.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@7.4.0...@quenty/gameproductservice@7.5.0) (2023-05-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix purchase processing for products ([af9621c](https://github.com/Quenty/NevermoreEngine/commit/af9621c5afd5a8189aa25081ce069c2279e30a37))
|
|
12
|
+
* Fix SetIsOwned call ([ebbec3c](https://github.com/Quenty/NevermoreEngine/commit/ebbec3cf0b4bd34ad39fbb079e311bde4bffed31))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* Initial refactor of guis to use ValueObject instead of ValueObject ([723aba0](https://github.com/Quenty/NevermoreEngine/commit/723aba0208cae7e06c9d8bf2d8f0092d042d70ea))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [7.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameproductservice@7.3.1...@quenty/gameproductservice@7.4.0) (2023-05-08)
|
|
7
24
|
|
|
8
25
|
**Note:** Version bump only for package @quenty/gameproductservice
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/gameproductservice",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.0",
|
|
4
4
|
"description": "Generalized monetization system for handling products and purchases correctly.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,28 +27,28 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@quenty/attributeutils": "^8.
|
|
30
|
+
"@quenty/attributeutils": "^8.15.0",
|
|
31
31
|
"@quenty/baseobject": "^6.2.1",
|
|
32
|
-
"@quenty/binder": "^8.
|
|
33
|
-
"@quenty/brio": "^8.
|
|
34
|
-
"@quenty/gameconfig": "^5.
|
|
35
|
-
"@quenty/instanceutils": "^7.
|
|
32
|
+
"@quenty/binder": "^8.16.0",
|
|
33
|
+
"@quenty/brio": "^8.13.0",
|
|
34
|
+
"@quenty/gameconfig": "^5.27.0",
|
|
35
|
+
"@quenty/instanceutils": "^7.14.0",
|
|
36
36
|
"@quenty/loader": "^6.2.1",
|
|
37
37
|
"@quenty/maid": "^2.5.0",
|
|
38
38
|
"@quenty/marketplaceutils": "^6.6.0",
|
|
39
|
-
"@quenty/observablecollection": "^5.
|
|
40
|
-
"@quenty/playerbinder": "^8.
|
|
39
|
+
"@quenty/observablecollection": "^5.16.0",
|
|
40
|
+
"@quenty/playerbinder": "^8.16.0",
|
|
41
41
|
"@quenty/promise": "^6.5.0",
|
|
42
|
-
"@quenty/receiptprocessing": "^1.
|
|
42
|
+
"@quenty/receiptprocessing": "^1.2.0",
|
|
43
43
|
"@quenty/remoting": "^6.5.0",
|
|
44
|
-
"@quenty/rx": "^7.
|
|
45
|
-
"@quenty/rxbinderutils": "^8.
|
|
46
|
-
"@quenty/servicebag": "^6.
|
|
47
|
-
"@quenty/signal": "^2.
|
|
48
|
-
"@quenty/statestack": "^8.
|
|
44
|
+
"@quenty/rx": "^7.11.0",
|
|
45
|
+
"@quenty/rxbinderutils": "^8.17.0",
|
|
46
|
+
"@quenty/servicebag": "^6.7.0",
|
|
47
|
+
"@quenty/signal": "^2.4.0",
|
|
48
|
+
"@quenty/statestack": "^8.14.0",
|
|
49
49
|
"@quenty/string": "^3.1.0",
|
|
50
50
|
"@quenty/table": "^3.2.0",
|
|
51
|
-
"@quenty/valueobject": "^7.
|
|
51
|
+
"@quenty/valueobject": "^7.14.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "11058e90e51ea83d3dad6ae9abe59cc19c36b94b"
|
|
54
54
|
}
|
|
@@ -16,7 +16,6 @@ local Promise = require("Promise")
|
|
|
16
16
|
local Rx = require("Rx")
|
|
17
17
|
local RxAttributeUtils = require("RxAttributeUtils")
|
|
18
18
|
local RxBrioUtils = require("RxBrioUtils")
|
|
19
|
-
local RxInstanceUtils = require("RxInstanceUtils")
|
|
20
19
|
local RxStateStackUtils = require("RxStateStackUtils")
|
|
21
20
|
local ValueObject = require("ValueObject")
|
|
22
21
|
local WellKnownAssetOwnershipHandler = require("WellKnownAssetOwnershipHandler")
|
|
@@ -38,8 +37,7 @@ function PlayerAssetOwnershipTracker.new(player, configPicker, assetType, market
|
|
|
38
37
|
|
|
39
38
|
self._assetOwnershipPromiseCache = {}
|
|
40
39
|
|
|
41
|
-
self._attributesEnabled =
|
|
42
|
-
self._attributesEnabled.Value = false
|
|
40
|
+
self._attributesEnabled = ValueObject.new(false, "boolean")
|
|
43
41
|
self._maid:GiveTask(self._attributesEnabled)
|
|
44
42
|
|
|
45
43
|
self._assetIdToWellKnownOwnershipTracker = ObservableMapSet.new()
|
|
@@ -52,8 +50,8 @@ function PlayerAssetOwnershipTracker.new(player, configPicker, assetType, market
|
|
|
52
50
|
self:SetOwnership(idOrKey, true)
|
|
53
51
|
end))
|
|
54
52
|
|
|
55
|
-
self._maid:GiveTask(
|
|
56
|
-
if
|
|
53
|
+
self._maid:GiveTask(self._attributesEnabled:Observe():Subscribe(function(isEnabled)
|
|
54
|
+
if isEnabled then
|
|
57
55
|
self._maid._wellKnown = self:_cacheWellKnownAssets()
|
|
58
56
|
else
|
|
59
57
|
self._maid._wellKnown = nil
|
|
@@ -161,7 +159,7 @@ function PlayerAssetOwnershipTracker:SetOwnership(idOrKey, ownsPass)
|
|
|
161
159
|
|
|
162
160
|
-- Update trackers
|
|
163
161
|
for _, wellOwnedAsset in pairs(self:_getWellKnownAssets(idOrKey)) do
|
|
164
|
-
wellOwnedAsset:SetIsOwned(
|
|
162
|
+
wellOwnedAsset:SetIsOwned(ownsPass)
|
|
165
163
|
end
|
|
166
164
|
end
|
|
167
165
|
|
|
@@ -6,7 +6,7 @@ local require = require(script.Parent.loader).load(script)
|
|
|
6
6
|
|
|
7
7
|
local BaseObject = require("BaseObject")
|
|
8
8
|
local PlayerAssetOwnershipUtils = require("PlayerAssetOwnershipUtils")
|
|
9
|
-
local
|
|
9
|
+
local ValueObject = require("ValueObject")
|
|
10
10
|
|
|
11
11
|
local WellKnownAssetOwnershipHandler = setmetatable({}, BaseObject)
|
|
12
12
|
WellKnownAssetOwnershipHandler.ClassName = "WellKnownAssetOwnershipHandler"
|
|
@@ -17,8 +17,7 @@ function WellKnownAssetOwnershipHandler.new(adornee, gameConfigAsset)
|
|
|
17
17
|
|
|
18
18
|
self._gameConfigAsset = assert(gameConfigAsset, "No gameConfigAsset")
|
|
19
19
|
|
|
20
|
-
self._isOwned =
|
|
21
|
-
self._isOwned.Value = false
|
|
20
|
+
self._isOwned = ValueObject.new(false, "boolean")
|
|
22
21
|
self._maid:GiveTask(self._isOwned)
|
|
23
22
|
|
|
24
23
|
self._maid:GiveTask(self:_observeAttributeNamesBrio():Subscribe(function(brio)
|
|
@@ -48,6 +47,8 @@ function WellKnownAssetOwnershipHandler.new(adornee, gameConfigAsset)
|
|
|
48
47
|
end
|
|
49
48
|
|
|
50
49
|
function WellKnownAssetOwnershipHandler:SetIsOwned(isOwned)
|
|
50
|
+
assert(type(isOwned) == "boolean", "Bad isOwned")
|
|
51
|
+
|
|
51
52
|
self._isOwned.Value = isOwned
|
|
52
53
|
end
|
|
53
54
|
|
|
@@ -56,7 +57,7 @@ function WellKnownAssetOwnershipHandler:GetIsOwned()
|
|
|
56
57
|
end
|
|
57
58
|
|
|
58
59
|
function WellKnownAssetOwnershipHandler:ObserveIsOwned()
|
|
59
|
-
return
|
|
60
|
+
return self._isOwned:Observe()
|
|
60
61
|
end
|
|
61
62
|
|
|
62
63
|
function WellKnownAssetOwnershipHandler:_observeAttributeNamesBrio()
|
|
@@ -135,11 +135,20 @@ function PlayerAssetMarketTracker:HandlePurchaseEvent(id, isPurchased)
|
|
|
135
135
|
assert(type(id) == "number", "Bad id")
|
|
136
136
|
assert(type(isPurchased) == "boolean", "Bad isPurchased")
|
|
137
137
|
|
|
138
|
+
self:_handlePurchaseEvent(id, isPurchased, false)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
function PlayerAssetMarketTracker:_handlePurchaseEvent(id, isPurchased, isFromReceipt)
|
|
142
|
+
assert(type(id) == "number", "Bad id")
|
|
143
|
+
assert(type(isPurchased) == "boolean", "Bad isPurchased")
|
|
144
|
+
|
|
138
145
|
local promise = self._pendingPromises[id]
|
|
139
146
|
|
|
140
147
|
-- Zero out promise resolution in receipt processing scenario (safety)
|
|
141
|
-
if self._receiptProcessingExpected
|
|
142
|
-
|
|
148
|
+
if self._receiptProcessingExpected then
|
|
149
|
+
if isPurchased and not isFromReceipt then
|
|
150
|
+
promise = nil
|
|
151
|
+
end
|
|
143
152
|
end
|
|
144
153
|
|
|
145
154
|
if promise then
|
|
@@ -173,7 +182,7 @@ function PlayerAssetMarketTracker:HandleProcessReceipt(_player, receiptInfo)
|
|
|
173
182
|
local pendingForAssetId = self._pendingPromises[productId]
|
|
174
183
|
|
|
175
184
|
if pendingForAssetId then
|
|
176
|
-
self:
|
|
185
|
+
self:_handlePurchaseEvent(productId, true, true)
|
|
177
186
|
|
|
178
187
|
return Enum.ProductPurchaseDecision.PurchaseGranted
|
|
179
188
|
end
|