def setInvVehicles(self, data): vCDs = data.get(INV_ITEM_VCDESC_KEY, {}) vTypeName = ITEM_TYPE_NAMES[_VEHICLE] result = set() for invID, vStrCD in vCDs.iteritems(): if vStrCD is None or not len(vStrCD): vIntCD = self._data.removeInvItem(invID=invID) else: vType = vehicles.getVehicleType(vStrCD) vIntCD = vehicles.makeIntCompactDescrByID(vTypeName, vType.id[0], vType.id[1]) self._data.setInvItem(vIntCD, custom_items._makeInventoryVehicle(invID, vStrCD, data)) if vIntCD > 0: result.add(vIntCD) return (result, False)
def setInvVehicles(self, data): vCDs = data.get(INV_ITEM_VCDESC_KEY, {}) vTypeName = ITEM_TYPE_NAMES[_VEHICLE] result = set() for invID, vStrCD in vCDs.iteritems(): if vStrCD is None or not len(vStrCD): vIntCD = self._data.removeInvItem(invID=invID) else: vType = vehicles.getVehicleType(vStrCD) vIntCD = vehicles.makeIntCompactDescrByID( vTypeName, vType.id[0], vType.id[1]) self._data.setInvItem( vIntCD, custom_items._makeInventoryVehicle(invID, vStrCD, data)) if vIntCD > 0: result.add(vIntCD) return (result, False)
def setInvVehicles(self, data): vData = data.get(INV_ITEM_VCDESC_KEY, {}) currentID = self._data.getNationID() rootCD = self._data.getRootCD() rootItem = self._data.getInvItem(rootCD) inventory = set() fullUpdate = False if not len(vData): invIDs = custom_items._findVehItemsToChange(data) mapping = self._data.getInvMapping() for invID in invIDs: if invID in mapping: vIntCD = mapping[invID] custom_items._changeInventoryVehicle( invID, self._data.getInvItem(vIntCD), data) inventory.add(vIntCD) if vIntCD == rootCD: fullUpdate = True return (inventory, fullUpdate) else: for invID, vStrCD in vData.iteritems(): if vStrCD is None or not len(vStrCD): vIntCD = self._data.removeInvItem(invID=invID) if vIntCD == rootCD: rootItem = None item = None else: vType = vehicles.getVehicleType(vStrCD) nationID, itemID = vType.id if nationID != currentID: continue vIntCD = vehicles.makeIntCompactDescrByID( _VEHICLE_TYPE_NAME, nationID, itemID) item = custom_items._makeInventoryVehicle( invID, vStrCD, data) self._data.setInvItem(vIntCD, item) if vIntCD > 0: inventory.add(vIntCD) if vIntCD == rootCD: fullUpdate = rootItem is None or item is not None and rootItem.repairCost != item.repairCost return (inventory, fullUpdate)
def setInvVehicles(self, data): vData = data.get(INV_ITEM_VCDESC_KEY, {}) currentID = self._data.getNationID() rootCD = self._data.getRootCD() rootItem = self._data.getInvItem(rootCD) inventory = set() fullUpdate = False if not len(vData): invIDs = custom_items._findVehItemsToChange(data) mapping = self._data.getInvMapping() for invID in invIDs: if invID in mapping: vIntCD = mapping[invID] custom_items._changeInventoryVehicle(invID, self._data.getInvItem(vIntCD), data) inventory.add(vIntCD) if vIntCD == rootCD: fullUpdate = True return (inventory, fullUpdate) else: for invID, vStrCD in vData.iteritems(): if vStrCD is None or not len(vStrCD): vIntCD = self._data.removeInvItem(invID=invID) if vIntCD == rootCD: rootItem = None item = None else: vType = vehicles.getVehicleType(vStrCD) nationID, itemID = vType.id if nationID != currentID: continue vIntCD = vehicles.makeIntCompactDescrByID(_VEHICLE_TYPE_NAME, nationID, itemID) item = custom_items._makeInventoryVehicle(invID, vStrCD, data) self._data.setInvItem(vIntCD, item) if vIntCD > 0: inventory.add(vIntCD) if vIntCD == rootCD: fullUpdate = rootItem is None or item is not None and rootItem.repairCost != item.repairCost return (inventory, fullUpdate)