Comparing version 0.3.9 to 0.3.10
@@ -51,6 +51,7 @@ "use strict"; | ||
if (player.id == target | ||
&& player.s.mluck | ||
&& player.s.mluck.f == this.id) { | ||
&& player.s?.mluck?.f == this.id | ||
&& player.s?.mluck?.ms == this.G.conditions.mluck.duration) { | ||
this.socket.removeListener("entities", mluckCheck); | ||
this.socket.removeListener("game_response", failCheck); | ||
this.socket.removeListener("player", selfMluckCheck); | ||
resolve(); | ||
@@ -60,2 +61,11 @@ } | ||
}; | ||
const selfMluckCheck = (data) => { | ||
if (data.s?.mluck?.f == this.id | ||
&& data.s?.mluck?.ms == this.G.conditions.mluck.duration) { | ||
this.socket.removeListener("entities", mluckCheck); | ||
this.socket.removeListener("game_response", failCheck); | ||
this.socket.removeListener("player", selfMluckCheck); | ||
resolve(); | ||
} | ||
}; | ||
const failCheck = async (data) => { | ||
@@ -66,2 +76,3 @@ if (typeof data == "string") { | ||
this.socket.removeListener("game_response", failCheck); | ||
this.socket.removeListener("player", selfMluckCheck); | ||
await this.requestPlayerData(); | ||
@@ -73,2 +84,3 @@ reject(`We are too far from ${target} to mluck.`); | ||
this.socket.removeListener("game_response", failCheck); | ||
this.socket.removeListener("player", selfMluckCheck); | ||
reject("We aren't a high enough level to use mluck."); | ||
@@ -81,6 +93,8 @@ } | ||
this.socket.removeListener("game_response", failCheck); | ||
this.socket.removeListener("player", selfMluckCheck); | ||
reject(`mluck timeout (${Constants_1.Constants.TIMEOUT}ms)`); | ||
}, Constants_1.Constants.TIMEOUT); | ||
this.socket.on("game_response", failCheck); | ||
this.socket.on("player", selfMluckCheck); | ||
this.socket.on("entities", mluckCheck); | ||
this.socket.on("game_response", failCheck); | ||
}); | ||
@@ -87,0 +101,0 @@ this.socket.emit("skill", { name: "mluck", id: target }); |
@@ -18,10 +18,2 @@ "use strict"; | ||
}); | ||
this.socket.on("welcome", () => { | ||
this.socket.emit("loaded", { | ||
height: 1080, | ||
width: 1920, | ||
scale: 2, | ||
success: 1 | ||
}); | ||
}); | ||
} | ||
@@ -35,3 +27,11 @@ async connect() { | ||
} | ||
resolve(); | ||
else { | ||
this.socket.emit("loaded", { | ||
height: 1080, | ||
width: 1920, | ||
scale: 2, | ||
success: 1 | ||
}); | ||
resolve(); | ||
} | ||
}); | ||
@@ -38,0 +38,0 @@ setTimeout(() => { |
{ | ||
"name": "alclient", | ||
"version": "0.3.9", | ||
"version": "0.3.10", | ||
"description": "A node client for interacting with Adventure Land - The Code MMORPG", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
498537
6643