美文网首页
dnf 脚 本

dnf 脚 本

作者: sen_coder | 来源:发表于2021-01-04 13:34 被阅读0次
    思路

    通过NPK标注怪金物,运用opencv识别对应的标注,实现辅助打怪。
    先怪》金》物。
    包含修理,物品出售等功能。

    图片

    键盘

    SendInput = windll.user32.SendInput
    PUL = POINTER(c_ulong)
    
    
    class KeyBdInput(Structure):
        _fields_ = [("wVk", c_ushort), ("wScan", c_ushort), ("dwFlags", c_ulong),
                    ("time", c_ulong), ("dwExtraInfo", PUL)]
    
    
    class HardwareInput(Structure):
        _fields_ = [("uMsg", c_ulong), ("wParamL", c_short), ("wParamH", c_ushort)]
    
    
    class MouseInput(Structure):
        _fields_ = [("dx", c_long), ("dy", c_long), ("mouseData", c_ulong),
                    ("dwFlags", c_ulong), ("time", c_ulong), ("dwExtraInfo", PUL)]
    
    
    class Input_I(Union):
        _fields_ = [("ki", KeyBdInput), ("mi", MouseInput), ("hi", HardwareInput)]
    
    
    class Input(Structure):
        _fields_ = [("type", c_ulong), ("ii", Input_I)]
    
    
    # Actuals Functions
    
    
    def PressKey(hexKeyCode):
        extra = c_ulong(0)
        ii_ = Input_I()
        ii_.ki = KeyBdInput(0, hexKeyCode, 0x0008, 0, pointer(extra))
        x = Input(c_ulong(1), ii_)
        windll.user32.SendInput(1, pointer(x), sizeof(x))
    
    
    def ReleaseKey(hexKeyCode):
        extra = c_ulong(0)
        ii_ = Input_I()
        ii_.ki = KeyBdInput(0, hexKeyCode, 0x0008 | 0x0002, 0, pointer(extra))
        x = Input(c_ulong(1), ii_)
        windll.user32.SendInput(1, pointer(x), sizeof(x))
    
    鼠标
    def left_click():
        extra = c_ulong(0)
        ii_ = Input_I()
        ii_.mi = MouseInput(0, 0, 0, 0x0002, 0, pointer(extra))
        x = Input(c_ulong(0), ii_)
        windll.user32.SendInput(1, pointer(x), sizeof(x))
    
        extra = c_ulong(0)
        ii_ = Input_I()
        ii_.mi = MouseInput(0, 0, 0, 0x0004, 0, pointer(extra))
        x = Input(c_ulong(0), ii_)
        windll.user32.SendInput(1, pointer(x), sizeof(x))
    
    鼠标变量设置

    mouse_button_down_mapping = {
    MouseButton.LEFT.name: 0x0002,
    MouseButton.MIDDLE.name: 0x0020,
    MouseButton.RIGHT.name: 0x0008
    }

    mouse_button_up_mapping = {
    MouseButton.LEFT.name: 0x0004,
    MouseButton.MIDDLE.name: 0x0040,
    MouseButton.RIGHT.name: 0x0010

    相关文章

      网友评论

          本文标题:dnf 脚 本

          本文链接:https://www.haomeiwen.com/subject/upqvoktx.html