NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

import numpy as np
import win32api, win32con, time
import keyboard
import pyautogui
import cv2
from PIL import Image, ImageOps
import threading
import pytesseract
from pynput.keyboard import Key, Controller
import pyscreenshot

pytesseract.pytesseract.tesseract_cmd = 'C:/Program Files/Tesseract-OCR/tesseract.exe'
keyboard2 = Controller()

# mevcut_tus_index = 0
# tuslar= ["1","2","3","4",Key.f1,Key.f3,Key.f4]


def findMiddle(input_list):
middle = float(len(input_list))/2
if middle % 2 != 0:
return input_list[int(middle - .5)]
else:
return (input_list[int(middle)], input_list[int(middle-1)])
def click(x,y):
win32api.SetCursorPos((x,y))
time.sleep(0.03)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,x,y,0,0)
def OCR_kontrol(name):
ocr_x =0
ocr_y= 112
ocr_y_end = 126
ocr_x_end = 282
ocr_x_distance = 280
ocr_y_distance = 14
last_oltalama = time.time()
while(True):
# textim = pyautogui.screenshot(region=(ocr_x,ocr_y,ocr_x_distance,ocr_y_distance))
textim = pyscreenshot.grab(bbox=(ocr_x, ocr_y, ocr_x_end, ocr_y_end)) # X1,Y1,X2,Y2

text_content= pytesseract.image_to_string(textim, lang='tur')
# print(text_content)
if (text_content.find("Oltaya birşey") != -1):
print('oltaya_birsey')
keyboard2.press(Key.esc)
time.sleep(0.2)
keyboard2.release(Key.esc)
time.sleep(0.2)
# keyboard2.press(Key.ctrl)
# keyboard2.press('g')
# time.sleep(0.5)
# keyboard2.release(Key.ctrl)
# keyboard2.release('g')
# time.sleep(0.2)
# keyboard2.press(Key.ctrl)
# keyboard2.press('g')
# time.sleep(0.5)
# keyboard2.release(Key.ctrl)
# keyboard2.release('g')
if (text_content.find("Yemi kaybettin") != -1 or text_content.find("Balıkçılık puanınız") != -1):
print('yem kaybedildi')
keyboard2.press(Key.ctrl)
keyboard2.press('g')
time.sleep(0.15)
keyboard2.release(Key.ctrl)
keyboard2.release('g')
time.sleep(0.1)
keyboard2.press(Key.ctrl)
keyboard2.press('g')
time.sleep(0.15)
keyboard2.release(Key.ctrl)
keyboard2.release('g')
time.sleep(0.15)
keyboard2.press(Key.f1)
time.sleep(0.06)
keyboard2.release(Key.f1)
time.sleep(0.06)
keyboard2.press(Key.f2)
time.sleep(0.07)
keyboard2.release(Key.f2)
time.sleep(1.3)
last_oltalama = time.time()
if (text_content.find("takılmış gibi") != -1 and time.time() - last_oltalama >13):
print('oltaya_takilmis gibi')
keyboard2.press(Key.f1)
time.sleep(0.06)
keyboard2.release(Key.f1)
time.sleep(0.06)
# keyboard2.press(Key.f2)
# time.sleep(0.07)
# keyboard2.release(Key.f2)
# last_oltalama = time.time()
if (text_content.find("Çengele yem") != -1 and time.time() - last_oltalama >13):
print('çengele yem gibi')
keyboard2.press(Key.f2)
time.sleep(0.07)
keyboard2.release(Key.f2)
last_oltalama = time.time()
if (text_content.find("Şu anki yemi") != -1 and time.time() - last_oltalama >13):
print('çengele yem gibi')
keyboard2.press(Key.f2)
time.sleep(0.07)
keyboard2.release(Key.f2)
last_oltalama = time.time()
if (text_content.find("Balık tutarken") != -1 and time.time() - last_oltalama >13):
print('Balık tutarken')
keyboard2.press(Key.f1)
time.sleep(0.06)
keyboard2.release(Key.f1)
time.sleep(0.06)
# keyboard2.press(Key.f2)
# time.sleep(0.07)
# keyboard2.release(Key.f2)
# last_oltalama = time.time()

def Bot_action(asd):
x = 244
y = 207
distance = 128

# fps counter için
prev_frame_time = 0
new_frame_time = 0
last_tiklama = time.time()
# mask = Image.open('mask.png').convert('L')
mask = Image.open('mask2.png').convert('L')

while (True):

# try:
# # fish_location = pyautogui.locateOnScreen('balik.png', region=(x, y, x + distance, y + distance))
# fish_location = pyautogui.locateOnScreen('balik_tek_pixel.png', region=(x, y, x + distance, y + distance), confidence=0.4)
# print("balik var lokasyonu :" + fish_location)
# except:
# print('balik_yok')

# (60, 95, 122) pixel color of fish
# im = pyautogui.screenshot(region=(x, y, distance, distance))
im = pyscreenshot.grab(bbox=(x, y, x+distance, y+distance),backend="mss", childprocess=False) # X1,Y1,X2,Y2
output = ImageOps.fit(im, mask.size, centering=(0.5, 0.5))
# output.putalpha(mask)
output.putalpha(mask)
# output.save(r"outputdeneme.png")
# exit()
#
# output.save(r"denememask.png")
# exit()
# im = output
# im.save(r"deneme2.png")
# exit()
# px = im.getpixel((x, y))
tolorance = 2
color_tolorance = 5
# color = (60, 95, 122)
color = (54, 88, 123)
disari_cik = False
baliklok= []
for x_pixel in range(0, distance, tolorance):
for y_pixel in range(0, distance, tolorance):
# im.save(r"deneme.png")
px = output.getpixel((x_pixel, y_pixel))
# print(px)
# print(px)
# if pyautogui.pixelMatchesColor(x_pixel, y_pixel, (60, 95, 122), tolerance = 40):
# if px[0] :
if time.time() - last_tiklama > 0.5:
if color[0] - color_tolorance <= px[0] <= color[0] + color_tolorance:
if color[1] - color_tolorance <= px[1] <= color[1] + color_tolorance:
if color[2] - color_tolorance <= px[2] <= color[2] + color_tolorance:
# print("balik var location :"+str(x_pixel) + " - "+ str(y_pixel))
# print(str(time.time()-last_tiklama))
# if time.time()-last_tiklama>1:
# print('tiklandi')
# click(x + int(x_pixel), y + int(y_pixel))
# last_tiklama = time.time()
baliklok.append([int(x_pixel),int(y_pixel)])
# disari_cik = True
# break
# if disari_cik:
# break

# print(px)
if not not baliklok:
# print(baliklok)
middleIndex = (len(baliklok) - 1) / 2
if middleIndex % 2 != 0:
click(x+int(baliklok[int(middleIndex - .5)][0]), y + int(baliklok[int(middleIndex - .5)][1]))
else:
click(x + int(baliklok[int(middleIndex)][0]), y + int(baliklok[int(middleIndex)][1]))
# print(middleIndex)
last_tiklama = time.time()


# new_frame_time = time.time()
# fps = 1 / (new_frame_time - prev_frame_time)
# prev_frame_time = new_frame_time
# fps = str(fps)
# print(fps)

y = threading.Thread(target=Bot_action, args=(1,))
y.start()
x = threading.Thread(target=OCR_kontrol, args=(1,))
x.start()

y.join()
x.join()





     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.