warrior makro
This commit is contained in:
parent
2751baca05
commit
ff25ac618e
|
|
@ -0,0 +1,3 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyArgumentListInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="E303" />
|
||||
<option value="E302" />
|
||||
<option value="E271" />
|
||||
<option value="E231" />
|
||||
<option value="E265" />
|
||||
<option value="E301" />
|
||||
<option value="E501" />
|
||||
<option value="E115" />
|
||||
<option value="W191" />
|
||||
<option value="E101" />
|
||||
<option value="E402" />
|
||||
<option value="E128" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||
<option name="ignoredErrors">
|
||||
<list>
|
||||
<option value="N806" />
|
||||
<option value="N802" />
|
||||
<option value="N801" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
<inspection_tool class="PyTypeCheckerInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnreachableCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="INFORMATION" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="main.ui_main" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (makrocalisma)" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
|
|
@ -0,0 +1,196 @@
|
|||
from PySide6.QtWidgets import QApplication, QMainWindow
|
||||
from PySide6.QtCore import QThread, Signal, QObject
|
||||
import keyboard
|
||||
import sys
|
||||
import time
|
||||
import os
|
||||
import ctypes
|
||||
import pyautogui
|
||||
from python_imagesearch.imagesearch import imagesearch
|
||||
import random
|
||||
from ui_main import Ui_MainWindow
|
||||
|
||||
|
||||
MOUSEEVENTF_LEFTDOWN = 0x0002
|
||||
MOUSEEVENTF_LEFTUP = 0x0004
|
||||
MOUSEEVENTF_RIGHTDOWN = 0x0008
|
||||
MOUSEEVENTF_RIGHTUP = 0x0010
|
||||
|
||||
def get_resource_path(relative_path):
|
||||
if hasattr(sys, '_MEIPASS'):
|
||||
return os.path.join(sys._MEIPASS, relative_path)
|
||||
return os.path.join(os.path.abspath("."), relative_path)
|
||||
|
||||
class MacroWorker(QObject):
|
||||
finished = Signal()
|
||||
status_update = Signal(str)
|
||||
|
||||
def __init__(self, macros):
|
||||
super().__init__()
|
||||
self.macros = macros
|
||||
self.running = True
|
||||
# kalkanimg = self.base_path = get_resource_path(os.path.join("img", "kalkan.png"))
|
||||
# restimg = self.base_path = get_resource_path(os.path.join("img", "restore.png"))
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
while self.running:
|
||||
for macro_name, macro_data in self.macros.items():
|
||||
if macro_data['enabled']:
|
||||
self.execute_macro(macro_name)
|
||||
time.sleep(0.1) # Makrolar arası bekleme
|
||||
except Exception as e:
|
||||
self.status_update.emit(f"Hata: {str(e)}")
|
||||
finally:
|
||||
self.finished.emit()
|
||||
|
||||
def execute_macro(self, macro_name):
|
||||
actions = self.macros[macro_name]['actions']
|
||||
self.status_update.emit(f"{macro_name} çalıştırılıyor...")
|
||||
|
||||
for action in actions:
|
||||
if not self.running:
|
||||
break
|
||||
|
||||
if action['type'] == 'press':
|
||||
keyboard.press(action['key'])
|
||||
elif action['type'] == 'release':
|
||||
keyboard.release(action['key'])
|
||||
elif action['type'] == 'delay':
|
||||
time.sleep(action['duration'])
|
||||
|
||||
def stop(self):
|
||||
self.running = False
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
# Makro tanımları
|
||||
self.macros = {
|
||||
'Atak': {
|
||||
'enabled': False,
|
||||
'actions': [
|
||||
{'type': 'press', 'key': 'r'},
|
||||
{'type': 'delay', 'duration': 0.1},
|
||||
{'type': 'release', 'key': 'r'},
|
||||
{'type': 'press', 'key': 'r'},
|
||||
{'type': 'delay', 'duration': 0.1},
|
||||
{'type': 'release', 'key': 'r'},
|
||||
{'type': 'press', 'key': '2'},
|
||||
{'type': 'delay', 'duration': 0.1},
|
||||
{'type': 'release', 'key': '2'}
|
||||
]
|
||||
},
|
||||
'Kalkan Tak': {
|
||||
'enabled': False,
|
||||
'actions': [
|
||||
{
|
||||
'type': 'conditional_image_search',
|
||||
'image': 'kalkan.png',
|
||||
'region': (150, 411, 130, 86),
|
||||
'precision': 0.8,
|
||||
'if_found': [
|
||||
{'type': 'mouse_move', 'x': 'found_x', 'y': 'found_y+60'},
|
||||
{'type': 'mouse_rclick'}],
|
||||
'if_not_found': []
|
||||
}
|
||||
]
|
||||
},
|
||||
'Restore Sil': {
|
||||
'enabled': False,
|
||||
'actions': [
|
||||
{
|
||||
'type': 'conditional_image_search',
|
||||
'image': 'restore.png',
|
||||
'region': (719, 456, 489, 118),
|
||||
'precision': 0.5,
|
||||
'if_found': [
|
||||
{'type': 'mouse_move', 'x': 'found_x', 'y': 'found_y'},
|
||||
{'type': 'mouse_doubleclick'}],
|
||||
'if_not_found': []
|
||||
}
|
||||
]
|
||||
},
|
||||
'Kılıç Sil': {
|
||||
'enabled': False,
|
||||
'actions': [
|
||||
{'type': 'press', 'key': 'f4'},
|
||||
{'type': 'delay', 'duration': 0.1},
|
||||
{'type': 'release', 'key': 'f4'}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
# Thread ve worker için değişkenler
|
||||
self.thread = None
|
||||
self.worker = None
|
||||
|
||||
# UI bağlantıları
|
||||
self.ui.btn_baslat.clicked.connect(self.toggle_macro)
|
||||
self.ui.chk_atak.stateChanged.connect(lambda: self.update_macro_state('Atak', self.ui.chk_atak))
|
||||
self.ui.chk_kalkan.stateChanged.connect(lambda: self.update_macro_state('Kalkan Tak', self.ui.chk_kalkan))
|
||||
self.ui.chk_restore.stateChanged.connect(lambda: self.update_macro_state('Restore Sil', self.ui.chk_restore))
|
||||
self.ui.chk_kilic.stateChanged.connect(lambda: self.update_macro_state('Kılıç Sil', self.ui.chk_kilic))
|
||||
|
||||
# Başlangıç durumu
|
||||
self.macro_running = False
|
||||
|
||||
def update_macro_state(self, macro_name, checkbox):
|
||||
self.macros[macro_name]['enabled'] = checkbox.isChecked()
|
||||
|
||||
def toggle_macro(self):
|
||||
if self.macro_running:
|
||||
self.stop_macro()
|
||||
self.ui.btn_baslat.setText("Makro Başlat")
|
||||
else:
|
||||
self.start_macro()
|
||||
self.ui.btn_baslat.setText("Makro Durdur")
|
||||
|
||||
def start_macro(self):
|
||||
if not any(macro['enabled'] for macro in self.macros.values()):
|
||||
self.ui.statusbar.showMessage("En az bir makro seçmelisiniz!", 3000)
|
||||
return
|
||||
|
||||
self.macro_running = True
|
||||
|
||||
# Thread ve worker oluştur
|
||||
self.thread = QThread()
|
||||
self.worker = MacroWorker(self.macros)
|
||||
self.worker.moveToThread(self.thread)
|
||||
|
||||
# Signal-slot bağlantıları
|
||||
self.thread.started.connect(self.worker.run)
|
||||
self.worker.finished.connect(self.thread.quit)
|
||||
self.worker.finished.connect(self.worker.deleteLater)
|
||||
self.thread.finished.connect(self.thread.deleteLater)
|
||||
self.worker.status_update.connect(self.update_status)
|
||||
|
||||
# Thread'i başlat
|
||||
self.thread.start()
|
||||
|
||||
self.ui.statusbar.showMessage("Makro çalışıyor...")
|
||||
|
||||
def stop_macro(self):
|
||||
if self.worker:
|
||||
self.worker.stop()
|
||||
self.macro_running = False
|
||||
self.ui.statusbar.showMessage("Makro durduruldu", 3000)
|
||||
|
||||
def update_status(self, message):
|
||||
self.ui.statusbar.showMessage(message, 1000)
|
||||
|
||||
def closeEvent(self, event):
|
||||
if self.macro_running:
|
||||
self.stop_macro()
|
||||
event.accept()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>283</width>
|
||||
<height>156</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Discord</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QCheckBox" name="chk_kalkan">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>111</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kalkan Tak</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="chk_restore">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>60</y>
|
||||
<width>111</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Restore Sil</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="chk_kilic">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Kılıç Sil</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="chk_atak">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>111</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Atak</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btn_baslat">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>40</y>
|
||||
<width>91</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Makro Başlat</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>283</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
import pyautogui
|
||||
import keyboard
|
||||
import time
|
||||
from python_imagesearch.imagesearch import imagesearch
|
||||
|
||||
|
||||
class MacroManager:
|
||||
def __init__(self):
|
||||
self.macros = {
|
||||
'Atak': {'enabled': False, 'func': self.atak_macro},
|
||||
'Kalkan Tak': {'enabled': False, 'func': self.kalkan_tak_macro},
|
||||
'Restore Sil': {'enabled': False, 'func': self.restore_sil_macro},
|
||||
'Kılıç Sil': {'enabled': False, 'func': self.kilic_sil_macro}
|
||||
}
|
||||
self.running = False
|
||||
|
||||
# MAKRO FONKSİYONLARI
|
||||
def atak_macro(self):
|
||||
"""R tuşuna 2 kez basıp 2 tuşuna basar"""
|
||||
keyboard.press('r')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('r')
|
||||
keyboard.press('r')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('r')
|
||||
keyboard.press('2')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('2')
|
||||
|
||||
def kalkan_tak_macro(self):
|
||||
try:
|
||||
pos = imagesearch(image_path)
|
||||
if pos[0] == -1:
|
||||
return # Hiçbir şey yapma
|
||||
|
||||
# Görsel bulundu, işlemleri yap
|
||||
pyautogui.moveTo(pos[0], pos[1]+60, duration=0.5)
|
||||
pyautogui.rclick()
|
||||
|
||||
except Exception as e:
|
||||
print(f"Hata oluştu ama işleme devam ediliyor: {e}")
|
||||
# Hata durumunda da hiçbir şey yapmıyoruz
|
||||
|
||||
# Kullanım:
|
||||
safe_image_operation("kalkan.png")
|
||||
|
||||
def restore_sil_macro(self):
|
||||
"""F3 tuşuna basarak restore siler"""
|
||||
keyboard.press('f3')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('f3')
|
||||
|
||||
def kilic_sil_macro(self):
|
||||
"""F4 tuşuna basarak kılıç siler"""
|
||||
keyboard.press('f4')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('f4')
|
||||
|
||||
|
||||
|
||||
# MAKRO YÖNETİM FONKSİYONLARI
|
||||
def toggle_macro(self, macro_name):
|
||||
"""Makroyu aktif/pasif yapar"""
|
||||
if macro_name in self.macros:
|
||||
self.macros[macro_name]['enabled'] = not self.macros[macro_name]['enabled']
|
||||
status = "aktif" if self.macros[macro_name]['enabled'] else "pasif"
|
||||
print(f"{macro_name} makrosu {status} hale getirildi")
|
||||
|
||||
def run_macros(self):
|
||||
"""Aktif makroları çalıştırır"""
|
||||
try:
|
||||
while self.running:
|
||||
for macro_name, macro_data in self.macros.items():
|
||||
if macro_data['enabled']:
|
||||
macro_data['func']() # İlgili makro fonksiyonunu çağır
|
||||
time.sleep(0.05) # CPU kullanımını azaltmak için
|
||||
except Exception as e:
|
||||
print(f"Hata oluştu: {str(e)}")
|
||||
|
||||
def start(self):
|
||||
"""Makro sistemini başlatır"""
|
||||
self.running = True
|
||||
self.run_macros()
|
||||
|
||||
def stop(self):
|
||||
"""Makro sistemini durdurur"""
|
||||
self.running = False
|
||||
|
||||
|
||||
# KULLANIM ÖRNEĞİ
|
||||
if __name__ == "__main__":
|
||||
manager = MacroManager()
|
||||
|
||||
# Makroları aktifleştirme
|
||||
manager.toggle_macro('Atak')
|
||||
manager.toggle_macro('Düşman Bul ve Saldır')
|
||||
|
||||
try:
|
||||
print("Makrolar çalışıyor... (Durdurmak için CTRL+C)")
|
||||
manager.start()
|
||||
except KeyboardInterrupt:
|
||||
manager.stop()
|
||||
print("Makrolar durduruldu")
|
||||
|
|
@ -0,0 +1,231 @@
|
|||
import sys
|
||||
import os
|
||||
import keyboard
|
||||
import pyautogui
|
||||
import time
|
||||
import ctypes
|
||||
from python_imagesearch.imagesearch import imagesearch
|
||||
from PySide6.QtWidgets import QApplication, QMainWindow
|
||||
from PySide6.QtCore import QThread, Signal, QObject
|
||||
from ui_main import Ui_MainWindow
|
||||
|
||||
MOUSEEVENTF_LEFTDOWN = 0x0002
|
||||
MOUSEEVENTF_LEFTUP = 0x0004
|
||||
MOUSEEVENTF_RIGHTDOWN = 0x0008
|
||||
MOUSEEVENTF_RIGHTUP = 0x0010
|
||||
|
||||
def get_resource_path(relative_path):
|
||||
""" Resimlere erişmek için doğru yolu oluşturur """
|
||||
try:
|
||||
base_path = sys._MEIPASS # PyInstaller için
|
||||
except Exception:
|
||||
base_path = os.path.abspath(".")
|
||||
|
||||
return os.path.join(base_path, relative_path)
|
||||
|
||||
|
||||
class MacroWorker(QObject):
|
||||
finished = Signal()
|
||||
status_update = Signal(str)
|
||||
|
||||
def __init__(self, macro_manager):
|
||||
super().__init__()
|
||||
self.macro_manager = macro_manager
|
||||
self.running = True
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
while self.running:
|
||||
self.macro_manager.run_macros()
|
||||
time.sleep(0.05)
|
||||
except Exception as e:
|
||||
self.status_update.emit(f"Hata: {str(e)}")
|
||||
finally:
|
||||
self.finished.emit()
|
||||
|
||||
|
||||
class MacroManager:
|
||||
def __init__(self):
|
||||
self.macros = {
|
||||
'Atak': {'enabled': False, 'func': self.atak_macro},
|
||||
'Kalkan Tak': {'enabled': False, 'func': self.kalkan_tak_macro},
|
||||
'Restore Sil': {'enabled': False, 'func': self.restore_sil_macro},
|
||||
'Kılıç Sil': {'enabled': False, 'func': self.kilic_sil_macro}
|
||||
}
|
||||
|
||||
# Resim yollarını tanımla
|
||||
self.image_paths = {
|
||||
'kalkan': get_resource_path(os.path.join("img", "kalkan.png")),
|
||||
'restore': get_resource_path(os.path.join("img", "restore.png"))
|
||||
# Diğer resimler buraya eklenebilir
|
||||
}
|
||||
|
||||
# MAKRO FONKSİYONLARI
|
||||
@staticmethod
|
||||
def atak_macro():
|
||||
keyboard.press('r')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('r')
|
||||
time.sleep(0.5)
|
||||
keyboard.press('r')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('r')
|
||||
time.sleep(0.5)
|
||||
keyboard.press('2')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('2')
|
||||
|
||||
def kalkan_tak_macro(self):
|
||||
"""F tuşuna basıldığında bir kez çalışacak kalkan takma fonksiyonu"""
|
||||
try:
|
||||
# F tuşunun basılı olup olmadığını kontrol et
|
||||
if not keyboard.is_pressed('f'):
|
||||
return
|
||||
|
||||
# Resmi ara
|
||||
pos = imagesearch(self.image_paths['kalkan'])
|
||||
if pos[0] == -1:
|
||||
return # Görsel bulunamazsa hiçbir şey yapma
|
||||
|
||||
# Görsel bulundu, işlemleri yap
|
||||
pyautogui.moveTo(pos[0], pos[1] + 60, duration=0.1)
|
||||
rclick(pos[0], pos[1] + 60)
|
||||
|
||||
# Tuş bırakılana kadar bekle (tekrar tetiklenmesini önle)
|
||||
while keyboard.is_pressed('f'):
|
||||
time.sleep(0.01)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Kalkan takma hatası: {e}")
|
||||
|
||||
def restore_sil_macro(self):
|
||||
"""Ekranda restore görselini bulunca duble click (seri iki sol tıklama) yapar"""
|
||||
try:
|
||||
# Resim yolunu kontrol et
|
||||
if 'restore' not in self.image_paths:
|
||||
print("Restore resim yolu tanımlı değil!")
|
||||
return
|
||||
|
||||
# Resmi ara
|
||||
pos = imagesearch(self.image_paths['restore'])
|
||||
if pos[0] == -1:
|
||||
return # Görsel bulunamazsa hiçbir şey yapma
|
||||
|
||||
# Görsel bulundu, işlemleri yap
|
||||
x, y = pos[0], pos[1]
|
||||
|
||||
# Duble click için fareyi konuma getir
|
||||
ctypes.windll.user32.SetCursorPos(x + 5, y + 5)
|
||||
|
||||
# DUBLE CLICK (hızlı ardışık iki sol tıklama)
|
||||
for _ in range(2):
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
|
||||
time.sleep(0.03) # Çok kısa bekleme ile gerçekçi duble click
|
||||
|
||||
except Exception as e:
|
||||
print(f"Restore silme hatası: {e}")
|
||||
|
||||
|
||||
|
||||
@staticmethod
|
||||
def kilic_sil_macro():
|
||||
keyboard.press('f4')
|
||||
time.sleep(0.1)
|
||||
keyboard.release('f4')
|
||||
|
||||
def run_macros(self):
|
||||
for macro_name, macro_data in self.macros.items():
|
||||
if macro_data['enabled']:
|
||||
macro_data['func']()
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.ui = Ui_MainWindow()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
self.macro_manager = MacroManager()
|
||||
self.worker = None
|
||||
self.thread = None
|
||||
|
||||
# UI bağlantıları
|
||||
self.ui.chk_atak.stateChanged.connect(
|
||||
lambda: self.toggle_macro('Atak', self.ui.chk_atak))
|
||||
self.ui.chk_kalkan.stateChanged.connect(
|
||||
lambda: self.toggle_macro('Kalkan Tak', self.ui.chk_kalkan))
|
||||
self.ui.chk_restore.stateChanged.connect(
|
||||
lambda: self.toggle_macro('Restore Sil', self.ui.chk_restore))
|
||||
self.ui.chk_kilic.stateChanged.connect(
|
||||
lambda: self.toggle_macro('Kılıç Sil', self.ui.chk_kilic))
|
||||
|
||||
self.ui.btn_baslat.clicked.connect(self.toggle_macro_execution)
|
||||
|
||||
def toggle_macro(self, macro_name, checkbox):
|
||||
self.macro_manager.macros[macro_name]['enabled'] = checkbox.isChecked()
|
||||
|
||||
def toggle_macro_execution(self):
|
||||
if self.worker and self.worker.running:
|
||||
self.stop_macros()
|
||||
self.ui.btn_baslat.setText("Makro Başlat")
|
||||
else:
|
||||
self.start_macros()
|
||||
self.ui.btn_baslat.setText("Makro Durdur")
|
||||
|
||||
def start_macros(self):
|
||||
self.thread = QThread()
|
||||
self.worker = MacroWorker(self.macro_manager)
|
||||
self.worker.moveToThread(self.thread)
|
||||
|
||||
self.thread.started.connect(self.worker.run)
|
||||
self.worker.finished.connect(self.thread.quit)
|
||||
self.worker.finished.connect(self.worker.deleteLater)
|
||||
self.thread.finished.connect(self.thread.deleteLater)
|
||||
self.worker.status_update.connect(
|
||||
lambda msg: self.ui.statusbar.showMessage(msg, 2000))
|
||||
|
||||
self.thread.start()
|
||||
|
||||
def stop_macros(self):
|
||||
if self.worker:
|
||||
self.worker.running = False
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.stop_macros()
|
||||
event.accept()
|
||||
|
||||
def click(x, y):
|
||||
ctypes.windll.user32.SetCursorPos(x, y)
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
|
||||
time.sleep(0.3)
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
|
||||
|
||||
|
||||
def rclick(x, y):
|
||||
ctypes.windll.user32.SetCursorPos(x, y)
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0)
|
||||
time.sleep(0.3)
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0)
|
||||
|
||||
|
||||
def double_click(x, y):
|
||||
"""Belirtilen konuma hızlı ardışık iki sol tıklama yapar"""
|
||||
ctypes.windll.user32.SetCursorPos(x, y)
|
||||
for _ in range(2):
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
|
||||
ctypes.windll.user32.mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
|
||||
time.sleep(0.03) # Gerçekçi duble click için
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Resim klasörünün varlığını kontrol et
|
||||
img_dir = os.path.join(os.path.dirname(__file__), "img")
|
||||
if not os.path.exists(img_dir):
|
||||
os.makedirs(img_dir)
|
||||
print(f"'img' klasörü oluşturuldu: {img_dir}")
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
sys.exit(app.exec())
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
|
|
@ -0,0 +1,65 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'mainGZHzyo.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.4.3
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
||||
QMetaObject, QObject, QPoint, QRect,
|
||||
QSize, QTime, QUrl, Qt)
|
||||
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
||||
QFont, QFontDatabase, QGradient, QIcon,
|
||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||
from PySide6.QtWidgets import (QApplication, QCheckBox, QMainWindow, QMenuBar,
|
||||
QPushButton, QSizePolicy, QStatusBar, QWidget)
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
if not MainWindow.objectName():
|
||||
MainWindow.setObjectName(u"MainWindow")
|
||||
MainWindow.resize(283, 156)
|
||||
self.centralwidget = QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName(u"centralwidget")
|
||||
self.chk_kalkan = QCheckBox(self.centralwidget)
|
||||
self.chk_kalkan.setObjectName(u"chk_kalkan")
|
||||
self.chk_kalkan.setGeometry(QRect(10, 40, 111, 20))
|
||||
self.chk_restore = QCheckBox(self.centralwidget)
|
||||
self.chk_restore.setObjectName(u"chk_restore")
|
||||
self.chk_restore.setGeometry(QRect(10, 60, 111, 20))
|
||||
self.chk_kilic = QCheckBox(self.centralwidget)
|
||||
self.chk_kilic.setObjectName(u"chk_kilic")
|
||||
self.chk_kilic.setGeometry(QRect(10, 80, 111, 20))
|
||||
self.chk_atak = QCheckBox(self.centralwidget)
|
||||
self.chk_atak.setObjectName(u"chk_atak")
|
||||
self.chk_atak.setGeometry(QRect(10, 20, 111, 20))
|
||||
self.btn_baslat = QPushButton(self.centralwidget)
|
||||
self.btn_baslat.setObjectName(u"btn_baslat")
|
||||
self.btn_baslat.setGeometry(QRect(160, 40, 91, 41))
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QMenuBar(MainWindow)
|
||||
self.menubar.setObjectName(u"menubar")
|
||||
self.menubar.setGeometry(QRect(0, 0, 283, 22))
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName(u"statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
|
||||
QMetaObject.connectSlotsByName(MainWindow)
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Discord", None))
|
||||
self.chk_kalkan.setText(QCoreApplication.translate("MainWindow", u"Kalkan Tak", None))
|
||||
self.chk_restore.setText(QCoreApplication.translate("MainWindow", u"Restore Sil", None))
|
||||
self.chk_kilic.setText(QCoreApplication.translate("MainWindow", u"K\u0131l\u0131\u00e7 Sil", None))
|
||||
self.chk_atak.setText(QCoreApplication.translate("MainWindow", u"Atak", None))
|
||||
self.btn_baslat.setText(QCoreApplication.translate("MainWindow", u"Makro Ba\u015flat", None))
|
||||
# retranslateUi
|
||||
|
||||
Loading…
Reference in New Issue