def sell_price(self, gold, copper, silver): price = price_in_copper(gold, silver, copper) cha = int(self.get('attributes/cha', 1)) price = (price / 2) + ((price / 100) * cha) money = convert_money(price) return (int(money['gold']), int(money['silver']), int(money['copper']))
def spend_money(self, gold=0, silver=0, copper=0): ihave = price_in_copper(*self.money_tuple()) price = price_in_copper(gold, silver, copper) remains = ihave - price if remains < 0: return False else: self.put('inventory/money', convert_money(remains)) return True
def gain_money(self, gold=0, silver=0, copper=0): total_gained = price_in_copper(gold, silver, copper) my_total = price_in_copper(*self.money_tuple()) my_total += total_gained self.put('inventory/money', convert_money(my_total))