def render_item_cell(self, item_id, locale): item = items_manager.get_item(item_id, locale) required = item.required_stats.get_required(locale) bonus = item.bonus_stats.get_bonus(locale) classes = item.classes.get_class_names(locale) return self.render_string("item_cell.html", item=item, group_name=items_manager.get_item_group_name(item.type, self.locale), required=", ".join("{0} {1}".format(stat_name, str(required[stat_name])) for stat_name in required.keys()), bonus=", ".join("{0} {1}".format(stat_name, str(bonus[stat_name])) for stat_name in bonus.keys()), classes=", ".join(classes))
def render_item_description(self, item_id, buy_button=True): item = items_manager.get_item(item_id, self.locale) required = item.required_stats.get_required(self.locale) bonus = item.bonus_stats.get_bonus(self.locale) classes = item.classes.get_class_names(self.locale) can_buy = False if buy_button: can_buy = (self.users_manager.online_users[self.current_user].character.gold >= item.price) return self.render_string("item_description.html", item=item, group_name=items_manager.get_item_group_name(item.type, self.locale), buy_button=buy_button, can_buy=can_buy, required=", ".join("{0} {1}".format(stat_name, str(required[stat_name])) for stat_name in required.keys()), bonus=", ".join("{0} {1}".format(stat_name, str(bonus[stat_name])) for stat_name in bonus.keys()), classes=", ".join(classes))