Compare commits
1 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
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>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
<mapping directory="" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,118 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="AutoImportSettings">
|
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
|
||||||
</component>
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="6630e23d-5f42-4fcf-ab4c-5c715600be9a" name="Changes" comment="login session added">
|
|
||||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="FileTemplateManagerImpl">
|
|
||||||
<option name="RECENT_TEMPLATES">
|
|
||||||
<list>
|
|
||||||
<option value="Python Script" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="Git.Settings">
|
|
||||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
|
||||||
<map>
|
|
||||||
<entry key="$PROJECT_DIR$" value="master" />
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectColorInfo">{
|
|
||||||
"associatedIndex": 2
|
|
||||||
}</component>
|
|
||||||
<component name="ProjectId" id="2uPDleMXrxfQNINpIA1SOcNUpzo" />
|
|
||||||
<component name="ProjectViewState">
|
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
|
||||||
<option name="showLibraryContents" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
|
||||||
"keyToString": {
|
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
|
||||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
|
||||||
"Python.main3.executor": "Run",
|
|
||||||
"Python.mainokcu.executor": "Run",
|
|
||||||
"Python.officialokcumakro.executor": "Run",
|
|
||||||
"Python.ofmacson.executor": "Run",
|
|
||||||
"Python.ofmacson1.executor": "Run",
|
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
|
||||||
"git-widget-placeholder": "login",
|
|
||||||
"last_opened_file_path": "C:/Users/ferra/PycharmProjects/makrocalisma",
|
|
||||||
"settings.editor.selected.configurable": "vcs.Git"
|
|
||||||
}
|
|
||||||
}]]></component>
|
|
||||||
<component name="PyConsoleOptionsProvider">
|
|
||||||
<option name="myPythonConsoleState">
|
|
||||||
<console-settings module-name="makrocalisma" sdk-home="$PROJECT_DIR$/makro/Scripts/python.exe">
|
|
||||||
<option name="sdk">
|
|
||||||
<Sdk />
|
|
||||||
</option>
|
|
||||||
<option name="mySdkHome" value="$PROJECT_DIR$/makro/Scripts/python.exe" />
|
|
||||||
<option name="mySdk">
|
|
||||||
<Sdk />
|
|
||||||
</option>
|
|
||||||
<option name="myModuleName" value="makrocalisma" />
|
|
||||||
</console-settings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="SharedIndexes">
|
|
||||||
<attachedChunks>
|
|
||||||
<set>
|
|
||||||
<option value="bundled-python-sdk-4c141bd692a7-e2d783800521-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-251.26927.90" />
|
|
||||||
</set>
|
|
||||||
</attachedChunks>
|
|
||||||
</component>
|
|
||||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="6630e23d-5f42-4fcf-ab4c-5c715600be9a" name="Changes" comment="" />
|
|
||||||
<created>1742141468248</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<option name="presentableId" value="Default" />
|
|
||||||
<updated>1742141468248</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00001" summary="login session added">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1756600811240</created>
|
|
||||||
<option name="number" value="00001" />
|
|
||||||
<option name="presentableId" value="LOCAL-00001" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1756600811240</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00002" summary="login session added">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1756600847010</created>
|
|
||||||
<option name="number" value="00002" />
|
|
||||||
<option name="presentableId" value="LOCAL-00002" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1756600847010</updated>
|
|
||||||
</task>
|
|
||||||
<option name="localTasksCounter" value="3" />
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="Vcs.Log.Tabs.Properties">
|
|
||||||
<option name="TAB_STATES">
|
|
||||||
<map>
|
|
||||||
<entry key="MAIN">
|
|
||||||
<value>
|
|
||||||
<State />
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
</map>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
<component name="VcsManagerConfiguration">
|
|
||||||
<MESSAGE value="login session added" />
|
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="login session added" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue