Esempio n. 1
0
 def submit(self, gold, exchangedCredits, callback=None):
     """
     Submit exchange operation, send request to exchange and call callback after response received
     :param gold: <int> gold value
     :param exchangedCredits: <int> credits value to exchange
     :param callback: <function>
     """
     result = yield GoldToCreditsExchanger(gold).request()
     if callback is not None:
         callback(result)
     return
 def submit(self, gold, valueToExchange, callback=None):
     result = yield GoldToCreditsExchanger(gold).request()
     if callback is not None:
         callback(result)
     return
Esempio n. 3
0
 def submit(self, gold, exchangedCredits, callback=None):
     result = yield GoldToCreditsExchanger(gold).request()
     if callback is not None:
         callback(result)
Esempio n. 4
0
 def exchange(self, gold):
     result = yield GoldToCreditsExchanger(gold).request()
     if result and len(result.userMsg):
         SystemMessages.pushI18nMessage(result.userMsg,
                                        type=result.sysMsgType)
         self.onWindowClose()
Esempio n. 5
0
from gui.shared.gui_items.processors.goodies import BoosterBuyer
from gui.shared.gui_items.processors.module import ModuleBuyer
from gui.shared.gui_items.processors.vehicle import VehicleBuyer, showVehicleReceivedResultMessages
from gui.shared.money import Currency
from helpers import dependency
from helpers.time_utils import timestampToISO
from skeletons.gui.game_control import ITradeInController
from skeletons.gui.goodies import IGoodiesCache
from skeletons.gui.shared import IItemsCache
from soft_exception import SoftException
from web.web_client_api import Field, W2CSchema, w2c
from web.web_client_api.common import ShopItemType
_ItemBuySpec = namedtuple('ItemBuySpec', ('type', 'id', 'count'))
_EXCHANGER = {
    Currency.GOLD:
    lambda value: GoldToCreditsExchanger(value, withConfirm=False)
}


def parseItemsSpec(specList):
    specList = specList or tuple()
    fields = {'type', 'id', 'count'}
    if not all((set(spec).issubset(fields) for spec in specList)):
        raise SoftException('invalid item buy spec')
    for spec in specList:
        if not ShopItemType.hasValue(spec['type']):
            raise SoftException('unsupported item type "{}"'.format(
                spec['type']))

    return [
        _ItemBuySpec(spec['type'], spec['id'], spec['count'])
 def submit(self, fromItemCount, toItemCount, withConfirm=True, callback=None):
     result = yield GoldToCreditsExchanger(fromItemCount, withConfirm=withConfirm).request()
     if callback is not None:
         callback(result)
     return