Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Guild Wars > GW Bots
You last visited: Today at 09:02

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Private script engine source release

Discussion on Private script engine source release within the GW Bots forum part of the Guild Wars category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Oct 2005
Posts: 2,485
Received Thanks: 218
Private script engine source release

Hello you guys,

in this thread I want to release my private script engine's source code that I have been using on and off for some years. As it has become heavily outdated with the big update and I don't bot anymore - I just play the game for fun from time to time - I think it is time to release the source code, as it may help some interested fellas with creating their own bot.
This script engine originated in a time when botting guild wars was not about money (see my registration date) but about helping each other with learning a new skill - coding. The whole thing took off when Harko released Requia and GW bots became much more than some inept macro scripts. I don't know how many of you remember this time but even back then some idiots destroyed this wonderful thing by trying to milk other peoples work for money. My journey started with creating the first basic lua scripts and somehow ended by recoding the whole damn script engine (in a very basic state, of course!). It never really was about botting a game, this was merely a good motivator. It was about learning and understanding. This was always very important to me and when Harko's Requia basically caused a huge divide in the Guild Wars botting community because some idiots realised there was big bank to be made, I withdrawed from the whole thing and went private. But deep down in my heart I always missed the times when professional developers took their time to teach totally inept morons like me the very basic principals of programming - hence the name of this script engine: Aeterna.
So all credit belongs to Harko - thank you!

Another point I want to make regarding safety: I never had a single account banned. And I always disregarded alle safety measures, because I would not really care if I got banned. I botted on up to 4 accounts simultaneously from a single IP adress without a VPN. I let the bots do their work during my 24h shifts, I traded big amounts of rares and money with my main account (making it 5 accounts from a single IP simultaneously) and even rushed my newly created bot account with my main to elona.
Why do I tell you this? Because I think that anets security measures are much more basic than everybody thinks. I do not think it has something to do with bot run time, VPN or hardware id - I think the common denominator of all the people that got banned is the GWCA. So create your own little thing and be safe.

Now to the code: it is more than 5 years old and I never had any programming classes. Tought it all to myself with the help of many wonderful people. Went on and off through the years so please bear with me when some passages do not seem to make any sense or are coded very badly. In the end it all worked, even if I did not always understood what I just did.
Concept is as follows: Aeterna is a lua script engine. The ingame variables and functions are registered to the lua engine, the bot itself is written in lua. On attaching Aeterna to a Guild Wars process, it injects the library from where the ingame functions (such as UseSkill) are called within the Guild Wars address space. So the hook is written in C++ to make use of inline assembly. Communication between Aeterna an the attached Guild Wars process works by sending specified windowmessages and overriding the WindowProc function in both Guild Wars and Aeterna.

The gui:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
using Microsoft.Win32;
using LuaInterface;
using AutoItX3Lib;
using System.Runtime.InteropServices;



