fist commit

This commit is contained in:
Sheldon 2021-02-19 18:32:20 +08:00
commit b4602ec314
5 changed files with 44 additions and 0 deletions

BIN
FreeCompany.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
FreeCompanyAlt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
PurchaseLand.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
Yes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

44
mouse_macro.py Normal file
View File

@ -0,0 +1,44 @@
from pyautogui import *
import time
def locateClick(imgname, alt=None, t=0.1, button="left"):
time.sleep(t)
box = locateOnScreen(imgname)
print(imgname, "found at: ", box)
if box is None:
if alt is not None:
locateClick(alt, button=button)
return False
x, y = box.left + box.width/2, box.top + box.height/2
moveTo(x, y)
longClick(button=button)
return True
def longClick(t=0.100, button="left"):
mouseDown(button=button)
time.sleep(t)
mouseUp(button=button)
count = 1;
while(True):
#if count%5 == 0: time.sleep(5);
# get center of screen
start_x, start_y = size()
start_x /= 3;
start_y /= 2;
moveTo(start_x, start_y)
click();
longClick(button="right")
if not locateClick("PurchaseLand.png", t=0.3):
press("esc");
continue
if not locateClick("FreeCompanyAlt.png", "FreeCompany.png"): pass
if not locateClick("Yes.png"): pass
count += 1;