forked from TheRealRhyle/SWGResouceScanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SWGRREP.py
91 lines (77 loc) · 2.84 KB
/
SWGRREP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import utils.auth as auth
import utils.readscreen as rs
import utils.parsedata as par
import utils.planet_coords as wp
import utils.discordposter as discord
from playsound import playsound
import keyboard
import time
# import json
def main_process():
_login, gh_sid = auth.get_auth()
gh_sid = gh_sid.strip('\n')
wp_planet = wp.get_planet()
wp_way = wp.get_coords()
getinfo = rs.get_resource_info()
resource_sample, _ = rs.parse_validate_write(getinfo)
resource_sample.gh_sid = gh_sid
resource_sample.planet = wp_planet
resource_sample.forceOp = "verify"
sample_json = par.class_to_json(resource_sample)
# build string as form data
submit_string = '?'
test_dict = eval(sample_json)
for k,v in test_dict.items():
submit_string = submit_string + k+"="+v+"&"
return submit_string
while True:
# . post to Galaxy Harvester
# ; post to Discord
if keyboard.read_key() == ".":
rs.dump_to_file()
playsound('resources/success1.mp3')
elif keyboard.read_key() == ",":
resource_sample, _ = rs.parse_validate_write(rs.get_resource_info())
playsound('resources/success1.mp3')
elif keyboard.read_key()=="'":
break
# if keyboard.read_key() == ".":
# # wp_planet = wp.get_planet()
# # getinfo = rs.get_resource_info()
# # _, getinfo = rs.parse_validate_write(getinfo)
# getinfo = rs.get_resource_info()
# resource_sample, _ = rs.parse_validate_write(getinfo)
# # print(getinfo)
# # string = main_process()
# # print(string)
# print(getinfo)
# if resource_sample != 'KeyError':
# playsound('resources/success1.mp3')
# else:
# playsound('resources/JarJarClumsy.mp3')
# # resp = auth.add_resource()
# # # resp = discord.post_to_discord(wp_planet, x,y, getinfo)
# # if resp == 200 or resp == 204:
# # playsound('resources/success1.mp3')
# # else:
# # playsound('resources/fail1.mp3')
# # else:
# # playsound('resources/JarJarClumsy.mp3')
# elif keyboard.read_key() == ";":
# wp_planet = wp.get_planet()
# x,y = wp.get_coords()
# getinfo = rs.get_resource_info()
# _, getinfo = rs.parse_validate_write(getinfo)
# if getinfo != 'KeyError':
# resp = discord.post_to_discord(wp_planet, x,y, getinfo)
# if resp == 200 or resp == 204:
# playsound('resources/success1.mp3')
# else:
# playsound('resources/fail1.mp3')
# else:
# playsound('resources/JarJarClumsy.mp3')
# elif keyboard.read_key()=="'":
# break
# r = auth.add_resource(login, submit_string)
# print(r.status_code)
# print(r.content)