namespace Pellax
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.CreateHandle();
            collectProcessesTimer.Tick += new EventHandler(_CollectProcesses);
            refreshGridTimer.Tick += new EventHandler(_refreshGrid);
            Event_OnScriptEnd += new OnScriptEndHandler(ScriptEnd);
            CollectProcesses();
            FormClosing += Form1_Closing;
        }

        System.Windows.Forms.Timer refreshGridTimer = new System.Windows.Forms.Timer();
        private void _refreshGrid(object sender, EventArgs e)
        {
            propertyGrid1.Refresh(); //method for the event handler in Form1 constructor
        }
        private void refreshGrid()
        {
            refreshGridTimer.Interval = 250;
            refreshGridTimer.Start();
        }

        [DllImport("user32.dll")]
        static extern int SetWindowText(IntPtr hWnd, string text);

        //the user defined message constants for interprocess communication. There are the same definitions in GwHook.dll

        const int AM_LIBRARYFREED = 0x1335;
        const int AM_UNLOADLIBRARY = 0x1336;
        const int AM_AETERNAMESSAGEDEFAULT = 0x1337;
        const int AM_ERROR = 0x1338;
        const int AM_COMINFO = 0x1339;
        const int AM_COMESTABLISHED = 0x1340;
        const int AM_MOVETO = 0x1341;
        const int AM_TRAVEL = 0x1342;
        const int AM_USESKILL = 0x1343;
        const int AM_PLAYERID = 0x1344;
        const int AM_LANGDIS = 0x1345;
        const int AM_ENTERMISSION = 0x1346;
        const int AM_TARGETNEXTALLY = 0x1347;
        const int AM_DROPITEM = 0x1348;
        const int AM_LOOTITEM = 0x1349;
        const int AM_TARGETNPC = 0x1350;
        const int AM_TARGETNEARESTITEM = 0x1351;
        const int AM_TARGETNEARESTALLY = 0x1352;
        const int AM_TARGETNEARESTENEMY = 0x1353;
        const int AM_TARGETATTACK = 0x1354;
        const int AM_SELLITEM = 0x1355;
        const int AM_GETITEMVALUE = 0x1356;
        const int AM_RECEIVEITEMVALUE = 0x1357;
        const int AM_SELLCOMPLETE = 0x1358;
        const int AM_IDENTITEM = 0x1359;
        const int AM_IDENTITEMCOMPLETE = 0x1360;
        const int AM_MOVETOEXACT = 0x1361;
        const int AM_MOVETOINFOX = 0x1362;
        const int AM_MOVETOINFOY = 0x1363;
        const int AM_TARGETNEXTENEMY = 0x1364;
        const int AM_TARGETNEXTITEM = 0x1365;
        const int AM_SALVAGEITEM = 0x1366;
        const int AM_SALVAGEITEMPTR = 0x1367;

        int lastMessage;
        int info1;
        int info2;
        protected override void WndProc(ref Message m) //override WndProc of Form1 to look for userdefined messages
        {
            switch (m.Msg)
            {
                case AM_AETERNAMESSAGEDEFAULT:
                    Print("AM_AETERNAMESSAGEDEFAULT RECEIVED\n");
                    lastMessage = (int)AM_AETERNAMESSAGEDEFAULT;
                    Print(m.WParam.ToString());
                    Print("\n");
                    Print(m.LParam.ToString());
                    Print("\n");
                    break;
                case AM_ERROR:
                    Print("An error occured.\n");
                    lastMessage = (int)AM_ERROR;
                    break;
                case AM_COMESTABLISHED:
                    Print("Communication between Aeterna and Guild Wars successfully established.\n");
                    lastMessage = (int)AM_COMESTABLISHED;
                    break;
                case AM_LIBRARYFREED:
                    Print("GwHook successfully unloaded.\n");
                    break;
                case AM_RECEIVEITEMVALUE:
                    gm.ItemValue = (int)m.WParam;
                    lastMessage = (int)AM_RECEIVEITEMVALUE;
                    break;
                case AM_SELLCOMPLETE:
                    lastMessage = (int)AM_SELLCOMPLETE;
                    break;
            }

            base.WndProc(ref m); //call the regular WndProc method after looking for custom messages in order to keep the Window alive
        }

        delegate void OnScriptEndHandler();
        OnScriptEndHandler Event_OnScriptEnd;

        //------------------------##############Process Collection#################------------------------------------ 
        System.Windows.Forms.Timer collectProcessesTimer = new System.Windows.Forms.Timer();
        private void CollectProcesses()
        {
            collectProcessesTimer.Interval = 1000;
            collectProcessesTimer.Start();
        }
        private void _CollectProcesses(object source, EventArgs e)
        {
            Process[] proc = Process.GetProcessesByName("gw");

            if (proc.Length != 0)
            {
                for (int i = 0; i < proc.Length; i++)
                {
                    ListViewItem item = new ListViewItem();
                    item.Tag = proc[i];                                     //The ListViewItem is given the process object as a tag. 
                                                                            //This is relevant for attaching, closing and removing routines.
                    item.Text = "Guild Wars (" + proc[i].Id.ToString() + ")";
                    AddListViewItem(item);
                }
            }
            RemoveListViewItems();                                          //The routine that checks for dead processes and removes them from the list
        }
        private void AddListViewItem(ListViewItem item)
        {
            ListViewItem lwitem = listView1.FindItemWithText(item.Text);
            if (lwitem == null)
                listView1.Items.Add(item);
        }
        private void RemoveListViewItems()
        {
            ListView.ListViewItemCollection lwitems = new ListView.ListViewItemCollection(listView1);

            if (lwitems.Count == 0)
                return;

            for (int i = 0; i < lwitems.Count; i++)  //Check all gathered LVItems (lvitems above)
            {
                Process process = (Process)lwitems[i].Tag;

                if (process != null && process.HasExited)
                    listView1.Items.Remove(lwitems[i]);
            }
        }
        //------------------------##############Process Collection#################--------------------------------------




        //------------------------##############File Handling Routines################-----------------------------------
        bool saved = false;
        bool changed = false;
        bool attached = false;
        bool injected = false;
        string script = "";
        string currentFile = "";
        string GWPath = ""; //currently suspended due to failed startup path acquisition via registry
        GwMemory gm;
        Communicator com;
        ValueStorageClass vsc; //object for the propertygrid
        Lua luaVM;
        AutoIt au3;
        Thread LuaThread;       //the lua engine runs in this thread
        Process guildWarsProcess;

        private void OpenLuaDoc()
        {
            if (!saved && richTextBox2.Text != "")
            {
                DialogResult d = MessageBox.Show("Content not saved yet. Do now?", "", MessageBoxButtons.YesNo);

                if (d == DialogResult.Yes)
                {
                    SaveLuaDoc();
                    return;
                }
            }

            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "LUA files (*.lua)|*.lua";
            ofd.InitialDirectory = Application.StartupPath;

            if (ofd.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            else
            {
                try
                {
                    Stream fileStream = new FileStream(ofd.FileName, FileMode.Open);
                    FileInfo fileInfo = new FileInfo(ofd.FileName);

                    richTextBox2.LoadFile(fileStream, RichTextBoxStreamType.PlainText);
                    fileStream.Close();
                }
                catch (Exception e)
                {
                    MessageBox.Show("ERROR OPENING FILE.\n" + e.Message);
                }
            }
            currentFile = ofd.FileName;
            changed = false;
        }
        private void SaveLuaDoc()
        {
            if (saved)
                return;
            if (!changed)
                return;
            if (currentFile == "")
            {
                SaveLuaDocAs();
                return;
            }
            if (currentFile == "NEWLUADOCCREATED")
            {
                SaveLuaDocAs();
                return;
            }
            try
            {
                Stream fileStream = new FileStream(currentFile, FileMode.Create);

                FileInfo fileInfo = new FileInfo(currentFile);

                this.richTextBox2.SaveFile(fileStream, RichTextBoxStreamType.PlainText);

                fileStream.Close();

            }
            catch (Exception e)
            {
                MessageBox.Show("ERROR SAVING FILE.\n" + e.Message);
            }
            saved = true;
            changed = false;
        }
        private void SaveLuaDocAs()
        {
            if (richTextBox2.Text == "")
                return;
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.AddExtension = true;
            sfd.CreatePrompt = false;
            sfd.Filter = "LUA Files (*.lua)|*.lua";
            sfd.InitialDirectory = Application.StartupPath;

            if (sfd.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            else
            {
                try
                {
                    Stream fileStream = new FileStream(sfd.FileName, FileMode.Create);

                    FileInfo fileInfo = new FileInfo(sfd.FileName);

                    this.richTextBox2.SaveFile(fileStream, RichTextBoxStreamType.PlainText);

                    fileStream.Close();

                }
                catch (Exception e)
                {
                    MessageBox.Show("ERROR SAVING FILE.\n" + e.Message);
                }
            }
            currentFile = sfd.FileName;
            changed = false;
            saved = true;
        }
        private void NewLuaDoc()
        {
            if (!saved && richTextBox2.Text != "")
            {
                DialogResult d = MessageBox.Show("Content not saved yet. Do now?", "", MessageBoxButtons.YesNo);

                if (d == DialogResult.Yes)
                {
                    SaveLuaDoc();
                    return;
                }
            }

            currentFile = "NEWLUADOCCREATED";
            richTextBox2.Text = "";
        }

        private void richTextBox2_TextChanged(object sender, EventArgs e)
        {
            changed = true;
            saved = false;
            script = richTextBox2.Text;
        }

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenLuaDoc();
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveLuaDoc();
        }

        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveLuaDocAs();
        }

        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NewLuaDoc();
        }

        //------------------------##############File Handling Routines################-----------------------------------






        //------------------------##############GUI related routines  ################-----------------------------------
        private void Attach()
        {
            if (attached)
                return;

            ListView.SelectedListViewItemCollection lvsi = new ListView.SelectedListViewItemCollection(listView1);

            if (lvsi.Count == 0)
            {
                Print("No Guild Wars process selected.\n");
                return;
            }

            guildWarsProcess = (Process)lvsi[0].Tag;  //The process object (tag) of the LVItems is "extracted"
                                                              //Hard-coded, but multi select is disabled so IDGAF  
            try
            {
                this.Text = "Aeterna - v1.0: " + guildWarsProcess.MainWindowTitle + " " + guildWarsProcess.Id.ToString();
                SetWindowText(guildWarsProcess.MainWindowHandle, "Guild Wars: " + guildWarsProcess.Id.ToString());
                gm = new GwMemory(guildWarsProcess.Id);
                gm.readAdresses = new Thread(new ThreadStart(gm.ReadAdresses));
                gm.readAdresses.IsBackground = true;
                gm.readAdresses.Start();
                vsc = new ValueStorageClass(gm);
                refreshGrid();
                propertyGrid1.SelectedObject = vsc;

                if (checkBox1.Checked)
                {
                    Process thisProcess = Process.GetCurrentProcess();

                    com = new Communicator(thisProcess.MainWindowHandle, guildWarsProcess.MainWindowHandle);
                    int res = Communicator.DllInject(guildWarsProcess.Id, thisProcess.MainWindowHandle, guildWarsProcess.MainWindowHandle);

                    if (res != 0x1337)
                    {
                        Print("Injection faild.\n");
                        injected = false;
                        return;
                    }

                    bool sendret = com.SendMessageToChildParam(AM_COMINFO, thisProcess.Id, 0); //This sends a parameterized message to the GwHook. Thusly the GwHook 
                                                                                               //can retrieve the windowhandle to its master process. This establishes 
                                                                                               //the communication between this engine and the GwHook. 
                    if (!sendret)
                    {
                        Print("Error: could not send COMINFO to child. Only master-to-child-communication may be possible.\n");
                    }
                    injected = true;                                                                            
                }
                button4.Enabled = false;
                button5.Enabled = true;
                attached = true;
            }
            catch (Exception e)
            {
                Print(e.Message+"\n");
            }
        }

        private void Detach()
        {
            button4.Enabled = true;
            button5.Enabled = false;
            propertyGrid1.SelectedObject = null;
            gm.readAdresses.Abort();
            gm = null;
            vsc = null;
            if (injected)
            {
                com.SendMessageToChild(AM_UNLOADLIBRARY);
                injected = false;
            }
            attached = false;  //reset everything to allow another process to be selected. Unloading the library currently not working. 
        }
        private void RunScript()
        {
            try {
                LuaThread = new Thread(new ThreadStart(RunEngine));
                LuaThread.IsBackground = true;
                LuaThread.Start();
                button3.Enabled = true;
                button2.Enabled = false;
            }
            catch (Exception e)
            {
                Print(e.Message + "\n");
            }
        }
        private void EndScript()
        {
            LuaThread.Abort();
            button3.Enabled = false;
            button2.Enabled = true;
        }
        private void ClearConsole()
        {
            richTextBox1.Text = "";
        }       
        private void StartNewProcess()
        {
            OpenFileDialog dlgFileOpen = new OpenFileDialog();
            dlgFileOpen.InitialDirectory = GWPath; //not working properly, see above
            dlgFileOpen.Filter = "Guild Wars|gw.exe";
            if (dlgFileOpen.ShowDialog() == DialogResult.OK)
            {
                string exePath = dlgFileOpen.FileName;
                Process proc = new Process();
                proc.StartInfo.FileName = exePath;
                proc.Start();
            }
        }
        private void CloseSelectedProcess()
        {
            ListView.SelectedListViewItemCollection lvic = new ListView.SelectedListViewItemCollection(listView1);
            if (lvic.Count == 0)
            {
                Print("No Guild Wars process selected.\n");
                return;
            }

            DialogResult dialogResult = MessageBox.Show("Are you sure you want to close the process?", "", MessageBoxButtons.YesNo);
            if (dialogResult == DialogResult.Yes)
            {
                Process po = (Process)lvic[0].Tag;
                if (!po.HasExited)
                {
                    po.Kill();
                    lvic[0].Remove();
                }
            }
        }

        private delegate void PrintEventHandler(string text);
        public void Print(string text)
        {
            if (richTextBox1.InvokeRequired)
            {
                PrintEventHandler peh = new PrintEventHandler(Print);
                richTextBox1.BeginInvoke(peh, text);
            }
            else
            {
                richTextBox1.AppendText(text);
            }
        } //method for displaying a string in the Aeterna console

        
        private delegate void ScriptEndHandler(); //is executed on script end. sets the buttons and terminates the lua related background threads
        private void ScriptEnd()
        {
            if (this.InvokeRequired)
            {
                ScriptEndHandler seh = new ScriptEndHandler(ScriptEnd);
                this.BeginInvoke(seh);
            }
            else
            {
                button2.Enabled = true;
                button3.Enabled = false;
                startToolStripMenuItem.Enabled = true;
                stopToolStripMenuItem.Enabled = false;
            }
            LuaThread.Abort();
        }

        //------------------------##############GUI related routines  ################-----------------------------------

        private void RunEngine()
        {
            try
            {
                luaVM = new Lua();
                au3 = new AutoIt();

                luaVM.RegisterFunction("Send", au3, au3.GetType().GetMethod("Send"));
                luaVM.RegisterFunction("Sleep", au3, au3.GetType().GetMethod("Sleep"));
                luaVM.RegisterFunction("ControlSend", au3, au3.GetType().GetMethod("ControlSend"));
                luaVM.RegisterFunction("ControlClick", au3, au3.GetType().GetMethod("ControlClick"));
                luaVM.RegisterFunction("RandomSleep", au3, au3.GetType().GetMethod("RandomSleep"));
                luaVM.RegisterFunction("Random", au3, au3.GetType().GetMethod("Random"));
                luaVM.RegisterFunction("PixelGetColor", au3, au3.GetType().GetMethod("PixelGetColor"));
                luaVM.RegisterFunction("PixelSearch", au3, au3.GetType().GetMethod("PixelSearch"));
                luaVM.RegisterFunction("WinMove", au3, au3.GetType().GetMethod("WinMove"));
                luaVM.RegisterFunction("WinSize", au3, au3.GetType().GetMethod("WinSize"));
                luaVM.RegisterFunction("SetOps", au3, au3.GetType().GetMethod("SetOps"));
                luaVM.RegisterFunction("Print", this, this.GetType().GetMethod("Print"));
                luaVM.RegisterFunction("WinSetTitle", au3, au3.GetType().GetMethod("WinSetTitle"));
                luaVM.RegisterFunction("MouseMove", au3, au3.GetType().GetMethod("MouseMove"));
                luaVM.RegisterFunction("WinActivate", au3, au3.GetType().GetMethod("WinActivate"));
                luaVM.RegisterFunction("WinActive", au3, au3.GetType().GetMethod("WinActive"));
                luaVM.RegisterFunction("GetLastMessage", this, this.GetType().GetMethod("GetLastMessage"));
                luaVM.RegisterFunction("SendMessage", this, this.GetType().GetMethod("SendMessage"));
                luaVM.RegisterFunction("MoveTo", this, this.GetType().GetMethod("MoveTo"));
                luaVM.RegisterFunction("Travel", this, this.GetType().GetMethod("Travel"));
                luaVM.RegisterFunction("DumpAddresses", this, this.GetType().GetMethod("DumpAddresses"));
                luaVM.RegisterFunction("SetTitle", this, this.GetType().GetMethod("SetTitle"));
                luaVM.RegisterFunction("CloseGw", this, this.GetType().GetMethod("CloseGw"));
                luaVM.RegisterFunction("MoveToExact", this, this.GetType().GetMethod("MoveToExact"));
                //luaVM.RegisterFunction("ShutdownStandBy", this, this.GetType().GetMethod("ShutdownStandBy"));

                luaVM.RegisterFunction("UseSkill", this, this.GetType().GetMethod("UseSkill"));
                luaVM.RegisterFunction("EnterMission", this, this.GetType().GetMethod("EnterMission"));
                luaVM.RegisterFunction("TargetNextAlly", this, this.GetType().GetMethod("TargetNextAlly"));
                luaVM.RegisterFunction("DropItem", this, this.GetType().GetMethod("DropItem"));
                luaVM.RegisterFunction("LootItem", this, this.GetType().GetMethod("LootItem"));
                luaVM.RegisterFunction("TargetNpc", this, this.GetType().GetMethod("TargetNpc"));
                luaVM.RegisterFunction("TargetNearestItem", this, this.GetType().GetMethod("TargetNearestItem"));
                luaVM.RegisterFunction("TargetNearestAlly", this, this.GetType().GetMethod("TargetNearestAlly"));
                luaVM.RegisterFunction("TargetNearestEnemy", this, this.GetType().GetMethod("TargetNearestEnemy"));
                luaVM.RegisterFunction("AttackTarget", this, this.GetType().GetMethod("AttackTarget"));
                luaVM.RegisterFunction("TerminateScript", this, this.GetType().GetMethod("TerminateScript"));
                luaVM.RegisterFunction("SellItem", this, this.GetType().GetMethod("SellItem"));
                luaVM.RegisterFunction("TargetNextEnemy", this, this.GetType().GetMethod("TargetNextEnemy"));
                luaVM.RegisterFunction("TargetNextItem", this, this.GetType().GetMethod("TargetNextItem"));

                luaVM.RegisterFunction("GetItem", gm, gm.GetType().GetMethod("GetItem"));
                luaVM.RegisterFunction("GetItemValue", this, this.GetType().GetMethod("GetItemValue"));
                luaVM.RegisterFunction("ItemID", this, this.GetType().GetMethod("ItemID"));
                luaVM.RegisterFunction("ItemRarity", this, this.GetType().GetMethod("ItemRarity"));
                luaVM.RegisterFunction("ItemQuantity", this, this.GetType().GetMethod("ItemQuantity"));
                luaVM.RegisterFunction("ItemModelID", this, this.GetType().GetMethod("ItemModelID"));
                luaVM.RegisterFunction("ItemValue", this, this.GetType().GetMethod("ItemValue"));
                luaVM.RegisterFunction("SellItem", this, this.GetType().GetMethod("SellItem"));
                luaVM.RegisterFunction("IdentItem", this, this.GetType().GetMethod("IdentItem"));
                luaVM.RegisterFunction("SalvageItem", this, this.GetType().GetMethod("SalvageItem"));

                luaVM.RegisterFunction("PlayerX", this, this.GetType().GetMethod("PlayerX"));
                luaVM.RegisterFunction("PlayerXMovementSpeed", this, this.GetType().GetMethod("PlayerXMovementSpeed"));
                luaVM.RegisterFunction("PlayerY", this, this.GetType().GetMethod("PlayerY"));
                luaVM.RegisterFunction("PlayerYMovementSpeed", this, this.GetType().GetMethod("PlayerYMovementSpeed"));
                luaVM.RegisterFunction("PlayerHp", this, this.GetType().GetMethod("PlayerHp"));
                luaVM.RegisterFunction("PlayerHpMax", this, this.GetType().GetMethod("PlayerHpMax"));
                luaVM.RegisterFunction("PlayerEp", this, this.GetType().GetMethod("PlayerEp"));
                luaVM.RegisterFunction("PlayerEpMax", this, this.GetType().GetMethod("PlayerEpMax"));
                luaVM.RegisterFunction("PlayerRegen", this, this.GetType().GetMethod("PlayerRegen"));
                luaVM.RegisterFunction("PlayerIsDead", this, this.GetType().GetMethod("PlayerIsDead"));
                luaVM.RegisterFunction("PlayerLevel", this, this.GetType().GetMethod("PlayerLevel"));
                luaVM.RegisterFunction("PlayerId", this, this.GetType().GetMethod("PlayerId"));
                luaVM.RegisterFunction("PlayerSpellId", this, this.GetType().GetMethod("PlayerSpellId"));
                luaVM.RegisterFunction("PlayerGold", this, this.GetType().GetMethod("PlayerGold"));
                luaVM.RegisterFunction("PlayerGoldStash", this, this.GetType().GetMethod("PlayerGoldStash"));
                luaVM.RegisterFunction("PlayerInMission", this, this.GetType().GetMethod("PlayerInMission"));
                luaVM.RegisterFunction("PlayerTownId", this, this.GetType().GetMethod("PlayerTownId"));

                luaVM.RegisterFunction("TargetX", this, this.GetType().GetMethod("TargetX"));
                luaVM.RegisterFunction("TargetXMovementSpeed", this, this.GetType().GetMethod("TargetXMovementSpeed"));
                luaVM.RegisterFunction("TargetY", this, this.GetType().GetMethod("TargetY"));
                luaVM.RegisterFunction("TargetYMovementSpeed", this, this.GetType().GetMethod("TargetYMovementSpeed"));
                luaVM.RegisterFunction("TargetHp", this, this.GetType().GetMethod("TargetHp"));
                luaVM.RegisterFunction("TargetLevel", this, this.GetType().GetMethod("TargetLevel"));
                luaVM.RegisterFunction("TargetType", this, this.GetType().GetMethod("TargetType"));
                luaVM.RegisterFunction("TargetId", this, this.GetType().GetMethod("TargetId"));
                luaVM.RegisterFunction("TargetFaction", this, this.GetType().GetMethod("TargetFaction"));
                luaVM.RegisterFunction("TargetPrimaryProfession", this, this.GetType().GetMethod("TargetPrimaryProfession"));
                luaVM.RegisterFunction("TargetSecondaryProfession", this, this.GetType().GetMethod("TargetSecondaryProfession"));
                luaVM.RegisterFunction("TargetSpellId", this, this.GetType().GetMethod("TargetSpellId"));
                luaVM.RegisterFunction("TargetIsCasting", this, this.GetType().GetMethod("TargetIsCasting"));
                luaVM.RegisterFunction("TargetDistance", this, this.GetType().GetMethod("TargetDistance"));
            }
            catch (Exception e)
            {
                Print(e.Message + "\n");
            }
            try
            {
                au3.SetOps(); //sets certain au3 options right, e.g. window title matchmode and others, necessary for ControlSend/Click to work properly
                Print("LuaEngine: " + "Starting script execution" + " - " + DateTime.Now + "." + "\n");
                luaVM.DoString(script); //script is a string above, that gets redefined when the richtextbox text changes
            }
            catch (ThreadAbortException tae)
            {
                Print("LuaEngine error: " + tae.Message + " - " + DateTime.Now + "\n");
                luaVM = null;
                au3 = null;
                Event_OnScriptEnd.Invoke();
                LuaThread.Abort();
                return;
            }
            catch (LuaException le)
            {
                Print("LuaEngine error: " + le.Message + " - " + DateTime.Now + "." + "\n");
                luaVM = null;
                au3 = null;
                Event_OnScriptEnd.Invoke();
                LuaThread.Abort();
                return;
            }
            catch (Exception e)
            {
                Print("LuaEngine error: " + e.Message + DateTime.Now + "." + "\n");
                luaVM = null;
                au3 = null;
                Event_OnScriptEnd.Invoke();
                LuaThread.Abort();
                return;
            }
            Print("LuaEngine: Script execution successfully ended - " + DateTime.Now + "." + "\n");
            au3 = null;
            luaVM = null;
            Event_OnScriptEnd.Invoke();
            LuaThread.Abort();
            return;
        }

        //these functions are registered in the luaVM above. See RunEngine() method. 

        public void ShutdownStandyBy()
        {
            Application.SetSuspendState(PowerState.Hibernate, true, true);
        }

        public void CloseGw()
        {
            if (guildWarsProcess != null)
                guildWarsProcess.Kill();
        }

        public float PlayerX()
        {
            return gm.PlayerX;
        }
        public float PlayerXMovementSpeed()
        {
            return gm.PlayerXMovementSpeed;
        }
        public float PlayerY()
        {
            return gm.PlayerY;
        }
        public float PlayerYMovementSpeed()
        {
            return gm.PlayerYMovementSpeed;
        }
        public int PlayerHp()
        {
            return ((int)gm.PlayerHpCurrent * gm.PlayerHpMax);
        }
        public int PlayerHpMax()
        {
            return gm.PlayerHpMax;
        }
        public int PlayerEp()
        {
            return ((int)gm.PlayerEpCurrent * gm.PlayerEpMax);
        }
        public int PlayerEpMax()
        {
            return gm.PlayerEpMax;
        }
        public int PlayerIsDead()
        {
            if (gm.PlayerHpCurrent == 0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
        public float PlayerRegen()
        {
            return gm.PlayerRegen;
        }
        public int PlayerLevel()
        {
            return gm.PlayerLevel;
        }
        public int PlayerId()
        {
            return gm.PlayerID;
        }
        public int PlayerSpellId()
        {
            return gm.PlayerSpellId;
        }
        public int PlayerGold()
        {
            return gm.PlayerGold;
        }
        public int PlayerGoldStash()
        {
            return gm.PlayerGoldStash;
        }
        public int GetLastMessage()
        {
            if (com == null)
            {
                return 0;
            }
            return lastMessage;
        }
        public int SendMessage(int target, uint Message)
        {
            if (com == null)
                return -1;
            if (target == 0)
            {
                com.SendMessageToMaster(Message);
                return 0;
            }
            if (target == 1)
            {
                com.SendMessageToChild(Message);
                return 1;
            }
            else
            {
                return -1;
            }
        }
        public int PlayerInMission()
        {
            return gm.PlayerInMission;
        }
        public int PlayerTownId()
        {
            return gm.PlayerTownId;
        }


        public float TargetX()
        {
            return gm.TargetX;
        }
        public float TargetXMovementSpeed()
        {
            return gm.TargetXMovementSpeed;
        }
        public float TargetY()
        {
            return gm.TargetY;
        }
        public float TargetYMovementSpeed()
        {
            return gm.TargetYMovementSpeed;
        }
        public float TargetHp()
        {
            return gm.TargetHpCurrent;
        }
        public int TargetLevel()
        {
            return gm.TargetLevel;
        }
        public int TargetType()
        {
            return gm.TargetType;
        }
        public int TargetId()
        {
            return gm.TargetId;
        }
        public int TargetFaction()
        {
            return gm.TargetFaction;
        }
        public int TargetPrimaryProfession()
        {
            return gm.TargetPrimaryProfession;
        }
        public int TargetSecondaryProfession()
        {
            return gm.TargetSecondaryProfession;
        }
        public int TargetSpellId()
        {
            return gm.TargetSpellId;
        }
        public int TargetIsCasting()
        {
            if (gm.TargetSpellId != 0)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
        public double TargetDistance()
        {
            return gm.TargetDistance;
        }

        public int ItemID()
        {
            return gm.ItemID;
        } 
        public int ItemRarity()
        {
            return gm.ItemRarity;
        }
        public int ItemQuantity()
        {
            return gm.ItemQuantity;
        }
        public int ItemModelID()
        {
            return gm.ItemModelID;
        }
        public int ItemValue()
        {
            return gm.ItemValue;
        }

        public void IdentItem(int idKit, int idToIdent)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChildParam(AM_IDENTITEM, idKit, idToIdent);
            }
        }

        public void SalvageItem(int idKit, int idToSalvage)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChildParam(AM_SALVAGEITEMPTR, gm.GetUnknownPointer(), 0);
                com.SendMessageToChildParam(AM_SALVAGEITEM, idKit, idToSalvage);               
            }
        }

        public int GetItemValue(int itemID)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return 0;
            }
            else
            {
                gm.ItemValue = -1;                                            //reset last message flag, see below
                com.SendMessageToChildParam(AM_GETITEMVALUE, itemID, 0);
                while (gm.ItemValue == -1)                  //the processing takes some time. wait until the item value is actually received
                {                                                           //to prevent crashes
                    Thread.Sleep(200);
                }
                return gm.ItemValue;
            }
        }
        public void SellItem(int id, int value)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                lastMessage = 0;

                com.SendMessageToChildParam(AM_SELLITEM, id, value);
                while (lastMessage != AM_SELLCOMPLETE)                      //same as GetItemValue above
                {
                    Thread.Sleep(100);
                }
            }
        }

        public void MoveTo(float x, float y)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChildParam(AM_MOVETOINFOX, 0, x);
                com.SendMessageToChildParam(AM_MOVETOINFOY, 0, y);
                com.SendMessageToChild(AM_MOVETO);
            }
        }

        public void MoveToExact(float x, float y)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChildParam(AM_MOVETOINFOX, 0, x);
                com.SendMessageToChildParam(AM_MOVETOINFOY, 0, y);
                com.SendMessageToChild(AM_MOVETOEXACT);
            }
        }


        public void Travel(int location, int dis, int lang)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChildParam(AM_LANGDIS, dis, lang);         //only 2 parameters per window message possible
                com.SendMessageToChildParam(AM_TRAVEL, location, 0);        //thusly split in half for 3 necessary inforamtion
            }
        }

        public void UseSkill(long slot, long target)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                long myId = gm.PlayerID;
                com.SendMessageToChildParam(AM_PLAYERID, (int)myId, 0);             //UseSkill requires the current AgentId in ASM code
                com.SendMessageToChildParam(AM_USESKILL, (int)slot, (int)target);   //again 2 windows messages for 3 necessary parameters
            }
        }

        public void EnterMission()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_ENTERMISSION);
            }
        }

        public void TargetNextAlly()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_TARGETNEXTALLY);
            }
        }

        public void DropItem()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_DROPITEM);
            }
        }

        public void LootItem()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                int itemID = gm.TargetId;
                com.SendMessageToChildParam(AM_LOOTITEM, itemID, 0);
            }
        }

        public void TargetNpc(int id)
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChildParam(AM_TARGETNPC, (int)id, 0);
            }
        }

        public void TargetNearestItem()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_TARGETNEARESTITEM);
            }
        }

        public void TargetNearestAlly()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_TARGETNEARESTALLY);
            }
        }

        public void TargetNearestEnemy()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_TARGETNEARESTENEMY);
            }
        }

        public void TargetNextEnemy()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_TARGETNEXTENEMY);
            }
        }

        public void TargetNextItem()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChild(AM_TARGETNEXTITEM);
            }
        }

        public void AttackTarget()
        {
            if (com == null)
            {
                Print("Error: not attached to a Guild Wars process.\n");
                return;
            }
            else
            {
                com.SendMessageToChildParam(AM_TARGETATTACK, gm.TargetId, 0);
            }
        }

        public void DumpAddresses()
        {
            Print("PlayerX Address: " + gm.PlayerXAddress.ToString("X4") + "\n");
            Print("PlayerMovementSpeedX Address: " + gm.PlayerMovementSpeedXAddress.ToString("X4") + "\n");
            Print("PlayerY Address: " + gm.PlayerYAddress.ToString("X4") + "\n");
            Print("PlayerMovementSpeedY Address: " + gm.PlayerMovementSpeedYAddress.ToString("X4") + "\n");
            Print("PlayerID Address: " + gm.PlayerIDAddress.ToString("X4") + "\n");
            Print("PlayerCurrentHp Address: " + gm.PlayerCurrentHpAddress.ToString("X4") + "\n");
            Print("PlayerMaxHp Address: " + gm.PlayerMaxHpAddress.ToString("X4") + "\n");
            Print("PlayerCurrentEp Address: " + gm.PlayerCurrentEnergyAddress.ToString("X4") + "\n");
            Print("PlayerMaxEp Address: " + gm.PlayerMaxEnergyAddress.ToString("X4") + "\n");
            Print("PlayerLevel Address: " + gm.PlayerLevelAddress.ToString("X4") + "\n");
            Print("PlayerCastingSpell Address: " + gm.PlayerCastingSpellAddress.ToString("X4") + "\n");
            Print("PlayerTownId Address: " + gm.PlayerTownIdAddress.ToString("X4") + "\n");
            Print("PlayerGold Address: " + gm.PlayerGoldAddress.ToString("X4") + "\n");
        }

        public void SetTitle(string newName)
        {
            if (guildWarsProcess == null)
                return;
            SetWindowText(guildWarsProcess.MainWindowHandle, newName);
        }

        public void TerminateScript()
        {
            Thread.CurrentThread.Abort();
        }

        //------------------------##############Button configuration  ################-----------------------------------
        private void button1_Click(object sender, EventArgs e)
        {
            ClearConsole();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            RunScript();
        }
        
        private void button3_Click(object sender, EventArgs e)
        {
            EndScript();
        }
        
        private void button4_Click(object sender, EventArgs e)
        {
            Attach();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            Detach();     
        }

        private void button6_Click(object sender, EventArgs e)
        {
            StartNewProcess();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            CloseSelectedProcess();
        }


        private void startToolStripMenuItem_Click(object sender, EventArgs e)
        {
            RunScript();
        }

        private void stopToolStripMenuItem_Click(object sender, EventArgs e)
        {
            EndScript();
        }

        private void clearConsoleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ClearConsole();
        }

        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            bool bHandled = false;

            switch (keyData)
            {
                case Keys.F5:
                    RunScript();
                    bHandled = true;
                    break;
                case Keys.F9:
                    EndScript();
                    bHandled = true;
                    break;
            }
            return bHandled;
        }
        //------------------------##############Button configuration  ################-----------------------------------



        //------------------------##############         DIRT         ################-----------------------------------
        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void Form1_Closing(object sender, FormClosingEventArgs f)
        {
            DialogResult dlg;
            if (changed)
            {
                dlg = MessageBox.Show("Warning, content not saved yet! Continue?", "Aeterna", MessageBoxButtons.YesNo);
                if (dlg == DialogResult.No)
                {
                    f.Cancel = true;
                    SaveLuaDoc();
                }
                if (injected)
                    com.SendMessageToChild(AM_UNLOADLIBRARY);
            }
            else if (!changed)
            {
                dlg = MessageBox.Show("Do you really want to quit Aeterna?", "Aeterna", MessageBoxButtons.YesNo);
                if (dlg == DialogResult.No)
                {
                    f.Cancel = true;
                }
                else if (dlg == DialogResult.Yes)
                {
                    try
                    {
                        if (gm.readAdresses != null && gm.readAdresses.IsAlive)
                        {
                            gm.readAdresses.Abort();
                        }
                        if (injected)
                            com.SendMessageToChild(AM_UNLOADLIBRARY);
                    }
                    catch (Exception e)
                    {
                        Print(e.Message + "\n");
                    }
                }
            }
                
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            About abt = new About();
            abt.Show();
        }

        private void helpToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Help hlp = new Help();
            hlp.Show();
        }

        /*
        private void AcquireGWPath() //Bugging ATM
        {
            return;
            RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\ArenaNet\\Guild Wars");
            GWPath = (string)rk.GetValue("Path");
        }


        /* Old method to bring the stat variables in the luaVM to the current state. Produced many crashes. 

public void RefreshLuaVariables(Lua luaVM)
{
    while (true)
    {
        try
        {
            luaVM["PlayerX"] = vsc.PlayerX;
            luaVM["PlayerY"] = vsc.PlayerY;
            luaVM["PlayerHpCurrent"] = vsc.PlayerHp;
            luaVM["PlayerHpMax"] = vsc.PlayerHpMax;
            luaVM["PlayerEpCurrent"] = vsc.PlayerEp;
            luaVM["PlayerEpMax"] = vsc.PlayerEpMax;
            luaVM["PlayerRegen"] = vsc.PlayerRegen;
            luaVM["PlayerIsDead"] = vsc.PlayerIsDead;

            luaVM["TargetX"] = vsc.TargetX;
            luaVM["TargetY"] = vsc.TargetY;
            luaVM["TargetHp"] = vsc.TargetHp;
            luaVM["TargetLevel"] = vsc.TargetLevel;
            luaVM["TargetType"] = vsc.TargetType;
            luaVM["TargetId"] = vsc.TargetId;
            luaVM["TargetSpellId"] = vsc.TargetSkill;
            luaVM["TargetIsCasting"] = vsc.TargetIsCasting;
            luaVM["TargetFaction"] = vsc.TargetFaction;

            luaVM["SystemDate"] = DateTime.Now.ToString();
        }
        catch (Exception e)
        {
            Print("Lua variable refresh thread: " + e.Message + "\n");
        }
        Thread.Sleep(100);             
    }
}

    ***Previous method to initiate and refresh the global lua variables***

    if (vsc != null) //value storage class initiated?
    {
        try
        {
            luaVM["PlayerX"] = vsc.PlayerX; //register global lua variables, will be refreshed below
            luaVM["PlayerY"] = vsc.PlayerY;
            luaVM["PlayerHpCurrent"] = vsc.PlayerHp;
            luaVM["PlayerHpMax"] = vsc.PlayerHpMax;
            luaVM["PlayerEpCurrent"] = vsc.PlayerEp;
            luaVM["PlayerEpMax"] = vsc.PlayerEpMax;
            luaVM["PlayerRegen"] = vsc.PlayerRegen;
            luaVM["PlayerIsDead"] = vsc.PlayerIsDead;

            luaVM["TargetX"] = vsc.TargetX;
            luaVM["TargetY"] = vsc.TargetY;
            luaVM["TargetHp"] = vsc.TargetHp;
            luaVM["TargetLevel"] = vsc.TargetLevel;
            luaVM["TargetType"] = vsc.TargetType;
            luaVM["TargetId"] = vsc.TargetId;
            luaVM["TargetSpellId"] = vsc.TargetSkill;
            luaVM["TargetIsCasting"] = vsc.TargetIsCasting;
            luaVM["TargetFaction"] = vsc.TargetFaction;

            luaVM["SystemDate"] = DateTime.Now.ToString();
        }
        catch (Exception e)
        {
            Print("Error on Engine startup: " + e.Message + "\n.");
        }
        LuaVarRefresh = new Thread(() => RefreshLuaVariables(luaVM));
        LuaVarRefresh.IsBackground = true;
        LuaVarRefre******art();
    }






*/

        /* Same as above, only with a timer to avoid background threads. Unfortunately it does not work. 
         * 
         * 
         * 
        public System.Windows.Forms.Timer refreshLuaVars = new System.Windows.Forms.Timer();
        public void refreshLuaVariables()
        {
            refreshLuaVars.Interval = 100;
            refreshLuaVars.Start();
            MessageBox.Show("Hit Start");
        }
        public void _refreshLuaVars(Lua luaVM)
        {
            //MessageBox.Show("Timer ticked");
            luaVM["PlayerX"] = vsc.PlayerX;
            luaVM["PlayerY"] = vsc.PlayerY;
            luaVM["PlayerHpCurrent"] = vsc.PlayerHp;
            luaVM["PlayerHpMax"] = vsc.PlayerHpMax;
            luaVM["PlayerEpCurrent"] = vsc.PlayerEp;
            luaVM["PlayerEpMax"] = vsc.PlayerEpMax;
            luaVM["PlayerRegen"] = vsc.PlayerRegen;
            luaVM["PlayerIsDead"] = vsc.PlayerIsDead;

            luaVM["TargetX"] = vsc.TargetX;
            luaVM["TargetY"] = vsc.TargetY;
            luaVM["TargetHp"] = vsc.TargetHp;
            luaVM["TargetLevel"] = vsc.TargetLevel;
            luaVM["TargetType"] = vsc.TargetType;
            luaVM["TargetId"] = vsc.TargetId;
            luaVM["TargetSpellId"] = vsc.TargetSkill;
            luaVM["TargetIsCasting"] = vsc.TargetIsCasting;
            luaVM["TargetFaction"] = vsc.TargetFaction;

            luaVM["SystemDate"] = DateTime.Now.ToString();

            Print(luaVM["PlayerX"].ToString());
            Print("\n");

        }
        */

        //------------------------##############         DIRT         ################-----------------------------------
    }
}
Communicator:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Windows.Interop;


