Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Trading #345

Draft
wants to merge 222 commits into
base: feature/player-trading
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
3383baf
Started work on trading.
nicknick-io Aug 25, 2021
5a0f6e6
Work in progress
nicknick-io Aug 26, 2021
629d055
trading stuff
Promises Aug 28, 2021
54c25f6
Merge pull request #1 from Promises/feature/trading
nicknick-io Aug 28, 2021
4014a05
We are now able to add and remove stuff from the trading window..
nicknick-io Aug 28, 2021
a23908b
Added close handling.
nicknick-io Aug 28, 2021
9a1a408
Item are now removed from a specific slot in both inventory and the a…
nicknick-io Aug 28, 2021
dcf93fc
Working on engine import/pkg improvements to make content dev simpler
Tynarus Sep 28, 2021
eef4e7d
Improving engine/config package/import structure with an index.ts entry
Tynarus Sep 29, 2021
a9e04b7
Improving engine/net package/import structure with an index.ts entry
Tynarus Sep 29, 2021
2fbab21
engine/util's turn for an index.ts file
Tynarus Sep 29, 2021
0ec1dd4
Adding more index file entries and cleaning up world.ts imports
Tynarus Sep 29, 2021
00075f7
Adding world/config/index.ts and fixing more imports in world.ts
Tynarus Sep 29, 2021
8c47db5
Lint fix
Tynarus Sep 29, 2021
6f60019
Merge github.com:runejs/server into feature/trading
nicknick-io Sep 29, 2021
0a6850f
Updated workflow file to include feature branches
SchauweM Sep 30, 2021
73df33f
Merge pull request #347 from runejs/workflow-patch-1
SchauweM Sep 30, 2021
baf1497
Merge remote-tracking branch 'origin/develop' into feature/engine-pac…
Tynarus Oct 1, 2021
691c9da
Merge pull request #349 from runejs/feature/engine-package-cleanup
Tynarus Oct 1, 2021
5f8d17b
Moving skill guide content into /plugins
Tynarus Oct 1, 2021
9a11682
Removing all references to @plugins/ from within the game engine.
Tynarus Oct 1, 2021
4b7ff15
Cleaning up Npc.ts imports
Tynarus Oct 1, 2021
1358c95
Cleaning up player.ts imports
Tynarus Oct 1, 2021
163f7da
Fixing circular dependency issues with Actor, cleaning up more imports
Tynarus Oct 1, 2021
aae3ce5
Merge branch 'develop' into feature/engine-package-cleanup
Tynarus Oct 1, 2021
18ed237
Converting packets to TypeScript and fixing issues with several
Tynarus Oct 1, 2021
d8ba12c
Merge remote-tracking branch 'origin/feature/engine-package-cleanup' …
Tynarus Oct 1, 2021
7fe08ca
Merge pull request #350 from runejs/feature/engine-package-cleanup
Tynarus Oct 2, 2021
8b8243e
Splitting server-specific code out into a new @server submodule
Tynarus Oct 2, 2021
31f80e1
Fixing various lint issues
Tynarus Oct 3, 2021
f0c9314
Changing the active `world` to be named `activeWorld` for clarity
Tynarus Oct 3, 2021
b5bd5da
Renaming game world activation function
Tynarus Oct 3, 2021
0441c82
Merge pull request #351 from runejs/feature/server-module
Tynarus Oct 3, 2021
1993108
Moving `engine/world/action` to `engine/action`, as the action pipeli…
Tynarus Oct 3, 2021
9b69c26
Merge branch 'develop' into feature/server-module
Tynarus Oct 3, 2021
9cc1ef7
Moving action pipe files into a new /pipe/ directory for organization
Tynarus Oct 3, 2021
e5afa17
Cleaning up all imports that references action pipe files directly
Tynarus Oct 3, 2021
3682726
Fixing various bugs in different plugins that had developed over time
Tynarus Oct 3, 2021
46a8173
Fixing linter issue
Tynarus Oct 5, 2021
be8a77f
Merge pull request #352 from runejs/feature/server-module
Tynarus Oct 5, 2021
305843b
Banking fixes
RedSparr0w Oct 6, 2021
73cf9ad
fixup?
RedSparr0w Oct 6, 2021
32ee448
Add rune armor items
RedSparr0w Oct 6, 2021
4115df0
Check if player has requirements to equip items
RedSparr0w Oct 6, 2021
10e1e47
Apply suggestions from code review
RedSparr0w Oct 6, 2021
074374a
Merge pull request #354 from RedSparr0w/banking-fixes
SchauweM Oct 6, 2021
2a4eaed
Make gloves non-tradable
RedSparr0w Oct 6, 2021
9308997
Merge branch 'develop' into items
SchauweM Oct 6, 2021
3c89592
Merge branch 'develop' into item-requirements
SchauweM Oct 6, 2021
c04c935
Merge pull request #355 from RedSparr0w/items
SchauweM Oct 6, 2021
9e7c4fe
Merge branch 'develop' into item-requirements
SchauweM Oct 6, 2021
6335a09
Merge pull request #356 from RedSparr0w/item-requirements
SchauweM Oct 6, 2021
a1d39b9
Add function to player, hasQuestRequirement, which will check if the …
Promises Oct 6, 2021
642d92f
indent error
Promises Oct 6, 2021
88902c1
add prefix to goblin_diplomacy
Promises Oct 7, 2021
bd197dc
Update src/engine/world/actor/player/player.ts
Promises Oct 9, 2021
3a9c224
some code cleanup
Promises Oct 9, 2021
46467f3
some code cleanup
Promises Oct 9, 2021
e0266c3
linting
Promises Oct 9, 2021
bb4f096
Merge pull request #357 from runejs/feature/quest-requirements
Promises Oct 14, 2021
3788683
Commenting out XTEA key sending since maps are not encrypted in the f…
Katilith Nov 23, 2021
5d48d09
Fixin' item on item interactions and adding a variable to disable xtea
Katilith Nov 26, 2021
2cdce42
Merge branch 'develop' into develop
Katilith Nov 26, 2021
7951943
Removing test code
Katilith Nov 26, 2021
6293d3a
Merge remote-tracking branch 'kiko/develop' into develop
Katilith Nov 26, 2021
4f7fc38
Merge pull request #360 from Kikorono/develop
SchauweM Nov 26, 2021
64a8513
Add a new function to deepmerge objects (this should be checked by so…
Promises Dec 27, 2021
fc31042
fix some missing semis
Promises Dec 27, 2021
4c452a3
alpha.2 to update all RuneJS packages and game engine to Node v16
Katilith Mar 1, 2022
ef5c0a3
Bump minimist from 1.2.5 to 1.2.6
dependabot[bot] Mar 25, 2022
2af6af1
Merge pull request #364 from runejs/dependabot/npm_and_yarn/minimist-…
SchauweM Mar 28, 2022
18036c0
Working on a new dialogue system
Katilith Mar 29, 2022
b77e081
Merge remote-tracking branch 'origin/develop' into develop
Katilith Jun 5, 2022
0d55a20
set up Jest
Jameskmonger Jul 10, 2022
297ff3a
add testing docs to CONTRIBUTING
Jameskmonger Jul 10, 2022
840e07b
add test for advancedNumberHookFilter
Jameskmonger Jul 10, 2022
1c5a35d
ignore coverage directory
Jameskmonger Jul 10, 2022
daa4d5f
add coverage docs
Jameskmonger Jul 10, 2022
3145612
fix package.json spacing
Jameskmonger Jul 10, 2022
44adf46
set up shared vs code config
Jameskmonger Jul 10, 2022
8af36e0
Fixing the reload content functionality
Katilith Jul 17, 2022
92037a9
Removing new dialogue system test file
Katilith Jul 17, 2022
9c32a8f
Merge pull request #368 from runejs/kiko/reload-content-fix
Katilith Jul 17, 2022
2779f32
Merge github.com:runejs/server into feature/trading
nicknick-io Jul 19, 2022
6499be4
Merge branch 'develop' into jest-tests
Katilith Jul 27, 2022
d713ffc
Merge pull request #366 from Jameskmonger/jest-tests
Katilith Jul 27, 2022
366d778
Merge branch 'develop' into vscode-settings
Katilith Jul 27, 2022
09cd289
Merge pull request #367 from Jameskmonger/vscode-settings
Katilith Jul 27, 2022
80cb83c
fix: update player and npc damage correctly
Jameskmonger Aug 15, 2022
994c442
Merge pull request #369 from Jameskmonger/fix-damage-update
Katilith Aug 18, 2022
daf296f
feat: add Queue<T>
Jameskmonger Sep 3, 2022
6d46ff1
Merge pull request #370 from Jameskmonger/queue-t
Katilith Sep 4, 2022
9c7f8bb
chore: set jest to only run `**/*.test.ts` files
Jameskmonger Sep 5, 2022
bf4b8a3
feat: register `item_on_ground_item` packet
Jameskmonger Sep 4, 2022
eb6dead
refactor: 'ground item' -> 'world item'
Jameskmonger Sep 5, 2022
a3071d3
fix: use `skills.getLevel` on player init so that modified levels are…
Jameskmonger Sep 6, 2022
b507415
Merge pull request #371 from Jameskmonger/item-on-ground-item
SchauweM Sep 7, 2022
b7b0ee9
Merge branch 'develop' into fix-jest-matcher
SchauweM Sep 7, 2022
8c48892
Merge pull request #372 from Jameskmonger/fix-jest-matcher
SchauweM Sep 7, 2022
2949bcb
Merge branch 'develop' into fix-setting-level
SchauweM Sep 7, 2022
0a72572
Merge pull request #373 from Jameskmonger/fix-setting-level
SchauweM Sep 7, 2022
a8301d5
build: add `typecheck` script to `package.json`
Jameskmonger Sep 7, 2022
2f30be1
Merge pull request #374 from Jameskmonger/typecheck
Katilith Sep 7, 2022
781d648
refactor: create strongly type `metadata` property on `Actor` and `Pl…
Jameskmonger Sep 7, 2022
b736979
refactor: add types for position-related metadata
Jameskmonger Sep 7, 2022
eeb486d
refactor: add type for client config (varp) in metadata
Jameskmonger Sep 7, 2022
99eb1b2
refactor: add types for shop config in metadata
Jameskmonger Sep 7, 2022
eab8d0c
refactor: create types for remaining metadata properties
Jameskmonger Sep 7, 2022
cdce42d
refactor: delete unused `buttonListener` metadata entry
Jameskmonger Sep 7, 2022
13f21fe
chore: :wrench: Adds all the tree objects for woodcutting
gruckion Sep 7, 2022
e8f41bc
Merge pull request #376 from Jameskmonger/actor-typed-metadaata
SchauweM Sep 8, 2022
720dcd8
fix: initialise `metadata` within Player
Jameskmonger Sep 13, 2022
fb623b9
Merge pull request #377 from Jameskmonger/fix-undefined-metadata
SchauweM Sep 13, 2022
8ad370f
refactor: delete old combat code
Jameskmonger Sep 16, 2022
b320304
refactor: remove prayer plugin and effect system (only used by prayers)
Jameskmonger Sep 16, 2022
cc4460e
fix: return void from openGatewayServer
Jameskmonger Sep 16, 2022
147a1a1
refactor: fix types for generic interaction packet readers
Jameskmonger Sep 16, 2022
715b9e7
fix: fix action switch statement for ladder dialogues
Jameskmonger Sep 16, 2022
bce1270
fix: use correct `bigint` type
Jameskmonger Sep 16, 2022
5012917
ci: run typecheck on CI
Jameskmonger Sep 16, 2022
4330781
Merge pull request #379 from Jameskmonger/fix-typechecks
SchauweM Sep 16, 2022
fe4be4b
Merge branch 'develop' into ci-typecheck
SchauweM Sep 16, 2022
5bef086
Merge pull request #380 from Jameskmonger/ci-typecheck
SchauweM Sep 16, 2022
1968510
build(deps): bump got and nodemon
dependabot[bot] Sep 16, 2022
b3a749e
Merge pull request #381 from runejs/dependabot/npm_and_yarn/got-and-n…
SchauweM Sep 16, 2022
8ae343e
Merge branch 'develop' into remove-combat
SchauweM Sep 19, 2022
54bebc2
Merge pull request #378 from Jameskmonger/remove-combat
SchauweM Sep 19, 2022
3eea5ad
feat: create TaskScheduler, Task, and useful Actor subclasses of Task
Jameskmonger Sep 4, 2022
f1a5f39
feat: add scheduler to Actor and World
Jameskmonger Sep 3, 2022
1a0cce9
docs: progress notes
Jameskmonger Sep 6, 2022
4ac22af
docs: update documentation
Jameskmonger Sep 6, 2022
d08f78e
refactor: create `enqueueTask` factory method for `Actor`
Jameskmonger Sep 6, 2022
f103d4a
feat: create ActorLandscapeObjectInteractionTask
Jameskmonger Sep 7, 2022
35b02d0
feat: allow ActorWalkToTask to accept a LandscapeObject as a target
Jameskmonger Sep 7, 2022
169bcfa
docs: add docs around Task configuration and subtypes
Jameskmonger Sep 16, 2022
e95e199
refactor: move firemaking plugin to skills/firemaking/
Jameskmonger Sep 6, 2022
83ca7f4
refactor: move data and types into separate files
Jameskmonger Sep 6, 2022
854e597
refactor: move lightFire and chance methods into separate files
Jameskmonger Sep 6, 2022
6c3462e
refactor: move main loop task into separate function
Jameskmonger Sep 6, 2022
abc8351
refactor: convert firemaking task to new task system
Jameskmonger Sep 6, 2022
536d8e9
feat: register item_on_world_item for firemaking
Jameskmonger Sep 6, 2022
8f90e20
refactor: Refactor old plugin move files, prep for tick based tasks
gruckion Sep 7, 2022
1997d0a
refactor: Removes unused variables
gruckion Sep 7, 2022
088d8e8
refactor: convert woodcuitting tasks to use new task system
gruckion Sep 7, 2022
4bb508f
Merge pull request #382 from Jameskmonger/rs2-tasks
Katilith Sep 26, 2022
b10682e
docs: add more docs to firemaking
Jameskmonger Nov 2, 2022
9f0afb8
feat: check for level, existing fires, and fix `busy` type
Jameskmonger Nov 2, 2022
946e7e1
Merge branch 'develop' into rs2-woodcutting-all-tree-objects
Katilith Nov 2, 2022
110ec88
Merge pull request #383 from Jameskmonger/rs2-tasks-firemaking
Katilith Nov 2, 2022
613fe05
Merge branch 'develop' into rs2-woodcutting-all-tree-objects
Katilith Nov 2, 2022
f8bc7bf
Merge pull request #375 from gruckion/rs2-woodcutting-all-tree-objects
Katilith Nov 2, 2022
9ba6abd
Merge branch 'develop' into feature/item-groups
Promises Nov 22, 2022
eca6ea7
fix item tag groups linting errors and confusion
Promises Nov 23, 2022
5d3dade
fix command help, show default value even if default value is 0
Promises Nov 24, 2022
5cc90ab
add movement radius as optional param to spawn_npc_command
Promises Nov 24, 2022
ad8b48a
Merge pull request #384 from runejs/patch/spawn-npc-command
SchauweM Nov 25, 2022
fde1a32
Merge branch 'develop' into feature/item-groups
SchauweM Nov 25, 2022
e1df341
Merge pull request #361 from runejs/feature/item-groups
SchauweM Nov 25, 2022
0382326
build(deps): bump json5 from 2.2.0 to 2.2.2
dependabot[bot] Dec 31, 2022
acfc3b1
Merge remote-tracking branch 'upstream/develop' into rs2-tasks-woodcu…
Jameskmonger Jan 15, 2023
3f855cb
refactor: add docs to plugin, task and canCut
Jameskmonger Jan 15, 2023
ac1e3a8
docs: remove non-docker setup docs
Jameskmonger Jan 15, 2023
6152a43
docs: split docker setup into prerequisites
Jameskmonger Jan 15, 2023
e0fb969
docs: add nodejs 16 instructions
Jameskmonger Jan 15, 2023
469bc51
fix: copy babelrc and use `npm run build`
Jameskmonger Jan 15, 2023
9e73c94
fix: use `start:standalone` to launch
Jameskmonger Jan 15, 2023
17736f2
refactor: use npm ci
Jameskmonger Jan 15, 2023
87ce104
refactor: remove unnecessary docker-compose args
Jameskmonger Jan 15, 2023
27c8283
fix: add `data`, `cache` and `config` as volumes
Jameskmonger Jan 15, 2023
301fa7e
Merge pull request #386 from Jameskmonger/rs2-tasks-woodcutting
Katilith Jan 16, 2023
5ed4a98
Merge branch 'develop' into docker-instructions
Katilith Jan 16, 2023
6622b47
Merge pull request #387 from Jameskmonger/docker-instructions
Katilith Jan 16, 2023
a874299
Merge branch 'develop' into fix-docker
Katilith Jan 16, 2023
493098f
Merge pull request #388 from Jameskmonger/fix-docker
Katilith Jan 16, 2023
f981b2d
chore: use `@runejs/store` instead of `filestore` to remove canvas de…
Jameskmonger Jan 16, 2023
13c7466
Merge branch 'develop' into dependabot/npm_and_yarn/json5-2.2.2
SchauweM Jan 17, 2023
23754d1
Merge pull request #385 from runejs/dependabot/npm_and_yarn/json5-2.2.2
SchauweM Jan 17, 2023
5dd58a5
fix: level up widget bug
jameshallam93 Feb 10, 2023
6c09b84
refactor: convert plugin `rs:hans` to typescript
Jameskmonger Feb 11, 2023
7bd9080
refactor: convert plugin `rs:transform_command` to typescript
Jameskmonger Feb 11, 2023
bfbab7b
refactor: various typescript fixes (no functional changes)
Jameskmonger Feb 11, 2023
256e7e2
refactor: more typescript fixes (mostly null checks)
Jameskmonger Feb 11, 2023
0026660
refactor: typescript fixes in WorldInstance and ItemContainer
Jameskmonger Feb 11, 2023
1d4c862
refactor: typescript fixes in shops/banks
Jameskmonger Feb 11, 2023
e0dabac
refactor: typescript fixes around player/actor
Jameskmonger Feb 11, 2023
f2fdd43
refactor: move item container typescript fixes
Jameskmonger Feb 11, 2023
71783fb
refactor: various small typescript fixes
Jameskmonger Feb 11, 2023
accf3ca
refactor: move typescript strict type checks
Jameskmonger Feb 11, 2023
a0e39ff
refactor: typescript fixes in util functions
Jameskmonger Feb 11, 2023
537fe3e
refactor: pathfinding, npc and dialogue typescript fixes
Jameskmonger Feb 11, 2023
c86cc6b
refactor: typescript fixes in action pipelines
Jameskmonger Feb 11, 2023
48d8929
refactor: typescript fixes in commands
Jameskmonger Feb 11, 2023
3ce856a
refactor: typescript fixes in config
Jameskmonger Feb 11, 2023
8dacc52
refactor: typescript null fixes in action code
Jameskmonger Feb 11, 2023
c18549c
refactor: null check fixes in plugins
Jameskmonger Feb 11, 2023
f327f14
refactor: null check fixes in engine/world
Jameskmonger Feb 11, 2023
982a5cd
refactor: various null check fixes
Jameskmonger Feb 11, 2023
1259e1f
refactor: fix actor and player `instance`
Jameskmonger Feb 11, 2023
fe58db1
refactor: more null checks
Jameskmonger Feb 11, 2023
fdcfd6c
refactor: last plugin-based type issues
Jameskmonger Feb 11, 2023
b788078
refactor: fixing world typing issues
Jameskmonger Feb 11, 2023
60a28fa
refactor: fix null sockets
Jameskmonger Feb 11, 2023
ac0dad4
refactor: fix ByteBuffer nullishness in GameServerConnection
Jameskmonger Feb 11, 2023
7d9300e
refactor: mark `translate___ServerConfig` keys as `| undefined`
Jameskmonger Feb 11, 2023
8392255
build: :recycle: :construction_worker: :wrench:
Jameskmonger Feb 11, 2023
8a30136
Merge branch 'develop' into strict-mode
Jameskmonger Feb 11, 2023
ae43b1f
build: also turn on `strictBindCallApply`
Jameskmonger Feb 11, 2023
5fc798f
Merge branch 'strict-mode' of github.com:Jameskmonger/runejs-server i…
Jameskmonger Feb 11, 2023
95a2d6d
some cr feedback
Jameskmonger Feb 12, 2023
66ea030
refactor: suppress `@typescript-eslint/no-non-null-assertion` warnings
Jameskmonger Feb 12, 2023
c60e9ae
refactor: playAnimation can be `null`
Jameskmonger Feb 12, 2023
0f7c507
refactor: return undefined from queue.dequeue
Jameskmonger Feb 12, 2023
0bffb5f
comments for `null as unknown as Foo`
Jameskmonger Feb 12, 2023
ac1b057
update docs to reflect WorldInstance constructor
Jameskmonger Feb 12, 2023
95e96f0
refactor: instanceId no longer optional on `findNearbyPlayers`
Jameskmonger Feb 12, 2023
6179136
Merge branch 'develop' into levelup-bug
Katilith Feb 13, 2023
9b1d4a8
Merge pull request #391 from jameshallam93/levelup-bug
Katilith Feb 13, 2023
e6e66cf
Merge branch 'develop' into strict-mode
Katilith Feb 13, 2023
bc1b899
Merge pull request #392 from Jameskmonger/strict-mode
Promises Feb 24, 2023
3f9fe62
Merge branch 'develop' into use-runejs-store
SchauweM Feb 24, 2023
3acbd35
Merge pull request #389 from Jameskmonger/use-runejs-store
SchauweM Feb 24, 2023
8d1d0bb
Merge branch 'runejs:develop' into feature/trading
nicknick-io Mar 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"@babel/preset-typescript",
[ "@babel/preset-env", {
"targets": {
"node": "14"
"node": "16"
},
"modules": "commonjs"
} ]
Expand All @@ -14,7 +14,8 @@
[ "babel-plugin-module-resolver", {
"root": [ "./src" ],
"alias": {
"@engine": "./dist/game-engine",
"@engine": "./dist/engine",
"@server": "./dist/server",
"@plugins": "./dist/plugins"
}
} ]
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Lint & Build Project

on:
pull_request:
branches: [ master, develop ]
branches: [ master, develop, feature/** ]
push:
branches: [ master, develop ]

Expand All @@ -25,5 +25,8 @@ jobs:
- name: Run Linter
run: npm run lint

- name: Run Typecheck
run: npm run typecheck

- name: Build Project
run: npm run build
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ yarn-error.log*

# Editor directories.ts and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
/.vs

/coverage/
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.tabSize": 4,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true
}
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,44 @@ We do have a few coding styles and lint rules we'd like all contributors to adhe
- Use TypeScript getters/setters instead of specific getter/setter methods
- `public get myVar(): number` instead of `public getMyVar(): number`
- `public set myVar(myVar: number)` instead of `public setMyVar(myVar: number)`

## Testing

Unit tests can be written using Jest. To execute the test suite, run `npm test`

- Test files should be located next to the file under test, and called `file-name.test.ts`
- Tests should use the `when / then` pattern made up of composable `describe` statements
- Make use of `beforeEach` to set up state before each test

After running the tests, you can find code coverage in the `./coverage/` folder.

### When / Then testing pattern

Tests should be broken down into a series of `describe` statements, which set up their own internal state when possible.

```ts
describe('when there is a player', () => {
let player: Player

beforeEach(() => {
player = createMockPlayer()
})

describe('when player is wearing a hat', () => {
beforeEach(() => {
player.equipment().set(0, someHatItem)
})

test('should return true', () => {
const result = isWearingHat(player)

expect(result).toEqual(true)
})
})
})
```

There are two main benefits to this kind of design:

- It serves as living documentation: from reading the `beforeEach` block you can clearly see how the prerequisite of "player is wearing a hat" is achieved
- It allows for easy expansion of test cases: future developers can add further statements inside "when player is wearing a hat" if they want to make use of that setup
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM node:14
FROM node:16
WORKDIR /usr/src/app
COPY package.json ./
COPY package-lock.json ./

RUN npm install
RUN npm ci

COPY src ./src
COPY tsconfig.json ./
COPY .babelrc ./

RUN npm build
RUN npm run build

EXPOSE 43594
CMD [ "npm", "start" ]
CMD [ "npm", "run", "start:standalone" ]
50 changes: 24 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,29 @@
![RuneJS](https://i.imgur.com/pmkdSfc.png)
[![RuneJS Discord Server](https://img.shields.io/discord/678751302297059336?label=RuneJS%20Discord&logo=discord)](https://discord.gg/5P74nSh)

# RuneJS
[![RuneJS](https://i.imgur.com/QSXNzwC.png)](https://github.com/runejs/)

[![RuneJS Discord Server](https://img.shields.io/discord/678751302297059336?label=RuneJS%20Discord&logo=discord)](https://discord.gg/5P74nSh)
# RuneJS Game Server

RuneJS is a RuneScape game server written entirely using TypeScript and JavaScript. The aim of this project is to create a game server that is both fun and easy to use, while also providing simple content development systems.
RuneJS is a RuneScape game server written in TypeScript and JavaScript. The aim of this project is to create a game server that is both fun and easy to use, while also providing simple content development systems.

The server runs on the 435 revision of the game, which was a game update made on October 31st, 2006. There are not any plans to convert it to other versions at this time.
The game server currently runs a build of RuneScape from October 30th-31st, 2006 (game build #435). No other builds are supported at this time, but may become available in the future.

**RuneJS is completely open-source and open to all pull requests and/or issues. Many plugins have been added by contributor pull requests and we're always happy to have more!**

![RuneJS Lumbridge](https://i.imgur.com/KVCqKSb.png)

## Setup

1. Download and install NodeJS **version 14 or higher**: https://nodejs.org/en/
2. Clone the Github Repo: https://github.com/runejs/server
3. Install dependencies by navigating to the project in your Terminal or command prompt and running the command npm install
4. Copy the `data/config/server-config.example.yaml` and paste it into the same folder using the name `server-config.yaml`
5. Go into your new `server-config.yaml` file and modify your RSA modulus and exponent with the ones matching your game client
- You may also modify the server's port and host address from this configuration file
6. Run the game server with `npm start`

The game server will spin up and be accessible via port 43594.
### Prerequisites

### Setup using docker
- [`docker`](https://docs.docker.com/get-docker/) and [`docker-compose`](https://docs.docker.com/compose/install/)
- If on Windows, `docker-compose` comes with `docker`

1. Download and install Docker and Docker Compose: first https://docs.docker.com/get-docker/ then https://docs.docker.com/compose/install/
2. Copy the `config/server-config.example.yaml` and paste it into the same folder using the name `server-config.yaml`
3. Go into your new `server-config.yaml` file and modify your RSA modulus and exponent with the ones matching your game client
1. Copy the `config/server-config.example.json` and paste it into the same folder using the name `server-config.json`
2. Go into your new `server-config.json` file and modify your RSA modulus and exponent with the ones matching your game client
- You may also modify the server's port and host address from this configuration file
4. Build the docker image with `docker-compose build`
5. Run the game server with `docker-compose up'
3. Build the docker image with `docker-compose build`
4. Run the game server with `docker-compose up'

The game server will spin up and be accessible via port 43594.

Expand All @@ -40,12 +32,18 @@ The game server will spin up and be accessible via port 43594.
The [RuneScape Java Client #435](https://github.com/runejs/refactored-client-435) must be used to log into a RuneJS game server.

## Additional Commands
* `npm run start:game` Launches the game server by itself without building
* `npm run start:game:dev` Builds and launches the game server by itself in watch mode
* `npm run start:login` Launches the login server by itself without building
* `npm run start:update` Launches the update server by itself without building
* `npm run start:infra` Launches both the login and update server without building
* `npm run start:standalone` Launches all three servers concurrently without building

Before running these commands, you must:

1. have [NodeJS **version 16 or higher**](https://nodejs.org/en/) installed on your machine
2. run `npm install` from the root of this project

* `npm run game` Launches the game server by itself without building
* `npm run game:dev` Builds and launches the game server by itself in watch mode
* `npm run login` Launches the login server by itself without building
* `npm run update` Launches the update server by itself without building
* `npm run infra` Launches both the login and update server without building
* `npm run standalone` Launches all three servers concurrently without building
* `npm run build:watch` Builds the application and watches for changes
* `npm run build` Builds the application
* `npm run lint` Runs the linter against the codebase to look for code style issues
1 change: 1 addition & 0 deletions config/server-config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"loginServerPort": 43591,
"rsaMod": "119568088839203297999728368933573315070738693395974011872885408638642676871679245723887367232256427712869170521351089799352546294030059890127723509653145359924771433131004387212857375068629466435244653901851504845054452735390701003613803443469723435116497545687393297329052988014281948392136928774011011998343",
"rsaExp": "12747337179295870166838611986189126026507945904720545965726999254744592875817063488911622974072289858092633084100280214658532446654378876853112046049506789703022033047774294965255097838909779899992870910011426403494610880634275141204442441976355383839981584149269550057129306515912021704593400378690444280161",
"encryptionEnabled": true,
"playerSavePath": "./data/saves",

"showWelcome": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"defence": 30
}
}
}
},
"groups": ["adamant_metal", "equipment"]
}
},

Expand All @@ -31,7 +32,8 @@
"magic": -4,
"ranged": 31
}
}
},
"groups": ["legs"]
},

"rs:adamant_plateskirt": {
Expand All @@ -52,6 +54,7 @@
"magic": -4,
"ranged": 31
}
}
},
"groups": ["legs"]
}
}
9 changes: 6 additions & 3 deletions data/config/items/equipment/standard-metals/black-armour.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"defence": 10
}
}
}
},
"groups": ["black_metal", "equipment"]
}
},

Expand All @@ -31,7 +32,8 @@
"magic": -4,
"ranged": 20
}
}
},
"groups": ["legs"]
},

"rs:black_plateskirt": {
Expand All @@ -52,6 +54,7 @@
"magic": -4,
"ranged": 20
}
}
},
"groups": ["legs"]
}
}
22 changes: 20 additions & 2 deletions data/config/items/equipment/standard-metals/bronze-armour.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"presets": {
"rs:bronze_armour_base": {
"tradable": true,
"equippable": true,
"equipment_data": {
"requirements": {
"skills": {
"defence": 1
}
}
},
"groups": ["bronze_metal", "equipment"]
}
},
"rs:bronze_platelegs": {
"extends": "rs:bronze_armour_base",
"game_id": 1075,
"examine": "These look pretty heavy.",
"weight": 9.071,
Expand All @@ -18,11 +33,13 @@
"magic": -4,
"ranged": 7
}
}
},
"groups": ["legs"]
},

"rs:bronze_plateskirt": {
"game_id": 1087,
"extends": "rs:bronze_armour_base",
"examine": "Designer leg protection.",
"weight": 8.164,
"tradable": true,
Expand All @@ -40,6 +57,7 @@
"magic": -4,
"ranged": 7
}
}
},
"groups": ["legs"]
}
}
20 changes: 18 additions & 2 deletions data/config/items/equipment/standard-metals/bronze-weapons.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
{
"presets": {
"rs:bronze_weapon_base": {
"tradable": true,
"equippable": true,
"equipment_data": {
"requirements": {
"skills": {
"defence": 1
}
}
},
"groups": ["bronze_metal", "equipment", "weapon"]
}
},
"rs:bronze_dagger": {
"game_id": 1205,
"extends": "rs:bronze_weapon_base",
"tradable": true,
"weight": 0.453,
"equippable": true,
Expand All @@ -9,7 +24,7 @@
"equipment_type": "one_handed",
"requirements": {
"quests": {
"goblin_diplomacy": 20
"tyn:goblin_diplomacy": 20
}
},
"offensive_bonuses": {
Expand All @@ -28,6 +43,7 @@
"weapon_info": {
"style": "dagger"
}
}
},
"groups": ["main_hand", "dagger"]
}
}
Loading