@nice2dev/game-engine 1.3.13 → 1.3.14

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.
Files changed (253) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +2 -2
  3. package/dist/types/accessibility/index.d.ts +0 -1
  4. package/dist/types/ai/index.d.ts +0 -1
  5. package/dist/types/animation/index.d.ts +0 -1
  6. package/dist/types/audio/HRTFAudio.d.ts +0 -180
  7. package/dist/types/audio/index.d.ts +0 -2
  8. package/dist/types/community/Community.d.ts +0 -112
  9. package/dist/types/community/index.d.ts +0 -1
  10. package/dist/types/core/TypeSafety.d.ts +0 -190
  11. package/dist/types/core/index.d.ts +0 -7
  12. package/dist/types/devtools/AssetStore.d.ts +0 -133
  13. package/dist/types/devtools/index.d.ts +0 -3
  14. package/dist/types/dialogue/index.d.ts +0 -2
  15. package/dist/types/docs/APIPlayground.d.ts +0 -26
  16. package/dist/types/docs/Cookbook.d.ts +0 -18
  17. package/dist/types/docs/Guides.d.ts +0 -18
  18. package/dist/types/docs/index.d.ts +0 -4
  19. package/dist/types/ecs/ECSOptimized.d.ts +0 -131
  20. package/dist/types/ecs/index.d.ts +0 -2
  21. package/dist/types/editor/NiceAnimationTimeline.d.ts +0 -114
  22. package/dist/types/editor/NiceLevelEditor.d.ts +0 -232
  23. package/dist/types/editor/NiceMaterialEditor.d.ts +0 -105
  24. package/dist/types/editor/NiceNodeGraph.d.ts +0 -87
  25. package/dist/types/editor/NiceParticleEditor.d.ts +0 -127
  26. package/dist/types/editor/behavior-tree/BTDebugPanel.d.ts +0 -102
  27. package/dist/types/editor/behavior-tree/BTEditorCanvas.d.ts +0 -79
  28. package/dist/types/editor/behavior-tree/BTEditorNode.d.ts +0 -58
  29. package/dist/types/editor/behavior-tree/BTEditorToolbar.d.ts +0 -75
  30. package/dist/types/editor/behavior-tree/BTNodePalette.d.ts +0 -72
  31. package/dist/types/editor/behavior-tree/BTPropertyPanel.d.ts +0 -66
  32. package/dist/types/editor/behavior-tree/BehaviorTreeEditor.d.ts +0 -186
  33. package/dist/types/editor/behavior-tree/index.d.ts +0 -14
  34. package/dist/types/editor/behavior-tree/serialization.d.ts +0 -30
  35. package/dist/types/editor/behavior-tree/types.d.ts +0 -299
  36. package/dist/types/editor/index.d.ts +0 -20
  37. package/dist/types/editor/state-machine/SMEditorCanvas.d.ts +0 -61
  38. package/dist/types/editor/state-machine/StateMachineEditor.d.ts +0 -139
  39. package/dist/types/editor/state-machine/index.d.ts +0 -11
  40. package/dist/types/editor/state-machine/serialization.d.ts +0 -23
  41. package/dist/types/editor/state-machine/types.d.ts +0 -241
  42. package/dist/types/engine/index.d.ts +0 -2
  43. package/dist/types/enterprise/index.d.ts +0 -1
  44. package/dist/types/epic/index.d.ts +0 -10
  45. package/dist/types/i18n/index.d.ts +0 -2
  46. package/dist/types/input/index.d.ts +0 -3
  47. package/dist/types/kids/index.d.ts +0 -2
  48. package/dist/types/legendary/index.d.ts +0 -57
  49. package/dist/types/monetization/index.d.ts +0 -1
  50. package/dist/types/multiplayer/NiceNetcode.d.ts +0 -434
  51. package/dist/types/multiplayer/index.d.ts +0 -5
  52. package/dist/types/network/index.d.ts +0 -2
  53. package/dist/types/pathfinding/index.d.ts +0 -1
  54. package/dist/types/performance/AssetCompression.d.ts +0 -137
  55. package/dist/types/performance/WASMModules.d.ts +0 -65
  56. package/dist/types/performance/WebGPUCompute.d.ts +0 -71
  57. package/dist/types/performance/index.d.ts +0 -1
  58. package/dist/types/physics/RapierIntegration.d.ts +0 -404
  59. package/dist/types/physics/index.d.ts +0 -2
  60. package/dist/types/plugins/index.d.ts +0 -2
  61. package/dist/types/procedural/index.d.ts +0 -2
  62. package/dist/types/release/index.d.ts +0 -1
  63. package/dist/types/rendering/WebGPUv2.d.ts +0 -173
  64. package/dist/types/rendering/index.d.ts +0 -3
  65. package/dist/types/runtime3d/index.d.ts +0 -2
  66. package/dist/types/scene/index.d.ts +0 -2
  67. package/dist/types/scripting/WasmCompiler.d.ts +0 -182
  68. package/dist/types/scripting/index.d.ts +0 -19
  69. package/dist/types/social/index.d.ts +0 -1
  70. package/dist/types/systems/NiceAI.d.ts +0 -637
  71. package/dist/types/systems/NiceAbility.d.ts +0 -225
  72. package/dist/types/systems/NiceAccessibility.d.ts +0 -230
  73. package/dist/types/systems/NiceAchievement.d.ts +0 -153
  74. package/dist/types/systems/NiceAchievementUI.d.ts +0 -196
  75. package/dist/types/systems/NiceAchievements.d.ts +0 -230
  76. package/dist/types/systems/NiceAction.d.ts +0 -81
  77. package/dist/types/systems/NiceAlchemy.d.ts +0 -195
  78. package/dist/types/systems/NiceAnalytics.d.ts +0 -493
  79. package/dist/types/systems/NiceAnimation.d.ts +0 -350
  80. package/dist/types/systems/NiceArena.d.ts +0 -215
  81. package/dist/types/systems/NiceAssetLoader.d.ts +0 -136
  82. package/dist/types/systems/NiceAuction.d.ts +0 -157
  83. package/dist/types/systems/NiceAudio.d.ts +0 -224
  84. package/dist/types/systems/NiceAugment.d.ts +0 -187
  85. package/dist/types/systems/NiceAura.d.ts +0 -193
  86. package/dist/types/systems/NiceBank.d.ts +0 -158
  87. package/dist/types/systems/NiceBattlePass.d.ts +0 -150
  88. package/dist/types/systems/NiceBehavior.d.ts +0 -160
  89. package/dist/types/systems/NiceBinding.d.ts +0 -96
  90. package/dist/types/systems/NiceBlacksmith.d.ts +0 -221
  91. package/dist/types/systems/NiceBuff.d.ts +0 -177
  92. package/dist/types/systems/NiceBuilding.d.ts +0 -207
  93. package/dist/types/systems/NiceBullet.d.ts +0 -167
  94. package/dist/types/systems/NiceCamera.d.ts +0 -252
  95. package/dist/types/systems/NiceCard.d.ts +0 -171
  96. package/dist/types/systems/NiceChat.d.ts +0 -148
  97. package/dist/types/systems/NiceCheat.d.ts +0 -375
  98. package/dist/types/systems/NiceClimbing.d.ts +0 -186
  99. package/dist/types/systems/NiceCloud.d.ts +0 -422
  100. package/dist/types/systems/NiceCollision.d.ts +0 -238
  101. package/dist/types/systems/NiceCombo.d.ts +0 -131
  102. package/dist/types/systems/NiceCommand.d.ts +0 -112
  103. package/dist/types/systems/NiceCompanion.d.ts +0 -182
  104. package/dist/types/systems/NiceController.d.ts +0 -144
  105. package/dist/types/systems/NiceCooking.d.ts +0 -193
  106. package/dist/types/systems/NiceCoroutine.d.ts +0 -101
  107. package/dist/types/systems/NiceCrafting.d.ts +0 -228
  108. package/dist/types/systems/NiceCutscene.d.ts +0 -437
  109. package/dist/types/systems/NiceDaily.d.ts +0 -133
  110. package/dist/types/systems/NiceDamage.d.ts +0 -271
  111. package/dist/types/systems/NiceDayNight.d.ts +0 -126
  112. package/dist/types/systems/NiceDebug.d.ts +0 -255
  113. package/dist/types/systems/NiceDestructible.d.ts +0 -150
  114. package/dist/types/systems/NiceDialogue.d.ts +0 -629
  115. package/dist/types/systems/NiceDungeon.d.ts +0 -202
  116. package/dist/types/systems/NiceECS.d.ts +0 -151
  117. package/dist/types/systems/NiceEnchant.d.ts +0 -148
  118. package/dist/types/systems/NiceEntityPool.d.ts +0 -127
  119. package/dist/types/systems/NiceEquipment.d.ts +0 -137
  120. package/dist/types/systems/NiceEvent.d.ts +0 -202
  121. package/dist/types/systems/NiceEventBus.d.ts +0 -164
  122. package/dist/types/systems/NiceFaction.d.ts +0 -173
  123. package/dist/types/systems/NiceFarming.d.ts +0 -163
  124. package/dist/types/systems/NiceFishing.d.ts +0 -196
  125. package/dist/types/systems/NiceFlocking.d.ts +0 -156
  126. package/dist/types/systems/NiceFog.d.ts +0 -137
  127. package/dist/types/systems/NiceFormation.d.ts +0 -140
  128. package/dist/types/systems/NiceGacha.d.ts +0 -134
  129. package/dist/types/systems/NiceGambling.d.ts +0 -175
  130. package/dist/types/systems/NiceGem.d.ts +0 -165
  131. package/dist/types/systems/NiceGesture.d.ts +0 -502
  132. package/dist/types/systems/NiceGrappling.d.ts +0 -154
  133. package/dist/types/systems/NiceGrid.d.ts +0 -142
  134. package/dist/types/systems/NiceGuild.d.ts +0 -162
  135. package/dist/types/systems/NiceHaptics.d.ts +0 -112
  136. package/dist/types/systems/NiceHousing.d.ts +0 -197
  137. package/dist/types/systems/NiceInput.d.ts +0 -280
  138. package/dist/types/systems/NiceInventory.d.ts +0 -534
  139. package/dist/types/systems/NiceLOD.d.ts +0 -144
  140. package/dist/types/systems/NiceLeaderboard.d.ts +0 -191
  141. package/dist/types/systems/NiceLevel.d.ts +0 -304
  142. package/dist/types/systems/NiceLighting.d.ts +0 -214
  143. package/dist/types/systems/NiceLocalization.d.ts +0 -148
  144. package/dist/types/systems/NiceLocomotion.d.ts +0 -398
  145. package/dist/types/systems/NiceLogger.d.ts +0 -117
  146. package/dist/types/systems/NiceLoot.d.ts +0 -176
  147. package/dist/types/systems/NiceMail.d.ts +0 -164
  148. package/dist/types/systems/NiceMap.d.ts +0 -234
  149. package/dist/types/systems/NiceMarriage.d.ts +0 -150
  150. package/dist/types/systems/NiceMastery.d.ts +0 -171
  151. package/dist/types/systems/NiceMatch.d.ts +0 -196
  152. package/dist/types/systems/NiceMatch3.d.ts +0 -118
  153. package/dist/types/systems/NiceMessageBus.d.ts +0 -115
  154. package/dist/types/systems/NiceMinimap.d.ts +0 -258
  155. package/dist/types/systems/NiceMining.d.ts +0 -175
  156. package/dist/types/systems/NiceModding.d.ts +0 -452
  157. package/dist/types/systems/NiceMount.d.ts +0 -152
  158. package/dist/types/systems/NiceNavigation.d.ts +0 -307
  159. package/dist/types/systems/NiceNetwork.d.ts +0 -568
  160. package/dist/types/systems/NiceNotification.d.ts +0 -438
  161. package/dist/types/systems/NiceObjective.d.ts +0 -395
  162. package/dist/types/systems/NiceParticle.d.ts +0 -639
  163. package/dist/types/systems/NiceParty.d.ts +0 -168
  164. package/dist/types/systems/NicePerformance.d.ts +0 -144
  165. package/dist/types/systems/NicePet.d.ts +0 -167
  166. package/dist/types/systems/NicePhotoMode.d.ts +0 -270
  167. package/dist/types/systems/NicePhysics.d.ts +0 -326
  168. package/dist/types/systems/NicePlatformer.d.ts +0 -158
  169. package/dist/types/systems/NicePool.d.ts +0 -128
  170. package/dist/types/systems/NicePortal.d.ts +0 -178
  171. package/dist/types/systems/NicePostProcess.d.ts +0 -254
  172. package/dist/types/systems/NiceProcedural.d.ts +0 -202
  173. package/dist/types/systems/NiceProfile.d.ts +0 -223
  174. package/dist/types/systems/NiceProjectile.d.ts +0 -157
  175. package/dist/types/systems/NicePvP.d.ts +0 -199
  176. package/dist/types/systems/NiceQTE.d.ts +0 -160
  177. package/dist/types/systems/NiceQuest.d.ts +0 -620
  178. package/dist/types/systems/NiceRaid.d.ts +0 -215
  179. package/dist/types/systems/NiceRanking.d.ts +0 -399
  180. package/dist/types/systems/NiceReplay.d.ts +0 -180
  181. package/dist/types/systems/NiceReputation.d.ts +0 -151
  182. package/dist/types/systems/NiceResource.d.ts +0 -200
  183. package/dist/types/systems/NiceRhythm.d.ts +0 -148
  184. package/dist/types/systems/NiceRoguelike.d.ts +0 -276
  185. package/dist/types/systems/NiceRune.d.ts +0 -202
  186. package/dist/types/systems/NiceSaveSystem.d.ts +0 -194
  187. package/dist/types/systems/NiceSceneManager.d.ts +0 -112
  188. package/dist/types/systems/NiceScore.d.ts +0 -186
  189. package/dist/types/systems/NiceScreenFX.d.ts +0 -235
  190. package/dist/types/systems/NiceScreenshot.d.ts +0 -443
  191. package/dist/types/systems/NiceScribe.d.ts +0 -239
  192. package/dist/types/systems/NiceSeason.d.ts +0 -176
  193. package/dist/types/systems/NiceSerialization.d.ts +0 -89
  194. package/dist/types/systems/NiceServiceLocator.d.ts +0 -94
  195. package/dist/types/systems/NiceShop.d.ts +0 -528
  196. package/dist/types/systems/NiceSignal.d.ts +0 -112
  197. package/dist/types/systems/NiceSkillTree.d.ts +0 -237
  198. package/dist/types/systems/NiceSocial.d.ts +0 -580
  199. package/dist/types/systems/NiceSpawner.d.ts +0 -237
  200. package/dist/types/systems/NiceSpell.d.ts +0 -216
  201. package/dist/types/systems/NiceState.d.ts +0 -224
  202. package/dist/types/systems/NiceStateMachine.d.ts +0 -108
  203. package/dist/types/systems/NiceStatus.d.ts +0 -116
  204. package/dist/types/systems/NiceStealth.d.ts +0 -204
  205. package/dist/types/systems/NiceSteam.d.ts +0 -255
  206. package/dist/types/systems/NiceStreaming.d.ts +0 -173
  207. package/dist/types/systems/NiceSwimming.d.ts +0 -166
  208. package/dist/types/systems/NiceTalent.d.ts +0 -154
  209. package/dist/types/systems/NiceTarget.d.ts +0 -121
  210. package/dist/types/systems/NiceTerrain.d.ts +0 -143
  211. package/dist/types/systems/NiceTilemap.d.ts +0 -218
  212. package/dist/types/systems/NiceTimer.d.ts +0 -153
  213. package/dist/types/systems/NiceTournament.d.ts +0 -190
  214. package/dist/types/systems/NiceTrading.d.ts +0 -238
  215. package/dist/types/systems/NiceTransmog.d.ts +0 -142
  216. package/dist/types/systems/NiceTutorial.d.ts +0 -248
  217. package/dist/types/systems/NiceTween.d.ts +0 -164
  218. package/dist/types/systems/NiceUI.d.ts +0 -364
  219. package/dist/types/systems/NiceVFX.d.ts +0 -333
  220. package/dist/types/systems/NiceVehicle.d.ts +0 -176
  221. package/dist/types/systems/NiceVoice.d.ts +0 -502
  222. package/dist/types/systems/NiceWater.d.ts +0 -162
  223. package/dist/types/systems/NiceWave.d.ts +0 -174
  224. package/dist/types/systems/NiceWaypoint.d.ts +0 -165
  225. package/dist/types/systems/NiceWeather.d.ts +0 -225
  226. package/dist/types/systems/NiceXR.d.ts +0 -187
  227. package/dist/types/systems/index.d.ts +0 -182
  228. package/dist/types/templates/index.d.ts +0 -2
  229. package/dist/types/tilemap/index.d.ts +0 -1
  230. package/dist/types/tutorials/TutorialEditor.d.ts +0 -43
  231. package/dist/types/tutorials/VoiceNarration.d.ts +0 -75
  232. package/dist/types/tutorials/content/Tutorials_T04.d.ts +0 -3
  233. package/dist/types/tutorials/content/UITutorials.d.ts +0 -14
  234. package/dist/types/tutorials/content/index.d.ts +0 -5
  235. package/dist/types/tutorials/index.d.ts +0 -6
  236. package/dist/types/ui/index.d.ts +0 -2
  237. package/dist/types/visual-scripting/VisualScriptDebugger.d.ts +0 -145
  238. package/dist/types/visual-scripting/VisualScriptExecutor.d.ts +0 -100
  239. package/dist/types/visual-scripting/VisualScriptGraph.d.ts +0 -173
  240. package/dist/types/visual-scripting/VisualScriptNode.d.ts +0 -157
  241. package/dist/types/visual-scripting/index.d.ts +0 -6
  242. package/dist/types/visual-scripting/nodes/ActionNodes.d.ts +0 -152
  243. package/dist/types/visual-scripting/nodes/EventNodes.d.ts +0 -95
  244. package/dist/types/visual-scripting/nodes/FlowControlNodes.d.ts +0 -134
  245. package/dist/types/visual-scripting/nodes/LogicNodes.d.ts +0 -122
  246. package/dist/types/visual-scripting/nodes/MathNodes.d.ts +0 -170
  247. package/dist/types/visual-scripting/nodes/UtilityNodes.d.ts +0 -131
  248. package/dist/types/visual-scripting/nodes/VariableNodes.d.ts +0 -107
  249. package/dist/types/visual-scripting/nodes/index.d.ts +0 -21
  250. package/dist/types/visual-scripting/nodes/registerNodes.d.ts +0 -29
  251. package/dist/types/visual-scripting/types.d.ts +0 -402
  252. package/dist/types/xr/WebXRLayers.d.ts +0 -319
  253. package/dist/types/xr/index.d.ts +0 -2
