//////////////////////////////////////////////////////////////////////////////// // Rune Finder // Countess Bot /////////////////////////////////////////////////////////////////////////////// // Script Written By Blues // Designed For JED 2.0 // Version 1.00 /////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include /////////////////////////////////////// // Place holding variable, do not edit /////////////////////////////////////// var SkipEnchants = new Array(); var CountessAttack = new Array(); var Defenses = new Array(); var skiptotal = 0; var countessattacktotal = 0; var defensestotal = 0; ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Configurable Varibles Change These If You Need To // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // //Variables to heal life and mana change them to the // //lowest you want them to get before healing. // // var heal_life = 500; // var heal_mana = 500; // // // //Percent at which you want to repair your items // var repair_percent = .3; // // // //Set to true or false to use a mercenary // var usingmerc = true; // // // //Set this to the level of health you want to reach before chickening // var HealthChicken = 250; // // // //Set this to the level of health you would like to try and heal at // var HealthPotion = 400; // // // //Set this to the level of mana you want to reach before chickening // var ManaChicken = 10; // // // //Set this to true or false if you want to chicken // //when your mana reaches a certain level // var UseManaChicken = false; // // // //Set this if you want to print enchantments on the screen // var ShowEnchant = true; // // // //Set this to true or false if you want to skip certain enchantments // var UseSkipEnchantments = false; // // // //Use this to list which immunes to skip // // Example: SkipEnchantment("Lightning Enchanted", 0); // SkipEnchantment("Conviction", 1); // SkipEnchantment("Lightning Enchanted", 1); // SkipEnchantment("Fanaticism", 1); // // // //Use This if you would like to heal your merc during battle // var UseMercHeal = true; // // // //Set the level of health your merc should have // //before healing him // var HealMercLvl = 20; // // // //This is the variable to set to use your defenses // //EXAMPLE: see Attack example // // // AddDefense("Energy Shield", 1, 0, 500), // AddDefense("Thunder Storm", 1, 0, 500), // AddDefense("Shiver Armor", 1, 0, 500), // // // //This is the attack sequence for the countess. // //EXAMPLE:AddAttack("Name", repeat(how many times), distance(you should be from target), delay(between casts));// // // AddAttack("Static Field", 4, 10, 500), // AddAttack("Nova", 5, 10, 500) // // // //This is the attack it will repeat after during the attack sequence // var RepeatAfter = 1; // // // //This is set to repostition you incase you get out // //of range during attacks // var reposition = true; // // // //Use TheForce // var UseTheForce = true; // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //End Configurable vars // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// //***********************************************************************************// //-----------------------------------------------------------------------------------// // UNLESS YOUR AN ADVANCED USER/SCRIPTER YOU SHOULDN'T TOUCH ANYTHING PAST HERE // //-----------------------------------------------------------------------------------// //***********************************************************************************// //////////////////////////////////////////////////////////////////////////////////////// //Global Variables Dont Touch! //////////////////////////////////////////////////////////////////////////////////////// var version = "Version 1.00"; var FoundCountess = false; var potion = "Full Rejuv Potion"; var location; var stash; var StashX; var StashY; var OriginalLocation; var AkaraPath = new Array(4); var CharsiPath = new Array(3); var KashyaPath = new Array(2); var WpUpPath = new Array(2); var WpDownPath = new Array(2); var WpLeftPath = new Array(2); var WpRightPath = new Array(2); /////////////////////////////////////////////////////////////// // Main Function /////////////////////////////////////////////////////////////// function JSMain(){ PBrown("--------------------------------------------------------------------- "); Print(CBlue+ "Countess Script " + COrange +version+ CBlue + " Created By " +COrange+ "Blues"); PBrown("--------------------------------------------------------------------- "); POrange("Starting the run for " + Player.Name); if(UseTheForce) ShowTheForce(); while (!Player.InGame) Sleep(500); Sleep(3000); if(!CheckHand()){ ELog("Error: Item in hand cannot be stashed."); Sleep(2000); if(UseTheForce) Stats("increment Exits"); Disconnect(); return; } if(!Player.Class == 1){ PRed("You must be a sorceress to use this script!"); Sleep(2000); if(UseTheForce) Stats("increment Exits"); Disconnect(); return; } if (!PickupBody()){ ELog("Error: Unable to retrieve body."); Sleep(2000); if(UseTheForce) Stats("increment Exits"); Disconnect(); return; } SetupGlobalBeltPotions(); ClearInventoryPotions(potion); if(Player.Act != 1){ ActWarp(1); Print(CBlue + "Getting Town Locations"); Sleep(3000); GetTownLocations(); Sleep(1000); GoToStart(location); }else{ Print(CBlue + "Getting Town Locations"); Sleep(2500); GetTownLocations(); } HandleGold(); UseNpcs(); StashInventory(); PBlue("The Countess Run Is Starting"); if(CountessRun()){ SmartSleep(1000); Disconnect(); return; }else{ ELog("General failure."); SmartSleep(2000); if(UseTheForce) Stats("increment Exits"); Disconnect(); return; } } //////////////////////////////////////////////////////////////// //Main Countess Run //////////////////////////////////////////////////////////////// function CountessRun(){ WpPath(location); SetEventHandler("onHealth", "HealthEventFunc"); SetEventHandler("onDeath", "DeathEventFunc"); if(UseManaChicken) SetEventHandler("onMana", "ManaEventFunc"); if(!Merc.IsDead && UseMercHeal) SetEventHandler("onMercHealth", "MercHealthEventFunc"); FindTower(); GoToTower5(); KillCountess(); return true; } /////////////////////////////////////////////////////////////// //Function to kill Countess /////////////////////////////////////////////////////////////// function KillCountess(){ FindCountessLocation(); for (i=0; i < 5; i++){ Countess = CountessInfo(); SmartSleep(100); } if(Countess){ if (ShowEnchant){ PBrown("The Countess: "); Countess.PrintEnchantments(4); } if(UseSkipEnchantments && CheckEnchantments(SkipEnchants, Countess)) { ELog("BAD Immunities detected."); if(UseTheForce) Stats("increment Immunes"); SmartSleep(500); return false; } }else{ ELog("Countess not found."); return false; } PickitEnable(); AttackSequence(CountessAttack, Countess, RepeatAfter); if(UseTheForce) Stats("increment countess"); PBrown("------------------------------------------------------------------------------------------------------------------------------------"); POrange(" The Countess Has Been "); Print(" " +COrange+ "PWNED" +CBrown+ " (O '.')--O" +CRed+ "<(X.x)>" +CBrown+ "O--('.' O) " +COrange+ "PWNED "); PBrown("------------------------------------------------------------------------------------------------------------------------------------"); PickitDisable(); PickIt(); RefillBeltPotions(potion, RefillBeltAmount()); RemoveEventHandler("onHealth", "HealthEventFunc"); if(UseManaChicken) RemoveEventHandler("onMana", "ManaEventFunc"); if(!Merc.IsDead && UseMercHeal) RemoveEventHandler("onMercHealth", "MercHealthEventFunc"); SmartSleep(2500); return; } /////////////////////////////////////////////////////// //Function to use the right paths /////////////////////////////////////////////////////// function GetTownLocations(){ EList = Entity.GetEntities("bank"); for(i = 0; i < EList.length; i++){ if(EList[i].Class == Entity.Object && (EList[i].Type == 267)){ stash = EList[i]; StashX = stash.Location.x; StashY = stash.Location.y; } } EList = Entity.GetEntities("waypoint"); for(i = 0; i < EList.length; i++){ if (EList[i].Class == Entity.Object && (EList[i].Type == 119)){ waypoint = EList[i]; WPX = waypoint.Location.x; WPY = waypoint.Location.y; } } if (WPX - 33 == StashX && WPY + 20 == StashY) { location = "Down"; } if (WPX - 28 == StashX && WPY + 25 == StashY) { location = "Up"; } if (WPX + 7 == StashX && WPY + 30 == StashY) { location = "Left"; } if (WPX + 12 == StashX && WPY + 30 == StashY) { location = "Right"; } OriginalLocation = new coord(StashX + 7, StashY - 1); AkaraPath[0] = new coord(StashX + 20, StashY); AkaraPath[1] = new coord(StashX + 36, StashY - 5); AkaraPath[2] = new coord(StashX + 52, StashY - 16); AkaraPath[3] = new coord(StashX + 68, StashY - 17); CharsiPath[0] = new coord(StashX + 5, StashY - 13); CharsiPath[1] = new coord(StashX - 14, StashY - 16); CharsiPath[2] = new coord(StashX - 25, StashY - 9); KashyaPath[0] = new coord(StashX + 17, StashY + 6); KashyaPath[1] = new coord(StashX + 26, StashY + 8); WpUpPath[0] = new coord(StashX + 10, StashY - 20); WpUpPath[1] = new coord(StashX + 25, StashY - 23); WpDownPath[0] = new coord(StashX + 25, StashY - 1); WpDownPath[1] = new coord(StashX + 40, StashY - 15); WpLeftPath[0] = new coord(StashX + 4, StashY - 13); WpLeftPath[1] = new coord(StashX - 6, StashY - 26); WpRightPath[0] = new coord(StashX + 2, StashY - 12); WpRightPath[1] = new coord(StashX - 11, StashY - 27); return location; } /////////////////////////////////////////////// //Function to use the npcs /////////////////////////////////////////////// function UseNpcs(){ if(Player.Health < heal_life || Player.Mana < heal_mana){ PBlue("Healing With Akara"); Move(OriginalLocation); Move(AkaraPath[0]); Move(AkaraPath[1]); Move(AkaraPath[2]); Move(AkaraPath[3]); Sleep(500); TalkToAkara(heal_life, heal_mana); if (NeedToIdentify()) IdentifyInventoryItems(); Sleep(500); Move(AkaraPath[3]); Move(AkaraPath[2]); Move(AkaraPath[1]); Move(AkaraPath[0]); Move(OriginalLocation); }else{ if(NeedToIdentify()){ PBlue("Identifying Items"); Move(OriginalLocation); Move(AkaraPath[0]); Move(AkaraPath[1]); Move(AkaraPath[2]); Move(AkaraPath[3]); Sleep(500); TalkToAkara(heal_life, heal_mana); if (NeedToIdentify()) IdentifyInventoryItems(); Sleep(500); Move(AkaraPath[3]); Move(AkaraPath[2]); Move(AkaraPath[1]); Move(AkaraPath[0]); Move(OriginalLocation); } } if(CheckForRepair(repair_percent)){ PBlue("Repairing with Charsi"); Move(OriginalLocation); Move(CharsiPath[0]); Move(CharsiPath[1]); Move(CharsiPath[2]); Sleep(500); TalkToCharsi(); Sleep(500); Move(CharsiPath[2]); Move(CharsiPath[1]); Move(CharsiPath[0]); Move(OriginalLocation); } if(usingmerc && Merc.IsDead){ PBlue("Resurrecting Merc with Kashya"); Move(OriginalLocation); Move(KashyaPath[0]); Move(KashyaPath[1]); Sleep(500); TalkToKashya(); Sleep(500); Move(KashyaPath[1]); Move(KashyaPath[0]); Move(OriginalLocation); } } ///////////////////////////////////////////////////////// //Move me to the wp ///////////////////////////////////////////////////////// function WpPath(path){ switch (path){ case "Down": Sleep(500); Move(WpDownPath[0]); Move(WpDownPath[1]); DoWaypoint("Black Marsh"); break; case "Up": Sleep(500); Move(WpUpPath[0]); Move(WpUpPath[1]); DoWaypoint("Black Marsh"); break; case "Left": Sleep(500); Move(WpLeftPath[0]); Move(WpLeftPath[1]); DoWaypoint("Black Marsh"); break; case "Right": Sleep(500); Move(WpRightPath[0]); Move(WpRightPath[1]); DoWaypoint("Black Marsh"); break; default: PRed("Town Paths Not Found"); Sleep(1000); if(UseTheForce) Stats("increment Exits"); Disconnect(); break; } } /////////////////////////////////////////////////////// //Function to go to the start point from other acts /////////////////////////////////////////////////////// function GoToStart(path){ switch (path){ case "Down": Move(WpDownPath[0]); Move(OriginalLocation); break; case "Up": Move(WpUpPath[0]); Move(OriginalLocation); break; case "Left": Move(WpLeftPath[0]); Move(OriginalLocation); break; case "Right": Move(WpRightPath[0]); Move(OriginalLocation); break; default: PRed("Town Paths Not Found"); Sleep(2000); if(UseTheForce) Stats("increment Exits"); Disconnect(); break; } } /////////////////////////////////////////////////////// //Function to move to the Tower /////////////////////////////////////////////////////// function FindTower(){ DoDefense(); PGray("Teleporting To The Tower"); SmartSleep(1500); while(Player.CurrentRoom != 163){ Tries = 0; while(!TeleMovePath(163, 163)){ Tries++; if(Tries == 3){ ELog("TeleMovePath() Failed Finding Tower."); SmartSleep(500); if(UseTheForce) Stats("increment Exits"); Disconnect(); }else{ BumpMe(); SmartSleep(200); } } } if(Player.CurrentRoom == 163){ do{ DoOutsideStairs(); }while(Player.CurrentRoom != 164); }else{ ELog("Failed To Make It To Room 163"); SmartSleep(500); if(UseTheForce) Stats("increment Exits"); Disconnect(); } } //////////////////////////////////////////////////////// //Function to find our way to tower level 5 //////////////////////////////////////////////////////// function GoToTower5(){ if(Player.CurrentRoom == 164){ do{ SmartSleep(1000); DoTowerMainStairs(); SmartSleep(500); }while(Player.CurrentRoom == 164); }else{ ELog("Failed To Get To Room 164"); if(UseTheForce) Stats("increment Exits"); Sleep(500); Disconnect(); } PGray("Teleporting Down Path To Tower Level 5"); while(Player.CurrentRoom != 159){ SmartSleep(500); Tries = 0; while(!TeleMovePath(143, 146)){ Tries++; if(Tries == 5){ ELog("TeleMovePath() Failed In Tower."); SmartSleep(500); if(UseTheForce) Stats("increment Exits"); Disconnect(); }else{ BumpMe(); SmartSleep(500); } } Sleep(500); if(Player.CurrentRoom > 142 && Player.CurrentRoom < 147){ do{ SmartSleep(500); DoTowerLevelStairs(); SmartSleep(500); }while(Player.CurrentRoom > 142 && Player.CurrentRoom < 147); } } } //////////////////////////////////////////////////////// //Function To Use To unstick me if i get stuck //////////////////////////////////////////////////////// function BumpMe(){ Print(CBrown + "Bump..."); if(!TeleMove(Player.Location.x - 30, Player.Location.y + 30)){ if(!TeleMove(Player.Location.x + 30, Player.Location.y + 30)){ if(!TeleMove(Player.Location.x - 30, Player.Location.y - 30)){ if(!TeleMove(Player.Location.x + 30, Player.Location.y - 30)){ if(!TeleMove(Player.Location.x - 20, Player.Location.y + 20)){ if(!TeleMove(Player.Location.x + 20, Player.Location.y + 20)){ if(!TeleMove(Player.Location.x - 20, Player.Location.y - 20)){ if(!TeleMove(Player.Location.x + 20, Player.Location.y - 20)){ if(!TeleMove(Player.Location.x - 10, Player.Location.y + 10)){ if(!TeleMove(Player.Location.x + 10, Player.Location.y + 10)){ if(!TeleMove(Player.Location.x - 10, Player.Location.y - 10)){ if(!TeleMove(Player.Location.x + 10, Player.Location.y - 10)){ Print(CRed + "Bump() Failed"); } } } } } } } } } } } } } //////////////////////////////////////////////////////// //Functions to use the correct stairs //////////////////////////////////////////////////////// function DoOutsideStairs(){ EList = Entity.GetEntities(); for (TMPi=0; TMPi < EList.length; TMPi++){ if (EList[TMPi].Class == Entity.Stair && EList[TMPi].Type == 10){ Stairway = EList[TMPi]; TeleMove(Stairway.Location); SmartSleep(500); Stairway.Interact(); SmartSleep(1000); return true; } } } function DoTowerMainStairs(){ EList = Entity.GetEntities(); for (TMPi=0; TMPi < EList.length; TMPi++){ if (EList[TMPi].Class == Entity.Stair && EList[TMPi].Type == 12) { Stairway = EList[TMPi]; Move(Stairway.Location); SmartSleep(500); Stairway.Interact(); SmartSleep(1000); return true; } } } function DoTowerLevelStairs(){ EList = Entity.GetEntities(); for (TMPi=0; TMPi < EList.length; TMPi++){ if (EList[TMPi].Class == Entity.Stair && EList[TMPi].Type == 9){ Stairway = EList[TMPi]; TeleMove(Stairway.Location); SmartSleep(500); Stairway.Interact(); SmartSleep(1000); return true; } } } //////////////////////////////////////////////////////// //Function To Find The Countess //////////////////////////////////////////////////////// function FindCountessLocation(){ EList = Entity.GetEntities(); for(i = 0; i < EList.length; i++){ if(EList[i].Class == Entity.Stair && EList[i].Type == 8){ MyStair = EList[i]; } } DoDefense(); SmartSleep(1000); if (MyStair.Location.x == 12570 && MyStair.Location.y == 11126){ CountessPath1(); }else{ if(MyStair.Location.x == 12635 && MyStair.Location.y == 11061){ CountessPath2(); }else{ ELog("Couldn't Locate Level 5 Stairs"); if(UseTheForce) Stats("increment Exits"); SmartSleep(500); Disconnect(); } } if(FoundCountess){ TeleMove(monster.Location); } } ////////////////////////////////////////////////////////// //Countess Paths ////////////////////////////////////////////////////////// function CountessPath1(){ TeleMove(12564, 11108); TeleMove(12566, 11090); TeleMove(12566, 11067); TeleMove(12560, 11041); CountessInfo(); Tries = 0; while(!FoundCountess){ Tries++; TeleMove(12566, 11067); TeleMove(12560, 11041); CountessInfo(); SmartSleep(500); if(Tries = 4 && !FoundCountess){ return false; } } } function CountessPath2(){ TeleMove(12614, 11066); TeleMove(12592, 11064); TeleMove(12569, 11065); TeleMove(12541, 11060); CountessInfo(); Tries = 0; while(!FoundCountess){ Tries++; TeleMove(12569, 11065); TeleMove(12541, 11060); CountessInfo(); SmartSleep(500); if(Tries = 4 && !FoundCountess){ return false; } } } ///////////////////////////////////////////////////////////////////// //Defense Handling Function ///////////////////////////////////////////////////////////////////// function DoDefense(){ for(i = 0; i < Defenses.length; i++){ Player.SetRightSkill(Defenses[i].skill); SmartSleep(500); Player.UseRightSkill(Player.Location.x, Player.Location.y); } } ///////////////////////////////////////////////////////////////////// //Attack Functions From Aennor and Avarice ///////////////////////////////////////////////////////////////////// function spell(s, p, r, d){ this.skill = s; this.repeat = p; this.range = r; this.delay = d; } function AttackSequence(attack_seq, mon, repeat_after){ Sleep(100); for (i = 0; i < repeat_after && i < attack_seq.length; i++){ Player.SetRightSkill(attack_seq[i].skill); for (n=0; n < attack_seq[i].repeat && !mon.Dead && !Player.Dead; n++){ Player.UseRightSkill(mon.Location.x, mon.Location.y); SmartSleep(Randomize(attack_seq[i].delay,50)); } } while (!mon.Dead && !Player.Dead){ for (i = repeat_after; i < attack_seq.length && !mon.Dead && !Player.Dead; i++){ if (reposition) RepositionForAttack(mon, attack_seq[i].range); Player.SetRightSkill(attack_seq[i].skill); for (n=0; n <= Randomize(attack_seq[i].repeat, 1) && !mon.Dead && !Player.Dead; n++){ Player.UseRightSkill(mon.Location.x, mon.Location.y); SmartSleep(Randomize(attack_seq[i].delay,50)); } } } } function RepositionForAttack(mon, range){ deltaX = Math.abs(Player.Location.x - mon.Location.x); deltaY = Math.abs(Player.Location.y - mon.Location.y); distance = Math.floor(Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY,2))); if (distance > range){ //Print(CBrown +"Out of range...repositioning."); if (Player.Location.x > mon.Location.x) newX = mon.Location.x + Math.floor(range/2); else newX = mon.Location.x - Math.floor(range/2); if (Player.Location.y > mon.Location.y) newY = mon.Location.y + Math.floor(range/2); else newY = mon.Location.y - Math.floor(range/2); TeleMove(new coord(newX, newY)); } } //////////////////////////////////////////////////////////// //Function to get Countess Info //////////////////////////////////////////////////////////// function CountessInfo(){ EList=Entity.GetEntities(); for(i=0; i < EList.length; i++){ monster=EList[i]; if(monster.Class == 1 && monster.Type == 45 && monster.MonsterType == 1 && monster.Name == "The Countess"){ FoundCountess = true; return monster; } } return; } /////////////////////////////////////////////////////////////////// //Event Handler Functions /////////////////////////////////////////////////////////////////// function HealthEventFunc(health){ if(health < HealthPotion){ UseGlobalBeltPotion(); } if (health < HealthChicken){ if(UseTheForce) Stats("increment Chicken"); Disconnect(); return; } } function ManaEventFunc(mana){ if(mana < ManaChicken){ if (!item.Name == "Full Rejuv Potion" || (item.Name == "Full Rejuv Potion" && !UseGlobalBeltPotion())){ if(UseTheForce) Stats("increment Chicken"); Disconnect(); return; } } } function MercHealthEventFunc(health){ if(health < HealMercLvl && !Merc.IsDead){ MercUseGlobalBeltPotion(); } } function SkipEnchantment(e, c){ SkipEnchants[skiptotal++] = new enchantment(e, c); } function AddDefense(s, p, r, d){ Defenses[defensestotal++] = new spell(s, p, r, d); } function AddAttack(s, p, r, d){ CountessAttack[countessattacktotal++] = new spell(s, p, r, d); } function DeathEventFunc(){ PRed("I've Been Pwned!"); if(UseTheForce) Stats("increment Deaths"); Sleep(1000); Disconnect(); } function ShowTheForce(){ Stats("setscript Blues_CountessSorc"); Stats("add Total"); Stats("add Exits"); Stats("add Deaths"); Stats("add Chicken"); Stats("add Immunes"); Stats("add Countess"); Stats("setsuccess Countess"); Stats("show"); }