def purchase_item(session): """Process item purchase.""" try: # this will raise exception if caller doesn't # have enough funds in their `db.wallet` print(item) transfer_funds(char, None, item_value) ware = spawn(item).pop() ware.move_to(char, quiet=True) ware.at_get(char) rtext = f"You pay {as_price(ware.db.value)} and purchase {ware.key}" except InsufficientFunds: rtext = f"You do not have enough money to buy {item_key}." session.msg(rtext)
def purchase_item(session): """Process item purchase.""" try: # this will raise exception if caller doesn't # have enough funds in their `db.wallet` transfer_funds(char, None, item['value']) ware = spawn(item).pop() ware.move_to(char, quiet=True) ware.at_get(char) rtext = "You pay {} and purchase {}".format( as_price(ware.db.value), ware.key) except InsufficientFunds: rtext = "You do not have enough money to buy {}.".format( item['key']) session.msg(rtext)
def at_object_receive(self, obj, source_location): if utils.inherits_from( obj, "typeclasses.characters.Character") and self.tags.get( "item", category='chargen'): spawn({ "prototype": "DAGGER", "location": self }, { "prototype": "SIMPLE_ROBE", "location": self }) if utils.inherits_from( obj, "typeclasses.characters.Character") and self.tags.get( "coins", category='chargen'): transfer_funds(obj, 1000)
def purchase_item(caller): """Process item purchase.""" try: # this will raise exception if # caller doesn't have enough funds if ware.location == caller.location.db.storeroom and ware.db.value: transfer_funds(caller, None, ware.db.value) ware.move_to(caller, quiet=True) ware.at_get(caller) rtext = "You pay {} and purchase {}".format( as_price(ware.db.value), ware.key) else: rtext = "{} is no longer available.".format( ware.key.capitalize()) except InsufficientFunds: rtext = "You do not have enough money to buy {}.".format(ware.key) caller.msg(rtext)
def purchase_item(s): """Process item purchase.""" try: # this will raise exception if caller doesn't # have enough funds in their `db.wallet` transfer_funds(char, None, item['value']) ware = spawn(item).pop() ware.move_to(char, quiet=True) ware.at_get(char) rtext = "You pay {} and purchase {}".format( as_price(ware.db.value), ware.key ) except InsufficientFunds: rtext = "You do not have enough money to buy {}.".format( item['key']) s.msg(rtext)
def purchase_item(caller): """Process item purchase.""" try: # this will raise exception if # caller doesn't have enough funds if ware.location == caller.location.db.storeroom and ware.db.value: transfer_funds(caller, None, ware.db.value) ware.move_to(caller, quiet=True) ware.at_get(caller) rtext = "You pay {} and purchase {}".format( as_price(ware.db.value), ware.key ) else: rtext = "{} is no longer available.".format( ware.key.capitalize()) except InsufficientFunds: rtext = "You do not have enough money to buy {}.".format( ware.key) caller.msg(rtext)