forked from Inconcessus/html5-tibia-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathipcclient.js
48 lines (31 loc) · 944 Bytes
/
ipcclient.js
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
39
40
41
42
43
44
45
46
47
48
"use strict";
const path = require("path");
// Load the configuration
global.CONFIG = require("./config");
// Create some useful global functions
global.getDataFile = function() {
/*
* Function global.getDataFile
* Returns a file from the base data directory
*/
return path.join(__dirname, "data", CONFIG.SERVER.CLIENT_VERSION, ...arguments);
}
global.requireModule = function() {
/*
* Function global.requireModule
* Requires a module from the base source directory
*/
return require(path.join(__dirname, "src", ...arguments));
}
// Load constants
global.CONST = require(getDataFile("constants.json"));
// Requires the prototype modifications
requireModule("__proto__");
if(require.main === module) {
/*
* Function require.main
* Returns a file from the base data directory
*/
const IPCHTTPAPI = requireModule("ipchttpapi");
new IPCHTTPAPI().listen(CONFIG.IPC.PORT, CONFIG.IPC.HOST);
}