mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Added stacking to clothing contrib's inventory command.
This commit is contained in:
parent
9f1d14bae2
commit
8b37bd7acf
1 changed files with 7 additions and 2 deletions
|
|
@ -658,12 +658,17 @@ class CmdInventory(MuxCommand):
|
|||
wear_table = evtable.EvTable(border="header")
|
||||
|
||||
carried = [obj for obj in items if not obj.db.worn]
|
||||
# Build and populate a dict for tallying items
|
||||
carried_sums = {obj.get_display_name(): 0 for obj in set(carried)}
|
||||
for obj in carried:
|
||||
carried_sums[obj.get_display_name()] += 1
|
||||
|
||||
worn = [obj for obj in items if obj.db.worn]
|
||||
|
||||
message_list.append("|wYou are carrying:|n")
|
||||
for item in carried:
|
||||
for key, value in carried_sums.items():
|
||||
carry_table.add_row(
|
||||
item.get_display_name(self.caller), item.get_display_desc(self.caller)
|
||||
f"({value})" if value > 1 else "", key
|
||||
)
|
||||
if carry_table.nrows == 0:
|
||||
carry_table.add_row("Nothing.", "")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue