Zurück   Pokemon GO Bot Forum |WoW Forum | WoW FairPlay Bot Forum > Offtopic > WoW/MMO Glider Bot Forum > FAQs und Guides

Werbung
Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Hyjal Blumen pflücken und Bergbau (2000g+/h) Admin Farm Profile für Bergbau 56 08.01.2012 22:51
Abmount Problem beim Erze farmen bmwmonster Allgemeines, Fragen, Bugs oder Probleme 1 22.03.2011 13:15
[gelöst] Bergbau Erze farmen TheTiger83 Allgemeines, Fragen, Bugs oder Probleme 14 27.01.2011 23:55
Flugmount + Kräuter farmen Cyrus WoW/MMO Glider Support 2 31.01.2009 13:57
Kräuter Erze Farmen Zachariass WoW/MMO Glider Support 3 01.04.2008 16:59
Antwort
 
Themen-Optionen Ansicht
HowTO Yoink, Erze und Blumen farmen mit dem Flugmount!
 
Alt 27.02.2009
Beiträge: n/a
 
Guest

HowTO Yoink, Erze und Blumen farmen mit dem Flugmount! - Posted: 27.02.2009
Die Sache ist total simpel, aber da es etliche Leute scheinbar nicht verstehen, hier das sehr gute Tut aus dem englischen Forum eingedeutscht. Die Dateien die benötigt werden sind als Anhang dabei.

Viel Spass beim Fliegen und sammeln.

--------------------------------

1.Kopiere das Yoink.cs file in den "Classes" Ordner
2. Öffne Yoink.cs aus diesem Ordner mit einem text editor (zb. notepad)
3. Öffne die _non ppather_ custom class (aus dem "DefaultClasses" Ordner) welche Du mit Yoink benutzen willst in einem 2. Text Editor Fenster, zb. Deathknight.cs welches wir als Beispiel nehmen hier.
4. Kopiere den ganzen Text der Custom Class(in unserem Beispiel den der Deathknight.cs) und füge ihn ein zwischen die Zeilen "#region Combat Class" und "#endregion" am unteren Ende deiner Yoink.cs. Nachdem das vollbracht ist, lösche den Text Block der 3 "using ..." Zeilen beinhaltet (im normal Fall). Zum besseren Verständniss hier 2 Beispiele mit Code. Das erste Beispiel vor dem Entfernen, das 2. nachdem die Zeilen entfernt wurden.

Code:
#region Combat Class
//I R USELESS COMMENT LINE < REPLACE ME WITH COMBAT CLASS

using System;
using System.Threading;
using Glider.Common.Objects;

namespace Glider.Common.Objects
{
    public class Deathknight : GGameClass
    {
        #region DK properties/config

------ [snipped most of the code] ------

            return true;

        }


        #endregion

    }
}

#endregion
Code:
Code:
#region Combat Class
//I R USELESS COMMENT LINE < REPLACE ME WITH COMBAT CLASS

// We have the deleted the first lines with "using ..." in it!

namespace Glider.Common.Objects
{
    public class Deathknight : GGameClass
    {
        #region DK properties/config

------ [snipped most of the code] ------

            return true;

        }


        #endregion

    }
}

#endregion
5. Nun ganz nach oben im Yoink.cs file, und dort die Zeile"////change this to your Combat Class" suchen, und ersetze den GGameClass Teil mit dem Namen der genutzten custom class (im Deathknight.cs Beispiel schreiben wir es also so: "public class Deathknight : GGameClass"):

Als Beispiel Code also folgendermaßen:

Code:
        //////////////////////////////////////////////
        ////change this to your Combat Class
        Glider.Common.Objects.GGameClass
    //////////////////////////////////////////////
ändern in

Code:
Code:
        //////////////////////////////////////////////
        ////change this to your Combat Class
        Glider.Common.Objects.Deathknight
    //////////////////////////////////////////////
6. Nun noch das Yoink.cs file speichern, glider starten, Yoink unter Classes aktivieren und dann unter General auswählen.

7. Nicht vergessen: Lege das Flugmount auf bar 1, button 1, wobei Ihr da ein wenig experimentieren koennt, Hauptsache ist das das Mount unter Keys Common richtig zugewiesen wird!

Und das war es schon. Sollte ein Fehler kommen habt ihr entweder etwas vergessen zu kopieren, oder es an der falschen Stelle eingefügt, oder aus versehen etwas gelöscht. Wenn man alles sorgfältig step by step macht, fliegt Yoink nach 5 Minuten schon.

Die Bedienung selber ist kinderleicht. In dem Fenster das nach erfolgreicher Installation aufgeht das erste mal auf Record Pfad gehen und dann eure Runde abfliegen die ihr machen wollt. Vorher empfiehlt es sich, den Namen von somearea auf einen Namen eurer Wahl zu ändern.

Ist die Runde komplett abgeflogen und ihr seid wieder am Startpunkt angekommen Pause Recording drücken. Dann wird eure Runde gespeichert. Nun einfach unten auf Patrol klicken, und die Fahrt kann losgehen.

In den Einstellungen kann Erze, Blumen oder beides angewählt werden, so das dem Farmspass keine Grenzen gesetzt sind. Experimentiert einfach ein wenig herum.

Eine Sache noch die schnell zu Fehlern führt: Seht euch mit Höhlen und Bäumen vor, also fliegt möglichst nicht unter Bäumen durch sondern fliegt einen Bogen drum, dasselbe bei Höhlen und Wasser. Yoink hat im Moment noch die Eigenart, sich in Bäumen zu verfangen, nicht wieder aus Höhlen rauszukommen, oder ins Wasser zu fliegen und dann nicht wieder aufzumounten.

So das wär dann alles, ich wünsche euch viel Spass mit Yoink.

PS: Die Version ist von heute, einfach ab und an auf mmoglider schauen ob es Updates gibt. In dem File sind auch noch ältere Versionen.

PPS: Weil ich grad sehe das schon geladen wurde und nichtmal ein Kommentar steht fällt mir noch eins ein: Auch wenn es den meisten hier schwer fällt und sie gewohnt sind nur zu nehmen und nix zu geben, ein DANKE Thori oder eine Rep macht es einem leichter, beim nächsten mal wieder ein Tut zu schreiben.

Denn vergesst eins nicht, alle Leute die sich hier diese Mühe machen brauchen so etwas nicht zu tun, Geld gibts nicht dafür und es kostet jedem seine Zeit so was zu schreiben. Also ein Danke ist wohl nicht zu viel verlangt wenn sich jemand die Mühe macht, für andere die Arbeit zu tun.
Angehängte Dateien
Dateityp: zip Yoink v0.zip (242,7 KB, 75x aufgerufen)

Geändert von Thori (08.03.2009 um 05:31 Uhr)
Mit Zitat antworten
Benutzerbild von Google Adsense
Registriert seit: viel zu lange
Beiträge: viel zu viele...
Ort: überall...
 
Google Adsense

Online Now!
Posted: vor kurzem


 
Alt 27.02.2009
Benutzerbild von _Hausi
Registriert seit: Oct 2008
Beiträge: 131
 
Rottenmeister

Offline
Ich habs zwar noch nicht geladen, aber danke Dir für dieses Tut.

Habe mich noch nicht an das Yoink getraut. Du erleichterst mir den Einstieg mit dieser Erklärung. *verbeug*
Mit Zitat antworten
 
Alt 27.02.2009
Registriert seit: Feb 2009
Beiträge: 1
 
Neuling

Offline
=)ich muss es mal versuchen.. aber bekomme immoment lieder nochnicht einmal hin das mein char richtig lootet,isst,tastenbelegung etc.. bin wohl zu dumm dafür
Mit Zitat antworten
 
Alt 27.02.2009
Registriert seit: Sep 2008
Beiträge: 37
 
Member

Offline
Erstmal danke fürs tutorial, ich probiers gleich mal aus, wenn ich fragen habe stell ich sie einfach im thread oder editet mein beitrag
Mit Zitat antworten
 
Alt 27.02.2009
Benutzerbild von trulala
Registriert seit: Dec 2007
Beiträge: 2.151
Ort: Berlin
 
Member

Offline
Super Arbeit

/sticky
Mit Zitat antworten
 
Alt 27.02.2009
Registriert seit: May 2008
Beiträge: 27
 
Member

Offline
yoink kann nicht mit Ppather tasks zusammen arbeiten oder?
Mit Zitat antworten
 
Alt 27.02.2009
Benutzerbild von trulala
Registriert seit: Dec 2007
Beiträge: 2.151
Ort: Berlin
 
Member

Offline
eher nur mit ppather
Mit Zitat antworten
 
Alt 27.02.2009
Beiträge: n/a
 
Guest

Im Moment eher nicht, aber ich denke das in absehbarer Zeit Pather fliegen kann Mighty, ich denke mal das Du darauf hinaus wolltest.
Mit Zitat antworten
 
Alt 27.02.2009
Benutzerbild von piw23
Registriert seit: Mar 2007
Beiträge: 2.120
Ort: viva COLONIA
 
Member

Offline
bei den garion classen kann man zb beim dud auch die fluggestallt anwählen, habe das aber noch net probiert da ich keinen 68ziger dudu zum ausprobieren habe
Streß und Hektik sind schlecht fürs Herz
sers Piw
Bot erfahrung: zuviel für die signatur

Video Guide für Anfänger / Glider Kaufen / Forum Regeln / Wie werd ich MEMBER


Mein LVL, Ruf und Gold Service PIW23 oder Homepage

*NEU*NEU* HANDLEVEL SERVICE *NEU*NEU*

Slots frei JA



KEIN GLIDER SUPPORT ÜBER ICQ O.Ä
Mit Zitat antworten
 
Alt 27.02.2009
Beiträge: n/a
 
Guest

Anwählen vielleicht (kann ich die Tage mal testen hab einen 71-80 Auftrag), aber fliegen wird Garion nicht, da im Moment weder Pather Task noch Glider WP Profile die Z Achse nutzen, und sich somit nicht 3 Dimensional bewegen können.

Geändert von Thori (27.02.2009 um 17:18 Uhr)
Mit Zitat antworten
 
Alt 27.02.2009
Benutzerbild von piw23
Registriert seit: Mar 2007
Beiträge: 2.120
Ort: viva COLONIA
 
Member

Offline
dann müsste man garion mal fragen warum er das zum anwählen hat, in dem offi thread sind mir zuviele seiten um das alles durchzulesen ob das da schonmal angesprochen wurde.
Streß und Hektik sind schlecht fürs Herz
sers Piw
Bot erfahrung: zuviel für die signatur

Video Guide für Anfänger / Glider Kaufen / Forum Regeln / Wie werd ich MEMBER


Mein LVL, Ruf und Gold Service PIW23 oder Homepage

*NEU*NEU* HANDLEVEL SERVICE *NEU*NEU*

Slots frei JA



KEIN GLIDER SUPPORT ÜBER ICQ O.Ä
Mit Zitat antworten
 
Alt 27.02.2009
Beiträge: n/a
 
Guest

Vielleicht hat er es in weiser Voraussicht schon eingefügt? Wie gesagt ich teste es in den nächsten Tagen mal wenn ich meinen Dudu Auftrag beginne, dann kann ich ein Feedback geben ob sich irgend etwas tut mit der Fluggestalt.
Mit Zitat antworten
 
Alt 03.03.2009
Registriert seit: Feb 2009
Beiträge: 50
 
Grunzer

Offline
Also soweit läuft Yoink ja gut erklärung ist spitze und kinderleicht einzustellen das problem was ich nur habe ist
ich will erze im sholazarbecken farmen! hab meine route abgeflogen und auf patrol gedrückt er fliegt los fliegt 10 mehter dann fliegt er wieder 2 bis 3 mal im kreis und dann erst wieder weiter und das wiederholt sich sich so alle 50 meter das er immer mal im kreis fliegt! woran kann das liegen ?
Mit Zitat antworten
 
Alt 04.03.2009
Beiträge: n/a
 
Guest

Dann scheint die Route nicht sauber abgeflogen worden zu sein beim ersten mal. Du darfst KEINE Erze sammeln beim aufzeichnen, einfach weiter Deine Runde drehen, sonst sind die WP zu dicht beieinander!
Mit Zitat antworten
 
Alt 07.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
Also ich habe alles so gemacht wie ich es sollte...aber ich kriege immer diesen fehler:

Zitat:
Compile successful with warnings on "Yoink.cs": Line 418, column 18: Die Variable UsedSpell ist zugewiesen, ihr Wert wird aber nie verwendet.
Line 2481, column 13: Unerreichbarer Code entdeckt.
Line 2503, column 13: Unerreichbarer Code entdeckt.
Line 2521, column 13: Unerreichbarer Code entdeckt.
Line 2542, column 13: Unerreichbarer Code entdeckt.
Was habe ich falsch gemacht, oder kann mir jemand ein fertiges script für Warrior hochladen? : /
Mit Zitat antworten
 
Alt 07.03.2009
Beiträge: n/a
 
Guest

Du hast beim kopieren einen Fehler gemacht.
Mit Zitat antworten
 
Alt 07.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
der wäre? ich habe alles so befolgt wie ich sollte...
Mit Zitat antworten
 
Alt 07.03.2009
Beiträge: n/a
 
Guest

Nein, denn wenn Du es alles EXAKT so gemacht hättest wie ich geschrieben habe, würde ja kein Fehler kommen, gell?

Ich weiss nicht WO Du einen Fehler gemacht hast, mach es einfach noch einmal, ganz von Anfang und vor allem Schritt für Schritt. Irgendwo hat sich bei Dir ein Fehler eingeschlichen, darum würde ich alles noch einmal machen.
Mit Zitat antworten
 
Alt 07.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
Also,
Ich nehme Yoink 0.4.8 Final, is schließlich das neuste,
öffne aus dem ordner "DefaultClasses" "Warrior.cs" und kopiere den GANZEN text aus dem ding zwischen
Zitat:
#region Combat Class
//I R USELESS COMMENT LINE < REPLACE ME WITH COMBAT CLASS
#endregion
und lösche danach die zeilen
Zitat:
using System;
using System.Threading;
using Glider.Common.Objects;
was mich hier irritiert hat ist das du gesagt hast am unteren ende der ganzen geschichte, war bei mir ganz oben da unten nichts war...

Als nächstes suche ich oben die zeile
Zitat:
//!Class: Glider.Common.Objects.YoinkSpace.Yoink
Diese sah wieder anders aus als dein beispiel, aber naja was anderes in der richtung war nicht da

Also schreib ich darein
Zitat:
//!Class: Glider.Common.Objects.Warrior
und wenn ich sie nun lade gibt es den fehler...
Weißt du jetzt evtl wo mein fehler liegt? : /

Edith meint das ich doof bin...
Zitat:
//////////////////////////////////////////////
////change this to your Combat Class
Glider.Common.Objects.GGameClass
//////////////////////////////////////////////
einfach übersehen....man >.<^^

Sagt mal geht das auch mit nem normalen flugmount?
Dickes +rep fürs noob fragen beantworten^^

Klappt immer noch net :<,
Hast du vllt kurz 5 mins zeit eins für warrior zu erstellen und es zu uppen? kriegst auch nochn +rep^^

Geändert von Kenny1547 (07.03.2009 um 14:36 Uhr)
Mit Zitat antworten
 
Alt 07.03.2009
Beiträge: n/a
 
Guest

Das geht mit jedem Mount, das Du auf die Mount Taste legst und per Glider zuweist. Was ist denn nun noch für ein Fehler?
Mit Zitat antworten
 
Alt 07.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
Immer noch der gleiche : /
Mit Zitat antworten
 
Alt 07.03.2009
Beiträge: n/a
 
Guest

Poste doch einfach mal den Code Deiner modifizierten Datei, dann schau ich wo der Fehler steckt. Aber nicht vergessen, #code Befehl benutzen.
Mit Zitat antworten
 
Alt 07.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
Da ich nicht weiß was du mit #code meinst, aber mir denken kann das du meinst das mein beitrag net 20 seiten lang wird uppe ich die cs einfach mal^^
Angehängte Dateien
Dateityp: cs Yoink.cs (139,6 KB, 5x aufgerufen)
Mit Zitat antworten
 
Alt 07.03.2009
Beiträge: n/a
 
Guest

Ich meine damit, das Du es so schreiben sollst:

Code:
Hier sollte Dein modifizierter Code stehen
Der #Code Befehl ist sogar als Taste zu bekommen, wenn Du Dein Text schreibst steht er oben von rechts an 3. Stelle beim Reply Editor.
Mit Zitat antworten
 
Alt 07.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
Achso ja, ich kenns halt als quote^^

Code:
// Yoink.cs - Flying Mount Node Patrol
//
// Version: 0.4.8 Final
//
//////////////////////////////////////////////////////////////////////////
//
// IMPORTANT!  
// 1. paste your NON PATROL OVERRIDING "combat class" where the useless comment is
// 2. copy the namespace and class name from the combat class and replace the line below with it
// 3. A using line looks like 'using blah.blah.blah;'  merge the using lines from your combat class, and the yoink class.
// 4. put your flying mount on casting bar 3, slot 1
// 5. put your cloud sucker on casting bar 3, slot 2
//
// For more information on Yoink
//
//          Glider Forums
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Media;
using System.Net;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using System.Text;
using System.Threading;

//!Class: Glider.Common.Objects.YoinkSpace.Yoink

//////////////////////////////////////////////
////paste your Combat Class below, between the region markers
//////////////////////////////////////////////
#region Combat Class


namespace Glider.Common.Objects
{
    public class Warrior : GGameClass
    {
        #region Warrior props
        GSpellTimer BattleShout = new GSpellTimer(2 * 60 * 1000);
        GSpellTimer Heroic;
        GSpellTimer Rend = new GSpellTimer(21 * 1000);
          
        bool GotExtra = false;
        bool UseShieldBash;
        bool UseHamstring;
        bool UseBloodrage;
        bool UseDemoralizing;
        bool UseCleave;
        bool ChaseRunners;
        bool UseOverpower;
        bool ChargePull;
        int HeroicRage;
        double ShieldBashLife;
        bool UseConcussion;
        double MeleeDistance;
        bool UseExecute;
        bool UseSunder;
        bool AvoidAdds;
        int AvoidAddDistance;
        bool UseMortalStrike;
        #endregion

        #region GGameClass overrides

        // Don't think we'll be needing any water...
        public override bool ShouldBuyWater { get { return false; } }

        public override string DisplayName
        {
            get { return "Warrior"; }
        }

        public override int PullDistance
        {
            get
            {
                if (ChargePull)
                    return 25;
                else
                    return base.PullDistance;
            }
        }

        public override void Startup()
        {
            //    Context.CombatLog += new GContext.GCombatLogHandler(TestCombatHandle);
        }

        public override void Shutdown()
        {
            //    Context.ChatLog -= new GContext.GChatLogHandler(TestChatHandle);
            //    Context.CombatLog -= new GContext.GCombatLogHandler(TestCombatHandle);
        }

        public override GConfigResult ShowConfiguration()
        {
            return Context.ShowStockConfigDialog(GPlayerClass.Warrior);
        }

        public override bool CanDrink
        {
            get { return false; }   // 12th step, no drinking.
        }

        public override string PowerLabel
        {
            get
            {
                return "Rage";
            }
        }

        public override string PowerValue
        {
            get
            {
                return Me.Rage.ToString();
            }
        }

        public override void CreateDefaultConfig()
        {
            Context.SetConfigValue("Warrior.PullDistance", "30", false);
            Context.SetConfigValue("Warrior.ChargePull", "False", false);
            Context.SetConfigValue("Warrior.UseExecute", "True", false);
            Context.SetConfigValue("Warrior.ChaseRunners", "True", false);
            Context.SetConfigValue("Warrior.UseBloodrage", "True", false);
            Context.SetConfigValue("Warrior.UseConcussion", "False", false);
            Context.SetConfigValue("Warrior.UseSunder", "False", false);
            Context.SetConfigValue("Warrior.UseHamstring", "True", false);
            Context.SetConfigValue("Warrior.UseDemoralizing", "True", false);
            Context.SetConfigValue("Warrior.HeroicRage", "15", false);
            Context.SetConfigValue("Warrior.HeroicCooldown", "6000", false);
            Context.SetConfigValue("Warrior.UseCleave", "False", false);
            Context.SetConfigValue("Warrior.UseOverpower", "True", false);
            Context.SetConfigValue("Warrior.UseShieldBash", "False", false);
            Context.SetConfigValue("Warrior.ShieldBashLife", "40", false);
            Context.SetConfigValue("Warrior.PullDistance", "30", false);
            Context.SetConfigValue("Warrior.MeleeDistance", "4.80", false);
            Context.SetConfigValue("Warrior.AvoidAdds", "True", false);
            Context.SetConfigValue("Warrior.AvoidAddDistance", "30", false);
            Context.SetConfigValue("Warrior.UseMortalStrike", "False", false);
        }

        public override void LoadConfig()
        {
            BattleShout.ForceReady();

            ChaseRunners = Context.GetConfigBool("Warrior.ChaseRunners");            
            HeroicRage = Context.GetConfigInt("Warrior.HeroicRage");
            Heroic = new GSpellTimer(Context.GetConfigInt("HeroicCooldown") * 1000, true);
            UseHamstring = Context.GetConfigBool("Warrior.UseHamstring");
            UseBloodrage = Context.GetConfigBool("Warrior.UseBloodrage");
            UseDemoralizing = Context.GetConfigBool("Warrior.UseDemoralizing");
            UseCleave = Context.GetConfigBool("Warrior.UseCleave");
            UseOverpower = Context.GetConfigBool("Warrior.UseOverpower");
            UseShieldBash = Context.GetConfigBool("Warrior.UseShieldBash");
            ShieldBashLife = Context.GetConfigDouble("Warrior.ShieldBashLife");
            ChargePull = Context.GetConfigBool("Warrior.ChargePull");
            UseConcussion = Context.GetConfigBool("Warrior.UseConcussion");
            MeleeDistance = Context.GetConfigDouble("Warrior.MeleeDistance");
            UseExecute = Context.GetConfigBool("Warrior.UseExecute");
            UseConcussion = Context.GetConfigBool("Warrior.UseConcussion");
            UseSunder = Context.GetConfigBool("Warrior.UseSunder");
            AvoidAdds = Context.GetConfigBool("Warrior.AvoidAdds");
            AvoidAddDistance = Context.GetConfigInt("Warrior.AvoidAddDistance");
            UseMortalStrike = Context.GetConfigBool("Warrior.UseMortalStrike");
        }

        #endregion

        #region KillTarget
        public override GCombatResult KillTarget(GUnit Target, bool IsAmbush)
        {
            int SundersLeft = 2;
            bool WasClose = false;
            bool UsedHamstring = false;
            bool UsedDemoralizing = false;
            bool BloodBefore = Context.RNG.Next() % 2 == 0;
            if (ChargePull)
                BloodBefore = false;

            if (Target.IsPlayer)
                return KillPlayer((GPlayer)Target);
            GMonster Monster = (GMonster)Target;
            double Distance = Target.DistanceToSelf;

            if (UseBloodrage && Interface.IsKeyReady("Warrior.Bloodrage") && Me.Health > .70 && BloodBefore)
            {
                Context.CastSpell("Warrior.Bloodrage");
                if (Target.DistanceToSelf > PullDistance - 1.0)
                    Target.Approach(PullDistance - 1.0);
            }
            if (!IsAmbush)
            {                
                if (ChargePull && !Me.IsInCombat)
                {
                    if (Target.DistanceToSelf < 8.0)
                    {
                        Monster.Approach();
                        Context.SendKey("Common.ToggleCombat");
                    }
                    else if (Interface.IsKeyReady("Warrior.Charge"))
                        {
                            if (!DoAndCheckCharge(Target))             // Never got there, fuggit.
                                return GCombatResult.Retry;
                        }
                }
                else
                {
                    if (Target.DistanceToSelf >= (MeleeDistance + 1.0))
                    {
                        Context.ReleaseSpinRun();
                        Context.CastSpell("Warrior.Ranged");
                        Target.WaitForApproach(Context.MeleeDistance, 5000);//wait for it....arm thy self!//wait for it....arm thy self!
                        Context.SendKey("Common.ToggleCombat");
                    }
                    else
                    {
                        Context.SendKey("Common.ToggleCombat");
                        Context.ReleaseSpinRun();
                    }
                }
            }
            else
            {
                Monster.Approach();
                if (Interface.IsKeyReady("Warrior.HeroicStrike") && Me.Rage >= HeroicRage)
                {
                    if (GotExtra && (UseCleave || Interface.IsKeyReady("Warrior.Thunderclap")))  // Bypass heroic strike in this case.
                    {
                        Context.CastSpell("Warrior.Thunderclap");
                    }
                    else
                    {
                        Heroic.Reset();
                        Context.CastSpell("Warrior.HeroicStrike");
                    }
                }
                else
                {
                    Context.SendKey("Common.ToggleCombat");
                }
                
            }

            Context.Debug("Going into warrior main loop");
            Context.ReleaseSpinRun();
            Rend.ForceReady();

            while (true)
            {
                Thread.Sleep(101);

                GCombatResult CommonResult = Context.CheckCommonCombatResult(Monster, IsAmbush);                

                if (CommonResult != GCombatResult.Unknown)
                    return CommonResult;

                Context.Movement.TweakMelee(Monster);

                Distance = Target.DistanceToSelf;

                if (Distance <= MeleeDistance + 1.0)
                    WasClose = true;

                if (Distance > (MeleeDistance + 1.0) && ChaseRunners)
                {
                    Monster.Approach(MeleeDistance - 2.0);
                    continue;
                }

                if (Distance > (MeleeDistance + 1.0) && WasClose && !ChaseRunners && Interface.IsKeyReady("Warrior.Ranged") && Distance < PullDistance)
                {
                    Thread.Sleep(666);
                    Context.ReleaseSpinRun();
                    Context.CastSpell("Warrior.Ranged");
                    continue;
                }

                if (UseBloodrage && Interface.IsKeyReady("Warrior.Bloodrage") && Me.Health > .70 && !BloodBefore)
                {
                    Context.CastSpell("Warrior.Bloodrage");
                    continue;
                }
                
                // Check for heal/panic first:
                if (Me.Health < .35 && Target.Health > .35 || Me.Health < .20)
                {
                    if (Interface.IsKeyReady("Common.Potion") && Interface.IsKeyEnabled("Common.Potion"))
                    {
                        Context.CastSpell("Common.Potion");
                        continue;
                    }
                }

                // Most important combat-move: hamstring!
                if (UseHamstring && Target.Health <= .50 && Me.Rage >= 10 && !UsedHamstring)
                {
                    UsedHamstring = true;
                    Context.CastSpell("Warrior.Hamstring");
                    continue;
                }
                

                if (UseShieldBash && Me.Rage >= 10)
                {
                    if (Target.IsCasting && Target.Health <= ShieldBashLife && Interface.IsKeyReady("Warrior.ShieldBash"))
                    {
                        Context.CastSpell("Warrior.ShieldBash");
                        continue;
                    }
                }

                if (CheckAdditional(Target))
                    continue;

                if (UseOverpower && Interface.IsKeyEnabled("Warrior.Overpower") && Me.Rage >= 5)
                {
                    Context.CastSpell("Warrior.Overpower");
                    continue;
                }

                if (UseDemoralizing && !UsedDemoralizing && Me.Rage >= 10)
                {
                    UsedDemoralizing = true;
                    Context.CastSpell("Warrior.DemoShout");
                    continue;
                }

                // Ok, combat moves.  First, keep battle shout up:
                if (BattleShout.IsReady && Me.Rage >= 10)
                {
                    BattleShout.Reset();
                    Context.CastSpell("Warrior.BattleShout");
                    continue;
                }

                // Execute if we can!
                if (UseExecute && Target.Health <= .20 && Me.Rage >= 15)
                {
                    Context.CastSpell("Warrior.Execute");
                    continue;
                }

                // No big stuff ready, see if rend is ticking:
                if (Interface.IsKeyReady("Warrior.Rend") && Me.Rage >= 10 && Target.Health > .45 && Rend.IsReady)
                {
                    Context.CastSpell("Warrior.Rend");
                    Rend.Reset();
                    continue;
                }

                if (UseConcussion && Interface.IsKeyReady("Warrior.Concussion") && Me.Rage >= 15)
                {
                    Context.CastSpell("Warrior.Concussion");
                    continue;
                }

                if (UseSunder && Me.Rage >= 15 && SundersLeft > 0)
                {
                    SundersLeft--;
                    Context.CastSpell("Warrior.SunderArmor");
                    continue;
                }

                // Spam something:
                if (UseMortalStrike && Me.Rage >= 30 && Interface.IsKeyReady("Warrior.MortalStrike"))
                {
                    Context.CastSpell("Warrior.MortalStrike");
                    continue;
                }

                // Spam something else:
                if (Interface.IsKeyReady("Warrior.HeroicStrike") && Me.Rage >= HeroicRage && Heroic.IsReady)
                {
                    Heroic.Reset();
                    Context.CastSpell("Warrior.HeroicStrike");
                    continue;
                }

                if (!Me.IsMeleeing)
                {
                    Context.SendKey("Common.ToggleCombat");
                    Context.ReleaseSpinRun();
                    continue;
                }

                // Extremely bored - maybe we should back up?
                if (AvoidAdds && Target.DistanceToSelf <= Context.MeleeDistance && !Target.IsCasting)
                    Movement.ConsiderAvoidAdds(AvoidAddDistance);
            }
        }
        #endregion

        #region Warrior combat helpers

        GCombatResult KillPlayer(GPlayer Player)
        {
            //TODO: Warrior stuff
             Context.Log("Attacked by player, waiting to die off");

            GSpellTimer WaitTime = new GSpellTimer(60 * 1000);
            WaitTime.Wait();

            if (!Me.IsDead)
                Context.KillAction("PlayerLeftAlive", true);
            return GCombatResult.Died;
        }

        public bool CheckAdditional(GUnit Target)
        {
            bool UsedSpell = false;
            GUnit Extra = GObjectList.GetNearestAttacker(Target.GUID);

            if (Extra == null)   // No extra.
            {
                GotExtra = false;
                return false;
            }

            if (!Extra.IsInMeleeRange)  // Too far to care about.
            {
                GotExtra = false;
                return false;
            }

            if (!GotExtra)
            {
                GotExtra = true;
                Context.Log("Additional attacker!");
            }

            if (Interface.IsKeyReady("Warrior.Thunderclap") && Me.Rage >= 20)
            {
                Context.CastSpell("Warrior.Thunderclap");
                return true;
            }

            if (UseCleave && Me.Rage >= 20)
            {
                Context.CastSpell("Warrior.Cleave");
                return true;
            }

            return false;
        }

        bool DoAndCheckCharge(GUnit Target)
        {
            GLocation Anchor = Me.Location;
            GSpellTimer ChargeWait = new GSpellTimer(2000, false);

            Context.CastSpell("Warrior.Charge");
            Context.ReleaseSpinRun();

            while (!ChargeWait.IsReadySlow)
            {
                if (Me.Location.GetDistanceTo(Anchor) >= 7.0)
                {
                    Context.Debug("Charge is moving us, excellent!");
                    Target.WaitForApproach(Context.MeleeDistance, 2000);
                    return true;
                }
            }

            Context.Log("Never seemed to get anywhere on charge");
            return false;
        }
        #endregion

