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)
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
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
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)
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()
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()
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())