using System; using System.Collections.Generic; using System.Drawing; using Chief; using Chief.Pathing; using Chief.Pathing.Heuristics; using Chief.Pathing.Processors; using ChiefD2; using ChiefD2.Mapping; using D2DataNew; /// /// Do not call ExitGame on this thread. Look in Bot.cs /// public class Pindle : Bot { public override void OnLobbyEnter() { this.DebugLog.Append("ChiefPindle: " + "Entered lobby, " + this.GameCount.ToString() + " runs attempted."); if(this.GameCount > 0) System.Threading.Thread.Sleep(2000); this.DebugLog.Append("ChiefPindle: " + "Creating game"); if (!this.Client.CreateGame()) { this.DebugLog.Append("ChiefPindle: " + "Failed to create game, balls!"); OnLobbyEnter(); // Try again, if we fail! } //this.Client.JoinGame("lfs3", "3"); } public override void OnGameEnter() { for (int i = 0; i < 2000 && this.Seed == 0; i += 10) System.Threading.Thread.Sleep(10); if (this.Seed == 0) throw new ChiefD2.GameFailedException("Failed to detect seed. This is probably due to a failed to join even if JoinResponse = success"); this.Map.LoadLevelMap(this.Seed, AreaLevel.Harrogath); this.Map.LoadLevelMap(this.Seed, AreaLevel.NihlathaksTemple); AStar townPather = new AStar(this.Map.GetLevelMap(AreaLevel.Harrogath), new DiagonalShortcut(), new WalkingReducer(10, 25)); AStar pindlePather = new AStar(this.Map.GetLevelMap(AreaLevel.NihlathaksTemple), new DiagonalShortcut(), new TeleportReducer(45)); // Wait for everything to load... for (int i = 0 ; i < 2000 && this.Hero.X == 0; i += 10) System.Threading.Thread.Sleep(10); if (this.Hero.X == 0) throw new GameFailedException("Failed to catch Hero.X, this error should not happen since Seed exception should be thrown first"); //while(this.Hero.X == 0) // System.Threading.Thread.Sleep(1); // AutoCorpseCheck() // Check for corpse // Pick it up // Move potions in inventory to belt // AutoTown() // Talk to Akara if life OR mana below regular pot value // Check for items to id // Check for ID / Town Portal scrolls less than 5 // Check for repair // Check for merc this.DebugLog.Append("ChiefPindle: " + "Running to portal ---------------------------------------------------------------"); WalkPath(townPather.FindPath(new Point(this.Hero.X, this.Hero.Y), new Point(5119, 5120)), 750); ChiefD2.Object portal = this.Objects.Find("PermanentTownPortal", 5117, 5119); if (portal == null) throw new GameFailedException("ChiefPindle: " + "Failed to find portal!"); MoveWaitStatic(portal.X, portal.Y, 150); if (!AutoPortalInteract(portal, 5, 5000)) throw new GameFailedException("ChiefPindle: " + "Failed to go into red portal."); System.Threading.Thread.Sleep(500); this.DebugLog.Append("ChiefPindle: " + "Entered portal, teleporting to pindle"); //AutoPrebuff(); /* // If these fail, BAIL out! //TeleportWait(10068, 13288); if (!TeleportWait(10067, 13268)) { this.DebugLog.Append("ChiefPindle: " + "Teleport failed, bail before we die!"); ExitGame(); } if (!TeleportWait(10062, 13240)) { this.DebugLog.Append("ChiefPindle: " + "Teleport failed, bail before we die!"); ExitGame(); } */ if (!TeleportPath(pindlePather.FindPath(new Point(this.Hero.X, this.Hero.Y), new Point(10062, 13240)))) throw new GameFailedException("ChiefPindle: " + "Teleport failed, bail before we die!"); this.DebugLog.Append("ChiefPindle: " + "I'm there, looking for bad guys"); List pindleAndMinions; while ((pindleAndMinions = this.Units.FindAll(NPCClass.DefiledWarrior)) == null) System.Threading.Thread.Sleep(10); this.DebugLog.Append("ChiefPindle: " + "Found: " + pindleAndMinions.Count + " DefiledWarrior"); // Save pindle x/y // Should I even remove dead units? they are useful sometimes... Point pindleBody = new Point((int)pindleAndMinions[0].X, (int)pindleAndMinions[1].Y); AutoKillAll(pindleAndMinions, SkillType.Blizzard, 350, 10000); this.DebugLog.Append("ChiefPindle: " + "Killed all DefiledWarriors, checking for items"); // Wait a second for items to drop System.Threading.Thread.Sleep(500); this.AutoPickIt(pindleBody.X, pindleBody.Y); this.DebugLog.Append("ChiefPindle: " + "Finished run."); /* // wait for items to fill System.Threading.Thread.Sleep(5000); foreach (Item item in this.Hero.Items) if (PickIt.Evaluate(item, this.Hero) != PickItResult.None) this.DebugLog.Append(item.BaseItem.Class.ToString() + "\n" + item.SimpleMods); */ } public override void OnGameExit() { this.DebugLog.Append("ChiefPindle: " + "Exited game."); } public override void Dispose() { } }