@@ -1,528 +0,0 @@
1
- /**
2
- * NiceShop - In-Game Shop & Store System
3
- *
4
- * Comprehensive shop system for managing in-game purchases, virtual currencies,
5
- * item catalogs, discounts, bundles, and storefront display.
6
- *
7
- * Features:
8
- * - Multiple currency support (soft/hard currencies)
9
- * - Item catalog management
10
- * - Category and filtering
11
- * - Discounts and sales
12
- * - Bundle deals
13
- * - Purchase history
14
- * - Limited time offers
15
- * - Daily/weekly rotating items
16
- * - Wishlist functionality
17
- * - Currency conversion
18
- * - Refund system
19
- * - Purchase validation
20
- *
21
- * @packageDocumentation
22
- */
23
- import { EventEmitter } from 'events';
24
- /** Unique item ID */
25
- export type ShopItemId = string;
26
- /** Unique currency ID */
27
- export type CurrencyId = string;
28
- /** Unique bundle ID */
29
- export type BundleId = string;
30
- /** Unique category ID */
31
- export type CategoryId = string;
32
- /** Unique transaction ID */
33
- export type TransactionId = string;
34
- /** Unique offer ID */
35
- export type OfferId = string;
36
- /** Item rarity */
37
- export type ItemRarity = 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary' | 'mythic';
38
- /** Item type */
39
- export type ItemType = 'consumable' | 'equipment' | 'cosmetic' | 'currency' | 'boost' | 'unlock' | 'subscription';
40
- /** Purchase state */
41
- export type PurchaseState = 'pending' | 'processing' | 'completed' | 'failed' | 'refunded' | 'cancelled';
42
- /** Offer type */
43
- export type OfferType = 'daily' | 'weekly' | 'seasonal' | 'flash' | 'permanent' | 'first_purchase';
44
- /** Discount type */
45
- export type DiscountType = 'percentage' | 'fixed' | 'bundle' | 'loyalty';
46
- /** Currency definition */
47
- export interface Currency {
48
- id: CurrencyId;
49
- name: string;
50
- symbol: string;
51
- icon?: string;
52
- isHardCurrency: boolean;
53
- exchangeRate?: number;
54
- maxAmount?: number;
55
- canBeEarned: boolean;
56
- canBePurchased: boolean;
57
- }
58
- /** Currency balance */
59
- export interface CurrencyBalance {
60
- currencyId: CurrencyId;
61
- amount: number;
62
- lifetimeEarned: number;
63
- lifetimeSpent: number;
64
- }
65
- /** Item price */
66
- export interface ItemPrice {
67
- currencyId: CurrencyId;
68
- amount: number;
69
- originalAmount?: number;
70
- }
71
- /** Shop item definition */
72
- export interface ShopItem {
73
- id: ShopItemId;
74
- name: string;
75
- description: string;
76
- type: ItemType;
77
- rarity: ItemRarity;
78
- categoryId: CategoryId;
79
- prices: ItemPrice[];
80
- icon?: string;
81
- preview?: string;
82
- tags: string[];
83
- metadata?: Record<string, unknown>;
84
- isNew?: boolean;
85
- isFeatured?: boolean;
86
- isLimitedTime?: boolean;
87
- purchaseLimit?: number;
88
- requiredLevel?: number;
89
- requiredItems?: ShopItemId[];
90
- unlockCondition?: string;
91
- expiresAt?: number;
92
- availableFrom?: number;
93
- quantity?: number;
94
- }
95
- /** Category definition */
96
- export interface ShopCategory {
97
- id: CategoryId;
98
- name: string;
99
- description?: string;
100
- icon?: string;
101
- parentId?: CategoryId;
102
- sortOrder: number;
103
- isVisible: boolean;
104
- }
105
- /** Bundle definition */
106
- export interface ShopBundle {
107
- id: BundleId;
108
- name: string;
109
- description: string;
110
- items: Array<{
111
- itemId: ShopItemId;
112
- quantity: number;
113
- }>;
114
- prices: ItemPrice[];
115
- savings: number;
116
- icon?: string;
117
- preview?: string;
118
- isLimitedTime?: boolean;
119
- expiresAt?: number;
120
- purchaseLimit?: number;
121
- }
122
- /** Discount definition */
123
- export interface Discount {
124
- id: string;
125
- type: DiscountType;
126
- value: number;
127
- categoryId?: CategoryId;
128
- itemIds?: ShopItemId[];
129
- minPurchase?: number;
130
- maxDiscount?: number;
131
- code?: string;
132
- validFrom: number;
133
- validUntil: number;
134
- usageLimit?: number;
135
- usageCount: number;
136
- isActive: boolean;
137
- }
138
- /** Special offer */
139
- export interface SpecialOffer {
140
- id: OfferId;
141
- type: OfferType;
142
- title: string;
143
- description: string;
144
- items: Array<{
145
- itemId: ShopItemId;
146
- quantity: number;
147
- discountPercent: number;
148
- }>;
149
- bundles?: BundleId[];
150
- prices: ItemPrice[];
151
- icon?: string;
152
- background?: string;
153
- validFrom: number;
154
- validUntil: number;
155
- purchaseLimit: number;
156
- purchaseCount: number;
157
- priority: number;
158
- }
159
- /** Transaction record */
160
- export interface Transaction {
161
- id: TransactionId;
162
- itemId?: ShopItemId;
163
- bundleId?: BundleId;
164
- offerId?: OfferId;
165
- quantity: number;
166
- prices: ItemPrice[];
167
- state: PurchaseState;
168
- timestamp: number;
169
- completedAt?: number;
170
- refundedAt?: number;
171
- discountApplied?: string;
172
- metadata?: Record<string, unknown>;
173
- }
174
- /** Wishlist item */
175
- export interface WishlistItem {
176
- itemId: ShopItemId;
177
- addedAt: number;
178
- notifyOnSale: boolean;
179
- targetPrice?: ItemPrice;
180
- }
181
- /** Shop statistics */
182
- export interface ShopStatistics {
183
- totalPurchases: number;
184
- totalSpent: Record<CurrencyId, number>;
185
- itemsPurchased: Record<ShopItemId, number>;
186
- favoriteCategory?: CategoryId;
187
- averagePurchaseValue: number;
188
- lastPurchaseDate?: number;
189
- loyaltyPoints: number;
190
- }
191
- /** Filter options */
192
- export interface ShopFilter {
193
- categoryId?: CategoryId;
194
- types?: ItemType[];
195
- rarities?: ItemRarity[];
196
- minPrice?: number;
197
- maxPrice?: number;
198
- currencyId?: CurrencyId;
199
- tags?: string[];
200
- showOwned?: boolean;
201
- showAffordable?: boolean;
202
- showNew?: boolean;
203
- showFeatured?: boolean;
204
- showLimitedTime?: boolean;
205
- searchQuery?: string;
206
- }
207
- /** Sort options */
208
- export interface ShopSort {
209
- field: 'name' | 'price' | 'rarity' | 'date' | 'popularity';
210
- direction: 'asc' | 'desc';
211
- }
212
- /** Purchase request */
213
- export interface PurchaseRequest {
214
- itemId?: ShopItemId;
215
- bundleId?: BundleId;
216
- offerId?: OfferId;
217
- quantity: number;
218
- currencyId: CurrencyId;
219
- discountCode?: string;
220
- }
221
- /** Purchase result */
222
- export interface PurchaseResult {
223
- success: boolean;
224
- transactionId?: TransactionId;
225
- error?: string;
226
- itemsReceived?: Array<{
227
- itemId: ShopItemId;
228
- quantity: number;
229
- }>;
230
- currencySpent?: ItemPrice;
231
- newBalance?: number;
232
- }
233
- /** Shop event types */
234
- export type ShopEventType = 'purchase_started' | 'purchase_completed' | 'purchase_failed' | 'purchase_refunded' | 'currency_changed' | 'item_added' | 'item_removed' | 'item_updated' | 'offer_started' | 'offer_ended' | 'discount_applied' | 'discount_removed' | 'wishlist_added' | 'wishlist_removed' | 'catalog_refreshed';
235
- /** Shop event data */
236
- export interface ShopEvent {
237
- type: ShopEventType;
238
- timestamp: number;
239
- itemId?: ShopItemId;
240
- bundleId?: BundleId;
241
- offerId?: OfferId;
242
- transactionId?: TransactionId;
243
- currencyId?: CurrencyId;
244
- amount?: number;
245
- oldBalance?: number;
246
- newBalance?: number;
247
- error?: string;
248
- }
249
- /** Shop event callback */
250
- export type ShopEventCallback = (event: ShopEvent) => void;
251
- /** Shop system configuration */
252
- export interface ShopConfig {
253
- currencies: Currency[];
254
- defaultCurrencyId: CurrencyId;
255
- maxTransactionHistory: number;
256
- maxWishlistSize: number;
257
- enableRefunds: boolean;
258
- refundWindowMs: number;
259
- enableDiscountCodes: boolean;
260
- loyaltyPointsPerPurchase: number;
261
- loyaltyPointsConversionRate: number;
262
- autoRefreshCatalogMs?: number;
263
- validatePurchases: boolean;
264
- purchaseCooldownMs: number;
265
- }
266
- /** Default configuration */
267
- export declare const DEFAULT_SHOP_CONFIG: ShopConfig;
268
- /**
269
- * In-game shop and store system
270
- */
271
- export declare class NiceShop extends EventEmitter {
272
- private config;
273
- private items;
274
- private categories;
275
- private bundles;
276
- private offers;
277
- private discounts;
278
- private balances;
279
- private transactions;
280
- private wishlist;
281
- private ownedItems;
282
- private statistics;
283
- private refreshInterval?;
284
- private lastPurchaseTime;
285
- constructor(config?: Partial<ShopConfig>);
286
- /**
287
- * Initialize currency balances
288
- */
289
- private initializeCurrencies;
290
- /**
291
- * Start auto-refresh interval
292
- */
293
- private startAutoRefresh;
294
- /**
295
- * Emit shop event
296
- */
297
- private emitEvent;
298
- /**
299
- * Get currency balance
300
- */
301
- getBalance(currencyId: CurrencyId): number;
302
- /**
303
- * Get all balances
304
- */
305
- getAllBalances(): CurrencyBalance[];
306
- /**
307
- * Add currency
308
- */
309
- addCurrency(currencyId: CurrencyId, amount: number, _source?: string): boolean;
310
- /**
311
- * Remove currency
312
- */
313
- removeCurrency(currencyId: CurrencyId, amount: number): boolean;
314
- /**
315
- * Set currency balance
316
- */
317
- setCurrency(currencyId: CurrencyId, amount: number): void;
318
- /**
319
- * Convert currency
320
- */
321
- convertCurrency(fromCurrencyId: CurrencyId, toCurrencyId: CurrencyId, amount: number): boolean;
322
- /**
323
- * Register shop item
324
- */
325
- registerItem(item: ShopItem): void;
326
- /**
327
- * Register multiple items
328
- */
329
- registerItems(items: ShopItem[]): void;
330
- /**
331
- * Remove item from catalog
332
- */
333
- removeItem(itemId: ShopItemId): boolean;
334
- /**
335
- * Update item
336
- */
337
- updateItem(itemId: ShopItemId, updates: Partial<ShopItem>): boolean;
338
- /**
339
- * Get item by ID
340
- */
341
- getItem(itemId: ShopItemId): ShopItem | undefined;
342
- /**
343
- * Get all items
344
- */
345
- getAllItems(): ShopItem[];
346
- /**
347
- * Get items by category
348
- */
349
- getItemsByCategory(categoryId: CategoryId): ShopItem[];
350
- /**
351
- * Filter items
352
- */
353
- filterItems(filter: ShopFilter, sort?: ShopSort): ShopItem[];
354
- /**
355
- * Register category
356
- */
357
- registerCategory(category: ShopCategory): void;
358
- /**
359
- * Get category
360
- */
361
- getCategory(categoryId: CategoryId): ShopCategory | undefined;
362
- /**
363
- * Get all categories
364
- */
365
- getAllCategories(): ShopCategory[];
366
- /**
367
- * Get subcategories
368
- */
369
- getSubcategories(parentId: CategoryId): ShopCategory[];
370
- /**
371
- * Register bundle
372
- */
373
- registerBundle(bundle: ShopBundle): void;
374
- /**
375
- * Get bundle
376
- */
377
- getBundle(bundleId: BundleId): ShopBundle | undefined;
378
- /**
379
- * Get all bundles
380
- */
381
- getAllBundles(): ShopBundle[];
382
- /**
383
- * Calculate bundle value
384
- */
385
- calculateBundleValue(bundleId: BundleId, currencyId: CurrencyId): number;
386
- /**
387
- * Register special offer
388
- */
389
- registerOffer(offer: SpecialOffer): void;
390
- /**
391
- * Get active offers
392
- */
393
- getActiveOffers(): SpecialOffer[];
394
- /**
395
- * Get offers by type
396
- */
397
- getOffersByType(type: OfferType): SpecialOffer[];
398
- /**
399
- * Check expired offers
400
- */
401
- checkExpiredOffers(): void;
402
- /**
403
- * Register discount
404
- */
405
- registerDiscount(discount: Discount): void;
406
- /**
407
- * Apply discount code
408
- */
409
- applyDiscountCode(code: string): Discount | undefined;
410
- /**
411
- * Calculate discounted price
412
- */
413
- calculateDiscountedPrice(price: number, discount: Discount): number;
414
- /**
415
- * Get applicable discounts for item
416
- */
417
- getApplicableDiscounts(itemId: ShopItemId): Discount[];
418
- /**
419
- * Check if player can afford item
420
- */
421
- canAfford(itemId: ShopItemId, currencyId?: CurrencyId): boolean;
422
- /**
423
- * Check if item can be purchased
424
- */
425
- canPurchase(itemId: ShopItemId): {
426
- canPurchase: boolean;
427
- reason?: string;
428
- };
429
- /**
430
- * Purchase item
431
- */
432
- purchaseItem(request: PurchaseRequest): Promise<PurchaseResult>;
433
- /**
434
- * Refund transaction
435
- */
436
- refundTransaction(transactionId: TransactionId): boolean;
437
- /**
438
- * Add to wishlist
439
- */
440
- addToWishlist(itemId: ShopItemId, notifyOnSale?: boolean, targetPrice?: ItemPrice): boolean;
441
- /**
442
- * Remove from wishlist
443
- */
444
- removeFromWishlist(itemId: ShopItemId): boolean;
445
- /**
446
- * Get wishlist
447
- */
448
- getWishlist(): WishlistItem[];
449
- /**
450
- * Check if item is in wishlist
451
- */
452
- isInWishlist(itemId: ShopItemId): boolean;
453
- /**
454
- * Get transaction history
455
- */
456
- getTransactionHistory(limit?: number): Transaction[];
457
- /**
458
- * Get transaction by ID
459
- */
460
- getTransaction(transactionId: TransactionId): Transaction | undefined;
461
- /**
462
- * Get transactions by state
463
- */
464
- getTransactionsByState(state: PurchaseState): Transaction[];
465
- /**
466
- * Check if item is owned
467
- */
468
- isOwned(itemId: ShopItemId): boolean;
469
- /**
470
- * Get owned quantity
471
- */
472
- getOwnedQuantity(itemId: ShopItemId): number;
473
- /**
474
- * Get all owned items
475
- */
476
- getAllOwnedItems(): Map<ShopItemId, number>;
477
- /**
478
- * Set owned items (for loading save data)
479
- */
480
- setOwnedItems(items: Map<ShopItemId, number>): void;
481
- /**
482
- * Get shop statistics
483
- */
484
- getStatistics(): ShopStatistics;
485
- /**
486
- * Get most popular items
487
- */
488
- getMostPopularItems(limit?: number): ShopItem[];
489
- /**
490
- * Get featured items
491
- */
492
- getFeaturedItems(): ShopItem[];
493
- /**
494
- * Get new items
495
- */
496
- getNewItems(): ShopItem[];
497
- /**
498
- * Get limited time items
499
- */
500
- getLimitedTimeItems(): ShopItem[];
501
- /**
502
- * Refresh catalog (check expiration, update availability)
503
- */
504
- refreshCatalog(): void;
505
- /**
506
- * Export shop state
507
- */
508
- exportState(): object;
509
- /**
510
- * Import shop state
511
- */
512
- importState(state: {
513
- balances?: [CurrencyId, CurrencyBalance][];
514
- ownedItems?: [ShopItemId, number][];
515
- wishlist?: [ShopItemId, WishlistItem][];
516
- transactions?: Transaction[];
517
- statistics?: ShopStatistics;
518
- }): void;
519
- /**
520
- * Destroy shop system
521
- */
522
- destroy(): void;
523
- }
524
- /**
525
- * Create shop system instance
526
- */
527
- export declare function createShopSystem(config?: Partial<ShopConfig>): NiceShop;
528
- export default NiceShop;
@@ -1,112 +0,0 @@
1
- export type SignalListener<T> = (value: T, previous: T) => void;
2
- export type Unsubscribe = () => void;
3
- export type Cleanup = () => void;
4
- export type EffectFn = () => void | Cleanup;
5
- export interface ReadableSignal<T> {
6
- get(): T;
7
- subscribe(listener: SignalListener<T>): Unsubscribe;
8
- }
9
- export interface WritableSignal<T> extends ReadableSignal<T> {
10
- set(value: T): void;
11
- update(updater: (current: T) => T): void;
12
- }
13
- export declare class Signal<T> implements WritableSignal<T> {
14
- private value;
15
- private listeners;
16
- private dependents;
17
- private name?;
18
- constructor(initialValue: T, name?: string);
19
- get(): T;
20
- set(newValue: T): void;
21
- update(updater: (current: T) => T): void;
22
- peek(): T;
23
- subscribe(listener: SignalListener<T>): Unsubscribe;
24
- addDependent(effect: EffectInstance): void;
25
- removeDependent(effect: EffectInstance): void;
26
- private notify;
27
- getName(): string | undefined;
28
- }
29
- export declare class ComputedSignal<T> implements ReadableSignal<T> {
30
- private computation;
31
- private cachedValue;
32
- private dirty;
33
- private listeners;
34
- private dependencies;
35
- private effect;
36
- constructor(computation: () => T);
37
- get(): T;
38
- subscribe(listener: SignalListener<T>): Unsubscribe;
39
- dispose(): void;
40
- }
41
- declare class EffectInstance {
42
- fn: EffectFn;
43
- dependencies: Set<Signal<unknown>>;
44
- cleanup: Cleanup | null;
45
- disposed: boolean;
46
- constructor(fn: EffectFn);
47
- run(): void;
48
- dispose(): void;
49
- }
50
- export declare function batch(fn: () => void): void;
51
- export declare function signal<T>(initialValue: T, name?: string): Signal<T>;
52
- export declare function computed<T>(computation: () => T): ComputedSignal<T>;
53
- export declare function effect(fn: EffectFn): () => void;
54
- export declare function derived<T, U>(source: ReadableSignal<T>, derivation: (value: T) => U): ComputedSignal<U>;
55
- export declare function combine<T extends ReadableSignal<unknown>[]>(...signals: T): ComputedSignal<{
56
- [K in keyof T]: T[K] extends ReadableSignal<infer U> ? U : never;
57
- }>;
58
- export declare function when<T>(source: ReadableSignal<T>, predicate: (value: T) => boolean): Promise<T>;
59
- export interface SignalStore<T extends Record<string, unknown>> {
60
- get<K extends keyof T>(key: K): T[K];
61
- set<K extends keyof T>(key: K, value: T[K]): void;
62
- update<K extends keyof T>(key: K, updater: (current: T[K]) => T[K]): void;
63
- subscribe<K extends keyof T>(key: K, listener: SignalListener<T[K]>): Unsubscribe;
64
- getSignal<K extends keyof T>(key: K): Signal<T[K]>;
65
- }
66
- export declare function createStore<T extends Record<string, unknown>>(initialState: T): SignalStore<T>;
67
- export declare class SignalArray<T> {
68
- private items;
69
- private lengthSignal;
70
- constructor(initial?: T[]);
71
- get(): T[];
72
- at(index: number): T | undefined;
73
- length(): number;
74
- push(...items: T[]): number;
75
- pop(): T | undefined;
76
- shift(): T | undefined;
77
- unshift(...items: T[]): number;
78
- set(index: number, value: T): void;
79
- remove(predicate: (item: T) => boolean): T[];
80
- clear(): void;
81
- subscribe(listener: SignalListener<T[]>): Unsubscribe;
82
- }
83
- export declare function signalArray<T>(initial?: T[]): SignalArray<T>;
84
- export declare class SignalMap<K, V> {
85
- private mapSignal;
86
- private sizeSignal;
87
- constructor(initial?: Iterable<[K, V]>);
88
- get(key: K): V | undefined;
89
- set(key: K, value: V): void;
90
- delete(key: K): boolean;
91
- has(key: K): boolean;
92
- clear(): void;
93
- size(): number;
94
- entries(): IterableIterator<[K, V]>;
95
- keys(): IterableIterator<K>;
96
- values(): IterableIterator<V>;
97
- subscribe(listener: SignalListener<Map<K, V>>): Unsubscribe;
98
- }
99
- export declare function signalMap<K, V>(initial?: Iterable<[K, V]>): SignalMap<K, V>;
100
- declare const _default: {
101
- signal: typeof signal;
102
- computed: typeof computed;
103
- effect: typeof effect;
104
- batch: typeof batch;
105
- derived: typeof derived;
106
- combine: typeof combine;
107
- when: typeof when;
108
- createStore: typeof createStore;
109
- signalArray: typeof signalArray;
110
- signalMap: typeof signalMap;
111
- };
112
- export default _default;