namespace Pellax
{
    class Communicator
    {
        IntPtr MainWindowHandle;
        IntPtr ChildWindowHandle;

        public Communicator(IntPtr hWindowMaster, IntPtr hWindowChild)
        {
            MainWindowHandle = hWindowMaster;
            ChildWindowHandle = hWindowChild;
        }

        [DllImport("DllInjector", EntryPoint = "InjectDll", CallingConvention = CallingConvention.Cdecl)]
        public static extern int DllInject(int ProcessId, IntPtr hWindowMaster, IntPtr hWindowChild);       //Import the injection method coded in C++ 

        //------------------------##############PROCESS COMMUNICATION##############------------------------------------

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool PostMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam);
        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        private static extern bool SendMessage(IntPtr hwnd, uint Msg, IntPtr wParam, IntPtr lParam);


        public bool SendMessageToMaster(uint Msg)
        {
            bool msg = PostMessage(MainWindowHandle, Msg, IntPtr.Zero, IntPtr.Zero);
            return msg;
        }
        public bool SendMessageToMasterParam(uint Msg, int wParam, int lParam)
        {
            bool msg = PostMessage(MainWindowHandle, Msg, (IntPtr)wParam, (IntPtr)lParam);
            return msg;
        }
        public bool SendMessageToChild(uint Msg)
        {
            bool msg = PostMessage(ChildWindowHandle, Msg, IntPtr.Zero, IntPtr.Zero);
            return msg;
        }
        public bool SendMessageToChildParam(uint Msg, int wParam, int lParam)
        {
            bool msg = PostMessage(ChildWindowHandle, Msg, (IntPtr)wParam, (IntPtr)lParam);
            return msg;
        }
        public bool SendMessageToChildParam(uint Msg, float wParam, float lParam)
        {
            bool msg = PostMessage(ChildWindowHandle, Msg, (IntPtr)wParam, (IntPtr)lParam);
            return msg;
        }
        public bool SendMessageToChildWait(uint Msg, int wParam, int lParam)
        {
            bool msg = SendMessage(ChildWindowHandle, Msg, (IntPtr)wParam, (IntPtr)lParam);
            return msg;
        }
        public bool SendMessageToMasterWait(uint Msg, int wParam, int lParam)
        {
            bool msg = SendMessage(MainWindowHandle, Msg, (IntPtr)wParam, (IntPtr)lParam);
            return msg;
        }

