Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Chaos Sanctuary Script Modified by SavSin @ Clan ChX v1.0.1
- //
- // Modifications:
- // Full support with modified *Passive Leech Script*
- // Added Custom Leech Commands.
- // Fixed Final Seal pop.
- // Added New Vars
- // Allows reverse Chaos (Infect, Desis, Vizor)
- // Added Giving waypoint at begining of round.
- //
- //
- // New Vars
- // NTConfig_CS_LeechSupTP - Text to bring leecher into the portal.
- // NTConfig_CS_LeechTown - Text to send leecher back to town.
- // NTConfig_CS_DiabloTP - Text to tell the leecher diablo's ready (hides leecher).
- // NTConfig_CS_DiabloDead - Tells leecher diablo is dead and will go to star to loot.
- // NTConfig_CS_DiabloText - Text Displayed to all for announcing Diablo is ready. (Must be different than NTConfig_CS_DiabloTP)
- // NTConfig_CS_GiveWaypoint - Gives the WP at the start of the run then Precasts and starts run.
- // How to use Passive Leech Support
- // NTConfig_LeechSupport must be set to TRUE
- // Configure the above new vars to your liking.
- // The bot will automatically make the TP's and send the commands as you have configed.
- function NTMain() {
- Include("libs/common/NTCommon.ntl");
- NTC_IncludeLibs();
- NTC_IncludeConfig("NTBot/char_configs");
- NT_LoadConfig();
- NTSI_LoadNIPFiles("NTBot/item_configs");
- NTA_Initialize();
- if(!NTTM_CheckAct()){
- NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
- return;
- }
- NTTMGR_TownManager();
- if(!NTTM_TownMove("waypoint")){
- NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
- return;
- }
- if(!NTM_TakeWaypoint(107)){
- NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
- return;
- }
- if(NTConfig_CS_GiveWaypoint)
- {
- PubTP();
- PubSay("Waypoint Up");
- }
- NTP_DoPrecast(true);
- if (!NTM_MoveTo(108, 7790, 5544)) {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
- return;
- }
- if(NTConfig_EvenFasterChaos){ // makes the addition of EvenFasterChaos a little bit easier.
- NTConfig_FastChaos = true;
- }
- if (!NTConfig_FastChaos) {
- if (NTConfig_Entrance) {
- NTCS_ClearPosition(30, EntranceSort);
- NTM_MoveTo(108, 7790, 5544);
- PubTP();
- PubSay(NTConfig_CS_EntranceTP);
- BO_Party();
- NTCS_ClearPosition(30, EntranceSort);
- var FrontToStarX = [7792,7794,7791,7777,7813,7769,7782,7802,7819,7768,7770,7791,7819, 7804];
- var FrontToStarY = [5564,5529,5495,5486,5486,5445,5421,5421,5446,5390,5355,5355,5376, 5340];
- for (var i = 0; i < FrontToStarX.length; i += 1) {
- NTM_MoveTo(108, FrontToStarX[i], FrontToStarY[i]);
- NTCS_ClearPosition(35, EntranceSort);
- }
- }
- for (i = 0; i < 2; i += 1) {
- NTM_MoveTo(108, 7784, 5310);
- NTCS_ClearPosition(30, SealSort);
- NTC_PingDelay(i < 1 ? 1000 : 10);
- }
- PubTP();
- PubSay(NTConfig_CS_StarTP);
- BO_Party();
- NTCS_ClearPosition(30, SealSort);
- } else {
- NTM_MoveTo(108, 7784, 5310);
- NTCS_ClearPosition(20, DistanceSort);
- PubTP();
- }
- if(NTConfig_CS_ReverseCS)
- {
- if(!NT_OpenSealsIntReverse())
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "NT_OpenSealsIntReverse()");
- return;
- }
- }
- else
- {
- if (!NT_OpenSealsInt())
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "NT_OpenSealsInt()");
- return;
- }
- }
- PubSay(NTConfig_CS_DiabloText);
- if (NTConfig_LeechSupport)
- {
- NTM_MoveTo(108, 7760, 5267);
- PubTP();
- PubSay(NTConfig_CS_DiabloTP);
- }
- NTM_MoveTo(108, 7792, 5291);
- for (i = 0; i < 200; i += 1) {
- if (GetUnit(NTC_UNIT_MONSTER, 243)) {
- break;
- }
- NTC_Delay(500);
- }
- if (!NTA_KillMonster(243)) {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTA_KillMonster()");
- return;
- }
- NTSI_PickItems();
- if (NTConfig_LeechSupport)
- {
- PubSay(NTConfig_CS_DiabloDead);
- }
- if (NTConfig_CS_NextGame != "") PubSay(NTConfig_CS_NextGame + NTC_GetNextGame());
- NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
- }
- function NT_OpenSealsInt() {
- var _unit;
- var _result;
- _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 396);
- if (!_unit) {
- return false;
- }
- if (_unit[0].roomy * 5 + _unit[0].y == 5275) {
- _result = NT_OpenVizierSealInt(1);
- } else {
- _result = NT_OpenVizierSealInt(2);
- }
- if (!NTConfig_FastChaos) {
- NTP_DoPrecast(true);
- }
- _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 394);
- if (_unit[0].roomx * 5 + _unit[0].x == 7773) {
- _result = NT_OpenDeSeisSealInt(1);
- } else {
- _result = NT_OpenDeSeisSealInt(2);
- }
- if (!_result) {
- return false;
- }
- if (!NTConfig_FastChaos) {
- PubTP();
- BO_Party();
- NTCS_ClearPosition(40, SealSortB);
- }
- _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 392);
- if (!_unit) {
- return false;
- }
- if (_unit[0].roomx * 5 + _unit[0].x == 7893) {
- _result = NT_OpenVenomSealInt(1);
- } else {
- _result = NT_OpenVenomSealInt(2);
- }
- NTP_DoPrecast(true);
- return _result;
- }
- function NT_OpenSealsIntReverse() {
- var _unit;
- var _result;
- _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 392);
- if (!_unit) {
- return false;
- }
- if (_unit[0].roomx * 5 + _unit[0].x == 7893) {
- _result = NT_OpenVenomSealInt(1);
- } else {
- _result = NT_OpenVenomSealInt(2);
- }
- NTP_DoPrecast(true);
- _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 394);
- if (_unit[0].roomx * 5 + _unit[0].x == 7773) {
- _result = NT_OpenDeSeisSealInt(1);
- } else {
- _result = NT_OpenDeSeisSealInt(2);
- }
- if (!_result) {
- return false;
- }
- _unit = GetPresetUnits(108, NTC_UNIT_OBJECT, 396);
- if (!_unit) {
- return false;
- }
- if (_unit[0].roomy * 5 + _unit[0].y == 5275) {
- _result = NT_OpenVizierSealInt(1);
- } else {
- _result = NT_OpenVizierSealInt(2);
- }
- if (!NTConfig_FastChaos) {
- NTP_DoPrecast(true);
- }
- return _result;
- }
- function NT_OpenVizierSealInt(type) {
- var i;
- if (!NTConfig_FastChaos) {
- if (type === 1) {
- var vx = [7767,7756,7744,7747,7750,7741,7729,7720,7720,7721,7719,7712,7700,7687,7676, 7666];
- var vy = [5292,5284,5275,5290,5303,5310,5314,5312,5301,5288,5273,5292,5294,5294,5292, 5307];
- }
- else
- {
- var vx = [7768,7755,7741,7733,7723,7714,7707,7680,7666, 7655];
- var vy = [5289,5295,5282,5291,5300,5282,5315,5310,5311, 5282];
- }
- for (i = 0; i < vx.length; i += 1) {
- NTM_MoveTo(108, vx[i], vy[i]);
- NTCS_ClearPosition(30, SealSort);
- }
- }
- if (NTConfig_LeechSupport)
- {
- if (type === 1)
- {
- NTM_MoveTo(108, 7672, 5283);
- NTCS_ClearPosition(25, DistanceSort);
- NTM_MoveTo(108, 7649, 5269);
- NTCS_ClearPosition(25, DistanceSort);
- }
- else
- {
- NTM_MoveTo(108, 7654, 5295);
- NTCS_ClearPosition(25, DistanceSort);
- NTM_MoveTo(108, 7647, 5274);
- NTCS_ClearPosition(25, DistanceSort);
- }
- PubTP();
- PubSay(NTConfig_CS_LeechSupTP);
- }
- if (!NT_OpenSealInt(396))
- {
- return false;
- }
- if (type == 1) {
- NTM_MoveTo(108, 7691, 5292);
- } else {
- NTM_MoveTo(108, 7695, 5316);
- }
- NTCS_Preattack(GetLocaleString(2851));
- if(!NTConfig_EvenFasterChaos)
- {
- NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 306 : null);
- }
- NTA_KillMonster(GetLocaleString(2851)); // Grand Vizier of Chaos
- if(!NTConfig_EvenFasterChaos)
- {
- NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 306 : null);
- }
- if(!NT_OpenSealInt(395))
- return false;
- if(NTConfig_LeechSupport)
- {
- PubSay(NTConfig_CS_LeechTown);
- }
- else
- {
- PubSay("Vizier dead.");
- }
- if(NTConfig_IdInField){
- NT_FieldID();
- } return true;
- }
- function NT_OpenDeSeisSealInt(type) {
- var i, n;
- if (!NTConfig_FastChaos) {
- if (type === 1) {
- var sx = [7791,7783,7800,7809,7785,7773,7773,7776,7794,7811,7817,7815,7798]; // Shape of "2"
- var sy = [5265,5256,5247,5232,5230,5222,5212,5194,5194,5193,5177,5157,5155];
- } else {
- var sx = [7786,7801,7786,7787,7810,7811,7810,7790,7774,7773,7794]; // shape of an "S" or "5"
- var sy = [5263,5249,5245,5227,5233,5215,5198,5194,5181,5156,5154];
- }
- for (var i = 0; i < sx.length; i += 1) {
- NTM_MoveTo(108, sx[i], sy[i]);
- NTCS_ClearPosition(30, type === 1 ? SealSort : SealSortB);
- }
- }
- if (NTConfig_LeechSupport) {
- if (type === 1) {
- NTM_MoveTo(108, 7794, 5155);
- NTCS_ClearPosition(25, DistanceSort);
- NTM_MoveTo(108, 7777, 5155);
- NTCS_ClearPosition(25, DistanceSort);
- } else {
- NTM_MoveTo(108, 7785, 5154);
- NTCS_ClearPosition(25, DistanceSort);
- NTM_MoveTo(108, 7811, 5155);
- NTCS_ClearPosition(25, DistanceSort);
- }
- PubTP();
- PubSay(NTConfig_CS_LeechSupTP);
- }
- if (!NT_OpenSealInt(394)) {
- return false;
- }
- if (type == 1) {
- NTM_MoveTo(108, 7797, 5201);
- for (i = 0; i < 3; i += 1) {
- NTM_TeleportTo(7794, 5227);
- }
- } else {
- NTM_MoveTo(108, 7798, 5186);
- }
- NTCS_Preattack(GetLocaleString(2852));
- if(!NTConfig_EvenFasterChaos){
- NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 310 : null);
- }
- NTA_KillMonster(GetLocaleString(2852)); // Lord De Seis
- if(!NTConfig_EvenFasterChaos){
- NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 310 : null);
- }
- if(NTConfig_LeechSupport)
- {
- PubSay(NTConfig_CS_LeechTown);
- }
- else
- {
- PubSay("De Seis dead.");
- }
- if(NTConfig_IdInField){
- NT_FieldID();
- } return NTM_MoveTo(108, 7800, 5255);
- }
- function NT_OpenVenomSealInt(type) {
- if (!NTConfig_FastChaos) {
- if (type === 1) {
- var IX = [7825,7827,7834,7845,7855,7852,7875,7896,7917]; // shape of a "t"
- var IY = [5293,5276,5291,5315,5301,5278,5293,5295,5291];
- } else {
- var IX = [7822,7826,7832,7850,7868,7877,7891,7907,7927,7932]; // looks like a hook
- var IY = [5297,5278,5307,5278,5297,5276,5276,5276,5279,5298];
- }
- for (var i = 0; i < IX.length; i += 1) {
- NTM_MoveTo(108, IX[i], IY[i]);
- NTCS_ClearPosition(30, type === 1 ? SealSort : SealSortB);
- }
- }
- if(NTConfig_LeechSupport) {
- if (type === 1) {
- NTM_MoveTo(108, 7898, 5296);
- NTCS_ClearPosition(25, DistanceSort);
- NTM_MoveTo(108, 7892, 5321);
- NTCS_ClearPosition(25, DistanceSort);
- } else {
- NTM_MoveTo(108, 7933, 5302);
- NTCS_ClearPosition(25, DistanceSort);
- NTM_MoveTo(108, 7909, 5313);
- NTCS_ClearPosition(25, DistanceSort);
- }
- PubTP();
- PubSay(NTConfig_CS_LeechSupTP);
- }
- if (!NT_OpenSealInt(392))
- {
- return false;
- }
- if (type === 1)
- {
- type = 1; // temp
- } else
- {
- NTM_MoveTo(108, 7933, 5299);
- }
- NTCS_Preattack(GetLocaleString(2853));
- if(!NTConfig_EvenFasterChaos){
- NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 362 : null);
- }
- NTA_KillMonster(GetLocaleString(2853)); // Infector of Souls
- if(!NTConfig_EvenFasterChaos){
- NTCS_ClearPosition(40, DistanceSort, NTConfig_FastChaos && !NTConfig_LeechSupport ? 0x10 : null, NTConfig_FastChaos && !NTConfig_LeechSupport ? 362 : null);
- }
- if(NTConfig_LeechSupport)
- {
- PubSay(NTConfig_CS_LeechTown);
- }
- else
- {
- PubSay("Infector Dead!");
- }
- if(!NT_OpenSealInt(393))
- return false;
- if(NTConfig_IdInField){
- NT_FieldID();
- }
- if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
- NTC_PingDelay(1000);
- } return true;
- }
- function NT_OpenSealInt(classid) {
- var warn;
- switch (classid) {
- case 396:
- case 394:
- case 392:
- warn = true;
- break;
- default:
- warn = false;
- break;
- }
- var i, seal;
- for (i = 0; i < 5; i += 1) {
- NTM_MoveToPresetUnit(108, 2, classid, classid === 394 ? 5 : 2, classid === 394 ? 5 : 0);
- seal = NTC_FindUnit(NTC_UNIT_OBJECT, classid);
- if (!seal) {
- return false;
- }
- if (seal.mode) { // for pubbies
- if (warn) {
- PubSay(NTConfig_CS_SealBasher);
- }
- return true;
- }
- warn = false;
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, seal);
- NTC_Delay(classid === 394 ? 1000 : 500);
- if (!seal.mode) {
- if (classid === 394 && CheckCollision(seal.x + 15, seal.y)) { // de seis optimization
- NTM_MoveTo(108, seal.x + 15, seal.y);
- } else {
- NTM_MoveTo(108, seal.x - 5, seal.y - 5);
- }
- NTC_Delay(500);
- } else {
- return true;
- }
- } return false;
- }
- function BO_Party() {
- if (NTConfig_PublicMode) {
- NTC_Delay(1000);
- }
- NTP_DoPrecast(true);
- }
- function NTC_GetNextGame() { // move this to ntc
- function Pad(num) {
- if (num < 10) {
- num = 0 + "" + num;
- }
- return num;
- }
- var i, result, number,
- game = me.gamename;
- for (i = game.length - 1; i > -1; i -= 1) {
- if (isNaN(game[i])) {
- break;
- }
- }
- result = game.substring(0, i + 1);
- number = parseInt(game.substring(i + 1), 10) === 99 ? 0 : (parseInt(game.substring(i + 1), 10) + 1); // 99 correction
- result += Pad(number);
- return result;
- }
- function NTA_MonsterStats(unit) {
- this.name = unit.name;
- this.x = unit.x;
- this.y = unit.y;
- this.gid = unit.gid;
- this.classid = unit.classid;
- this.spectype = unit.spectype;
- }
- function DistanceSort(unitA, unitB) {
- if (GetDistance(me.x, me.y, unitA.x, unitA.y) < GetDistance(me.x, me.y, unitB.x, unitB.y)) {
- return -1;
- }
- return 1;
- }
- function EntranceSort(unitA, unitB) {
- if (GetDistance(unitA.x, unitA.y, 7790, 5544) < GetDistance(unitB.x, unitB.y, 7790, 5544)) {
- return -1;
- }
- return 1;
- }
- function SealSort(unitA, unitB) {
- if (GetDistance(unitA.x, unitA.y, 7784, 5310) < GetDistance(unitB.x, unitB.y, 7784, 5310)) {
- return -1;
- }
- return 1;
- }
- function SealSortB(unitA, unitB) {
- if (GetDistance(unitA.x, unitA.y, 7800, 5255) < GetDistance(unitB.x, unitB.y, 7800, 5255)) {
- return -1;
- }
- return 1;
- }
- function NTCS_Preattack(name) {
- var i, n, target, pos, positions;
- target = NTC_FindUnit(1, name, 10);
- switch (me.classid) {
- case 0:
- break;
- case 1:
- break;
- case 2:
- break;
- case 3:
- if (!target) {
- return;
- }
- positions = [[6, 11], [0, 8], [8, -1], [-9, 2], [0, -11], [8, -8]];
- for (i = 0; i < positions.length; i += 1) {
- if (CheckCollision(me.areaid, target.x + positions[i][0], target.y + positions[i][1], 1)) { // check if we can move there
- NTM_MoveTo(108, target.x + positions[i][0], target.y + positions[i][1]);
- NTC_PutSkill(NTConfig_AttackSkill[2], NTC_HAND_RIGHT);
- for (n = 0; n < 8; n += 1) {
- NTC_CastSkill(NTConfig_AttackSkill[1], 2);
- }
- break;
- }
- }
- break;
- case 4:
- if (!target || NTConfig_AttackSkill[0] < 0) {
- return;
- }
- pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, 20, 4);
- if (pos) {
- NTM_MoveTo(108, pos[0], pos[1]);
- }
- for (i = 0; i < 2; i += 1) {
- NTC_CastSkill(130, NTC_HAND_RIGHT);
- NTC_Delay(150);
- }
- break;
- case 5:
- break;
- case 6:
- break;
- }
- }
- function PubTP() {
- if (NTConfig_PublicMode) {
- NTM_MakeTP();
- }
- }
- function PubSay(string) {
- if (NTConfig_PublicMode) {
- Say(string);
- }
- }
- function OpenStashes(range) {
- var i, unit,
- objects = [GetLocaleString(3274)],
- orgx = me.x,
- orgy = me.y;
- for (i = 0; i < objects.length; i += 1) {
- unit = NTC_FindUnit(NTC_UNIT_OBJECT, objects[i]);
- if (unit) {
- do {
- if (GetDistance(orgx, orgy, unit.x, unit.y) <= range) {
- if (NTC_OpenChest(unit)) {
- NTSI_PickItems();
- }
- }
- } while (unit.GetNext());
- }
- }
- }
- function NTT_CheckPotionSafe() {
- var i, items, hpCheck, mpCheck;
- items = me.GetItems();
- if (NTConfig_BeltColType.indexOf("hp") > -1) {
- for (i = 0; i < items.length; i += 1) {
- if (!hpCheck && items[i].mode === 2 && items[i].code.indexOf("hp") > -1) {
- hpCheck = true;
- }
- }
- } else {
- hpCheck = true;
- }
- if (NTConfig_BeltColType.indexOf("mp") > -1) {
- for (i = 0; i < items.length; i += 1) {
- if (!mpCheck && items[i].mode === 2 && items[i].code.indexOf("mp") > -1) {
- mpCheck = true;
- }
- }
- } else {
- mpCheck = true;
- }
- return !(hpCheck && mpCheck);
- }
- function NTA_Dodge(target, distance) {
- var i, j, coordx, coordy, monster, count,
- maxcount = 999,
- coords = [],
- goodCoords = [],
- monList = [],
- angles = [45, 90, 135, 180, 225, 270, 305, 360];
- for (i = 0; i < angles.length; i += 1) {
- coordx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * distance + target.x);
- coordy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * distance + target.y);
- if (CheckCollision(me.areaid, coordx, coordy, 1)) {
- coords.push([coordx, coordy]);
- }
- }
- if (coords.length === 0) { // no valid positions - don't move
- return true;
- }
- coords.sort(NTA_SortRooms);
- monster = GetUnit(1);
- if (monster) {
- do {
- if (monster.hp > 0) {
- monList.push(new NTA_MonsterStats(target));
- }
- } while (monster.GetNext());
- }
- for (i = 0; i < coords.length; i += 1) {
- count = 0;
- for (j = 0; j < monList.length; j += 1) {
- if (monList[j].hp > 0 && GetDistance(monList[j].x, monList[j].y, coords[i][0], coords[i][1]) < 10) {
- count += 1;
- }
- }
- if (count < maxcount) {
- goodCoords = [coords[i][0], coords[i][1]];
- maxcount = count;
- if (count === 0) {
- break;
- }
- }
- }
- if (goodCoords.length > 0) { // just in case goodCoords is empty (shouldn't happen)
- if (Math.abs(me.x - goodCoords[0]) < 3 && Math.abs(me.y - goodCoords[1]) < 3) { // close enough
- return true;
- }
- Say("!Dodge " + target.name);
- NTM_MoveTo(me.areaid, goodCoords[0], goodCoords[1]);
- }
- return true;
- }
- function NTCS_ClearPosition(range, sortFunc, spectype, classid) {
- var i, orgx, orgy, monList, ignoreList, target, result,
- gidAttack = [],
- dodgeIDs = [310, 362],
- attackcount = 0;
- if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
- return false;
- }
- switch (arguments.length) {
- case 0:
- range = 20;
- case 1:
- sortFunc = DistanceSort;
- case 2:
- spectype = false;
- case 3:
- classid = false;
- break;
- }
- orgx = me.x;
- orgy = me.y;
- ignoreList = [];
- MainLoop : while (attackcount < 300) {
- monList = [];
- target = NTC_FindUnit(NTC_UNIT_MONSTER);
- if (target) {
- do {
- if (target.IsAttackable()) {
- if ((me.classid === 1 || me.classid === 2 || me.classid === 6) && NTConfig_Dodge && GetDistance(me, target) < 7 && dodgeIDs.indexOf(target.classid) > -1) {
- NTA_Dodge(target, 15);
- continue MainLoop;
- }
- if (ignoreList.indexOf(target.gid) < 0 && GetDistance(orgx, orgy, target.x, target.y) <= range) {
- if (NTA_IsValidMonster(target)) {
- monList.push(new NTA_MonsterStats(target));
- } else {
- ignoreList.push(target.gid);
- }
- }
- }
- } while (target.GetNext());
- }
- if (monList.length === 0) {
- break;
- }
- monList.sort(sortFunc);
- target = NTC_FindUnit(NTC_UNIT_MONSTER, monList[0].gid);
- if (target && target.IsAttackable()) {
- result = NTA_Attack(target, attackcount % 30 === 0);
- switch (result) {
- case 1:
- monList.shift();
- ignoreList.push(target.gid);
- break;
- case 2:
- case 3:
- if(!gidAttack[target.gid]) {
- gidAttack[target.gid] = 0;
- }
- gidAttack[target.gid] += 1;
- if (gidAttack[target.gid] > NTConfig_LowMaxAttacks) {
- monList.shift();
- ignoreList.push(target.gid);
- }
- attackcount += 1;
- if (target.mode === 0 || target.mode === 12) {
- NTSI_FastPick();
- }
- break;
- default:
- return false;
- }
- } else {
- monList.shift();
- ignoreList.push(target.gid);
- }
- }
- switch (me.classid) {
- case NTC_CHAR_CLASS_PALADIN:
- if (attackcount > 2 && (parseInt(me.hp * 100/ me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp * 100 / me.mpmax) < NTConfig_UseRedemptionMP)) {
- if (NTC_PutSkill(124, NTC_HAND_RIGHT)) {
- NTC_PingDelay(1000);
- }
- }
- break;
- case NTC_CHAR_CLASS_NECROMANCER:
- if (typeof(NTA_SkeletonArmy) === 'function') { // old summon code
- NTA_SkeletonArmy(NTConfig_SkeletonArmy);
- NTA_MageArmy(NTConfig_MageArmy);
- NTA_ReviveArmy(NTConfig_ReviveArmy);
- } else {
- NTA_RaiseArmy(); // new summon code
- }
- break;
- case NTC_CHAR_CLASS_SORCERESS:
- if (me.GetState(30) === 0) {
- NTC_CastSkill(58, NTC_HAND_RIGHT);
- }
- break;
- case NTC_CHAR_CLASS_BARBARIAN:
- if (attackcount > 0) {
- if (typeof(MWL_FindItem) === 'function') { // in case of using muddy's item find (like myself)
- MWL_FindItem(20);
- } else if (NTConfig_UseFindItem && !NTA_CheckForCloseMonsters(10)) {
- NTA_FindItem(NTConfig_FindItemRange);
- }
- }
- break;
- }
- if (attackcount > 0) {
- NTSI_PickItems();
- }
- if (NTConfig_OpenChest) {
- OpenStashes(range);
- }
- if (NTT_CheckMerc()) {
- NTTMGR_VisitTown();
- }
- if (NTT_CheckPotionSafe()) {
- NTTMGR_VisitTown();
- }
- if (NTConfig_IdInField) {
- if (!NTT_CheckSpace(NTConfig_FreeSpaceXY[0], NTConfig_FreeSpaceXY[1])) {
- NT_FieldID();
- }
- } return true;
- }
- function NTA_SortRooms(a, b) {
- if (GetDistance(me.x, me.y, a[0], a[1]) < GetDistance(me.x, me.y, b[0], b[1])) {
- return -1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement