-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmisc_BulkGacha.py
96 lines (65 loc) · 2.26 KB
/
misc_BulkGacha.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
import re
bulkgacha_button_number = 4
bulkgacha_serial = 0x40016844
bulkgacha_gump = 668631410
bulk_id = 0x2258
book_id = 0x2259
Misc.SendMessage("Bulk Orders Books CONTAINER?", 54)
container_serial = Target.PromptTarget()
Misc.SendMessage(container_serial, 80)
Misc.SendMessage("Finished CONTAINER?", 54)
finished_container_serial = Target.PromptTarget()
Misc.SendMessage(container_serial, 80)
def withdrawGold(lessThan=200, amount=20000):
if Player.Gold <= lessThan:
Player.ChatSay(33, "withdraw %i" % amount)
Misc.Pause(200)
def buyBulkDeed(button_number):
withdrawGold()
if not Gumps.CurrentGump() == bulkgacha_gump:
Items.UseItem(bulkgacha_serial)
Gumps.WaitForGump(bulkgacha_gump, 1000)
Gumps.SendAction(bulkgacha_gump, button_number)
def getBook():
container = Items.FindBySerial(container_serial)
if container.IsContainer:
book = Items.FindByID(book_id, 0x0000, container_serial)
if book:
return book
else:
Misc.SendMessage("There is not a bulk order book!", 33)
end()
else:
Misc.SendMessage("This is not a container.", 33)
end()
def evalBook(book):
for prop in book.Properties:
match = re.search("^Deeds in book: (\d+)$", str(prop))
if match:
Misc.SendMessage(match.groups()[0] + "/500", 80)
space = 500 - int(match.groups()[0])
if not space:
Items.Move(book, finished_container_serial, 1)
Misc.Pause(550)
return space
def putBulk():
while Items.FindByID(bulk_id, -1, Player.Backpack.Serial):
book = getBook()
evalBook(book)
bulk = Items.FindByID(bulk_id, -1, Player.Backpack.Serial)
if bulk and book:
Items.Move(bulk, book, 1)
Misc.Pause(610)
Gumps.WaitForGump(1425364447, 10000)
if Gumps.CurrentGump() == 1425364447:
Gumps.SendAction(1425364447, 0)
while True:
putBulk()
book = getBook()
if not book:
break
space = evalBook(book)
if 50 <= space:
space = 50
for i in range(space):
buyBulkDeed(bulkgacha_button_number)