コード例 #1
0
ファイル: Player.cs プロジェクト: crazypoultry/Stab_Face
        /// <summary>
        /// Moves to a specified Waypoint.
        /// Other movement function rely on this.
        /// Implements CTM struct for movement currently.
        /// TODO: Facade this when Settings are implmented
        /// </summary>
        /// <param name="wp"></param>
        private void moveToLoc(Waypoint wp)
        {
            if (!isInRange(wp, 1.0f))
            {
                int tries = 0;
                while (verifyWrite(wp.getX(), 0xC4D890) == false && tries < 3)
                {
                    MemoryWriter.WriteMem(WoW_Instance.getProcess(), 0xC4D890, BitConverter.GetBytes(wp.getX()));
                    tries++;
                    if (tries >= 3)
                    {
                        return;
                    }
                }
                tries = 0;
                Thread.Sleep(3);
                while (verifyWrite(wp.getY(), 0xC4D894) == false && tries < 3)
                {
                    MemoryWriter.WriteMem(WoW_Instance.getProcess(), 0xC4D894, BitConverter.GetBytes(wp.getY()));
                    tries++;
                    if (tries >= 3)
                    {
                        return;
                    }
                }
                tries = 0;
                Thread.Sleep(3);
                float z = wp.getZ();
                if (z == 0)
                {
                    // For glider imports
                    z = this.getLocation().getZ();
                }
                while (verifyWrite(wp.getZ(), 0xC4D898) == false && tries < 3)
                {
                    MemoryWriter.WriteMem(WoW_Instance.getProcess(), 0xC4D898, BitConverter.GetBytes(wp.getZ()));
                    tries++;
                    if (tries >= 3)
                    {
                        return;
                    }
                }
                tries = 0;
                Thread.Sleep(5);

                MemoryWriter.WriteMem(WoW_Instance.getProcess(), 0xC4D888, new byte[] { (byte)0x04 });
                //MemoryWriter.WriteMem(WoW_Instance.getProcess(), 0xC4D888, new byte[] { (byte)0x04 });

                //Thread.Sleep(200);
                //Debug.Print("Moving: " + isMoving());
                //while (isMoving())
                //    Thread.Sleep(15); //Enjoy the ride

                //Thread.Sleep(20);
            }
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: crazypoultry/Stab_Face
        /// <summary>
        /// Attempts to target a Unit.
        /// Does not work very well currently.
        /// TODO: Facade this when Settings are implmented
        /// </summary>
        /// <param name="u"></param>
        private void targetUnit(Unit u)
        {
            // Tab targeting method

            /*if (target!= null && MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID())
             *  return; // Already targeting
             * else
             * {
             *  while (true)
             *  {
             *      try
             *      {
             *
             *          faceLocation(u.getLocation());
             *          PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, "F");
             *          Thread.Sleep(200);
             *          if (MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID())
             *              this.target = u;
             *              return;
             *      }
             *      catch (Exception ex) { }
             *  }
             * } */

            // Memory write method. Requires macro: '' bound to key 'T'.
            if (target != null && MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID())
            {
                return; // Already targeting
            }
            else
            {
                while (true)
                {
                    try
                    {
                        faceLocation(u.getLocation());
                        MemoryWriter.WriteMem(WoW_Instance.getProcess(), 0xB4E2E0, BitConverter.GetBytes(u.getGUID()));
                        Thread.Sleep(100);
                        PostMessage.SendKeys((int)WoW_Instance.getProcess().MainWindowHandle, "T");
                        Thread.Sleep(200);
                        if (MemoryReader.readUInt64(WoW_Instance.getProcess().Handle, objBase + PlayerOffsets.CUR_TARGET_GUID_OFFSET) == u.getGUID())
                        {
                            this.target = u;
                        }
                        return;
                    }
                    catch (Exception ex) { }
                }
            }
        }