        //SendMessage waits for a response, whereas PostMessage immediately returns


        //------------------------##############PROCESS COMMUNICATION##############------------------------------------

    }
}
Memory stuff:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using GwRead;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace Pellax
{
    class GwMemory
    {
        GwReader gwr; //a reference to the managed GwReader.dll. Contains all the functions for reading and writing memory stuff. 

        public GwMemory(int procID)
        {
            gwr = new GwReader(procID);
        }

        public float PlayerX;
        public float PlayerY;
        public float PlayerXMovementSpeed;
        public float PlayerYMovementSpeed;
        public float PlayerHpCurrent;
        public int PlayerHpMax;
        public float PlayerRegen;
        public float PlayerEpCurrent;
        public int PlayerEpMax;
        public int PlayerLevel;
        public int PlayerID;
        public int PlayerSpellId;
        public int PlayerGold;
        public int PlayerGoldStash;
        public int PlayerTownId;
        public int PlayerInMission;

        public float TargetX;
        public float TargetY;
        public float TargetXMovementSpeed;
        public float TargetYMovementSpeed;
        public float TargetHpCurrent;
        public int TargetFaction;
        public int TargetId;
        public int TargetType;
        public int TargetLevel;
        public int TargetSpellId;
        public int TargetPrimaryProfession;
        public int TargetSecondaryProfession;
        public double TargetDistance;

        public int PlayerIDAddress;
        public int PlayerXAddress;
        public int PlayerYAddress;
        public int PlayerCurrentHpAddress;
        public int PlayerMaxHpAddress;
        public int PlayerMaxEnergyAddress;
        public int PlayerCurrentEnergyAddress;
        public int PlayerLevelAddress;
        public int PlayerPrimaryProfessionAddress;
        public int PlayerSecondaryProfessionAddress;
        public int PlayerTypeAddress;
        public int PlayerMovementSpeedXAddress;
        public int PlayerMovementSpeedYAddress;
        public int PlayerCastingSpellAddress;
        public int PlayerFactionAddress;
        public int PlayerTownIdAddress;
        public int PlayerGoldAddress;

        public int ItemID = 0;
        public int ItemRarity = 0;
        public int ItemQuantity = 0;
        public int ItemModelID = 0;
        public int ItemValue = 0;

        public int BagNumberOfItems;

        public Thread readAdresses;

        public void ReadAdresses()
        {
            while (true) 
            {
                PlayerX = gwr.ReadPlayerX();
                PlayerY = gwr.ReadPlayerY();
                PlayerXMovementSpeed = gwr.ReadPlayerMovementSpeedX();
                PlayerYMovementSpeed = gwr.ReadPlayerMovementSpeedY();
                PlayerHpCurrent = gwr.ReadPlayerHpCurrent();
                PlayerHpMax = gwr.ReadPlayerHpMax();
                PlayerEpCurrent = gwr.ReadPlayerEnergyCurrent();
                PlayerEpMax = gwr.ReadPlayerEnergyMax();
                PlayerLevel = gwr.ReadPlayerLevel();
                PlayerID = gwr.ReadPlayerID();
                PlayerSpellId = gwr.ReadPlayerCastingSpell();
                PlayerGold = gwr.ReadPlayerGold();
                PlayerGoldStash = gwr.ReadPlayerGoldStash();           
                PlayerTownId = gwr.ReadPlayerTownId();
                PlayerInMission = gwr.ReadPlayerInMission();

                TargetX = gwr.ReadTargetX();
                TargetY = gwr.ReadTargetY();
                TargetXMovementSpeed = gwr.ReadTargetMovementSpeedX();
                TargetYMovementSpeed = gwr.ReadTargetMovementSpeedY();
                TargetHpCurrent = gwr.ReadTargetHpCurrent();
                TargetFaction = gwr.ReadTargetFaction();
                TargetId = gwr.ReadTargetID();
                TargetType = gwr.ReadTargetType();
                TargetLevel = gwr.ReadTargetLevel();
                TargetSpellId = gwr.ReadTargetCastingSpell();
                TargetPrimaryProfession = gwr.ReadTargetPrimaryProfession();
                TargetSecondaryProfession = gwr.ReadTargetSecondaryProfession();
                TargetDistance = (  Math.Sqrt(Math.Pow((double)(PlayerX - TargetX), 2) + Math.Pow((double)(PlayerY - TargetY), 2))    );

                BagNumberOfItems = gwr.ReadBagNumberOfItems();

                PlayerIDAddress = gwr.PlayerIDAddress;
                PlayerXAddress = gwr.PlayerXAddress;
                PlayerYAddress = gwr.PlayerYAddress;
                PlayerCurrentHpAddress = gwr.PlayerCurrentHpAddress;
                PlayerMaxHpAddress = gwr.PlayerMaxHpAddress;
                PlayerMaxEnergyAddress = gwr.PlayerMaxEnergyAddress;
                PlayerCurrentEnergyAddress = gwr.PlayerCurrentEnergyAddress;
                PlayerLevelAddress = gwr.PlayerLevelAddress;
                PlayerPrimaryProfessionAddress = gwr.PlayerPrimaryProfessionAddress;
                PlayerSecondaryProfessionAddress = gwr.PlayerSecondaryProfessionAddress;
                PlayerTypeAddress = gwr.PlayerTypeAddress;
                PlayerMovementSpeedXAddress = gwr.PlayerMovementSpeedXAddress;
                PlayerMovementSpeedYAddress = gwr.PlayerMovementSpeedYAddress;
                PlayerCastingSpellAddress = gwr.PlayerCastingSpellAddress;
                PlayerFactionAddress = gwr.PlayerFactionAddress;
                PlayerTownIdAddress = gwr.PlayerTownIdAddress;
                PlayerGoldAddress = gwr.PlayerGoldAddress;

                Thread.Sleep(100);
            }
        }
        public int TargetNpc(int id)
        {
            int result = gwr.TargetNpc(id);
            return result;
        }

        public int GetItem(int bag, int slot)
        {
            int[] item = gwr.GetItem(bag, slot);
            ItemID = item[0];
            ItemRarity = item[1];
            ItemQuantity = item[2];
            ItemModelID = item[3];
            ItemValue = item[4];

            return 0;
        }        

        public int GetUnknownPointer()
        {
            return gwr.ReadUnknownPointer();
        }
    }
}
2nd memory stuff:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace GwRead
{
    public class GwReader
    {
        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, out IntPtr lpNumberOfBytesWritten);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool WriteProcessMemory(IntPtr handle, IntPtr lpBaseAddress, byte[] lpBuffer, UIntPtr nSize, out IntPtr lpNumberOfBytesWritten);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Boolean bInheritHandle, UInt32 dwProcessId);

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern int GetLastError();

        int PlayerIDOffset = 0x2C;
        int PlayerXOffset = 0x74;
        int PlayerYOffset = 0x78;
        int PlayerCurrentHpOffset = 0x130;
        int PlayerMaxHpOffset = 0x134;
        int PlayerMaxEnergyOffset = 0x120;
        int PlayerCurrentEnergyOffset = 0x11C;
        int PlayerLevelOffset = 0x10C;
        int PlayerPrimaryProfessionOffset = 0x10A;
        int PlayerSecondaryProfessionOffset = 0x10B;
        int PlayerTypeOffset = 0x9C;
        int PlayerMovementSpeedXOffset = 0xA0;
        int PlayerMovementSpeedYOffset = 0xA4;
        int PlayerCastingSpellOffset = 0x1B4;
        int PlayerFactionOffset = 0x1B0;

        public int PlayerIDAddress = 0x2C;
        public int PlayerXAddress = 0x74;
        public int PlayerYAddress = 0x78;
        public int PlayerCurrentHpAddress = 0x130;
        public int PlayerMaxHpAddress = 0x134;
        public int PlayerMaxEnergyAddress = 0x120;
        public int PlayerCurrentEnergyAddress = 0x11C;
        public int PlayerLevelAddress = 0x10C;
        public int PlayerPrimaryProfessionAddress = 0x10A;
        public int PlayerSecondaryProfessionAddress = 0x10B;
        public int PlayerTypeAddress = 0x9C;
        public int PlayerMovementSpeedXAddress = 0xA0;
        public int PlayerMovementSpeedYAddress = 0xA4;
        public int PlayerCastingSpellAddress = 0x1B4;
        public int PlayerFactionAddress = 0x1B0;
        public int PlayerTownIdAddress = 0;
        public int PlayerGoldAddress = 0;

        int staticAdressIDSelf = 0xECA394; //0xEBF3C4; //0xEBF3D4; //0xEBF3CC;
        int staticAdressIDTarget = 0xEC9EE8; //0xEBEF18; //0xEBEF28; //0xEBEF20;
        int staticAdressAgentArray = 0xECA3E8; //0xEBF418; //0xEBF420
        int staticAddressTownId = 0xEC2848; //0xEB7970; //0xEB7978;
        int staticAddressInMission = 0xEBF9B8;
        int baseAddress = 0xA3C790; //0xA5D3F0; //0xA52230; //0xA52230; //0xA46134;//0x3B3C30;//0xA30790;

        IntPtr handle;
        IntPtr handleWrite;

        public GwReader(int procID)
        {
            handle = OpenProcess(0x10, false, (UInt32)procID);
            handleWrite = OpenProcess(0x8 | 0x20, false, (UInt32)procID);
        }

        int ReadIntChain(int baseAddress, int[] offsets)
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)baseAddress, buffer, (UIntPtr)4, out bytesWritten);
            int nextValue = BitConverter.ToInt32(buffer, 0);

            for (int i = 0; i < offsets.Length; i++)
            {
                ReadProcessMemory(handle, (IntPtr)(nextValue + offsets[i]), buffer, (UIntPtr)4, out bytesWritten);
                nextValue = BitConverter.ToInt32(buffer, 0);
            }

            int result = 0;
            ReadProcessMemory(handle, (IntPtr)nextValue, buffer, (UIntPtr)4, out bytesWritten);
            result = BitConverter.ToInt32(buffer, 0);
            return result;
        }

        int ReadIntPtrChain(int baseAddress1, int[] offsets)
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)baseAddress1, buffer, (UIntPtr)4, out bytesWritten);
            int nextValue = BitConverter.ToInt32(buffer, 0);

            for (int i = 0; i < offsets.Length; i++)
            {
                ReadProcessMemory(handle, (IntPtr)(nextValue + offsets[i]), buffer, (UIntPtr)4, out bytesWritten);
                nextValue = BitConverter.ToInt32(buffer, 0);
            }

            return nextValue;
        }

        int ReadByte(int address)
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)address, buffer, (UIntPtr)1, out bytesWritten);
            int value = BitConverter.ToInt32(buffer, 0);

            return value;
        }

        int ReadInt(int address)
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)address, buffer, (UIntPtr)4, out bytesWritten);
            int value = BitConverter.ToInt32(buffer, 0);

            return value;
        }

        int ReadSelfBase()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)staticAdressIDSelf, buffer, (UIntPtr)4, out bytesWritten);
            int IDSelf = BitConverter.ToInt32(buffer, 0);

            ReadProcessMemory(handle, (IntPtr)staticAdressAgentArray, buffer, (UIntPtr)4, out bytesWritten);
            int baseAgentArray = BitConverter.ToInt32(buffer, 0);

            ReadProcessMemory(handle, (IntPtr)baseAgentArray + (IDSelf * 4), buffer, (UIntPtr)4, out bytesWritten);
            int AgentSelf = BitConverter.ToInt32(buffer, 0);

            return AgentSelf;
        }

        int ReadTargetBase()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)staticAdressIDTarget, buffer, (UIntPtr)4, out bytesWritten);
            int IDTarget = BitConverter.ToInt32(buffer, 0);

            ReadProcessMemory(handle, (IntPtr)staticAdressAgentArray, buffer, (UIntPtr)4, out bytesWritten);
            int baseAgentArray = BitConverter.ToInt32(buffer, 0);

            ReadProcessMemory(handle, (IntPtr)baseAgentArray + (IDTarget * 4), buffer, (UIntPtr)4, out bytesWritten);
            int AgentTarget = BitConverter.ToInt32(buffer, 0);

            return AgentTarget;
        }

        public int ReadBagNumberOfItems()
        {
            int[] offsets = { 0x18, 0x40, 0xF8, 0x4, 0x10 };

            return ReadIntChain(baseAddress, offsets);
        }

        public int[] GetItem(int bag, int slot)
        {
            int[] itemStats = { 1, 2, 3, 4, 5 }; //Id, rarity, quantity, modelId
            int bagConverted = 0;

            switch (bag)
            {
                case 4:
                    bagConverted = 0xD0;
                    break;
                case 8:
                    bagConverted = 0xA4;
                    break;
                case 12:
                    bagConverted = 0x78;
                    break;
                case 16:
                    bagConverted = 0x4C;
                    break;
            }
            //MessageBox.Show(bagConverted.ToString());
            int[] itemArrayOffsets = { 0x158, 0x38, 0x0, bagConverted, (slot * 4) };

            int basead = ReadInt(baseAddress);
            int offBegin = ReadInt(basead + 0x18);            
            int off1 = ReadInt(offBegin + 0x40); //0x158
            //MessageBox.Show(off1.ToString("X"));
            int off2 = ReadInt(off1 + 0x38); //0x38
            //MessageBox.Show(off2.ToString("X"));
            int off3 = ReadInt(off2 + 0);
            //MessageBox.Show(off3.ToString("X"));
            int off4 = ReadInt(off3 + bagConverted);
            //MessageBox.Show(off4.ToString("X"));
            int off5 = ReadInt(off4 + (slot * 4));
            //MessageBox.Show(off5.ToString("X"));

            /*
            Hier gabs irgendwie ärger mit ReadIntPointerChain usw. musste es dann manuell machen, hatte keine lust die ursprüngliche routine zu bearbeiten, da es ja mit allem anderen klappt. 
            */

            /*
            int itemArray = ReadIntPtrChain(ReadInt(baseAddress), itemArrayOffsets);
            MessageBox.Show("ptr chain " + itemArray.ToString());
            

            int itemArray = ReadIntChain(baseAddress, itemArrayOffsets);
            //MessageBox.Show("chain " + itemArray.ToString());

            int itemOfInterest = ReadInt(itemArray + (slot * 4));
            //MessageBox.Show(itemOfInterest.ToString());

            //int itemOfInterestRarity = ReadInt(itemOfInterest + 0x3C); //rarity

             */
            itemStats[0] = ReadInt(off5);
            itemStats[1] = ReadByte(ReadInt(off5 + 0x38));  //rarity?    
            itemStats[2] = ReadByte(off5 + 0x4C); //quantity, ehemals 4B
            itemStats[3] = ReadInt(off5 + 0x2C); //modelId
            itemStats[4] = ReadInt(off5 + 0x24); //value

            return itemStats;
        }

        public int TargetNpc(int id)
        {
            IntPtr NpcIdAddress = (IntPtr)staticAdressIDTarget;
            byte[] buffer = new byte[4];
            buffer = BitConverter.GetBytes(id);
            IntPtr lpNumberOfBytesWritten;

            if (handleWrite == null)
            {
                return -1;
            }

            WriteProcessMemory(handleWrite, NpcIdAddress, buffer, (UIntPtr)4, out lpNumberOfBytesWritten);
            int result = GetLastError();
            return result;
        }

        public int ReadUnknownPointer()
        {
            int[] unknownPointerOffsets = { 0x158, 0xB8 };
            int uPtr = ReadIntPtrChain(baseAddress, unknownPointerOffsets);

            return uPtr;
        }

        public int ReadPlayerGold()
        {
            int goldBase = 0xA318B0;
            int[] playerGoldOffsets = { 0x18, 0x40, 0xF8, 0x90 };

            return ReadIntChain(goldBase, playerGoldOffsets);
        }

        public int ReadPlayerGoldStash()
        {
            int[] playerGoldStashOffsets = { 0x7DC, 0x24, 0x14, 0x80 };
            int gAddress = ReadIntPtrChain(0xA35298, playerGoldStashOffsets);
            return gAddress;

            /*
            int[] playerGoldStashOffsets = { 0x7DC, 0x24, 0x14, 0x80 };
            
            return ReadIntChain(0xA35298, playerGoldStashOffsets);
            */
        }

        public float ReadPlayerX()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerXOffset, buffer, (UIntPtr)4, out bytesWritten);
            float PlayerX = BitConverter.ToSingle(buffer, 0);
            PlayerXAddress = (ReadSelfBase() + PlayerXOffset);

            return PlayerX;
        }

        public float ReadPlayerY()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerYOffset, buffer, (UIntPtr)4, out bytesWritten);
            float PlayerY = BitConverter.ToSingle(buffer, 0);
            PlayerYAddress = ReadSelfBase() + PlayerYOffset;

            return PlayerY;
        }

        public float ReadPlayerHpCurrent()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerCurrentHpOffset, buffer, (UIntPtr)4, out bytesWritten);
            float PlayerHpCurrent = BitConverter.ToSingle(buffer, 0);
            PlayerCurrentHpAddress = ReadSelfBase() + PlayerCurrentHpOffset;

            return PlayerHpCurrent;
        }

        public int ReadPlayerHpMax()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerMaxHpOffset, buffer, (UIntPtr)4, out bytesWritten);
            int PlayerMaxHP = BitConverter.ToInt32(buffer, 0);
            PlayerMaxHpAddress = ReadSelfBase() + PlayerMaxHpOffset;

            return PlayerMaxHP;
        }

        public int ReadPlayerCastingSpell()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerCastingSpellOffset, buffer, (UIntPtr)4, out bytesWritten);
            int PlayerCastingSpell = BitConverter.ToInt16(buffer, 0);
            PlayerCastingSpellAddress = ReadSelfBase() + PlayerCastingSpellOffset;

            return PlayerCastingSpell;
        }

        public int ReadPlayerLevel()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerLevelOffset, buffer, (UIntPtr)4, out bytesWritten);
            int PlayerLevel = BitConverter.ToInt32(buffer, 0);
            PlayerLevelAddress = ReadSelfBase() + PlayerLevelOffset;

            return PlayerLevel;
        }

        public int ReadPlayerID()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerIDOffset, buffer, (UIntPtr)4, out bytesWritten);
            int PlayerLevel = BitConverter.ToInt32(buffer, 0);
            PlayerIDAddress = ReadSelfBase() + PlayerIDOffset;

            return PlayerLevel;
        }

        public float ReadPlayerMovementSpeedX()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerMovementSpeedXOffset, buffer, (UIntPtr)4, out bytesWritten);
            float PlayerXMovementSpeed = BitConverter.ToSingle(buffer, 0);
            PlayerMovementSpeedXAddress = ReadSelfBase() + PlayerMovementSpeedXOffset;

            return PlayerXMovementSpeed;
        }

        public float ReadPlayerMovementSpeedY()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerMovementSpeedYOffset, buffer, (UIntPtr)4, out bytesWritten);
            float PlayerYMovementSpeed = BitConverter.ToSingle(buffer, 0);
            PlayerMovementSpeedYAddress = ReadSelfBase() + PlayerMovementSpeedYOffset;

            return PlayerYMovementSpeed;
        }

        public int ReadTargetID()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerIDOffset, buffer, (UIntPtr)4, out bytesWritten);
            int TargetID = BitConverter.ToInt32(buffer, 0);

            return TargetID;
        }

        public float ReadPlayerEnergyCurrent()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerCurrentEnergyOffset, buffer, (UIntPtr)4, out bytesWritten);
            float PlayerEnergyCurrent = BitConverter.ToSingle(buffer, 0);
            PlayerCurrentEnergyAddress = ReadSelfBase() + PlayerCurrentEnergyOffset;

            return PlayerEnergyCurrent;
        }

        public int ReadPlayerEnergyMax()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadSelfBase() + PlayerMaxEnergyOffset, buffer, (UIntPtr)4, out bytesWritten);
            int PlayerEpMax = BitConverter.ToInt32(buffer, 0);
            PlayerMaxEnergyAddress = ReadSelfBase() + PlayerMaxEnergyOffset;

            return PlayerEpMax;
        }

        public int ReadPlayerTownId()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)staticAddressTownId, buffer, (UIntPtr)4, out bytesWritten);
            int PlayerTownId = BitConverter.ToInt32(buffer, 0);
            PlayerTownIdAddress = staticAddressTownId;

            return PlayerTownId;
        }

        public int ReadPlayerInMission()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)staticAddressInMission, buffer, (UIntPtr)4, out bytesWritten);
            int PlayerInMission = BitConverter.ToInt32(buffer, 0);

            return PlayerInMission;
        }

        public float ReadTargetX()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerXOffset, buffer, (UIntPtr)4, out bytesWritten);
            float TargetX = BitConverter.ToSingle(buffer, 0);

            return TargetX;
        }

        public float ReadTargetY()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerYOffset, buffer, (UIntPtr)4, out bytesWritten);
            float TargetY = BitConverter.ToSingle(buffer, 0);

            return TargetY;
        }

        public float ReadTargetMovementSpeedX()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerMovementSpeedXOffset, buffer, (UIntPtr)4, out bytesWritten);
            float TargetXMovementSpeed = BitConverter.ToSingle(buffer, 0);

            return TargetXMovementSpeed;
        }

        public float ReadTargetMovementSpeedY()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerMovementSpeedYOffset, buffer, (UIntPtr)4, out bytesWritten);
            float TargetYMovementSpeed = BitConverter.ToSingle(buffer, 0);

            return TargetYMovementSpeed;
        }

        public float ReadTargetHpCurrent()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerCurrentHpOffset, buffer, (UIntPtr)4, out bytesWritten);
            float TargetHpCurrent = BitConverter.ToSingle(buffer, 0);

            return TargetHpCurrent;
        }

        public int ReadTargetType()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerTypeOffset, buffer, (UIntPtr)4, out bytesWritten);
            int TargetType = BitConverter.ToInt32(buffer, 0);

            return TargetType;
        }

        public int ReadTargetFaction()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerFactionOffset, buffer, (UIntPtr)4, out bytesWritten);
            int TargetFaction = BitConverter.ToInt16(buffer, 0);

            return TargetFaction;
        }

        public int ReadTargetCastingSpell()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerCastingSpellOffset, buffer, (UIntPtr)4, out bytesWritten);
            int TargetCastingSpell = BitConverter.ToInt16(buffer, 0);

            return TargetCastingSpell;
        }

        public int ReadTargetLevel()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerLevelOffset, buffer, (UIntPtr)4, out bytesWritten);
            int TargetLevel = BitConverter.ToInt32(buffer, 0);

            return TargetLevel;
        }

        public int ReadTargetPrimaryProfession()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerPrimaryProfessionOffset, buffer, (UIntPtr)4, out bytesWritten);
            int PrimaryProfession = buffer[0];

            return PrimaryProfession;
        }

        public int ReadTargetSecondaryProfession()
        {
            byte[] buffer = new byte[4];
            IntPtr bytesWritten;

            ReadProcessMemory(handle, (IntPtr)ReadTargetBase() + PlayerSecondaryProfessionOffset, buffer, (UIntPtr)4, out bytesWritten);
            int TargetSecondaryProfession = buffer[0];

            return TargetSecondaryProfession;
        }



    }
}
Maybe these code templates can helo somebody to write their own little bot or understand something better. Feel free to ask any questions, but I might not be able to answer everything as it has again been a while since I opened Visual Studio.

