-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathciv.py
39 lines (28 loc) · 835 Bytes
/
civ.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# encoding: utf-8
from time import sleep
import Vision
import Movement
class Ref:
winName = "Sid Meier's Civilization V (DX11)"
folder = "Templates/Civ5/"
coin = folder + "coin.bmp"
landBtn = folder + "landBuyBtn.bmp"
def buyLand():
box = Vision.getBox(None, Ref.winName)
img = Vision.getCv(Vision.getBmp(box), False)
buyMode = getLandBuy(img)
target = Vision.cv.imread(Ref.coin, 0)
array = Vision.matchAll(img, target)
for point in array:
Movement.mousePos(point)
Movement.leftClick()
Movement.mousePos(buyMode)
Movement.leftClick()
sleep(.3)
def getLandBuy(img):
target = Vision.cv.imread(Ref.landBtn, 0)
point, _ = Vision.match(img, target)
return (point[0] + 100, point[1])
if __name__ == '__main__':
buyLand()
pass