-
Notifications
You must be signed in to change notification settings - Fork 331
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
Add red portal use in Summoner + minor fix #1419
Conversation
There is one bug left with Warriv: |
Hmm this is odd, I'll look into it. The spaces you had previously were correct, feel free to put them back. |
d2bs/kolbot/libs/common/Town.js
Outdated
@@ -67,13 +67,18 @@ var Town = { | |||
|
|||
// Do town chores | |||
doChores: function (repair = false) { | |||
var i, | |||
cancelFlags = [0x01, 0x02, 0x04, 0x08, 0x14, 0x16, 0x0c, 0x0f, 0x19, 0x1a], | |||
npc = getUnit(1, "warriv"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use NPC.Warriv variable for npc name to ensure compatibility with different locales.
|
||
for (i = 0; i < 12; i += 1) { | ||
if (me.area === targetArea || me.dead) { | ||
break; | ||
} | ||
|
||
if (me.inTown) { | ||
if (me.area === 40 && npc && getDistance(me, npc) < 50) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
npc isn't defined here.
d2bs/kolbot/libs/common/Town.js
Outdated
} else if (me.area === 40 && npc && getDistance(me, npc) < 50) { | ||
if (npc.openMenu()) { | ||
Misc.useMenu(0x0D37); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While using warriv to travel to A1 for chores may save time in common cases, it changes behavior for bots that may expect to be on current act for other tasks. Most definitely this isn't desired behavior for bots on normal difficulty because pots are lower tiered in a1.
d2bs/kolbot/libs/common/Loader.js
Outdated
} | ||
|
||
if (townCheck) { | ||
print("ÿc2Starting script: ÿc9" + i); | ||
//scriptBroadcast(JSON.stringify({currScript: i})); | ||
Messaging.sendToScript("tools/toolsthread.js", JSON.stringify({currScript: i})); | ||
this.scriptIndex++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider the following refactor:
for (s in Scripts) {
if (Scripts[s]) {
scriptList.push(s);
}
}
for (this.scriptIndex = 0; this.scriptIndex < charScripts.length; this.scriptIndex++) {
script = this.scriptList[this.scriptIndex];
if (this.fileList.indexOf(script) < 0) {
Misc.errorReport("ÿc1Script " + script + " doesn't exist.");
continue;
}
if (!include("bots/" + script + ".js")) {
Misc.errorReport("Failed to include script: " + script);
continue;
}
if (isIncluded("bots/" + script + ".js")) {
try {
if (typeof (global[script]) !== "function") {
throw new Error("Invalid script function name");
}
if (this.skipTown.indexOf(script) > -1 || Town.goToTown()) {
print("ÿc2Starting script: ÿc9" + script);
//scriptBroadcast(JSON.stringify({currScript: script}));
Messaging.sendToScript("tools/toolsthread.js", JSON.stringify({currScript: script}));
reconfiguration = typeof Scripts[script] === 'object';
if (reconfiguration) {
print("ÿc2Copying Config properties from " + script + " object.");
this.copy(Scripts[script], Config);
}
global[script]();
if (reconfiguration) {
print("ÿc2Reverting back unmodified config properties.");
this.copy(unmodifiedConfig, Config);
}
}
} catch (error) {
Misc.errorReport(error, script);
}
}
}
change existing scriptList to fileList
move charScripts from scriptName to main function, rename charScripts to scriptList
change the loader loop from what it is to for loop using new scriptList you have created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, modifications done
Looks good to me. Thanks. |
* Summoner script now uses red portal to move to Duriel * Change attack function in Andariel and Duriel for classic compatibility * Use Warriv to move to act 1 if game starts in act 2 * always precast at duriel start * Remove warriv use in doChores + revisions * Loader refactoring * scriptName now returns null instead of undefined
* Summoner script now uses red portal to move to Duriel * Change attack function in Andariel and Duriel for classic compatibility * Use Warriv to move to act 1 if game starts in act 2 * always precast at duriel start * Remove warriv use in doChores + revisions * Loader refactoring * scriptName now returns null instead of undefined
* Summoner script now uses red portal to move to Duriel * Change attack function in Andariel and Duriel for classic compatibility * Use Warriv to move to act 1 if game starts in act 2 * always precast at duriel start * Remove warriv use in doChores + revisions * Loader refactoring * scriptName now returns null instead of undefined
* Summoner script now uses red portal to move to Duriel * Change attack function in Andariel and Duriel for classic compatibility * Use Warriv to move to act 1 if game starts in act 2 * always precast at duriel start * Remove warriv use in doChores + revisions * Loader refactoring * scriptName now returns null instead of undefined
Summoner.js, Duriel.js, Loader.js
Andariel.js, Duriel.js
Town.js, Pather.js