Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var NTConfig_Entrance = false;
- function NTMain() {
- Include("libs/common/NTCommon.ntl");
- NTC_IncludeLibs();
- NTC_IncludeConfig("NTBot/char_configs");
- NT_LoadConfig();
- NTSI_LoadNIPFiles("NTBot/item_configs");
- NTA_Initialize();
- Print(COLOR_3 + "Starting Diablo Script");
- if(!NTTM_CheckAct()){
- NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
- return;
- }
- NTTMGR_TownManager();
- Print(COLOR_8 + "Going to River of Flame");
- if(!NTTM_TownMove("waypoint")){
- NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
- return;
- }
- if(!NTM_TakeWaypoint(107)){
- NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
- return;
- }
- Print(COLOR_5 + "Precasting");
- NTP_DoPrecast(true);
- Print(COLOR_8 + "Going to Chaos Sanctuary");
- if (!NTM_MoveTo(108, 7797, 5600)) {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
- return;
- }
- NTM_TeleportTo(7797, 5560);
- if (!NTM_MoveTo(me.areaid, 7790, 5544)) {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
- return;
- }
- if (NTConfig_Entrance) {
- NTCS_ClearPosition(30, EntranceSort);
- NTM_MoveTo(me.areaid, 7790, 5544);
- PubTP();
- PubSay("Entrance TP up.");
- 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(me.areaid, FrontToStarX[i], FrontToStarY[i]);
- NTCS_ClearPosition(35, EntranceSort);
- }
- }
- NTM_MoveTo(me.areaid, 7784, 5310);
- NTCS_ClearPosition(30, SealSort);
- NTM_MoveTo(me.areaid, 7784, 5310);
- PubTP();
- PubSay("Star TP up.");
- BO_Party();
- NTCS_ClearPosition(30, SealSort);
- if (!NT_OpenSealsInt()) {
- NTC_SendMsgToScript("NTBotGame.ntj", "NT_OpenSealsInt()");
- return;
- }
- PubSay("Diablo.");
- NTM_MoveTo(me.areaid, 7760, 5267);
- PubTP();
- PubSay("Diablo TP up.");
- if (!NTM_MoveTo(me.areaid, 7800, 5294)) {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTM_MoveTo()");
- return;
- }
- NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
- Print(COLOR_8 + "Waiting for Diablo to spawn..");
- 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();
- PubSay("NG " + NTC_GetNextGame());
- NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
- }
- function NT_OpenSealsInt() {
- var _unit;
- var _result;
- _unit = GetPresetUnits(me.areaid, 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);
- }
- NTP_DoPrecast(true);
- _unit = GetPresetUnits(me.areaid, 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;
- }
- PubTP();
- BO_Party();
- NTCS_ClearPosition(40, SealSortB);
- _unit = GetPresetUnits(me.areaid, 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_OpenVizierSealInt(type) {
- var i, n;
- if (type === 1) {
- var vx = [7767,7756,7744,7747,7750,7741,7729,7720,7720,7721,7719,7712,7700,7687,7676, 7666, 7647];// ||| |||
- var vy = [5292,5284,5275,5290,5303,5310,5314,5312,5301,5288,5273,5292,5294,5294,5292, 5307, 5267];// |||
- } else {
- var vx = [7768,7755,7741,7733,7723,7714,7707,7680,7666, 7655, 7649];// |||||||||
- var vy = [5289,5295,5282,5291,5300,5282,5315,5310,5311, 5282, 5269];// |||
- }
- for (var i = 0; i < vx.length; i += 1) {
- NTM_MoveTo(me.areaid, vx[i], vy[i]);
- NTCS_ClearPosition(30, SealSort);
- }
- PubTP();
- PubSay("Leech TP up.");
- if (!NT_OpenSealInt(395) || !NT_OpenSealInt(396)) {
- return false;
- }
- if (type == 1) {
- NTM_MoveTo(me.areaid, 7691, 5292);
- } else {
- NTM_MoveTo(me.areaid, 7695, 5316);
- }
- NTC_FindUnit(1, GetLocaleString(2851), 10);
- NTCS_ClearPosition(40, SealSort);
- NTA_KillMonster(GetLocaleString(2851)); // Grand Vizier of Chaos
- NTCS_ClearPosition(40, SealSort);
- PubSay("Vizier dead.");
- if(NTConfig_IdInField){
- NT_FieldID();
- }
- return true;
- }
- function NT_OpenDeSeisSealInt(type) {
- var i, n;
- if (type === 1) {
- var sx = [7791,7783,7800,7809,7785,7773,7773,7776,7794,7811,7817,7815,7798,7785]; // Shape of "2"
- var sy = [5265,5256,5247,5232,5230,5222,5212,5194,5194,5193,5177,5157,5155,5155];
- } else {
- var sx = [7786,7801,7786,7787,7810,7811,7810,7790,7774,7773,7794, 7821]; // shape of an "S" or "5"
- var sy = [5263,5249,5245,5227,5233,5215,5198,5194,5181,5156,5154, 5160];
- }
- for (var i = 0; i < sx.length; i += 1) {
- NTM_MoveTo(me.areaid, sx[i], sy[i]);
- NTCS_ClearPosition(30, type === 1 ? SealSort : SealSortB);
- }
- PubTP();
- PubSay("Leech TP up.");
- if (!NT_OpenSealInt(394)) {
- return false;
- }
- if (type == 1) {
- NTM_MoveTo(me.areaid, 7797, 5201);
- for (i = 0; i < 3; i += 1) {
- NTM_TeleportTo(7794, 5227);
- }
- } else {
- NTM_MoveTo(me.areaid, 7798, 5186);
- }
- var seis = NTC_FindUnit(1, GetLocaleString(2852), 10);
- NTCS_Preattack(seis);
- NTCS_ClearPosition(40, NTA_SortMonsters);
- NTA_KillMonster(GetLocaleString(2852)); // Lord De Seis
- NTCS_ClearPosition(40, NTA_SortMonsters);
- PubSay("De Seis dead.");
- if(NTConfig_IdInField){
- NT_FieldID();
- }
- return NTM_MoveTo(me.areaid, 7800, 5255);
- }
- function NT_OpenVenomSealInt(type) {
- if (type === 1) {
- var IX = [7825,7827,7834,7845,7855,7852,7875,7896,7917, 7861]; // shape of a "t"
- var IY = [5293,5276,5291,5315,5301,5278,5293,5295,5291, 5321];
- } else {
- var IX = [7822,7826,7832,7850,7868,7877,7891,7907,7927,7932, 7909]; // looks like a hook
- var IY = [5297,5278,5307,5278,5297,5276,5276,5276,5279,5298, 5318];
- }
- for (var i = 0; i < IX.length; i += 1) {
- NTM_MoveTo(me.areaid, IX[i], IY[i]);
- NTCS_ClearPosition(30, SealSortB);
- }
- PubTP();
- PubSay("Leech TP up.");
- if (!NT_OpenSealInt(393) || !NT_OpenSealInt(392)) {
- return false;
- }
- if (type === 1) {
- type = 1; // temp
- } else {
- NTM_MoveTo(me.areaid, 7933, 5299);
- }
- NTC_FindUnit(1, GetLocaleString(2853), 10);
- NTCS_ClearPosition(40, NTA_SortMonsters);
- NTA_KillMonster(GetLocaleString(2853)); // Infector of Souls
- NTCS_ClearPosition(40, NTA_SortMonsters);
- PubSay("Infector dead.");
- 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(me.areaid, 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("Don't hit the seals.");
- }
- 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(me.areaid, seal.x + 15, seal.y);
- } else {
- NTM_MoveTo(me.areaid, 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;
- }
- // clear functions
- function NTCS_ClearPosition(range, sortFunc) {
- var i, orgx, orgy, monList, skipList, target, result,
- attackcount = 0;
- if (NTConfig_AttackSkill[1] < 0 || NTConfig_AttackSkill[3] < 0) {
- return false;
- }
- switch (arguments.length) {
- case 0:
- range = 20;
- case 1:
- sortFunc = DistanceSort;
- break;
- }
- orgx = me.x;
- orgy = me.y;
- skipList = [];
- while (attackcount < 300) {
- if (attackcount % 2 === 0) {
- monList = [];
- target = NTC_FindUnit(NTC_UNIT_MONSTER, null, 3);
- if (target) {
- do {
- if (skipList.indexOf(target.gid) < 0) {
- if (target.IsAttackable()) {
- if (orgx - range < target.x && orgx + range > target.x && orgy - range < target.y && orgy + range > target.y && NTA_IsValidMonster(target)) {
- monList.push(new NTA_MonsterStats(target));
- }
- } else {
- skipList.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:
- skipList.push(target.gid);
- monList.shift();
- break;
- case 2:
- case 3:
- if (target.mode === 0 || target.mode === 12) {
- NTSI_FastPick();
- }
- attackcount += 1;
- break;
- default:
- return false;
- }
- } else {
- monList.shift();
- }
- }
- 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:
- NTA_SkeletonArmy(NTConfig_SkeletonArmy);
- NTA_MageArmy(NTConfig_MageArmy);
- NTA_ReviveArmy(NTConfig_ReviveArmy);
- 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) {
- MWL_FindItem(20);
- }
- break;
- }
- if (attackcount > 0) {
- NTSI_PickItems();
- }
- if (NTT_CheckPotionSafe()) {
- NTTMGR_VisitTown();
- }
- return true;
- }
- 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 NTA_SortMonsters(unitA, unitB) {
- var monID = [58, 59, 60, 61, 62, 101, 102, 103, 104, 105, 229, 278, 279, 280, 281, 282, 645, 646, 647, 667, 668, 669, 670];
- if (monID.indexOf(unitA.classid) > -1) {
- return -1;
- } else if (GetDistance(me.x, me.y, unitA.x, unitA.y) < GetDistance(me.x, me.y, unitB.x, unitB.y)) {
- return -1;
- }
- return 1;
- }
- 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, 7798, 5186) < GetDistance(unitB.x, unitB.y, 7798, 5186)) {
- return -1;
- }
- return 1;
- }
- function NTCS_Preattack(target) {
- if (!target) {
- return;
- }
- var i;
- switch (me.classid) {
- case 0:
- break;
- case 1:
- if (CheckCollision(me.areaid, target.x + 10, target.y + 20, 1)) { // check if we can move there
- NTM_MoveTo(me.areaid, target.x + 10, target.y + 20);
- }
- NTC_CastSkill(NTConfig_AttackSkill[1], NTC_HAND_RIGHT, target);
- break;
- case 2:
- break;
- case 3:
- if (CheckCollision(me.areaid, target.x + 6, target.y + 10, 1)) { // check if we can move there
- NTM_MoveTo(me.areaid, target.x + 6, target.y + 10);
- NTC_PutSkill(NTConfig_AttackSkill[2], NTC_HAND_RIGHT);
- for (i = 0; i < 7; i += 1) {
- NTC_CastSkill(NTConfig_AttackSkill[1], 2);
- }
- }
- break;
- case 4:
- if (CheckCollision(me.areaid, target.x, target.y + 10, 1)) { // check if we can move there
- NTM_MoveTo(me.areaid, target.x, target.y + 10);
- for (i = 0; i < 2; i += 1) {
- NTC_CastSkill(130, NTC_HAND_RIGHT);
- NTC_Delay(150);
- }
- }
- break;
- case 5:
- break;
- case 6:
- break;
- case 7:
- break;
- }
- }
- // general functions
- function PubTP() {
- if (NTConfig_PublicMode) {
- NTM_MakeTP();
- }
- }
- function PubSay(string) {
- if (NTConfig_PublicMode) {
- Say(string);
- }
- }
- function NTT_CheckPotionSafe() {
- var i, items, hpCheck, mpCheck;
- if (NTConfig_BeltColType.indexOf("hp") > -1) {
- items = me.GetItems();
- for (i in items) {
- if (items[i].mode === 2 && items[i].code.indexOf("hp") > -1) {
- hpCheck = true;
- break;
- }
- }
- }
- if (NTConfig_BeltColType.indexOf("hp") > -1) {
- items = me.GetItems();
- for (i in items) {
- if (items[i].mode === 2 && items[i].code.indexOf("mp") > -1) {
- mpCheck = true;
- break;
- }
- }
- }
- return !(hpCheck && mpCheck);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement