@open-core/framework 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/adapters/contracts/IPlatformCapabilities.d.ts +79 -0
- package/dist/adapters/contracts/IPlatformCapabilities.js +31 -0
- package/dist/adapters/contracts/IPlayerInfo.d.ts +1 -1
- package/dist/adapters/contracts/{IPedAppearanceClient.d.ts → client/IPedAppearanceClient.d.ts} +1 -1
- package/dist/adapters/contracts/server/IEntityServer.d.ts +188 -0
- package/dist/adapters/contracts/server/IEntityServer.js +39 -0
- package/dist/adapters/contracts/{IPlayerServer.d.ts → server/IPlayerServer.d.ts} +52 -9
- package/dist/adapters/contracts/server/IPlayerServer.js +39 -0
- package/dist/adapters/contracts/types/identifier.d.ts +67 -0
- package/dist/adapters/contracts/types/identifier.js +64 -0
- package/dist/adapters/contracts/types/index.d.ts +1 -0
- package/dist/{kernel/shared/appearance → adapters/contracts/types}/index.js +1 -1
- package/dist/adapters/fivem/fivem-capabilities.d.ts +18 -0
- package/dist/adapters/fivem/fivem-capabilities.js +67 -0
- package/dist/adapters/fivem/fivem-engine-events.js +17 -4
- package/dist/adapters/fivem/fivem-entity-server.d.ts +6 -2
- package/dist/adapters/fivem/fivem-entity-server.js +14 -1
- package/dist/adapters/fivem/fivem-ped-appearance-client.d.ts +1 -1
- package/dist/adapters/fivem/fivem-ped-appearance-client.js +1 -1
- package/dist/adapters/fivem/fivem-ped-appearance-server.d.ts +1 -1
- package/dist/adapters/fivem/fivem-ped-appearance-server.js +1 -1
- package/dist/adapters/fivem/fivem-platform.d.ts +5 -0
- package/dist/adapters/fivem/fivem-platform.js +100 -0
- package/dist/adapters/fivem/fivem-player-server.d.ts +7 -1
- package/dist/adapters/fivem/fivem-player-server.js +19 -1
- package/dist/adapters/fivem/fivem-playerinfo.d.ts +1 -1
- package/dist/adapters/fivem/fivem-vehicle-server.d.ts +1 -1
- package/dist/adapters/fivem/fivem-vehicle-server.js +1 -1
- package/dist/adapters/fivem/index.d.ts +13 -0
- package/dist/adapters/fivem/index.js +31 -0
- package/dist/adapters/index.d.ts +8 -7
- package/dist/adapters/index.js +13 -12
- package/dist/adapters/node/index.d.ts +5 -0
- package/dist/adapters/node/index.js +13 -1
- package/dist/adapters/node/node-capabilities.d.ts +19 -0
- package/dist/adapters/node/node-capabilities.js +54 -0
- package/dist/adapters/node/node-entity-server.d.ts +17 -6
- package/dist/adapters/node/node-entity-server.js +41 -15
- package/dist/adapters/node/node-net-transport.js +2 -2
- package/dist/adapters/node/node-ped-appearance-client.d.ts +1 -1
- package/dist/adapters/node/node-ped-appearance-client.js +1 -1
- package/dist/adapters/node/node-ped-appearance-server.d.ts +1 -1
- package/dist/adapters/node/node-ped-appearance-server.js +1 -1
- package/dist/adapters/node/node-platform.d.ts +5 -0
- package/dist/adapters/node/node-platform.js +103 -0
- package/dist/adapters/node/node-player-server.d.ts +19 -3
- package/dist/adapters/node/node-player-server.js +43 -9
- package/dist/adapters/node/node-playerinfo.d.ts +2 -2
- package/dist/adapters/node/node-playerinfo.js +14 -3
- package/dist/adapters/node/node-vehicle-server.d.ts +1 -1
- package/dist/adapters/node/node-vehicle-server.js +1 -1
- package/dist/adapters/platform/index.d.ts +1 -0
- package/dist/{runtime/server/database.js → adapters/platform/index.js} +1 -7
- package/dist/adapters/platform/platform-registry.d.ts +101 -0
- package/dist/adapters/platform/platform-registry.js +122 -0
- package/dist/adapters/register-capabilities.d.ts +52 -2
- package/dist/adapters/register-capabilities.js +69 -130
- package/dist/adapters/register-client-capabilities.js +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.js +5 -31
- package/dist/kernel/di/container.d.ts +4 -2
- package/dist/kernel/di/container.js +5 -3
- package/dist/kernel/di/metadata.scanner.d.ts +2 -1
- package/dist/kernel/di/metadata.scanner.js +3 -2
- package/dist/kernel/{utils/error → error}/app.error.d.ts +2 -2
- package/dist/kernel/error/common.error-codes.d.ts +1 -0
- package/dist/kernel/error/framework.error-codes.d.ts +12 -0
- package/dist/kernel/error/index.d.ts +4 -0
- package/dist/kernel/error/index.js +18 -0
- package/dist/kernel/{utils/error → error}/security.error.d.ts +1 -1
- package/dist/kernel/error/security.types.js +2 -0
- package/dist/kernel/index.d.ts +4 -5
- package/dist/kernel/index.js +6 -11
- package/dist/kernel/{shared/logger → logger}/core-logger.d.ts +0 -19
- package/dist/kernel/{shared/logger → logger}/core-logger.js +10 -24
- package/dist/kernel/{shared/logger → logger}/logger.env.d.ts +12 -5
- package/dist/kernel/{shared/logger → logger}/logger.env.js +29 -13
- package/dist/kernel/{shared/logger → logger}/logger.service.d.ts +14 -0
- package/dist/kernel/{shared/logger → logger}/logger.service.js +20 -2
- package/dist/kernel/logger/transports/transport.interface.js +2 -0
- package/dist/kernel/shared/index.d.ts +1 -2
- package/dist/kernel/shared/index.js +1 -2
- package/dist/kernel/utils/index.d.ts +0 -2
- package/dist/kernel/utils/index.js +0 -2
- package/dist/kernel/utils/result.d.ts +1 -1
- package/dist/runtime/client/api.d.ts +7 -0
- package/dist/runtime/client/api.js +23 -0
- package/dist/runtime/client/client-bootstrap.js +1 -1
- package/dist/runtime/client/controllers/spawner.controller.d.ts +1 -1
- package/dist/runtime/client/decorators/index.d.ts +2 -2
- package/dist/runtime/client/decorators/index.js +2 -2
- package/dist/runtime/client/decorators/key.d.ts +2 -2
- package/dist/runtime/client/decorators/key.js +3 -3
- package/dist/runtime/client/decorators/localEvent.d.ts +1 -1
- package/dist/runtime/client/decorators/localEvent.js +1 -1
- package/dist/runtime/client/decorators/{tick.d.ts → onTick.d.ts} +1 -1
- package/dist/runtime/client/decorators/{tick.js → onTick.js} +2 -2
- package/dist/runtime/client/decorators/{nui.d.ts → onView.d.ts} +4 -4
- package/dist/runtime/client/decorators/{nui.js → onView.js} +5 -5
- package/dist/runtime/client/index.d.ts +1 -7
- package/dist/runtime/client/index.js +26 -12
- package/dist/runtime/client/player/player.d.ts +1 -1
- package/dist/runtime/client/player/player.loader.js +3 -3
- package/dist/runtime/client/services/appearance.service.d.ts +1 -1
- package/dist/runtime/client/services/appearance.service.js +1 -1
- package/dist/runtime/client/services/blip.service.d.ts +1 -1
- package/dist/runtime/client/services/marker.service.d.ts +1 -1
- package/dist/runtime/client/services/ped.service.d.ts +1 -1
- package/dist/runtime/client/services/spawn.service.d.ts +2 -2
- package/dist/runtime/client/services/spawn.service.js +12 -12
- package/dist/runtime/client/services/textui.service.d.ts +1 -1
- package/dist/runtime/client/services/vehicle-client.service.d.ts +1 -1
- package/dist/runtime/client/services/vehicle.service.d.ts +1 -1
- package/dist/runtime/client/system/processors/export.processor.js +1 -1
- package/dist/runtime/client/system/processors/gameEvent.processor.js +1 -1
- package/dist/runtime/client/system/processors/interval.processor.js +1 -1
- package/dist/runtime/client/system/processors/localEvent.processor.js +1 -1
- package/dist/runtime/client/system/processors/netEvent.processor.js +1 -1
- package/dist/runtime/client/system/processors/nui.processor.js +5 -4
- package/dist/runtime/client/system/processors/resourceLifecycle.processor.js +1 -1
- package/dist/runtime/client/system/processors/tick.processor.js +1 -1
- package/dist/runtime/client/ui-bridge.js +1 -1
- package/dist/runtime/core/entity.d.ts +168 -0
- package/dist/runtime/core/entity.js +226 -0
- package/dist/runtime/core/index.d.ts +3 -0
- package/dist/runtime/core/index.js +19 -0
- package/dist/runtime/core/spatial.d.ts +5 -0
- package/dist/runtime/core/spatial.js +2 -0
- package/dist/runtime/core/world.d.ts +13 -0
- package/dist/runtime/core/world.js +64 -0
- package/dist/runtime/server/api.d.ts +12 -0
- package/dist/runtime/server/api.js +34 -0
- package/dist/runtime/server/bootstrap.js +58 -103
- package/dist/runtime/server/bus/internal-event.bus.js +1 -1
- package/dist/runtime/server/contracts/index.d.ts +1 -2
- package/dist/runtime/server/contracts/index.js +2 -3
- package/dist/runtime/server/contracts/player-persistence.contract.d.ts +16 -18
- package/dist/runtime/server/contracts/player-persistence.contract.js +16 -18
- package/dist/runtime/server/contracts/security/command-error-observer.contract.d.ts +73 -0
- package/dist/runtime/server/contracts/security/command-error-observer.contract.js +9 -0
- package/dist/runtime/server/contracts/security/permission.types.d.ts +2 -2
- package/dist/runtime/server/contracts/security/principal-provider.contract.d.ts +3 -3
- package/dist/runtime/server/contracts/security/principal-provider.contract.js +2 -2
- package/dist/runtime/server/contracts/security/security-handler.contract.d.ts +2 -2
- package/dist/runtime/server/controllers/chat.controller.d.ts +1 -1
- package/dist/runtime/server/controllers/chat.controller.js +5 -0
- package/dist/runtime/server/controllers/command-export.controller.d.ts +12 -3
- package/dist/runtime/server/controllers/command-export.controller.js +81 -25
- package/dist/runtime/server/controllers/player-export.controller.d.ts +2 -2
- package/dist/runtime/server/controllers/player-export.controller.js +5 -0
- package/dist/runtime/server/controllers/principal-export.controller.js +8 -7
- package/dist/runtime/server/controllers/ready.controller.d.ts +5 -0
- package/dist/runtime/server/controllers/ready.controller.js +37 -0
- package/dist/runtime/server/controllers/remote-command-execution.controller.d.ts +10 -1
- package/dist/runtime/server/controllers/remote-command-execution.controller.js +65 -13
- package/dist/runtime/server/controllers/session.controller.d.ts +2 -2
- package/dist/runtime/server/controllers/session.controller.js +25 -17
- package/dist/runtime/server/controllers/vehicle.controller.d.ts +3 -38
- package/dist/runtime/server/controllers/vehicle.controller.js +6 -152
- package/dist/runtime/server/decorators/guard.d.ts +8 -6
- package/dist/runtime/server/decorators/guard.js +10 -8
- package/dist/runtime/server/decorators/index.d.ts +1 -1
- package/dist/runtime/server/decorators/index.js +1 -1
- package/dist/runtime/server/decorators/onNet.d.ts +3 -3
- package/dist/runtime/server/decorators/{onFiveMEvent.d.ts → onRuntimeEvent.d.ts} +5 -4
- package/dist/runtime/server/decorators/{onFiveMEvent.js → onRuntimeEvent.js} +7 -6
- package/dist/runtime/server/decorators/requiresState.js +3 -3
- package/dist/runtime/server/decorators/throttle.d.ts +1 -1
- package/dist/runtime/server/decorators/throttle.js +1 -1
- package/dist/runtime/server/decorators/utils.d.ts +1 -1
- package/dist/runtime/server/decorators/utils.js +1 -1
- package/dist/runtime/server/devmode/dev-mode.service.d.ts +7 -8
- package/dist/runtime/server/devmode/dev-mode.service.js +18 -46
- package/dist/runtime/server/devmode/index.d.ts +1 -3
- package/dist/runtime/server/devmode/index.js +1 -18
- package/dist/runtime/server/devmode/player-simulator.service.js +3 -3
- package/dist/runtime/server/devmode/state-inspector.service.js +2 -2
- package/dist/runtime/server/devmode/types.d.ts +67 -31
- package/dist/runtime/server/devmode/types.js +1 -4
- package/dist/runtime/server/entities/player.d.ts +80 -66
- package/dist/runtime/server/entities/player.js +137 -98
- package/dist/runtime/server/entities/vehicle.d.ts +3 -3
- package/dist/runtime/server/error-handler.js +5 -5
- package/dist/runtime/server/helpers/normalize-app-error.d.ts +9 -0
- package/dist/runtime/server/helpers/normalize-app-error.js +20 -0
- package/dist/runtime/server/helpers/resolve-method.js +3 -3
- package/dist/runtime/server/index.d.ts +1 -13
- package/dist/runtime/server/index.js +25 -23
- package/dist/runtime/server/runtime.d.ts +32 -281
- package/dist/runtime/server/runtime.js +46 -60
- package/dist/runtime/server/services/appearance.service.d.ts +5 -5
- package/dist/runtime/server/services/appearance.service.js +5 -5
- package/dist/runtime/server/services/chat.service.d.ts +5 -3
- package/dist/runtime/server/services/chat.service.js +17 -12
- package/dist/runtime/server/services/core/command.service.d.ts +9 -1
- package/dist/runtime/server/services/core/command.service.js +16 -7
- package/dist/runtime/server/services/core/player.service.d.ts +12 -16
- package/dist/runtime/server/services/core/player.service.js +42 -47
- package/dist/runtime/server/services/core/principal.service.js +5 -5
- package/dist/runtime/server/services/core/session-recovery.service.d.ts +1 -1
- package/dist/runtime/server/services/core/session-recovery.service.js +2 -2
- package/dist/runtime/server/services/default/default-command-error-observer.d.ts +14 -0
- package/dist/runtime/server/services/default/default-command-error-observer.js +43 -0
- package/dist/runtime/server/services/default/default-principal.provider.d.ts +13 -0
- package/dist/runtime/server/services/default/default-principal.provider.js +38 -0
- package/dist/runtime/server/services/default/default-security.handler.d.ts +1 -1
- package/dist/runtime/server/services/default/default-security.handler.js +1 -1
- package/dist/runtime/server/services/index.d.ts +0 -3
- package/dist/runtime/server/services/index.js +1 -6
- package/dist/runtime/server/services/parallel/index.d.ts +1 -45
- package/dist/runtime/server/services/parallel/index.js +0 -44
- package/dist/runtime/server/services/parallel/native-worker.entry.d.ts +1 -0
- package/dist/runtime/server/services/parallel/native-worker.entry.js +12 -0
- package/dist/runtime/server/services/parallel/parallel-compute.service.d.ts +17 -17
- package/dist/runtime/server/services/parallel/parallel-compute.service.js +10 -3
- package/dist/runtime/server/services/parallel/types.d.ts +5 -2
- package/dist/runtime/server/services/parallel/worker-pool.d.ts +5 -9
- package/dist/runtime/server/services/parallel/worker-pool.js +167 -57
- package/dist/runtime/server/services/parallel/worker.d.ts +8 -5
- package/dist/runtime/server/services/parallel/worker.js +8 -5
- package/dist/runtime/server/services/persistence.service.js +3 -3
- package/dist/runtime/server/services/ports/command-execution.port.d.ts +7 -0
- package/dist/runtime/server/services/ports/principal.port.d.ts +1 -1
- package/dist/runtime/server/services/remote/remote-command.service.d.ts +1 -0
- package/dist/runtime/server/services/remote/remote-command.service.js +7 -3
- package/dist/runtime/server/services/remote/remote-player.service.d.ts +2 -2
- package/dist/runtime/server/services/remote/remote-player.service.js +3 -3
- package/dist/runtime/server/services/remote/server-bridge.js +2 -2
- package/dist/runtime/server/services/services.register.d.ts +2 -5
- package/dist/runtime/server/services/services.register.js +29 -41
- package/dist/runtime/server/services/vehicle-modification.service.js +1 -1
- package/dist/runtime/server/services/vehicle.service.d.ts +3 -3
- package/dist/runtime/server/services/vehicle.service.js +5 -5
- package/dist/runtime/server/setup.d.ts +2 -3
- package/dist/runtime/server/setup.js +10 -11
- package/dist/runtime/server/system/metadata-server.keys.d.ts +1 -1
- package/dist/runtime/server/system/metadata-server.keys.js +1 -1
- package/dist/runtime/server/system/processors/command.processor.js +4 -0
- package/dist/runtime/server/system/processors/export.processor.js +1 -1
- package/dist/runtime/server/system/processors/internalEvent.processor.js +1 -1
- package/dist/runtime/server/system/processors/netEvent.processor.js +8 -9
- package/dist/runtime/server/system/processors/{fivemEvent.processor.d.ts → runtimeEvent.processor.d.ts} +1 -1
- package/dist/runtime/server/system/processors/{fivemEvent.processor.js → runtimeEvent.processor.js} +8 -8
- package/dist/runtime/server/system/processors/tick.processor.js +1 -1
- package/dist/runtime/server/system/processors.register.js +16 -11
- package/dist/runtime/server/system/schema-generator.js +2 -2
- package/dist/runtime/server/types/core-exports.d.ts +6 -6
- package/dist/runtime/server/types/index.d.ts +1 -1
- package/dist/runtime/server/types/index.js +1 -1
- package/dist/runtime/server/types/internal-events.d.ts +1 -1
- package/dist/runtime/server/types/vehicle.types.d.ts +1 -1
- package/package.json +8 -16
- package/dist/adapters/contracts/IEntityServer.d.ts +0 -88
- package/dist/adapters/contracts/IEntityServer.js +0 -13
- package/dist/adapters/contracts/IPlayerServer.js +0 -13
- package/dist/adapters/database/oxmysql.adapter.d.ts +0 -89
- package/dist/adapters/database/oxmysql.adapter.js +0 -149
- package/dist/adapters/database/resource.adapter.d.ts +0 -12
- package/dist/adapters/database/resource.adapter.js +0 -68
- package/dist/kernel/shared/appearance/index.d.ts +0 -1
- package/dist/runtime/index.d.ts +0 -2
- package/dist/runtime/index.js +0 -39
- package/dist/runtime/server/bootstrap.validation.d.ts +0 -12
- package/dist/runtime/server/bootstrap.validation.js +0 -104
- package/dist/runtime/server/contracts/auth-provider.contract.d.ts +0 -58
- package/dist/runtime/server/contracts/auth-provider.contract.js +0 -23
- package/dist/runtime/server/contracts/repository/index.d.ts +0 -57
- package/dist/runtime/server/contracts/repository/index.js +0 -61
- package/dist/runtime/server/contracts/repository/repository.contract.d.ts +0 -224
- package/dist/runtime/server/contracts/repository/repository.contract.js +0 -341
- package/dist/runtime/server/contracts/repository/repository.types.d.ts +0 -51
- package/dist/runtime/server/contracts/repository/repository.types.js +0 -7
- package/dist/runtime/server/database/adapter.registry.d.ts +0 -4
- package/dist/runtime/server/database/adapter.registry.js +0 -14
- package/dist/runtime/server/database/database.contract.d.ts +0 -128
- package/dist/runtime/server/database/database.contract.js +0 -29
- package/dist/runtime/server/database/database.service.d.ts +0 -188
- package/dist/runtime/server/database/database.service.js +0 -287
- package/dist/runtime/server/database/index.d.ts +0 -5
- package/dist/runtime/server/database/index.js +0 -25
- package/dist/runtime/server/database/types.d.ts +0 -67
- package/dist/runtime/server/database/types.js +0 -7
- package/dist/runtime/server/database.d.ts +0 -7
- package/dist/runtime/server/devmode/hot-reload.server.d.ts +0 -74
- package/dist/runtime/server/devmode/hot-reload.server.js +0 -261
- package/dist/runtime/server/services/config.service.d.ts +0 -75
- package/dist/runtime/server/services/config.service.js +0 -116
- package/dist/runtime/server/services/http/http.service.d.ts +0 -50
- package/dist/runtime/server/services/http/http.service.js +0 -126
- /package/dist/adapters/contracts/{IPedAppearanceClient.js → client/IPedAppearanceClient.js} +0 -0
- /package/dist/adapters/contracts/{IPedAppearanceServer.d.ts → server/IPedAppearanceServer.d.ts} +0 -0
- /package/dist/adapters/contracts/{IPedAppearanceServer.js → server/IPedAppearanceServer.js} +0 -0
- /package/dist/adapters/contracts/{IVehicleServer.d.ts → server/IVehicleServer.d.ts} +0 -0
- /package/dist/adapters/contracts/{IVehicleServer.js → server/IVehicleServer.js} +0 -0
- /package/dist/kernel/{utils/error → error}/app.error.js +0 -0
- /package/dist/kernel/{shared/logger/transports/transport.interface.js → error/common.error-codes.js} +0 -0
- /package/dist/{runtime/server/types/security.types.js → kernel/error/framework.error-codes.js} +0 -0
- /package/dist/kernel/{utils/error → error}/security.error.js +0 -0
- /package/dist/{runtime/server/types → kernel/error}/security.types.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/index.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/index.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/logger.config.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/logger.config.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/logger.types.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/logger.types.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/buffered.transport.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/buffered.transport.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/console.transport.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/console.transport.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/dev-transport.factory.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/dev-transport.factory.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/http.transport.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/http.transport.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/index.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/index.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/simple-console.transport.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/simple-console.transport.js +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/transport.interface.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/websocket.transport.d.ts +0 -0
- /package/dist/kernel/{shared/logger → logger}/transports/websocket.transport.js +0 -0
- /package/dist/kernel/shared/{appearance/appearance.interface.d.ts → player-appearance.types.d.ts} +0 -0
- /package/dist/kernel/shared/{appearance/appearance.interface.js → player-appearance.types.js} +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
[](https://github.com/newcore-network/opencore/actions/workflows/ci.yml)
|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+
[](https://opencorejs.dev/docs/cli/introduction)
|
|
6
|
+
[](https://opencorejs.dev)
|
|
7
|
+
|
|
8
|
+
|
|
1
9
|
# OpenCore Framework - Open Stable beta
|
|
2
10
|
|
|
3
11
|
OpenCore is a TypeScript multiplayer runtime framework targeting FiveM via an adapter.
|
|
@@ -11,6 +19,8 @@ It is not a gamemode or RP framework. It provides:
|
|
|
11
19
|
|
|
12
20
|
License: MPL-2.0
|
|
13
21
|
|
|
22
|
+
[Discord Community](https://discord.gg/99g3FgvkPs) | [Website](https://opencorejs.dev) | [OpenCore CLI](https://github.com/newcore-network/opencore-cli)
|
|
23
|
+
|
|
14
24
|
## Scope
|
|
15
25
|
|
|
16
26
|
This package (`@open-core/framework`) contains transversal infrastructure only.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform capabilities contract.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Defines what features a platform supports, allowing runtime
|
|
6
|
+
* feature detection and graceful degradation across different
|
|
7
|
+
* game engines (FiveM, RageMP, alt:V, RedM, etc.)
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class IPlatformCapabilities {
|
|
10
|
+
/**
|
|
11
|
+
* Unique identifier for the platform.
|
|
12
|
+
* @example 'fivem', 'ragemp', 'altv', 'redm'
|
|
13
|
+
*/
|
|
14
|
+
abstract readonly platformName: string;
|
|
15
|
+
/**
|
|
16
|
+
* Human-readable display name.
|
|
17
|
+
* @example 'FiveM', 'RageMP', 'alt:V', 'RedM'
|
|
18
|
+
*/
|
|
19
|
+
abstract readonly displayName: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the platform supports routing buckets (virtual worlds/dimensions).
|
|
22
|
+
*/
|
|
23
|
+
abstract readonly supportsRoutingBuckets: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the platform supports state bags for entity synchronization.
|
|
26
|
+
*/
|
|
27
|
+
abstract readonly supportsStateBags: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the platform has native voice chat support.
|
|
30
|
+
*/
|
|
31
|
+
abstract readonly supportsVoiceChat: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Whether the platform supports server-side entity creation.
|
|
34
|
+
*/
|
|
35
|
+
abstract readonly supportsServerEntities: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Supported identifier types for this platform.
|
|
38
|
+
* @example ['steam', 'license', 'discord'] for FiveM
|
|
39
|
+
* @example ['socialclub', 'ip'] for RageMP
|
|
40
|
+
*/
|
|
41
|
+
abstract readonly identifierTypes: readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* Maximum number of players supported by the platform.
|
|
44
|
+
* Returns undefined if unlimited or unknown.
|
|
45
|
+
*/
|
|
46
|
+
abstract readonly maxPlayers: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Check if a specific feature is supported.
|
|
49
|
+
*
|
|
50
|
+
* @param feature - Feature identifier to check
|
|
51
|
+
* @returns true if the feature is supported
|
|
52
|
+
*/
|
|
53
|
+
abstract isFeatureSupported(feature: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get platform-specific configuration value.
|
|
56
|
+
*
|
|
57
|
+
* @param key - Configuration key
|
|
58
|
+
* @returns Configuration value or undefined
|
|
59
|
+
*/
|
|
60
|
+
abstract getConfig<T = unknown>(key: string): T | undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Well-known feature identifiers for cross-platform compatibility.
|
|
64
|
+
*/
|
|
65
|
+
export declare const PlatformFeatures: {
|
|
66
|
+
readonly ROUTING_BUCKETS: "routing_buckets";
|
|
67
|
+
readonly STATE_BAGS: "state_bags";
|
|
68
|
+
readonly VOICE_CHAT: "voice_chat";
|
|
69
|
+
readonly SERVER_ENTITIES: "server_entities";
|
|
70
|
+
readonly VEHICLE_MODS: "vehicle_mods";
|
|
71
|
+
readonly PED_APPEARANCE: "ped_appearance";
|
|
72
|
+
readonly WEAPON_COMPONENTS: "weapon_components";
|
|
73
|
+
readonly BLIPS: "blips";
|
|
74
|
+
readonly MARKERS: "markers";
|
|
75
|
+
readonly TEXT_LABELS: "text_labels";
|
|
76
|
+
readonly CHECKPOINTS: "checkpoints";
|
|
77
|
+
readonly COLSHAPES: "colshapes";
|
|
78
|
+
};
|
|
79
|
+
export type PlatformFeature = (typeof PlatformFeatures)[keyof typeof PlatformFeatures];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlatformFeatures = exports.IPlatformCapabilities = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Platform capabilities contract.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Defines what features a platform supports, allowing runtime
|
|
9
|
+
* feature detection and graceful degradation across different
|
|
10
|
+
* game engines (FiveM, RageMP, alt:V, RedM, etc.)
|
|
11
|
+
*/
|
|
12
|
+
class IPlatformCapabilities {
|
|
13
|
+
}
|
|
14
|
+
exports.IPlatformCapabilities = IPlatformCapabilities;
|
|
15
|
+
/**
|
|
16
|
+
* Well-known feature identifiers for cross-platform compatibility.
|
|
17
|
+
*/
|
|
18
|
+
exports.PlatformFeatures = {
|
|
19
|
+
ROUTING_BUCKETS: 'routing_buckets',
|
|
20
|
+
STATE_BAGS: 'state_bags',
|
|
21
|
+
VOICE_CHAT: 'voice_chat',
|
|
22
|
+
SERVER_ENTITIES: 'server_entities',
|
|
23
|
+
VEHICLE_MODS: 'vehicle_mods',
|
|
24
|
+
PED_APPEARANCE: 'ped_appearance',
|
|
25
|
+
WEAPON_COMPONENTS: 'weapon_components',
|
|
26
|
+
BLIPS: 'blips',
|
|
27
|
+
MARKERS: 'markers',
|
|
28
|
+
TEXT_LABELS: 'text_labels',
|
|
29
|
+
CHECKPOINTS: 'checkpoints',
|
|
30
|
+
COLSHAPES: 'colshapes',
|
|
31
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Vector3 } from '../../kernel';
|
|
2
2
|
export declare abstract class IPlayerInfo {
|
|
3
3
|
abstract getPlayerName(clientId: number): string | null;
|
|
4
|
-
abstract getPlayerPosition(clientId: number): Vector3
|
|
4
|
+
abstract getPlayerPosition(clientId: number): Vector3;
|
|
5
5
|
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { Vector3 } from '../../../kernel/utils/vector3';
|
|
2
|
+
/**
|
|
3
|
+
* Options for setting entity position.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Platform-specific options can be passed via the `platformOptions` field.
|
|
7
|
+
* Each platform adapter interprets these options according to its capabilities.
|
|
8
|
+
*/
|
|
9
|
+
export interface SetPositionOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Whether to keep the entity alive during teleport.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
keepAlive?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether to clear the area around the new position.
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
clearArea?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Platform-specific options.
|
|
22
|
+
* @example { ragdollFlag: false, deadFlag: false } for FiveM
|
|
23
|
+
*/
|
|
24
|
+
platformOptions?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Server-side entity operations adapter.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Abstracts entity natives for server-side operations across different platforms.
|
|
31
|
+
* Allows the runtime to work without direct platform dependencies.
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class IEntityServer {
|
|
34
|
+
/**
|
|
35
|
+
* Checks if an entity exists.
|
|
36
|
+
* @param handle - Entity handle
|
|
37
|
+
*/
|
|
38
|
+
abstract doesExist(handle: number): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Gets entity coordinates.
|
|
41
|
+
* @param handle - Entity handle
|
|
42
|
+
*/
|
|
43
|
+
abstract getCoords(handle: number): Vector3;
|
|
44
|
+
/**
|
|
45
|
+
* Sets entity coordinates using the new simplified API.
|
|
46
|
+
*
|
|
47
|
+
* @param handle - Entity handle
|
|
48
|
+
* @param position - Target position
|
|
49
|
+
* @param options - Optional positioning options
|
|
50
|
+
*/
|
|
51
|
+
abstract setPosition(handle: number, position: Vector3, options?: SetPositionOptions): void;
|
|
52
|
+
/**
|
|
53
|
+
* Sets entity coordinates.
|
|
54
|
+
*
|
|
55
|
+
* @deprecated Use setPosition() instead for cross-platform compatibility.
|
|
56
|
+
* This method is kept for backward compatibility and FiveM-specific use cases.
|
|
57
|
+
*
|
|
58
|
+
* @param handle - Entity handle
|
|
59
|
+
* @param x - X coordinate
|
|
60
|
+
* @param y - Y coordinate
|
|
61
|
+
* @param z - Z coordinate
|
|
62
|
+
* @param alive - Keep alive flag (FiveM specific)
|
|
63
|
+
* @param deadFlag - Dead flag (FiveM specific)
|
|
64
|
+
* @param ragdollFlag - Ragdoll flag (FiveM specific)
|
|
65
|
+
* @param clearArea - Clear area flag
|
|
66
|
+
*/
|
|
67
|
+
abstract setCoords(handle: number, x: number, y: number, z: number, alive?: boolean, deadFlag?: boolean, ragdollFlag?: boolean, clearArea?: boolean): void;
|
|
68
|
+
/**
|
|
69
|
+
* Gets entity heading (rotation on Z axis).
|
|
70
|
+
* @param handle - Entity handle
|
|
71
|
+
*/
|
|
72
|
+
abstract getHeading(handle: number): number;
|
|
73
|
+
/**
|
|
74
|
+
* Sets entity heading (rotation on Z axis).
|
|
75
|
+
* @param handle - Entity handle
|
|
76
|
+
* @param heading - Heading in degrees (0-360)
|
|
77
|
+
*/
|
|
78
|
+
abstract setHeading(handle: number, heading: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Gets entity model hash.
|
|
81
|
+
* @param handle - Entity handle
|
|
82
|
+
*/
|
|
83
|
+
abstract getModel(handle: number): number;
|
|
84
|
+
/**
|
|
85
|
+
* Deletes an entity.
|
|
86
|
+
* @param handle - Entity handle
|
|
87
|
+
*/
|
|
88
|
+
abstract delete(handle: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Sets entity orphan mode (what happens when script stops).
|
|
91
|
+
*
|
|
92
|
+
* @param handle - Entity handle
|
|
93
|
+
* @param mode - Orphan mode (platform-specific values)
|
|
94
|
+
* - FiveM: 0 = delete, 1 = keep, 2 = keep until restart
|
|
95
|
+
*/
|
|
96
|
+
abstract setOrphanMode(handle: number, mode: number): void;
|
|
97
|
+
/**
|
|
98
|
+
* Sets entity routing bucket (virtual world/dimension).
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* Not all platforms support routing buckets.
|
|
102
|
+
* Use IPlatformCapabilities.supportsRoutingBuckets to check support.
|
|
103
|
+
*
|
|
104
|
+
* @param handle - Entity handle
|
|
105
|
+
* @param bucket - Routing bucket ID
|
|
106
|
+
*/
|
|
107
|
+
abstract setRoutingBucket(handle: number, bucket: number): void;
|
|
108
|
+
/**
|
|
109
|
+
* Gets entity routing bucket (virtual world/dimension).
|
|
110
|
+
* @param handle - Entity handle
|
|
111
|
+
* @returns Routing bucket ID (0 is default world)
|
|
112
|
+
*/
|
|
113
|
+
abstract getRoutingBucket(handle: number): number;
|
|
114
|
+
/**
|
|
115
|
+
* Gets the state bag interface for an entity.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* Not all platforms support state bags.
|
|
119
|
+
* Use IPlatformCapabilities.supportsStateBags to check support.
|
|
120
|
+
*
|
|
121
|
+
* @param handle - Entity handle
|
|
122
|
+
*/
|
|
123
|
+
abstract getStateBag(handle: number): EntityStateBag;
|
|
124
|
+
/**
|
|
125
|
+
* Gets entity health.
|
|
126
|
+
* @param handle - Entity handle
|
|
127
|
+
* @returns Health value (platform-specific range)
|
|
128
|
+
*/
|
|
129
|
+
abstract getHealth(handle: number): number;
|
|
130
|
+
/**
|
|
131
|
+
* Sets entity health.
|
|
132
|
+
* @param handle - Entity handle
|
|
133
|
+
* @param health - Health value
|
|
134
|
+
*/
|
|
135
|
+
abstract setHealth(handle: number, health: number): void;
|
|
136
|
+
/**
|
|
137
|
+
* Gets entity armor.
|
|
138
|
+
* @param handle - Entity handle
|
|
139
|
+
* @returns Armor value (typically 0-100)
|
|
140
|
+
*/
|
|
141
|
+
abstract getArmor(handle: number): number;
|
|
142
|
+
/**
|
|
143
|
+
* Sets entity armor.
|
|
144
|
+
* @param handle - Entity handle
|
|
145
|
+
* @param armor - Armor value
|
|
146
|
+
*/
|
|
147
|
+
abstract setArmor(handle: number, armor: number): void;
|
|
148
|
+
/**
|
|
149
|
+
* Gets entity dimension (alias for getRoutingBucket).
|
|
150
|
+
*
|
|
151
|
+
* @remarks
|
|
152
|
+
* This is a cross-platform alias. Some platforms call it "dimension",
|
|
153
|
+
* others call it "routing bucket" or "virtual world".
|
|
154
|
+
*
|
|
155
|
+
* @param handle - Entity handle
|
|
156
|
+
* @returns Dimension ID
|
|
157
|
+
*/
|
|
158
|
+
getDimension(handle: number): number;
|
|
159
|
+
/**
|
|
160
|
+
* Sets entity dimension (alias for setRoutingBucket).
|
|
161
|
+
*
|
|
162
|
+
* @remarks
|
|
163
|
+
* This is a cross-platform alias. Some platforms call it "dimension",
|
|
164
|
+
* others call it "routing bucket" or "virtual world".
|
|
165
|
+
*
|
|
166
|
+
* @param handle - Entity handle
|
|
167
|
+
* @param dimension - Dimension ID
|
|
168
|
+
*/
|
|
169
|
+
setDimension(handle: number, dimension: number): void;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* State bag interface for entity state synchronization.
|
|
173
|
+
*/
|
|
174
|
+
export interface EntityStateBag {
|
|
175
|
+
/**
|
|
176
|
+
* Sets a value in the state bag.
|
|
177
|
+
*
|
|
178
|
+
* @param key - State key
|
|
179
|
+
* @param value - Value to set
|
|
180
|
+
* @param replicated - Whether to replicate to clients (default: true)
|
|
181
|
+
*/
|
|
182
|
+
set(key: string, value: unknown, replicated?: boolean): void;
|
|
183
|
+
/**
|
|
184
|
+
* Gets a value from the state bag.
|
|
185
|
+
* @param key - State key
|
|
186
|
+
*/
|
|
187
|
+
get(key: string): unknown;
|
|
188
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IEntityServer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Server-side entity operations adapter.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Abstracts entity natives for server-side operations across different platforms.
|
|
9
|
+
* Allows the runtime to work without direct platform dependencies.
|
|
10
|
+
*/
|
|
11
|
+
class IEntityServer {
|
|
12
|
+
/**
|
|
13
|
+
* Gets entity dimension (alias for getRoutingBucket).
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This is a cross-platform alias. Some platforms call it "dimension",
|
|
17
|
+
* others call it "routing bucket" or "virtual world".
|
|
18
|
+
*
|
|
19
|
+
* @param handle - Entity handle
|
|
20
|
+
* @returns Dimension ID
|
|
21
|
+
*/
|
|
22
|
+
getDimension(handle) {
|
|
23
|
+
return this.getRoutingBucket(handle);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets entity dimension (alias for setRoutingBucket).
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This is a cross-platform alias. Some platforms call it "dimension",
|
|
30
|
+
* others call it "routing bucket" or "virtual world".
|
|
31
|
+
*
|
|
32
|
+
* @param handle - Entity handle
|
|
33
|
+
* @param dimension - Dimension ID
|
|
34
|
+
*/
|
|
35
|
+
setDimension(handle, dimension) {
|
|
36
|
+
this.setRoutingBucket(handle, dimension);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.IEntityServer = IEntityServer;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type { PlayerIdentifier } from '../types/identifier';
|
|
1
2
|
/**
|
|
2
3
|
* Server-side player operations adapter.
|
|
3
4
|
*
|
|
4
5
|
* @remarks
|
|
5
|
-
* Abstracts
|
|
6
|
-
* Allows the runtime to work without direct
|
|
6
|
+
* Abstracts player natives for server-side operations across different platforms.
|
|
7
|
+
* Allows the runtime to work without direct platform dependencies.
|
|
7
8
|
*/
|
|
8
9
|
export declare abstract class IPlayerServer {
|
|
9
10
|
/**
|
|
10
|
-
* Gets the ped handle for a player.
|
|
11
|
+
* Gets the ped/character handle for a player.
|
|
11
12
|
*
|
|
12
13
|
* @param playerSrc - Player source/client ID (as string)
|
|
13
14
|
* @returns Ped entity handle
|
|
@@ -29,12 +30,21 @@ export declare abstract class IPlayerServer {
|
|
|
29
30
|
*/
|
|
30
31
|
abstract getIdentifier(playerSrc: string, identifierType: string): string | undefined;
|
|
31
32
|
/**
|
|
32
|
-
* Gets all identifiers for a player.
|
|
33
|
+
* Gets all identifiers for a player as raw strings.
|
|
34
|
+
*
|
|
35
|
+
* @deprecated Use getPlayerIdentifiers() for structured identifier data.
|
|
33
36
|
*
|
|
34
37
|
* @param playerSrc - Player source/client ID (as string)
|
|
35
|
-
* @returns Array of identifier strings
|
|
38
|
+
* @returns Array of identifier strings (e.g., ['steam:xxx', 'license:xxx'])
|
|
36
39
|
*/
|
|
37
40
|
abstract getIdentifiers(playerSrc: string): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Gets all identifiers for a player as structured objects.
|
|
43
|
+
*
|
|
44
|
+
* @param playerSrc - Player source/client ID (as string)
|
|
45
|
+
* @returns Array of PlayerIdentifier objects
|
|
46
|
+
*/
|
|
47
|
+
abstract getPlayerIdentifiers(playerSrc: string): PlayerIdentifier[];
|
|
38
48
|
/**
|
|
39
49
|
* Gets the number of player identifiers.
|
|
40
50
|
*
|
|
@@ -43,14 +53,14 @@ export declare abstract class IPlayerServer {
|
|
|
43
53
|
*/
|
|
44
54
|
abstract getNumIdentifiers(playerSrc: string): number;
|
|
45
55
|
/**
|
|
46
|
-
* Gets player name.
|
|
56
|
+
* Gets player display name.
|
|
47
57
|
*
|
|
48
58
|
* @param playerSrc - Player source/client ID (as string)
|
|
49
59
|
* @returns Player name
|
|
50
60
|
*/
|
|
51
61
|
abstract getName(playerSrc: string): string;
|
|
52
62
|
/**
|
|
53
|
-
* Gets player ping.
|
|
63
|
+
* Gets player ping/latency.
|
|
54
64
|
*
|
|
55
65
|
* @param playerSrc - Player source/client ID (as string)
|
|
56
66
|
* @returns Ping in milliseconds
|
|
@@ -64,20 +74,53 @@ export declare abstract class IPlayerServer {
|
|
|
64
74
|
*/
|
|
65
75
|
abstract getEndpoint(playerSrc: string): string;
|
|
66
76
|
/**
|
|
67
|
-
* Sets player routing bucket.
|
|
77
|
+
* Sets player routing bucket (virtual world/dimension).
|
|
78
|
+
*
|
|
79
|
+
* @remarks
|
|
80
|
+
* Not all platforms support routing buckets.
|
|
81
|
+
* Use IPlatformCapabilities.supportsRoutingBuckets to check support.
|
|
68
82
|
*
|
|
69
83
|
* @param playerSrc - Player source/client ID (as string)
|
|
70
84
|
* @param bucket - Routing bucket ID
|
|
71
85
|
*/
|
|
72
86
|
abstract setRoutingBucket(playerSrc: string, bucket: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* Gets player routing bucket (virtual world/dimension).
|
|
89
|
+
*
|
|
90
|
+
* @param playerSrc - Player source/client ID (as string)
|
|
91
|
+
* @returns Routing bucket ID (0 is default world)
|
|
92
|
+
*/
|
|
93
|
+
abstract getRoutingBucket(playerSrc: string): number;
|
|
73
94
|
/**
|
|
74
95
|
* Gets all currently connected player sources.
|
|
75
96
|
*
|
|
76
97
|
* @remarks
|
|
77
|
-
* Returns the source IDs (as strings) of all players currently connected
|
|
98
|
+
* Returns the source IDs (as strings) of all players currently connected.
|
|
78
99
|
* Used for session recovery after resource restarts.
|
|
79
100
|
*
|
|
80
101
|
* @returns Array of player source strings
|
|
81
102
|
*/
|
|
82
103
|
abstract getConnectedPlayers(): string[];
|
|
104
|
+
/**
|
|
105
|
+
* Gets player dimension (alias for getRoutingBucket).
|
|
106
|
+
*
|
|
107
|
+
* @remarks
|
|
108
|
+
* Cross-platform alias. Some platforms call it "dimension",
|
|
109
|
+
* others call it "routing bucket" or "virtual world".
|
|
110
|
+
*
|
|
111
|
+
* @param playerSrc - Player source/client ID (as string)
|
|
112
|
+
* @returns Dimension ID
|
|
113
|
+
*/
|
|
114
|
+
getDimension(playerSrc: string): number;
|
|
115
|
+
/**
|
|
116
|
+
* Sets player dimension (alias for setRoutingBucket).
|
|
117
|
+
*
|
|
118
|
+
* @remarks
|
|
119
|
+
* Cross-platform alias. Some platforms call it "dimension",
|
|
120
|
+
* others call it "routing bucket" or "virtual world".
|
|
121
|
+
*
|
|
122
|
+
* @param playerSrc - Player source/client ID (as string)
|
|
123
|
+
* @param dimension - Dimension ID
|
|
124
|
+
*/
|
|
125
|
+
setDimension(playerSrc: string, dimension: number): void;
|
|
83
126
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IPlayerServer = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Server-side player operations adapter.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* Abstracts player natives for server-side operations across different platforms.
|
|
9
|
+
* Allows the runtime to work without direct platform dependencies.
|
|
10
|
+
*/
|
|
11
|
+
class IPlayerServer {
|
|
12
|
+
/**
|
|
13
|
+
* Gets player dimension (alias for getRoutingBucket).
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Cross-platform alias. Some platforms call it "dimension",
|
|
17
|
+
* others call it "routing bucket" or "virtual world".
|
|
18
|
+
*
|
|
19
|
+
* @param playerSrc - Player source/client ID (as string)
|
|
20
|
+
* @returns Dimension ID
|
|
21
|
+
*/
|
|
22
|
+
getDimension(playerSrc) {
|
|
23
|
+
return this.getRoutingBucket(playerSrc);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets player dimension (alias for setRoutingBucket).
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Cross-platform alias. Some platforms call it "dimension",
|
|
30
|
+
* others call it "routing bucket" or "virtual world".
|
|
31
|
+
*
|
|
32
|
+
* @param playerSrc - Player source/client ID (as string)
|
|
33
|
+
* @param dimension - Dimension ID
|
|
34
|
+
*/
|
|
35
|
+
setDimension(playerSrc, dimension) {
|
|
36
|
+
this.setRoutingBucket(playerSrc, dimension);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.IPlayerServer = IPlayerServer;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic player identifier structure.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Platform-agnostic representation of player identifiers.
|
|
6
|
+
* Different platforms use different identifier systems:
|
|
7
|
+
* - FiveM: steam, license, discord, fivem, ip
|
|
8
|
+
* - RageMP: socialclub, ip
|
|
9
|
+
* - alt:V: socialclub, hwid, ip
|
|
10
|
+
*/
|
|
11
|
+
export interface PlayerIdentifier {
|
|
12
|
+
/**
|
|
13
|
+
* Identifier type.
|
|
14
|
+
* @example 'steam', 'license', 'discord', 'socialclub', 'hwid'
|
|
15
|
+
*/
|
|
16
|
+
type: string;
|
|
17
|
+
/**
|
|
18
|
+
* Raw identifier value (without the type prefix).
|
|
19
|
+
* @example '110000100000001' (steam ID)
|
|
20
|
+
*/
|
|
21
|
+
value: string;
|
|
22
|
+
/**
|
|
23
|
+
* Full identifier string as provided by the platform.
|
|
24
|
+
* @example 'steam:110000100000001'
|
|
25
|
+
*/
|
|
26
|
+
raw: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Well-known identifier types across platforms.
|
|
30
|
+
*/
|
|
31
|
+
export declare const IdentifierTypes: {
|
|
32
|
+
readonly STEAM: "steam";
|
|
33
|
+
readonly IP: "ip";
|
|
34
|
+
readonly LICENSE: "license";
|
|
35
|
+
readonly LICENSE2: "license2";
|
|
36
|
+
readonly DISCORD: "discord";
|
|
37
|
+
readonly FIVEM: "fivem";
|
|
38
|
+
readonly XBL: "xbl";
|
|
39
|
+
readonly LIVE: "live";
|
|
40
|
+
readonly SOCIAL_CLUB: "socialclub";
|
|
41
|
+
readonly HWID: "hwid";
|
|
42
|
+
readonly ROCKSTAR: "rockstar";
|
|
43
|
+
};
|
|
44
|
+
export type IdentifierType = (typeof IdentifierTypes)[keyof typeof IdentifierTypes];
|
|
45
|
+
/**
|
|
46
|
+
* Parse a raw identifier string into a PlayerIdentifier.
|
|
47
|
+
*
|
|
48
|
+
* @param raw - Raw identifier string (e.g., 'steam:110000100000001')
|
|
49
|
+
* @returns Parsed identifier or null if invalid format
|
|
50
|
+
*/
|
|
51
|
+
export declare function parseIdentifier(raw: string): PlayerIdentifier | null;
|
|
52
|
+
/**
|
|
53
|
+
* Create a raw identifier string from type and value.
|
|
54
|
+
*
|
|
55
|
+
* @param type - Identifier type
|
|
56
|
+
* @param value - Identifier value
|
|
57
|
+
* @returns Raw identifier string
|
|
58
|
+
*/
|
|
59
|
+
export declare function createIdentifier(type: string, value: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Find an identifier by type from a list.
|
|
62
|
+
*
|
|
63
|
+
* @param identifiers - List of identifiers
|
|
64
|
+
* @param type - Type to find
|
|
65
|
+
* @returns The identifier or undefined
|
|
66
|
+
*/
|
|
67
|
+
export declare function findIdentifierByType(identifiers: PlayerIdentifier[], type: string): PlayerIdentifier | undefined;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdentifierTypes = void 0;
|
|
4
|
+
exports.parseIdentifier = parseIdentifier;
|
|
5
|
+
exports.createIdentifier = createIdentifier;
|
|
6
|
+
exports.findIdentifierByType = findIdentifierByType;
|
|
7
|
+
/**
|
|
8
|
+
* Well-known identifier types across platforms.
|
|
9
|
+
*/
|
|
10
|
+
exports.IdentifierTypes = {
|
|
11
|
+
// Common across multiple platforms
|
|
12
|
+
STEAM: 'steam',
|
|
13
|
+
IP: 'ip',
|
|
14
|
+
// FiveM specific
|
|
15
|
+
LICENSE: 'license',
|
|
16
|
+
LICENSE2: 'license2',
|
|
17
|
+
DISCORD: 'discord',
|
|
18
|
+
FIVEM: 'fivem',
|
|
19
|
+
XBL: 'xbl',
|
|
20
|
+
LIVE: 'live',
|
|
21
|
+
// RageMP / alt:V specific
|
|
22
|
+
SOCIAL_CLUB: 'socialclub',
|
|
23
|
+
HWID: 'hwid',
|
|
24
|
+
// RedM specific
|
|
25
|
+
ROCKSTAR: 'rockstar',
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Parse a raw identifier string into a PlayerIdentifier.
|
|
29
|
+
*
|
|
30
|
+
* @param raw - Raw identifier string (e.g., 'steam:110000100000001')
|
|
31
|
+
* @returns Parsed identifier or null if invalid format
|
|
32
|
+
*/
|
|
33
|
+
function parseIdentifier(raw) {
|
|
34
|
+
const colonIndex = raw.indexOf(':');
|
|
35
|
+
if (colonIndex === -1) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const type = raw.substring(0, colonIndex);
|
|
39
|
+
const value = raw.substring(colonIndex + 1);
|
|
40
|
+
if (!type || !value) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return { type, value, raw };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a raw identifier string from type and value.
|
|
47
|
+
*
|
|
48
|
+
* @param type - Identifier type
|
|
49
|
+
* @param value - Identifier value
|
|
50
|
+
* @returns Raw identifier string
|
|
51
|
+
*/
|
|
52
|
+
function createIdentifier(type, value) {
|
|
53
|
+
return `${type}:${value}`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Find an identifier by type from a list.
|
|
57
|
+
*
|
|
58
|
+
* @param identifiers - List of identifiers
|
|
59
|
+
* @param type - Type to find
|
|
60
|
+
* @returns The identifier or undefined
|
|
61
|
+
*/
|
|
62
|
+
function findIdentifierByType(identifiers, type) {
|
|
63
|
+
return identifiers.find((id) => id.type === type);
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './identifier';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./identifier"), exports);
|