In the end it looked something like this:
Attached Images
File Type: jpg AeternaExample.jpg (719.4 KB, 117 views)
Term!nX is offline  
Thanks
2 Users
Old 05/30/2020, 09:50   #2
 
elite*gold: 0
Join Date: Oct 2005
Posts: 2,485
Received Thanks: 218
Rest of the code snippets (post too long):

The hook:
Code:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include <string>
#include <Windows.h>
#include <cstring>
#include <iostream>
#include <sstream>

const int AM_LIBRARYFREED = 0x1335;
const int AM_UNLOADLIBRARY = 0x1336;
const int AM_MESSAGEDEFAULT = 0x1337;
const int AM_ERROR = 0x1338;
const int AM_COMINFO = 0x1339;
const int AM_COMESTABLISHED = 0x1340;
const int AM_MOVETO = 0x1341;
const int AM_TRAVEL = 0x1342;
const int AM_USESKILL = 0x1343;
const int AM_PLAYERID = 0x1344;
const int AM_LANGDIS = 0x1345;
const int AM_ENTERMISSION = 0x1346;
const int AM_TARGETNEXTALLY = 0x1347;
const int AM_DROPITEM = 0x1348;
const int AM_LOOTITEM = 0x1349;
const int AM_TARGETNPC = 0x1350;
const int AM_TARGETNEARESTITEM = 0x1351;
const int AM_TARGETNEARESTALLY = 0x1352;
const int AM_TARGETNEARESTENEMY = 0x1353;
const int AM_TARGETATTACK = 0x1354;
const int AM_SELLITEM = 0x1355;
const int AM_GETITEMVALUE = 0x1356;
const int AM_RECEIVEITEMVALUE = 0x1357;
const int AM_SELLCOMPLETE = 0x1358;
const int AM_IDENTITEM = 0x1359;
const int AM_IDENTITEMCOMPLETE = 0x1360;
const int AM_MOVETOEXACT = 0x1361;
const int AM_MOVETOINFOX = 0x1362;
const int AM_MOVETOINFOY = 0x1363;
const int AM_TARGETNEXTENEMY = 0x1364;
const int AM_TARGETNEXTITEM = 0x1365;
const int AM_SALVAGEITEM = 0x1366;
const int AM_SALVAGEITEMPTR = 0x1367;

MSG message;

HWND hWndMaster;
HWND hWndChild;
LONG OriginalWndProc;
int ProcessIdMaster;

DWORD WINAPI Main_Thread();
int SendMessageToMaster(int Message);
int SendMessageToMasterParam(int Message, int firstParam, int seccondParam);
int SendMessageToChild(int Message);
int SendMessageToChildParam(int Message, int firstParam, int seccondParam);
void ShowInt(int value);
BOOL CALLBACK EnumWindowsProcMaster(HWND hwnd, LPARAM lParam);

int currentPlayerId = 0;
int district = 0;
int language = 0;
int unknownPointer = 0;
float xInfo = 0;
float yInfo = 0;
void MoveTo(float x, float y);
void Travel(long location, int dis, int lang);
void UseSkill(long slot, long target);
void EnterMission();
void TargetNextAlly();
void DropItem();
void LootItem(int itemID);
void TargetNpc(int id);
void TargetNearestItem();
void TargetNearestAlly();
void TargetNearestEnemy();
void AttackTarget(int targetID);
void UnloadLibrary();
void SellItem(int value, int id);
void GetItemValue(int itemID);
void IdentItem(int idKit, int idToIdent);
void MoveToExact(float x, float y);
void TargetNextEnemy();
void TargetNextItem();
void SalvageItem(int idKit, int idToSalvage, int unknownPtr);

LRESULT CALLBACK CustomWndProc(HWND hwnd, UINT Message, WPARAM wP, LPARAM lP)
{
	switch (Message)
	{
	case AM_MESSAGEDEFAULT:
		MessageBox(0, "User defined Message received.", "", 0);
		break;
	case AM_COMINFO:
		ProcessIdMaster = wP;
		EnumWindows(EnumWindowsProcMaster, ProcessIdMaster);
		SendMessageToMaster(AM_COMESTABLISHED);
		break;
	case AM_MOVETOINFOX:
		xInfo = (float)lP;
		break;
	case AM_MOVETOINFOY:
		yInfo = (float)lP;
		break;
	case AM_MOVETO:
		MoveTo(xInfo, yInfo);
		break;
	case AM_MOVETOEXACT:
		MoveToExact(xInfo, yInfo);
		break;
	case AM_LANGDIS:
		district = int(wP);
		language = int(lP);
		break;
	case AM_TRAVEL:
		Travel((long)wP, district, language);
		break;
	case AM_PLAYERID:
		currentPlayerId = (int)wP;
		break;
	case AM_USESKILL:
		UseSkill((long)wP, (long)lP);
		break;
	case AM_ENTERMISSION:
		EnterMission();
		break;
	case AM_TARGETNEXTALLY:
		TargetNextAlly();
		break;
	case AM_DROPITEM:
		DropItem();
		break;
	case AM_LOOTITEM:
		LootItem((int)wP);
		break;
	case AM_TARGETNPC:
		TargetNpc((int)wP);
		break;
	case AM_TARGETNEARESTITEM:
		TargetNearestItem();
		break;
	case AM_TARGETNEARESTALLY:
		TargetNearestAlly();
		break;
	case AM_TARGETNEARESTENEMY:
		TargetNearestEnemy();
		break;
	case AM_TARGETATTACK:
		AttackTarget((int)wP);
		break;
	case AM_UNLOADLIBRARY:
		UnloadLibrary();
		break;
	case AM_SELLITEM:
		SellItem((int)wP, (int)lP);
		break;
	case AM_GETITEMVALUE:
		GetItemValue((int)wP);
		break;
	case AM_IDENTITEM:
		IdentItem((int)wP, (int)lP);
		break;
	case AM_TARGETNEXTENEMY:
		TargetNextEnemy();
		break;
	case AM_TARGETNEXTITEM:
		TargetNextItem();
		break;
	case AM_SALVAGEITEMPTR:
		unknownPointer = (int)wP;
		break;
	case AM_SALVAGEITEM:
		SalvageItem((int)wP, (int)lP, unknownPointer);
		break;
	default:
		break;
	}

	return CallWindowProc((WNDPROC)OriginalWndProc, hwnd, Message, wP, lP);
}

