mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 20:47:17 +02:00
Re-added description and changed formatting per Griatch's request.
This commit is contained in:
parent
8b37bd7acf
commit
496d6f4353
1 changed files with 8 additions and 7 deletions
|
|
@ -78,7 +78,7 @@ from django.conf import settings
|
|||
|
||||
from evennia import DefaultCharacter, DefaultObject, default_cmds
|
||||
from evennia.commands.default.muxcommand import MuxCommand
|
||||
from evennia.utils import at_search_result, evtable, inherits_from, iter_to_str
|
||||
from evennia.utils import at_search_result, evtable, inherits_from, iter_to_str, int2str
|
||||
|
||||
# Options start here.
|
||||
# Maximum character length of 'wear style' strings, or None for unlimited.
|
||||
|
|
@ -658,18 +658,19 @@ 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
|
||||
|
||||
names_and_descs = [(obj.get_display_name(self.caller), obj.get_display_desc(self.caller))
|
||||
for obj in set(carried)]
|
||||
carried_sums = {tup: names_and_descs.count(tup) for tup in set(names_and_descs)}
|
||||
|
||||
worn = [obj for obj in items if obj.db.worn]
|
||||
|
||||
message_list.append("|wYou are carrying:|n")
|
||||
for key, value in carried_sums.items():
|
||||
for (name, desc), count in carried_sums.items():
|
||||
carry_table.add_row(
|
||||
f"({value})" if value > 1 else "", key
|
||||
f"{int2str(count)} {name}", desc
|
||||
)
|
||||
|
||||
if carry_table.nrows == 0:
|
||||
carry_table.add_row("Nothing.", "")
|
||||
message_list.append(str(carry_table))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue