예제 #1
0
    def __onGetItemsFromShop(self, itemTypeID, itemTypeIDs, resultID, data, _):
        if resultID < RES_SUCCESS:
            LOG_ERROR('Server return error shop %s items request: responseCode=' % ITEM_TYPE_NAMES[itemTypeID], resultID)
            data = {}
        parser = ShopDataParser(data)
        for intCD, price, _, _ in parser.getItemsIterator(self._data.getNationID(), itemTypeID):
            self._data.setShopPrice(intCD, price)

        self.__requestNextIShopItems(itemTypeIDs)
예제 #2
0
    def getItems(self, itemTypeID = None, criteria = REQ_CRITERIA.EMPTY):
        from gui.shared.utils.requesters import ShopDataParser
        shopParser = ShopDataParser(self.shop.getItemsData())
        result = ItemsCollection()
        for intCD, _, _, _ in shopParser.getItemsIterator(itemTypeID=itemTypeID):
            item = self.getItemByCD(intCD)
            if criteria(item):
                result[intCD] = item

        return result
예제 #3
0
    def getItems(self, itemTypeID=None, criteria=REQ_CRITERIA.EMPTY):
        from gui.shared.utils.requesters import ShopDataParser
        shopParser = ShopDataParser(self.shop.getItemsData())
        result = ItemsCollection()
        for intCD, _, _, _ in shopParser.getItemsIterator(
                itemTypeID=itemTypeID):
            item = self.getItemByCD(intCD)
            if criteria(item):
                result[intCD] = item

        return result
예제 #4
0
    def __onGetItemsFromShop(self, itemTypeID, itemTypeIDs, resultID, data, _):
        if resultID < RES_SUCCESS:
            LOG_ERROR(
                'Server return error shop %s items request: responseCode=' %
                ITEM_TYPE_NAMES[itemTypeID], resultID)
            data = {}
        parser = ShopDataParser(data)
        for intCD, price, _, _ in parser.getItemsIterator(
                self._data.getNationID(), itemTypeID):
            self._data.setShopPrice(intCD, price)

        self.__requestNextIShopItems(itemTypeIDs)
예제 #5
0
    def __onGetVehiclesFromShop(self, resultID, data, _):
        if resultID < RES_SUCCESS:
            LOG_ERROR('Server return error shop vehicles request: responseCode=' % resultID)
            data = {}
        parser = ShopDataParser(data)
        setShopPrice = self._data.setShopPrice
        addHidden = self._data.addHidden
        for intCD, price, isHidden, _ in parser.getItemsIterator(itemTypeID=_VEHICLE):
            setShopPrice(intCD, price)
            if isHidden:
                addHidden(intCD)

        self.__stopDataCollect()
예제 #6
0
    def __onGetVehiclesFromShop(self, resultID, data, _):
        if resultID < RES_SUCCESS:
            LOG_ERROR(
                'Server return error shop vehicles request: responseCode=' %
                resultID)
            data = {}
        parser = ShopDataParser(data)
        setShopPrice = self._data.setShopPrice
        addHidden = self._data.addHidden
        for intCD, price, isHidden, _ in parser.getItemsIterator(
                itemTypeID=_VEHICLE):
            setShopPrice(intCD, price)
            if isHidden:
                addHidden(intCD)

        self.__stopDataCollect()
예제 #7
0
 def __cb_onShopItemsReceived(self, resultID, data, _):
     self._gui.hideWaiting('request-shop')
     if resultID < 0:
         LOG_ERROR('Server return error shop %s items request:', resultID,
                   data)
         data = ({}, set([]))
     self._itemPrice = ShopDataParser(data).getPrice(self.getVar())
     self.toggle(isOn=self.isOn())