All pastes #839121 Raw Edit

Anonymous

public text v1 · immutable
#839121 ·published 2007-12-30 21:22 UTC
rendered paste body
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;

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(5000);//(1000 * 60 * 3);

        this.DebugLog.Append("ChiefPindle: " + "Creating game");

        while (!this.Client.CreateGame())
        {
            // Try again, if we fail!
            this.DebugLog.Append("ChiefPindle: " + "Failed to create game, balls!");
            System.Threading.Thread.Sleep(5000);
        }
        //this.Client.JoinGame("lfs3", "3");
    }

    public override void OnGameEnter()
    {
        if (!Util.WaitForValue(ref this.Seed, 1, 5000))
            throw new GameFailedException("ChiefPindle: " + "Seed never set, did we even enter the game?");

        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...
        DateTime start = DateTime.Now;

        while (this.Hero.X == 0)
        {
            if (((TimeSpan)DateTime.Now.Subtract(start)).TotalMilliseconds >= 5000)
                throw new GameFailedException("ChiefPindle: " + "Hero.X never set");

            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)), 650);

        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 (!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<NPC> 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.Lightning, 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.");
    }

    public override void OnGameExit()
    {
        this.DebugLog.Append("ChiefPindle: " + "Exited game.");
    }

    public override void Dispose()
    {

    }
}