haxball.js 1.0.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -46
- package/package.json +35 -37
- package/src/index.js +5272 -5
- package/test/room.js +39 -0
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -6
- package/.prettierignore +0 -2
- package/.prettierrc +0 -7
- package/src/structures/Collection.js +0 -9
- package/src/structures/Player.js +0 -100
- package/src/structures/Room.js +0 -303
- package/src/util/room.js +0 -73
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
### 🔖 Table Of Contents
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
13
|
+
- 🤔 [How To Use](#how-to-use)
|
|
14
|
+
- 🚀 [Technologies](#technologies)
|
|
15
|
+
- 🌱 [Minimal Requirements](#minimal-requirements)
|
|
16
|
+
- 🎊 [Features](#features)
|
|
17
|
+
- 💡 [How To Contribute](#how-to-contribute)
|
|
18
|
+
- 🤗 [Contributors](#contributors)
|
|
19
|
+
- 👤 [Author](#author)
|
|
20
|
+
- 🔏 [License](#license)
|
|
21
21
|
|
|
22
22
|
---
|
|
23
23
|
|
|
@@ -34,32 +34,36 @@ npm install haxball.js
|
|
|
34
34
|
```js
|
|
35
35
|
const HaxballJS = require("haxball.js");
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
HaxballJS.then((HBInit) => {
|
|
38
|
+
// All is same as Haxball Headless Host Documentation
|
|
39
|
+
const room = HBInit({
|
|
40
|
+
roomName: "Haxball.JS",
|
|
40
41
|
maxPlayers: 16,
|
|
41
42
|
public: true,
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
noPlayer: true,
|
|
44
|
+
token: "TOKEN", // Required
|
|
45
|
+
});
|
|
44
46
|
|
|
45
|
-
room.
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
room.setDefaultStadium("Big");
|
|
48
|
+
room.setScoreLimit(5);
|
|
49
|
+
room.setTimeLimit(0);
|
|
48
50
|
|
|
49
|
-
room.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
51
|
+
room.onRoomLink = function (link) {
|
|
52
|
+
console.log(link);
|
|
53
|
+
};
|
|
53
54
|
});
|
|
54
|
-
|
|
55
|
-
room.create();
|
|
56
55
|
```
|
|
57
56
|
|
|
58
57
|
---
|
|
59
58
|
|
|
60
59
|
<h2 id="technologies">🚀 Technologies</h2>
|
|
61
60
|
|
|
62
|
-
-
|
|
61
|
+
- wrtc - WebRTC implementation for NodeJS
|
|
62
|
+
- ws - Websocket Connection
|
|
63
|
+
- JSON5 - JSON Helper Module
|
|
64
|
+
- @peculiar/webcrypto - Webcrypto implementation for NodeJS
|
|
65
|
+
- pako - ZLIP Port for NodeJS
|
|
66
|
+
- node-fetch - HTTP Requests
|
|
63
67
|
|
|
64
68
|
[Back To The Top](#title)
|
|
65
69
|
|
|
@@ -67,8 +71,8 @@ room.create();
|
|
|
67
71
|
|
|
68
72
|
<h2 id="minimal-requirements">🌱 Minimal Requirements</h2>
|
|
69
73
|
|
|
70
|
-
-
|
|
71
|
-
-
|
|
74
|
+
- NPM
|
|
75
|
+
- NodeJs
|
|
72
76
|
|
|
73
77
|
[Back To The Top](#title)
|
|
74
78
|
|
|
@@ -76,9 +80,9 @@ room.create();
|
|
|
76
80
|
|
|
77
81
|
<h2 id="features">🎊 Features</h2>
|
|
78
82
|
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
83
|
+
- [x] Promise based
|
|
84
|
+
- [x] Synchronous
|
|
85
|
+
- [x] Performant
|
|
82
86
|
|
|
83
87
|
[Back To The Top](#title)
|
|
84
88
|
|
|
@@ -86,13 +90,13 @@ room.create();
|
|
|
86
90
|
|
|
87
91
|
<h2 id="how-to-contribute">💡 How To Contribute</h2>
|
|
88
92
|
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
93
|
+
- Make a fork of this repository
|
|
94
|
+
- Clone to you machine and entry on respective paste
|
|
95
|
+
- Create a branch with your resource: `git checkout -b my-feature`
|
|
96
|
+
- Commit your changes: `git commit -m 'feat: My new feature'`
|
|
97
|
+
- Push your branch: `git push origin my-feature`
|
|
98
|
+
- A green button will appear at the beginning of this repository
|
|
99
|
+
- Click to open and fill in the pull request information
|
|
96
100
|
|
|
97
101
|
<p align="center">
|
|
98
102
|
<i>Contributions, issues and features requests are welcome!</i><br />
|
|
@@ -117,17 +121,6 @@ room.create();
|
|
|
117
121
|
|
|
118
122
|
---
|
|
119
123
|
|
|
120
|
-
<h2 id="author">👤 Author</h2>
|
|
121
|
-
|
|
122
|
-
🤓 **Mertushka <mertushkaonline@gmail.com>**
|
|
123
|
-
|
|
124
|
-
- Instagram: [@mertushka](https://instagram.com/mertushka)
|
|
125
|
-
- Github: [@mertushka](https://github.com/mertushka)
|
|
126
|
-
|
|
127
|
-
[Back To The Top](#title)
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
124
|
<h2 id="license">🔏 License</h2>
|
|
132
125
|
|
|
133
126
|
Copyright © 2021 [Mertushka <mertushkaonline@gmail.com>](https://github.com/mertushka)
|
package/package.json
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
"homepage": "https://github.com/mertushka/haxball.js#readme"
|
|
2
|
+
"name": "haxball.js",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "A powerful library for interacting with the Haxball Headless API",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "mocha --recursive --exit"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"haxball",
|
|
11
|
+
"headless",
|
|
12
|
+
"bot",
|
|
13
|
+
"room"
|
|
14
|
+
],
|
|
15
|
+
"author": "mertushka",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@peculiar/webcrypto": "^1.3.3",
|
|
19
|
+
"json5": "^2.2.1",
|
|
20
|
+
"node-fetch": "^2.6.6",
|
|
21
|
+
"pako": "^2.0.4",
|
|
22
|
+
"wrtc": "^0.4.7",
|
|
23
|
+
"ws": "^8.5.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"mocha": "^9.2.2",
|
|
27
|
+
"node-pre-gyp": "^0.17.0"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/mertushka/haxball.js.git"
|
|
32
|
+
},
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/mertushka/haxball.js/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/mertushka/haxball.js#readme"
|
|
39
37
|
}
|