        #region UpdateKeys method
        public override void UpdateKeys(GKey[] UpdatableKeys)
        {
            foreach (GKey One in UpdatableKeys)
            {
                GShortcut button = null;

                switch (One.KeyName)
                {
                    case "Warrior.Ranged":
                        button = GShortcut.FindMatchingShortcut(GShortcutType.Spell, "0xacc 0xbca");
                        break;

                    default:
                        continue;  // Don't try to handle this, we didn't do anything smart.
                }

                if (button != null)
                {
                    Context.Debug("Mapped " + One.KeyName + " -> " + button.ToString());
                    One.SIM = button.ShortcutValue;
                }
                else
                    Context.Log("Unable to find suitable button for " + One.KeyName + ", see help section \"Re-Assigning Keys\" under Key Mappings.");

            }
        }
        #endregion

    }
}
#endregion

namespace Glider.Common.Objects.YoinkSpace
{
    public class Yoink :
        //////////////////////////////////////////////
        ////change this to your Combat Class
        Glider.Common.Objects.Warrior
    //////////////////////////////////////////////
    {
        #region Initialization
        private void initialize()
 ----[rest ausgelassen]----

Geändert von Kenny1547 (07.03.2009 um 20:41 Uhr)
Mit Zitat antworten
 
Alt 07.03.2009
Beiträge: n/a
 
Guest

Kenny, wenn ich QUOTE meine dann schreibe ich QUOTE, ich schrieb aber CODE!

Das ist ein Unterschied! Der zeigt nur einen Ausschnitt im Fenster an, was bei langen Codes sehr hilfreich ist da man dann innerhalb des Fensters scrollen kann. ^^
Code:
// Yoink.cs - Flying Mount Node Patrol
//
// Version: 0.4.8 Final
//
//////////////////////////////////////////////////////////////////////////
//
// IMPORTANT!
// 1. paste your NON PATROL OVERRIDING "combat class" where the useless comment is
// 2. copy the namespace and class name from the combat class and replace the line below with it
// 3. A using line looks like 'using blah.blah.blah;' merge the using lines from your combat class, and the yoink class.
// 4. put your flying mount on casting bar 3, slot 1
// 5. put your cloud sucker on casting bar 3, slot 2
//
// For more information on Yoink
//
// Glider Forums
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Media;
using System.Net;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using System.Text;
using System.Threading;

//!Class: Glider.Common.Objects.YoinkSpace.Yoink

//////////////////////////////////////////////
////paste your Combat Class below, between the region markers
//////////////////////////////////////////////
#region Combat Class


namespace Glider.Common.Objects
{
public class Warrior : GGameClass
{
#region Warrior props
GSpellTimer BattleShout = new GSpellTimer(2 * 60 * 1000);
GSpellTimer Heroic;
GSpellTimer Rend = new GSpellTimer(21 * 1000);

bool GotExtra = false;
bool UseShieldBash;
bool UseHamstring;
bool UseBloodrage;
bool UseDemoralizing;
bool UseCleave;
bool ChaseRunners;
bool UseOverpower;
bool ChargePull;
int HeroicRage;
double ShieldBashLife;
bool UseConcussion;
double MeleeDistance;
bool UseExecute;
bool UseSunder;
bool AvoidAdds;
int AvoidAddDistance;
bool UseMortalStrike;
#endregion

#region GGameClass overrides

// Don't think we'll be needing any water...
public override bool ShouldBuyWater { get { return false; } }

public override string DisplayName
{
get { return "Warrior"; }
}

public override int PullDistance
{
get
{
if (ChargePull)
return 25;
else
return base.PullDistance;
}
}

public override void Startup()
{
// Context.CombatLog += new GContext.GCombatLogHandler(TestCombatHandle);
}

public override void Shutdown()
{
// Context.ChatLog -= new GContext.GChatLogHandler(TestChatHandle);
// Context.CombatLog -= new GContext.GCombatLogHandler(TestCombatHandle);
}

public override GConfigResult ShowConfiguration()
{
return Context.ShowStockConfigDialog(GPlayerClass.Warrior );
}

public override bool CanDrink
{
get { return false; } // 12th step, no drinking.
}

public override string PowerLabel
{
get
{
return "Rage";
}
}

public override string PowerValue
{
get
{
return Me.Rage.ToString();
}
}

public override void CreateDefaultConfig()
{
Context.SetConfigValue("Warrior.PullDistance", "30", false);
Context.SetConfigValue("Warrior.ChargePull", "False", false);
Context.SetConfigValue("Warrior.UseExecute", "True", false);
Context.SetConfigValue("Warrior.ChaseRunners", "True", false);
Context.SetConfigValue("Warrior.UseBloodrage", "True", false);
Context.SetConfigValue("Warrior.UseConcussion", "False", false);
Context.SetConfigValue("Warrior.UseSunder", "False", false);
Context.SetConfigValue("Warrior.UseHamstring", "True", false);
Context.SetConfigValue("Warrior.UseDemoralizing", "True", false);
Context.SetConfigValue("Warrior.HeroicRage", "15", false);
Context.SetConfigValue("Warrior.HeroicCooldown", "6000", false);
Context.SetConfigValue("Warrior.UseCleave", "False", false);
Context.SetConfigValue("Warrior.UseOverpower", "True", false);
Context.SetConfigValue("Warrior.UseShieldBash", "False", false);
Context.SetConfigValue("Warrior.ShieldBashLife", "40", false);
Context.SetConfigValue("Warrior.PullDistance", "30", false);
Context.SetConfigValue("Warrior.MeleeDistance", "4.80", false);
Context.SetConfigValue("Warrior.AvoidAdds", "True", false);
Context.SetConfigValue("Warrior.AvoidAddDistance", "30", false);
Context.SetConfigValue("Warrior.UseMortalStrike", "False", false);
}

public override void LoadConfig()
{
BattleShout.ForceReady();

ChaseRunners = Context.GetConfigBool("Warrior.ChaseRunners");
HeroicRage = Context.GetConfigInt("Warrior.HeroicRage");
Heroic = new GSpellTimer(Context.GetConfigInt("HeroicCooldown") * 1000, true);
UseHamstring = Context.GetConfigBool("Warrior.UseHamstring");
UseBloodrage = Context.GetConfigBool("Warrior.UseBloodrage");
UseDemoralizing = Context.GetConfigBool("Warrior.UseDemoralizing");
UseCleave = Context.GetConfigBool("Warrior.UseCleave");
UseOverpower = Context.GetConfigBool("Warrior.UseOverpower");
UseShieldBash = Context.GetConfigBool("Warrior.UseShieldBash");
ShieldBashLife = Context.GetConfigDouble("Warrior.ShieldBashLife");
ChargePull = Context.GetConfigBool("Warrior.ChargePull");
UseConcussion = Context.GetConfigBool("Warrior.UseConcussion");
MeleeDistance = Context.GetConfigDouble("Warrior.MeleeDistance");
UseExecute = Context.GetConfigBool("Warrior.UseExecute");
UseConcussion = Context.GetConfigBool("Warrior.UseConcussion");
UseSunder = Context.GetConfigBool("Warrior.UseSunder");
AvoidAdds = Context.GetConfigBool("Warrior.AvoidAdds");
AvoidAddDistance = Context.GetConfigInt("Warrior.AvoidAddDistance");
UseMortalStrike = Context.GetConfigBool("Warrior.UseMortalStrike");
}

#endregion

#region KillTarget
public override GCombatResult KillTarget(GUnit Target, bool IsAmbush)
{
int SundersLeft = 2;
bool WasClose = false;
bool UsedHamstring = false;
bool UsedDemoralizing = false;
bool BloodBefore = Context.RNG.Next() % 2 == 0;
if (ChargePull)
BloodBefore = false;

if (Target.IsPlayer)
return KillPlayer((GPlayer)Target);
GMonster Monster = (GMonster)Target;
double Distance = Target.DistanceToSelf;

if (UseBloodrage && Interface.IsKeyReady("Warrior.Bloodrage") && Me.Health > .70 && BloodBefore)
{
Context.CastSpell("Warrior.Bloodrage");
if (Target.DistanceToSelf > PullDistance - 1.0)
Target.Approach(PullDistance - 1.0);
}
if (!IsAmbush)
{
if (ChargePull && !Me.IsInCombat)
{
if (Target.DistanceToSelf < 8.0)
{
Monster.Approach();
Context.SendKey("Common.ToggleCombat");
}
else if (Interface.IsKeyReady("Warrior.Charge"))
{
if (!DoAndCheckCharge(Target)) // Never got there, fuggit.
return GCombatResult.Retry;
}
}
else
{
if (Target.DistanceToSelf >= (MeleeDistance + 1.0))
{
Context.ReleaseSpinRun();
Context.CastSpell("Warrior.Ranged");
Target.WaitForApproach(Context.MeleeDistance, 5000);//wait for it....arm thy self!//wait for it....arm thy self!
Context.SendKey("Common.ToggleCombat");
}
else
{
Context.SendKey("Common.ToggleCombat");
Context.ReleaseSpinRun();
}
}
}
else
{
Monster.Approach();
if (Interface.IsKeyReady("Warrior.HeroicStrike") && Me.Rage >= HeroicRage)
{
if (GotExtra && (UseCleave || Interface.IsKeyReady("Warrior.Thunderclap"))) // Bypass heroic strike in this case.
{
Context.CastSpell("Warrior.Thunderclap");
}
else
{
Heroic.Reset();
Context.CastSpell("Warrior.HeroicStrike");
}
}
else
{
Context.SendKey("Common.ToggleCombat");
}

}

Context.Debug("Going into warrior main loop");
Context.ReleaseSpinRun();
Rend.ForceReady();

while (true)
{
Thread.Sleep(101);

GCombatResult CommonResult = Context.CheckCommonCombatResult(Monster, IsAmbush);

if (CommonResult != GCombatResult.Unknown)
return CommonResult;

Context.Movement.TweakMelee(Monster);

Distance = Target.DistanceToSelf;

if (Distance <= MeleeDistance + 1.0)
WasClose = true;

if (Distance > (MeleeDistance + 1.0) && ChaseRunners)
{
Monster.Approach(MeleeDistance - 2.0);
continue;
}

if (Distance > (MeleeDistance + 1.0) && WasClose && !ChaseRunners && Interface.IsKeyReady("Warrior.Ranged") && Distance < PullDistance)
{
Thread.Sleep(666);
Context.ReleaseSpinRun();
Context.CastSpell("Warrior.Ranged");
continue;
}

if (UseBloodrage && Interface.IsKeyReady("Warrior.Bloodrage") && Me.Health > .70 && !BloodBefore)
{
Context.CastSpell("Warrior.Bloodrage");
continue;
}

// Check for heal/panic first:
if (Me.Health < .35 && Target.Health > .35 || Me.Health < .20)
{
if (Interface.IsKeyReady("Common.Potion") && Interface.IsKeyEnabled("Common.Potion"))
{
Context.CastSpell("Common.Potion");
continue;
}
}

// Most important combat-move: hamstring!
if (UseHamstring && Target.Health <= .50 && Me.Rage >= 10 && !UsedHamstring)
{
UsedHamstring = true;
Context.CastSpell("Warrior.Hamstring");
continue;
}


if (UseShieldBash && Me.Rage >= 10)
{
if (Target.IsCasting && Target.Health <= ShieldBashLife && Interface.IsKeyReady("Warrior.ShieldBash"))
{
Context.CastSpell("Warrior.ShieldBash");
continue;
}
}

if (CheckAdditional(Target))
continue;

if (UseOverpower && Interface.IsKeyEnabled("Warrior.Overpower") && Me.Rage >= 5)
{
Context.CastSpell("Warrior.Overpower");
continue;
}

if (UseDemoralizing && !UsedDemoralizing && Me.Rage >= 10)
{
UsedDemoralizing = true;
Context.CastSpell("Warrior.DemoShout");
continue;
}

// Ok, combat moves. First, keep battle shout up:
if (BattleShout.IsReady && Me.Rage >= 10)
{
BattleShout.Reset();
Context.CastSpell("Warrior.BattleShout");
continue;
}

// Execute if we can!
if (UseExecute && Target.Health <= .20 && Me.Rage >= 15)
{
Context.CastSpell("Warrior.Execute");
continue;
}

// No big stuff ready, see if rend is ticking:
if (Interface.IsKeyReady("Warrior.Rend") && Me.Rage >= 10 && Target.Health > .45 && Rend.IsReady)
{
Context.CastSpell("Warrior.Rend");
Rend.Reset();
continue;
}

if (UseConcussion && Interface.IsKeyReady("Warrior.Concussion") && Me.Rage >= 15)
{
Context.CastSpell("Warrior.Concussion");
continue;
}

if (UseSunder && Me.Rage >= 15 && SundersLeft > 0)
{
SundersLeft--;
Context.CastSpell("Warrior.SunderArmor");
continue;
}

// Spam something:
if (UseMortalStrike && Me.Rage >= 30 && Interface.IsKeyReady("Warrior.MortalStrike"))
{
Context.CastSpell("Warrior.MortalStrike");
continue;
}

// Spam something else:
if (Interface.IsKeyReady("Warrior.HeroicStrike") && Me.Rage >= HeroicRage && Heroic.IsReady)
{
Heroic.Reset();
Context.CastSpell("Warrior.HeroicStrike");
continue;
}

if (!Me.IsMeleeing)
{
Context.SendKey("Common.ToggleCombat");
Context.ReleaseSpinRun();
continue;
}

// Extremely bored - maybe we should back up?
if (AvoidAdds && Target.DistanceToSelf <= Context.MeleeDistance && !Target.IsCasting)
Movement.ConsiderAvoidAdds(AvoidAddDistance);
}
}
#endregion

#region Warrior combat helpers

GCombatResult KillPlayer(GPlayer Player)
{
//TODO: Warrior stuff
Context.Log("Attacked by player, waiting to die off");

GSpellTimer WaitTime = new GSpellTimer(60 * 1000);
WaitTime.Wait();

if (!Me.IsDead)
Context.KillAction("PlayerLeftAlive", true);
return GCombatResult.Died;
}

public bool CheckAdditional(GUnit Target)
{
bool UsedSpell = false;
GUnit Extra = GObjectList.GetNearestAttacker(Target.GUID);

if (Extra == null) // No extra.
{
GotExtra = false;
return false;
}

if (!Extra.IsInMeleeRange) // Too far to care about.
{
GotExtra = false;
return false;
}

if (!GotExtra)
{
GotExtra = true;
Context.Log("Additional attacker!");
}

if (Interface.IsKeyReady("Warrior.Thunderclap") && Me.Rage >= 20)
{
Context.CastSpell("Warrior.Thunderclap");
return true;
}

if (UseCleave && Me.Rage >= 20)
{
Context.CastSpell("Warrior.Cleave");
return true;
}

return false;
}

bool DoAndCheckCharge(GUnit Target)
{
GLocation Anchor = Me.Location;
GSpellTimer ChargeWait = new GSpellTimer(2000, false);

Context.CastSpell("Warrior.Charge");
Context.ReleaseSpinRun();

while (!ChargeWait.IsReadySlow)
{
if (Me.Location.GetDistanceTo(Anchor) >= 7.0)
{
Context.Debug("Charge is moving us, excellent!");
Target.WaitForApproach(Context.MeleeDistance, 2000);
return true;
}
}

Context.Log("Never seemed to get anywhere on charge");
return false;
}
#endregion

#region UpdateKeys method
public override void UpdateKeys(GKey[] UpdatableKeys)
{
foreach (GKey One in UpdatableKeys)
{
GShortcut button = null;

switch (One.KeyName)
{
case "Warrior.Ranged":
button = GShortcut.FindMatchingShortcut(GShortcutType.Spell , "0xacc 0xbca");
break;

default:
continue; // Don't try to handle this, we didn't do anything smart.
}

if (button != null)
{
Context.Debug("Mapped " + One.KeyName + " -> " + button.ToString());
One.SIM = button.ShortcutValue;
}
else
Context.Log("Unable to find suitable button for " + One.KeyName + ", see help section \"Re-Assigning Keys\" under Key Mappings.");

}
}
#endregion

}
}
#endregion

namespace Glider.Common.Objects.YoinkSpace
{
public class Yoink :
//////////////////////////////////////////////
////change this to your Combat Class
Glider.Common.Objects.Warrior
//////////////////////////////////////////////
{
#region Initialization
private void initialize()
Schau, so sieht das als Code aus. Hab Deinen mal genommen. Was mir an Deinem auffällt bzw an dem Fehler, hast Du Yoink mal gestartet? Also der Compiler Fehler der da kommt klingt nicht so wichtig, kannst Du Yoink so fliegen lassen oder macht der nix?

Geändert von Thori (07.03.2009 um 19:42 Uhr)
Mit Zitat antworten
 
Alt 07.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
Ja tut mir leid^^, er macht garnix, kein neues fenster kein ppather nix...ich kann da auch nix einstellen oder so
Mit Zitat antworten
 
Alt 07.03.2009
Benutzerbild von Mr. Hankey
Registriert seit: Jan 2008
Beiträge: 1.103
 
Member

Offline
So, nachdem ich Yoink auch heute mal getestet hab, werd ich auch mal ein Feedback abgeben.
Dank dem gut umgeschriebenen Tutorial, der von Thori geschrieben worden ist, hat alles auf anhieb geklappt, wie man da etwas falsch machen kann versteh ich net, aber gut^^.. Danke an dieser stelle an dich Thori, Rep hast ja bereits bekommen..^^
Zu Yoink selbst kann ich auch nur positives sagen, zwar ist mein Char etwa 2-3 mal bereits gestorben, aber das liegt halt an seinem Level.. Schade das der Charakter nicht selbst zur Leiche laufen kann..

btw. bei mir funktioniert das auf Mounten wieder nur wenn ich das Flugmount auf Taste 1, Bar 3 lege und nich in Bar1 auf Taste 1^^
«Erwarte nicht das andere mehr Zeit in die Antwort, als du in deine Frage investieren!»

Mit Zitat antworten
 
Alt 08.03.2009
Beiträge: n/a
 
Guest

Also Kenny, da Du nicht Deinen ganzen modifizierten Code geschickt hast sondern nur ausschnitte davon kann ich den auch nicht testen.

Ich habe Dir aber eine modifizierte Yoink Datei angehaengt die fuer den Krieger ist, probier die einfach mal, die hab ich getestet und die geht. Da kommt zwar beim Compilieren auch ein Fehler, aber den kannst Du ignorieren da Yoink laeuft.

Btw geht Yoink nicht mit Pather, also Deine Pather Class solltest Du ausstellen, vielleicht war da der Fehler bei Dir.

Hier der Code:
Code:
// Yoink.cs - Flying Mount Node Patrol
//
// Version: 0.4.0
//
//////////////////////////////////////////////////////////////////////////
//
// IMPORTANT!  
// 1. paste your NON PATROL OVERRIDING "combat class" where the useless comment is
// 2. copy the namespace and class name from the combat class and replace the line below with it
// 3. A using line looks like 'using blah.blah.blah;'  merge the using lines from your combat class, and the yoink class.
// 4. put your flying mount on casting bar 3, slot 1
// 5. put your cloud sucker on casting bar 3, slot 2
//
// For more information on Yoink
//
//          http://vforums.mmoglider.com/showthread.php?t=196008
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Media;
using System.Net;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using System.Text;
using System.Threading;

//!Class: Glider.Common.Objects.YoinkSpace.Yoink

//////////////////////////////////////////////
////paste your Combat Class below, between the region markers
//////////////////////////////////////////////
#region Combat Class

namespace Glider.Common.Objects
{
    public class Warrior : GGameClass
    {
        #region Warrior props
        GSpellTimer BattleShout = new GSpellTimer(2 * 60 * 1000);
        GSpellTimer Heroic;
        GSpellTimer Rend = new GSpellTimer(21 * 1000);
          
        bool GotExtra = false;
        bool UseShieldBash;
        bool UseHamstring;
        bool UseBloodrage;
        bool UseDemoralizing;
        bool UseCleave;
        bool ChaseRunners;
        bool UseOverpower;
        bool ChargePull;
        int HeroicRage;
        double ShieldBashLife;
        bool UseConcussion;
        double MeleeDistance;
        bool UseExecute;
        bool UseSunder;
        bool AvoidAdds;
        int AvoidAddDistance;
        bool UseMortalStrike;
        #endregion

        #region GGameClass overrides

        // Don't think we'll be needing any water...
        public override bool ShouldBuyWater { get { return false; } }

        public override string DisplayName
        {
            get { return "Warrior"; }
        }

        public override int PullDistance
        {
            get
            {
                if (ChargePull)
                    return 25;
                else
                    return base.PullDistance;
            }
        }

        public override void Startup()
        {
            //    Context.CombatLog += new GContext.GCombatLogHandler(TestCombatHandle);
        }

        public override void Shutdown()
        {
            //    Context.ChatLog -= new GContext.GChatLogHandler(TestChatHandle);
            //    Context.CombatLog -= new GContext.GCombatLogHandler(TestCombatHandle);
        }

        public override GConfigResult ShowConfiguration()
        {
            return Context.ShowStockConfigDialog(GPlayerClass.Warrior);
        }

        public override bool CanDrink
        {
            get { return false; }   // 12th step, no drinking.
        }

        public override string PowerLabel
        {
            get
            {
                return "Rage";
            }
        }

        public override string PowerValue
        {
            get
            {
                return Me.Rage.ToString();
            }
        }

        public override void CreateDefaultConfig()
        {
            Context.SetConfigValue("Warrior.PullDistance", "30", false);
            Context.SetConfigValue("Warrior.ChargePull", "False", false);
            Context.SetConfigValue("Warrior.UseExecute", "True", false);
            Context.SetConfigValue("Warrior.ChaseRunners", "True", false);
            Context.SetConfigValue("Warrior.UseBloodrage", "True", false);
            Context.SetConfigValue("Warrior.UseConcussion", "False", false);
            Context.SetConfigValue("Warrior.UseSunder", "False", false);
            Context.SetConfigValue("Warrior.UseHamstring", "True", false);
            Context.SetConfigValue("Warrior.UseDemoralizing", "True", false);
            Context.SetConfigValue("Warrior.HeroicRage", "15", false);
            Context.SetConfigValue("Warrior.HeroicCooldown", "6000", false);
            Context.SetConfigValue("Warrior.UseCleave", "False", false);
            Context.SetConfigValue("Warrior.UseOverpower", "True", false);
            Context.SetConfigValue("Warrior.UseShieldBash", "False", false);
            Context.SetConfigValue("Warrior.ShieldBashLife", "40", false);
            Context.SetConfigValue("Warrior.PullDistance", "30", false);
            Context.SetConfigValue("Warrior.MeleeDistance", "4.80", false);
            Context.SetConfigValue("Warrior.AvoidAdds", "True", false);
            Context.SetConfigValue("Warrior.AvoidAddDistance", "30", false);
            Context.SetConfigValue("Warrior.UseMortalStrike", "False", false);
        }

        public override void LoadConfig()
        {
            BattleShout.ForceReady();

            ChaseRunners = Context.GetConfigBool("Warrior.ChaseRunners");            
            HeroicRage = Context.GetConfigInt("Warrior.HeroicRage");
            Heroic = new GSpellTimer(Context.GetConfigInt("HeroicCooldown") * 1000, true);
            UseHamstring = Context.GetConfigBool("Warrior.UseHamstring");
            UseBloodrage = Context.GetConfigBool("Warrior.UseBloodrage");
            UseDemoralizing = Context.GetConfigBool("Warrior.UseDemoralizing");
            UseCleave = Context.GetConfigBool("Warrior.UseCleave");
            UseOverpower = Context.GetConfigBool("Warrior.UseOverpower");
            UseShieldBash = Context.GetConfigBool("Warrior.UseShieldBash");
            ShieldBashLife = Context.GetConfigDouble("Warrior.ShieldBashLife");
            ChargePull = Context.GetConfigBool("Warrior.ChargePull");
            UseConcussion = Context.GetConfigBool("Warrior.UseConcussion");
            MeleeDistance = Context.GetConfigDouble("Warrior.MeleeDistance");
            UseExecute = Context.GetConfigBool("Warrior.UseExecute");
            UseConcussion = Context.GetConfigBool("Warrior.UseConcussion");
            UseSunder = Context.GetConfigBool("Warrior.UseSunder");
            AvoidAdds = Context.GetConfigBool("Warrior.AvoidAdds");
            AvoidAddDistance = Context.GetConfigInt("Warrior.AvoidAddDistance");
            UseMortalStrike = Context.GetConfigBool("Warrior.UseMortalStrike");
        }

        #endregion

        #region KillTarget
        public override GCombatResult KillTarget(GUnit Target, bool IsAmbush)
        {
            int SundersLeft = 2;
            bool WasClose = false;
            bool UsedHamstring = false;
            bool UsedDemoralizing = false;
            bool BloodBefore = Context.RNG.Next() % 2 == 0;
            if (ChargePull)
                BloodBefore = false;

            if (Target.IsPlayer)
                return KillPlayer((GPlayer)Target);
            GMonster Monster = (GMonster)Target;
            double Distance = Target.DistanceToSelf;

            if (UseBloodrage && Interface.IsKeyReady("Warrior.Bloodrage") && Me.Health > .70 && BloodBefore)
            {
                Context.CastSpell("Warrior.Bloodrage");
                if (Target.DistanceToSelf > PullDistance - 1.0)
                    Target.Approach(PullDistance - 1.0);
            }
            if (!IsAmbush)
            {                
                if (ChargePull && !Me.IsInCombat)
                {
                    if (Target.DistanceToSelf < 8.0)
                    {
                        Monster.Approach();
                        Context.SendKey("Common.ToggleCombat");
                    }
                    else if (Interface.IsKeyReady("Warrior.Charge"))
                        {
                            if (!DoAndCheckCharge(Target))             // Never got there, fuggit.
                                return GCombatResult.Retry;
                        }
                }
                else
                {
                    if (Target.DistanceToSelf >= (MeleeDistance + 1.0))
                    {
                        Context.ReleaseSpinRun();
                        Context.CastSpell("Warrior.Ranged");
                        Target.WaitForApproach(Context.MeleeDistance, 5000);//wait for it....arm thy self!//wait for it....arm thy self!
                        Context.SendKey("Common.ToggleCombat");
                    }
                    else
                    {
                        Context.SendKey("Common.ToggleCombat");
                        Context.ReleaseSpinRun();
                    }
                }
            }
            else
            {
                Monster.Approach();
                if (Interface.IsKeyReady("Warrior.HeroicStrike") && Me.Rage >= HeroicRage)
                {
                    if (GotExtra && (UseCleave || Interface.IsKeyReady("Warrior.Thunderclap")))  // Bypass heroic strike in this case.
                    {
                        Context.CastSpell("Warrior.Thunderclap");
                    }
                    else
                    {
                        Heroic.Reset();
                        Context.CastSpell("Warrior.HeroicStrike");
                    }
                }
                else
                {
                    Context.SendKey("Common.ToggleCombat");
                }
                
            }

            Context.Debug("Going into warrior main loop");
            Context.ReleaseSpinRun();
            Rend.ForceReady();

            while (true)
            {
                Thread.Sleep(101);

                GCombatResult CommonResult = Context.CheckCommonCombatResult(Monster, IsAmbush);                

                if (CommonResult != GCombatResult.Unknown)
                    return CommonResult;

                Context.Movement.TweakMelee(Monster);

                Distance = Target.DistanceToSelf;

                if (Distance <= MeleeDistance + 1.0)
                    WasClose = true;

                if (Distance > (MeleeDistance + 1.0) && ChaseRunners)
                {
                    Monster.Approach(MeleeDistance - 2.0);
                    continue;
                }

                if (Distance > (MeleeDistance + 1.0) && WasClose && !ChaseRunners && Interface.IsKeyReady("Warrior.Ranged") && Distance < PullDistance)
                {
                    Thread.Sleep(666);
                    Context.ReleaseSpinRun();
                    Context.CastSpell("Warrior.Ranged");
                    continue;
                }

                if (UseBloodrage && Interface.IsKeyReady("Warrior.Bloodrage") && Me.Health > .70 && !BloodBefore)
                {
                    Context.CastSpell("Warrior.Bloodrage");
                    continue;
                }
                
                // Check for heal/panic first:
                if (Me.Health < .35 && Target.Health > .35 || Me.Health < .20)
                {
                    if (Interface.IsKeyReady("Common.Potion") && Interface.IsKeyEnabled("Common.Potion"))
                    {
                        Context.CastSpell("Common.Potion");
                        continue;
                    }
                }

                // Most important combat-move: hamstring!
                if (UseHamstring && Target.Health <= .50 && Me.Rage >= 10 && !UsedHamstring)
                {
                    UsedHamstring = true;
                    Context.CastSpell("Warrior.Hamstring");
                    continue;
                }
                

                if (UseShieldBash && Me.Rage >= 10)
                {
                    if (Target.IsCasting && Target.Health <= ShieldBashLife && Interface.IsKeyReady("Warrior.ShieldBash"))
                    {
                        Context.CastSpell("Warrior.ShieldBash");
                        continue;
                    }
                }

                if (CheckAdditional(Target))
                    continue;

                if (UseOverpower && Interface.IsKeyEnabled("Warrior.Overpower") && Me.Rage >= 5)
                {
                    Context.CastSpell("Warrior.Overpower");
                    continue;
                }

                if (UseDemoralizing && !UsedDemoralizing && Me.Rage >= 10)
                {
                    UsedDemoralizing = true;
                    Context.CastSpell("Warrior.DemoShout");
                    continue;
                }

                // Ok, combat moves.  First, keep battle shout up:
                if (BattleShout.IsReady && Me.Rage >= 10)
                {
                    BattleShout.Reset();
                    Context.CastSpell("Warrior.BattleShout");
                    continue;
                }

                // Execute if we can!
                if (UseExecute && Target.Health <= .20 && Me.Rage >= 15)
                {
                    Context.CastSpell("Warrior.Execute");
                    continue;
                }

                // No big stuff ready, see if rend is ticking:
                if (Interface.IsKeyReady("Warrior.Rend") && Me.Rage >= 10 && Target.Health > .45 && Rend.IsReady)
                {
                    Context.CastSpell("Warrior.Rend");
                    Rend.Reset();
                    continue;
                }

                if (UseConcussion && Interface.IsKeyReady("Warrior.Concussion") && Me.Rage >= 15)
                {
                    Context.CastSpell("Warrior.Concussion");
                    continue;
                }

                if (UseSunder && Me.Rage >= 15 && SundersLeft > 0)
                {
                    SundersLeft--;
                    Context.CastSpell("Warrior.SunderArmor");
                    continue;
                }

                // Spam something:
                if (UseMortalStrike && Me.Rage >= 30 && Interface.IsKeyReady("Warrior.MortalStrike"))
                {
                    Context.CastSpell("Warrior.MortalStrike");
                    continue;
                }

                // Spam something else:
                if (Interface.IsKeyReady("Warrior.HeroicStrike") && Me.Rage >= HeroicRage && Heroic.IsReady)
                {
                    Heroic.Reset();
                    Context.CastSpell("Warrior.HeroicStrike");
                    continue;
                }

                if (!Me.IsMeleeing)
                {
                    Context.SendKey("Common.ToggleCombat");
                    Context.ReleaseSpinRun();
                    continue;
                }

                // Extremely bored - maybe we should back up?
                if (AvoidAdds && Target.DistanceToSelf <= Context.MeleeDistance && !Target.IsCasting)
                    Movement.ConsiderAvoidAdds(AvoidAddDistance);
            }
        }
        #endregion

        #region Warrior combat helpers

        GCombatResult KillPlayer(GPlayer Player)
        {
            //TODO: Warrior stuff
             Context.Log("Attacked by player, waiting to die off");

            GSpellTimer WaitTime = new GSpellTimer(60 * 1000);
            WaitTime.Wait();

            if (!Me.IsDead)
                Context.KillAction("PlayerLeftAlive", true);
            return GCombatResult.Died;
        }

        public bool CheckAdditional(GUnit Target)
        {
            bool UsedSpell = false;
            GUnit Extra = GObjectList.GetNearestAttacker(Target.GUID);

            if (Extra == null)   // No extra.
            {
                GotExtra = false;
                return false;
            }

            if (!Extra.IsInMeleeRange)  // Too far to care about.
            {
                GotExtra = false;
                return false;
            }

            if (!GotExtra)
            {
                GotExtra = true;
                Context.Log("Additional attacker!");
            }

            if (Interface.IsKeyReady("Warrior.Thunderclap") && Me.Rage >= 20)
            {
                Context.CastSpell("Warrior.Thunderclap");
                return true;
            }

            if (UseCleave && Me.Rage >= 20)
            {
                Context.CastSpell("Warrior.Cleave");
                return true;
            }

            return false;
        }

        bool DoAndCheckCharge(GUnit Target)
        {
            GLocation Anchor = Me.Location;
            GSpellTimer ChargeWait = new GSpellTimer(2000, false);

            Context.CastSpell("Warrior.Charge");
            Context.ReleaseSpinRun();

            while (!ChargeWait.IsReadySlow)
            {
                if (Me.Location.GetDistanceTo(Anchor) >= 7.0)
                {
                    Context.Debug("Charge is moving us, excellent!");
                    Target.WaitForApproach(Context.MeleeDistance, 2000);
                    return true;
                }
            }

            Context.Log("Never seemed to get anywhere on charge");
            return false;
        }
        #endregion

        #region UpdateKeys method
        public override void UpdateKeys(GKey[] UpdatableKeys)
        {
            foreach (GKey One in UpdatableKeys)
            {
                GShortcut button = null;

                switch (One.KeyName)
                {
                    case "Warrior.Ranged":
                        button = GShortcut.FindMatchingShortcut(GShortcutType.Spell, "0xacc 0xbca");
                        break;

                    default:
                        continue;  // Don't try to handle this, we didn't do anything smart.
                }

                if (button != null)
                {
                    Context.Debug("Mapped " + One.KeyName + " -> " + button.ToString());
                    One.SIM = button.ShortcutValue;
                }
                else
                    Context.Log("Unable to find suitable button for " + One.KeyName + ", see help section \"Re-Assigning Keys\" under Key Mappings.");

            }
        }
        #endregion

    }
}

#endregion

namespace Glider.Common.Objects.YoinkSpace
{
    public class Yoink :
        //////////////////////////////////////////////
        ////change this to your Combat Class
        Glider.Common.Objects.Warrior
    //////////////////////////////////////////////
    {
        #region Initialization
        private void initialize()
        {
            log("initialize");
            tickRate = 1000;
            Ticker = new System.Threading.Timer(new System.Threading.TimerCallback(Tick), null, tickRate, tickRate);
            Ticker.Change(0, tickRate);
            RunMethod = PathRunMethod.BOUNCE;
            soundPlayer = new SoundPlayer();
            CurrentTargetNode = new Node();
            http = new http();
            http.UserAgent = LanguageVars.CLASSNAME + "/" + VERSION;
            BlackList = new List<long>();
            chatLogBuffer = new List<String>();
            Context.SetKeyValue(LanguageVars.CLASSNAME + ".Mount", GBarState.Indifferent, GContext.SS_NONE, 49);
            Context.SetKeyValue(LanguageVars.CLASSNAME + ".Extractor", GBarState.Indifferent, GContext.SS_NONE, 50);
            Context.SetKeyValue(LanguageVars.CLASSNAME + ".BAR3", GBarState.Indifferent, GContext.SS_SHIFT, 51);
            InitializeGUI();
            DisableMainLoop = false;
            GContext.Main.ChatLog += new GContext.GChatLogHandler(Main_ChatLog);
        }
        private bool RunPatrolLoop = true;
        private bool DisableMainLoop = true;
        private bool pathDirection = false;
        private int currentPathIndex = 0;
        private int _tickRate = -1;
        private int tickRate
        {
            get
            {
                return _tickRate;
            }
            set
            {
                _tickRate = value;
                if (!Object.Equals(null, Ticker))
                {
                    Ticker.Change(0, value);
                }
            }
        }
        private const string VERSION = "0.4.0";
        private const string DBURL = "http://thatit.org/yoink/";
        private Timer Ticker = null;
        private Thread gatherThread = null;
        private Thread mainLoopThread = null;
        private Thread onlineDBQueryThread = null;
        private Coordinates PatrolPath = null;
        private List<long> BlackList = null;
        private List<String> chatLogBuffer = null;
        private SoundPlayer soundPlayer = null;
        private Action DoingNow = Action.NIL;
        private DateTime timeLastAquired;
        private PathRunMethod RunMethod;
        private Node CurrentTargetNode;
        private http http = null;
        #region GUI Initialization
        private System.Windows.Forms.Button btnRecNewPath;
        private System.Windows.Forms.Button btnLoadPath;
        private System.Windows.Forms.Button btnRunPath;
        private System.Windows.Forms.Button btnPauseRec;
        private System.Windows.Forms.Button btnUnloadPath;
        private System.Windows.Forms.TextBox txbLoadFileName;
        private System.Windows.Forms.TextBox txbSaveFileName;
        private System.Windows.Forms.TableLayoutPanel tlpMain;
        private System.Windows.Forms.Form GUIForm;
        private System.Windows.Forms.Label lblYoink;
        private System.Windows.Forms.ComboBox cbbPathMode;
        private System.Windows.Forms.CheckBox cbNinja;
        private System.Windows.Forms.Label lblLootDelay;
        private System.Windows.Forms.NumericUpDown nudLootDelay;
        private System.Windows.Forms.CheckBox cbGetHerbs;
        private System.Windows.Forms.CheckBox cbGetMinerals;
        private System.Windows.Forms.CheckBox cbGetClouds;
        private System.Windows.Forms.CheckBox cbGetTreasures;
        private System.Windows.Forms.CheckBox cbUseOnlineDB;
        private void InitializeGUI()
        {
            #region Init
            this.btnRecNewPath = new System.Windows.Forms.Button();
            this.btnLoadPath = new System.Windows.Forms.Button();
            this.btnRunPath = new System.Windows.Forms.Button();
            this.btnUnloadPath = new System.Windows.Forms.Button();
            this.tlpMain = new System.Windows.Forms.TableLayoutPanel();
            this.lblYoink = new System.Windows.Forms.Label();
            this.txbLoadFileName = new System.Windows.Forms.TextBox();
            this.txbSaveFileName = new System.Windows.Forms.TextBox();
            this.btnPauseRec = new System.Windows.Forms.Button();
            this.cbbPathMode = new System.Windows.Forms.ComboBox();
            this.cbNinja = new System.Windows.Forms.CheckBox();
            this.lblLootDelay = new System.Windows.Forms.Label();
            this.nudLootDelay = new System.Windows.Forms.NumericUpDown();
            this.cbGetHerbs = new System.Windows.Forms.CheckBox();
            this.cbGetMinerals = new System.Windows.Forms.CheckBox();
            this.cbGetClouds = new System.Windows.Forms.CheckBox();
            this.cbGetTreasures = new System.Windows.Forms.CheckBox();
            this.cbUseOnlineDB = new System.Windows.Forms.CheckBox();
            #endregion
            #region Text
            this.lblLootDelay.Text = LanguageVars.LOOTDELAY;
            this.cbGetClouds.Text = LanguageVars.GETCLOUDS;
            this.cbGetHerbs.Text = LanguageVars.GETHERBS;
            this.cbGetMinerals.Text = LanguageVars.GETMINERALS;
            this.btnLoadPath.Text = LanguageVars.LOAD1;
            this.btnUnloadPath.Text = LanguageVars.UNLOAD1;
            this.btnRecNewPath.Text = LanguageVars.RECORD1;
            this.btnPauseRec.Text = LanguageVars.RECORD3;
            this.btnRunPath.Text = LanguageVars.RUN1;
            this.lblYoink.Text = LanguageVars.CLASSNAME;
            this.cbNinja.Text = LanguageVars.NINJA;
            this.cbGetTreasures.Text = LanguageVars.GETTREASURES;
            this.cbUseOnlineDB.Text = LanguageVars.USEONLINEDB;
            #endregion
            #region Other
            this.nudLootDelay.Minimum = 0;
            this.nudLootDelay.Maximum = 10000;
            this.cbbPathMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cbbPathMode.Items.Add("BOUNCE");
            this.cbbPathMode.Items.Add("CIRCLE");
            #endregion
            #region DockStyle
            this.cbNinja.Dock = System.Windows.Forms.DockStyle.Fill;
            this.lblYoink.Dock = System.Windows.Forms.DockStyle.Fill;
            this.txbLoadFileName.Dock = System.Windows.Forms.DockStyle.Fill;
            this.btnLoadPath.Dock = System.Windows.Forms.DockStyle.Fill;
            this.btnUnloadPath.Dock = System.Windows.Forms.DockStyle.Fill;
            this.txbSaveFileName.Dock = System.Windows.Forms.DockStyle.Fill;
            this.btnRecNewPath.Dock = System.Windows.Forms.DockStyle.Fill;
            this.btnPauseRec.Dock = System.Windows.Forms.DockStyle.Fill;
            this.btnRunPath.Dock = System.Windows.Forms.DockStyle.Fill;
            this.cbbPathMode.Dock = System.Windows.Forms.DockStyle.Fill;
            this.lblLootDelay.Dock = System.Windows.Forms.DockStyle.Fill;
            this.nudLootDelay.Dock = System.Windows.Forms.DockStyle.Fill;
            this.cbGetHerbs.Dock = System.Windows.Forms.DockStyle.Fill;
            this.cbGetMinerals.Dock = System.Windows.Forms.DockStyle.Fill;
            this.cbGetClouds.Dock = System.Windows.Forms.DockStyle.Fill;
            this.cbGetTreasures.Dock = System.Windows.Forms.DockStyle.Fill;
            this.cbUseOnlineDB.Dock = System.Windows.Forms.DockStyle.Fill;
            #endregion
            #region Table Layout Panel
            this.tlpMain.AutoSize = true;
            this.tlpMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly;
            this.tlpMain.ColumnCount = 1;
            this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpMain.RowCount = 2;
            this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            this.tlpMain.Width = 200;
            this.tlpMain.Controls.Add(lblYoink);
            this.tlpMain.Controls.Add(txbLoadFileName);
            this.tlpMain.Controls.Add(btnLoadPath);
            this.tlpMain.Controls.Add(btnUnloadPath);
            this.tlpMain.Controls.Add(txbSaveFileName);
            this.tlpMain.Controls.Add(cbbPathMode);
            this.tlpMain.Controls.Add(btnRecNewPath);
            this.tlpMain.Controls.Add(btnPauseRec);
            this.tlpMain.Controls.Add(cbGetHerbs);
            this.tlpMain.Controls.Add(cbGetMinerals);
            this.tlpMain.Controls.Add(cbGetClouds);
            this.tlpMain.Controls.Add(cbGetTreasures);
            this.tlpMain.Controls.Add(cbNinja);
            this.tlpMain.Controls.Add(lblLootDelay);
            this.tlpMain.Controls.Add(nudLootDelay);
            this.tlpMain.Controls.Add(cbUseOnlineDB);
            this.tlpMain.Controls.Add(btnRunPath);
            #endregion
            #region Form
            this.GUIForm = new System.Windows.Forms.Form();
            this.GUIForm.Hide();
            this.GUIForm.SuspendLayout();
            this.GUIForm.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.GUIForm.AutoSize = true;
            this.GUIForm.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            this.GUIForm.ShowIcon = false;
            this.GUIForm.Controls.Add(this.tlpMain);
            this.GUIForm.Name = YoinkSpace.Random.String(8);
            this.GUIForm.Text = YoinkSpace.Random.String(8);
            this.GUIForm.ResumeLayout(false);
            #endregion
            #region Config
            this.txbLoadFileName.Text = (getConfigVal("txbLoadFileName") == String.Empty) ? LanguageVars.DEFAULTPATHNAME1 : getConfigVal("txbLoadFileName");
            this.txbSaveFileName.Text = (getConfigVal("txbSaveFileName") == String.Empty) ? LanguageVars.DEFAULTPATHNAME1 : getConfigVal("txbSaveFileName");
            this.cbbPathMode.SelectedItem = (getConfigVal("cbbPathMode") == String.Empty) ? "BOUNCE" : getConfigVal("cbbPathMode");
            this.cbGetHerbs.Checked = (getConfigVal("cbGetHerbs") == String.Empty) ? true : Boolean.Parse(getConfigVal("cbGetHerbs"));
            this.cbGetMinerals.Checked = (getConfigVal("cbGetMinerals") == String.Empty) ? true : Boolean.Parse(getConfigVal("cbGetMinerals"));
            this.cbGetClouds.Checked = (getConfigVal("cbGetClouds") == String.Empty) ? false : Boolean.Parse(getConfigVal("cbGetClouds"));
            this.cbNinja.Checked = (getConfigVal("cbNinja") == String.Empty) ? true : Boolean.Parse(getConfigVal("cbNinja"));
            this.nudLootDelay.Value = (getConfigVal("nudLootDelay") == String.Empty) ? 1000 : Decimal.Parse(getConfigVal("nudLootDelay"));
            this.cbGetTreasures.Checked = (getConfigVal("cbGetTreasures") == String.Empty) ? false : Boolean.Parse(getConfigVal("cbGetTreasures"));
            this.cbUseOnlineDB.Checked = (getConfigVal("cbUseOnlineDB") == String.Empty) ? true : Boolean.Parse(getConfigVal("cbUseOnlineDB"));
            #endregion
            #region Events
            this.txbLoadFileName.TextChanged += new EventHandler(txbLoadFileName_TextChanged);
            this.txbSaveFileName.TextChanged += new EventHandler(txbSaveFileName_TextChanged);
            this.btnRecNewPath.Click += new EventHandler(btnRecNewPath_Click);
            this.btnLoadPath.Click += new EventHandler(loadPath);
            this.btnRunPath.Click += new EventHandler(btnRunPath_Click);
            this.btnPauseRec.Click += new EventHandler(btnPauseRec_Click);
            this.btnUnloadPath.Click += new EventHandler(btnUnloadPath_Click);
            this.GUIForm.FormClosing += new System.Windows.Forms.FormClosingEventHandler(GUIForm_FormClosing);
            this.cbbPathMode.SelectedValueChanged += new EventHandler(cbbPathMode_SelectedValueChanged);
            this.cbNinja.CheckedChanged += new EventHandler(cbNinja_CheckedChanged);
            this.nudLootDelay.ValueChanged += new EventHandler(nudLootDelay_ValueChanged);
            this.cbGetClouds.CheckedChanged += new EventHandler(cbGetClouds_CheckedChanged);
            this.cbGetHerbs.CheckedChanged += new EventHandler(cbGetHerbs_CheckedChanged);
            this.cbGetMinerals.CheckedChanged += new EventHandler(cbGetMinerals_CheckedChanged);
            this.cbGetTreasures.CheckedChanged += new EventHandler(cbGetTreasures_CheckedChanged);
            this.cbUseOnlineDB.CheckedChanged += new EventHandler(cbUseOnlineDB_CheckedChanged);
            #endregion
            this.GUIForm.Show();
        }
        #endregion
        #endregion
        #region Loops
        private void loopMain()
        {
            try
            {
                if (DisableMainLoop) return;
                if (isGliderUseable)
                {
                    switch (DoingNow)
                    {
                        case Action.PATROL:
                            DisableMainLoop = true;
                            playSound();
                            loopPatrol();
                            resetKeys();
                            DisableMainLoop = false;
                            break;
                        case Action.MANEUVER:
                            DisableMainLoop = true;
                            playSound();
                            loopManeuver();
                            resetKeys();
                            DisableMainLoop = false;
                            break;
                        case Action.RECORD:
                            DisableMainLoop = true;
                            loopRecord();
                            DisableMainLoop = false;
                            break;
                        case Action.COMBAT:
                            DisableMainLoop = true;
                            loopCombat();
                            DisableMainLoop = false;
                            break;
                    }
                }
            }
            catch (Exception ex)
            {
                log("loopMain(): " + ex.Message);
            }
        }
        private void loopCombat()
        {
            try
            {
                while (Context.Me.IsInCombat)
                {
                    if (IsMounted())
                        disMount();
                    GUnit target = GObjectList.GetNearestAttacker(0);
                    if (object.Equals(null, target))
                    {
                        continue;
                    }
                    if (target != null && !target.IsDead)
                    {
                        if ((target.IsPlayer && !((GPlayer)target).IsSameFaction) ||
                            target.Reaction != GReaction.Friendly)
                        {
                            Context.Log("Got a Target. Go Kill!");
                            if (!target.SetAsTarget(false))
                            {
                                Context.Log("Can not target");
                            }
                            else
                            {
                                target.TouchHealthDrop();
                                StartCombat();
                                GCombatResult outcome = KillTarget(target, false);
                                log("Combat outcome: " + outcome.ToString());
                            }
                        }
                        else
                            Context.ClearTarget();
                    }
                    pause(100, 1000);
                }
                Context.Me.Refresh(true);
                if (Context.Me.IsDead)
                {
                    stopAll("Dead >_<");
                    return;
                }
                resetKeys();
                GUnit[] units = GObjectList.GetUnits();
                foreach (GUnit u in units)
                {
                    if (u.IsLootable)
                    {
                        lootUnit2D(u);
                    }
                }
                DoingNow = Action.PATROL;
                if (checkForNodes())
                {
                    if (CurrentTargetNode.Coords.Location.DistanceToSelf < 20)
                    {
                        DoingNow = Action.MANEUVER;
                    }
                }
            }
            catch (Exception ex)
            {
                log("loopCombat(): " + ex.Message);
            }
        }
        private bool firstPathIndex = true;
        private void loopPatrol()
        {
            try
            {
                while (DoingNow == Action.PATROL)
                {
                    Context.Me.Refresh(true);
                    if (Context.Me.IsDead)
                    {
                        stopAll("Dead >_<");
                        return;
                    }
                    if (Context.Me.IsInCombat && !IsMounted())
                    {
                        log("ambushed, kick some but using combat class");
                        DoingNow = Action.COMBAT;
                        return;
                    }
                    if (!IsMounted())
                    {
                        mountAndTakeOff();
                        if (!IsMounted())
                        {
                            continue;
                        }
                    }
                    float meX = Context.Me.Location.X;
                    float meY = Context.Me.Location.Y;
                    float meZ = Context.Me.Location.Z;
                    //find closest waypoint
                    float lowestDiff = 100000;
                    float tmpXdiff = 0;
                    float tmpYdiff = 0;
                    float tmpZdiff = 0;
                    float tmpLowDif = 0;
                    int PathCursor = -1;
                    int closestCoordIndex = -1;
                    foreach (Coordinate c in PatrolPath)
                    {
                        if (pathDirection)
                        {
                            if (currentPathIndex > PathCursor && !firstPathIndex)
                            {
                                PathCursor++;
                                continue;
                            }
                        }
                        else
                        {
                            if (currentPathIndex < PathCursor && !firstPathIndex)
                            {
                                PathCursor++;
                                continue;
                            }
                        }
                        PathCursor++;
                        tmpXdiff = Math.Abs(c.X - meX);
                        tmpYdiff = Math.Abs(c.Y - meY);
                        tmpZdiff = Math.Abs(c.Z - meZ);
                        tmpLowDif = tmpXdiff + tmpYdiff + tmpZdiff;
                        if (lowestDiff > tmpLowDif)
                        {
                            lowestDiff = tmpLowDif;
                            closestCoordIndex = PathCursor;
                        }
                    }
                    firstPathIndex = false;
                    //go towards the point after the closest point
                    int targetCoordIndex = -1;
                    if (pathDirection)
                        targetCoordIndex = closestCoordIndex - 1;
                    else
                        targetCoordIndex = closestCoordIndex + 1;
                    if (targetCoordIndex < 0)
                    {
                        switch (RunMethod)
                        {
                            case PathRunMethod.BOUNCE:
                                targetCoordIndex = 0;
                                pathDirection = !pathDirection;
                                break;
                            case PathRunMethod.CIRCLE:
                                targetCoordIndex = PatrolPath.Count - 1;
                                break;
                        }
                    }
                    if (targetCoordIndex > PatrolPath.Count - 1)
                    {
                        switch (RunMethod)
                        {
                            case PathRunMethod.BOUNCE:
                                targetCoordIndex = PatrolPath.Count - 1;
                                pathDirection = !pathDirection;
                                break;
                            case PathRunMethod.CIRCLE:
                                targetCoordIndex = 0;
                                break;
                        }
                    }
                    currentPathIndex = targetCoordIndex;
                    Coordinate TargetCoord = PatrolPath[targetCoordIndex];
                    moveTo3D(TargetCoord, .3, 15, 0, 0, 0, 0, 0);
                    if (checkForNodes())
                    {
                        DoingNow = Action.MANEUVER;
                        return;
                    }
                    pause(300, 1500);
                }
            }
            catch (Exception ex)
            {
                log("loopPatrol(): " + ex.Message);
            }
        }
        private void loopManeuver()
        {
            DateTime startTime = DateTime.Now;
            DateTime distStTime = DateTime.Now;
            try
            {
                GObject node = GObjectList.FindObject(CurrentTargetNode.GUID);
                if (node != null && node.IsValid)
                {
                    log("Maneuvering towards " + node.Name);
                }
                bool directlyAbove = false;
                while (DoingNow == Action.MANEUVER)
                {
                    node = GObjectList.FindObject(CurrentTargetNode.GUID);
                    #region Checks
                    if (node == null || !node.IsValid)
                    {
                        log("node dissapeared, blacklisting it, back to patrol");
                        blackListNode(CurrentTargetNode.GUID);
                        DoingNow = Action.PATROL;
                        if (checkForNodes())
                        {
                            if (CurrentTargetNode.Coords.Location.DistanceToSelf < 20)
                            {
                                DoingNow = Action.MANEUVER;
                            }
                        }
                        return;
                    }
                    node.Refresh(true);
                    Context.Me.Refresh(true);
                    if (Context.Me.IsDead)
                    {
                        stopAll("Dead >_<");
                        return;
                    }
                    if (Context.Me.IsInCombat && !IsMounted())
                    {
                        log("ambushed, kick some but using combat class");
                        DoingNow = Action.COMBAT;
                        return;
                    }
                    if (DateTime.Now.CompareTo(startTime.AddSeconds(45)) > 0)
                    {
                        log("took too long to get to this node (45 seconds), blacklisting it, back to patrol");
                        blackListNode(CurrentTargetNode.GUID);
                        DoingNow = Action.PATROL;
                        if (checkForNodes())
                        {
                            if (CurrentTargetNode.Coords.Location.DistanceToSelf < 20)
                            {
                                DoingNow = Action.MANEUVER;
                            }
                        }
                        return;
                    }
                    if (!checkForNodes())
                    {
                        log("no nodes, back to patrol");
                        DoingNow = Action.PATROL;
                        return;
                    }
                    #endregion
                    #region Maneuver
                    Coordinate TargetCoord = new Coordinate(node.Location);
                    Coordinate MyCoord = new Coordinate(Context.Me.Location);

                    float diffY = TargetCoord.Y - MyCoord.Y;
                    float diffX = TargetCoord.X - MyCoord.X;
                    float diffZ = TargetCoord.Z - MyCoord.Z;
                    double distanceX = Math.Round(Math.Abs(diffX));
                    double distanceY = Math.Round(Math.Abs(diffY));
                    double distanceZ = Math.Round(Math.Abs(diffZ));

                    if (DateTime.Now.CompareTo(distStTime.AddSeconds(1)) > 0)
                    {
                        distStTime = DateTime.Now;
                        //log("Distance: " + node.DistanceToSelf.ToString() + " distanceX:" + distanceX.ToString() + " distanceY:" + distanceY.ToString() + " distanceZ:" + distanceZ.ToString());
                    }

                    if (!directlyAbove && distanceX < 4 && distanceY < 4 && diffZ < 0)
                    {
                        directlyAbove = true;
                        log("directly above node, descending");
                    }
                    if (!directlyAbove)
                    {
                        TargetCoord.Z = TargetCoord.Z + 25;
                    }

                    moveTo3D(TargetCoord, .3, (directlyAbove) ? 0 : 5, (directlyAbove) ? 0 : 5, (directlyAbove) ? 100 : 4, (directlyAbove) ? 100 : 4, (directlyAbove) ? 100 : 4, (directlyAbove) ? 100 : 4);
                    if (directlyAbove && diffZ > -10 && IsMounted())
                    {
                        resetKeys();
                        disMount();
                    }
                    if (directlyAbove && diffZ > -10 && !IsMounted())
                    {
                        resetKeys();
                        pause(300, 1500);
                        moveTo2D(TargetCoord, 4, 10, 200);
                        acquireNode();
                        acquireNodeThreadSupervisor();
                    }
                    #endregion
                    pause(200);
                }
            }
            catch (Exception ex)
            {
                log("loopManeuver(): " + ex.Message);
            }
        }
        private void loopRecord()
        {
            try
            {
                if (!isGliderUseable) return;
                if (object.Equals(null, PatrolPath))
                    PatrolPath = new Coordinates();
                while (DoingNow == Action.RECORD || DoingNow == Action.RECORDPAUSE)
                {
                    if (DoingNow == Action.RECORD)
                    {
                        Context.Me.Refresh(true);
                        float meX = Context.Me.Location.X;
                        float meY = Context.Me.Location.Y;
                        float meZ = Context.Me.Location.Z;
                        if (PatrolPath.Count > 0)
                        {
                            if (PatrolPath[PatrolPath.Count - 1].X == meX && PatrolPath[PatrolPath.Count - 1].Y == meY && PatrolPath[PatrolPath.Count - 1].Z == meZ)
                                continue;
                        }
                        playSound();
                        PatrolPath.Add(new Coordinate(Context.Me.Location));
                    }
                    //pause(300, 1500);//better?
                    pause(1000);
                }
            }
            catch (Exception ex)
            {
                log("loopRecord(): " + ex.Message);
            }
            string s = string.Empty;
            foreach (Coordinate c in PatrolPath)
            {
                s += c.X.ToString() + "|" + c.Y.ToString() + "|" + c.Z.ToString() + "\n";
            }
            try
            {
                string fpath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + txbSaveFileName.Text + ".yoink";
                FileStream fs = new FileStream(fpath, FileMode.Create);
                StreamWriter sw = new StreamWriter(fs);
                sw.Write(s);
                sw.Flush();
                sw.Close();
                fs.Close();
                log("Wrote path recording to: " + fpath);
            }
            catch (Exception ex)
            {
                log("loopRecord(): " + ex.Message);
            }
        }
        #endregion
        #region Node Logic
        private void acquireNode()
        {
            gatherThread = new Thread(new ThreadStart(acquireNode2));
            gatherThread.Start();
        }
        private void acquireNode2()
        {
            try
            {
                GObject node = GObjectList.FindObject(CurrentTargetNode.GUID);
                moveTo2D(new Coordinate(node.Location), 5, 100, 100);
                int chatLogBufferCursor = chatLogBuffer.Count;
                bool isCloud = (node.Name.ToLower().Contains("cloud")) ? true : false;
                while (node != null && node.IsValid)
                {
                    if (isCloud)
                    {
                        useExtractor();
                    }
                    else
                    {
                        GContext.Main.EnableCursorHook();
                        node.Hover();
                        node.Interact();
                        GContext.Main.DisableCursorHook();
                    }
                    string message = GContext.Main.RedMessage.ToLower();
                    if (message.ToLower().Contains("lock"))
                    {
                        log(message + ", blacklisting node");
                        blackListNode(CurrentTargetNode.GUID);
                        return;
                    }
                    if (message.ToLower().Contains("require"))
                    {
                        log(message + ", blacklisting node");
                        blackListNode(CurrentTargetNode.GUID);
                        return;
                    }
                    if (message.ToLower().Contains("are full"))
                    {
                        stopAll("Bags Full");
                        return;
                    }
                    if (message.ToLower().Contains("placed in that"))
                    {
                        stopAll("Bags Full");
                        return;
                    }
                    if (message.ToLower().Contains("not go there"))
                    {
                        stopAll("Bags Full");
                        return;
                    }
                    while (Context.Me.IsCasting)
                    {
                        pause(50);
                    }
                    pause((int)nudLootDelay.Value);
                    //HandleBopPopup(1000);
                    if (chatLogBuffer.Count > chatLogBufferCursor)
                    {
                        int howManyNewLines = chatLogBuffer.Count - chatLogBufferCursor;
                        List<String> newLines = chatLogBuffer.GetRange(chatLogBuffer.Count - howManyNewLines, howManyNewLines);
                        chatLogBufferCursor = chatLogBuffer.Count;
                        foreach (String line in newLines)
                        {
                            if ((line == String.Empty) || (line == null)) continue;
                            if (line.ToLower().Contains("you receive loot: "))
                            {
                                log("Got some of the node!");
                                timeLastAquired = DateTime.Now;
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log("acquireNode2(): " + ex.Message);
            }
        }
        private void acquireNodeThreadSupervisor()
        {
            try
            {
                GObject node = GObjectList.FindObject(CurrentTargetNode.GUID);
                DateTime startTime = DateTime.Now;
                timeLastAquired = DateTime.Now;
                while (node != null && node.IsValid)
                {
                    if (Context.Me.IsInCombat)
                    {
                        log("ambushed, kick some but using combat class");
                        DoingNow = Action.COMBAT;
                        gatherThread.Abort();
                        resetKeys();
                        return;
                    }
                    if (DateTime.Now.CompareTo(timeLastAquired.AddSeconds(35)) > 0)
                    {
                        log("took too long to mine this node (35 seconds), blacklisting it");
                        blackListNode(CurrentTargetNode.GUID);
                        DoingNow = Action.PATROL;
                        if (checkForNodes())
                        {
                            if (CurrentTargetNode.Coords.Location.DistanceToSelf < 20)
                            {
                                DoingNow = Action.MANEUVER;
                            }
                        }
                        gatherThread.Abort();
                        resetKeys();
                        return;
                    }
                    pause(500);
                }
                gatherThread.Abort();
                resetKeys();
                DoingNow = Action.PATROL;
                if (checkForNodes())
                {
                    if (CurrentTargetNode.Coords.Location.DistanceToSelf < 20)
                    {
                        DoingNow = Action.MANEUVER;
                    }
                }
            }
            catch (Exception ex)
            {
                log("acquireNodeThreadSupervisor(): " + ex.Message);
            }
        }
        private bool checkForNodes()
        {
            GObject[] objs = GObjectList.GetObjects();
            foreach (GObject o in objs)
            {
                Action a = new Action();
                if (IsValidNode(o, out a))
                {
                    setTargetNode(o.GUID, o.Location, o.Name, a);
                    startDBQuery(o);
                    return true;
                }
            }
            return false;
        }
        private bool IsValidNode(GObject obj, out Action Action)
        {
            Action = Action.NIL;
            if (object.Equals(null, obj))
                return false;
            if (!obj.IsValid)
                return false;
            if (BlackList.Contains(obj.GUID))
                return false;
            if (obj.Type != GObjectType.Node && obj.Type != GObjectType.Monster)
                return false;
            //valid node?
            if (obj.Type == GObjectType.Node)
            {
                GNode objNode = (GNode)obj;
                if (!objNode.IsFlower && !objNode.IsMineral && !objNode.IsTreasure)
                    return false;
                if (objNode.IsFlower && !GPlayerSelf.Me.HasHerbalism)
                    return false;
                if (objNode.IsMineral && !GPlayerSelf.Me.HasMining)
                    return false;
                if (objNode.IsFlower && !cbGetHerbs.Checked)
                    return false;
                if (objNode.IsMineral && !cbGetMinerals.Checked)
                    return false;
                if (objNode.IsTreasure && !cbGetTreasures.Checked)
                    return false;
            }
            //valid cloud?
            if (obj.Type == GObjectType.Monster)
            {
                if (!cbGetClouds.Checked)
                    return false;
                if (!obj.Name.ToLower().Contains("cloud"))
                    return false;
            }
            //check ninja status
            if (!cbNinja.Checked)
            {
                GPlayer[] players = GObjectList.GetPlayers();
                foreach (GPlayer player in players)
                {
                    if (player.GUID == Context.Me.GUID)
                        continue;
                    player.Refresh(true);
                    if (player.Location.GetDistanceTo(obj.Location) < 20)
                    {
                        return false;
                    }
                }
            }
            Action = Action.AQUIRE;
            return true;
        }
        private void startDBQuery(GObject obj)
        {
            try
            {
                if (!object.Equals(null, onlineDBQueryThread))
                {
                    if (onlineDBQueryThread.IsAlive)
                        return;
                }
                onlineDBQueryThread = new Thread(new ParameterizedThreadStart(startDBQuery2));
                onlineDBQueryThread.SetApartmentState(ApartmentState.STA);
                onlineDBQueryThread.Priority = ThreadPriority.AboveNormal;
                onlineDBQueryThread.Name = "onlineDBQueryThread";
                onlineDBQueryThread.Start(obj);
            }
            catch (Exception ex)
            {
                log("startDBQuery(GObject obj): " + ex.Message);
            }
        }
        private void startDBQuery2(object o)
        {
            try
            {
                GObject obj = (GObject)o;
                int numCases = onlineDbQueryEvents(new Coordinate(obj.Location), 20, "stuckswim", "stuckinside");
                if (numCases > 0)
                {
                    log("Online DB Reported " + numCases.ToString() + " cases of stuckswim and/or stuckinside for a node location, blacklisting the node");
                    blackListNode(obj.GUID);
                }
            }
            catch (Exception ex)
            {
                log("startDBQuery2(object o): " + ex.Message);
            }
        }
        private void blackListNode(long GUID)
        {
            BlackList.Add(GUID);
        }
        private void setTargetNode(long GUID, GLocation Coords, String Name, Action NodeAction)
        {
            Node n = new Node();
            n.Action = NodeAction;
            n.Word = String.Empty;
            n.GUID = GUID;
            n.Coords = new Coordinate(Coords);
            n.Name = Name;
            CurrentTargetNode = n;
        }
        #endregion
        #region Move Logic
        private void moveTo3D(Coordinate TargetCoord)
        {
            moveTo3D(TargetCoord, .3, 0, 0, 0, 0, 0, 0);
        }
        private void moveTo3D(Coordinate TargetCoord, double TolHead, int tolZ_lower, int tolZ_upper, int tolX_lower, int tolX_upper, int tolY_lower, int tolY_upper)
        {
            Context.Me.Refresh(true);
            Coordinate MyCoord = new Coordinate(Context.Me.Location);
            GLocation TargetGLoc = new GLocation(TargetCoord.X, TargetCoord.Y, TargetCoord.Z);
            GLocation MyGLoc = new GLocation(MyCoord.X, MyCoord.Y, MyCoord.Z);
            float diffY = TargetCoord.Y - MyCoord.Y;
            float diffX = TargetCoord.X - MyCoord.X;
            float diffZ = TargetCoord.Z - MyCoord.Z;
            float distanceX = Math.Abs(diffX);
            float distanceY = Math.Abs(diffY);
            float distanceZ = Math.Abs(diffZ);
            float distanceXY = Math.Abs(diffY) + Math.Abs(diffX);
            #region heading
            double heading = Context.Movement.GetHeadingTo(MyGLoc, TargetGLoc);
            double headingDiff = heading - Context.Me.Heading;
            if (Math.Abs(headingDiff) > TolHead)
            {
                Context.Movement.SetHeading(heading);
            }
            else
            {
                if (Context.IsSpinning)
                    Context.ReleaseSpin();
            }
            #endregion
            #region X and Y Axis
            clamp(ref tolX_lower, 0, 100);
            clamp(ref tolX_upper, 0, 100);
            tolX_lower = tolX_lower * -1;
            clamp(ref tolY_lower, 0, 100);
            clamp(ref tolY_upper, 0, 100);
            tolY_lower = tolY_lower * -1;
            if (diffX > tolX_upper || diffY > tolY_upper)
            {
                Context.ReleaseKey("Common.Back");
                Context.PressKey("Common.Forward");
            }
            else if (diffX < tolX_lower || diffY < tolY_lower)
            {
                Context.ReleaseKey("Common.Back");
                Context.PressKey("Common.Forward");
                //Context.ReleaseKey("Common.Forward");
                //Context.PressKey("Common.Back");
            }
            else
            {
                Context.ReleaseKey("Common.Back");
                Context.ReleaseKey("Common.Forward");
            }
            #endregion
            #region Z Axis
            clamp(ref tolZ_lower, 0, 100);
            clamp(ref tolZ_upper, 0, 100);
            tolZ_lower = tolZ_lower * -1;
            bool mounted = IsMounted();
            if (diffZ > tolZ_upper)//go up
            {
                Context.ReleaseKey("Common.Sit");
                Context.PressKey("Common.Jump");
            }
            else if (diffZ < tolZ_lower && mounted)//go down
            {
                Context.ReleaseKey("Common.Jump");
                Context.PressKey("Common.Sit");
            }
            else
            {
                Context.ReleaseKey("Common.Sit");
                Context.ReleaseKey("Common.Jump");
            }
            #endregion
        }
        private void moveTo2D(Coordinate TargetCoord, int distance, int adjustFrequencyMS, int numLoops)
        {
            GLocation loc = new GLocation(TargetCoord.X, TargetCoord.Y, TargetCoord.Z);
            if (loc.DistanceToSelf <= distance)
                return;
            resetKeys();
            for (int i = 0; i < numLoops; i++)
            {
                if (loc.DistanceToSelf <= distance)
                    break;
                Context.Me.Refresh(true);
                GLocation MyGLoc = Context.Me.Location;
                double heading = Context.Movement.GetHeadingTo(MyGLoc, loc);
                Context.Movement.SetHeading(heading);
                Context.PressKey("Common.Forward");
                pause(adjustFrequencyMS);
            }
            resetKeys();
        }
        #endregion
        #region Event Handlers
        private void cbUseOnlineDB_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbUseOnlineDB", cbUseOnlineDB.Checked.ToString());
        }
        private void Main_ChatLog(string RawText, string ParsedText)
        {
            chatLogBuffer.Add(RawText);
        }
        private void GUIForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        {
            e.Cancel = true;
            GUIForm.Visible = false;
        }
        private void txbSaveFileName_TextChanged(object sender, EventArgs e)
        {
            setConfigVal("txbSaveFileName", txbSaveFileName.Text);
        }
        private void txbLoadFileName_TextChanged(object sender, EventArgs e)
        {
            setConfigVal("txbLoadFileName", txbLoadFileName.Text);
        }
        private void cbNinja_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbNinja", cbNinja.Checked.ToString());
        }
        private void cbGetMinerals_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetMinerals", cbGetMinerals.Checked.ToString());
        }
        private void cbGetHerbs_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetHerbs", cbGetHerbs.Checked.ToString());
        }
        private void cbGetClouds_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetClouds", cbGetClouds.Checked.ToString());
        }
        private void cbGetTreasures_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetTreasures", cbGetClouds.Checked.ToString());
        }
        private void nudLootDelay_ValueChanged(object sender, EventArgs e)
        {
            setConfigVal("nudLootDelay", nudLootDelay.Value.ToString());
        }
        private void cbbPathMode_SelectedValueChanged(object sender, EventArgs e)
        {
            string s = (string)cbbPathMode.SelectedItem;
            log("changing Path Mode to " + s);
            switch (s)
            {
                case "BOUNCE":
                    RunMethod = PathRunMethod.BOUNCE;
                    break;
                case "CIRCLE":
                    RunMethod = PathRunMethod.CIRCLE;
                    break;
                default:
                    break;
            }
            setConfigVal("cbbPathMode", s);
        }
        private void btnRunPath_Click(object data, EventArgs e)
        {
            try
            {
                if (!isGliderUseable) return;
                if (isPatrolling)
                {
                    stopAll("GUI Stop Button Pressed");
                }
                else
                {
                    startAll("GUI Start Button Pressed");
                }
            }
            catch (Exception ex)
            {
                log("btnRunPath_Click(object data, EventArgs e): " + ex.Message);
            }
        }
        private void loadPath(object sender, EventArgs e)
        {
            try
            {
                if (!isGliderUseable) return;
                if (isPatrolling)
                {
                    log("Please stop the current patrol first.");
                    return;
                }
                string s = string.Empty;
                bool error = false;
                try
                {
                    string fname = txbLoadFileName.Text + ".yoink";
                    FileStream fs = new FileStream(Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + fname, FileMode.Open);
                    StreamReader sr = new StreamReader(fs);
                    s = sr.ReadToEnd();
                    log("Loaded " + fname);
                }
                catch (Exception ex)
                {
                    error = true;
                    log("loadPath(object sender, EventArgs e): " + ex.Message);
                }
                string[] lines = s.Split('\n');
                PatrolPath = new Coordinates();
                foreach (string line in lines)
                {
                    string[] coordsOneSet = line.Split('|');
                    if (coordsOneSet.Length < 3)
                        continue;
                    PatrolPath.Add(new Coordinate(float.Parse(coordsOneSet[0]), float.Parse(coordsOneSet[1]), float.Parse(coordsOneSet[2])));
                }
                if (!error)
                    playSound();
            }
            catch (Exception ex)
            {
                log("loadPath(object sender, EventArgs e): " + ex.Message);
            }
        }
        private void btnUnloadPath_Click(object sender, EventArgs e)
        {
            PatrolPath = new Coordinates();
        }
        private void btnRecNewPath_Click(object sender, EventArgs e)
        {
            if (!isGliderUseable) return;
            if (DoingNow == Action.RECORD || DoingNow == Action.RECORDPAUSE)
            {
                DoingNow = Action.NIL;
                btnRecNewPath.Text = LanguageVars.RECORD1;
                btnPauseRec.Text = LanguageVars.RECORD3;
            }
            else if (DoingNow == Action.NIL)
            {
                DoingNow = Action.RECORD;
                btnRecNewPath.Text = LanguageVars.RECORD2;
            }
            else
            {
                log("Please stop patrolling first.");
                return;
            }
        }
        private void btnPauseRec_Click(object sender, EventArgs e)
        {
            if (!isGliderUseable) return;
            if (DoingNow != Action.RECORD && DoingNow != Action.RECORDPAUSE)
            {
                log("Not Recording, can't pause.");
                return;
            }
            if (DoingNow == Action.RECORD)
            {
                DoingNow = Action.RECORDPAUSE;
                btnPauseRec.Text = LanguageVars.RECORD4;
            }
            else
            {
                DoingNow = Action.RECORD;
                btnPauseRec.Text = LanguageVars.RECORD3;
            }
        }
        #endregion
        #region Other Logic
        private void lootUnit2D(GUnit unit)
        {
            moveTo2D(new Coordinate(unit.Location), 5, 100, 100);
            GContext.Main.EnableCursorHook();
            unit.Hover();
            unit.Interact();
            GContext.Main.DisableCursorHook();
            HandleBopPopup();
            string message = GContext.Main.RedMessage.ToLower();
            if (message.Contains("are full"))
            {
                stopAll("Bags Full");
                return;
            }
            if (message.Contains("not go there"))
            {
                stopAll("Bags Full");
                return;
            }
        }
        private void HandleBopPopup()
        {
            HandleBopPopup(1000);
        }
        private void HandleBopPopup(int maxWaitMS)
        {
            resetKeys();
            DateTime st = DateTime.Now;
            while (true)
            {
                if (DateTime.Now.CompareTo(st.AddMilliseconds(maxWaitMS)) > 0)
                    break;
                for (int i = 1; i <= 4; i++)
                {
                    String name = "StaticPopup" + i.ToString();
                    GInterfaceObject obj = GContext.Main.Interface.GetByName(name);
                    if (obj == null || !obj.IsVisible)
                        continue;
                    if (obj.IsVisible)
                    {
                        GInterfaceObject text = obj.GetChildObject(name + "Text");
                        log("Loot: Got a loot popup ('" + text + "')");
                        if (text.LabelText.Contains("will bind it to you"))
                        {
                            GInterfaceObject obj2 = GContext.Main.Interface.GetByName(name + "Button1");
                            if (obj2 != null && obj2.IsVisible)
                            {
                                GContext.Main.EnableCursorHook();
                                obj2.ClickMouse(false);
                                GContext.Main.DisableCursorHook();
                            }
                        }
                        else
                        {
                            GInterfaceObject obj3 = GContext.Main.Interface.GetByName(name + "Button2");
                            if (obj3 != null && obj3.IsVisible)
                            {
                                GContext.Main.EnableCursorHook();
                                obj3.ClickMouse(false);
                                GContext.Main.DisableCursorHook();
                            }
                        }
                    }
                }
                pause(100);
            }
        }
        private void resetKeys()
        {
            GContext.Main.DisableCursorHook();
            Context.ReleaseSpin();
            Context.ReleaseKey("Common.Jump");
            Context.ReleaseKey("Common.Sit");
            Context.ReleaseKey("Common.Forward");
            Context.ReleaseKey("Common.Back");
            Context.ReleaseKey("Common.RotateRight");
            Context.ReleaseKey("Common.RotateLeft");
        }
        private void TargetClosestAttacker()
        {
            GUnit NearestAttacker = GObjectList.GetNearestAttacker(0);
            NearestAttacker.SetAsTarget(false);
        }
        private void disMount()
        {
            Context.SendKey(LanguageVars.CLASSNAME + ".Mount");
        }
        private void useExtractor()
        {
            resetKeys();
            pause(200);
            Context.SendKey(LanguageVars.CLASSNAME + ".BAR3");
            pause(200);
            Context.SendKey(LanguageVars.CLASSNAME + ".Extractor");
        }
        private void mountAndTakeOff()
        {
            resetKeys();
            Context.SendKey(LanguageVars.CLASSNAME + ".BAR3");
            pause(200);
            Context.SendKey(LanguageVars.CLASSNAME + ".Mount");
            pause(4500, 8000);//looking at minimap or something ;)
            if (IsMounted())
            {
                Context.PressKey("Common.Jump");
                pause(1000, 3000);
                Context.ReleaseKey("Common.Jump");
            }
            else
            {
                if (GContext.Main.RedMessage.Contains("swim"))
                {
                    onlineDbInsertEvent("stuckswim");
                    stopAll("Trying to mount while swimming.");
                }
                else if (GContext.Main.RedMessage.Contains("mount here"))
                {
                    onlineDbInsertEvent("stuckinside");
                    stopAll("Trying to mount inside.");
                }
            }
        }
        private static bool IsMounted()
        {
            return IsMounted(GPlayerSelf.Me);
        }
        private static bool IsMounted(GUnit Unit)
        {
            Unit.SetBuffsDirty();
            if (Unit.HasBuff(MountSpellIds.FlyingMounts))
                return true;
            if (Unit.HasBuff(MountSpellIds.GroundMounts))
                return true;
            return false;
        }
        private void Tick(object state)
        {
            if (!object.Equals(null, mainLoopThread))
            {
                if (mainLoopThread.IsAlive)
                    return;
            }
            mainLoopThread = new Thread(new ThreadStart(loopMain));
            mainLoopThread.SetApartmentState(ApartmentState.STA);
            mainLoopThread.Priority = ThreadPriority.AboveNormal;
            mainLoopThread.Name = "MainLoopThread";
            mainLoopThread.Start();
        }
        #region Stoppers
        private bool stopGlide()
        {
            return stopGlide(String.Empty);
        }
        private bool stopGlide(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                if (!isGliderUseable) return false;
                log("Stopping Glide; " + reason);
                if (Context.IsGliding)
                {
                    Context.KillAction("[" + LanguageVars.CLASSNAME + " " + DateTime.Now.ToString() + "] " + reason, false);
                    return true;
                }
                else
                {
                    log("Glide already stopped.");
                    return false;
                }
            }
            catch (Exception ex)
            {
                log("stopGlide(String reason): " + ex.Message);
            }
            return false;
        }
        private bool stopPatrol()
        {
            return stopPatrol(String.Empty);
        }
        private bool stopPatrol(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                log("Stopping Patrol; " + reason);
                if (!isPatrolling)
                {
                    log("Patrol already stopped.");
                    return false;
                }
                DoingNow = Action.NIL;
                btnRunPath.Text = LanguageVars.RUN1;
                DisableMainLoop = false;
                resetKeys();
                killAllThreads();
                return true;
            }
            catch (Exception ex)
            {
                log("stopPatrol(String reason): " + ex.Message);
            }
            return false;
        }
        private bool stopAll()
        {
            return stopAll(String.Empty);
        }
        private bool stopAll(String reason)
        {
            bool b = stopGlide(reason);
            b = (stopPatrol(reason) && b) ? true : false;
            return b;
        }
        #endregion
        #region Starters
        private bool startGlide()
        {
            return startGlide(String.Empty);
        }
        private bool startGlide(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                if (!isGliderUseable) return false;
                log("Starting Glide; " + reason);
                if (!Context.IsGliding)
                {
                    return Context.StartGlide();
                }
                else
                {
                    log("Glide already started.");
                    return false;
                }
            }
            catch (Exception ex)
            {
                log("startGlide(String reason): " + ex.Message);
            }
            return false;
        }
        private bool startPatrol()
        {
            return startPatrol(String.Empty);
        }
        private bool startPatrol(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                if (!isGliderUseable) return false;
                log("Starting Patrol; " + reason);
                if (isPatrolling)
                {
                    log("Patrol already started.");
                    return false;
                }
                if (Context.Me.IsDead)
                {
                    log("Toon is dead >_<");
                    return false;
                }
                if (!pathLoaded)
                {
                    loadPath();
                    if (!pathLoaded)
                    {
                        log("Please Load a path with > 1 point first.");
                        return false;
                    }
                }
                firstPathIndex = true;
                DoingNow = Action.PATROL;
                btnRunPath.Text = LanguageVars.RUN2;
                return true;
            }
            catch (Exception ex)
            {
                log("startPatrol(String reason): " + ex.Message);
            }
            return false;
        }
        private bool startAll()
        {
            return startAll(String.Empty);
        }
        private bool startAll(String reason)
        {
            return (startPatrol(reason) && startGlide(reason));
        }
        #endregion
        private bool isPatrolling
        {
            get
            {
                return (DoingNow != Action.NIL);
            }
        }
        private bool pathLoaded
        {
            get
            {
                return (!object.Equals(null, PatrolPath) && PatrolPath.Count > 1);
            }
        }
        private void loadPath()
        {
            loadPath(null, null);
        }
        private bool contextUseable()
        {
            if (object.Equals(null, Context))
            {
                return false;
            }
            if (object.Equals(null, Context.Me))
            {
                return false;
            }
            if (object.Equals(null, Context.Me.Location))
            {
                return false;
            }
            return true;
        }
        private bool isGliderUseable
        {
            get
            {
                if (contextUseable())
                {
                    return true;
                }
                return false;
            }
        }
        private void killAllThreads()
        {
            try
            {
                log("killing all threads");
                if (!object.Equals(null, gatherThread))
                {
                    if (gatherThread.IsAlive)
                        gatherThread.Abort();
                }
                if (!object.Equals(null, mainLoopThread))
                {
                    if (mainLoopThread.IsAlive)
                    {
                        mainLoopThread.Abort();
                        DisableMainLoop = false;
                    }
                }
                if (!object.Equals(null, onlineDBQueryThread))
                {
                    if (onlineDBQueryThread.IsAlive)
                        onlineDBQueryThread.Abort();
                }
            }
            catch (Exception ex)
            {
                log("killAllThreads(): " + ex.Message);
            }
        }
        private void killTicker()
        {
            try
            {
                log("killing ticker");
                if (!object.Equals(null, Ticker))
                {
                    Ticker.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                    Ticker.Dispose();
                }
            }
            catch (Exception ex)
            {
                log("killTicker(): " + ex.Message);
            }
        }
        #endregion
        #region Internal Helpers
        private void onlineDbInsertEvent(String Event)
        {
            if (!cbUseOnlineDB.Checked) return;
            http.Response resp = new http.Response();
            ArrayList paramSet = new ArrayList();
            Context.Me.Refresh(true);
            paramSet.Add(new string[2] { "worldmap", Context.WorldMap });
            paramSet.Add(new string[2] { "zonetext", Context.ZoneText });
            paramSet.Add(new string[2] { "subzonetext", Context.SubZoneText });
            paramSet.Add(new string[2] { "x", Context.Me.Location.X.ToString() });
            paramSet.Add(new string[2] { "y", Context.Me.Location.Y.ToString() });
            paramSet.Add(new string[2] { "z", Context.Me.Location.Z.ToString() });
            paramSet.Add(new string[2] { "op", "insert_event" });
            paramSet.Add(new string[2] { "event", Event });
            bool success = http.post(ref resp, DBURL, paramSet, null, http.FILE_COMPRESSION_METHODS.NONE, http.ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED, http.REQUEST_METHODS.GET);
            if (success)
                log("onlineDbInsertEvent(" + Event + "): " + resp.ToString());
            else
                log("onlineDbInsertEvent(" + Event + "): FAILED!");
        }
        private int onlineDbQueryEvents(Coordinate Coord, int range, params string[] Events)
        {
            try
            {
                if (!cbUseOnlineDB.Checked) return 0;
                http.Response resp = new http.Response();
                ArrayList paramSet = new ArrayList();
                paramSet.Add(new string[2] { "worldmap", Context.WorldMap });
                paramSet.Add(new string[2] { "zonetext", Context.ZoneText });
                paramSet.Add(new string[2] { "subzonetext", Context.SubZoneText });
                paramSet.Add(new string[2] { "x", Coord.X.ToString() });
                paramSet.Add(new string[2] { "y", Coord.Y.ToString() });
                paramSet.Add(new string[2] { "z", Coord.Z.ToString() });
                paramSet.Add(new string[2] { "op", "query_events" });
                paramSet.Add(new string[2] { "range", range.ToString() });
                foreach (string e in Events)
                {
                    paramSet.Add(new string[2] { "events[]", e });
                }
                bool success = http.post(ref resp, DBURL, paramSet, null, http.FILE_COMPRESSION_METHODS.NONE, http.ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED, http.REQUEST_METHODS.GET);
                if (!success)
                {
                    log("onlineDbQueryEvents: FAILED!");
                    return 0;
                }
                string result = resp.ToString().Trim();
                int resultInt = Int32.Parse(result);
                return resultInt;
            }
            catch (Exception ex)
            {
                log("onlineDbQueryEvents(Coordinate Coord, int range, params string[] Events): " + ex.Message);
                return 0;
            }
        }
        private String getConfigVal(String Key)
        {
            String cv1 = LanguageVars.CLASSNAME + "." + Key;
            String cv11 = Context.GetConfigString(cv1);
            return (object.Equals(null, cv11)) ? String.Empty : cv11;
        }
        private void setConfigVal(String Key, String Value)
        {
            try
            {
                Context.SetConfigValue(LanguageVars.CLASSNAME + "." + Key, Value, true);
            }
            catch (Exception ex)
            {
                log("setConfigVal(String Key, String Value): " + ex.Message);
            }
        }
        private void pause(int HowLongMS)
        {
            clamp(ref HowLongMS, 1, 3600000);//1 hour max ./shrug
            Thread.Sleep(HowLongMS);
        }
        private void pause(int minMS, int maxMS)
        {
            clamp(ref minMS, 1, 3600000);//1 hour max ./shrug
            Thread.Sleep(new System.Random().Next(minMS, maxMS));
        }
        private void clamp(ref int inVal, int min, int max)
        {
            inVal = Math.Min(max, inVal);
            inVal = Math.Max(min, inVal);
        }
        private void log(string what)
        {
            Context.Log("[" + LanguageVars.CLASSNAME + " v" + VERSION + " " + DateTime.Now.ToString() + "] " + what);
        }
        private void playSound()
        {
            try
            {
                if (!soundPlayer.IsLoadCompleted)
                {
                    string sep = Path.DirectorySeparatorChar.ToString();
                    soundPlayer.SoundLocation = Environment.CurrentDirectory + sep + "Key.wav";
                    soundPlayer.Load();
                    soundPlayer.Stop();
                }
                soundPlayer.Play();
            }
            catch (Exception ex)
            {
                log("playSound(): " + ex.Message);
            }
        }
        #endregion
        #region Overrides
        public override void Patrol()
        {
            bool gliderRunning = false;
            while (RunPatrolLoop)
            {
                if (Context.IsGliderRunning && !gliderRunning)
                {
                    gliderRunning = true;
                    OnStartGlide();
                }
                if (!Context.IsGliderRunning && gliderRunning)
                {
                    gliderRunning = false;
                }
                pause(500);
            }
        }
        public override string DisplayName
        {
            get { return LanguageVars.CLASSNAME; }
        }
        public override void OnStartGlide()
        {
            log("OnStartGlide");
            if (!isPatrolling)
            {
                startPatrol("Glide Started");
            }
        }
        public override void OnStopGlide()
        {
            log("OnStopGlide");
            if (isPatrolling)
            {
                stopPatrol("Glide Stopped");
            }
        }
        public override void OnResurrect()
        {
            log("OnResurrect");
        }
        public override bool Rest()
        {
            log("Rest");
            return false;
        }
        public override void ApproachingTarget(GUnit Target)
        {
            log("ApproachingTarget");
        }
        public override void RunningAction()
        {
            log("RunningAction");
        }
        public override void Startup()
        {
            log("Startup");
            initialize();
            base.Startup();
        }
        public override void Shutdown()
        {
            log("Shutdown");
            GUIForm.Close();
            GUIForm.Dispose();
            soundPlayer.Stop();
            killTicker();
            killAllThreads();
            base.Shutdown();
            RunPatrolLoop = false;
        }
        #endregion
    }
    #region External Helpers
    public static class LanguageVars
    {
        public static string USEONLINEDB = "Use Online Database";
        public static string GETTREASURES = "Get Treasures";
        public static string GETHERBS = "Get Herbs";
        public static string GETMINERALS = "Get Minerals";
        public static string GETCLOUDS = "Get Clouds";
        public static string LOOTDELAY = "Loot Delay (ms)";
        public static string NINJA = "Loot Ninjutsu";
        public static string CLASSNAME = "Yoink";
        public static string DEFAULTPATHNAME1 = "somearea";
        public static string RECORD1 = "Record Path";
        public static string RECORD2 = "Stop Recording";
        public static string RECORD3 = "Pause Recording";
        public static string RECORD4 = "Resume Recording";
        public static string RUN1 = "Patrol";
        public static string RUN2 = "Stop Patrolling";
        public static string LOAD1 = "Load Path";
        public static string UNLOAD1 = "UnLoad Path";
        public static string DATAFILEFRIENDLYNAME1 = "Yoink Files";
    }
    public static class MountSpellIds
    {
        public static int[] FlyingMounts
        {
            get
            {
                return new int[] {
                        #region Long List
                        54726, //Winged Steed of the Ebon Blade
		                44744,
                        41517,
                        59567,
                        32290,
                        41518,
                        32242,
                        3363,
                        44151,
                        59568,
                        49193,
                        32243,
                        39798,
                        46197,
                        32292,
                        32296,
                        32235,
                        32239,
                        59569,
                        60021,
                        44317,
                        61442,
                        61444,
                        32246,
                        59976,
                        43927,
                        32297,
                        60024,
                        37015,
                        59570,
                        32295,
                        51960,
                        41513,
                        59650,
                        61451,
                        39800,
                        59961,
                        46199,
                        60025,
                        59571,
                        32240,
                        41514,
                        58615,
                        39801,
                        61229,
                        60002,
                        61309,
                        41515,
                        39802,
                        61230,
                        44153,
                        61294,
                        32245,
                        32289,
                        41516,
                        61446,
                        39803,
                        32244,
                        32345,
                        59996,
                        40192
	#endregion
                    };
            }
        }
        public static int[] GroundMounts
        {
            get
            {
                return new int[] {
                        #region Long List
                        23214, //Charger (Paladin epic mount)
		                581,
                        580,
                        579,
                        578,
                        472,
                        471,
                        470,
                        468,
                        459,
                        458,
                        8980,
                        8395,
                        8394,
                        6899,
                        6898,
                        6897,
                        6896,
                        6777,
                        6654,
                        6653,
                        6648,
                        61470,
                        47037,
                        46628,
                        61469,
                        61467,
                        61465,
                        61447,
                        61425,
                        60424,
                        60140,
                        60136,
                        60119,
                        60118,
                        60116,
                        60114,
                        59811,
                        59810,
                        59804,
                        59802,
                        59799,
                        59797,
                        59793,
                        59791,
                        59788,
                        59785,
                        59573,
                        59572,
                        55531,
                        54753,
                        51412,
                        50870,
                        50869,
                        49379,
                        49378,
                        49322,
                        48954,
                        48027,
                        43900,
                        43899,
                        43810,
                        43688,
                        42781,
                        42777,
                        42776,
                        41252,
                        39319,
                        39318,
                        39317,
                        39316,
                        39315,
                        36702,
                        35714,
                        35713,
                        35712,
                        35711,
                        35710,
                        35028,
                        35027,
                        35025,
                        35022,
                        35020,
                        35018,
                        34899,
                        34898,
                        34897,
                        34896,
                        34795,
                        34790,
                        34407,
                        34406,
                        33660,
                        33630,
                        30174,
                        29059,
                        28828,
                        24252,
                        24242,
                        23510,
                        23509,
                        23338,
                        23252,
                        23251,
                        23250,
                        23249,
                        23248,
                        23247,
                        23246,
                        23243,
                        23242,
                        23241,
                        23240,
                        23239,
                        23238,
                        23229,
                        23228,
                        23227,
                        23225,
                        23223,
                        23222,
                        23221,
                        23220,
                        23219,
                        22724,
                        22723,
                        22722,
                        22721,
                        22720,
                        22719,
                        22718,
                        22717,
                        18992,
                        18991,
                        18990,
                        18989,
                        18363,
                        17481,
                        17465,
                        17464,
                        17463,
                        17462,
                        17461,
                        17460,
                        17459,
                        17458,
                        17456,
                        17455,
                        17454,
                        17453,
                        17450,
                        17229,
                        16084,
                        16083,
                        16082,
                        16081,
                        16080,
                        16060,
                        16059,
                        16058,
                        16056,
                        16055,
                        15781,
                        15780,
                        15779,
                        10969,
                        10873,
                        10799,
                        10798,
                        10796,
                        10795,
                        10793,
                        10789
	#endregion
                    };
            }
        }
    }
    public static class AllowedChars
    {
        public static string String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
    }
    public class Coordinate : ISerializable
    {
        public float X = 0;
        public float Y = 0;
        public float Z = 0;
        public GLocation Location
        {
            get
            {
                return new GLocation(X, Y, Z);
            }
        }
        public Coordinate(float X, float Y, float Z)
        {
            this.X = X;
            this.Y = Y;
            this.Z = Z;
        }
        public Coordinate(GLocation Coords)
        {
            X = Coords.X;
            Y = Coords.Y;
            Z = Coords.Z;
        }
        public Coordinate(SerializationInfo info, StreamingContext ctxt)
        {
            X = (float)info.GetValue("X", typeof(float));
            Y = (float)info.GetValue("Y", typeof(float));
            Z = (float)info.GetValue("Z", typeof(float));
        }
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("X", X);
            info.AddValue("Y", Y);
            info.AddValue("Z", Z);
        }
    }
    public class Coordinates : IEnumerable, ISerializable
    {
        private ArrayList allCoordinates = new ArrayList();
        public Coordinates(SerializationInfo info, StreamingContext ctxt)
        {
            allCoordinates = (ArrayList)info.GetValue("allCoordinates", typeof(ArrayList));
        }
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("allCoordinates", allCoordinates);
        }
        public Coordinate this[int index]
        {
            get
            {
                return (Coordinate)allCoordinates[index];
            }
            set
            {
                allCoordinates[index] = value;
            }
        }
        public Coordinates()
        {
            allCoordinates = new ArrayList();
        }
        public int Add(Coordinate a)
        {
            lock (allCoordinates)
            {
                return allCoordinates.Add(a);
            }
        }
        public void RemoveAt(int i)
        {
            lock (allCoordinates)
            {
                allCoordinates.RemoveAt(i);
            }
        }
        public int Count
        {
            get
            {
                return allCoordinates.Count;
            }
        }
        IEnumerator IEnumerable.GetEnumerator()
        {
            return new MemoryEnumerator(allCoordinates);
        }
        public class MemoryEnumerator : IEnumerator
        {
            private int cursor = -1;
            private ArrayList _Memories = null;
            public MemoryEnumerator(ArrayList Memories)
            {
                _Memories = Memories;
            }
            public bool MoveNext()
            {
                cursor++;
                return (cursor < _Memories.Count);
            }
            public void Reset()
            {
                cursor = -1;
            }
            public object Current
            {
                get
                {
                    try
                    {
                        return _Memories[cursor];
                    }
                    catch (IndexOutOfRangeException)
                    {
                        throw new InvalidOperationException("Index out of bounds.");
                    }
                }
            }
        }
    }
    public struct Node
    {
        public string Word;
        public Action Action;
        public long GUID;
        public Coordinate Coords;
        public string Name;
    }
    public enum PathRunMethod
    {
        BOUNCE,
        CIRCLE
    }
    public enum Action
    {
        NIL,
        AQUIRE,
        COMBAT,
        PATROL,
        MANEUVER,
        RECORD,
        RECORDPAUSE,
        LOAD
    }
    public static class Random
    {
        public static string String(Int32 NumSpaces)
        {
            char[] ac = AllowedChars.String.ToCharArray();
            System.Random Random = new System.Random();
            System.Text.StringBuilder StringBuilder = new StringBuilder(NumSpaces, NumSpaces);
            for (Int32 i = 0; i < NumSpaces; i++)
            {
                StringBuilder.Append(ac[Random.Next(0, ac.Length)]);
            }
            return StringBuilder.ToString();
        }
    }
    internal sealed class http
    {
        public static byte[] FileToByteArray(string file)
        {
            FileInfo fInfo = new FileInfo(file);
            long numBytes = fInfo.Length;
            FileStream fStream = new FileStream(file, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fStream);
            byte[] data = br.ReadBytes((int)numBytes);
            br.Close();
            fStream.Close();
            return data;
        }
        public delegate void httpInfoDelegate(String s);
        public event httpInfoDelegate onInformationMessage;
        private void Info(String s)
        {
            if (!object.Equals(null, onInformationMessage))
            {
                onInformationMessage(s);
            }
        }
        private static DateTime DateCompiled()
        {
            System.Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            DateTime d = new DateTime(
                v.Build * TimeSpan.TicksPerDay +
                v.Revision * TimeSpan.TicksPerSecond * 2
                ).AddYears(1999).AddHours(1);
            return d;
        }
        private static String AssemblyVersion
        {
            get
            {
                return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }
        public string UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1";
        public CookieContainer CookieJar = new CookieContainer();
        private Hashtable getQueryStringParams(string url)
        {
            int queryStringStart = url.IndexOf("?");
            if (queryStringStart == -1) return new Hashtable();
            string queryString = url.Substring(queryStringStart + 1);
            Hashtable h = new Hashtable();
            string[] pairs = queryString.Split('&');
            foreach (string pair in pairs)
            {
                try
                {
                    string[] splitPair = pair.Split('=');
                    if (splitPair[0] == String.Empty || object.Equals(null, splitPair[0])) continue;
                    h[splitPair[0]] = splitPair[1];
                }
                catch
                {
                }
            }
            return h;
        }
        private StreamWriter addVar(StreamWriter sw, string boundary, string varName, string varValue)
        {
            string newLine = "\r\n";
            sw.Write("--" + boundary + newLine);
            sw.Write("Content-Disposition: form-data; name=\"" + varName + "\"");
            sw.Write(newLine);
            sw.Write(newLine);
            sw.Flush();
            sw.Write(varValue);
            sw.Write(newLine);
            sw.Flush();
            return sw;
        }
        private ArrayList normalizePostData(ArrayList Data)
        {
            ArrayList AllParams = new ArrayList();
            Type t_hashTable = typeof(System.Collections.Hashtable);
            Type t_stringArray = typeof(string[]);
            foreach (object o in Data)
            {
                Type t = o.GetType();
                if (t == t_hashTable)
                {
                    Hashtable h = (Hashtable)o;
                    foreach (DictionaryEntry de in h)
                    {
                        AllParams.Add(new string[2] { (string)de.Key, (string)de.Value });
                    }
                }
                if (t == t_stringArray)
                {
                    string[] s = (string[])o;
                    AllParams.Add(new string[2] { s[0], s[1] });
                }
            }
            return AllParams;
        }
        private MemoryStream getPostData(Hashtable files, ArrayList _allParams, string url, string boundary, FILE_COMPRESSION_METHODS CompressionMethod)
        {
            ArrayList allParams = normalizePostData(_allParams);
            MemoryStream postData = new MemoryStream();
            string newLine = "\r\n";
            StreamWriter sw = new StreamWriter(postData);
            if (!object.Equals(null, allParams))
            {
                foreach (string[] param in allParams)
                {
                    string fieldName = param[0];
                    string fieldValue = param[1];
                    if (fieldName == String.Empty || object.Equals(null, fieldName)) continue;
                    sw = addVar(sw, boundary, fieldName, fieldValue);
                }
            }
            Hashtable queryStringParams = getQueryStringParams(url);
            IDictionaryEnumerator en = queryStringParams.GetEnumerator();
            while (en.MoveNext())
            {
                sw = addVar(sw, boundary, en.Key.ToString(), en.Value.ToString());
            }
            if (!object.Equals(null, files))
            {
                foreach (DictionaryEntry de in files)
                {
                    string fieldName = (string)de.Key;
                    string fileName = (string)de.Value;
                    byte[] fileContents = FileToByteArray(fileName);

                    if (fileContents == null) { Info("Upload: couldnt read \"" + fileName + "\""); return null; } //couldnt read the file
                    int uSize = fileContents.Length;
                    string FileNameOnlyName = Path.GetFileName(fileName);

                    sw = addVar(sw, boundary, "md5_" + fieldName, MD5SUM(fileContents));
                    //write the file to the stream
                    sw.Write("--" + boundary + newLine);
                    sw.Write("Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"{2}", fieldName, Path.GetFileName(fileName), newLine);
                    sw.Write("Content-Type: application/octet-stream" + newLine + newLine);
                    sw.Flush();
                    postData.Write(fileContents, 0, fileContents.Length);
                    sw.Write(newLine);

                }
            }
            DateTime _datetime = DateTime.Now;
            string dateTimeNow = _datetime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            string dateTimeNowUTC = _datetime.ToUniversalTime().ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            sw = addVar(sw, boundary, "clientTime", dateTimeNow);
            sw = addVar(sw, boundary, "clientTimeUTC", dateTimeNowUTC);
            sw.Write("--{0}--{1}", boundary, newLine);
            sw.Flush();
            //byte[] b = postData.ToArray();
            //string s = System.Text.Encoding.UTF8.GetString(b);
            return postData;
        }
        private string MD5SUM(byte[] FileOrText) //Output: String<-> Input: Byte[] //
        {
            try
            {
                return BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(FileOrText)).Replace("-", "").ToLower();
            }
            catch
            {
                //DebugLine("MD5SUM: "+e.Message);
                return null; //the addon possibly does not exist
            }
        }
        public enum ENCODING_TYPES
        {
            APP_X_WWW_FORM_URLENCODED,
            MULTI_FORM_DATA
        }
        public enum REQUEST_METHODS
        {
            GET,
            POST
        }
        public enum FILE_COMPRESSION_METHODS
        {
            NONE,
            GZIP
        }
        public CredentialCache CredentialCache = new CredentialCache();
        public int Timeout = 43200000;
        public bool post(ref Response Response, string Url)
        {
            return post(ref Response, Url, null, null, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FILE_COMPRESSION_METHODS.NONE, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters)
        {
            return post(ref Response, Url, Parameters, null, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FILE_COMPRESSION_METHODS.NONE, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FILE_COMPRESSION_METHODS.NONE, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, EncType, ReqMethod, this.Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, EncType, ReqMethod, Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent, string Referer)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, Referer);
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent, string Referer, CookieContainer Cookies)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, Cookies, this.CredentialCache, FileCompressionMethods, Referer);
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent, string Referer, CookieContainer Cookies, CredentialCache CredentialCache)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, Cookies, CredentialCache, FileCompressionMethods, Referer);
        }
        private bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, string UserAgent, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, CookieContainer Cookies, CredentialCache CredentialCache, FILE_COMPRESSION_METHODS FileCompressionMethods, string Referer)
        {

            if (!object.Equals(null, Url)) Info("URL: " + Url);
            if (!object.Equals(null, Files)) Info("Files: " + Files.Count.ToString());
            if (!object.Equals(null, EncType)) Info("Encode Type: " + EncType.ToString());
            if (!object.Equals(null, ReqMethod)) Info("Request Method: " + ReqMethod.ToString());
            if (!object.Equals(null, Referer) && !object.Equals(String.Empty, Referer)) Info("Referer: " + Referer);
            //Info(req.Headers.ToString());
            //Info(s2);

            System.Net.ServicePointManager.Expect100Continue = false;
            //string newLine = "\r\n";

            string boundary = Guid.NewGuid().ToString().Replace("-", "");
            MemoryStream postData = new MemoryStream();
            string urlEncoded = "";

            switch (EncType)
            {
                case ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED:
                    urlEncoded = Url + "?" + getPostDataUrlEncoded(Parameters, Url, boundary);
                    break;
                case ENCODING_TYPES.MULTI_FORM_DATA:
                    postData = getPostData(Files, Parameters, Url, boundary, FileCompressionMethods);
                    break;
            }


            if (EncType == ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED)
            {
                Url = urlEncoded;
            }

            HttpWebRequest req = (new MyWebRequest().GetWebRequest2(new System.Uri(Url)) as HttpWebRequest);
            switch (EncType)
            {
                case ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED:
                    req.ContentType = "application/x-www-form-urlencoded;";
                    break;
                case ENCODING_TYPES.MULTI_FORM_DATA:
                    req.ContentType = "multipart/form-data; boundary=" + boundary;
                    break;
            }
            switch (ReqMethod)
            {
                case REQUEST_METHODS.GET:
                    req.Method = "GET";
                    break;
                case REQUEST_METHODS.POST:
                    req.Method = "POST";
                    break;
            }
            if (!object.Equals(null, Referer))
            {
                req.Referer = Referer;
            }
            req.UnsafeAuthenticatedConnectionSharing = true;
            req.CookieContainer = Cookies;

            if (!object.Equals(null, Cookies))
            {
                req.CookieContainer = Cookies;
            }
            if (!object.Equals(null, CredentialCache))
            {
                req.Credentials = CredentialCache;
            }
            req.UserAgent = UserAgent;
            req.AllowWriteStreamBuffering = false;
            req.Accept = "application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
            req.ContentLength = postData.Length;
            req.Timeout = Timeout;
            if (ReqMethod == REQUEST_METHODS.POST)
            {
                Stream oRequestStream = req.GetRequestStream();
                postData.Seek(0, SeekOrigin.Begin);

                int bytesSent = 0;
                int totalBytesSent = 0;
                int totalOutBytes = (int)postData.Length;
                byte[] buffer = new Byte[checked((uint)Math.Min(4096, (int)postData.Length))];
                while ((bytesSent = postData.Read(buffer, 0, buffer.Length)) != 0)
                {
                    oRequestStream.Write(buffer, 0, bytesSent);
                    totalBytesSent += bytesSent;
                    fireSendProgressEvent(totalBytesSent, (int)postData.Length);
                }
                oRequestStream.Close();
            }
            Info("Request Sent.  ( " + postData.Length.ToString("N0") + " Bytes )");

            HttpWebResponse lHttpWebResponse;
            Stream lHttpWebResponseStream;
            byte[] byteBuffer = new byte[1024];
            int bytesRead;
            try
            {
                lHttpWebResponse = (HttpWebResponse)req.GetResponse();

                Response.CharacterSet = lHttpWebResponse.CharacterSet;
                Response.ContentEncoding = lHttpWebResponse.ContentEncoding;
                Response.ContentType = lHttpWebResponse.ContentType;
                Response.Cookies = lHttpWebResponse.Cookies;
                Response.Headers = lHttpWebResponse.Headers;
                Response.IsFromCache = lHttpWebResponse.IsFromCache;
                Response.IsMutuallyAuthenticated = lHttpWebResponse.IsMutuallyAuthenticated;
                Response.LastModified = lHttpWebResponse.LastModified;
                Response.Method = lHttpWebResponse.Method;
                Response.ProtocolVersion = lHttpWebResponse.ProtocolVersion;
                Response.ResponseUri = lHttpWebResponse.ResponseUri;
                Response.Server = lHttpWebResponse.Server;
                Response.StatusCode = lHttpWebResponse.StatusCode;
                Response.StatusDescription = lHttpWebResponse.StatusDescription;

                lHttpWebResponseStream = req.GetResponse().GetResponseStream();
                Int32 ContentLength = Convert.ToInt32(lHttpWebResponse.ContentLength);
                int progress = 0;
                Response.Content = new MemoryStream();
                do
                {
                    bytesRead = lHttpWebResponseStream.Read(byteBuffer, 0, 1024);
                    Response.Content.Write(byteBuffer, 0, bytesRead);
                    progress += bytesRead;

                    if (progress <= ContentLength)
                    {
                        fireReceiveProgressEvent(progress, ContentLength);
                    }
                    else
                    {
                        fireReceiveProgressEvent(ContentLength, ContentLength);
                    }
                } while (bytesRead > 0);
                lHttpWebResponseStream.Close();
                postData.Close();
                lHttpWebResponse.Close();
                Info("Response Received.  ( " + ContentLength.ToString("N0") + " Bytes )");
                return true;
            }
            catch (Exception e)
            {
                Info(e.Message);
                return false;
            }

        }
        public class Response
        {
            public MemoryStream Content;
            public string CharacterSet;
            public string ContentType;
            public string ContentEncoding;
            public CookieCollection Cookies;
            public long ContentLength
            {
                get
                {
                    if (!object.Equals(null, Content))
                        return Content.Length;
                    else return -1;
                }
            }
            public WebHeaderCollection Headers;
            public bool IsFromCache;
            public bool IsMutuallyAuthenticated;
            public DateTime LastModified;
            public string Method;
            public Version ProtocolVersion;
            public Uri ResponseUri;
            public string Server;
            public HttpStatusCode StatusCode;
            public string StatusDescription;
            public override string ToString()
            {
                if (!object.Equals(null, Content))
                    return System.Text.Encoding.UTF8.GetString(Content.ToArray());
                else return "";
            }
        }
        private string getPostDataUrlEncoded(ArrayList allParams, string url, string boundary)
        {
            string postData = "";
            bool first = true;
            if (!object.Equals(null, allParams))
            {
                foreach (string[] param in allParams)
                {

                    string fieldName = param[0];
                    if (fieldName == String.Empty) continue;
                    if (fieldName == String.Empty || object.Equals(null, fieldName)) continue;
                    string fieldValue = param[1];
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        postData += "&";
                    }
                    postData += fieldName + "=" + fieldValue;
                }
            }
            Hashtable queryStringParams = getQueryStringParams(url);
            IDictionaryEnumerator en = queryStringParams.GetEnumerator();
            while (en.MoveNext())
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    postData += "&";
                }
                postData += en.Key + "=" + en.Value;
            }
            DateTime _datetime = DateTime.Now;
            string dateTimeNow = _datetime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            string dateTimeNowUTC = _datetime.ToUniversalTime().ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            if (first)
            {
                first = false;
            }
            else
            {
                postData += "&";
            }
            postData += "clientTime=" + dateTimeNow;
            if (first)
            {
                first = false;
            }
            else
            {
                postData += "&";
            }
            postData += "clientTimeUTC=" + dateTimeNowUTC;
            return postData;
        }
        public delegate void ReceiveProgressDelegate(int CurrentPosition, int TotalSize);
        public event ReceiveProgressDelegate onReceiveProgress;
        private void fireReceiveProgressEvent(int CurrentPosition, int TotalSize)
        {
            if (!object.Equals(null, onReceiveProgress))
            {
                onReceiveProgress(CurrentPosition, TotalSize);
            }
        }
        public delegate void SendProgressDelegate(int CurrentPosition, int TotalSize);
        public event SendProgressDelegate onSendProgress;
        private void fireSendProgressEvent(int CurrentPosition, int TotalSize)
        {
            if (!object.Equals(null, onSendProgress))
            {
                onSendProgress(CurrentPosition, TotalSize);
            }
        }
    }
    internal class AcceptAllCertificatePolicy : ICertificatePolicy
    {
        public AcceptAllCertificatePolicy()
        {
        }
        public bool CheckValidationResult(ServicePoint sPoint,
           System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Net.WebRequest wRequest, int certProb)
        {
            // Always accept
            return true;
        }
    }
    internal class MyWebRequest : System.Net.WebClient
    {
        protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);
            webRequest.KeepAlive = false;
            return webRequest;
        }
        public System.Net.WebRequest GetWebRequest2(Uri uri)
        {
            return GetWebRequest(uri);
        }
    }
    #endregion
}
Viel Spass mit Yoink.

