Ejemplo n.º 1
0
    def getNationTreeData(self, nationName):
        data = super(BCTechTree,
                     self).getNationTreeData(NATION_NAMES[g_bootcamp.nation])
        dataNodes = data.get('nodes', None)
        nationData = g_bootcamp.getNationData()
        if dataNodes is not None:
            dataNodes = [
                node for node in dataNodes
                if not NODE_STATE.isPremium(node['state'])
            ]
            for node in dataNodes:
                if 'vehCompareTreeNodeData' in node:
                    node['vehCompareTreeNodeData']['modeAvailable'] = False
                nodeState = node['state']
                if not NODE_STATE.inInventory(nodeState):
                    isUnlocked = NODE_STATE.isUnlocked(nodeState)
                    isVehicleSecond = node['id'] == nationData[
                        'vehicle_second']
                    if not (isVehicleSecond and isUnlocked):
                        node['state'] = NODE_STATE_FLAGS.LOCKED
                    if isUnlocked:
                        node['state'] |= NODE_STATE_FLAGS.PURCHASE_DISABLED
                    if isVehicleSecond:
                        node['state'] |= NODE_STATE_FLAGS.NEXT_2_UNLOCK
                    if NODE_STATE.isAnnouncement(nodeState):
                        node['state'] |= NODE_STATE_FLAGS.ANNOUNCEMENT
                        node['state'] |= NODE_STATE_FLAGS.NOT_CLICKABLE

            data['nodes'] = dataNodes
        return data
 def onBackClick(self):
     if self._backAlias == VIEW_ALIAS.LOBBY_RESEARCH and self.__isSecondVehicle(
     ):
         firstVehicleCD = g_bootcamp.getNationData()['vehicle_first']
         event_dispatcher.showResearchView(firstVehicleCD)
     else:
         super(BCVehiclePreview, self).onBackClick()
Ejemplo n.º 3
0
 def _makeMeta(self):
     item = self.itemsCache.items.getItemByCD(self._unlockCtx.itemCD)
     bcNationData = g_bootcamp.getNationData()
     if item.intCD == bcNationData['vehicle_second']:
         dialogData = self.__getVehicleData(bcNationData, item)
     else:
         dialogData = self.__getVehicleComponentData(item)
     return dialogs.BCConfirmDialogMeta(dialogData)
 def request4Buy(self, itemCD):
     nationData = g_bootcamp.getNationData()
     if nationData['module'] == itemCD:
         super(BCResearch, self).request4Buy(itemCD)
     elif nationData['vehicle_second'] == itemCD:
         shared_events.showOldVehiclePreview(int(itemCD), self.alias)
     else:
         super(BCResearch, self).request4Buy(itemCD)
 def request4Unlock(self, unlockCD, vehCD, unlockIdx, xpCost):
     nationData = g_bootcamp.getNationData()
     if nationData['module'] == unlockCD:
         super(BCResearch, self).request4Unlock(unlockCD, vehCD, unlockIdx, xpCost)
     elif nationData['vehicle_second'] == unlockCD:
         shared_events.showOldVehiclePreview(int(unlockCD), self.alias)
     else:
         super(BCResearch, self).request4Unlock(unlockCD, vehCD, unlockIdx, xpCost)
 def __init__(self, dumper):
     super(BCResearchItemsData, self).__init__(dumper)
     lessonNum = g_bootcamp.getLessonNum()
     self.__overrideResearch = lessonNum < g_bootcamp.getContextIntParameter('researchFreeLesson')
     self.__secondVehicleResearch = lessonNum < g_bootcamp.getContextIntParameter('researchSecondVehicleLesson')
     nationData = g_bootcamp.getNationData()
     self.__firstVehicleNode = nationData['vehicle_first']
     self.__secondVehicleNode = nationData['vehicle_second']
     self.__moduleNodeCD = nationData['module']
 def goToNextVehicle(self, vehCD):
     if not g_bootcamp.isResearchFreeLesson():
         nationData = g_bootcamp.getNationData()
         if nationData['vehicle_second'] == vehCD:
             vehicle = self.itemsCache.items.getItemByCD(int(vehCD))
             if vehicle.isInInventory:
                 shared_events.showResearchView(vehCD)
                 return
         if nationData['vehicle_first'] == vehCD:
             shared_events.showResearchView(vehCD)
     else:
         shared_events.showResearchView(vehCD)
 def goToNextVehicle(self, vehCD):
     if not g_bootcamp.isResearchFreeLesson():
         nationData = g_bootcamp.getNationData()
         vehicle = self._itemsCache.items.getItemByCD(int(vehCD))
         exitEvent = events.LoadViewEvent(VIEW_ALIAS.LOBBY_TECHTREE, ctx={'nation': vehicle.nationName})
         if nationData['vehicle_second'] == vehCD:
             if vehicle.isInInventory:
                 shared_events.showResearchView(vehCD, exitEvent=exitEvent)
                 return
         if nationData['vehicle_first'] == vehCD:
             shared_events.showResearchView(vehCD, exitEvent=exitEvent)
     else:
         shared_events.showResearchView(vehCD)
    def _buildList(self):
        defaultModules = super(_BootCampLogicProvider, self)._buildList()
        if self._slotType != FITTING_TYPES.OPTIONAL_DEVICE:
            return defaultModules
        else:
            nationData = g_bootcamp.getNationData()
            optionalDeviceId = nationData['equipment']
            optionalDeviceValue = None
            for device in defaultModules:
                if device['id'] == optionalDeviceId:
                    optionalDeviceValue = device

            if optionalDeviceValue is not None:
                defaultModules.remove(optionalDeviceValue)
                defaultModules.insert(0, optionalDeviceValue)
            scrollCountOptionalDevices = g_bootcamp.getContextIntParameter('scrollCountOptionalDevices')
            del defaultModules[scrollCountOptionalDevices:]
            return defaultModules
 def __isSecondVehicle(self):
     nationData = g_bootcamp.getNationData()
     return nationData['vehicle_second'] == self._vehicleCD
Ejemplo n.º 11
0
 def nationData(self):
     return g_bootcamp.getNationData()
Ejemplo n.º 12
0
 def goToNextVehicle(self, vehCD):
     nationData = g_bootcamp.getNationData()
     super(BCResearch, self).goToNextVehicle(vehCD)
     if vehCD not in (nationData.get('vehicle_first'),
                      nationData.get('vehicle_second')):
         self.exitFromResearch()