-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathauto_Questing_Zeus.py
345 lines (265 loc) · 9.43 KB
/
auto_Questing_Zeus.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# QUESTING
# REQUIRED:
# * DO NOT HAVE BACKPACKS
# * PACK PET
# * TRUSH POUCH
# * MAKE TOOL ONCE
# IMPORTS
# ========================
import sys
import re
# SETTINGS
# ========================
quest_mobile_serial = 0x00000717 # QUEST NPC
pack_pet_serial = 0x000117BD # PACK PET SERIAL
pet_serials ={
0x0000A8D5: {"name": "Nigoki", "food": "meat"},
0x0000A8D5: {"name": "Nirama", "food": "fruit"}
}
# TARGET ITEM_ID
target_item_ids = {
0x2831: "Recipe Scroll",
0x2F58: "Talisman",
0x2F59: "Talisman",
0x2F5A: "Talisman",
0x2F5B: "Talisman"
}
# TARGET PROPERTIES
target_properties_regex = {
"Recipe Scroll",
"Slayer",
"^(?=.*Bonus)(?=.*(2[5-9]|[3-9][0-9])).*$", # Bonus and 25-99
}
# ITEM_ID
# ========================
tool_kit_id = 0x1EB8
ingot_id = 0x1BF2
quest_item_color_id = 0x04ea
#for i in range(100):
# Misc.SendMessage("MESSAGE:" + str(i), i)
# Misc.Pause(100)
# INITS
# ========================
quested = False
# DEFINES
# ========================
def Warning():
Misc.SendMessage("WARNING:", 33)
for i in range(10):
Misc.SendMessage("Sub-backpacks and all items inside are DESTROYED!!!", 33)
Misc.SendMessage("IF YOU CONFIRMED, SELECT YOUR TRUSH POUCH.", 53)
Misc.SendMessage("( ESC to be CANCEL ) ", 53)
global trush_pouch
trush_pouch = Target.PromptTarget()
if trush_pouch == -1:
Misc.SendMessage("Cancelled!", 5)
sys.exit()
def MoveItemToBackpack(item):
Items.Move(item, Player.Backpack.Serial, 0)
Misc.Pause(1000)
def MoveItemToTrush(item):
Items.Move(item, trush_pouch, 0)
Misc.Pause(1000)
def GetItemFromPet(item, low_amount, get_amount):
if Items.BackpackCount(item, -1) < low_amount:
pet = Mobiles.FindBySerial(pack_pet_serial)
get_item = Items.FindByID(item, -1, pet.Backpack.Serial)
Items.Move(get_item, Player.Backpack.Serial, get_amount)
Misc.Pause(1000)
def DevideSubBackpackItems():
Misc.SendMessage("DEVIDE ITEMS", 1150)
Misc.SendMessage("==============", 1150)
backpack_id = 0x0E75
while Items.FindByID(backpack_id, -1, Player.Backpack.Serial):
sub_backpack = Items.FindByID(backpack_id, -1, Player.Backpack.Serial)
if sub_backpack:
for item_id in target_item_ids:
while Items.FindByID(item_id, -1, sub_backpack.Serial):
target_item = Items.FindByID(item_id, -1, sub_backpack.Serial)
if target_item:
item_props = Items.GetPropStringList(target_item)
is_target = False
# PROPERTIES CHECK
for item_prop in item_props:
Misc.SendMessage(item_prop)
# EVAL TARGET PROPERTIES
for target_prop in target_properties_regex:
# REGEX
if re.search(target_prop, item_prop, flags=re.IGNORECASE):
Misc.Beep()
Misc.SendMessage("MATCH!", 50)
Misc.SendMessage("REGEX:", 60)
Misc.SendMessage(" => " + target_prop, 60)
Misc.SendMessage("PROPS:", 80)
Misc.SendMessage(" => " + item_prop, 80)
is_target = True
# TARGET TO KEEP OR TRUSH
if is_target:
Misc.SendMessage(" => KEEP", 90)
MoveItemToBackpack(target_item)
is_target = False
else:
Misc.SendMessage(" => TRUSH")
MoveItemToTrush(target_item)
Misc.Pause(1000)
Misc.Pause(100)
MoveItemToTrush(sub_backpack)
Misc.Pause(1000)
def SubBackpackCleanup():
bag = 0x0E75
colors = {
0x0003: "Blue",
0x000d: "Purple",
0x0021: "Red",
0x001c: "Dark Pink",
0x0037: "Frog Green",
0x003a: "Uguisu Green",
0x0044: "Green",
0x0059: "Light Blue",
0x0062: "Dark Blue",
0x0071: "Dark Purple"
}
for color in colors:
while Items.FindByID(bag, color, Player.Backpack.Serial):
item = Items.FindByID(bag, color, Player.Backpack.Serial)
MoveItemToTrush(item)
def Questing():
global quested
if quested:
return
if 10 <= Items.BackpackCount(tool_kit_id, quest_item_color_id):
return
Misc.SendMessage("QUESTING", 1150)
Misc.SendMessage("==============", 1150)
while not quested:
# TALK
Mobiles.UseMobile(quest_mobile_serial)
Misc.Pause(100)
# ALREDY GET QUEST?
if Gumps.LastGumpTextExist("I will be in your debt if you bring me"):
Misc.SendMessage("Already have a quest.")
# CLOSE
Gumps.WaitForGump(1280077232, 10000)
Gumps.SendAction(1280077232, 0)
quested = True
Misc.Pause(500)
return
# CHECK QUEST
quest_check = Gumps.LastGumpTextExist("Necessity's Mother")
Misc.SendMessage("QUEST: %s" % quest_check)
if quest_check:
# ACCEPT
Gumps.WaitForGump(1280077232, 10000)
Gumps.SendAction(1280077232, 4)
quested = True
else:
# REFUSE
Gumps.WaitForGump(1280077232, 10000)
Gumps.SendAction(1280077232, 2)
# CLOSE
Gumps.WaitForGump(1280077232, 10000)
Gumps.SendAction(1280077232, 0)
quested = False
Misc.Pause(500)
def HowManyMake():
# CREATE TOOLS FOR QUEST
if Items.BackpackCount(tool_kit_id, 0) <= 1:
return 11
else:
return 10
def Craft():
global quested
if not quested:
return
if 10 <= Items.BackpackCount(tool_kit_id, quest_item_color_id):
return
Misc.SendMessage("CRAFTING", 1150)
Misc.SendMessage("==============", 1150)
# CREATE TOOLS FOR QUEST
count = 0
while Items.BackpackCount(tool_kit_id, quest_item_color_id) < HowManyMake() and (count < 15):
# USE
item = Items.FindByID(tool_kit_id, 0, Player.Backpack.Serial)
Items.UseItem(item)
Misc.Pause(500)
# REMAKE
Gumps.WaitForGump(949095101, 10000)
Gumps.SendAction(949095101, 21)
Misc.Pause(1500)
count += 1
# CLOSE
Gumps.WaitForGump(949095101, 10000)
Gumps.SendAction(949095101, 0)
Misc.Pause(500)
def ReportQuest():
global quested
Misc.SendMessage("REPORT QUEST", 1150)
Misc.SendMessage("==============", 1150)
if 10 <= Items.BackpackCount(tool_kit_id, quest_item_color_id):
# TALK
Mobiles.UseMobile(quest_mobile_serial)
Misc.Pause(250)
# CONTINUE
Gumps.WaitForGump(1280077232, 10000)
Gumps.SendAction(1280077232, 8)
# ACCEPT
Gumps.WaitForGump(1280077232, 10000)
Gumps.SendAction(1280077232, 5)
quested = False
Misc.Pause(250)
# ITEM_ID: Foods
# ===============================
foods = {
0x097B: {"name": "fish", "type": "etc"},
0x097D: {"name": "cheese", "type": "etc"},
0x09B7: {"name": "chicken", "type": "meat"},
0x09C0: {"name": "sausage", "type": "meat"},
0x09C9: {"name": "ham", "type": "meat"},
0x09D1: {"name": "grape", "type": "fruit"},
0x09D2: {"name": "peach", "type": "fruit"},
0x09D0: {"name": "apple", "type": "fruit"},
0x09EB: {"name": "muffins", "type": "etc"},
0x09F2: {"name": "ribs", "type": "meat"}
}
# DEFINES: PetFood
# ===============================
def PetFood(pet_serial, trush_poach_serial):
global ate_meat
global ate_fruit
ate_meat = False
ate_fruit = False
Misc.SendMessage("PETFOOD", 1150)
Misc.SendMessage("==============", 1150)
while ate_fruit == False:
Spells.CastMagery("Create Food")
Misc.Pause(1000)
for food_k, food_v in foods.items():
item = Items.FindByID(food_k, -1, Player.Backpack.Serial)
if item is not None:
if food_v["type"] == "fruit":
Target.Cancel()
Misc.Pause(50)
Items.Move(item, pet_serial, 0)
ate_fruit = True
Misc.Pause(500)
for food in foods.keys():
item = Items.FindByID(food, -1, Player.Backpack.Serial)
if item is not None:
Target.Cancel()
Misc.Pause(50)
Items.Move(item, trush_poach_serial, 0)
Misc.Pause(500)
Misc.Pause(1000)
# RUN
# ========================
Warning()
while True:
PetFood(pack_pet_serial, trush_pouch)
for i in range(10):
DevideSubBackpackItems()
SubBackpackCleanup()
Questing()
GetItemFromPet(ingot_id, 100, 400)
Craft()
ReportQuest()
Misc.Pause(50)