Exemplo n.º 1
0
    def _applyItems(self, purchaseItems, isModeChanged, callback):
        results = []
        vehicleCD = g_currentVehicle.item.descriptor.makeCompactDescr()
        modifiedOutfits = {season:outfit.copy() for season, outfit in self._modifiedOutfits.iteritems()}
        originalOutfits = self._ctx.startMode.getOriginalOutfits()
        removeUnselectedItemsFromEditableStyle(modifiedOutfits, self.__baseOutfits, purchaseItems)
        requestData = []
        for season in SeasonType.COMMON_SEASONS:
            outfit = modifiedOutfits[season]
            baseOutfit = self.__baseOutfits[season]
            if outfit.vehicleCD != baseOutfit.vehicleCD or not outfit.isEqual(baseOutfit):
                diff = getEditableStyleOutfitDiff(outfit, baseOutfit)
                outfit = self.__style.getOutfit(season, vehicleCD=vehicleCD, diff=diff)
                requestData.append((outfit, season))

        if not requestData:
            emptyComponent = CustomizationOutfit()
            outfit = self._modifiedOutfits[self.season]
            emptyComponent.styleId = outfit.id
            outfit = Outfit(component=emptyComponent)
            requestData.append((outfit, SeasonType.ALL))
        result = yield OutfitApplier(g_currentVehicle.item, requestData).request()
        results.append(result)
        if self.isInited:
            self._events.onItemsBought(originalOutfits, purchaseItems, results)
        callback(self)
Exemplo n.º 2
0
    def pack(self):
        component = CustomizationOutfit()
        for container in self._containers.itervalues():
            container.pack(component)

        component.styleId = self._id
        return component
Exemplo n.º 3
0
    def pack(self):
        component = CustomizationOutfit()
        for container in self._containers.itervalues():
            container.pack(component)

        component.styleId = self._id
        component.styleProgressionLevel = self.__styleProgressionLevel
        component.serial_number = self.__styleSerialNumber
        return component
Exemplo n.º 4
0
    def pack(self):
        """ Pack the current outfit into a component.
        """
        component = CustomizationOutfit()
        for container in self._containers.itervalues():
            container.pack(component)

        component.styleId = self._id
        return component
Exemplo n.º 5
0
 def _request(self, callback):
     _logger.debug(
         'Make server request to put on outfit on vehicle %s, season %s',
         self.vehicle.invID, self.season)
     component = self.outfit.pack()
     if self.season == SeasonType.ALL:
         component = CustomizationOutfit()
         component.styleId = self.outfit.id
     elif component.styleId and isEditedStyle(component):
         intCD = makeIntCompactDescrByID('customizationItem',
                                         CustomizationType.STYLE,
                                         component.styleId)
         style = self.itemsCache.items.getItemByCD(intCD)
         baseComponent = style.getOutfit(
             self.season, self.vehicle.descriptor.makeCompactDescr())
         component = component.getDiff(baseComponent.pack())
     BigWorld.player().shop.buyAndEquipOutfit(
         self.vehicle.invID, self.season, component.makeCompDescr(),
         lambda code: self._response(code, callback))