我是新来的额 发表于 2023-1-26 02:00:23

AutoLoot - 自动捡东西辅助

下载地址:链接:https://pan.baidu.com/s/1BmUrK99Epu-c2uwt4RB-GQ?pwd=jgad 提取码:jgad --来自百度网盘超级会员V5的分享
这是如何工作的:以管理员模式 打开AutoLoot.exe,并在游戏过程中按下空格键。程序将在鼠标附近的位置寻找可以拾取的物品,并帮你把它捡起来。该软件应当同时适用国服与国际服。
如何使用:在游戏过程中按下空格键拾取单一物品。或按下Capslock(大写锁定键)开启连续拾取模式。
如何安装:https://img.caimogu.cc/data/cache/editor/2023/01/26/63782f93e84aa947999c33003a63cf2d.png
[*]确保在你的游戏中,选择“按住自定义按键拾取物品”选项,并且设置物品拾取按键为 "F"。
[*]使用本文中提供的过滤器(将本文提供的文件放在你游戏的过滤器目录中,并选择使用Sharket3.20速刷版.filter这个过滤器进行游戏 )
[*]在运行游戏前打开AutoLoot.exe,该程序不需要安装

如果你成功运行了程序,他应当是一个没有窗口的黑框框https://img.caimogu.cc/data/cache/editor/2023/01/26/1865751bb6ad3016bc17a6aa7f34d456.png
自动捡东西预览https://v.qq.com/x/page/o3500jm6o1v.htmlhttps://v.qq.com/x/page/g35002srxer.html

可能存在的问题:
[*]为什么要使用新的过滤器:我修改了过滤器对一些物品的显示颜色,从而完成物品匹配,如果你的过滤器显示的颜色并非程序中设定的那样,那它将无法完成物品拾取。
[*]流放之路游戏中会因为地图背景与玩家技能的影响导致画面混乱,可能无法很好地完成识别,这种情况偶有发生。
[*]我的电脑使用3440*1440分辨率,程序的效果在其他分辨率的电脑上可能存在差异。我没有在其他电脑上测试过该软件,我不知道其他环境下该软件是否能正常运行,如有环境问题你可以在本贴中进行回复。
[*]为什么鼠标移动了但是没有拾取物品:请以管理员模式重新打开AutoLoot.exe

这里面是不是有病毒这个程序需要监听你的键盘输入,并向系统发送移动鼠标和模拟键盘按键的指令,我不确定你的防火墙会不会拦截这些行为。这个程序一共没几行代码,我直接把源代码贴在这里,你也可以不使用我打包好的exe,自己下载python运行源代码。
可以拾取的物品高级通货、重铸石、后悔石、神圣石、混沌石、六分仪、崇高、先驱石、剥离石等夏武拉裂片、乌尔尼多裂片、以及对应的裂隙石、裂隙祝福污秽系列通货、污秽链接石、污秽神秘石、污秽护甲片、污秽磨刀石等高级精华化石与共振器各种孕育石高级圣油各种五军裂片高级催化剂拟象裂片、梦魇宝珠充能罗盘、测绘罗盘各种等级的古灵余烬、古灵溶液女神祭品绿门碎片部分圣甲虫各种命能高级地图、四守卫地图
因为很多游戏玩法我平常没有接触,比如庄园、精华、深渊、盗贼流放者、神龛、挖坟。所以这些模式对应的掉落物我也不知道捡那些,因此没有调整过它们的颜色显示。你可以使用下面的自定义过程配置适合自己的过滤器。
如何定制化物品拾取在过滤器中,将想要拾取的物品设置为:    SetTextColor 255 255 255 # T2通货    SetBackgroundColor 255 0 0 # T2通货    SetBorderColor 0 255 0 # T2通货    SetFontSize 64 # T2通货即纯红色背景,字体大一点就行。程序将拾取任何是红色背景的东西。
如何改快捷键:自己改代码

源代码:import sysfrom time import time, sleep
import numpy as npimport win32gui, win32ui, win32api, win32confrom pynput import keyboard

def num_of_detection_box(size: int, stride: int):    return int(size / stride)

def load_cfg() -> dict:    try:      with open('AutoLootConfig.ini', 'r', encoding='utf-8') as file:            config = eval(file.read())            assert isinstance(config, dict)            return dict(config)    except Exception as e:      print('Config File Parse Failed.')      return {}
CFG = load_cfg()STRIDE_X, STRIDE_Y = 24, 8DOWNSAMPLE_RATE = int(CFG.get('DOWNSAMPLE_RATE', 2))COLOR_THRESHOLD, STD_THRESHOLD = CFG.get('COLOR_THRESHOLD', 35), 20DELAY      = CFG.get('DELAY', 0.2)SEARCH_RANGE = CFG.get('SEARCH_RANGE', 640)

