@crowdedkingdoms/crowdyjs 17.14.0-dev.1 → 18.0.1-dev.1
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/MIGRATION.md +129 -1
- package/README.md +97 -164
- package/dist/crowdy-client.d.ts +12 -31
- package/dist/crowdy-client.d.ts.map +1 -1
- package/dist/crowdy-client.js +15 -37
- package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
- package/dist/crowdy-dsh/bridge.js +3 -6
- package/dist/crowdy-studio/controller.d.ts +34 -59
- package/dist/crowdy-studio/controller.d.ts.map +1 -1
- package/dist/crowdy-studio/controller.js +96 -225
- package/dist/crowdy-studio/diagnostics.d.ts +3 -12
- package/dist/crowdy-studio/diagnostics.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.d.ts +2 -4
- package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
- package/dist/crowdy-studio/dom-shell.js +16 -49
- package/dist/crowdy-studio/embed/hud-layer.d.ts +1 -2
- package/dist/crowdy-studio/embed/hud-layer.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.d.ts +3 -13
- package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
- package/dist/crowdy-studio/embed/panel.js +3 -6
- package/dist/crowdy-studio/index.d.ts +1 -3
- package/dist/crowdy-studio/index.d.ts.map +1 -1
- package/dist/crowdy-studio/index.js +0 -2
- package/dist/crowdy-studio/models.d.ts +3 -4
- package/dist/crowdy-studio/models.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.d.ts +8 -12
- package/dist/crowdy-studio/starter-projects.d.ts.map +1 -1
- package/dist/crowdy-studio/starter-projects.js +12 -103
- package/dist/domains/appAccess.d.ts +14 -1
- package/dist/domains/appAccess.d.ts.map +1 -1
- package/dist/domains/appAccess.js +37 -1
- package/dist/domains/apps.d.ts +1 -10
- package/dist/domains/apps.d.ts.map +1 -1
- package/dist/domains/apps.js +1 -16
- package/dist/domains/host.d.ts +3 -3
- package/dist/domains/host.js +3 -3
- package/dist/domains/hosting.d.ts +0 -6
- package/dist/domains/hosting.d.ts.map +1 -1
- package/dist/domains/hosting.js +1 -16
- package/dist/domains/marketplace.d.ts +9 -70
- package/dist/domains/marketplace.d.ts.map +1 -1
- package/dist/domains/marketplace.js +9 -120
- package/dist/domains/organizations.d.ts +1 -9
- package/dist/domains/organizations.d.ts.map +1 -1
- package/dist/domains/organizations.js +1 -15
- package/dist/domains/payments.d.ts +5 -48
- package/dist/domains/payments.d.ts.map +1 -1
- package/dist/domains/payments.js +5 -57
- package/dist/domains/playerWallet.d.ts +6 -12
- package/dist/domains/playerWallet.d.ts.map +1 -1
- package/dist/domains/playerWallet.js +6 -21
- package/dist/domains/quotas.d.ts +20 -7
- package/dist/domains/quotas.d.ts.map +1 -1
- package/dist/domains/quotas.js +15 -6
- package/dist/domains/users.d.ts +7 -74
- package/dist/domains/users.d.ts.map +1 -1
- package/dist/domains/users.js +7 -105
- package/dist/errors.d.ts +7 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +6 -10
- package/dist/generated/graphql.d.ts +955 -8272
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +5 -329
- package/dist/grid-mods/exec-client-halves.d.ts +19 -3
- package/dist/grid-mods/exec-client-halves.d.ts.map +1 -1
- package/dist/grid-mods/exec-client-halves.js +17 -2
- package/dist/grid-mods/grid-host-calls.d.ts +29 -17
- package/dist/grid-mods/grid-host-calls.d.ts.map +1 -1
- package/dist/grid-mods/grid-host-calls.js +40 -46
- package/dist/grid-mods/mod-runtime.d.ts +18 -11
- package/dist/grid-mods/mod-runtime.d.ts.map +1 -1
- package/dist/grid-mods/mod-runtime.js +4 -2
- package/dist/grid-scope.d.ts +0 -189
- package/dist/grid-scope.d.ts.map +1 -1
- package/dist/grid-scope.js +0 -70
- package/dist/index.d.ts +12 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -16
- package/dist/kit/actions.d.ts +5 -9
- package/dist/kit/actions.d.ts.map +1 -1
- package/dist/kit/actions.js +5 -9
- package/dist/kit/index.d.ts +2 -33
- package/dist/kit/index.d.ts.map +1 -1
- package/dist/kit/index.js +1 -32
- package/dist/kit/kit.d.ts +8 -208
- package/dist/kit/kit.d.ts.map +1 -1
- package/dist/kit/kit.js +5 -163
- package/dist/kit/social.d.ts +1 -3
- package/dist/kit/social.d.ts.map +1 -1
- package/dist/kit/social.js +1 -3
- package/dist/kit/wire.d.ts +16 -5
- package/dist/kit/wire.d.ts.map +1 -1
- package/dist/kit/wire.js +19 -5
- package/dist/live-coding/assets/browser-authoring-index.json +1 -1
- package/dist/live-coding/assets/manifest.json +1 -1
- package/dist/live-coding/browser-authoring-index.generated.d.ts.map +1 -1
- package/dist/live-coding/browser-authoring-index.generated.js +1496 -4386
- package/dist/live-coding/rust-analysis.d.ts.map +1 -1
- package/dist/live-coding/rust-analysis.js +30 -34
- package/dist/player-runtime/client-host-calls.d.ts +8 -0
- package/dist/player-runtime/client-host-calls.d.ts.map +1 -0
- package/dist/player-runtime/client-host-calls.js +28 -0
- package/dist/player-runtime/glue-runtime.d.ts +24 -20
- package/dist/player-runtime/glue-runtime.d.ts.map +1 -1
- package/dist/player-runtime/glue-runtime.js +26 -55
- package/dist/player-runtime/glue-sab.d.ts +2 -2
- package/dist/player-runtime/glue-sab.js +2 -2
- package/dist/player-runtime/player-code-broker.d.ts +70 -43
- package/dist/player-runtime/player-code-broker.d.ts.map +1 -1
- package/dist/player-runtime/player-code-broker.js +159 -64
- package/dist/player-runtime/player-glue-worker.d.ts +8 -9
- package/dist/player-runtime/player-glue-worker.d.ts.map +1 -1
- package/dist/player-runtime/player-glue-worker.js +26 -11
- package/dist/stores/inbox.d.ts +1 -1
- package/dist/stores/inbox.d.ts.map +1 -1
- package/dist/stores/index.d.ts +0 -11
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/index.js +0 -4
- package/dist/stores/session.d.ts +0 -2
- package/dist/stores/session.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/crowdy-studio/model-lint-log.d.ts +0 -76
- package/dist/crowdy-studio/model-lint-log.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint-log.js +0 -93
- package/dist/crowdy-studio/model-lint.d.ts +0 -61
- package/dist/crowdy-studio/model-lint.d.ts.map +0 -1
- package/dist/crowdy-studio/model-lint.js +0 -45
- package/dist/domains/compute.d.ts +0 -208
- package/dist/domains/compute.d.ts.map +0 -1
- package/dist/domains/compute.js +0 -274
- package/dist/domains/controlPlane.d.ts +0 -38
- package/dist/domains/controlPlane.d.ts.map +0 -1
- package/dist/domains/controlPlane.js +0 -43
- package/dist/domains/gameModel.d.ts +0 -1174
- package/dist/domains/gameModel.d.ts.map +0 -1
- package/dist/domains/gameModel.js +0 -1333
- package/dist/domains/playerCompute.d.ts +0 -91
- package/dist/domains/playerCompute.d.ts.map +0 -1
- package/dist/domains/playerCompute.js +0 -136
- package/dist/domains/playerModel.d.ts +0 -20
- package/dist/domains/playerModel.d.ts.map +0 -1
- package/dist/domains/playerModel.js +0 -54
- package/dist/kit/abilities.d.ts +0 -66
- package/dist/kit/abilities.d.ts.map +0 -1
- package/dist/kit/abilities.js +0 -71
- package/dist/kit/blueprints/combat.d.ts +0 -81
- package/dist/kit/blueprints/combat.d.ts.map +0 -1
- package/dist/kit/blueprints/combat.js +0 -357
- package/dist/kit/blueprints/core.d.ts +0 -222
- package/dist/kit/blueprints/core.d.ts.map +0 -1
- package/dist/kit/blueprints/core.js +0 -185
- package/dist/kit/blueprints/decks.d.ts +0 -50
- package/dist/kit/blueprints/decks.d.ts.map +0 -1
- package/dist/kit/blueprints/decks.js +0 -163
- package/dist/kit/blueprints/economy.d.ts +0 -88
- package/dist/kit/blueprints/economy.d.ts.map +0 -1
- package/dist/kit/blueprints/economy.js +0 -533
- package/dist/kit/blueprints/guild.d.ts +0 -51
- package/dist/kit/blueprints/guild.d.ts.map +0 -1
- package/dist/kit/blueprints/guild.js +0 -50
- package/dist/kit/blueprints/index.d.ts +0 -23
- package/dist/kit/blueprints/index.d.ts.map +0 -1
- package/dist/kit/blueprints/index.js +0 -22
- package/dist/kit/blueprints/inventory.d.ts +0 -84
- package/dist/kit/blueprints/inventory.d.ts.map +0 -1
- package/dist/kit/blueprints/inventory.js +0 -257
- package/dist/kit/blueprints/leaderboards.d.ts +0 -49
- package/dist/kit/blueprints/leaderboards.d.ts.map +0 -1
- package/dist/kit/blueprints/leaderboards.js +0 -126
- package/dist/kit/blueprints/liveops.d.ts +0 -42
- package/dist/kit/blueprints/liveops.d.ts.map +0 -1
- package/dist/kit/blueprints/liveops.js +0 -170
- package/dist/kit/blueprints/locks.d.ts +0 -82
- package/dist/kit/blueprints/locks.d.ts.map +0 -1
- package/dist/kit/blueprints/locks.js +0 -155
- package/dist/kit/blueprints/loot.d.ts +0 -90
- package/dist/kit/blueprints/loot.d.ts.map +0 -1
- package/dist/kit/blueprints/loot.js +0 -229
- package/dist/kit/blueprints/matches.d.ts +0 -84
- package/dist/kit/blueprints/matches.d.ts.map +0 -1
- package/dist/kit/blueprints/matches.js +0 -349
- package/dist/kit/blueprints/moderation.d.ts +0 -32
- package/dist/kit/blueprints/moderation.d.ts.map +0 -1
- package/dist/kit/blueprints/moderation.js +0 -140
- package/dist/kit/blueprints/npcs.d.ts +0 -78
- package/dist/kit/blueprints/npcs.d.ts.map +0 -1
- package/dist/kit/blueprints/npcs.js +0 -125
- package/dist/kit/blueprints/plots.d.ts +0 -63
- package/dist/kit/blueprints/plots.d.ts.map +0 -1
- package/dist/kit/blueprints/plots.js +0 -151
- package/dist/kit/blueprints/progression.d.ts +0 -68
- package/dist/kit/blueprints/progression.d.ts.map +0 -1
- package/dist/kit/blueprints/progression.js +0 -324
- package/dist/kit/blueprints/quests.d.ts +0 -72
- package/dist/kit/blueprints/quests.d.ts.map +0 -1
- package/dist/kit/blueprints/quests.js +0 -285
- package/dist/kit/blueprints/worldsim.d.ts +0 -91
- package/dist/kit/blueprints/worldsim.d.ts.map +0 -1
- package/dist/kit/blueprints/worldsim.js +0 -468
- package/dist/kit/combat.d.ts +0 -141
- package/dist/kit/combat.d.ts.map +0 -1
- package/dist/kit/combat.js +0 -196
- package/dist/kit/decks.d.ts +0 -157
- package/dist/kit/decks.d.ts.map +0 -1
- package/dist/kit/decks.js +0 -186
- package/dist/kit/director.d.ts +0 -88
- package/dist/kit/director.d.ts.map +0 -1
- package/dist/kit/director.js +0 -86
- package/dist/kit/economy.d.ts +0 -289
- package/dist/kit/economy.d.ts.map +0 -1
- package/dist/kit/economy.js +0 -427
- package/dist/kit/engine.d.ts +0 -48
- package/dist/kit/engine.d.ts.map +0 -1
- package/dist/kit/engine.js +0 -113
- package/dist/kit/features.d.ts +0 -60
- package/dist/kit/features.d.ts.map +0 -1
- package/dist/kit/features.js +0 -65
- package/dist/kit/instances.d.ts +0 -52
- package/dist/kit/instances.d.ts.map +0 -1
- package/dist/kit/instances.js +0 -60
- package/dist/kit/inventory.d.ts +0 -129
- package/dist/kit/inventory.d.ts.map +0 -1
- package/dist/kit/inventory.js +0 -200
- package/dist/kit/leaderboards.d.ts +0 -86
- package/dist/kit/leaderboards.d.ts.map +0 -1
- package/dist/kit/leaderboards.js +0 -133
- package/dist/kit/liveops.d.ts +0 -112
- package/dist/kit/liveops.d.ts.map +0 -1
- package/dist/kit/liveops.js +0 -183
- package/dist/kit/loot.d.ts +0 -128
- package/dist/kit/loot.d.ts.map +0 -1
- package/dist/kit/loot.js +0 -160
- package/dist/kit/matches.d.ts +0 -301
- package/dist/kit/matches.d.ts.map +0 -1
- package/dist/kit/matches.js +0 -458
- package/dist/kit/matchmaking.d.ts +0 -57
- package/dist/kit/matchmaking.d.ts.map +0 -1
- package/dist/kit/matchmaking.js +0 -59
- package/dist/kit/minigames.d.ts +0 -30
- package/dist/kit/minigames.d.ts.map +0 -1
- package/dist/kit/minigames.js +0 -38
- package/dist/kit/mobs.d.ts +0 -90
- package/dist/kit/mobs.d.ts.map +0 -1
- package/dist/kit/mobs.js +0 -98
- package/dist/kit/moderation.d.ts +0 -73
- package/dist/kit/moderation.d.ts.map +0 -1
- package/dist/kit/moderation.js +0 -103
- package/dist/kit/movement.d.ts +0 -78
- package/dist/kit/movement.d.ts.map +0 -1
- package/dist/kit/movement.js +0 -103
- package/dist/kit/notifications.d.ts +0 -45
- package/dist/kit/notifications.d.ts.map +0 -1
- package/dist/kit/notifications.js +0 -67
- package/dist/kit/npcs.d.ts +0 -226
- package/dist/kit/npcs.d.ts.map +0 -1
- package/dist/kit/npcs.js +0 -141
- package/dist/kit/objects.d.ts +0 -116
- package/dist/kit/objects.d.ts.map +0 -1
- package/dist/kit/objects.js +0 -119
- package/dist/kit/pets.d.ts +0 -85
- package/dist/kit/pets.d.ts.map +0 -1
- package/dist/kit/pets.js +0 -96
- package/dist/kit/plots.d.ts +0 -85
- package/dist/kit/plots.d.ts.map +0 -1
- package/dist/kit/plots.js +0 -113
- package/dist/kit/progression.d.ts +0 -181
- package/dist/kit/progression.d.ts.map +0 -1
- package/dist/kit/progression.js +0 -265
- package/dist/kit/quests.d.ts +0 -171
- package/dist/kit/quests.d.ts.map +0 -1
- package/dist/kit/quests.js +0 -237
- package/dist/kit/racing.d.ts +0 -85
- package/dist/kit/racing.d.ts.map +0 -1
- package/dist/kit/racing.js +0 -99
- package/dist/kit/shared.d.ts +0 -73
- package/dist/kit/shared.d.ts.map +0 -1
- package/dist/kit/shared.js +0 -101
- package/dist/kit/telemetry.d.ts +0 -66
- package/dist/kit/telemetry.d.ts.map +0 -1
- package/dist/kit/telemetry.js +0 -133
- package/dist/kit/territory.d.ts +0 -97
- package/dist/kit/territory.d.ts.map +0 -1
- package/dist/kit/territory.js +0 -114
- package/dist/kit/worldsim.d.ts +0 -263
- package/dist/kit/worldsim.d.ts.map +0 -1
- package/dist/kit/worldsim.js +0 -268
- package/dist/stores/model.d.ts +0 -81
- package/dist/stores/model.d.ts.map +0 -1
- package/dist/stores/model.js +0 -163
|
@@ -1,533 +0,0 @@
|
|
|
1
|
-
import { kitPolicyJson, ownerEquals, ownerEqualsCaller, ownerMirrorProperty, toSnakeCase, trustedAuthorityFields, } from './core.js';
|
|
2
|
-
/** Compute the type/function names an economy blueprint (and its runtime helper) uses. */
|
|
3
|
-
export function economyNames(typePrefix = '') {
|
|
4
|
-
const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
|
|
5
|
-
return {
|
|
6
|
-
walletType: `${typePrefix}Wallet`,
|
|
7
|
-
listingType: `${typePrefix}ShopListing`,
|
|
8
|
-
tradeType: `${typePrefix}TradeOffer`,
|
|
9
|
-
marketType: `${typePrefix}MarketListing`,
|
|
10
|
-
fnPrefix,
|
|
11
|
-
buyListingFn: `${fnPrefix}buy_listing`,
|
|
12
|
-
acceptTradeFn: `${fnPrefix}accept_trade`,
|
|
13
|
-
cancelTradeFn: `${fnPrefix}cancel_trade`,
|
|
14
|
-
buyMarketFn: `${fnPrefix}buy_market_listing`,
|
|
15
|
-
cancelMarketFn: `${fnPrefix}cancel_market_listing`,
|
|
16
|
-
restockFn: `${fnPrefix}restock_listing`,
|
|
17
|
-
restockAutomation: `${fnPrefix.replace(/_/g, '-')}shop-restock`,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/** The earn/spend function name for one currency. */
|
|
21
|
-
export function economyCurrencyFn(verb, currency, typePrefix = '') {
|
|
22
|
-
const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
|
|
23
|
-
return `${fnPrefix}${verb}_${toSnakeCase(currency)}`;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Blueprint for a server-authoritative **economy**: per-player `Wallet`
|
|
27
|
-
* containers (one int property per currency), an admin `ShopListing` catalog
|
|
28
|
-
* with an atomic `buy_listing` (wallet debit + stock decrement + item grant
|
|
29
|
-
* in ONE invoke), escrow `TradeOffer` swaps, and a player-to-player
|
|
30
|
-
* `MarketListing` flow (buyer wallet → seller wallet + stack transfer, all
|
|
31
|
-
* in one transaction).
|
|
32
|
-
*
|
|
33
|
-
* Anti-duplication is structural: every movement of currency or items is a
|
|
34
|
-
* single function invocation whose condition guards check balances, stock,
|
|
35
|
-
* item identity, and ownership mirrors server-side — never split a spend and
|
|
36
|
-
* a grant across two invokes. Trusted mints (`earn_<c>`) default to
|
|
37
|
-
* `invokeScope: "server"` (app admins only).
|
|
38
|
-
*
|
|
39
|
-
* Trade/market guards verify stack ownership through the kit-standard
|
|
40
|
-
* `owner_user_id` mirror property on the stack type (the inventory blueprint
|
|
41
|
-
* defines it; set it via `InventoryKit.createStack({ ownerUserId })`), and
|
|
42
|
-
* pin the offer creator via the injected `$self_owner_id` — the server-truth
|
|
43
|
-
* owner of the offer/listing container.
|
|
44
|
-
*
|
|
45
|
-
* Runtime counterpart: `client.kit(appId).economy`.
|
|
46
|
-
*/
|
|
47
|
-
export function economyBlueprint(options = {}) {
|
|
48
|
-
const { typePrefix = '', currencies = ['gold'], ownerIdKind = 'int', earnAuthority = 'server', } = options;
|
|
49
|
-
if (currencies.length === 0) {
|
|
50
|
-
throw new Error('economyBlueprint requires at least one currency');
|
|
51
|
-
}
|
|
52
|
-
const currency = options.shopCurrency ?? currencies[0];
|
|
53
|
-
if (!currencies.includes(currency)) {
|
|
54
|
-
throw new Error(`economyBlueprint shopCurrency '${currency}' must be one of the declared currencies`);
|
|
55
|
-
}
|
|
56
|
-
const names = economyNames(typePrefix);
|
|
57
|
-
const kind = ownerIdKind;
|
|
58
|
-
const propertyDefinitions = [
|
|
59
|
-
// Wallet: owner mirror + one balance property per currency.
|
|
60
|
-
ownerMirrorProperty(names.walletType, kind),
|
|
61
|
-
...currencies.map((c) => ({
|
|
62
|
-
containerTypeName: names.walletType,
|
|
63
|
-
key: c,
|
|
64
|
-
valueType: 'int',
|
|
65
|
-
defaultValueJson: '0',
|
|
66
|
-
description: `Balance of the '${c}' currency.`,
|
|
67
|
-
})),
|
|
68
|
-
// Shop listing catalog row.
|
|
69
|
-
{
|
|
70
|
-
containerTypeName: names.listingType,
|
|
71
|
-
key: 'item_id',
|
|
72
|
-
valueType: 'string',
|
|
73
|
-
description: 'The item this listing sells (matched against stack item_id).',
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
containerTypeName: names.listingType,
|
|
77
|
-
key: 'price',
|
|
78
|
-
valueType: 'int',
|
|
79
|
-
defaultValueJson: '0',
|
|
80
|
-
description: `Price per unit in '${currency}'.`,
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
containerTypeName: names.listingType,
|
|
84
|
-
key: 'stock',
|
|
85
|
-
valueType: 'int',
|
|
86
|
-
defaultValueJson: '0',
|
|
87
|
-
description: 'Units remaining; buying decrements atomically.',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
containerTypeName: names.listingType,
|
|
91
|
-
key: 'max_stock',
|
|
92
|
-
valueType: 'int',
|
|
93
|
-
defaultValueJson: '0',
|
|
94
|
-
description: 'Restock ceiling used by the shop-restock automation.',
|
|
95
|
-
},
|
|
96
|
-
// Escrow trade offer.
|
|
97
|
-
{
|
|
98
|
-
containerTypeName: names.tradeType,
|
|
99
|
-
key: 'to_user_id',
|
|
100
|
-
valueType: 'int',
|
|
101
|
-
defaultValueJson: '0',
|
|
102
|
-
description: 'The user invited to accept this trade.',
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
containerTypeName: names.tradeType,
|
|
106
|
-
key: 'give_stack_id',
|
|
107
|
-
valueType: 'string',
|
|
108
|
-
defaultValueJson: '""',
|
|
109
|
-
description: "Container id of the offerer's escrowed source stack.",
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
containerTypeName: names.tradeType,
|
|
113
|
-
key: 'receive_stack_id',
|
|
114
|
-
valueType: 'string',
|
|
115
|
-
defaultValueJson: '""',
|
|
116
|
-
description: "Container id of the offerer's stack that receives the wanted items.",
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
containerTypeName: names.tradeType,
|
|
120
|
-
key: 'give_item_id',
|
|
121
|
-
valueType: 'string',
|
|
122
|
-
defaultValueJson: '""',
|
|
123
|
-
description: 'Item the offerer gives.',
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
containerTypeName: names.tradeType,
|
|
127
|
-
key: 'give_qty',
|
|
128
|
-
valueType: 'int',
|
|
129
|
-
defaultValueJson: '0',
|
|
130
|
-
description: 'Quantity the offerer gives.',
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
containerTypeName: names.tradeType,
|
|
134
|
-
key: 'want_item_id',
|
|
135
|
-
valueType: 'string',
|
|
136
|
-
defaultValueJson: '""',
|
|
137
|
-
description: 'Item the offerer wants in return.',
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
containerTypeName: names.tradeType,
|
|
141
|
-
key: 'want_qty',
|
|
142
|
-
valueType: 'int',
|
|
143
|
-
defaultValueJson: '0',
|
|
144
|
-
description: 'Quantity the offerer wants in return.',
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
containerTypeName: names.tradeType,
|
|
148
|
-
key: 'status',
|
|
149
|
-
valueType: 'string',
|
|
150
|
-
defaultValueJson: '"open"',
|
|
151
|
-
description: "Trade lifecycle: 'open' | 'accepted' | 'cancelled'.",
|
|
152
|
-
},
|
|
153
|
-
// Market listing.
|
|
154
|
-
{
|
|
155
|
-
containerTypeName: names.marketType,
|
|
156
|
-
key: 'stack_id',
|
|
157
|
-
valueType: 'string',
|
|
158
|
-
defaultValueJson: '""',
|
|
159
|
-
description: "Container id of the seller's escrowed source stack.",
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
containerTypeName: names.marketType,
|
|
163
|
-
key: 'item_id',
|
|
164
|
-
valueType: 'string',
|
|
165
|
-
defaultValueJson: '""',
|
|
166
|
-
description: 'Item being sold.',
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
containerTypeName: names.marketType,
|
|
170
|
-
key: 'quantity',
|
|
171
|
-
valueType: 'int',
|
|
172
|
-
defaultValueJson: '0',
|
|
173
|
-
description: 'Units transferred to the buyer on purchase.',
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
containerTypeName: names.marketType,
|
|
177
|
-
key: 'price',
|
|
178
|
-
valueType: 'int',
|
|
179
|
-
defaultValueJson: '0',
|
|
180
|
-
description: `Ask price in '${currency}' paid straight into the seller's wallet.`,
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
containerTypeName: names.marketType,
|
|
184
|
-
key: 'active',
|
|
185
|
-
valueType: 'bool',
|
|
186
|
-
defaultValueJson: 'true',
|
|
187
|
-
description: 'False once bought or cancelled.',
|
|
188
|
-
},
|
|
189
|
-
];
|
|
190
|
-
const functions = [];
|
|
191
|
-
// earn/spend per currency.
|
|
192
|
-
for (const c of currencies) {
|
|
193
|
-
functions.push({
|
|
194
|
-
name: economyCurrencyFn('earn', c, typePrefix),
|
|
195
|
-
containerTypeName: names.walletType,
|
|
196
|
-
returnType: 'int',
|
|
197
|
-
parameters: [
|
|
198
|
-
{
|
|
199
|
-
name: 'amount',
|
|
200
|
-
valueType: 'int',
|
|
201
|
-
required: true,
|
|
202
|
-
description: 'Units to add (negative values are ignored).',
|
|
203
|
-
},
|
|
204
|
-
],
|
|
205
|
-
mutations: [
|
|
206
|
-
{ target: 'self', property: c, expression: `self.${c} + max(0, $amount)` },
|
|
207
|
-
],
|
|
208
|
-
returnExpression: `self.${c}`,
|
|
209
|
-
...trustedAuthorityFields(earnAuthority),
|
|
210
|
-
description: `Mint '${c}' into this wallet — a trusted grant (default: app admins via server scope).`,
|
|
211
|
-
});
|
|
212
|
-
functions.push({
|
|
213
|
-
name: economyCurrencyFn('spend', c, typePrefix),
|
|
214
|
-
containerTypeName: names.walletType,
|
|
215
|
-
returnType: 'int',
|
|
216
|
-
parameters: [
|
|
217
|
-
{
|
|
218
|
-
name: 'amount',
|
|
219
|
-
valueType: 'int',
|
|
220
|
-
required: true,
|
|
221
|
-
description: 'Units to deduct; must not exceed the balance.',
|
|
222
|
-
},
|
|
223
|
-
],
|
|
224
|
-
mutations: [
|
|
225
|
-
{ target: 'self', property: c, expression: `self.${c} - $amount` },
|
|
226
|
-
],
|
|
227
|
-
returnExpression: `self.${c}`,
|
|
228
|
-
invokePolicyJson: kitPolicyJson({
|
|
229
|
-
type: 'and',
|
|
230
|
-
rules: [
|
|
231
|
-
{ type: 'owner_of_self' },
|
|
232
|
-
{
|
|
233
|
-
type: 'condition',
|
|
234
|
-
expression: `$amount > 0 && self.${c} >= $amount`,
|
|
235
|
-
},
|
|
236
|
-
],
|
|
237
|
-
}),
|
|
238
|
-
description: `Spend '${c}' from the caller's own wallet; refuses to overdraw.`,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
// Shop: atomic wallet debit + stock decrement + item grant.
|
|
242
|
-
functions.push({
|
|
243
|
-
name: names.buyListingFn,
|
|
244
|
-
containerTypeName: names.listingType,
|
|
245
|
-
returnType: 'int',
|
|
246
|
-
parameters: [
|
|
247
|
-
{
|
|
248
|
-
name: 'wallet_id',
|
|
249
|
-
valueType: 'container_ref',
|
|
250
|
-
required: true,
|
|
251
|
-
description: "The buyer's wallet (must be owned by the caller).",
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
name: 'to_stack_id',
|
|
255
|
-
valueType: 'container_ref',
|
|
256
|
-
required: true,
|
|
257
|
-
description: 'A stack of the listed item that receives the unit.',
|
|
258
|
-
},
|
|
259
|
-
],
|
|
260
|
-
mutations: [
|
|
261
|
-
{
|
|
262
|
-
target: 'ref($wallet_id)',
|
|
263
|
-
property: currency,
|
|
264
|
-
expression: `ref($wallet_id).${currency} - self.price`,
|
|
265
|
-
},
|
|
266
|
-
{ target: 'self', property: 'stock', expression: 'self.stock - 1' },
|
|
267
|
-
{
|
|
268
|
-
target: 'ref($to_stack_id)',
|
|
269
|
-
property: 'quantity',
|
|
270
|
-
expression: 'ref($to_stack_id).quantity + 1',
|
|
271
|
-
},
|
|
272
|
-
],
|
|
273
|
-
returnExpression: `ref($wallet_id).${currency}`,
|
|
274
|
-
invokePolicyJson: kitPolicyJson({
|
|
275
|
-
type: 'condition',
|
|
276
|
-
expression: [
|
|
277
|
-
'self.stock > 0',
|
|
278
|
-
ownerEqualsCaller('ref($wallet_id).owner_user_id', kind),
|
|
279
|
-
`ref($wallet_id).${currency} >= self.price`,
|
|
280
|
-
'ref($to_stack_id).item_id == self.item_id',
|
|
281
|
-
].join(' && '),
|
|
282
|
-
}),
|
|
283
|
-
description: 'Buy one unit: wallet debit, stock decrement, and item grant in one transaction — money duplication is structurally impossible.',
|
|
284
|
-
});
|
|
285
|
-
// Escrow trade: atomic four-stack swap. $self_owner_id (injected,
|
|
286
|
-
// unspoofable) is the offer creator, so a forged offer cannot drain a
|
|
287
|
-
// third party's stacks.
|
|
288
|
-
functions.push({
|
|
289
|
-
name: names.acceptTradeFn,
|
|
290
|
-
containerTypeName: names.tradeType,
|
|
291
|
-
returnType: 'string',
|
|
292
|
-
parameters: [
|
|
293
|
-
{
|
|
294
|
-
name: 'give_stack_id',
|
|
295
|
-
valueType: 'container_ref',
|
|
296
|
-
required: true,
|
|
297
|
-
description: "The offerer's escrowed source stack (must match the recorded give_stack_id).",
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
name: 'to_give_stack_id',
|
|
301
|
-
valueType: 'container_ref',
|
|
302
|
-
required: true,
|
|
303
|
-
description: "The acceptor's stack that receives the given items.",
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
name: 'want_stack_id',
|
|
307
|
-
valueType: 'container_ref',
|
|
308
|
-
required: true,
|
|
309
|
-
description: "The acceptor's stack that pays the wanted items.",
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
name: 'to_want_stack_id',
|
|
313
|
-
valueType: 'container_ref',
|
|
314
|
-
required: true,
|
|
315
|
-
description: "The offerer's stack that receives the wanted items (must match the recorded receive_stack_id).",
|
|
316
|
-
},
|
|
317
|
-
],
|
|
318
|
-
mutations: [
|
|
319
|
-
{
|
|
320
|
-
target: 'ref($give_stack_id)',
|
|
321
|
-
property: 'quantity',
|
|
322
|
-
expression: 'ref($give_stack_id).quantity - self.give_qty',
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
target: 'ref($to_give_stack_id)',
|
|
326
|
-
property: 'quantity',
|
|
327
|
-
expression: 'ref($to_give_stack_id).quantity + self.give_qty',
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
target: 'ref($want_stack_id)',
|
|
331
|
-
property: 'quantity',
|
|
332
|
-
expression: 'ref($want_stack_id).quantity - self.want_qty',
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
target: 'ref($to_want_stack_id)',
|
|
336
|
-
property: 'quantity',
|
|
337
|
-
expression: 'ref($to_want_stack_id).quantity + self.want_qty',
|
|
338
|
-
},
|
|
339
|
-
{ target: 'self', property: 'status', expression: '"accepted"' },
|
|
340
|
-
],
|
|
341
|
-
returnExpression: 'self.status',
|
|
342
|
-
invokePolicyJson: kitPolicyJson({
|
|
343
|
-
type: 'condition',
|
|
344
|
-
expression: [
|
|
345
|
-
'self.status == "open"',
|
|
346
|
-
'self.to_user_id == $caller_user_id',
|
|
347
|
-
'$give_stack_id == self.give_stack_id',
|
|
348
|
-
'$to_want_stack_id == self.receive_stack_id',
|
|
349
|
-
ownerEquals('ref($give_stack_id).owner_user_id', '$self_owner_id', kind),
|
|
350
|
-
'ref($give_stack_id).item_id == self.give_item_id',
|
|
351
|
-
'ref($give_stack_id).quantity >= self.give_qty',
|
|
352
|
-
ownerEqualsCaller('ref($to_give_stack_id).owner_user_id', kind),
|
|
353
|
-
'ref($to_give_stack_id).item_id == self.give_item_id',
|
|
354
|
-
ownerEqualsCaller('ref($want_stack_id).owner_user_id', kind),
|
|
355
|
-
'ref($want_stack_id).item_id == self.want_item_id',
|
|
356
|
-
'ref($want_stack_id).quantity >= self.want_qty',
|
|
357
|
-
ownerEquals('ref($to_want_stack_id).owner_user_id', '$self_owner_id', kind),
|
|
358
|
-
'ref($to_want_stack_id).item_id == self.want_item_id',
|
|
359
|
-
].join(' && '),
|
|
360
|
-
}),
|
|
361
|
-
description: 'Accept an escrow trade: both stack pairs swap atomically after ownership/item/quantity guards; any failure rolls the whole swap back.',
|
|
362
|
-
});
|
|
363
|
-
functions.push({
|
|
364
|
-
name: names.cancelTradeFn,
|
|
365
|
-
containerTypeName: names.tradeType,
|
|
366
|
-
returnType: 'string',
|
|
367
|
-
mutations: [{ target: 'self', property: 'status', expression: '"cancelled"' }],
|
|
368
|
-
returnExpression: 'self.status',
|
|
369
|
-
invokePolicyJson: kitPolicyJson({
|
|
370
|
-
type: 'condition',
|
|
371
|
-
expression: 'self.status == "open" && ($self_owner_id == $caller_user_id || self.to_user_id == $caller_user_id)',
|
|
372
|
-
}),
|
|
373
|
-
description: 'Cancel an open trade (either party may).',
|
|
374
|
-
});
|
|
375
|
-
// Market: wallet→wallet payment + stack transfer, one invoke, 5 mutations.
|
|
376
|
-
functions.push({
|
|
377
|
-
name: names.buyMarketFn,
|
|
378
|
-
containerTypeName: names.marketType,
|
|
379
|
-
returnType: 'int',
|
|
380
|
-
parameters: [
|
|
381
|
-
{
|
|
382
|
-
name: 'wallet_id',
|
|
383
|
-
valueType: 'container_ref',
|
|
384
|
-
required: true,
|
|
385
|
-
description: "The buyer's wallet (must be owned by the caller).",
|
|
386
|
-
},
|
|
387
|
-
{
|
|
388
|
-
name: 'seller_wallet_id',
|
|
389
|
-
valueType: 'container_ref',
|
|
390
|
-
required: true,
|
|
391
|
-
description: "The seller's wallet that receives the payment.",
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
name: 'from_stack_id',
|
|
395
|
-
valueType: 'container_ref',
|
|
396
|
-
required: true,
|
|
397
|
-
description: "The seller's escrowed source stack (must match the recorded stack_id).",
|
|
398
|
-
},
|
|
399
|
-
{
|
|
400
|
-
name: 'to_stack_id',
|
|
401
|
-
valueType: 'container_ref',
|
|
402
|
-
required: true,
|
|
403
|
-
description: "The buyer's stack that receives the items.",
|
|
404
|
-
},
|
|
405
|
-
],
|
|
406
|
-
mutations: [
|
|
407
|
-
{
|
|
408
|
-
target: 'ref($wallet_id)',
|
|
409
|
-
property: currency,
|
|
410
|
-
expression: `ref($wallet_id).${currency} - self.price`,
|
|
411
|
-
},
|
|
412
|
-
{
|
|
413
|
-
target: 'ref($seller_wallet_id)',
|
|
414
|
-
property: currency,
|
|
415
|
-
expression: `ref($seller_wallet_id).${currency} + self.price`,
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
target: 'ref($from_stack_id)',
|
|
419
|
-
property: 'quantity',
|
|
420
|
-
expression: 'ref($from_stack_id).quantity - self.quantity',
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
target: 'ref($to_stack_id)',
|
|
424
|
-
property: 'quantity',
|
|
425
|
-
expression: 'ref($to_stack_id).quantity + self.quantity',
|
|
426
|
-
},
|
|
427
|
-
{ target: 'self', property: 'active', expression: 'false' },
|
|
428
|
-
],
|
|
429
|
-
returnExpression: `ref($wallet_id).${currency}`,
|
|
430
|
-
invokePolicyJson: kitPolicyJson({
|
|
431
|
-
type: 'condition',
|
|
432
|
-
expression: [
|
|
433
|
-
'self.active',
|
|
434
|
-
ownerEqualsCaller('ref($wallet_id).owner_user_id', kind),
|
|
435
|
-
`ref($wallet_id).${currency} >= self.price`,
|
|
436
|
-
ownerEquals('ref($seller_wallet_id).owner_user_id', '$self_owner_id', kind),
|
|
437
|
-
'$from_stack_id == self.stack_id',
|
|
438
|
-
ownerEquals('ref($from_stack_id).owner_user_id', '$self_owner_id', kind),
|
|
439
|
-
'ref($from_stack_id).item_id == self.item_id',
|
|
440
|
-
'ref($from_stack_id).quantity >= self.quantity',
|
|
441
|
-
ownerEqualsCaller('ref($to_stack_id).owner_user_id', kind),
|
|
442
|
-
'ref($to_stack_id).item_id == self.item_id',
|
|
443
|
-
].join(' && '),
|
|
444
|
-
}),
|
|
445
|
-
description: "Buy a market listing: buyer wallet → seller wallet payment plus the stack transfer, all atomic; the listing deactivates in the same transaction.",
|
|
446
|
-
});
|
|
447
|
-
functions.push({
|
|
448
|
-
name: names.cancelMarketFn,
|
|
449
|
-
containerTypeName: names.marketType,
|
|
450
|
-
returnType: 'bool',
|
|
451
|
-
mutations: [{ target: 'self', property: 'active', expression: 'false' }],
|
|
452
|
-
returnExpression: 'self.active',
|
|
453
|
-
invokePolicyJson: kitPolicyJson({
|
|
454
|
-
type: 'condition',
|
|
455
|
-
expression: 'self.active && $self_owner_id == $caller_user_id',
|
|
456
|
-
}),
|
|
457
|
-
description: 'Take a market listing down (seller only).',
|
|
458
|
-
});
|
|
459
|
-
const automations = [];
|
|
460
|
-
if (options.restock) {
|
|
461
|
-
functions.push({
|
|
462
|
-
name: names.restockFn,
|
|
463
|
-
containerTypeName: names.listingType,
|
|
464
|
-
returnType: 'int',
|
|
465
|
-
parameters: [
|
|
466
|
-
{
|
|
467
|
-
name: 'amount',
|
|
468
|
-
valueType: 'int',
|
|
469
|
-
required: true,
|
|
470
|
-
description: 'Units to add per tick (clamped to max_stock).',
|
|
471
|
-
},
|
|
472
|
-
],
|
|
473
|
-
mutations: [
|
|
474
|
-
{
|
|
475
|
-
target: 'self',
|
|
476
|
-
property: 'stock',
|
|
477
|
-
expression: 'min(self.max_stock, self.stock + max(0, $amount))',
|
|
478
|
-
},
|
|
479
|
-
],
|
|
480
|
-
returnExpression: 'self.stock',
|
|
481
|
-
invokePolicyJson: kitPolicyJson({ type: 'is_automation' }),
|
|
482
|
-
autonomousInvocable: true,
|
|
483
|
-
description: 'Server-driven shop restock tick (automation-only).',
|
|
484
|
-
});
|
|
485
|
-
automations.push({
|
|
486
|
-
name: names.restockAutomation,
|
|
487
|
-
functionName: names.restockFn,
|
|
488
|
-
targetMode: 'type',
|
|
489
|
-
targetTypeName: names.listingType,
|
|
490
|
-
triggerType: 'schedule',
|
|
491
|
-
scheduleKind: 'interval',
|
|
492
|
-
intervalMs: options.restock.intervalMs,
|
|
493
|
-
maxTargets: 32,
|
|
494
|
-
selectorJson: JSON.stringify({
|
|
495
|
-
selfWhere: [{ key: 'stock', op: '<', value: 'self.max_stock' }],
|
|
496
|
-
}),
|
|
497
|
-
paramsJson: JSON.stringify({ amount: options.restock.amount ?? 1 }),
|
|
498
|
-
description: 'Periodically restocks shop listings below their max_stock.',
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
return {
|
|
502
|
-
name: names.walletType,
|
|
503
|
-
containerTypes: [
|
|
504
|
-
{
|
|
505
|
-
typeName: names.walletType,
|
|
506
|
-
displayName: names.walletType,
|
|
507
|
-
instantiableBy: 'member',
|
|
508
|
-
description: 'A per-player wallet holding currency balances.',
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
typeName: names.listingType,
|
|
512
|
-
displayName: names.listingType,
|
|
513
|
-
instantiableBy: 'admin',
|
|
514
|
-
description: 'A studio-priced shop listing (catalog row) players buy from.',
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
typeName: names.tradeType,
|
|
518
|
-
displayName: names.tradeType,
|
|
519
|
-
instantiableBy: 'member',
|
|
520
|
-
description: 'A player-to-player escrow trade offer, swapped atomically on accept.',
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
typeName: names.marketType,
|
|
524
|
-
displayName: names.marketType,
|
|
525
|
-
instantiableBy: 'member',
|
|
526
|
-
description: 'A player market listing paid straight into the seller wallet.',
|
|
527
|
-
},
|
|
528
|
-
],
|
|
529
|
-
propertyDefinitions,
|
|
530
|
-
functions,
|
|
531
|
-
...(automations.length ? { automations } : {}),
|
|
532
|
-
};
|
|
533
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { type KitBlueprint } from './core.js';
|
|
2
|
-
/** Options for {@link guildBlueprint}. */
|
|
3
|
-
export interface GuildBlueprintOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Prefix for the composed type names (`'Guild'` → `GuildHall` /
|
|
6
|
-
* `GuildBankInventory`). Defaults to `'Guild'`.
|
|
7
|
-
*/
|
|
8
|
-
typePrefix?: string;
|
|
9
|
-
/**
|
|
10
|
-
* The guild team's group id — the hall's `group_permission` policy checks
|
|
11
|
-
* membership of THIS group. Create the team first
|
|
12
|
-
* (`kit.social.guild.create`), then deploy the blueprint. Deploy one
|
|
13
|
-
* prefixed blueprint per guild that needs its own hall.
|
|
14
|
-
*/
|
|
15
|
-
guildGroupId: string;
|
|
16
|
-
/**
|
|
17
|
-
* Optional group permission key the hall requires (e.g. a custom
|
|
18
|
-
* `use_hall` role permission). Omit to admit every guild member.
|
|
19
|
-
*/
|
|
20
|
-
hallPermission?: string;
|
|
21
|
-
/** Also compose a guild-bank inventory (`<prefix>Bank*`). Defaults to true. */
|
|
22
|
-
bank?: boolean;
|
|
23
|
-
}
|
|
24
|
-
/** Names derived by {@link guildBlueprint} for a given prefix. */
|
|
25
|
-
export interface GuildNames {
|
|
26
|
-
hallType: string;
|
|
27
|
-
openHallFn: string;
|
|
28
|
-
closeHallFn: string;
|
|
29
|
-
bankTypePrefix: string;
|
|
30
|
-
bankInventoryType: string;
|
|
31
|
-
bankStackType: string;
|
|
32
|
-
}
|
|
33
|
-
/** Compute the type/function names a guild blueprint (and kit.social.guild) uses. */
|
|
34
|
-
export declare function guildNames(typePrefix?: string): GuildNames;
|
|
35
|
-
/**
|
|
36
|
-
* Composite blueprint for a **guild's shared assets** — a demonstration of
|
|
37
|
-
* blueprint composition: a `GuildHall` lockable whose open/close is gated on
|
|
38
|
-
* membership of the guild team (`group_permission`), plus a prefixed
|
|
39
|
-
* guild-bank inventory (`GuildBankInventory` / `GuildBankItemStack`) for
|
|
40
|
-
* shared storage. The guild itself is a **team** (`kit.social.guild`), its
|
|
41
|
-
* chat a **channel**, and its territory a grid group-grant
|
|
42
|
-
* (`kit.social.guild.claimTerritory`) — no new model surface needed for
|
|
43
|
-
* those.
|
|
44
|
-
*
|
|
45
|
-
* Runtime counterparts: `client.kit(appId).social.guild` (team/chat/territory),
|
|
46
|
-
* `kit.objectsFor(guildNames().hallType)` (the hall), and
|
|
47
|
-
* `client.kit(appId, { inventory: { typePrefix: guildNames().bankTypePrefix } })
|
|
48
|
-
* .inventory` (the bank).
|
|
49
|
-
*/
|
|
50
|
-
export declare function guildBlueprint(options: GuildBlueprintOptions): KitBlueprint;
|
|
51
|
-
//# sourceMappingURL=guild.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"guild.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/guild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAIjE,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,kEAAkE;AAClE,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,UAAU,SAAU,GAAG,UAAU,CAW3D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,YAAY,CAoB3E"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { composeBlueprints } from './core.js';
|
|
2
|
-
import { inventoryBlueprint, inventoryNames } from './inventory.js';
|
|
3
|
-
import { lockBlueprint, lockNames } from './locks.js';
|
|
4
|
-
/** Compute the type/function names a guild blueprint (and kit.social.guild) uses. */
|
|
5
|
-
export function guildNames(typePrefix = 'Guild') {
|
|
6
|
-
const locks = lockNames(`${typePrefix}Hall`);
|
|
7
|
-
const bank = inventoryNames(`${typePrefix}Bank`);
|
|
8
|
-
return {
|
|
9
|
-
hallType: locks.objectType,
|
|
10
|
-
openHallFn: locks.openFn,
|
|
11
|
-
closeHallFn: locks.closeFn,
|
|
12
|
-
bankTypePrefix: `${typePrefix}Bank`,
|
|
13
|
-
bankInventoryType: bank.inventoryType,
|
|
14
|
-
bankStackType: bank.stackType,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Composite blueprint for a **guild's shared assets** — a demonstration of
|
|
19
|
-
* blueprint composition: a `GuildHall` lockable whose open/close is gated on
|
|
20
|
-
* membership of the guild team (`group_permission`), plus a prefixed
|
|
21
|
-
* guild-bank inventory (`GuildBankInventory` / `GuildBankItemStack`) for
|
|
22
|
-
* shared storage. The guild itself is a **team** (`kit.social.guild`), its
|
|
23
|
-
* chat a **channel**, and its territory a grid group-grant
|
|
24
|
-
* (`kit.social.guild.claimTerritory`) — no new model surface needed for
|
|
25
|
-
* those.
|
|
26
|
-
*
|
|
27
|
-
* Runtime counterparts: `client.kit(appId).social.guild` (team/chat/territory),
|
|
28
|
-
* `kit.objectsFor(guildNames().hallType)` (the hall), and
|
|
29
|
-
* `client.kit(appId, { inventory: { typePrefix: guildNames().bankTypePrefix } })
|
|
30
|
-
* .inventory` (the bank).
|
|
31
|
-
*/
|
|
32
|
-
export function guildBlueprint(options) {
|
|
33
|
-
const { typePrefix = 'Guild', guildGroupId, hallPermission, bank = true } = options;
|
|
34
|
-
if (!guildGroupId) {
|
|
35
|
-
throw new Error('guildBlueprint requires guildGroupId — create the guild team first, then deploy');
|
|
36
|
-
}
|
|
37
|
-
const hall = lockBlueprint({
|
|
38
|
-
objectTypeName: `${typePrefix}Hall`,
|
|
39
|
-
authority: {
|
|
40
|
-
kind: 'groupPermission',
|
|
41
|
-
groupId: guildGroupId,
|
|
42
|
-
...(hallPermission !== undefined ? { permission: hallPermission } : {}),
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
const blueprints = [hall];
|
|
46
|
-
if (bank) {
|
|
47
|
-
blueprints.push(inventoryBlueprint({ typePrefix: `${typePrefix}Bank` }));
|
|
48
|
-
}
|
|
49
|
-
return composeBlueprints(typePrefix.toLowerCase(), blueprints);
|
|
50
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Blueprint builders for the Game Kit, one module per game concept, re-exported
|
|
3
|
-
* here as a stable barrel (import paths from `kit/index.js` and the package
|
|
4
|
-
* root are unchanged as builders are added).
|
|
5
|
-
*/
|
|
6
|
-
export { andPolicies, composeBlueprints, featureGate, kitPolicyJson, mergeBlueprints, ownerEquals, ownerEqualsCaller, ownerMirrorProperty, toSnakeCase, trustedAuthorityFields, type KitAutomationSpec, type KitAutomationTriggerSpec, type KitBlueprint, type KitInvokePolicy, type KitOwnerIdKind, type KitSelectorSpec, type KitTrustedAuthority, type MergedBlueprints, type SelectorPermissionPredicate, } from './core.js';
|
|
7
|
-
export { combatBlueprint, combatNames, type CombatBlueprintOptions, type CombatNames, } from './combat.js';
|
|
8
|
-
export { decksBlueprint, decksNames, type DecksBlueprintOptions, type DecksNames, } from './decks.js';
|
|
9
|
-
export { economyBlueprint, economyCurrencyFn, economyNames, type EconomyBlueprintOptions, type EconomyNames, } from './economy.js';
|
|
10
|
-
export { guildBlueprint, guildNames, type GuildBlueprintOptions, type GuildNames, } from './guild.js';
|
|
11
|
-
export { inventoryBlueprint, inventoryBarterFunctionName, inventoryCraftFunctionName, inventoryNames, type InventoryBarterSpec, type InventoryBlueprintOptions, type InventoryNames, type InventoryRecipeSpec, } from './inventory.js';
|
|
12
|
-
export { leaderboardsBlueprint, leaderboardsNames, type LeaderboardsBlueprintOptions, type LeaderboardsNames, } from './leaderboards.js';
|
|
13
|
-
export { lootBlueprint, lootNames, lootRollFn, type LootBlueprintOptions, type LootDropSpec, type LootEntrySpec, type LootNames, type LootTableSpec, } from './loot.js';
|
|
14
|
-
export { lockBlueprint, lockNames, type LockAuthority, type LockBlueprintOptions, type LockNames, } from './locks.js';
|
|
15
|
-
export { questsBlueprint, questsNames, type QuestAdvanceSpec, type QuestsBlueprintOptions, type QuestsNames, } from './quests.js';
|
|
16
|
-
export { progressionBlueprint, progressionNames, type ProgressionBlueprintOptions, type ProgressionNames, } from './progression.js';
|
|
17
|
-
export { plotBlueprint, plotNames, type PlotBlueprintOptions, type PlotNames, } from './plots.js';
|
|
18
|
-
export { matchesBlueprint, matchesNames, type MatchesBlueprintOptions, type MatchesNames, } from './matches.js';
|
|
19
|
-
export { npcBehaviorFunctionName, npcBlueprint, type NpcBehaviorSpec, type NpcBehaviorTrigger, type NpcBlueprintOptions, } from './npcs.js';
|
|
20
|
-
export { worldsimBlueprint, worldsimNames, type WorldsimBlueprintOptions, type WorldsimNames, } from './worldsim.js';
|
|
21
|
-
export { liveopsBlueprint, liveopsNames, type LiveopsBlueprintOptions, type LiveopsNames, } from './liveops.js';
|
|
22
|
-
export { moderationBlueprint, moderationNames, type ModerationBlueprintOptions, type ModerationNames, } from './moderation.js';
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,aAAa,EACb,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,2BAA2B,GACjC,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,eAAe,EACf,WAAW,EACX,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,UAAU,EACV,KAAK,qBAAqB,EAC1B,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,cAAc,EACd,UAAU,EACV,KAAK,qBAAqB,EAC1B,KAAK,UAAU,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,aAAa,EACb,SAAS,EACT,UAAU,EACV,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,aAAa,EACb,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,SAAS,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,SAAS,EACT,KAAK,oBAAoB,EACzB,KAAK,SAAS,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,KAAK,wBAAwB,EAC7B,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,YAAY,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,KAAK,0BAA0B,EAC/B,KAAK,eAAe,GACrB,MAAM,iBAAiB,CAAC"}
|