public override void BotEvent(Object source) {
            this.ticks++;
            this.wowinfo.Refresh(wow);
            Player = new GameObject(wow, this.wowinfo.PlayerGUID);
            setWalkTarget(out WalkTarget);
            if (WalkTarget.GUID != 0) {
                Vector3 RealTarget = Behindtarget(WalkTarget);
                double mydiff = AngleDiff(Calculateangle(RealTarget), Player.Unit.Rotation);
                if (Vector3.Distance(Player.Unit.Position, RealTarget) > PositionThreshhold) {
                    if ((Math.Abs(mydiff) < RotationThreshhold)) {
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, ref left);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);

                        SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_UP, ref forward);
                        //}
                        //else if (forward || left || right) {
                        //    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, ref forward);
                        //    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, ref left);
                        //    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);
                        //}
                    }
                    else if (mydiff < 0) {
                        SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_LEFT, ref left);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, ref forward);

                    }
                    else if (mydiff > 0) {
                        SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, ref left);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, ref forward);

                    }
                }
                else{
                    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, ref forward);
                    double dmgdiff = AngleDiff(Calculateangle(WalkTarget.Unit.Position), Player.Unit.Rotation);
                    if ((Math.Abs(dmgdiff) < RotationThreshhold)) {
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, ref left);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);
                    }
                    else if (dmgdiff < 0) {
                        SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_LEFT, ref left);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);
                    }
                    else if (dmgdiff > 0) {
                        SendKey.KeyDown(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);
                        SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, ref left);

                    }
                }
            }
            else {
                if (forward || left || right) {
                    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_UP, ref forward);
                    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_LEFT, ref left);
                    SendKey.KeyUp(ConstController.WindowsVirtualKey.VK_RIGHT, ref right);
                }
            }
        }
Example #2
0
 public DPSBot(BlackMagic wowProcess, WoWGlobal globalinfo, uint tt) : base(tt) {
     this.wow = wowProcess;
     this.wowinfo = globalinfo;
     this.wowinfo.Refresh(wowProcess);
     Player = new GameObject(wowProcess, this.wowinfo.PlayerGUID);
     Target = new GameObject(wowProcess, this.wowinfo.TargetGUID);
     Focus = new GameObject(wowProcess, this.wowinfo.FocusGUID);
 }
Example #3
0
 private void SetTargetBeta() {
     if (Focus.Unit.TargetGUID != 0) {
         Target = new GameObject(wow, (UInt64)this.Focus.Unit.TargetGUID);
     }
     else {
         Target = new GameObject(wow, (UInt64)this.wowinfo.FocusGUID);
     }
 }
 public WalkBehindBot(BlackMagic wowProcess, WoWGlobal globalinfo, uint tt, WalkTargetType wtf, float posThreshhold) : base(tt) {
     this.wow = wowProcess;
     this.wowinfo = globalinfo;
     this.wowinfo.Refresh(wowProcess);
     this.WhatToFollow = wtf;
     this.PositionThreshhold = posThreshhold;
     Player = new GameObject(wowProcess, this.wowinfo.PlayerGUID);
     setWalkTarget(out WalkTarget);
 }
        public override void BotEvent(Object source) {
            this.ticks++;
            this.wowinfo.Refresh(wow);
            Player = new GameObject(wow, this.wowinfo.PlayerGUID);
            Target = new GameObject(wow, this.wowinfo.TargetGUID);
            Focus = new GameObject(wow, this.wowinfo.FocusGUID);
            Raid = new WoWRaid(wow);
            Rota();

        }
Example #6
0
        public override void BotEvent(Object source) {
            this.ticks++;
            this.wowinfo.Refresh(wow);
            Player = new GameObject(wow, this.wowinfo.PlayerGUID);
            //CurTarget = new GameObject(wow, this.wowinfo.TargetGUID);
            Focus = new GameObject(wow, this.wowinfo.FocusGUID);
            SetTargetBeta();
            if (Target.GUID != 0) {
                Rota();
            }


        }
