Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // yeah, there's some lame null pointer crash in LeaderStater2.2 when you exit the game manually..
- // din dickers around and doesn't go for bo..big problem - in one scenario, it happens cus din is town managing and sorc/barb are ready to go. should make a ready notification and only bo if all chars are ready
- // din switchs to vigor when he moves around in cs - this is bad
- // FIXME: teleporting is slow... sorc gets hit, stunned, and teleporting doesn't take the first chance to cast after stunned and waits until she gets stunned again and she ends up dieing
- // FIXME: sorc delay after popping seal waiting on spawn. make her dodge
- // FIXME: dodging, i messed it up trying to improve it
- //sometimes sorc tp creating fails and she doesn't make tp
- //when sorc goes so far ahead before din kills seis, the nta killmonster diablo fails and she quits
- // on a rare occasion, the din thought he killed seis when he really didn't and the party continued to try to kill diablo even though seis wasn't dead. maybe add some monster checks before diablo or smth
- // FIXME: large delay after din takes TP before he precasts.
- // still on some weird occasion the din town manages at end of run
- // TODO: better barb bo casting, the current one has lame delays somewhere
- // din precasts or smth after viz dies and doesn't take tp back to town - it's gotta be the NTM code trying to kill monsters in the way.
- // FIXME: sometimes din doesn't take bo tp - seems to be only when he town manages and the others are ready already
- // FIXME: sorc stands around when she needs to be fighting a boss or shit
- // FIXME: delays where the sorc just sits there after popping a seal - make her move around.
- // FIXME: din doesn't do pots etc when precasting - look in NTA for code to do this
- // FIXME: sorc doesn't do pots etc when dodging at star
- // FIXME: sorc doesn't wait on sealboss to die if sorcSucks = 0 (happens due to immunity skipping).
- // FIXME: delays when hitting seals - she stands there and dies. makes her dodge and then try to hit seal again if it still isn't popped
- // TODO: use NTConfig_ variables instead of just setting them in the script
- // TODO: NTCS_TeleportTo
- // TODO: NTCS_CheckAct
- // TODO: make din select concen before/after he takes tp
- // TODO: instead of looping createtp, just mod the createtp function to loop
- // TODO: instead of trying to use NTA_KillMonster for the sorc, make a function that clears the monsters near the boss until the boss is dead
- // TODO: NTCS_Town() that tries to take any close tps of members of your party or even your own if you can reach them without any collisions and they are within a small distance, but if all else fails then just make your own
- // TODO: NTCS_UsePortal function that tries it multiple times - another benefit to this is that you can remove the area delay
- // in latest taking tp's is bugged? or why else could the barb AND din not take tp for bo
- // din casts hammers until death even though boss is dead?
- // new list:
- // make a var dinSucks. if it is true, then din will go to healer then give a DinReady message after every sealboss if he has less than x/x hp/mana. sorc will wait on this message..
- // sorc stands still when grabbing potions with telekinesis. maybe shouldn't use telegrab
- // laggy ass sorc pickit that causes her to stand around tanking?
- // sorc goes on ahead even though sealboss isn't dead -.-
- // din thinks sealboss is dead when it really isn't.
- //even NEWER list!
- // - chars wrongly thinking they killed sealboss still a problem
- // - pickit still hangs and causes chickens
- // - on a rare occasion the first time i started the bot, din/barb didn't go for bo
- // - dinsucks not implemented
- // - it's a problem when din fails to take sorc's boss tp
- // - sorc tries to tank monsters after popping seal. make her dodge while waiting to see if it popped correctly?
- // - sayMsgs must always be 1 because the sealboss down notification is message based.
- // - idea: sorc only tries to kill sealboss if she has above X hp/mana
- // - idea: change SnagIt so it only grabs potions if you are low on them
- // - idea for hdin attack code: if the target isn't taking damage, move
- // - idea: NTCS_VisitTown, and if you're a sorc, it will dodge to a close place with no monsters so it doesn't try to tp when being chewed up by a mob
- // - idea: sorc doesn't fight sealboss if there's more than X monsters(this is bad tho cus din could get overwhelmed)
- // - idea: after sorc pops seal, make her go stand by din and shoot orbs until boss dies?
- // - smart sorc mode: if less than x hp, don't fight boss. if greater than x monsters OR x champions/uniques OR din has low hp then fight beside din. if no other conditions met, fight monster normally.
- // - idea for tp chicken, if there is a portal made by you or someone in your party nearby, take it
- var _MyDT_PreMessage = "lame";
- var _sealpos = 0;
- var safex;
- var safey;
- var prevx;
- var prevy;
- var leader = "telemarketur";
- var sorcGetDiaXP = 0;
- var barbTakeTps = 0;
- var sayMsgs = 1;
- var barbLeaveAfterBo = 0;
- var onlySora = 0;
- var sorcSucks = 0; // TODO: instead of this var, make vars that decide if the sorc fights each seperate sealboss.
- var dinTouchHealerHP = 0; // if after killing a sealboss, the din has less than this percent of HP he will go touch jamella. set to 0 to disable
- var _startExp;
- function NTCS_Sora_TeleportTo(x, y) // doesn't care where tele lands
- {
- var _ox = me.x, _oy = me.y;
- NTC_CastSkill(54, NTC_HAND_RIGHT, x, y);
- if(NTConfig_TeleGrab == 1){
- NTConfig_TeleGrab++;
- NTSI_PickItems();
- NTConfig_TeleGrab--;
- }
- MyCS_CatchShrine();
- for(var i = 0 ; i < 20 ; i++)
- {
- if(me.x != _ox || me.y != _oy){
- return true;
- }
- Delay(NTC_DELAY_FRAME);
- }
- return false;
- }
- function NTCS_WalkTo(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) {
- ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, x, y);
- Delay(30);
- 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 == 3) {
- return false;
- }
- ClickMap(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, me.x + Random(-3, 3), me.y + Random(-3, 3));
- Delay(30);
- ClickMap(NTC_CLICK_LUP, NTC_SHIFT_NONE, null);
- continue MoveLoop;
- }
- Delay(20);
- }
- while (me.mode !== 1 && me.mode !== 5 && me.mode !== 17) {
- Delay(5);
- }
- if (attemptCount >= 3) {
- return false;
- }
- }
- return true;
- }
- function NTCS_MoveTo(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; }
- // ubi21 Enigma reset start
- ////////////////////////////
- if(NTConfig_ResetEnigma && NTC_GetSkillLevel(54) < 1) {
- NTC_SendLogToOOG(NTC_LOG_COMMON, COLOR_1 + "Teleport Bug Found!");
- Print(COLOR_1 + "Teleport Bug Found!");
- NTT_ResetEnigma();
- }
- // ubi21 Enigma reset end
- ////////////////////////////
- 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() && (NTCS_WalkTo(x, y) || NTTM_TownMoveXY(x, y))); }
- if(NTConfig_SwitchTele && _path.length > 2 && canswitch && _teleport){
- if(NTC_SwapWeapons(1)){
- if(debugMove){
- switchedtoTele = me.weaponstab == 1;
- Print(COLOR_2 + "Swapped to tele " + switchedtoTele);
- }
- }
- }
- if ((NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe, true)) || (me.hp <= parseInt(me.hpmax * NTConfig_TPChicken,10) / 100)) {
- NTTMGR_VisitTown();
- }
- 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(NTCS_WalkTo(_path[i][0], _path[i][1])) { break; }
- }
- }
- if(!NTC_InTown()) { NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe); }
- if(n < 2)
- {
- if(clearpath)
- {
- if(!NTA_ClearPosition('20', true, '2')) { return false; }
- NTP_DoPrecast(false);
- NTCS_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) && (!NTConfig_SwitchTele))
- {
- //NTA_ClearPosition(10, true);
- //NTSI_PickItems();
- _attacked = true;
- _retry = 0;
- }
- else {
- return false;
- }
- }
- return true;
- }
- function NTCS_MoveToPresetUnit(areaid, unittype, classid, offsetx, offsety, clearpath)
- {
- var i, n;
- var _unit;
- if(arguments.length < 4)
- {
- offsetx = 0;
- offsety = 0;
- }
- if(arguments.length < 6)
- clearpath = false;
- for(i = 0 ; i <= 15 ; i++)
- {
- _unit = GetPresetUnits(areaid, unittype);
- if(_unit)
- {
- for(n = 0 ; n < _unit.length ; n++)
- {
- if(_unit[n].id == classid)
- return NTCS_MoveTo(areaid, _unit[n].roomx*5+_unit[n].x+offsetx, _unit[n].roomy*5+_unit[n].y+offsety, 3, clearpath);
- }
- }
- }
- return false;
- }
- function NTCS_PaladinAttackInt(target, firstorder) {
- var _primaryindex;
- var _attackSkill;
- if ((NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe, true)) || (me.hp <= parseInt(me.hpmax * NTConfig_TPChicken,10) / 100)) {
- if (!NTTMGR_VisitTown()) return 0;
- }
- if (firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100) {
- if (GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4)) {
- var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);
- if (_pos) NTCS_MoveTo(target.areaid, _pos[0], _pos[1], 0, false, false);
- }
- if (!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target)) return 2;
- return 3;
- }
- _primaryindex = (target.spectype & 0x0A) ? 1 : 3;
- if (NTConfig_OnlySmiteStationary && NTConfig_AttackSkill[1] == 97 && GetBaseStat("monstats2.txt", target.classid, 56) == 1) _primaryindex = 3;
- _attackIndex = NTA_GetAttackType(target, _primaryindex, 100, 100, 100);
- if (NTConfig_AttackSkill[_attackIndex] > -1) {
- if (_NTA_SkillRange[_attackIndex] < 4 && !CheckCollision(target.areaid, target.x, target.y, 1)) return 1;
- if (!NTCS_PaladinCastSkillInt(_attackIndex, target)) return 2;
- return 3;
- }
- return 1;
- }
- function WillMyHammerHit(atx, aty)
- {
- var hx = atx - me.x;
- var hy = aty - me.y;
- if((hx == -10 && hy == -9) ||
- (hx == -9 && hy == -10) ||
- (hx == -11 && hy == -7) ||
- (hx == -10 && hy == -8) ||
- (hx == -9 && hy == -9) ||
- (hx == -8 && hy == -10) ||
- (hx == -7 && hy == -11) ||
- (hx == -6 && hy == -12) ||
- (hx == -5 && hy == -13) ||
- (hx == -12 && hy == -5) ||
- (hx == -11 && hy == -6) ||
- (hx == -10 && hy == -7) ||
- (hx == -9 && hy == -8) ||
- (hx == -8 && hy == -9) ||
- (hx == -7 && hy == -10) ||
- (hx == -6 && hy == -11) ||
- (hx == -5 && hy == -12) ||
- (hx == -12 && hy == -4) ||
- (hx == -11 && hy == -5) ||
- (hx == -10 && hy == -6) ||
- (hx == -9 && hy == -7) ||
- (hx == -7 && hy == -9) ||
- (hx == -6 && hy == -10) ||
- (hx == -5 && hy == -11) ||
- (hx == -4 && hy == -12) ||
- (hx == -3 && hy == -13) ||
- (hx == -13 && hy == -2) ||
- (hx == -12 && hy == -2) ||
- (hx == -11 && hy == -4) ||
- (hx == -10 && hy == -5) ||
- (hx == -3 && hy == -12) ||
- (hx == -2 && hy == -13) ||
- (hx == -12 && hy == -2) ||
- (hx == -11 && hy == -3) ||
- (hx == -10 && hy == -4) ||
- (hx == -3 && hy == -11) ||
- (hx == -2 && hy == -12) ||
- (hx == -1 && hy == -13) ||
- (hx == 0 && hy == -14) ||
- (hx == -11 && hy == 2) ||
- (hx == -8 && hy == -1) ||
- (hx == -7 && hy == -2) ||
- (hx == -6 && hy == -3) ||
- (hx == -5 && hy == -4) ||
- (hx == -4 && hy == -5) ||
- (hx == -3 && hy == -6) ||
- (hx == -2 && hy == -7) ||
- (hx == -1 && hy == -8) ||
- (hx == 0 && hy == -9) ||
- (hx == -12 && hy == 4) ||
- (hx == -11 && hy == 3) ||
- (hx == -10 && hy == 2) ||
- (hx == -8 && hy == 0) ||
- (hx == -7 && hy == -1) ||
- (hx == -6 && hy == -2) ||
- (hx == 0 && hy == -8) ||
- (hx == -12 && hy == 4) ||
- (hx == -11 && hy == 3) ||
- (hx == -10 && hy == 2) ||
- (hx == -8 && hy == 0) ||
- (hx == -7 && hy == 1) ||
- (hx == -6 && hy == 0) ||
- (hx == -3 && hy == -3) ||
- (hx == -2 && hy == -4) ||
- (hx == 2 && hy == -8) ||
- (hx == 3 && hy == -9) ||
- (hx == -11 && hy == 4) ||
- (hx == -8 && hy == 1) ||
- (hx == -7 && hy == 0) ||
- (hx == -6 && hy == -1) ||
- (hx == 0 && hy == -7) ||
- (hx == 1 && hy == -8) ||
- (hx == 2 && hy == -9) ||
- (hx == -11 && hy == 5) ||
- (hx == -10 && hy == 4) ||
- (hx == -8 && hy == 2) ||
- (hx == -7 && hy == 1) ||
- (hx == -6 && hy == 0) ||
- (hx == -3 && hy == -3) ||
- (hx == -2 && hy == -4) ||
- (hx == 2 && hy == -8) ||
- (hx == 3 && hy == -9) ||
- (hx == -11 && hy == 5) ||
- (hx == -10 && hy == 4) ||
- (hx == -8 && hy == 2) ||
- (hx == -7 && hy == 1) ||
- (hx == -6 && hy == 0) ||
- (hx == -3 && hy == -3) ||
- (hx == -2 && hy == -4) ||
- (hx == 2 && hy == -8) ||
- (hx == 3 && hy == -9) ||
- (hx == -10 && hy == 5) ||
- (hx == -7 && hy == 2) ||
- (hx == -6 && hy == 1) ||
- (hx == -3 && hy == -2) ||
- (hx == -2 && hy == -3) ||
- (hx == -1 && hy == -4) ||
- (hx == 0 && hy == -5) ||
- (hx == 2 && hy == -7) ||
- (hx == 3 && hy == -8) ||
- (hx == -10 && hy == 5) ||
- (hx == -7 && hy == 2) ||
- (hx == -6 && hy == 1) ||
- (hx == -3 && hy == -2) ||
- (hx == -2 && hy == -3) ||
- (hx == -1 && hy == -4) ||
- (hx == 0 && hy == -5) ||
- (hx == 2 && hy == -7) ||
- (hx == 3 && hy == -8) ||
- (hx == -10 && hy == 6) ||
- (hx == -9 && hy == 5) ||
- (hx == -7 && hy == 3) ||
- (hx == -6 && hy == 2) ||
- (hx == -3 && hy == -1) ||
- (hx == 2 && hy == -2) ||
- (hx == -1 && hy == -3) ||
- (hx == 0 && hy == -4) ||
- (hx == 1 && hy == -5) ||
- (hx == 3 && hy == -7) ||
- (hx == 4 && hy == -8) ||
- (hx == -9 && hy == 6) ||
- (hx == -6 && hy == 3) ||
- (hx == -3 && hy == 0) ||
- (hx == -2 && hy == -1) ||
- (hx == -1 && hy == -2) ||
- (hx == 0 && hy == -3) ||
- (hx == 1 && hy == -4) ||
- (hx == 4 && hy == -7) ||
- (hx == 5 && hy == -8) ||
- (hx == -9 && hy == 7) ||
- (hx == -8 && hy == 6) ||
- (hx == -6 && hy == 4) ||
- (hx == -5 && hy == 3) ||
- (hx == -3 && hy == 1) ||
- (hx == -2 && hy == 0) ||
- (hx == -1 && hy == -1) ||
- (hx == 1 && hy == -3) ||
- (hx == 2 && hy == -4) ||
- (hx == 4 && hy == -6) ||
- (hx == 5 && hy == -7) ||
- (hx == -9 && hy == 8) ||
- (hx == -8 && hy == 7) ||
- (hx == -6 && hy == 5) ||
- (hx == -5 && hy == 4) ||
- (hx == -2 && hy == 1) ||
- (hx == -1 && hy == 0) ||
- (hx == 0 && hy == -1) ||
- (hx == 2 && hy == -3) ||
- (hx == 3 && hy == -4) ||
- (hx == 5 && hy == -6) ||
- (hx == 6 && hy == -7) ||
- (hx == -8 && hy == 8) ||
- (hx == -5 && hy == 5) ||
- (hx == -4 && hy == 4) ||
- (hx == -2 && hy == 2) ||
- (hx == -1 && hy == 1) ||
- (hx == 0 && hy == 0) ||
- (hx == 2 && hy == -2) ||
- (hx == 3 && hy == -3) ||
- (hx == 6 && hy == -6) ||
- (hx == -8 && hy == 9) ||
- (hx == -7 && hy == 8) ||
- (hx == -5 && hy == 6) ||
- (hx == -4 && hy == 5) ||
- (hx == -3 && hy == 4) ||
- (hx == -1 && hy == 2) ||
- (hx == 0 && hy == 1) ||
- (hx == 1 && hy == 0) ||
- (hx == 3 && hy == -2) ||
- (hx == 4 && hy == -3) ||
- (hx == 6 && hy == -5) ||
- (hx == 7 && hy == -6) ||
- (hx == -7 && hy == 9) ||
- (hx == -6 && hy == 8) ||
- (hx == -4 && hy == 6) ||
- (hx == -3 && hy == 5) ||
- (hx == 0 && hy == 2) ||
- (hx == 1 && hy == 1) ||
- (hx == 3 && hy == -1) ||
- (hx == 4 && hy == -2) ||
- (hx == 7 && hy == -5) ||
- (hx == -6 && hy == 9) ||
- (hx == -3 && hy == 6) ||
- (hx == -2 && hy == 5) ||
- (hx == 4 && hy == -1) ||
- (hx == 5 && hy == -2) ||
- (hx == 7 && hy == -4) ||
- (hx == 8 && hy == -5) ||
- (hx == -6 && hy == 10) ||
- (hx == -5 && hy == 9) ||
- (hx == -2 && hy == 6) ||
- (hx == -1 && hy == 5) ||
- (hx == 4 && hy == 0) ||
- (hx == 5 && hy == -1) ||
- (hx == 7 && hy == -3) ||
- (hx == 8 && hy == -4) ||
- (hx == -5 && hy == 10) ||
- (hx == -4 && hy == 9) ||
- (hx == -2 && hy == 7) ||
- (hx == -1 && hy == 6) ||
- (hx == 0 && hy == 5) ||
- (hx == 4 && hy == 1) ||
- (hx == 5 && hy == 0) ||
- (hx == 8 && hy == -3) ||
- (hx == 9 && hy == -4) ||
- (hx == -4 && hy == 10) ||
- (hx == -1 && hy == 7) ||
- (hx == 0 && hy == 6) ||
- (hx == 1 && hy == 5) ||
- (hx == 2 && hy == 4) ||
- (hx == 3 && hy == 3) ||
- (hx == 4 && hy == 2) ||
- (hx == 5 && hy == 1) ||
- (hx == 6 && hy == 0) ||
- (hx == 8 && hy == -2) ||
- (hx == 9 && hy == -3) ||
- (hx == -4 && hy == 11) ||
- (hx == -3 && hy == 10) ||
- (hx == -2 && hy == 9) ||
- (hx == 0 && hy == 7) ||
- (hx == 1 && hy == 6) ||
- (hx == 2 && hy == 5) ||
- (hx == 3 && hy == 4) ||
- (hx == 4 && hy == 3) ||
- (hx == 5 && hy == 2) ||
- (hx == 6 && hy == 1) ||
- (hx == 9 && hy == -2) ||
- (hx == -2 && hy == 10) ||
- (hx == 1 && hy == 7) ||
- (hx == 2 && hy == 6) ||
- (hx == 3 && hy == 5) ||
- (hx == 4 && hy == 4) ||
- (hx == 5 && hy == 3) ||
- (hx == 6 && hy == 2) ||
- (hx == 8 && hy == 0) ||
- (hx == 9 && hy == -1) ||
- (hx == 10 && hy == -2) ||
- (hx == -2 && hy == 11) ||
- (hx == -1 && hy == 10) ||
- (hx == 3 && hy == 6) ||
- (hx == 4 && hy == 5) ||
- (hx == 5 && hy == 4) ||
- (hx == 9 && hy == 0) ||
- (hx == -1 && hy == 11) ||
- (hx == 8 && hy == 2) ||
- (hx == 9 && hy == 1) ||
- (hx == 10 && hy == 0) ||
- (hx == 0 && hy == 11) ||
- (hx == 1 && hy == 10) ||
- (hx == 2 && hy == 9) ||
- (hx == 9 && hy == 2) ||
- (hx == 0 && hy == 12) ||
- (hx == 1 && hy == 11) ||
- (hx == 2 && hy == 10) ||
- (hx == 3 && hy == 9) ||
- (hx == 4 && hy == 8) ||
- (hx == 7 && hy == 5) ||
- (hx == 8 && hy == 4) ||
- (hx == 9 && hy == 3) ||
- (hx == 10 && hy == 2) ||
- (hx == 0 && hy == 12) ||
- (hx == 1 && hy == 11) ||
- (hx == 2 && hy == 10) ||
- (hx == 3 && hy == 9) ||
- (hx == 4 && hy == 8) ||
- (hx == 7 && hy == 5) ||
- (hx == 8 && hy == 4) ||
- (hx == 9 && hy == 3) ||
- (hx == 10 && hy == 2) ||
- (hx == 2 && hy == 11) ||
- (hx == 3 && hy == 10) ||
- (hx == 4 && hy == 9) ||
- (hx == 5 && hy == 8) ||
- (hx == 6 && hy == 7) ||
- (hx == 7 && hy == 6) ||
- (hx == 8 && hy == 5) ||
- (hx == 9 && hy == 4) ||
- (hx == 4 && hy == 10) ||
- (hx == 5 && hy == 9) ||
- (hx == 6 && hy == 8) ||
- (hx == 7 && hy == 7) ||
- (hx == 8 && hy == 6) ||
- (hx == 9 && hy == 5) ||
- (hx == 10 && hy == 4) ||
- (hx == 6 && hy == 9) ||
- (hx == 7 && hy == 8) ||
- (hx == 8 && hy == 7))
- return true;
- return false;
- }
- function NTCS_PaladinCastSkillInt(index, target) {
- if (NTConfig_AttackSkill[index] == 112) {
- if (me.x - target.x < 1 || me.x - target.x > 2 || me.y - target.y < 1 || me.y - target.y > 2) {
- if (CheckCollision(target.areaid, target.x + 2, target.y + 2, 1)) NTCS_MoveTo(target.areaid, target.x + 2, target.y + 2, 0, false, false);
- else if (me.x - target.x < -4 || me.x - target.x > 2 || me.y - target.y < 0 || me.y - target.y > 2) NTCS_MoveTo(target.areaid, target.x - 4, target.y, 0, false, false);
- var hhx = target.x - me.x;
- var hhy = target.y - me.y;
- if(WillMyHammerHit(target.x, target.y))
- Print("hammer will hit them - hx = " + hhx + ", hy = " + hhy);
- else
- Print("hammer won't hit them - hx = " + hhx + ", hy = " + hhy);
- }
- } else {
- if (GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4)) {
- var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);
- if (_pos) NTCS_MoveTo(target.areaid, _pos[0], _pos[1], 0, false, false);
- }
- }
- if (NTConfig_AttackSkill[index + 1] > -1) NTC_PutSkill(NTConfig_AttackSkill[index + 1], NTC_HAND_RIGHT);
- return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
- }
- function NTCS_Din_KillMonster(classid) {
- var _target;
- if (NTConfig_AttackSkill[1] < 0) {
- return false;
- }
- _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);
- if (!_target) {
- return false;
- }
- if (NTConfig_PrioritizeWeakerFoes && NTConfig_PrioritizeWeakerFoesAreaDisable.indexOf(me.areaid) < 0) {
- NTA_ClearPosition(20, true, 2);
- }
- if (_target.IsAttackable()) {
- var _attackcount = 0;
- while (_attackcount < 300 && NTA_IsValidMonster(_target)) {
- if (NTCS_PaladinAttackInt(_target, (_attackcount % 30) == 0) < 2) {
- break;
- }
- _attackcount++;
- _sorcattack++;
- }
- }
- if(skippedImmuneBoss){
- Print(COLOR_2 + "skipping " + _target.name + " because of your skip immune settings");
- return true;
- }
- return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
- }
- function NTA_SorceressAttackInt(target, firstorder) {
- var _primaryindex;
- var _attackSkill;
- if ((NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe, true)) || (me.hp <= parseInt(me.hpmax * NTConfig_TPChicken,10) / 100)) {
- if (!NTTMGR_VisitTown()) { return 0; }
- }
- if (firstorder && NTConfig_AttackSkill[0] > -1 && NTA_GetResistance(target, _NTA_SkillDamage[0]) < 100 && me.GetSkillStatus(NTConfig_AttackSkill[0]) != 8) {
- if (GetDistance(me, target) > _NTA_SkillRange[0] || !CheckCollision(me, target, 4)) {
- var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[0], 4);
- if (_pos) NTCS_MoveTo(target.areaid, _pos[0], _pos[1], 0, false, false);
- }
- if (!NTC_CastSkill(NTConfig_AttackSkill[0], _NTA_SkillHand[0], target)) return 2;
- return 3;
- }
- var _caststatic = true;
- if (NTConfig_StaticBossesOnly) _caststatic = NTConfig_StaticBossesSelect.indexOf(target.name) > -1;
- if (_caststatic && NTConfig_CastStatic < 100 && parseInt(target.hp * 100 / target.hpmax) > NTConfig_CastStatic && NTA_GetResistance(target, NTA_DAMAGE_LIGHTNING) <= 80) {
- var _staticlevel = NTC_GetSkillLevel(42);
- if (_staticlevel > 0) {
- var _staticrange;
- var _castx, _casty;
- _staticrange = Math.floor((5 + _staticlevel - 1) * 2 / 3);
- if (GetDistance(me, target) > _staticrange || !CheckCollision(me, target, 6)) {
- var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _staticrange, 6);
- if (_pos) NTCS_MoveTo(target.areaid, _pos[0], _pos[1], 0, false, false);
- }
- if (target.x < me.x) _castx = me.x - 1;
- else if (target.x > me.x) _castx = me.x + 1;
- else _castx = me.x;
- if (target.y < me.y) _casty = me.y - 1;
- else if (target.y > me.y) _casty = me.y + 1;
- else _casty = me.y;
- if (!CheckCollision(target.areaid, _castx, _casty, 1)) {
- _castx = me.x;
- _casty = me.y;
- }
- if (!NTC_CastSkill(42, NTC_HAND_RIGHT, _castx, _casty)) return 2;
- return 3;
- }
- }
- _primaryindex = (target.spectype & 0x0A) ? 1 : 3;
- _attackSkill = NTA_GetAttackType(target, _primaryindex, 91, 81, 81);
- if (NTConfig_AttackSkill[_attackSkill] > -1) {
- if (!NTCS_SorceressCastSkillInt(_attackSkill, target, _primaryindex)) return 2;
- return 3;
- }
- if (NTA_GetResistance(target, _NTA_SkillDamage[_primaryindex]) < 100 || (_primaryindex == 1 && NTC_GetMerc())) {
- if (!NTCS_SorceressCastSkillInt(_primaryindex, target, _primaryindex)) return 2;
- return 3;
- }
- return 1;
- }
- function NTCS_SorceressCastSkillInt(index, target, primaryIndex) {
- var secondarySkill = 0;
- if (target.name == "Baal" && NTConfig_AttackSkill[10] > -1) {
- index = 10;
- if(NTConfig_AttackSkill[index] == 38) {
- _NTA_SkillRange[index] = 2;
- }
- }
- if ((target.name == "Mephisto" || target.name == "Andariel" || target.name == "Duriel" || target.name == "Diablo") && NTConfig_AttackSkill[9] > -1) {
- index = 9;
- if(NTConfig_AttackSkill[index] == 38) {
- _NTA_SkillRange[index] = 2;
- }
- }
- //var secondarySkill = 0;
- _haveCL = NTC_GetSkillLevel(53); // check to see if we even have CL
- _havetele = NTC_GetSkillLevel(54);
- if (DebugAttacksInGame) {
- Print(COLOR_3 + " sorc attack count = " + _sorcattack);
- }
- if (DebugAttacksInGame && target.GetState(28) > 0) {
- Print(COLOR_2 + "target convicted");
- Print(COLOR_2 + "continue attack");
- }
- if (_sorcattack >= 20) _sorcattack = 0;
- if (_havetele && NTConfig_DancingSorc) {
- NTT_CheckMerc(); // revive merc
- if ((NTA_CheckMyHp() || ((target.GetState(28) <= 0) && NTA_CheckMercInfinity())) || (_sorcattack % NTConfig_AttackJump) == 0) {
- if (DebugAttacksInGame && target.GetState(28) <= 0) {
- Print(COLOR_11 + "target not convicted");
- Print(COLOR_11 + "let's dance");
- }
- NTA_Bounce(target, index);
- }
- }
- if (me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8) {
- if (GetDistance(me, target) > _NTA_SkillRange[index] || !CheckCollision(me, target, 4)) {
- var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[index], 4);
- if (_pos) NTCS_MoveTo(target.areaid, _pos[0], _pos[1], 0, false, false);
- }
- if (NTConfig_ChainLightOnLightImmunes && NTA_GetResistance(target, NTA_DAMAGE_LIGHTNING) >= 95 && _haveCL > 0) {
- if (DebugAttacksInGame) {
- Print(COLOR_9 + " Target Light resist = " + NTA_GetResistance(target, NTA_DAMAGE_LIGHTNING));
- Print(COLOR_9 + "Switching to CL");
- } // need to add debug to config
- return (NTC_CastSkill(53, NTC_HAND_LEFT, target))
- }
- return NTC_CastSkill(NTConfig_AttackSkill[index], _NTA_SkillHand[index], target);
- }
- secondarySkill = NTA_GetAttackType(target, primaryIndex + 1, 81, 81, 81);
- if (NTConfig_AttackSkill[secondarySkill] > -1) {
- if (GetDistance(me, target) > _NTA_SkillRange[secondarySkill] || !CheckCollision(me, target, 4)) {
- var _pos = me.GetOptimalAttackPos(target.areaid, target.x, target.y, _NTA_SkillRange[secondarySkill], 4);
- if (_pos) NTCS_MoveTo(target.areaid, _pos[0], _pos[1], 0, false, false);
- }
- return NTC_CastSkill(NTConfig_AttackSkill[secondarySkill], _NTA_SkillHand[secondarySkill], target);
- }
- for (var i = 0; i < 25; i++) {
- Delay(NTC_DELAY_FRAME);
- if (me.GetSkillStatus(NTConfig_AttackSkill[index]) != 8) break;
- }
- return false;
- }
- function NTCS_Sorc_KillMonster(classid) {
- var _target;
- if (NTConfig_AttackSkill[1] < 0) {
- return false;
- }
- _target = NTC_FindUnit(NTC_UNIT_MONSTER, classid, 5);
- if (!_target) {
- return false;
- }
- if (NTConfig_PrioritizeWeakerFoes && NTConfig_PrioritizeWeakerFoesAreaDisable.indexOf(me.areaid) < 0) {
- NTA_ClearPosition(20, true, 2);
- }
- if (_target.IsAttackable()) {
- var _attackcount = 0;
- while (_attackcount < 300 && NTA_IsValidMonster(_target)) {
- if (NTA_SorceressAttackInt(_target, (_attackcount % 30) == 0) < 2) {
- break;
- }
- _attackcount++;
- _sorcattack++;
- }
- }
- if(skippedImmuneBoss){
- Print(COLOR_2 + "skipping " + _target.name + " because of your skip immune settings");
- return true;
- }
- return (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12);
- }
- function NTCS_GetCloserIntS(unit){
- //Print(COLOR_1 + " we are here");
- if(GetDistance(me, unit) > 3)
- return NTCS_MoveTo(unit.areaid, unit.x+1, unit.y);
- return true;
- }
- function NTCS_MoveCloseInt(target, maxrange)
- {
- var _result = true;
- var _dist = GetDistance(me, target);
- if (_dist > maxrange)
- {
- var _destx, _desty;
- _destx = me.x + Math.round((_dist - maxrange) * (target.x - me.x) / _dist);
- _desty = me.y + Math.round((_dist - maxrange) * (target.y - me.y) / _dist);
- _result = NTCS_MoveTo(target.areaid, _destx, _desty, 1);
- }
- return _result;
- }
- function NTCS_GetPortalDistance(how, dest, ownername, myportal)
- {
- var _portal;
- var _playerportal = false;
- if(how == "BluePortal")
- {
- if(!ownername)
- ownername = me.name;
- _playerportal = true;
- }
- if(arguments.length > 3 && myportal)
- _portal = myportal;
- else
- {
- _portal = NTM_FindCorrectPortalInt(_playerportal, dest, ownername);
- if(_portal < 0)
- _portal = NTM_FindPortalAreaInt(dest);
- if(_portal == -1)
- return false;
- }
- if(!_portal)
- return false;
- return GetDistance(me.x, me.y, _portal.x, _portal.y);
- }
- function NTCS_ChangeAreaInt(how, dest, ownername, myportal)
- {
- var _portal;
- var _playerportal = false;
- var _prearea;
- if(how == "BluePortal")
- {
- if(!ownername)
- ownername = me.name;
- _playerportal = true;
- }
- if(arguments.length > 3 && myportal)
- _portal = myportal;
- else
- {
- _portal = NTM_FindCorrectPortalInt(_playerportal, dest, ownername);
- if(_portal < 0)
- _portal = NTM_FindPortalAreaInt(dest);
- if(_portal == -1)
- return false;
- }
- if(!_portal)
- return false;
- _prearea = me.areaid;
- for(var i = 0 ; i < 100 ; i++)
- {
- if((i % 10) == 0)
- {
- if (me.classid === 1 && NTConfig_Telekinesis && NTC_InTown() && NTC_GetSkillLevel(43) && GetDistance(me, _portal) > 5 && GetDistance(me, _portal) < 23)
- {
- if (i > 10)
- NTCS_MoveCloseInt(_portal, Math.round(GetDistance(me, _portal) / 2), false);
- NTC_CastSkill(43, NTC_HAND_RIGHT, _portal);
- }
- else{
- NTCS_MoveTo(_portal.areaid, _portal.x + 1, _portal.y)
- if(NTC_GetSkillLevel(54) < 1){
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _portal);
- }
- else if(NTCS_GetCloserIntS(_portal)){
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _portal);
- }
- }
- }
- Delay(5);
- if(me.areaid != _prearea)
- {
- while(me.areaid == 0)
- Delay(1);
- if(me.areaid != _prearea)
- {
- //NTC_PingDelay(NTConfig_AreaDelay);
- return true;
- }
- break;
- }
- }
- return (me.areaid != _prearea);
- }
- function NTCS_UsePortal(how, dest, ownername, portal)
- {
- if(me.areaid == dest)
- return true;
- if(NTC_InTown())
- me.Cancel(1);
- if(NTCS_ChangeAreaInt(how, dest, ownername, portal))
- {
- return true;
- }
- return false;
- }
- var ax = 0;
- var ay = 0;
- function NTA_SortRooms(a, b) {
- if (GetDistance(ax, ay, a[0], a[1]) < GetDistance(ax, ay, b[0], b[1])) {
- return -1;
- }
- return 1;
- }
- 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_IdleDodge(atx, aty, mindistance, maxdistance, distancestep) {
- var i, j, y, coordx, coordy, monster, count,
- maxcount = 999,
- coords = [],
- goodCoords = [],
- monList = [],
- angles = [22, 45, 67, 90, 112, 135, 157, 180, 202, 225, 247, 270, 292, 315, 337, 360];
- for(y = mindistance; y < maxdistance; y += distancestep) {
- for (i = 0; i < angles.length; i += 1) {
- coordx = Math.round((Math.cos(angles[i] * Math.PI / 180)) * y + atx);
- coordy = Math.round((Math.sin(angles[i] * Math.PI / 180)) * y + aty);
- if (CheckCollision(me.areaid, coordx, coordy, 1)) {
- coords.push([coordx, coordy]);
- }
- }
- }
- if (coords.length === 0) { // no valid positions - don't move
- return false;
- }
- ax = atx;
- ay = aty;
- coords.sort(NTA_SortRooms);
- monster = GetUnit(1);
- if (monster) {
- do {
- if (monster.hp > 0) {
- monList.push(new NTA_MonsterStats(monster));
- }
- } while (monster.GetNext());
- }
- else
- {
- return false;
- }
- if(monList.length == 0)
- return false;
- for (i = 0; i < coords.length; i += 1) {
- count = 0;
- for (j = 0; j < monList.length; j += 1) {
- if (GetDistance(monList[j].x, monList[j].y, coords[i][0], coords[i][1]) < 15) {
- count += 1;
- target = monList[j];
- }
- }
- 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) {
- NTCS_WalkTo(goodCoords[0], goodCoords[1]);
- return true;
- }
- Print("Dodge maxcount = " + maxcount);
- NTCS_MoveTo(me.areaid, goodCoords[0], goodCoords[1]);
- return true;
- }
- return false;
- }
- function NTCS_GoToStar()
- {
- if(!NTCS_MoveTo(108, 7794, 5295))
- if(!NTCS_MoveTo(108, 7794, 5295))
- {
- return false;
- }
- return true;
- }
- function NTC_IsPlayerInGame(name)
- {
- var _player;
- var _myPartyId;
- var _area;
- _player = GetPlayerUnit();
- do
- {
- if(_player && _player.name == name)
- {
- return true;
- };
- }
- while(_player && _player.GetNext());
- return false;
- }
- var quitScript = 0;
- function NTCS_SafeExitGame() // i wanted to do more than a normal exitgame...
- {
- // TODO: cancel UI's here, or maybe there's some NT function that already does this? (because having a UI open before calling ExitGame causes a crash)
- ExitGame();
- quitScript = 1;
- }
- function NTC_IsQuesterIn(area, name)
- {
- var _player;
- var _myPartyId;
- var _area;
- _player = GetPlayerUnit();
- if(!_player)
- return false;
- _myPartyId = _player.partyid;
- if(arguments.length < 1)
- {
- _area = me.areaid;
- }
- if(arguments.length > 0)
- {
- _area = area;
- }
- do
- {
- if(_player.areaid == _area && _myPartyId == _player.partyid)
- {
- if(!name)
- {
- return true;
- }
- else if(_player.name == name)
- {
- return true;
- }
- }
- }
- while(_player && _player.GetNext());
- return false;
- }
- var bossAlive = 0;
- var bGotBo = 0;
- function NTMain()
- {
- 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);
- if(!NTTM_CheckAct(4))
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_CheckAct()");
- return;
- }
- _startExp = me.GetStat(13);
- NTTMGR_TownManager();
- TD_File("NTBot/bots/TeamD.txt", 1);
- if(me.classid == 1)
- {
- Print("Loading sorc function");
- TD_Sorcfunc();
- }
- if(me.classid == 3)
- {
- Print("Loading hammer function");
- NTTM_TownMove("portalspot");
- var ticksTillRepeat = 1;
- while(1)
- {
- if(bGotBo == 0 && --ticksTillRepeat == 0)
- {
- Say("DinReady");
- ticksTillRepeat = 10000;
- }
- TD_TeamCommands();
- Delay(1);
- }
- }
- if(me.classid == 4)
- {
- Print("Loading barb function");
- NTTM_TownMove("portalspot");
- while(1)
- {
- if(quitScript == 1)
- break;
- if(!TD_TeamCommands())
- break;
- Delay(10);
- }
- }
- if(me.classid == 2)
- {
- Print("Loading Necro function");
- NTTM_TownMove("portalspot");
- while(1)
- {
- if(quitScript == 1)
- break;
- TD_TeamCommands();
- Delay(10);
- }
- }
- NTC_SendMsgToScript("NTBotGame.ntj", "SCRIPT_END");
- }
- function NTM_MakeTPFast(dest)
- {
- if(NTC_InTown())
- return true;
- if(!NTC_CastSkill(220, NTC_HAND_RIGHT))
- return false;
- //NTC_PingDelay(500);
- _portalname = GetLocaleString(3226);
- for(var i = 0 ; i < 300 ; i++)
- {
- _portal = NTC_FindUnit(NTC_UNIT_OBJECT, _portalname);
- if(_portal)
- {
- do
- {
- if(_portal.mode == 2 && NTC_CheckOwner(_portal))
- {
- return true;
- }
- } while(_portal.GetNext());
- }
- Delay(5);
- }
- return false;
- return true;
- }
- function NTM_MakeTpFastSafe(dst)
- {
- // rety x many times..
- }
- function NTCS_OutputStatistics()
- {
- var _expGain = me.GetStat(13) - _startExp;
- if(_expGain > 0)
- {
- NTC_SendLogToOOG(NTC_LOG_COMMON, COLOR_2 + "Exp gained " + _expGain);
- }
- }
- var DinRdy = 0;
- function TD_Sorcfunc()
- {
- if(!NTTM_TownMove("waypoint"))
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTTM_TownMove()");
- return;
- }
- if(!NTM_TakeWaypoint(107))
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTM_TakeWaypoint()");
- return;
- }
- NTCS_WalkTo(me.x+5, me.y+5);
- while(!NTC_IsQuesterIn(103, "telemarkebo") || !NTC_IsQuesterIn(103, "telemarkedin"))
- {
- Delay(5);
- }
- while(DinRdy == 0)
- Delay(5);
- Delay(1000);
- for(var i = 0 ; i < 5 ; i++)
- {
- if(NTM_MakeTPFast())
- {
- break;
- }
- }
- Delay(600); // wait on tp to open
- TD_File("NTBot/bots/TeamD.txt", 1, ".bo");
- if(sayMsgs)
- Say("BO");
- while(!me.GetState(32))
- {
- Delay(10);
- }
- if(barbLeaveAfterBo == 1)
- {
- while(NTC_IsPlayerInGame("telemarkebo"))
- {
- Delay(5);
- }
- }
- //NTC_PingDelay(1800);
- //NTP_DoPrecast(true);
- NTC_PutSkill(40, NTC_HAND_RIGHT);
- NTC_CastSkill(40);
- var coordsRiver = [[107, 7798, 5880], [107, 7798, 5840], [107, 7798, 5805], [107, 7798, 5770], [107, 7798, 5730],
- [107, 7798, 5690], [107, 7798, 5660], [107, 7798, 5610]];
- var coordsCs = [[108, 7798, 5570], [108, 7798, 5530], [108, 7821, 5501], [108, 7821, 5461], [108, 7821, 5421], [108, 7821, 5381],
- [108, 7821, 5341], [108, 7821, 5320]];
- for(var i = 0; i < coordsRiver.length; i++)
- {
- if (!NTCS_Sora_TeleportTo(coordsRiver[i][1], coordsRiver[i][2]))
- NTCS_MoveTo(coordsRiver[i][0], coordsRiver[i][1], coordsRiver[i][2]);
- }
- for(var i = 0; i < coordsCs.length; i++)
- {
- if (!NTCS_Sora_TeleportTo(coordsCs[i][1], coordsCs[i][2]))
- NTCS_MoveTo(coordsCs[i][0], coordsCs[i][1], coordsCs[i][2]);
- }
- if(TD_DetectLayout(1) == 1) //T Shape
- {
- NTCS_MoveTo(me.areaid, 7701, 5299);
- NTCS_Deploy(7687, 5288, 0, 0, 5, 5);
- for(var i = 0 ; i < 5 ; i++)
- {
- if(NTM_MakeTPFast())
- {
- break;
- }
- }
- }
- else
- {
- NTCS_MoveTo(me.areaid, 7700, 5313); //L Shape
- NTCS_Deploy(7680, 5313, 5, 5, 0, 0);
- for(var i = 0 ; i < 5 ; i++)
- {
- if(NTM_MakeTPFast())
- {
- break;
- }
- }
- }
- if(onlySora)
- {
- Delay(9000000);
- }
- TD_File("NTBot/bots/TeamD.txt", 1, ".s1"); //vizier
- if(sayMsgs)
- Say("Viz Up");
- if(!TD_VizierSeal())
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "Seal opening");
- return;
- }
- if(sorcSucks == 0)
- {
- NTCS_MoveTo(me.areaid, safex, safey);
- var _Vis = NTC_FindUnit(NTC_UNIT_MONSTER, GetLocaleString(2851), 20);
- NTCS_Sorc_KillMonster(GetLocaleString(2851));
- NTSI_PickItems();
- }
- else
- {
- bossAlive = 1;
- NTCS_GoToStar();
- while(bossAlive == 1)
- {
- if(NTA_IdleDodge(7794, 5295, 10, 30, 1))
- {
- Delay(1000);
- //NTCS_GoToStar();
- }
- // TODO: use potions, etc
- Delay(10);
- }
- }
- if(TD_DetectLayout(3) == 1)
- {
- NTCS_MoveTo(me.areaid, 7900, 5300);
- NTCS_Deploy(7920, 5291, 5, 5, 0, 0);
- for(var i = 0 ; i < 5 ; i++)
- {
- if(NTM_MakeTPFast())
- {
- break;
- }
- }
- }
- else
- {
- NTCS_MoveTo(me.areaid, 7900, 5300);
- NTCS_Deploy(7930, 5278, 0, 5, 5, 0);
- for(var i = 0 ; i < 5 ; i++)
- {
- if(NTM_MakeTPFast())
- {
- break;
- }
- }
- }
- TD_File("NTBot/bots/TeamD.txt", 1, ".s3"); //infector
- if(sayMsgs)
- Say("Fect Up");
- if(!TD_InfectorSeal())
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "Seal opening");
- return;
- }
- //NTCS_MoveTo(me.areaid, safex, safey);
- //sorcSucks = 1; // i put this here as an easy way to make the sorc go back to star instead of trying to fight fect/seis
- if(sorcSucks == 0)
- {
- NTCS_MoveTo(me.areaid, 7900, 5300);
- var _fect = NTC_FindUnit(NTC_UNIT_MONSTER, GetLocaleString(2853), 20);
- NTCS_Sorc_KillMonster(GetLocaleString(2853));
- NTSI_PickItems();
- }
- else
- {
- bossAlive = 1;
- NTCS_GoToStar();
- while(bossAlive == 1)
- {
- if(NTA_IdleDodge(7794, 5295, 10, 30, 1))
- {
- Delay(1000);
- //NTCS_GoToStar();
- }
- Delay(10);
- }
- }
- if(TD_DetectLayout(2) == 1) // S
- {
- NTCS_MoveTo(me.areaid, 7776, 5230);
- NTCS_Deploy(7776, 5220, 0, 0, 15, 15);
- for(var i = 0 ; i < 5 ; i++)
- {
- if(NTM_MakeTPFast())
- {
- break;
- }
- }
- }
- else
- {
- NTCS_MoveTo(me.areaid, 7779, 5200);
- NTCS_Deploy(7779, 5180, 0, 0, 10, 10);
- for(var i = 0 ; i < 5 ; i++)
- {
- if(NTM_MakeTPFast())
- {
- break;
- }
- }
- }
- TD_File("NTBot/bots/TeamD.txt", 1, ".s2"); //de seis
- if(sayMsgs)
- Say("Seis Up");
- if(!TD_DeSeisSeal())
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "Seal opening");
- return;
- }
- if(sorcSucks == 0)
- {
- NTCS_MoveTo(me.areaid, 7776, 5230);
- var _Seis = NTC_FindUnit(NTC_UNIT_MONSTER, GetLocaleString(2852), 20);
- NTCS_Sorc_KillMonster(GetLocaleString(2852));
- NTSI_PickItems();
- }
- else
- {
- bossAlive = 1;
- NTCS_GoToStar();
- while(bossAlive == 1)
- {
- if(NTA_IdleDodge(7794, 5295, 10, 30, 1))
- {
- Delay(1000);
- //NTCS_GoToStar();
- }
- Delay(10);
- }
- }
- if(!NTCS_MoveTo(me.areaid, 7792, 5292))
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTCS_MoveTo()");
- return;
- }
- NTM_MakeTPFast();
- TD_File("NTBot/bots/TeamD.txt", 1, ".d");
- if(sayMsgs)
- Say("Dia Out");
- NTC_FindUnit(NTC_UNIT_MONSTER, 243, 60);
- if(sorcGetDiaXP == 1)
- {
- if(!NTCS_Sorc_KillMonster(243))
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "NTCS_Sorc_KillMonster()");
- return;
- }
- NTSI_PickItems();
- }
- else
- {
- if(!NTCS_UsePortal("BluePortal", 103, me.name))
- {
- NTTM_CheckAct();
- }
- Delay(60000);
- }
- NTCS_OutputStatistics();
- }
- //--internal functions--
- function quitfunc(msg, type) //quit when leader leaves game
- {
- //if(msg.indexOf("weaken") != -1 || msg.indexOf("timeout") != -1) { //if anyone quits
- if(msg.indexOf(leader) != -1 && msg.indexOf("telemarkebo") == -1/* && msg.indexOf("telemarkedin") == -1 */ && (msg.indexOf("weaken") != -1 || msg.indexOf("timeout") != -1)) //if leader quits
- {
- NTCS_OutputStatistics();
- Delay(2000);
- NTCS_SafeExitGame();
- }
- if(msg.indexOf("telemarkedin") != -1 /*&& msg.indexOf("telemarkebo") == -1 && msg.indexOf("telemarkedin") == -1 */ && (msg.indexOf("weaken") != -1 || msg.indexOf("timeout") != -1)) //if din quits
- {
- NTCS_OutputStatistics();
- Delay(2000);
- NTCS_SafeExitGame();
- }
- if(msg.indexOf("Viz Down") != -1 || msg.indexOf("Seis Down") != -1 || msg.indexOf("Fect Down") != -1)
- {
- bossAlive = 0;
- }
- if(msg.indexOf("DinReady") != -1)
- {
- DinRdy = 1;
- }
- }
- function TD_Preattack(classid, extrahammers) //extra hammers = hammers cast after the seal boss is spawned
- {
- NTC_PutSkill(NTConfig_AttackSkill[4], NTC_HAND_RIGHT);
- while(!NTC_FindUnit(NTC_UNIT_MONSTER, classid))
- {
- NTC_CastSkill(NTConfig_AttackSkill[3], 2);
- if ((NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe, true)) || (me.hp <= parseInt(me.hpmax * NTConfig_TPChicken,10) / 100)) {
- NTTMGR_VisitTown();
- }
- }
- for(var i = 0 ; i < extrahammers ; i++)
- {
- var _mon = NTC_FindUnit(NTC_UNIT_MONSTER, classid);
- if(_mon.hp <= 0 || _mon.mode == 0 || _mon.mode == 12) // if they're dead we don't need to precast anymore
- {
- break;
- }
- NTC_CastSkill(NTConfig_AttackSkill[3], 2);
- if ((NTTMGR_CheckCurse(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe, true)) || (me.hp <= parseInt(me.hpmax * NTConfig_TPChicken,10) / 100)) {
- NTTMGR_VisitTown();
- }
- }
- }
- function TD_VizierSeal() //vizier
- {
- for(var i = 0 ; i < 30 ; i++)
- {
- NTCS_MoveToPresetUnit(me.areaid, 2, 395);
- var _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 395, 5);
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
- Delay(100);
- if(_seal.mode <= 0)
- {
- //NTCS_MoveTo(me.areaid, safex, safey);
- }
- else
- {
- break;
- }
- Delay(100);
- if(i == 4 && _seal.mode <= 0)
- {
- return false;
- }
- }
- for(i = 0 ; i < 30 ; i++)
- {
- NTCS_MoveToPresetUnit(me.areaid, 2, 396);
- _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 396, 5);
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
- Delay(100);
- if(_seal.mode <= 0)
- {
- //NTCS_MoveTo(me.areaid, safex, safey);
- }
- else
- {
- break;
- }
- Delay(100);
- if(i == 4 && _seal.mode <= 0)
- {
- return false;
- }
- }
- return true;
- }
- function TD_DeSeisSeal() //de seis
- {
- for(var i = 0 ; i < 30 ; i++)
- {
- NTCS_MoveToPresetUnit(me.areaid, 2, 394);
- _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 394, 5);
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
- Delay(100);
- if(_seal.mode <= 0)
- {
- //NTCS_MoveTo(me.areaid, safex, safey);
- }
- else
- {
- break;
- }
- Delay(100);
- if(i == 4 && _seal.mode <= 0)
- {
- return false;
- }
- }
- return true;
- }
- function TD_InfectorSeal() //infector
- {
- for(var i = 0 ; i < 30 ; i++)
- {
- NTCS_MoveToPresetUnit(me.areaid, 2, 393);
- _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 393, 5);
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
- Delay(100);
- if(_seal.mode <= 0)
- {
- //NTCS_MoveTo(me.areaid, safex, safey);
- }
- else
- {
- break;
- }
- Delay(100);
- if(i == 4 && _seal.mode <= 0)
- {
- return false;
- }
- }
- for(i = 0 ; i < 30 ; i++)
- {
- NTCS_MoveToPresetUnit(me.areaid, 2, 392);
- _seal = NTC_FindUnit(NTC_UNIT_OBJECT, 392, 5);
- NTC_DoClick(NTC_CLICK_LDOWN, NTC_SHIFT_NONE, _seal);
- Delay(100);
- if(_seal.mode <= 0)
- {
- //NTCS_MoveTo(me.areaid, safex, safey);
- }
- else
- {
- break;
- }
- Delay(100);
- if(i == 4 && _seal.mode <= 0)
- {
- return false;
- }
- }
- return true;
- }
- function TD_TeamCommands()
- {
- var _msg = TD_File("NTBot/bots/TeamD.txt", 0);
- if(_msg && _msg != _MyDT_PreMessage)
- {
- _MyDT_PreMessage = _msg;
- switch(_msg.substring(_msg.indexOf("/") + 1))
- {
- case ".bo":
- if(me.classid == 3) //Hammerdin
- {
- NTCS_UsePortal("BluePortal", 107, leader);
- bGotBo = 1;
- while(!me.GetState(32))
- {
- Delay(10);
- }
- NTC_PingDelay(2000);
- NTP_DoPrecast(true);
- if(!NTCS_UsePortal("BluePortal", 103, leader)) //or make my own?
- {
- NTTM_CheckAct();
- }
- return true;
- }
- if(me.classid == 4) //Barb
- {
- NTCS_UsePortal("BluePortal", 107, leader);
- while(!NTC_IsQuesterIn(107, "telemarkedin")) // wait on din
- {
- Delay(10);
- }
- NTC_CastSkill(155, NTC_HAND_RIGHT); // Battle Command
- for(var _botimes = 0; _botimes < 4; _botimes++)
- {
- NTC_CastSkill(155, NTC_HAND_RIGHT); // Battle Command
- NTC_CastSkill(138, NTC_HAND_RIGHT); // Shout
- NTC_CastSkill(149, NTC_HAND_RIGHT); // Battle Orders
- }
- if(barbLeaveAfterBo == 1)
- NTCS_SafeExitGame();
- if(!NTCS_UsePortal("BluePortal", 103, leader))
- {
- NTTM_CheckAct();
- }
- return true;
- }
- if(me.classid == 2) //Necro
- {
- NTCS_UsePortal("BluePortal", 107, leader);
- Delay(500);
- NTP_DoPrecast(true);
- Delay(4500);
- if(!NTCS_UsePortal("BluePortal", 103, leader))
- {
- NTTM_CheckAct();
- }
- return true;
- }
- break;
- case ".s1": //vizier
- if(me.classid == 3) //Hammerdin
- {
- NTC_PutSkill(NTC_HAND_LEFT, 112);
- NTC_PutSkill(NTC_HAND_RIGHT, 113);
- if(!NTCS_UsePortal("BluePortal", 108, leader))
- {
- return true;
- }
- TD_Preattack(GetLocaleString(2851), 8);
- NTCS_Din_KillMonster(GetLocaleString(2851));
- if(sayMsgs)
- Say("Viz Down");
- NTSI_PickItems();
- if(NTCS_GetPortalDistance("BluePortal", 103, leader) >= 10 || !NTCS_UsePortal("BluePortal", 103, leader))
- {
- NTTM_CheckAct();
- }
- return true;
- }
- if(me.classid == 4 && barbTakeTps == 1) //Barb
- {
- if(!NTCS_UsePortal("BluePortal", 108, leader))
- {
- return true;
- }
- for(var i = 0 ; i < 3 ; i++)
- {
- NTC_CastSkill(130, NTC_HAND_RIGHT);
- }
- if(!NTCS_UsePortal("BluePortal", 103, leader))
- {
- return true;
- }
- NTTM_CheckAct();
- if(!NTCS_UsePortal("BluePortal", 103, leader))
- {
- return true;
- }
- NTTM_CheckAct();
- }
- if(me.classid == 2) //Necro
- {
- if(!NTCS_UsePortal("BluePortal", 108, leader))
- {
- return true;
- }
- NTA_KillMonster(GetLocaleString(2851));
- if(sayMsgs)
- Say("Viz Down");
- NTTM_CheckAct();
- return true;
- }
- break;
- case ".s2": //de seis
- if(me.classid == 3) //Hammerdin
- {
- NTC_PutSkill(NTC_HAND_LEFT, 112);
- NTC_PutSkill(NTC_HAND_RIGHT, 113);
- if(!NTCS_UsePortal("BluePortal", 108, leader))
- {
- return true;
- }
- TD_Preattack(GetLocaleString(2852), 8);
- NTCS_Din_KillMonster(GetLocaleString(2852));
- if(sayMsgs)
- Say("Seis Down");
- NTSI_PickItems();
- if(NTCS_GetPortalDistance("BluePortal", 103, leader) >= 10 || !NTCS_UsePortal("BluePortal", 103, leader))
- {
- NTTM_CheckAct();
- }
- return true;
- }
- if(me.classid == 4 && barbTakeTps == 1) //Barb
- {
- if(!NTCS_UsePortal("BluePortal", 108, leader))
- {
- return true;
- }
- for(var i = 0 ; i < 3 ; i++)
- {
- NTC_CastSkill(130, NTC_HAND_RIGHT);
- }
- //NTP_DoPrecast(true);
- //NTA_KillMonster(GetLocaleString(2852));
- //NTC_Delay(500);
- if(!NTCS_UsePortal("BluePortal", 103, leader))
- {
- return true;
- }
- NTTM_CheckAct();
- return true;
- }
- if(me.classid == 2) //Necro
- {
- NTCS_UsePortal("BluePortal", 108, leader);
- NTC_Delay(3000);
- NTA_KillMonster(GetLocaleString(2852));
- NTSI_PickItems();
- if(!NTCS_UsePortal("BluePortal", 103, leader))
- {
- NTTM_CheckAct();
- }
- NTP_DoPrecast(true);
- }
- break;
- case ".s3": //infector
- if(me.classid == 3) //Hammerdin
- {
- NTC_PutSkill(NTC_HAND_LEFT, 112);
- NTC_PutSkill(NTC_HAND_RIGHT, 113);
- if(!NTCS_UsePortal("BluePortal", 108, leader))
- {
- return true;
- }
- TD_Preattack(GetLocaleString(2853), 8);
- NTCS_Din_KillMonster(GetLocaleString(2853));
- if(sayMsgs)
- Say("Fect Down");
- NTSI_PickItems();
- if(NTCS_GetPortalDistance("BluePortal", 103, leader) >= 10 || !NTCS_UsePortal("BluePortal", 103, leader))
- {
- NTTM_CheckAct();
- }
- return true;
- NTP_DoPrecast(true);
- }
- if(me.classid == 4 && barbTakeTps == 1) //Barb
- {
- if(!NTCS_UsePortal("BluePortal", 108, leader))
- {
- return true;
- }
- for(var i = 0 ; i < 3 ; i++)
- {
- NTC_CastSkill(130, NTC_HAND_RIGHT);
- }
- //NTP_DoPrecast(true);
- //NTA_KillMonster(GetLocaleString(2853));
- //NTC_Delay(500);
- if(!NTCS_UsePortal("BluePortal", 103, leader)) //or make my own?
- {
- return true;
- }
- NTTM_CheckAct();
- return true;
- }
- if(me.classid == 2) //Necro
- {
- NTCS_UsePortal("BluePortal", 108, leader);
- NTC_Delay(3000);
- NTA_KillMonster(GetLocaleString(2853));
- NTSI_PickItems();
- if(!NTCS_UsePortal("BluePortal", 103, leader)) //or make my own?
- {
- NTTM_CheckAct();
- }
- NTP_DoPrecast(true);
- }
- break;
- case ".d":
- if(me.classid == 3) //Hammerdin
- {
- NTC_PutSkill(NTC_HAND_LEFT, 112);
- NTC_PutSkill(NTC_HAND_RIGHT, 113);
- NTCS_UsePortal("BluePortal", 108, leader);
- NTC_FindUnit(NTC_UNIT_MONSTER, 243, 100);
- if(!NTCS_Din_KillMonster(243))
- {
- NTC_SendMsgToScript("NTBotGame.ntj", "KillMonster()");
- return true;
- }
- NTSI_PickItems();
- NTCS_SafeExitGame();
- }
- /*if(me.classid == 4) { //Barb, Uncomment Section if you want to follow to D
- NTCS_UsePortal("BluePortal", 108, leader);
- NTP_DoPrecast(true);
- //do something until diablo dies
- var _diablo = NTC_FindUnit(NTC_UNIT_MONSTER, 243)
- while(_diablo && _diablo.hp > 0)
- NTC_Delay(500);
- }*/
- /*if(me.classid == 2) { //Necro Uncomment if you want to follow to D
- NTCS_UsePortal("BluePortal", 108, leader);
- NTP_DoPrecast(true);
- //do something until diablo dies
- var _diablo = NTC_FindUnit(NTC_UNIT_MONSTER, 243)
- while(_diablo && _diablo.hp > 0)
- NTC_Delay(500);
- }*/
- break;
- }
- }
- return true;
- }
- function TD_DetectLayout(seal)
- {
- switch(seal)
- {
- case 1:
- _sealpos = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT);
- for(var i = 0 ; i < _sealpos.length ; i++)
- {
- if(_sealpos[i].id == 396)
- {
- if(_sealpos[i].roomy * 5 + _sealpos[i].y == 5275)
- {
- return 1;
- }
- else
- {
- return 2;
- }
- break;
- }
- }
- break;
- case 2:
- _sealpos = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT);
- for(i = 0 ; i < _sealpos.length ; i++)
- {
- if(_sealpos[i].id == 394)
- {
- if(_sealpos[i].roomx * 5 + _sealpos[i].x == 7773)
- {
- return 1;
- }
- else
- {
- return 2;
- }
- break;
- }
- }
- break;
- case 3:
- _sealpos = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT);
- for(i = 0 ; i < _sealpos.length ; i++)
- {
- if(_sealpos[i].id == 392)
- {
- if(_sealpos[i].roomx * 5 + _sealpos[i].x == 7893)
- {
- return 1;
- }
- else
- {
- return 2;
- }
- break;
- }
- }
- break;
- }
- }
- function TD_File(path, mode, msg, delay) //big thanks to all the koreans out there
- {
- var _msg = "";
- var _line = "";
- var _fileHandle;
- var _isFileCheck = false;
- if(arguments.length < 3)
- {
- msg = "";
- }
- if (arguments.length < 4) delay = (mode > 0) ? 5 : 2;
- while(delay--)
- {
- if(mode == 2 && !_isFileCheck)
- {
- _fileHandle = FileOpen(path, 0);
- if(!_fileHandle)
- {
- _fileHandle = FileOpen(path, 1);
- }
- if(_fileHandle)
- {
- _fileHandle.Close();
- }
- _isFileCheck = true;
- }
- _fileHandle = FileOpen(path, mode);
- if(_fileHandle)
- {
- break;
- }
- if(delay)
- {
- Delay(200);
- }
- }
- if(_fileHandle)
- {
- if(mode == 0)
- {
- while(!_fileHandle.eof)
- {
- _line = _fileHandle.ReadLine();
- if(_line || !_fileHandle.eof)
- {
- _msg += _line + msg;
- }
- }
- }
- else if(msg)
- {
- _fileHandle.WriteLine(msg);
- }
- _fileHandle.Close();
- }
- return _msg;
- }
- function NTCS_Deploy(x, y, plusx, minusx, plusy, minusy) //you can build up to 5 positions (x-shaped), center position is x, y; rest are +/- offsets
- {
- // might wanna make this call etal's TD_Deploy, it seems more advanced
- var _monster = NTC_FindUnit(NTC_UNIT_MONSTER);
- var num = [0, 0, 0, 0, 0];
- var firstnum = 100;
- if(!_monster)
- {
- return NTCS_MoveTo(me.areaid, x, y);
- }
- do
- {
- if(GetDistance(_monster.x, _monster.y, x, y) <= 15)
- if(_monster.classid != 306)
- {
- num[0]++;
- }
- if(GetDistance(_monster.x, _monster.y, x + plusx, y) <= 15)
- if(_monster.classid != 306)
- {
- num[1]++;
- }
- if(GetDistance(_monster.x, _monster.y, x - minusx, y) <= 15)
- if(_monster.classid != 306)
- {
- num[2]++;
- }
- if(GetDistance(_monster.x, _monster.y, x, y + plusy) <= 15)
- if(_monster.classid != 306)
- {
- num[3]++;
- }
- if(GetDistance(_monster.x, _monster.y, x, y - minusy) <= 15)
- if(_monster.classid != 306)
- {
- num[4]++;
- }
- }
- while(_monster.GetNext())
- for(var i = 0 ; i < num.length ; i++)
- {
- //Print("ÿc1" + num[i] + " ÿc:monsters at position ÿc;" + i); //doesn't count storm casters as of v0.8
- if(num[i] < firstnum)
- {
- firstnum = num[i];
- }
- }
- if(firstnum == num[0])
- {
- safex = x;
- safey = y;
- NTCS_MoveTo(me.areaid, x, y);
- }
- else if(firstnum == num[1])
- {
- safex = x + plusx;
- safey = y;
- NTCS_MoveTo(me.areaid, x + plusx, y);
- }
- else if(firstnum == num[2])
- {
- safex = x - minusx;
- safey = y;
- NTCS_MoveTo(me.areaid, x - minusx, y);
- }
- else if(firstnum == num[3])
- {
- safex = x;
- safey = y + plusy;
- NTCS_MoveTo(me.areaid, x, y + plusy);
- }
- else if(firstnum == num[4])
- {
- safex = x;
- safey = y - minusy;
- NTCS_MoveTo(me.areaid, x, y - minusy);
- }
- }
Add Comment
Please, Sign In to add comment