Achso weil Du ja oft Probleme mit Codes hast haenge ich Dir das ganze noch als Datei an. Haette gern mein Beitrag vorher editiert, aber beim Edit fehlt der Datei hinzufuegen Button.

Also pack die Datei einfach in Deinen Classes Ordner und waehle Yoink aus im Glider. Dann sollte das Fenster aufgehen und alles wunderbar laufen, habe es bei mir getestet. Wenn Du mal Lust hast kannst ja meinen Code hier mit Deinem vergleichen, dann findest vielleicht den Fehler und weisst es beim naechsten mal und einer anderen Class besser.

@Hankey ich hab den Startpost mal geaendert, denn bei mir ist das Mount auch an anderer Stelle. Das es allerdings garnicht an 1-1 bei Dir laeuft wundert mich jetzt doch. Vielleicht ist dort eine andere Taste zugewiesen gewesen? Also bei mir gehts einfach da wo ich Platz habe und das Mount zuweise.
Angehängte Dateien
Dateityp: cs Yoink.cs (122,6 KB, 7x aufgerufen)

Geändert von Thori (08.03.2009 um 12:16 Uhr)
Mit Zitat antworten
 
Alt 08.03.2009
Registriert seit: Dec 2007
Beiträge: 87
 
Schlachtrufer

