-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathget_base_50s.py
111 lines (93 loc) · 3.08 KB
/
get_base_50s.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
# Fishes and fights South of Port Sarim until level 50
api = lambda: None
def set_api():
"""
Sets all the global variables into an api variable so it can be passed to other scripts
Avoid defining too many things in this file..
"""
for k in globals():
if k.startswith("__") or k == "api":
continue
setattr(api, k, globals()[k])
SLEEPING_BAG = 1263
TINDERBOX = 166
BRONZE_AXE = 87
FISHING_NET = 376
walk_path = None
def walk_to_point(point: "List[int]", debug_name: str = "(some path)") -> int:
global walk_path
if walk_path == None:
api.log("Calculating path to " + debug_name + "")
walk_path = api.calculate_path_to(point[0], point[1])
if walk_path == None:
api.log("Failed to calculate path to " + debug_name + "")
return 1000
walk_path.process()
if not walk_path.complete():
api.log("Walking " + debug_name + "")
if not walk_path.walk():
api.log("Failed to walk " + debug_name + "")
walk_path = None
else:
api.log("Walked " + debug_name + " successfully")
return 600
else:
walk_path = None
return 650
def get_adjacent_coord():
if is_reachable(get_x()+1, get_z()):
return (get_x()+1, get_z())
elif is_reachable(get_x(), get_z()+1):
return (get_x(), get_z()+1)
elif is_reachable(get_x()-1, get_z()):
return (get_x()-1, get_z())
elif is_reachable(get_x(), get_z()-1):
return (get_x(), get_z()-1)
return (None, None)
def walk_adjacent() -> int:
adj_x, adj_z = get_adjacent_coord()
if adj_x == None or adj_z == None:
api.log("FAILED TO GET ADJACENT COORD!! RIP GOOD SOUL")
return 1000
if api.walk_to(adj_x, adj_z):
api.log("Moved to %s, %s" % (adj_x, adj_z))
else:
api.log("Failed to move to %s, %s" % (adj_x, adj_z))
return 1000
print(api)
import skip_tutorial_script
import get_acc_builder_equip
import full_shrimp_port_sarim
move_timer = False
def loop():
set_api() # Needs to be called on each loop because the globals get updated on login
api.set_autologin(True)
global move_timer
if move_timer:
api.log("Moving otherwise we'll log out..")
move_timer = False
return walk_adjacent()
if api.get_fatigue() > 95 and api.has_inventory_item(SLEEPING_BAG):
api.log("Sleeping zzz")
api.use_sleeping_bag()
return 5000
if not skip_tutorial_script.done(api):
api.log("Tutorial")
return skip_tutorial_script.go(api)
if not get_acc_builder_equip.done(api):
api.log("Getting acc builder equip")
return get_acc_builder_equip.go(api)
if not full_shrimp_port_sarim.done(api):
api.log("Fishing shrimp")
return full_shrimp_port_sarim.go(api)
else:
api.log("Done everything. I have %s items in my inventory" % len(api.get_inventory_items()))
api.stop_script()
api.set_autologin(False)
api.logout()
api.stop_account()
return 10000
def on_server_message(msg):
global move_timer
if msg.startswith("@cya@You have been standing"):
move_timer = True