Add a command to drain inv

master
Tanner Collin 3 years ago
parent f65967342a
commit af1db24cd5
  1. 1
      bot.py
  2. 24
      game.py

@ -201,6 +201,7 @@ def init(global_state):
g.break_time = 0
g.dumping = None
g.draining = False
g.item_lock = False
g.command_lock = False

@ -653,6 +653,10 @@ class Game:
else:
reply = 'not found'
if command == 'drain':
self.g.draining = True
reply = 'ok'
if command == 'gapple':
self.g.job.state = self.g.job.find_gapple
if data:
@ -753,6 +757,10 @@ class Game:
if command == 'use':
self.use_item(0)
if command == 'test':
reply = 'ok'
self.select_next_item()
################# Authorized commands ##########################
if authed:
@ -897,6 +905,15 @@ class Game:
else:
return False
def select_next_item(self):
# select the next item slot that has an item
for slot, item in self.g.inv.items():
if item.present:
self.g.game.choose_slot(slot)
self.g.holding = item.item_id
return True
else: # for
return False
def drop_stack(self):
packet = PlayerDiggingPacket()
@ -1112,5 +1129,12 @@ class Game:
else:
self.g.dumping = None
if self.g.draining and not self.g.item_lock:
if self.select_next_item():
self.drop_stack()
self.g.item_lock = True
else:
self.g.draining = False
if not self.g.path:
self.g.correction_count = 0

Loading…
Cancel
Save