BOOL CALLBACK EnumWindowsProcChild(HWND hwnd, LPARAM lParam)
{
	DWORD lpdwProcessId;
	GetWindowThreadProcessId(hwnd, &lpdwProcessId);
	if (lpdwProcessId == lParam)
	{
		hWndChild = hwnd;
		return FALSE;
	}
	return TRUE;
}

BOOL CALLBACK EnumWindowsProcMaster(HWND hwnd, LPARAM lParam)
{
	DWORD lpdwProcessId;
	GetWindowThreadProcessId(hwnd, &lpdwProcessId);
	if (lpdwProcessId == lParam)
	{
		hWndMaster = hwnd;
		return FALSE;
	}
	return TRUE;
}

DWORD WINAPI Main_Thread()
{
	EnumWindows(EnumWindowsProcChild, GetCurrentProcessId());

	OriginalWndProc = GetWindowLongPtr(hWndChild, GWLP_WNDPROC);

	int retSet = SetWindowLongPtr(hWndChild, GWLP_WNDPROC, (LONG)CustomWndProc);

	return S_OK;
}

void ShowInt(int value)
{
	std::stringstream ss;
	ss << value;
	std::string valueStr = ss.str();

	MessageBox(0, valueStr.c_str(), "ShowInt", 0);
}

int SendMessageToMaster(int Message)
{
	int ret = PostMessage(hWndMaster, Message, 0, 0);
	return ret;
}

int SendMessageToChild(int Message)
{
	int ret = PostMessage(hWndChild, Message, 0, 0);
	return ret;
}

int SendMessageToChildParam(int Message, int firstParam, int seccondParam)
{
	int ret = PostMessage(hWndChild, Message, (int)firstParam, (int)seccondParam);
	return ret;
}

int SendMessageToMasterParam(int Message, int firstParam, int seccondParam)
{
	int ret = PostMessage(hWndMaster, Message, (int)firstParam, (int)seccondParam);
	return ret;
}

void UnloadLibrary()
{
	HMODULE hModule;
	GetModuleHandleEx(0, "GwHook.dll", &hModule);
	SendMessageToMaster(AM_LIBRARYFREED);
	bool fl = FreeLibrary(hModule);
	if (!fl)
		MessageBox(0, "Not unloaded. ", "", 0);
}

void IdentItem(int idKit, int idToIdent)
{
	DWORD IdentItemFunc = 0x8094F0; //0x8005C0; //0x7FA3D0; //0x7FF300; //0x7FC220;
	
	_asm
	{
		MOV ECX, idKit
		MOV EDX, idToIdent
		CALL IdentItemFunc
	}
}

void SalvageItem(int idKit, int idToSalvage, int unknownPtr)
{
	
	if (unknownPtr == 0)
		return;
	
	DWORD SalvageItemFunc = 0x800820;
		
	_asm
	{



		MOV EAX, unknownPtr //0x13AACE30 //unknown
		MOV ECX, 0x9 //unknown
		MOV EBX, idKit
		MOV EDI, idToSalvage 
		PUSH EDI
		MOV EDX, EBX
		CALL SalvageItemFunc

		/*
		MOV EAX, idToSalvage
		MOV ECX, 0x100000FF
		MOV EDI, idKit
		CALL SalvageItemFunc
		*/














		/*
		DWORD SalvageItemFunc = 0x7592A0;

		MOV EDI, idKit
		MOV ECX, idToSalvage
		PUSH ECX
		CALL SalvageItemFunc
		
		
		DWORD SalvageItemFunc0 = 0x7FA826;
		DWORD SalvageItemFunc1 = 0x7F92A0;
		DWORD SalvageItemFunc2 = 0x7FA6F0;
		
		MOV EAX, 0
		MOV EBX, idKit
		MOV EDI, idToSalvage
		CALL SalvageItemFunc0
		
		
		MOV ECX, idToSalvage
		PUSH ECX
		MOV EDI, idKit
		CALL SalvageItemFunc1
		MOV EDX, EAX
		MOV ECX, EDI
		CALL SalvageItemFunc2
		
		
		MOV EAX, 0
		MOV ECX, 0x9 //unknown
		MOV EBX, idKit
		MOV EDI, idToSalvage //bzw. PUSH idToSalvage
		PUSH EDI
		MOV EDX, EBX
		CALL SalvageItemFunc
		*/
	}
}

void GetItemValue(int itemID)
{
	DWORD GetItemValueFunc = 0x570E50; //0x56FFC0; //0x56EB10;

	long itemValue = 0;
	

	_asm 
	{
         MOV ECX, itemID
		 CALL GetItemValueFunc
		 MOV itemValue, EAX


		/*
		PUSHAD
		MOV ECX, itemID
		CALL GetItemValueFunc
		MOV itemValue, EAX
		POPAD
		*/
	}

	SendMessageToMasterParam(AM_RECEIVEITEMVALUE, itemValue, itemID);
}

void SellItem(int id, int value)
{
	DWORD SellItemFunc = 0x897DC0; //0x88F090; //0x88A770;
	
	int itemValue = value;
	int* itemIdPtr = &id;
	
	_asm
	{
		
		PUSH 0 //ECX
		MOV ECX, value
		PUSH 0 //EDX
		MOV EDX, 0
		PUSH 0 //EAX
		//MOV EAX, itemIdPtr
		LEA EAX, id
		PUSH ECX //value
		MOV ECX, 0xB
		PUSH EDX
		MOV EDX, 0
		PUSH EAX
		PUSH 1 //EBX
		CALL SellItemFunc
		
		/*
		PUSH 0 //ECX
		PUSH 0 //EDX
		PUSH 0 //EAX
		MOV EDX, itemIdPtr
		MOV EAX, itemValue
		PUSH EAX //value
		MOV EDX, 1
		PUSH EDX

		MOV EDI, id
		PUSH EDI
		PUSH 1 //EBX
		MOV ECX, 0x0B
		CALL SellItemFunc
		*/

		/*
		PUSH 0
		MOV ECX, value
		PUSH 0
		PUSH 0
		PUSH itemValue
		PUSH 0
		PUSH itemIdPtr
		PUSH 1
		MOV ECX, 0xB
		MOV EDX, 0
		CALL SellItemFunc

		/* 
		ORIGINAL: 
		PUSH 0
		PUSH 0
		PUSH 0
		PUSH itemValue
		PUSH 0
		PUSH itemIdPtr
		PUSH 1
		MOV ECX, 0xB
		MOV EDX, 0
		CALL SellItemFunc
		*/
	}

	SendMessageToMaster(AM_SELLCOMPLETE);
}

void MoveTo(float x, float y)
{
	DWORD MoveToFunc = 0x897AF0; //0x88EDC0; //0x88ED30; //0x88e050; //0x7c52d0;

	float rX = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);
	float rY = static_cast <float> (rand()) / static_cast <float> (RAND_MAX);

	float co[3] = { (x+rX), (y+rY), 0.0f };
	
	_asm
	{
		LEA ECX, co
		CALL MoveToFunc
	}
}

void MoveToExact(float x, float y)
{
	DWORD MoveToFunc = 0x897AF0; // 0x88EDC0; //0x88ED30;

	float co[3] = { x, y, 0.0f };

	_asm
	{
		LEA ECX, co
		CALL MoveToFunc
	}
}

void Travel(long location, int dis, int lang)
{
	DWORD TravelFunc = 0x817FD0; //0x80F1F0; //0x80A6C0; //0x8094D0; //0x803730; //0x806140;
	_asm
	{
		MOV EAX, 1
		MOV ECX, lang
		MOV EDX, 0
		PUSH EAX
		PUSH ECX
		MOV ECX, location
		PUSH EDX
		MOV EDX, dis
		CALL TravelFunc
		
		/*
		MOV EAX, 1
		PUSH EAX
		MOV ECX, language
		PUSH ECX
		MOV EDX, 0
		PUSH EDX
		MOV EDX, dis
		CALL TravelFunc
		
		MOV ECX, 0
		MOV EDX, location
		PUSH ECX
		PUSH EDX
		CALL TravelFunc
		
		
		
		
		MOV EAX, 1
		MOV ECX, lang
		MOV EDX, 0
		PUSH EAX
		PUSH ECX
		MOV ECX, location
		PUSH EDX
		MOV EDX, 2
		CALL TravelFunc
		*/
	}
}

void EnterMission()
{
	DWORD EnterMissionFunc = 0x817E90; //0x80F0B0; //0x80A5E0; //0x80DEF0; //0x812aa0; //0x80AB60;
	_asm
	{
		CALL EnterMissionFunc
	}
}

void TargetNextAlly()
{
	/*
	DWORD TargetNextAllyFunction = 0x4026D0;
	_asm
	{
		MOV EBX, 0
		CALL TargetNextAllyFunction
	}
	*/
}

void DropItem()
{
	DWORD DropItemFunction = 0x897780; //0x88EA50; //0x88E9C0; //0x88DCE0; //0x7a6d40; //0x88A130;

	_asm
	{
		CALL DropItemFunction
	}
}

void LootItem(int itemID)
{
	DWORD LootItemFunction = 0x897B30; //0x88EE00; //0x88ED70; //0x88E090; //0x79c230; //0x7C5370;

	_asm
	{
		MOV ECX, itemID
		CALL LootItemFunction
		
		/*
		MOV EDX, 0
		MOV ECX, itemID

		CALL LootItemFunction
		*/
	}
}

void UseSkill(long slot, long target)
{
	DWORD UseSkillFunction = 0x7D1940; // 0x7C8B30; //0x7C9680; //0x7C9200; //0x4630B4; //0x7C7680; //0x7c5480;
	
	long myId = (long)currentPlayerId;

	_asm
	{
		
		
		PUSH 0
		PUSH target
		MOV EDX, slot
		MOV ECX, myId
		CALL UseSkillFunction

		
		/*
		----alter junk

		MOV EDI, slot
		MOV ESI, myId
		MOV ECX, target
		CALL UseSkillFunction

		MOV ECX, myId
		MOV EDX, slot
		PUSH 0
		PUSH target
		CALL UseSkillFunction
		*/
	}
}

void TargetNpc(int id)
{
	DWORD TargetNpcIdFunctionGo = 0x88df70; //0x7c5110;
	DWORD TargetNpcIdFunction = 0x897A10; //0x88ECE0; //0x7C9310; //0x88df70; //0x456CE0;
	
	_asm //sets the target
	{
		MOV ECX, id
		CALL TargetNpcIdFunction
	}
	
	/*
	_asm //moves to the target
	{
		MOV EDI, 0
		MOV EDX, EDI
		MOV ECX, id
		CALL TargetNpcIdFunctionGo;
	}
	*/
}

void TargetNextEnemy()
{
	DWORD TargetFunction = 0x452440; //0x7B48D0; //0x797e70;

	_asm
	{
		MOV EDX, 0x1
		MOV ECX, 0x8000
		CALL TargetFunction
		
		/*
		MOV EAX, 0x2000
		MOV ECX, 0x2008
		CALL TargetFunction
		*/
	}
}

void TargetNextItem()
{
	
	DWORD TargetFunction = 0x799480; //0x797e70;

	_asm
	{
		MOV EAX, 0x01000600
		MOV ECX, 0x01000600
		CALL TargetFunction
	}
	
}


void TargetNearestItem()
{

	DWORD TargetFunction = 0x7A1FE0; //0x799050; //0x799450; //0x7B48C0; //0x797e40;
	_asm
	{
		
		MOV EAX, 0x01000600;
		MOV ECX, 0x01000600;
		CALL TargetFunction
		
		/*
		DWORD TargetFunction1 = 0x451190;
		DWORD TargetFunction2 = 0x795D60;

		MOV EDX, 1
		MOV ECX, 0x2000
		CALL TargetFunction1
		MOV EAX, 0x100600
		MOV ECX, EAX
		CALL TargetFunction2
		*/
	}
}

void TargetNearestAlly()
{
	DWORD TargetFunction = 0x7A1FE0; //0x799050; // 0x799450; //0x7B6AC0; //0x797e40;
	_asm
	{
		//MOV EDX, 0x1
		//MOV ECX, 0x4000
		MOV EAX, 0x93
		MOV ECX, 0x93
		CALL TargetFunction
		
		/*
		MOV ECX, 0xA000093
		MOV EAX, 0xA000093
		CALL TargetFunction
		*/
		/*
		MOV EAX, 0xA0;
		MOV ECX, 0xA0;
		
		PUSH 1
		MOV ECX, 
		CALL TargetFunction
		*/
	}
	
	/*
	DWORD TargetFunction1 = 0x451190;
	DWORD TargetFunction2 = 0x795D60;

	_asm
	{
		MOV EDX, 1
		MOV ECX, 0x4000
		CALL TargetFunction1
		MOV EAX, 0xA000093
		MOV ECX, EAX
		CALL TargetFunction2
	}
	*/
}

void TargetNearestEnemy()
{
	DWORD TargetFunction = 0x7A1FE0; //0x799050; //0x799450;//0x797e40;
	_asm
	{
		/*
		MOV EAX, 0x02000001;
		MOV ECX, 0x02000001;
		*/
		MOV ECX, 0x2008
		MOV EAX, 0x2008
		CALL TargetFunction
	}
	
	/*
	DWORD TargetFunction1 = 0x451190;
	DWORD TargetFunction2 = 0x795D60;

	_asm
	{
		MOV EDX, 1
		MOV ECX, 0x8000
		CALL TargetFunction1
		MOV EAX, 0x2008
		MOV ECX, EAX
		CALL TargetFunction2
	}
	*/
}

void AttackTarget(int targetID)
{
	DWORD AttackTargetFunction = 0x88E840; //0x88db60; //0x7C4E90;

	_asm
	{
		MOV ECX, targetID
		CALL AttackTargetFunction
		
		/*
		MOV EDI, 0
		MOV EDX, EDI
		MOV ECX, targetID
		
		CALL AttackTargetFunction
		*/
	}
}

