Include item names in supply logs

This commit is contained in:
Tanner committed 2026-11-18 21:01:17 +00:00
1 parent 86cf8672f6
commit ccf3c1748c
1 file changed
+28 -8
+28 -8
View File
@@ -26,6 +26,23 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
def default_supplies(self):
return dict(self.DEFAULT_SUPPLIES)
@staticmethod
def _item_label(item_id):
name = items.ITEM_NAMES.get(item_id, 'unknown_item')
return '{}:{}'.format(name, item_id)
@classmethod
def _item_group_label(cls, item_ids):
labels = [cls._item_label(item_id) for item_id in sorted(
item_ids, key=lambda item_id: (
items.ITEM_NAMES.get(item_id, 'unknown_item'), item_id))]
return '({})'.format(', '.join(labels))
@classmethod
def _stack_label(cls, stack):
return '{} x{}'.format(
cls._item_label(stack.item_id), stack.item_count)
def idle(self):
return None
@@ -163,7 +180,7 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
return False
item = self.g.inv[slot]
print('Dropping lesser-priority stack to make pickup room:',
item.item_id, item.item_count, 'from slot', slot)
self._stack_label(item), 'from slot', slot)
if not self.g.game.drop_inventory_slot(slot, whole_stack=True):
return False
self.pending_drop_slot = slot
@@ -189,7 +206,7 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
missing = []
for item_ids, limits in self.supplies.items():
minimum, maximum = limits
print('Checking items:', item_ids)
print('Checking items:', self._item_group_label(item_ids))
num_items = self.g.game.count_items(item_ids)
print('Have:', num_items)
@@ -264,7 +281,7 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
self.checked_ground_items.add(obj.entity_id)
continue
print('Going to ground item', obj.item_id, target)
print('Going to ground item', self._item_label(obj.item_id), target)
self.g.path = navpath
self.state = self.going_to_ground_item
return
@@ -491,7 +508,7 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
self._remember_empty_supply_groups()
for item_ids, limits in self.supplies.items():
minimum_items, maximum_stacks = limits
print('Checking items:', item_ids)
print('Checking items:', self._item_group_label(item_ids))
num_items = self.g.game.count_items(item_ids)
print('Have:', num_items)
@@ -577,8 +594,10 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
self.state = self.cleanup
return
window_slot = w.container_slots + main_slot - 9
print('Moving lesser-priority stack from inventory slot',
main_slot, 'through hotbar slot', transit_slot)
print('Moving lesser-priority stack',
self._stack_label(self.g.inv[main_slot]),
'from inventory slot', main_slot,
'through hotbar slot', transit_slot)
self.g.item_lock = True
if self.g.game.swap_container_slot_with_hotbar(
window_slot, transit_slot):
@@ -592,7 +611,8 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
self.g.look_at = None
self.state = self.cleanup
return
print('Swapping', slot, 'for hotbar slot', inventory_slot)
print('Swapping', self._stack_label(slot),
'for hotbar slot', inventory_slot)
self.g.item_lock = True
if self.g.game.swap_container_slot_with_hotbar(
slot_num, inventory_slot):
@@ -602,7 +622,7 @@ class GrabSuppliesStates(WorkBoundaryReturnMixin):
return
self.count += 1
print('Moving', slot)
print('Moving', self._stack_label(slot))
self.g.item_lock = True
self.g.game.click_window(slot_num, 0, 1, slot)
return