-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfull_shrimp_port_sarim.py
122 lines (93 loc) · 3.35 KB
/
full_shrimp_port_sarim.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
# Fills inventory with cooked shrimp South West of port Sarim
# get_acc_builder_equip should be run first to get all the reqs
BURNT_SHRIMP_ID = 353
RAW_SHRIMP_ID = 349
RAW_ANCHOVY_ID = 321
COOKED_SHRIMP_ID = 350
TINDERBOX_ID = 166
LOGS_ID = 14
TREE_IDS = [0, 1]
FISH_SPOT = (310, 686)
FISH_OBJ_ID = 193
FIRE_ID = 97
unstuck = False
def done(api):
return len(api.get_inventory_items()) >= 25 and not api.has_inventory_item(BURNT_SHRIMP_ID) and not api.has_inventory_item(RAW_SHRIMP_ID) and not api.has_inventory_item(RAW_ANCHOVY_ID)
def go(api):
global unstuck
if api.in_combat():
if not api.walk_to(api.get_x(), api.get_z()):
api.log("Could not escape combat")
return 650
api.log("# Cooked shrimp = %s, # Raw shrimp = %s" % (api.get_inventory_count_by_id(COOKED_SHRIMP_ID), api.get_inventory_count_by_id(RAW_SHRIMP_ID)))
if unstuck:
return get_unstuck(api)
elif len(api.get_inventory_items()) < 25:
return go_fish(api)
elif api.has_inventory_item(RAW_SHRIMP_ID) and api.get_nearest_object_by_id(FIRE_ID):
return cook_shrimp(api)
elif api.has_inventory_item(RAW_SHRIMP_ID) and api.get_nearest_ground_item_by_id(LOGS_ID):
return burn_logs(api)
elif api.has_inventory_item(LOGS_ID):
return drop_logs(api)
elif api.has_inventory_item(RAW_SHRIMP_ID):
return chop_logs(api)
elif api.has_inventory_item(BURNT_SHRIMP_ID):
drop_unneeded_items(api)
return 1000
api.log("Nothing to do")
return 700
def get_unstuck(api):
global unstuck
unstuck = False
log("Getting unstuck")
return api.walk_path_point((305, 880), "firemakable location")
def drop_unneeded_items(api):
for item in api.get_inventory_items():
if item.id == BURNT_SHRIMP_ID or item.id == RAW_ANCHOVY_ID:
api.drop_item(item)
return True
return False
def go_fish(api):
if drop_unneeded_items(api):
return 700
if not api.in_radius_of(FISH_SPOT[0],FISH_SPOT[1],8):
return api.walk_to_point(FISH_SPOT, "fish spot")
fish_spot_obj = api.get_nearest_object_by_id(FISH_OBJ_ID)
if fish_spot_obj == None:
api.log("Could not find fishing spot")
return 1000
api.at_object(fish_spot_obj)
return 2000
def cook_shrimp(api):
fire_obj = api.get_nearest_object_by_id(FIRE_ID)
if fire_obj == None:
api.log("Could not find fire")
return 1000
api.log("Gonna use " + str(api.get_inventory_item_by_id(RAW_SHRIMP_ID)) + " on " + str(fire_obj))
api.use_item_on_object(api.get_inventory_item_by_id(RAW_SHRIMP_ID), fire_obj)
return 2000
def burn_logs(api):
logs = api.get_nearest_ground_item_by_id(LOGS_ID)
if logs == None:
api.log("Could not find logs")
return 1000
api.use_item_on_ground_item(api.get_inventory_item_by_id(TINDERBOX_ID), logs)
return 2000
def drop_logs(api):
api.drop_item(api.get_inventory_item_by_id(LOGS_ID))
return api.walk_adjacent()
def chop_logs(api):
if drop_unneeded_items(api):
return 700
tree = api.get_nearest_object_by_id(ids=TREE_IDS)
if tree == None:
api.log("Could not find tree")
return 1000
api.at_object(tree)
return 2000
def on_server_message(msg):
global unstuck
if msg.startswith("You can't light"):
log("Need to get unstuck")
unstuck = True