BOOL APIENTRY DllMain(HMODULE hModule,
	DWORD  ul_reason_for_call,
	LPVOID lpReserved
	)
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
		CreateRemoteThread(GetCurrentProcess(), 0, 0, (LPTHREAD_START_ROUTINE)Main_Thread, 0, 0, 0);
		break;
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}

The injector:
Code:
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include <string>
#include <Windows.h>
#include <cstring>
#include <iostream>
#include <sstream>

const char DllPath[] = "GwHook.dll";
HANDLE hProcChild;
HWND hWndMaster;
HWND hWndChild;
DWORD ProcessID;

int SendMessageToMaster(int Message);
int SendMessageToChild(int Message);
void ShowInt(int value);

extern "C" //Wichtig, damit unmanaged C++ DLLs von .Net Applications aufgerufen werden können.
{
	__declspec(dllexport) int InjectDll(DWORD ProcessId, HWND _hWndMaster, HWND _hWndChild)
	{
		char buffer[MAX_PATH];
		GetCurrentDirectory(MAX_PATH, buffer);
		char fileName[128] = "\\GwHook.dll";
		strcat_s(buffer, fileName);

		
		HINSTANCE hInstance = LoadLibrary("kernel32");

		DWORD LoadLibraryAAddress = (DWORD)GetProcAddress(hInstance, "LoadLibraryA"); //Adresse der LoadLibraryA-Funktion in der kernel32.dll extrahieren

		hProcChild = OpenProcess(PROCESS_ALL_ACCESS, false, ProcessId);
		if (hProcChild == NULL)
			return GetLastError();

		LPVOID PathAddress = VirtualAllocEx(hProcChild, 0, strlen(buffer) + 1, MEM_COMMIT, PAGE_READWRITE); //Genug vRAM allozieren. Mindestens so viel, wie der Pfad/Dateiname der 
																									  //Bibliothek ist. PathAddress ist der Zeiger auf den Anfang des Pfad/Dateinamen.

		bool memoryWritten = WriteProcessMemory(hProcChild, PathAddress, buffer, strlen(buffer) + 1, NULL); //Den Pfad/Dateinamen in den soeben allozierten vRAM schreiben

		HANDLE hRemoteThreadLoadLibrary = CreateRemoteThread(hProcChild, 0, 0, (LPTHREAD_START_ROUTINE)LoadLibraryAAddress, PathAddress, 0, 0); //Fremdapplikation zwingen, die Bibliothek zu laden: 
																																				//1.: (LPTHREAD_START_ROUTINE)LoadLibraryAddr -> dies ist der Zeiger auf die LoadLibraryA-Funktion in der kernel32.dll
																																				//2.: PathAddress -> dies ist der Zeiger auf den Pfad/Dateinamen der Bibliothek. Dies ist das Argument für die LoadLibraryA-Funktion.
		WaitForSingleObject(hRemoteThreadLoadLibrary, INFINITE);


		if ((memoryWritten) && (hRemoteThreadLoadLibrary != NULL))
		{
			ProcessID = ProcessId;
			hWndMaster = _hWndMaster;
			hWndChild = _hWndChild;
			/*
			hRemoteThreadOverrideWndProc = CreateRemoteThread(hProcChild, 0, 0, (LPTHREAD_START_ROUTINE)Dummy, 0, 0, 0); //siehe oben
			if (hRemoteThreadOverrideWndProc == NULL)
			{
			MessageBox(0, "Error creating Main_Thread.", "", 0);
			int e = GetLastError();
			ShowInt(e);
			}
			*/
			CloseHandle(hProcChild);
			CloseHandle(hRemoteThreadLoadLibrary);
			return 0x1337;
		}
		else
		{
			CloseHandle(hProcChild);
			return GetLastError();
		}
	}
}

void ShowInt(int value)
{
	std::stringstream ss;
	ss << value;
	std::string valueStr = ss.str();

	MessageBox(0, valueStr.c_str(), "", 0);
}

int SendMessageToMaster(int Message)
{
	int ret = PostMessage(hWndMaster, Message, 0, 0);
	return ret;
}

int SendMessageToChild(int Message)
{
	int ret = PostMessage(hWndChild, Message, 0, 0);
	return ret;
}

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
Example of a bot script:
Code:
require 'GwAPI'

runcounter = 0
runcountermax = 1000
sellcounter = 0
sellcountermax = 40

function EnterDroknar()
	Lib_MoveTo(417, 10104)
	Lib_MoveTo(-50, 10700)
	while (PlayerX() ~= 8612) do
		Sleep(500)
	end	
end

function EnterElona()
	EnterMission()
	while (PlayerX() ~= 15363) do
		Sleep(200)
	end
end

function EnterTemple()
	Lib_MoveTo(-5200, 16000)
	while (PlayerX() ~= -5205) do 
		Sleep(50)
	end
end

function Buff()
	UseSkill(7, PlayerId())
	RandomSleep(2500, 3000)
	UseSkill(6, PlayerId())
	RandomSleep(2500, 3000)
	UseSkill(5, PlayerId())
	RandomSleep(2500, 3000)
	UseSkill(4, PlayerId())
	RandomSleep(3000, 3500)
end

function MoveToSpotDroknar()
	TargetNpc(PlayerId())
	Lib_MoveTo(6958, -16115)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	Lib_MoveTo(3526, -15648)
	if (PlayerIsDead() == 1) then
		return
	end
	Lib_MoveTo(2487, -14765)
	Lib_MoveTo(1748, -14893)
	Lib_MoveTo(739, -15283)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	if (PlayerIsDead() == 1) then
		return
	end
	Lib_MoveTo(-537, -15128)
	Lib_MoveTo(-2051, -15992)
	Lib_MoveTo(-3092, -17339)
	if (PlayerIsDead() == 1) then
		return
	end
	Lib_MoveTo(-4767, -16789)
	Lib_MoveTo(-4867, -16358)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	if (PlayerIsDead() == 1) then
		return
	end
	Lib_MoveTo(-5748, -15831)
end

function MoveToSpotElona()
	TargetNpc(31)
	while (PlayerHpMax() ~= 105) do
		Sleep(1000)
	end
	DropItem()
	RandomSleep(1000, 2000)
	UseSkill(0, PlayerId())
	RandomSleep(500, 700)
	Lib_MoveTo(12924, 2980)
	Lib_MoveTo(10934, 2246)
end

function MoveToSpotTemple()
	UseSkill(0, PlayerId())
	Lib_MoveTo(-5600, 12500)
end

function Fight()
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(1200, 1500)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(4, PlayerId())
	RandomSleep(2200, 2600)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(2, PlayerId())
	RandomSleep(2300, 2500)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(3, PlayerId())
	RandomSleep(5200, 5600)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	if (PlayerIsDead() == 1) then
		return
	end
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	if (PlayerIsDead() == 1) then
		return
	end
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	if (PlayerIsDead() == 1) then
		return
	end
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
end

function FightTemple()
	if (PlayerIsDead == 1) then
		return
	end
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(1200, 1500)
	UseSkill(4, PlayerId())
	RandomSleep(2200, 2600)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(2, PlayerId())
	RandomSleep(2300, 2500)
	UseSkill(3, PlayerId())
	RandomSleep(5200, 5600)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	if (PlayerIsDead() == 1) then
		return
	end
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(7000, 8000)
	UseSkill(0, PlayerId())
	if (PlayerIsDead() == 1) then
		return
	end
	RandomSleep(500, 800)
	UseSkill(4, PlayerId())
	RandomSleep(2000, 3000)
	UseSkill(2, PlayerId())
	RandomSleep(2000, 3000)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
	UseSkill(0, PlayerId())
	RandomSleep(500, 800)
	if (PlayerIsDead() == 1) then
		return
	end
	UseSkill(1, PlayerId())
	RandomSleep(4500, 5000)
end


function TravelDroknar()
	Travel(20, 2, 3)
	Sleep(2000)
	while (PlayerIsDead() == 1) do
		Sleep(500)
	end
end

function TravelElona()
	Travel(118, 2, 3)
	Sleep(2000)
	while (PlayerIsDead() == 1) do
		Sleep(500)
	end
end

function TravelTemple()
	Travel(138, 2, 3)
	Sleep(2000)
	while (PlayerIsDead() == 1) do
		Sleep(500)
	end
end

function Loot(distance)
	if (PlayerIsDead() == 1) then
		return
	end
	GetItem(16, 9)
	if (ItemID() ~= 0) then
		return --inventory full, prevents loop hungups
	end
	while (true) do
		TargetNearestItem()
		Sleep(1000)
		if (TargetId() == 0) then
			return
		end
		if (TargetType() == 512) then
			return
		end
		if (TargetFaction() == -17904) then
			return
		end
		targetDistance = TargetDistance()
		if (targetDistance > distance) then
			return
		end
		if (TargetType() == 1024) then
			if (PlayerIsDead() == 1) then
				Print("Player died while looting.\n")
				return
			end
			LootItem()
			if (PlayerIsDead() == 1) then
				Print("Player died while looting.\n")
				return
			end
		end
		if (PlayerIsDead() == 1) then
			Print("Player died while looting.\n")
			return
		end
		Sleep(1000)
	end
end

function LootTemple(distance)
	if (PlayerIsDead() == 1) then
		return
	end
	GetItem(16, 9)
	if (ItemID() ~= 0) then
		return --inventory full, prevents loop hungups
	end
	while (true) do
		TargetNearestItem()
		Sleep(1000)
		if (TargetId() == 0) then
			return
		end
		if (TargetType() == 512) then
			return
		end
		if (TargetFaction() == -17904) then
			return
		end
		targetDistance = TargetDistance()
		if (targetDistance > distance) then
			return
		end
		if (TargetType() == 1024) then
			if (PlayerIsDead() == 1) then
				Print("Player died while looting.\n")
				return
			end
			LootItem()
			while (TargetId() ~= 0) do
				if (PlayerIsDead() == 1) then
					Print("Player died while looting.\n")
					return
				end
				Sleep(1000)
			end
			Lib_MoveTo(-5600, 12500)
		end
		if (PlayerIsDead() == 1) then
			Print("Player died while looting.\n")
			return
		end
		Sleep(1000)
	end
end

function IdentItems()
	for i = 0,19 do
		GetItem(4, i)
		if (ItemID() ~= 0) then
			if (ItemRarity() ~= 64) then
				Lib_Ident(ItemID())
				Sleep(300)
			end
		end
	end
	for i = 0, 4 do
		GetItem(8, i)
		if (ItemID() ~= 0) then
			if (ItemRarity() ~= 64) then
				Lib_Ident(ItemID())
				Sleep(300)
			end
		end
	end
	for i = 0, 9 do
		GetItem(12, i)
		if (ItemID() ~= 0) then
			if (ItemRarity() ~= 64) then
				Lib_Ident(ItemID())
				Sleep(300)
			end
		end
		GetItem(16, i)
		if (ItemID() ~= 0) then
			if (ItemRarity() ~= 64) then
				Lib_Ident(ItemID())
				Sleep(300)
			end
		end
	end
end

function SellItems()
	TargetNpc(15)
	Sleep(10000)
	Print("Selling items...\n")
	for i = 0, 19 do
		GetItem(4, i)
		Sleep(500)
		SellCurrentItem(ItemID())
		Sleep(1000)
	end
	for i = 0, 4 do
		GetItem(8, i)
		Sleep(500)
		SellCurrentItem(ItemID())
		Sleep(1000)
	end
	for i = 0, 9 do
		GetItem(12, i)
		Sleep(500)
		SellCurrentItem(ItemID())
		Sleep(1000)
	end
	for i = 0, 9 do
		GetItem(16, i)
		Sleep(500)
		SellCurrentItem(ItemID())
		Sleep(1000)
	end
			
end

function SellCurrentItem(id)
	if (ItemID() == 0) then
		return
	end
	if (ItemRarity() == 64) then
		return
	end
	--if (ItemModelID() == 146) then
	--	return
	--end
	if (ItemModelID() == 5962) then
		return
	end
	if (ItemModelID() == 5960) then
		return
	end
	if (ItemModelID() == 5899) then
		return
	end
	if (ItemModelID() == 500) then --bergtroll hauer
		return
	end
	if (ItemModelID() == 934) then --plant fiber
		return
	end
	if (ItemModelID() == 931) then --monsterauge
		return
	end
	if (ItemModelID() == 442) then --abnorm samen
		return
	end
	value = GetItemValue(id) * ItemQuantity()
	SellItem(id, value)
end	

while (true) do
	GetItem(16, 3) --check how full the inventory is
	Sleep(2000)
	if (ItemID() ~= 0) then --means there is an item
		if (PlayerTownId() ~= 118) then
			Travel(118, 2, 3)
			Sleep(2000)
			while (PlayerIsDead() == 1) do
				Sleep(500)
			end
		end
		IdentItems()
		SellItems()
	end
	roll = Random(0, 100)
	if (roll < 20) then
		rollRuns = Random(1, 6)
		Print("Doing ")
		Print(rollRuns)
		Print(" Droknar runs.\n")
		if (PlayerTownId() ~= 20) then
			Travel(20, 2, 3)
			Sleep(2000)
			while (PlayerIsDead() == 1) do
				Sleep(500)
			end
		end
		for i = 1, rollRuns do
			EnterDroknar()
			Buff()
			MoveToSpotDroknar()
			Fight()
			Loot(10000)
			TravelDroknar()
			runcounter = runcounter + 1
		end
	end
	if (roll < 50) then
		rollRuns = Random(1, 6)
		Print("Doing ")
		Print(rollRuns)
		Print(" Elona runs.\n")
		if (PlayerTownId() ~= 118) then
			Travel(118, 2, 3)
			Sleep(2000)
			while (PlayerIsDead() == 1) do
				Sleep(500)
			end
		end
		for i = 1, rollRuns do
			EnterElona()
			Buff()
			MoveToSpotElona()
			Fight()
			Loot(10000)
			TravelElona()
			runcounter = runcounter + 1
		end
	end
	if (roll > 50) then
		rollRuns = Random(1, 6)
		Print("Doing ")
		Print(rollRuns)
		Print(" Temple runs.\n")
		if (PlayerTownId() ~= 138) then
			Travel(138, 2, 3)
			Sleep(2000)
			while (PlayerIsDead() == 1) do
				Sleep(500)
			end
		end
		for i = 1, rollRuns do
			EnterTemple()
			Buff()
			MoveToSpotTemple()
			FightTemple()
			LootTemple(10000)
			TravelTemple()
			runcounter = runcounter + 1
		end
	end			
	runcounter = runcounter + 1
	sellcounter = sellcounter + 1
	if (sellcounter == sellcountermax) then
		Travel(118, 2, 3)
		Sleep(2000)
		while (PlayerIsDead() == 1) do
			Sleep(500)
		end
		IdentItems()
		SellItems()
		sellcounter = 0
	end	
	if (runcounter == runcountermax) then
		TerminateScript()
		CloseGw()
	end
	Print("Number of Run: ")
	Print(runcounter)
	Print(". Gold: ")
	Print(PlayerGold())
	Print("\n")
end
Term!nX is offline  
Thanks
5 Users
Old 05/30/2020, 20:26   #3
 
