├── .dockerignore ├── .github └── workflows │ ├── ci.yml │ └── community.js ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── docs ├── .vitepress │ ├── cache │ │ └── deps │ │ │ ├── _metadata.json │ │ │ ├── package.json │ │ │ ├── vue.js │ │ │ └── vue.js.map │ ├── config.js │ └── theme │ │ ├── components │ │ ├── PathTo.vue │ │ ├── Playground.vue │ │ ├── PreferenceSwitch.vue │ │ ├── Type.vue │ │ ├── Video.vue │ │ └── preferences.ts │ │ └── index.js ├── advanced │ ├── agones.md │ ├── auth.md │ ├── create-plugin.md │ ├── event-changes.md │ ├── listen-param-client.md │ └── spritesheet.md ├── api-gui │ ├── react.md │ └── vue-directive.md ├── api │ └── readme.md ├── classes │ ├── client-engine.md │ ├── client.md │ ├── event.md │ ├── gui.md │ ├── keyboard.md │ ├── map.md │ ├── player.md │ ├── resource.md │ ├── scene-map-server.md │ ├── scene-map.md │ ├── server-engine.md │ ├── server.md │ ├── shape.md │ ├── sound.md │ ├── sprite.md │ ├── spritesheet.md │ ├── tests.md │ ├── vue-inject.md │ ├── world-maps.md │ └── world.md ├── commands │ ├── battle.md │ ├── class.md │ ├── common.md │ ├── components.md │ ├── effect.md │ ├── element.md │ ├── gold.md │ ├── gui.md │ ├── item.md │ ├── move.md │ ├── parameter.md │ ├── skill.md │ ├── state.md │ └── variable.md ├── database │ ├── actor.md │ ├── armor.md │ ├── class.md │ ├── effect.md │ ├── element.md │ ├── item.md │ ├── skill.md │ ├── state.md │ └── weapon.md ├── demo.png ├── extract.js ├── functions │ └── inject.md ├── gui │ ├── _trigger-tooltip.md │ ├── create-menu.md │ ├── notification-gui.md │ ├── react-app.md │ ├── react-tooltip.md │ ├── react.md │ ├── reuse-gui.md │ ├── theme.md │ └── tooltip.md ├── guide │ ├── animation-tile.md │ ├── api-preference.md │ ├── autoload.md │ ├── component.md │ ├── configuration.md │ ├── create-database.md │ ├── create-event.md │ ├── create-gui.md │ ├── create-map.md │ ├── create-module.md │ ├── create-shape.md │ ├── create-sound.md │ ├── create-sprite.md │ ├── create-tileset.md │ ├── create-world-maps.md │ ├── env.md │ ├── gamepad.md │ ├── get-started.md │ ├── inputs.md │ ├── performance.md │ ├── player-start.md │ ├── production.md │ ├── pwa.md │ ├── readme.md │ ├── responsive-design.md │ ├── save.md │ ├── structure.md │ ├── synchronization.md │ ├── tailwindcss.md │ ├── unit-test.md │ └── upgrade.md ├── header.png ├── index.md ├── migration │ └── to-v4.md ├── others │ └── readme.md ├── package-lock.json ├── package.json ├── partials │ ├── prerequisites-data.md │ └── todo.md ├── plugins │ ├── character-select.md │ ├── chat.md │ ├── emotion-bubble.md │ ├── inventory-plugin.md │ ├── save.md │ └── title-screen.md ├── public │ └── assets │ │ ├── add-colission.png │ │ ├── add-shape.png │ │ ├── agones-diagram.jpg │ │ ├── anim-tile.png │ │ ├── animation-chara.png │ │ ├── animation.png │ │ ├── attach-shape.png │ │ ├── chara.png │ │ ├── component-multi.png │ │ ├── hpbar.png │ │ ├── hpbar2.png │ │ ├── hpbar3.png │ │ ├── hud.png │ │ ├── layer-overlay.png │ │ ├── layer-z.png │ │ ├── layers.png │ │ ├── map-sound.png │ │ ├── medieval.png │ │ ├── move-to.mp4 │ │ ├── name-hero.png │ │ ├── name.png │ │ ├── name2.png │ │ ├── new-tileset.png │ │ ├── overlay-problem-solved.png │ │ ├── overlay-problem.png │ │ ├── plugins │ │ ├── character-select.png │ │ ├── chat.png │ │ ├── emotion.png │ │ ├── login.png │ │ ├── rpg-save-screen.png │ │ └── rpg-title-screen.png │ │ ├── precise-collision.png │ │ ├── rpgjs_gui.mp4 │ │ ├── rpgjs_world.mp4 │ │ ├── rpgjs_world_2.mp4 │ │ ├── select-tile.jpeg │ │ ├── set-colission.jpeg │ │ ├── shape-component.png │ │ ├── smartphone.png │ │ ├── start-event.png │ │ ├── start-event2.png │ │ ├── start-player.png │ │ ├── start-player2.png │ │ ├── tile-anim2.png │ │ ├── tiled-add-in-world.png │ │ ├── tiled-world-2.png │ │ ├── tiled-world.png │ │ ├── z-0.png │ │ ├── z-tile.png │ │ └── z-value.png ├── readme.md ├── specification │ └── fr │ │ ├── animation-chara.png │ │ ├── spec-autotile.png │ │ ├── spec-tileset.png │ │ ├── spec-tileset2.png │ │ ├── spritesheet-bad.png │ │ ├── spritesheet-ok.png │ │ ├── spritesheet.png │ │ └── tileset.md └── web3 │ └── auth.md ├── lerna.json ├── netlify.toml ├── package-lock.json ├── package.json ├── packages ├── client │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── rpg.toml │ ├── src │ │ ├── Components │ │ │ ├── AbstractComponent.ts │ │ │ ├── BarComponent.ts │ │ │ ├── Component.ts │ │ │ ├── DebugComponent.ts │ │ │ ├── ImageComponent.ts │ │ │ ├── ShapeComponent.ts │ │ │ ├── TextComponent.ts │ │ │ └── TileComponent.ts │ │ ├── Effects │ │ │ ├── Animation.ts │ │ │ ├── AnimationCharacter.ts │ │ │ ├── Spinner.ts │ │ │ ├── Timeline.ts │ │ │ └── TransitionScene.ts │ │ ├── GameEngine.ts │ │ ├── Gui │ │ │ ├── Gui.ts │ │ │ ├── React.ts │ │ │ └── Vue.ts │ │ ├── Interfaces │ │ │ ├── Character.ts │ │ │ └── Scene.ts │ │ ├── KeyboardControls.ts │ │ ├── Logger.ts │ │ ├── Presets │ │ │ ├── AnimationSpritesheet.ts │ │ │ └── Scene.ts │ │ ├── Renderer.ts │ │ ├── Resources.ts │ │ ├── RpgClient.ts │ │ ├── RpgClientEngine.ts │ │ ├── Scene │ │ │ ├── EventLayer.ts │ │ │ ├── Map.ts │ │ │ ├── Scene.ts │ │ │ └── SceneData.ts │ │ ├── Sound │ │ │ ├── RpgSound.ts │ │ │ ├── Sound.ts │ │ │ └── Sounds.ts │ │ ├── Sprite │ │ │ ├── Character.ts │ │ │ ├── Player.ts │ │ │ ├── Spritesheet.ts │ │ │ └── Spritesheets.ts │ │ ├── Tilemap │ │ │ ├── CommonLayer.ts │ │ │ ├── ImageLayer.ts │ │ │ ├── Tile.ts │ │ │ ├── TileLayer.ts │ │ │ ├── TileSet.ts │ │ │ └── index.ts │ │ ├── clientEntryPoint.ts │ │ ├── index.ts │ │ ├── inject.ts │ │ └── types │ │ │ └── howler.d.ts │ └── tsconfig.json ├── common │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── rpg.toml │ ├── src │ │ ├── AbstractObject.ts │ │ ├── Color.ts │ │ ├── DefaultInput.ts │ │ ├── Event.ts │ │ ├── EventEmitter.ts │ │ ├── Game.ts │ │ ├── Hit.ts │ │ ├── Inject.ts │ │ ├── Logger.ts │ │ ├── Map.ts │ │ ├── Module.ts │ │ ├── Player.ts │ │ ├── Plugin.ts │ │ ├── Scheduler.ts │ │ ├── Shape.ts │ │ ├── Utils.ts │ │ ├── Vector2d.ts │ │ ├── VirtualGrid.ts │ │ ├── Worker.ts │ │ ├── WorldMaps.ts │ │ ├── gui │ │ │ └── PrebuiltGui.ts │ │ ├── index.ts │ │ ├── transports │ │ │ └── io.ts │ │ └── workers │ │ │ └── move.ts │ └── tsconfig.json ├── compiler │ ├── CHANGELOG.md │ ├── __mocks__ │ │ └── image-size.ts │ ├── index.d.ts │ ├── package-lock.json │ ├── package.json │ ├── pnpm-lock.yaml │ ├── src │ │ ├── add │ │ │ ├── addToToml.ts │ │ │ └── index.ts │ │ ├── browser.ts │ │ ├── build │ │ │ ├── clean-dist.ts │ │ │ ├── client-config.ts │ │ │ ├── index.ts │ │ │ ├── load-config-file.ts │ │ │ ├── load-global-config.ts │ │ │ ├── utils.ts │ │ │ ├── vite-plugin-code-injector.ts │ │ │ ├── vite-plugin-config.toml.ts │ │ │ ├── vite-plugin-css.ts │ │ │ ├── vite-plugin-flag-transform.ts │ │ │ ├── vite-plugin-lib.ts │ │ │ ├── vite-plugin-map-extract.ts │ │ │ ├── vite-plugin-map-update.ts │ │ │ ├── vite-plugin-require.ts │ │ │ ├── vite-plugin-rpgjs-loader.ts │ │ │ ├── vite-plugin-tmx-tsx-mover.ts │ │ │ ├── vite-plugin-tsx-xml.ts │ │ │ └── vite-plugin-world-transform.ts │ │ ├── generate │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── jsonSchema │ │ │ ├── canvas.ts │ │ │ ├── compilation.ts │ │ │ ├── express.ts │ │ │ ├── index.ts │ │ │ ├── socket.ts │ │ │ └── vitest.ts │ │ ├── logs │ │ │ └── warning.ts │ │ ├── serve │ │ │ ├── api.ts │ │ │ ├── index.ts │ │ │ └── run-server.ts │ │ ├── setupFiles │ │ │ ├── canvas.ts │ │ │ ├── env.ts │ │ │ └── inject.ts │ │ ├── test │ │ │ ├── index.ts │ │ │ └── vitest.config.ts │ │ └── utils │ │ │ ├── json-schema.ts │ │ │ └── log.ts │ ├── tests │ │ ├── build.spec.ts │ │ ├── css.spec.ts │ │ ├── json-schema.spec.ts │ │ ├── load-config.spec.ts │ │ ├── toml.spec.ts │ │ └── vite-config.spec.ts │ ├── tsconfig.json │ ├── vite.config.ts │ └── vitest.config.ts ├── database │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── rpg.toml │ ├── src │ │ ├── actor.ts │ │ ├── armor.ts │ │ ├── class.ts │ │ ├── common.ts │ │ ├── effect.ts │ │ ├── enemy.ts │ │ ├── index.ts │ │ ├── interfaces │ │ │ ├── effects.ts │ │ │ ├── efficiency.ts │ │ │ ├── elements.ts │ │ │ ├── params-modifier.ts │ │ │ ├── states.ts │ │ │ └── types.ts │ │ ├── item.ts │ │ ├── skill.ts │ │ ├── state.ts │ │ └── weapon.ts │ └── tsconfig.json ├── plugins │ ├── agones │ │ ├── matchmaker │ │ │ ├── .dockerignore │ │ │ ├── Dockerfile │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── src │ │ │ │ ├── agones-api.ts │ │ │ │ ├── app.ts │ │ │ │ ├── server.ts │ │ │ │ └── service.ts │ │ │ ├── tests │ │ │ │ └── matchmaker-web.spec.ts │ │ │ ├── tsconfig.json │ │ │ └── yaml │ │ │ │ ├── fleet.yml │ │ │ │ ├── fleetautoscaler.yml │ │ │ │ └── gameserver.yml │ │ └── module │ │ │ ├── CHANGELOG.md │ │ │ ├── index.d.ts │ │ │ ├── package-lock.json │ │ │ ├── package.json │ │ │ ├── src │ │ │ ├── client.ts │ │ │ ├── index.ts │ │ │ ├── interfaces │ │ │ │ └── agones.ts │ │ │ ├── mmorpg.ts │ │ │ ├── redisStore.ts │ │ │ └── server.ts │ │ │ └── tests │ │ │ └── agones.spec.ts │ ├── auth │ │ ├── CHANGELOG.md │ │ ├── config.json │ │ ├── package-lock.json │ │ ├── package.json │ │ └── src │ │ │ ├── index.ts │ │ │ └── server │ │ │ ├── index.ts │ │ │ ├── mmorpg.ts │ │ │ └── web3 │ │ │ ├── nonce.ts │ │ │ └── verify.ts │ ├── chat │ │ ├── CHANGELOG.md │ │ ├── client │ │ │ ├── gui │ │ │ │ └── chat.vue │ │ │ ├── index.ts │ │ │ ├── map.ts │ │ │ └── sprite.ts │ │ ├── index.ts │ │ ├── mmorpg.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ └── server │ │ │ ├── index.ts │ │ │ └── player.ts │ ├── default-gui │ │ ├── CHANGELOG.md │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── rpg.toml │ │ ├── src │ │ │ ├── assets │ │ │ │ ├── controls │ │ │ │ │ └── back.png │ │ │ │ ├── fonts │ │ │ │ │ └── Lato │ │ │ │ │ │ ├── Lato-Black.ttf │ │ │ │ │ │ ├── Lato-BlackItalic.ttf │ │ │ │ │ │ ├── Lato-Bold.ttf │ │ │ │ │ │ ├── Lato-BoldItalic.ttf │ │ │ │ │ │ ├── Lato-Italic.ttf │ │ │ │ │ │ ├── Lato-Light.ttf │ │ │ │ │ │ ├── Lato-LightItalic.ttf │ │ │ │ │ │ ├── Lato-Regular.ttf │ │ │ │ │ │ ├── Lato-Thin.ttf │ │ │ │ │ │ ├── Lato-ThinItalic.ttf │ │ │ │ │ │ └── OFL.txt │ │ │ │ ├── icons │ │ │ │ │ ├── acid.svg │ │ │ │ │ ├── death-skull.svg │ │ │ │ │ ├── fire.svg │ │ │ │ │ ├── fireflake.svg │ │ │ │ │ ├── flake.svg │ │ │ │ │ ├── flamer.svg │ │ │ │ │ ├── katana.svg │ │ │ │ │ ├── key.svg │ │ │ │ │ ├── license.txt │ │ │ │ │ ├── medical-pack.svg │ │ │ │ │ ├── potion-ball.svg │ │ │ │ │ ├── sword-brandish.svg │ │ │ │ │ └── swords-power.svg │ │ │ │ ├── sounds.ts │ │ │ │ └── sounds │ │ │ │ │ ├── confirmation_002.ogg │ │ │ │ │ └── error_002.ogg │ │ │ ├── battle │ │ │ │ ├── layouts │ │ │ │ │ └── main.vue │ │ │ │ └── main.vue │ │ │ ├── client.ts │ │ │ ├── components │ │ │ │ ├── back.vue │ │ │ │ ├── bar.vue │ │ │ │ ├── hero.vue │ │ │ │ └── icon.vue │ │ │ ├── index.ts │ │ │ ├── menu │ │ │ │ ├── layouts │ │ │ │ │ ├── equipment.vue │ │ │ │ │ ├── item.vue │ │ │ │ │ ├── main.vue │ │ │ │ │ ├── save.vue │ │ │ │ │ └── status.vue │ │ │ │ └── main.vue │ │ │ ├── notifications │ │ │ │ ├── alert.vue │ │ │ │ └── disconnected.vue │ │ │ ├── shop │ │ │ │ └── main.vue │ │ │ ├── vue-shims.d.ts │ │ │ └── window │ │ │ │ ├── arrow.vue │ │ │ │ ├── choice.vue │ │ │ │ ├── dialog.vue │ │ │ │ └── window.vue │ │ └── tsconfig.json │ ├── emotion-bubbles │ │ ├── CHANGELOG.md │ │ ├── config.json │ │ ├── index.d.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── readme.md │ │ ├── src │ │ │ ├── client.ts │ │ │ ├── emotion.ts │ │ │ ├── index.ts │ │ │ ├── server.ts │ │ │ └── spritesheet │ │ │ │ ├── assets │ │ │ │ └── bubble.png │ │ │ │ └── bubble.ts │ │ └── tsconfig.json │ ├── fx │ │ ├── CHANGELOG.md │ │ ├── index.d.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── readme.md │ │ ├── src │ │ │ ├── assets │ │ │ │ └── default-bundle.zip │ │ │ ├── client.ts │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── gamepad │ │ ├── CHANGELOG.md │ │ ├── client │ │ │ ├── assets │ │ │ │ ├── confirmation_002.ogg │ │ │ │ ├── error_002.ogg │ │ │ │ └── gamepad.svg │ │ │ ├── index.ts │ │ │ └── sound.ts │ │ ├── config.json │ │ ├── index.ts │ │ ├── package-lock.json │ │ └── package.json │ ├── interpreter │ │ ├── CHANGELOG.md │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── readme.md │ │ ├── src │ │ │ ├── blocks │ │ │ │ ├── choice.ts │ │ │ │ ├── gold.ts │ │ │ │ ├── index.ts │ │ │ │ └── text.ts │ │ │ ├── format-message.ts │ │ │ ├── index.ts │ │ │ ├── interpreter.ts │ │ │ ├── types │ │ │ │ ├── block.ts │ │ │ │ ├── edge.ts │ │ │ │ └── group.ts │ │ │ └── validate.ts │ │ ├── tests │ │ │ ├── interpreter.spec.ts │ │ │ └── validate.spec.ts │ │ └── tsconfig.json │ ├── mobile-gui │ │ ├── CHANGELOG.md │ │ ├── package-lock.json │ │ ├── package.json │ │ └── src │ │ │ ├── assets │ │ │ ├── flatDark32.png │ │ │ └── flatDark35.png │ │ │ ├── client.ts │ │ │ ├── controls │ │ │ └── main.vue │ │ │ ├── index.ts │ │ │ ├── scene-map.ts │ │ │ └── vue-shims.d.ts │ ├── save │ │ ├── CHANGELOG.md │ │ ├── client │ │ │ ├── gui │ │ │ │ ├── load.vue │ │ │ │ ├── save.vue │ │ │ │ └── slots.vue │ │ │ ├── index.ts │ │ │ └── sprite.ts │ │ ├── index.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── rpg.toml │ │ └── server │ │ │ ├── index.ts │ │ │ └── player.ts │ ├── starter-kit │ │ ├── CHANGELOG.md │ │ ├── index.d.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ │ ├── client │ │ │ │ ├── animations │ │ │ │ │ ├── assets │ │ │ │ │ │ └── pipo-btleffect206_192.png │ │ │ │ │ └── index.ts │ │ │ │ ├── characters │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── Female 13-2.png │ │ │ │ │ │ ├── Female 19-3.png │ │ │ │ │ │ ├── Male 01-1.png │ │ │ │ │ │ ├── Male 01-2.png │ │ │ │ │ │ ├── Male 04-1.png │ │ │ │ │ │ ├── Male 12-2.png │ │ │ │ │ │ ├── Male 17-2.png │ │ │ │ │ │ └── chest.png │ │ │ │ │ ├── characters.ts │ │ │ │ │ ├── chest.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── images │ │ │ │ │ ├── assets │ │ │ │ │ │ └── perlin.jpg │ │ │ │ │ └── index.ts │ │ │ │ ├── index.ts │ │ │ │ ├── maps │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── LightShadow_pipo.png │ │ │ │ │ │ ├── [A]Dirt_pipo.png │ │ │ │ │ │ ├── [A]Flower_pipo.png │ │ │ │ │ │ ├── [A]Grass_pipo.png │ │ │ │ │ │ ├── [A]Wall-Up_pipo.png │ │ │ │ │ │ ├── [A]WaterFall_pipo.png │ │ │ │ │ │ ├── [A]Water_pipo.png │ │ │ │ │ │ ├── [Base]BaseChip_pipo.png │ │ │ │ │ │ └── [Base]BaseChip_pipo3.png │ │ │ │ │ └── medieval.ts │ │ │ │ └── sounds │ │ │ │ │ ├── assets │ │ │ │ │ ├── Town_Theme.ogg │ │ │ │ │ └── doorOpen_1.ogg │ │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── server │ │ │ │ ├── database │ │ │ │ ├── actors │ │ │ │ │ └── hero.ts │ │ │ │ ├── armors │ │ │ │ │ └── shield.ts │ │ │ │ ├── classes │ │ │ │ │ └── fighter.ts │ │ │ │ ├── index.ts │ │ │ │ ├── items │ │ │ │ │ ├── key.ts │ │ │ │ │ └── potion.ts │ │ │ │ ├── skills │ │ │ │ │ └── fire.ts │ │ │ │ ├── states │ │ │ │ │ └── paralyze.ts │ │ │ │ └── weapons │ │ │ │ │ └── sword.ts │ │ │ │ ├── events │ │ │ │ ├── chest.ts │ │ │ │ ├── npc.ts │ │ │ │ ├── shop.ts │ │ │ │ ├── villager1.ts │ │ │ │ └── villager2.ts │ │ │ │ ├── index.ts │ │ │ │ └── maps │ │ │ │ ├── cave.ts │ │ │ │ ├── mapz.ts │ │ │ │ ├── samplemap.ts │ │ │ │ └── tmx │ │ │ │ ├── LightShadow_pipo.tsx │ │ │ │ ├── [A]Dirt_pipo.tsx │ │ │ │ ├── [A]Flower_pipo.tsx │ │ │ │ ├── [A]Grass_pipo.tsx │ │ │ │ ├── [A]Wall-Up_pipo.tsx │ │ │ │ ├── [A]WaterFall_pipo.tsx │ │ │ │ ├── [A]Water_pipo.tsx │ │ │ │ ├── [Base]BaseChip_pipo.tsx │ │ │ │ ├── cave.tmx │ │ │ │ ├── mapz.tmx │ │ │ │ └── samplemap.tmx │ │ └── tsconfig.json │ ├── title-screen │ │ ├── CHANGELOG.md │ │ ├── config.json │ │ ├── index.d.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ │ ├── client │ │ │ │ ├── gui │ │ │ │ │ ├── assets │ │ │ │ │ │ └── default.png │ │ │ │ │ ├── connect.vue │ │ │ │ │ ├── create-account.vue │ │ │ │ │ └── title.vue │ │ │ │ ├── index.ts │ │ │ │ └── sprite.ts │ │ │ ├── index.ts │ │ │ └── server │ │ │ │ ├── index.ts │ │ │ │ ├── mmorpg │ │ │ │ ├── index.ts │ │ │ │ └── model.ts │ │ │ │ ├── player.ts │ │ │ │ └── rpg │ │ │ │ └── index.ts │ │ └── tsconfig.json │ └── web3 │ │ ├── CHANGELOG.md │ │ ├── config.json │ │ ├── index.d.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ ├── index.ts │ │ └── server │ │ │ ├── index.ts │ │ │ ├── mmorpg.ts │ │ │ └── web3manager.ts │ │ └── tsconfig.json ├── runtime │ ├── CHANGELOG.md │ ├── index.html │ ├── package.json │ ├── readme.md │ ├── rpg.toml │ └── runtime.ts ├── sample │ ├── CHANGELOG.md │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── rpg.json │ ├── src │ │ ├── client.ts │ │ ├── config │ │ │ ├── client │ │ │ │ ├── assets │ │ │ │ │ └── face.png │ │ │ │ ├── fonts │ │ │ │ │ └── Lato │ │ │ │ │ │ ├── Lato-Black.ttf │ │ │ │ │ │ ├── Lato-BlackItalic.ttf │ │ │ │ │ │ ├── Lato-Bold.ttf │ │ │ │ │ │ ├── Lato-BoldItalic.ttf │ │ │ │ │ │ ├── Lato-Italic.ttf │ │ │ │ │ │ ├── Lato-Light.ttf │ │ │ │ │ │ ├── Lato-LightItalic.ttf │ │ │ │ │ │ ├── Lato-Regular.ttf │ │ │ │ │ │ ├── Lato-Thin.ttf │ │ │ │ │ │ ├── Lato-ThinItalic.ttf │ │ │ │ │ │ └── OFL.txt │ │ │ │ ├── index.ts │ │ │ │ └── theme.scss │ │ │ ├── inputs.ts │ │ │ └── server │ │ │ │ └── index.ts │ │ ├── modules │ │ │ ├── index.ts │ │ │ └── main │ │ │ │ ├── client │ │ │ │ ├── animation.ts │ │ │ │ ├── assets │ │ │ │ │ ├── animation.png │ │ │ │ │ └── sky.png │ │ │ │ ├── characters │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── Female_13-2.png │ │ │ │ │ │ ├── Female_19-3.png │ │ │ │ │ │ ├── Jedi.png │ │ │ │ │ │ ├── Male 01-2.png │ │ │ │ │ │ ├── Male 04-1.png │ │ │ │ │ │ ├── Male 12-2.png │ │ │ │ │ │ ├── Male 17-2.png │ │ │ │ │ │ ├── Male_01-1.png │ │ │ │ │ │ ├── chest.png │ │ │ │ │ │ ├── kite_blue_blue.png │ │ │ │ │ │ └── light.png │ │ │ │ │ ├── characters.ts │ │ │ │ │ ├── chest.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ └── lpc.ts │ │ │ │ ├── gui │ │ │ │ │ ├── hp.vue │ │ │ │ │ └── tooltip.vue │ │ │ │ ├── index.ts │ │ │ │ ├── maps │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── BaseChip_pipo.png │ │ │ │ │ │ ├── Dirt_pipo.png │ │ │ │ │ │ ├── Flower_pipo.png │ │ │ │ │ │ ├── Grass_pipo.png │ │ │ │ │ │ ├── LightShadow_pipo.png │ │ │ │ │ │ ├── Wall-Up_pipo.png │ │ │ │ │ │ ├── WaterFall_pipo.png │ │ │ │ │ │ ├── Water_pipo.png │ │ │ │ │ │ └── [Base]BaseChip_pipo3.png │ │ │ │ │ └── medieval.ts │ │ │ │ ├── sounds │ │ │ │ │ ├── assets │ │ │ │ │ │ ├── Town_Theme.ogg │ │ │ │ │ │ └── doorOpen_1.ogg │ │ │ │ │ └── index.ts │ │ │ │ └── sprite.ts │ │ │ │ ├── index.ts │ │ │ │ └── server │ │ │ │ ├── cave.ts │ │ │ │ ├── index.ts │ │ │ │ ├── paralyse.ts │ │ │ │ ├── player.ts │ │ │ │ └── tmx │ │ │ │ ├── [A]Dirt_pipo.tsx │ │ │ │ ├── [A]Flower_pipo.tsx │ │ │ │ ├── [A]Grass_pipo.tsx │ │ │ │ ├── [A]WaterFall_pipo.tsx │ │ │ │ ├── [A]Water_pipo.tsx │ │ │ │ ├── [Base]BaseChip_pipo.tsx │ │ │ │ ├── cave.tmx │ │ │ │ ├── map-1-1.tmx │ │ │ │ ├── mapz.tmx │ │ │ │ ├── samplemap.tmx │ │ │ │ ├── untitled1.tmx │ │ │ │ ├── untitled2.tmx │ │ │ │ ├── untitled3.tmx │ │ │ │ ├── untitled4.tmx │ │ │ │ ├── untitled5.tmx │ │ │ │ └── world.world │ │ ├── server.ts │ │ └── standalone.ts │ ├── styles.css │ └── tsconfig.json ├── sample2 │ ├── .env │ ├── CHANGELOG.md │ ├── index.html │ ├── main │ │ ├── client.ts │ │ ├── database │ │ │ └── items │ │ │ │ └── Potion.ts │ │ ├── events │ │ │ └── npc.ts │ │ ├── gui │ │ │ ├── test.tsx │ │ │ ├── tooltip.tsx │ │ │ └── tooltip.vue │ │ ├── maps │ │ │ └── map.ts │ │ ├── player.ts │ │ ├── scene-map.ts │ │ ├── server.ts │ │ ├── sounds │ │ │ ├── theme.ogg │ │ │ └── theme.ts │ │ ├── sprite.ts │ │ ├── spritesheets │ │ │ ├── animations │ │ │ │ ├── animation.png │ │ │ │ └── animation.ts │ │ │ └── npc │ │ │ │ ├── female.png │ │ │ │ ├── male.png │ │ │ │ └── spritesheet.ts │ │ └── worlds │ │ │ ├── maps │ │ │ ├── base.png │ │ │ ├── map.tmx │ │ │ ├── map2.tmx │ │ │ └── tileset.tsx │ │ │ └── world.world │ ├── package-lock.json │ ├── package.json │ ├── plugin │ │ ├── index.ts │ │ └── server │ │ │ ├── index.ts │ │ │ └── player.ts │ ├── rpg.toml │ ├── styles.css │ └── tsconfig.json ├── sample3 │ ├── .eslintrc.cjs │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── index.html │ ├── package-lock.json │ ├── package.json │ ├── postcss.config.js │ ├── public │ │ └── vite.svg │ ├── rpg.toml │ ├── src │ │ ├── App.tsx │ │ ├── game │ │ │ └── main │ │ │ │ ├── characters │ │ │ │ ├── female.png │ │ │ │ ├── male.png │ │ │ │ └── spritesheet.ts │ │ │ │ ├── client.ts │ │ │ │ ├── gui │ │ │ │ └── test.tsx │ │ │ │ ├── maps │ │ │ │ ├── base.png │ │ │ │ ├── map.tmx │ │ │ │ └── tileset.tsx │ │ │ │ └── player.ts │ │ ├── index.css │ │ ├── main.tsx │ │ ├── pages │ │ │ └── signup.tsx │ │ ├── store │ │ │ └── auth.ts │ │ ├── vite-env.d.ts │ │ └── web3 │ │ │ ├── adapter.ts │ │ │ ├── config.ts │ │ │ ├── index.tsx │ │ │ └── wallet.tsx │ ├── tailwind.config.js │ ├── tsconfig.json │ └── tsconfig.node.json ├── server │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── rpg.toml │ ├── src │ │ ├── Game │ │ │ ├── EventManager.ts │ │ │ ├── Map.ts │ │ │ └── WorldMaps.ts │ │ ├── Gui │ │ │ ├── DialogGui.ts │ │ │ ├── Gui.ts │ │ │ ├── MenuGui.ts │ │ │ ├── NotificationGui.ts │ │ │ ├── ShopGui.ts │ │ │ └── index.ts │ │ ├── Interfaces │ │ │ ├── Gui.ts │ │ │ └── StateStore.ts │ │ ├── MatchMaker.ts │ │ ├── Monitor │ │ │ └── index.ts │ │ ├── Player │ │ │ ├── BattleManager.ts │ │ │ ├── ClassManager.ts │ │ │ ├── ComponentManager.ts │ │ │ ├── EffectManager.ts │ │ │ ├── ElementManager.ts │ │ │ ├── GoldManager.ts │ │ │ ├── GuiManager.ts │ │ │ ├── ItemFixture.ts │ │ │ ├── ItemManager.ts │ │ │ ├── MoveManager.ts │ │ │ ├── ParameterManager.ts │ │ │ ├── Player.ts │ │ │ ├── SkillManager.ts │ │ │ ├── StateManager.ts │ │ │ └── VariableManager.ts │ │ ├── Query.ts │ │ ├── RpgServer.ts │ │ ├── Scenes │ │ │ └── Map.ts │ │ ├── decorators │ │ │ ├── event.ts │ │ │ └── map.ts │ │ ├── entry-point.ts │ │ ├── express │ │ │ ├── api.ts │ │ │ ├── errors │ │ │ │ ├── NotAuthorized.ts │ │ │ │ └── NotFound.ts │ │ │ └── server.ts │ │ ├── index.ts │ │ ├── inject.ts │ │ ├── logs │ │ │ ├── index.ts │ │ │ ├── item.ts │ │ │ ├── log.ts │ │ │ ├── skill.ts │ │ │ └── state.ts │ │ ├── models │ │ │ └── Item.ts │ │ ├── presets │ │ │ └── index.ts │ │ └── server.ts │ └── tsconfig.json ├── standalone │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── rpg.toml │ └── src │ │ └── index.ts ├── testing │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── tiled │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── readme.md │ ├── src │ │ ├── classes │ │ │ ├── Gid.ts │ │ │ ├── Layer.ts │ │ │ ├── Map.ts │ │ │ ├── Object.ts │ │ │ ├── Properties.ts │ │ │ ├── Tile.ts │ │ │ └── Tileset.ts │ │ ├── generate │ │ │ ├── tileset.ts │ │ │ └── wangtile.ts │ │ ├── index.ts │ │ ├── parser │ │ │ ├── open-file.ts │ │ │ └── parser.ts │ │ ├── types │ │ │ ├── Layer.ts │ │ │ ├── Map.ts │ │ │ ├── Objects.ts │ │ │ ├── Text.ts │ │ │ ├── Tile.ts │ │ │ ├── Tileset.ts │ │ │ ├── Types.ts │ │ │ └── WorldMaps.ts │ │ └── utils.ts │ ├── tests │ │ ├── class.spec.ts │ │ ├── data.ts │ │ ├── parser.spec.ts │ │ ├── tiledmap-multi-layers.spec.ts │ │ └── tiledmap.spec.ts │ └── tsconfig.json └── types │ ├── CHANGELOG.md │ ├── package-lock.json │ ├── package.json │ ├── src │ ├── Component.ts │ ├── Hitbox.ts │ ├── Input.ts │ ├── Object.ts │ ├── Player.ts │ ├── Socket.ts │ ├── System.ts │ ├── Utils.ts │ └── index.ts │ └── tsconfig.json ├── readme.md ├── tests ├── load-testing │ ├── CHANGELOG.md │ ├── load.js │ ├── package-lock.json │ ├── package.json │ ├── random-move.js │ ├── reports │ │ └── 2022-24-01.md │ └── socket.yml └── unit-tests │ └── specs │ ├── animation.spec.ts │ ├── battle.spec.ts │ ├── beforeEach.ts │ ├── class.spec.ts │ ├── client-hooks.spec.ts │ ├── collision.spec.ts │ ├── component.spec.ts │ ├── control.spec.ts │ ├── database.spec.ts │ ├── effects.spec.ts │ ├── elements.spec.ts │ ├── event.spec.ts │ ├── fixtures │ ├── actor.ts │ ├── animation.ts │ ├── armor.ts │ ├── class.ts │ ├── control.ts │ ├── elements.ts │ ├── enemy.ts │ ├── gui │ │ ├── menu.vue │ │ └── tooltip.vue │ ├── item.ts │ ├── maps │ │ ├── BaseChip_pipo.png │ │ ├── BaseChip_pipo.tsx │ │ ├── map.tmx │ │ ├── map.ts │ │ ├── world.ts │ │ └── world │ │ │ ├── LightShadow_pipo.tsx │ │ │ ├── [Base]BaseChip_pipo.tsx │ │ │ ├── cave.tmx │ │ │ ├── samplemap.tmx │ │ │ ├── untitled1.tmx │ │ │ ├── untitled2.tmx │ │ │ ├── untitled3.tmx │ │ │ ├── untitled4.tmx │ │ │ └── untitled5.tmx │ ├── server.ts │ ├── shape.ts │ ├── skill.ts │ ├── sounds │ │ └── Town_Theme.ogg │ ├── spritesheets │ │ └── sample.png │ ├── state.ts │ └── weapons.ts │ ├── gui.spec.ts │ ├── item.spec.ts │ ├── map.spec.ts │ ├── move.spec.ts │ ├── player-camera.spec.ts │ ├── player-command.spec.ts │ ├── player-hooks.spec.ts │ ├── player-params.spec.ts │ ├── reconciliation.spec.ts │ ├── save.spec.ts │ ├── scene.spec.ts │ ├── server-hooks.spec.ts │ ├── shape.spec.ts │ ├── skill.spec.ts │ ├── sound.spec.ts │ ├── standalone.spec.ts │ ├── state.spec.ts │ ├── sync.spec.ts │ ├── timeline.spec.ts │ ├── utils.spec.ts │ ├── variable.spec.ts │ ├── virtual-grid.spec.ts │ ├── weapon-armor.spec.ts │ └── world-maps.spec.ts └── tsconfig.json /.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | **/dist 3 | **/lib 4 | lerna-debug.log -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | lib 4 | lerna-debug.log 5 | coverage 6 | packages/common/types 7 | docs/api/* 8 | docs/others/* 9 | !docs/api/readme.md 10 | !docs/others/readme.md 11 | cache 12 | packages/**/browser 13 | vitest.config.ts.timestamp* -------------------------------------------------------------------------------- /docs/.vitepress/cache/deps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module" 3 | } 4 | -------------------------------------------------------------------------------- /docs/.vitepress/cache/deps/vue.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "sources": [], 4 | "sourcesContent": [], 5 | "mappings": "", 6 | "names": [] 7 | } 8 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/components/Playground.vue: -------------------------------------------------------------------------------- 1 | 5 | 6 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/components/Type.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/components/Video.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /docs/.vitepress/theme/components/preferences.ts: -------------------------------------------------------------------------------- 1 | import { ref } from 'vue' 2 | 3 | export const inBrowser = typeof window !== 'undefined' 4 | 5 | if (!inBrowser) { 6 | global.localStorage = { 7 | getItem() { 8 | return null 9 | }, 10 | setItem() { 11 | return null 12 | }, 13 | } 14 | global.document = {} 15 | } 16 | 17 | 18 | const get = (key: string, defaultValue = true): boolean => { 19 | return inBrowser 20 | ? JSON.parse(localStorage.getItem(key) || String(defaultValue)) 21 | : defaultValue 22 | } 23 | 24 | export const preferAutoloadKey = 'vue-docs-prefer-autoload' 25 | export const preferAutoload = ref(get(preferAutoloadKey)) -------------------------------------------------------------------------------- /docs/.vitepress/theme/index.js: -------------------------------------------------------------------------------- 1 | import { h } from 'vue' 2 | import DefaultTheme from 'vitepress/theme' 3 | import PathTo from './components/PathTo.vue' 4 | import Video from './components/Video.vue' 5 | import Type from './components/Type.vue' 6 | import PreferenceSwitch from './components/PreferenceSwitch.vue' 7 | import Playground from './components/Playground.vue' 8 | 9 | export default { 10 | extends: DefaultTheme, 11 | Layout: () => { 12 | // @ts-ignore 13 | return h(DefaultTheme.Layout, null, { 14 | 'sidebar-nav-before': () => h(PreferenceSwitch), 15 | }) 16 | }, 17 | enhanceApp(ctx) { 18 | ctx.app.component('Playground', Playground) 19 | ctx.app.component('PathTo', PathTo) 20 | ctx.app.component('Video', Video) 21 | ctx.app.component('Type', Type) 22 | } 23 | } -------------------------------------------------------------------------------- /docs/advanced/event-changes.md: -------------------------------------------------------------------------------- 1 | # Modify an event according to an external situation 2 | 3 | ## Prerequisites 4 | 5 | - [Know how to create an event and attach it to a map](/guide/create-event.html) 6 | 7 | ## Goal 8 | 9 | Sometimes you have events that update themselves according to external events. Imagine the following scene: the hero presses a lever that opens a door. 10 | 11 | -------------------------------------------------------------------------------- /docs/advanced/spritesheet.md: -------------------------------------------------------------------------------- 1 | # Create more advanced spritesheets 2 | 3 | ## Prerequisites 4 | 5 | Have already created a Spritesheet 6 | 7 | ## SpriteSheet 8 | 9 | ![Animation Character](/assets/animation-chara.png) 10 | 11 | As you can see the animations are in several places on the image and there are several actions 12 | 13 | ---- 14 | Image Credit: [ArMM1998](https://opengameart.org/content/zelda-like-tilesets-and-sprites) -------------------------------------------------------------------------------- /docs/api-gui/vue-directive.md: -------------------------------------------------------------------------------- 1 | # Directive for VueJS 2 | 3 | ## `v-propagate` 4 | 5 | The `v-propagate` directive is straightforward to use. Simply add it to any element in your VueJS template to enable event propagation for that element within the RPGJS canvas. 6 | 7 | ### Example 8 | 9 | ```vue 10 | 15 | ``` 16 | 17 | In this example, the `v-propagate` directive is attached to a `div` element. Any events that occur within this `div` will be propagated through the RPGJS game canvas. This is particularly useful for integrating VueJS-based GUI elements with the RPGJS game canvas, allowing for seamless interaction between the GUI and the game. -------------------------------------------------------------------------------- /docs/api/readme.md: -------------------------------------------------------------------------------- 1 | API generated here -------------------------------------------------------------------------------- /docs/classes/client-engine.md: -------------------------------------------------------------------------------- 1 | # RpgClientEngine 2 | 3 | ## RpgEngineHooks 4 | 5 | ```ts 6 | import { RpgClientEngine, RpgClientEngineHooks } from '@rpgjs/client' 7 | 8 | const engine: RpgClientEngineHooks = { 9 | onConnected(engine: RpgClientEngine) { 10 | console.log('client is connected') 11 | } 12 | } 13 | ``` 14 | 15 | 16 | 17 | ## RpgClientEngine 18 | 19 | -------------------------------------------------------------------------------- /docs/classes/client.md: -------------------------------------------------------------------------------- 1 | # RpgClient 2 | 3 | ## RpgClient Entry Point 4 | 5 | You need to create a class that inherits RpgClientEngine 6 | 7 | ```ts 8 | import { entryPoint } from '@rpgjs/client' 9 | import modules from './to/path/modules' 10 | import io from 'socket.io-client' 11 | 12 | document.addEventListener('DOMContentLoaded', () => { 13 | entryPoint(modules, { io }).start() 14 | }) 15 | ``` 16 | 1. Use `entryPoint` to create an instance of `RpgClientEngine`. 17 | 2. Be sure to start the client part when the DOM is loaded. 18 | 19 | 20 | 21 | ## @RpgClient decorator 22 | 23 | -------------------------------------------------------------------------------- /docs/classes/gui.md: -------------------------------------------------------------------------------- 1 | # RpgGui 2 | 3 | ## List of Prebuilt GUI 4 | 5 | 6 | 7 | ## RpgGui API 8 | 9 | -------------------------------------------------------------------------------- /docs/classes/keyboard.md: -------------------------------------------------------------------------------- 1 | # KeyboardControls 2 | 3 | > You can access this instance from RpgClientEngine 4 | 5 | -------------------------------------------------------------------------------- /docs/classes/map.md: -------------------------------------------------------------------------------- 1 | # RpgMap 2 | 3 | ## @MapData decorator 4 | 5 | 6 | 7 | ## RpgMap Hooks 8 | 9 | Full Example: 10 | 11 | ```ts 12 | import { MapData, RpgMap, RpgPlayer } from '@rpgjs/server' 13 | 14 | @MapData({ 15 | id: 'medieval', 16 | file: require('./tmx/town.tmx') 17 | }) 18 | class TownMap extends RpgMap { 19 | // When map is loaded 20 | onLoad() {} 21 | 22 | // When the player enters the map 23 | onJoin(player: RpgPlayer) {} 24 | 25 | // When the player leaves the map 26 | onLeave(player: RpgPlayer) { 27 | super.onLeave(player) 28 | } 29 | } 30 | ``` 31 | 32 | ## RpgMap methods 33 | 34 | -------------------------------------------------------------------------------- /docs/classes/player.md: -------------------------------------------------------------------------------- 1 | # RpgPlayer 2 | 3 | An `RpgPlayer` instance is created each time a player is connected. In an event, you often find a `player` parameter of type `RpgPlayer`. You have a series of methods to apply to the player 4 | 5 | ```ts 6 | import { RpgPlayer, RpgPlayerHooks } from '@rpgjs/server' 7 | 8 | export const player: RpgPlayerHooks = { 9 | onConnected(player: RpgPlayer) { 10 | // Making instructions when the player is connected 11 | } 12 | } 13 | ``` 14 | 15 | [Then put the class in the RpgServer decorator.](/classes/server.html#playerclass) 16 | 17 | -------------------------------------------------------------------------------- /docs/classes/resource.md: -------------------------------------------------------------------------------- 1 | # RpgResource 2 | 3 | -------------------------------------------------------------------------------- /docs/classes/scene-map-server.md: -------------------------------------------------------------------------------- 1 | # RpgSceneMap 2 | 3 | ## Example to use (in module) 4 | 5 | ```ts 6 | import { RpgServer, RpgModule, RpgServerEngine } from '@rpgjs/server' 7 | 8 | @RpgModule({ 9 | engine: { 10 | onStart(engine: RpgServerEngine) { 11 | const sceneMap = engine.sceneMap 12 | sceneMap.createDynamicMap({ 13 | id: 'myid', 14 | file: require('./tmx/town.tmx') 15 | }) 16 | } 17 | } 18 | }) 19 | export default class RpgServerModuleEngine {} 20 | ``` 21 | 22 | ## API 23 | 24 | 25 | -------------------------------------------------------------------------------- /docs/classes/scene-map.md: -------------------------------------------------------------------------------- 1 | # RpgScene 2 | 3 | ## RpgScene Hooks 4 | 5 | [Put the created class in the RpgClient decorator](/classes/client.html#scenes) 6 | 7 | Example: 8 | 9 | ```ts 10 | import { RpgSceneMapHooks, RpgSceneMap } from '@rpgjs/client' 11 | 12 | const sceneMap: RpgSceneMapHooks = { 13 | onAfterLoading(scene: RpgSceneMap) { 14 | 15 | } 16 | } 17 | ``` 18 | 19 | 20 | 21 | ## RpgScene 22 | 23 | 24 | 25 | ## RpgSceneMap 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/classes/server-engine.md: -------------------------------------------------------------------------------- 1 | # RpgServerEngine 2 | 3 | ## Example to use (in module) 4 | 5 | ```ts 6 | import { RpgServer, RpgModule, RpgServerEngine } from '@rpgjs/server' 7 | import { player } from './player' // optional 8 | 9 | @RpgModule({ 10 | engine: { 11 | onStart(engine: RpgServerEngine) { 12 | const globalConfig = engine.globalConfig 13 | } 14 | } 15 | }) 16 | export default class RpgServerModuleEngine {} 17 | ``` 18 | 19 | ## RpgServerEngineHooks 20 | 21 | 22 | 23 | ## RpgServerEngine 24 | 25 | -------------------------------------------------------------------------------- /docs/classes/shape.md: -------------------------------------------------------------------------------- 1 | # RpgShape 2 | 3 | On this page you can see how to use the shapes: [Shape Guide](/guide/create-shape.html) 4 | 5 | -------------------------------------------------------------------------------- /docs/classes/tests.md: -------------------------------------------------------------------------------- 1 | # Unit Tests API 2 | 3 | > The unit tests are based on Vitest, please read the [guide to install and run the tests](/guide/unit-test). 4 | 5 | ## Testing API 6 | 7 | 8 | 9 | ## Fixture API 10 | 11 | -------------------------------------------------------------------------------- /docs/classes/vue-inject.md: -------------------------------------------------------------------------------- 1 | # Injections in VueJS 2 | 3 | ## To know 4 | 5 | Below is the list of services that can be injected in a View component 6 | 7 | Read the guide "[Create GUI](/guide/create-gui.html)" to learn more about the use of injections 8 | 9 | ## Services 10 | 11 | -------------------------------------------------------------------------------- /docs/classes/world-maps.md: -------------------------------------------------------------------------------- 1 | # RpgWorldMaps 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/battle.md: -------------------------------------------------------------------------------- 1 | # Battle Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/class.md: -------------------------------------------------------------------------------- 1 | # Class/Actor Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/common.md: -------------------------------------------------------------------------------- 1 | # Common Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/effect.md: -------------------------------------------------------------------------------- 1 | # Effect Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/element.md: -------------------------------------------------------------------------------- 1 | # Elements Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/gold.md: -------------------------------------------------------------------------------- 1 | # Gold Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/gui.md: -------------------------------------------------------------------------------- 1 | # Prebuilt GUI 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/item.md: -------------------------------------------------------------------------------- 1 | # Items Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/move.md: -------------------------------------------------------------------------------- 1 | ## Movement Commands 2 | 3 | 4 | 5 | ### Movements List 6 | 7 | All the movements below can be used in the `moveRoutes()` array. 8 | 9 | 10 | 11 | > The movement in number of pixels depends on the speed of the player. -------------------------------------------------------------------------------- /docs/commands/parameter.md: -------------------------------------------------------------------------------- 1 | # Parameters Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/skill.md: -------------------------------------------------------------------------------- 1 | # Skills Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/state.md: -------------------------------------------------------------------------------- 1 | # States Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/commands/variable.md: -------------------------------------------------------------------------------- 1 | # Variable Commands 2 | 3 | -------------------------------------------------------------------------------- /docs/database/effect.md: -------------------------------------------------------------------------------- 1 | # Effects 2 | 3 | The effects make it possible to change the combat (or other) situation. Effects are just labels 4 | 5 | 6 | 7 | ## Create Custom Effect 8 | 9 | -------------------------------------------------------------------------------- /docs/database/element.md: -------------------------------------------------------------------------------- 1 | # Elements 2 | 3 | The elements allow you to vary the damage on another player 4 | 5 | Create a file named `elements.ts`: 6 | 7 | ```ts 8 | export enum Elements { 9 | Fire = 'fire', 10 | Water = 'water', 11 | Ice = 'ice' 12 | } 13 | ``` 14 | 15 | > We give a string for each element because it will be easier to recognize the element on the client side. -------------------------------------------------------------------------------- /docs/database/skill.md: -------------------------------------------------------------------------------- 1 | # Skills 2 | 3 | 4 | 5 | ## Full Skill 6 | 7 | ```ts 8 | import { RpgPlayer } from '@rpgjs/server' 9 | import { Skill } from '@rpgjs/database' 10 | 11 | @Skill({ 12 | name: 'Fire', 13 | description: 'Shoots a ball of fire', 14 | spCost: 10, 15 | power: 100, 16 | variance: 10, 17 | hitRate: 1, 18 | addStates: [], 19 | removeStates: [], 20 | elements: [], 21 | coefficient: {} 22 | }) 23 | export class Fire { 24 | onLearn(player: RpgPlayer) { 25 | 26 | } 27 | 28 | onUse(player: RpgPlayer) { 29 | 30 | } 31 | 32 | onForget(player: RpgPlayer) { 33 | 34 | } 35 | } 36 | ``` 37 | 38 | ## API 39 | 40 | -------------------------------------------------------------------------------- /docs/database/state.md: -------------------------------------------------------------------------------- 1 | # States 2 | 3 | ## Prerequisites 4 | 5 | 6 | 7 | ## Example of full state: 8 | 9 | ```ts 10 | import { RpgPlayer } from '@rpgjs/server' 11 | import { State } from '@rpgjs/database' 12 | 13 | @State({ 14 | name: 'Paralyse', 15 | description: 'The player is paralyzed', 16 | effects: [], 17 | paramsModifier: [], 18 | statesEfficiency: [], 19 | elementsEfficiency: [] 20 | }) 21 | export class Paralyse { 22 | 23 | } 24 | ``` 25 | 26 | ## API 27 | 28 | -------------------------------------------------------------------------------- /docs/demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/demo.png -------------------------------------------------------------------------------- /docs/gui/create-menu.md: -------------------------------------------------------------------------------- 1 | # Creating a menu 2 | 3 | ## Goal 4 | 5 | The goal is to create an "Inn" menu. By paying a certain amount, the player will get back all his health points. -------------------------------------------------------------------------------- /docs/guide/animation-tile.md: -------------------------------------------------------------------------------- 1 | # Create animated tiles 2 | 3 | ## Prerequisites 4 | 5 | 1. You have already created a map and a tileset (previous tutorial) 6 | 7 | ## Create animation 8 | 9 | 1. Go to the tileset in question, 10 | 2. Select the tile 11 | 3. Click on the `Tile Animation Editor` icon 12 | 13 | ![medieval](/assets/anim-tile.png) 14 | 15 | 4. Select the tiles to make an animation 16 | 17 | ![medieval](/assets/tile-anim2.png) 18 | 19 | ::: danger 20 | For performance reasons, the tiles must be aligned on the same X axis and the distance between the tiles must be equivalent 21 | ::: 22 | 23 | ::: danger 24 | Tile Map Editor's frame duration is not supported 25 | ::: -------------------------------------------------------------------------------- /docs/guide/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/guide/readme.md -------------------------------------------------------------------------------- /docs/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/header.png -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: home 3 | 4 | hero: 5 | name: RPGJS 6 | text: Documentation 7 | tagline: Framework to create an RPG or MMORPG (with the same code) in the browser with Typescript 8 | image: 9 | src: https://github.com/RSamaium/RPG-JS/raw/v4/docs/header.png 10 | alt: VitePress 11 | actions: 12 | - theme: brand 13 | text: Get Started 14 | link: /guide/get-started 15 | - theme: alt 16 | text: View on GitHub 17 | link: https://github.com/RSamaium 18 | --- -------------------------------------------------------------------------------- /docs/others/readme.md: -------------------------------------------------------------------------------- 1 | Others files generated here -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/documentation", 3 | "version": "1.0.0", 4 | "description": "Documentation for RPG JS v3", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "vitepress dev .", 8 | "build": "npm run generate && vitepress build .", 9 | "generate": "node extract" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "MIT", 14 | "dependencies": { 15 | "@vue/theme": "^2.2.4", 16 | "comment-parser": "^1.4.0", 17 | "compare-versions": "^6.1.0" 18 | }, 19 | "devDependencies": { 20 | "vitepress": "^1.0.0-rc.4" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /docs/partials/prerequisites-data.md: -------------------------------------------------------------------------------- 1 | ## Prerequisites 2 | 3 | Read the article [Create database](/guide/create-database.html#prerequisites) to find out how to put the data into your game and then use it. -------------------------------------------------------------------------------- /docs/partials/todo.md: -------------------------------------------------------------------------------- 1 | ::: danger 2 | This documentation is not complete. Please wait :) 3 | ::: -------------------------------------------------------------------------------- /docs/plugins/character-select.md: -------------------------------------------------------------------------------- 1 | # Character Select (MMORPG) 2 | 3 | ## Goal 4 | 5 | It's Character Select plugin which allows you to select characters based on Actors and Classes 6 | 7 | ![chat](/assets/plugins/character-select.png) 8 | 9 | ## Installation 10 | 11 | `npx rpgjs add @rpgjs/title-screen` 12 | 13 | and 14 | 15 | `npx rpgjs add rpgjs-character-select` 16 | 17 | ## Configuration instruction 18 | https://github.com/dominx99/rpgjs-plugins/blob/master/character-select/readme.md 19 | 20 | ## Plugin Discussion 21 | 22 | https://community.rpgjs.dev/d/199-character-select-plugin 23 | 24 | ## Author 25 | 26 | [dominx99](https://community.rpgjs.dev/u/dominx99) -------------------------------------------------------------------------------- /docs/plugins/chat.md: -------------------------------------------------------------------------------- 1 | # Chat (for MMORPG) 2 | 3 | ## Goal 4 | 5 | Players can talk together on the same map 6 | 7 | ![chat](/assets/plugins/chat.png) 8 | 9 | ## Installation 10 | 11 | `npx rpgjs add @rpgjs/chat` -------------------------------------------------------------------------------- /docs/plugins/inventory-plugin.md: -------------------------------------------------------------------------------- 1 | # Inventory GUI Plugin 2 | 3 | ## Goal 4 | 5 | It's a plugin of RPG JS engine that gives possibility to manage inventory. 6 | 7 | ![Watch the video](https://imgur.com/aO2oxml.png) 8 | 9 | ## Installation 10 | 11 | `npx rpgjs add rpgjs-inventory` 12 | 13 | ## Configuration instruction 14 | https://github.com/dominx99/rpgjs-plugins/tree/master/plugins/inventory 15 | 16 | ## Plugin Discussion 17 | 18 | https://community.rpgjs.dev/d/219-inventory-plugin 19 | 20 | ## Author 21 | 22 | [dominx99](https://community.rpgjs.dev/u/dominx99) -------------------------------------------------------------------------------- /docs/plugins/save.md: -------------------------------------------------------------------------------- 1 | # Save Screen (for RPG) 2 | 3 | ## Goal 4 | 5 | Add a save screen for RPG mode. The data is saved in LocalStorage. 6 | It goes very well with the screen title plugin. 7 | For an MMORPG, the title screen plugin is enough 8 | 9 | ![chat](/assets/plugins/rpg-save-screen.png) 10 | 11 | ## Installation 12 | 13 | `npx rpgjs add @rpgjs/save` -------------------------------------------------------------------------------- /docs/public/assets/add-colission.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/add-colission.png -------------------------------------------------------------------------------- /docs/public/assets/add-shape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/add-shape.png -------------------------------------------------------------------------------- /docs/public/assets/agones-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/agones-diagram.jpg -------------------------------------------------------------------------------- /docs/public/assets/anim-tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/anim-tile.png -------------------------------------------------------------------------------- /docs/public/assets/animation-chara.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/animation-chara.png -------------------------------------------------------------------------------- /docs/public/assets/animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/animation.png -------------------------------------------------------------------------------- /docs/public/assets/attach-shape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/attach-shape.png -------------------------------------------------------------------------------- /docs/public/assets/chara.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/chara.png -------------------------------------------------------------------------------- /docs/public/assets/component-multi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/component-multi.png -------------------------------------------------------------------------------- /docs/public/assets/hpbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/hpbar.png -------------------------------------------------------------------------------- /docs/public/assets/hpbar2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/hpbar2.png -------------------------------------------------------------------------------- /docs/public/assets/hpbar3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/hpbar3.png -------------------------------------------------------------------------------- /docs/public/assets/hud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/hud.png -------------------------------------------------------------------------------- /docs/public/assets/layer-overlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/layer-overlay.png -------------------------------------------------------------------------------- /docs/public/assets/layer-z.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/layer-z.png -------------------------------------------------------------------------------- /docs/public/assets/layers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/layers.png -------------------------------------------------------------------------------- /docs/public/assets/map-sound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/map-sound.png -------------------------------------------------------------------------------- /docs/public/assets/medieval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/medieval.png -------------------------------------------------------------------------------- /docs/public/assets/move-to.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/move-to.mp4 -------------------------------------------------------------------------------- /docs/public/assets/name-hero.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/name-hero.png -------------------------------------------------------------------------------- /docs/public/assets/name.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/name.png -------------------------------------------------------------------------------- /docs/public/assets/name2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/name2.png -------------------------------------------------------------------------------- /docs/public/assets/new-tileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/new-tileset.png -------------------------------------------------------------------------------- /docs/public/assets/overlay-problem-solved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/overlay-problem-solved.png -------------------------------------------------------------------------------- /docs/public/assets/overlay-problem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/overlay-problem.png -------------------------------------------------------------------------------- /docs/public/assets/plugins/character-select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/plugins/character-select.png -------------------------------------------------------------------------------- /docs/public/assets/plugins/chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/plugins/chat.png -------------------------------------------------------------------------------- /docs/public/assets/plugins/emotion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/plugins/emotion.png -------------------------------------------------------------------------------- /docs/public/assets/plugins/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/plugins/login.png -------------------------------------------------------------------------------- /docs/public/assets/plugins/rpg-save-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/plugins/rpg-save-screen.png -------------------------------------------------------------------------------- /docs/public/assets/plugins/rpg-title-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/plugins/rpg-title-screen.png -------------------------------------------------------------------------------- /docs/public/assets/precise-collision.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/precise-collision.png -------------------------------------------------------------------------------- /docs/public/assets/rpgjs_gui.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/rpgjs_gui.mp4 -------------------------------------------------------------------------------- /docs/public/assets/rpgjs_world.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/rpgjs_world.mp4 -------------------------------------------------------------------------------- /docs/public/assets/rpgjs_world_2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/rpgjs_world_2.mp4 -------------------------------------------------------------------------------- /docs/public/assets/select-tile.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/select-tile.jpeg -------------------------------------------------------------------------------- /docs/public/assets/set-colission.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/set-colission.jpeg -------------------------------------------------------------------------------- /docs/public/assets/shape-component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/shape-component.png -------------------------------------------------------------------------------- /docs/public/assets/smartphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/smartphone.png -------------------------------------------------------------------------------- /docs/public/assets/start-event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/start-event.png -------------------------------------------------------------------------------- /docs/public/assets/start-event2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/start-event2.png -------------------------------------------------------------------------------- /docs/public/assets/start-player.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/start-player.png -------------------------------------------------------------------------------- /docs/public/assets/start-player2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/start-player2.png -------------------------------------------------------------------------------- /docs/public/assets/tile-anim2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/tile-anim2.png -------------------------------------------------------------------------------- /docs/public/assets/tiled-add-in-world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/tiled-add-in-world.png -------------------------------------------------------------------------------- /docs/public/assets/tiled-world-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/tiled-world-2.png -------------------------------------------------------------------------------- /docs/public/assets/tiled-world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/tiled-world.png -------------------------------------------------------------------------------- /docs/public/assets/z-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/z-0.png -------------------------------------------------------------------------------- /docs/public/assets/z-tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/z-tile.png -------------------------------------------------------------------------------- /docs/public/assets/z-value.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/public/assets/z-value.png -------------------------------------------------------------------------------- /docs/readme.md: -------------------------------------------------------------------------------- 1 | --- 2 | home: true 3 | actionText: Guide → 4 | actionLink: /guide/ 5 | --- -------------------------------------------------------------------------------- /docs/specification/fr/animation-chara.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/specification/fr/animation-chara.png -------------------------------------------------------------------------------- /docs/specification/fr/spec-autotile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/specification/fr/spec-autotile.png -------------------------------------------------------------------------------- /docs/specification/fr/spec-tileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/specification/fr/spec-tileset.png -------------------------------------------------------------------------------- /docs/specification/fr/spec-tileset2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/specification/fr/spec-tileset2.png -------------------------------------------------------------------------------- /docs/specification/fr/spritesheet-bad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/specification/fr/spritesheet-bad.png -------------------------------------------------------------------------------- /docs/specification/fr/spritesheet-ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/specification/fr/spritesheet-ok.png -------------------------------------------------------------------------------- /docs/specification/fr/spritesheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/docs/specification/fr/spritesheet.png -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/*", 4 | "packages/plugins/*", 5 | "packages/plugins/agones/module", 6 | "tests/*" 7 | ], 8 | "version": "4.3.1" 9 | } 10 | -------------------------------------------------------------------------------- /netlify.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | base = "docs" 3 | publish = ".vitepress/dist" 4 | command = "npm run build" 5 | [[headers]] 6 | for = "/assets/*" 7 | [headers.values] 8 | Cache-Control = "public, max-age=31536000, immutable" -------------------------------------------------------------------------------- /packages/client/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "src/index.ts" 7 | name = "RpgClient" 8 | fileName = "rpg.client" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" 12 | 13 | [vite.build.rollupOptions] 14 | external = ["@rpgjs/common", "vue", "rxjs", "react", "react-dom"] -------------------------------------------------------------------------------- /packages/client/src/Effects/AnimationCharacter.ts: -------------------------------------------------------------------------------- 1 | export enum Animation { 2 | Stand = 'stand', 3 | Walk = 'walk', 4 | Attack = 'attack', 5 | Defense = 'defense', 6 | Skill = 'skill' 7 | } -------------------------------------------------------------------------------- /packages/client/src/Effects/Spinner.ts: -------------------------------------------------------------------------------- 1 | import { RpgClientEngine } from "../RpgClientEngine"; 2 | import { Graphics, Renderer } from "pixi.js"; 3 | 4 | export class SpinnerGraphic extends Graphics { 5 | constructor(private clientEngine: RpgClientEngine) { 6 | super() 7 | } 8 | 9 | render(renderer: Renderer) { 10 | super.render(renderer) 11 | this.rotation += 0.12; 12 | const percent = Math.abs(Math.sin(Date.now() / 1000)) 13 | this 14 | .clear() 15 | .lineStyle(4, 0xffffff, 1) 16 | .moveTo(40, 0) 17 | .arc(0, 0, 40, 0, Math.PI * 2 * percent, false) 18 | } 19 | } -------------------------------------------------------------------------------- /packages/client/src/Interfaces/Character.ts: -------------------------------------------------------------------------------- 1 | import { RpgSprite } from '../Sprite/Player' 2 | 3 | export interface ISpriteCharacter { 4 | onCharacterWalk(sprite: RpgSprite): void 5 | onCharacterStand(sprite: RpgSprite): void 6 | onCharacterAction(sprite: RpgSprite): void 7 | } -------------------------------------------------------------------------------- /packages/client/src/Interfaces/Scene.ts: -------------------------------------------------------------------------------- 1 | import * as PIXI from 'pixi.js' 2 | 3 | export interface IScene { 4 | load(obj: object): any 5 | draw(t: number, dt: number, frame: number) 6 | removeObject(id: string) 7 | addObject(obj: object, id: string) 8 | updateScene(obj: { data: object, partial: object }) 9 | } -------------------------------------------------------------------------------- /packages/client/src/Logger.ts: -------------------------------------------------------------------------------- 1 | export function log(message) { 2 | return new Error(`[RPGJS] - ${message}`) 3 | } -------------------------------------------------------------------------------- /packages/client/src/Presets/Scene.ts: -------------------------------------------------------------------------------- 1 | export enum Scene { 2 | Map = 'map' 3 | } -------------------------------------------------------------------------------- /packages/client/src/Scene/EventLayer.ts: -------------------------------------------------------------------------------- 1 | import { TiledLayer } from "@rpgjs/tiled"; 2 | import { Container } from "pixi.js"; 3 | 4 | export class EventLayer extends Container { 5 | constructor() { 6 | super() 7 | this.sortableChildren = true 8 | } 9 | } -------------------------------------------------------------------------------- /packages/client/src/Scene/SceneData.ts: -------------------------------------------------------------------------------- 1 | export interface SceneDataOptions { 2 | inputs?: { 3 | 4 | } 5 | } 6 | 7 | export function SceneData(options) { 8 | return (target) => { 9 | for (let key in options) { 10 | target.prototype[key] = options[key] 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /packages/client/src/Sound/Sounds.ts: -------------------------------------------------------------------------------- 1 | import { _initResource } from '../Resources' 2 | 3 | export const sounds = new Map() 4 | 5 | export function _initSound(_sounds, engine) { 6 | return _initResource(sounds, _sounds, 'sound', engine) 7 | } -------------------------------------------------------------------------------- /packages/client/src/Sprite/Player.ts: -------------------------------------------------------------------------------- 1 | import Character from './Character' 2 | 3 | export class RpgSprite extends Character {} -------------------------------------------------------------------------------- /packages/client/src/Sprite/Spritesheets.ts: -------------------------------------------------------------------------------- 1 | import { RpgClientEngine } from '..' 2 | import { _initResource } from '../Resources' 3 | 4 | export const spritesheets: Map = new Map() 5 | 6 | export function _initSpritesheet(_spritesheets, engine: RpgClientEngine) { 7 | return _initResource(spritesheets, _spritesheets, 'image', engine) 8 | } -------------------------------------------------------------------------------- /packages/client/src/Tilemap/CommonLayer.ts: -------------------------------------------------------------------------------- 1 | import { Layer } from "@rpgjs/tiled" 2 | import TileMap from './index' 3 | import { Container } from "pixi.js" 4 | 5 | export class CommonLayer extends Container { 6 | z: number 7 | 8 | constructor(protected layer: Layer, protected map: TileMap) { 9 | super() 10 | this.applyProperties() 11 | } 12 | 13 | applyProperties() { 14 | this.alpha = this.layer.opacity ?? 1 15 | this.visible = this.layer.visible ?? true 16 | this.x = this.layer.offsetx ?? 0 17 | this.y = this.layer.offsety ?? 0 18 | this.z = this.layer.properties.z ?? 0 19 | } 20 | } -------------------------------------------------------------------------------- /packages/common/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "src/index.ts" 7 | name = "RpgCommon" 8 | fileName = "rpg.common" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" -------------------------------------------------------------------------------- /packages/common/src/DefaultInput.ts: -------------------------------------------------------------------------------- 1 | import { Controls, Input, Control } from '@rpgjs/types' 2 | 3 | export const DefaultInput: Controls = { 4 | [Control.Up]: { 5 | repeat: true, 6 | bind: Input.Up 7 | }, 8 | [Control.Down]: { 9 | repeat: true, 10 | bind: Input.Down 11 | }, 12 | [Control.Right]: { 13 | repeat: true, 14 | bind: Input.Right 15 | }, 16 | [Control.Left]: { 17 | repeat: true, 18 | bind: Input.Left 19 | }, 20 | [Control.Action]: { 21 | bind: [Input.Space, Input.Enter] 22 | }, 23 | [Control.Back]: { 24 | bind: Input.Escape 25 | } 26 | } -------------------------------------------------------------------------------- /packages/common/src/Event.ts: -------------------------------------------------------------------------------- 1 | import { RpgCommonPlayer } from './Player' 2 | 3 | export class RpgCommonEvent extends RpgCommonPlayer {} 4 | -------------------------------------------------------------------------------- /packages/common/src/Inject.ts: -------------------------------------------------------------------------------- 1 | type Constructor = new (...args: any[]) => T; 2 | type ServiceIdentifier = string; 3 | 4 | export class InjectContext { 5 | private instances = new Map, any>(); 6 | 7 | inject(constructor: Constructor, args: any[] = []): T { 8 | const serviceName = constructor.name; 9 | if (!this.instances.has(serviceName)) { 10 | const instance = new constructor(this, ...args); 11 | if (instance['initialize']) { 12 | instance['initialize'](...args); 13 | } 14 | this.instances.set(serviceName, instance); 15 | } 16 | return this.instances.get(serviceName); 17 | } 18 | } 19 | 20 | export interface InjectInit { 21 | initialize(...args: any[]): any 22 | } -------------------------------------------------------------------------------- /packages/common/src/Logger.ts: -------------------------------------------------------------------------------- 1 | export function log(message) { 2 | return new Error(`[RPGJS] - ${message}`) 3 | } 4 | 5 | export function warning(...message) { 6 | console.warn('[RPGJS Warning]', ...message) 7 | } -------------------------------------------------------------------------------- /packages/common/src/Player.ts: -------------------------------------------------------------------------------- 1 | import { PendingMove } from '@rpgjs/types' 2 | import { AbstractObject } from './AbstractObject' 3 | 4 | export const LiteralDirection = { 5 | 1: 'up', 6 | 2: 'right', 7 | 3: 'down', 8 | 4: 'left' 9 | } 10 | 11 | export class RpgCommonPlayer extends AbstractObject { 12 | events: any[] = [] 13 | layerName: string = '' 14 | data: any = {} 15 | pendingMove: PendingMove = [] 16 | inputsTimestamp: { 17 | [inputName: string]: number 18 | } = {} 19 | 20 | /** 21 | * Display/Hide the GUI attached to this sprite 22 | * 23 | * @prop {boolean} guiDisplay 24 | * @since 3.0.0-beta.5 25 | * @memberof RpgSprite 26 | * */ 27 | guiDisplay: boolean 28 | } 29 | 30 | export default AbstractObject -------------------------------------------------------------------------------- /packages/common/src/Worker.ts: -------------------------------------------------------------------------------- 1 | import workerpool from 'workerpool' 2 | 3 | export class GameWorker { 4 | pool: any 5 | 6 | constructor(private options = {}) { 7 | //this.pool = workerpool.pool(__dirname + '/workers/move.js', options) 8 | } 9 | 10 | load() { 11 | return this 12 | } 13 | 14 | call(methodName: string, data: any) { 15 | return this.pool.exec(methodName, [data]) 16 | } 17 | } -------------------------------------------------------------------------------- /packages/common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "ES2020", 5 | "outDir": "./lib", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "sourceMap": true, 9 | "strictNullChecks": true, 10 | "strictPropertyInitialization": false, 11 | "moduleResolution": "node", 12 | "esModuleInterop": true, 13 | "removeComments": false, 14 | "noUnusedParameters": false, 15 | "noUnusedLocals": false, 16 | "noImplicitThis": false, 17 | "noImplicitAny": false, 18 | "noImplicitReturns": false, 19 | "declaration": true, 20 | "stripInternal": true 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } -------------------------------------------------------------------------------- /packages/compiler/__mocks__/image-size.ts: -------------------------------------------------------------------------------- 1 | export default function sizeOf() { 2 | return { 3 | width: 100, 4 | height: 100, 5 | } 6 | } -------------------------------------------------------------------------------- /packages/compiler/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.vue" { 2 | import Vue from 'vue' 3 | export default Vue 4 | } 5 | 6 | declare module "*.world" { 7 | const value: any; 8 | export default value; 9 | } 10 | 11 | declare module "server!*" { 12 | const value: any; 13 | export default value; 14 | } 15 | 16 | declare module "client!*" { 17 | const value: any; 18 | export default value; 19 | } 20 | 21 | declare module "development!*" { 22 | const value: any; 23 | export default value; 24 | } 25 | 26 | declare module "production!*" { 27 | const value: any; 28 | export default value; 29 | } 30 | 31 | declare module "rpg!*" { 32 | const value: any; 33 | export default value; 34 | } 35 | 36 | declare module "mmorpg!*" { 37 | const value: any; 38 | export default value; 39 | } -------------------------------------------------------------------------------- /packages/compiler/src/browser.ts: -------------------------------------------------------------------------------- 1 | export * as autoLoad from './build/vite-plugin-config.toml' 2 | export { flagTransform } from './build/vite-plugin-flag-transform' 3 | export { worldTransformPlugin } from './build/vite-plugin-world-transform' -------------------------------------------------------------------------------- /packages/compiler/src/build/vite-plugin-code-injector.ts: -------------------------------------------------------------------------------- 1 | import { Plugin } from 'vite'; 2 | 3 | const scriptInjection = ` 4 | 7 | ` 8 | 9 | export function codeInjectorPlugin(): Plugin { 10 | return { 11 | name: 'html-transform', 12 | transformIndexHtml: { 13 | enforce: 'pre', 14 | transform(html) { 15 | return html.replace('', `${scriptInjection}`); 16 | } 17 | } 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /packages/compiler/src/build/vite-plugin-lib.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import path from 'path'; 3 | 4 | export function runtimePlugin(_outputPath, vite) { 5 | return { 6 | name: 'runtime-plugin', 7 | writeBundle() { 8 | const outputPath = path.join(_outputPath, 9 | (vite?.build?.lib?.fileName ?? 'rpg.runtime') + '.' + 10 | (vite?.build?.rollupOptions?.output?.format ?? 'umd') + 11 | '.js' 12 | ) 13 | if (fs.existsSync(outputPath)) { 14 | const originalCode = fs.readFileSync(outputPath, 'utf-8'); 15 | const modifiedCode = `window.global ||= window;\n${originalCode}`; 16 | fs.writeFileSync(outputPath, modifiedCode); 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /packages/compiler/src/build/vite-plugin-rpgjs-loader.ts: -------------------------------------------------------------------------------- 1 | export function rpgjsPluginLoader(output: string = 'client', isBuild: boolean = false) { 2 | return { 3 | name: 'rpgjs-assets-loader', 4 | enforce: 'pre', 5 | transform: async (code, id: string) => { 6 | const regex = /^(?!.*node_modules(?:\/|\\)(?!rpgjs-|@rpgjs)).*$/; 7 | if (regex.test(id) && id.endsWith('.ts')) { 8 | return { 9 | code: `import '${id}';\n${code}`, 10 | map: null 11 | }; 12 | } 13 | } 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /packages/compiler/src/jsonSchema/express.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | "express": { 3 | "type": "object", 4 | "properties": { 5 | "static": { 6 | "type": "string" 7 | }, 8 | "port": { 9 | "type": "integer" 10 | }, 11 | "json": { 12 | "type": "object", 13 | "additionalProperties": true 14 | }, 15 | "cors": { 16 | "type": "object", 17 | "additionalProperties": true 18 | }, 19 | "socketIo": { 20 | "type": "object", 21 | "additionalProperties": true 22 | } 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /packages/compiler/src/jsonSchema/socket.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | "socketIoClient": { 3 | "type": "object", 4 | "additionalProperties": true 5 | } 6 | } -------------------------------------------------------------------------------- /packages/compiler/src/jsonSchema/vitest.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | "vitest": { 3 | "type": "object", 4 | "additionalProperties": true 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/compiler/src/logs/warning.ts: -------------------------------------------------------------------------------- 1 | import colors from 'picocolors' 2 | 3 | export function warn(message: string) { 4 | console.log(colors.yellow(`⚠️ Warning - ${message}`)) 5 | } 6 | 7 | export function info(message: string) { 8 | console.log(colors.blue(`ℹ️ Info - ${message}`)) 9 | } 10 | 11 | export function error(message: string) { 12 | console.log(colors.red(`❌ Error - ${message}`)) 13 | } 14 | 15 | export const errorApi = (err) => { 16 | error(`${err.response.status} - ${err.response.data.error}`) 17 | } -------------------------------------------------------------------------------- /packages/compiler/src/serve/api.ts: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | axios.interceptors.request.use(function (config) { 4 | config.url += '?dev=1' 5 | return config; 6 | }, function (error) { 7 | return Promise.reject(error); 8 | }); 9 | 10 | export default axios -------------------------------------------------------------------------------- /packages/compiler/src/setupFiles/env.ts: -------------------------------------------------------------------------------- 1 | process.env.MATCH_MAKER_URL = 'test' 2 | process.env.MATCH_MAKER_SECRET_TOKEN = 'test' 3 | process.env.SERVER_ID = 'server1' 4 | process.env.SECRET_TOKEN = 'test' 5 | process.env.KUBECONFIG = '{ "apiVersion": "1", "clusters": [ { "cluster": {} } ], "users": [ { "user": {} } ] }' -------------------------------------------------------------------------------- /packages/compiler/src/setupFiles/inject.ts: -------------------------------------------------------------------------------- 1 | import { vi } from 'vitest'; 2 | 3 | const cacheInstances: { [key: string]: any } = {}; 4 | 5 | vi.mock('@rpgjs/common', async () => { 6 | const common = await vi.importActual('@rpgjs/common') 7 | return { 8 | ...common, 9 | inject: vi.fn().mockImplementation((service, args = []) => { 10 | console.log(service.name) 11 | if (cacheInstances[service.name]) { 12 | return cacheInstances[service.name]; 13 | } 14 | const instance = new service(...args); 15 | if (instance['initialize']) instance['initialize'](...args) 16 | cacheInstances[service.name] = instance; 17 | return instance; 18 | }), 19 | }; 20 | }); 21 | -------------------------------------------------------------------------------- /packages/compiler/src/test/index.ts: -------------------------------------------------------------------------------- 1 | import { startVitest } from 'vitest/node' 2 | 3 | export async function test() { 4 | const vitest = await startVitest('test', ['tests/run-only.test.ts'], { 5 | 6 | }) 7 | 8 | await vitest?.close() 9 | } 10 | -------------------------------------------------------------------------------- /packages/compiler/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "module": "ES2020", 5 | "outDir": "./lib", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "sourceMap": true, 9 | "strictNullChecks": true, 10 | "strictPropertyInitialization": false, 11 | "moduleResolution": "node", 12 | "esModuleInterop": true, 13 | "removeComments": false, 14 | "noUnusedParameters": false, 15 | "noUnusedLocals": false, 16 | "noImplicitThis": false, 17 | "noImplicitAny": false, 18 | "noImplicitReturns": false, 19 | "declaration": true, 20 | "experimentalDecorators": true, 21 | "emitDecoratorMetadata": true, 22 | "stripInternal": true, 23 | "skipLibCheck": true 24 | }, 25 | "include": [ 26 | "src" 27 | ] 28 | } -------------------------------------------------------------------------------- /packages/compiler/vitest.config.ts: -------------------------------------------------------------------------------- 1 | export default {} -------------------------------------------------------------------------------- /packages/database/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/database", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "publishConfig": { 7 | "access": "public" 8 | }, 9 | "scripts": { 10 | "build": "tsc && npm run build:browser", 11 | "build:browser": "RPG_TYPE=rpg npx rpgjs build", 12 | "watch": "tsc -w" 13 | }, 14 | "keywords": [], 15 | "author": "Samuel Ronce", 16 | "license": "MIT", 17 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee", 18 | "devDependencies": { 19 | "@rpgjs/compiler": "^4.3.0", 20 | "typescript": "^5.0.2" 21 | }, 22 | "type": "module" 23 | } 24 | -------------------------------------------------------------------------------- /packages/database/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "src/index.ts" 7 | name = "RpgDatabase" 8 | fileName = "rpg.database" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" -------------------------------------------------------------------------------- /packages/database/src/armor.ts: -------------------------------------------------------------------------------- 1 | import { merge } from './common' 2 | import { EquipmentOptions } from './item' 3 | 4 | export interface ArmorClass { 5 | new(...args: any[]): ArmorInstance; 6 | price?: number; 7 | _type?: string; 8 | } 9 | 10 | export interface ArmorOptions extends EquipmentOptions { } 11 | 12 | export interface ArmorInstance extends ArmorOptions { 13 | equipped?: boolean 14 | } 15 | 16 | export function Armor(options: ArmorOptions) { 17 | return merge(options, 'armor', { 18 | price: options.price 19 | }) 20 | } -------------------------------------------------------------------------------- /packages/database/src/enemy.ts: -------------------------------------------------------------------------------- 1 | import { merge } from './common' 2 | import { ActorGlobalOptions } from './actor' 3 | 4 | interface EnemyOptions extends ActorGlobalOptions { 5 | startingItems?: [{ nb: number, item: any }] 6 | graphic?: string, 7 | gain?: { 8 | exp?: number 9 | gold?: number 10 | items?: [{ nb: number, item: any, chance?: number }] 11 | } 12 | } 13 | 14 | export function Enemy(options: EnemyOptions) { 15 | return merge({ 16 | options 17 | }, 'enemy') 18 | } -------------------------------------------------------------------------------- /packages/database/src/interfaces/effects.ts: -------------------------------------------------------------------------------- 1 | import { Effect } from "../effect"; 2 | 3 | export interface EffectsOption { 4 | /** 5 | * List of effects applied by the object, weapon, armor or condition 6 | * @prop {Array} [effects] 7 | * @example 8 | * 9 | * ```ts 10 | * import { Effect } from '@rpgjs/server' 11 | * 12 | * effects: [Effect.CAN_NOT_SKILL] 13 | * ``` 14 | * @memberof Item 15 | * @memberof Weapon 16 | * @memberof Armor 17 | * @memberof State 18 | * */ 19 | effects?: Effect[] 20 | } -------------------------------------------------------------------------------- /packages/database/src/interfaces/types.ts: -------------------------------------------------------------------------------- 1 | export type DatabaseTypes = 'item' | 'weapon' | 'armor' | 'class' | 'enemy' | 'skill' | 'state' | 'actor' | 'effect' -------------------------------------------------------------------------------- /packages/database/src/state.ts: -------------------------------------------------------------------------------- 1 | import { merge, Data } from './common' 2 | import { EfficiencyOptions } from './interfaces/efficiency' 3 | import { ParamsModifierOption } from './interfaces/params-modifier' 4 | import { EffectsOption } from './interfaces/effects'; 5 | 6 | export interface StateOptions extends EfficiencyOptions, ParamsModifierOption, EffectsOption, Data { } 7 | 8 | export function State(options: StateOptions) { 9 | return merge(options, 'state') 10 | } -------------------------------------------------------------------------------- /packages/database/src/weapon.ts: -------------------------------------------------------------------------------- 1 | import { merge } from './common' 2 | import { EquipmentOptions } from './item' 3 | 4 | export interface WeaponClass { 5 | new(...args: any[]): WeaponInstance; 6 | price?: number; 7 | _type?: string; 8 | } 9 | 10 | export interface WeaponOptions extends EquipmentOptions { 11 | atk?: number 12 | } 13 | 14 | export interface WeaponInstance extends WeaponOptions { 15 | equipped?: boolean 16 | } 17 | 18 | export function Weapon(options: WeaponOptions) { 19 | return merge(options, 'weapon', { 20 | price: options.price 21 | }) 22 | } -------------------------------------------------------------------------------- /packages/database/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "ES2020", 5 | "outDir": "./lib", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "sourceMap": true, 9 | "strictNullChecks": true, 10 | "strictPropertyInitialization": false, 11 | "moduleResolution": "node", 12 | "esModuleInterop": true, 13 | "removeComments": false, 14 | "noUnusedParameters": false, 15 | "noUnusedLocals": false, 16 | "noImplicitThis": false, 17 | "noImplicitAny": false, 18 | "noImplicitReturns": false, 19 | "declaration": true 20 | }, 21 | "include": [ 22 | "src" 23 | ] 24 | } -------------------------------------------------------------------------------- /packages/plugins/agones/matchmaker/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tests 3 | dist -------------------------------------------------------------------------------- /packages/plugins/agones/matchmaker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:16-alpine 2 | WORKDIR /app 3 | ADD . /app 4 | RUN npm i 5 | RUN npm run build 6 | CMD node dist/server.js -------------------------------------------------------------------------------- /packages/plugins/agones/matchmaker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/agones-matchmaker", 3 | "version": "1.0.0-beta.1", 4 | "description": "", 5 | "main": "index.js", 6 | "publishConfig": { 7 | "access": "public" 8 | }, 9 | "scripts": { 10 | "build": "tsc", 11 | "watch": "tsc -w", 12 | "dev": "nodemon dist/server.js" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "MIT", 17 | "dependencies": { 18 | "@kubernetes/client-node": "^0.18.1", 19 | "cors": "^2.8.5", 20 | "express": "^4.18.2" 21 | }, 22 | "devDependencies": { 23 | "@types/node": "^18.15.10", 24 | "nodemon": "^2.0.22", 25 | "supertest": "^6.3.3", 26 | "typescript": "^5.0.2" 27 | }, 28 | "type": "module" 29 | } 30 | -------------------------------------------------------------------------------- /packages/plugins/agones/matchmaker/src/server.ts: -------------------------------------------------------------------------------- 1 | import load from './app' 2 | 3 | const PORT = process.env.PORT || 3010 4 | const app = load() 5 | 6 | app.listen(PORT, () => { 7 | console.log(`service is listen on ${PORT} port`) 8 | }) -------------------------------------------------------------------------------- /packages/plugins/agones/matchmaker/yaml/fleet.yml: -------------------------------------------------------------------------------- 1 | apiVersion: "agones.dev/v1" 2 | kind: Fleet 3 | metadata: 4 | name: rpg-game-server 5 | spec: 6 | replicas: 2 7 | scheduling: Distributed 8 | template: 9 | spec: 10 | ports: 11 | - name: default 12 | portPolicy: Dynamic 13 | containerPort: 3000 14 | health: 15 | initialDelaySeconds: 30 16 | periodSeconds: 25 17 | template: 18 | spec: 19 | containers: 20 | - name: rpg 21 | image: $(IMAGE) 22 | env: 23 | - name: MATCH_MAKER_URL 24 | value: "$(URL)" 25 | - name: MATCH_MAKER_SECRET_TOKEN 26 | value: "$(SECRET_TOKEN)" 27 | - name: REDIS_URL 28 | value: "$(REDIS_URL)" -------------------------------------------------------------------------------- /packages/plugins/agones/matchmaker/yaml/fleetautoscaler.yml: -------------------------------------------------------------------------------- 1 | apiVersion: "autoscaling.agones.dev/v1" 2 | kind: FleetAutoscaler 3 | metadata: 4 | name: rpg-game-server-autoscaler 5 | spec: 6 | fleetName: rpg-game-server 7 | policy: 8 | type: Buffer 9 | buffer: 10 | bufferSize: 2 11 | minReplicas: 0 12 | maxReplicas: 5 -------------------------------------------------------------------------------- /packages/plugins/agones/matchmaker/yaml/gameserver.yml: -------------------------------------------------------------------------------- 1 | apiVersion: "agones.dev/v1" 2 | kind: GameServer 3 | metadata: 4 | generateName: rpg- 5 | spec: 6 | ports: 7 | - name: default 8 | portPolicy: Dynamic 9 | containerPort: 3000 10 | health: 11 | initialDelaySeconds: 30 12 | periodSeconds: 25 13 | template: 14 | spec: 15 | containers: 16 | - name: rpg 17 | image: $(IMAGE) 18 | env: 19 | - name: MATCH_MAKER_URL 20 | value: "$(URL)" 21 | - name: MATCH_MAKER_SECRET_TOKEN 22 | value: "$(SECRET_TOKEN)" 23 | - name: REDIS_URL 24 | value: "$(REDIS_URL)" -------------------------------------------------------------------------------- /packages/plugins/agones/module/index.d.ts: -------------------------------------------------------------------------------- 1 | declare module "server!*" { 2 | const value: any; 3 | export default value; 4 | } 5 | 6 | declare module "mmorpg!*" { 7 | const value: any; 8 | export default value; 9 | } -------------------------------------------------------------------------------- /packages/plugins/agones/module/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/agones", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "keywords": [], 13 | "author": "Samuel Ronce", 14 | "license": "MIT", 15 | "dependencies": { 16 | "@google-cloud/agones-sdk": "^1.33.0", 17 | "@rpgjs/client": "^4.3.0", 18 | "@rpgjs/server": "^4.3.0", 19 | "redis": "^4.6.7", 20 | "rxjs": "^7.8.1" 21 | }, 22 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 23 | } 24 | -------------------------------------------------------------------------------- /packages/plugins/agones/module/src/client.ts: -------------------------------------------------------------------------------- 1 | import { RpgClient, RpgClientEngine, RpgModule } from '@rpgjs/client' 2 | 3 | @RpgModule({ 4 | engine: { 5 | onStart(client: RpgClientEngine) { 6 | client.globalConfig.matchMakerService = process.env.MATCH_MAKER_URL + '/start' 7 | } 8 | } 9 | }) 10 | export default class RpgClientModule {} -------------------------------------------------------------------------------- /packages/plugins/agones/module/src/index.ts: -------------------------------------------------------------------------------- 1 | import obj from 'mmorpg!./mmorpg' 2 | 3 | export default obj -------------------------------------------------------------------------------- /packages/plugins/agones/module/src/mmorpg.ts: -------------------------------------------------------------------------------- 1 | import server from 'server!./server' 2 | import client from 'client!./client' 3 | 4 | export default { 5 | server, 6 | client 7 | } -------------------------------------------------------------------------------- /packages/plugins/agones/module/src/redisStore.ts: -------------------------------------------------------------------------------- 1 | import { createClient, RedisClientType } from 'redis' 2 | import { IStoreState } from '@rpgjs/server' 3 | 4 | export class RedisStore implements IStoreState { 5 | private client: RedisClientType 6 | 7 | constructor(private options: { url: string | undefined }) {} 8 | 9 | async connect() { 10 | this.client = createClient(this.options) 11 | await this.client.connect() 12 | } 13 | 14 | set(key: string, val: any): Promise { 15 | return this.client.set(key, val) 16 | } 17 | 18 | get(key: string): Promise { 19 | return this.client.get(key) 20 | } 21 | } -------------------------------------------------------------------------------- /packages/plugins/auth/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## [4.3.1](https://github.com/RSamaium/RPG-JS/compare/v4.3.0...v4.3.1) (2024-01-29) 7 | 8 | 9 | ### Bug Fixes 10 | 11 | * lerna publish packages ([41c6ef0](https://github.com/RSamaium/RPG-JS/commit/41c6ef0e5b65d9084ecab40f4c65ef2d5d04a658)) 12 | 13 | 14 | 15 | 16 | 17 | # [4.3.0](https://github.com/RSamaium/RPG-JS/compare/v4.2.2...v4.3.0) (2024-01-29) 18 | 19 | **Note:** Version bump only for package @rpgjs/auth 20 | -------------------------------------------------------------------------------- /packages/plugins/auth/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": "auth", 3 | "server": { 4 | "type": "object", 5 | "properties": { 6 | "jwtSecret": { 7 | "type": "string" 8 | }, 9 | "cookie": { 10 | "type": "object", 11 | "additionalProperties": true 12 | } 13 | }, 14 | "required": [ 15 | "jwtSecret" 16 | ] 17 | }, 18 | "client": {}, 19 | "*": {} 20 | } -------------------------------------------------------------------------------- /packages/plugins/auth/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/auth", 3 | "version": "4.3.1", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "Samuel Ronce", 11 | "license": "MIT", 12 | "type": "module", 13 | "dependencies": { 14 | "@rpgjs/server": "^4.3.0", 15 | "jsonwebtoken": "^9.0.2", 16 | "siwe": "^2.1.4", 17 | "zod": "^3.22.4" 18 | }, 19 | "publishConfig": { 20 | "access": "public" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/plugins/auth/src/index.ts: -------------------------------------------------------------------------------- 1 | import server from 'server!./server' 2 | 3 | export default { 4 | client: null, 5 | server 6 | } -------------------------------------------------------------------------------- /packages/plugins/auth/src/server/index.ts: -------------------------------------------------------------------------------- 1 | import mmorpgServer from 'mmorpg!./mmorpg' 2 | 3 | export default mmorpgServer || null -------------------------------------------------------------------------------- /packages/plugins/auth/src/server/web3/nonce.ts: -------------------------------------------------------------------------------- 1 | import { generateNonce } from 'siwe'; 2 | 3 | export async function playerWeb3NonceHandler(req, res, next) { 4 | try { 5 | res.setHeader('Content-Type', 'text/plain') 6 | res.status(200).send(generateNonce()) 7 | 8 | } catch (error) { 9 | next(error) 10 | } 11 | } -------------------------------------------------------------------------------- /packages/plugins/chat/client/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgClient, RpgModule } from '@rpgjs/client' 2 | import { sprite } from './sprite' 3 | import chatGui from './gui/chat.vue' 4 | import { sceneMap } from './map' 5 | 6 | @RpgModule({ 7 | sprite, 8 | scenes: { 9 | map: sceneMap 10 | }, 11 | gui: [ 12 | chatGui 13 | ] 14 | }) 15 | export default class RpgClientEngine {} -------------------------------------------------------------------------------- /packages/plugins/chat/client/map.ts: -------------------------------------------------------------------------------- 1 | import { RpgSceneMapHooks, RpgSceneMap, RpgGui } from '@rpgjs/client'; 2 | 3 | export const sceneMap: RpgSceneMapHooks = { 4 | onAfterLoading(map: any) { 5 | RpgGui.display('rpg-chat') 6 | } 7 | } -------------------------------------------------------------------------------- /packages/plugins/chat/client/sprite.ts: -------------------------------------------------------------------------------- 1 | import { RpgSprite, RpgSpriteHooks } from '@rpgjs/client' 2 | 3 | export const sprite: RpgSpriteHooks = { 4 | 5 | } -------------------------------------------------------------------------------- /packages/plugins/chat/index.ts: -------------------------------------------------------------------------------- 1 | import mmorpg from 'mmorpg!./mmorpg' 2 | 3 | export default mmorpg -------------------------------------------------------------------------------- /packages/plugins/chat/mmorpg.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | import server from 'server!./server' 3 | 4 | export default { 5 | client, 6 | server 7 | } -------------------------------------------------------------------------------- /packages/plugins/chat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/chat", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "index.ts", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "Samuel Ronce", 12 | "license": "MIT", 13 | "dependencies": { 14 | "@rpgjs/client": "^4.3.0", 15 | "@rpgjs/server": "^4.3.0" 16 | }, 17 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 18 | } 19 | -------------------------------------------------------------------------------- /packages/plugins/chat/server/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgServer, RpgModule } from '@rpgjs/server' 2 | import { player } from './player' 3 | 4 | @RpgModule({ 5 | player 6 | }) 7 | export default class RpgServerEngine {} -------------------------------------------------------------------------------- /packages/plugins/default-gui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/default-gui", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "publishConfig": { 7 | "access": "public" 8 | }, 9 | "scripts": { 10 | "build:browser": "RPG_TYPE=rpg npx rpgjs build" 11 | }, 12 | "keywords": [], 13 | "author": "Samuel Ronce", 14 | "license": "MIT", 15 | "dependencies": { 16 | "@rpgjs/client": "^4.3.0", 17 | "rxjs": "^7.8.0", 18 | "typescript": "^5.0.2", 19 | "vue": "^3.2.47" 20 | }, 21 | "devDependencies": { 22 | "@rpgjs/compiler": "^4.3.0" 23 | }, 24 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 25 | } 26 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "src/index.ts" 7 | name = "RpgDefaultGui" 8 | fileName = "rpg.default-gui" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" 12 | assetFileNames = "assets/[name][extname]" 13 | 14 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/controls/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/controls/back.png -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Black.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-BlackItalic.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Bold.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-BoldItalic.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Italic.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Light.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-LightItalic.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Regular.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-Thin.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/fonts/Lato/Lato-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/fonts/Lato/Lato-ThinItalic.ttf -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/icons/acid.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/icons/death-skull.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/icons/fire.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/icons/flake.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/icons/flamer.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/icons/key.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/icons/medical-pack.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/sounds.ts: -------------------------------------------------------------------------------- 1 | import { Sound } from '@rpgjs/client' 2 | 3 | @Sound({ 4 | sounds: { 5 | alert: require('./sounds/confirmation_002.ogg'), 6 | error: require('./sounds/error_002.ogg') 7 | } 8 | }) 9 | export class GuiSounds {} -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/sounds/confirmation_002.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/sounds/confirmation_002.ogg -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/assets/sounds/error_002.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/default-gui/src/assets/sounds/error_002.ogg -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/battle/main.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 29 | 30 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/client.ts: -------------------------------------------------------------------------------- 1 | import { RpgModule, RpgClient } from '@rpgjs/client' 2 | import DialogUi from './window/dialog.vue' 3 | import ChoiceUi from './window/choice.vue' 4 | import MenuUi from './menu/main.vue' 5 | import ShopUi from './shop/main.vue' 6 | import WindowUi from './window/window.vue' 7 | import DisconnectUi from './notifications/disconnected.vue' 8 | import NotificationUi from './notifications/alert.vue' 9 | import { GuiSounds } from './assets/sounds' 10 | 11 | @RpgModule({ 12 | gui: [ 13 | DialogUi, 14 | MenuUi, 15 | WindowUi, 16 | ChoiceUi, 17 | DisconnectUi, 18 | ShopUi, 19 | NotificationUi 20 | ], 21 | sounds: [ 22 | GuiSounds 23 | ] 24 | }) 25 | export default class RpgClientEngine {} -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/components/back.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 15 | 16 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/components/icon.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | 3 | export default { 4 | client 5 | } -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/menu/layouts/equipment.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 19 | 20 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/menu/layouts/save.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 28 | 29 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/menu/layouts/status.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/notifications/disconnected.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/default-gui/src/vue-shims.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.vue" { 2 | import Vue from 'vue' 3 | export default Vue 4 | } -------------------------------------------------------------------------------- /packages/plugins/emotion-bubbles/index.d.ts: -------------------------------------------------------------------------------- 1 | import { RpgPlayer } from '@rpgjs/server' 2 | 3 | declare module '@rpgjs/server' { 4 | export interface RpgPlayer { 5 | showEmotionBubble: (emotion: string) => void 6 | } 7 | } -------------------------------------------------------------------------------- /packages/plugins/emotion-bubbles/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/plugin-emotion-bubbles", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "scripts": { 7 | "build": "tsc", 8 | "watch": "tsc -w" 9 | }, 10 | "publishConfig": { 11 | "access": "public" 12 | }, 13 | "keywords": [], 14 | "author": "Samuel Ronce", 15 | "license": "MIT", 16 | "dependencies": { 17 | "@rpgjs/client": "^4.3.0", 18 | "@rpgjs/server": "^4.3.0" 19 | }, 20 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 21 | } 22 | -------------------------------------------------------------------------------- /packages/plugins/emotion-bubbles/readme.md: -------------------------------------------------------------------------------- 1 | # Emotion Bubble Plugin 2 | 3 | ## Installation 4 | 5 | `npm install @rpgjs/plugin-emotion-bubbles` 6 | 7 | and 8 | 9 | ```ts 10 | import emotionBubblesPlugin from '@rpgjs/plugin-emotion-bubbles' 11 | 12 | export default [ 13 | emotionBubblesPlugin 14 | ] 15 | ``` 16 | 17 | Add in the file `plugins.ts` 18 | 19 | ## To use the plugin 20 | 21 | Use the `showAnimation` command to display the animation 22 | 23 | ```ts 24 | player.showAnimation('bubble', 'like') 25 | ``` -------------------------------------------------------------------------------- /packages/plugins/emotion-bubbles/src/client.ts: -------------------------------------------------------------------------------- 1 | import { RpgClient, RpgModule, RpgClientEngine } from '@rpgjs/client' 2 | import { Emote } from './spritesheet/bubble' 3 | 4 | @RpgModule({ 5 | engine: { 6 | onStart(engine: RpgClientEngine) { 7 | engine.addSpriteSheet(Emote(engine.globalConfig.emotionBubble)) 8 | } 9 | } 10 | }) 11 | export default class RpgClientModule {} -------------------------------------------------------------------------------- /packages/plugins/emotion-bubbles/src/index.ts: -------------------------------------------------------------------------------- 1 | import { EmotionBubble } from './emotion' 2 | import client from 'client!./client' 3 | import 'server!./server' 4 | 5 | export { 6 | EmotionBubble 7 | } 8 | 9 | export default { 10 | client 11 | } -------------------------------------------------------------------------------- /packages/plugins/emotion-bubbles/src/server.ts: -------------------------------------------------------------------------------- 1 | import { RpgPlayer } from '@rpgjs/server' 2 | 3 | declare module '@rpgjs/server' { 4 | export interface RpgPlayer { 5 | showEmotionBubble: (emotion: string) => void 6 | } 7 | } 8 | 9 | RpgPlayer.prototype.showEmotionBubble = function(emotion: string) { 10 | this.showAnimation('bubble', emotion) 11 | } -------------------------------------------------------------------------------- /packages/plugins/emotion-bubbles/src/spritesheet/assets/bubble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/emotion-bubbles/src/spritesheet/assets/bubble.png -------------------------------------------------------------------------------- /packages/plugins/fx/index.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/fx/index.d.ts -------------------------------------------------------------------------------- /packages/plugins/fx/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/fx", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "build": "tsc", 9 | "watch": "tsc -w" 10 | }, 11 | "publishConfig": { 12 | "access": "public" 13 | }, 14 | "files": [ 15 | "src", 16 | "index.d.ts" 17 | ], 18 | "keywords": [], 19 | "author": "Samuel Ronce", 20 | "license": "MIT", 21 | "dependencies": { 22 | "@rpgjs/client": "^4.3.0", 23 | "jszip": "3.10.1", 24 | "revolt-fx": "1.1.1" 25 | }, 26 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 27 | } 28 | -------------------------------------------------------------------------------- /packages/plugins/fx/readme.md: -------------------------------------------------------------------------------- 1 | # Emotion Bubble Plugin 2 | 3 | ## Installation 4 | 5 | `npm install @rpgjs/plugin-emotion-bubbles` 6 | 7 | and 8 | 9 | ```ts 10 | import emotionBubblesPlugin from '@rpgjs/plugin-emotion-bubbles' 11 | 12 | export default [ 13 | emotionBubblesPlugin 14 | ] 15 | ``` 16 | 17 | Add in the file `plugins.ts` 18 | 19 | ## To use the plugin 20 | 21 | Use the `showAnimation` command to display the animation 22 | 23 | ```ts 24 | player.showAnimation('bubble', 'like') 25 | ``` -------------------------------------------------------------------------------- /packages/plugins/fx/src/assets/default-bundle.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/fx/src/assets/default-bundle.zip -------------------------------------------------------------------------------- /packages/plugins/fx/src/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | 3 | export default { 4 | client 5 | } -------------------------------------------------------------------------------- /packages/plugins/gamepad/client/assets/confirmation_002.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/gamepad/client/assets/confirmation_002.ogg -------------------------------------------------------------------------------- /packages/plugins/gamepad/client/assets/error_002.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/gamepad/client/assets/error_002.ogg -------------------------------------------------------------------------------- /packages/plugins/gamepad/client/sound.ts: -------------------------------------------------------------------------------- 1 | import { Sound } from '@rpgjs/client' 2 | 3 | @Sound({ 4 | sounds: { 5 | connect: require('./assets/confirmation_002.ogg'), 6 | disconnect: require('./assets/error_002.ogg') 7 | } 8 | }) 9 | export class GamePadSounds {} -------------------------------------------------------------------------------- /packages/plugins/gamepad/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | 3 | export default { 4 | client 5 | } -------------------------------------------------------------------------------- /packages/plugins/gamepad/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/gamepad", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "index.ts", 6 | "keywords": [], 7 | "author": "Samuel Ronce", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "dependencies": { 13 | "@rpgjs/client": "^4.3.0", 14 | "joypad.js": "^2.3.3" 15 | }, 16 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 17 | } 18 | -------------------------------------------------------------------------------- /packages/plugins/interpreter/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/interpreter", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "scripts": { 7 | "test": "vitest" 8 | }, 9 | "exports": { 10 | ".": "./src/index.ts", 11 | "./blocks": "./src/blocks/index.ts" 12 | }, 13 | "publishConfig": { 14 | "access": "public" 15 | }, 16 | "keywords": [], 17 | "author": "Samuel Ronce", 18 | "license": "MIT", 19 | "dependencies": { 20 | "@rpgjs/server": "^4.3.0", 21 | "rxjs": "^7.8.1", 22 | "zod": "^3.21.4" 23 | }, 24 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 25 | } 26 | -------------------------------------------------------------------------------- /packages/plugins/interpreter/src/blocks/index.ts: -------------------------------------------------------------------------------- 1 | import choice from './choice' 2 | import text from './text' 3 | import gold from './gold' 4 | import type { Choice } from './choice' 5 | import type { Text } from './text' 6 | import type { ChangeGold } from './gold' 7 | 8 | export type Flow = { 9 | [blockId: string]: Choice | Text | ChangeGold 10 | } 11 | 12 | export default [ 13 | choice, 14 | text, 15 | gold 16 | ] -------------------------------------------------------------------------------- /packages/plugins/interpreter/src/format-message.ts: -------------------------------------------------------------------------------- 1 | // Use https://formatjs.io/ to format messages, but if module is not installed, just return defaultMessage 2 | export function formatMessage(message: { 3 | defaultMessage: string, 4 | description?: string, 5 | id: string 6 | }): string { 7 | return message.defaultMessage 8 | } -------------------------------------------------------------------------------- /packages/plugins/interpreter/src/index.ts: -------------------------------------------------------------------------------- 1 | export { RpgInterpreter } from "./interpreter" 2 | export { jsonSchemaToZod } from './validate'; -------------------------------------------------------------------------------- /packages/plugins/interpreter/src/types/edge.ts: -------------------------------------------------------------------------------- 1 | export interface Edge { 2 | [blockId: string]: string | string[] | { blocks: { blockId: string, handle: string }[] } 3 | } -------------------------------------------------------------------------------- /packages/plugins/interpreter/src/types/group.ts: -------------------------------------------------------------------------------- 1 | export enum Group { 2 | UI = 'ui', 3 | Logic = 'logic', 4 | Param = 'param', 5 | } -------------------------------------------------------------------------------- /packages/plugins/mobile-gui/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/mobile-gui", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "files": [ 13 | "src" 14 | ], 15 | "keywords": [], 16 | "author": "Samuel Ronce", 17 | "license": "MIT", 18 | "dependencies": { 19 | "@rpgjs/client": "^4.3.0", 20 | "nipplejs": "^0.10.1", 21 | "vue": "^3.2.47" 22 | }, 23 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 24 | } 25 | -------------------------------------------------------------------------------- /packages/plugins/mobile-gui/src/assets/flatDark32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/mobile-gui/src/assets/flatDark32.png -------------------------------------------------------------------------------- /packages/plugins/mobile-gui/src/assets/flatDark35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/mobile-gui/src/assets/flatDark35.png -------------------------------------------------------------------------------- /packages/plugins/mobile-gui/src/client.ts: -------------------------------------------------------------------------------- 1 | import { RpgModule, RpgClient } from '@rpgjs/client' 2 | import ControlGui from './controls/main.vue' 3 | import { sceneMap } from './scene-map' 4 | 5 | @RpgModule({ 6 | gui: [ 7 | ControlGui 8 | ], 9 | scenes: { 10 | map: sceneMap 11 | } 12 | }) 13 | export default class RpgClientEngine {} -------------------------------------------------------------------------------- /packages/plugins/mobile-gui/src/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | 3 | export default { 4 | client 5 | } -------------------------------------------------------------------------------- /packages/plugins/mobile-gui/src/scene-map.ts: -------------------------------------------------------------------------------- 1 | import { RpgGui, PrebuiltGui, RpgSceneMap, RpgSprite, RpgSceneMapHooks } from '@rpgjs/client' 2 | 3 | export const sceneMap: RpgSceneMapHooks = { 4 | onAfterLoading() { 5 | RpgGui.display(PrebuiltGui.Controls) 6 | } 7 | } -------------------------------------------------------------------------------- /packages/plugins/mobile-gui/src/vue-shims.d.ts: -------------------------------------------------------------------------------- 1 | declare module "*.vue" { 2 | import Vue from 'vue' 3 | export default Vue 4 | } -------------------------------------------------------------------------------- /packages/plugins/save/client/gui/load.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/save/client/gui/save.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/save/client/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgClient, RpgModule } from '@rpgjs/client' 2 | import { sprite } from './sprite' 3 | import loadGui from './gui/load.vue' 4 | import saveGui from './gui/save.vue' 5 | 6 | @RpgModule({ 7 | sprite, 8 | gui: [ 9 | loadGui, 10 | saveGui 11 | ] 12 | }) 13 | export default class RpgClientEngine {} -------------------------------------------------------------------------------- /packages/plugins/save/client/sprite.ts: -------------------------------------------------------------------------------- 1 | import { RpgSprite, RpgSpriteHooks } from '@rpgjs/client' 2 | 3 | export const sprite: RpgSpriteHooks = { 4 | 5 | } -------------------------------------------------------------------------------- /packages/plugins/save/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | import server from 'server!./server' 3 | 4 | export default { 5 | client, 6 | server 7 | } -------------------------------------------------------------------------------- /packages/plugins/save/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/save", 3 | "version": "4.3.1", 4 | "description": "", 5 | "main": "index.ts", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "build:browser": "RPG_TYPE=rpg npx rpgjs build" 9 | }, 10 | "publishConfig": { 11 | "access": "public" 12 | }, 13 | "keywords": [], 14 | "author": "Samuel Ronce", 15 | "license": "MIT", 16 | "dependencies": { 17 | "@rpgjs/client": "^4.3.0", 18 | "@rpgjs/server": "^4.3.0" 19 | }, 20 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 21 | } 22 | -------------------------------------------------------------------------------- /packages/plugins/save/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "index.ts" 7 | name = "RpgSave" 8 | fileName = "rpg.save" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" -------------------------------------------------------------------------------- /packages/plugins/save/server/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgServer, RpgModule } from '@rpgjs/server' 2 | import { player } from './player' 3 | 4 | @RpgModule({ 5 | player, 6 | engine: { 7 | onStart(server) { 8 | 9 | } 10 | } 11 | }) 12 | export default class RpgServerEngine {} -------------------------------------------------------------------------------- /packages/plugins/save/server/player.ts: -------------------------------------------------------------------------------- 1 | import { RpgPlayer, RpgPlayerHooks } from '@rpgjs/server' 2 | 3 | export const player: RpgPlayerHooks = { 4 | onConnected(player: RpgPlayer) { 5 | player._socket.on('save', (index) => { 6 | const json = player.save() 7 | player.emit('saved', { 8 | slot: index, 9 | data: json, 10 | date: Date.now() 11 | }) 12 | }) 13 | } 14 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/index.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/index.d.ts -------------------------------------------------------------------------------- /packages/plugins/starter-kit/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/starter-kit", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "private": true, 7 | "scripts": { 8 | "build": "tsc && npm run copy", 9 | "watch": "npm run copy && tsc -w", 10 | "copy": "cp -R ./src/maps/tmx ./lib/maps" 11 | }, 12 | "files": [ 13 | "src" 14 | ], 15 | "keywords": [], 16 | "author": "Samuel Ronce", 17 | "license": "MIT", 18 | "devDependencies": { 19 | "typescript": "^4.1.3" 20 | }, 21 | "dependencies": { 22 | "@rpgjs/client": "^4.3.0", 23 | "@rpgjs/database": "^4.3.0", 24 | "@rpgjs/server": "^4.3.0" 25 | }, 26 | "gitHead": "11ef47d2e4c982de49aa6c155ab43bf4695d142e" 27 | } 28 | -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/animations/assets/pipo-btleffect206_192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/animations/assets/pipo-btleffect206_192.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/animations/index.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet } from '@rpgjs/client' 2 | 3 | const to = () => { 4 | const array: any = [] 5 | let k = 0 6 | for (let i=0 ; i < 4 ; i++) { 7 | for (let j=0 ; j < 5 ; j++) { 8 | array.push({ time: k * 5, frameX: j, frameY: i }) 9 | k++ 10 | } 11 | } 12 | return array 13 | } 14 | 15 | @Spritesheet({ 16 | id: 'shield', 17 | image: require('./assets/pipo-btleffect206_192.png'), 18 | framesWidth: 5, 19 | framesHeight: 4, 20 | width: 960, 21 | height: 768, 22 | opacity: 1, 23 | anchor: [0.5], 24 | textures: { 25 | default: { 26 | animations: [ to() ] 27 | } 28 | } 29 | }) 30 | export class Animations { } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/Female 13-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/Female 13-2.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/Female 19-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/Female 19-3.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/Male 01-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/Male 01-1.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/Male 01-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/Male 01-2.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/Male 04-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/Male 04-1.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/Male 12-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/Male 12-2.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/Male 17-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/Male 17-2.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/assets/chest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/characters/assets/chest.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/characters.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet, Presets } from '@rpgjs/client' 2 | 3 | const { RMSpritesheet } = Presets 4 | 5 | @Spritesheet({ 6 | images: { 7 | female13: require('./assets/Female 13-2.png'), 8 | female19: require('./assets/Female 19-3.png'), 9 | male1_1: require('./assets/Male 01-1.png'), 10 | male4_1: require('./assets/Male 04-1.png'), 11 | male12: require('./assets/Male 12-2.png'), 12 | male17: require('./assets/Male 17-2.png'), 13 | male1_2: require('./assets/Male 01-2.png') 14 | }, 15 | width: 96, 16 | height: 128, 17 | ...RMSpritesheet(3, 4) 18 | }) 19 | export class Characters { } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/chest.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet, Animation, Direction, RpgSprite } from '@rpgjs/client' 2 | 3 | @Spritesheet({ 4 | id: 'chest', 5 | image: require('./assets/chest.png'), 6 | width: 124, 7 | height: 61, 8 | framesHeight: 2, 9 | framesWidth: 4, 10 | textures: { 11 | [Animation.Stand]: { 12 | animations: direction => [[ {time: 0, frameX: 3, frameY: direction == Direction.Up ? 0 : 1 } ]] 13 | } 14 | } 15 | }) 16 | export class Chest { } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/characters/index.ts: -------------------------------------------------------------------------------- 1 | import { Characters } from './characters' 2 | import { Chest } from './chest' 3 | 4 | export default [ 5 | Characters, 6 | Chest 7 | ] -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/images/assets/perlin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/images/assets/perlin.jpg -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/images/index.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet } from '@rpgjs/client' 2 | 3 | @Spritesheet({ 4 | images: { 5 | transition: require('./assets/perlin.jpg') 6 | } 7 | }) 8 | export class Images {} -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgModule, RpgClient } from '@rpgjs/client' 2 | import { MedievalTilesets } from './maps/medieval' 3 | import Characters from './characters' 4 | import { Images } from './images' 5 | import { Musics, Sounds } from './sounds' 6 | import { Animations } from './animations' 7 | 8 | @RpgModule({ 9 | spritesheets: [ 10 | MedievalTilesets, 11 | ...Characters, 12 | Images, 13 | Animations 14 | ], 15 | sounds: [ 16 | Musics, 17 | Sounds 18 | ] 19 | }) 20 | export default class RpgClientEngine {} -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/LightShadow_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/LightShadow_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[A]Dirt_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[A]Dirt_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[A]Flower_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[A]Flower_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[A]Grass_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[A]Grass_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[A]Wall-Up_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[A]Wall-Up_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[A]WaterFall_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[A]WaterFall_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[A]Water_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[A]Water_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[Base]BaseChip_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[Base]BaseChip_pipo.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/assets/[Base]BaseChip_pipo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/maps/assets/[Base]BaseChip_pipo3.png -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/maps/medieval.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet } from '@rpgjs/client' 2 | 3 | @Spritesheet({ 4 | images: { 5 | '[A]Dirt_pipo': require('./assets/[A]Dirt_pipo.png'), 6 | '[A]Flower_pipo': require('./assets/[A]Flower_pipo.png'), 7 | '[A]Grass_pipo': require('./assets/[A]Grass_pipo.png'), 8 | '[A]Wall-Up_pipo': require('./assets/[A]Wall-Up_pipo.png'), 9 | '[A]WaterFall_pipo': require('./assets/[A]WaterFall_pipo.png'), 10 | '[A]Water_pipo': require('./assets/[A]Water_pipo.png'), 11 | '[Base]BaseChip_pipo': require('./assets/[Base]BaseChip_pipo.png') 12 | } 13 | }) 14 | export class MedievalTilesets { 15 | 16 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/sounds/assets/Town_Theme.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/sounds/assets/Town_Theme.ogg -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/sounds/assets/doorOpen_1.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/starter-kit/src/client/sounds/assets/doorOpen_1.ogg -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/client/sounds/index.ts: -------------------------------------------------------------------------------- 1 | import { Sound } from '@rpgjs/client' 2 | 3 | @Sound({ 4 | sounds: { 5 | town: require('./assets/Town_Theme.ogg'), 6 | }, 7 | loop: true, 8 | volume: 0.5 9 | }) 10 | export class Musics {} 11 | 12 | @Sound({ 13 | sounds: { 14 | chest: require('./assets/doorOpen_1.ogg'), 15 | } 16 | }) 17 | export class Sounds {} -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | import server from 'server!./server' 3 | import databaseList from 'server!./server/database' 4 | 5 | export const database = databaseList 6 | 7 | export default { 8 | client, 9 | server 10 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/armors/shield.ts: -------------------------------------------------------------------------------- 1 | import { Armor } from '@rpgjs/database' 2 | 3 | @Armor({ 4 | name: 'Shield', 5 | description: 'A great shield!', 6 | price: 100, 7 | pdef: 22, 8 | sdef: 20 9 | }) 10 | export class Shield {} -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/classes/fighter.ts: -------------------------------------------------------------------------------- 1 | import { Class } from '@rpgjs/database' 2 | import { Fire } from '../skills/fire' 3 | 4 | @Class({ 5 | name: 'Fighter', 6 | equippable: [ 7 | 8 | ], 9 | skillsToLearn: [ 10 | { level: 1, skill: Fire } 11 | ] 12 | }) 13 | export class Fighter { 14 | 15 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/index.ts: -------------------------------------------------------------------------------- 1 | import { Potion } from './items/potion' 2 | import { Key } from './items/key' 3 | import { Paralyze } from './states/paralyze' 4 | import { Hero } from './actors/hero' 5 | import { Sword } from './weapons/sword' 6 | import { Shield } from './armors/shield' 7 | 8 | export default { 9 | Potion, 10 | Paralyze, 11 | Hero, 12 | Key, 13 | Sword, 14 | Shield 15 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/items/key.ts: -------------------------------------------------------------------------------- 1 | import { Item } from '@rpgjs/database' 2 | 3 | @Item({ 4 | name: 'Dungeon Key', 5 | description: 'it\'s the key to the dungeon', 6 | price: 1000, 7 | consumable: false 8 | }) 9 | export class Key { } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/items/potion.ts: -------------------------------------------------------------------------------- 1 | import { Item } from '@rpgjs/database' 2 | 3 | @Item({ 4 | name: 'Potion', 5 | description: 'Give 100 HP', 6 | price: 200, 7 | hpValue: 100, 8 | hitRate: 1, 9 | consumable: true 10 | }) 11 | export class Potion { } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/skills/fire.ts: -------------------------------------------------------------------------------- 1 | import { Skill } from '@rpgjs/database' 2 | 3 | @Skill({ 4 | name: 'Fire', 5 | description: 'Use Fire', 6 | spCost: 50 7 | }) 8 | export class Fire { 9 | 10 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/states/paralyze.ts: -------------------------------------------------------------------------------- 1 | import { State } from '@rpgjs/database' 2 | 3 | @State({ 4 | name: 'Paralyze' 5 | }) 6 | export class Paralyze { 7 | 8 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/database/weapons/sword.ts: -------------------------------------------------------------------------------- 1 | import { Weapon } from '@rpgjs/database' 2 | 3 | @Weapon({ 4 | name: 'Sword', 5 | description: 'Figther Weapon', 6 | price: 500, 7 | atk: 112 8 | }) 9 | export class Sword { 10 | 11 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/events/shop.ts: -------------------------------------------------------------------------------- 1 | import { RpgEvent, EventData, RpgPlayer } from '@rpgjs/server' 2 | import { Key } from '../database/items/key'; 3 | 4 | @EventData({ 5 | name: 'shop', 6 | hitbox: { 7 | width: 32, 8 | height: 16 9 | } 10 | }) 11 | export class ShopEvent extends RpgEvent { 12 | onInit() { 13 | this.setGraphic('male4_1') 14 | } 15 | async onAction(player: RpgPlayer) { 16 | await player.callShop([ Key ]) 17 | } 18 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/cave.ts: -------------------------------------------------------------------------------- 1 | import { RpgMap, MapData } from '@rpgjs/server' 2 | 3 | @MapData({ 4 | id: 'cave', 5 | file: require('./tmx/cave.tmx') 6 | }) 7 | export class CaveMap extends RpgMap {} -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/mapz.ts: -------------------------------------------------------------------------------- 1 | import { RpgMap, MapData } from '@rpgjs/server' 2 | 3 | @MapData({ 4 | id: 'mapz', 5 | file: require('./tmx/mapz.tmx') 6 | }) 7 | export class MapZ extends RpgMap { 8 | } -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/tmx/LightShadow_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/tmx/[A]Dirt_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/tmx/[A]Flower_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/tmx/[A]Grass_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/tmx/[A]Wall-Up_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/starter-kit/src/server/maps/tmx/[A]WaterFall_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/plugins/starter-kit/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "outDir": "./lib", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "sourceMap": true, 9 | "strictNullChecks": true, 10 | "strictPropertyInitialization": false, 11 | "moduleResolution": "node", 12 | "esModuleInterop": true, 13 | "removeComments": false, 14 | "noUnusedParameters": false, 15 | "noUnusedLocals": false, 16 | "noImplicitThis": false, 17 | "noImplicitAny": false, 18 | "noImplicitReturns": false, 19 | "declaration": true, 20 | "experimentalDecorators": true, 21 | "emitDecoratorMetadata": true 22 | }, 23 | "include": [ 24 | "src" 25 | ], 26 | "exclude": ["src/maps/tmx"] 27 | } -------------------------------------------------------------------------------- /packages/plugins/title-screen/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": "titleScreen", 3 | "server": { 4 | "type": "object", 5 | "properties": { 6 | "mongodb": { 7 | "type": "string" 8 | } 9 | }, 10 | "required": [ 11 | "mongodb" 12 | ] 13 | }, 14 | "client": { 15 | "type": "object", 16 | "properties": { 17 | "apiUrl": { 18 | "type": "string" 19 | } 20 | } 21 | }, 22 | "*": {} 23 | } -------------------------------------------------------------------------------- /packages/plugins/title-screen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/title-screen", 3 | "version": "4.3.1", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "Samuel Ronce", 12 | "license": "MIT", 13 | "dependencies": { 14 | "@rpgjs/client": "^4.3.0", 15 | "@rpgjs/server": "^4.3.0", 16 | "axios": "^1.4.0", 17 | "body-parser": "^1.20.2", 18 | "mongoose": "^7.4.3", 19 | "mongoose-bcrypt": "^1.10.1" 20 | }, 21 | "publishConfig": { 22 | "access": "public" 23 | }, 24 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 25 | } 26 | -------------------------------------------------------------------------------- /packages/plugins/title-screen/src/client/gui/assets/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/plugins/title-screen/src/client/gui/assets/default.png -------------------------------------------------------------------------------- /packages/plugins/title-screen/src/client/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgClient, RpgModule, RpgGui } from '@rpgjs/client' 2 | import titleGui from './gui/title.vue' 3 | import loginGui from './gui/connect.vue' 4 | import { sprite } from './sprite' 5 | 6 | @RpgModule({ 7 | sprite, 8 | gui: [ 9 | titleGui, 10 | loginGui 11 | ] 12 | }) 13 | export default class RpgClientEngine {} -------------------------------------------------------------------------------- /packages/plugins/title-screen/src/client/sprite.ts: -------------------------------------------------------------------------------- 1 | import { RpgSprite, RpgSpriteHooks } from '@rpgjs/client' 2 | 3 | export const sprite: RpgSpriteHooks = { 4 | 5 | } -------------------------------------------------------------------------------- /packages/plugins/title-screen/src/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | import server from 'server!./server' 3 | 4 | export default { 5 | client, 6 | server 7 | } -------------------------------------------------------------------------------- /packages/plugins/title-screen/src/server/index.ts: -------------------------------------------------------------------------------- 1 | import mmorpgServer from 'mmorpg!./mmorpg' 2 | import rpgServer from 'rpg!./rpg' 3 | 4 | export default mmorpgServer || rpgServer -------------------------------------------------------------------------------- /packages/plugins/title-screen/src/server/mmorpg/model.ts: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | import bcryptPlugin from 'mongoose-bcrypt' 3 | 4 | const { Schema, model, models } = mongoose 5 | 6 | const schema = new Schema({ 7 | nickname: { type: String, required: true, unique: true }, 8 | password: { type: String, required: true }, 9 | email: { 10 | type: String, 11 | required: true 12 | }, 13 | date: { type: Date, default: Date.now }, 14 | data: String 15 | }) 16 | 17 | schema.plugin(bcryptPlugin) 18 | 19 | export default models.Player || model('Player', schema) -------------------------------------------------------------------------------- /packages/plugins/title-screen/src/server/player.ts: -------------------------------------------------------------------------------- 1 | import { RpgPlayer, RpgPlayerHooks } from '@rpgjs/server' 2 | 3 | export const player: RpgPlayerHooks = { 4 | 5 | } -------------------------------------------------------------------------------- /packages/plugins/web3/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## [4.3.1](https://github.com/RSamaium/RPG-JS/compare/v4.3.0...v4.3.1) (2024-01-29) 7 | 8 | 9 | ### Bug Fixes 10 | 11 | * lerna publish packages ([41c6ef0](https://github.com/RSamaium/RPG-JS/commit/41c6ef0e5b65d9084ecab40f4c65ef2d5d04a658)) 12 | 13 | 14 | 15 | 16 | 17 | # [4.3.0](https://github.com/RSamaium/RPG-JS/compare/v4.2.2...v4.3.0) (2024-01-29) 18 | 19 | 20 | ### Bug Fixes 21 | 22 | * wallet address ([4f95fa5](https://github.com/RSamaium/RPG-JS/commit/4f95fa551f2dcc1cce23cc14a8dbbef677d25353)) 23 | -------------------------------------------------------------------------------- /packages/plugins/web3/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "namespace": "auth", 3 | "server": { 4 | "type": "object", 5 | "properties": { 6 | "jwtSecret": { 7 | "type": "string" 8 | } 9 | }, 10 | "required": [ 11 | "jwtSecret" 12 | ] 13 | }, 14 | "client": {}, 15 | "*": {} 16 | } -------------------------------------------------------------------------------- /packages/plugins/web3/index.d.ts: -------------------------------------------------------------------------------- 1 | import { PlayerWeb3Manager } from './src/server/web3manager' 2 | 3 | declare module '@rpgjs/server' { 4 | export interface RpgPlayer { 5 | web3: PlayerWeb3Manager 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/plugins/web3/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/web3", 3 | "version": "4.3.1", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "Samuel Ronce", 12 | "license": "MIT", 13 | "type": "module", 14 | "dependencies": { 15 | "@rpgjs/auth": "^4.3.1", 16 | "@rpgjs/server": "^4.3.0" 17 | }, 18 | "publishConfig": { 19 | "access": "public" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/plugins/web3/src/index.ts: -------------------------------------------------------------------------------- 1 | import server from 'server!./server' 2 | 3 | export default { 4 | client: null, 5 | server 6 | } -------------------------------------------------------------------------------- /packages/plugins/web3/src/server/index.ts: -------------------------------------------------------------------------------- 1 | import mmorpgServer from 'mmorpg!./mmorpg' 2 | 3 | export default mmorpgServer || null -------------------------------------------------------------------------------- /packages/plugins/web3/src/server/mmorpg.ts: -------------------------------------------------------------------------------- 1 | import { RpgServer, RpgModule, RpgPlayer } from '@rpgjs/server' 2 | import AuthModule from '@rpgjs/auth' 3 | import { PlayerWeb3Manager } from './web3manager' 4 | 5 | // @ts-ignore 6 | @RpgModule({ 7 | imports: [AuthModule], 8 | player: { 9 | onConnected(player: RpgPlayer) { 10 | player.web3 = new PlayerWeb3Manager(player._socket.web3) 11 | delete player._socket.web3 12 | } 13 | } 14 | }) 15 | export default class RpgServerWeb3ModuleEngine { } -------------------------------------------------------------------------------- /packages/plugins/web3/src/server/web3manager.ts: -------------------------------------------------------------------------------- 1 | interface PlayerWeb3Options { 2 | address: string; 3 | } 4 | 5 | export class PlayerWeb3Manager { 6 | public readonly walletAdress: string; 7 | 8 | constructor({ address }: PlayerWeb3Options) { 9 | this.walletAdress = address; 10 | } 11 | } -------------------------------------------------------------------------------- /packages/runtime/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/runtime", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "RPG_TYPE=rpg npx rpgjs build" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "MIT", 12 | "dependencies": { 13 | "@rpgjs/client": "^4.3.0", 14 | "@rpgjs/database": "^4.3.0", 15 | "@rpgjs/server": "^4.3.0", 16 | "@rpgjs/standalone": "^4.3.0" 17 | }, 18 | "devDependencies": { 19 | "@rpgjs/compiler": "^4.3.0" 20 | }, 21 | "publishConfig": { 22 | "access": "public" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/runtime/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "runtime.ts" 7 | name = "RPG" 8 | fileName = "rpg.runtime" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" 12 | 13 | [vite.build.rollupOptions] 14 | external = ["vue", "react", "react-dom"] -------------------------------------------------------------------------------- /packages/runtime/runtime.ts: -------------------------------------------------------------------------------- 1 | import entryPoint from 'rpg!virtual-standalone.ts' 2 | import * as Client from '@rpgjs/client' 3 | import * as Server from '@rpgjs/server' 4 | import * as Database from '@rpgjs/database' 5 | import * as Standalone from '@rpgjs/standalone' 6 | 7 | export default { 8 | run: (modules) => { 9 | return entryPoint(modules).start() 10 | }, 11 | Client, 12 | Server, 13 | Database, 14 | Standalone 15 | } -------------------------------------------------------------------------------- /packages/sample/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | RPGJS Game 8 | 9 | 10 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/sample/rpg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Game", 3 | "compilerOptions": { 4 | "alias": { 5 | "@": "./src" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /packages/sample/src/client.ts: -------------------------------------------------------------------------------- 1 | import { entryPoint } from '@rpgjs/client' 2 | import io from 'socket.io-client' 3 | import globalConfig from './config/client' 4 | import modules from './modules' 5 | 6 | document.addEventListener('DOMContentLoaded', function(e) { 7 | entryPoint(modules, { 8 | io, 9 | globalConfig, 10 | maxFps: 60, 11 | envs: import.meta.env 12 | }).start() 13 | }) -------------------------------------------------------------------------------- /packages/sample/src/config/client/assets/face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/assets/face.png -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-Black.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-BlackItalic.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-Bold.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-BoldItalic.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-Italic.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-Light.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-LightItalic.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-Regular.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-Thin.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/fonts/Lato/Lato-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/config/client/fonts/Lato/Lato-ThinItalic.ttf -------------------------------------------------------------------------------- /packages/sample/src/config/client/index.ts: -------------------------------------------------------------------------------- 1 | import { inputs } from '../inputs' 2 | import rpgConfig from '../../../rpg.json' 3 | 4 | export default { 5 | inputs, 6 | screenTitle: { 7 | title: rpgConfig.name 8 | }, 9 | // matchMakerService() { 10 | // return { 11 | // url: 'http://localhost', 12 | // port: 3000 13 | // } 14 | // } 15 | } -------------------------------------------------------------------------------- /packages/sample/src/config/client/theme.scss: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "lato"; 3 | src: url('@/config/client/fonts/Lato/Lato-Regular.ttf') format("truetype"); 4 | } 5 | 6 | /* 7 | Window StyleSheet 8 | */ 9 | $window-background: linear-gradient(148deg, rgba(79,82,136,0.7) 0%, rgba(42,43,73,0.7) 100%); 10 | $window-border: 2.5px solid white; 11 | $window-border-radius: 5px; 12 | $window-arrow-color: white; 13 | $window-font-size: 25px; 14 | $window-font-color: white; 15 | $window-font-family: 'lato'; 16 | 17 | $cursor-background: #7782ab; 18 | $cursor-border: 1px solid #9db0c6; 19 | 20 | $hero-face: url('@/config/client/assets/face.png'); 21 | 22 | @mixin window-content { 23 | // add extra style stylesheet 24 | } -------------------------------------------------------------------------------- /packages/sample/src/config/server/index.ts: -------------------------------------------------------------------------------- 1 | import { inputs } from '../inputs' 2 | 3 | export default { 4 | mongodb: 'mongodb://localhost:27017/test', 5 | startMap: 'cave', 6 | inputs 7 | } -------------------------------------------------------------------------------- /packages/sample/src/modules/index.ts: -------------------------------------------------------------------------------- 1 | import main from './main' 2 | import defaultGui from '@rpgjs/default-gui' 3 | import mobileGui from '@rpgjs/mobile-gui' 4 | import gamepad from '@rpgjs/gamepad' 5 | import emotionBubblesPlugin from '@rpgjs/plugin-emotion-bubbles' 6 | import save from '@rpgjs/save' 7 | 8 | export default [ 9 | main, 10 | gamepad, 11 | defaultGui, 12 | //mobileGui, 13 | emotionBubblesPlugin, 14 | save 15 | //chat, 16 | //title 17 | ] -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/assets/animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/assets/animation.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/assets/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/assets/sky.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Female_13-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Female_13-2.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Female_19-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Female_19-3.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Jedi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Jedi.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Male 01-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Male 01-2.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Male 04-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Male 04-1.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Male 12-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Male 12-2.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Male 17-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Male 17-2.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/Male_01-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/Male_01-1.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/chest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/chest.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/kite_blue_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/kite_blue_blue.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/assets/light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/characters/assets/light.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/characters.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet, Presets } from '@rpgjs/client' 2 | 3 | const { RMSpritesheet } = Presets 4 | 5 | @Spritesheet({ 6 | images: { 7 | female13: require('./assets/Female_13-2.png'), 8 | female19: require('./assets/Female_19-3.png'), 9 | male1_1: require('./assets/Male_01-1.png'), 10 | // male4_1: require('./assets/Male 04-1.png'), 11 | // male12: require('./assets/Male 12-2.png'), 12 | // male17: require('./assets/Male 17-2.png'), 13 | // male1_2: require('./assets/Male 01-2.png'), 14 | }, 15 | width: 96, 16 | height: 128, 17 | ...RMSpritesheet(3, 4) 18 | }) 19 | export class Characters { } -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/chest.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet, Animation, Direction, RpgSprite } from '@rpgjs/client' 2 | 3 | @Spritesheet({ 4 | id: 'chest', 5 | image: require('./assets/chest.png'), 6 | width: 124, 7 | height: 61, 8 | framesHeight: 2, 9 | framesWidth: 4, 10 | textures: { 11 | [Animation.Stand]: { 12 | animations: direction => [[ {time: 0, frameX: 3, frameY: direction == Direction.Up ? 0 : 1 } ]] 13 | } 14 | } 15 | }) 16 | export class Chest { } -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/characters/index.ts: -------------------------------------------------------------------------------- 1 | import { Characters } from './characters' 2 | import { Chest } from './chest' 3 | import { LPC } from './lpc' 4 | 5 | export default [ 6 | Characters, 7 | Chest, 8 | LPC 9 | ] -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/gui/hp.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 20 | 21 | -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/BaseChip_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/BaseChip_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/Dirt_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/Dirt_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/Flower_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/Flower_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/Grass_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/Grass_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/LightShadow_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/LightShadow_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/Wall-Up_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/Wall-Up_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/WaterFall_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/WaterFall_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/Water_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/Water_pipo.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/assets/[Base]BaseChip_pipo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/maps/assets/[Base]BaseChip_pipo3.png -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/maps/medieval.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet } from '@rpgjs/client' 2 | 3 | @Spritesheet({ 4 | images: { 5 | '[A]Dirt_pipo': require('./assets/Dirt_pipo.png'), 6 | '[A]Flower_pipo': require('./assets/Flower_pipo.png'), 7 | '[A]Grass_pipo': require('./assets/Grass_pipo.png'), 8 | '[A]Wall-Up_pipo': require('./assets/Wall-Up_pipo.png'), 9 | '[A]WaterFall_pipo': require('./assets/WaterFall_pipo.png'), 10 | '[A]Water_pipo': require('./assets/Water_pipo.png'), 11 | '[Base]BaseChip_pipo': require('./assets/BaseChip_pipo.png') 12 | } 13 | }) 14 | export class MedievalTilesets { 15 | 16 | } -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/sounds/assets/Town_Theme.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/sounds/assets/Town_Theme.ogg -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/sounds/assets/doorOpen_1.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample/src/modules/main/client/sounds/assets/doorOpen_1.ogg -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/sounds/index.ts: -------------------------------------------------------------------------------- 1 | import { Sound } from '@rpgjs/client' 2 | 3 | @Sound({ 4 | sounds: { 5 | town: require('./assets/Town_Theme.ogg'), 6 | }, 7 | loop: true, 8 | volume: 0.5 9 | }) 10 | export class Musics {} -------------------------------------------------------------------------------- /packages/sample/src/modules/main/client/sprite.ts: -------------------------------------------------------------------------------- 1 | import { RpgSprite, RpgSpriteHooks } from '@rpgjs/client' 2 | 3 | export const sprite: RpgSpriteHooks = { 4 | onInit(sprite: RpgSprite) { 5 | 6 | } 7 | } -------------------------------------------------------------------------------- /packages/sample/src/modules/main/index.ts: -------------------------------------------------------------------------------- 1 | import client from 'client!./client' 2 | import server from 'server!./server' 3 | 4 | export default { 5 | client, 6 | server 7 | } -------------------------------------------------------------------------------- /packages/sample/src/modules/main/server/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgServer, RpgModule, RpgPlayer } from '@rpgjs/server' 2 | import { CaveMap, SampleMap } from './cave' 3 | import { player, Shield } from './player' 4 | import WorldMap from './tmx/world.world' 5 | 6 | @RpgModule({ 7 | player, 8 | database: { 9 | Shield 10 | }, 11 | maps: [ 12 | // SampleMap, 13 | // CaveMap 14 | ], 15 | worldMaps: [ 16 | WorldMap 17 | ] 18 | }) 19 | export default class RpgServerEngine {} -------------------------------------------------------------------------------- /packages/sample/src/modules/main/server/paralyse.ts: -------------------------------------------------------------------------------- 1 | import { RpgPlayer } from '@rpgjs/server' 2 | import { State } from '@rpgjs/database' 3 | 4 | @State({ 5 | name: 'Paralyse', 6 | description: 'The player is paralyzed', 7 | effects: [], 8 | statesEfficiency: [], 9 | elementsEfficiency: [] 10 | }) 11 | export class Paralyse { 12 | 13 | } -------------------------------------------------------------------------------- /packages/sample/src/modules/main/server/tmx/[A]Dirt_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/sample/src/modules/main/server/tmx/[A]Flower_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/sample/src/modules/main/server/tmx/[A]Grass_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/sample/src/modules/main/server/tmx/[A]WaterFall_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /packages/sample/src/server.ts: -------------------------------------------------------------------------------- 1 | import { expressServer } from '@rpgjs/server/express' 2 | import modules from './modules' 3 | import globalConfig from './config/server' 4 | 5 | expressServer(modules, { 6 | globalConfig, 7 | basePath: __dirname, 8 | envs: import.meta.env 9 | }) -------------------------------------------------------------------------------- /packages/sample/src/standalone.ts: -------------------------------------------------------------------------------- 1 | import { entryPoint } from '@rpgjs/standalone' 2 | import globalConfigClient from './config/client' 3 | import globalConfigServer from './config/server' 4 | import modules from './modules' 5 | 6 | document.addEventListener('DOMContentLoaded', function() { 7 | entryPoint(modules, { 8 | globalConfigClient, 9 | globalConfigServer, 10 | envs: import.meta.env 11 | }).start() 12 | }) -------------------------------------------------------------------------------- /packages/sample/styles.css: -------------------------------------------------------------------------------- 1 | body, 2 | html { 3 | height: 100%; 4 | overflow: hidden; 5 | } 6 | 7 | body { 8 | margin: 0; 9 | background-color: black; 10 | display: flex; 11 | align-items: center; 12 | justify-content: center; 13 | } 14 | 15 | #rpg { 16 | position: relative; 17 | 18 | } 19 | 20 | @media (min-width: 800px) { 21 | #rpg { 22 | width: 1000px; 23 | height: 800px; 24 | } 25 | } 26 | 27 | @media (max-width: 800px) { 28 | #rpg { 29 | position: absolute; 30 | top: 0; 31 | left: 0; 32 | right: 0; 33 | bottom: 0; 34 | } 35 | } -------------------------------------------------------------------------------- /packages/sample2/.env: -------------------------------------------------------------------------------- 1 | VITE_MONGO_URI=test -------------------------------------------------------------------------------- /packages/sample2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | RPGJS Game 8 | 9 | 10 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /packages/sample2/main/client.ts: -------------------------------------------------------------------------------- 1 | import { RpgClientEngineHooks, RpgClientEngine } from "@rpgjs/client" 2 | 3 | const client: RpgClientEngineHooks = { 4 | onConnectError(engine: RpgClientEngine, err: Error) { 5 | console.log(err.message) 6 | } 7 | } 8 | 9 | export default client -------------------------------------------------------------------------------- /packages/sample2/main/database/items/Potion.ts: -------------------------------------------------------------------------------- 1 | import { Item } from '@rpgjs/database' 2 | 3 | @Item({ 4 | id: 'potion', 5 | name: 'Potion', 6 | description: 'Gives 100 HP', 7 | price: 200, 8 | hpValue: 100, 9 | hitRate: 1, 10 | consumable: true, 11 | addStates: [], 12 | removeStates: [], 13 | elements: [], 14 | paramsModifier: {} 15 | }) 16 | export default class Potion {} -------------------------------------------------------------------------------- /packages/sample2/main/events/npc.ts: -------------------------------------------------------------------------------- 1 | import { RpgEvent, EventData, RpgPlayer, ShapePositioning, RpgShape, Speed, Move, Components } from '@rpgjs/server' 2 | 3 | @EventData({ 4 | name: 'EV-1' 5 | }) 6 | export default class CatEvent extends RpgEvent { 7 | onInit() { 8 | this.setGraphic('male') 9 | this.setHitbox(16, 16) 10 | //this.infiniteMoveRoute([ Move.tileRandom() ]) 11 | this.setComponentsTop( 12 | Components.text('{id}') 13 | ) 14 | this.speed = Speed.Slow 15 | } 16 | } -------------------------------------------------------------------------------- /packages/sample2/main/gui/test.tsx: -------------------------------------------------------------------------------- 1 | import { room } from '@rpgjs/client' 2 | import { RpgReactContext, useEventPropagator } from '@rpgjs/client/react' 3 | import { useContext } from 'react' 4 | 5 | export default function Test({ gold }) { 6 | const { rpgCurrentPlayer } = useContext(RpgReactContext) 7 | const propagate = useEventPropagator(); 8 | 9 | return
test
10 | } -------------------------------------------------------------------------------- /packages/sample2/main/gui/tooltip.tsx: -------------------------------------------------------------------------------- 1 | import { RpgReactContext } from '@rpgjs/client/react' 2 | import { useContext } from 'react' 3 | 4 | export default function tooltip({ spriteData }) { 5 | const context = useContext(RpgReactContext) 6 | return ( 7 | 8 | {spriteData.position.x}, {spriteData.position.y} 9 | 10 | ) 11 | } 12 | 13 | tooltip.rpgAttachToSprite = true -------------------------------------------------------------------------------- /packages/sample2/main/gui/tooltip.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /packages/sample2/main/maps/map.ts: -------------------------------------------------------------------------------- 1 | import { RpgPlayer } from '@rpgjs/server' 2 | import { MapData, RpgMap } from '@rpgjs/server' 3 | 4 | @MapData({ 5 | id: 'map', 6 | file: require('../worlds/maps/map.tmx') 7 | }) 8 | export default class TownMap extends RpgMap { 9 | onInit() { 10 | console.log('Map loaded') 11 | } 12 | 13 | onJoin(player: RpgPlayer) { 14 | console.log('enter', player.id) 15 | } 16 | 17 | // When the player leaves the map 18 | onLeave(player: RpgPlayer) { 19 | super.onLeave(player) 20 | console.log('leave', player.id) 21 | } 22 | } -------------------------------------------------------------------------------- /packages/sample2/main/scene-map.ts: -------------------------------------------------------------------------------- 1 | import { RpgSceneMapHooks, RpgSceneMap, RpgGui } from '@rpgjs/client' 2 | 3 | const sceneMap: RpgSceneMapHooks = { 4 | onAfterLoading(scene) { 5 | scene.on('click', (ev) => { 6 | console.log('scene', ev) 7 | }) 8 | }, 9 | } 10 | 11 | export default sceneMap; -------------------------------------------------------------------------------- /packages/sample2/main/server.ts: -------------------------------------------------------------------------------- 1 | import { RpgServerEngine } from "@rpgjs/server" 2 | 3 | export default { 4 | auth(engine: RpgServerEngine, socket) { 5 | 6 | }, 7 | onStart(engine: RpgServerEngine) { 8 | 9 | } 10 | } -------------------------------------------------------------------------------- /packages/sample2/main/sounds/theme.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample2/main/sounds/theme.ogg -------------------------------------------------------------------------------- /packages/sample2/main/sounds/theme.ts: -------------------------------------------------------------------------------- 1 | import { Sound } from '@rpgjs/client' 2 | 3 | @Sound({ 4 | sounds: { 5 | town: require('./theme.ogg'), 6 | }, 7 | loop: true 8 | }) 9 | export default class Musics {} -------------------------------------------------------------------------------- /packages/sample2/main/sprite.ts: -------------------------------------------------------------------------------- 1 | import { RpgSprite, RpgSpriteHooks } from '@rpgjs/client' 2 | 3 | const sprite: RpgSpriteHooks = { 4 | onInit(sprite: RpgSprite) { 5 | sprite.eventMode = 'static' 6 | sprite.on('click', (event) => { 7 | console.log('ok') 8 | //console.log(event) 9 | }) 10 | } 11 | } 12 | 13 | export default sprite -------------------------------------------------------------------------------- /packages/sample2/main/spritesheets/animations/animation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample2/main/spritesheets/animations/animation.png -------------------------------------------------------------------------------- /packages/sample2/main/spritesheets/animations/animation.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet } from '@rpgjs/client' 2 | 3 | const to = () => { 4 | const array: any = [] 5 | let k = 0 6 | for (let i=0 ; i < 4 ; i++) { 7 | for (let j=0 ; j < 5 ; j++) { 8 | array.push({ time: k * 5, frameX: j, frameY: i }) 9 | k++ 10 | } 11 | } 12 | return array 13 | } 14 | 15 | @Spritesheet({ 16 | framesWidth: 5, 17 | framesHeight: 4, 18 | opacity: 1, 19 | anchor: [0.5], 20 | textures: { 21 | default: { 22 | animations: [ to() ] 23 | } 24 | } 25 | }) 26 | export default class ShieldAnimations {} -------------------------------------------------------------------------------- /packages/sample2/main/spritesheets/npc/female.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample2/main/spritesheets/npc/female.png -------------------------------------------------------------------------------- /packages/sample2/main/spritesheets/npc/male.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample2/main/spritesheets/npc/male.png -------------------------------------------------------------------------------- /packages/sample2/main/spritesheets/npc/spritesheet.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet, Presets } from '@rpgjs/client' 2 | 3 | const { RMSpritesheet } = Presets 4 | 5 | @Spritesheet( 6 | RMSpritesheet(3, 4) 7 | ) 8 | export default class Characters { } -------------------------------------------------------------------------------- /packages/sample2/main/worlds/maps/base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample2/main/worlds/maps/base.png -------------------------------------------------------------------------------- /packages/sample2/main/worlds/world.world: -------------------------------------------------------------------------------- 1 | { 2 | "maps": [ 3 | { 4 | "fileName": "maps/map.tmx", 5 | "height": 640, 6 | "width": 640, 7 | "x": 288, 8 | "y": 64 9 | }, 10 | { 11 | "fileName": "maps/map2.tmx", 12 | "height": 640, 13 | "width": 640, 14 | "x": -352, 15 | "y": 65 16 | } 17 | ], 18 | "onlyShowAdjacentMaps": false, 19 | "type": "world" 20 | } 21 | -------------------------------------------------------------------------------- /packages/sample2/plugin/index.ts: -------------------------------------------------------------------------------- 1 | import server from 'server!./server' 2 | 3 | export default { 4 | client: null, 5 | server 6 | } -------------------------------------------------------------------------------- /packages/sample2/plugin/server/index.ts: -------------------------------------------------------------------------------- 1 | import { RpgServer, RpgModule } from '@rpgjs/server' 2 | import player from './player.js'; 3 | 4 | /** @ts-ignore */ 5 | @RpgModule({ 6 | hooks: { 7 | player: ['onEquip'], 8 | }, 9 | player 10 | }) 11 | export default class RpgServerModule { } -------------------------------------------------------------------------------- /packages/sample2/plugin/server/player.ts: -------------------------------------------------------------------------------- 1 | import { RpgPlayer, RpgPlayerHooks } from '@rpgjs/server' 2 | 3 | const player: RpgPlayerHooks = { 4 | onConnected(player: RpgPlayer) { 5 | 6 | } 7 | } 8 | 9 | export default player -------------------------------------------------------------------------------- /packages/sample2/rpg.toml: -------------------------------------------------------------------------------- 1 | modules = [ 2 | './main', 3 | './plugin', 4 | '@rpgjs/default-gui', 5 | '@rpgjs/plugin-emotion-bubbles', 6 | '@rpgjs/gamepad', 7 | # '@rpgjs/mobile-gui' 8 | # '@rpgjs/chat', 9 | # '@rpgjs/title-screen' 10 | ] 11 | 12 | spritesheetDirectories = [] 13 | 14 | [start] 15 | map = 'map' 16 | graphic = 'male' 17 | hitbox = [32, 32] 18 | 19 | [titleScreen] 20 | mongodb = 'mongodb://localhost:27017/rpg' 21 | 22 | [pwa] 23 | includeAssets = ['favicon.ico', 'apple-touch-icon.png', 'mask-icon.svg'] 24 | 25 | [compilerOptions.build] 26 | serverUrl = '$ENV:VITE_SERVER_URL' 27 | pwaEnabled = false 28 | 29 | 30 | -------------------------------------------------------------------------------- /packages/sample2/styles.css: -------------------------------------------------------------------------------- 1 | body, 2 | html { 3 | height: 100%; 4 | overflow: hidden; 5 | } 6 | 7 | body { 8 | margin: 0; 9 | background-color: black; 10 | display: flex; 11 | align-items: center; 12 | justify-content: center; 13 | } 14 | 15 | #rpg { 16 | position: relative; 17 | 18 | } 19 | 20 | @media (min-width: 800px) { 21 | #rpg { 22 | width: 1000px; 23 | height: 800px; 24 | } 25 | } 26 | 27 | @media (max-width: 800px) { 28 | #rpg { 29 | position: absolute; 30 | top: 0; 31 | left: 0; 32 | right: 0; 33 | bottom: 0; 34 | } 35 | } -------------------------------------------------------------------------------- /packages/sample3/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { browser: true, es2020: true }, 4 | extends: [ 5 | 'eslint:recommended', 6 | 'plugin:@typescript-eslint/recommended', 7 | 'plugin:react-hooks/recommended', 8 | ], 9 | ignorePatterns: ['dist', '.eslintrc.cjs'], 10 | parser: '@typescript-eslint/parser', 11 | plugins: ['react-refresh'], 12 | rules: { 13 | 'react-refresh/only-export-components': [ 14 | 'warn', 15 | { allowConstantExport: true }, 16 | ], 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /packages/sample3/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /packages/sample3/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Vite + React + TS 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/sample3/postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /packages/sample3/rpg.toml: -------------------------------------------------------------------------------- 1 | modulesRoot = './src/game' 2 | 3 | modules = [ 4 | '@rpgjs/web3', 5 | './main', 6 | '@rpgjs/default-gui', 7 | ] 8 | 9 | autostart = false 10 | 11 | [auth] 12 | jwtSecret = 'mysecret' 13 | 14 | [express.cors] 15 | origin = '$ENV:VITE_GAME_URL' 16 | credentials = true 17 | 18 | [express.socketIo.cors] 19 | origin = '$ENV:VITE_GAME_URL' 20 | credentials = true 21 | 22 | [socketIoClient] 23 | withCredentials = true 24 | 25 | [start] 26 | map = './src/game/main/maps/map' 27 | graphic = 'male' 28 | hitbox = [32, 32] -------------------------------------------------------------------------------- /packages/sample3/src/game/main/characters/female.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample3/src/game/main/characters/female.png -------------------------------------------------------------------------------- /packages/sample3/src/game/main/characters/male.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample3/src/game/main/characters/male.png -------------------------------------------------------------------------------- /packages/sample3/src/game/main/characters/spritesheet.ts: -------------------------------------------------------------------------------- 1 | import { Spritesheet, Presets } from '@rpgjs/client' 2 | 3 | const { RMSpritesheet } = Presets 4 | 5 | @Spritesheet( 6 | RMSpritesheet(3, 4) 7 | ) 8 | export default class Characters { } -------------------------------------------------------------------------------- /packages/sample3/src/game/main/client.ts: -------------------------------------------------------------------------------- 1 | import { type RpgClientEngineHooks, RpgClientEngine } from "@rpgjs/client"; 2 | 3 | const client: RpgClientEngineHooks = { 4 | onStart(engine: RpgClientEngine) { 5 | 6 | } 7 | }; 8 | 9 | export default client; -------------------------------------------------------------------------------- /packages/sample3/src/game/main/gui/test.tsx: -------------------------------------------------------------------------------- 1 | export default function Test() { 2 | return
Test
; 3 | } -------------------------------------------------------------------------------- /packages/sample3/src/game/main/maps/base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/packages/sample3/src/game/main/maps/base.png -------------------------------------------------------------------------------- /packages/sample3/src/game/main/player.ts: -------------------------------------------------------------------------------- 1 | import { Components, RpgPlayer } from '@rpgjs/server' 2 | 3 | export default { 4 | onConnected(player: RpgPlayer) { 5 | player.setComponentsTop(Components.text(player.web3.walletAdress)) 6 | } 7 | } -------------------------------------------------------------------------------- /packages/sample3/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | body, 6 | html { 7 | height: 100%; 8 | overflow: hidden; 9 | } 10 | 11 | body { 12 | margin: 0; 13 | background-color: black; 14 | } 15 | 16 | #rpg { 17 | position: relative; 18 | 19 | } 20 | 21 | #rpg { 22 | position: absolute; 23 | top: 0; 24 | left: 0; 25 | right: 0; 26 | bottom: 0; 27 | } -------------------------------------------------------------------------------- /packages/sample3/src/main.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom/client' 3 | import App from './App.tsx' 4 | import './index.css' 5 | 6 | ReactDOM.createRoot(document.getElementById('root')!).render( 7 | 8 | , 9 | ) 10 | -------------------------------------------------------------------------------- /packages/sample3/src/store/auth.ts: -------------------------------------------------------------------------------- 1 | import { AuthenticationStatus } from '@rainbow-me/rainbowkit' 2 | import { atom, computed } from 'nanostores' 3 | 4 | export const authStatus = atom('unauthenticated') 5 | export const setAuthStatus = (status: AuthenticationStatus) => authStatus.set(status) 6 | export const isConnected = computed(authStatus, (status) => status === 'authenticated') -------------------------------------------------------------------------------- /packages/sample3/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /packages/sample3/src/web3/config.ts: -------------------------------------------------------------------------------- 1 | import '@rainbow-me/rainbowkit/styles.css'; 2 | 3 | import { 4 | getDefaultWallets 5 | } from '@rainbow-me/rainbowkit'; 6 | import { configureChains, createConfig } from 'wagmi'; 7 | import { 8 | polygonMumbai, 9 | } from 'wagmi/chains'; 10 | import { publicProvider } from 'wagmi/providers/public'; 11 | 12 | export const { chains, publicClient } = configureChains( 13 | [polygonMumbai], 14 | [ 15 | publicProvider() 16 | ] 17 | ); 18 | 19 | const { connectors } = getDefaultWallets({ 20 | appName: 'My RainbowKit App', 21 | projectId: 'YOUR_PROJECT_ID', 22 | chains 23 | }); 24 | 25 | export const wagmiConfig = createConfig({ 26 | autoConnect: true, 27 | connectors, 28 | publicClient 29 | }) -------------------------------------------------------------------------------- /packages/sample3/src/web3/wallet.tsx: -------------------------------------------------------------------------------- 1 | import { useAccount, useConnect, useDisconnect } from 'wagmi'; 2 | import { ConnectButton } from '@rainbow-me/rainbowkit'; 3 | 4 | export function AuthButton() { 5 | const { isConnected } = useAccount(); 6 | const { connect } = useConnect(); 7 | const { disconnect } = useDisconnect(); 8 | 9 | if (isConnected) { 10 | return ; 11 | } else { 12 | return ; 13 | } 14 | } -------------------------------------------------------------------------------- /packages/sample3/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: [ 4 | "./src/**/*.{js,jsx,ts,tsx}", 5 | ], 6 | theme: { 7 | extend: {}, 8 | }, 9 | plugins: [], 10 | } -------------------------------------------------------------------------------- /packages/sample3/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": ["vite.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /packages/server/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "src/index.ts" 7 | name = "RpgServer" 8 | fileName = "rpg.server" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" 12 | 13 | [vite.build.rollupOptions] 14 | external = ["@rpgjs/common", "@rpgjs/database"] -------------------------------------------------------------------------------- /packages/server/src/Gui/NotificationGui.ts: -------------------------------------------------------------------------------- 1 | import { PrebuiltGui } from '@rpgjs/common' 2 | import { Gui } from './Gui' 3 | import { RpgPlayer } from '../Player/Player' 4 | import { IGui } from '../Interfaces/Gui' 5 | 6 | export class NotificationGui extends Gui implements IGui { 7 | constructor(player: RpgPlayer) { 8 | super(PrebuiltGui.Notification, player) 9 | } 10 | } -------------------------------------------------------------------------------- /packages/server/src/Gui/index.ts: -------------------------------------------------------------------------------- 1 | import { Gui } from './Gui' 2 | import { DialogGui } from './DialogGui' 3 | import { MenuGui } from './MenuGui' 4 | import { ShopGui } from './ShopGui' 5 | import { NotificationGui } from './NotificationGui' 6 | 7 | export { 8 | Gui, 9 | DialogGui, 10 | MenuGui, 11 | ShopGui, 12 | NotificationGui 13 | } -------------------------------------------------------------------------------- /packages/server/src/Interfaces/Gui.ts: -------------------------------------------------------------------------------- 1 | export interface IGui { 2 | open(...any): Promise 3 | close?() 4 | } -------------------------------------------------------------------------------- /packages/server/src/Interfaces/StateStore.ts: -------------------------------------------------------------------------------- 1 | export interface IStoreState { 2 | connect(): Promise 3 | get(key: string): Promise 4 | set(key: string, val: string): Promise 5 | } -------------------------------------------------------------------------------- /packages/server/src/Player/GoldManager.ts: -------------------------------------------------------------------------------- 1 | export class GoldManager { 2 | private _gold: number = 0 3 | 4 | /** 5 | * You can change the game money 6 | * 7 | * ```ts 8 | * player.gold += 100 9 | * ``` 10 | * 11 | * @title Change Gold 12 | * @prop {number} player.gold 13 | * @default 0 14 | * @memberof GoldManager 15 | * */ 16 | set gold(val: number) { 17 | if (val < 0) { 18 | val = 0 19 | } 20 | this._gold = val 21 | } 22 | 23 | get gold(): number { 24 | return this._gold 25 | } 26 | } -------------------------------------------------------------------------------- /packages/server/src/Player/ItemFixture.ts: -------------------------------------------------------------------------------- 1 | import { ItemInstance } from "@rpgjs/database" 2 | 3 | export class ItemFixture { 4 | protected getFeature(name, prop): any { 5 | const array = {} 6 | for (let item of this.equipments) { 7 | if (item[name]) { 8 | for (let feature of item[name]) { 9 | const { rate } = feature 10 | const instance = feature[prop] 11 | const cache = array[instance.id] 12 | if (cache && cache.rate >= rate) continue 13 | array[instance.id] = feature 14 | } 15 | } 16 | } 17 | return Object.values(array) 18 | } 19 | } 20 | 21 | 22 | export interface ItemFixture{ 23 | equipments: ItemInstance[] 24 | } 25 | -------------------------------------------------------------------------------- /packages/server/src/express/errors/NotAuthorized.ts: -------------------------------------------------------------------------------- 1 | export class NotAuthorized extends Error { 2 | status = 401 3 | constructor(message?: string) { 4 | super(message || 'Not authorized') 5 | } 6 | } -------------------------------------------------------------------------------- /packages/server/src/express/errors/NotFound.ts: -------------------------------------------------------------------------------- 1 | export class NotFound extends Error { 2 | status = 404 3 | constructor(message?: string) { 4 | super(message || 'Not found') 5 | } 6 | } -------------------------------------------------------------------------------- /packages/server/src/logs/index.ts: -------------------------------------------------------------------------------- 1 | import { ItemLog } from './item' 2 | import { SkillLog } from './skill' 3 | import { StateLog } from './state' 4 | import { Log } from './log' 5 | 6 | export { 7 | ItemLog, 8 | SkillLog, 9 | StateLog, 10 | Log 11 | } -------------------------------------------------------------------------------- /packages/server/src/logs/log.ts: -------------------------------------------------------------------------------- 1 | export class Log { 2 | constructor(private id: string, private msg: string) {} 3 | } -------------------------------------------------------------------------------- /packages/server/src/logs/state.ts: -------------------------------------------------------------------------------- 1 | import { Log } from './log' 2 | 3 | export class StateLog { 4 | static addFailed(stateClass) { 5 | return new Log('ADD_STATE_FAILED', `Adding the ${stateClass.name} state has failed`) 6 | } 7 | static removeFailed(stateClass) { 8 | return new Log('REMOVE_STATE_FAILED', `Removing the ${stateClass.name} state has failed`) 9 | } 10 | static notApplied(stateClass) { 11 | return new Log('STATE_NOT_APPLIED', `State ${stateClass.name} does not exist`) 12 | } 13 | } -------------------------------------------------------------------------------- /packages/server/src/models/Item.ts: -------------------------------------------------------------------------------- 1 | import { ItemOptions } from '@rpgjs/database' 2 | import { RpgPlayer } from '../Player/Player'; 3 | 4 | export interface ItemModel extends ItemOptions { 5 | id?: string 6 | equipped?: boolean 7 | onUseFailed?: (player: RpgPlayer) => {} 8 | onUse?: (player: RpgPlayer) => {} 9 | onAdd?: (player: RpgPlayer) => {} 10 | onRemove?: (player: RpgPlayer) => {} 11 | } -------------------------------------------------------------------------------- /packages/standalone/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/standalone", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "src/index.ts", 6 | "scripts": { 7 | "build:browser": "RPG_TYPE=rpg npx rpgjs build" 8 | }, 9 | "keywords": [], 10 | "author": "Samuel Ronce", 11 | "license": "MIT", 12 | "dependencies": { 13 | "@rpgjs/client": "^4.3.0", 14 | "@rpgjs/common": "^4.3.0", 15 | "@rpgjs/server": "^4.3.0", 16 | "simple-room": "^3.0.6" 17 | }, 18 | "devDependencies": { 19 | "@rpgjs/compiler": "^4.3.0", 20 | "typescript": "^5.0.2" 21 | }, 22 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee", 23 | "type": "module" 24 | } 25 | -------------------------------------------------------------------------------- /packages/standalone/rpg.toml: -------------------------------------------------------------------------------- 1 | [compilerOptions.build] 2 | pwaEnabled = false 3 | outputDir = "./browser" 4 | 5 | [vite.build.lib] 6 | entry = "src/index.ts" 7 | name = "RpgStandalone" 8 | fileName = "rpg.standalone" 9 | 10 | [vite.build.rollupOptions.output] 11 | format = "umd" 12 | 13 | [vite.build.rollupOptions] 14 | external = ["@rpgjs/client", "@rpgjs/server", "@rpgjs/common"] -------------------------------------------------------------------------------- /packages/testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/testing", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "publishConfig": { 7 | "access": "public" 8 | }, 9 | "scripts": { 10 | "watch": "tsc -w", 11 | "build": "tsc" 12 | }, 13 | "keywords": [], 14 | "author": "Samuel Ronce", 15 | "license": "MIT", 16 | "dependencies": { 17 | "@rpgjs/client": "^4.3.0", 18 | "@rpgjs/common": "^4.3.0", 19 | "@rpgjs/server": "^4.3.0", 20 | "@rpgjs/types": "^4.0.5", 21 | "simple-room": "^3.0.3" 22 | }, 23 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee", 24 | "devDependencies": { 25 | "@types/css-font-loading-module": "^0.0.8", 26 | "typescript": "^5.0.2" 27 | }, 28 | "type": "module" 29 | } 30 | -------------------------------------------------------------------------------- /packages/testing/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "ES2020", 5 | "outDir": "./lib", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "sourceMap": true, 9 | "strictNullChecks": true, 10 | "strictPropertyInitialization": false, 11 | "moduleResolution": "node", 12 | "esModuleInterop": true, 13 | "removeComments": false, 14 | "noUnusedParameters": false, 15 | "noUnusedLocals": false, 16 | "noImplicitThis": false, 17 | "noImplicitAny": false, 18 | "noImplicitReturns": false, 19 | "declaration": true, 20 | "stripInternal": true 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } -------------------------------------------------------------------------------- /packages/tiled/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/tiled", 3 | "version": "4.3.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "types": "./lib/index.d.ts", 7 | "publishConfig": { 8 | "access": "public" 9 | }, 10 | "scripts": { 11 | "build": "tsc", 12 | "watch": "tsc -w" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "MIT", 17 | "devDependencies": { 18 | "@types/node": "^18.15.10", 19 | "typescript": "^5.0.2" 20 | }, 21 | "dependencies": { 22 | "axios": "^1.3.4", 23 | "buffer": "^6.0.3", 24 | "xml-js": "^1.6.11", 25 | "xmlbuilder": "^15.1.1" 26 | }, 27 | "type": "module", 28 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 29 | } 30 | -------------------------------------------------------------------------------- /packages/tiled/readme.md: -------------------------------------------------------------------------------- 1 | Time was saved on writing the types. Thanks to https://github.com/excaliburjs/excalibur-tiled/blob/main/src -------------------------------------------------------------------------------- /packages/tiled/src/classes/Object.ts: -------------------------------------------------------------------------------- 1 | import { TiledObject } from "../types/Objects"; 2 | import { TileGid } from "./Gid"; 3 | 4 | export class TiledObjectClass extends TileGid { 5 | layerName?: string = '' 6 | 7 | constructor(object?: TiledObject) { 8 | super(object) 9 | Object.assign(this, object) 10 | if (object?.gid) { 11 | this.y -= this.height 12 | } 13 | } 14 | } 15 | 16 | export interface TiledObjectClass extends TiledObject {} -------------------------------------------------------------------------------- /packages/tiled/src/classes/Tile.ts: -------------------------------------------------------------------------------- 1 | import { TilesetTile } from "../types/Tile"; 2 | import { TileGid } from "./Gid"; 3 | 4 | type TileInfo = TilesetTile & { gid?: number, index: number, layerIndex?: number } 5 | 6 | export class Tile extends TileGid { 7 | index: number 8 | 9 | constructor(public tile: TileInfo | { gid: number }) { 10 | super(tile) 11 | Reflect.deleteProperty(tile, 'gid') 12 | Object.assign(this, tile) 13 | } 14 | } 15 | 16 | export interface Tile extends TileInfo {} -------------------------------------------------------------------------------- /packages/tiled/src/types/Tile.ts: -------------------------------------------------------------------------------- 1 | import { TiledLayer } from "./Layer"; 2 | import { TiledObject } from "./Objects"; 3 | import { TiledFrame, TiledProperty } from "./Types"; 4 | 5 | export interface TilesetTile { 6 | gid: number 7 | id: number; 8 | type: string; 9 | image: string; 10 | imageheight: number; 11 | imagewidth: number; 12 | animations: TiledFrame[]; 13 | properties: { 14 | [key: string]: any 15 | } 16 | terrain: number[]; 17 | objects: TiledObject[]; 18 | probability: number; 19 | } -------------------------------------------------------------------------------- /packages/tiled/src/types/WorldMaps.ts: -------------------------------------------------------------------------------- 1 | export interface TiledWorldMap { 2 | fileName: string 3 | height: number 4 | width: number 5 | x: number 6 | y: number 7 | } 8 | 9 | export interface TiledWorld { 10 | maps: TiledWorldMap[] 11 | onlyShowAdjacentMaps: boolean, 12 | type: 'world' 13 | } -------------------------------------------------------------------------------- /packages/tiled/src/utils.ts: -------------------------------------------------------------------------------- 1 | export function isTiledFormat(val: any): boolean { 2 | return typeof val == 'object' && val.version && val.orientation 3 | } -------------------------------------------------------------------------------- /packages/types/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@rpgjs/types", 3 | "version": "4.0.5", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "types": "./lib/index.d.ts", 7 | "publishConfig": { 8 | "access": "public" 9 | }, 10 | "scripts": { 11 | "build": "tsc", 12 | "watch": "tsc -w" 13 | }, 14 | "keywords": [], 15 | "author": "Samuel Ronce", 16 | "license": "MIT", 17 | "devDependencies": { 18 | "typescript": "^5.0.2" 19 | }, 20 | "dependencies": { 21 | "rxjs": "^7.8.1" 22 | }, 23 | "type": "module", 24 | "gitHead": "5abe6ca78be96524d74a052a230f2315c900ddee" 25 | } 26 | -------------------------------------------------------------------------------- /packages/types/src/Object.ts: -------------------------------------------------------------------------------- 1 | export type ObjectFixture = { 2 | object: any, 3 | paramsChanged: any 4 | } 5 | 6 | export type ObjectFixtureList = { 7 | [objectId: string]: ObjectFixture 8 | } -------------------------------------------------------------------------------- /packages/types/src/Socket.ts: -------------------------------------------------------------------------------- 1 | export enum SocketMethods { 2 | CameraFollow = 'cameraFollow', 3 | ShowAnimation = 'showAnimation', 4 | PlaySound = 'playSound', 5 | ModeMove = 'modeMove' 6 | } 7 | 8 | export enum SocketEvents { 9 | CallMethod = 'callMethod', 10 | GameReload = 'gameReload', 11 | ChangeServer = 'changeServer', 12 | LoadScene = 'loadScene', 13 | } -------------------------------------------------------------------------------- /packages/types/src/System.ts: -------------------------------------------------------------------------------- 1 | export type Tick = { 2 | timestamp: number, 3 | deltaTime: number, 4 | frame: number, 5 | deltaRatio: number 6 | } -------------------------------------------------------------------------------- /packages/types/src/Utils.ts: -------------------------------------------------------------------------------- 1 | export type constructor = { new (...args: any[]): T } -------------------------------------------------------------------------------- /packages/types/src/index.ts: -------------------------------------------------------------------------------- 1 | export { HitEllipse, HitPolygon, HitBox, HitObject, HitType, MovingHitbox } from './Hitbox' 2 | export { CameraOptions, MoveClientMode, Behavior, MoveMode, PlayerType, ClientMode, Position, PositionXY, PendingMove, Direction, MoveTo, PositionXY_OptionalZ } from './Player' 3 | export { SocketMethods, SocketEvents } from './Socket' 4 | export { Tick } from './System' 5 | export { Control, Input, Controls, ControlOptions } from './Input' 6 | export { constructor } from './Utils' 7 | export { ObjectFixture, ObjectFixtureList } from './Object' 8 | export { LayoutObject, ComponentObject, TextComponentObject, BarComponentObject, LayoutOptions, LayoutPositionEnum, ImageComponentObject, ShapeComponentObject, TileComponentObject, DebugComponentObject, TextComponentStyleObject } from './Component' -------------------------------------------------------------------------------- /packages/types/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "module": "ES2020", 5 | "outDir": "./lib", 6 | "rootDir": "./src", 7 | "strict": true, 8 | "sourceMap": true, 9 | "strictNullChecks": true, 10 | "strictPropertyInitialization": false, 11 | "moduleResolution": "node", 12 | "esModuleInterop": true, 13 | "removeComments": false, 14 | "noUnusedParameters": false, 15 | "noUnusedLocals": false, 16 | "noImplicitThis": false, 17 | "noImplicitAny": false, 18 | "noImplicitReturns": false, 19 | "declaration": true, 20 | "stripInternal": true 21 | }, 22 | "include": [ 23 | "src" 24 | ] 25 | } -------------------------------------------------------------------------------- /tests/load-testing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "load-testing", 3 | "version": "4.0.5", 4 | "description": "", 5 | "main": "load.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "private": true, 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "msgpack-lite": "^0.1.26", 15 | "socket.io-client": "^4.7.2", 16 | "yargs": "^17.7.2" 17 | }, 18 | "type": "module" 19 | } 20 | -------------------------------------------------------------------------------- /tests/load-testing/random-move.js: -------------------------------------------------------------------------------- 1 | function getRandomInt(max) { 2 | return Math.floor(Math.random() * Math.floor(max)); 3 | } 4 | 5 | function randomDir() { 6 | return getRandomInt(4)+1 7 | } 8 | 9 | export { 10 | randomDir 11 | } -------------------------------------------------------------------------------- /tests/load-testing/socket.yml: -------------------------------------------------------------------------------- 1 | config: 2 | target: "http://localhost:3000" 3 | phases: 4 | - duration: 50 5 | arrivalRate: 3 6 | engines: 7 | socketio-v3: {} 8 | processor: "./random-move.js" 9 | scenarios: 10 | - name: SocketIO 11 | engine: "socketio-v3" 12 | flow: 13 | - loop: 14 | - function: "randomDir" 15 | - emit: 16 | channel: move 17 | data: { input: "{{direction}}", options: {"movement": true}, step: 0 } 18 | - think: 1 19 | - think: 50 -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/actor.ts: -------------------------------------------------------------------------------- 1 | import { Actor } from '@rpgjs/database' 2 | import { Presets } from '@rpgjs/server' 3 | import { Fighter } from './class' 4 | 5 | const {MAXHP } = Presets 6 | 7 | @Actor({ 8 | id: 'hero', 9 | name: 'Hero', 10 | description: 'A great fighter!', 11 | initialLevel: 1, 12 | finalLevel: 99, 13 | expCurve: { 14 | basis: 30, 15 | extra: 20, 16 | accelerationA: 30, 17 | accelerationB: 30 18 | }, 19 | parameters: { 20 | [MAXHP]: { 21 | start: 700, 22 | end: 10000 23 | } 24 | }, 25 | startingEquipment: [], 26 | class: Fighter 27 | }) 28 | export class Hero {} -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/armor.ts: -------------------------------------------------------------------------------- 1 | import { Armor } from '@rpgjs/database' 2 | import { Presets } from '@rpgjs/server' 3 | import { Elements } from './elements' 4 | 5 | const { MAXHP } = Presets 6 | 7 | @Armor({ 8 | name: 'Shield', 9 | price: 100, 10 | pdef: 22, 11 | sdef: 20, 12 | elementsDefense: [Elements.Fire] 13 | }) 14 | export class Shield {} 15 | 16 | @Armor({ 17 | name: 'HpUpValue', 18 | paramsModifier: { 19 | [MAXHP]: { 20 | value: 100 21 | } 22 | } 23 | }) 24 | export class HpUpValue {} -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/class.ts: -------------------------------------------------------------------------------- 1 | import { Class } from '@rpgjs/database' 2 | import { Elements } from './elements' 3 | 4 | @Class({ 5 | name: 'Fighter', 6 | elementsEfficiency: [Elements.Fire] 7 | }) 8 | export class Fighter {} -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/control.ts: -------------------------------------------------------------------------------- 1 | import { Input, Control } from '@rpgjs/client' 2 | 3 | export const inputs = { 4 | [Control.Up]: { 5 | repeat: true, 6 | bind: Input.Up 7 | }, 8 | [Control.Down]: { 9 | repeat: true, 10 | bind: Input.Down 11 | }, 12 | [Control.Right]: { 13 | repeat: true, 14 | bind: Input.Right 15 | }, 16 | [Control.Left]: { 17 | repeat: true, 18 | bind: Input.Left 19 | }, 20 | [Control.Action]: { 21 | bind: [Input.Space, Input.Enter] 22 | }, 23 | [Control.Back]: { 24 | bind: Input.Escape 25 | } 26 | } -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/elements.ts: -------------------------------------------------------------------------------- 1 | export enum Elements { 2 | Fire, 3 | Water 4 | } -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/gui/tooltip.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/item.ts: -------------------------------------------------------------------------------- 1 | import { Item } from '@rpgjs/database' 2 | 3 | @Item({ 4 | name: 'Potion', 5 | price: 100, 6 | hpValue: 100 7 | }) 8 | export class Potion {} 9 | 10 | @Item({ 11 | name: 'Key', 12 | consumable: false 13 | }) 14 | export class Key {} -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/maps/BaseChip_pipo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/tests/unit-tests/specs/fixtures/maps/BaseChip_pipo.png -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/maps/map.ts: -------------------------------------------------------------------------------- 1 | import { RpgMap, MapData } from '@rpgjs/server' 2 | import { Spritesheet } from '@rpgjs/client' 3 | 4 | @MapData({ 5 | id: 'map', 6 | file: require('./map.tmx') 7 | }) 8 | export class SampleMap extends RpgMap {} 9 | 10 | @Spritesheet({ 11 | id: '[Base]BaseChip_pipo', 12 | image: require('./BaseChip_pipo.png') 13 | }) 14 | export class Tileset { } -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/maps/world/LightShadow_pipo.tsx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/server.ts: -------------------------------------------------------------------------------- 1 | import { RpgServer, RpgServerEngine } from '@rpgjs/server' 2 | import { Potion } from './item' 3 | import { Sword } from './weapons' 4 | import { Confuse, HpPlus, Sleep } from './state' 5 | import { Fire } from './skill' 6 | 7 | @RpgServer({ 8 | basePath: __dirname, 9 | database: [ 10 | Potion, 11 | Sword, 12 | Confuse, 13 | HpPlus, 14 | Sleep, 15 | Fire 16 | ] 17 | }) 18 | export class RPGServer extends RpgServerEngine { 19 | 20 | } -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/shape.ts: -------------------------------------------------------------------------------- 1 | export const box = { 2 | x: 0, 3 | y: 0, 4 | width: 100, 5 | height: 100, 6 | name: 'test' 7 | } 8 | export const circle = { 9 | ellipse: true, 10 | x: 0, 11 | y: 0, 12 | width: 100, 13 | height: 100, 14 | name: 'test' 15 | } 16 | export const polygon = { 17 | polygon: [{ 18 | x: 0, 19 | y: 0 20 | }, { 21 | x: 71, 22 | y: -9 23 | }, { 24 | x: 255, 25 | y: 83 26 | }, { 27 | x: 235, 28 | y: 273 29 | }, 30 | { 31 | x: 31, 32 | y: 235 33 | }], 34 | x: 0, 35 | y: 0, 36 | width: 0, 37 | height: 0, 38 | name: 'test' 39 | } -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/skill.ts: -------------------------------------------------------------------------------- 1 | import { Skill } from '@rpgjs/database' 2 | import { Confuse } from './state' 3 | 4 | @Skill({ 5 | id: 'fire', 6 | name: 'Fire', 7 | spCost: 75, 8 | power: 140, 9 | addStates: [Confuse] 10 | }) 11 | export class Fire {} 12 | 13 | @Skill({ 14 | id: 'ice', 15 | name: 'Ice', 16 | spCost: 60, 17 | power: 130, 18 | }) 19 | export class Ice {} -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/sounds/Town_Theme.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/tests/unit-tests/specs/fixtures/sounds/Town_Theme.ogg -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/spritesheets/sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RSamaium/RPG-JS/7ae3df045566b595a8bdca60e2b2ea411e620868/tests/unit-tests/specs/fixtures/spritesheets/sample.png -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/state.ts: -------------------------------------------------------------------------------- 1 | import { State, Effect } from '@rpgjs/database' 2 | import { Presets } from '@rpgjs/server' 3 | 4 | const { MAXHP } = Presets 5 | 6 | @State({ 7 | name: 'Confuse', 8 | effects: [Effect.CAN_NOT_SKILL] 9 | }) 10 | export class Confuse { 11 | 12 | } 13 | 14 | @State({ 15 | name: 'Sleep' 16 | }) 17 | export class Sleep { 18 | 19 | } 20 | 21 | @State({ 22 | name: 'HP Plus', 23 | paramsModifier: { 24 | [MAXHP]: { 25 | value: 100 26 | } 27 | } 28 | }) 29 | export class HpPlus { 30 | 31 | } -------------------------------------------------------------------------------- /tests/unit-tests/specs/fixtures/weapons.ts: -------------------------------------------------------------------------------- 1 | import { Weapon } from '@rpgjs/database' 2 | import { Elements } from './elements' 3 | import { Confuse } from './state'; 4 | 5 | @Weapon({ 6 | name: 'Sword', 7 | price: 100, 8 | atk: 112, 9 | elements: [Elements.Fire] 10 | }) 11 | export class Sword { 12 | 13 | } -------------------------------------------------------------------------------- /tests/unit-tests/specs/standalone.spec.ts: -------------------------------------------------------------------------------- 1 | import { entryPoint } from '@rpgjs/standalone' 2 | import { beforeEach, test, afterEach, expect } from 'vitest' 3 | 4 | let game, server, client 5 | 6 | beforeEach(async () => { 7 | const game = await entryPoint([]).start() 8 | server = game.server 9 | client = game.client 10 | }) 11 | 12 | test('Test RPG mode starting', async () => { 13 | expect(server).toBeDefined() 14 | expect(client).toBeDefined() 15 | }) 16 | 17 | afterEach(() => { 18 | server.world.clear() 19 | client.reset() 20 | }) -------------------------------------------------------------------------------- /tests/unit-tests/specs/utils.spec.ts: -------------------------------------------------------------------------------- 1 | import { Utils } from '@rpgjs/common' 2 | import { test, expect, describe } from 'vitest' 3 | 4 | 5 | describe('extractId()', () => { 6 | test('Image', () => { 7 | const id = Utils.extractId('foo/bar/baz.png') 8 | expect(id).toBe('baz') 9 | }) 10 | 11 | test('Map', () => { 12 | const id = Utils.extractId('foo/bar/baz.tmx') 13 | expect(id).toBe('baz') 14 | }) 15 | 16 | test('Sound', () => { 17 | const id = Utils.extractId('foo/bar/baz.mp3') 18 | expect(id).toBe('baz') 19 | }) 20 | }) 21 | 22 | --------------------------------------------------------------------------------