Exemplo n.º 1
0
 def updateVehicleCustomization(self, itemID=None):
     space = g_hangarSpace.space
     if space is not None and g_currentVehicle.isInHangar():
         VehicleCustomizationModel.updateVehicleSticker(
             "inscription", itemID, self.getRealPosition(), self._rentalPackageDP.selectedPackage.get("periodDays")
         )
         space.updateVehicleSticker(VehicleCustomizationModel.getVehicleModel())
Exemplo n.º 2
0
 def updateVehicleCustomization(self, itemID=None):
     space = g_hangarSpace.space
     if space is not None and g_currentVehicle.isInHangar():
         VehicleCustomizationModel.updateVehicleSticker(
             'inscription', itemID, self.getRealPosition(),
             self._rentalPackageDP.selectedPackage.get('periodDays'))
         space.updateVehicleSticker(
             VehicleCustomizationModel.getVehicleModel())
Exemplo n.º 3
0
    def _populate(self):
        BigWorld.player().resyncDossiers()
        self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, True))
        View._populate(self)
        credits, gold = g_itemsCache.items.stats.money
        self.as_setCreditsS(credits)
        self.as_setGoldS(gold)
        g_playerEvents.onDossiersResync += self.__pe_onDossiersResync
        g_clientUpdateManager.addCallbacks({
            'stats.gold':
            self.onGoldUpdate,
            'stats.credits':
            self.onCreditsUpdate,
            'cache.mayConsumeWalletResources':
            self.onGoldUpdate,
            'account.attrs':
            self.onCameraUpdate,
            'inventory.1.compDescr':
            self.onVehiclesUpdate,
            'cache.vehsLock':
            self.__cv_onChanged
        })
        g_itemsCache.onSyncCompleted += self.__pe_onShopResync
        game_control.g_instance.igr.onIgrTypeChanged += self.__onIGRTypeChanged
        g_currentVehicle.onChanged += self.__cv_onChanged
        g_hangarSpace.onSpaceCreate += self.__hs_onSpaceCreate
        g_eventsCache.onSyncCompleted += self.__onEventsCacheSyncCompleted
        vehDescr = None
        vehType = None
        if g_currentVehicle.isPresent():
            vehDescr = CustomizationHelper.getUpdatedDescriptor(
                g_currentVehicle.item.descriptor)
            vehType = vehDescr.type
            VehicleCustomizationModel.setVehicleDescriptor(vehDescr)
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        for customization in _VEHICLE_CUSTOMIZATIONS:
            sectionName = customization['sectionName']
            interface = customization['interface'](
                sectionName, vehDescr.type.customizationNationID,
                customization['type'], customization['position'])
            interface.onDataInited += self.__ci_onDataInited
            interface.onCustomizationChangeSuccess += self.__ci_onCustomizationChangeSuccess
            interface.onCustomizationChangeFailed += self.__ci_onCustomizationChangeFailed
            interface.onCustomizationDropSuccess += self.__ci_onCustomizationDropSuccess
            interface.onCustomizationDropFailed += self.__ci_onCustomizationDropFailed
            interface.onCurrentItemChange += self.__ci_onCurrentItemChanged
            self.__interfaces[sectionName] = interface
            interface.updateSlotsPosition(vehDescr)
            interface.setFlashObject(self.flashObject, setScript=False)
            interface.fetchCurrentItem(vehDescr)
            interface.invalidateViewData(vehType)

        if not self.__steps:
            self.__finishInitData()
        self.setupContextHints(TUTORIAL.CUSTOMIZATION)
        return
    def __onIGRTypeChanged(self, roomType, xpFactor):
        LOG_DEBUG('__onIGRTypeChanged', roomType, xpFactor)
        if not g_currentVehicle.isPresent():
            return
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        vehType = vehicles.g_cache.vehicle(*g_currentVehicle.item.descriptor.type.id)
        vehDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
        VehicleCustomizationModel.resetVehicleDescriptor(vehDescr)
        for interface in self.__interfaces.itervalues():
            interface.update(CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor))
            interface.refreshViewData(vehType, refresh=True)

        self.as_refreshDataS()
        self.as_onResetNewItemS()
        self.__isIgrChanged = True
    def _populate(self):
        BigWorld.player().resyncDossiers()
        self.fireEvent(LobbySimpleEvent(LobbySimpleEvent.HIDE_HANGAR, True))
        View._populate(self)
        credits, gold = g_itemsCache.items.stats.money
        self.as_setCreditsS(credits)
        self.as_setGoldS(gold)
        g_playerEvents.onDossiersResync += self.__pe_onDossiersResync
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onGoldUpdate,
         'stats.credits': self.onCreditsUpdate,
         'cache.mayConsumeWalletResources': self.onGoldUpdate,
         'account.attrs': self.onCameraUpdate,
         'inventory.1.compDescr': self.onVehiclesUpdate,
         'cache.vehsLock': self.__cv_onChanged})
        g_itemsCache.onSyncCompleted += self.__pe_onShopResync
        game_control.g_instance.igr.onIgrTypeChanged += self.__onIGRTypeChanged
        g_currentVehicle.onChanged += self.__cv_onChanged
        g_hangarSpace.onSpaceCreate += self.__hs_onSpaceCreate
        g_eventsCache.onSyncCompleted += self.__onEventsCacheSyncCompleted
        vehDescr = None
        vehType = None
        if g_currentVehicle.isPresent():
            vehDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
            vehType = vehDescr.type
            VehicleCustomizationModel.setVehicleDescriptor(vehDescr)
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        for customization in _VEHICLE_CUSTOMIZATIONS:
            sectionName = customization['sectionName']
            interface = customization['interface'](sectionName, vehDescr.type.customizationNationID, customization['type'], customization['position'])
            interface.onDataInited += self.__ci_onDataInited
            interface.onCustomizationChangeSuccess += self.__ci_onCustomizationChangeSuccess
            interface.onCustomizationChangeFailed += self.__ci_onCustomizationChangeFailed
            interface.onCustomizationDropSuccess += self.__ci_onCustomizationDropSuccess
            interface.onCustomizationDropFailed += self.__ci_onCustomizationDropFailed
            interface.onCurrentItemChange += self.__ci_onCurrentItemChanged
            self.__interfaces[sectionName] = interface
            interface.updateSlotsPosition(vehDescr)
            interface.setFlashObject(self.flashObject, setScript=False)
            interface.fetchCurrentItem(vehDescr)
            interface.invalidateViewData(vehType)

        if not self.__steps:
            self.__finishInitData()
        self.setupContextHints(TUTORIAL.CUSTOMIZATION)
        return
