Exemplo n.º 1
0
 def onBoosterActionBtnClick(self, boosterID, questID):
     if self.__isReceivedBoostersTab:
         booster = g_goodiesCache.getBooster(boosterID)
         activeBooster = self.__getActiveBoosterByType(booster.boosterType)
         if activeBooster is not None:
             canActivate = yield DialogsInterface.showDialog(
                 I18nConfirmDialogMeta(
                     BOOSTER_CONSTANTS.BOOSTER_ACTIVATION_CONFORMATION_TEXT_KEY,
                     messageCtx={
                         "newBoosterName": text_styles.middleTitle(booster.description),
                         "curBoosterName": text_styles.middleTitle(activeBooster.description),
                     },
                     focusedID=DIALOG_BUTTON_ID.CLOSE,
                 )
             )
         else:
             canActivate = True
         if canActivate:
             self.__activateBoosterRequest(booster)
     else:
         if questID and questID.isdigit():
             questID = int(questID)
         quest = g_eventsCache.getAllQuests(includePotapovQuests=True).get(questID)
         if quest is not None:
             quests_events.showEventsWindow(quest.getID(), quest.getType())
         elif self.__questsDescriptor and self.__questsDescriptor.getChapter(questID):
             quests_events.showEventsWindow(questID, constants.EVENT_TYPE.TUTORIAL)
     return
Exemplo n.º 2
0
    def _showAward(self, ctx):
        goodies = ctx[1].data.get('goodies', {})
        for boosterID in goodies:
            booster = g_goodiesCache.getBooster(boosterID)
            if booster is not None:
                shared_events.showBoosterAward(booster)

        return
Exemplo n.º 3
0
    def _showAward(self, ctx):
        goodies = ctx[1].data.get('goodies', {})
        for boosterID in goodies:
            booster = g_goodiesCache.getBooster(boosterID)
            if booster is not None and booster.enabled:
                shared_events.showBoosterAward(booster)

        return
Exemplo n.º 4
0
 def _packBlocks(self, boosterID, *args, **kwargs):
     items = super(BoosterTooltipData, self)._packBlocks(*args, **kwargs)
     booster = g_goodiesCache.getBooster(boosterID)
     questsResult = self.__getBoosterQuestNames(boosterID)
     items.append(formatters.packBuildUpBlockData([formatters.packTitleDescBlock(text_styles.highTitle(booster.fullUserName), desc=text_styles.main(booster.description)), formatters.packImageBlockData(img=booster.bigTooltipIcon, align=BLOCKS_TOOLTIP_TYPES.ALIGN_CENTER, width=180, height=180, padding={'top': -14,
       'bottom': -14})]))
     items.append(self.__packDueDate(booster))
     if len(questsResult):
         qNames = '"%s"' % ', '.join(questsResult)
         items.append(self.__packAccessCondition(qNames))
     if booster.inCooldown:
         items.append(self.__packActiveState(booster.getUsageLeftTimeStr()))
     return items