Example #7
0
 public Tester(BlackMagic w, GameObject Player, float threshhold) {
     GameObject TempObject = new GameObject(Initializer.FirstObject);
     int i = 0;
     while ((uint)TempObject.BaseAddress != 0) {
         i++;
         Console.WriteLine(TempObject.Unit.Position.X + " " + TempObject.Unit.Position.X + " " + TempObject.Unit.Position.Z);
         Console.WriteLine(Player.Unit.Position.X + " " + Player.Unit.Position.X + " " + Player.Unit.Position.Z);
         if (Vector3.Distance(TempObject.Unit.Position, Player.Unit.Position) < threshhold && TempObject.GUID != Player.GUID) {
             gameobjects.Add(TempObject);
             Console.WriteLine("Found one");
         }
         TempObject = new GameObject(w, (UIntPtr)w.ReadUInt(((uint)TempObject.BaseAddress + (uint)ConstOffsets.ObjectManager.NextObject)));
     }
 }
Example #8
0
        static void Main(string[] args) {
            myargs = args;
            WowPrinter.Print(ConstStrings.WelcomeMessage);
            if (args.Length > 0) {
                PROCESS_WINDOW_TITLE = args[0].ToString();  //If has arguments then connect to that window, not default
            }
            wowPrinter.Print(new Message("Connecting to window named " + PROCESS_WINDOW_TITLE));
            if (!Initializer.ConnectToGame(out wow, PROCESS_WINDOW_TITLE)) {
                WowPrinter.PrintExit(ConstStrings.InitError);            //Initialize if fail terminate the program
                return;
            }
            else {
                //Init success
                ClientInfo = new WoWGlobal(wow);
                WowPrinter.Print(ClientInfo);
                GameObject PlayerObject = new GameObject(wow, (UInt64)ClientInfo.PlayerGUID);
                GameObject TargetObject = new GameObject(wow, (UInt64)ClientInfo.TargetGUID);
                WoWRaid wr = new WoWRaid(wow);
                WoWParty wp = new WoWParty(wow);
                WowPrinter.Print(wp, 1);
                WowPrinter.Print(wr, 1);
                WowPrinter.Print(TargetObject); //For debug
                //DruidBalanceComplex gyula = new DruidBalanceComplex(100, 20);
                //Other.Tester tst = new Other.Tester(wow, PlayerObject, 60);
                //TestBot tb = new TestBot(100,100, ComplexBotStance.DpsTargetRanged);
                //WalkBehindBot kutya = new WalkBehindBot(wow, clientInfo, 100, WalkTargetType.CurrentTarget, 1);
                InitPvPBotBasedonClass(args, PlayerObject.Unit.WowClass);
                //SendKey.Rect pos =SendKey.GetWoWPosition();
                //SendKey.SetCursorPos((pos.Right-pos.Left)/2, (pos.Bottom - pos.Top) / 2);
                //StressTester asd = new StressTester(Wow, ClientInfo, 100);
                bool temp = true;
                while (temp) {
                    switch (Console.ReadKey().Key) {
                        case ConsoleKey.R:
                            RestartApp(args);
                            break;
                        case ConsoleKey.T:
                            temp = false;
                            break;
                    }
                }
                return;
            }

        }
Example #9
0
 public static bool ConnectToGame(out BlackMagic w, string title) {
     w = new BlackMagic();
     try {
         if (!w.OpenProcessAndThread(SProcess.GetProcessFromWindowTitle(title))) {
             return false;
         }
         Console.WriteLine("Process found...");
         uint ObjMgrAddr = w.ReadUInt(w.ReadUInt((uint)w.MainModule.BaseAddress + (uint)ConstOffsets.ObjectManager.CurMgrPointer) + (uint)ConstOffsets.ObjectManager.CurMgrOffset);
         Console.WriteLine("Object Manager found... at x{0:X}",ObjMgrAddr);
         FirstObject = new GameObject(w,(UIntPtr)w.ReadUInt(ObjMgrAddr + (uint)ConstOffsets.ObjectManager.FirstObject));
         Console.WriteLine("First Object found...");
         return true;
         
     }
     catch {
         return false;
     }
 }
        private RaidMembers FindLowestRaidMember(out GameObject tempObject) {
            RaidMembers result = RaidMembers.RaidMember1;
            tempObject = new GameObject(wow, Raid.RaidMembers[0]);
            NumberofLowHPRaidMembers = 0;
            uint playerhp = tempObject.Unit.GetHealthPercent();
            if (playerhp < HealthForAoeHeal && playerhp != 0) {
                NumberofLowHPRaidMembers++;
            }
            for (int i = 1; i < this.Raid.RaidMembers.Count; i++) {
                GameObject temp2Object = new GameObject(wow, Raid.RaidMembers[i]);
                if (temp2Object.Unit.GetHealthPercent() < HealthForAoeHeal && temp2Object.Unit.Health != 0) {
                    NumberofLowHPRaidMembers++;
                    //}
                    if (Vector3.Distance(Player.Unit.Position, temp2Object.Unit.Position) < 40 && GameObject.HPMin(ref tempObject, temp2Object) && temp2Object.Unit.Health != 0) {
                        result = (RaidMembers)i+1;
                    }
                }
            }
            return result;

        }
