예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
 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)
예제 #6
0
파일: npcshop.py 프로젝트: evennia/ainneve
 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)