Offline
Okay danke, aber das ist leider für Paladin^^, naja ich schaus mir mal an, viel kämpfen soll der ja sowieso nicht

Ich habe meine Yoink.cs eben auch mal angehängt, aber jetzt öffnet sich zumindest schonmal ein neues fenster :>

Geändert von Kenny1547 (08.03.2009 um 09:15 Uhr)
Mit Zitat antworten
 
Alt 08.03.2009
Registriert seit: Jun 2008
Beiträge: 10
 

Offline
Sehr gute anleitung, habe nach ca 6 min alles fertig gehabt und konnte sofort losfliegen. Danke dir
Mit Zitat antworten
 
Alt 08.03.2009
Beiträge: n/a
 
Guest

Zitat:
Zitat von Kenny1547 Beitrag anzeigen
Okay danke, aber das ist leider für Paladin^^, naja ich schaus mir mal an, viel kämpfen soll der ja sowieso nicht

Ich habe meine Yoink.cs eben auch mal angehängt, aber jetzt öffnet sich zumindest schonmal ein neues fenster :>
Ups sorry hast recht, hab mich im Ordner vertan!

Ich editier den Beitrag und mach den Krieger Code rein.
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Mr. Hankey
Registriert seit: Jan 2008
Beiträge: 1.103
 