Example #11
0
 private PartyMembers FindLowestPartyMember(out GameObject tempObject) {
     PartyMembers result = PartyMembers.Player;
     tempObject = new GameObject(wow, (UInt64)wowinfo.PlayerGUID);
     NumberofLowHPPartyMembers = 0;
     uint playerhp = tempObject.Unit.GetHealthPercent();
     if (playerhp < HealthForAoeHeal && playerhp!=0) {
         NumberofLowHPPartyMembers++;
     }
     if (playerhp < HealthForSelfishHeal) {
         return result;
     }
     else {
         for (int i = 0; i < this.Party.Party.Count; i++) {
             GameObject temp2Object = new GameObject(wow, Party.Party[i]);
             if (temp2Object.Unit.GetHealthPercent() < HealthForAoeHeal && temp2Object.Unit.Health!=0) {
                 NumberofLowHPPartyMembers++;
             }
             if (Vector3.Distance(Player.Unit.Position, temp2Object.Unit.Position) < 40 && GameObject.HPMin(ref tempObject, temp2Object) && temp2Object.Unit.Health!=0) {
                 result = (PartyMembers)i + 1;
             }
         }
     }
     return result;
 }
Example #12
0
 public static bool HPMin(ref GameObject minimum, GameObject next) {
     if (next.GUID == 0 || minimum.unit.GetHealthPercent() < next.Unit.GetHealthPercent()) {
         return false;
     }
     else{
         minimum = next;
         return true;
     }
 }
 private void setWalkTarget(out GameObject wtarget) {
     switch (this.WhatToFollow) {
         case WalkTargetType.CurrentFocus:
             wtarget = new GameObject(this.wow, (UInt64)this.wowinfo.FocusGUID);
             return;
         case WalkTargetType.CurrentTarget:
             wtarget = new GameObject(this.wow, (UInt64)this.wowinfo.TargetGUID);
             return;
         case WalkTargetType.Other:
             throw new NotImplementedException();
     }
     wtarget = new GameObject(this.wow, (UInt64)this.wowinfo.FocusGUID);
 }
Example #14
0
        private void RefreshBuffs(BlackMagic w, GameObject go) {
            this.Buffs.Clear();
            if (this.AddressofTheBuffs == BuffStorage.Unkown) {
                if ((uint)go.BuffBigArrayAddress >= (uint)w.MainModule.BaseAddress) {
                    this.AddressofTheBuffs = BuffStorage.BigArray;
                }
                else {
                    this.AddressofTheBuffs = BuffStorage.SmallArray;
                }
            }
            while (true) {
                if (FillBuffsList(w, go)) {
                    break;
                }
            }


        }
Example #15
0
 private bool FillBuffsList(BlackMagic w, GameObject go) {
     uint addr = 0;
     uint i = 0;
     uint temp = 1;
     switch (this.AddressofTheBuffs) {
         case BuffStorage.Unkown:
             throw new NullReferenceException();
         case BuffStorage.SmallArray:
             addr = (uint)go.BuffSmallArrayAddress;
             break;
         case BuffStorage.BigArray:
             addr = (uint)go.BuffBigArrayAddress;
             break;
     }
     try {
         while (temp != 0 && temp < 121820) {
             temp = w.ReadUInt(addr + (0x08 * i));
             i++;
             if (temp != 0 && temp < 121820) {
                 this.Buffs.Add(temp);
             }
         }
         return true;
     }
     catch {
         Program.WowPrinter.Print(ConstStrings.BuffError);
         switch (this.AddressofTheBuffs) {
             case BuffStorage.Unkown:
                 throw new NullReferenceException();
             case BuffStorage.SmallArray:
                 this.AddressofTheBuffs = BuffStorage.Unkown;
                 break;
             case BuffStorage.BigArray:
                 this.AddressofTheBuffs = BuffStorage.SmallArray;
                 break;
         }
         return false;
     }
 }
Example #16
0
        public void Refresh(BlackMagic w, GameObject go) {
            try {
                this.WowClass = (WoWClass)w.ReadByte((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.Class8);
                this.Shapeshift = (ShapeshiftForm)w.ReadByte((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.ShapeShift);
                this.Role = Role.Unknown;

                this.Level = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.Level);
                this.Health = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.Health);
                this.MaxHealth = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.MaxHealth);
                this.Power = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.Power);
                this.MaxPower = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.MaxPower);
                this.SecondaryPower = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.SecondaryPower);
                this.MovingInfo = new MovementFlags(w.ReadByte((uint)go.MovementArrayAddress + (uint)ConstOffsets.Movements.IsMoving8));
                this.HolyPower = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.HolyPower);
                this.Faction = w.ReadUInt((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.Faction);
                this.TargetGUID = w.ReadUInt64((uint)go.DescriptorArrayAddress + (uint)ConstOffsets.Descriptors.TargetGUID);
                //byte temp = w.ReadByte((uint)go.BuffSmallArrayAddress + (uint)ConstOffsets.Descriptors.IsinCombat);
                this.IsInCombat = (w.ReadByte((w.ReadUInt((uint)go.BaseAddress + (uint)ConstOffsets.Movements.IsinCombatOffset1)) + (uint)ConstOffsets.Movements.IsinCombatOffset2+2)& 0x8)!=0;
                this.position.X = w.ReadFloat((uint)go.BaseAddress + (uint)ConstOffsets.Positions.X);
                this.position.Y = w.ReadFloat((uint)go.BaseAddress + (uint)ConstOffsets.Positions.Y);
                this.position.Z = w.ReadFloat((uint)go.BaseAddress + (uint)ConstOffsets.Positions.Z);

                this.CastingSpellID = w.ReadUInt((uint)go.BaseAddress + (uint)ConstOffsets.CastingInfo.IsCasting);
                this.ChannelingSpellID = w.ReadUInt((uint)go.BaseAddress + (uint)ConstOffsets.CastingInfo.ChanneledCasting);
                this.BalancePower = w.ReadInt((uint)go.BaseAddress + (uint)ConstOffsets.CastingInfo.BalancePower);
                //this.BalanceStance = (BalanceFlag)(w.ReadByte((uint)go.BaseAddress + (uint)ConstOffsets.CastingInfo.BalanceState) & 0x01);
                float temprot = w.ReadFloat((uint)go.BaseAddress + (uint)ConstOffsets.Positions.Rotation);

                if (temprot > Math.PI) {
                    this.Rotation = -(2 * Math.PI - temprot);
                }
                else {
                    this.Rotation = temprot;
                }
                this.RefreshBuffs(w, go);
            }
            catch {
                Program.WowPrinter.Print(ConstStrings.ReadError);
            }

            //this.Position = new Vector3(x,y,z);
        }
Example #17
0
 public WoWUnit(BlackMagic w, GameObject go) {
     this.Refresh(w, go);
 }
Example #18
0
 public GameObject(GameObject other) {
     this.BaseAddress = other.BaseAddress;
     this.GUID = other.GUID;
     this.DescriptorArrayAddress = other.DescriptorArrayAddress;
     this.BuffBigArrayAddress = other.BuffBigArrayAddress;
     this.BuffSmallArrayAddress = other.BuffSmallArrayAddress;
     this.Unit = new WoWUnit();
 }
