Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MercAutoEquip #1141

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Binary file modified d2bs/D2BS.bin
Binary file not shown.
Binary file modified d2bs/D2BS.dll
Binary file not shown.
Binary file modified d2bs/D2BS.pdb
Binary file not shown.
35 changes: 33 additions & 2 deletions d2bs/kolbot/D2BotChannel.dbj
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var gameStart, handle, ingame, firstLogin, useChat,
gameCount = DataFile.getStats().runs + 1,
channelTick = getTickCount(),
lastGameStatus = "ready",
loginRetry = 0,
fListTick = 0,
retry = 0,
badGames = [],
Expand Down Expand Up @@ -273,15 +274,20 @@ function main() {
}

function locationAction(location) {
var i, n, string, text, regex, fullText, lines;
var i, n, string, control, text, regex, fullText, lines;

MainSwitch:
switch (location) {
case 0:
ControlAction.click();

break;
case 1: // Lobby
D2Bot.updateStatus("Lobby");

me.blockKeys = false;
loginRetry = 0;

if (!firstLogin) {
firstLogin = true;
}
Expand Down Expand Up @@ -514,7 +520,32 @@ MainLoop:
try {
login(me.profile);
} catch (e) {
print(e);
if (getLocation() === 12 && loginRetry < 2) {
if (loginRetry === 0) {
// start from beginning of the char list
sendKey(0x24);
}

control = getControl(4, 237, 457, 72, 93); // char on 1st column, 4th row

if (control) {
me.blockMouse = true;
me.blockKeys = true;

control.click();
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);

me.blockMouse = false;
}

loginRetry++;
} else {
me.blockKeys = false;
print(e + " " + getLocation());
}
}

break;
Expand Down
35 changes: 33 additions & 2 deletions d2bs/kolbot/D2BotFollow.dbj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ include("common/misc.js");
var i, j, gameInfo, joinInfo, gameStart, ingame, handle,
firstLogin, chatActionsDone, lastGameTick, connectFail,
gameCount = DataFile.getStats().runs + 1,
loginRetry = 0,
lastGameStatus = "ready",
leader = "",
lastGame = [];
Expand Down Expand Up @@ -278,17 +279,22 @@ function locationAction () {
return;
}

var i, string, text, location;
var i, string, control, text, location;

location = getLocation();

MainSwitch:
switch (location) {
case 0:
ControlAction.click();

break;
case 1: // Lobby
D2Bot.updateStatus("Lobby");

me.blockKeys = false;
loginRetry = 0;

if (!firstLogin) {
firstLogin = true;
}
Expand Down Expand Up @@ -490,7 +496,32 @@ JoinLoop2:
try {
login(me.profile);
} catch (e) {
print(e + " " + getLocation());
if (getLocation() === 12 && loginRetry < 2) {
if (loginRetry === 0) {
// start from beginning of the char list
sendKey(0x24);
}

control = getControl(4, 237, 457, 72, 93); // char on 1st column, 4th row

if (control) {
me.blockMouse = true;
me.blockKeys = true;

control.click();
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);

me.blockMouse = false;
}

loginRetry++;
} else {
me.blockKeys = false;
print(e + " " + getLocation());
}
}

break;
Expand Down
33 changes: 32 additions & 1 deletion d2bs/kolbot/D2BotLead.dbj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ if (!FileTools.exists("data/" + me.profile + ".json")) {
var gameInfo, gameStart, ingame, chatActionsDone, pingQuit,
handle, useChat, firstLogin, connectFail,
gameCount = DataFile.getStats().runs + 1,
loginRetry = 0,
lastGameStatus = "ready",
isUp = "no",
chanInfo = {
Expand Down Expand Up @@ -332,10 +333,15 @@ function locationAction(location) {
MainSwitch:
switch (location) {
case 0:
ControlAction.click();

break;
case 1: // Lobby
D2Bot.updateStatus("Lobby");

me.blockKeys = false;
loginRetry = 0;

if (!firstLogin) {
firstLogin = true;
}
Expand Down Expand Up @@ -597,7 +603,32 @@ MainSwitch:
try {
login(me.profile);
} catch (e) {
print(e + " " + getLocation());
if (getLocation() === 12 && loginRetry < 2) {
if (loginRetry === 0) {
// start from beginning of the char list
sendKey(0x24);
}

control = getControl(4, 237, 457, 72, 93); // char on 1st column, 4th row

if (control) {
me.blockMouse = true;
me.blockKeys = true;

control.click();
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);

me.blockMouse = false;
}

loginRetry++;
} else {
me.blockKeys = false;
print(e + " " + getLocation());
}
}

break;
Expand Down
35 changes: 33 additions & 2 deletions d2bs/kolbot/D2BotPubJoin.dbj
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ var gameInfo, gameStart, ingame, chatActionsDone, pingQuit,
handle, useChat, firstLogin, connectFail, lastGameTick,
gameCount = DataFile.getStats().runs + 1,
lastGameStatus = "ready",
loginRetry = 0,
loginFail = 0,
isUp = "no",
chanInfo = {
Expand Down Expand Up @@ -357,15 +358,20 @@ function main() {
}

function locationAction(location) {
var i, string, text, gameToJoin, doneGames, gameList;
var i, string, control, text, gameToJoin, doneGames, gameList;

MainSwitch:
switch (location) {
case 0:
ControlAction.click();

break;
case 1: // Lobby
D2Bot.updateStatus("Lobby");

me.blockKeys = false;
loginRetry = 0;

if (!firstLogin) {
firstLogin = true;
}
Expand Down Expand Up @@ -524,7 +530,32 @@ MainSwitch:
try {
login(me.profile);
} catch (e) {
print(e + " " + getLocation());
if (getLocation() === 12 && loginRetry < 2) {
if (loginRetry === 0) {
// start from beginning of the char list
sendKey(0x24);
}

control = getControl(4, 237, 457, 72, 93); // char on 1st column, 4th row

if (control) {
me.blockMouse = true;
me.blockKeys = true;

control.click();
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);
sendKey(0x28);

me.blockMouse = false;
}

loginRetry++;
} else {
me.blockKeys = false;
print(e + " " + getLocation());
}
}

break;
Expand Down
2 changes: 1 addition & 1 deletion d2bs/kolbot/libs/AutoMule.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ MainLoop:
this.baseGids = [];

for (i = 0; i < Config.Runewords.length; i += 1) {
base = Runewords.getBase(Config.Runewords[i][0], Config.Runewords[i][1]) || Runewords.getBase(Config.Runewords[i][0], Config.Runewords[i][1], true);
base = Runewords.getBase(Config.Runewords[i][0], Config.Runewords[i][1], (Config.Runewords[i][2]||0)) || Runewords.getBase(Config.Runewords[i][0], Config.Runewords[i][1], (Config.Runewords[i][2]||0), true);

if (base) {
this.baseGids.push(base.gid);
Expand Down
18 changes: 12 additions & 6 deletions d2bs/kolbot/libs/GameAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ var GameAction = {
},

getItemDesc: function (unit, logIlvl) {
var i, desc,
var i, desc, index,
stringColor = "";

if (logIlvl === undefined) {
Expand All @@ -128,14 +128,20 @@ var GameAction = {

i -= 1;
} else {
if (desc[i].match(/^(y|ÿ)c/)) {
stringColor = desc[i].substring(0, 4);
} else {
// Add color info
if (!desc[i].match(/^(y|ÿ)c/)) {
desc[i] = stringColor + desc[i];
}

// Find and store new color info
index = desc[i].lastIndexOf("ÿc");

if (index > -1) {
stringColor = desc[i].substring(index, index + "ÿ".length + 2);
}
}

desc[i] = desc[i].replace(/(y|ÿ)c([0-9!"+<;.*])/g, "\\xffc$2").replace("ÿ", "\\xff", "g");
desc[i] = desc[i].replace(/(y|ÿ)c([0-9!"+<:;.*])/g, "\\xffc$2").replace("ÿ", "\\xff", "g");
}

if (logIlvl && desc[desc.length - 1]) {
Expand Down Expand Up @@ -247,7 +253,7 @@ var GameAction = {
var i, code, desc, sock,
header = "",
color = -1,
name = unit.itemType + "_" + unit.fname.split("\n").reverse().join(" ").replace(/(y|ÿ)c[0-9!"+<;.*]|\/|\\/, "").trim();
name = unit.itemType + "_" + unit.fname.split("\n").reverse().join(" ").replace(/(y|ÿ)c[0-9!"+<:;.*]|\/|\\/g, "").trim();

desc = this.getItemDesc(unit, logIlvl) + "$" + unit.gid + ":" + unit.classid + ":" + unit.location + ":" + unit.x + ":" + unit.y + (unit.getFlag(0x400000) ? ":eth" : "");
color = unit.getColor();
Expand Down
18 changes: 12 additions & 6 deletions d2bs/kolbot/libs/MuleLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var MuleLogger = {

// don't edit
getItemDesc: function (unit, logIlvl) {
var i, desc,
var i, desc, index,
stringColor = "";

if (logIlvl === undefined) {
Expand All @@ -47,14 +47,20 @@ var MuleLogger = {

i -= 1;
} else {
if (desc[i].match(/^(y|ÿ)c/)) {
stringColor = desc[i].substring(0, 4);
} else {
// Add color info
if (!desc[i].match(/^(y|ÿ)c/)) {
desc[i] = stringColor + desc[i];
}

// Find and store new color info
index = desc[i].lastIndexOf("ÿc");

if (index > -1) {
stringColor = desc[i].substring(index, index + "ÿ".length + 2);
}
}

desc[i] = desc[i].replace(/(y|ÿ)c([0-9!"+<;.*])/g, "\\xffc$2").replace("ÿ", "\\xff", "g");
desc[i] = desc[i].replace(/(y|ÿ)c([0-9!"+<:;.*])/g, "\\xffc$2").replace("ÿ", "\\xff", "g");
}

if (logIlvl && desc[desc.length - 1]) {
Expand Down Expand Up @@ -122,7 +128,7 @@ var MuleLogger = {
var i, code, desc, sock,
header = "",
color = -1,
name = unit.itemType + "_" + unit.fname.split("\n").reverse().join(" ").replace(/(y|ÿ)c[0-9!"+<;.*]|\/|\\/, "").trim();
name = unit.itemType + "_" + unit.fname.split("\n").reverse().join(" ").replace(/(y|ÿ)c[0-9!"+<:;.*]|\/|\\/g, "").trim();

desc = this.getItemDesc(unit, logIlvl) + "$" + unit.gid + ":" + unit.classid + ":" + unit.location + ":" + unit.x + ":" + unit.y + (unit.getFlag(0x400000) ? ":eth" : "");
color = unit.getColor();
Expand Down
Loading