Member

Offline
Zitat:
Zitat von Thori Beitrag anzeigen
@Hankey ich hab den Startpost mal geaendert, denn bei mir ist das Mount auch an anderer Stelle. Das es allerdings garnicht an 1-1 bei Dir laeuft wundert mich jetzt doch. Vielleicht ist dort eine andere Taste zugewiesen gewesen? Also bei mir gehts einfach da wo ich Platz habe und das Mount zuweise.
Auf 1-1 würde es bestimmt laufen, hab es aber auf Standard gelassen, daher hat er Automatisch auf 3-1 gegriffen. Schätze halt mal, dass das bei den meisten so sein wird..

Und wennst schon am Editieren bist, ich glaub du hast ne veraltete Version genommen^^..
Bei deinem Code stand oben

// Yoink.cs - Flying Mount Node Patrol
//
// Version: 0.4.0


Dachte das wäre vielleicht erwähnens wert..
«Erwarte nicht das andere mehr Zeit in die Antwort, als du in deine Frage investieren!»

Mit Zitat antworten
 
Alt 08.03.2009
Beiträge: n/a
 
Guest

Zitat:
Zitat von Mr. Hankey Beitrag anzeigen
Auf 1-1 würde es bestimmt laufen, hab es aber auf Standard gelassen, daher hat er Automatisch auf 3-1 gegriffen. Schätze halt mal, dass das bei den meisten so sein wird..

Und wennst schon am Editieren bist, ich glaub du hast ne veraltete Version genommen^^..
Bei deinem Code stand oben

// Yoink.cs - Flying Mount Node Patrol
//
// Version: 0.4.0


Dachte das wäre vielleicht erwähnens wert..
Ja die läuft aber genauso gut bei mir, keine Fehler und nix. Ich bin nicht so der ewig updatende, eher der DtarS Typ.

Also Dont touch a runnig System.
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Zelina
Registriert seit: Feb 2009
Beiträge: 20
 
Späher

Offline
ok bei mir funktionier soweit alles außer das er sich nicht wehrt wenn er angegriffen wird !
Was muss ich einstellen oder ändern ?
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Gliderboy2
Registriert seit: Apr 2008
Beiträge: 40
 
Grunzer

Offline
Kann man des auch im sholazar becken nutzen???? weil da ja recht viele berge sowie bäume sind, nicht dass er dann da probs bekommt, und wie sieht des aus mit der flughöhe und epic fl mount, ich habe eins mit 310%, da verliert man son vorkommen mal schnell ausm auge weil man zu schnell drüber ist und es zb auf der minimap gar net kommt....
Need meinen Gliderboy zurück...
Mit Zitat antworten
 
Alt 08.03.2009
Registriert seit: Jun 2008
Beiträge: 88
 
Schlachtrufer

Offline
ich verstehe nicht ganz was man alles in den Classes Ordner packen muss... nur die editierte Yoink.cs Datei?
Mit Zitat antworten
 
Alt 08.03.2009
Beiträge: n/a
 
Guest

Zitat:
Zitat von derdikkebaer Beitrag anzeigen
ich verstehe nicht ganz was man alles in den Classes Ordner packen muss... nur die editierte Yoink.cs Datei?
Genau, nur die.

@Gliderboy dann musst Du die Strecke sehr gut abfliegen und Baeumen aus dem weg gehen, mit Bergen gibt es kaum Probleme, nur Hoehlen Wasser und Baeume sind schlecht.

@Zelina Du musst die Standard Class so reineditieren wie es am Anfang beschrieben ist, dann kaempft er auch gegen angreifende Mobs.
Mit Zitat antworten
 
Alt 08.03.2009
Registriert seit: Jun 2008
Beiträge: 88
 
Schlachtrufer

Offline
hat jmd sowas für Hunter?bzw. mit welcher Class macht ihr das mitm Hunter?
Mit Zitat antworten
 
Alt 08.03.2009
Beiträge: n/a
 
Guest

Zitat:
Zitat von derdikkebaer Beitrag anzeigen
hat jmd sowas für Hunter?bzw. mit welcher Class macht ihr das mitm Hunter?
Hast Du Dir auch nur im Ansatz mal den Startpost durchgelesen? Ich kanns echt nicht glauben was Du hier fragst.
Mit Zitat antworten
 
Alt 08.03.2009
Registriert seit: Jun 2008
Beiträge: 88
 
Schlachtrufer

Offline
oh lol ok, habe Default anscheinend überlesen sry
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Zelina
Registriert seit: Feb 2009
Beiträge: 20
 
Späher

Offline
So sieht das jetzt bei mir aus.

