From f1e40fc479b2a0b1058d8e9a84685b379d2af21e Mon Sep 17 00:00:00 2001 From: Nick Kosarev Date: Thu, 22 Aug 2024 12:21:31 +0200 Subject: [PATCH] feat: added prisma to monorepo (#209) * feat: added prisma to monorepo * chore: prepared prisma client * chore: types, websocket, formatting --- .env.example | 3 + .github/ISSUE_TEMPLATE/bug_report.md | 18 +- .github/ISSUE_TEMPLATE/feature_request.md | 1 - .github/renovate.json | 15 +- .github/workflows/ci.yml | 1 + .github/workflows/deploy-prod.yml | 2 +- .prettierrc | 4 +- .vscode/extensions.json | 6 +- .vscode/settings.json | 2 +- CHANGELOG.md | 11 +- apps/website-e2e/playwright.config.ts | 10 +- apps/website-e2e/src/example.spec.ts | 8 +- apps/website-svelte/src/app.html | 20 +- apps/website-svelte/src/hooks.server.ts | 12 +- apps/website-svelte/src/lib/config.ts | 12 +- .../src/lib/game/actions/interface.ts | 5 +- apps/website-svelte/src/lib/game/baseGame.ts | 15 +- .../src/lib/game/common/generators/unitTop.ts | 8 +- .../src/lib/game/common/inventory.ts | 7 +- .../src/lib/game/common/poll.ts | 6 +- .../lib/game/components/buildingInterface.ts | 16 +- .../lib/game/components/dialogueInterface.ts | 14 +- .../lib/game/components/graphicsContainer.ts | 7 +- .../lib/game/components/unitHairContainer.ts | 19 +- .../lib/game/components/unitHeadContainer.ts | 7 +- .../src/lib/game/components/unitInterface.ts | 54 +- .../lib/game/components/unitTopContainer.ts | 12 +- .../components/wagonEngineCloudsContainer.ts | 3 +- .../game/components/wagonWheelContainer.ts | 2 +- .../src/lib/game/objects/baseObject.ts | 5 +- .../src/lib/game/objects/baseWagon.ts | 41 +- .../game/objects/buildings/baseBuilding.ts | 6 +- .../objects/buildings/constructionArea.ts | 9 +- .../src/lib/game/objects/flagObject.ts | 6 +- .../src/lib/game/objects/treeObject.ts | 24 +- .../src/lib/game/objects/units/player.ts | 6 +- .../src/lib/game/objects/units/unitObject.ts | 19 +- .../game/quests/treesAreRunningOutQuest.ts | 9 +- .../src/lib/game/scripts/buildScript.ts | 6 +- .../src/lib/game/scripts/chopTreeScript.ts | 6 +- .../src/lib/game/scripts/mineStoneScript.ts | 6 +- .../moveOffScreenAndSelfDestroyScript.ts | 12 +- .../scripts/moveToTradePostAndTradeScript.ts | 12 +- .../scripts/placeItemInWarehouseScript.ts | 12 +- .../lib/game/scripts/plantNewTreeScript.ts | 12 +- .../lib/game/services/action/actionService.ts | 85 +- .../src/lib/game/services/action/answer.ts | 6 +- .../src/lib/game/services/action/interface.ts | 18 +- .../src/lib/game/services/chunk/baseChunk.ts | 59 +- .../lib/game/services/chunk/chunkService.ts | 42 +- .../lib/game/services/chunk/forestChunk.ts | 13 +- .../src/lib/game/services/chunk/interface.ts | 19 +- .../src/lib/game/services/chunk/lakeChunk.ts | 13 +- .../lib/game/services/chunk/villageChunk.ts | 37 +- .../lib/game/services/event/eventService.ts | 23 +- .../src/lib/game/services/event/interface.ts | 16 +- .../lib/game/services/event/pollService.ts | 5 +- .../src/lib/game/services/interface.ts | 4 +- .../lib/game/services/player/playerService.ts | 4 +- .../src/lib/game/services/quest/interface.ts | 2 +- .../lib/game/services/quest/questService.ts | 20 +- .../src/lib/game/services/route/interface.ts | 13 +- .../src/lib/game/services/route/route.ts | 7 +- .../lib/game/services/route/routeService.ts | 20 +- .../lib/game/services/server/serverService.ts | 4 +- .../src/lib/game/services/socket/interface.ts | 4 +- .../game/services/socket/webSocketService.ts | 8 +- .../src/lib/game/services/trade/interface.ts | 2 +- .../lib/game/services/trade/tradeService.ts | 37 +- .../src/lib/game/services/wagon/interface.ts | 8 +- .../lib/game/services/wagon/wagonService.ts | 14 +- .../stream-plugin/customWebSocketService.ts | 8 +- .../game/stream-plugin/unitsOnStreamPlugin.ts | 13 +- apps/website-svelte/src/lib/game/types.ts | 55 +- .../src/lib/game/utils/assetsManager.ts | 7 +- .../lib/game/utils/generators/background.ts | 27 +- .../game/utils/generators/backgroundImages.ts | 133 ++- apps/website-svelte/src/lib/styles/legacy.css | 865 +++++++++--------- apps/website-svelte/src/lib/styles/styles.css | 163 ++-- .../website-svelte/src/lib/styles/website.css | 9 +- apps/website-svelte/tsconfig.json | 6 +- apps/website-svelte/vite.config.ts | 5 +- apps/website/nuxt.config.ts | 12 +- apps/website/src/assets/css/styles.css | 52 +- .../src/components/MainHeader.client.vue | 96 +- .../src/components/MainLogo.client.vue | 132 ++- apps/website/src/components/MenuDesktop.vue | 116 ++- apps/website/src/components/MenuHamburger.vue | 85 +- apps/website/src/components/MenuProfile.vue | 83 +- .../website/src/components/MenuSmartphone.vue | 77 +- apps/website/src/pages/index.vue | 179 ++-- .../website/src/public/units/banana/idle.json | 102 +-- .../src/public/units/banana/moving.json | 150 +-- .../website/src/public/units/burger/idle.json | 86 +- .../src/public/units/burger/moving.json | 150 +-- .../website/src/public/units/catchy/idle.json | 102 +-- .../src/public/units/catchy/moving.json | 150 +-- apps/website/src/public/units/claw/idle.json | 86 +- .../website/src/public/units/claw/moving.json | 150 +-- .../src/public/units/gentleman/idle.json | 86 +- .../src/public/units/gentleman/moving.json | 150 +-- .../src/public/units/marshmallow/idle.json | 86 +- .../src/public/units/marshmallow/moving.json | 150 +-- apps/website/src/public/units/pup/idle.json | 86 +- apps/website/src/public/units/pup/moving.json | 150 +-- apps/website/src/public/units/shape/idle.json | 86 +- .../src/public/units/shape/moving.json | 150 +-- .../website/src/public/units/sharky/idle.json | 86 +- .../src/public/units/sharky/moving.json | 150 +-- .../src/public/units/twitchy/idle.json | 86 +- .../src/public/units/twitchy/moving.json | 150 +-- apps/website/src/public/units/woody/idle.json | 86 +- .../src/public/units/woody/moving.json | 150 +-- apps/website/src/public/units/wooly/idle.json | 86 +- .../src/public/units/wooly/moving.json | 150 +-- apps/website/src/server/api/auth/me.get.ts | 6 +- .../website/src/server/api/auth/twitch.get.ts | 14 +- apps/website/src/server/api/websocket.ts | 51 ++ apps/website/src/server/plugins/start.ts | 4 +- apps/website/src/server/tsconfig.json | 6 + apps/website/src/server/utils/logger.ts | 27 +- apps/website/src/server/utils/room.ts | 19 + apps/website/src/stores/website.ts | 4 +- apps/website/src/utils/__tests__/date.spec.ts | 104 +-- .../src/utils/__tests__/locale.spec.ts | 56 +- .../src/utils/__tests__/random.spec.ts | 40 +- apps/website/src/utils/date.ts | 10 +- apps/website/src/utils/locale.ts | 27 +- apps/website/src/utils/random.ts | 8 +- apps/website/tsconfig.spec.json | 8 +- apps/website/vitest.config.ts | 8 +- libs/prisma-client/.eslintrc.json | 18 + libs/prisma-client/project.json | 8 + libs/prisma-client/src/index.ts | 1 + libs/prisma-client/src/lib/prisma-client.ts | 3 + libs/prisma-client/tsconfig.json | 19 + libs/prisma-client/tsconfig.lib.json | 10 + libs/prisma-schema/prisma/schema.prisma | 370 ++++++++ libs/prisma-schema/project.json | 27 + libs/prisma-schema/tsconfig.json | 19 + libs/prisma-schema/tsconfig.lib.json | 10 + libs/types/.eslintrc.json | 18 + libs/types/project.json | 8 + libs/types/src/index.ts | 1 + libs/types/src/lib/types.ts | 487 ++++++++++ libs/types/tsconfig.json | 19 + libs/types/tsconfig.lib.json | 10 + package.json | 5 +- tsconfig.base.json | 6 +- vitest.workspace.ts | 2 +- yarn.lock | 79 +- 151 files changed, 4109 insertions(+), 3364 deletions(-) create mode 100644 apps/website/src/server/api/websocket.ts create mode 100644 apps/website/src/server/utils/room.ts create mode 100644 libs/prisma-client/.eslintrc.json create mode 100644 libs/prisma-client/project.json create mode 100644 libs/prisma-client/src/index.ts create mode 100644 libs/prisma-client/src/lib/prisma-client.ts create mode 100644 libs/prisma-client/tsconfig.json create mode 100644 libs/prisma-client/tsconfig.lib.json create mode 100644 libs/prisma-schema/prisma/schema.prisma create mode 100644 libs/prisma-schema/project.json create mode 100644 libs/prisma-schema/tsconfig.json create mode 100644 libs/prisma-schema/tsconfig.lib.json create mode 100644 libs/types/.eslintrc.json create mode 100644 libs/types/project.json create mode 100644 libs/types/src/index.ts create mode 100644 libs/types/src/lib/types.ts create mode 100644 libs/types/tsconfig.json create mode 100644 libs/types/tsconfig.lib.json diff --git a/.env.example b/.env.example index 88619bdc..afffede4 100644 --- a/.env.example +++ b/.env.example @@ -14,5 +14,8 @@ PRIVATE_WEBSITE_BEARER="" # WebSocket server with event messages PUBLIC_WEBSOCKET_URL="" +# Database +DATABASE_URL="" + # App version VERSION="" diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index dd84ea78..b5c68e55 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -4,7 +4,6 @@ about: Create a report to help us improve title: '' labels: '' assignees: '' - --- **Describe the bug** @@ -12,6 +11,7 @@ A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: + 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen. If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] **Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] **Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index bbcbbe7d..2f28cead 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,7 +4,6 @@ about: Suggest an idea for this project title: '' labels: '' assignees: '' - --- **Is your feature request related to a problem? Please describe.** diff --git a/.github/renovate.json b/.github/renovate.json index d7314454..dd687add 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -12,19 +12,10 @@ }, "packageRules": [ { - "matchUpdateTypes": [ - "minor", - "patch", - "pin", - "digest" - ], + "matchUpdateTypes": ["minor", "patch", "pin", "digest"], "automerge": true, - "automergeSchedule": [ - "after 1am and before 2am" - ], - "schedule": [ - "after 2am and before 3am" - ] + "automergeSchedule": ["after 1am and before 2am"], + "schedule": ["after 2am and before 3am"] } ] } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee0fe970..ba612092 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,4 +36,5 @@ jobs: # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud # - run: yarn nx-cloud record -- echo Hello World # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected + - run: yarn run lint - run: yarn nx affected -t build lint test diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 84708476..f50ed010 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -56,4 +56,4 @@ jobs: token: '${{ github.token }}' environment-url: ${{ steps.deployment.outputs.environment_url }} deployment-id: ${{ steps.deployment.outputs.deployment_id }} - state: 'failure' \ No newline at end of file + state: 'failure' diff --git a/.prettierrc b/.prettierrc index 544138be..b52a92b1 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,5 @@ { - "singleQuote": true + "singleQuote": true, + "semi": false, + "printWidth": 100 } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 227d2de9..dadd80bb 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,3 @@ { - "recommendations": [ - "nrwl.angular-console", - "esbenp.prettier-vscode", - "ms-playwright.playwright" - ] + "recommendations": ["nrwl.angular-console", "esbenp.prettier-vscode", "ms-playwright.playwright"] } diff --git a/.vscode/settings.json b/.vscode/settings.json index cea90f0a..a7efa1f4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -42,4 +42,4 @@ "pcss", "postcss" ] -} \ No newline at end of file +} diff --git a/CHANGELOG.md b/CHANGELOG.md index b742bbd6..014d2db7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Changelog - ## v0.2.0 [compare changes](https://github.com/hmbanan666/chat-game/compare/v0.1.0...v0.2.0) @@ -20,7 +19,7 @@ ### 📦 Build -- ⚠️ Migrate npm to yarn ([b314be9](https://github.com/hmbanan666/chat-game/commit/b314be9)) +- ⚠️ Migrate npm to yarn ([b314be9](https://github.com/hmbanan666/chat-game/commit/b314be9)) ### 🏡 Chore @@ -31,7 +30,7 @@ #### ⚠️ Breaking Changes -- ⚠️ Migrate npm to yarn ([b314be9](https://github.com/hmbanan666/chat-game/commit/b314be9)) +- ⚠️ Migrate npm to yarn ([b314be9](https://github.com/hmbanan666/chat-game/commit/b314be9)) ### ❤️ Contributors @@ -41,13 +40,12 @@ ## v0.1.0 - ### 🚀 Enhancements - Tests ([8dd5cb7](https://github.com/hmbanan666/chat-game/commit/8dd5cb7)) - Conventional commits ([4cc6d9b](https://github.com/hmbanan666/chat-game/commit/4cc6d9b)) - Migrate dependabot to renovate ([31bfaca](https://github.com/hmbanan666/chat-game/commit/31bfaca)) -- ⚠️ Support i18n ([a07e69e](https://github.com/hmbanan666/chat-game/commit/a07e69e)) +- ⚠️ Support i18n ([a07e69e](https://github.com/hmbanan666/chat-game/commit/a07e69e)) ### 🩹 Fixes @@ -85,9 +83,8 @@ #### ⚠️ Breaking Changes -- ⚠️ Support i18n ([a07e69e](https://github.com/hmbanan666/chat-game/commit/a07e69e)) +- ⚠️ Support i18n ([a07e69e](https://github.com/hmbanan666/chat-game/commit/a07e69e)) ### ❤️ Contributors - Hywax ([@hywax](http://github.com/hywax)) - diff --git a/apps/website-e2e/playwright.config.ts b/apps/website-e2e/playwright.config.ts index 755b0fdd..7dd61b08 100644 --- a/apps/website-e2e/playwright.config.ts +++ b/apps/website-e2e/playwright.config.ts @@ -1,10 +1,10 @@ -import { defineConfig, devices } from '@playwright/test'; -import { nxE2EPreset } from '@nx/playwright/preset'; +import { defineConfig, devices } from '@playwright/test' +import { nxE2EPreset } from '@nx/playwright/preset' -import { workspaceRoot } from '@nx/devkit'; +import { workspaceRoot } from '@nx/devkit' // For CI, you may want to set BASE_URL to the deployed application. -const baseURL = process.env['BASE_URL'] || 'http://localhost:4200'; +const baseURL = process.env['BASE_URL'] || 'http://localhost:4200' /** * Read environment variables from file. @@ -66,4 +66,4 @@ export default defineConfig({ use: { ...devices['Desktop Chrome'], channel: 'chrome' }, } */ ], -}); +}) diff --git a/apps/website-e2e/src/example.spec.ts b/apps/website-e2e/src/example.spec.ts index fa8f1f33..4bbdd7c6 100644 --- a/apps/website-e2e/src/example.spec.ts +++ b/apps/website-e2e/src/example.spec.ts @@ -1,8 +1,8 @@ -import { test, expect } from '@playwright/test'; +import { test, expect } from '@playwright/test' test('has title', async ({ page }) => { - await page.goto('/'); + await page.goto('/') // Expect h1 to contain a substring. - expect(await page.locator('h1').innerText()).toContain('Welcome'); -}); + expect(await page.locator('h1').innerText()).toContain('Welcome') +}) diff --git a/apps/website-svelte/src/app.html b/apps/website-svelte/src/app.html index 817dac30..1de68026 100644 --- a/apps/website-svelte/src/app.html +++ b/apps/website-svelte/src/app.html @@ -1,12 +1,12 @@ - + - - - - - %sveltekit.head% - - -
%sveltekit.body%
- + + + + + %sveltekit.head% + + +
%sveltekit.body%
+ diff --git a/apps/website-svelte/src/hooks.server.ts b/apps/website-svelte/src/hooks.server.ts index 7acbac64..507baf82 100644 --- a/apps/website-svelte/src/hooks.server.ts +++ b/apps/website-svelte/src/hooks.server.ts @@ -31,9 +31,15 @@ const handleJWT: Handle = ({ event, resolve }) => { const handleLocale: Handle = async ({ event, resolve }) => { const { pathname, search } = event.url - const browserLang = `${`${event.request.headers.get('accept-language')}`.match(/[a-z]+(?=[\-_,;])/i)}`.toLowerCase() - const browserLocale = supportedLocales.find((locale) => locale === browserLang) ? browserLang as Locale : defaultLocale - const locale = supportedLocales.find((locale) => locale === event.params.lang) ? event.params.lang as Locale : browserLocale + const browserLang = `${`${event.request.headers.get('accept-language')}`.match( + /[a-z]+(?=[\-_,;])/i + )}`.toLowerCase() + const browserLocale = supportedLocales.find((locale) => locale === browserLang) + ? (browserLang as Locale) + : defaultLocale + const locale = supportedLocales.find((locale) => locale === event.params.lang) + ? (event.params.lang as Locale) + : browserLocale event.locals.locale = locale diff --git a/apps/website-svelte/src/lib/config.ts b/apps/website-svelte/src/lib/config.ts index e715871a..426c44a6 100644 --- a/apps/website-svelte/src/lib/config.ts +++ b/apps/website-svelte/src/lib/config.ts @@ -20,11 +20,13 @@ const allEnv = z.object({ PUBLIC_GAME_ADMIN_PLAYER_ID: z.string().default('svhjz9p5467wne9ybasf1bwy'), PUBLIC_TWITCH_CLIENT_ID: z.string().default(''), PUBLIC_TWITCH_URL: z.string().default('https://www.twitch.tv/hmbanan666'), - PUBLIC_TWITCH_CHANNEL_REWARDS: z.string().default(JSON.stringify({ - add150ViewerPointsId: 'd8237822-c943-434f-9d7e-87a9f549f4c4', - villainStealFuelId: 'd5956de4-54ff-49e4-afbe-ee4e62718eee', - addNewIdea: '289457e8-18c2-4b68-8564-fc61dd60b2a2', - })), + PUBLIC_TWITCH_CHANNEL_REWARDS: z.string().default( + JSON.stringify({ + add150ViewerPointsId: 'd8237822-c943-434f-9d7e-87a9f549f4c4', + villainStealFuelId: 'd5956de4-54ff-49e4-afbe-ee4e62718eee', + addNewIdea: '289457e8-18c2-4b68-8564-fc61dd60b2a2', + }) + ), }) const ConfigSchema = allEnv.transform((value) => { diff --git a/apps/website-svelte/src/lib/game/actions/interface.ts b/apps/website-svelte/src/lib/game/actions/interface.ts index 3ec94365..508ad450 100644 --- a/apps/website-svelte/src/lib/game/actions/interface.ts +++ b/apps/website-svelte/src/lib/game/actions/interface.ts @@ -3,8 +3,5 @@ import type { GameObjectPlayer, IGameActionResponse } from '$lib/game/types' export interface GameAction { command: string commandDescription: string - live: ( - player: GameObjectPlayer, - params: string[], - ) => Promise + live: (player: GameObjectPlayer, params: string[]) => Promise } diff --git a/apps/website-svelte/src/lib/game/baseGame.ts b/apps/website-svelte/src/lib/game/baseGame.ts index 772b1dad..609c45bc 100644 --- a/apps/website-svelte/src/lib/game/baseGame.ts +++ b/apps/website-svelte/src/lib/game/baseGame.ts @@ -10,15 +10,14 @@ import type { GameOptions, GameSceneType, GameStateResponse, - IGameInventoryItem, IGameObjectRaider, + IGameInventoryItem, + IGameObjectRaider, } from '$lib/game/types' import { AudioManager } from '$lib/game/utils/audioManager' import { BackgroundGenerator } from '$lib/game/utils/generators/background' import { AssetsManager } from '$lib/game/utils/assetsManager' import { MovingScene } from '$lib/game/scenes/movingScene' -import { - MoveOffScreenAndSelfDestroyScript, -} from '$lib/game/scripts/moveOffScreenAndSelfDestroyScript' +import { MoveOffScreenAndSelfDestroyScript } from '$lib/game/scripts/moveOffScreenAndSelfDestroyScript' import { getRandomInRange } from '$lib/utils/random' import { MoveToTargetScript } from '$lib/game/scripts/moveToTargetScript' import { ChopTreeScript } from '$lib/game/scripts/chopTreeScript' @@ -293,10 +292,7 @@ export class BaseGame extends Container implements Game { if (!object.target || object.target.state === 'DESTROYED') { object.state = 'IDLE' if (object.target instanceof TreeObject) { - void object.inventory.addOrCreateItem( - 'WOOD', - object.target?.resource, - ) + void object.inventory.addOrCreateItem('WOOD', object.target?.resource) } return true } @@ -338,8 +334,7 @@ export class BaseGame extends Container implements Game { const columnWidth = this.app.screen.width / 6 const rowHeight = this.app.screen.height / 6 - let leftPadding - = wagon.direction === 'LEFT' ? columnWidth * 4 : columnWidth * 2 + let leftPadding = wagon.direction === 'LEFT' ? columnWidth * 4 : columnWidth * 2 let topPadding = rowHeight * 3 if (wagon.speedPerSecond === 0) { diff --git a/apps/website-svelte/src/lib/game/common/generators/unitTop.ts b/apps/website-svelte/src/lib/game/common/generators/unitTop.ts index e0ffd8b9..2de36f0b 100644 --- a/apps/website-svelte/src/lib/game/common/generators/unitTop.ts +++ b/apps/website-svelte/src/lib/game/common/generators/unitTop.ts @@ -1,15 +1,11 @@ import type { IGameObjectUnit } from '$lib/game/types' -export function generateUnitTop(): Partial< - IGameObjectUnit['visual']['top'] -> { +export function generateUnitTop(): Partial { const availableTopsForUnits: IGameObjectUnit['visual']['top'][] = [ 'GREEN_SHIRT', 'BLUE_SHIRT', 'DARK_SILVER_SHIRT', ] - return availableTopsForUnits[ - Math.floor(Math.random() * availableTopsForUnits.length) - ] + return availableTopsForUnits[Math.floor(Math.random() * availableTopsForUnits.length)] } diff --git a/apps/website-svelte/src/lib/game/common/inventory.ts b/apps/website-svelte/src/lib/game/common/inventory.ts index c822c6ff..8838b18d 100644 --- a/apps/website-svelte/src/lib/game/common/inventory.ts +++ b/apps/website-svelte/src/lib/game/common/inventory.ts @@ -1,10 +1,5 @@ import { createId } from '@paralleldrive/cuid2' -import type { - GameObject, - IGameInventory, - IGameInventoryItem, - ItemType, -} from '$lib/game/types' +import type { GameObject, IGameInventory, IGameInventoryItem, ItemType } from '$lib/game/types' interface InventoryOptions { object: GameObject diff --git a/apps/website-svelte/src/lib/game/common/poll.ts b/apps/website-svelte/src/lib/game/common/poll.ts index b9fc3eeb..c46a9848 100644 --- a/apps/website-svelte/src/lib/game/common/poll.ts +++ b/apps/website-svelte/src/lib/game/common/poll.ts @@ -1,11 +1,7 @@ import { createId } from '@paralleldrive/cuid2' import { VoteAction } from '../actions/voteAction' import { getRandomInRange } from '$lib/utils/random' -import type { - Game, - GameObjectPlayer, - IGamePoll, -} from '$lib/game/types' +import type { Game, GameObjectPlayer, IGamePoll } from '$lib/game/types' interface IPollOptions { game: Game diff --git a/apps/website-svelte/src/lib/game/components/buildingInterface.ts b/apps/website-svelte/src/lib/game/components/buildingInterface.ts index c0d9db8e..99427830 100644 --- a/apps/website-svelte/src/lib/game/components/buildingInterface.ts +++ b/apps/website-svelte/src/lib/game/components/buildingInterface.ts @@ -20,12 +20,8 @@ export class BuildingInterface extends GraphicsContainer { } init() { - this.wood - = this.building.inventory.items.find((item) => item.type === 'WOOD') - ?.amount ?? 0 - this.stone - = this.building.inventory.items.find((item) => item.type === 'STONE') - ?.amount ?? 0 + this.wood = this.building.inventory.items.find((item) => item.type === 'WOOD')?.amount ?? 0 + this.stone = this.building.inventory.items.find((item) => item.type === 'STONE')?.amount ?? 0 this.drawWood() this.drawStone() @@ -43,12 +39,8 @@ export class BuildingInterface extends GraphicsContainer { } update() { - const wood = this.building.inventory.items.find( - (item) => item.type === 'WOOD', - )?.amount - const stone = this.building.inventory.items.find( - (item) => item.type === 'STONE', - )?.amount + const wood = this.building.inventory.items.find((item) => item.type === 'WOOD')?.amount + const stone = this.building.inventory.items.find((item) => item.type === 'STONE')?.amount if (wood !== this.wood || stone !== this.stone) { this.wood = wood diff --git a/apps/website-svelte/src/lib/game/components/dialogueInterface.ts b/apps/website-svelte/src/lib/game/components/dialogueInterface.ts index 3970d756..91ad09fc 100644 --- a/apps/website-svelte/src/lib/game/components/dialogueInterface.ts +++ b/apps/website-svelte/src/lib/game/components/dialogueInterface.ts @@ -4,7 +4,7 @@ import type { IGameObjectUnit } from '$lib/game/types' export class DialogueInterface extends GraphicsContainer { public unit: IGameObjectUnit - public messages: { id: string, text: string, isShowed: boolean }[] + public messages: { id: string; text: string; isShowed: boolean }[] #showingSpeed: number constructor(unit: IGameObjectUnit) { @@ -19,7 +19,7 @@ export class DialogueInterface extends GraphicsContainer { this.y = 0 } - create(message: { id: string, text: string }) { + create(message: { id: string; text: string }) { const container = new GraphicsContainer({ type: 'INTERFACE' }) const basicText = new Text({ @@ -28,7 +28,7 @@ export class DialogueInterface extends GraphicsContainer { fontFamily: 'Noto Serif', fontSize: 16, fontWeight: '500', - fill: 0x451A03, + fill: 0x451a03, align: 'left', wordWrap: true, wordWrapWidth: 350, @@ -42,7 +42,7 @@ export class DialogueInterface extends GraphicsContainer { const graphics = new Graphics() graphics.rect(-rectOffsetX, -rectOffsetY, rectWidth, rectHeight) - graphics.fill(0xFEF3C7) + graphics.fill(0xfef3c7) container.addChild(graphics, basicText) @@ -76,9 +76,7 @@ export class DialogueInterface extends GraphicsContainer { this.create(needToShowMessages[0]) needToShowMessages[0].isShowed = true - this.#showingSpeed = this.#getShowingSpeed( - needToShowMessages[0].text.length, - ) + this.#showingSpeed = this.#getShowingSpeed(needToShowMessages[0].text.length) } for (const container of this.children) { @@ -93,6 +91,6 @@ export class DialogueInterface extends GraphicsContainer { } #getShowingSpeed(messageLength: number) { - return (0.05 - ((messageLength * 4) / 10000)) / this.unit.game.tick + return (0.05 - (messageLength * 4) / 10000) / this.unit.game.tick } } diff --git a/apps/website-svelte/src/lib/game/components/graphicsContainer.ts b/apps/website-svelte/src/lib/game/components/graphicsContainer.ts index a22a526d..cf85d2cd 100644 --- a/apps/website-svelte/src/lib/game/components/graphicsContainer.ts +++ b/apps/website-svelte/src/lib/game/components/graphicsContainer.ts @@ -1,8 +1,5 @@ import { Container, Sprite } from 'pixi.js' -import type { - GraphicsContainerType, - IGameObjectDirection, -} from '$lib/game/types' +import type { GraphicsContainerType, IGameObjectDirection } from '$lib/game/types' interface IGraphicsContainerOptions { type: GraphicsContainerType @@ -25,7 +22,7 @@ export class GraphicsContainer extends Container { static createWithSprite( spriteIndex: string, direction: IGameObjectDirection, - type: GraphicsContainerType, + type: GraphicsContainerType ) { const sprite = Sprite.from(spriteIndex) sprite.anchor.set(0.5, 1) diff --git a/apps/website-svelte/src/lib/game/components/unitHairContainer.ts b/apps/website-svelte/src/lib/game/components/unitHairContainer.ts index 4b8d6db6..aee6a123 100644 --- a/apps/website-svelte/src/lib/game/components/unitHairContainer.ts +++ b/apps/website-svelte/src/lib/game/components/unitHairContainer.ts @@ -18,7 +18,7 @@ export class UnitHairContainer extends GraphicsContainer { static create( spriteIndex: string, direction: IGameObjectDirection, - visual: IGameObjectUnit['visual']['hairstyle'], + visual: IGameObjectUnit['visual']['hairstyle'] ) { const sprite = Sprite.from(spriteIndex) sprite.anchor.set(0.5, 1) @@ -36,7 +36,7 @@ export class UnitHairContainer extends GraphicsContainer { static createWithBothDirections( spriteIndex: string, - visual: IGameObjectUnit['visual']['hairstyle'], + visual: IGameObjectUnit['visual']['hairstyle'] ) { const containers = [] @@ -48,18 +48,9 @@ export class UnitHairContainer extends GraphicsContainer { static getAll() { return [ - ...UnitHairContainer.createWithBothDirections( - 'unitHairClassic', - 'CLASSIC', - ), - ...UnitHairContainer.createWithBothDirections( - 'unitHairCoalLong', - 'COAL_LONG', - ), - ...UnitHairContainer.createWithBothDirections( - 'unitHairOrangeWithBeard', - 'ORANGE_WITH_BEARD', - ), + ...UnitHairContainer.createWithBothDirections('unitHairClassic', 'CLASSIC'), + ...UnitHairContainer.createWithBothDirections('unitHairCoalLong', 'COAL_LONG'), + ...UnitHairContainer.createWithBothDirections('unitHairOrangeWithBeard', 'ORANGE_WITH_BEARD'), ] } } diff --git a/apps/website-svelte/src/lib/game/components/unitHeadContainer.ts b/apps/website-svelte/src/lib/game/components/unitHeadContainer.ts index 44e02514..3863d917 100644 --- a/apps/website-svelte/src/lib/game/components/unitHeadContainer.ts +++ b/apps/website-svelte/src/lib/game/components/unitHeadContainer.ts @@ -18,7 +18,7 @@ export class UnitHeadContainer extends GraphicsContainer { static create( spriteIndex: string, direction: IGameObjectDirection, - visual: IGameObjectUnit['visual']['head'], + visual: IGameObjectUnit['visual']['head'] ) { const sprite = Sprite.from(spriteIndex) sprite.anchor.set(0.5, 1) @@ -34,10 +34,7 @@ export class UnitHeadContainer extends GraphicsContainer { return container } - static createWithBothDirections( - spriteIndex: string, - visual: IGameObjectUnit['visual']['head'], - ) { + static createWithBothDirections(spriteIndex: string, visual: IGameObjectUnit['visual']['head']) { const containers = [] containers.push(UnitHeadContainer.create(spriteIndex, 'LEFT', visual)) diff --git a/apps/website-svelte/src/lib/game/components/unitInterface.ts b/apps/website-svelte/src/lib/game/components/unitInterface.ts index 371520cc..0ce660c2 100644 --- a/apps/website-svelte/src/lib/game/components/unitInterface.ts +++ b/apps/website-svelte/src/lib/game/components/unitInterface.ts @@ -35,19 +35,11 @@ export class UnitInterface extends GraphicsContainer { init() { this.coins = this.unit.coins - this.wood - = this.unit.inventory.items.find((item) => item.type === 'WOOD')?.amount - ?? 0 - this.stone - = this.unit.inventory.items.find((item) => item.type === 'STONE')?.amount - ?? 0 - - this.haveAxe = !!this.unit.inventory.items.find( - (item) => item.type === 'AXE', - ) - this.havePickaxe = !!this.unit.inventory.items.find( - (item) => item.type === 'PICKAXE', - ) + this.wood = this.unit.inventory.items.find((item) => item.type === 'WOOD')?.amount ?? 0 + this.stone = this.unit.inventory.items.find((item) => item.type === 'STONE')?.amount ?? 0 + + this.haveAxe = !!this.unit.inventory.items.find((item) => item.type === 'AXE') + this.havePickaxe = !!this.unit.inventory.items.find((item) => item.type === 'PICKAXE') this.drawUserName() this.drawWood() @@ -71,26 +63,18 @@ export class UnitInterface extends GraphicsContainer { update() { const name = this.unit.name - const wood - = this.unit.inventory.items.find((item) => item.type === 'WOOD')?.amount - ?? 0 - const stone - = this.unit.inventory.items.find((item) => item.type === 'STONE')?.amount - ?? 0 - const haveAxe = !!this.unit.inventory.items.find( - (item) => item.type === 'AXE', - ) - const havePickaxe = !!this.unit.inventory.items.find( - (item) => item.type === 'PICKAXE', - ) + const wood = this.unit.inventory.items.find((item) => item.type === 'WOOD')?.amount ?? 0 + const stone = this.unit.inventory.items.find((item) => item.type === 'STONE')?.amount ?? 0 + const haveAxe = !!this.unit.inventory.items.find((item) => item.type === 'AXE') + const havePickaxe = !!this.unit.inventory.items.find((item) => item.type === 'PICKAXE') if ( - name !== this.name - || this.unit.coins !== this.coins - || wood !== this.wood - || stone !== this.stone - || haveAxe !== this.haveAxe - || havePickaxe !== this.havePickaxe + name !== this.name || + this.unit.coins !== this.coins || + wood !== this.wood || + stone !== this.stone || + haveAxe !== this.haveAxe || + havePickaxe !== this.havePickaxe ) { this.name = name this.coins = this.unit.coins @@ -161,14 +145,14 @@ export class UnitInterface extends GraphicsContainer { fontFamily: 'Noto Serif', fontSize: 14, fontWeight: '600', - fill: 0x451A03, + fill: 0x451a03, align: 'center', }, }) const graphics = new Graphics() graphics.roundRect(-6, -2, basicText.width + 12, basicText.height + 4, 0) - graphics.fill(0xFEF3C7) + graphics.fill(0xfef3c7) container.addChild(graphics, basicText) @@ -280,9 +264,7 @@ export class UnitInterface extends GraphicsContainer { } getResourcesArray() { - return this.unit.inventory.items.filter( - (item) => item.type === 'WOOD' || item.type === 'STONE', - ) + return this.unit.inventory.items.filter((item) => item.type === 'WOOD' || item.type === 'STONE') } showNextItem() { diff --git a/apps/website-svelte/src/lib/game/components/unitTopContainer.ts b/apps/website-svelte/src/lib/game/components/unitTopContainer.ts index b86b5183..daa0b4d4 100644 --- a/apps/website-svelte/src/lib/game/components/unitTopContainer.ts +++ b/apps/website-svelte/src/lib/game/components/unitTopContainer.ts @@ -18,7 +18,7 @@ export class UnitTopContainer extends GraphicsContainer { static create( spriteIndex: string, direction: IGameObjectDirection, - visual: IGameObjectUnit['visual']['top'], + visual: IGameObjectUnit['visual']['top'] ) { const sprite = Sprite.from(spriteIndex) sprite.anchor.set(0.5, 1) @@ -34,10 +34,7 @@ export class UnitTopContainer extends GraphicsContainer { return container } - static createWithBothDirections( - spriteIndex: string, - visual: IGameObjectUnit['visual']['top'], - ) { + static createWithBothDirections(spriteIndex: string, visual: IGameObjectUnit['visual']['top']) { const containers = [] containers.push(UnitTopContainer.create(spriteIndex, 'LEFT', visual)) @@ -52,10 +49,7 @@ export class UnitTopContainer extends GraphicsContainer { ...UnitTopContainer.createWithBothDirections('blackTop', 'BLACK_SHIRT'), ...UnitTopContainer.createWithBothDirections('greenTop', 'GREEN_SHIRT'), ...UnitTopContainer.createWithBothDirections('blueTop', 'BLUE_SHIRT'), - ...UnitTopContainer.createWithBothDirections( - 'darkSilverTop', - 'DARK_SILVER_SHIRT', - ), + ...UnitTopContainer.createWithBothDirections('darkSilverTop', 'DARK_SILVER_SHIRT'), ] } } diff --git a/apps/website-svelte/src/lib/game/components/wagonEngineCloudsContainer.ts b/apps/website-svelte/src/lib/game/components/wagonEngineCloudsContainer.ts index 29e9572d..a174410f 100644 --- a/apps/website-svelte/src/lib/game/components/wagonEngineCloudsContainer.ts +++ b/apps/website-svelte/src/lib/game/components/wagonEngineCloudsContainer.ts @@ -24,8 +24,7 @@ export class WagonEngineCloudsContainer extends GraphicsContainer { this.#offset -= speed + 1 const cloudsActive = speed * 8 + 1 - const canCreateCloud - = this.children.length < cloudsActive && this.#offset <= 0 + const canCreateCloud = this.children.length < cloudsActive && this.#offset <= 0 if (canCreateCloud) { this.#createRandom() this.#offset = speed * getRandomInRange(170, 190) + 3 diff --git a/apps/website-svelte/src/lib/game/components/wagonWheelContainer.ts b/apps/website-svelte/src/lib/game/components/wagonWheelContainer.ts index 277889c7..730162cc 100644 --- a/apps/website-svelte/src/lib/game/components/wagonWheelContainer.ts +++ b/apps/website-svelte/src/lib/game/components/wagonWheelContainer.ts @@ -18,7 +18,7 @@ export class WagonWheelContainer extends GraphicsContainer { static create( spriteIndex: string, direction: IGameObjectDirection, - side: IWagonWheelContainerOptions['side'], + side: IWagonWheelContainerOptions['side'] ) { const sprite = Sprite.from(spriteIndex) sprite.anchor.set(0.5, 0.5) diff --git a/apps/website-svelte/src/lib/game/objects/baseObject.ts b/apps/website-svelte/src/lib/game/objects/baseObject.ts index c36ba579..5a0ff54f 100644 --- a/apps/website-svelte/src/lib/game/objects/baseObject.ts +++ b/apps/website-svelte/src/lib/game/objects/baseObject.ts @@ -136,10 +136,7 @@ export class BaseObject extends Container implements GameObject { } #checkIfIsOnTarget() { - return ( - this.#getDistanceToTargetX() + this.#getDistanceToTargetY() - <= this.minDistance - ) + return this.#getDistanceToTargetX() + this.#getDistanceToTargetY() <= this.minDistance } #getDistanceToTargetX() { diff --git a/apps/website-svelte/src/lib/game/objects/baseWagon.ts b/apps/website-svelte/src/lib/game/objects/baseWagon.ts index 365b385e..a23ab484 100644 --- a/apps/website-svelte/src/lib/game/objects/baseWagon.ts +++ b/apps/website-svelte/src/lib/game/objects/baseWagon.ts @@ -103,30 +103,30 @@ export class BaseWagon extends BaseObject implements Wagon { } } - checkIfPointInCollisionArea(point: { x: number, y: number }) { + checkIfPointInCollisionArea(point: { x: number; y: number }) { return ( - this.collisionArea.startX < point.x - && point.x < this.collisionArea.endX - && this.collisionArea.startY < point.y - && point.y < this.collisionArea.endY + this.collisionArea.startX < point.x && + point.x < this.collisionArea.endX && + this.collisionArea.startY < point.y && + point.y < this.collisionArea.endY ) } - public checkIfPointInVisibilityArea(point: { x: number, y: number }) { + public checkIfPointInVisibilityArea(point: { x: number; y: number }) { return ( - this.visibilityArea.startX < point.x - && point.x < this.visibilityArea.endX - && this.visibilityArea.startY < point.y - && point.y < this.visibilityArea.endY + this.visibilityArea.startX < point.x && + point.x < this.visibilityArea.endX && + this.visibilityArea.startY < point.y && + point.y < this.visibilityArea.endY ) } - public checkIfPointInServerDataArea(point: { x: number, y: number }) { + public checkIfPointInServerDataArea(point: { x: number; y: number }) { return ( - this.serverDataArea.startX < point.x - && point.x < this.serverDataArea.endX - && this.serverDataArea.startY < point.y - && point.y < this.serverDataArea.endY + this.serverDataArea.startX < point.x && + point.x < this.serverDataArea.endX && + this.serverDataArea.startY < point.y && + point.y < this.serverDataArea.endY ) } @@ -190,16 +190,7 @@ export class BaseWagon extends BaseObject implements Wagon { const clouds = new WagonEngineCloudsContainer({ wagon: this }) - this.addChild( - spriteBase, - engine, - cargo, - spriteSide, - storage, - wheel1, - wheel2, - clouds, - ) + this.addChild(spriteBase, engine, cargo, spriteSide, storage, wheel1, wheel2, clouds) } #drawWheels(container: GraphicsContainer) { diff --git a/apps/website-svelte/src/lib/game/objects/buildings/baseBuilding.ts b/apps/website-svelte/src/lib/game/objects/buildings/baseBuilding.ts index 49976f27..a55261d0 100644 --- a/apps/website-svelte/src/lib/game/objects/buildings/baseBuilding.ts +++ b/apps/website-svelte/src/lib/game/objects/buildings/baseBuilding.ts @@ -1,9 +1,5 @@ import { BaseObject } from '../baseObject' -import type { - Game, - GameObjectBuildingType, - IGameObjectBuilding, -} from '$lib/game/types' +import type { Game, GameObjectBuildingType, IGameObjectBuilding } from '$lib/game/types' import { Inventory } from '$lib/game/common/inventory' interface IBuildingOptions { diff --git a/apps/website-svelte/src/lib/game/objects/buildings/constructionArea.ts b/apps/website-svelte/src/lib/game/objects/buildings/constructionArea.ts index 79149d2c..99d82b0d 100644 --- a/apps/website-svelte/src/lib/game/objects/buildings/constructionArea.ts +++ b/apps/website-svelte/src/lib/game/objects/buildings/constructionArea.ts @@ -1,9 +1,6 @@ import { Sprite } from 'pixi.js' import { BaseBuilding } from './baseBuilding' -import type { - Game, - IGameBuildingConstructionArea, -} from '$lib/game/types' +import type { Game, IGameBuildingConstructionArea } from '$lib/game/types' interface IConstructionAreaOptions { game: Game @@ -12,9 +9,7 @@ interface IConstructionAreaOptions { chunkId?: string } -export class ConstructionArea - extends BaseBuilding - implements IGameBuildingConstructionArea { +export class ConstructionArea extends BaseBuilding implements IGameBuildingConstructionArea { constructor({ game, x, y, chunkId }: IConstructionAreaOptions) { super({ game, x, y, chunkId, type: 'CONSTRUCTION_AREA' }) diff --git a/apps/website-svelte/src/lib/game/objects/flagObject.ts b/apps/website-svelte/src/lib/game/objects/flagObject.ts index 87b46d5d..5c7efcb2 100644 --- a/apps/website-svelte/src/lib/game/objects/flagObject.ts +++ b/apps/website-svelte/src/lib/game/objects/flagObject.ts @@ -72,9 +72,9 @@ export class FlagObject extends BaseObject implements GameObjectFlag { #getSprite() { if ( - this.variant === 'MOVEMENT' - || this.variant === 'WAGON_NEAR_MOVEMENT' - || this.variant === 'WAGON_MOVEMENT' + this.variant === 'MOVEMENT' || + this.variant === 'WAGON_NEAR_MOVEMENT' || + this.variant === 'WAGON_MOVEMENT' ) { return Sprite.from('flag1') } diff --git a/apps/website-svelte/src/lib/game/objects/treeObject.ts b/apps/website-svelte/src/lib/game/objects/treeObject.ts index 92d4c833..c421cb18 100644 --- a/apps/website-svelte/src/lib/game/objects/treeObject.ts +++ b/apps/website-svelte/src/lib/game/objects/treeObject.ts @@ -28,17 +28,7 @@ export class TreeObject extends BaseObject implements GameObjectTree { private growSpeedPerSecond = 0.5 private animationSpeedPerSecond = 3 - constructor({ - game, - x, - y, - resource, - size, - health, - theme, - variant, - chunkId, - }: TreeOptions) { + constructor({ game, x, y, resource, size, health, theme, variant, chunkId }: TreeOptions) { super({ game, x, y, type: 'TREE' }) this.chunkId = chunkId @@ -135,8 +125,7 @@ export class TreeObject extends BaseObject implements GameObjectTree { } this.animationSpeedPerSecond *= -1 - this.angle - += ((this.animationSpeedPerSecond * 5) / this.game.tick) * 10 + this.angle += ((this.animationSpeedPerSecond * 5) / this.game.tick) * 10 } #shakeOnWind() { @@ -182,14 +171,7 @@ export class TreeObject extends BaseObject implements GameObjectTree { } #getRandomTheme(): GameObjectTree['theme'] { - const themes: GameObjectTree['theme'][] = [ - 'GREEN', - 'BLUE', - 'STONE', - 'TEAL', - 'TOXIC', - 'VIOLET', - ] + const themes: GameObjectTree['theme'][] = ['GREEN', 'BLUE', 'STONE', 'TEAL', 'TOXIC', 'VIOLET'] const index = getRandomInRange(0, themes.length - 1) return themes[index] } diff --git a/apps/website-svelte/src/lib/game/objects/units/player.ts b/apps/website-svelte/src/lib/game/objects/units/player.ts index 84ea48de..aff6ce75 100644 --- a/apps/website-svelte/src/lib/game/objects/units/player.ts +++ b/apps/website-svelte/src/lib/game/objects/units/player.ts @@ -1,10 +1,6 @@ import { UnitObject } from './unitObject' import { getRandomInRange } from '$lib/utils/random' -import type { - Game, - GameObjectPlayer, - IGameSkill, -} from '$lib/game/types' +import type { Game, GameObjectPlayer, IGameSkill } from '$lib/game/types' import { Skill } from '$lib/game/common/skill' import { Inventory } from '$lib/game/common/inventory' diff --git a/apps/website-svelte/src/lib/game/objects/units/unitObject.ts b/apps/website-svelte/src/lib/game/objects/units/unitObject.ts index 162ebdb1..e2cd6a9a 100644 --- a/apps/website-svelte/src/lib/game/objects/units/unitObject.ts +++ b/apps/website-svelte/src/lib/game/objects/units/unitObject.ts @@ -11,11 +11,7 @@ import { BaseObject } from '../baseObject' import { StoneObject } from '../stoneObject' import { TreeObject } from '../treeObject' import { getRandomInRange } from '$lib/utils/random' -import type { - Game, - GameObject, - IGameObjectUnit, -} from '$lib/game/types' +import type { Game, GameObject, IGameObjectUnit } from '$lib/game/types' import { Inventory } from '$lib/game/common/inventory' import { AssetsManager } from '$lib/game/utils/assetsManager' @@ -86,9 +82,8 @@ export class UnitObject extends BaseObject implements IGameObjectUnit { addMessage(message: string): void { const MAX_CHARS = 100 - const messagePrepared - = message.trim().slice(0, MAX_CHARS) - + (message.length > MAX_CHARS ? '...' : '') + const messagePrepared = + message.trim().slice(0, MAX_CHARS) + (message.length > MAX_CHARS ? '...' : '') this.dialogue.messages.push({ id: createId(), @@ -146,7 +141,7 @@ export class UnitObject extends BaseObject implements IGameObjectUnit { this.#animationMovingLeft, this.#animationMovingRight, this.#interface, - this.#dialogueInterface, + this.#dialogueInterface ) } @@ -184,11 +179,7 @@ export class UnitObject extends BaseObject implements IGameObjectUnit { } } - if ( - this.state === 'IDLE' - || this.state === 'CHOPPING' - || this.state === 'MINING' - ) { + if (this.state === 'IDLE' || this.state === 'CHOPPING' || this.state === 'MINING') { this.#animationMovingLeft.animationSpeed = 0 this.#animationMovingRight.animationSpeed = 0 this.#animationMovingLeft.currentFrame = 0 diff --git a/apps/website-svelte/src/lib/game/quests/treesAreRunningOutQuest.ts b/apps/website-svelte/src/lib/game/quests/treesAreRunningOutQuest.ts index 772f565b..72c7dfe1 100644 --- a/apps/website-svelte/src/lib/game/quests/treesAreRunningOutQuest.ts +++ b/apps/website-svelte/src/lib/game/quests/treesAreRunningOutQuest.ts @@ -10,16 +10,11 @@ interface ITreesAreRunningOutQuestOptions { } export class TreesAreRunningOutQuest extends BaseQuest { - constructor({ - creatorId, - taskUpdateFunc1, - taskAction1, - }: ITreesAreRunningOutQuestOptions) { + constructor({ creatorId, taskUpdateFunc1, taskAction1 }: ITreesAreRunningOutQuestOptions) { super({ type: 'SIDE', title: 'The trees are running out!', - description: - 'In the village, someone is actively cutting down trees. Help is needed!', + description: 'In the village, someone is actively cutting down trees. Help is needed!', }) this.creatorId = creatorId diff --git a/apps/website-svelte/src/lib/game/scripts/buildScript.ts b/apps/website-svelte/src/lib/game/scripts/buildScript.ts index eb0497e9..a37b328d 100644 --- a/apps/website-svelte/src/lib/game/scripts/buildScript.ts +++ b/apps/website-svelte/src/lib/game/scripts/buildScript.ts @@ -11,11 +11,7 @@ export class BuildScript extends Script { constructor({ target, object, buildFunc }: IBuildScriptOptions) { super({ object }) - this.tasks = [ - this.setTarget(target), - this.runToTarget(), - this.build(buildFunc), - ] + this.tasks = [this.setTarget(target), this.runToTarget(), this.build(buildFunc)] } build(func: () => boolean): IGameTask { diff --git a/apps/website-svelte/src/lib/game/scripts/chopTreeScript.ts b/apps/website-svelte/src/lib/game/scripts/chopTreeScript.ts index 56f2ebaa..e4dbfd3a 100644 --- a/apps/website-svelte/src/lib/game/scripts/chopTreeScript.ts +++ b/apps/website-svelte/src/lib/game/scripts/chopTreeScript.ts @@ -11,11 +11,7 @@ export class ChopTreeScript extends Script { constructor({ target, object, chopTreeFunc }: IPlantNewTreeScriptOptions) { super({ object }) - this.tasks = [ - this.setTarget(target), - this.runToTarget(), - this.chopTree(chopTreeFunc), - ] + this.tasks = [this.setTarget(target), this.runToTarget(), this.chopTree(chopTreeFunc)] } chopTree(func: () => boolean): IGameTask { diff --git a/apps/website-svelte/src/lib/game/scripts/mineStoneScript.ts b/apps/website-svelte/src/lib/game/scripts/mineStoneScript.ts index dc971dd9..7b76a676 100644 --- a/apps/website-svelte/src/lib/game/scripts/mineStoneScript.ts +++ b/apps/website-svelte/src/lib/game/scripts/mineStoneScript.ts @@ -11,11 +11,7 @@ export class MineStoneScript extends Script { constructor({ target, object, mineStoneFunc }: IMineStoneScriptOptions) { super({ object }) - this.tasks = [ - this.setTarget(target), - this.runToTarget(), - this.mineStone(mineStoneFunc), - ] + this.tasks = [this.setTarget(target), this.runToTarget(), this.mineStone(mineStoneFunc)] } mineStone(func: () => boolean): IGameTask { diff --git a/apps/website-svelte/src/lib/game/scripts/moveOffScreenAndSelfDestroyScript.ts b/apps/website-svelte/src/lib/game/scripts/moveOffScreenAndSelfDestroyScript.ts index da9ce5ea..37ed2013 100644 --- a/apps/website-svelte/src/lib/game/scripts/moveOffScreenAndSelfDestroyScript.ts +++ b/apps/website-svelte/src/lib/game/scripts/moveOffScreenAndSelfDestroyScript.ts @@ -8,18 +8,10 @@ interface IMoveOffScreenAndSelfDestroyScriptOptions { } export class MoveOffScreenAndSelfDestroyScript extends Script { - constructor({ - target, - object, - selfDestroyFunc, - }: IMoveOffScreenAndSelfDestroyScriptOptions) { + constructor({ target, object, selfDestroyFunc }: IMoveOffScreenAndSelfDestroyScriptOptions) { super({ object }) - this.tasks = [ - this.setTarget(target), - this.runToTarget(), - this.selfDestroy(selfDestroyFunc), - ] + this.tasks = [this.setTarget(target), this.runToTarget(), this.selfDestroy(selfDestroyFunc)] } selfDestroy(func: () => void): IGameTask { diff --git a/apps/website-svelte/src/lib/game/scripts/moveToTradePostAndTradeScript.ts b/apps/website-svelte/src/lib/game/scripts/moveToTradePostAndTradeScript.ts index f862e3e0..58bd1618 100644 --- a/apps/website-svelte/src/lib/game/scripts/moveToTradePostAndTradeScript.ts +++ b/apps/website-svelte/src/lib/game/scripts/moveToTradePostAndTradeScript.ts @@ -8,18 +8,10 @@ interface IMoveToTradePostAndTradeScriptOptions { } export class MoveToTradePostAndTradeScript extends Script { - constructor({ - target, - object, - startTradeFunc, - }: IMoveToTradePostAndTradeScriptOptions) { + constructor({ target, object, startTradeFunc }: IMoveToTradePostAndTradeScriptOptions) { super({ object }) - this.tasks = [ - this.setTarget(target), - this.runToTarget(), - this.startTrade(startTradeFunc), - ] + this.tasks = [this.setTarget(target), this.runToTarget(), this.startTrade(startTradeFunc)] } startTrade(func: () => void): IGameTask { diff --git a/apps/website-svelte/src/lib/game/scripts/placeItemInWarehouseScript.ts b/apps/website-svelte/src/lib/game/scripts/placeItemInWarehouseScript.ts index 29e29668..80d3126e 100644 --- a/apps/website-svelte/src/lib/game/scripts/placeItemInWarehouseScript.ts +++ b/apps/website-svelte/src/lib/game/scripts/placeItemInWarehouseScript.ts @@ -8,18 +8,10 @@ interface IPlaceItemInWarehouseScriptOptions { } export class PlaceItemInWarehouseScript extends Script { - constructor({ - target, - object, - placeItemFunc, - }: IPlaceItemInWarehouseScriptOptions) { + constructor({ target, object, placeItemFunc }: IPlaceItemInWarehouseScriptOptions) { super({ object }) - this.tasks = [ - this.setTarget(target), - this.runToTarget(), - this.placeItem(placeItemFunc), - ] + this.tasks = [this.setTarget(target), this.runToTarget(), this.placeItem(placeItemFunc)] } placeItem(func: () => void): IGameTask { diff --git a/apps/website-svelte/src/lib/game/scripts/plantNewTreeScript.ts b/apps/website-svelte/src/lib/game/scripts/plantNewTreeScript.ts index 7996348b..f6a92dac 100644 --- a/apps/website-svelte/src/lib/game/scripts/plantNewTreeScript.ts +++ b/apps/website-svelte/src/lib/game/scripts/plantNewTreeScript.ts @@ -8,18 +8,10 @@ interface IPlantNewTreeScriptOptions { } export class PlantNewTreeScript extends Script { - constructor({ - target, - object, - plantNewTreeFunc, - }: IPlantNewTreeScriptOptions) { + constructor({ target, object, plantNewTreeFunc }: IPlantNewTreeScriptOptions) { super({ object }) - this.tasks = [ - this.setTarget(target), - this.runToTarget(), - this.plantNewTree(plantNewTreeFunc), - ] + this.tasks = [this.setTarget(target), this.runToTarget(), this.plantNewTree(plantNewTreeFunc)] } plantNewTree(func: () => void): IGameTask { diff --git a/apps/website-svelte/src/lib/game/services/action/actionService.ts b/apps/website-svelte/src/lib/game/services/action/actionService.ts index f56391c5..2bbd1d50 100644 --- a/apps/website-svelte/src/lib/game/services/action/actionService.ts +++ b/apps/website-svelte/src/lib/game/services/action/actionService.ts @@ -7,7 +7,8 @@ import type { GameObjectPlayer, GameSceneType, IGameActionResponse, - IGameSceneAction, ItemType, + IGameSceneAction, + ItemType, } from '$lib/game/types' import { config } from '$lib/config' import type { GameAction } from '$lib/game/actions/interface' @@ -65,7 +66,15 @@ export class ActionService implements GameActionService { this.activeActions = this.possibleActions } - async handleCommand({ command, playerId, params }: { command: string, playerId: string, params: string[] }): Promise { + async handleCommand({ + command, + playerId, + params, + }: { + command: string + playerId: string + params: string[] + }): Promise { const player = await this.#initPlayer(playerId) if (!player) { return ANSWER.NO_PLAYER_ERROR @@ -79,7 +88,13 @@ export class ActionService implements GameActionService { return this.#handleAction(action, player, params) } - async handleMessage({ playerId, text }: { playerId: string, text: string }): Promise { + async handleMessage({ + playerId, + text, + }: { + playerId: string + text: string + }): Promise { const player = await this.#initPlayer(playerId) if (!player) { return ANSWER.NO_PLAYER_ERROR @@ -103,7 +118,7 @@ export class ActionService implements GameActionService { async handleAction( action: IGameSceneAction, playerId: string, - params?: string[], + params?: string[] ): Promise { const player = await this.game.playerService.findOrCreatePlayer(playerId) if (!player) { @@ -193,7 +208,7 @@ export class ActionService implements GameActionService { async #handleAction( action: GameAction, player: GameObjectPlayer, - params: string[], + params: string[] ): Promise { const answer = await action.live(player, params) if (answer) { @@ -314,10 +329,7 @@ export class ActionService implements GameActionService { } } - const isSuccess = await player.inventory?.reduceOrDestroyItem( - itemExist.type, - count, - ) + const isSuccess = await player.inventory?.reduceOrDestroyItem(itemExist.type, count) if (!isSuccess) { return { ok: false, @@ -401,10 +413,7 @@ export class ActionService implements GameActionService { if (!player.target || player.target.state === 'DESTROYED') { player.state = 'IDLE' if (player.target instanceof StoneObject) { - void player.inventory.addOrCreateItem( - 'STONE', - player.target?.resource, - ) + void player.inventory.addOrCreateItem('STONE', player.target?.resource) } return true } @@ -668,11 +677,7 @@ export class ActionService implements GameActionService { return ANSWER.WRONG_AMOUNT_ERROR } - const status = await this.game.tradeService.findActiveOfferAndTrade( - params[0], - amount, - player, - ) + const status = await this.game.tradeService.findActiveOfferAndTrade(params[0], amount, player) if (status === 'OFFER_ERROR') { return { ok: false, @@ -706,25 +711,22 @@ export class ActionService implements GameActionService { // Part 1: Check trees on Wagon Path const onlyOnPath = this.game.children.filter( (obj) => - obj instanceof TreeObject - && obj.state !== 'DESTROYED' - && !obj.isReserved - && obj.isOnWagonPath, + obj instanceof TreeObject && + obj.state !== 'DESTROYED' && + !obj.isReserved && + obj.isOnWagonPath ) if (onlyOnPath && onlyOnPath.length > 0) { - return this.determineNearestObject( - this.game.wagonService.wagon, - onlyOnPath, - ) as TreeObject + return this.determineNearestObject(this.game.wagonService.wagon, onlyOnPath) as TreeObject } // Part 2: Check nearest free tree const other = this.game.children.filter( (obj) => - obj instanceof TreeObject - && obj.state !== 'DESTROYED' - && !obj.isReserved - && obj.isReadyToChop, + obj instanceof TreeObject && + obj.state !== 'DESTROYED' && + !obj.isReserved && + obj.isReadyToChop ) if (other && other.length > 0) { return this.determineNearestObject(this.game.wagonService.wagon, other) as TreeObject @@ -735,28 +737,21 @@ export class ActionService implements GameActionService { // Part 1: Check on Wagon Path const onlyOnPath = this.game.children.filter( (obj) => - obj instanceof StoneObject - && obj.state !== 'DESTROYED' - && !obj.isReserved - && obj.isOnWagonPath, + obj instanceof StoneObject && + obj.state !== 'DESTROYED' && + !obj.isReserved && + obj.isOnWagonPath ) if (onlyOnPath && onlyOnPath.length > 0) { - return this.determineNearestObject( - this.game.wagonService.wagon, - onlyOnPath, - ) as StoneObject + return this.determineNearestObject(this.game.wagonService.wagon, onlyOnPath) as StoneObject } // Part 2: Check nearest free const other = this.game.children.filter( - (obj) => - obj instanceof StoneObject && obj.state !== 'DESTROYED' && !obj.isReserved, + (obj) => obj instanceof StoneObject && obj.state !== 'DESTROYED' && !obj.isReserved ) if (other && other.length > 0) { - return this.determineNearestObject( - this.game.wagonService.wagon, - other, - ) as StoneObject + return this.determineNearestObject(this.game.wagonService.wagon, other) as StoneObject } } @@ -765,7 +760,7 @@ export class ActionService implements GameActionService { x: number y: number }, - objects: GameObject[], + objects: GameObject[] ) { let closestObject = objects[0] let shortestDistance diff --git a/apps/website-svelte/src/lib/game/services/action/answer.ts b/apps/website-svelte/src/lib/game/services/action/answer.ts index 33f5f70f..9f7bfc33 100644 --- a/apps/website-svelte/src/lib/game/services/action/answer.ts +++ b/apps/website-svelte/src/lib/game/services/action/answer.ts @@ -17,7 +17,7 @@ export const ANSWER = { }, BUSY_ERROR: { ok: false, - message: 'You\'re busy right now', + message: "You're busy right now", }, CANT_DO_THIS_NOW_ERROR: { ok: false, @@ -45,7 +45,7 @@ export const ANSWER = { }, ALREADY_VOTED_ERROR: { ok: false, - message: 'You\'ve already voted.', + message: "You've already voted.", }, NOT_ENOUGH_PARAMS_ERROR: { ok: false, @@ -53,6 +53,6 @@ export const ANSWER = { }, NOT_ENOUGH_WOOD_ERROR: { ok: false, - message: 'You don\'t have enough wood.', + message: "You don't have enough wood.", }, } diff --git a/apps/website-svelte/src/lib/game/services/action/interface.ts b/apps/website-svelte/src/lib/game/services/action/interface.ts index f3aa4729..2f19c5ee 100644 --- a/apps/website-svelte/src/lib/game/services/action/interface.ts +++ b/apps/website-svelte/src/lib/game/services/action/interface.ts @@ -2,8 +2,22 @@ import type { GameService } from '$lib/game/services/interface' import type { IGameActionResponse, IGameSceneAction } from '$lib/game/types' export interface GameActionService extends GameService { - handleCommand: ({ command, playerId, params }: { command: string, playerId: string, params: string[] }) => Promise - handleMessage: ({ playerId, text }: { playerId: string, text: string }) => Promise + handleCommand: ({ + command, + playerId, + params, + }: { + command: string + playerId: string + params: string[] + }) => Promise + handleMessage: ({ + playerId, + text, + }: { + playerId: string + text: string + }) => Promise getAmountFromChatCommand: (text: string) => number | null isActionPossible: (action: IGameSceneAction) => boolean } diff --git a/apps/website-svelte/src/lib/game/services/chunk/baseChunk.ts b/apps/website-svelte/src/lib/game/services/chunk/baseChunk.ts index 1033221a..226b8ed4 100644 --- a/apps/website-svelte/src/lib/game/services/chunk/baseChunk.ts +++ b/apps/website-svelte/src/lib/game/services/chunk/baseChunk.ts @@ -5,14 +5,12 @@ import type { GameObjectFlag, IGameBuildingConstructionArea, IGameBuildingStore, - IGameBuildingWagonStop, IGameBuildingWarehouse, + IGameBuildingWagonStop, + IGameBuildingWarehouse, } from '$lib/game/types' import { Area } from '$lib/game/objects/area' import { TreeObject } from '$lib/game/objects/treeObject' -import type { - GameChunk, - IGameChunkTheme, -} from '$lib/game/services/chunk/interface' +import type { GameChunk, IGameChunkTheme } from '$lib/game/services/chunk/interface' import { FlagObject } from '$lib/game/objects/flagObject' interface BaseChunkOptions { @@ -33,15 +31,7 @@ export class BaseChunk implements GameChunk { area!: GameChunk['area'] game: Game - constructor({ - title, - type, - theme, - width, - height, - center, - game, - }: BaseChunkOptions) { + constructor({ title, type, theme, width, height, center, game }: BaseChunkOptions) { this.id = createId() this.center = center this.title = title @@ -66,14 +56,11 @@ export class BaseChunk implements GameChunk { return { x: this.area.area.endX, - y: getRandomInRange( - this.area.area.startY + offsetFromTop, - this.area.area.endY, - ), + y: getRandomInRange(this.area.area.startY + offsetFromTop, this.area.area.endY), } } - isPointInArea(point: { x: number, y: number }): boolean { + isPointInArea(point: { x: number; y: number }): boolean { if (point.x >= this.area.area.startX && point.x <= this.area.area.endX) { if (point.y >= this.area.area.startY && point.y <= this.area.area.endY) { return true @@ -86,11 +73,11 @@ export class BaseChunk implements GameChunk { get availableTree() { const trees = this.game.children.filter( (obj) => - obj instanceof TreeObject - && obj.chunkId === this.id - && obj.state !== 'DESTROYED' - && !obj.isReserved - && obj.isReadyToChop, + obj instanceof TreeObject && + obj.chunkId === this.id && + obj.state !== 'DESTROYED' && + !obj.isReserved && + obj.isReadyToChop ) if (!trees || !trees.length) { return undefined @@ -101,16 +88,18 @@ export class BaseChunk implements GameChunk { get randomMovementFlag() { const flags = this.game.children.filter( - (f) => f instanceof FlagObject && f.chunkId === this.id && f.variant === 'MOVEMENT', + (f) => f instanceof FlagObject && f.chunkId === this.id && f.variant === 'MOVEMENT' ) return flags.length > 0 - ? flags[Math.floor(Math.random() * flags.length)] as GameObjectFlag + ? (flags[Math.floor(Math.random() * flags.length)] as GameObjectFlag) : undefined } get warehouse() { - return this.game.children.find((b) => b.type === 'WAREHOUSE') as IGameBuildingWarehouse | undefined + return this.game.children.find((b) => b.type === 'WAREHOUSE') as + | IGameBuildingWarehouse + | undefined } get store() { @@ -118,20 +107,18 @@ export class BaseChunk implements GameChunk { } get constructionArea() { - return this.game.children.find((b) => b.type === 'CONSTRUCTION_AREA') as IGameBuildingConstructionArea | undefined + return this.game.children.find((b) => b.type === 'CONSTRUCTION_AREA') as + | IGameBuildingConstructionArea + | undefined } get wagonStop(): IGameBuildingWagonStop | undefined { - return this.game.children.find((b) => b.type === 'WAGON_STOP') as IGameBuildingWagonStop | undefined + return this.game.children.find((b) => b.type === 'WAGON_STOP') as + | IGameBuildingWagonStop + | undefined } - #initArea({ - width, height, theme, - }: { - width: number - height: number - theme: IGameChunkTheme - }) { + #initArea({ width, height, theme }: { width: number; height: number; theme: IGameChunkTheme }) { const halfWidth = Math.round(width / 2) const halfHeight = Math.round(height / 2) diff --git a/apps/website-svelte/src/lib/game/services/chunk/chunkService.ts b/apps/website-svelte/src/lib/game/services/chunk/chunkService.ts index e38e92f7..29ff398e 100644 --- a/apps/website-svelte/src/lib/game/services/chunk/chunkService.ts +++ b/apps/website-svelte/src/lib/game/services/chunk/chunkService.ts @@ -1,7 +1,8 @@ import type { Game } from '$lib/game/types' import type { GameChunk, - GameChunkService, IGameChunkTheme, + GameChunkService, + IGameChunkTheme, } from '$lib/game/services/chunk/interface' import { VillageChunk } from '$lib/game/services/chunk/villageChunk' import { ForestChunk } from '$lib/game/services/chunk/forestChunk' @@ -46,7 +47,7 @@ export class ChunkService implements GameChunkService { } } - generateChunks(startPoint: { x: number, y: number }, amount: number) { + generateChunks(startPoint: { x: number; y: number }, amount: number) { let outPoint = startPoint for (let i = 1; i <= amount; i++) { @@ -81,7 +82,7 @@ export class ChunkService implements GameChunkService { } } - generateRandomChunk(startPoint: { x: number, y: number }) { + generateRandomChunk(startPoint: { x: number; y: number }) { const random = getRandomInRange(1, 2) const width = getRandomInRange(2000, 3000) @@ -117,25 +118,18 @@ export class ChunkService implements GameChunkService { } getRandomTheme(): IGameChunkTheme { - const themes: IGameChunkTheme[] = [ - 'GREEN', - 'BLUE', - 'STONE', - 'TEAL', - 'VIOLET', - 'TOXIC', - ] + const themes: IGameChunkTheme[] = ['GREEN', 'BLUE', 'STONE', 'TEAL', 'VIOLET', 'TOXIC'] return themes[Math.floor(Math.random() * themes.length)] } generateRandomVillage({ center, - width, - height, - theme, - game, + width, + height, + theme, + game, }: { - center: { x: number, y: number } + center: { x: number; y: number } width: number height: number theme: IGameChunkTheme @@ -149,11 +143,11 @@ export class ChunkService implements GameChunkService { generateRandomForest({ center, - width, - height, - theme, + width, + height, + theme, }: { - center: { x: number, y: number } + center: { x: number; y: number } width: number height: number theme: IGameChunkTheme @@ -172,11 +166,11 @@ export class ChunkService implements GameChunkService { generateRandomLake({ center, - width, - height, - theme, + width, + height, + theme, }: { - center: { x: number, y: number } + center: { x: number; y: number } width: number height: number theme: IGameChunkTheme diff --git a/apps/website-svelte/src/lib/game/services/chunk/forestChunk.ts b/apps/website-svelte/src/lib/game/services/chunk/forestChunk.ts index b51af136..83642068 100644 --- a/apps/website-svelte/src/lib/game/services/chunk/forestChunk.ts +++ b/apps/website-svelte/src/lib/game/services/chunk/forestChunk.ts @@ -1,14 +1,9 @@ import { BaseChunk } from './baseChunk' import { getRandomInRange } from '$lib/utils/random' -import type { - Game, -} from '$lib/game/types' +import type { Game } from '$lib/game/types' import { TreeObject } from '$lib/game/objects/treeObject' import { StoneObject } from '$lib/game/objects/stoneObject' -import type { - IGameChunkTheme, - IGameForestChunk, -} from '$lib/game/services/chunk/interface' +import type { IGameChunkTheme, IGameForestChunk } from '$lib/game/services/chunk/interface' interface ForestChunkOptions { center: IGameForestChunk['center'] @@ -30,9 +25,7 @@ export class ForestChunk extends BaseChunk implements IGameForestChunk { game, }) - const treesToPrepare = Math.round( - (this.area.area.endX - this.area.area.startX) / 10, - ) + const treesToPrepare = Math.round((this.area.area.endX - this.area.area.startX) / 10) this.#initTrees(treesToPrepare) this.#initStones(3) } diff --git a/apps/website-svelte/src/lib/game/services/chunk/interface.ts b/apps/website-svelte/src/lib/game/services/chunk/interface.ts index fb4c8013..fccd970c 100644 --- a/apps/website-svelte/src/lib/game/services/chunk/interface.ts +++ b/apps/website-svelte/src/lib/game/services/chunk/interface.ts @@ -6,7 +6,8 @@ import type { IGameBuildingConstructionArea, IGameBuildingStore, IGameBuildingWagonStop, - IGameBuildingWarehouse, IGameObjectArea, + IGameBuildingWarehouse, + IGameObjectArea, } from '$lib/game/types' export interface GameChunkService extends GameService { @@ -15,9 +16,9 @@ export interface GameChunkService extends GameService { chunks: GameChunk[] removeChunk: (chunk: GameChunk) => void removeAllOutsideChunks: () => void - generateChunks: (startPoint: { x: number, y: number }, amount: number) => void + generateChunks: (startPoint: { x: number; y: number }, amount: number) => void generateRandomVillage: (data: { - center: { x: number, y: number } + center: { x: number; y: number } width: number height: number theme: IGameChunkTheme @@ -41,18 +42,12 @@ export interface GameChunk { wagonStop: IGameBuildingWagonStop | undefined availableTree: GameObjectTree | undefined randomMovementFlag: GameObjectFlag | undefined - randomOutPoint: { x: number, y: number } + randomOutPoint: { x: number; y: number } live: () => void - isPointInArea: (point: { x: number, y: number }) => boolean + isPointInArea: (point: { x: number; y: number }) => boolean } -export type IGameChunkTheme = - | 'GREEN' - | 'TOXIC' - | 'STONE' - | 'TEAL' - | 'BLUE' - | 'VIOLET' +export type IGameChunkTheme = 'GREEN' | 'TOXIC' | 'STONE' | 'TEAL' | 'BLUE' | 'VIOLET' export interface IGameVillageChunk extends GameChunk {} diff --git a/apps/website-svelte/src/lib/game/services/chunk/lakeChunk.ts b/apps/website-svelte/src/lib/game/services/chunk/lakeChunk.ts index 480fbbeb..ab4b8c19 100644 --- a/apps/website-svelte/src/lib/game/services/chunk/lakeChunk.ts +++ b/apps/website-svelte/src/lib/game/services/chunk/lakeChunk.ts @@ -1,15 +1,10 @@ import { BaseChunk } from './baseChunk' import { getRandomInRange } from '$lib/utils/random' -import type { - Game, -} from '$lib/game/types' +import type { Game } from '$lib/game/types' import { Lake } from '$lib/game/objects/lake' import { TreeObject } from '$lib/game/objects/treeObject' import { StoneObject } from '$lib/game/objects/stoneObject' -import type { - IGameChunkTheme, - IGameLakeChunk, -} from '$lib/game/services/chunk/interface' +import type { IGameChunkTheme, IGameLakeChunk } from '$lib/game/services/chunk/interface' interface LakeChunkOptions { game: Game @@ -31,9 +26,7 @@ export class LakeChunk extends BaseChunk implements IGameLakeChunk { type: 'LAKE', }) - const treesToPrepare = Math.round( - (this.area.area.endX - this.area.area.startX) / 30, - ) + const treesToPrepare = Math.round((this.area.area.endX - this.area.area.startX) / 30) this.#initTrees(treesToPrepare) this.#initStones(3) this.#initLake() diff --git a/apps/website-svelte/src/lib/game/services/chunk/villageChunk.ts b/apps/website-svelte/src/lib/game/services/chunk/villageChunk.ts index 4d7d6941..b423be3d 100644 --- a/apps/website-svelte/src/lib/game/services/chunk/villageChunk.ts +++ b/apps/website-svelte/src/lib/game/services/chunk/villageChunk.ts @@ -10,19 +10,13 @@ import { PlaceItemInWarehouseScript } from '../../scripts/placeItemInWarehouseSc import { PlantNewTreeScript } from '../../scripts/plantNewTreeScript' import { BaseChunk } from './baseChunk' import { getRandomInRange } from '$lib/utils/random' -import type { - Game, - GameObjectFlag, -} from '$lib/game/types' +import type { Game, GameObjectFlag } from '$lib/game/types' import { Farmer } from '$lib/game/objects/units/farmer' import { Courier } from '$lib/game/objects/units/courier' import { TreeObject } from '$lib/game/objects/treeObject' import { FlagObject } from '$lib/game/objects/flagObject' import { StoneObject } from '$lib/game/objects/stoneObject' -import type { - IGameChunkTheme, - IGameVillageChunk, -} from '$lib/game/services/chunk/interface' +import type { IGameChunkTheme, IGameVillageChunk } from '$lib/game/services/chunk/interface' interface VillageChunkOptions { game: Game @@ -65,7 +59,7 @@ export class VillageChunk extends BaseChunk implements IGameVillageChunk { checkIfNeedToPlantTree() { const treesNow = this.game.children.filter( - (t) => t instanceof TreeObject && t.chunkId === this.id && t.state !== 'DESTROYED', + (t) => t instanceof TreeObject && t.chunkId === this.id && t.state !== 'DESTROYED' ) if (treesNow.length < 40) { return this.#getRandomEmptyResourceFlagInVillage() @@ -91,7 +85,7 @@ export class VillageChunk extends BaseChunk implements IGameVillageChunk { getTreesAmount() { return this.game.children.filter( - (obj) => obj instanceof TreeObject && obj.chunkId === this.id && obj.state !== 'DESTROYED', + (obj) => obj instanceof TreeObject && obj.chunkId === this.id && obj.state !== 'DESTROYED' ).length } @@ -163,10 +157,7 @@ export class VillageChunk extends BaseChunk implements IGameVillageChunk { if (!object.target || object.target.state === 'DESTROYED') { object.state = 'IDLE' if (object.target instanceof TreeObject) { - void object.inventory.addOrCreateItem( - 'WOOD', - object.target?.resource, - ) + void object.inventory.addOrCreateItem('WOOD', object.target?.resource) } return true } @@ -345,11 +336,11 @@ export class VillageChunk extends BaseChunk implements IGameVillageChunk { #getRandomEmptyResourceFlagInVillage() { const flags = this.game.children.filter( (f) => - f instanceof FlagObject - && f.chunkId === this.id - && f.variant === 'RESOURCE' - && !f.target - && !f.isReserved, + f instanceof FlagObject && + f.chunkId === this.id && + f.variant === 'RESOURCE' && + !f.target && + !f.isReserved ) return flags.length > 0 ? (flags[Math.floor(Math.random() * flags.length)] as FlagObject) @@ -358,17 +349,15 @@ export class VillageChunk extends BaseChunk implements IGameVillageChunk { #getResourceFlagInVillageAmount() { return this.game.children.filter( - (f) => f instanceof FlagObject && f.chunkId === this.id && f.variant === 'RESOURCE', + (f) => f instanceof FlagObject && f.chunkId === this.id && f.variant === 'RESOURCE' ).length } #getRandomMovementFlagInVillage() { const flags = this.game.children.filter( - (f) => f instanceof FlagObject && f.chunkId === this.id && f.variant === 'MOVEMENT', + (f) => f instanceof FlagObject && f.chunkId === this.id && f.variant === 'MOVEMENT' ) - return flags.length > 0 - ? flags[Math.floor(Math.random() * flags.length)] - : undefined + return flags.length > 0 ? flags[Math.floor(Math.random() * flags.length)] : undefined } #getRandomTitle() { diff --git a/apps/website-svelte/src/lib/game/services/event/eventService.ts b/apps/website-svelte/src/lib/game/services/event/eventService.ts index c59064a4..e18e3a7a 100644 --- a/apps/website-svelte/src/lib/game/services/event/eventService.ts +++ b/apps/website-svelte/src/lib/game/services/event/eventService.ts @@ -1,17 +1,9 @@ import { PollService } from './pollService' -import type { - Game, - GameSceneType, -} from '$lib/game/types' +import type { Game, GameSceneType } from '$lib/game/types' import { Event } from '$lib/game/services/event/event' import { VillageChunk } from '$lib/game/services/chunk/villageChunk' -import type { - GameEventService, - IGameEvent, -} from '$lib/game/services/event/interface' -import type { - IGameQuestTask, -} from '$lib/game/services/quest/interface' +import type { GameEventService, IGameEvent } from '$lib/game/services/event/interface' +import type { IGameQuestTask } from '$lib/game/services/quest/interface' import type { GameAction } from '$lib/game/actions/interface' export class EventService implements GameEventService { @@ -121,16 +113,15 @@ export class EventService implements GameEventService { const updateProgress1: IGameQuestTask['updateProgress'] = () => { if ( - !this.game.routeService.route - && this.events.find((e) => e.type === 'MAIN_QUEST_STARTED') + !this.game.routeService.route && + this.events.find((e) => e.type === 'MAIN_QUEST_STARTED') ) { return { status: 'SUCCESS', } } - const items - = this.game.wagonService.cargo?.checkIfAlreadyHaveItem('WOOD') + const items = this.game.wagonService.cargo?.checkIfAlreadyHaveItem('WOOD') if (!items) { return { status: 'FAILED', @@ -171,7 +162,7 @@ export class EventService implements GameEventService { if (this.game.chunkService.chunk instanceof VillageChunk) { this.game.routeService.generateAdventure( this.game.chunkService.chunk, - event.quest.conditions.chunks ?? 3, + event.quest.conditions.chunks ?? 3 ) } diff --git a/apps/website-svelte/src/lib/game/services/event/interface.ts b/apps/website-svelte/src/lib/game/services/event/interface.ts index 3c7d1563..f9598f20 100644 --- a/apps/website-svelte/src/lib/game/services/event/interface.ts +++ b/apps/website-svelte/src/lib/game/services/event/interface.ts @@ -1,8 +1,4 @@ -import type { - GameSceneType, - IGamePoll, - ITradeOffer, -} from '$lib/game/types' +import type { GameSceneType, IGamePoll, ITradeOffer } from '$lib/game/types' import type { GameService } from '$lib/game/services/interface' import type { IGameQuest } from '$lib/game/services/quest/interface' import type { GameAction } from '$lib/game/actions/interface' @@ -27,7 +23,15 @@ export interface IGameEvent { id: string title: string description: string - type: 'RAID_STARTED' | 'SCENE_CHANGING_STARTED' | 'GROUP_FORM_STARTED' | 'IDEA_CREATED' | 'MAIN_QUEST_STARTED' | 'SIDE_QUEST_STARTED' | 'TRADE_STARTED' | 'VOTING_FOR_NEW_MAIN_QUEST_STARTED' + type: + | 'RAID_STARTED' + | 'SCENE_CHANGING_STARTED' + | 'GROUP_FORM_STARTED' + | 'IDEA_CREATED' + | 'MAIN_QUEST_STARTED' + | 'SIDE_QUEST_STARTED' + | 'TRADE_STARTED' + | 'VOTING_FOR_NEW_MAIN_QUEST_STARTED' status: 'STARTED' | 'STOPPED' endsAt: Date poll?: IGamePoll diff --git a/apps/website-svelte/src/lib/game/services/event/pollService.ts b/apps/website-svelte/src/lib/game/services/event/pollService.ts index 93982e24..5fd059c1 100644 --- a/apps/website-svelte/src/lib/game/services/event/pollService.ts +++ b/apps/website-svelte/src/lib/game/services/event/pollService.ts @@ -1,7 +1,4 @@ -import type { - Game, - GameObjectPlayer, IGamePoll, -} from '$lib/game/types' +import type { Game, GameObjectPlayer, IGamePoll } from '$lib/game/types' import type { GameService } from '$lib/game/services/interface' export class PollService implements GameService { diff --git a/apps/website-svelte/src/lib/game/services/interface.ts b/apps/website-svelte/src/lib/game/services/interface.ts index 9ad57158..a7a4eaae 100644 --- a/apps/website-svelte/src/lib/game/services/interface.ts +++ b/apps/website-svelte/src/lib/game/services/interface.ts @@ -1,6 +1,4 @@ -import type { - Game, -} from '$lib/game/types' +import type { Game } from '$lib/game/types' export interface GameService { game: Game diff --git a/apps/website-svelte/src/lib/game/services/player/playerService.ts b/apps/website-svelte/src/lib/game/services/player/playerService.ts index 868b91af..cd8a91a5 100644 --- a/apps/website-svelte/src/lib/game/services/player/playerService.ts +++ b/apps/website-svelte/src/lib/game/services/player/playerService.ts @@ -2,9 +2,7 @@ import type { Game } from '$lib/game/types' import { Player } from '$lib/game/objects/units/player' import type { GamePlayerService } from '$lib/game/services/player/interface' import { getDateMinusMinutes } from '$lib/utils/date' -import { - MoveOffScreenAndSelfDestroyScript, -} from '$lib/game/scripts/moveOffScreenAndSelfDestroyScript' +import { MoveOffScreenAndSelfDestroyScript } from '$lib/game/scripts/moveOffScreenAndSelfDestroyScript' export class PlayerService implements GamePlayerService { game: Game diff --git a/apps/website-svelte/src/lib/game/services/quest/interface.ts b/apps/website-svelte/src/lib/game/services/quest/interface.ts index cafc9b1a..7d6119d5 100644 --- a/apps/website-svelte/src/lib/game/services/quest/interface.ts +++ b/apps/website-svelte/src/lib/game/services/quest/interface.ts @@ -51,5 +51,5 @@ export interface IGameQuestTask { } export type IGameQuestTaskFunc = ( - progressToSuccess?: IGameQuestTask['progressToSuccess'], + progressToSuccess?: IGameQuestTask['progressToSuccess'] ) => Partial diff --git a/apps/website-svelte/src/lib/game/services/quest/questService.ts b/apps/website-svelte/src/lib/game/services/quest/questService.ts index a6938d0f..860bfec8 100644 --- a/apps/website-svelte/src/lib/game/services/quest/questService.ts +++ b/apps/website-svelte/src/lib/game/services/quest/questService.ts @@ -3,13 +3,13 @@ import { DonateWoodToVillageAction } from '../../actions/donateWoodToVillageActi import { PlantTreeAction } from '../../actions/plantTreeAction' import { NoTradingPostQuest } from '../../quests/noTradingPostQuest' import { TreesAreRunningOutQuest } from '../../quests/treesAreRunningOutQuest' -import type { - Game, -} from '$lib/game/types' +import type { Game } from '$lib/game/types' import { VillageChunk } from '$lib/game/services/chunk/villageChunk' import type { GameQuestService, - IGameQuest, IGameQuestTask, IGameQuestTaskFunc, + IGameQuest, + IGameQuestTask, + IGameQuestTaskFunc, } from '$lib/game/services/quest/interface' import type { GameAction } from '$lib/game/actions/interface' @@ -84,9 +84,7 @@ export class QuestService implements GameQuestService { findActionByCommand(command: string): GameAction | undefined { for (const q of this.quests) { if (q?.tasks) { - const task = q.tasks.find( - (q) => q.action?.command === command, - ) + const task = q.tasks.find((q) => q.action?.command === command) if (task?.action) { return task.action } @@ -131,9 +129,7 @@ export class QuestService implements GameQuestService { } #generateSecondSideQuest() { - const sideQuests = this.game.eventService.events.filter( - (e) => e.type === 'SIDE_QUEST_STARTED', - ) + const sideQuests = this.game.eventService.events.filter((e) => e.type === 'SIDE_QUEST_STARTED') if (sideQuests.length >= 1) { return } @@ -193,9 +189,7 @@ export class QuestService implements GameQuestService { } } - const sideQuests = this.game.eventService.events.filter( - (e) => e.type === 'SIDE_QUEST_STARTED', - ) + const sideQuests = this.game.eventService.events.filter((e) => e.type === 'SIDE_QUEST_STARTED') if (sideQuests.length >= 1) { return } diff --git a/apps/website-svelte/src/lib/game/services/route/interface.ts b/apps/website-svelte/src/lib/game/services/route/interface.ts index 568c8253..9d158654 100644 --- a/apps/website-svelte/src/lib/game/services/route/interface.ts +++ b/apps/website-svelte/src/lib/game/services/route/interface.ts @@ -1,8 +1,5 @@ import type { GameObjectFlag } from '$lib/game/types' -import type { - GameChunk, - IGameVillageChunk, -} from '$lib/game/services/chunk/interface' +import type { GameChunk, IGameVillageChunk } from '$lib/game/services/chunk/interface' import type { GameService } from '$lib/game/services/interface' export interface GameRouteService extends GameService { @@ -13,10 +10,10 @@ export interface GameRouteService extends GameService { } export interface IGameRoute { - startPoint: { x: number, y: number } - endPoint: { x: number, y: number } + startPoint: { x: number; y: number } + endPoint: { x: number; y: number } chunks: GameChunk[] - addGlobalFlag: (point: { x: number, y: number }) => void - setEndPoint: (point: { x: number, y: number }) => void + addGlobalFlag: (point: { x: number; y: number }) => void + setEndPoint: (point: { x: number; y: number }) => void removeFlag: (id: string) => void } diff --git a/apps/website-svelte/src/lib/game/services/route/route.ts b/apps/website-svelte/src/lib/game/services/route/route.ts index a47ad9ef..3f3ef4f5 100644 --- a/apps/website-svelte/src/lib/game/services/route/route.ts +++ b/apps/website-svelte/src/lib/game/services/route/route.ts @@ -91,10 +91,7 @@ export class Route implements IGameRoute { #isInArea(area: IRouteArea, point: IRoutePoint) { return ( - area.startX < point.x - && point.x < area.endX - && area.startY < point.y - && point.y < area.endY + area.startX < point.x && point.x < area.endX && area.startY < point.y && point.y < area.endY ) } @@ -136,7 +133,7 @@ export class Route implements IGameRoute { point2: { x: number y: number - }, + } ) { return Math.sqrt((point1.x - point2.x) ** 2 + (point1.y - point2.y) ** 2) } diff --git a/apps/website-svelte/src/lib/game/services/route/routeService.ts b/apps/website-svelte/src/lib/game/services/route/routeService.ts index bf4b64b7..df71486f 100644 --- a/apps/website-svelte/src/lib/game/services/route/routeService.ts +++ b/apps/website-svelte/src/lib/game/services/route/routeService.ts @@ -1,15 +1,7 @@ -import type { - Game, -} from '$lib/game/types' +import type { Game } from '$lib/game/types' import { Route } from '$lib/game/services/route/route' -import type { - GameRouteService, - IGameRoute, -} from '$lib/game/services/route/interface' -import type { - GameChunk, - IGameVillageChunk, -} from '$lib/game/services/chunk/interface' +import type { GameRouteService, IGameRoute } from '$lib/game/services/route/interface' +import type { GameChunk, IGameVillageChunk } from '$lib/game/services/chunk/interface' import { TreeObject } from '$lib/game/objects/treeObject' import { StoneObject } from '$lib/game/objects/stoneObject' import type { FlagObject } from '$lib/game/objects/flagObject' @@ -24,11 +16,7 @@ export class RouteService implements GameRouteService { update() { if (!this.route?.flags || this.route.flags.length <= 0) { - if ( - this.game.eventService.events.find( - (e) => e.type === 'MAIN_QUEST_STARTED', - ) - ) { + if (this.game.eventService.events.find((e) => e.type === 'MAIN_QUEST_STARTED')) { return this.#finishAdventure() } } diff --git a/apps/website-svelte/src/lib/game/services/server/serverService.ts b/apps/website-svelte/src/lib/game/services/server/serverService.ts index 7335995e..c7eac0a7 100644 --- a/apps/website-svelte/src/lib/game/services/server/serverService.ts +++ b/apps/website-svelte/src/lib/game/services/server/serverService.ts @@ -14,7 +14,7 @@ export class ServerService implements GameServerService { async getPlayer(id: string): Promise { try { const res = await fetch(`/auth/game/player/${id}`) - const player = await res.json() as Player + const player = (await res.json()) as Player if (!player?.id) { return null } @@ -28,7 +28,7 @@ export class ServerService implements GameServerService { async getInventory(id: string): Promise { try { const res = await fetch(`/auth/game/inventory/${id}`) - const inventory = await res.json() as Inventory + const inventory = (await res.json()) as Inventory if (!inventory) { return null } diff --git a/apps/website-svelte/src/lib/game/services/socket/interface.ts b/apps/website-svelte/src/lib/game/services/socket/interface.ts index 06c24ce1..5bc8de3c 100644 --- a/apps/website-svelte/src/lib/game/services/socket/interface.ts +++ b/apps/website-svelte/src/lib/game/services/socket/interface.ts @@ -1,5 +1,3 @@ import type { GameService } from '$lib/game/services/interface' -export interface GameWebSocketService extends GameService { - -} +export interface GameWebSocketService extends GameService {} diff --git a/apps/website-svelte/src/lib/game/services/socket/webSocketService.ts b/apps/website-svelte/src/lib/game/services/socket/webSocketService.ts index 9b636879..d9d33ddc 100644 --- a/apps/website-svelte/src/lib/game/services/socket/webSocketService.ts +++ b/apps/website-svelte/src/lib/game/services/socket/webSocketService.ts @@ -52,7 +52,13 @@ export class WebSocketService implements GameWebSocketService { this.#setMessagesPerSecondHandler() this.socket.addEventListener('open', () => { - this.socket.send(JSON.stringify({ type: 'GAME_HANDSHAKE', id: this.game.id, profileJWT: this.game.profileJWT })) + this.socket.send( + JSON.stringify({ + type: 'GAME_HANDSHAKE', + id: this.game.id, + profileJWT: this.game.profileJWT, + }) + ) }) this.socket.addEventListener('message', (event) => { diff --git a/apps/website-svelte/src/lib/game/services/trade/interface.ts b/apps/website-svelte/src/lib/game/services/trade/interface.ts index c6ce5d44..8eda8f49 100644 --- a/apps/website-svelte/src/lib/game/services/trade/interface.ts +++ b/apps/website-svelte/src/lib/game/services/trade/interface.ts @@ -7,7 +7,7 @@ export interface GameTradeService extends GameService { findActiveOfferAndTrade: ( offerId: string, amount: number, - player: GameObjectPlayer, + player: GameObjectPlayer ) => Promise } diff --git a/apps/website-svelte/src/lib/game/services/trade/tradeService.ts b/apps/website-svelte/src/lib/game/services/trade/tradeService.ts index 3cccae29..c6c2fac6 100644 --- a/apps/website-svelte/src/lib/game/services/trade/tradeService.ts +++ b/apps/website-svelte/src/lib/game/services/trade/tradeService.ts @@ -2,17 +2,12 @@ import { MoveOffScreenAndSelfDestroyScript } from '../../scripts/moveOffScreenAn import { MoveToTargetScript } from '../../scripts/moveToTargetScript' import { MoveToTradePostAndTradeScript } from '../../scripts/moveToTradePostAndTradeScript' import { getRandomInRange } from '$lib/utils/random' -import type { - Game, - GameObjectPlayer, ITradeOffer, -} from '$lib/game/types' +import type { Game, GameObjectPlayer, ITradeOffer } from '$lib/game/types' import { VillageChunk } from '$lib/game/services/chunk/villageChunk' import { FlagObject } from '$lib/game/objects/flagObject' import { Trader } from '$lib/game/objects/units/trader' import { Poll } from '$lib/game/common/poll' -import type { - FindActiveOfferAndTrade, GameTradeService, -} from '$lib/game/services/trade/interface' +import type { FindActiveOfferAndTrade, GameTradeService } from '$lib/game/services/trade/interface' export class TradeService implements GameTradeService { offers: ITradeOffer[] = [] @@ -39,7 +34,7 @@ export class TradeService implements GameTradeService { async findActiveOfferAndTrade( offerId: string, amount: number, - player: GameObjectPlayer, + player: GameObjectPlayer ): Promise { for (const offer of this.offers) { if (offer.id === offerId) { @@ -54,11 +49,7 @@ export class TradeService implements GameTradeService { return 'OFFER_NOT_FOUND' } - async trade( - offer: ITradeOffer, - amount: number, - player: GameObjectPlayer, - ): Promise { + async trade(offer: ITradeOffer, amount: number, player: GameObjectPlayer): Promise { if (offer.amount < amount) { return false } @@ -161,15 +152,13 @@ export class TradeService implements GameTradeService { return false } - const activeTrade = this.game.eventService.events.find( - (e) => e.type === 'TRADE_STARTED', - ) + const activeTrade = this.game.eventService.events.find((e) => e.type === 'TRADE_STARTED') return !activeTrade } #getTradePointFlag() { return this.game.children.find( - (obj) => obj instanceof FlagObject && obj.variant === 'TRADE_POINT', + (obj) => obj instanceof FlagObject && obj.variant === 'TRADE_POINT' ) as FlagObject | undefined } @@ -265,37 +254,33 @@ export class TradeService implements GameTradeService { } const votingEvents = this.game.eventService.events.filter( - (e) => e.type === 'VOTING_FOR_NEW_MAIN_QUEST_STARTED', + (e) => e.type === 'VOTING_FOR_NEW_MAIN_QUEST_STARTED' ) if (votingEvents.length >= 1) { return } const adventureEvents = this.game.eventService.events.filter( - (e) => e.type === 'MAIN_QUEST_STARTED', + (e) => e.type === 'MAIN_QUEST_STARTED' ) if (adventureEvents.length >= 1) { return } - const votesToSuccess - = this.game.activePlayers.length >= 2 - ? this.game.activePlayers.length - : 1 + const votesToSuccess = this.game.activePlayers.length >= 2 ? this.game.activePlayers.length : 1 const poll = new Poll({ votesToSuccess, game: this.game }) this.game.eventService.initEvent({ type: 'VOTING_FOR_NEW_MAIN_QUEST_STARTED', title: 'The merchant offers a quest', - description: 'Let\'s make the quest active? Vote in chat.', + description: "Let's make the quest active? Vote in chat.", secondsToEnd: 180, quest: this.game.questService.create({ status: 'INACTIVE', type: 'MAIN', title: 'Transport cargo to a neighboring village', - description: - 'The merchant is worried about the safety of the items in the chest.', + description: 'The merchant is worried about the safety of the items in the chest.', creatorId: trader.id, tasks: [], conditions: { diff --git a/apps/website-svelte/src/lib/game/services/wagon/interface.ts b/apps/website-svelte/src/lib/game/services/wagon/interface.ts index 2886ca04..623bd484 100644 --- a/apps/website-svelte/src/lib/game/services/wagon/interface.ts +++ b/apps/website-svelte/src/lib/game/services/wagon/interface.ts @@ -1,8 +1,4 @@ -import type { - GameObject, - GameObjectFlag, - IGameInventory, -} from '$lib/game/types' +import type { GameObject, GameObjectFlag, IGameInventory } from '$lib/game/types' import type { GameService } from '$lib/game/services/interface' export interface GameWagonService extends GameService { @@ -10,7 +6,7 @@ export interface GameWagonService extends GameService { cargo: IGameInventory | undefined randomOutFlag: GameObjectFlag randomNearFlag: GameObjectFlag - initWagon: (point: { x: number, y: number }) => void + initWagon: (point: { x: number; y: number }) => void setCargo: () => void emptyCargo: () => void } diff --git a/apps/website-svelte/src/lib/game/services/wagon/wagonService.ts b/apps/website-svelte/src/lib/game/services/wagon/wagonService.ts index 1340d2c4..f1f50bc4 100644 --- a/apps/website-svelte/src/lib/game/services/wagon/wagonService.ts +++ b/apps/website-svelte/src/lib/game/services/wagon/wagonService.ts @@ -22,7 +22,7 @@ export class WagonService implements GameWagonService { this.#updateFlags() } - initWagon({ x, y }: { x: number, y: number }) { + initWagon({ x, y }: { x: number; y: number }) { this.wagon = new BaseWagon({ game: this.game, x, y }) this.wagon.init() @@ -50,10 +50,8 @@ export class WagonService implements GameWagonService { } #updateWagon() { - const collisionObjects - = this.game.children.filter( - (obj) => obj.isOnWagonPath && obj.state !== 'DESTROYED', - ) ?? [] + const collisionObjects = + this.game.children.filter((obj) => obj.isOnWagonPath && obj.state !== 'DESTROYED') ?? [] for (const collisionObject of collisionObjects) { const isInArea = this.wagon.checkIfPointInCollisionArea({ x: collisionObject.x, @@ -126,10 +124,8 @@ export class WagonService implements GameWagonService { const minOffsetX = 1800 const minOffsetY = 1200 - const offsetX - = getRandomInRange(minOffsetX, minOffsetX * 1.5) * getMinusOrPlus() - const offsetY - = getRandomInRange(minOffsetY, minOffsetY * 1.5) * getMinusOrPlus() + const offsetX = getRandomInRange(minOffsetX, minOffsetX * 1.5) * getMinusOrPlus() + const offsetY = getRandomInRange(minOffsetY, minOffsetY * 1.5) * getMinusOrPlus() return new FlagObject({ game: this.game, diff --git a/apps/website-svelte/src/lib/game/stream-plugin/customWebSocketService.ts b/apps/website-svelte/src/lib/game/stream-plugin/customWebSocketService.ts index e3dc0754..8af3bc40 100644 --- a/apps/website-svelte/src/lib/game/stream-plugin/customWebSocketService.ts +++ b/apps/website-svelte/src/lib/game/stream-plugin/customWebSocketService.ts @@ -47,7 +47,13 @@ export class CustomWebSocketService { this.#setMessagesPerSecondHandler() this.socket.addEventListener('open', () => { - this.socket.send(JSON.stringify({ type: 'GAME_HANDSHAKE', id: this.game.id, profileJWT: this.game.profileJWT })) + this.socket.send( + JSON.stringify({ + type: 'GAME_HANDSHAKE', + id: this.game.id, + profileJWT: this.game.profileJWT, + }) + ) }) this.socket.addEventListener('message', (event) => { diff --git a/apps/website-svelte/src/lib/game/stream-plugin/unitsOnStreamPlugin.ts b/apps/website-svelte/src/lib/game/stream-plugin/unitsOnStreamPlugin.ts index a71c17e5..105762f2 100644 --- a/apps/website-svelte/src/lib/game/stream-plugin/unitsOnStreamPlugin.ts +++ b/apps/website-svelte/src/lib/game/stream-plugin/unitsOnStreamPlugin.ts @@ -154,7 +154,7 @@ export class UnitsOnStreamPlugin extends Container implements UnitsOnStream { return this.#nearFlags[Math.floor(Math.random() * this.#nearFlags.length)] } - #initWagon({ x, y }: { x: number, y: number }) { + #initWagon({ x, y }: { x: number; y: number }) { this.wagon = new BaseWagon({ game: this as any, x, y }) this.wagon.init() @@ -193,8 +193,7 @@ export class UnitsOnStreamPlugin extends Container implements UnitsOnStream { #generateRandomNearFlag() { const minOffsetX = 200 - const offsetX - = getRandomInRange(minOffsetX, this.app.screen.width - 500) + const offsetX = getRandomInRange(minOffsetX, this.app.screen.width - 500) const offsetY = 30 const flag = new FlagObject({ @@ -209,7 +208,13 @@ export class UnitsOnStreamPlugin extends Container implements UnitsOnStream { return flag } - async handleMessage({ playerId, text }: { playerId: string, text: string }): Promise { + async handleMessage({ + playerId, + text, + }: { + playerId: string + text: string + }): Promise { const player = await this.#initPlayer(playerId) if (!player) { return ANSWER.NO_PLAYER_ERROR diff --git a/apps/website-svelte/src/lib/game/types.ts b/apps/website-svelte/src/lib/game/types.ts index f590ec22..1dca6d3c 100644 --- a/apps/website-svelte/src/lib/game/types.ts +++ b/apps/website-svelte/src/lib/game/types.ts @@ -3,22 +3,14 @@ import type { GameServerService } from './services/server/interface' import type { GameAction } from '$lib/game/actions/interface' import type { GameChunk, - GameChunkService, IGameChunkTheme, + GameChunkService, + IGameChunkTheme, } from '$lib/game/services/chunk/interface' import type { GamePlayerService } from '$lib/game/services/player/interface' import type { GameTradeService } from '$lib/game/services/trade/interface' -import type { - GameEventService, - IGameEvent, -} from '$lib/game/services/event/interface' -import type { - GameWagonService, - Wagon, -} from '$lib/game/services/wagon/interface' -import type { - GameRouteService, - IGameRoute, -} from '$lib/game/services/route/interface' +import type { GameEventService, IGameEvent } from '$lib/game/services/event/interface' +import type { GameWagonService, Wagon } from '$lib/game/services/wagon/interface' +import type { GameRouteService, IGameRoute } from '$lib/game/services/route/interface' import type { GameActionService } from '$lib/game/services/action/interface' import type { GameQuestService } from '$lib/game/services/quest/interface' @@ -39,7 +31,13 @@ export interface UnitsOnStream extends Container { findObject: (id: string) => GameObject | undefined removeObject: (obj: GameObject) => void rebuildScene: () => void - handleMessage: ({ playerId, text }: { playerId: string, text: string }) => Promise + handleMessage: ({ + playerId, + text, + }: { + playerId: string + text: string + }) => Promise } export interface Game extends Container { @@ -198,13 +196,7 @@ export interface IGameSkill { xpNextLvl: number } -export type IGameObjectState = - | 'MOVING' - | 'IDLE' - | 'WAITING' - | 'CHOPPING' - | 'MINING' - | 'DESTROYED' +export type IGameObjectState = 'MOVING' | 'IDLE' | 'WAITING' | 'CHOPPING' | 'MINING' | 'DESTROYED' export type IGameObjectDirection = 'LEFT' | 'RIGHT' export type GameObjectBuildingType = @@ -275,15 +267,10 @@ export interface IGameObjectUnit extends GameObject { visual: { head: '1' hairstyle: 'BOLD' | 'CLASSIC' | 'COAL_LONG' | 'ORANGE_WITH_BEARD' - top: - | 'VIOLET_SHIRT' - | 'BLACK_SHIRT' - | 'GREEN_SHIRT' - | 'BLUE_SHIRT' - | 'DARK_SILVER_SHIRT' + top: 'VIOLET_SHIRT' | 'BLACK_SHIRT' | 'GREEN_SHIRT' | 'BLUE_SHIRT' | 'DARK_SILVER_SHIRT' } dialogue: { - messages: { id: string, text: string }[] + messages: { id: string; text: string }[] } chopTree: () => void mineStone: () => void @@ -347,7 +334,7 @@ export interface IGamePoll { id: string action: GameAction votesToSuccess: number - votes: { id: string, userName: string }[] + votes: { id: string; userName: string }[] } export type GameSceneType = 'VILLAGE' | 'DEFENCE' | 'MOVING' @@ -373,15 +360,7 @@ export interface IGameGroup { export interface PlayerTitle { title: string - type: - | 'RICH' - | 'FAMOUS' - | 'VIEWER' - | 'RAIDER' - | 'VILLAIN' - | 'REFUELLER' - | 'WOODSMAN' - | 'MINER' + type: 'RICH' | 'FAMOUS' | 'VIEWER' | 'RAIDER' | 'VILLAIN' | 'REFUELLER' | 'WOODSMAN' | 'MINER' } export type GraphicsContainerType = diff --git a/apps/website-svelte/src/lib/game/utils/assetsManager.ts b/apps/website-svelte/src/lib/game/utils/assetsManager.ts index c79f397e..24766a3b 100644 --- a/apps/website-svelte/src/lib/game/utils/assetsManager.ts +++ b/apps/website-svelte/src/lib/game/utils/assetsManager.ts @@ -303,7 +303,7 @@ export abstract class AssetsManager { public static getRandomSpriteForBackground(app: Application) { const graphics1 = new Graphics() - graphics1.rect(0, 0, 64, 64).fill(0x0B8A8F) + graphics1.rect(0, 0, 64, 64).fill(0x0b8a8f) const texture1 = app.renderer.generateTexture(graphics1) const sprite1 = Sprite.from(texture1) @@ -407,10 +407,7 @@ export abstract class AssetsManager { }) } - public static async saveCanvasAsWebp( - app: Application, - imageName = 'untitled', - ) { + public static async saveCanvasAsWebp(app: Application, imageName = 'untitled') { const blob = await app.renderer.extract.image({ target: app.stage, format: 'webp', diff --git a/apps/website-svelte/src/lib/game/utils/generators/background.ts b/apps/website-svelte/src/lib/game/utils/generators/background.ts index 32d7773f..bb596e4c 100644 --- a/apps/website-svelte/src/lib/game/utils/generators/background.ts +++ b/apps/website-svelte/src/lib/game/utils/generators/background.ts @@ -173,25 +173,20 @@ export class BackgroundGenerator { ctx.canvas.height = blob.height ctx.drawImage(blob, 0, 0) - const imageData = ctx.getImageData( - 0, - 0, - ctx.canvas.width, - ctx.canvas.height, - ) + const imageData = ctx.getImageData(0, 0, ctx.canvas.width, ctx.canvas.height) const pixels: number[] = [] for (let y = 0; y < blob.width; y++) { for (let x = 0; x < blob.width; x++) { - const [redIndex, greenIndex, blueIndex, _] - = this.getColorIndicesForCoord(x, y, ctx.canvas.width) + const [redIndex, greenIndex, blueIndex, _] = this.getColorIndicesForCoord( + x, + y, + ctx.canvas.width + ) const average = Math.round( - (imageData?.data[redIndex] - + imageData?.data[greenIndex] - + imageData?.data[blueIndex]) - / 3, + (imageData?.data[redIndex] + imageData?.data[greenIndex] + imageData?.data[blueIndex]) / 3 ) pixels.push(average) @@ -227,13 +222,7 @@ export class BackgroundGenerator { }) } - generateRandomGridBackground({ - width, - height, - }: { - width: number - height: number - }) { + generateRandomGridBackground({ width, height }: { width: number; height: number }) { const gridX = Math.ceil(width / 64) const gridY = Math.floor(height / 64) diff --git a/apps/website-svelte/src/lib/game/utils/generators/backgroundImages.ts b/apps/website-svelte/src/lib/game/utils/generators/backgroundImages.ts index 0b01ff37..e9aba5f4 100644 --- a/apps/website-svelte/src/lib/game/utils/generators/backgroundImages.ts +++ b/apps/website-svelte/src/lib/game/utils/generators/backgroundImages.ts @@ -1,88 +1,73 @@ export const BACKGROUND_TILE_1 = [ - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, ] export const BACKGROUND_TILE_2 = [ - 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, - 93, 111, 93, 93, 93, 93, 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, - 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, - 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, - 111, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 111, 93, 93, 93, 93, 111, 93, - 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 111, 93, 93, 111, 93, 93, - 111, 93, 93, 93, 111, 93, 93, 111, 93, 93, 93, 93, 93, 111, 93, 93, 111, 93, - 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 93, - 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 111, 93, - 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 111, - 93, 93, 93, 93, 111, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 111, 93, 93, - 111, 93, 93, 93, 111, 93, 93, 93, 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, - 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 111, 93, 93, + 93, 93, 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, + 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, + 93, 93, 93, 93, 111, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 111, 93, 93, 93, 93, 111, 93, 93, + 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 111, 93, 93, 111, 93, 93, 111, 93, 93, 111, 93, 93, 93, 111, 93, 93, 111, 93, 93, + 93, 93, 93, 111, 93, 93, 111, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, + 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 111, 93, + 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 111, 93, 93, 93, 93, + 111, 93, 111, 93, 93, 93, 93, 93, 93, 111, 93, 111, 93, 93, 111, 93, 93, 93, 111, 93, 93, 93, 111, + 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, + 93, ] export const BACKGROUND_TILE_3 = [ - 97, 97, 97, 149, 149, 97, 97, 97, 149, 149, 97, 97, 97, 115, 97, 97, 97, 206, - 97, 149, 115, 115, 97, 115, 115, 97, 97, 97, 103, 115, 103, 97, 97, 206, 206, - 97, 115, 115, 97, 115, 97, 97, 153, 153, 97, 97, 103, 97, 103, 115, 115, 97, - 103, 115, 97, 97, 103, 97, 153, 115, 115, 97, 149, 149, 97, 103, 115, 97, 103, - 115, 103, 97, 97, 97, 103, 115, 115, 103, 115, 115, 97, 97, 97, 97, 97, 97, - 97, 97, 206, 206, 103, 97, 97, 103, 97, 115, 97, 206, 206, 206, 97, 97, 97, - 115, 115, 206, 97, 97, 97, 97, 103, 97, 97, 97, 206, 115, 115, 97, 103, 115, - 115, 103, 97, 149, 103, 206, 206, 97, 97, 97, 103, 115, 115, 97, 103, 115, - 103, 97, 149, 115, 103, 115, 115, 97, 153, 153, 97, 103, 115, 97, 103, 97, - 103, 97, 115, 103, 97, 103, 115, 97, 153, 115, 115, 97, 97, 103, 153, 153, 97, - 97, 97, 97, 97, 103, 97, 97, 103, 115, 115, 103, 97, 103, 153, 115, 115, 97, - 97, 206, 206, 206, 97, 97, 97, 103, 97, 103, 97, 97, 103, 115, 115, 97, 115, - 115, 206, 97, 97, 97, 149, 97, 97, 97, 206, 206, 97, 97, 97, 103, 115, 115, - 103, 97, 206, 97, 115, 149, 97, 97, 103, 115, 115, 103, 97, 103, 115, 103, 97, - 115, 206, 97, 97, 115, 103, 97, 97, 103, 115, 103, 97, 103, 97, 97, 97, 115, - 115, 103, + 97, 97, 97, 149, 149, 97, 97, 97, 149, 149, 97, 97, 97, 115, 97, 97, 97, 206, 97, 149, 115, 115, + 97, 115, 115, 97, 97, 97, 103, 115, 103, 97, 97, 206, 206, 97, 115, 115, 97, 115, 97, 97, 153, + 153, 97, 97, 103, 97, 103, 115, 115, 97, 103, 115, 97, 97, 103, 97, 153, 115, 115, 97, 149, 149, + 97, 103, 115, 97, 103, 115, 103, 97, 97, 97, 103, 115, 115, 103, 115, 115, 97, 97, 97, 97, 97, 97, + 97, 97, 206, 206, 103, 97, 97, 103, 97, 115, 97, 206, 206, 206, 97, 97, 97, 115, 115, 206, 97, 97, + 97, 97, 103, 97, 97, 97, 206, 115, 115, 97, 103, 115, 115, 103, 97, 149, 103, 206, 206, 97, 97, + 97, 103, 115, 115, 97, 103, 115, 103, 97, 149, 115, 103, 115, 115, 97, 153, 153, 97, 103, 115, 97, + 103, 97, 103, 97, 115, 103, 97, 103, 115, 97, 153, 115, 115, 97, 97, 103, 153, 153, 97, 97, 97, + 97, 97, 103, 97, 97, 103, 115, 115, 103, 97, 103, 153, 115, 115, 97, 97, 206, 206, 206, 97, 97, + 97, 103, 97, 103, 97, 97, 103, 115, 115, 97, 115, 115, 206, 97, 97, 97, 149, 97, 97, 97, 206, 206, + 97, 97, 97, 103, 115, 115, 103, 97, 206, 97, 115, 149, 97, 97, 103, 115, 115, 103, 97, 103, 115, + 103, 97, 115, 206, 97, 97, 115, 103, 97, 97, 103, 115, 103, 97, 103, 97, 97, 97, 115, 115, 103, ] export const BACKGROUND_TILE_4 = [ - 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, - 93, 111, 93, 93, 93, 93, 111, 93, 93, 111, 173, 93, 93, 93, 111, 93, 93, 93, - 93, 93, 111, 93, 93, 93, 93, 173, 168, 173, 111, 93, 93, 93, 93, 93, 93, 93, - 111, 93, 93, 93, 93, 103, 173, 93, 111, 93, 93, 93, 211, 111, 93, 93, 93, 93, - 111, 93, 93, 93, 111, 93, 93, 93, 93, 211, 168, 111, 93, 93, 93, 93, 111, 93, - 93, 93, 111, 93, 93, 93, 93, 103, 93, 103, 93, 93, 93, 209, 209, 93, 111, 93, - 93, 93, 93, 93, 93, 93, 93, 93, 93, 209, 173, 173, 173, 93, 111, 93, 93, 111, - 93, 93, 111, 93, 93, 93, 103, 209, 173, 136, 173, 209, 93, 93, 93, 111, 93, - 93, 111, 93, 93, 93, 103, 103, 173, 173, 173, 209, 93, 111, 93, 93, 93, 93, - 93, 93, 111, 93, 93, 103, 209, 209, 103, 93, 93, 111, 93, 93, 93, 93, 93, 93, - 111, 93, 93, 93, 111, 93, 93, 93, 93, 218, 93, 93, 93, 111, 93, 173, 93, 93, - 93, 93, 111, 93, 93, 93, 111, 147, 218, 93, 93, 111, 173, 136, 173, 93, 93, - 93, 93, 93, 111, 93, 103, 93, 93, 111, 93, 103, 103, 173, 93, 93, 93, 111, 93, - 93, 111, 93, 93, 93, 93, 111, 93, 103, 93, 93, 93, 93, 93, 111, 93, 93, 93, - 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 111, 93, 93, + 93, 93, 111, 93, 93, 111, 173, 93, 93, 93, 111, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 173, 168, + 173, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, 93, 103, 173, 93, 111, 93, 93, 93, 211, + 111, 93, 93, 93, 93, 111, 93, 93, 93, 111, 93, 93, 93, 93, 211, 168, 111, 93, 93, 93, 93, 111, 93, + 93, 93, 111, 93, 93, 93, 93, 103, 93, 103, 93, 93, 93, 209, 209, 93, 111, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 209, 173, 173, 173, 93, 111, 93, 93, 111, 93, 93, 111, 93, 93, 93, 103, 209, 173, + 136, 173, 209, 93, 93, 93, 111, 93, 93, 111, 93, 93, 93, 103, 103, 173, 173, 173, 209, 93, 111, + 93, 93, 93, 93, 93, 93, 111, 93, 93, 103, 209, 209, 103, 93, 93, 111, 93, 93, 93, 93, 93, 93, 111, + 93, 93, 93, 111, 93, 93, 93, 93, 218, 93, 93, 93, 111, 93, 173, 93, 93, 93, 93, 111, 93, 93, 93, + 111, 147, 218, 93, 93, 111, 173, 136, 173, 93, 93, 93, 93, 93, 111, 93, 103, 93, 93, 111, 93, 103, + 103, 173, 93, 93, 93, 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, 103, 93, 93, 93, 93, 93, 111, 93, + 93, 93, 93, 93, 93, 93, 93, 93, ] export const BACKGROUND_TILE_5 = [ - 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, - 93, 111, 93, 211, 211, 93, 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 211, - 173, 173, 173, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 103, 211, 173, - 123, 173, 211, 93, 93, 93, 93, 213, 93, 93, 93, 93, 93, 103, 103, 173, 173, - 173, 211, 111, 93, 93, 93, 151, 213, 93, 93, 93, 111, 93, 103, 211, 211, 156, - 93, 111, 93, 93, 103, 156, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, - 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 111, 93, - 93, 111, 93, 93, 111, 203, 93, 93, 111, 93, 93, 111, 93, 93, 93, 93, 93, 111, - 93, 93, 203, 136, 203, 93, 111, 93, 93, 93, 93, 93, 93, 209, 93, 93, 93, 93, - 103, 156, 111, 93, 93, 93, 93, 93, 93, 93, 211, 209, 151, 93, 93, 93, 93, 93, - 111, 93, 93, 93, 111, 93, 93, 103, 209, 151, 209, 209, 93, 111, 93, 93, 93, - 93, 218, 93, 111, 93, 103, 103, 211, 209, 211, 93, 93, 111, 93, 111, 93, 218, - 168, 93, 93, 93, 111, 103, 103, 156, 103, 111, 93, 93, 93, 111, 93, 103, 156, - 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, - 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 111, 93, 211, + 211, 93, 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 211, 173, 173, 173, 93, 93, 93, 93, 111, + 93, 93, 93, 93, 93, 93, 103, 211, 173, 123, 173, 211, 93, 93, 93, 93, 213, 93, 93, 93, 93, 93, + 103, 103, 173, 173, 173, 211, 111, 93, 93, 93, 151, 213, 93, 93, 93, 111, 93, 103, 211, 211, 156, + 93, 111, 93, 93, 103, 156, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 111, 93, 93, 111, 93, 93, 111, 93, 93, 111, 203, 93, 93, 111, + 93, 93, 111, 93, 93, 93, 93, 93, 111, 93, 93, 203, 136, 203, 93, 111, 93, 93, 93, 93, 93, 93, 209, + 93, 93, 93, 93, 103, 156, 111, 93, 93, 93, 93, 93, 93, 93, 211, 209, 151, 93, 93, 93, 93, 93, 111, + 93, 93, 93, 111, 93, 93, 103, 209, 151, 209, 209, 93, 111, 93, 93, 93, 93, 218, 93, 111, 93, 103, + 103, 211, 209, 211, 93, 93, 111, 93, 111, 93, 218, 168, 93, 93, 93, 111, 103, 103, 156, 103, 111, + 93, 93, 93, 111, 93, 103, 156, 111, 93, 93, 111, 93, 93, 93, 93, 111, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, ] diff --git a/apps/website-svelte/src/lib/styles/legacy.css b/apps/website-svelte/src/lib/styles/legacy.css index 92c30c87..b3d1738c 100644 --- a/apps/website-svelte/src/lib/styles/legacy.css +++ b/apps/website-svelte/src/lib/styles/legacy.css @@ -1,929 +1,930 @@ :root { - /* Resurrect 64 Palette */ - --color-coal-1: #2e222f; - --color-coal-2: #3e3546; - --color-coal-3: #625565; - --color-coal-4: #966c6c; - --color-coal-5: #ab947a; - - --color-silver-1: #694f62; - --color-silver-2: #7f708a; - --color-silver-3: #9babb2; - --color-silver-4: #c7dcd0; - --color-silver-5: #ffffff; - - --color-red-1: #6e2727; - --color-red-2: #b33831; - --color-red-3: #ea4f36; - --color-red-4: #f57d4a; - - --color-orange-1: #ae2334; - --color-orange-2: #e83b3b; - --color-orange-3: #fb6b1d; - --color-orange-4: #f79617; - --color-orange-5: #f9c22b; - - --color-brown-1: #7a3045; - --color-brown-2: #9e4539; - --color-brown-3: #cd683d; - --color-brown-4: #e6904e; - --color-brown-5: #fbb954; - - --color-toxic-1: #4c3e24; - --color-toxic-2: #676633; - --color-toxic-3: #a2a947; - --color-toxic-4: #d5e04b; - --color-toxic-5: #fbff86; - - --color-green-1: #165a4c; - --color-green-2: #239063; - --color-green-3: #1ebc73; - --color-green-4: #91db69; - --color-green-5: #cddf6c; - - --color-stone-1: #313638; - --color-stone-2: #374e4a; - --color-stone-3: #547e64; - --color-stone-4: #92a984; - --color-stone-5: #b2ba90; - - --color-teal-1: #0b5e65; - --color-teal-2: #0b8a8f; - --color-teal-3: #0eaf9b; - --color-teal-4: #30e1b9; - --color-teal-5: #8ff8e2; - - --color-blue-1: #323353; - --color-blue-2: #484a77; - --color-blue-3: #4d65b4; - --color-blue-4: #4d9be6; - --color-blue-5: #8fd3ff; - - --color-violet-1: #45293f; - --color-violet-2: #6b3e75; - --color-violet-3: #905ea9; - --color-violet-4: #a884f3; - --color-violet-5: #eaaded; - - --color-plume-1: #753c54; - --color-plume-2: #a24b6f; - --color-plume-3: #cf657f; - --color-plume-4: #ed8099; - - --color-rose-1: #831c5d; - --color-rose-2: #c32454; - --color-rose-3: #f04f78; - --color-rose-4: #f68181; - --color-rose-5: #fca790; - --color-rose-6: #fdcbb0; - - --color-sand-1: #f6d7b0; - --color-sand-2: #f2d2a9; - --color-sand-3: #eccca2; - --color-sand-4: #e7c496; - --color-sand-5: #e1bf92; -} - -body, html { - font-family: "Noto Serif", serif; - font-optical-sizing: auto; - font-weight: 500; - font-style: normal; - font-variation-settings: "wdth" 100; + /* Resurrect 64 Palette */ + --color-coal-1: #2e222f; + --color-coal-2: #3e3546; + --color-coal-3: #625565; + --color-coal-4: #966c6c; + --color-coal-5: #ab947a; + + --color-silver-1: #694f62; + --color-silver-2: #7f708a; + --color-silver-3: #9babb2; + --color-silver-4: #c7dcd0; + --color-silver-5: #ffffff; + + --color-red-1: #6e2727; + --color-red-2: #b33831; + --color-red-3: #ea4f36; + --color-red-4: #f57d4a; + + --color-orange-1: #ae2334; + --color-orange-2: #e83b3b; + --color-orange-3: #fb6b1d; + --color-orange-4: #f79617; + --color-orange-5: #f9c22b; + + --color-brown-1: #7a3045; + --color-brown-2: #9e4539; + --color-brown-3: #cd683d; + --color-brown-4: #e6904e; + --color-brown-5: #fbb954; + + --color-toxic-1: #4c3e24; + --color-toxic-2: #676633; + --color-toxic-3: #a2a947; + --color-toxic-4: #d5e04b; + --color-toxic-5: #fbff86; + + --color-green-1: #165a4c; + --color-green-2: #239063; + --color-green-3: #1ebc73; + --color-green-4: #91db69; + --color-green-5: #cddf6c; + + --color-stone-1: #313638; + --color-stone-2: #374e4a; + --color-stone-3: #547e64; + --color-stone-4: #92a984; + --color-stone-5: #b2ba90; + + --color-teal-1: #0b5e65; + --color-teal-2: #0b8a8f; + --color-teal-3: #0eaf9b; + --color-teal-4: #30e1b9; + --color-teal-5: #8ff8e2; + + --color-blue-1: #323353; + --color-blue-2: #484a77; + --color-blue-3: #4d65b4; + --color-blue-4: #4d9be6; + --color-blue-5: #8fd3ff; + + --color-violet-1: #45293f; + --color-violet-2: #6b3e75; + --color-violet-3: #905ea9; + --color-violet-4: #a884f3; + --color-violet-5: #eaaded; + + --color-plume-1: #753c54; + --color-plume-2: #a24b6f; + --color-plume-3: #cf657f; + --color-plume-4: #ed8099; + + --color-rose-1: #831c5d; + --color-rose-2: #c32454; + --color-rose-3: #f04f78; + --color-rose-4: #f68181; + --color-rose-5: #fca790; + --color-rose-6: #fdcbb0; + + --color-sand-1: #f6d7b0; + --color-sand-2: #f2d2a9; + --color-sand-3: #eccca2; + --color-sand-4: #e7c496; + --color-sand-5: #e1bf92; +} + +body, +html { + font-family: 'Noto Serif', serif; + font-optical-sizing: auto; + font-weight: 500; + font-style: normal; + font-variation-settings: 'wdth' 100; } .bg-primary { - background-color: #FFE7B3; + background-color: #ffe7b3; } .bg-accent-violet { - background-color: #473876; + background-color: #473876; } .bg-progress-bar { - background-color: #DBB594; + background-color: #dbb594; } .bg-twitch-command { - background-image: linear-gradient(to right, #56468B 0%, #664282 100%); - border: 2px solid #7D66D9; + background-image: linear-gradient(to right, #56468b 0%, #664282 100%); + border: 2px solid #7d66d9; } .text-primary { - color: #38352E + color: #38352e; } .text-accent-sand { - color: #FFE7B3 + color: #ffe7b3; } .text-secondary-sand { - color: #DBB594 + color: #dbb594; } .border-primary { - border-color: #978365 + border-color: #978365; } .border-secondary { - border-color: #CBB99F + border-color: #cbb99f; } .bg-coal-1 { - background-color: var(--color-coal-1); + background-color: var(--color-coal-1); } .bg-coal-2 { - background-color: var(--color-coal-2); + background-color: var(--color-coal-2); } .bg-coal-3 { - background-color: var(--color-coal-3); + background-color: var(--color-coal-3); } .bg-coal-4 { - background-color: var(--color-coal-4); + background-color: var(--color-coal-4); } .bg-coal-5 { - background-color: var(--color-coal-5); + background-color: var(--color-coal-5); } .border-coal-1 { - border-color: var(--color-coal-1); + border-color: var(--color-coal-1); } .border-coal-2 { - border-color: var(--color-coal-2); + border-color: var(--color-coal-2); } .border-coal-3 { - border-color: var(--color-coal-3); + border-color: var(--color-coal-3); } .border-coal-4 { - border-color: var(--color-coal-4); + border-color: var(--color-coal-4); } .border-coal-5 { - border-color: var(--color-coal-5); + border-color: var(--color-coal-5); } .bg-silver-1 { - background-color: var(--color-silver-1); + background-color: var(--color-silver-1); } .bg-silver-2 { - background-color: var(--color-silver-2); + background-color: var(--color-silver-2); } .bg-silver-3 { - background-color: var(--color-silver-3); + background-color: var(--color-silver-3); } .bg-silver-4 { - background-color: var(--color-silver-4); + background-color: var(--color-silver-4); } .bg-silver-5 { - background-color: var(--color-silver-5); + background-color: var(--color-silver-5); } .border-silver-1 { - border-color: var(--color-silver-1); + border-color: var(--color-silver-1); } .border-silver-2 { - border-color: var(--color-silver-2); + border-color: var(--color-silver-2); } .border-silver-3 { - border-color: var(--color-silver-3); + border-color: var(--color-silver-3); } .border-silver-4 { - border-color: var(--color-silver-4); + border-color: var(--color-silver-4); } .border-silver-5 { - border-color: var(--color-silver-5); + border-color: var(--color-silver-5); } .text-silver-1 { - color: var(--color-silver-1); + color: var(--color-silver-1); } .text-silver-2 { - color: var(--color-silver-2); + color: var(--color-silver-2); } .text-silver-3 { - color: var(--color-silver-3); + color: var(--color-silver-3); } .text-silver-4 { - color: var(--color-silver-4); + color: var(--color-silver-4); } .text-silver-5 { - color: var(--color-silver-5); + color: var(--color-silver-5); } .bg-red-1 { - background-color: var(--color-red-1); + background-color: var(--color-red-1); } .bg-red-2 { - background-color: var(--color-red-2); + background-color: var(--color-red-2); } .bg-red-3 { - background-color: var(--color-red-3); + background-color: var(--color-red-3); } .bg-red-4 { - background-color: var(--color-red-4); + background-color: var(--color-red-4); } .border-red-1 { - border-color: var(--color-red-1); + border-color: var(--color-red-1); } .border-red-2 { - border-color: var(--color-red-2); + border-color: var(--color-red-2); } .border-red-3 { - border-color: var(--color-red-3); + border-color: var(--color-red-3); } .border-red-4 { - border-color: var(--color-red-4); + border-color: var(--color-red-4); } .text-red-1 { - color: var(--color-red-1); + color: var(--color-red-1); } .text-red-2 { - color: var(--color-red-2); + color: var(--color-red-2); } .text-red-3 { - color: var(--color-red-3); + color: var(--color-red-3); } .text-red-4 { - color: var(--color-red-4); + color: var(--color-red-4); } .bg-violet-1 { - background-color: var(--color-violet-1); + background-color: var(--color-violet-1); } .bg-violet-2 { - background-color: var(--color-violet-2); + background-color: var(--color-violet-2); } .bg-violet-3 { - background-color: var(--color-violet-3); + background-color: var(--color-violet-3); } .bg-violet-4 { - background-color: var(--color-violet-4); + background-color: var(--color-violet-4); } .bg-violet-5 { - background-color: var(--color-violet-5); + background-color: var(--color-violet-5); } .border-violet-1 { - border-color: var(--color-violet-1); + border-color: var(--color-violet-1); } .border-violet-2 { - border-color: var(--color-violet-2); + border-color: var(--color-violet-2); } .border-violet-3 { - border-color: var(--color-violet-3); + border-color: var(--color-violet-3); } .border-violet-4 { - border-color: var(--color-violet-4); + border-color: var(--color-violet-4); } .border-violet-5 { - border-color: var(--color-violet-5); + border-color: var(--color-violet-5); } .text-violet-1 { - color: var(--color-violet-1); + color: var(--color-violet-1); } .text-violet-2 { - color: var(--color-violet-2); + color: var(--color-violet-2); } .text-violet-3 { - color: var(--color-violet-3); + color: var(--color-violet-3); } .text-violet-4 { - color: var(--color-violet-4); + color: var(--color-violet-4); } .text-violet-5 { - color: var(--color-violet-5); + color: var(--color-violet-5); } .bg-orange-1 { - background-color: var(--color-orange-1); + background-color: var(--color-orange-1); } .bg-orange-2 { - background-color: var(--color-orange-2); + background-color: var(--color-orange-2); } .bg-orange-3 { - background-color: var(--color-orange-3); + background-color: var(--color-orange-3); } .bg-orange-4 { - background-color: var(--color-orange-4); + background-color: var(--color-orange-4); } .bg-orange-5 { - background-color: var(--color-orange-5); + background-color: var(--color-orange-5); } .border-orange-1 { - border-color: var(--color-orange-1); + border-color: var(--color-orange-1); } .border-orange-2 { - border-color: var(--color-orange-2); + border-color: var(--color-orange-2); } .border-orange-3 { - border-color: var(--color-orange-3); + border-color: var(--color-orange-3); } .border-orange-4 { - border-color: var(--color-orange-4); + border-color: var(--color-orange-4); } .border-orange-5 { - border-color: var(--color-orange-5); + border-color: var(--color-orange-5); } .text-orange-1 { - color: var(--color-orange-1); + color: var(--color-orange-1); } .text-orange-2 { - color: var(--color-orange-2); + color: var(--color-orange-2); } .text-orange-3 { - color: var(--color-orange-3); + color: var(--color-orange-3); } .text-orange-4 { - color: var(--color-orange-4); + color: var(--color-orange-4); } .text-orange-5 { - color: var(--color-orange-5); + color: var(--color-orange-5); } .bg-brown-1 { - background-color: var(--color-brown-1); + background-color: var(--color-brown-1); } .bg-brown-2 { - background-color: var(--color-brown-2); + background-color: var(--color-brown-2); } .bg-brown-3 { - background-color: var(--color-brown-3); + background-color: var(--color-brown-3); } .bg-brown-4 { - background-color: var(--color-brown-4); + background-color: var(--color-brown-4); } .bg-brown-5 { - background-color: var(--color-brown-5); + background-color: var(--color-brown-5); } .border-brown-1 { - border-color: var(--color-brown-1); + border-color: var(--color-brown-1); } .border-brown-2 { - border-color: var(--color-brown-2); + border-color: var(--color-brown-2); } .border-brown-3 { - border-color: var(--color-brown-3); + border-color: var(--color-brown-3); } .border-brown-4 { - border-color: var(--color-brown-4); + border-color: var(--color-brown-4); } .border-brown-5 { - border-color: var(--color-brown-5); + border-color: var(--color-brown-5); } .text-brown-1 { - color: var(--color-brown-1); + color: var(--color-brown-1); } .text-brown-2 { - color: var(--color-brown-2); + color: var(--color-brown-2); } .text-brown-3 { - color: var(--color-brown-3); + color: var(--color-brown-3); } .text-brown-4 { - color: var(--color-brown-4); + color: var(--color-brown-4); } .text-brown-5 { - color: var(--color-brown-5); + color: var(--color-brown-5); } .bg-blue-1 { - background-color: var(--color-blue-1); + background-color: var(--color-blue-1); } .bg-blue-2 { - background-color: var(--color-blue-2); + background-color: var(--color-blue-2); } .bg-blue-3 { - background-color: var(--color-blue-3); + background-color: var(--color-blue-3); } .bg-blue-4 { - background-color: var(--color-blue-4); + background-color: var(--color-blue-4); } .bg-blue-5 { - background-color: var(--color-blue-5); + background-color: var(--color-blue-5); } .border-blue-1 { - border-color: var(--color-blue-1); + border-color: var(--color-blue-1); } .border-blue-2 { - border-color: var(--color-blue-2); + border-color: var(--color-blue-2); } .border-blue-3 { - border-color: var(--color-blue-3); + border-color: var(--color-blue-3); } .border-blue-4 { - border-color: var(--color-blue-4); + border-color: var(--color-blue-4); } .border-blue-5 { - border-color: var(--color-blue-5); + border-color: var(--color-blue-5); } .text-blue-1 { - color: var(--color-blue-1); + color: var(--color-blue-1); } .text-blue-2 { - color: var(--color-blue-2); + color: var(--color-blue-2); } .text-blue-3 { - color: var(--color-blue-3); + color: var(--color-blue-3); } .text-blue-4 { - color: var(--color-blue-4); + color: var(--color-blue-4); } .text-blue-5 { - color: var(--color-blue-5); + color: var(--color-blue-5); } .bg-teal-1 { - background-color: var(--color-teal-1); + background-color: var(--color-teal-1); } .bg-teal-2 { - background-color: var(--color-teal-2); + background-color: var(--color-teal-2); } .bg-teal-3 { - background-color: var(--color-teal-3); + background-color: var(--color-teal-3); } .bg-teal-4 { - background-color: var(--color-teal-4); + background-color: var(--color-teal-4); } .bg-teal-5 { - background-color: var(--color-teal-5); + background-color: var(--color-teal-5); } .border-teal-1 { - border-color: var(--color-teal-1); + border-color: var(--color-teal-1); } .border-teal-2 { - border-color: var(--color-teal-2); + border-color: var(--color-teal-2); } .border-teal-3 { - border-color: var(--color-teal-3); + border-color: var(--color-teal-3); } .border-teal-4 { - border-color: var(--color-teal-4); + border-color: var(--color-teal-4); } .border-teal-5 { - border-color: var(--color-teal-5); + border-color: var(--color-teal-5); } .text-teal-1 { - color: var(--color-teal-1); + color: var(--color-teal-1); } .text-teal-2 { - color: var(--color-teal-2); + color: var(--color-teal-2); } .text-teal-3 { - color: var(--color-teal-3); + color: var(--color-teal-3); } .text-teal-4 { - color: var(--color-teal-4); + color: var(--color-teal-4); } .text-teal-5 { - color: var(--color-teal-5); + color: var(--color-teal-5); } .bg-green-1 { - background-color: var(--color-green-1); + background-color: var(--color-green-1); } .bg-green-2 { - background-color: var(--color-green-2); + background-color: var(--color-green-2); } .bg-green-3 { - background-color: var(--color-green-3); + background-color: var(--color-green-3); } .bg-green-4 { - background-color: var(--color-green-4); + background-color: var(--color-green-4); } .bg-green-5 { - background-color: var(--color-green-5); + background-color: var(--color-green-5); } .border-green-1 { - border-color: var(--color-green-1); + border-color: var(--color-green-1); } .border-green-2 { - border-color: var(--color-green-2); + border-color: var(--color-green-2); } .border-green-3 { - border-color: var(--color-green-3); + border-color: var(--color-green-3); } .border-green-4 { - border-color: var(--color-green-4); + border-color: var(--color-green-4); } .border-green-5 { - border-color: var(--color-green-5); + border-color: var(--color-green-5); } .text-green-1 { - color: var(--color-green-1); + color: var(--color-green-1); } .text-green-2 { - color: var(--color-green-2); + color: var(--color-green-2); } .text-green-3 { - color: var(--color-green-3); + color: var(--color-green-3); } .text-green-4 { - color: var(--color-green-4); + color: var(--color-green-4); } .text-green-5 { - color: var(--color-green-5); + color: var(--color-green-5); } .bg-stone-1 { - background-color: var(--color-stone-1); + background-color: var(--color-stone-1); } .bg-stone-2 { - background-color: var(--color-stone-2); + background-color: var(--color-stone-2); } .bg-stone-3 { - background-color: var(--color-stone-3); + background-color: var(--color-stone-3); } .bg-stone-4 { - background-color: var(--color-stone-4); + background-color: var(--color-stone-4); } .bg-stone-5 { - background-color: var(--color-stone-5); + background-color: var(--color-stone-5); } .border-stone-1 { - border-color: var(--color-stone-1); + border-color: var(--color-stone-1); } .border-stone-2 { - border-color: var(--color-stone-2); + border-color: var(--color-stone-2); } .border-stone-3 { - border-color: var(--color-stone-3); + border-color: var(--color-stone-3); } .border-stone-4 { - border-color: var(--color-stone-4); + border-color: var(--color-stone-4); } .border-stone-5 { - border-color: var(--color-stone-5); + border-color: var(--color-stone-5); } .text-stone-1 { - color: var(--color-stone-1); + color: var(--color-stone-1); } .text-stone-2 { - color: var(--color-stone-2); + color: var(--color-stone-2); } .text-stone-3 { - color: var(--color-stone-3); + color: var(--color-stone-3); } .text-stone-4 { - color: var(--color-stone-4); + color: var(--color-stone-4); } .text-stone-5 { - color: var(--color-stone-5); + color: var(--color-stone-5); } @keyframes animation-tree-shake { - 0% { - transform: skewX(0deg); - } - /* Chop */ - 10% { - transform: skewX(-5deg); - } - 12% { - transform: skewX(5deg); - } - 15% { - transform: skewX(0deg); - } - /* Chop */ - 30% { - transform: skewX(-5deg); - } - 32% { - transform: skewX(5deg); - } - 35% { - transform: skewX(0deg); - } - - 50% { - transform: skewX(0deg); - } - 60% { - transform: skewX(0deg); - } - - /* Chop */ - 65% { - transform: skewX(-5deg); - } - 67% { - transform: skewX(5deg); - } - 70% { - transform: skewX(0deg); - } - 100% { - transform: skewX(0deg); - } + 0% { + transform: skewX(0deg); + } + /* Chop */ + 10% { + transform: skewX(-5deg); + } + 12% { + transform: skewX(5deg); + } + 15% { + transform: skewX(0deg); + } + /* Chop */ + 30% { + transform: skewX(-5deg); + } + 32% { + transform: skewX(5deg); + } + 35% { + transform: skewX(0deg); + } + + 50% { + transform: skewX(0deg); + } + 60% { + transform: skewX(0deg); + } + + /* Chop */ + 65% { + transform: skewX(-5deg); + } + 67% { + transform: skewX(5deg); + } + 70% { + transform: skewX(0deg); + } + 100% { + transform: skewX(0deg); + } } .animation-tree-shake { - animation: animation-tree-shake 2.6s infinite; + animation: animation-tree-shake 2.6s infinite; } @keyframes animation-tree-wind-shake { - 0% { - transform: skewX(0deg); - } - 10% { - transform: skewX(-5deg); - } - 15% { - transform: skewX(0); - } - 50% { - transform: skewX(0); - } - 57% { - transform: skewX(2deg); - } - 65% { - transform: skewX(-4deg); - } - 73% { - transform: skewX(0); - } - 100% { - transform: skewX(0deg); - } + 0% { + transform: skewX(0deg); + } + 10% { + transform: skewX(-5deg); + } + 15% { + transform: skewX(0); + } + 50% { + transform: skewX(0); + } + 57% { + transform: skewX(2deg); + } + 65% { + transform: skewX(-4deg); + } + 73% { + transform: skewX(0); + } + 100% { + transform: skewX(0deg); + } } .animation-tree-wind-shake { - animation: animation-tree-wind-shake 10s infinite; + animation: animation-tree-wind-shake 10s infinite; } @keyframes animation-tree-chopping { - 0% { - transform: translate(0, 0) rotate(0deg); - } - /* Chop */ - 10% { - transform: translate(0, 0) rotate(0deg); - } - 12% { - transform: translate(-5px, 8px) rotate(-45deg); - } - 15% { - transform: translate(0, 0) rotate(0deg); - } - /* Chop */ - 30% { - transform: translate(0, 0) rotate(0deg); - } - 32% { - transform: translate(-5px, 8px) rotate(-45deg); - } - 35% { - transform: translate(0, 0) rotate(0deg); - } - - 50% { - transform: translate(0, 0) rotate(0deg); - } - 60% { - transform: translate(0, 0) rotate(0deg); - } - - /* Chop */ - 65% { - transform: translate(0, 0) rotate(0deg); - } - 67% { - transform: translate(-5px, 8px) rotate(-45deg); - } - 70% { - transform: translate(0, 0) rotate(0deg); - } - - 100% { - transform: translate(0, 0) rotate(0deg); - } + 0% { + transform: translate(0, 0) rotate(0deg); + } + /* Chop */ + 10% { + transform: translate(0, 0) rotate(0deg); + } + 12% { + transform: translate(-5px, 8px) rotate(-45deg); + } + 15% { + transform: translate(0, 0) rotate(0deg); + } + /* Chop */ + 30% { + transform: translate(0, 0) rotate(0deg); + } + 32% { + transform: translate(-5px, 8px) rotate(-45deg); + } + 35% { + transform: translate(0, 0) rotate(0deg); + } + + 50% { + transform: translate(0, 0) rotate(0deg); + } + 60% { + transform: translate(0, 0) rotate(0deg); + } + + /* Chop */ + 65% { + transform: translate(0, 0) rotate(0deg); + } + 67% { + transform: translate(-5px, 8px) rotate(-45deg); + } + 70% { + transform: translate(0, 0) rotate(0deg); + } + + 100% { + transform: translate(0, 0) rotate(0deg); + } } .animation-tree-chopping { - animation: animation-tree-chopping 2.6s infinite; + animation: animation-tree-chopping 2.6s infinite; } @keyframes animation-stone-little-shake { - 0% { - transform: skewY(0deg); - } - 10% { - transform: skewY(-1deg); - } - 15% { - transform: skewY(0); - } - 50% { - transform: skewY(0); - } - 57% { - transform: skewY(1deg); - } - 65% { - transform: skewY(-1deg); - } - 73% { - transform: skewY(0); - } - 100% { - transform: skewY(0deg); - } + 0% { + transform: skewY(0deg); + } + 10% { + transform: skewY(-1deg); + } + 15% { + transform: skewY(0); + } + 50% { + transform: skewY(0); + } + 57% { + transform: skewY(1deg); + } + 65% { + transform: skewY(-1deg); + } + 73% { + transform: skewY(0); + } + 100% { + transform: skewY(0deg); + } } .animation-stone-little-shake { - animation: animation-stone-little-shake 10s infinite; + animation: animation-stone-little-shake 10s infinite; } @keyframes animation-rabbit-hop { - 0% { - transform: translate(0, 0) rotate(0deg); - } - 70% { - transform: translate(0, 1px) rotate(0deg); - } - 80% { - transform: translate(0, -6px) rotate(-8deg) scale(0.7); - } - 90% { - transform: translate(0, 2px) rotate(2deg); - } - 100% { - transform: translate(0, 0) rotate(0deg); - } + 0% { + transform: translate(0, 0) rotate(0deg); + } + 70% { + transform: translate(0, 1px) rotate(0deg); + } + 80% { + transform: translate(0, -6px) rotate(-8deg) scale(0.7); + } + 90% { + transform: translate(0, 2px) rotate(2deg); + } + 100% { + transform: translate(0, 0) rotate(0deg); + } } .animation-rabbit-hop { - animation: animation-rabbit-hop 0.7s infinite; + animation: animation-rabbit-hop 0.7s infinite; } @keyframes animation-wolf-move { - 0% { - transform: translate(0, 0) rotate(0deg); - } - 70% { - transform: translate(0, 1px) rotate(0deg); - } - 80% { - transform: translate(0, -1px) rotate(-4deg) scale(0.88); - } - 90% { - transform: translate(0, 1px) rotate(2deg); - } - 100% { - transform: translate(0, 0) rotate(0deg); - } + 0% { + transform: translate(0, 0) rotate(0deg); + } + 70% { + transform: translate(0, 1px) rotate(0deg); + } + 80% { + transform: translate(0, -1px) rotate(-4deg) scale(0.88); + } + 90% { + transform: translate(0, 1px) rotate(2deg); + } + 100% { + transform: translate(0, 0) rotate(0deg); + } } .animation-wolf-move { - animation: animation-wolf-move 0.8s infinite; + animation: animation-wolf-move 0.8s infinite; } @keyframes animation-player-move { - 0% { - transform: translate(0, 0) rotate(0deg); - } - 70% { - transform: translate(0, 1px) rotate(0deg); - } - 80% { - transform: translate(0, -1px) rotate(-4deg) scale(0.88); - } - 90% { - transform: translate(0, 1px) rotate(2deg); - } - 100% { - transform: translate(0, 0) rotate(0deg); - } + 0% { + transform: translate(0, 0) rotate(0deg); + } + 70% { + transform: translate(0, 1px) rotate(0deg); + } + 80% { + transform: translate(0, -1px) rotate(-4deg) scale(0.88); + } + 90% { + transform: translate(0, 1px) rotate(2deg); + } + 100% { + transform: translate(0, 0) rotate(0deg); + } } .animation-player-move { - animation: animation-player-move 0.6s infinite; + animation: animation-player-move 0.6s infinite; } diff --git a/apps/website-svelte/src/lib/styles/styles.css b/apps/website-svelte/src/lib/styles/styles.css index 5a6c8115..900f092b 100644 --- a/apps/website-svelte/src/lib/styles/styles.css +++ b/apps/website-svelte/src/lib/styles/styles.css @@ -8,155 +8,156 @@ @import '@radix-ui/colors/violet.css'; :root { - --color-twitch: #8E4EC6; - --color-background: #FFF7ED; - --color-background-2: #F6EEE7; - --color-border: #DCBC9F; - --color-border-2: #E1DCCF; - --color-bg-accent-1: #56468B; - --color-bg-accent-2: #6F5F58; - --color-common: var(--gray-9); - --color-uncommon: #33B074; - --color-rare: #0090FF; - --color-epic: #7D66D9; - --color-legendary: #F76B15; - --color-bg-loader: #7D66D9; + --color-twitch: #8e4ec6; + --color-background: #fff7ed; + --color-background-2: #f6eee7; + --color-border: #dcbc9f; + --color-border-2: #e1dccf; + --color-bg-accent-1: #56468b; + --color-bg-accent-2: #6f5f58; + --color-common: var(--gray-9); + --color-uncommon: #33b074; + --color-rare: #0090ff; + --color-epic: #7d66d9; + --color-legendary: #f76b15; + --color-bg-loader: #7d66d9; } html { - font-size: 16px; + font-size: 16px; } -html, body { - font-family: "Noto Serif", "Times New Roman", "Georgia", serif; - font-optical-sizing: auto; - font-weight: 500; - font-style: normal; - font-variation-settings: "wdth" 100; +html, +body { + font-family: 'Noto Serif', 'Times New Roman', 'Georgia', serif; + font-optical-sizing: auto; + font-weight: 500; + font-style: normal; + font-variation-settings: 'wdth' 100; } body { - min-height: 100vh; - margin: 0; + min-height: 100vh; + margin: 0; } h1, h2, h3, p { - margin: 0; + margin: 0; } h1, h2, p { - font-weight: 400; + font-weight: 400; } h3 { - font-weight: 600; + font-weight: 600; } p { - font-size: 1rem; - line-height: 1.5; + font-size: 1rem; + line-height: 1.5; } a { - color: var(--green-9); - text-decoration: none; + color: var(--green-9); + text-decoration: none; } a:hover { - text-decoration: underline; + text-decoration: underline; } h1 { - font-size: 2rem; - text-align: center; + font-size: 2rem; + text-align: center; } h2 { - font-size: 1.2rem; + font-size: 1.2rem; } pre { - font-size: 16px; - background-color: rgba(255, 255, 255, 0.45); - border-radius: 3px; - box-shadow: 2px 2px 6px rgb(255 255 255 / 25%); - padding: 0.5em; - overflow-x: auto; + font-size: 16px; + background-color: rgba(255, 255, 255, 0.45); + border-radius: 3px; + box-shadow: 2px 2px 6px rgb(255 255 255 / 25%); + padding: 0.5em; + overflow-x: auto; } input, button { - font-size: inherit; - font-family: inherit; + font-size: inherit; + font-family: inherit; } button, -input[type="submit"], -input[type="reset"] { - background: none; - color: inherit; - border: none; - padding: 0; - font: inherit; - cursor: pointer; - outline: inherit; +input[type='submit'], +input[type='reset'] { + background: none; + color: inherit; + border: none; + padding: 0; + font: inherit; + cursor: pointer; + outline: inherit; } button:focus:not(:focus-visible) { - outline: none; + outline: none; } @media (min-width: 720px) { - html { - font-size: 18px; - } + html { + font-size: 18px; + } - h1 { - font-size: 2.4rem; - } + h1 { + font-size: 2.4rem; + } - h2 { - font-size: 1.5rem; - } + h2 { + font-size: 1.5rem; + } } .bg-paper { - background-image: url($lib/assets/website/background-paper-2.webp); - background-repeat: no-repeat; - background-position: bottom; - background-size: cover; + background-image: url($lib/assets/website/background-paper-2.webp); + background-repeat: no-repeat; + background-position: bottom; + background-size: cover; } .dropdown-menu { - display: flex; - flex-direction: column; - align-items: flex-start; - gap: 0.25em; - width: max-content; - max-width: 320px; - position: absolute; - bottom: -0.25em; - transform: translateY(100%); - padding: 0.5em; - background-color: var(--brown-3); - z-index: 5; + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 0.25em; + width: max-content; + max-width: 320px; + position: absolute; + bottom: -0.25em; + transform: translateY(100%); + padding: 0.5em; + background-color: var(--brown-3); + z-index: 5; } .dropdown-menu a { - color: inherit; - text-decoration: none; + color: inherit; + text-decoration: none; } .dropdown-menu button { - text-align: left; + text-align: left; } .dropdown-menu button:hover, .dropdown-menu a:hover { - color: var(--green-9); -} \ No newline at end of file + color: var(--green-9); +} diff --git a/apps/website-svelte/src/lib/styles/website.css b/apps/website-svelte/src/lib/styles/website.css index 09726202..052ef2f7 100644 --- a/apps/website-svelte/src/lib/styles/website.css +++ b/apps/website-svelte/src/lib/styles/website.css @@ -1,4 +1,5 @@ -html, body { - background-color: var(--orange-2); - color: var(--bronze-12); -} \ No newline at end of file +html, +body { + background-color: var(--orange-2); + color: var(--bronze-12); +} diff --git a/apps/website-svelte/tsconfig.json b/apps/website-svelte/tsconfig.json index 27b6795a..4c63f2e1 100644 --- a/apps/website-svelte/tsconfig.json +++ b/apps/website-svelte/tsconfig.json @@ -11,9 +11,5 @@ "forceConsistentCasingInFileNames": true, "skipLibCheck": true }, - "exclude": [ - "node_modules", - "tmp", - "build" - ] + "exclude": ["node_modules", "tmp", "build"] } diff --git a/apps/website-svelte/vite.config.ts b/apps/website-svelte/vite.config.ts index f503b8f1..3f537502 100644 --- a/apps/website-svelte/vite.config.ts +++ b/apps/website-svelte/vite.config.ts @@ -4,10 +4,7 @@ import { svelteTesting } from '@testing-library/svelte/vite' import { defineConfig } from 'vite' export default defineConfig({ - plugins: [ - sveltekit(), - svelteTesting(), - ], + plugins: [sveltekit(), svelteTesting()], server: { host: '0.0.0.0', port: 3000, diff --git a/apps/website/nuxt.config.ts b/apps/website/nuxt.config.ts index 27009636..3e535b66 100644 --- a/apps/website/nuxt.config.ts +++ b/apps/website/nuxt.config.ts @@ -1,5 +1,5 @@ -import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; -import { defineNuxtConfig } from 'nuxt/config'; +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin' +import { defineNuxtConfig } from 'nuxt/config' // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ @@ -30,10 +30,6 @@ export default defineNuxtConfig({ cookieKey: '', // NUXT_PUBLIC_COOKIE_KEY }, }, - modules: [ - '@nuxt/eslint', - '@vueuse/nuxt', - '@pinia/nuxt', - ], + modules: ['@nuxt/eslint', '@vueuse/nuxt', '@pinia/nuxt'], compatibilityDate: '2024-08-18', -}); \ No newline at end of file +}) diff --git a/apps/website/src/assets/css/styles.css b/apps/website/src/assets/css/styles.css index 07271ca1..4f477263 100644 --- a/apps/website/src/assets/css/styles.css +++ b/apps/website/src/assets/css/styles.css @@ -16,19 +16,19 @@ @import '@radix-ui/colors/violet.css'; :root { - --color-twitch: #8E4EC6; - --color-background: #FFF7ED; - --color-background-2: #F6EEE7; - --color-border: var(--brown-7); - --color-border-2: #E1DCCF; - --color-bg-accent-1: var(--violet-9); - --color-bg-accent-2: #6F5F58; - --color-common: var(--gray-9); - --color-uncommon: #33B074; - --color-rare: #0090FF; - --color-epic: #7D66D9; - --color-legendary: #F76B15; - --color-bg-loader: #7D66D9; + --color-twitch: #8e4ec6; + --color-background: #fff7ed; + --color-background-2: #f6eee7; + --color-border: var(--brown-7); + --color-border-2: #e1dccf; + --color-bg-accent-1: var(--violet-9); + --color-bg-accent-2: #6f5f58; + --color-common: var(--gray-9); + --color-uncommon: #33b074; + --color-rare: #0090ff; + --color-epic: #7d66d9; + --color-legendary: #f76b15; + --color-bg-loader: #7d66d9; } html { @@ -44,12 +44,13 @@ body { line-height: inherit; margin: 0; } -html, body { - font-family: "Noto Serif", "Times New Roman", "Georgia", serif; +html, +body { + font-family: 'Noto Serif', 'Times New Roman', 'Georgia', serif; font-optical-sizing: auto; font-weight: 500; font-style: normal; - font-variation-settings: "wdth" 100; + font-variation-settings: 'wdth' 100; } h1, @@ -80,8 +81,8 @@ a { text-decoration: inherit; } pre { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, - 'Liberation Mono', 'Courier New', monospace; + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', + 'Courier New', monospace; } p { @@ -123,8 +124,8 @@ button { } button, -input[type="submit"], -input[type="reset"] { +input[type='submit'], +input[type='reset'] { background: none; color: inherit; border: none; @@ -140,15 +141,15 @@ button:focus:not(:focus-visible) { @media (min-width: 720px) { html { - font-size: 18px; + font-size: 18px; } h1 { - font-size: 2.4rem; + font-size: 2.4rem; } h2 { - font-size: 1.5rem; + font-size: 1.5rem; } } @@ -188,7 +189,8 @@ button:focus:not(:focus-visible) { color: var(--green-9); } -html, body { +html, +body { background-color: var(--orange-2); color: var(--bronze-12); } @@ -207,6 +209,6 @@ section { padding: 4em 0; h1 { - margin-bottom: 0.25em; + margin-bottom: 0.25em; } } diff --git a/apps/website/src/components/MainHeader.client.vue b/apps/website/src/components/MainHeader.client.vue index dc98039f..a7fc7925 100644 --- a/apps/website/src/components/MainHeader.client.vue +++ b/apps/website/src/components/MainHeader.client.vue @@ -16,62 +16,62 @@ const { width } = useWindowSize() \ No newline at end of file +} + diff --git a/apps/website/src/components/MainLogo.client.vue b/apps/website/src/components/MainLogo.client.vue index 7ceb0ad5..2dccdbc4 100644 --- a/apps/website/src/components/MainLogo.client.vue +++ b/apps/website/src/components/MainLogo.client.vue @@ -1,15 +1,15 @@