From f4c535b38aaee18dd479e230858db316d1051d88 Mon Sep 17 00:00:00 2001 From: clarkzjw Date: Wed, 3 Jan 2018 00:41:37 +0800 Subject: + fix --- Dockerfile | 38 -------------------------------------- README.md | 29 ++++------------------------- bot.py | 5 ++--- circle.yml | 12 ------------ requirements.txt | 9 ++++++++- 5 files changed, 14 insertions(+), 79 deletions(-) delete mode 100644 Dockerfile delete mode 100644 circle.yml diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 0f556b7..0000000 --- a/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -# LumberJack bot -# It is difficult to dockerize this bot -# I have no idea how to access host's screenshot -# inside a docker container -# Project's present status: -# It can access mouse move inside a container -# But due to it cannot access screenshot of the host -# it cannot make decisions yet - -FROM ubuntu:latest -MAINTAINER clarkzjw - -RUN \ - sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y firefox sudo xvfb scrot git build-essential python3 python3-dev python3-pip python3-tk - -RUN export uid=1000 gid=1000 && \ - mkdir -p /home/developer && \ - echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ - echo "developer:x:${uid}:" >> /etc/group && \ - echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ - chmod 0440 /etc/sudoers.d/developer && \ - chown ${uid}:${gid} -R /home/developer - -RUN \ - Xvfb :1 -screen 0 1366x768x16 &> xvfb.log && \ - export DISPLAY=:1.0 && \ - touch /root/.Xauthority && \ - touch /home/developer/.Xauthority && \ - pip3 install image && \ - pip3 install python3-xlib && \ - pip3 install pyautogui - -USER developer -ENV HOME /home/developer -CMD /bin/bash diff --git a/README.md b/README.md index 3d46f32..75395d3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# LumberJack bot [![CircleCI](https://circleci.com/gh/clarkzjw/LumberJack.svg?style=svg)](https://circleci.com/gh/clarkzjw/LumberJack) [![](https://images.microbadger.com/badges/version/clarkzjw/lumberjack.svg)](https://microbadger.com/images/clarkzjw/lumberjack "Get your own version badge on microbadger.com") [![](https://images.microbadger.com/badges/image/clarkzjw/lumberjack.svg)](https://microbadger.com/images/clarkzjw/lumberjack "Get your own image badge on microbadger.com") +# LumberJack bot -Current Top Score: 408 +Current Top Score: 1068 -![image](https://cloud.githubusercontent.com/assets/2663319/20305522/de7b327e-ab70-11e6-898e-3f286a0b567a.png) +![image](https://user-images.githubusercontent.com/2663319/34491418-4e345ac6-f01e-11e7-99af-88e8e8a1e2ec.png) ## Usage @@ -10,25 +10,4 @@ Current Top Score: 408 python3 bot.py ``` -Make sure you have PyAutoGUI installed. - -If you use Debian based Linux, you can install PyAutoGUI by - -```bash -sudo apt-get install scrot python3-tk python3 python3-dev python3-pip -sudo pip3 install image -sudo pip3 install python3-xlib -sudo pip3 install pyautogui -``` - -## The Docker way - -Although the Docker image of this bot cannot work correctly, you can give it a try. Remember to read the comments on top of Dockerfile - -```bash -docker run -it \ --e DISPLAY=$DISPLAY \ --v /tmp/.X11-unix:/tmp/.X11-unix \ -clarkzjw/lumberjack -``` - +Tested on macOS 10.12.6 with screen resolution 1680*1050 (not HiDPI) on Safari. diff --git a/bot.py b/bot.py index c419bbc..42cb070 100644 --- a/bot.py +++ b/bot.py @@ -3,12 +3,11 @@ import time import mss import pyautogui as pg from numpy import array, uint8 - -#from keyboard import send - from pynput.keyboard import Key, Controller + keyboard = Controller() + def begin(): pg.click(440, 900, 2) diff --git a/circle.yml b/circle.yml deleted file mode 100644 index e4d4da5..0000000 --- a/circle.yml +++ /dev/null @@ -1,12 +0,0 @@ -machine: - services: - - docker - -dependencies: - override: - - docker info - - docker build -t lumberjack . - -test: - override: - - docker run -d lumberjack; sleep 10 diff --git a/requirements.txt b/requirements.txt index f30d3d3..1b8e67c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,13 @@ keyboard==0.11.0 mss==3.1.1 numpy==1.13.3 +Pillow==5.0.0 PyAutoGUI==0.9.36 -pyobjc==4.1 +PyMsgBox==1.0.6 +pynput==1.3.8.1 pyobjc-core==4.1 +pyobjc-framework-Cocoa==4.1 +pyobjc-framework-Quartz==4.1 +PyScreeze==0.1.13 +PyTweening==1.0.3 +six==1.11.0 -- cgit v1.2.3