Commit f65545e0 authored by insert's avatar insert

Changed the way it parses whitespaces, should fix #1

The loop now looks for a null terminator from the start, rather than see where the null terminators stop from the end.
parent ecc1f452
......@@ -25,4 +25,8 @@ console.log(identity.name); // Your character's name =)
## To-Do
- Create documentation for module
- Finish support for [ML struct](https://wiki.guildwars2.com/wiki/API:MumbleLink#MumbleLink_structure), this includes: f* vars, the context, desc and other variables.
\ No newline at end of file
- Finish support for [ML struct](https://wiki.guildwars2.com/wiki/API:MumbleLink#MumbleLink_structure), this includes: f* vars, the context, desc and other variables.
## Issues
- Usually works, sometimes it becomes hit or miss after a few launches, same issue occurs with GW2-Taco, restarting the application several times seems to have fixed it for some reason? (To investigate)
\ No newline at end of file
......@@ -76,13 +76,14 @@ class MumbleLink {
* Remove all whitespaces because JSON.parse dosen't like them.
*/
let end = 0;
for (let i=data.length-1;i>0;i--) {
if (data[i].charCodeAt() != 0) {
end = i+1;
for (let i=0;i<data.length;i++) {
if (data[i].charCodeAt() == 0) {
end = i;
break;
}
}
return JSON.parse(data.substring(0, end));
data = data.substring(0, end);
return JSON.parse(data);
}
}
......
{
"name": "gw2mumblelink",
"version": "1.0.1",
"version": "1.0.2",
"description": "Guild Wars 2 Mumble Link integration for Node.js",
"main": "index.js",
"scripts": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment