Skip to content

Commit

Permalink
Add code check for items and fix moveToExit (#1367)
Browse files Browse the repository at this point in the history
-add unit code check for possible base stat name duplicates
-fix movetoExit to work properly for array of target areas
-fix gate opening in a5 which continued to re-click when it was already in opening animation
  • Loading branch information
imbalanced authored and noah- committed Mar 23, 2019
1 parent c3bf745 commit 71e502f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion d2bs/kolbot/libs/GameAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ var GameAction = {
break;
case 7: // Unique
for (i = 0; i < 401; i += 1) {
if (unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
if (unit.code === getBaseStat(17, i, 4).trim() && unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
code = getBaseStat(17, i, "invfile");

break;
Expand Down
2 changes: 1 addition & 1 deletion d2bs/kolbot/libs/MuleLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ var MuleLogger = {
break;
case 7: // Unique
for (i = 0; i < 401; i += 1) {
if (unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
if (unit.code === getBaseStat(17, i, 4).trim() && unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
code = getBaseStat(17, i, "invfile");

break;
Expand Down
5 changes: 1 addition & 4 deletions d2bs/kolbot/libs/bots/Travincal.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ function Travincal() {

// Stack Merc
if (me.classid === 4 && !me.getSkill(54, 1) && me.gametype === 1) {
// WAR - moveToExit needs to be fixed
Pather.moveToExit(100, true);
delay(me.ping*2 + 100);
Pather.moveToExit(83, true);
Pather.moveToExit([100, 83], true);
}

if (Config.MFLeader) {
Expand Down
4 changes: 2 additions & 2 deletions d2bs/kolbot/libs/common/Misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ var Misc = {
break;
case 7: // Unique
for (i = 0; i < 401; i += 1) {
if (unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
if (unit.code === getBaseStat(17, i, 4).trim() && unit.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
code = getBaseStat(17, i, "invfile");

break;
Expand Down Expand Up @@ -2194,7 +2194,7 @@ var Packet = {
return true;
}

if (getInteractedNPC()) {
if (getInteractedNPC() && getTickCount() - tick > 1000) {
me.cancel();
}

Expand Down
8 changes: 6 additions & 2 deletions d2bs/kolbot/libs/common/Pather.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ ModeLoop:

break;
case 2: // stairs
if (!this.openExit(targetArea) && !this.useUnit(5, currExit.tileid, areas[i])) {
if (!this.openExit(areas[i]) && !this.useUnit(5, currExit.tileid, areas[i])) {
return false;
}

Expand Down Expand Up @@ -1394,13 +1394,17 @@ MainLoop:

if (unit) {
for (i = 0; i < 3; i += 1) {
if (unit.mode) {
break;
}

Misc.click(0, 0, unit);
//unit.interact();

tick = getTickCount();

while (getTickCount() - tick < 3000) {
if (unit.mode === 2) {
if (unit.mode) {
delay(1000);

break;
Expand Down
4 changes: 2 additions & 2 deletions d2bs/kolbot/libs/common/Prototypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Unit.prototype.openMenu = function (addDelay) {
return true;
}

if (getInteractedNPC()) {
if (getInteractedNPC() && getTickCount() - tick > 1000) {
me.cancel();
}

Expand Down Expand Up @@ -1018,7 +1018,7 @@ Unit.prototype.getColor = function () {
}
} else if (this.quality === 7) { // Unique
for (i = 0; i < 401; i += 1) {
if (this.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
if (this.code === getBaseStat(17, i, 4).replace(/^\s+|\s+$/g, "") && this.fname.split("\n").reverse()[0].indexOf(getLocaleString(getBaseStat(17, i, 2))) > -1) {
return getBaseStat(17, i, 13) > 20 ? -1 : getBaseStat(17, i, 13);
}
}
Expand Down

0 comments on commit 71e502f

Please sign in to comment.