def buyQuestItems(self): """ Attempts to buy all quest items, returns result Returns bool - True if successful, otherwise False """ for item in self.items: us = UserShopFront(self.usr, item.owner, item.id, str(item.price)) us.loadInventory() if not item.name in us.inventory: return False if not us.inventory[item.name].buy(): return False return True
def shop(self, index): """ Return's the user shop the indexed item is in Parameters: index (int) -- The item index Returns UserShopFront - User shop item is in """ return UserShopFront(self.usr, item.owner, item.id, str(item.price))
def buy(self, index): """ Attempts to buy indexed item, returns result Parameters: index (int) -- The item index Returns bool - True if item was bought, false otherwise """ item = self.items[index] us = UserShopFront(self.usr, item.owner, item.id, str(item.price)) us.load() if not item.name in us.inventory: return False if not us.inventory[item.name].buy(): return False return True