@quenty/gameconfig 12.8.0 → 12.9.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,22 @@
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
+ # [12.9.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameconfig@12.8.0...@quenty/gameconfig@12.9.0) (2024-09-12)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * GameConfigAsset does not export empty description or name ([1a9de5c](https://github.com/Quenty/NevermoreEngine/commit/1a9de5c899cc7b47aedabacc78006883b4236c95))
12
+
13
+
14
+ ### Features
15
+
16
+ * Add additional game config types ([c6fdf4a](https://github.com/Quenty/NevermoreEngine/commit/c6fdf4a34ea26135c6aa16a6a268a966062f4a2f))
17
+
18
+
19
+
20
+
21
+
6
22
  # [12.8.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gameconfig@12.7.1...@quenty/gameconfig@12.8.0) (2024-08-09)
7
23
 
8
24
  **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": "12.8.0",
3
+ "version": "12.9.0",
4
4
  "description": "Configuration service to specify Roblox badges, products, and other specific assets.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,31 +27,31 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@quenty/attributeutils": "^14.4.0",
31
- "@quenty/badgeutils": "^10.3.0",
32
- "@quenty/baseobject": "^10.3.0",
33
- "@quenty/binder": "^14.5.0",
34
- "@quenty/brio": "^14.4.0",
35
- "@quenty/clienttranslator": "^14.5.0",
36
- "@quenty/cmdrservice": "^13.6.0",
37
- "@quenty/instanceutils": "^13.4.0",
38
- "@quenty/loader": "^10.3.0",
39
- "@quenty/maid": "^3.2.0",
40
- "@quenty/marketplaceutils": "^11.4.0",
41
- "@quenty/observablecollection": "^12.4.0",
42
- "@quenty/playerutils": "^8.4.0",
30
+ "@quenty/attributeutils": "^14.5.0",
31
+ "@quenty/badgeutils": "^10.4.0",
32
+ "@quenty/baseobject": "^10.4.0",
33
+ "@quenty/binder": "^14.6.0",
34
+ "@quenty/brio": "^14.5.0",
35
+ "@quenty/clienttranslator": "^14.6.0",
36
+ "@quenty/cmdrservice": "^13.7.0",
37
+ "@quenty/instanceutils": "^13.5.0",
38
+ "@quenty/loader": "^10.4.0",
39
+ "@quenty/maid": "^3.3.0",
40
+ "@quenty/marketplaceutils": "^11.5.0",
41
+ "@quenty/observablecollection": "^12.5.0",
42
+ "@quenty/playerutils": "^8.5.0",
43
43
  "@quenty/preferredparentutils": "^4.2.0",
44
- "@quenty/promise": "^10.3.0",
44
+ "@quenty/promise": "^10.4.0",
45
45
  "@quenty/pseudolocalize": "^3.3.0",
46
- "@quenty/remotefunctionutils": "^10.3.0",
47
- "@quenty/remoting": "^12.5.0",
48
- "@quenty/rx": "^13.4.0",
49
- "@quenty/rxbinderutils": "^14.5.0",
50
- "@quenty/servicebag": "^11.4.0",
51
- "@quenty/statestack": "^14.5.0",
46
+ "@quenty/remotefunctionutils": "^10.4.0",
47
+ "@quenty/remoting": "^12.6.0",
48
+ "@quenty/rx": "^13.5.0",
49
+ "@quenty/rxbinderutils": "^14.6.0",
50
+ "@quenty/servicebag": "^11.5.0",
51
+ "@quenty/statestack": "^14.6.0",
52
52
  "@quenty/string": "^3.2.0",
53
53
  "@quenty/table": "^3.5.0",
54
- "@quenty/valueobject": "^13.4.0"
54
+ "@quenty/valueobject": "^13.5.0"
55
55
  },
56
- "gitHead": "ba466bdbc05c42fb607cf5e228c16339201d21d7"
56
+ "gitHead": "fb172906f3ee725269ec1e5f4daf9dca227e729d"
57
57
  }
@@ -21,10 +21,12 @@ function GameConfigServiceClient:Init(serviceBag)
21
21
  -- Internal
22
22
  self._serviceBag:GetService(require("GameConfigCommandServiceClient"))
23
23
  self._serviceBag:GetService(require("GameConfigTranslator"))
24
+ self._serviceBag:GetService(require("GameConfigDataService"))
24
25
  self._binders = self._serviceBag:GetService(require("GameConfigBindersClient"))
25
26
 
26
- self._configPicker = GameConfigPicker.new(self._binders.GameConfig, self._binders.GameConfigAsset)
27
- self._maid:GiveTask(self._configPicker)
27
+ self._configPicker = self._maid:Add(GameConfigPicker.new(self._binders.GameConfig, self._binders.GameConfigAsset))
28
+
29
+ self._serviceBag:GetService(require("GameConfigDataService")):SetConfigPicker(self._configPicker)
28
30
  end
29
31
 
30
32
  function GameConfigServiceClient:Start()
@@ -5,7 +5,6 @@
5
5
 
6
6
  local require = require(script.Parent.loader).load(script)
7
7
 
8
- local MarketplaceService = game:GetService("MarketplaceService")
9
8
  local TeleportService = game:GetService("TeleportService")
10
9
 
11
10
  local GameConfigCmdrUtils = require("GameConfigCmdrUtils")
@@ -65,114 +64,6 @@ function GameConfigCommandService:_registerCommands()
65
64
  return string.format("Awards: %s", table.concat(givenTo, ", "))
66
65
  end)
67
66
 
68
- self._cmdrService:RegisterCommand({
69
- Name = "prompt-product";
70
- Description = "Prompts the player to make a product purchase.";
71
- Group = "GameConfig";
72
- Args = {
73
- {
74
- Name = "Player";
75
- Type = "players";
76
- Description = "The player to prompt.";
77
- },
78
- {
79
- Name = "Product";
80
- Type = "productId";
81
- Description = "The Product to prompt.";
82
- },
83
- };
84
- }, function(_context, players, productId)
85
- local givenTo = {}
86
-
87
- for _, player in pairs(players) do
88
- MarketplaceService:PromptProductPurchase(player, productId)
89
- table.insert(givenTo, string.format("%s prompted purchase of %d", PlayerUtils.formatName(player), productId))
90
- end
91
-
92
- return string.format("Prompted: %s", table.concat(givenTo, ", "))
93
- end)
94
-
95
- self._cmdrService:RegisterCommand({
96
- Name = "prompt-pass";
97
- Description = "Prompts the player to make a gamepass purchase.";
98
- Group = "GameConfig";
99
- Args = {
100
- {
101
- Name = "Player";
102
- Type = "players";
103
- Description = "The player to prompt.";
104
- },
105
- {
106
- Name = "GamePass";
107
- Type = "passId";
108
- Description = "The gamepass to prompt.";
109
- },
110
- };
111
- }, function(_context, players, gamePassId)
112
- local givenTo = {}
113
-
114
- for _, player in pairs(players) do
115
- MarketplaceService:PromptGamePassPurchase(player, gamePassId)
116
- table.insert(givenTo, string.format("%s prompted purchase of %d", PlayerUtils.formatName(player), gamePassId))
117
- end
118
-
119
- return string.format("Prompted: %s", table.concat(givenTo, ", "))
120
- end)
121
-
122
- self._cmdrService:RegisterCommand({
123
- Name = "prompt-asset";
124
- Description = "Prompts the player to make an asset purchase.";
125
- Group = "GameConfig";
126
- Args = {
127
- {
128
- Name = "Player";
129
- Type = "players";
130
- Description = "The player to prompt.";
131
- },
132
- {
133
- Name = "Asset";
134
- Type = "assetId";
135
- Description = "The asset to prompt.";
136
- },
137
- };
138
- }, function(_context, players, assetId)
139
- local givenTo = {}
140
-
141
- for _, player in pairs(players) do
142
- MarketplaceService:PromptPurchase(player, assetId)
143
- table.insert(givenTo, string.format("%s prompted purchase of %d", PlayerUtils.formatName(player), assetId))
144
- end
145
-
146
- return string.format("Prompted: %s", table.concat(givenTo, ", "))
147
- end)
148
-
149
- self._cmdrService:RegisterCommand({
150
- Name = "prompt-bundle";
151
- Description = "Prompts the player to make a bundle purchase.";
152
- Group = "GameConfig";
153
- Args = {
154
- {
155
- Name = "Player";
156
- Type = "players";
157
- Description = "The player to prompt.";
158
- },
159
- {
160
- Name = "Bundle";
161
- Type = "bundleId";
162
- Description = "The asset to prompt.";
163
- },
164
- };
165
- }, function(_context, players, bundleId)
166
- local givenTo = {}
167
-
168
- for _, player in pairs(players) do
169
- MarketplaceService:PromptBundlePurchase(player, bundleId)
170
- table.insert(givenTo, string.format("%s prompted purchase of %d", PlayerUtils.formatName(player), bundleId))
171
- end
172
-
173
- return string.format("Prompted: %s", table.concat(givenTo, ", "))
174
- end)
175
-
176
67
  self._cmdrService:RegisterCommand({
177
68
  Name = "goto-named-place";
178
69
  Description = "Teleport to a Roblox place.";
@@ -23,7 +23,7 @@ function GameConfigAsset.new(obj, serviceBag)
23
23
  assetType = self:ObserveAssetType();
24
24
  text = self:ObserveCloudName();
25
25
  }):Subscribe(function(state)
26
- if state.text then
26
+ if state.text and state.text ~= "" then
27
27
  local prefix = string.format("assets.%s.%s.name", state.assetType, state.assetKey)
28
28
  self:SetNameTranslationKey(self._translator:ToTranslationKey(prefix, state.text))
29
29
  else
@@ -36,7 +36,7 @@ function GameConfigAsset.new(obj, serviceBag)
36
36
  assetType = self:ObserveAssetType();
37
37
  text = self:ObserveCloudDescription();
38
38
  }):Subscribe(function(state)
39
- if state.text then
39
+ if state.text and state.text ~= "" then
40
40
  local prefix = string.format("assets.%s.%s.description", state.assetType, state.assetKey)
41
41
  self:SetDescriptionTranslationKey(self._translator:ToTranslationKey(prefix, state.text))
42
42
  else
@@ -32,14 +32,16 @@ function GameConfigService:Init(serviceBag)
32
32
 
33
33
  -- Internal
34
34
  self._serviceBag:GetService(require("GameConfigCommandService"))
35
+ self._serviceBag:GetService(require("GameConfigDataService"))
35
36
  self._serviceBag:GetService(require("GameConfigTranslator"))
36
37
  self._binders = self._serviceBag:GetService(require("GameConfigBindersServer"))
37
38
 
38
39
  -- Setup picker
39
- self._configPicker = GameConfigPicker.new(self._binders.GameConfig, self._binders.GameConfigAsset)
40
- self._maid:GiveTask(self._configPicker)
40
+ self._configPicker = self._maid:Add(GameConfigPicker.new(self._binders.GameConfig, self._binders.GameConfigAsset))
41
41
 
42
42
  self._getPreferredParent = PreferredParentUtils.createPreferredParentRetriever(ReplicatedStorage, "GameConfigs")
43
+
44
+ self._serviceBag:GetService(require("GameConfigDataService")):SetConfigPicker(self._configPicker)
43
45
  end
44
46
 
45
47
  --[=[
@@ -95,6 +97,15 @@ function GameConfigService:AddAsset(assetKey, assetId)
95
97
  self:AddTypedAsset(GameConfigAssetTypes.ASSET, assetKey, assetId)
96
98
  end
97
99
 
100
+ --[=[
101
+ Adds a new asset with the key configured to the `assetKey`
102
+ @param assetKey string -- Key name to use for the asset
103
+ @param subscriptionId string -- Cloud id
104
+ ]=]
105
+ function GameConfigService:AddSubscription(assetKey, subscriptionId)
106
+ self:AddTypedAsset(GameConfigAssetTypes.SUBSCRIPTION, assetKey, subscriptionId)
107
+ end
108
+
98
109
  --[=[
99
110
  Adds a new bundle with the key configured to the `assetKey`
100
111
  @param assetKey string -- Key name to use for the bundle
@@ -15,6 +15,8 @@ local pluralMap = {
15
15
  [GameConfigAssetTypes.PLACE] = "places";
16
16
  [GameConfigAssetTypes.ASSET] = "assets";
17
17
  [GameConfigAssetTypes.BUNDLE] = "bundles";
18
+ [GameConfigAssetTypes.SUBSCRIPTION] = "subscriptions";
19
+ [GameConfigAssetTypes.MEMBERSHIP] = "memberships";
18
20
  }
19
21
 
20
22
  for _, item in pairs(GameConfigAssetTypes) do
@@ -51,4 +51,18 @@ return Table.readonly({
51
51
  @within GameConfigAssetTypes
52
52
  ]=]
53
53
  PLACE = "place";
54
+
55
+ --[=[
56
+ Specifies the asset is of type subscription
57
+ @prop SUBSCRIPTION string
58
+ @within GameConfigAssetTypes
59
+ ]=]
60
+ SUBSCRIPTION = "subscription";
61
+
62
+ --[=[
63
+ Specifies the asset is of type membership (Roblox Premium)
64
+ @prop MEMBERSHIP string
65
+ @within GameConfigAssetTypes
66
+ ]=]
67
+ MEMBERSHIP = "membership";
54
68
  })
@@ -0,0 +1,25 @@
1
+ --[=[
2
+ @class GameConfigDataService
3
+ ]=]
4
+
5
+ local require = require(script.Parent.loader).load(script)
6
+
7
+ local GameConfigDataService = {}
8
+ GameConfigDataService.ServiceName = "GameConfigDataService"
9
+
10
+ function GameConfigDataService:Init(serviceBag)
11
+ assert(not self._serviceBag, "Already initialized")
12
+ self._serviceBag = assert(serviceBag, "No serviceBag")
13
+
14
+
15
+ end
16
+
17
+ function GameConfigDataService:SetConfigPicker(configPicker)
18
+ self._configPicker = configPicker
19
+ end
20
+
21
+ function GameConfigDataService:GetConfigPicker()
22
+ return self._configPicker
23
+ end
24
+
25
+ return GameConfigDataService