Exemplo n.º 6
0
    def _populate(self):
        View._populate(self)
        credits, gold = g_itemsCache.items.stats.money
        self.as_setCreditsS(credits)
        self.as_setGoldS(gold)
        g_clientUpdateManager.addCallbacks({
            'stats.gold':
            self.onGoldUpdate,
            'stats.credits':
            self.onCreditsUpdate,
            'cache.mayConsumeWalletResources':
            self.onGoldUpdate,
            'account.attrs':
            self.onCameraUpdate,
            'inventory.1.compDescr':
            self.onVehiclesUpdate
        })
        g_playerEvents.onShopResync += self.__pe_onShopResync
        g_currentVehicle.onChanged += self.__cv_onChanged
        vehDescr = None
        vehType = None
        if g_currentVehicle.isPresent():
            vehDescr = g_currentVehicle.item.descriptor
            vehType = vehDescr.type
            VehicleCustomizationModel.setVehicleDescriptor(vehDescr)
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        for customization in _VEHICLE_CUSTOMIZATIONS:
            sectionName = customization['sectionName']
            interface = customization['interface'](
                sectionName, vehDescr.type.customizationNationID,
                customization['position'])
            interface.onDataInited += self.__ci_onDataInited
            interface.onCustomizationChangeSuccess += self.__ci_onCustomizationChangeSuccess
            interface.onCustomizationChangeFailed += self.__ci_onCustomizationChangeFailed
            interface.onCustomizationDropSuccess += self.__ci_onCustomizationDropSuccess
            interface.onCustomizationDropFailed += self.__ci_onCustomizationDropFailed
            interface.onCurrentItemChange += self.__ci_onCurrentItemChanged
            self.__interfaces[sectionName] = interface
            interface.setFlashObject(self.flashObject, setScript=False)
            interface.fetchCurrentItem(vehDescr)
            interface.invalidateViewData(vehType)

        if not self.__steps:
            self.__finishInitData()
        return
