Example #1
0
 def _showAward(self, ctx):
     data = ctx[1].data
     goodies = data.get('goodies', {})
     for boosterID in goodies:
         booster = g_goodiesCache.getBooster(boosterID)
         if booster is not None:
             shared_events.showBoosterAward(booster)
 def __init__(self, boosterID, balance):
     super(BuyBoosterMeta, self).__init__('buyConfirmation', scope=ScopeTemplates.LOBBY_SUB_SCOPE)
     self.__booster = g_goodiesCache.getBooster(boosterID)
     self.__balance = balance
     self._eManager = EventManager()
     self.onInvalidate = Event(self._eManager)
     g_clientUpdateManager.addCallbacks({'stats': self.__onStatsChanged})
Example #3
0
 def _showAward(self, ctx):
     battleResult = ctx[1].data
     battleResult = next(battleResult.itervalues())
     goodies = battleResult.get('goodies', {})
     for boosterID in goodies:
         booster = g_goodiesCache.getBooster(boosterID)
         if booster is not None:
             shared_events.showBoosterAward(booster)
Example #4
0
 def __init__(self, boosterID, balance):
     super(BuyBoosterMeta,
           self).__init__('buyConfirmation',
                          scope=ScopeTemplates.LOBBY_SUB_SCOPE)
     self.__booster = g_goodiesCache.getBooster(boosterID)
     self.__balance = balance
     self._eManager = EventManager()
     self.onInvalidate = Event(self._eManager)
     g_clientUpdateManager.addCallbacks({'stats': self.__onStatsChanged})
 def getSlotTooltipBody(self, slotIdx):
     boosterID = self._slotsMap.get(int(slotIdx), None)
     if boosterID == _EMPTY_BOOSTER_ID:
         tooltip = ''
     elif boosterID in (ADD_BOOSTER_ID, _ADD_AVAILABLE_BOOSTER_ID):
         body = TOOLTIPS.BOOSTERSPANEL_OPENBOOSTERSWINDOW_BODY
         tooltip = makeTooltip(None, body)
     else:
         booster = g_goodiesCache.getBooster(int(boosterID))
         tooltip = makeTooltip(i18n.makeString(MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_HEADER, boosterName=booster.userName, quality=booster.qualityStr), booster.description, i18n.makeString(TOOLTIPS.BOOSTERSPANEL_BOOSTERDESCRIPTION_NOTE, time=booster.getUsageLeftTimeStr()))
     return tooltip
Example #6
0
 def doAction(self, boosterID, questID):
     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)
     return
Example #7
0
 def doAction(self, boosterID, questID):
     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)
     return
Example #8
0
    def _makeResultItem(self, strBoosterID):
        try:
            if strBoosterID.isdigit():
                boosterID = int(strBoosterID)
            else:
                _, boosterIdPart = strBoosterID.split('_')
                boosterID = int(boosterIdPart)
            return g_goodiesCache.getBooster(boosterID)
        except Exception:
            LOG_CURRENT_EXCEPTION()

        return None
Example #9
0
    def _makeResultItem(self, strBoosterID):
        try:
            if strBoosterID.isdigit():
                boosterID = int(strBoosterID)
            else:
                _, boosterIdPart = strBoosterID.split('_')
                boosterID = int(boosterIdPart)
            return g_goodiesCache.getBooster(boosterID)
        except Exception:
            LOG_CURRENT_EXCEPTION()

        return None
Example #10
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:
         quests_events.showEventsWindow(questID, constants.EVENT_TYPE.BATTLE_QUEST)
Example #11
0
 def getSlotTooltipBody(self, slotIdx):
     boosterID = self._slotsMap.get(int(slotIdx), None)
     tooltip = ''
     if boosterID in (ADD_BOOSTER_ID, _ADD_AVAILABLE_BOOSTER_ID):
         if not self._isPanelInactive:
             body = TOOLTIPS.BOOSTERSPANEL_OPENBOOSTERSWINDOW_BODY
             tooltip = makeTooltip(None, body)
     else:
         booster = g_goodiesCache.getBooster(int(boosterID))
         tooltip = makeTooltip(
             i18n.makeString(
                 MENU.BOOSTERSWINDOW_BOOSTERSTABLERENDERER_HEADER,
                 boosterName=booster.userName,
                 quality=booster.qualityStr), booster.description,
             i18n.makeString(TOOLTIPS.BOOSTERSPANEL_BOOSTERDESCRIPTION_NOTE,
                             time=booster.getUsageLeftTimeStr()))
     return tooltip
Example #12
0
 def doAction(self, boosterID, questID):
     booster = g_goodiesCache.getBooster(boosterID)
     if booster:
         yield DialogsInterface.showDialog(BuyBoosterMeta(boosterID, self.__balance))
Example #13
0
 def buildItem(self, boosterID):
     return g_goodiesCache.getBooster(boosterID)
Example #14
0
 def buildItem(self, boosterID):
     return g_goodiesCache.getBooster(boosterID)
Example #15
0
 def doAction(self, boosterID, questID):
     booster = g_goodiesCache.getBooster(boosterID)
     if booster:
         yield DialogsInterface.showDialog(
             BuyBoosterMeta(boosterID, self.__balance))
Example #16
0
 def onBoosterActionBtnClick(self, boosterID, questID):
     if self._isReceivedBoostersTab:
         booster = g_goodiesCache.getBooster(boosterID)
         self.__activateBoosterRequest(booster)
     else:
         quests_events.showEventsWindow(questID, constants.EVENT_TYPE.BATTLE_QUEST)