@underpostnet/cyberia 3.3.73 → 3.3.77
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/.env.example +17 -5
- package/.github/workflows/coverall.cyberia.ci.yml +10 -0
- package/.github/workflows/docker-image.cyberia-client.ci.yml +1 -1
- package/.github/workflows/docker-image.cyberia-client.dev.ci.yml +1 -1
- package/.github/workflows/docker-image.cyberia-server.ci.yml +1 -1
- package/.github/workflows/docker-image.cyberia-server.dev.ci.yml +1 -1
- package/.github/workflows/docker-image.engine-cyberia.ci.yml +1 -1
- package/.github/workflows/docker-image.engine-cyberia.dev.ci.yml +1 -1
- package/.github/workflows/engine-cyberia.ci.yml +1 -1
- package/.github/workflows/publish.cyberia.ci.yml +44 -0
- package/AGENTS.md +61 -12
- package/CHANGELOG.md +159 -161
- package/CLI-HELP.md +20 -13
- package/Dockerfile +1 -1
- package/Dockerfile.dev +1 -1
- package/Dockerfile.test +2 -2
- package/README.md +28 -28
- package/bin/build.js +96 -21
- package/bin/cyberia.js +1247 -1373
- package/bin/index.js +1247 -1373
- package/compose.env +17 -5
- package/conf.js +7 -4
- package/deploy/cyberia-client/deploy.sh +10 -11
- package/deploy/cyberia-client/package.sh +0 -1
- package/deploy/cyberia-client/state.sh +3 -2
- package/deploy/cyberia-server/deploy.sh +10 -11
- package/deploy/cyberia-server/package.sh +0 -1
- package/deploy/cyberia-server/state.sh +3 -2
- package/deploy/dd-cyberia/deploy.sh +5 -5
- package/deploy/dd-cyberia/init.sh +15 -14
- package/deploy/dd-cyberia/package.sh +0 -1
- package/deploy/dd-cyberia/state.sh +2 -2
- package/deploy/dd-cyberia/sync-deploy.sh +139 -75
- package/deploy/lib/config.sh +29 -0
- package/deploy/lib/github-actions-logging.sh +92 -76
- package/deploy/lib/host.sh +28 -19
- package/deploy/lib/state.sh +4 -1
- package/deploy/pwa-microservices-template/deploy.sh +10 -8
- package/deploy/release/deploy.sh +0 -2
- package/deployment.yaml +1 -1
- package/docker-compose.yml +23 -17
- package/docs/coverage/cyberia/api/cyberia-instance/cyberia-fallback-capture.js.html +1591 -0
- package/docs/coverage/cyberia/api/cyberia-instance/index.html +116 -0
- package/docs/coverage/cyberia/api/cyberia-server-defaults/cyberia-server-defaults.js.html +4138 -0
- package/docs/coverage/cyberia/api/cyberia-server-defaults/index.html +116 -0
- package/docs/coverage/cyberia/api/object-layer/index.html +116 -0
- package/docs/coverage/cyberia/api/object-layer/object-layer.model.js.html +1393 -0
- package/docs/coverage/cyberia/base.css +362 -0
- package/docs/coverage/cyberia/block-navigation.js +82 -0
- package/docs/coverage/cyberia/favicon.png +0 -0
- package/docs/coverage/cyberia/index.html +161 -0
- package/docs/coverage/cyberia/prettify.css +101 -0
- package/docs/coverage/cyberia/prettify.js +937 -0
- package/docs/coverage/cyberia/projects/cyberia/atlas-sprite-sheet-generator.js.html +1315 -0
- package/docs/coverage/cyberia/projects/cyberia/index.html +176 -0
- package/docs/coverage/cyberia/projects/cyberia/instance-backup.js.html +715 -0
- package/docs/coverage/cyberia/projects/cyberia/instance-data.js.html +2182 -0
- package/docs/coverage/cyberia/projects/cyberia/shape-generator.js.html +3265 -0
- package/docs/coverage/cyberia/projects/cyberia/stat-balance.js.html +328 -0
- package/docs/coverage/cyberia/sort-arrow-sprite.png +0 -0
- package/docs/coverage/cyberia/sorter.js +205 -0
- package/hardhat/package-lock.json +2 -2
- package/hardhat/package.json +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-vultr.yaml +1 -1
- package/manifests/deployment/dd-cyberia-development/deployment.yaml +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/mongo-express/deployment.yaml +46 -27
- package/manifests/deployment/mongo-express/kustomization.yaml +9 -0
- package/manifests/deployment/mongo-express/mongo-express-nodeport.yaml +18 -0
- package/manifests/deployment/mongo-express/service.yaml +16 -0
- package/manifests/deployment/mongo-express-no-auth/disable-mongodb-auth.yaml +16 -0
- package/manifests/deployment/mongo-express-no-auth/kustomization.yaml +16 -0
- package/package.json +19 -17
- package/scripts/test-monitor.sh +3 -3
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +14 -9
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.model.js +36 -5
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.router.js +5 -0
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +88 -184
- package/src/api/cyberia-action/cyberia-action.router.js +2 -2
- package/src/api/cyberia-action/cyberia-action.service.js +3 -4
- package/src/api/cyberia-audio/cyberia-audio.controller.js +6 -0
- package/src/api/cyberia-audio/cyberia-audio.model.js +61 -0
- package/src/api/cyberia-audio/cyberia-audio.router.js +21 -0
- package/src/api/cyberia-audio/cyberia-audio.service.js +220 -0
- package/src/api/cyberia-client-hints/cyberia-client-hints.controller.js +1 -3
- package/src/api/cyberia-client-hints/cyberia-client-hints.model.js +10 -19
- package/src/api/cyberia-client-hints/cyberia-client-hints.router.js +12 -34
- package/src/api/cyberia-client-hints/cyberia-client-hints.service.js +15 -32
- package/src/api/cyberia-dialogue/cyberia-dialogue.model.js +1 -1
- package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +1 -1
- package/src/api/cyberia-entity/cyberia-entity.model.js +2 -0
- package/src/api/cyberia-entity/cyberia-entity.service.js +1 -1
- package/src/api/cyberia-entity-type-default/cyberia-entity-type-default.controller.js +8 -2
- package/src/api/cyberia-entity-type-default/cyberia-entity-type-default.model.js +31 -20
- package/src/api/cyberia-entity-type-default/cyberia-entity-type-default.router.js +16 -1
- package/src/api/cyberia-entity-type-default/cyberia-entity-type-default.service.js +466 -3
- package/src/api/cyberia-instance/cyberia-fallback-capture.js +87 -51
- package/src/api/cyberia-instance/cyberia-fallback-world.js +21 -40
- package/src/api/cyberia-instance/cyberia-instance-boot.service.js +5 -5
- package/src/api/cyberia-instance/cyberia-instance-items.js +98 -0
- package/src/api/cyberia-instance/cyberia-instance-map.service.js +34 -141
- package/src/api/cyberia-instance/cyberia-instance.controller.js +1 -4
- package/src/api/cyberia-instance/cyberia-instance.model.js +0 -14
- package/src/api/cyberia-instance/cyberia-instance.router.js +3 -16
- package/src/api/cyberia-instance/cyberia-instance.service.js +3 -43
- package/src/api/cyberia-instance/cyberia-world-generator.js +8 -13
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +49 -75
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +74 -1
- package/src/api/cyberia-map/cyberia-map.service.js +6 -2
- package/src/api/cyberia-map-audio-conf/cyberia-map-audio-conf.controller.js +31 -0
- package/src/api/cyberia-map-audio-conf/cyberia-map-audio-conf.model.js +56 -0
- package/src/api/cyberia-map-audio-conf/cyberia-map-audio-conf.router.js +33 -0
- package/src/api/cyberia-map-audio-conf/cyberia-map-audio-conf.service.js +189 -0
- package/src/api/cyberia-quest/cyberia-quest.router.js +3 -3
- package/src/api/cyberia-quest/cyberia-quest.service.js +3 -3
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.model.js +1 -1
- package/src/api/cyberia-server-defaults/cyberia-server-defaults.js +403 -188
- package/src/api/cyberia-skill/cyberia-skill.model.js +6 -6
- package/src/api/file/file.ref.js +153 -0
- package/src/api/file/file.ref.json +11 -2
- package/src/api/object-layer/object-layer.model.js +47 -12
- package/src/api/object-layer/object-layer.router.js +10 -3
- package/src/api/object-layer/object-layer.service.js +113 -120
- package/src/cli/app.js +12 -1
- package/src/cli/client.js +2 -2
- package/src/cli/cluster.js +80 -18
- package/src/cli/deploy.js +215 -34
- package/src/cli/docker-compose.js +1 -1
- package/src/cli/fs-selection.js +115 -0
- package/src/cli/fs.js +158 -342
- package/src/cli/index.js +22 -10
- package/src/cli/release.js +3 -1
- package/src/cli/repository.js +35 -9
- package/src/cli/run.js +80 -199
- package/src/cli/test.js +4 -0
- package/src/cli/wireguard.js +32 -31
- package/src/client/components/core/Badge.js +0 -1
- package/src/client/components/core/CssCore.js +8 -1
- package/src/client/components/core/Docs.js +77 -100
- package/src/client/components/core/Modal.js +77 -23
- package/src/client/components/core/ToolTip.js +15 -0
- package/src/client/components/cryptokoyn/AppShellCryptokoyn.js +0 -2
- package/src/client/components/cyberia/ActionEngineCyberia.js +12 -36
- package/src/client/components/cyberia/EntityEngineCyberia.js +492 -121
- package/src/client/components/cyberia/InstanceEngineCyberia.js +129 -160
- package/src/client/components/cyberia/InstanceSelectionView.js +7 -1
- package/src/client/components/cyberia/MapEngineCyberia.js +175 -69
- package/src/client/components/cyberia/ObjectLayerEngine.js +1011 -97
- package/src/client/components/cyberia/ObjectLayerEngineModal.js +81 -155
- package/src/client/components/cyberia/ObjectLayerEngineViewer.js +113 -98
- package/src/client/components/cyberia/SharedDefaultsCyberia.js +215 -56
- package/src/client/components/cyberia-portal/AppShellCyberiaPortal.js +0 -34
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +1 -1
- package/src/client/components/cyberia-portal/MainBodyCyberiaPortal.js +712 -76
- package/src/client/components/cyberia-portal/RouterCyberiaPortal.js +0 -4
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +0 -4
- package/src/client/components/default/AppShellDefault.js +1 -4
- package/src/client/components/itemledger/AppShellItemledger.js +0 -2
- package/src/client/components/underpost/AppShellUnderpost.js +1 -1
- package/src/client/public/cyberia-docs/ARCHITECTURE.md +15 -15
- package/src/client/public/cyberia-docs/CYBERIA-CLI.md +280 -24
- package/src/client/public/cyberia-docs/CYBERIA-CLIENT.md +51 -29
- package/src/client/public/cyberia-docs/CYBERIA-SAGA.md +52 -53
- package/src/client/public/cyberia-docs/CYBERIA-SERVER.md +16 -11
- package/src/client/public/cyberia-docs/CYBERIA.md +28 -28
- package/src/client/public/cyberia-docs/ENTITY-PROFILE.md +11 -5
- package/src/client/public/cyberia-docs/ROADMAP.md +1 -1
- package/src/client/public/cyberia-docs/STATS-PROGRESSION.md +217 -0
- package/src/client/public/cyberia-docs/WHITE-PAPER.md +20 -12
- package/src/client/services/cyberia-audio/cyberia-audio.service.js +99 -0
- package/src/client/services/cyberia-entity-type-default/cyberia-entity-type-default.service.js +38 -0
- package/src/client/services/cyberia-instance/cyberia-instance.management.js +5 -4
- package/src/client/services/cyberia-instance/cyberia-instance.service.js +0 -40
- package/src/client/services/cyberia-map/cyberia-map.management.js +5 -4
- package/src/client/services/cyberia-map-audio-conf/cyberia-map-audio-conf.service.js +138 -0
- package/src/client/services/object-layer/object-layer.management.js +6 -10
- package/src/client/services/object-layer/object-layer.service.js +3 -1
- package/src/client/ssr/views/Cyberia404.js +3 -3
- package/src/client-builder/client-build-docs.js +52 -52
- package/src/client-builder/client-build.js +67 -44
- package/src/client-builder/client-bundle.js +347 -0
- package/src/db/mongo/MongoExpress.js +187 -0
- package/src/grpc/cyberia/grpc-server.js +5 -7
- package/src/index.js +1 -1
- package/src/projects/cyberia/atlas-sprite-sheet-generator.js +143 -146
- package/src/projects/cyberia/atlas-sprite-sheet-store.js +391 -0
- package/src/projects/cyberia/besu-genesis-generator.js +5 -14
- package/src/projects/cyberia/boot-contract-fixtures.js +32 -0
- package/src/projects/cyberia/catalog-cyberia.js +3 -2
- package/src/projects/cyberia/gemini-client.js +3 -3
- package/src/projects/cyberia/generate-saga.js +4 -11
- package/src/projects/cyberia/hot-reload-trigger.js +17 -28
- package/src/projects/cyberia/instance-backup.js +210 -0
- package/src/projects/cyberia/instance-data.js +177 -257
- package/src/projects/cyberia/map-preview-generator.js +32 -68
- package/src/projects/cyberia/object-layer.js +152 -319
- package/src/projects/cyberia/seed-audio.js +139 -0
- package/src/projects/cyberia/semantic-layer-generator-skin.js +2 -8
- package/src/projects/cyberia/semantic-layer-generator.js +2 -18
- package/src/projects/cyberia/stat-balance.js +81 -0
- package/src/projects/cyberia/stat-commands.js +23 -0
- package/src/projects/cyberia/stat-contract-generator.js +101 -0
- package/src/runtime/cyberia-client/Dockerfile +8 -4
- package/src/runtime/cyberia-client/Dockerfile.dev +5 -2
- package/src/runtime/cyberia-server/Dockerfile +9 -2
- package/src/runtime/cyberia-server/Dockerfile.dev +8 -1
- package/src/runtime/engine-cyberia/Dockerfile +1 -1
- package/src/runtime/engine-cyberia/Dockerfile.dev +1 -1
- package/src/runtime/engine-cyberia/Dockerfile.test +2 -2
- package/src/runtime/engine-cyberia/compose.env +17 -5
- package/src/runtime/engine-cyberia/docker-compose.yml +23 -17
- package/src/server/build/coverage.js +113 -42
- package/src/server/build/package.js +55 -12
- package/src/server/build/testing.js +59 -9
- package/src/server/network/middlewares.js +8 -2
- package/src/server/network/underpost-gateway.js +113 -14
- package/src/server/ops/logger.js +70 -35
- package/src/server/runtime/conf.js +40 -9
- package/src/server/runtime/start.js +11 -2
- package/src/server/storage/data-query.js +16 -0
- package/src/server/storage/downloader.js +62 -14
- package/src/server/storage/zip.js +153 -0
- package/test/integration/app/cyberia/atlas-sprite-sheet-store.test.js +402 -0
- package/test/integration/app/cyberia/atlas-sprite-sheet.test.js +86 -0
- package/test/integration/app/cyberia/cyberia-cli-plain-reads.test.js +34 -0
- package/test/integration/app/cyberia/cyberia-entity-type-default.test.js +842 -0
- package/test/integration/app/cyberia/cyberia-instance-conf-coerce.test.js +53 -0
- package/test/integration/app/cyberia/cyberia-instance-conf-defaults.test.js +16 -22
- package/test/integration/app/cyberia/cyberia-instance-items.test.js +90 -0
- package/test/integration/app/cyberia/cyberia-load.test.js +6 -7
- package/test/integration/app/cyberia/cyberia-map-audio-conf.test.js +256 -0
- package/test/integration/app/cyberia/cyberia-stats.test.js +150 -0
- package/test/integration/app/cyberia/fallback-world-capture.test.js +87 -2
- package/test/integration/app/cyberia/object-layer-item-selection.test.js +56 -0
- package/test/integration/app/cyberia/object-layer-natural-key.test.js +32 -0
- package/test/integration/app/cyberia/seed-audio.test.js +275 -0
- package/test/integration/infra/2-network/wireguard-cli.test.js +33 -9
- package/test/integration/infra/2-network/wireguard-edge.test.js +58 -18
- package/test/integration/infra/3-cluster/mongo-express-deploy.test.js +156 -0
- package/test/integration/infra/4-ingress/api-cross-origin.test.js +79 -0
- package/test/integration/infra/4-ingress/underpost-ingress.test.js +1 -1
- package/test/unit/catalog.test.js +13 -2
- package/test/unit/client-build-docs.test.js +97 -70
- package/test/unit/client-bundle.test.js +313 -0
- package/test/unit/conf-resolution.test.js +58 -7
- package/test/unit/coverage-artifact.test.js +120 -29
- package/test/unit/cyberia/instance-backup.test.js +183 -0
- package/test/unit/cyberia/instance-data.test.js +314 -0
- package/test/unit/cyberia/instance-object-layer-items.test.js +46 -0
- package/test/unit/cyberia/publish-workflow.test.js +22 -0
- package/test/unit/cyberia/stat-balance.test.js +69 -0
- package/test/unit/deploy-legacy-gateway-sweep.test.js +63 -0
- package/test/unit/deploy-log-table.test.js +76 -5
- package/test/unit/downloader-integrity.test.js +98 -0
- package/test/unit/file-reference-registry.test.js +141 -0
- package/test/unit/fs-storage-paths.test.js +596 -0
- package/test/unit/gateway-pod-fetch.test.js +95 -0
- package/test/unit/letsencrypt-issuer.test.js +101 -0
- package/test/unit/logger-redaction.test.js +29 -0
- package/test/unit/package.test.js +70 -16
- package/test/unit/prepare-host.test.js +84 -1
- package/test/unit/release-bump.test.js +3 -1
- package/test/unit/start-options.test.js +12 -0
- package/test/unit/test-tiers.test.js +27 -0
- package/test/unit/zip-archive.test.js +142 -0
- package/vitest.config.js +11 -3
- package/src/api/cyberia-instance/cyberia-fallback-default-items.js +0 -63
- package/src/client/components/cyberia/FallbackWorldEngineCyberia.js +0 -368
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Cyberia stats and entity progression
|
|
2
|
+
|
|
3
|
+
The Go server owns effective stats, XP, and level changes.
|
|
4
|
+
The engine owns authored content, configuration, validation, and persistence.
|
|
5
|
+
The client displays server state. The CLI validates content and generates shared contracts.
|
|
6
|
+
|
|
7
|
+
## Canonical contract
|
|
8
|
+
|
|
9
|
+
`src/client/components/cyberia/SharedDefaultsCyberia.js` defines the stat order, descriptions, modifier bounds, defaults, effective floors, and what one point is worth. The generated contract carries the scales to the server, so the simulation and the documentation read one table.
|
|
10
|
+
|
|
11
|
+
| Index | Stat | One point | Effective floor |
|
|
12
|
+
| --- | --- | --- | ---: |
|
|
13
|
+
| 0 | `effect` | Removes one life point per hit | 1 |
|
|
14
|
+
| 1 | `resistance` | Adds one point of maximum life and a tenth of a point to each regeneration | 0 |
|
|
15
|
+
| 2 | `agility` | Adds one percent of base movement speed | -90 |
|
|
16
|
+
| 3 | `range` | Adds fifty milliseconds of summon lifetime | 0 |
|
|
17
|
+
| 4 | `intelligence` | Adds five percentage points of summon chance | 0 |
|
|
18
|
+
| 5 | `utility` | Removes one percent of base cooldown and adds one percentage point of regeneration chance | 0 |
|
|
19
|
+
|
|
20
|
+
Chances are fractions of one. A tap regenerates with `lifeRegenChance` (default 0.15) plus utility; a skill summons with its `skillRules` chance (projectile 0.75, doppelganger 0.6) plus intelligence. No chance the stats raise passes `maxChance` (default 0.95), so nothing becomes a certainty. Regeneration heals the entity's own base amount plus a tenth of a point per resistance point, never past its maximum.
|
|
21
|
+
|
|
22
|
+
Each OL modifier is an integer from `-100` through `+100`. Zero is neutral.
|
|
23
|
+
Missing stat keys resolve to zero. Unknown keys, fractions, numeric strings, null values, and values outside the bounds fail validation.
|
|
24
|
+
An OL cannot store XP or level in `data.stats`.
|
|
25
|
+
|
|
26
|
+
The editor marks negative values as penalties and positive values as bonuses.
|
|
27
|
+
The randomizer validates its bounds and uses the full signed range by default.
|
|
28
|
+
|
|
29
|
+
## Semantic bounds and balancing
|
|
30
|
+
|
|
31
|
+
`STAT_TYPE_BOUNDS` in the same module declares the inclusive range each stat may take per item type. A weapon deals its effect and can cost resistance; a skin and a breastplate defend; a skill reaches; world content carries nothing. A type or stat absent there keeps the contract range.
|
|
32
|
+
|
|
33
|
+
| Type | effect | resistance | agility | range | intelligence | utility |
|
|
34
|
+
| --- | ---: | ---: | ---: | ---: | ---: | ---: |
|
|
35
|
+
| `weapon` | 5..20 | -10..2 | -5..5 | 0..10 | 0..5 | 0..10 |
|
|
36
|
+
| `skin` | 1 | 0..20 | -5..10 | 0 | 0..2 | 0..5 |
|
|
37
|
+
| `breastplate` | 0 | 5..30 | -15..0 | 0 | 0..3 | 0..5 |
|
|
38
|
+
| `skill` | 0..15 | 0..5 | 0..5 | 5..30 | 0..10 | 0..10 |
|
|
39
|
+
| `resource` | 0 | 0..10 | 0 | 0 | 0 | 0 |
|
|
40
|
+
| world content | 0 | 0 | 0 | 0 | 0 | 0 |
|
|
41
|
+
|
|
42
|
+
`src/projects/cyberia/stat-balance.js` applies one policy to every object layer the `ol` command writes: import, batch import, generation, atlas rebuilds, and the minify refresh. `--normalize-stats` clamps the stats the content carries into its type's range. `--random-stats` draws every stat inside the range instead. `--min-stat` and `--max-stat` narrow the range; a request that leaves no overlap pins the stat to the semantic edge nearest it. The policy is a pure function of the content and the flags, so a run is deterministic and normalizing is idempotent.
|
|
43
|
+
|
|
44
|
+
## Aggregation and levels
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
BaseStat(level) = baseStats[stat] + (level - 1) * perLevelStats[stat]
|
|
48
|
+
EffectiveStat = max(floor, BaseStat(level) + ActiveOLStat + TemporaryStat)
|
|
49
|
+
TotalXPForLevel(level) = xpPerLevel * (level - 1)^2
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Each active OL with positive quantity contributes once. Stack quantity does not multiply its modifier.
|
|
53
|
+
The server applies floors after the full sum. Effective values can exceed the OL bounds.
|
|
54
|
+
Equipment rules still control item types, active slots, and required skins.
|
|
55
|
+
|
|
56
|
+
Players, bots, NPCs, and resources share `EntityProgression`, the base curve, and stat aggregation.
|
|
57
|
+
Bots, NPCs, and resources have frozen progression. Their content `level` selects the base stats.
|
|
58
|
+
An absent content level uses `defaultBotLevel`. New players start at level 1 with zero XP.
|
|
59
|
+
Terrain and other passive objects carry no progression state.
|
|
60
|
+
|
|
61
|
+
Summoned entities inherit the caster's base and signed contributions, then add their own contributions.
|
|
62
|
+
The server applies floors after inheritance. A caster cycle stops traversal.
|
|
63
|
+
Temporary modifiers have an ID and expiry time. Setting the same ID replaces that modifier.
|
|
64
|
+
The lifecycle phase removes expired modifiers and updates maximum life.
|
|
65
|
+
|
|
66
|
+
The agility floor retains at least 10% of configured movement speed.
|
|
67
|
+
The existing minimum action cooldown still applies. Resistance keeps maximum life and regeneration nonnegative.
|
|
68
|
+
Increasing maximum life does not grant an instant heal.
|
|
69
|
+
|
|
70
|
+
## Server configuration
|
|
71
|
+
|
|
72
|
+
`src/api/cyberia-server-defaults/cyberia-server-defaults.js` owns progression defaults and configuration limits.
|
|
73
|
+
Instance content can override `progressionRules`. Partial curves inherit missing defaults.
|
|
74
|
+
The engine resolves and validates the complete configuration before transport.
|
|
75
|
+
|
|
76
|
+
| Setting | Default |
|
|
77
|
+
| --- | ---: |
|
|
78
|
+
| `maxLevel` | 100 |
|
|
79
|
+
| `xpPerLevel` | 100 |
|
|
80
|
+
| `defaultBotLevel` | 1 |
|
|
81
|
+
| `killXp` | 25 |
|
|
82
|
+
| `objectiveXp` | 10 |
|
|
83
|
+
| `questXp` | 100 |
|
|
84
|
+
| `minAwardIntervalMs` | 500 |
|
|
85
|
+
| `repeatWindowMs` | 60000 |
|
|
86
|
+
| `maxRepeatAwards` | 4 |
|
|
87
|
+
| `maxAwardsPerWindow` | 30 |
|
|
88
|
+
|
|
89
|
+
The default base array is `[5, 10, 0, 0, 0, 0]`.
|
|
90
|
+
The default growth array is `[2, 5, 1, 10, 1, 1]`.
|
|
91
|
+
The first total XP thresholds are `0`, `100`, `400`, and `900`.
|
|
92
|
+
One reward can advance several levels. XP stops at the maximum level threshold.
|
|
93
|
+
|
|
94
|
+
Authored levels must be integers from 1 through 65535 and cannot exceed the instance maximum.
|
|
95
|
+
Base and growth fields must be integers from 0 through 100.
|
|
96
|
+
The CLI prints the current defaults with `node bin/cyberia.js stats progression`.
|
|
97
|
+
|
|
98
|
+
Configuration participates in the instance version hash.
|
|
99
|
+
The server validates stat bounds, curves, and authored levels before a full reload mutates state.
|
|
100
|
+
An invalid reload retains its pending version so a corrected payload can retry.
|
|
101
|
+
On a curve change, player XP selects the level under the new curve. The new maximum clamps XP.
|
|
102
|
+
|
|
103
|
+
## XP rules
|
|
104
|
+
|
|
105
|
+
Only resolved simulation events can award XP:
|
|
106
|
+
|
|
107
|
+
- A player or bot defeat can award kill XP.
|
|
108
|
+
- A resource defeat can award objective XP.
|
|
109
|
+
- A completed quest can award quest XP once per quest code and session.
|
|
110
|
+
|
|
111
|
+
A combat contributor must supply at least 10% of recorded positive damage.
|
|
112
|
+
Self kills, summoned targets, item drops, providers, ghosts, and frozen players cannot produce eligible defeat rewards.
|
|
113
|
+
Bots and NPCs cannot gain XP.
|
|
114
|
+
|
|
115
|
+
Low-value outcomes share an award interval and a window limit.
|
|
116
|
+
Repeated rewards for the same event kind and target divide by `1`, `2`, `3`, then `4`.
|
|
117
|
+
Further repeats in that window award zero. Lower-level targets reduce the reward again.
|
|
118
|
+
Integer division rounds down. Zero rewards do not consume an award slot.
|
|
119
|
+
|
|
120
|
+
Unique quest completion bypasses the low-value interval and window limit.
|
|
121
|
+
This permits a final kill and its quest completion to award XP in the same tick.
|
|
122
|
+
Quest completion still rejects repeats.
|
|
123
|
+
|
|
124
|
+
Raw taps, idle duration, inventory changes, and currency transfers award no XP.
|
|
125
|
+
Player skills and tap regeneration share the server action cooldown. Movement input remains independent.
|
|
126
|
+
|
|
127
|
+
## API and Object Layer specification
|
|
128
|
+
|
|
129
|
+
An Object Layer record stores its contract marker outside hashed metadata. The model stamps it on every write:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"statContractVersion": 2,
|
|
134
|
+
"data": {
|
|
135
|
+
"stats": {
|
|
136
|
+
"effect": -100,
|
|
137
|
+
"resistance": 100,
|
|
138
|
+
"agility": 0,
|
|
139
|
+
"range": 0,
|
|
140
|
+
"intelligence": 0,
|
|
141
|
+
"utility": 0
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
This fragment omits the existing required item, ledger, and asset fields.
|
|
148
|
+
The OL API, import path, generator, and boot assembler use the shared validator.
|
|
149
|
+
Mongo schema validation also enforces integer bounds. API updates run validators.
|
|
150
|
+
|
|
151
|
+
Entity content stores optional `level` beside `entityType` and `objectLayerItemIds`.
|
|
152
|
+
The map editor preserves this field and accepts an optional level. An empty input uses the instance default.
|
|
153
|
+
`InstanceConfig.progressionRules` carries the resolved server rules over gRPC and REST. Protobuf field 24 is reserved.
|
|
154
|
+
|
|
155
|
+
The game link uses JSON envelopes over WebSocket. AOI stat arrays use canonical order.
|
|
156
|
+
|
|
157
|
+
| Snapshot scope | Fields |
|
|
158
|
+
| --- | --- |
|
|
159
|
+
| Living entities | `level`, `effectiveStats[6]`, `statsSum` |
|
|
160
|
+
| Viewing player only | `xp`, `levelXp`, `nextLevelXp`, `baseStats[6]`, `layerStats[6]`, `temporaryStats[6]` |
|
|
161
|
+
|
|
162
|
+
`xp` is total XP. `levelXp` and `nextLevelXp` are the thresholds that bound the current level, so the client draws in-level progress without the curve. At maximum level, all three equal the final threshold.
|
|
163
|
+
`statsSum` is an uncapped display summary, not an equipment budget.
|
|
164
|
+
Passive objects omit `level` and `effectiveStats`. Other players do not receive private XP or base-stat breakdowns.
|
|
165
|
+
The instance-map REST API serves authored topology and capabilities. It does not calculate simulation stats.
|
|
166
|
+
|
|
167
|
+
An XP award sends a `combat_text` message of kind `xp` to the earner only. Damage and regen kinds stay broadcast to the area of interest.
|
|
168
|
+
|
|
169
|
+
The overhead HUD of every living entity shows its level, its stats sum, and an XP bar under the HP bar. The bar fills with the viewing player's in-level progress and stays empty for other entities.
|
|
170
|
+
The Stats tab draws one shared stat panel per block. Every entity gets its effective stats; the viewing player also gets OL, base, and temporary values.
|
|
171
|
+
The level-up effect observes authoritative level increments for an entity already in view.
|
|
172
|
+
First exposure, repeated snapshots, and level decreases produce no effect. Reconnect resets effects.
|
|
173
|
+
The server broadcasts the `level-up` audio event to every viewer in reach when a player's level rises, and the `death` audio event on every defeat.
|
|
174
|
+
|
|
175
|
+
## Progression lifetime
|
|
176
|
+
|
|
177
|
+
The guest runtime assigns a new UUID for each WebSocket session.
|
|
178
|
+
Progression survives death, respawn, portal travel, and world reload within that session.
|
|
179
|
+
A disconnect or server restart ends that progression state.
|
|
180
|
+
|
|
181
|
+
Persistent account progression requires an authenticated, stable account binding and an engine-owned persistence contract.
|
|
182
|
+
The simulation server exposes no XP mutation API and stores no progression.
|
|
183
|
+
|
|
184
|
+
## Generation and verification
|
|
185
|
+
|
|
186
|
+
Generate contracts after a shared stat or progression-default change:
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
node bin/cyberia.js stat-contract
|
|
190
|
+
node bin/cyberia.js stat-contract --check
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The generator writes the Go contract, C header, and REST test fixtures. Do not edit these outputs by hand.
|
|
194
|
+
Regenerate protobuf output with the existing protobuf toolchain when `gen/proto/cyberia.proto` changes.
|
|
195
|
+
|
|
196
|
+
Inspect and validate content with:
|
|
197
|
+
|
|
198
|
+
```sh
|
|
199
|
+
node bin/cyberia.js stats progression
|
|
200
|
+
node bin/cyberia.js stats validate /tmp/object-layers.json
|
|
201
|
+
node bin/cyberia.js stats random --min=-100 --max=100
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Focused engine tests:
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
node node_modules/vitest/vitest.mjs run test/integration/app/cyberia/cyberia-stats.test.js
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Run `go test ./...` from `cyberia-server`. The REST and WebSocket tests need local loopback socket access.
|
|
211
|
+
The tests cover signed bounds, floors, inheritance, expiry, thresholds, static levels, repeat limits, tap spam, and reload rejection.
|
|
212
|
+
Generated REST fixtures and protobuf round trips check the engine/server contract.
|
|
213
|
+
|
|
214
|
+
Run the native client tests, including the level-up effect, with `cyberia-client/tests/run.sh`.
|
|
215
|
+
|
|
216
|
+
Build the client with its existing `Web.mk` target and Emscripten SDK.
|
|
217
|
+
The SDK needs Python 3.10 or later and a writable cache.
|
|
@@ -18,7 +18,7 @@ _Stackable Rendering Layers as a Unified Tokenized Reality_
|
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
-
**Version:** 3.3.
|
|
21
|
+
**Version:** 3.3.77 | **Status:** Draft | **Authors:** Underpost Engineering
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
@@ -208,18 +208,26 @@ The `ObjectLayerToken` contract maps each `tokenId` → canonical `cid` on-chain
|
|
|
208
208
|
|
|
209
209
|
### 4.4 Canonical Stats Schema
|
|
210
210
|
|
|
211
|
-
|
|
211
|
+
Each Object Layer contributes six signed integer modifiers in `[-100, +100]`. Zero is neutral.
|
|
212
|
+
The canonical source is `SharedDefaultsCyberia.js`.
|
|
212
213
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
| Stat | Runtime meaning |
|
|
215
|
+
| -------------- | --------------------------------------------------------------------- |
|
|
216
|
+
| `effect` | Life removed by an impact |
|
|
217
|
+
| `resistance` | Maximum life bonus and life restored by regeneration |
|
|
218
|
+
| `agility` | Movement speed percentage modifier |
|
|
219
|
+
| `range` | Summoned entity lifetime in milliseconds |
|
|
220
|
+
| `intelligence` | Summon success chance modifier |
|
|
221
|
+
| `utility` | Action cooldown percentage reduction and regeneration chance modifier |
|
|
222
|
+
|
|
223
|
+
The server adds base stats at the entity level, active OL contributions, and temporary modifiers.
|
|
224
|
+
It applies playable floors after this sum. Players, bots, NPCs, and resources use the same calculation.
|
|
225
|
+
Bots and NPCs use assigned levels with frozen XP.
|
|
226
|
+
|
|
227
|
+
XP belongs to entity progression. Resolved kills, resource defeats, and quest completions can award XP.
|
|
228
|
+
Cooldowns, contribution checks, repeat limits, and rate limits restrict rewards. Raw taps and idle time award no XP.
|
|
229
|
+
|
|
230
|
+
The current guest runtime keeps progression for one connected session.
|
|
223
231
|
|
|
224
232
|
### 4.5 Item Type Registry
|
|
225
233
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Auth } from '../../components/core/Auth.js';
|
|
2
|
+
import { loggerFactory } from '../../components/core/Logger.js';
|
|
3
|
+
import { getApiBaseUrl, headersFactory, payloadFactory, buildQueryUrl } from '../core/core.service.js';
|
|
4
|
+
const logger = loggerFactory(import.meta);
|
|
5
|
+
logger.info('Load service');
|
|
6
|
+
const endpoint = 'cyberia-audio';
|
|
7
|
+
class CyberiaAudioService {
|
|
8
|
+
static post = (options = { id: '', body: {} }) =>
|
|
9
|
+
new Promise((resolve, reject) =>
|
|
10
|
+
fetch(getApiBaseUrl({ id: options.id, endpoint }), {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
headers: headersFactory(),
|
|
13
|
+
credentials: 'include',
|
|
14
|
+
body: payloadFactory(options.body),
|
|
15
|
+
})
|
|
16
|
+
.then(async (res) => {
|
|
17
|
+
return await res.json();
|
|
18
|
+
})
|
|
19
|
+
.then((res) => {
|
|
20
|
+
logger.info(res);
|
|
21
|
+
return resolve(res);
|
|
22
|
+
})
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
logger.error(error);
|
|
25
|
+
return reject(error);
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
static put = (options = { id: '', body: {} }) =>
|
|
29
|
+
new Promise((resolve, reject) =>
|
|
30
|
+
fetch(getApiBaseUrl({ id: options.id, endpoint }), {
|
|
31
|
+
method: 'PUT',
|
|
32
|
+
headers: headersFactory(),
|
|
33
|
+
credentials: 'include',
|
|
34
|
+
body: payloadFactory(options.body),
|
|
35
|
+
})
|
|
36
|
+
.then(async (res) => {
|
|
37
|
+
return await res.json();
|
|
38
|
+
})
|
|
39
|
+
.then((res) => {
|
|
40
|
+
logger.info(res);
|
|
41
|
+
return resolve(res);
|
|
42
|
+
})
|
|
43
|
+
.catch((error) => {
|
|
44
|
+
logger.error(error);
|
|
45
|
+
return reject(error);
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
static get = (options = {}) => {
|
|
49
|
+
const { id, page, limit, filterModel, sortModel, sort, asc, order } = options;
|
|
50
|
+
const url = buildQueryUrl(getApiBaseUrl({ id, endpoint }), {
|
|
51
|
+
page,
|
|
52
|
+
limit,
|
|
53
|
+
filterModel,
|
|
54
|
+
sortModel,
|
|
55
|
+
sort,
|
|
56
|
+
asc,
|
|
57
|
+
order,
|
|
58
|
+
});
|
|
59
|
+
return new Promise((resolve, reject) =>
|
|
60
|
+
fetch(url.toString(), {
|
|
61
|
+
method: 'GET',
|
|
62
|
+
headers: headersFactory(),
|
|
63
|
+
credentials: 'include',
|
|
64
|
+
})
|
|
65
|
+
.then(async (res) => {
|
|
66
|
+
return await res.json();
|
|
67
|
+
})
|
|
68
|
+
.then((res) => {
|
|
69
|
+
logger.info(res);
|
|
70
|
+
return resolve(res);
|
|
71
|
+
})
|
|
72
|
+
.catch((error) => {
|
|
73
|
+
logger.error(error);
|
|
74
|
+
return reject(error);
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
static delete = (options = { id: '', body: {} }) =>
|
|
79
|
+
new Promise((resolve, reject) =>
|
|
80
|
+
fetch(getApiBaseUrl({ id: options.id, endpoint }), {
|
|
81
|
+
method: 'DELETE',
|
|
82
|
+
headers: headersFactory(),
|
|
83
|
+
credentials: 'include',
|
|
84
|
+
body: payloadFactory(options.body),
|
|
85
|
+
})
|
|
86
|
+
.then(async (res) => {
|
|
87
|
+
return await res.json();
|
|
88
|
+
})
|
|
89
|
+
.then((res) => {
|
|
90
|
+
logger.info(res);
|
|
91
|
+
return resolve(res);
|
|
92
|
+
})
|
|
93
|
+
.catch((error) => {
|
|
94
|
+
logger.error(error);
|
|
95
|
+
return reject(error);
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
export { CyberiaAudioService };
|
package/src/client/services/cyberia-entity-type-default/cyberia-entity-type-default.service.js
CHANGED
|
@@ -95,5 +95,43 @@ class CyberiaEntityTypeDefaultService {
|
|
|
95
95
|
return reject(error);
|
|
96
96
|
}),
|
|
97
97
|
);
|
|
98
|
+
/** Points one instance's conf at every default the given maps place. */
|
|
99
|
+
static syncInstance = (options = { instanceCode: '', body: {} }) =>
|
|
100
|
+
new Promise((resolve, reject) =>
|
|
101
|
+
fetch(getApiBaseUrl({ id: `sync-instance/${options.instanceCode}`, endpoint }), {
|
|
102
|
+
method: 'POST',
|
|
103
|
+
headers: headersFactory(),
|
|
104
|
+
credentials: 'include',
|
|
105
|
+
body: payloadFactory(options.body),
|
|
106
|
+
})
|
|
107
|
+
.then(async (res) => await res.json())
|
|
108
|
+
.then((res) => {
|
|
109
|
+
logger.info(res);
|
|
110
|
+
return resolve(res);
|
|
111
|
+
})
|
|
112
|
+
.catch((error) => {
|
|
113
|
+
logger.error(error);
|
|
114
|
+
return reject(error);
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
/** States the complete set of instances that reference this default. */
|
|
118
|
+
static setInstances = (options = { id: '', body: {} }) =>
|
|
119
|
+
new Promise((resolve, reject) =>
|
|
120
|
+
fetch(getApiBaseUrl({ id: `${options.id}/instances`, endpoint }), {
|
|
121
|
+
method: 'POST',
|
|
122
|
+
headers: headersFactory(),
|
|
123
|
+
credentials: 'include',
|
|
124
|
+
body: payloadFactory(options.body),
|
|
125
|
+
})
|
|
126
|
+
.then(async (res) => await res.json())
|
|
127
|
+
.then((res) => {
|
|
128
|
+
logger.info(res);
|
|
129
|
+
return resolve(res);
|
|
130
|
+
})
|
|
131
|
+
.catch((error) => {
|
|
132
|
+
logger.error(error);
|
|
133
|
+
return reject(error);
|
|
134
|
+
}),
|
|
135
|
+
);
|
|
98
136
|
}
|
|
99
137
|
export { CyberiaEntityTypeDefaultService };
|
|
@@ -29,7 +29,7 @@ class CyberiaInstanceManagement {
|
|
|
29
29
|
<i class="fa-solid fa-upload"></i>
|
|
30
30
|
</div>`,
|
|
31
31
|
class: `in fll section-mp management-table-btn-mini management-table-btn-load-instance-${idModal}-${cellRenderId} ${
|
|
32
|
-
!params.data.
|
|
32
|
+
!params.data.code ? 'hide' : ''
|
|
33
33
|
}`,
|
|
34
34
|
})}`;
|
|
35
35
|
|
|
@@ -37,12 +37,13 @@ class CyberiaInstanceManagement {
|
|
|
37
37
|
EventsUI.onClick(
|
|
38
38
|
`.management-table-btn-load-instance-${idModal}-${cellRenderId}`,
|
|
39
39
|
async () => {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
// Instances are addressed by code, the key the engine URL carries.
|
|
41
|
+
if (!params.data.code) return;
|
|
42
|
+
const result = await CyberiaInstanceService.get({ id: params.data.code });
|
|
42
43
|
if (result.status === 'success' && result.data) {
|
|
43
44
|
if (loadInstanceCallback) await loadInstanceCallback(result.data);
|
|
44
45
|
NotificationManager.Push({
|
|
45
|
-
html: `Instance "${result.data.name || result.data.code
|
|
46
|
+
html: `Instance "${result.data.name || result.data.code}" loaded`,
|
|
46
47
|
status: 'success',
|
|
47
48
|
});
|
|
48
49
|
} else {
|
|
@@ -96,46 +96,6 @@ class CyberiaInstanceService {
|
|
|
96
96
|
return reject(error);
|
|
97
97
|
}),
|
|
98
98
|
);
|
|
99
|
-
/** Fallback-world default items currently staged on the engine process. */
|
|
100
|
-
static getFallbackDefaultItems = () =>
|
|
101
|
-
new Promise((resolve, reject) =>
|
|
102
|
-
fetch(getApiBaseUrl({ id: 'fallback-world/default-items', endpoint }), {
|
|
103
|
-
method: 'GET',
|
|
104
|
-
headers: headersFactory(),
|
|
105
|
-
credentials: 'include',
|
|
106
|
-
})
|
|
107
|
-
.then(async (res) => res.json())
|
|
108
|
-
.then((res) => {
|
|
109
|
-
logger.info(res);
|
|
110
|
-
return resolve(res);
|
|
111
|
-
})
|
|
112
|
-
.catch((error) => {
|
|
113
|
-
logger.error(error);
|
|
114
|
-
return reject(error);
|
|
115
|
-
}),
|
|
116
|
-
);
|
|
117
|
-
/**
|
|
118
|
-
* Stage the fallback world's default items and reload a running cyberia-server
|
|
119
|
-
* (moderator/admin). The items ride along with the trigger — nothing is persisted.
|
|
120
|
-
*/
|
|
121
|
-
static fallbackHotReload = (options = { body: {} }) =>
|
|
122
|
-
new Promise((resolve, reject) =>
|
|
123
|
-
fetch(getApiBaseUrl({ id: 'fallback-world/hot-reload', endpoint }), {
|
|
124
|
-
method: 'POST',
|
|
125
|
-
headers: headersFactory(),
|
|
126
|
-
credentials: 'include',
|
|
127
|
-
body: JSON.stringify(options.body ?? {}),
|
|
128
|
-
})
|
|
129
|
-
.then(async (res) => res.json())
|
|
130
|
-
.then((res) => {
|
|
131
|
-
logger.info(res);
|
|
132
|
-
return resolve(res);
|
|
133
|
-
})
|
|
134
|
-
.catch((error) => {
|
|
135
|
-
logger.error(error);
|
|
136
|
-
return reject(error);
|
|
137
|
-
}),
|
|
138
|
-
);
|
|
139
99
|
static portalConnect = (options = { id: '' }) =>
|
|
140
100
|
new Promise((resolve, reject) =>
|
|
141
101
|
fetch(getApiBaseUrl({ id: `${options.id}/portal-connect`, endpoint }), {
|
|
@@ -29,7 +29,7 @@ class CyberiaMapManagement {
|
|
|
29
29
|
<i class="fa-solid fa-upload"></i>
|
|
30
30
|
</div>`,
|
|
31
31
|
class: `in fll section-mp management-table-btn-mini management-table-btn-load-map-${idModal}-${cellRenderId} ${
|
|
32
|
-
!params.data.
|
|
32
|
+
!params.data.code ? 'hide' : ''
|
|
33
33
|
}`,
|
|
34
34
|
})}`;
|
|
35
35
|
|
|
@@ -37,12 +37,13 @@ class CyberiaMapManagement {
|
|
|
37
37
|
EventsUI.onClick(
|
|
38
38
|
`.management-table-btn-load-map-${idModal}-${cellRenderId}`,
|
|
39
39
|
async () => {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
// Maps are addressed by code, the key the engine URL carries.
|
|
41
|
+
if (!params.data.code) return;
|
|
42
|
+
const result = await CyberiaMapService.get({ id: params.data.code });
|
|
42
43
|
if (result.status === 'success' && result.data) {
|
|
43
44
|
if (loadMapCallback) await loadMapCallback(result.data);
|
|
44
45
|
NotificationManager.Push({
|
|
45
|
-
html: `Map "${result.data.name || result.data.code
|
|
46
|
+
html: `Map "${result.data.name || result.data.code}" loaded`,
|
|
46
47
|
status: 'success',
|
|
47
48
|
});
|
|
48
49
|
} else {
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { Auth } from '../../components/core/Auth.js';
|
|
2
|
+
import { loggerFactory } from '../../components/core/Logger.js';
|
|
3
|
+
import { getApiBaseUrl, headersFactory, payloadFactory, buildQueryUrl } from '../core/core.service.js';
|
|
4
|
+
const logger = loggerFactory(import.meta);
|
|
5
|
+
logger.info('Load service');
|
|
6
|
+
const endpoint = 'cyberia-map-audio-conf';
|
|
7
|
+
class CyberiaMapAudioConfService {
|
|
8
|
+
static post = (options = { id: '', body: {} }) =>
|
|
9
|
+
new Promise((resolve, reject) =>
|
|
10
|
+
fetch(getApiBaseUrl({ id: options.id, endpoint }), {
|
|
11
|
+
method: 'POST',
|
|
12
|
+
headers: headersFactory(),
|
|
13
|
+
credentials: 'include',
|
|
14
|
+
body: payloadFactory(options.body),
|
|
15
|
+
})
|
|
16
|
+
.then(async (res) => {
|
|
17
|
+
return await res.json();
|
|
18
|
+
})
|
|
19
|
+
.then((res) => {
|
|
20
|
+
logger.info(res);
|
|
21
|
+
return resolve(res);
|
|
22
|
+
})
|
|
23
|
+
.catch((error) => {
|
|
24
|
+
logger.error(error);
|
|
25
|
+
return reject(error);
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
static put = (options = { id: '', body: {} }) =>
|
|
29
|
+
new Promise((resolve, reject) =>
|
|
30
|
+
fetch(getApiBaseUrl({ id: options.id, endpoint }), {
|
|
31
|
+
method: 'PUT',
|
|
32
|
+
headers: headersFactory(),
|
|
33
|
+
credentials: 'include',
|
|
34
|
+
body: payloadFactory(options.body),
|
|
35
|
+
})
|
|
36
|
+
.then(async (res) => {
|
|
37
|
+
return await res.json();
|
|
38
|
+
})
|
|
39
|
+
.then((res) => {
|
|
40
|
+
logger.info(res);
|
|
41
|
+
return resolve(res);
|
|
42
|
+
})
|
|
43
|
+
.catch((error) => {
|
|
44
|
+
logger.error(error);
|
|
45
|
+
return reject(error);
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
static get = (options = {}) => {
|
|
49
|
+
const { id, page, limit, filterModel, sortModel, sort, asc, order } = options;
|
|
50
|
+
const url = buildQueryUrl(getApiBaseUrl({ id, endpoint }), {
|
|
51
|
+
page,
|
|
52
|
+
limit,
|
|
53
|
+
filterModel,
|
|
54
|
+
sortModel,
|
|
55
|
+
sort,
|
|
56
|
+
asc,
|
|
57
|
+
order,
|
|
58
|
+
});
|
|
59
|
+
return new Promise((resolve, reject) =>
|
|
60
|
+
fetch(url.toString(), {
|
|
61
|
+
method: 'GET',
|
|
62
|
+
headers: headersFactory(),
|
|
63
|
+
credentials: 'include',
|
|
64
|
+
})
|
|
65
|
+
.then(async (res) => {
|
|
66
|
+
return await res.json();
|
|
67
|
+
})
|
|
68
|
+
.then((res) => {
|
|
69
|
+
logger.info(res);
|
|
70
|
+
return resolve(res);
|
|
71
|
+
})
|
|
72
|
+
.catch((error) => {
|
|
73
|
+
logger.error(error);
|
|
74
|
+
return reject(error);
|
|
75
|
+
}),
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
static delete = (options = { id: '', body: {} }) =>
|
|
79
|
+
new Promise((resolve, reject) =>
|
|
80
|
+
fetch(getApiBaseUrl({ id: options.id, endpoint }), {
|
|
81
|
+
method: 'DELETE',
|
|
82
|
+
headers: headersFactory(),
|
|
83
|
+
credentials: 'include',
|
|
84
|
+
body: payloadFactory(options.body),
|
|
85
|
+
})
|
|
86
|
+
.then(async (res) => {
|
|
87
|
+
return await res.json();
|
|
88
|
+
})
|
|
89
|
+
.then((res) => {
|
|
90
|
+
logger.info(res);
|
|
91
|
+
return resolve(res);
|
|
92
|
+
})
|
|
93
|
+
.catch((error) => {
|
|
94
|
+
logger.error(error);
|
|
95
|
+
return reject(error);
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
static getByMapCode = (options = { mapCode: '' }) =>
|
|
99
|
+
new Promise((resolve, reject) =>
|
|
100
|
+
fetch(`${getApiBaseUrl({ endpoint })}/map-code/${options.mapCode}`, {
|
|
101
|
+
method: 'GET',
|
|
102
|
+
headers: headersFactory(),
|
|
103
|
+
credentials: 'include',
|
|
104
|
+
})
|
|
105
|
+
.then(async (res) => {
|
|
106
|
+
return await res.json();
|
|
107
|
+
})
|
|
108
|
+
.then((res) => {
|
|
109
|
+
logger.info(res);
|
|
110
|
+
return resolve(res);
|
|
111
|
+
})
|
|
112
|
+
.catch((error) => {
|
|
113
|
+
logger.error(error);
|
|
114
|
+
return reject(error);
|
|
115
|
+
}),
|
|
116
|
+
);
|
|
117
|
+
static assign = (options = { mapCode: '', body: {} }) =>
|
|
118
|
+
new Promise((resolve, reject) =>
|
|
119
|
+
fetch(`${getApiBaseUrl({ endpoint })}/map-code/${options.mapCode}`, {
|
|
120
|
+
method: 'POST',
|
|
121
|
+
headers: headersFactory(),
|
|
122
|
+
credentials: 'include',
|
|
123
|
+
body: payloadFactory(options.body),
|
|
124
|
+
})
|
|
125
|
+
.then(async (res) => {
|
|
126
|
+
return await res.json();
|
|
127
|
+
})
|
|
128
|
+
.then((res) => {
|
|
129
|
+
logger.info(res);
|
|
130
|
+
return resolve(res);
|
|
131
|
+
})
|
|
132
|
+
.catch((error) => {
|
|
133
|
+
logger.error(error);
|
|
134
|
+
return reject(error);
|
|
135
|
+
}),
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
export { CyberiaMapAudioConfService };
|