-
Notifications
You must be signed in to change notification settings - Fork 0
/
Steel_Loot_Gui.py
211 lines (165 loc) · 6.31 KB
/
Steel_Loot_Gui.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# More Info Soon
# This is steel_loot combined with whitelist
# You can create white_list with items_to_list.py
# V0.3 14.01.23 22:32
if __name__ == "":
from JsMacrosAC import *
import ast
# == DEBUG ==
debug = True
# == DEBUG ==
white_lst = ['the_vault:faceted_focus', 'the_vault:fundamental_focus', 'the_vault:resilient_focus',
'the_vault:opportunistic_focus', 'the_vault:nullifying_focus', 'the_vault:amplifying_focus',
'the_vault:wild_focus']
lst = len(white_lst)
click_lst = []
active_lst = []
btn_clicked_one = 0
btn_clicked_two = 0
screen = Hud.createScreen("Whitelist WIP", False)
def close(m1, m2):
screen.close()
if debug:
Chat.log("Closed Screen")
def callback(btn, ctx):
global btn_clicked_two
if btn_clicked_two == 0:
btn.setLabel("X")
btn_clicked_two = 1
if debug:
Chat.log('Selected')
return btn_clicked_two
if btn_clicked_two == 1:
btn.setLabel("")
btn_clicked_two = 0
if debug:
Chat.log('Unselected')
return btn_clicked_two
def callback_two(btn, ctx):
global btn_clicked_one
if btn_clicked_one == 0:
btn.setLabel("X")
btn_clicked_one = 1
if debug:
Chat.log('Selected')
return btn_clicked_one
if btn_clicked_one == 1:
btn.setLabel("")
btn_clicked_one = 0
if debug:
Chat.log('Unselected')
return btn_clicked_one
def print_str(str):
if str in click_lst:
return
else:
click_lst.append(str)
if debug:
Chat.log("click_lst from print_str")
Chat.log(click_lst)
def cls_lst(a1, a2):
click_lst.clear()
if debug:
Chat.log("click_lst from def cls_lst")
Chat.log(click_lst)
Chat.log("Cleared Marked Items")
screen.reload()
def set_active_lst(a3, a4):
global active_lst
active_lst.clear()
active_lst = click_lst.copy()
Chat.log("Active List")
if debug:
Chat.log("active_lst from set_active_lst")
Chat.log(active_lst)
return active_lst
def cls_active_lst(a5, a6):
active_lst.clear()
Chat.log("Cleared Whitelist")
def save_lst(a7, a8):
with open(r'C:/Users/Julian/PycharmProjects/Minecraft jsMacros/Linked/config_whitelist.txt', 'w') as fp:
fp.write(str(active_lst))
fp.close()
Chat.log("Whitelist Saved")
def load_lst(a9, a10):
try:
with open("C:/Users/Julian/PycharmProjects/Minecraft jsMacros/Linked/config_whitelist.txt") as f:
saved_list_str = f.read()
f.close()
saved_list = ast.literal_eval(saved_list_str)
Chat.log("Loaded Whitelist")
if debug:
Chat.log(saved_list)
except FileNotFoundError:
Chat.log("Filed Doesnt Exist")
def screen_init(screen):
cen_x = int(Hud.getOpenScreen().getWidth() * 0.5)
cen_y = int(Hud.getOpenScreen().getHeight() * 0.5)
y_close = int(cen_y * 1.8)
x_close = int(cen_x * 0.885)
y_cls_lst = int(cen_y * 1.7)
screen.addButton(20, 20, 100, 20, "Add item to Whitelist", JavaWrapper.methodToJava(set_active_lst))
screen.addButton(20, 45, 100, 20, "Check Whitelist", JavaWrapper.methodToJava(lambda a5, a6: Chat.log(active_lst)))
screen.addButton(20, 70, 100, 20, "Clear Whitelist", JavaWrapper.methodToJava(cls_active_lst))
screen.addButton(20, 95, 100, 20, "Load Whitelist", JavaWrapper.methodToJava(load_lst))
screen.addButton(20, 120, 100, 20, "Save Whitelist", JavaWrapper.methodToJava(save_lst))
screen.addButton(x_close, y_close, 100, 20, "Close", JavaWrapper.methodToJava(close))
screen.addButton(x_close, y_cls_lst, 100, 20, "Clear Marked Items", JavaWrapper.methodToJava(cls_lst))
for index, value in enumerate(white_lst):
index = 20 + index * 20
screen.addItem(140, index, value, screen)
screen.addButton(160, index, 10, 10, "",
JavaWrapper.methodToJava(lambda btn, ctx, str=value: btn.setLabel("X") and print_str(str)))
def rm(ctx): # If using Command
screen.setOnInit(JavaWrapper.methodToJava(screen_init))
Hud.openScreen(screen)
Chat.createCommandBuilder('ov').executes(JavaWrapper.methodToJavaAsync(rm)).register()
vanilla_inventory_slots = 46
# white_list = ["minecraft:stone", "minecraft:grass_block", "minecraft:oak_planks"]
def on_click(ctx, btn):
Chat.log("Mjau")
chest_slots = int(Player.openInventory().getTotalSlots() - vanilla_inventory_slots)
Chat.log(chest_slots)
for i in range(chest_slots):
i = + i
if Player.openInventory().getSlot(i).getItemId() != "minecraft:air":
Chat.log(Player.openInventory().getSlot(i).getItemId())
if Player.openInventory().getSlot(i).getItemId() in active_lst:
Player.openInventory().quickAll(i)
pass
def screen_init_from_chest(sceen):
Hud.getOpenScreen().close()
screen.setOnInit(JavaWrapper.methodToJava(screen_init))
Hud.openScreen(screen)
# screen_init(screen)
def chest(ybtn, ybtn_wl):
Time.sleep(10)
screen_chest = Hud.getOpenScreen()
x_btn = int(Hud.getOpenScreen().getWidth() * 0.47)
y_btn = int(Hud.getOpenScreen().getHeight() / 2 * ybtn)
x_btn_wl = int(Hud.getOpenScreen().getWidth() * 0.555)
y_btn_wl = int(Hud.getOpenScreen().getHeight() / 2 * ybtn_wl)
screen_chest.addButton(x_btn, y_btn, 50, 12, 150, "Steal", JavaWrapper.methodToJava(on_click))
screen_chest.addButton(x_btn_wl, y_btn_wl, 10, 10, 150, "X", JavaWrapper.methodToJava(lambda btn, tt: screen_init_from_chest(screen)))
if debug:
Chat.log("Opened Chest")
Chat.log(screen_chest)
def check_chest():
if "Chest" in Hud.getOpenScreenName():
if "6" in Hud.getOpenScreenName():
ybtn = 1.059
ybtn_wl = 0.54
chest(ybtn, ybtn_wl)
elif "5" in Hud.getOpenScreenName():
ybtn = 1.02
ybtn_wl = 0.576
chest(ybtn, ybtn_wl)
elif "4" in Hud.getOpenScreenName():
ybtn = 0.982
ybtn_wl = 0.618
chest(ybtn, ybtn_wl)
elif "3" in Hud.getOpenScreenName():
ybtn = 0.945
ybtn_wl = 0.655
chest(ybtn, ybtn_wl)
JsMacros.on("OpenScreen", JavaWrapper.methodToJava(lambda a11, a12: check_chest() if(Hud.getOpenScreenName() is not None) else Chat.log("None")))