def hello():    print('POE - AutoLoot Ready to Roll.')    print(f'Color Threshold: {COLOR_THRESHOLD}')    print(f'Search Range: {SEARCH_RANGE}')    print(f'Loot Delay: {DELAY}')    print(f'Downsample Rate: {DOWNSAMPLE_RATE}')        print('')       print(f'Press "Space" to pick up an item. Press "CapsLock" to pick up item continually.')   
class Looter:    def __init__(self) -> None:      self.fever_mode = False            self.handle = win32gui.FindWindow(0, "Path of Exile")      if self.handle == 0:             win32gui.MessageBox(0, "游戏尚未启动,无法找到窗口.", "Error", 0)            sys.exit(-1)
      self.wDC = win32gui.GetWindowDC(self.handle)      self.dcObj = win32ui.CreateDCFromHandle(self.wDC)      self.cDC = self.dcObj.CreateCompatibleDC()      self.dataBitMap = win32ui.CreateBitmap()      self.width = None      self.height = None      self.l_offset, self.t_offset = 0, 0      self.n_box_x, self.n_box_y = 0, 0      self.lx, self.ly = 0, 0
    def screenshot(self) -> np.ndarray:      # get window size      l, t, r, b = win32gui.GetWindowRect(self.handle)      self.width = int((r - l))       self.height = int((b - t))      self.l_offset = l      self.t_offset = t            self.dataBitMap.CreateCompatibleBitmap(self.dcObj, self.width, self.height)      self.cDC.SelectObject(self.dataBitMap)      self.cDC.BitBlt((0, 0), (self.width, self.height), self.dcObj, (0, 0), win32con.SRCCOPY)            # save the image as a bitmap file      signedIntsArray = self.dataBitMap.GetBitmapBits(True)      img = np.frombuffer(signedIntsArray, dtype="uint8").reshape(self.height, self.width, 4)      img = img[::DOWNSAMPLE_RATE, ::DOWNSAMPLE_RATE, :3]            self.width =int(self.width / DOWNSAMPLE_RATE)      self.height = int(self.height / DOWNSAMPLE_RATE)      self.n_box_x = num_of_detection_box(self.width, STRIDE_X)      self.n_box_y = num_of_detection_box(self.height, STRIDE_Y)      return img

    def detect(self, shot: np.ndarray, srange: int, order: str = 'Near to Center') -> tuple:      if self.fever_mode: srange = 10000      # Record time      tick = time()
      # get mouse cursor position      cursor = win32api.GetCursorPos()
      # Step 1. Do Screen Shot      shot = shot[: self.n_box_y * STRIDE_Y, : self.n_box_x * STRIDE_X, ::-1]
      # Image filter      shot = shot.reshape().transpose().reshape()      std= np.std(shot, axis=-1)      mean = shot.mean(axis=-1)
      # find item      found, lx, ly = False, 0, 0      coords = []      for y in range(self.n_box_y):            for x in range(self.n_box_x):                coords.append((x, y))
      if order == 'Near to Cursor':            coords = sorted(coords, key=lambda _: abs(cursor - _ * STRIDE_X) + abs(cursor - _ * STRIDE_Y))      if order == 'Near to Center':            coords = sorted(coords, key=lambda _: abs(self.width / 2 - _ * STRIDE_X) + abs(self.height / 2 - _ * STRIDE_Y))
      for x, y in coords:            if (                abs(cursor - (x + .5) * STRIDE_X) + abs(cursor - y * STRIDE_Y) > srange and                abs(self.width / 2 - (x + .5) * STRIDE_X) + abs(self.height / 2 - y * STRIDE_Y) > srange            ): continue                        if (                mean > 255 - COLOR_THRESHOLD and                mean < 128 + COLOR_THRESHOLD and                mean < 128 + COLOR_THRESHOLD and                std < STD_THRESHOLD and                std > 60 - STD_THRESHOLD and                std > 60 - STD_THRESHOLD            ):                found, lx, ly = True, x, y                break            tok = time()      print(f'Image Processing Duration:{tok - tick: .4f} secs')            # transform local coord to global coord      gx = int(self.l_offset + int((lx + .5) * STRIDE_X) * DOWNSAMPLE_RATE)      gy = int(self.t_offset + int((ly + .5) * STRIDE_Y) * DOWNSAMPLE_RATE)            if found:            self.lx = int((lx + .5) * STRIDE_X) * DOWNSAMPLE_RATE            self.ly = int((ly + .5) * STRIDE_Y) * DOWNSAMPLE_RATE            return gx, gy      else: return None
Processor = Looter()
def onpress_callback(key: keyboard.KeyCode):    try:      # if key == keyboard.Key.esc: sys.exit(0)      if key == keyboard.Key.space:
            # Step 1. Do Screen Shot            coord = Processor.detect(shot=Processor.screenshot(), srange=SEARCH_RANGE)
            # move mouse to item and click            if coord is not None:                found_x, found_y = coord                # press 'F' down                win32api.keybd_event(70, 0, 0, 0) # press down F                sleep(0.02)                win32api.SetCursorPos((found_x, found_y))                sleep(0.01)                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, 0, 0, 0)                win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0)
                win32api.keybd_event(70, 0, win32con.KEYEVENTF_KEYUP, 0) # press F Up                print(f'Drop was found at [{found_x}, {found_y}]')            else:                print('We Got Nothing.')
            if Processor.fever_mode == True:                sleep(DELAY)                win32api.keybd_event(32, 0, 0, 0) # press down space          except Exception as e:      raise e      if isinstance(Exception, AttributeError): pass      else: pass

def onrelease_callback(key: keyboard.KeyCode):    try:      if key in {keyboard.Key.caps_lock}:                        if Processor.fever_mode is True:                Processor.fever_mode = False            else:                Processor.fever_mode = True                win32api.keybd_event(32, 0, 0, 0) # press down space
    except Exception as e:      if isinstance(Exception, AttributeError): pass      else: pass
hello()hook = keyboard.Listenerwith hook(on_press=onpress_callback, on_release=onrelease_callback, suppress=False) as listener:    listener.join()
本帖最后由 我是新来的额 于 2023-1-28 14:42 编辑

勇敢村村民 发表于 2023-1-27 08:24:13

东西虽好,谨慎使用。。

我是新来的额 发表于 2023-1-28 14:45:01

自己顶起来,17173为啥现在没啥人了
页: [1]
查看完整版本: AutoLoot - 自动捡东西辅助