def func(self): from world.economy import format_coin # make sure the char has a wallet if not hasattr(self.caller.db, "wallet"): self.caller.msg("You don't have a wallet.") return self.caller.msg('You are carrying {}'.format( format_coin(self.caller.db.wallet)))
def func(self): from world.economy import format_coin # make sure the char has a wallet if not hasattr(self.caller.db, "wallet"): self.caller.msg("You don't have a wallet.") return self.caller.msg('You are carrying {}'.format( format_coin(self.caller.db.wallet) ))
def display(self, item): # display the value of the item data = "" if item.attributes.has('value'): data += "Value: {0}\n".format(format_coin(item.db.value)) if item.attributes.has('weight'): data += "Weight: {0}\n".format(item.db.weight) if item.attributes.has('damage'): data += "|rDamage: {:>2d}|n \n".format(item.db.damage) if item.attributes.has('range'): data += "|GRange: {:>2d}|n \n".format(item.db.range) if item.attributes.has('toughness'): data += "|yToughness: {:>2d}|n".format(item.db.toughness) self.caller.msg(data)
def return_appearance(self, looker): """ This formats a description. It is the hook a 'look' command should call. Args: looker (Object): Object doing the looking. """ if not looker: return # get and identify all objects visible = (con for con in self.contents if con != looker and con.access(looker, "view")) # identify wares that have been assigned a value exits, users, things, wares = [], [], [], [] for con in visible: key = con.get_display_name(looker, pose=True) if con.destination: exits.append(key) elif con.has_account: users.append(key) elif con.db.value: wares.append(con) else: things.append(key) # get description, build string string = "|c%s|n\n" % self.get_display_name(looker, pose=True) desc = self.db.desc if desc: string += "%s" % desc if exits: string += "\n|wExits:|n " + ", ".join(exits) if users: string += "\n" + "\n".join(users) for ware in wares: string += "\n|y{thing} |n({price})".format( thing=ware.get_display_name(looker), price=format_coin(ware.db.value) ) if things: string += "\n" + "\n".join(things) return string
def return_appearance(self, looker): """ This formats a description. It is the hook a 'look' command should call. Args: looker (Object): Object doing the looking. """ if not looker: return # get and identify all objects visible = (con for con in self.contents if con != looker and con.access(looker, "view")) # identify wares that have been assigned a value exits, users, things, wares = [], [], [], [] for con in visible: key = con.get_display_name(looker, pose=True) if con.destination: exits.append(key) elif con.has_account: users.append(key) elif con.db.value: wares.append(con) else: things.append(key) # get description, build string string = "|c%s|n\n" % self.get_display_name(looker, pose=True) desc = self.db.desc if desc: string += "%s" % desc if exits: string += "\n|wExits:|n " + ", ".join(exits) if users: string += "\n" + "\n".join(users) for ware in wares: string += "\n|y{thing} |n({price})".format( thing=ware.get_display_name(looker), price=format_coin(ware.db.value)) if things: string += "\n" + "\n".join(things) return string