Yoink.cs
Code:
namespace Glider.Common.Objects.YoinkSpace
{
    public class Yoink :
        //////////////////////////////////////////////
        ////change this to your Combat Class
        Glider.Common.Objects.Priest
    //////////////////////////////////////////////
    {
        #region Initialization
        private void initialize()
        {
Code:
#region Combat Class
//I R USELESS COMMENT LINE < REPLACE ME WITH COMBAT CLASS
using System;
using System.Threading;
using Glider.Common.Objects;

namespace Glider.Common.Objects
{
    public class Priest : GGameClass
    {
        const double MIN_FLAY_DISTANCE = 10.0;

        #region Priest properties/config
        GSpellTimer Fortitude = new GSpellTimer(27 * 60 * 1000, false);         // Assume it's not totally fresh each time.
        GSpellTimer InnerFire = new GSpellTimer(5 * 60 * 1000, true);          // Five minutes if we don't find the id...
        int InnerFireBuffID = 0;
        GSpellTimer Mindblast;  // Duration set by config.
        GSpellTimer Pain;       // Duration set by config.
        GSpellTimer Shield;     // Duration set by config.
        GSpellTimer Renew = new GSpellTimer(15 * 1000);
        GSpellTimer FlashHeal = new GSpellTimer(10 * 1000);   // Avoid loop of spamming flash heal.
        GSpellTimer Fade = new GSpellTimer(30 * 1000);

        bool ShouldFlay;
        bool FlayRunners;
        bool ShouldWand;
        bool PreShield;
        bool AlwaysShield;
        bool SkipFlayRange;
        bool UseShadowform;
        bool UseVampiric;
        bool ExtraFlay;

        #endregion
#endregion

namespace Glider.Common.Objects.YoinkSpace
{
ist da etwas falsch ? Wenn ja was bitte ^^
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Gliderboy2
Registriert seit: Apr 2008
Beiträge: 40
 
Grunzer

Offline
schonal die "using bla bla " löschen....
Need meinen Gliderboy zurück...
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Gliderboy2
Registriert seit: Apr 2008
Beiträge: 40
 
Grunzer

Offline
Problem:

yoink speichert des profil net ab, Folgende meldung:
\Profiles\Herbs.yoink" konnte nicht gefunden werden.
Need meinen Gliderboy zurück...
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von oHa510
Registriert seit: Feb 2008
Beiträge: 48
 
Grunzer

Offline
Zitat:
Zitat von Gliderboy2 Beitrag anzeigen
Problem:

yoink speichert des profil net ab, Folgende meldung:
\Profiles\Herbs.yoink" konnte nicht gefunden werden.
em? record path name eingeben und dann beim laden natürlich dort den selben namen benutzen..

ist doch alles selbsterklärend -.-

ansonsten mal gucken ob du überhaupt den \Profiles\ ordner im glider ordner hast
Mit Zitat antworten
 
Alt 08.03.2009
Beiträge: n/a
 
Guest

Zitat:
Zitat von Gliderboy2 Beitrag anzeigen
Problem:

yoink speichert des profil net ab, Folgende meldung:
\Profiles\Herbs.yoink" konnte nicht gefunden werden.
Doch der speichert, allerdings ist der Standard Name somerea. Wenn Du den beim Abspeichern nicht geändert hast, findet er jetzt keinen unter dem Namen Herbs.

Geändert von Thori (08.03.2009 um 17:26 Uhr)
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Zelina
Registriert seit: Feb 2009
Beiträge: 20
 
Späher

Offline
also das ist jetzt meine Yoink.cs
Ich weiß nicht was ich ändern soll, bitte hilfe

Code:
// Yoink.cs - Flying Mount Node Patrol
//
// Version: 0.4.8 Final
//
//////////////////////////////////////////////////////////////////////////
//
// IMPORTANT!  
// 1. paste your NON PATROL OVERRIDING "combat class" where the useless comment is
// 2. copy the namespace and class name from the combat class and replace the line below with it
// 3. A using line looks like 'using blah.blah.blah;'  merge the using lines from your combat class, and the yoink class.
// 4. put your flying mount on casting bar 3, slot 1
// 5. put your cloud sucker on casting bar 3, slot 2
//
// For more information on Yoink
//
//          http://vforums.mmoglider.com/showthread.php?t=196008
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Media;
using System.Net;
using System.Runtime.Serialization;
using System.Security.Cryptography;
using System.Text;
using System.Threading;

//!Class: Glider.Common.Objects.YoinkSpace.Yoink

//////////////////////////////////////////////
////paste your Combat Class below, between the region markers
//////////////////////////////////////////////
#region Combat Class
//I R USELESS COMMENT LINE < REPLACE ME WITH COMBAT CLASS
using System;
using System.Threading;
using Glider.Common.Objects;

namespace Glider.Common.Objects
{
    public class Priest : GGameClass
    {
        const double MIN_FLAY_DISTANCE = 10.0;

        #region Priest properties/config
        GSpellTimer Fortitude = new GSpellTimer(27 * 60 * 1000, false);         // Assume it's not totally fresh each time.
        GSpellTimer InnerFire = new GSpellTimer(5 * 60 * 1000, true);          // Five minutes if we don't find the id...
        int InnerFireBuffID = 0;
        GSpellTimer Mindblast;  // Duration set by config.
        GSpellTimer Pain;       // Duration set by config.
        GSpellTimer Shield;     // Duration set by config.
        GSpellTimer Renew = new GSpellTimer(15 * 1000);
        GSpellTimer FlashHeal = new GSpellTimer(10 * 1000);   // Avoid loop of spamming flash heal.
        GSpellTimer Fade = new GSpellTimer(30 * 1000);

        bool ShouldFlay;
        bool FlayRunners;
        bool ShouldWand;
        bool PreShield;
        bool AlwaysShield;
        bool SkipFlayRange;
        bool UseShadowform;
        bool UseVampiric;
        bool ExtraFlay;

        #endregion
#endregion

namespace Glider.Common.Objects.YoinkSpace
{
    public class Yoink :
        //////////////////////////////////////////////
        ////change this to your Combat Class
        Glider.Common.Objects.Priest
    //////////////////////////////////////////////
    {
        #region Initialization
        private void initialize()
        {
            log("initialize");
            tickRate = 1000;
            Ticker = new System.Threading.Timer(new System.Threading.TimerCallback(Tick), null, tickRate, tickRate);
            Ticker.Change(0, tickRate);
            RunMethod = PathRunMethod.BOUNCE;
            soundPlayer = new SoundPlayer();
            http = new http();
            http.UserAgent = LanguageVars.CLASSNAME + "/" + VERSION;
            nodeBlackList = new List<long>();
            lootBlackList = new List<long>();
            tempBlackList = new List<TempBlackListItem>();
            chatLogBuffer = new List<String>();
            Context.SetKeyValue(LanguageVars.CLASSNAME + ".Mount", GBarState.Indifferent, GContext.SS_NONE, 49);
            Context.SetKeyValue(LanguageVars.CLASSNAME + ".Extractor", GBarState.Indifferent, GContext.SS_NONE, 50);
            Context.SetKeyValue(LanguageVars.CLASSNAME + ".BAR3", GBarState.Indifferent, GContext.SS_SHIFT, 51);
            InitializeGUI();
            isSubLoopRunning = false;
            GContext.Main.ChatLog += new GContext.GChatLogHandler(Main_ChatLog);
        }
        private bool RunPatrolLoop = true;
        private bool isSubLoopRunning = true;
        private bool pathDirection = true;
        private int currentPathIndex = 0;
        private int _tickRate = -1;
        private int tickRate
        {
            get
            {
                return _tickRate;
            }
            set
            {
                _tickRate = value;
                if (!Object.Equals(null, Ticker))
                {
                    Ticker.Change(0, value);
                }
            }
        }
        private const string VERSION = "0.4.8 Final";
        private const string DBURL = "*****************";
        private const float NODEAQUIREDISTXLOW = -4;
        private const float NODEAQUIREDISTXHIGH = 4;
        private const float NODEAQUIREDISTYLOW = -4;
        private const float NODEAQUIREDISTYHIGH = 4;
        private const float NODEAQUIREDISTZLOW = -10;
        private const float NODEAQUIREDISTZHIGH = 10;
        private Timer Ticker = null;
        private Thread thread_aquire = null;
        private Thread thread_combat = null;
        private Thread thread_mainloop = null;
        private Thread thread_database = null;
        private Thread thread_loot = null;
        private Coordinates PatrolPath = null;
        private List<TempBlackListItem> tempBlackList = null;
        private List<long> nodeBlackList = null;
        private List<long> lootBlackList = null;
        private List<String> chatLogBuffer = null;
        private SoundPlayer soundPlayer = null;
        private Action DoingNow = Action.NIL;
        private DateTime timeLastAquired;
        private PathRunMethod RunMethod;
        private GObject CurrentTargetNode;
        private GObject CurrentTargetLoot;
        private http http = null;
        #region GUI Initialization
        private System.Windows.Forms.Button btnRecNewPath;
        private System.Windows.Forms.Button btnLoadPath;
        private System.Windows.Forms.Button btnRunPath;
        private System.Windows.Forms.Button btnPauseRec;
        private System.Windows.Forms.Button btnUnloadPath;
        private System.Windows.Forms.TextBox txbLoadFileName;
        private System.Windows.Forms.TextBox txbSaveFileName;
        private System.Windows.Forms.TableLayoutPanel tlpMain;
        private System.Windows.Forms.Form GUIForm;
        private System.Windows.Forms.Label lblYoink;
        private System.Windows.Forms.ComboBox cbbPathMode;
        private System.Windows.Forms.CheckBox cbNinja;
        private System.Windows.Forms.Label lblLootDelay;
        private System.Windows.Forms.NumericUpDown nudLootDelay;
        private System.Windows.Forms.CheckBox cbGetHerbs;
        private System.Windows.Forms.CheckBox cbGetMinerals;
        private System.Windows.Forms.CheckBox cbGetClouds;
        private System.Windows.Forms.CheckBox cbGetTreasures;
        private System.Windows.Forms.CheckBox cbUseOnlineDB;
        private System.Windows.Forms.NumericUpDown nudRecFreq;
        private System.Windows.Forms.Label lblNudRecFreq;
        private System.Windows.Forms.Label lblPathPatMode;
        private System.Windows.Forms.Label lblPathRecName;
        private System.Windows.Forms.Label lblPathPatName;
        private System.Windows.Forms.CheckBox cbSkin;
        private void InitializeGUI()
        {
            #region Init
            lblPathPatName = new System.Windows.Forms.Label();
            lblPathRecName = new System.Windows.Forms.Label();
            btnRecNewPath = new System.Windows.Forms.Button();
            btnLoadPath = new System.Windows.Forms.Button();
            btnRunPath = new System.Windows.Forms.Button();
            btnUnloadPath = new System.Windows.Forms.Button();
            tlpMain = new System.Windows.Forms.TableLayoutPanel();
            lblYoink = new System.Windows.Forms.Label();
            txbLoadFileName = new System.Windows.Forms.TextBox();
            txbSaveFileName = new System.Windows.Forms.TextBox();
            btnPauseRec = new System.Windows.Forms.Button();
            cbbPathMode = new System.Windows.Forms.ComboBox();
            cbNinja = new System.Windows.Forms.CheckBox();
            lblLootDelay = new System.Windows.Forms.Label();
            nudLootDelay = new System.Windows.Forms.NumericUpDown();
            cbGetHerbs = new System.Windows.Forms.CheckBox();
            cbGetMinerals = new System.Windows.Forms.CheckBox();
            cbGetClouds = new System.Windows.Forms.CheckBox();
            cbGetTreasures = new System.Windows.Forms.CheckBox();
            cbUseOnlineDB = new System.Windows.Forms.CheckBox();
            nudRecFreq = new System.Windows.Forms.NumericUpDown();
            lblNudRecFreq = new System.Windows.Forms.Label();
            lblPathPatMode = new System.Windows.Forms.Label();
            cbSkin = new System.Windows.Forms.CheckBox();
            #endregion
            #region Text
            lblLootDelay.Text = LanguageVars.LOOTDELAY;
            cbGetClouds.Text = LanguageVars.GETCLOUDS;
            cbGetHerbs.Text = LanguageVars.GETHERBS;
            cbGetMinerals.Text = LanguageVars.GETMINERALS;
            btnLoadPath.Text = LanguageVars.LOAD1;
            btnUnloadPath.Text = LanguageVars.UNLOAD1;
            btnRecNewPath.Text = LanguageVars.RECORD1;
            btnPauseRec.Text = LanguageVars.RECORD3;
            btnRunPath.Text = LanguageVars.RUN1;
            lblYoink.Text = LanguageVars.CLASSNAME + " v" + VERSION;
            cbNinja.Text = LanguageVars.NINJA;
            cbGetTreasures.Text = LanguageVars.GETTREASURES;
            cbUseOnlineDB.Text = LanguageVars.USEONLINEDB;
            lblNudRecFreq.Text = LanguageVars.RECORDFREQ;
            lblPathPatMode.Text = LanguageVars.PATHPATMODE;
            lblPathPatName.Text = LanguageVars.PATPATHNAME;
            lblPathRecName.Text = LanguageVars.RECPATHNAME;
            cbSkin.Text = LanguageVars.SKIN;
            #endregion
            #region Other
            nudLootDelay.Minimum = 0;
            nudLootDelay.Maximum = 10000;
            cbbPathMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            cbbPathMode.Items.Add("BOUNCE");
            cbbPathMode.Items.Add("CIRCLE");
            nudRecFreq.Minimum = 100;
            nudRecFreq.Maximum = 10000;
            cbUseOnlineDB.Enabled = false;
            cbUseOnlineDB.Checked = false;
            #endregion
            #region DockStyle
            cbNinja.Dock = System.Windows.Forms.DockStyle.Fill;
            lblYoink.Dock = System.Windows.Forms.DockStyle.Fill;
            txbLoadFileName.Dock = System.Windows.Forms.DockStyle.Fill;
            btnLoadPath.Dock = System.Windows.Forms.DockStyle.Fill;
            btnUnloadPath.Dock = System.Windows.Forms.DockStyle.Fill;
            txbSaveFileName.Dock = System.Windows.Forms.DockStyle.Fill;
            btnRecNewPath.Dock = System.Windows.Forms.DockStyle.Fill;
            btnPauseRec.Dock = System.Windows.Forms.DockStyle.Fill;
            btnRunPath.Dock = System.Windows.Forms.DockStyle.Fill;
            cbbPathMode.Dock = System.Windows.Forms.DockStyle.Fill;
            lblLootDelay.Dock = System.Windows.Forms.DockStyle.Fill;
            nudLootDelay.Dock = System.Windows.Forms.DockStyle.Fill;
            cbGetHerbs.Dock = System.Windows.Forms.DockStyle.Fill;
            cbGetMinerals.Dock = System.Windows.Forms.DockStyle.Fill;
            cbGetClouds.Dock = System.Windows.Forms.DockStyle.Fill;
            cbGetTreasures.Dock = System.Windows.Forms.DockStyle.Fill;
            cbUseOnlineDB.Dock = System.Windows.Forms.DockStyle.Fill;
            nudRecFreq.Dock = System.Windows.Forms.DockStyle.Fill;
            lblNudRecFreq.Dock = System.Windows.Forms.DockStyle.Fill;
            lblPathPatMode.Dock = System.Windows.Forms.DockStyle.Fill;
            lblPathPatName.Dock = System.Windows.Forms.DockStyle.Fill;
            lblPathRecName.Dock = System.Windows.Forms.DockStyle.Fill;
            cbSkin.Dock = System.Windows.Forms.DockStyle.Fill;
            #endregion
            #region Table Layout Panel
            tlpMain.AutoSize = true;
            tlpMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly;
            tlpMain.ColumnCount = 1;
            tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpMain.RowCount = 2;
            tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpMain.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tlpMain.Width = 200;
            tlpMain.Controls.Add(lblYoink);
            tlpMain.Controls.Add(lblPathPatName);
            tlpMain.Controls.Add(txbLoadFileName);
            tlpMain.Controls.Add(btnLoadPath);
            tlpMain.Controls.Add(btnUnloadPath);
            tlpMain.Controls.Add(lblPathRecName);
            tlpMain.Controls.Add(txbSaveFileName);
            tlpMain.Controls.Add(lblPathPatMode);
            tlpMain.Controls.Add(cbbPathMode);
            tlpMain.Controls.Add(lblNudRecFreq);
            tlpMain.Controls.Add(nudRecFreq);
            tlpMain.Controls.Add(btnRecNewPath);
            tlpMain.Controls.Add(btnPauseRec);
            tlpMain.Controls.Add(cbGetHerbs);
            tlpMain.Controls.Add(cbGetMinerals);
            tlpMain.Controls.Add(cbGetClouds);
            tlpMain.Controls.Add(cbGetTreasures);
            tlpMain.Controls.Add(cbSkin);
            tlpMain.Controls.Add(cbNinja);
            tlpMain.Controls.Add(lblLootDelay);
            tlpMain.Controls.Add(nudLootDelay);
            tlpMain.Controls.Add(cbUseOnlineDB);
            tlpMain.Controls.Add(btnRunPath);
            #endregion
            #region Form
            GUIForm = new System.Windows.Forms.Form();
            GUIForm.Hide();
            GUIForm.SuspendLayout();
            GUIForm.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            GUIForm.AutoSize = true;
            GUIForm.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
            GUIForm.ShowIcon = false;
            GUIForm.Controls.Add(tlpMain);
            GUIForm.Name = YoinkSpace.Random.String(8);
            GUIForm.Text = YoinkSpace.Random.String(8);
            GUIForm.ResumeLayout(false);
            #endregion
            #region Config
            txbLoadFileName.Text = (getConfigVal("txbLoadFileName") == String.Empty) ? LanguageVars.DEFAULTPATHNAME1 : getConfigVal("txbLoadFileName");
            txbSaveFileName.Text = (getConfigVal("txbSaveFileName") == String.Empty) ? LanguageVars.DEFAULTPATHNAME1 : getConfigVal("txbSaveFileName");
            cbbPathMode.SelectedItem = (getConfigVal("cbbPathMode") == String.Empty) ? "BOUNCE" : getConfigVal("cbbPathMode");
            cbGetHerbs.Checked = (getConfigVal("cbGetHerbs") == String.Empty) ? true : Boolean.Parse(getConfigVal("cbGetHerbs"));
            cbGetMinerals.Checked = (getConfigVal("cbGetMinerals") == String.Empty) ? true : Boolean.Parse(getConfigVal("cbGetMinerals"));
            cbGetClouds.Checked = (getConfigVal("cbGetClouds") == String.Empty) ? false : Boolean.Parse(getConfigVal("cbGetClouds"));
            cbNinja.Checked = (getConfigVal("cbNinja") == String.Empty) ? false : Boolean.Parse(getConfigVal("cbNinja"));
            nudLootDelay.Value = (getConfigVal("nudLootDelay") == String.Empty) ? 1000 : Decimal.Parse(getConfigVal("nudLootDelay"));
            cbGetTreasures.Checked = (getConfigVal("cbGetTreasures") == String.Empty) ? false : Boolean.Parse(getConfigVal("cbGetTreasures"));
            //cbUseOnlineDB.Checked = (getConfigVal("cbUseOnlineDB") == String.Empty) ? true : Boolean.Parse(getConfigVal("cbUseOnlineDB"));
            nudRecFreq.Value = (getConfigVal("nudRecFreq") == String.Empty) ? 1000 : Decimal.Parse(getConfigVal("nudRecFreq"));
            cbSkin.Checked = (getConfigVal("cbSkin") == String.Empty) ? false : Boolean.Parse(getConfigVal("cbSkin"));
            #endregion
            #region Events
            txbLoadFileName.TextChanged += new EventHandler(txbLoadFileName_TextChanged);
            txbSaveFileName.TextChanged += new EventHandler(txbSaveFileName_TextChanged);
            btnRecNewPath.Click += new EventHandler(btnRecNewPath_Click);
            btnLoadPath.Click += new EventHandler(loadPath);
            btnRunPath.Click += new EventHandler(btnRunPath_Click);
            btnPauseRec.Click += new EventHandler(btnPauseRec_Click);
            btnUnloadPath.Click += new EventHandler(btnUnloadPath_Click);
            GUIForm.FormClosing += new System.Windows.Forms.FormClosingEventHandler(GUIForm_FormClosing);
            cbbPathMode.SelectedValueChanged += new EventHandler(cbbPathMode_SelectedValueChanged);
            cbNinja.CheckedChanged += new EventHandler(cbNinja_CheckedChanged);
            nudLootDelay.ValueChanged += new EventHandler(nudLootDelay_ValueChanged);
            cbGetClouds.CheckedChanged += new EventHandler(cbGetClouds_CheckedChanged);
            cbGetHerbs.CheckedChanged += new EventHandler(cbGetHerbs_CheckedChanged);
            cbGetMinerals.CheckedChanged += new EventHandler(cbGetMinerals_CheckedChanged);
            cbGetTreasures.CheckedChanged += new EventHandler(cbGetTreasures_CheckedChanged);
            cbUseOnlineDB.CheckedChanged += new EventHandler(cbUseOnlineDB_CheckedChanged);
            nudRecFreq.ValueChanged += new EventHandler(nudRecFreq_ValueChanged);
            cbSkin.CheckedChanged += new EventHandler(cbSkin_CheckedChanged);
            #endregion
            this.GUIForm.Show();
        }
        #endregion
        #endregion
        #region Loops
        private Action determineCurrentAction()
        {
            if (!object.Equals(null, Context.Me.IsCasting))
            {
                if (!Context.Me.IsCasting)
                    isSucking = false;
            }
            if (DoingNow == Action.NIL)
            {
                return Action.NIL;
            }
            if (DoingNow == Action.RECORD || DoingNow == Action.RECORDPAUSE)
            {
                return DoingNow;
            }
            if (isDead)
            {
                return Action.NIL;
            }
            if (isInCombat)
            {
                return Action.COMBAT;
            }
            if (isNodeNearby)
            {
                if (isWithinAquireDistance(CurrentTargetNode))
                {
                    return Action.AQUIRE;
                }
                else if (!isSucking)
                {
                    return Action.MANEUVER;
                }
            }
            if (isLootableUnitNearby)
            {
                return Action.LOOT;
            }
            return Action.PATROL;
        }
        private void loopMain()
        {
            try
            {
                if (!isGliderUseable) return;
                DoingNow = determineCurrentAction();
                if (isSubLoopRunning) return;
                switch (DoingNow)
                {
                    case Action.PATROL:
                        isSubLoopRunning = true;
                        playSound();
                        log("Patrolling at path index " + currentPathIndex.ToString());
                        subLoopPatrol();
                        resetKeys();
                        isSubLoopRunning = false;
                        break;
                    case Action.MANEUVER:
                        isSubLoopRunning = true;
                        playSound();
                        log("Maneuvering towards " + this.CurrentTargetNode.Name);
                        subLoopManeuver();
                        resetKeys();
                        isSubLoopRunning = false;
                        break;
                    case Action.RECORD:
                        isSubLoopRunning = true;
                        playSound();
                        log("Recording with " + PatrolPath.Count.ToString() + " path indexes");
                        subLoopRecord();
                        resetKeys();
                        isSubLoopRunning = false;
                        break;
                    case Action.COMBAT:
                        isSubLoopRunning = true;
                        playSound();
                        log("Engaging in Combat");
                        subLoopCombat();
                        combatMonitor();
                        resetKeys();
                        isSubLoopRunning = false;
                        break;
                    case Action.AQUIRE:
                        isSubLoopRunning = true;
                        playSound();
                        log("Acquiring " + this.CurrentTargetNode.Name);
                        subLoopAcquireNode();
                        aquireNodeMonitor();
                        resetKeys();
                        isSubLoopRunning = false;
                        break;
                    case Action.LOOT:
                        isSubLoopRunning = true;
                        playSound();
                        log("Looting");
                        subLoopLoot();
                        lootMonitor();
                        resetKeys();
                        isSubLoopRunning = false;
                        break;
                }
            }
            catch (Exception ex)
            {
                log("loopMain(): " + ex.Message);
            }
        }
        private int closestPathIndex(int startIndex, bool direction)
        {
            Coordinate myCoords = myLocation;
            float lowestDiff = 100000;
            float tmpLowDif = 0;
            int closestCoordIndex = 0;
            if (pathDirection)
            {
                for (int i = startIndex; i < PatrolPath.Count; i++)
                {
                    tmpLowDif = distanceBetween(myCoords, PatrolPath[i]);
                    if (lowestDiff > tmpLowDif)
                    {
                        lowestDiff = tmpLowDif;
                        closestCoordIndex = i;
                    }
                }
            }
            else
            {
                for (int i = startIndex; i > -1; i--)
                {
                    tmpLowDif = distanceBetween(myCoords, PatrolPath[i]);
                    if (lowestDiff > tmpLowDif)
                    {
                        lowestDiff = tmpLowDif;
                        closestCoordIndex = i;
                    }
                }
            }
            return closestCoordIndex;
        }
        private Coordinate myLocation
        {
            get
            {
                return new Coordinate(Context.Me.Location);
            }
        }
        private float distanceBetween(Coordinate r, Coordinate s)
        {
            return Math.Abs(r.X - s.X) + Math.Abs(r.Y - s.Y) + Math.Abs(r.Z - s.Z);
        }
        private void subLoopPatrol()
        {
            try
            {
                while (DoingNow == Action.PATROL)
                {
                    Context.Me.Refresh(true);
                    if (!isMounted)
                    {
                        mountAndTakeOff();
                        if (!isMounted)
                        {
                            continue;
                        }
                    }
                    int targetCoordIndex = -1;
                    Coordinate myCoords = myLocation;
                    if (distanceBetween(myCoords, PatrolPath[currentPathIndex]) < 70)
                    {

                        //find closest waypoint
                        int closestIndex = closestPathIndex(currentPathIndex, pathDirection);

                        //go towards the point after the closest point
                        if (pathDirection)
                            targetCoordIndex = closestIndex + 1;
                        else
                            targetCoordIndex = closestIndex - 1;

                        //reverse direction or restart
                        if (targetCoordIndex > PatrolPath.Count - 1)
                        {
                            switch (RunMethod)
                            {
                                case PathRunMethod.BOUNCE:
                                    targetCoordIndex = PatrolPath.Count - 1;
                                    pathDirection = !pathDirection;
                                    break;
                                case PathRunMethod.CIRCLE:
                                    targetCoordIndex = 0;
                                    pathDirection = true;
                                    break;
                            }
                        }
                        if (targetCoordIndex < 0)
                        {
                            switch (RunMethod)
                            {
                                case PathRunMethod.BOUNCE:
                                    targetCoordIndex = 0;
                                    pathDirection = !pathDirection;
                                    break;
                                case PathRunMethod.CIRCLE:
                                    targetCoordIndex = PatrolPath.Count - 1;
                                    pathDirection = false;
                                    break;
                            }
                        }
                        currentPathIndex = targetCoordIndex;
                    }
                    if (isStuck)
                    {
                        doSomethingCrazy();
                    }
                    else
                    {
                        moveTo3D(PatrolPath[currentPathIndex], .3, -15, 15, 0, 0, 0, 0);
                    }
                    pause(300, 1500);
                }
            }
            catch (Exception ex)
            {
                log("subLoopPatrol(): " + ex.Message);
            }
        }
        private void subLoopManeuver()
        {
            DateTime startTime = DateTime.Now;
            try
            {
                GObject node = GObjectList.FindObject(CurrentTargetNode.GUID);
                if (!isValidNode(node))
                    return;

                startDBQuery(node);
                bool directlyAbove = false;

                while (DoingNow == Action.MANEUVER)
                {
                    #region Checks
                    if (!isValidNode(node))
                        return;
                    if (DateTime.Now.CompareTo(startTime.AddSeconds(45)) > 0)
                    {
                        log("took too long to get to this node (45 seconds), blacklisting it, back to patrol");
                        blackListNode(CurrentTargetNode.GUID);
                        return;
                    }
                    #endregion
                    #region Maneuver
                    Coordinate TargetCoord = new Coordinate(node.Location);
                    Coordinate MyCoord = new Coordinate(Context.Me.Location);
                    float diffY = MyCoord.Y - TargetCoord.Y;
                    float diffX = MyCoord.X - TargetCoord.X;
                    float diffZ = MyCoord.Z - TargetCoord.Z;
                    //diffX: 3 diffY: -1 diffZ: 31
                    //log("diffX: " + ((int)diffX).ToString() + " diffY: " + ((int)diffY).ToString() + " diffZ: " + ((int)diffZ).ToString());
                    if (!directlyAbove &&
                        diffX < NODEAQUIREDISTXHIGH + 3 &&
                        diffX > NODEAQUIREDISTXLOW - 3 &&
                        diffY < NODEAQUIREDISTYHIGH + 3 &&
                        diffY > NODEAQUIREDISTYLOW - 3 &&
                        diffZ < 35 &&
                        diffZ > 0)
                    {
                        resetKeys();
                        directlyAbove = true;
                        log("directly above node, descending");
                    }
                    if (!directlyAbove)
                    {
                        TargetCoord.Z = TargetCoord.Z + 25;
                    }
                    if (!directlyAbove && !isMounted && node.DistanceToSelf > 40)
                    {
                        resetKeys();
                        mountAndTakeOff();
                        if (!isMounted)
                        {
                            continue;
                        }
                    }
                    if (directlyAbove &&
                        diffZ > 0 &&
                        diffZ < 10 &&
                        isMounted)
                    {
                        resetKeys();
                        disMount();
                    }
                    else if (isMounted)
                    {
                        moveTo3D(TargetCoord, .3,
                            (directlyAbove) ? 0 : (int)NODEAQUIREDISTZLOW,
                            (directlyAbove) ? 0 : (int)NODEAQUIREDISTZHIGH,
                            (directlyAbove) ? -100 : (int)NODEAQUIREDISTXLOW,
                            (directlyAbove) ? 100 : (int)NODEAQUIREDISTXHIGH,
                            (directlyAbove) ? -100 : (int)NODEAQUIREDISTYLOW,
                            (directlyAbove) ? 100 : (int)NODEAQUIREDISTYHIGH);
                    }
                    else if (!isWithinAquireDistance(node))
                    {
                        moveTo2D(TargetCoord, 4, 5, 200);
                        resetKeys();
                    }
                    else
                    {
                        return;
                    }

                    pause(100, 300);
                    node.Refresh(true);
                    Context.Me.Refresh(true);
                    #endregion
                }
            }
            catch (Exception ex)
            {
                log("subLoopManeuver(): " + ex.Message);
            }
        }
        private void subLoopRecord()
        {
            try
            {
                if (!isGliderUseable) return;
                if (object.Equals(null, PatrolPath))
                    PatrolPath = new Coordinates();
                while (DoingNow == Action.RECORD || DoingNow == Action.RECORDPAUSE)
                {
                    pause((int)nudRecFreq.Value);
                    if (DoingNow == Action.RECORD)
                    {
                        Context.Me.Refresh(true);
                        float meX = Context.Me.Location.X;
                        float meY = Context.Me.Location.Y;
                        float meZ = Context.Me.Location.Z;
                        if (PatrolPath.Count > 0)
                        {
                            if (PatrolPath[PatrolPath.Count - 1].X == meX && PatrolPath[PatrolPath.Count - 1].Y == meY && PatrolPath[PatrolPath.Count - 1].Z == meZ)
                                continue;
                        }
                        playSound();
                        PatrolPath.Add(new Coordinate(Context.Me.Location));
                    }
                }
            }
            catch (Exception ex)
            {
                log("subLoopRecord(): " + ex.Message);
            }
            string s = string.Empty;
            foreach (Coordinate c in PatrolPath)
            {
                s += c.X.ToString() + "|" + c.Y.ToString() + "|" + c.Z.ToString() + "\n";
            }
            try
            {
                string fpath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + txbSaveFileName.Text + ".yoink";
                FileStream fs = new FileStream(fpath, FileMode.Create);
                StreamWriter sw = new StreamWriter(fs);
                sw.Write(s);
                sw.Flush();
                sw.Close();
                fs.Close();
                log("Wrote path recording to: " + fpath);
            }
            catch (Exception ex)
            {
                log("subLoopRecord(): " + ex.Message);
            }
        }
        #endregion
        #region Stuck Detecter
        private void doSomethingCrazy()
        {
            System.Random random = new System.Random();
            int r = random.Next(1, 5);
            switch (r)
            {
                case 1:
                    Context.PressKey("Common.Jump");
                    Thread.Sleep(250);
                    Context.ReleaseKey("Common.Jump");
                    break;
                case 2:
                    Context.PressKey("Common.Sit");
                    Thread.Sleep(250);
                    Context.ReleaseKey("Common.Sit");
                    break;
                case 3:
                    Context.PressKey("Common.StrafeLeft");
                    Thread.Sleep(250);
                    Context.ReleaseKey("Common.StrafeLeft");
                    break;
                case 4:
                    Context.PressKey("Common.StrafeRight");
                    Thread.Sleep(250);
                    Context.ReleaseKey("Common.StrafeRight");
                    break;
                default:
                    Context.PressKey("Common.StrafeRight");
                    Thread.Sleep(250);
                    Context.ReleaseKey("Common.StrafeRight");
                    break;
            }
        }
        private GLocation lastCoord = new GLocation();
        private bool isStuck
        {
            get
            {
                bool stuck = false;
                GLocation myCoordNow = Context.Me.Location;
                if (myCoordNow.GetDistanceTo(lastCoord) < 1)
                {
                    stuck = true;
                }
                lastCoord = myCoordNow;
                return stuck;
            }
        }
        #endregion
        #region Loot Logic
        private void lootMonitor()
        {
            try
            {
                DateTime stTime = DateTime.Now;
                while (DoingNow == Action.LOOT)
                {
                    if (DateTime.Now.CompareTo(stTime.AddSeconds(35)) > 0)
                    {
                        log("took too long to loot this, blacklisting it.");
                        resetKeys();
                        blackListLoot(CurrentTargetLoot.GUID);
                        break;
                    }
                    pause(500);
                }
                lootEnded();
            }
            catch (Exception ex)
            {
                log("lootMonitor(): " + ex.Message);
            }
        }
        private void subLoopLoot()
        {
            thread_loot = new Thread(new ThreadStart(subLoopLoot2));
            thread_loot.Start();
        }
        private void subLoopLoot2()
        {
            try
            {
                while (DoingNow == Action.LOOT)
                {
                    while (!object.Equals(null, firstLootable))
                    {
                        CurrentTargetLoot = firstLootable;
                        if (isMounted)
                            lootUnit3D(CurrentTargetLoot);
                        else
                            lootUnit2D(CurrentTargetLoot);
                        pause(100, 1000);
                    }
                }
            }
            catch (Exception ex)
            {
                log("subLoopLoot2(): " + ex.Message);
            }
        }
        private void lootUnit2D(GObject unit)
        {
            while (!isWithinAquireDistance(unit))
            {
                moveTo2D(new Coordinate(unit.Location), 3, 100, 100);
            }
            resetKeys();
            if (isMounted)
            {
                disMount();
            }
            lootIt(unit);
        }
        private void lootUnit3D(GObject unit)
        {
            while (!isWithinAquireDistance(unit))
            {
                moveTo3D(new Coordinate(unit.Location), .3, (int)NODEAQUIREDISTZLOW, (int)NODEAQUIREDISTZHIGH, (int)NODEAQUIREDISTXLOW, (int)NODEAQUIREDISTXHIGH, (int)NODEAQUIREDISTYLOW, (int)NODEAQUIREDISTYHIGH);
            }
            resetKeys();
            if (isMounted)
            {
                disMount();
            }
            lootIt(unit);
        }
        private void lootIt(GObject unit)
        {
            GContext.Main.EnableCursorHook();
            unit.Hover();
            unit.Interact();
            GContext.Main.DisableCursorHook();
            HandleBopPopup();
            if (isBagsFull)
            {
                stopAll("Bags Full");
                return;
            }
        }
        private void HandleBopPopup()
        {
            HandleBopPopup(1000);
        }
        private void HandleBopPopup(int maxWaitMS)
        {
            DateTime st = DateTime.Now;
            while (true)
            {
                if (DateTime.Now.CompareTo(st.AddMilliseconds(maxWaitMS)) > 0)
                    break;
                for (int i = 1; i <= 4; i++)
                {
                    String name = "StaticPopup" + i.ToString();
                    GInterfaceObject obj = GContext.Main.Interface.GetByName(name);
                    if (obj == null || !obj.IsVisible)
                        continue;
                    if (obj.IsVisible)
                    {
                        GInterfaceObject text = obj.GetChildObject(name + "Text");
                        log("Loot: Got a loot popup ('" + text + "')");
                        if (text.LabelText.Contains("will bind it to you"))
                        {
                            GInterfaceObject obj2 = GContext.Main.Interface.GetByName(name + "Button1");
                            if (obj2 != null && obj2.IsVisible)
                            {
                                GContext.Main.EnableCursorHook();
                                obj2.ClickMouse(false);
                                GContext.Main.DisableCursorHook();
                            }
                        }
                        else
                        {
                            GInterfaceObject obj3 = GContext.Main.Interface.GetByName(name + "Button2");
                            if (obj3 != null && obj3.IsVisible)
                            {
                                GContext.Main.EnableCursorHook();
                                obj3.ClickMouse(false);
                                GContext.Main.DisableCursorHook();
                            }
                        }
                    }
                }
                pause(100);
            }
        }
        private void lootEnded()
        {
            try
            {
                if (!object.Equals(null, thread_loot))
                {
                    if (thread_loot.IsAlive)
                    {
                        thread_loot.Abort();
                    }
                }
            }
            catch (Exception ex)
            {
                log("lootEnded(): " + ex.Message);
            }
        }
        private bool isLootableUnitNearby
        {
            get
            {
                GUnit[] units = GObjectList.GetUnits();
                foreach (GUnit u in units)
                {
                    if ((!lootBlackList.Contains(u.GUID) && u.IsLootable) || (!lootBlackList.Contains(u.GUID) && u.IsSkinnable && cbSkin.Checked))
                    {
                        return true;
                    }
                }
                return false;
            }
        }
        private DateTime test1 = DateTime.Now;
        private GUnit firstLootable
        {
            get
            {
                GUnit[] units = GObjectList.GetUnits();
                foreach (GUnit u in units)
                {
                    if (!lootBlackList.Contains(u.GUID))
                    {
                        //if (u.IsLootable || u.IsSkinnable)
                        //{
                        //    if (test1.AddSeconds(1).CompareTo(DateTime.Now) < 0)
                        //    {
                        //        test1 = DateTime.Now;
                        //        FileStream fs = new FileStream(@"C:\test.txt", System.IO.FileMode.Create);
                        //        for (int i = 0; i < 100; i++)
                        //        {
                        //            try
                        //            {
                        //                byte b = GContext.Main.Memory.ReadByte(u.BaseAddress + i, "test1");
                        //                fs.WriteByte(b);
                        //            }
                        //            catch
                        //            {
                        //                log("stopped reading at " + i.ToString() + " bytes");
                        //                break;
                        //            }
                        //        }
                        //        fs.Close();
                        //    }

                        //}
                        if (u.IsLootable)
                            return u;
                        if (u.IsSkinnable && cbSkin.Checked)
                            return u;
                    }
                }
                return null;
            }
        }
        private void blackListLoot(long GUID)
        {
            lootBlackList.Add(GUID);
        }
        #endregion
        #region Combat Logic
        private void subLoopCombat()
        {
            thread_combat = new Thread(new ThreadStart(subLoopCombat2));
            thread_combat.Start();
        }
        private void subLoopCombat2()
        {
            try
            {
                while (DoingNow == Action.COMBAT)
                {
                    GUnit target = GObjectList.GetNearestAttacker(0);
                    if (object.Equals(null, target))
                    {
                        continue;
                    }
                    if (target != null && !target.IsDead)
                    {
                        if ((target.IsPlayer && !((GPlayer)target).IsSameFaction) ||
                            target.Reaction != GReaction.Friendly)
                        {
                            Context.Log("Got a Target. Go Kill!");
                            if (!target.SetAsTarget(false))
                            {
                                Context.Log("Can not target");
                            }
                            else
                            {
                                target.TouchHealthDrop();
                                StartCombat();
                                GCombatResult outcome = KillTarget(target, false);
                                log("Combat outcome: " + outcome.ToString());
                            }
                        }
                        else
                            Context.ClearTarget();
                    }
                    pause(100, 1000);
                }
            }
            catch (Exception ex)
            {
                log("subLoopCombat2(): " + ex.Message);
            }
        }
        private void combatMonitor()
        {
            try
            {
                while (DoingNow == Action.COMBAT)
                {
                    pause(500);
                }
                combatEnded();
            }
            catch (Exception ex)
            {
                log("combatMonitor(): " + ex.Message);
            }
        }
        private void combatEnded()
        {
            try
            {
                if (!object.Equals(null, thread_combat))
                {
                    if (thread_combat.IsAlive)
                    {
                        thread_combat.Abort();
                    }
                }
            }
            catch (Exception ex)
            {
                log("combatEnded(): " + ex.Message);
            }
        }
        #endregion
        #region Node Logic
        private void subLoopAcquireNode()
        {
            thread_aquire = new Thread(new ThreadStart(subLoopAcquireNode2));
            thread_aquire.Start();
        }
        private bool isSucking = false;
        private void subLoopAcquireNode2()
        {
            try
            {
                killthread_database(); //too late to back out anyway...
                resetKeys();
                GObject node = GObjectList.FindObject(CurrentTargetNode.GUID);
                moveTo2D(new Coordinate(node.Location), 5, 100, 100);
                resetKeys();
                int chatLogBufferCursor = chatLogBuffer.Count;
                bool isCloud = (node.Name.ToLower().Contains("cloud")) ? true : false;
                while (node != null && node.IsValid)
                {
                    if (isMounted)
                    {
                        disMount();
                        continue;
                    }
                    if (isCloud)
                    {
                        useExtractor();
                        pause(200);
                        while (Context.Me.IsCasting)
                        {
                            isSucking = true;
                            pause(50);
                        }
                        isSucking = false;
                    }
                    else
                    {
                        #region heading
                        double heading = Context.Movement.GetHeadingTo(Context.Me.Location, node.Location);
                        double headingDiff = heading - Context.Me.Heading;
                        if (Math.Abs(headingDiff) > .2)
                        {
                            Context.Movement.SetHeading(heading);
                        }
                        else
                        {
                            if (Context.IsSpinning)
                                Context.ReleaseSpin();
                        }
                        #endregion

                        GContext.Main.EnableCursorHook();
                        node.Hover();
                        node.Interact();
                        GContext.Main.DisableCursorHook();
                    }
                    string message = GContext.Main.RedMessage.ToLower();
                    if (message.ToLower().Contains("lock"))
                    {
                        log(message + ", blacklisting node");
                        blackListNode(CurrentTargetNode.GUID);
                        return;
                    }
                    if (message.ToLower().Contains("require"))
                    {
                        log(message + ", blacklisting node");
                        blackListNode(CurrentTargetNode.GUID);
                        return;
                    }
                    if (isBagsFull)
                    {
                        stopAll("Bags Full");
                        return;
                    }
                    while (Context.Me.IsCasting)
                    {
                        pause(50);
                    }
                    pause((int)nudLootDelay.Value);
                    if (chatLogBuffer.Count > chatLogBufferCursor)
                    {
                        int howManyNewLines = chatLogBuffer.Count - chatLogBufferCursor;
                        List<String> newLines = chatLogBuffer.GetRange(chatLogBuffer.Count - howManyNewLines, howManyNewLines);
                        chatLogBufferCursor = chatLogBuffer.Count;
                        foreach (String line in newLines)
                        {
                            if ((line == String.Empty) || (line == null)) continue;
                            if (line.ToLower().Contains("you receive"))
                            {
                                log("Got some of the node!");
                                timeLastAquired = DateTime.Now;
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log("subLoopAcquireNode2(): " + ex.Message);
            }
        }
        private void aquireNodeMonitor()
        {
            try
            {
                timeLastAquired = DateTime.Now;
                while (DoingNow == Action.AQUIRE)
                {
                    if (DateTime.Now.CompareTo(timeLastAquired.AddSeconds(35)) > 0)
                    {
                        log("took too long to aquire this node (35 seconds), blacklisting it");
                        resetKeys();
                        blackListNode(CurrentTargetNode.GUID);
                        break;
                    }
                    pause(500);
                }
                aquireNodeEnded();
            }
            catch (Exception ex)
            {
                log("aquireNodeMonitor(): " + ex.Message);
            }
        }
        private void aquireNodeEnded()
        {
            try
            {
                if (!object.Equals(null, thread_aquire))
                {
                    if (thread_aquire.IsAlive)
                    {
                        thread_aquire.Abort();
                    }
                }
            }
            catch (Exception ex)
            {
                log("aquireNodeEnded(): " + ex.Message);
            }
        }
        private bool isWithinAquireDistance(GObject node)
        {
            if (object.Equals(null, node)) return false;
            float distX = node.Location.X - Context.Me.Location.X;
            float distY = node.Location.Y - Context.Me.Location.Y;
            float distZ = node.Location.Z - Context.Me.Location.Z;
            bool isCloud = (node.Name.ToLower().Contains("cloud")) ? true : false;

            if (distX < NODEAQUIREDISTXLOW + ((isCloud) ? -4 : 0))
                return false;
            if (distX > NODEAQUIREDISTXHIGH + ((isCloud) ? 4 : 0))
                return false;
            if (distY < NODEAQUIREDISTYLOW + ((isCloud) ? -4 : 0))
                return false;
            if (distY > NODEAQUIREDISTYHIGH + ((isCloud) ? 4 : 0))
                return false;
            if (distZ < NODEAQUIREDISTZLOW)
                return false;
            if (distZ > NODEAQUIREDISTZHIGH)
                return false;
            return true;
        }
        private GObject[] getObjects(bool sortByDistanceToMe, params GObjectType[] types)
        {
            GObject[] objs = GObjectList.GetObjects();
            List<GObject> objs2 = new List<GObject>();
            for (int i = 0; i < objs.Length; i++)
            {
                foreach (GObjectType type in types)
                {
                    if (objs[i].Type == type)
                    {
                        objs2.Add(objs[i]);
                        break;
                    }
                }
            }
            if (sortByDistanceToMe)
            {
                for (int i = 0; i < objs2.Count; i++)
                {
                    for (int a = 0; a < objs2.Count; a++)
                    {
                        if (objs2[i].DistanceToSelf < objs2[a].DistanceToSelf)
                        {
                            GObject tmp = objs2[i];
                            objs2[i] = objs2[a];
                            objs2[a] = tmp;
                        }
                    }
                }
            }
            return objs2.ToArray();
        }
        private bool isNodeNearby
        {
            get
            {
                GObject[] objs = getObjects(true, GObjectType.Node, GObjectType.Monster);
                foreach (GObject o in objs)
                {
                    Action a = new Action();
                    if (IsValidNode(o, out a))
                    {
                        setTargetNode(o);
                        return true;
                    }
                }
                return false;
            }
        }
        private bool isValidNode(GObject obj)
        {
            Action tmp = Action.NIL;
            return IsValidNode(obj, out tmp);
        }
        private bool IsValidNode(GObject obj, out Action Action)
        {
            Action = Action.NIL;
            if (object.Equals(null, obj))
                return false;
            if (!obj.IsValid)
                return false;
            if (nodeBlackList.Contains(obj.GUID))
                return false;
            if (obj.Type != GObjectType.Node && obj.Type != GObjectType.Monster)
                return false;
            //valid node?
            if (obj.Type == GObjectType.Node)
            {
                GNode objNode = (GNode)obj;
                if (!objNode.IsFlower && !objNode.IsMineral && !objNode.IsTreasure)
                    return false;
                if (objNode.IsFlower && !GPlayerSelf.Me.HasHerbalism)
                    return false;
                if (objNode.IsMineral && !GPlayerSelf.Me.HasMining)
                    return false;
                if (objNode.IsFlower && !cbGetHerbs.Checked)
                    return false;
                if (objNode.IsMineral && !cbGetMinerals.Checked)
                    return false;
                if (objNode.IsTreasure && !cbGetTreasures.Checked)
                    return false;
            }
            //valid cloud?
            if (obj.Type == GObjectType.Monster)
            {
                if (!cbGetClouds.Checked)
                    return false;
                if (!obj.Name.ToLower().Contains("cloud"))
                    return false;
            }
            //check temp blacklist
            foreach (TempBlackListItem tbli in tempBlackList)
            {
                if (tbli.GUID == obj.GUID)
                {
                    if (tbli.timeBlackListed.Add(tbli.blackListDuration).CompareTo(DateTime.Now) > 0)
                    {
                        return false;
                    }
                }
            }
            //check ninja status
            if (!cbNinja.Checked)
            {
                GPlayer[] players = GObjectList.GetPlayers();
                foreach (GPlayer player in players)
                {
                    if (player.GUID == Context.Me.GUID)
                        continue;
                    player.Refresh(true);
                    if (player.Location.GetDistanceTo(obj.Location) < 20)
                    {
                        int numSecs = YoinkSpace.Random.Int(10, 30);
                        log(numSecs.ToString() + " second temp ban for node with nearby player");
                        tempBlackList.Add(new TempBlackListItem(obj.GUID, DateTime.Now, TimeSpan.FromSeconds(numSecs)));
                        return false;
                    }
                }
            }
            Action = Action.AQUIRE;
            return true;
        }
        private void blackListNode(long GUID)
        {
            nodeBlackList.Add(GUID);
        }
        private void setTargetNode(GObject node)
        {
            CurrentTargetNode = node;
        }
        #endregion
        #region Move Logic
        private void moveTo3D(Coordinate TargetCoord)
        {
            moveTo3D(TargetCoord, .3, 0, 0, 0, 0, 0, 0);
        }
        private void moveTo3D(Coordinate TargetCoord, double TolHead, int tolZ_lower, int tolZ_upper, int tolX_lower, int tolX_upper, int tolY_lower, int tolY_upper)
        {
            Context.Me.Refresh(true);
            Coordinate MyCoord = new Coordinate(Context.Me.Location);
            GLocation TargetGLoc = new GLocation(TargetCoord.X, TargetCoord.Y, TargetCoord.Z);
            GLocation MyGLoc = new GLocation(MyCoord.X, MyCoord.Y, MyCoord.Z);
            float diffY = TargetCoord.Y - MyCoord.Y;
            float diffX = TargetCoord.X - MyCoord.X;
            float diffZ = TargetCoord.Z - MyCoord.Z;
            float distanceX = Math.Abs(diffX);
            float distanceY = Math.Abs(diffY);
            float distanceZ = Math.Abs(diffZ);
            float distanceXY = Math.Abs(diffY) + Math.Abs(diffX);
            #region heading
            double heading = Context.Movement.GetHeadingTo(MyGLoc, TargetGLoc);
            double headingDiff = heading - Context.Me.Heading;
            if (Math.Abs(headingDiff) > TolHead)
            {
                Context.Movement.SetHeading(heading);
            }
            else
            {
                if (Context.IsSpinning)
                    Context.ReleaseSpin();
            }
            #endregion
            #region X and Y Axis
            //clamp(ref tolX_lower, 0, 100);
            //clamp(ref tolX_upper, 0, 100);
            //tolX_lower = tolX_lower * -1;
            //clamp(ref tolY_lower, 0, 100);
            //clamp(ref tolY_upper, 0, 100);
            //tolY_lower = tolY_lower * -1;
            if (diffX > tolX_upper || diffY > tolY_upper)
            {
                Context.ReleaseKey("Common.Back");
                Context.PressKey("Common.Forward");
            }
            else if (diffX < tolX_lower || diffY < tolY_lower)
            {
                Context.ReleaseKey("Common.Back");
                Context.PressKey("Common.Forward");
                //Context.ReleaseKey("Common.Forward");
                //Context.PressKey("Common.Back");
            }
            else
            {
                Context.ReleaseKey("Common.Back");
                Context.ReleaseKey("Common.Forward");
            }
            #endregion
            #region Z Axis
            //clamp(ref tolZ_lower, 0, 100);
            //clamp(ref tolZ_upper, 0, 100);
            //tolZ_lower = tolZ_lower * -1;
            if (diffZ > tolZ_upper)//go up
            {
                Context.ReleaseKey("Common.Sit");
                Context.PressKey("Common.Jump");
            }
            else if (diffZ < tolZ_lower && isMounted)//go down
            {
                Context.ReleaseKey("Common.Jump");
                Context.PressKey("Common.Sit");
            }
            else
            {
                Context.ReleaseKey("Common.Sit");
                Context.ReleaseKey("Common.Jump");
            }
            #endregion
        }
        private void moveTo2D(Coordinate TargetCoord, int distance, int adjustFrequencyMS, int numLoops)
        {
            GLocation loc = new GLocation(TargetCoord.X, TargetCoord.Y, TargetCoord.Z);
            if (loc.DistanceToSelf <= distance)
                return;
            resetKeys();
            for (int i = 0; i < numLoops; i++)
            {
                if (loc.DistanceToSelf <= distance)
                    break;
                Context.Me.Refresh(true);
                GLocation MyGLoc = Context.Me.Location;
                double heading = Context.Movement.GetHeadingTo(MyGLoc, loc);
                Context.Movement.SetHeading(heading);
                Context.PressKey("Common.Forward");
                pause(adjustFrequencyMS);
            }
            resetKeys();
        }
        #endregion
        #region Event Handlers
        private void cbSkin_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbSkin", cbSkin.Checked.ToString());
        }
        private void nudRecFreq_ValueChanged(object sender, EventArgs e)
        {
            setConfigVal("nudRecFreq", nudRecFreq.Value.ToString());
        }
        private void cbUseOnlineDB_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbUseOnlineDB", cbUseOnlineDB.Checked.ToString());
        }
        private void Main_ChatLog(string RawText, string ParsedText)
        {
            chatLogBuffer.Add(RawText);
        }
        private void GUIForm_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
        {
            e.Cancel = true;
            GUIForm.Visible = false;
        }
        private void txbSaveFileName_TextChanged(object sender, EventArgs e)
        {
            setConfigVal("txbSaveFileName", txbSaveFileName.Text);
        }
        private void txbLoadFileName_TextChanged(object sender, EventArgs e)
        {
            setConfigVal("txbLoadFileName", txbLoadFileName.Text);
        }
        private void cbNinja_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbNinja", cbNinja.Checked.ToString());
        }
        private void cbGetMinerals_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetMinerals", cbGetMinerals.Checked.ToString());
        }
        private void cbGetHerbs_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetHerbs", cbGetHerbs.Checked.ToString());
        }
        private void cbGetClouds_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetClouds", cbGetClouds.Checked.ToString());
        }
        private void cbGetTreasures_CheckedChanged(object sender, EventArgs e)
        {
            setConfigVal("cbGetTreasures", cbGetClouds.Checked.ToString());
        }
        private void nudLootDelay_ValueChanged(object sender, EventArgs e)
        {
            setConfigVal("nudLootDelay", nudLootDelay.Value.ToString());
        }
        private void cbbPathMode_SelectedValueChanged(object sender, EventArgs e)
        {
            string s = (string)cbbPathMode.SelectedItem;
            log("changing Path Mode to " + s);
            switch (s)
            {
                case "BOUNCE":
                    RunMethod = PathRunMethod.BOUNCE;
                    break;
                case "CIRCLE":
                    RunMethod = PathRunMethod.CIRCLE;
                    break;
                default:
                    break;
            }
            setConfigVal("cbbPathMode", s);
        }
        private void btnRunPath_Click(object data, EventArgs e)
        {
            try
            {
                if (!isGliderUseable) return;
                if (isRunning)
                {
                    stopAll("GUI Stop Button Pressed");
                }
                else
                {
                    startAll("GUI Start Button Pressed");
                }
            }
            catch (Exception ex)
            {
                log("btnRunPath_Click(object data, EventArgs e): " + ex.Message);
            }
        }
        private void loadPath(object sender, EventArgs e)
        {
            try
            {
                if (!isGliderUseable) return;
                if (isRunning)
                {
                    log("Please stop the current patrol first.");
                    return;
                }
                string s = string.Empty;
                bool error = false;
                try
                {
                    string fname = txbLoadFileName.Text + ".yoink";
                    FileStream fs = new FileStream(Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Profiles" + Path.DirectorySeparatorChar + fname, FileMode.Open);
                    StreamReader sr = new StreamReader(fs);
                    s = sr.ReadToEnd();
                    log("Loaded " + fname);
                }
                catch (Exception ex)
                {
                    error = true;
                    log("loadPath(object sender, EventArgs e): " + ex.Message);
                }
                string[] lines = s.Split('\n');
                PatrolPath = new Coordinates();
                foreach (string line in lines)
                {
                    string[] coordsOneSet = line.Split('|');
                    if (coordsOneSet.Length < 3)
                        continue;
                    PatrolPath.Add(new Coordinate(float.Parse(coordsOneSet[0]), float.Parse(coordsOneSet[1]), float.Parse(coordsOneSet[2])));
                }
                if (!error)
                    playSound();
            }
            catch (Exception ex)
            {
                log("loadPath(object sender, EventArgs e): " + ex.Message);
            }
        }
        private void btnUnloadPath_Click(object sender, EventArgs e)
        {
            PatrolPath = new Coordinates();
        }
        private void btnRecNewPath_Click(object sender, EventArgs e)
        {
            if (!isGliderUseable) return;
            if (DoingNow == Action.RECORD || DoingNow == Action.RECORDPAUSE)
            {
                DoingNow = Action.NIL;
                btnRecNewPath.Text = LanguageVars.RECORD1;
                btnPauseRec.Text = LanguageVars.RECORD3;
            }
            else if (DoingNow == Action.NIL)
            {
                DoingNow = Action.RECORD;
                btnRecNewPath.Text = LanguageVars.RECORD2;
            }
            else
            {
                log("Please stop patrolling first.");
                return;
            }
        }
        private void btnPauseRec_Click(object sender, EventArgs e)
        {
            if (!isGliderUseable) return;
            if (DoingNow != Action.RECORD && DoingNow != Action.RECORDPAUSE)
            {
                log("Not Recording, can't pause.");
                return;
            }
            if (DoingNow == Action.RECORD)
            {
                DoingNow = Action.RECORDPAUSE;
                btnPauseRec.Text = LanguageVars.RECORD4;
            }
            else
            {
                DoingNow = Action.RECORD;
                btnPauseRec.Text = LanguageVars.RECORD3;
            }
        }
        #endregion
        #region Other Logic
        private void resetKeys()
        {
            GContext.Main.DisableCursorHook();
            if (GContext.Main.IsSpinning)
            {
                Context.ReleaseSpin();
            }
            Context.ReleaseAllKeys();
            Context.ReleaseKey("Common.Back");
            Context.ReleaseKey("Common.Forward");
            Context.ReleaseKey("Common.Sit");
            Context.ReleaseKey("Common.Jump");
        }
        private void TargetClosestAttacker()
        {
            GUnit NearestAttacker = GObjectList.GetNearestAttacker(0);
            NearestAttacker.SetAsTarget(false);
        }
        private void disMount()
        {
            if (isMounted)
            {
                resetKeys();
                Context.SendKey(LanguageVars.CLASSNAME + ".Mount");
            }
            else
            {
                log("can't dismount, not mounted");
            }
        }
        private void useExtractor()
        {
            resetKeys();
            pause(200);
            Context.SendKey(LanguageVars.CLASSNAME + ".BAR3");
            pause(200);
            Context.SendKey(LanguageVars.CLASSNAME + ".Extractor");
        }
        private void mountAndTakeOff()
        {
            resetKeys();
            Context.SendKey(LanguageVars.CLASSNAME + ".BAR3");
            pause(200);
            Context.SendKey(LanguageVars.CLASSNAME + ".Mount");
            pause(4500, 8000);//looking at minimap or something ;)
            if (isMounted)
            {
                Context.PressKey("Common.Jump");
                pause(1000, 3000);
                Context.ReleaseKey("Common.Jump");
            }
            else
            {
                if (GContext.Main.RedMessage.Contains("swim"))
                {
                    onlineDbInsertEvent("stuckswim");
                    stopAll("Trying to mount while swimming.");
                }
                else if (GContext.Main.RedMessage.Contains("use that here"))
                {
                    onlineDbInsertEvent("stuckinside");
                    stopAll("Trying to mount inside.");
                }
                else if (GContext.Main.RedMessage.Contains("mount here"))
                {
                    onlineDbInsertEvent("stuckinside");
                    stopAll("Trying to mount inside.");
                }
            }
        }
        private static bool isMounted
        {
            get
            {
                GPlayerSelf.Me.SetBuffsDirty();
                if (GPlayerSelf.Me.HasBuff(MountSpellIds.FlyingMounts))
                    return true;
                if (GPlayerSelf.Me.HasBuff(MountSpellIds.GroundMounts))
                    return true;
                return false;
            }
        }
        private void Tick(object state)
        {
            thread_mainloop = new Thread(new ThreadStart(loopMain));
            thread_mainloop.SetApartmentState(ApartmentState.STA);
            thread_mainloop.Priority = ThreadPriority.AboveNormal;
            thread_mainloop.Name = "MainLoopThread";
            thread_mainloop.Start();
        }
        #region Stoppers
        private bool stopGlide()
        {
            return stopGlide(String.Empty);
        }
        private bool stopGlide(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                if (!isGliderUseable) return false;
                log("Stopping Glide; " + reason);
                if (Context.IsGliding)
                {
                    Context.KillAction("[" + LanguageVars.CLASSNAME + " " + DateTime.Now.ToString() + "] " + reason, false);
                    return true;
                }
                else
                {
                    log("Glide already stopped.");
                    return false;
                }
            }
            catch (Exception ex)
            {
                log("stopGlide(String reason): " + ex.Message);
            }
            return false;
        }
        private bool stopPatrol()
        {
            return stopPatrol(String.Empty);
        }
        private bool stopPatrol(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                log("Stopping Patrol; " + reason);
                if (!isRunning)
                {
                    log("Patrol already stopped.");
                    return false;
                }
                DoingNow = Action.NIL;
                btnRunPath.Text = LanguageVars.RUN1;
                isSubLoopRunning = false;
                resetKeys();
                killthread_all();
                return true;
            }
            catch (Exception ex)
            {
                log("stopPatrol(String reason): " + ex.Message);
            }
            return false;
        }
        private bool stopAll()
        {
            return stopAll(String.Empty);
        }
        private bool stopAll(String reason)
        {
            bool b = stopGlide(reason);
            b = (stopPatrol(reason) && b) ? true : false;
            return b;
        }
        #endregion
        #region Starters
        private bool startGlide()
        {
            return startGlide(String.Empty);
        }
        private bool startGlide(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                if (!isGliderUseable) return false;
                log("Starting Glide; " + reason);
                if (!Context.IsGliding)
                {
                    return Context.StartGlide();
                }
                else
                {
                    log("Glide already started.");
                    return false;
                }
            }
            catch (Exception ex)
            {
                log("startGlide(String reason): " + ex.Message);
            }
            return false;
        }
        private bool startPatrol()
        {
            return startPatrol(String.Empty);
        }
        private bool startPatrol(String reason)
        {
            try
            {
                GUIForm.Visible = true;
                if (!isGliderUseable) return false;
                log("Starting Patrol; " + reason);
                if (isRunning)
                {
                    log("Patrol already started.");
                    return false;
                }
                if (isDead)
                {
                    log("Toon is dead >_<");
                    return false;
                }
                if (!pathLoaded)
                {
                    loadPath();
                    if (!pathLoaded)
                    {
                        log("Please Load a path with > 1 point first.");
                        return false;
                    }
                }
                currentPathIndex = closestPathIndex((pathDirection) ? 0 : PatrolPath.Count - 1, pathDirection);
                DoingNow = Action.PATROL;
                btnRunPath.Text = LanguageVars.RUN2;
                return true;
            }
            catch (Exception ex)
            {
                log("startPatrol(String reason): " + ex.Message);
            }
            return false;
        }
        private bool startAll()
        {
            return startAll(String.Empty);
        }
        private bool startAll(String reason)
        {
            return (startPatrol(reason) && startGlide(reason));
        }
        #endregion
        private bool isDead
        {
            get
            {
                return (Context.Me.IsDead);
            }
        }
        private bool isBagsFull
        {
            get
            {
                string message = GContext.Main.RedMessage.ToLower();
                if (message.ToLower().Contains("are full"))
                    return true;
                if (message.ToLower().Contains("placed in that"))
                    return true;
                if (message.ToLower().Contains("not go there"))
                    return true;
                return false;
            }
        }
        private bool isFlyingMountable
        {
            get
            {
                string message = GContext.Main.RedMessage.ToLower();
                if (message.ToLower().Contains("swim"))
                    return false;
                if (message.ToLower().Contains("mount here"))
                    return false;
                return true;
            }
        }
        private bool isRunning
        {
            get
            {
                return (DoingNow != Action.NIL);
            }
        }
        private bool isInCombat
        {
            get
            {
                if (Context.Me.IsInCombat && !isMounted)
                    return true;
                else return false;
            }
        }
        private bool pathLoaded
        {
            get
            {
                return (!object.Equals(null, PatrolPath) && PatrolPath.Count > 1);
            }
        }
        private void loadPath()
        {
            loadPath(null, null);
        }
        private bool contextUseable()
        {
            if (object.Equals(null, Context))
            {
                return false;
            }
            if (object.Equals(null, Context.Me))
            {
                return false;
            }
            if (object.Equals(null, Context.Me.Location))
            {
                return false;
            }
            return true;
        }
        private bool isGliderUseable
        {
            get
            {
                if (contextUseable())
                {
                    return true;
                }
                return false;
            }
        }
        private bool killthread_combat()
        {
            if (!object.Equals(null, thread_combat))
            {
                if (thread_combat.IsAlive)
                {
                    thread_combat.Abort();
                    log("killed " + thread_combat.Name);
                    return true;
                }
            }
            return false;
        }
        private bool killthread_loot()
        {
            if (!object.Equals(null, thread_loot))
            {
                if (thread_loot.IsAlive)
                {
                    thread_loot.Abort();
                    log("killed " + thread_loot.Name);
                    return true;
                }
            }
            return false;
        }
        private bool killthread_aquire()
        {
            if (!object.Equals(null, thread_aquire))
            {
                if (thread_aquire.IsAlive)
                {
                    thread_aquire.Abort();
                    log("killed " + thread_aquire.Name);
                    return true;
                }
            }
            return false;
        }
        private bool killthread_database()
        {
            if (!object.Equals(null, thread_database))
            {
                if (thread_database.IsAlive)
                {
                    thread_database.Abort();
                    log("killed " + thread_database.Name);
                    return true;
                }
            }
            return false;
        }
        private void killthread_all()
        {
            try
            {
                killthread_aquire();
                killthread_combat();
                killthread_database();
                killthread_loot();
            }
            catch (Exception ex)
            {
                log("killthread_all(): " + ex.Message);
            }
        }
        private void killTicker()
        {
            try
            {
                log("killing ticker");
                if (!object.Equals(null, Ticker))
                {
                    Ticker.Change(System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite);
                    Ticker.Dispose();
                }
            }
            catch (Exception ex)
            {
                log("killTicker(): " + ex.Message);
            }
        }
        #endregion
        #region Internal Helpers
        #region Online DB
        private void startDBQuery(GObject obj)
        {
            return;
            try
            {
                if (!cbUseOnlineDB.Checked) return;
                if (!object.Equals(null, thread_database))
                {
                    if (thread_database.IsAlive)
                        return;
                }
                thread_database = new Thread(new ParameterizedThreadStart(startDBQuery2));
                thread_database.SetApartmentState(ApartmentState.STA);
                thread_database.Priority = ThreadPriority.AboveNormal;
                thread_database.Name = "onlineDBQueryThread";
                thread_database.Start(obj);
            }
            catch (Exception ex)
            {
                log("startDBQuery(GObject obj): " + ex.Message);
            }
        }
        private void startDBQuery2(object o)
        {
            return;
            try
            {
                GObject obj = (GObject)o;
                int numCases = onlineDbQueryEvents(new Coordinate(obj.Location), 20, "stuckswim", "stuckinside");
                if (numCases > 0)
                {
                    log("Online DB Reported " + numCases.ToString() + " cases of stuckswim and/or stuckinside for a node location, blacklisting the node");
                    blackListNode(obj.GUID);
                }
            }
            catch (Exception ex)
            {
                log("startDBQuery2(object o): " + ex.Message);
            }
        }
        private void onlineDbInsertEvent(String Event)
        {
            return;
            if (!cbUseOnlineDB.Checked) return;
            http.Response resp = new http.Response();
            ArrayList paramSet = new ArrayList();
            Context.Me.Refresh(true);
            paramSet.Add(new string[2] { "worldmap", Context.WorldMap });
            paramSet.Add(new string[2] { "zonetext", Context.ZoneText });
            paramSet.Add(new string[2] { "subzonetext", Context.SubZoneText });
            paramSet.Add(new string[2] { "x", Context.Me.Location.X.ToString() });
            paramSet.Add(new string[2] { "y", Context.Me.Location.Y.ToString() });
            paramSet.Add(new string[2] { "z", Context.Me.Location.Z.ToString() });
            paramSet.Add(new string[2] { "op", "insert_event" });
            paramSet.Add(new string[2] { "event", Event });
            bool success = http.post(ref resp, DBURL, paramSet, null, http.FILE_COMPRESSION_METHODS.NONE, http.ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED, http.REQUEST_METHODS.GET);
            if (success)
                log("onlineDbInsertEvent(" + Event + "): " + resp.ToString());
            else
                log("onlineDbInsertEvent(" + Event + "): FAILED!");
        }
        private int onlineDbQueryEvents(Coordinate Coord, int range, params string[] Events)
        {
            return 0;
            try
            {
                if (!cbUseOnlineDB.Checked) return 0;
                http.Response resp = new http.Response();
                ArrayList paramSet = new ArrayList();
                paramSet.Add(new string[2] { "worldmap", Context.WorldMap });
                paramSet.Add(new string[2] { "zonetext", Context.ZoneText });
                paramSet.Add(new string[2] { "subzonetext", Context.SubZoneText });
                paramSet.Add(new string[2] { "x", Coord.X.ToString() });
                paramSet.Add(new string[2] { "y", Coord.Y.ToString() });
                paramSet.Add(new string[2] { "z", Coord.Z.ToString() });
                paramSet.Add(new string[2] { "op", "query_events" });
                paramSet.Add(new string[2] { "range", range.ToString() });
                foreach (string e in Events)
                {
                    paramSet.Add(new string[2] { "events[]", e });
                }
                bool success = http.post(ref resp, DBURL, paramSet, null, http.FILE_COMPRESSION_METHODS.NONE, http.ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED, http.REQUEST_METHODS.GET);
                if (!success)
                {
                    log("onlineDbQueryEvents: FAILED!");
                    return 0;
                }
                string result = resp.ToString().Trim();
                int resultInt = Int32.Parse(result);
                return resultInt;
            }
            catch (Exception ex)
            {
                log("onlineDbQueryEvents(Coordinate Coord, int range, params string[] Events): " + ex.Message);
                return 0;
            }
        }
        #endregion
        private String getConfigVal(String Key)
        {
            String cv1 = LanguageVars.CLASSNAME + "." + Key;
            String cv11 = Context.GetConfigString(cv1);
            return (object.Equals(null, cv11)) ? String.Empty : cv11;
        }
        private void setConfigVal(String Key, String Value)
        {
            try
            {
                Context.SetConfigValue(LanguageVars.CLASSNAME + "." + Key, Value, true);
            }
            catch (Exception ex)
            {
                log("setConfigVal(String Key, String Value): " + ex.Message);
            }
        }
        private void pause(int HowLongMS)
        {
            clamp(ref HowLongMS, 1, 3600000);//1 hour max ./shrug
            Thread.Sleep(HowLongMS);
        }
        private void pause(int minMS, int maxMS)
        {
            clamp(ref minMS, 1, 3600000);//1 hour max ./shrug
            Thread.Sleep(new System.Random().Next(minMS, maxMS));
        }
        private void clamp(ref int inVal, int min, int max)
        {
            inVal = Math.Min(max, inVal);
            inVal = Math.Max(min, inVal);
        }
        private void log(string what)
        {
            Context.Log("[" + LanguageVars.CLASSNAME + " v" + VERSION + " " + DateTime.Now.ToString() + "] " + what);
        }
        private void playSound()
        {
            try
            {
                if (!soundPlayer.IsLoadCompleted)
                {
                    string sep = Path.DirectorySeparatorChar.ToString();
                    soundPlayer.SoundLocation = Environment.CurrentDirectory + sep + "Key.wav";
                    soundPlayer.Load();
                    soundPlayer.Stop();
                }
                soundPlayer.Play();
            }
            catch (Exception ex)
            {
                log("playSound(): " + ex.Message);
            }
        }
        #endregion
        #region Overrides
        public override void Patrol()
        {
            bool gliderRunning = false;
            while (RunPatrolLoop)
            {
                if (Context.IsGliderRunning && !gliderRunning)
                {
                    gliderRunning = true;
                    OnStartGlide();
                }
                if (!Context.IsGliderRunning && gliderRunning)
                {
                    gliderRunning = false;
                }
                pause(500);
            }
        }
        public override string DisplayName
        {
            get { return LanguageVars.CLASSNAME; }
        }
        public override void OnStartGlide()
        {
            log("OnStartGlide");
            if (!isRunning)
            {
                startPatrol("Glide Started");
            }
        }
        public override void OnStopGlide()
        {
            log("OnStopGlide");
            if (isRunning)
            {
                stopPatrol("Glide Stopped");
            }
        }
        public override void OnResurrect()
        {
            log("OnResurrect");
        }
        public override bool Rest()
        {
            log("Rest");
            return false;
        }
        public override void ApproachingTarget(GUnit Target)
        {
            log("ApproachingTarget");
        }
        public override void RunningAction()
        {
            log("RunningAction");
        }
        public override void Startup()
        {
            log("Startup");
            initialize();
            base.Startup();
        }
        public override void Shutdown()
        {
            log("Shutdown");
            GUIForm.Close();
            GUIForm.Dispose();
            soundPlayer.Stop();
            killTicker();
            killthread_all();
            base.Shutdown();
            RunPatrolLoop = false;
        }
        #endregion
    }
    #region External Helpers
    public static class LanguageVars
    {
        public static string SKIN = "Skin Corpses";
        public static string PATPATHNAME = "Patrol Path Name";
        public static string RECPATHNAME = "Recording Path Name";
        public static string PATHPATMODE = "Path Patrol Mode";
        public static string RECORDFREQ = "Record Frequency (ms)";
        public static string USEONLINEDB = "Use Online Database";
        public static string GETTREASURES = "Get Treasures";
        public static string GETHERBS = "Get Herbs";
        public static string GETMINERALS = "Get Minerals";
        public static string GETCLOUDS = "Get Clouds";
        public static string LOOTDELAY = "Loot Delay (ms)";
        public static string NINJA = "Loot Ninjutsu";
        public static string CLASSNAME = "Yoink";
        public static string DEFAULTPATHNAME1 = "somearea";
        public static string RECORD1 = "Record Path";
        public static string RECORD2 = "Stop Recording";
        public static string RECORD3 = "Pause Recording";
        public static string RECORD4 = "Resume Recording";
        public static string RUN1 = "Patrol";
        public static string RUN2 = "Stop Patrolling";
        public static string LOAD1 = "Load Path";
        public static string UNLOAD1 = "UnLoad Path";
        public static string DATAFILEFRIENDLYNAME1 = "Yoink Files";
    }
    public static class MountSpellIds
    {
        public static int[] FlyingMounts
        {
            get
            {
                return new int[] {
                        #region Long List
                        54726, //Winged Steed of the Ebon Blade
		                44744,
                        41517,
                        59567,
                        32290,
                        41518,
                        32242,
                        3363,
                        44151,
                        59568,
                        49193,
                        32243,
                        39798,
                        46197,
                        32292,
                        32296,
                        32235,
                        32239,
                        59569,
                        60021,
                        44317,
                        61442,
                        61444,
                        32246,
                        59976,
                        43927,
                        32297,
                        60024,
                        37015,
                        59570,
                        32295,
                        51960,
                        41513,
                        59650,
                        61451,
                        39800,
                        59961,
                        46199,
                        60025,
                        59571,
                        32240,
                        41514,
                        58615,
                        39801,
                        61229,
                        60002,
                        61309,
                        41515,
                        39802,
                        61230,
                        44153,
                        61294,
                        32245,
                        32289,
                        41516,
                        61446,
                        39803,
                        32244,
                        32345,
                        59996,
                        40192
	#endregion
                    };
            }
        }
        public static int[] GroundMounts
        {
            get
            {
                return new int[] {
                        #region Long List
                        23214, //Charger (Paladin epic mount)
		                581,
                        580,
                        579,
                        578,
                        472,
                        471,
                        470,
                        468,
                        459,
                        458,
                        8980,
                        8395,
                        8394,
                        6899,
                        6898,
                        6897,
                        6896,
                        6777,
                        6654,
                        6653,
                        6648,
                        61470,
                        47037,
                        46628,
                        61469,
                        61467,
                        61465,
                        61447,
                        61425,
                        60424,
                        60140,
                        60136,
                        60119,
                        60118,
                        60116,
                        60114,
                        59811,
                        59810,
                        59804,
                        59802,
                        59799,
                        59797,
                        59793,
                        59791,
                        59788,
                        59785,
                        59573,
                        59572,
                        55531,
                        54753,
                        51412,
                        50870,
                        50869,
                        49379,
                        49378,
                        49322,
                        48954,
                        48027,
                        43900,
                        43899,
                        43810,
                        43688,
                        42781,
                        42777,
                        42776,
                        41252,
                        39319,
                        39318,
                        39317,
                        39316,
                        39315,
                        36702,
                        35714,
                        35713,
                        35712,
                        35711,
                        35710,
                        35028,
                        35027,
                        35025,
                        35022,
                        35020,
                        35018,
                        34899,
                        34898,
                        34897,
                        34896,
                        34795,
                        34790,
                        34407,
                        34406,
                        33660,
                        33630,
                        30174,
                        29059,
                        28828,
                        24252,
                        24242,
                        23510,
                        23509,
                        23338,
                        23252,
                        23251,
                        23250,
                        23249,
                        23248,
                        23247,
                        23246,
                        23243,
                        23242,
                        23241,
                        23240,
                        23239,
                        23238,
                        23229,
                        23228,
                        23227,
                        23225,
                        23223,
                        23222,
                        23221,
                        23220,
                        23219,
                        22724,
                        22723,
                        22722,
                        22721,
                        22720,
                        22719,
                        22718,
                        22717,
                        18992,
                        18991,
                        18990,
                        18989,
                        18363,
                        17481,
                        17465,
                        17464,
                        17463,
                        17462,
                        17461,
                        17460,
                        17459,
                        17458,
                        17456,
                        17455,
                        17454,
                        17453,
                        17450,
                        17229,
                        16084,
                        16083,
                        16082,
                        16081,
                        16080,
                        16060,
                        16059,
                        16058,
                        16056,
                        16055,
                        15781,
                        15780,
                        15779,
                        10969,
                        10873,
                        10799,
                        10798,
                        10796,
                        10795,
                        10793,
                        10789
	#endregion
                    };
            }
        }
    }
    public static class AllowedChars
    {
        public static string String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
    }
    public class TempBlackListItem
    {
        public long GUID;
        public DateTime timeBlackListed;
        public TimeSpan blackListDuration;
        public TempBlackListItem(long GUID, DateTime timeBlackListed, TimeSpan blackListDuration)
        {
            this.GUID = GUID;
            this.timeBlackListed = timeBlackListed;
            this.blackListDuration = blackListDuration;
        }
    }
    public class Coordinate : ISerializable
    {
        public float X = 0;
        public float Y = 0;
        public float Z = 0;
        public GLocation Location
        {
            get
            {
                return new GLocation(X, Y, Z);
            }
        }
        public Coordinate(float X, float Y, float Z)
        {
            this.X = X;
            this.Y = Y;
            this.Z = Z;
        }
        public Coordinate(GLocation Coords)
        {
            X = Coords.X;
            Y = Coords.Y;
            Z = Coords.Z;
        }
        public Coordinate(SerializationInfo info, StreamingContext ctxt)
        {
            X = (float)info.GetValue("X", typeof(float));
            Y = (float)info.GetValue("Y", typeof(float));
            Z = (float)info.GetValue("Z", typeof(float));
        }
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("X", X);
            info.AddValue("Y", Y);
            info.AddValue("Z", Z);
        }
    }
    public class Coordinates : IEnumerable, ISerializable
    {
        private ArrayList allCoordinates = new ArrayList();
        public Coordinates(SerializationInfo info, StreamingContext ctxt)
        {
            allCoordinates = (ArrayList)info.GetValue("allCoordinates", typeof(ArrayList));
        }
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("allCoordinates", allCoordinates);
        }
        public Coordinate this[int index]
        {
            get
            {
                return (Coordinate)allCoordinates[index];
            }
            set
            {
                allCoordinates[index] = value;
            }
        }
        public Coordinates()
        {
            allCoordinates = new ArrayList();
        }
        public int Add(Coordinate a)
        {
            lock (allCoordinates)
            {
                return allCoordinates.Add(a);
            }
        }
        public void RemoveAt(int i)
        {
            lock (allCoordinates)
            {
                allCoordinates.RemoveAt(i);
            }
        }
        public int Count
        {
            get
            {
                return allCoordinates.Count;
            }
        }
        IEnumerator IEnumerable.GetEnumerator()
        {
            return new MemoryEnumerator(allCoordinates);
        }
        public class MemoryEnumerator : IEnumerator
        {
            private int cursor = -1;
            private ArrayList _Memories = null;
            public MemoryEnumerator(ArrayList Memories)
            {
                _Memories = Memories;
            }
            public bool MoveNext()
            {
                cursor++;
                return (cursor < _Memories.Count);
            }
            public void Reset()
            {
                cursor = -1;
            }
            public object Current
            {
                get
                {
                    try
                    {
                        return _Memories[cursor];
                    }
                    catch (IndexOutOfRangeException)
                    {
                        throw new InvalidOperationException("Index out of bounds.");
                    }
                }
            }
        }
    }
    public struct Node
    {
        public string Word;
        public Action Action;
        public long GUID;
        public Coordinate Coords;
        public string Name;
    }
    public enum PathRunMethod
    {
        BOUNCE,
        CIRCLE
    }
    public enum Action
    {
        NIL,
        AQUIRE,
        COMBAT,
        PATROL,
        MANEUVER,
        RECORD,
        RECORDPAUSE,
        LOAD,
        LOOT
    }
    public static class Random
    {
        public static string String(Int32 NumSpaces)
        {
            char[] ac = AllowedChars.String.ToCharArray();
            System.Random Random = new System.Random();
            System.Text.StringBuilder StringBuilder = new StringBuilder(NumSpaces, NumSpaces);
            for (Int32 i = 0; i < NumSpaces; i++)
            {
                StringBuilder.Append(ac[Random.Next(0, ac.Length)]);
            }
            return StringBuilder.ToString();
        }
        public static Int32 Int(Int32 MinValue, Int32 MaxValue)
        {
            System.Random Random = new System.Random();
            return Random.Next(MinValue, MaxValue);
        }
    }
    internal sealed class http
    {
        public static byte[] FileToByteArray(string file)
        {
            FileInfo fInfo = new FileInfo(file);
            long numBytes = fInfo.Length;
            FileStream fStream = new FileStream(file, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fStream);
            byte[] data = br.ReadBytes((int)numBytes);
            br.Close();
            fStream.Close();
            return data;
        }
        public delegate void httpInfoDelegate(String s);
        public event httpInfoDelegate onInformationMessage;
        private void Info(String s)
        {
            if (!object.Equals(null, onInformationMessage))
            {
                onInformationMessage(s);
            }
        }
        private static DateTime DateCompiled()
        {
            System.Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            DateTime d = new DateTime(
                v.Build * TimeSpan.TicksPerDay +
                v.Revision * TimeSpan.TicksPerSecond * 2
                ).AddYears(1999).AddHours(1);
            return d;
        }
        private static String AssemblyVersion
        {
            get
            {
                return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
            }
        }
        public string UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1";
        public CookieContainer CookieJar = new CookieContainer();
        private Hashtable getQueryStringParams(string url)
        {
            int queryStringStart = url.IndexOf("?");
            if (queryStringStart == -1) return new Hashtable();
            string queryString = url.Substring(queryStringStart + 1);
            Hashtable h = new Hashtable();
            string[] pairs = queryString.Split('&');
            foreach (string pair in pairs)
            {
                try
                {
                    string[] splitPair = pair.Split('=');
                    if (splitPair[0] == String.Empty || object.Equals(null, splitPair[0])) continue;
                    h[splitPair[0]] = splitPair[1];
                }
                catch
                {
                }
            }
            return h;
        }
        private StreamWriter addVar(StreamWriter sw, string boundary, string varName, string varValue)
        {
            string newLine = "\r\n";
            sw.Write("--" + boundary + newLine);
            sw.Write("Content-Disposition: form-data; name=\"" + varName + "\"");
            sw.Write(newLine);
            sw.Write(newLine);
            sw.Flush();
            sw.Write(varValue);
            sw.Write(newLine);
            sw.Flush();
            return sw;
        }
        private ArrayList normalizePostData(ArrayList Data)
        {
            ArrayList AllParams = new ArrayList();
            Type t_hashTable = typeof(System.Collections.Hashtable);
            Type t_stringArray = typeof(string[]);
            foreach (object o in Data)
            {
                Type t = o.GetType();
                if (t == t_hashTable)
                {
                    Hashtable h = (Hashtable)o;
                    foreach (DictionaryEntry de in h)
                    {
                        AllParams.Add(new string[2] { (string)de.Key, (string)de.Value });
                    }
                }
                if (t == t_stringArray)
                {
                    string[] s = (string[])o;
                    AllParams.Add(new string[2] { s[0], s[1] });
                }
            }
            return AllParams;
        }
        private MemoryStream getPostData(Hashtable files, ArrayList _allParams, string url, string boundary, FILE_COMPRESSION_METHODS CompressionMethod)
        {
            ArrayList allParams = normalizePostData(_allParams);
            MemoryStream postData = new MemoryStream();
            string newLine = "\r\n";
            StreamWriter sw = new StreamWriter(postData);
            if (!object.Equals(null, allParams))
            {
                foreach (string[] param in allParams)
                {
                    string fieldName = param[0];
                    string fieldValue = param[1];
                    if (fieldName == String.Empty || object.Equals(null, fieldName)) continue;
                    sw = addVar(sw, boundary, fieldName, fieldValue);
                }
            }
            Hashtable queryStringParams = getQueryStringParams(url);
            IDictionaryEnumerator en = queryStringParams.GetEnumerator();
            while (en.MoveNext())
            {
                sw = addVar(sw, boundary, en.Key.ToString(), en.Value.ToString());
            }
            if (!object.Equals(null, files))
            {
                foreach (DictionaryEntry de in files)
                {
                    string fieldName = (string)de.Key;
                    string fileName = (string)de.Value;
                    byte[] fileContents = FileToByteArray(fileName);

                    if (fileContents == null) { Info("Upload: couldnt read \"" + fileName + "\""); return null; } //couldnt read the file
                    int uSize = fileContents.Length;
                    string FileNameOnlyName = Path.GetFileName(fileName);

                    sw = addVar(sw, boundary, "md5_" + fieldName, MD5SUM(fileContents));
                    //write the file to the stream
                    sw.Write("--" + boundary + newLine);
                    sw.Write("Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"{2}", fieldName, Path.GetFileName(fileName), newLine);
                    sw.Write("Content-Type: application/octet-stream" + newLine + newLine);
                    sw.Flush();
                    postData.Write(fileContents, 0, fileContents.Length);
                    sw.Write(newLine);

                }
            }
            DateTime _datetime = DateTime.Now;
            string dateTimeNow = _datetime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            string dateTimeNowUTC = _datetime.ToUniversalTime().ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            sw = addVar(sw, boundary, "clientTime", dateTimeNow);
            sw = addVar(sw, boundary, "clientTimeUTC", dateTimeNowUTC);
            sw.Write("--{0}--{1}", boundary, newLine);
            sw.Flush();
            //byte[] b = postData.ToArray();
            //string s = System.Text.Encoding.UTF8.GetString(b);
            return postData;
        }
        private string MD5SUM(byte[] FileOrText) //Output: String<-> Input: Byte[] //
        {
            try
            {
                return BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(FileOrText)).Replace("-", "").ToLower();
            }
            catch
            {
                //DebugLine("MD5SUM: "+e.Message);
                return null; //the addon possibly does not exist
            }
        }
        public enum ENCODING_TYPES
        {
            APP_X_WWW_FORM_URLENCODED,
            MULTI_FORM_DATA
        }
        public enum REQUEST_METHODS
        {
            GET,
            POST
        }
        public enum FILE_COMPRESSION_METHODS
        {
            NONE,
            GZIP
        }
        public CredentialCache CredentialCache = new CredentialCache();
        public int Timeout = 43200000;
        public bool post(ref Response Response, string Url)
        {
            return post(ref Response, Url, null, null, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FILE_COMPRESSION_METHODS.NONE, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters)
        {
            return post(ref Response, Url, Parameters, null, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FILE_COMPRESSION_METHODS.NONE, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FILE_COMPRESSION_METHODS.NONE, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, ENCODING_TYPES.MULTI_FORM_DATA, REQUEST_METHODS.POST, this.Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, EncType, ReqMethod, this.Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout)
        {
            return post(ref Response, Url, Parameters, Files, this.UserAgent, EncType, ReqMethod, Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, "");
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent, string Referer)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, this.CookieJar, this.CredentialCache, FileCompressionMethods, Referer);
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent, string Referer, CookieContainer Cookies)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, Cookies, this.CredentialCache, FileCompressionMethods, Referer);
        }
        public bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, FILE_COMPRESSION_METHODS FileCompressionMethods, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, string UserAgent, string Referer, CookieContainer Cookies, CredentialCache CredentialCache)
        {
            return post(ref Response, Url, Parameters, Files, UserAgent, EncType, ReqMethod, Timeout, Cookies, CredentialCache, FileCompressionMethods, Referer);
        }
        private bool post(ref Response Response, string Url, ArrayList Parameters, Hashtable Files, string UserAgent, ENCODING_TYPES EncType, REQUEST_METHODS ReqMethod, int Timeout, CookieContainer Cookies, CredentialCache CredentialCache, FILE_COMPRESSION_METHODS FileCompressionMethods, string Referer)
        {

            if (!object.Equals(null, Url)) Info("URL: " + Url);
            if (!object.Equals(null, Files)) Info("Files: " + Files.Count.ToString());
            if (!object.Equals(null, EncType)) Info("Encode Type: " + EncType.ToString());
            if (!object.Equals(null, ReqMethod)) Info("Request Method: " + ReqMethod.ToString());
            if (!object.Equals(null, Referer) && !object.Equals(String.Empty, Referer)) Info("Referer: " + Referer);
            //Info(req.Headers.ToString());
            //Info(s2);

            System.Net.ServicePointManager.Expect100Continue = false;
            //string newLine = "\r\n";

            string boundary = Guid.NewGuid().ToString().Replace("-", "");
            MemoryStream postData = new MemoryStream();
            string urlEncoded = "";

            switch (EncType)
            {
                case ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED:
                    urlEncoded = Url + "?" + getPostDataUrlEncoded(Parameters, Url, boundary);
                    break;
                case ENCODING_TYPES.MULTI_FORM_DATA:
                    postData = getPostData(Files, Parameters, Url, boundary, FileCompressionMethods);
                    break;
            }


            if (EncType == ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED)
            {
                Url = urlEncoded;
            }

            HttpWebRequest req = (new MyWebRequest().GetWebRequest2(new System.Uri(Url)) as HttpWebRequest);
            switch (EncType)
            {
                case ENCODING_TYPES.APP_X_WWW_FORM_URLENCODED:
                    req.ContentType = "application/x-www-form-urlencoded;";
                    break;
                case ENCODING_TYPES.MULTI_FORM_DATA:
                    req.ContentType = "multipart/form-data; boundary=" + boundary;
                    break;
            }
            switch (ReqMethod)
            {
                case REQUEST_METHODS.GET:
                    req.Method = "GET";
                    break;
                case REQUEST_METHODS.POST:
                    req.Method = "POST";
                    break;
            }
            if (!object.Equals(null, Referer))
            {
                req.Referer = Referer;
            }
            req.UnsafeAuthenticatedConnectionSharing = true;
            req.CookieContainer = Cookies;

            if (!object.Equals(null, Cookies))
            {
                req.CookieContainer = Cookies;
            }
            if (!object.Equals(null, CredentialCache))
            {
                req.Credentials = CredentialCache;
            }
            req.UserAgent = UserAgent;
            req.AllowWriteStreamBuffering = false;
            req.Accept = "application/x-shockwave-flash,text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
            req.ContentLength = postData.Length;
            req.Timeout = Timeout;
            if (ReqMethod == REQUEST_METHODS.POST)
            {
                Stream oRequestStream = req.GetRequestStream();
                postData.Seek(0, SeekOrigin.Begin);

                int bytesSent = 0;
                int totalBytesSent = 0;
                int totalOutBytes = (int)postData.Length;
                byte[] buffer = new Byte[checked((uint)Math.Min(4096, (int)postData.Length))];
                while ((bytesSent = postData.Read(buffer, 0, buffer.Length)) != 0)
                {
                    oRequestStream.Write(buffer, 0, bytesSent);
                    totalBytesSent += bytesSent;
                    fireSendProgressEvent(totalBytesSent, (int)postData.Length);
                }
                oRequestStream.Close();
            }
            Info("Request Sent.  ( " + postData.Length.ToString("N0") + " Bytes )");

            HttpWebResponse lHttpWebResponse;
            Stream lHttpWebResponseStream;
            byte[] byteBuffer = new byte[1024];
            int bytesRead;
            try
            {
                lHttpWebResponse = (HttpWebResponse)req.GetResponse();

                Response.CharacterSet = lHttpWebResponse.CharacterSet;
                Response.ContentEncoding = lHttpWebResponse.ContentEncoding;
                Response.ContentType = lHttpWebResponse.ContentType;
                Response.Cookies = lHttpWebResponse.Cookies;
                Response.Headers = lHttpWebResponse.Headers;
                Response.IsFromCache = lHttpWebResponse.IsFromCache;
                Response.IsMutuallyAuthenticated = lHttpWebResponse.IsMutuallyAuthenticated;
                Response.LastModified = lHttpWebResponse.LastModified;
                Response.Method = lHttpWebResponse.Method;
                Response.ProtocolVersion = lHttpWebResponse.ProtocolVersion;
                Response.ResponseUri = lHttpWebResponse.ResponseUri;
                Response.Server = lHttpWebResponse.Server;
                Response.StatusCode = lHttpWebResponse.StatusCode;
                Response.StatusDescription = lHttpWebResponse.StatusDescription;

                lHttpWebResponseStream = req.GetResponse().GetResponseStream();
                Int32 ContentLength = Convert.ToInt32(lHttpWebResponse.ContentLength);
                int progress = 0;
                Response.Content = new MemoryStream();
                do
                {
                    bytesRead = lHttpWebResponseStream.Read(byteBuffer, 0, 1024);
                    Response.Content.Write(byteBuffer, 0, bytesRead);
                    progress += bytesRead;

                    if (progress <= ContentLength)
                    {
                        fireReceiveProgressEvent(progress, ContentLength);
                    }
                    else
                    {
                        fireReceiveProgressEvent(ContentLength, ContentLength);
                    }
                } while (bytesRead > 0);
                lHttpWebResponseStream.Close();
                postData.Close();
                lHttpWebResponse.Close();
                Info("Response Received.  ( " + ContentLength.ToString("N0") + " Bytes )");
                return true;
            }
            catch (Exception e)
            {
                Info(e.Message);
                return false;
            }

        }
        public class Response
        {
            public MemoryStream Content;
            public string CharacterSet;
            public string ContentType;
            public string ContentEncoding;
            public CookieCollection Cookies;
            public long ContentLength
            {
                get
                {
                    if (!object.Equals(null, Content))
                        return Content.Length;
                    else return -1;
                }
            }
            public WebHeaderCollection Headers;
            public bool IsFromCache;
            public bool IsMutuallyAuthenticated;
            public DateTime LastModified;
            public string Method;
            public Version ProtocolVersion;
            public Uri ResponseUri;
            public string Server;
            public HttpStatusCode StatusCode;
            public string StatusDescription;
            public override string ToString()
            {
                if (!object.Equals(null, Content))
                    return System.Text.Encoding.UTF8.GetString(Content.ToArray());
                else return "";
            }
        }
        private string getPostDataUrlEncoded(ArrayList allParams, string url, string boundary)
        {
            string postData = "";
            bool first = true;
            if (!object.Equals(null, allParams))
            {
                foreach (string[] param in allParams)
                {

                    string fieldName = param[0];
                    if (fieldName == String.Empty) continue;
                    if (fieldName == String.Empty || object.Equals(null, fieldName)) continue;
                    string fieldValue = param[1];
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        postData += "&";
                    }
                    postData += fieldName + "=" + fieldValue;
                }
            }
            Hashtable queryStringParams = getQueryStringParams(url);
            IDictionaryEnumerator en = queryStringParams.GetEnumerator();
            while (en.MoveNext())
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    postData += "&";
                }
                postData += en.Key + "=" + en.Value;
            }
            DateTime _datetime = DateTime.Now;
            string dateTimeNow = _datetime.ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            string dateTimeNowUTC = _datetime.ToUniversalTime().ToString("s", DateTimeFormatInfo.InvariantInfo) + "Z";
            if (first)
            {
                first = false;
            }
            else
            {
                postData += "&";
            }
            postData += "clientTime=" + dateTimeNow;
            if (first)
            {
                first = false;
            }
            else
            {
                postData += "&";
            }
            postData += "clientTimeUTC=" + dateTimeNowUTC;
            return postData;
        }
        public delegate void ReceiveProgressDelegate(int CurrentPosition, int TotalSize);
        public event ReceiveProgressDelegate onReceiveProgress;
        private void fireReceiveProgressEvent(int CurrentPosition, int TotalSize)
        {
            if (!object.Equals(null, onReceiveProgress))
            {
                onReceiveProgress(CurrentPosition, TotalSize);
            }
        }
        public delegate void SendProgressDelegate(int CurrentPosition, int TotalSize);
        public event SendProgressDelegate onSendProgress;
        private void fireSendProgressEvent(int CurrentPosition, int TotalSize)
        {
            if (!object.Equals(null, onSendProgress))
            {
                onSendProgress(CurrentPosition, TotalSize);
            }
        }
    }
    internal class AcceptAllCertificatePolicy : ICertificatePolicy
    {
        public AcceptAllCertificatePolicy()
        {
        }
        public bool CheckValidationResult(ServicePoint sPoint,
           System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Net.WebRequest wRequest, int certProb)
        {
            // Always accept
            return true;
        }
    }
    internal class MyWebRequest : System.Net.WebClient
    {
        protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            HttpWebRequest webRequest = (HttpWebRequest)base.GetWebRequest(uri);
            webRequest.KeepAlive = false;
            return webRequest;
        }
        public System.Net.WebRequest GetWebRequest2(Uri uri)
        {
            return GetWebRequest(uri);
        }
    }
    #endregion
}
Mit Zitat antworten
 
Alt 08.03.2009
Registriert seit: Jun 2008
Beiträge: 88
 
Schlachtrufer

Offline
schon geklärt
Mit Zitat antworten
 
Alt 08.03.2009
Benutzerbild von Mr. Hankey
Registriert seit: Jan 2008
Beiträge: 1.103
 
Member

Offline
Zelina einfach diese 3 Zeilen in der Combat Class region Löschen

Code:
#region Combat Class
//I R USELESS COMMENT LINE < REPLACE ME WITH COMBAT CLASS
using System;
using System.Threading;
using Glider.Common.Objects;
«Erwarte nicht das andere mehr Zeit in die Antwort, als du in deine Frage investieren!»

Mit Zitat antworten
 
Alt 10.03.2009
Benutzerbild von Relaxe
Registriert seit: Mar 2008
Beiträge: 127
Ort: Nagrand
 
Member

Offline
Also bei mir läufts nun auch mit nem eigenen Profil aber ich hätte trotzdem noch eine Frage: Undzwar fliegt er wunderbar die Waypoints und wenn er dann ein Erz sieht fliegt er auch hin. Da liegt machmal das Problem, die Erze sind teilweise an irgentwechen Kanten oder so und der Toon fliegt nicht immer GENAU über das Erz und baut es dann ab sondern steht bei mir in dem Falle immer an der Klippe und das Erz nur ein paar Meter unter ihm

Kann man irgentwie einstellen, dass er sich erst genau ausrichten soll, sprich über dem Erz und dann erst abmountet?
Mit Zitat antworten
Antwort


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen
Ansicht



Willkommen zurück
Foren Statistik
Mitglieder: 54,125
Threads: 35,506
Posts: 187,396

Neustes Mitglied: dizzyshtolze5767
Werbung