From da8cb5928b32ec1fb6ea18dee79115b7c8407276 Mon Sep 17 00:00:00 2001 From: Whyy0416 Date: Wed, 7 Aug 2019 01:46:11 +0800 Subject: [PATCH 1/5] Update Attack.js --- d2bs/kolbot/libs/common/Attack.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/d2bs/kolbot/libs/common/Attack.js b/d2bs/kolbot/libs/common/Attack.js index c4138b8e6..4eaef0de5 100644 --- a/d2bs/kolbot/libs/common/Attack.js +++ b/d2bs/kolbot/libs/common/Attack.js @@ -233,6 +233,8 @@ var Attack = { if (Config.MFLeader) { Pather.makePortal(); + Pather.TeamCheck(1); //add by WhyY0416 + delay(1000); say("kill " + classId); } @@ -298,6 +300,10 @@ var Attack = { throw new Error("Failed to kill " + target.name + errorInfo); } + if (Config.MFLeader) { + Pather.TeamCheck(2); + } + return true; }, @@ -384,6 +390,8 @@ var Attack = { if (Config.MFLeader && !!bossId) { Pather.makePortal(); + Pather.TeamCheck(1); //add by WhyY0416 + delay(1000); say("clear " + bossId); } @@ -556,6 +564,10 @@ var Attack = { if (attackCount > 0 && pickit) { Pickit.pickItems(); } + + if (Config.MFLeader && !!bossId) { + Pather.TeamCheck(2); + } return true; }, @@ -858,7 +870,9 @@ var Attack = { clearLevel: function (spectype) { if (Config.MFLeader) { Pather.makePortal(); - say("clearlevel " + getArea().name); + Pather.TeamCheck(1); //add by WhyY0416 + delay(1000); + say("clearlevel"); //dhd enable unique name for tombs } var room, result, rooms, myRoom, currentArea, previousArea; @@ -920,6 +934,9 @@ var Attack = { } //this.storeStatistics(Pather.getAreaName(me.area)); + if (Config.MFLeader) { + Pather.TeamCheck(2); + } return true; }, @@ -1620,4 +1637,4 @@ AuraLoop: // Skip monsters with auras return false; } -}; \ No newline at end of file +}; From a82845ee6af5851172597f3abb539322ac01ecee Mon Sep 17 00:00:00 2001 From: Whyy0416 Date: Wed, 7 Aug 2019 01:48:30 +0800 Subject: [PATCH 2/5] Update Pather.js --- d2bs/kolbot/libs/common/Pather.js | 76 ++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/d2bs/kolbot/libs/common/Pather.js b/d2bs/kolbot/libs/common/Pather.js index f9514dea0..497123d50 100644 --- a/d2bs/kolbot/libs/common/Pather.js +++ b/d2bs/kolbot/libs/common/Pather.js @@ -1578,6 +1578,80 @@ MainLoop: return true; }, + /* + Pather.TeamCheck(); + Make Leader communication to others. Add by WhyY0416 + */ + TeamCheck: function (phase) { + var MemberCount = 0, + Member = [], + timeOut = 600; //How to put this in character's config ? + + function ChatEvent(name,msg) { + if (me.name !== name){ + var i, command, + match = ["Ready","Finished"]; + + if (msg) { + for (i = 0; i < match.length; i += 1) { + if (msg.match(match[i])) { + if(Member.indexOf(name) > -1){ + continue; + } + else{ + Member.push(name); + break; + } + } + } + } + } + } + + addEventListener("chatmsg", ChatEvent); + + if (me.area === 108){ //Diablo Script. + return true; + } + + if (!party = getParty()){ //single playermode. + return true; + } + else if (MemberCount === 0){ //Except MFLeader!!! + do { + if (party.name !== me.name){ + MemberCount += 1; + } + } + while (party.getNext()); + } + + if (phase === 1){ + say("Position " + getArea().id); + delay(1000); + } + + +MainLoop: + while (timeOut > 0){ + if (Member.length === MemberCount){ + break MainLoop; + } + if (timeOut % 5 === 0){ + if (phase === 1){ + say("TeamCheck"); + } + else if (phase === 2){ + say("FinishCheck"); + } + } + timeOut -= 1; + delay(1000); + } + Member.length = 0; + return true; + }, + /* Pather.getAreaName(area); area - id of the area to get the name for @@ -1724,4 +1798,4 @@ MainLoop: return areas[area]; } -}; \ No newline at end of file +}; From 720da051140519d5aa08830a8063b88a1989f9c9 Mon Sep 17 00:00:00 2001 From: Whyy0416 Date: Wed, 7 Aug 2019 01:49:00 +0800 Subject: [PATCH 3/5] Update MFHelper.js --- d2bs/kolbot/libs/bots/MFHelper.js | 42 +++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/d2bs/kolbot/libs/bots/MFHelper.js b/d2bs/kolbot/libs/bots/MFHelper.js index e59b5aabf..44e07495d 100644 --- a/d2bs/kolbot/libs/bots/MFHelper.js +++ b/d2bs/kolbot/libs/bots/MFHelper.js @@ -5,14 +5,14 @@ */ function MFHelper() { - var i, player, playerAct, split, + var i, player, playerAct, split, LeaderArea, oldCommand = "", command = ""; function ChatEvent(name, msg) { if (!player) { var i, - match = ["kill", "clearlevel", "clear", "quit", "cows", "council"]; + match = ["kill", "clearlevel", "clear", "quit", "cows", "council", "TeamCheck","FinishCheck"]; if (msg) { for (i = 0; i < match.length; i += 1) { @@ -26,6 +26,9 @@ function MFHelper() { } if (player && name === player.name) { + if (msg.match("Position ")){ + LeaderArea = msg.split("Position ")[1]; + } command = msg; } } @@ -184,8 +187,9 @@ MainLoop: split = command.split("kill ")[1]; - for (i = 0; i < 5; i += 1) { - if (Pather.usePortal(player.area, player.name)) { + for (i = 0; i < 30; i += 1) { + if (Pather.usePortal(LeaderArea, player.name)) { + delay(500); break; } @@ -217,8 +221,9 @@ MainLoop: } else if (command.indexOf("clearlevel") > -1) { print("ÿc4MFHelperÿc0: Clear Level"); - for (i = 0; i < 5; i += 1) { - if (Pather.usePortal(player.area, player.name)) { + for (i = 0; i < 30; i += 1) { + if (Pather.usePortal(LeaderArea, player.name)) { + delay(500); break; } @@ -241,8 +246,9 @@ MainLoop: split = command.split("clear ")[1]; - for (i = 0; i < 5; i += 1) { - if (Pather.usePortal(player.area, player.name)) { + for (i = 0; i < 30; i += 1) { + if (Pather.usePortal(LeaderArea, player.name)) { + delay(500); break; } @@ -275,8 +281,9 @@ MainLoop: } else if (command.indexOf("cows") > -1) { print("ÿc4MFHelperÿc0: Clear Cows"); - for (i = 0; i < 5; i += 1) { + for (i = 0; i < 30; i += 1) { if (Town.goToTown(1) && Pather.usePortal(39)) { + delay(500); break; } @@ -297,8 +304,9 @@ MainLoop: } else if (command.indexOf("council") > -1) { print("ÿc4MFHelperÿc0: Kill Council"); - for (i = 0; i < 5; i += 1) { + for (i = 0; i < 30; i += 1) { if (Pather.usePortal(player.area, player.name)) { + delay(500); break; } @@ -315,6 +323,18 @@ MainLoop: } else { print("Failed to use portal."); } + } else if (command.indexOf("TeamCheck") > -1 ) { + say("Ready"); + delay(1000); + if (!me.inTown){ + Town.goToTown; + } + } else if (command.indexOf("FinishCheck") > -1){ + say("Finished"); + delay(1000); + if (!me.inTown){ + Town.goToTown; + } } } } @@ -323,4 +343,4 @@ MainLoop: } return true; -} \ No newline at end of file +} From 0358d10b3ed99dbb9df5ef898e1bcbaaf29bf958 Mon Sep 17 00:00:00 2001 From: Whyy0416 Date: Wed, 7 Aug 2019 17:21:23 +0800 Subject: [PATCH 4/5] Update Pather.js --- d2bs/kolbot/libs/common/Pather.js | 110 +++++++++++++++--------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/d2bs/kolbot/libs/common/Pather.js b/d2bs/kolbot/libs/common/Pather.js index 497123d50..e76a11d8a 100644 --- a/d2bs/kolbot/libs/common/Pather.js +++ b/d2bs/kolbot/libs/common/Pather.js @@ -1583,74 +1583,74 @@ MainLoop: Make Leader communication to others. Add by WhyY0416 */ TeamCheck: function (phase) { - var MemberCount = 0, - Member = [], - timeOut = 600; //How to put this in character's config ? + var MemberCount = 0, + Member = [], + timeOut = 600; //How to put this in character's config ? function ChatEvent(name,msg) { - if (me.name !== name){ - var i, command, - match = ["Ready","Finished"]; + if (me.name !== name){ + var i, command, + match = ["Ready","Finished"]; - if (msg) { - for (i = 0; i < match.length; i += 1) { - if (msg.match(match[i])) { - if(Member.indexOf(name) > -1){ - continue; - } - else{ - Member.push(name); - break; - } - } - } - } + if (msg) { + for (i = 0; i < match.length; i += 1) { + if (msg.match(match[i])) { + if(Member.indexOf(name) > -1){ + continue; + } + else{ + Member.push(name); + break; + } + } + } + } } - } + } - addEventListener("chatmsg", ChatEvent); + addEventListener("chatmsg", ChatEvent); - if (me.area === 108){ //Diablo Script. - return true; - } + if (me.area === 108){ //Diablo Script. + return true; + } - if (!party = getParty()){ //single playermode. - return true; - } - else if (MemberCount === 0){ //Except MFLeader!!! - do { - if (party.name !== me.name){ - MemberCount += 1; - } + if (!party = getParty()){ //single playermode. + return true; + } + else if (MemberCount === 0){ //Except MFLeader!!! + do { + if (party.name !== me.name){ + MemberCount += 1; } - while (party.getNext()); } - - if (phase === 1){ - say("Position " + getArea().id); - delay(1000); + while (party.getNext()); } + + if (phase === 1){ + say("Position " + getArea().id); + delay(1000); + } MainLoop: - while (timeOut > 0){ - if (Member.length === MemberCount){ - break MainLoop; - } - if (timeOut % 5 === 0){ - if (phase === 1){ - say("TeamCheck"); - } - else if (phase === 2){ - say("FinishCheck"); - } - } - timeOut -= 1; - delay(1000); - } - Member.length = 0; - return true; - }, + while (timeOut > 0){ + if (Member.length === MemberCount){ + break MainLoop; + } + if (timeOut % 5 === 0){ + if (phase === 1){ + say("TeamCheck"); + } + else if (phase === 2){ + say("FinishCheck"); + } + } + timeOut -= 1; + delay(1000); + } + Member.length = 0; + return true; + }, /* Pather.getAreaName(area); From 4f69a6a4234012265c46cf8bedfffb31e1b78f24 Mon Sep 17 00:00:00 2001 From: Whyy0416 Date: Wed, 7 Aug 2019 22:08:10 +0800 Subject: [PATCH 5/5] Update Pather.js --- d2bs/kolbot/libs/common/Pather.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/d2bs/kolbot/libs/common/Pather.js b/d2bs/kolbot/libs/common/Pather.js index e76a11d8a..ebff056b4 100644 --- a/d2bs/kolbot/libs/common/Pather.js +++ b/d2bs/kolbot/libs/common/Pather.js @@ -1614,17 +1614,18 @@ MainLoop: return true; } - if (!party = getParty()){ //single playermode. - return true; - } - else if (MemberCount === 0){ //Except MFLeader!!! + if (MemberCount === 0){ //Except MFLeader!!! + var party = getParty(); do { if (party.name !== me.name){ MemberCount += 1; } } while (party.getNext()); - } + if (!party){ //single playermode. + return true; + } + } if (phase === 1){ say("Position " + getArea().id);