Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var _MyDT_PreMessage = "";
- var leader = "Vitamins";
- var barb = "Lurk";
- function NTMain()
- {
- Delay(1000);
- Include("libs/common/NTCommon.ntl");
- NTC_IncludeLibs();
- NTC_IncludeConfig("NTBot/char_configs");
- NT_LoadConfig();
- NTSI_LoadNIPFiles("NTBot/item_configs");
- NTA_Initialize();
- RegisterEvent(EVENT_GAMEMSG, quitfunc);
- var XPList = [0, 0, 500, 1500, 3750, 7875, 14175, 22680, 32886, 44396, 57715, 72144, 90180, 112725, 140906,
- 176132, 220165, 275207, 344008, 430010, 537513, 671891, 839864, 1049830, 1312287, 1640359,
- 2050449, 2563061, 3203826, 3902260, 4663553, 5493363, 6397855, 7383752, 8458379, 9629723,
- 10906488, 12298162, 13815086, 15468534, 17270791, 19235252, 21376515, 23710491, 26254525,
- 29027522, 32050088, 35344686, 38935798, 42850109, 47116709, 51767302, 56836449, 62361819,
- 68384473, 74949165, 82104680, 89904191, 98405658, 107672256, 117772849, 128782495, 140783010,
- 153863570, 168121381, 183662396, 200602101, 219066380, 239192444, 261129853, 285041630, 311105466,
- 339515048, 370481492, 404234916, 441026148, 481128591, 524840254, 572485967, 624419793, 681027665,
- 742730244, 809986056, 883294891, 963201521, 1050299747, 1145236814, 1248718217, 1361512946, 1484459201,
- 1618470619, 1764543065, 1923762030, 2097310703, 2286478756, 2492671933, 2717422497, 2962400612, 3229426756, 3520485254, 0, 0],
- minXP = XPList[me.GetStat(12)] + 1;
- NTC_Delay(1000);
- Print(NTTMGR_CheckScrolls(1));
- NTC_PutSkill(0, NTC_HAND_RIGHT);
- Suicide(minXP);
- //partyTaxiSorc();
- while (NTC_InMyParty(leader) || NTC_InMyParty(barb))
- {
- if (me.areaid === 103)
- CheckDiabloPortal();
- NTC_Delay(500);
- }
- return "NTMain()";
- }
- function quitfunc(msg, type)
- {
- if (msg.indexOf(leader) != -1 && msg.indexOf("Leech TP up") != -1)
- {
- NT_File("NTBot/bots/TeamD.txt", 1, ".filler", 50);
- }
- }
- function CheckDiabloPortal()
- {
- var _msg = NT_File("NTBot/bots/TeamD.txt", 0);
- if (_msg && _msg != _MyDT_PreMessage) {
- _MyDT_PreMessage = _msg;
- switch (_msg.substring(_msg.indexOf("/") + 1))
- {
- case ".filler":
- Print("got diablo portal cmd");
- if (NTC_GetSkillLevel(100) < NTC_GetSkillLevel(110))
- NTC_PutSkill(110, NTC_HAND_RIGHT);
- else
- NTC_PutSkill(100, NTC_HAND_RIGHT);
- NTTM_CheckAct(4);
- NTTM_TownMove("portalspot");
- NTM_UsePortal("BluePortal", 108, leader);
- //while (!isMainCharIn(108))
- //Delay(100);
- if (!NTM_MoveTo(me.areaid, 7762, 5267))
- return "NTM_MoveTo()";
- break;
- }
- }
- }
- function UseFillerPortal()
- {
- var portal = NTC_FindUnit(2, GetLocaleString(3226)),
- subareas = [105, 106, 105 + 256, 106 + 256, 105 + 768, 106 + 768];
- if (portal)
- {
- do {
- if (subareas.indexOf(portal.subareaid) > -1 && portal.GetParent() !== me.name)
- {
- NTM_UsePortal(null, null, null, portal);
- return true;
- }
- } while (portal.GetNext());
- }
- return false;
- }
- function GetNearestMonster()
- {
- var gid,
- range = 20,
- monIDs = [14, 120, 140, 298, 299, 301, 302, 304, 305, 307, 308, 310, 311, 361, 362],
- monster = NTC_FindUnit(1);
- if (monster)
- {
- do {
- if (monster.hp > 0 && monIDs.indexOf(monster.classid) > -1 && GetDistance(me, monster) < range)
- {
- range = GetDistance(me, monster);
- gid = monster.gid;
- }
- } while (monster.GetNext());
- }
- if (gid)
- {
- return NTC_FindUnit(1, gid);
- }
- return false;
- }
- function Suicide(xp)
- {
- Print(NTC_InMyParty(leader) + " " + NTC_InMyParty(barb));
- if (me.areaid == 103)
- {
- var i, n, path, unit, monster, made, pos;
- for (i = 0; i < 20; i += 1)
- {
- //if (NTC_InMyParty(leader) || NTC_InMyParty(barb))
- //{
- if (NTTMGR_CheckScrolls(1) < 10)
- {
- //getGoldFiller();
- NTTMGR_TownManager();
- NTTM_TownMove("portalspot");
- }
- if (!UseFillerPortal())
- {
- NTTM_TownMove("portalspot");
- if(!NTM_TakeWaypoint(106))
- return "NTM_TakeWaypoint()";
- if (me.areaid == 106)
- {
- unit = GetPresetUnits(105, 1, 256);
- if (unit.length)
- path = GetPath(me.areaid, me.x, me.y, unit[0].roomx * 5 + unit[0].x, unit[0].roomy * 5 + unit[0].y, false, 20);
- else
- return false;
- if (!path)
- {
- Print("Invalid path");
- while (NTC_InMyParty(leader))
- Delay(500);
- CloseD2();
- }
- for (n = 0; n < path.length; n += 1)
- {
- monster = nearestMonster();
- if (monster[0])
- {
- Print("Wanna have sex with this supersexy " + monster[4] + " (Distance " + monster[3] + ").");
- Print(made);
- pos = me.GetOptimalAttackPos(monster[2], monster[0], monster[1], made ? 3 : 15, 4);
- if (pos)
- NTM_MoveTo2(monster[2], pos[0], pos[1]);
- Print("there");
- if (me.mode !== 17 && !made)
- {
- made = true;
- pos = me.GetOptimalAttackPos(monster[2], monster[0], monster[1], 3, 4);
- if (pos)
- NTM_WalkTo2(pos[0], pos[1]);
- }
- break;
- }
- NTM_WalkTo2(path[n][0], path[n][1]);
- }
- }
- }
- if (me.mode !== 17 && !made)
- {
- made = true;
- Delay(100);
- }
- monster = nearestMonster();
- if (monster)
- {
- pos = me.GetOptimalAttackPos(monster[2], monster[0], monster[1], 3, 4);
- if (pos)
- NTM_WalkTo2(pos[0], pos[1]);
- }
- while (me.mode !== 0 && me.mode !== 17 && !NTC_InTown())
- NTC_Delay(50);
- while (me.mode === 0 || me.mode === 17)
- {
- Print("dead");
- while (me.areaid != 103)
- {
- me.Cancel(0);
- if (me.areaid == 103)
- break;
- Delay(100);
- }
- }
- Delay(150);
- me.Cancel(1);
- if (me.GetStat(13) <= xp)
- {
- Print("Target XP reached.");
- break;
- }
- //}
- }
- }
- }
- function NTM_WalkTo2(x, y) { // kolton's updated walkto
- var i, distance, nTimer,
- nFail = 0,
- attemptCount = 0;
- if (me.runwalk === 0) {
- me.runwalk = 1;
- }
- MoveLoop : while (GetDistance(me.x, me.y, x, y) > 3 && me.mode !== 17) {
- if (me.classid == 3) {
- NTC_PutSkill(115, NTC_HAND_RIGHT);
- }
- ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, x, y);
- NTC_Delay(40);
- ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
- attemptCount += 1;
- nTimer = GetTickCount();
- while (me.mode !== 2 && me.mode !== 3 && me.mode !== 6) {
- if (me.mode === 17) {
- break MoveLoop;
- }
- if ((GetTickCount() - nTimer) > 500) {
- nFail++;
- if (nFail === 2) {
- return false;
- }
- ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, me.x + Random(-3, 3), me.y + Random(-3, 3));
- NTC_Delay(40);
- ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
- continue MoveLoop;
- }
- NTC_Delay(40);
- }
- while (me.mode !== 1 && me.mode !== 5 && me.mode !== 17) {
- NTC_Delay(40);
- }
- if (attemptCount >= 3) {
- return false;
- }
- }
- return true;
- }
- function nearestMonster()
- {
- var _unit = NTC_FindUnit(NTC_UNIT_MONSTER);
- var uX, uY, uDistance, uName, uAreaid, uRoomsX, uRoomsY;
- var lastDistance = 1000;
- var monIDs = [14, 120, 140, 298, 299, 301, 302, 304, 305, 307, 308, 310, 311, 361, 362];
- if (!_unit)
- return false;
- do
- {
- if (GetDistance(me, _unit) < lastDistance && monIDs.indexOf(_unit.classid) > -1 && _unit.hp > 0 && _unit.mode != 0 && _unit.mode != 12 && (_unit.classid === 14 || _unit.classid === 140 || _unit.classid === 299 || _unit.classid === 302 || _unit.classid === 305 || _unit.classid === 308 || _unit.classid === 311 || _unit.classid === 361 || _unit.classid === 120 || _unit.classid === 307 || _unit.classid === 310 || _unit.classid === 304 || _unit.classid === 301 || _unit.classid === 298|| _unit.classid === 362))
- {
- lastDistance = GetDistance(me, _unit);
- uName = _unit.name;
- uDistance = GetDistance(me, _unit);
- uX = _unit.x;
- uY = _unit.y;
- uAreaid = _unit.areaid;
- uRoomsX = _unit.roomx * 5;
- uRoomsY = _unit.roomy * 5;
- }
- }while (_unit.GetNext())
- return [uX, uY, uAreaid, uDistance, uName, uRoomsX, uRoomsY];
- }
- function NTM_MoveTo2(areaid, x, y, retry, clearpath, canswitch)
- {
- //NT_LoadConfig();
- //NTSI_LoadNIPFiles("NTBot/item_configs");
- var i, n;
- var _teleport;
- var _path = undefined; // houstin add
- var _retry = 0;
- var _attacked = false;
- if(x == me.x && y == me.y) { return true; }
- if(arguments.length < 4) { retry = 3; }
- if(arguments.length < 5) { clearpath = false; }
- if(arguments.length < 6) { canswitch = true; }
- if(NTC_InTown() || NTC_GetSkillLevel(54) < 1) { _teleport = false; }
- else { _teleport = true; }
- if (_teleport && GetDistance(me.x, me.y, x, y) < 30) {// houstin add
- return NTM_TeleportTo(x, y);
- }
- _path = GetPath(areaid, me.x, me.y, x, y, _teleport);
- if(!_path) { return (NTC_InTown() && (NTM_WalkTo2(x, y) || NTTM_TownMoveXY(x, y))); }
- for(i = 0 ; i < _path.length ; i++)
- {
- for(n = 0 ; n < 2 ; n++)
- {
- if(_teleport)
- {
- if(NTM_TeleportTo(_path[i][0]+Random(-n, n), _path[i][1]+Random(-n, n))) { break; }
- }
- else
- {
- if(NTM_WalkTo2(_path[i][0], _path[i][1])) { break; }
- }
- }
- if(n < 2)
- {
- if(clearpath)
- {
- if(!NTA_ClearPosition('20', true, '2')) { return false; }
- NTP_DoPrecast(false);
- NTM_MoveTo(me.areaid, _path[i][0], _path[i][1], 1);
- }
- }
- else if(_retry < retry)
- {
- _path = GetPath(areaid, me.x, me.y, x, y, _teleport);
- if(!_path) { return false; }
- i = -1;
- _retry++;
- _attacked = false;
- }
- else if((!_attacked))
- {
- //NTA_ClearPosition(10, true);
- //NTSI_PickItems();
- _attacked = true;
- _retry = 0;
- }
- else {
- return false;
- }
- }
- return true;
- }
- function MyTP_CheckBeltScroll()
- {
- for (var i = 0; i < 4; i++)
- {
- if (NTConfig_BeltColType[i] == "tsc")
- return true;
- }
- return false;
- }
- function NTM_MakeTP2(dest) // ??
- {
- var _usetp = true;
- var _portal;
- //var _portalname;
- if(NTC_InTown())
- return true;
- if(arguments.length < 1)
- _usetp = false;
- if(MyTP_CheckBeltScroll())
- {
- if(!MyTP_MakeStoreTownPortal() && !MyTP_MakeStoreTownPortal())
- return false;
- }
- else if(!NTC_CastSkill(220, NTC_HAND_RIGHT) && !NTC_CastSkill(220, NTC_HAND_RIGHT))
- return false;
- NTC_PingDelay(500);
- //_portalname = GetLocaleString(3226);
- for(var i = 0 ; i <= 2 ; i++)
- {
- _portal = NTC_FindUnit(NTC_UNIT_OBJECT, "blueportal", 103);
- if(_portal)
- {
- do
- {
- if(_portal.mode == 2 && NTC_CheckOwner(_portal))
- {
- if(_usetp)
- return NTM_UsePortal("BluePortal", dest, me.name, _portal);
- return true;
- }
- } while(_portal.GetNext());
- }
- if(i < 2)
- NTC_Delay(250);
- }
- return false;
- }
- //////////
- function partyTaxiSorc()
- {
- for(i = 0; i <= 100; i++)
- {
- if (NTC_InMyParty(leader))
- {
- break;
- }
- var _player = GetPlayerUnit();
- if (_player)
- {
- _mypartyid = _player.partyid;
- while (_player.GetNext())
- {
- if (_player.name == (leader) && _player.partyflag == 2 && (_player.partyid == 65535 || _player.partyid != _mypartyid))
- {
- me.ClickParty(_player, 2);
- break;
- }
- }
- }
- NTC_Delay(200);
- }
- }
- function getGoldFiller()
- {
- var _goldinventory = me.GetStat(14);
- if (NTC_InTown())
- {
- if (!NTTM_CheckAct(4))
- return "NTTM_CheckAct()";
- NTTM_TownMove("portalspot");
- var _item = NTC_FindUnit(NTC_UNIT_ITEM, GetLocaleString(2215));
- if (_item)
- {
- Print("seen gold");
- do
- {
- if (_item.classid == 523 && (GetDistance(me, _item) <= 15))
- {
- //NTM_MoveCloser(_item, 0);
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _item);
- }
- } while (_item.GetNext());
- }
- }
- }
Add Comment
Please, Sign In to add comment