diff --git a/bot.py b/bot.py index 28bbf92..bac151e 100644 --- a/bot.py +++ b/bot.py @@ -206,6 +206,7 @@ def init(global_state): g.command_lock = False g.window = None + g.trades = [] g.job = jobs.JobStates(g) g.chopped_tree = False @@ -246,7 +247,7 @@ def bot(global_state): time.sleep(utils.TICK) print('Player loaded.') - while not g.chunks.check_loaded(g.pos, 529): + while not g.chunks.check_loaded(g.pos, 288): time.sleep(utils.TICK) print('Chunks loaded.') diff --git a/game.py b/game.py index b73b1f9..14844ed 100644 --- a/game.py +++ b/game.py @@ -922,7 +922,9 @@ class Game: def select_next_item(self): # select the next item slot that has an item for slot, item in self.g.inv.items(): + if slot < 9: continue # skip armour slots if item.present: + print('slot:', slot, 'item:', item) self.g.game.choose_slot(slot) self.g.holding = item.item_id return True diff --git a/jobs.py b/jobs.py index 7eb8e9c..0a436c8 100644 --- a/jobs.py +++ b/jobs.py @@ -403,6 +403,7 @@ class GatherWoodStates: print('Unable to get to tree', self.tree) if self.tree not in self.good_trees: self.bad_trees.append(self.tree) + print('Added to bad trees list') self.state = self.cleanup return @@ -507,7 +508,6 @@ class GatherWoodStates: # never gets ran, placeholder return None - def __init__(self, global_state): self.g = global_state self.state = self.idle @@ -1288,19 +1288,23 @@ class ClearLeavesStates: return None def init(self): - if self.g.chopped_tree: - sapling_type = self.g.chopped_tree + '_sapling' - sapling_item = items.get_id(sapling_type) - num_saplings = self.g.game.count_items([sapling_item]) - print('Have', num_saplings, sapling_type, 'in inventory') + if not self.g.chopped_tree: + print('Didnt chop tree, clearing leaves') + self.state = self.cleanup + return - if num_saplings > 8: - print('Aborting clearing leaves') - self.state = self.cleanup - return + sapling_type = self.g.chopped_tree + '_sapling' + sapling_item = items.get_id(sapling_type) + num_saplings = self.g.game.count_items([sapling_item]) + print('Have', num_saplings, sapling_type, 'in inventory') - self.state = self.select_log - print('Clearing leaves...') + if num_saplings > 8: + print('Have enough saplings, aborting clearing leaves') + self.state = self.cleanup + return + + self.state = self.select_log + print('Clearing leaves...') def select_log(self): # select a log to avoid using tools