diff --git a/.gitignore b/.gitignore
index 40b0dce..0500d05 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,7 +9,6 @@ build-env/*
!build-env/assets/
!build-env/typescript/
!build-env/pkg-cache
-!build-env/plugins
!build-env/package.json
.vscode
diff --git a/.gitmodules b/.gitmodules
index a6a52de..1f7f90b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
[submodule "build-env/plugins/_example@identifier"]
path = build-env/plugins/_example@identifier
url = https://github.com/asphyxia-core/plugin-template
+[submodule "docs"]
+ path = docs
+ url = https://github.com/asphyxia-core/asphyxia-core.github.io
diff --git a/api/typedoc.json b/api/typedoc.json
deleted file mode 100644
index 4344abd..0000000
--- a/api/typedoc.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "includeDeclarations": true,
- "excludeExternals": true,
- "externalPattern": ["!asphyxia-core.d.ts"],
- "mode": "file",
- "readme": "../docs/_typedoc.md",
- "name": "Asphyxia CORE Module API",
- "out": "../docs/typedoc"
-}
diff --git a/build-env/plugins/_example@identifier b/build-env/plugins/_example@identifier
deleted file mode 160000
index 27f1a25..0000000
--- a/build-env/plugins/_example@identifier
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 27f1a259b57ad4bc82b1fbdce7fb67a5be653a22
diff --git a/docs b/docs
new file mode 160000
index 0000000..2308694
--- /dev/null
+++ b/docs
@@ -0,0 +1 @@
+Subproject commit 230869490fd447e217da07cb89cdab41eab260f1
diff --git a/package-lock.json b/package-lock.json
index feb8e11..b8d8924 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -614,12 +614,6 @@
"delayed-stream": "~1.0.0"
}
},
- "commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "optional": true
- },
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -1158,7 +1152,7 @@
},
"fs.realpath": {
"version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
+ "resolved": "https://registry.npm.taobao.org/fs.realpath/download/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"function-bind": {
@@ -1181,8 +1175,8 @@
},
"glob": {
"version": "7.1.6",
- "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
- "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
+ "resolved": "https://registry.npm.taobao.org/glob/download/glob-7.1.6.tgz",
+ "integrity": "sha1-FB8zuBp8JJLhJVlDB0gMRmeSeKY=",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@@ -1220,8 +1214,8 @@
},
"handlebars": {
"version": "4.7.6",
- "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.6.tgz",
- "integrity": "sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA==",
+ "resolved": "https://registry.npm.taobao.org/handlebars/download/handlebars-4.7.6.tgz",
+ "integrity": "sha1-1MBcG6+Q6ZRfd6pop6IZqkp9904=",
"requires": {
"minimist": "^1.2.5",
"neo-async": "^2.6.0",
@@ -1231,17 +1225,14 @@
},
"dependencies": {
"uglify-js": {
- "version": "3.9.2",
- "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.9.2.tgz",
- "integrity": "sha512-zGVwKslUAD/EeqOrD1nQaBmXIHl1Vw371we8cvS8I6mYK9rmgX5tv8AAeJdfsQ3Kk5mGax2SVV/AizxdNGhl7Q==",
- "optional": true,
- "requires": {
- "commander": "~2.20.3"
- }
+ "version": "3.12.1",
+ "resolved": "https://registry.npm.taobao.org/uglify-js/download/uglify-js-3.12.1.tgz?cache=0&sync_timestamp=1606761738581&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fuglify-js%2Fdownload%2Fuglify-js-3.12.1.tgz",
+ "integrity": "sha1-eDB/U597nKVVe6uxhup4rTDMA3U=",
+ "optional": true
},
"wordwrap": {
"version": "1.0.0",
- "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "resolved": "https://registry.npm.taobao.org/wordwrap/download/wordwrap-1.0.0.tgz",
"integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
}
}
@@ -1279,9 +1270,9 @@
"integrity": "sha512-+hQeKWwpSDiWFeu/3jKUvwboE4Z035gR6FnpscbHPOEEjCbgv2px9/Mlb3O0nOTRyZOw4MMFRYfVL3zctOV6OQ=="
},
"highlight.js": {
- "version": "10.0.2",
- "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.0.2.tgz",
- "integrity": "sha512-2gMT2MHU6/2OjAlnaOE2LFdr9dwviDN3Q2lSw7Ois3/5uTtahbgYTkr4EPoY828ps+2eQWiixPTF8+phU6Ofkg=="
+ "version": "10.4.1",
+ "resolved": "https://registry.npm.taobao.org/highlight.js/download/highlight.js-10.4.1.tgz",
+ "integrity": "sha1-1I+89KmXHENhs/lfMCdHr+GdutA="
},
"http-errors": {
"version": "1.7.2",
@@ -1325,7 +1316,7 @@
},
"inflight": {
"version": "1.0.6",
- "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
+ "resolved": "https://registry.npm.taobao.org/inflight/download/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"requires": {
"once": "^1.3.0",
@@ -1343,9 +1334,9 @@
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
},
"interpret": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz",
- "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw=="
+ "version": "1.4.0",
+ "resolved": "https://registry.npm.taobao.org/interpret/download/interpret-1.4.0.tgz",
+ "integrity": "sha1-Zlq4vE2iendKQFhOgS4+D6RbGh4="
},
"into-stream": {
"version": "5.1.1",
@@ -1665,9 +1656,9 @@
}
},
"lunr": {
- "version": "2.3.8",
- "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz",
- "integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg=="
+ "version": "2.3.9",
+ "resolved": "https://registry.npm.taobao.org/lunr/download/lunr-2.3.9.tgz",
+ "integrity": "sha1-GLEjFCgyM33W6WTfGlp3B7JdNeE="
},
"make-error": {
"version": "1.3.6",
@@ -1676,8 +1667,8 @@
},
"marked": {
"version": "1.0.0",
- "resolved": "https://registry.npmjs.org/marked/-/marked-1.0.0.tgz",
- "integrity": "sha512-Wo+L1pWTVibfrSr+TTtMuiMfNzmZWiOPeO7rZsQUY5bgsxpHesBEcIWJloWVTFnrMXnf/TL30eTFSGJddmQAng=="
+ "resolved": "https://registry.npm.taobao.org/marked/download/marked-1.0.0.tgz?cache=0&sync_timestamp=1605794918833&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmarked%2Fdownload%2Fmarked-1.0.0.tgz",
+ "integrity": "sha1-01eEJFoEhx5ZiKSR4ohnNi6UFpM="
},
"media-typer": {
"version": "0.3.0",
@@ -1844,9 +1835,9 @@
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"neo-async": {
- "version": "2.6.1",
- "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
- "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw=="
+ "version": "2.6.2",
+ "resolved": "https://registry.npm.taobao.org/neo-async/download/neo-async-2.6.2.tgz",
+ "integrity": "sha1-tKr7k+OustgXTKU88WOrfXMIMF8="
},
"oauth-sign": {
"version": "0.9.0",
@@ -1873,7 +1864,7 @@
},
"once": {
"version": "1.4.0",
- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "resolved": "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1"
@@ -1949,7 +1940,7 @@
},
"path-is-absolute": {
"version": "1.0.1",
- "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
+ "resolved": "https://registry.npm.taobao.org/path-is-absolute/download/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"path-parse": {
@@ -2251,7 +2242,7 @@
},
"rechoir": {
"version": "0.6.2",
- "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
+ "resolved": "https://registry.npm.taobao.org/rechoir/download/rechoir-0.6.2.tgz",
"integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=",
"requires": {
"resolve": "^1.1.6"
@@ -2410,8 +2401,8 @@
},
"shelljs": {
"version": "0.8.4",
- "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz",
- "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==",
+ "resolved": "https://registry.npm.taobao.org/shelljs/download/shelljs-0.8.4.tgz",
+ "integrity": "sha1-3naE/ut2f4cWsyYHiooAh1iQ48I=",
"requires": {
"glob": "^7.0.0",
"interpret": "^1.0.0",
@@ -2692,9 +2683,9 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
},
"typedoc": {
- "version": "0.17.6",
- "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.17.6.tgz",
- "integrity": "sha512-pQiYnhG3yJk7939cv2n8uFoTsSgy5Hfiw0dgOQYa9nT9Ya1013dMctQdAXMj8JbNu7KhcauQyq9Zql9D/TziLw==",
+ "version": "0.17.8",
+ "resolved": "https://registry.npm.taobao.org/typedoc/download/typedoc-0.17.8.tgz",
+ "integrity": "sha1-lrZ+lFSqeFO/xNyaVciget/VR44=",
"requires": {
"fs-extra": "^8.1.0",
"handlebars": "^4.7.6",
@@ -2705,21 +2696,21 @@
"minimatch": "^3.0.0",
"progress": "^2.0.3",
"shelljs": "^0.8.4",
- "typedoc-default-themes": "^0.10.1"
+ "typedoc-default-themes": "^0.10.2"
}
},
"typedoc-default-themes": {
- "version": "0.10.1",
- "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.10.1.tgz",
- "integrity": "sha512-SuqAQI0CkwhqSJ2kaVTgl37cWs733uy9UGUqwtcds8pkFK8oRF4rZmCq+FXTGIb9hIUOu40rf5Kojg0Ha6akeg==",
+ "version": "0.10.2",
+ "resolved": "https://registry.npm.taobao.org/typedoc-default-themes/download/typedoc-default-themes-0.10.2.tgz",
+ "integrity": "sha1-dDOAqAr+YsXvksob1KvirFlr5NI=",
"requires": {
"lunr": "^2.3.8"
}
},
"typescript": {
- "version": "3.9.3",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz",
- "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ=="
+ "version": "3.9.7",
+ "resolved": "https://registry.npm.taobao.org/typescript/download/typescript-3.9.7.tgz?cache=0&sync_timestamp=1607503857134&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftypescript%2Fdownload%2Ftypescript-3.9.7.tgz",
+ "integrity": "sha1-mNYApevcOPQMsndSLxLcgA6eJfo="
},
"uglify-js": {
"version": "2.8.29",
@@ -2952,7 +2943,7 @@
},
"wrappy": {
"version": "1.0.2",
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "resolved": "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
},
"xtend": {
diff --git a/package.json b/package.json
index 6dae748..9942e93 100644
--- a/package.json
+++ b/package.json
@@ -44,8 +44,8 @@
"showdown": "^1.9.1",
"sizeof": "^1.0.0",
"ts-node": "^8.10.1",
- "typedoc": "^0.17.6",
- "typescript": "^3.9.3",
+ "typedoc": "^0.17.8",
+ "typescript": "^3.9.7",
"winston": "^3.2.1"
}
}
diff --git a/plugins/_example@identifier/README.md b/plugins/_example@identifier/README.md
new file mode 100644
index 0000000..5c13c69
--- /dev/null
+++ b/plugins/_example@identifier/README.md
@@ -0,0 +1,5 @@
+# Plugin Template
+
+This readme file will be shown in WebUI.
+
+You can follow this example to create your own plugin.
diff --git a/plugins/_example@identifier/handlers/example.ts b/plugins/_example@identifier/handlers/example.ts
new file mode 100644
index 0000000..31b3813
--- /dev/null
+++ b/plugins/_example@identifier/handlers/example.ts
@@ -0,0 +1,53 @@
+/*
+EamusePluginRoute. Handle your game message like this
+
+You can send a plain XML request to test this route:
+
+
+
+*/
+export const example: EPR = async (info, data, send) => {
+ /* [Check documentation for the entire API] */
+
+ /*
+ Access data from request like this
+ NOTE: all card number will be automatically converted to refid.
+ This is to support older game that doesn't use cardmng,
+ yet still allow them to register with internal profile manager.
+ And they can show up in WebUI as a profile, along with card binding feature.
+ */
+ const refid = $(data).attr().card;
+
+ /* Access config like this */
+ const event = U.GetConfig('event');
+
+ /*
+ Create user data in profile space if not exists
+ WebUI will try to find a "name" field in profile documents and display them.
+ If you are using a collection of data for each profile,
+ make sure to avoid using name field in supplementary documents.
+ If you have multiple documents per refid, it is recommended to provide a field to
+ simulate collections in NoSQL database (e.g. MongoDB)
+ */
+ await DB.Upsert(
+ refid,
+ {
+ collection: 'profile',
+ name: 'PLAYER',
+ },
+ { $inc: { login_count: 1 } }
+ );
+
+ /*
+ Send your response like this
+ There are more methods for sending request.
+ */
+ send.pugFile('templates/example.pug', { refid, event });
+
+ /* Or you can send ejs template (plain xml works as well) */
+ // send.xmlFile('templates/example.xml', { refid, event });
+};
+
+export const changeName = async (data: any) => {
+ await DB.Update(data.refid, { collection: 'profile' }, { $set: { name: data.name } });
+};
diff --git a/plugins/_example@identifier/index.ts b/plugins/_example@identifier/index.ts
new file mode 100644
index 0000000..c7b7ef3
--- /dev/null
+++ b/plugins/_example@identifier/index.ts
@@ -0,0 +1,43 @@
+import { example, changeName } from './handlers/example';
+
+export function register() {
+ /* Register game code */
+ R.GameCode('NULL');
+
+ /* A plugin can have multiple contributors. */
+ R.Contributor('Your Name', 'http://your-link.com');
+ R.Contributor('Others Name');
+
+ /* Register plugin configuration */
+ R.Config('event', {
+ type: 'string',
+ default: 'EVENT_1',
+ options: ['EVENT_1', 'EVENT_2'],
+ });
+
+ /* Register your routes */
+ R.Route('example.method', example);
+
+ /*
+ Register a unhandled handler that print all unhandled methods.
+ You should remove it before you publish your plugin,
+ unless you have specific reason not to.
+ */
+ R.Unhandled();
+
+ /* Insert or clear a existing document in plugin space */
+ DB.Upsert({ clicked: { $exists: true } }, { $set: { clicked: 0 } });
+
+ /* Register a event and increment the click counter */
+ R.WebUIEvent('click', async data => {
+ console.log('WebUI Button Clicked');
+ await DB.Update({ clicked: { $exists: true } }, { $inc: { clicked: 1 } });
+ });
+
+ /* Register a event and increment the click counter */
+ R.WebUIEvent('change', changeName);
+
+ /* Use --dev argument to enable console output. */
+ console.log(`Core Version: ${CORE_VERSION}`);
+ console.log('Plugin Registered');
+}
diff --git a/plugins/_example@identifier/templates/example.pug b/plugins/_example@identifier/templates/example.pug
new file mode 100644
index 0000000..38dfe19
--- /dev/null
+++ b/plugins/_example@identifier/templates/example.pug
@@ -0,0 +1,5 @@
+//-
+ Learn pug here: https://pugjs.org/api/getting-started.html
+example(status="0")
+ refid(__type="str") #{refid}
+ event(__type="str") #{event}
\ No newline at end of file
diff --git a/plugins/_example@identifier/templates/example.xml b/plugins/_example@identifier/templates/example.xml
new file mode 100644
index 0000000..264249c
--- /dev/null
+++ b/plugins/_example@identifier/templates/example.xml
@@ -0,0 +1,7 @@
+
+
+ <%= refid %>
+ <%= event %>
+
\ No newline at end of file
diff --git a/plugins/_example@identifier/webui/css/profile_name.css b/plugins/_example@identifier/webui/css/profile_name.css
new file mode 100644
index 0000000..bb2ac1c
--- /dev/null
+++ b/plugins/_example@identifier/webui/css/profile_name.css
@@ -0,0 +1,3 @@
+#change-name-button {
+ background-color: rgb(245, 147, 0);
+}
diff --git a/plugins/_example@identifier/webui/custom_page.pug b/plugins/_example@identifier/webui/custom_page.pug
new file mode 100644
index 0000000..baa5d1f
--- /dev/null
+++ b/plugins/_example@identifier/webui/custom_page.pug
@@ -0,0 +1,29 @@
+//-
+ Custom web component for plugin page
+ The following frontend components are already avaliable:
+ * Bulma [https://bulma.io/]
+ * MaterialDesignIcons [https://materialdesignicons.com/]
+ * jQuery [https://jquery.com/]
+ * axios [https://github.com/axios/axios]
+ * GeoPattern [https://github.com/btmills/geopattern]
+ * jdenticon [https://jdenticon.com/]
+ You can include your own js, css or images as well.
+
+ To request data from database, use //DATA// to indicate a comment block for capture and follow:
+ fieldName: expression
+
+ Then fieldName will be avaliable for the template engine when rendering.
+
+//DATA//
+ data: DB.FindOne({ clicked: { $exists: true } })
+
+.content
+ h3 Custom Page
+ p Clicked: #{data.clicked}
+ p
+ button.button.is-primary#plugin-click
+ | Send "click" event and refresh
+
+//- You can include custom javascripts and send data back to plugin using emit()
+ see profile_name.pug for sending data using form
+script(src="static/js/custom_page.js")
\ No newline at end of file
diff --git a/plugins/_example@identifier/webui/js/custom_page.js b/plugins/_example@identifier/webui/js/custom_page.js
new file mode 100644
index 0000000..86cc11a
--- /dev/null
+++ b/plugins/_example@identifier/webui/js/custom_page.js
@@ -0,0 +1,5 @@
+$('#plugin-click').on('click', () => {
+ emit('click', {}).then(() => {
+ location.reload();
+ });
+});
diff --git a/plugins/_example@identifier/webui/profile_name.pug b/plugins/_example@identifier/webui/profile_name.pug
new file mode 100644
index 0000000..7fd16d4
--- /dev/null
+++ b/plugins/_example@identifier/webui/profile_name.pug
@@ -0,0 +1,42 @@
+//-
+ Custom web component for individual user profile
+ The following frontend components are already avaliable:
+ * Bulma [https://bulma.io/]
+ * MaterialDesignIcons [https://materialdesignicons.com/]
+ * jQuery [https://jquery.com/]
+ * axios [https://github.com/axios/axios]
+ * GeoPattern [https://github.com/btmills/geopattern]
+ * jdenticon [https://jdenticon.com/]
+ You can include your own js/css as well
+
+ To request data from database, use //DATA// to indicate a comment block for capture and follow:
+ fieldName: expression
+
+ Then fieldName will be avaliable for the template engine when rendering.
+
+ WebUI file with prefix "profile_" is different from other pug file:
+ * This page have a "refid" local variable, you can request data with it or use it during render.
+ * User can access these page by editing a profile.
+
+//DATA//
+ profile: DB.FindOne(refid, { login_count: { $exists: true } })
+
+//-
+ You can include your own stylesheet
+link(rel="stylesheet" href="static/css/profile_name.css")
+
+div
+ h3 Hi #{profile.name}
+
+ section.section
+ //-
+ You can send data back to plugin using post method in form
+ see custom_page.pug for sending data using emit() function
+ form(method="post" action="/emit/change")
+ input(type="hidden" name="refid" value=refid)
+ .field
+ label.label Change Name
+ .field
+ input.input(type="text" name="name", value=profile.name)
+ .field
+ button.button.is-primary#change-name-button(type="submit") Submit
diff --git a/api/asphyxia-core.d.ts b/plugins/asphyxia-core.d.ts
similarity index 98%
rename from api/asphyxia-core.d.ts
rename to plugins/asphyxia-core.d.ts
index 0805cd8..ef37d04 100644
--- a/api/asphyxia-core.d.ts
+++ b/plugins/asphyxia-core.d.ts
@@ -1,6 +1,21 @@
///
///
+/**
+ * Version string of Asphyxia CORE, for example "v1.19"
+ */
+declare const CORE_VERSION: string;
+
+/**
+ * Major version of Asphyxia CORE, for version `v1.19`, this number is 1.
+ */
+declare const CORE_VERSION_MAJOR: number;
+
+/**
+ * Minor version of Asphyxia CORE, for version `v1.19`, this number is 19.
+ */
+declare const CORE_VERSION_MINOR: number;
+
declare type KNumberType =
| 's8'
| 'u8'
diff --git a/build-env/plugins/package.json b/plugins/package.json
similarity index 100%
rename from build-env/plugins/package.json
rename to plugins/package.json
diff --git a/build-env/plugins/tsconfig.json b/plugins/tsconfig.json
similarity index 100%
rename from build-env/plugins/tsconfig.json
rename to plugins/tsconfig.json
diff --git a/src/eamuse/ExternalPluginLoader.ts b/src/eamuse/ExternalPluginLoader.ts
index a4ac7e9..67d119f 100644
--- a/src/eamuse/ExternalPluginLoader.ts
+++ b/src/eamuse/ExternalPluginLoader.ts
@@ -43,6 +43,7 @@ import { EamuseRouteHandler } from './EamuseRouteContainer';
import xml2json from 'fast-xml-parser';
import _ from 'lodash';
import { isPlainObject } from 'lodash';
+import { VERSION } from '../utils/Consts';
/** Caller Detection */
export function GetCallerPlugin(): string {
@@ -173,6 +174,10 @@ export function LoadExternalPlugins() {
WebUIEvent: () => {},
};
+ $.CORE_VERSION = VERSION;
+ $.CORE_VERSION_MAJOR = parseInt(VERSION.split('.')[0].substr(1));
+ $.CORE_VERSION_MINOR = parseInt(VERSION.split('.')[1]);
+
function EnableRegisterNamespace(plugin: EamusePlugin) {
$.R.GameCode = (gameCode: string) => {
plugin.RegisterGameCode(gameCode);
diff --git a/typedoc.json b/typedoc.json
new file mode 100644
index 0000000..b2d632c
--- /dev/null
+++ b/typedoc.json
@@ -0,0 +1,10 @@
+{
+ "includeDeclarations": true,
+ "excludeExternals": true,
+ "externalPattern": ["!./plugins/asphyxia-core.d.ts"],
+ "mode": "file",
+ "readme": "./docs/_typedoc.md",
+ "name": "Asphyxia CORE Module API",
+ "out": "./docs/typedoc",
+ "tsconfig": "./plugins/tsconfig.json"
+}