def _isEnoughMoney(cls, price, money):
     if not price.isDefined():
         return (False, GUI_ITEM_ECONOMY_CODE.ITEM_NO_PRICE)
     shortage = money.getShortage(price)
     if shortage:
         currency = shortage.getCurrency(byWeight=True)
         return (False, GUI_ITEM_ECONOMY_CODE.getCurrencyError(currency))
     return (True, GUI_ITEM_ECONOMY_CODE.UNDEFINED)
def getMoneyVOWithReason(errorMsg, moneyObj):
    result = []
    for c, v in moneyObj.iteritems():
        if errorMsg == GUI_ITEM_ECONOMY_CODE.getCurrencyError(c):
            result.append(('%sError' % c, v))
        result.append((c, v))

    return tuple(result)
Example #3
0
    def _isEnoughMoney(cls, prices, money):
        shortage = MONEY_UNDEFINED
        for itemPrice in prices:
            need = money.getShortage(itemPrice.price)
            if need:
                shortage += need
            return (True, GUI_ITEM_ECONOMY_CODE.UNDEFINED)

        if shortage:
            currency = shortage.getCurrency(byWeight=True)
            return (False, GUI_ITEM_ECONOMY_CODE.getCurrencyError(currency))
        return (False, GUI_ITEM_ECONOMY_CODE.ITEM_NO_PRICE)