103 lines
4.0 KiB
Python
103 lines
4.0 KiB
Python
from src import sendkeys
|
|
from src import config
|
|
from src import data
|
|
import win32api
|
|
import win32gui
|
|
import win32con
|
|
from time import sleep
|
|
|
|
|
|
def test_send_direct():
|
|
config.read_config(r'config.yaml')
|
|
sendkeys.send_directInput('Hello World')
|
|
|
|
|
|
def test_sendkeys():
|
|
config.read_config(r'config.yaml')
|
|
sendkeys.send_text('Hello World')
|
|
|
|
|
|
def test_inv():
|
|
conf = config.read_config(r'config.yaml')
|
|
data.compile_regex(conf)
|
|
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
|
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
|
message = data.Message.from_text(text)
|
|
sendkeys.invite(message)
|
|
|
|
|
|
def test_send_to():
|
|
config.read_config(r'config.yaml')
|
|
text = 'Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
|
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
|
# sendkeys.send_to('Sinusal', 'Your item level 21 23% Vaal Impurity of Lightning for 18 chaos is ready to pickup.')
|
|
sendkeys.send_to('Sinusal', text)
|
|
|
|
|
|
def test_send_to2():
|
|
config.read_config(r'config.yaml')
|
|
text = 'Hi, I would like to buy your Watcher\'s Eye ' \
|
|
'listed for 7 Exalt in Ritual (stash tab "$"; position: left 25, top 1)'
|
|
sendkeys.send_to('Sinusal', text)
|
|
|
|
|
|
def test_pickup():
|
|
conf = config.read_config(r'config.yaml')
|
|
data.compile_regex(conf)
|
|
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
|
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
|
message = data.Message.from_text(text)
|
|
sendkeys.send_to_format('pickup', message)
|
|
|
|
|
|
def test_wait():
|
|
conf = config.read_config(r'config.yaml')
|
|
data.compile_regex(conf)
|
|
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
|
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
|
message = data.Message.from_text(text)
|
|
sendkeys.send_to_format('wait', message)
|
|
|
|
|
|
def test_ty():
|
|
conf = config.read_config(r'config.yaml')
|
|
data.compile_regex(conf)
|
|
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
|
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
|
message = data.Message.from_text(text)
|
|
sendkeys.send_to_format('ty', message)
|
|
|
|
|
|
def test_sold():
|
|
conf = config.read_config(r'config.yaml')
|
|
data.compile_regex(conf)
|
|
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: Hi, I would like to buy your level 21 23% Vaal Impurity of Lightning ' \
|
|
'listed for 18 chaos in Ritual (stash tab "$"; position: left 22, top 5)'
|
|
message = data.Message.from_text(text)
|
|
sendkeys.send_to_format('sold', message)
|
|
|
|
|
|
def test_ty_wo_trade():
|
|
conf = config.read_config(r'config.yaml')
|
|
data.compile_regex(conf)
|
|
text = '2021/03/08 23:24:52 17931875 bb3 [INFO Client 1492] @From Sinusal: Hi, how are you doing? '
|
|
message = data.Message.from_text(text)
|
|
sendkeys.send_to_format('ty', message)
|
|
|
|
|
|
def test_win31_api():
|
|
hwndMain = win32gui.FindWindow(None, "cmd")
|
|
hwndChild = win32gui.GetWindow(hwndMain, win32con.GW_CHILD)
|
|
while(True):
|
|
# [hwndChild] this is the Unique ID of the sub/child application/proccess
|
|
# [win32con.WM_CHAR] This sets what PostMessage Expects for input theres KeyDown and KeyUp as well
|
|
# [0x44] hex code for D
|
|
# [0]No clue, good luck!
|
|
# temp = win32api.PostMessage(hwndChild, win32con.WM_CHAR, 0x44, 0) returns key sent
|
|
temp = win32api.PostMessage(hwndChild, win32con.WM_CHAR, 0x44, 0)
|
|
|
|
# print(temp) prints the returned value of temp, into the console
|
|
print(temp)
|
|
# sleep(1) this waits 1 second before looping through again
|
|
sleep(1)
|