Exemplo n.º 7
0
    def __onIGRTypeChanged(self, roomType, xpFactor):
        LOG_DEBUG('__onIGRTypeChanged', roomType, xpFactor)
        if not g_currentVehicle.isPresent():
            return
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        vehType = vehicles.g_cache.vehicle(
            *g_currentVehicle.item.descriptor.type.id)
        vehDescr = CustomizationHelper.getUpdatedDescriptor(
            g_currentVehicle.item.descriptor)
        VehicleCustomizationModel.resetVehicleDescriptor(vehDescr)
        for interface in self.__interfaces.itervalues():
            interface.update(
                CustomizationHelper.getUpdatedDescriptor(
                    g_currentVehicle.item.descriptor))
            interface.refreshViewData(vehType, refresh=True)

        self.as_refreshDataS()
        self.as_onResetNewItemS()
        self.__isIgrChanged = True
    def _populate(self):
        View._populate(self)
        credits, gold = g_itemsCache.items.stats.money
        self.as_setCreditsS(credits)
        self.as_setGoldS(gold)
        g_clientUpdateManager.addCallbacks({'stats.gold': self.onGoldUpdate,
         'stats.credits': self.onCreditsUpdate,
         'cache.mayConsumeWalletResources': self.onGoldUpdate,
         'account.attrs': self.onCameraUpdate,
         'inventory.1.compDescr': self.onVehiclesUpdate})
        g_playerEvents.onShopResync += self.__pe_onShopResync
        g_currentVehicle.onChanged += self.__cv_onChanged
        vehDescr = None
        vehType = None
        if g_currentVehicle.isPresent():
            vehDescr = g_currentVehicle.item.descriptor
            vehType = vehDescr.type
            VehicleCustomizationModel.setVehicleDescriptor(vehDescr)
        self.__steps = len(_VEHICLE_CUSTOMIZATIONS)
        for customization in _VEHICLE_CUSTOMIZATIONS:
            sectionName = customization['sectionName']
            interface = customization['interface'](sectionName, vehDescr.type.customizationNationID, customization['position'])
            interface.onDataInited += self.__ci_onDataInited
            interface.onCustomizationChangeSuccess += self.__ci_onCustomizationChangeSuccess
            interface.onCustomizationChangeFailed += self.__ci_onCustomizationChangeFailed
            interface.onCustomizationDropSuccess += self.__ci_onCustomizationDropSuccess
            interface.onCustomizationDropFailed += self.__ci_onCustomizationDropFailed
            interface.onCurrentItemChange += self.__ci_onCurrentItemChanged
            self.__interfaces[sectionName] = interface
            interface.setFlashObject(self.flashObject, setScript=False)
            interface.fetchCurrentItem(vehDescr)
            interface.invalidateViewData(vehType)

        if not self.__steps:
            self.__finishInitData()
        return