elite*gold: 0
Join Date: Dec 2007
Posts: 11
Received Thanks: 0
hast du evtl. auch den Code vom Designer?
freekster is offline  
Old 06/01/2020, 07:50   #4
 
elite*gold: 0
Join Date: Sep 2014
Posts: 339
Received Thanks: 115
Can you just post a zip file with it all in there if its not to much to ask..?
phat34 is offline  
Old 06/02/2020, 19:55   #5
 
elite*gold: 0
Join Date: Oct 2005
Posts: 2,485
Received Thanks: 218
Quote:
Originally Posted by freekster View Post
hast du evtl. auch den Code vom Designer?
Code:
namespace Pellax
{
    partial class Form1
    {
        /// <summary>
        /// Erforderliche Designervariable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Verwendete Ressourcen bereinigen.
        /// </summary>
        /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Vom Windows Form-Designer generierter Code

        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.menuStrip1 = new System.Windows.Forms.MenuStrip();
            this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.engineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.startToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
            this.clearConsoleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.helpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
            this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.label2 = new System.Windows.Forms.Label();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.checkBox1 = new System.Windows.Forms.CheckBox();
            this.button7 = new System.Windows.Forms.Button();
            this.button6 = new System.Windows.Forms.Button();
            this.button5 = new System.Windows.Forms.Button();
            this.button4 = new System.Windows.Forms.Button();
            this.listView1 = new System.Windows.Forms.ListView();
            this.tabPage2 = new System.Windows.Forms.TabPage();
            this.button3 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.richTextBox2 = new System.Windows.Forms.RichTextBox();
            this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.menuStrip1.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.groupBox1.SuspendLayout();
            this.tabPage2.SuspendLayout();
            this.SuspendLayout();
            // 
            // menuStrip1
            // 
            this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.fileToolStripMenuItem,
            this.engineToolStripMenuItem,
            this.helpToolStripMenuItem});
            this.menuStrip1.Location = new System.Drawing.Point(0, 0);
            this.menuStrip1.Name = "menuStrip1";
            this.menuStrip1.Size = new System.Drawing.Size(829, 24);
            this.menuStrip1.TabIndex = 0;
            this.menuStrip1.Text = "menuStrip1";
            // 
            // fileToolStripMenuItem
            // 
            this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.newToolStripMenuItem,
            this.openToolStripMenuItem,
            this.toolStripSeparator1,
            this.saveToolStripMenuItem,
            this.saveAsToolStripMenuItem,
            this.toolStripSeparator2,
            this.exitToolStripMenuItem});
            this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
            this.fileToolStripMenuItem.Text = "File";
            // 
            // newToolStripMenuItem
            // 
            this.newToolStripMenuItem.Name = "newToolStripMenuItem";
            this.newToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
            this.newToolStripMenuItem.Text = "New";
            this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
            // 
            // openToolStripMenuItem
            // 
            this.openToolStripMenuItem.Name = "openToolStripMenuItem";
            this.openToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
            this.openToolStripMenuItem.Text = "Open";
            this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
            // 
            // toolStripSeparator1
            // 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
            this.toolStripSeparator1.Size = new System.Drawing.Size(120, 6);
            // 
            // saveToolStripMenuItem
            // 
            this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
            this.saveToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
            this.saveToolStripMenuItem.Text = "Save";
            this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
            // 
            // saveAsToolStripMenuItem
            // 
            this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
            this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
            this.saveAsToolStripMenuItem.Text = "Save As...";
            this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
            // 
            // toolStripSeparator2
            // 
            this.toolStripSeparator2.Name = "toolStripSeparator2";
            this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6);
            // 
            // exitToolStripMenuItem
            // 
            this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
            this.exitToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
            this.exitToolStripMenuItem.Text = "Exit";
            this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
            // 
            // engineToolStripMenuItem
            // 
            this.engineToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.startToolStripMenuItem,
            this.stopToolStripMenuItem,
            this.toolStripSeparator3,
            this.clearConsoleToolStripMenuItem});
            this.engineToolStripMenuItem.Name = "engineToolStripMenuItem";
            this.engineToolStripMenuItem.Size = new System.Drawing.Size(55, 20);
            this.engineToolStripMenuItem.Text = "Engine";
            // 
            // startToolStripMenuItem
            // 
            this.startToolStripMenuItem.Name = "startToolStripMenuItem";
            this.startToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
            this.startToolStripMenuItem.Text = "Start           F5";
            this.startToolStripMenuItem.Click += new System.EventHandler(this.startToolStripMenuItem_Click);
            // 
            // stopToolStripMenuItem
            // 
            this.stopToolStripMenuItem.Enabled = false;
            this.stopToolStripMenuItem.Name = "stopToolStripMenuItem";
            this.stopToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
            this.stopToolStripMenuItem.Text = "Stop            F9";
            this.stopToolStripMenuItem.Click += new System.EventHandler(this.stopToolStripMenuItem_Click);
            // 
            // toolStripSeparator3
            // 
            this.toolStripSeparator3.Name = "toolStripSeparator3";
            this.toolStripSeparator3.Size = new System.Drawing.Size(143, 6);
            // 
            // clearConsoleToolStripMenuItem
            // 
            this.clearConsoleToolStripMenuItem.Name = "clearConsoleToolStripMenuItem";
            this.clearConsoleToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
            this.clearConsoleToolStripMenuItem.Text = "Clear console";
            this.clearConsoleToolStripMenuItem.Click += new System.EventHandler(this.clearConsoleToolStripMenuItem_Click);
            // 
            // helpToolStripMenuItem
            // 
            this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.helpToolStripMenuItem1,
            this.aboutToolStripMenuItem});
            this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
            this.helpToolStripMenuItem.Text = "Help";
            // 
            // helpToolStripMenuItem1
            // 
            this.helpToolStripMenuItem1.Name = "helpToolStripMenuItem1";
            this.helpToolStripMenuItem1.Size = new System.Drawing.Size(156, 22);
            this.helpToolStripMenuItem1.Text = "Help...          F10";
            this.helpToolStripMenuItem1.Click += new System.EventHandler(this.helpToolStripMenuItem1_Click);
            // 
            // aboutToolStripMenuItem
            // 
            this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
            this.aboutToolStripMenuItem.Size = new System.Drawing.Size(156, 22);
            this.aboutToolStripMenuItem.Text = "About...       F12";
            this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click);
            // 
            // tabControl1
            // 
            this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage2);
            this.tabControl1.Location = new System.Drawing.Point(8, 24);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(616, 352);
            this.tabControl1.TabIndex = 1;
            // 
            // tabPage1
            // 
            this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(246)))), ((int)(((byte)(239)))), ((int)(((byte)(226)))));
            this.tabPage1.Controls.Add(this.label2);
            this.tabPage1.Controls.Add(this.groupBox1);
            this.tabPage1.Location = new System.Drawing.Point(4, 22);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage1.Size = new System.Drawing.Size(608, 326);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "Process overview";
            // 
            // label2
            // 
            this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Verdana", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.SystemColors.HotTrack;
            this.label2.Location = new System.Drawing.Point(240, 40);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(159, 38);
            this.label2.TabIndex = 1;
            this.label2.Text = "Aeterna";
            // 
            // groupBox1
            // 
            this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.groupBox1.Controls.Add(this.checkBox1);
            this.groupBox1.Controls.Add(this.button7);
            this.groupBox1.Controls.Add(this.button6);
            this.groupBox1.Controls.Add(this.button5);
            this.groupBox1.Controls.Add(this.button4);
            this.groupBox1.Controls.Add(this.listView1);
            this.groupBox1.Location = new System.Drawing.Point(112, 96);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(384, 184);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Guild Wars process overview";
            // 
            // checkBox1
            // 
            this.checkBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.checkBox1.AutoSize = true;
            this.checkBox1.Location = new System.Drawing.Point(292, 48);
            this.checkBox1.Name = "checkBox1";
            this.checkBox1.Size = new System.Drawing.Size(72, 17);
            this.checkBox1.TabIndex = 2;
            this.checkBox1.Text = "InjectDLL";
            this.checkBox1.UseVisualStyleBackColor = true;
            // 
            // button7
            // 
            this.button7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button7.Location = new System.Drawing.Point(288, 152);
            this.button7.Name = "button7";
            this.button7.Size = new System.Drawing.Size(88, 24);
            this.button7.TabIndex = 4;
            this.button7.Text = "Close";
            this.button7.UseVisualStyleBackColor = true;
            this.button7.Click += new System.EventHandler(this.button7_Click);
            // 
            // button6
            // 
            this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button6.Location = new System.Drawing.Point(288, 120);
            this.button6.Name = "button6";
            this.button6.Size = new System.Drawing.Size(88, 24);
            this.button6.TabIndex = 3;
            this.button6.Text = "Start";
            this.button6.UseVisualStyleBackColor = true;
            this.button6.Click += new System.EventHandler(this.button6_Click);
            // 
            // button5
            // 
            this.button5.Anchor = System.Windows.Forms.AnchorStyles.Right;
            this.button5.Enabled = false;
            this.button5.Location = new System.Drawing.Point(288, 88);
            this.button5.Name = "button5";
            this.button5.Size = new System.Drawing.Size(88, 24);
            this.button5.TabIndex = 2;
            this.button5.Text = "Detach";
            this.button5.UseVisualStyleBackColor = true;
            this.button5.Click += new System.EventHandler(this.button5_Click);
            // 
            // button4
            // 
            this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.button4.Location = new System.Drawing.Point(288, 16);
            this.button4.Name = "button4";
            this.button4.Size = new System.Drawing.Size(88, 24);
            this.button4.TabIndex = 1;
            this.button4.Text = "Attach";
            this.button4.UseVisualStyleBackColor = true;
            this.button4.Click += new System.EventHandler(this.button4_Click);
            // 
            // listView1
            // 
            this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.listView1.Font = new System.Drawing.Font("Courier New", 8.5F);
            this.listView1.LabelWrap = false;
            this.listView1.Location = new System.Drawing.Point(8, 16);
            this.listView1.MultiSelect = false;
            this.listView1.Name = "listView1";
            this.listView1.ShowGroups = false;
            this.listView1.Size = new System.Drawing.Size(272, 160);
            this.listView1.TabIndex = 0;
            this.listView1.UseCompatibleStateImageBehavior = false;
            this.listView1.View = System.Windows.Forms.View.List;
            // 
            // tabPage2
            // 
            this.tabPage2.Controls.Add(this.button3);
            this.tabPage2.Controls.Add(this.button2);
            this.tabPage2.Controls.Add(this.richTextBox2);
            this.tabPage2.Location = new System.Drawing.Point(4, 22);
            this.tabPage2.Name = "tabPage2";
            this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
            this.tabPage2.Size = new System.Drawing.Size(608, 326);
            this.tabPage2.TabIndex = 1;
            this.tabPage2.Text = "Lua script overview";
            this.tabPage2.UseVisualStyleBackColor = true;
            // 
            // button3
            // 
            this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button3.Enabled = false;
            this.button3.Location = new System.Drawing.Point(368, 298);
            this.button3.Name = "button3";
            this.button3.Size = new System.Drawing.Size(240, 24);
            this.button3.TabIndex = 2;
            this.button3.Text = "Stop Script";
            this.button3.UseVisualStyleBackColor = true;
            this.button3.Click += new System.EventHandler(this.button3_Click);
            // 
            // button2
            // 
            this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.button2.Location = new System.Drawing.Point(0, 298);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(240, 24);
            this.button2.TabIndex = 1;
            this.button2.Text = "Run script";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // richTextBox2
            // 
            this.richTextBox2.AcceptsTab = true;
            this.richTextBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.richTextBox2.Font = new System.Drawing.Font("Courier New", 9.5F);
            this.richTextBox2.Location = new System.Drawing.Point(0, 0);
            this.richTextBox2.Name = "richTextBox2";
            this.richTextBox2.Size = new System.Drawing.Size(608, 296);
            this.richTextBox2.TabIndex = 0;
            this.richTextBox2.Text = "";
            this.richTextBox2.TextChanged += new System.EventHandler(this.richTextBox2_TextChanged);
            // 
            // propertyGrid1
            // 
            this.propertyGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.propertyGrid1.Location = new System.Drawing.Point(632, 40);
            this.propertyGrid1.Name = "propertyGrid1";
            this.propertyGrid1.Size = new System.Drawing.Size(192, 512);
            this.propertyGrid1.TabIndex = 2;
            // 
            // richTextBox1
            // 
            this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.richTextBox1.Font = new System.Drawing.Font("Courier New", 9.5F);
            this.richTextBox1.Location = new System.Drawing.Point(8, 400);
            this.richTextBox1.Name = "richTextBox1";
            this.richTextBox1.ReadOnly = true;
            this.richTextBox1.Size = new System.Drawing.Size(616, 152);
            this.richTextBox1.TabIndex = 3;
            this.richTextBox1.Text = "";
            // 
            // label1
            // 
            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(8, 384);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(87, 13);
            this.label1.TabIndex = 4;
            this.label1.Text = "Aeterna console:";
            // 
            // button1
            // 
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button1.Location = new System.Drawing.Point(520, 378);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(104, 20);
            this.button1.TabIndex = 5;
            this.button1.Text = "Clear console";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.button1_Click);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(829, 556);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.richTextBox1);
            this.Controls.Add(this.propertyGrid1);
            this.Controls.Add(this.tabControl1);
            this.Controls.Add(this.menuStrip1);
            this.MainMenuStrip = this.menuStrip1;
            this.Name = "Form1";
            this.Text = "Aeterna - v1.0";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabPage1.PerformLayout();
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.tabPage2.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip menuStrip1;
        private System.Windows.Forms.TabControl tabControl1;
        private System.Windows.Forms.TabPage tabPage1;
        private System.Windows.Forms.TabPage tabPage2;
        private System.Windows.Forms.PropertyGrid propertyGrid1;
        private System.Windows.Forms.RichTextBox richTextBox1;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Button button7;
        private System.Windows.Forms.Button button6;
        private System.Windows.Forms.Button button5;
        private System.Windows.Forms.Button button4;
        private System.Windows.Forms.ListView listView1;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.RichTextBox richTextBox2;
        private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
        private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
        private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem engineToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem startToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem stopToolStripMenuItem;
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
        private System.Windows.Forms.ToolStripMenuItem clearConsoleToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem1;
        private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
        private System.Windows.Forms.CheckBox checkBox1;
    }
}
There you go.
Term!nX is offline  
Thanks
1 User
Old 07/15/2020, 14:03   #6
 
elite*gold: 0
Join Date: May 2010
Posts: 92
Received Thanks: 15
weil ne .zip oder Github zu einfach wäre
iTeX- is offline  
Reply


Similar Threads Similar Threads
hack using engine(any engine?) anf by pass for this engine..
10/09/2009 - Grand Chase Philippines - 3 Replies
wla na bang engine na gumagana?



All times are GMT +1. The time now is 09:02.


Powered by vBulletin®
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

BTC: 33E6kMtxYa7dApCFzrS3Jb7U3NrVvo8nsK
ETH: 0xc6ec801B7563A4376751F33b0573308aDa611E05

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2021 elitepvpers All Rights Reserved.