diff --git a/package-lock.json b/package-lock.json index 6a9ae2605..b5b272ff4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -121,6 +121,12 @@ "integrity": "sha512-SGGAhXLHDx+PK4YLNcNGa6goPf9XRWQNAUUbffkwVGGXIxmDKWyGGL4inzq2sPmExu431Ekb9aEMn9BkPqEYFA==", "dev": true }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, "@types/mime": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.1.tgz", @@ -529,6 +535,15 @@ "esprima": "^4.0.0" } }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -570,6 +585,12 @@ "mime-db": "1.42.0" } }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, "moment": { "version": "2.24.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz", @@ -805,6 +826,12 @@ "ansi-regex": "^5.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "toidentifier": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", @@ -822,6 +849,18 @@ "yn": "^3.0.0" } }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, "tslib": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", diff --git a/package.json b/package.json index 04947e37f..75152c521 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "src/game-server.ts", "scripts": { "server": "npm start", - "start": "ts-node src/main.ts", + "start": "ts-node -r tsconfig-paths/register src/main.ts", "fake-players": "npm start -- --fakePlayers" }, "repository": { @@ -40,6 +40,7 @@ "@types/js-yaml": "^3.12.1", "@types/node": "^12.12.6", "@types/uuid": "^3.4.6", - "@types/yargs": "^13.0.4" + "@types/yargs": "^13.0.4", + "tsconfig-paths": "^3.9.0" } } diff --git a/src/net/client-connection.ts b/src/net/client-connection.ts index f529f1fbb..45b443478 100644 --- a/src/net/client-connection.ts +++ b/src/net/client-connection.ts @@ -1,10 +1,10 @@ import { Socket } from 'net'; -import { Player } from '../world/entity/mob/player/player'; +import { Player } from '@server/world/mob/player/player'; +import { world } from '@server/game-server'; import { RsBuffer } from './rs-buffer'; import { ClientHandshakeParser } from './data-parser/client-handshake-parser'; import { ClientLoginParser } from './data-parser/client-login-parser'; import { ClientPacketDataParser } from './data-parser/client-packet-data-parser'; -import { world } from '../game-server'; import { DataParser } from './data-parser/data-parser'; enum ConnectionStage { diff --git a/src/net/data-parser/client-handshake-parser.ts b/src/net/data-parser/client-handshake-parser.ts index 696d15860..cc6ee11fd 100644 --- a/src/net/data-parser/client-handshake-parser.ts +++ b/src/net/data-parser/client-handshake-parser.ts @@ -1,4 +1,4 @@ -import { RsBuffer } from '../rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { DataParser } from './data-parser'; /** diff --git a/src/net/data-parser/client-login-parser.ts b/src/net/data-parser/client-login-parser.ts index abf405b8c..7965384a7 100644 --- a/src/net/data-parser/client-login-parser.ts +++ b/src/net/data-parser/client-login-parser.ts @@ -1,8 +1,8 @@ -import { RsBuffer } from '../rs-buffer'; -import { Player } from '../../world/entity/mob/player/player'; import BigInteger from 'bigi'; -import { Isaac } from '../isaac'; -import { world } from '../../game-server'; +import { RsBuffer } from '@server/net/rs-buffer'; +import { Player } from '@server/world/mob/player/player'; +import { Isaac } from '@server/net/isaac'; +import { world } from '@server/game-server'; import { DataParser } from './data-parser'; const rsaModulus = BigInteger('119568088839203297999728368933573315070738693395974011872885408638642676871679245723887367232256427712869170521351089799352546294030059890127723509653145359924771433131004387212857375068629466435244653901851504845054452735390701003613803443469723435116497545687393297329052988014281948392136928774011011998343'); diff --git a/src/net/data-parser/client-packet-data-parser.ts b/src/net/data-parser/client-packet-data-parser.ts index fd80a3165..e3d9afe6a 100644 --- a/src/net/data-parser/client-packet-data-parser.ts +++ b/src/net/data-parser/client-packet-data-parser.ts @@ -1,7 +1,7 @@ -import { RsBuffer } from '../rs-buffer'; -import { incomingPacketSizes } from '../incoming-packet-sizes'; +import { RsBuffer } from '@server/net/rs-buffer'; +import { incomingPacketSizes } from '@server/net/incoming-packet-sizes'; +import { handlePacket } from '@server/world/mob/player/packet/incoming-packet-directory'; import { DataParser } from './data-parser'; -import { handlePacket } from '../../world/entity/mob/player/packet/incoming-packet-directory'; /** * Parses incoming packet data from the game client once the user is fully authenticated. diff --git a/src/net/data-parser/data-parser.ts b/src/net/data-parser/data-parser.ts index f8e7a03b4..d0a1dda66 100644 --- a/src/net/data-parser/data-parser.ts +++ b/src/net/data-parser/data-parser.ts @@ -1,5 +1,5 @@ -import { ClientConnection } from '../client-connection'; -import { RsBuffer } from '../rs-buffer'; +import { ClientConnection } from '@server/net/client-connection'; +import { RsBuffer } from '@server/net/rs-buffer'; export abstract class DataParser { diff --git a/src/web-server.ts b/src/web-server.ts index 5fe09f5a2..e77501da0 100644 --- a/src/web-server.ts +++ b/src/web-server.ts @@ -1,6 +1,6 @@ import express, { Request } from 'express'; import { gameCache, world } from './game-server'; -import { Player } from './world/entity/mob/player/player'; +import { Player } from './world/mob/player/player'; import { constants } from 'http2'; import { logger } from '@runejs/logger'; import { ItemData, ItemDetails, saveItemData } from './world/config/item-data'; diff --git a/src/world/config/item-data.ts b/src/world/config/item-data.ts index 8fee46f42..1b10dbf21 100644 --- a/src/world/config/item-data.ts +++ b/src/world/config/item-data.ts @@ -2,7 +2,7 @@ import { readFileSync, writeFileSync } from 'fs'; import { ItemDefinition } from '@runejs/cache-parser'; import { logger } from '@runejs/logger/dist/logger'; import { join } from 'path'; -import { serverDir } from '../../game-server'; +import { serverDir } from '@server/game-server'; import { JSON_SCHEMA, safeLoad, safeDump } from 'js-yaml'; export enum EquipmentSlot { diff --git a/src/world/config/npc-spawn.ts b/src/world/config/npc-spawn.ts index 049a854f7..73aca678f 100644 --- a/src/world/config/npc-spawn.ts +++ b/src/world/config/npc-spawn.ts @@ -1,9 +1,9 @@ import { logger } from '@runejs/logger/dist/logger'; import { JSON_SCHEMA, safeLoad } from 'js-yaml'; -import { readFileSync } from "fs"; -import { join } from "path"; -import { serverDir } from '../../game-server'; -import { Direction } from '../world'; +import { readFileSync } from 'fs'; +import { join } from 'path'; +import { serverDir } from '@server/game-server'; +import { Direction } from '@server/world/world'; export interface NpcSpawn { npcId: number; diff --git a/src/world/entity/entity.ts b/src/world/entity.ts similarity index 93% rename from src/world/entity/entity.ts rename to src/world/entity.ts index 5a40c9939..4d15ece26 100644 --- a/src/world/entity/entity.ts +++ b/src/world/entity.ts @@ -1,4 +1,4 @@ -import { Position } from '../position'; +import { Position } from './position'; export abstract class Entity { diff --git a/src/world/entity/mob/items/item-container.ts b/src/world/items/item-container.ts similarity index 98% rename from src/world/entity/mob/items/item-container.ts rename to src/world/items/item-container.ts index 05f80a0e4..11277f742 100644 --- a/src/world/entity/mob/items/item-container.ts +++ b/src/world/items/item-container.ts @@ -1,6 +1,6 @@ import { Item } from './item'; import { Subject } from 'rxjs'; -import { world } from '../../../../game-server'; +import { world } from '@server/game-server'; export interface ContainerUpdateEvent { slot?: number; diff --git a/src/world/entity/mob/items/item.ts b/src/world/items/item.ts similarity index 100% rename from src/world/entity/mob/items/item.ts rename to src/world/items/item.ts diff --git a/src/world/map/chunk.ts b/src/world/map/chunk.ts index 44605c4a6..bc5e7eb19 100644 --- a/src/world/map/chunk.ts +++ b/src/world/map/chunk.ts @@ -1,9 +1,9 @@ import { Position } from '../position'; -import { Player } from '../entity/mob/player/player'; +import { Player } from '../mob/player/player'; import { CollisionMap } from './collision-map'; import { gameCache } from '../../game-server'; import { LandscapeObject, LandscapeObjectDefinition, MapRegionTile } from '@runejs/cache-parser'; -import { Npc } from '../entity/mob/npc/npc'; +import { Npc } from '../mob/npc/npc'; /** * A single map chunk within the game world that keeps track of the entities within it. diff --git a/src/world/entity/mob/mob.ts b/src/world/mob/mob.ts similarity index 98% rename from src/world/entity/mob/mob.ts rename to src/world/mob/mob.ts index 99aeffbdc..b94e575c0 100644 --- a/src/world/entity/mob/mob.ts +++ b/src/world/mob/mob.ts @@ -1,8 +1,8 @@ -import { Entity } from '../entity'; import { WalkingQueue } from './walking-queue'; -import { ItemContainer } from './items/item-container'; +import { ItemContainer } from '../items/item-container'; import { UpdateFlags } from './update-flags'; import { Npc } from './npc/npc'; +import { Entity } from '../entity'; /** * Handles a mobile entity within the game world. diff --git a/src/world/entity/mob/npc/npc.ts b/src/world/mob/npc/npc.ts similarity index 90% rename from src/world/entity/mob/npc/npc.ts rename to src/world/mob/npc/npc.ts index 8540f6946..a99dd3c1e 100644 --- a/src/world/entity/mob/npc/npc.ts +++ b/src/world/mob/npc/npc.ts @@ -1,10 +1,10 @@ -import { Mob } from '../mob'; -import { NpcSpawn } from '../../../config/npc-spawn'; +import { Mob } from '@server/world/mob/mob'; +import { NpcSpawn } from '@server/world/config/npc-spawn'; import { NpcDefinition } from '@runejs/cache-parser'; import uuidv4 from 'uuid/v4'; -import { Position } from '../../../position'; -import { Direction } from '../../../world'; -import { world } from '../../../../game-server'; +import { Position } from '@server/world/position'; +import { Direction } from '@server/world/world'; +import { world } from '@server/game-server'; interface NpcAnimations { walk: number; diff --git a/src/world/entity/mob/player/action/equip-item-action.ts b/src/world/mob/player/action/equip-item-action.ts similarity index 94% rename from src/world/entity/mob/player/action/equip-item-action.ts rename to src/world/mob/player/action/equip-item-action.ts index f727ef830..27db9dfb7 100644 --- a/src/world/entity/mob/player/action/equip-item-action.ts +++ b/src/world/mob/player/action/equip-item-action.ts @@ -1,10 +1,10 @@ import { Player } from '../player'; -import { world } from '../../../../../game-server'; +import { world } from '@server/game-server'; import { logger } from '@runejs/logger/dist/logger'; -import { EquipmentSlot, equipmentSlotIndex, ItemDetails, WeaponType } from '../../../../config/item-data'; -import { Item } from '../../items/item'; +import { EquipmentSlot, equipmentSlotIndex, ItemDetails, WeaponType } from '@server/world/config/item-data'; +import { Item } from '@server/world/items/item'; import { interfaceIds } from '../game-interface'; -import { ItemContainer } from '../../items/item-container'; +import { ItemContainer } from '@server/world/items/item-container'; export const equipItemAction = (player: Player, itemId: number, inventorySlot: number) => { const itemToEquipData = world.itemData.get(itemId); diff --git a/src/world/entity/mob/player/action/input-command-action.ts b/src/world/mob/player/action/input-command-action.ts similarity index 96% rename from src/world/entity/mob/player/action/input-command-action.ts rename to src/world/mob/player/action/input-command-action.ts index e61d2e66a..f71f03880 100644 --- a/src/world/entity/mob/player/action/input-command-action.ts +++ b/src/world/mob/player/action/input-command-action.ts @@ -1,7 +1,6 @@ import { Player } from '../player'; import { logger } from '@runejs/logger/dist/logger'; -import { world } from '../../../../../game-server'; -import { throws } from 'assert'; +import { world } from '@server/game-server'; import { interfaceIds } from '../game-interface'; type commandHandler = (player: Player, args?: string[]) => void; diff --git a/src/world/entity/mob/player/action/swap-item-action.ts b/src/world/mob/player/action/swap-item-action.ts similarity index 100% rename from src/world/entity/mob/player/action/swap-item-action.ts rename to src/world/mob/player/action/swap-item-action.ts diff --git a/src/world/entity/mob/player/action/unequip-item-action.ts b/src/world/mob/player/action/unequip-item-action.ts similarity index 95% rename from src/world/entity/mob/player/action/unequip-item-action.ts rename to src/world/mob/player/action/unequip-item-action.ts index 0ebfd0227..13a1a918a 100644 --- a/src/world/entity/mob/player/action/unequip-item-action.ts +++ b/src/world/mob/player/action/unequip-item-action.ts @@ -1,5 +1,5 @@ import { Player } from '../player'; -import { Item } from '../../items/item'; +import { Item } from '@server/world/items/item'; import { interfaceIds } from '../game-interface'; export const unequipItemAction = (player: Player, itemId: number, equipmentSlot: number) => { diff --git a/src/world/entity/mob/player/game-interface.ts b/src/world/mob/player/game-interface.ts similarity index 100% rename from src/world/entity/mob/player/game-interface.ts rename to src/world/mob/player/game-interface.ts diff --git a/src/world/entity/mob/player/packet/impl/button-click-packet.ts b/src/world/mob/player/packet/impl/button-click-packet.ts similarity index 94% rename from src/world/entity/mob/player/packet/impl/button-click-packet.ts rename to src/world/mob/player/packet/impl/button-click-packet.ts index fd1325d1e..9eb72a9fe 100644 --- a/src/world/entity/mob/player/packet/impl/button-click-packet.ts +++ b/src/world/mob/player/packet/impl/button-click-packet.ts @@ -1,6 +1,6 @@ import { incomingPacket } from '../incoming-packet'; import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; const ignoreButtons: number[] = [ 3651 // character design accept button diff --git a/src/world/entity/mob/player/packet/impl/camera-turn-packet.ts b/src/world/mob/player/packet/impl/camera-turn-packet.ts similarity index 80% rename from src/world/entity/mob/player/packet/impl/camera-turn-packet.ts rename to src/world/mob/player/packet/impl/camera-turn-packet.ts index bbb64444f..de8d8c532 100644 --- a/src/world/entity/mob/player/packet/impl/camera-turn-packet.ts +++ b/src/world/mob/player/packet/impl/camera-turn-packet.ts @@ -1,6 +1,6 @@ import { incomingPacket } from '../incoming-packet'; import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; export const cameraTurnPacket: incomingPacket = (player: Player, packetId: number, packetSize: number, packet: RsBuffer): void => { // Do nothing diff --git a/src/world/entity/mob/player/packet/impl/character-design-packet.ts b/src/world/mob/player/packet/impl/character-design-packet.ts similarity index 95% rename from src/world/entity/mob/player/packet/impl/character-design-packet.ts rename to src/world/mob/player/packet/impl/character-design-packet.ts index 89a69c674..02da2a25d 100644 --- a/src/world/entity/mob/player/packet/impl/character-design-packet.ts +++ b/src/world/mob/player/packet/impl/character-design-packet.ts @@ -1,6 +1,6 @@ import { incomingPacket } from '../incoming-packet'; import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { interfaceIds } from '../../game-interface'; export const characterDesignPacket: incomingPacket = (player: Player, packetId: number, packetSize: number, packet: RsBuffer): void => { diff --git a/src/world/entity/mob/player/packet/impl/command-packet.ts b/src/world/mob/player/packet/impl/command-packet.ts similarity index 90% rename from src/world/entity/mob/player/packet/impl/command-packet.ts rename to src/world/mob/player/packet/impl/command-packet.ts index a7cef52d6..6e9769e32 100644 --- a/src/world/entity/mob/player/packet/impl/command-packet.ts +++ b/src/world/mob/player/packet/impl/command-packet.ts @@ -1,6 +1,6 @@ import { incomingPacket } from '../incoming-packet'; import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { inputCommandAction } from '../../action/input-command-action'; export const commandPacket: incomingPacket = (player: Player, packetId: number, packetSize: number, packet: RsBuffer): void => { diff --git a/src/world/entity/mob/player/packet/impl/interface-click-packet.ts b/src/world/mob/player/packet/impl/interface-click-packet.ts similarity index 80% rename from src/world/entity/mob/player/packet/impl/interface-click-packet.ts rename to src/world/mob/player/packet/impl/interface-click-packet.ts index db0faae5b..39d98dc39 100644 --- a/src/world/entity/mob/player/packet/impl/interface-click-packet.ts +++ b/src/world/mob/player/packet/impl/interface-click-packet.ts @@ -1,6 +1,6 @@ import { incomingPacket } from '../incoming-packet'; import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; export const interfaceClickPacket: incomingPacket = (player: Player, packetId: number, packetSize: number, packet: RsBuffer): void => { // Do nothing diff --git a/src/world/entity/mob/player/packet/impl/item-equip-packet.ts b/src/world/mob/player/packet/impl/item-equip-packet.ts similarity index 95% rename from src/world/entity/mob/player/packet/impl/item-equip-packet.ts rename to src/world/mob/player/packet/impl/item-equip-packet.ts index 151ccf84c..678380bac 100644 --- a/src/world/entity/mob/player/packet/impl/item-equip-packet.ts +++ b/src/world/mob/player/packet/impl/item-equip-packet.ts @@ -1,6 +1,6 @@ import { incomingPacket } from '../incoming-packet'; import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { logger } from '@runejs/logger/dist/logger'; import { interfaceIds } from '../../game-interface'; import { equipItemAction } from '../../action/equip-item-action'; diff --git a/src/world/entity/mob/player/packet/impl/item-option-1-packet.ts b/src/world/mob/player/packet/impl/item-option-1-packet.ts similarity index 92% rename from src/world/entity/mob/player/packet/impl/item-option-1-packet.ts rename to src/world/mob/player/packet/impl/item-option-1-packet.ts index 9e4608f87..d173a293f 100644 --- a/src/world/entity/mob/player/packet/impl/item-option-1-packet.ts +++ b/src/world/mob/player/packet/impl/item-option-1-packet.ts @@ -1,10 +1,10 @@ import { incomingPacket } from '../incoming-packet'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { Player } from '../../player'; import { interfaceIds } from '../../game-interface'; import { logger } from '@runejs/logger/dist/logger'; import { unequipItemAction } from '../../action/unequip-item-action'; -import { ItemContainer } from '../../../items/item-container'; +import { ItemContainer } from '@server/world/items/item-container'; export const itemOption1Packet: incomingPacket = (player: Player, packetId: number, packetSize: number, packet: RsBuffer): void => { const itemId = packet.readNegativeOffsetShortBE(); diff --git a/src/world/entity/mob/player/packet/impl/item-swap-packet.ts b/src/world/mob/player/packet/impl/item-swap-packet.ts similarity index 92% rename from src/world/entity/mob/player/packet/impl/item-swap-packet.ts rename to src/world/mob/player/packet/impl/item-swap-packet.ts index 4c56381ba..a77574503 100644 --- a/src/world/entity/mob/player/packet/impl/item-swap-packet.ts +++ b/src/world/mob/player/packet/impl/item-swap-packet.ts @@ -1,6 +1,6 @@ import { incomingPacket } from '../incoming-packet'; import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { swapItemAction } from '../../action/swap-item-action'; export const itemSwapPacket: incomingPacket = (player: Player, packetId: number, packetSize: number, packet: RsBuffer): void => { diff --git a/src/world/entity/mob/player/packet/impl/walk-packet.ts b/src/world/mob/player/packet/impl/walk-packet.ts similarity index 93% rename from src/world/entity/mob/player/packet/impl/walk-packet.ts rename to src/world/mob/player/packet/impl/walk-packet.ts index 28fda2e9f..91fca1089 100644 --- a/src/world/entity/mob/player/packet/impl/walk-packet.ts +++ b/src/world/mob/player/packet/impl/walk-packet.ts @@ -1,5 +1,5 @@ import { Player } from '../../player'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { incomingPacket } from '../incoming-packet'; export const walkPacket: incomingPacket = (player: Player, packetId: number, packetSize: number, packet: RsBuffer): void => { diff --git a/src/world/entity/mob/player/packet/incoming-packet-directory.ts b/src/world/mob/player/packet/incoming-packet-directory.ts similarity index 96% rename from src/world/entity/mob/player/packet/incoming-packet-directory.ts rename to src/world/mob/player/packet/incoming-packet-directory.ts index d44c638d8..3ec14ffbe 100644 --- a/src/world/entity/mob/player/packet/incoming-packet-directory.ts +++ b/src/world/mob/player/packet/incoming-packet-directory.ts @@ -1,5 +1,5 @@ import { Player } from '../player'; -import { RsBuffer } from '../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { logger } from '@runejs/logger'; import { incomingPacket } from './incoming-packet'; diff --git a/src/world/entity/mob/player/packet/incoming-packet.ts b/src/world/mob/player/packet/incoming-packet.ts similarity index 72% rename from src/world/entity/mob/player/packet/incoming-packet.ts rename to src/world/mob/player/packet/incoming-packet.ts index bbdeaa8e8..e5d272397 100644 --- a/src/world/entity/mob/player/packet/incoming-packet.ts +++ b/src/world/mob/player/packet/incoming-packet.ts @@ -1,4 +1,4 @@ -import { RsBuffer } from '../../../../../net/rs-buffer'; +import { RsBuffer } from '@server/net/rs-buffer'; import { Player } from '../player'; export type incomingPacket = (player: Player, packetId: number, packetSize: number, buffer: RsBuffer) => void; diff --git a/src/world/entity/mob/player/packet/packet-sender.ts b/src/world/mob/player/packet/packet-sender.ts similarity index 96% rename from src/world/entity/mob/player/packet/packet-sender.ts rename to src/world/mob/player/packet/packet-sender.ts index 918b94c59..2739a2f6e 100644 --- a/src/world/entity/mob/player/packet/packet-sender.ts +++ b/src/world/mob/player/packet/packet-sender.ts @@ -1,9 +1,9 @@ import { Player } from '../player'; import { Socket } from 'net'; -import { Packet, PacketType } from '../../../../../net/packet'; -import { ItemContainer } from '../../items/item-container'; -import { Item } from '../../items/item'; -import { Position } from '../../../../position'; +import { Packet, PacketType } from '@server/net/packet'; +import { ItemContainer } from '@server/world/items/item-container'; +import { Item } from '@server/world/items/item'; +import { Position } from '@server/world/position'; /** * 6 = set chatbox input type to 2 diff --git a/src/world/entity/mob/player/player-data.ts b/src/world/mob/player/player-data.ts similarity index 96% rename from src/world/entity/mob/player/player-data.ts rename to src/world/mob/player/player-data.ts index 932852668..881856732 100644 --- a/src/world/entity/mob/player/player-data.ts +++ b/src/world/mob/player/player-data.ts @@ -1,9 +1,9 @@ -import { Item } from '../items/item'; +import { Item } from '@server/world/items/item'; +import { serverDir } from '@server/game-server'; import { writeFileSync, readFileSync, existsSync } from 'fs'; import { join } from 'path'; import { logger } from '@runejs/logger/dist/logger'; import { Player } from './player'; -import { serverDir } from '../../../../game-server'; export interface Appearance { gender: number; diff --git a/src/world/entity/mob/player/player.ts b/src/world/mob/player/player.ts similarity index 97% rename from src/world/entity/mob/player/player.ts rename to src/world/mob/player/player.ts index 880649faa..9feec9b8c 100644 --- a/src/world/entity/mob/player/player.ts +++ b/src/world/mob/player/player.ts @@ -1,11 +1,11 @@ import { Socket } from 'net'; import { PacketSender } from './packet/packet-sender'; -import { Isaac } from '../../../../net/isaac'; +import { Isaac } from '@server/net/isaac'; import { PlayerUpdateTask } from './task/updating/player-update-task'; import { Mob } from '../mob'; -import { Position } from '../../../position'; +import { Position } from '@server/world/position'; import { Skill, skills } from '../skills/skill'; -import { world } from '../../../../game-server'; +import { world } from '@server/game-server'; import { logger } from '@runejs/logger'; import { Appearance, @@ -15,9 +15,9 @@ import { savePlayerData } from './player-data'; import { ActiveInterface, interfaceIds, interfaceSettings } from './game-interface'; -import { ContainerUpdateEvent, ItemContainer } from '../items/item-container'; -import { EquipmentBonuses, ItemDetails } from '../../../config/item-data'; -import { Item } from '../items/item'; +import { ContainerUpdateEvent, ItemContainer } from '../../items/item-container'; +import { EquipmentBonuses, ItemDetails } from '../../config/item-data'; +import { Item } from '../../items/item'; import { Npc } from '../npc/npc'; import { NpcUpdateTask } from './task/updating/npc-update-task'; diff --git a/src/world/entity/mob/player/task/updating/mob-updating.ts b/src/world/mob/player/task/updating/mob-updating.ts similarity index 93% rename from src/world/entity/mob/player/task/updating/mob-updating.ts rename to src/world/mob/player/task/updating/mob-updating.ts index 504b87c31..d958a05ea 100644 --- a/src/world/entity/mob/player/task/updating/mob-updating.ts +++ b/src/world/mob/player/task/updating/mob-updating.ts @@ -1,10 +1,10 @@ -import { RsBuffer } from '../../../../../../net/rs-buffer'; -import { Mob } from '../../../mob'; -import { world } from '../../../../../../game-server'; -import { Packet } from '../../../../../../net/packet'; -import { Npc } from '../../../npc/npc'; +import { RsBuffer } from '@server/net/rs-buffer'; +import { Mob } from '@server/world/mob/mob'; +import { world } from '@server/game-server'; +import { Packet } from '@server/net/packet'; +import { Npc } from '@server/world/mob/npc/npc'; import { Player } from '../../player'; -import { Position } from '../../../../../position'; +import { Position } from '@server/world/position'; /** * Handles the registration of nearby NPCs or Players for the specified player. diff --git a/src/world/entity/mob/player/task/updating/npc-update-task.ts b/src/world/mob/player/task/updating/npc-update-task.ts similarity index 91% rename from src/world/entity/mob/player/task/updating/npc-update-task.ts rename to src/world/mob/player/task/updating/npc-update-task.ts index f6950a800..0c15e1e05 100644 --- a/src/world/entity/mob/player/task/updating/npc-update-task.ts +++ b/src/world/mob/player/task/updating/npc-update-task.ts @@ -1,9 +1,9 @@ -import { Task } from '../../../../../../task/task'; +import { Task } from '@server/task/task'; import { Player } from '../../player'; -import { Packet, PacketType } from '../../../../../../net/packet'; -import { RsBuffer } from '../../../../../../net/rs-buffer'; -import { Npc } from '../../../npc/npc'; -import { world } from '../../../../../../game-server'; +import { Packet, PacketType } from '@server/net/packet'; +import { RsBuffer } from '@server/net/rs-buffer'; +import { Npc } from '@server/world/mob/npc/npc'; +import { world } from '@server/game-server'; import { registerNewMobs, updateTrackedMobs } from './mob-updating'; /** diff --git a/src/world/entity/mob/player/task/updating/player-update-task.ts b/src/world/mob/player/task/updating/player-update-task.ts similarity index 95% rename from src/world/entity/mob/player/task/updating/player-update-task.ts rename to src/world/mob/player/task/updating/player-update-task.ts index fbe126baf..e50132ef0 100644 --- a/src/world/entity/mob/player/task/updating/player-update-task.ts +++ b/src/world/mob/player/task/updating/player-update-task.ts @@ -1,11 +1,11 @@ import { Player } from '../../player'; -import { RsBuffer, stringToLong } from '../../../../../../net/rs-buffer'; -import { Task } from '../../../../../../task/task'; -import { UpdateFlags } from '../../../update-flags'; -import { Packet, PacketType } from '../../../../../../net/packet'; -import { world } from '../../../../../../game-server'; -import { EquipmentSlot, HelmetType, ItemDetails, TorsoType } from '../../../../../config/item-data'; -import { ItemContainer } from '../../../items/item-container'; +import { RsBuffer, stringToLong } from '@server/net/rs-buffer'; +import { Task } from '@server/task/task'; +import { UpdateFlags } from '@server/world/mob/update-flags'; +import { Packet, PacketType } from '@server/net/packet'; +import { world } from '@server/game-server'; +import { EquipmentSlot, HelmetType, ItemDetails, TorsoType } from '@server/world/config/item-data'; +import { ItemContainer } from '@server/world/items/item-container'; import { appendMovement, updateTrackedMobs, registerNewMobs } from './mob-updating'; /** diff --git a/src/world/entity/mob/skills/skill.ts b/src/world/mob/skills/skill.ts similarity index 100% rename from src/world/entity/mob/skills/skill.ts rename to src/world/mob/skills/skill.ts diff --git a/src/world/entity/mob/update-flags.ts b/src/world/mob/update-flags.ts similarity index 96% rename from src/world/entity/mob/update-flags.ts rename to src/world/mob/update-flags.ts index dbee3297a..3707e2964 100644 --- a/src/world/entity/mob/update-flags.ts +++ b/src/world/mob/update-flags.ts @@ -1,4 +1,4 @@ -import { Position } from '../../position'; +import { Position } from '../position'; /** * Various player updating flags. diff --git a/src/world/entity/mob/walking-queue.ts b/src/world/mob/walking-queue.ts similarity index 98% rename from src/world/entity/mob/walking-queue.ts rename to src/world/mob/walking-queue.ts index 07f45b21c..efb6159f5 100644 --- a/src/world/entity/mob/walking-queue.ts +++ b/src/world/mob/walking-queue.ts @@ -1,9 +1,8 @@ import { Mob } from './mob'; -import { Position } from '../../position'; +import { Position } from '../position'; import { Player } from './player/player'; -import { world } from '../../../game-server'; -import { Chunk } from '../../map/chunk'; -import { logger } from '@runejs/logger'; +import { world } from '@server/game-server'; +import { Chunk } from '../map/chunk'; import { MapRegionTile } from '@runejs/cache-parser'; import { Npc } from './npc/npc'; diff --git a/src/world/world.ts b/src/world/world.ts index f431ae918..ed9480fb5 100644 --- a/src/world/world.ts +++ b/src/world/world.ts @@ -1,12 +1,12 @@ -import { Player } from './entity/mob/player/player'; +import { Player } from './mob/player/player'; import { ChunkManager } from './map/chunk-manager'; import { logger } from '@runejs/logger'; import { ItemDetails, parseItemData } from './config/item-data'; -import { gameCache, world } from '../game-server'; +import { gameCache, world } from '@server/game-server'; import { Position } from './position'; import yargs from 'yargs'; import { NpcSpawn, parseNpcSpawns } from './config/npc-spawn'; -import { Npc } from './entity/mob/npc/npc'; +import { Npc } from './mob/npc/npc'; /** * A direction within the world. diff --git a/tsconfig.json b/tsconfig.json index 083220ad7..1792f02d0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,9 @@ "sourceMap": true, "baseUrl": ".", "allowJs": true, + "paths": { + "@server/*": ["src/*"] + }, "types": [ "webpack-env", "node"