Exemplo n.º 9
0
    def _constructInscription(self, itemID, groups, inscriptions, isCurrent = False, isInHangar = False, withoutCheck = True):
        itemInfo = None
        inscription = inscriptions.get(itemID, None)
        priceFactors = g_itemsCache.items.shop.getInscriptionsGroupPriceFactors(self.nationID)
        defPriceFactors = g_itemsCache.items.shop.defaults.getInscriptionsGroupPriceFactors(self.nationID)
        hiddens = g_itemsCache.items.shop.getInscriptionsGroupHiddens(self.nationID)
        if inscription is not None:
            groupName, igrType, texture, bumpMap, inscriptionUserString, isFeatured = inscription[0:6]
            inscriptionIDs, groupUserString, igrType, allow, deny = groups.get(groupName)
            isNewItem = self.isNewID(itemID)
            if withoutCheck or isNewItem or isInHangar or groupName not in hiddens:
                price = self._makeCost(self._cost, self._vehPriceFactor, priceFactors.get(groupName)) if not isInHangar else 0
                defaultPrice = self._makeCost(self._defCost, self._defVehPriceFactor, defPriceFactors.get(groupName, 1)) if not isInHangar else 0
                action = None
                if price != defaultPrice:
                    isPremium = self._isGold == 1
                    newPrice = (0, price) if isPremium else (price, 0)
                    oldPrice = (0, defaultPrice) if isPremium else (defaultPrice, 0)
                    state = (None, ACTION_TOOLTIPS_STATE.DISCOUNT) if isPremium else (ACTION_TOOLTIPS_STATE.DISCOUNT, None)
                    key = 'inscriptionPacket7Cost'
                    if self._period == 0:
                        key = 'inscriptionPacketInfCost'
                    elif self._period == 30:
                        key = 'inscriptionPacket30Cost'
                    action = {'type': ACTION_TOOLTIPS_TYPE.ECONOMICS,
                     'key': key,
                     'isBuying': True,
                     'state': state,
                     'newPrice': newPrice,
                     'oldPrice': oldPrice}
                timeLeftStr = ''
                days = 0
                isPermanent = False
                value = 0
                timeLeft = 0 if self._isGold else self._period * 86400
                canUse = True
                if isInHangar:
                    item = CustomizationHelper.getItemFromHangar(CUSTOMIZATION_ITEM_TYPE.INSCRIPTION_TYPE, itemID, self.nationID, self.position)
                    if item:
                        isPermanent = item.get('isPermanent')
                        value = item.get('quantity')
                        timeLeft = value * 86400 if not item.get('isPermanent') else 0
                        timeLeftStr = CustomizationHelper.getTimeLeftText(timeLeft)
                        if not isPermanent:
                            _, selectedInscriptions = VehicleCustomizationModel.getVehicleModel()
                            for selectedInscription in selectedInscriptions:
                                if selectedInscriptions.index(selectedInscription) != self.position and selectedInscription[0] == itemID:
                                    canUse = False

                if isCurrent:
                    updatedDescr = CustomizationHelper.getUpdatedDescriptor(g_currentVehicle.item.descriptor)
                    item = updatedDescr.playerInscriptions[self.position]
                    _, startTime, days, _ = item
                    if days:
                        timeLeft = startTime + days * 86400 - time.time()
                    timeLeftStr = CustomizationHelper.getTimeLeftText(timeLeft)
                itemInfo = {'id': itemID,
                 'texturePath': self._makeSmallTextureUrl(texture, None, None),
                 'description': self._makeDescription(groupUserString, inscriptionUserString),
                 'igrType': igrType,
                 'price': {'cost': price,
                           'isGold': days == 0 if isCurrent else self._isGold == 1},
                 'action': action,
                 'current': isCurrent,
                 'position': self.position,
                 'isInHangar': isInHangar,
                 'isFeatured': isFeatured,
                 'isNew': isNewItem,
                 'timeLeftStr': timeLeftStr,
                 'type': CUSTOMIZATION_ITEM_TYPE.INSCRIPTION,
                 'nationId': self.nationID,
                 'isSpecialTooltip': True,
                 'timeLeftValue': timeLeft,
                 'isPermanent': isPermanent,
                 'value': value,
                 'canUse': canUse}
        return itemInfo