* You need to use the environment Python3, pycharm, Daily simulator , Yin Yang teacher .
* Preparation Library pip install pyautogui pip install pywin32 12
* All libraries needed import tkinter as tk import pyautogui import time import random
import win32gui import win32con import threading from tkinter import * AP =
True Ma = 0 12345678910
* modular
* Adjust simulator form size and position def chuangkou(): titlename = " Reliable simulator 3.2.9" # Pay attention to your version # Get handle
hwnd = win32gui.FindWindow(0, titlename) # Get the coordinates of the upper left corner and the lower right corner of the window left, top, right,
bottom = win32gui.GetWindowRect(hwnd) print(" wide ",right," high ", bottom) #
Adjust the target window to coordinates (0,0), Set the size to (700,500) win32gui.SetWindowPos(hwnd,win32con.HWND_TOPMOST,
0, 0, 700, 500, win32con.SWP_SHOWWINDOW) 123456789
* Get start match button def kaishi(): if
pyautogui.pixelMatchesColor(647,391,(241,213,141)) == True: # Judge whether the pixel is the input pixel if
pyautogui.pixelMatchesColor(684,404,(105,71,35)) == True: # Judge whether the pixel is the input pixel a =
random.randint(649, 678) # random x Axis coordinate interval b = random.randint(391, 414) # random y Axis coordinate interval
pyautogui.moveTo(x=a, y=b, duration=0.25) # The time of mouse moving to the random area is random c second
pyautogui.doubleClick() # Click the area print(" Button recognized ") time.sleep(2)
time.sleep(random.uniform(0.05, 0.10)) 1234567891011
* Get the end screen def jieshu(): if pyautogui.pixelMatchesColor(254,119,(153,28,18)) ==
True: # Judge whether the pixel is the input pixel if pyautogui.pixelMatchesColor(503,100,(231,214,170)) ==
True: # Judge whether the pixel is the input pixel print(" Recognized ") time.sleep(random.uniform(0.05, 0.2)) #
Random delay time a = random.randint(424, 676) # random x Axis coordinate interval b = random.randint(286, 413) #
random y Axis coordinate interval for i in range(0, random.randint(7, 9)): # Random hits 7 reach 9 second a = a +
random.randint(2, 8) # x Axis random position offset a = a - random.randint(2, 8) b = b +
random.randint(2, 8) # y Axis random position offset b = b - random.randint(2, 8)
pyautogui.moveTo(x=a, y=b, duration=0.15) # Randomly move the mouse to a random position
time.sleep(random.uniform(0.05, 0.10)) # Random delay click interval pyautogui.click() # Simulate mouse click
time.sleep(random.uniform(0.05, 0.10)) # Delay random seconds after Click time.sleep(1) # Pause for one second after execution
1234567891011121314151617
* Because of the dead loop, we need to make a multithreading def thread_it(func, *args): # establish t =
threading.Thread(target=func, args=args) # guard !!! t.setDaemon(True) # start-up
t.start() 1234567
* GUI Interface Used tk def __init__(self, master, masterl): fm1 = Frame(master)
Label(topl, justify=tk.LEFT, image=photo, compound=tk.CENTER,
fg="white").pack(side=TOP, anchor=W, fill=BOTH) fm1.pack(side=TOP, fill=BOTH)
fm2 = Frame(masterl) Button(topl, text=' Start passion ( Captain version )', command=lambda:
thread_it(New), bg="pink").pack(side=LEFT, anchor=NW, fill=X) Button(topl,
text=' Start passion ( Hitter version )', command=lambda: thread_it(News),
bg="DeepSkyBlue").pack(side=LEFT, anchor=N, fill=X, padx=12, ) Button(topl,
text=' Adjust the position ', command=lambda: thread_it(chuangkou), bg="red").pack(side=TOP,
anchor=NE, fill=X) fm2.pack(side=LEFT, fill=NONE, padx=10) fm3 = Frame(masterl)
Button(topl, text=' stop it ', command=lambda: thread_it(tingzhi),
bg="yellow").pack(side=LEFT, anchor=W, fill=X) Button(topl, text=' start ',
command=lambda: thread_it(dakai), bg="yellow").pack(side=LEFT, fill=X, padx=5)
fm3.pack(side=LEFT, fill=NONE, ipadx=10) 12345678910111213141516
* The main code is here, and there are some small things , It's the big guy's : Here is the complete code import tkinter as tk import pyautogui
import time import random import win32gui import win32con import threading from
tkinter import * AP = True Ma = 0 def kaishi(): if
pyautogui.pixelMatchesColor(647,391,(241,213,141)) == True: # Judge whether the pixel is the input pixel if
pyautogui.pixelMatchesColor(684,404,(105,71,35)) == True: # Judge whether the pixel is the input pixel a =
random.randint(649, 678) # random x Axis coordinate interval b = random.randint(391, 414) # random y Axis coordinate interval
pyautogui.moveTo(x=a, y=b, duration=0.25) # The time of mouse moving to the random area is random c second
pyautogui.doubleClick() # Click the area print(" Button recognized ") time.sleep(2)
time.sleep(random.uniform(0.05, 0.10)) def jieshu(): if
pyautogui.pixelMatchesColor(254,119,(153,28,18)) == True: # Judge whether the pixel is the input pixel if
pyautogui.pixelMatchesColor(503,100,(231,214,170)) == True: # Judge whether the pixel is the input pixel
print(" Recognized ") time.sleep(random.uniform(0.05, 0.2)) # Random delay time a =
random.randint(424, 676) # random x Axis coordinate interval b = random.randint(286, 413) # random y Axis coordinate interval for
i in range(0, random.randint(7, 9)): # Random hits 7 reach 9 second a = a + random.randint(2, 8)
# x Axis random position offset a = a - random.randint(2, 8) b = b + random.randint(2, 8) # y Axis random position offset
b = b - random.randint(2, 8) pyautogui.moveTo(x=a, y=b, duration=0.15) #
Randomly move the mouse to a random position time.sleep(random.uniform(0.05, 0.10)) # Random delay click interval
pyautogui.click() # Simulate mouse click time.sleep(random.uniform(0.05, 0.10)) # Delay random seconds after Click
time.sleep(1) # Pause for one second after execution def chuangkou(): titlename = " Reliable simulator 3.2.9" # Get handle
hwnd = win32gui.FindWindow(0, titlename) # Get the coordinates of the upper left corner and the lower right corner of the window left, top, right,
bottom = win32gui.GetWindowRect(hwnd) print(" wide ",right," high ", bottom) #
Adjust the target window to coordinates (0,0), Set the size to (700,500) win32gui.SetWindowPos(hwnd,win32con.HWND_TOPMOST,
0, 0, 700, 500, win32con.SWP_SHOWWINDOW) def New(): # The way to drive the soul while (AP):
#AP Is a global variable used to pause code print(" Yuhun driver is performing ") kaishi() print(" Wait for the end ") time.sleep(1)
jieshu() def News(): # The method of fighting against the soul while (AP): print(" Royal soul thugs are in execution ") jieshu()
time.sleep(1) def tingzhi(): # Stop button modification AP The variable is False Stop the cycle global AP AP = False
print(AP) def dakai(): # Modify variables AP by true Unlock cycle global AP AP = True print(AP) def
thread_it(func, *args): # establish t = threading.Thread(target=func, args=args) # guard
!!! t.setDaemon(True) # start-up t.start() # block -- Stuck interface ! # t.join() def __init__(self,
master, masterl): # After studying the layout for a long time, it's super messy fm1 = Frame(master) Label(topl,
justify=tk.LEFT, image=photo, compound=tk.CENTER, fg="white").pack(side=TOP,
anchor=W, fill=BOTH) fm1.pack(side=TOP, fill=BOTH) fm2 = Frame(masterl)
Button(topl, text=' Start passion ( Captain version )', command=lambda: thread_it(New),
bg="pink").pack(side=LEFT, anchor=NW, fill=X) Button(topl, text=' Start passion ( Hitter version )',
command=lambda: thread_it(News), bg="DeepSkyBlue").pack(side=LEFT, anchor=N,
fill=X, padx=12, ) Button(topl, text=' Adjust the position ', command=lambda:
thread_it(chuangkou), bg="red").pack(side=TOP, anchor=NE, fill=X)
fm2.pack(side=LEFT, fill=NONE, padx=10) fm3 = Frame(masterl) Button(topl,
text=' stop it ', command=lambda: thread_it(tingzhi), bg="yellow").pack(side=LEFT,
anchor=W, fill=X) Button(topl, text=' start ', command=lambda: thread_it(dakai),
bg="yellow").pack(side=LEFT, fill=X, padx=5) fm3.pack(side=LEFT, fill=NONE,
ipadx=10) topl = tk.Tk() # establish top container photo =
tk.PhotoImage(file="C:\\Users\\longqiang\\Desktop\\python\\ experiment \\yysimg.png")
# You can find the size you like 400*200 pixel Pay attention to the name of the picture topl.geometry("420x280+851+484") # Set interface size
And the initial position of the interface , The default will coincide with the simulator topl.title(" I love you, Yin Yang master ") # import picture __init__(topl, master=topl,
masterl=topl) # Call interface topl.resizable(0, 0) # The user is not allowed to change the window size topl.mainloop() # Continuous running window
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
* Remember to change the path position of the picture
design sketch
* Evil sprouts new python game player , The use of scripts is pixel matching , Different settings of daily simulator may not recognize pixels , The simulator settings are as follows
* Usage process , Enter the game team interface, and directly click to start passion soul control , Due to the separation of the Taicai stop button , Other functions can be added later
Source code access plus group Oh :1136192749
Technology