Example #19
0
 public static void RefreshObjectMangaer(BlackMagic w) {
     uint ObjMgrAddr = w.ReadUInt(w.ReadUInt((uint)w.MainModule.BaseAddress + (uint)ConstOffsets.ObjectManager.CurMgrPointer) + (uint)ConstOffsets.ObjectManager.CurMgrOffset);
     FirstObject = new GameObject(w, (UIntPtr)w.ReadUInt(ObjMgrAddr + (uint)ConstOffsets.ObjectManager.FirstObject));
 }
Example #20
0
 public StressTester(BlackMagic wowProcess, WoWGlobal globalinfo, uint tt) : base(tt) {
     this.wow = wowProcess;
     this.wowinfo = globalinfo;
     Player = new GameObject(wowProcess, this.wowinfo.PlayerGUID);
     Target = new GameObject(wowProcess, this.wowinfo.TargetGUID);
 }
Example #21
0
        public void Print(GameObject go) {
            Type type = go.GetType();
            PropertyInfo[] properties = type.GetProperties();
            Console.WriteLine("Printing Info about a " + type.ToString());
            foreach (PropertyInfo property in properties) {
                if (property.Name.Contains("GUID")) {
                    Console.WriteLine(property.Name.ToString().PadRight(Paddistance) + String.Format("0x{0:X16}", property.GetValue(go, null)));

                }
                else if(property.Name.Contains("Address")){
                    uint temp = (uint)(UIntPtr)property.GetValue(go, null);
                    Console.WriteLine(property.Name.ToString().PadRight(Paddistance) + String.Format("0x{0:X8}", temp));
                }
                else {
                    Console.WriteLine(property.Name.ToString().PadRight(Paddistance) + property.GetValue(go, null));
                }
            }
            Print(go.Unit,3);
        }
Example #22
0
        public static Vector3 Behindtarget(GameObject target) {
            return new Vector3(
                target.Unit.Position.X + (float)Math.Cos(target.Unit.Rotation) * BehindScale,
                target.Unit.Position.Y + (float)Math.Sin(target.Unit.Rotation) * BehindScale,
                target.Unit.Position.Z);

        }
Example #23
0
 protected virtual void RefreshGameObjects() {
     Program.ClientInfo.Refresh(Program.Wow);
     target = new GameObject(Program.Wow, Program.ClientInfo.TargetGUID);
     player = new GameObject(Program.Wow, Program.ClientInfo.PlayerGUID);
     focus = new GameObject(Program.Wow, Program.ClientInfo.FocusGUID);
 }
Example #24
0
        public GameObject(BlackMagic w, UInt64 guid) {
            try {
                this.GUID = guid;
                if (this.GUID != 0) {
                    GameObject TempObject = new GameObject(Initializer.FirstObject);
                    while ((uint)TempObject.BaseAddress != 0) {
                        if (TempObject.GUID == this.GUID) {
                            this.BaseAddress = TempObject.BaseAddress;
                            this.GUID = TempObject.GUID;
                            this.DescriptorArrayAddress = TempObject.DescriptorArrayAddress;
                            this.BuffBigArrayAddress = TempObject.BuffBigArrayAddress;
                            this.BuffSmallArrayAddress = TempObject.BuffSmallArrayAddress;
                            this.MovementArrayAddress = (UIntPtr)w.ReadUInt((uint)this.BaseAddress + (uint)ConstOffsets.ObjectManager.LocalMovementArray);
                            this.RefreshUnit(w);
                            return;
                        }
                        else {
                            TempObject = new GameObject(w, (UIntPtr)w.ReadUInt(((uint)TempObject.BaseAddress + (uint)ConstOffsets.ObjectManager.NextObject)));
                        }
                    }
                    Program.WowPrinter.Print(new Error(String.Format("Couldnt Find Gameobject with GUID 0x{0:X16}", guid)));
                }
                this.Unit = new WoWUnit();

            }
            catch {
                this.Unit = new WoWUnit();
                Program.WowPrinter.Print(ConstStrings.GameObjectConstructorError);
            }
        }