Ejemplo n.º 1
0
 def updateStrongholdStatistics(self):
     if not isStrongholdsEnabled():
         yield lambda callback: callback(True)
         return
     self.__strongholdStats = yield self.__clanDossier.requestStrongholdStatistics()
     if self.__updateCallback:
         self.__updateCallback(self.getStatsVO())
def _addStrongholdsBattleType(items, isInRoaming):
    visible = isStrongholdsEnabled()
    items.append((_DisabledSelectorItem if isInRoaming else _StrongholdsItem)(
        backport.text(_R_BATTLE_TYPES.strongholds()),
        PREBATTLE_ACTION_NAME.STRONGHOLDS_BATTLES_LIST,
        4,
        SELECTOR_BATTLE_TYPES.SORTIE,
        isVisible=visible))
def _addStrongholdsBattleType(items, lobbyContext=None):
    settings = lobbyContext.getServerSettings()
    isInRoaming = settings.roaming.isInRoaming()
    visible = isStrongholdsEnabled()
    items.append((_DisabledSelectorItem if isInRoaming else _StrongholdsItem)(
        backport.text(_R_BATTLE_TYPES.strongholds()),
        PREBATTLE_ACTION_NAME.STRONGHOLDS_BATTLES_LIST,
        4,
        SELECTOR_BATTLE_TYPES.SORTIE,
        isVisible=visible))
 def __checkSwitch(self):
     entity = self.prbEntity
     flags = entity.getFunctionalFlags()
     entityActive = flags & FUNCTIONAL_FLAG.STRONGHOLD > 0
     unitActive = flags & FUNCTIONAL_FLAG.UNIT > 0 and entityActive
     switched = unitActive is not self.__unitActive
     if switched:
         isStrongholdsDisabled = not isStrongholdsEnabled()
         if isStrongholdsDisabled and self.__unitActive:
             self.__showPopupDlg()
     self.__entityActive = entityActive
     self.__unitActive = unitActive
Ejemplo n.º 5
0
 def _updateStrongholdsSelector(self, emblem=None):
     strongholdEnabled = isStrongholdsEnabled()
     if strongholdEnabled:
         tooltip = TOOLTIPS.HEADER_BUTTONS_FORTS
     else:
         tooltip = TOOLTIPS.HEADER_BUTTONS_FORTS_TURNEDOFF
     return {
         'label': MENU.HEADERBUTTONS_STRONGHOLD,
         'value': FORTIFICATION_ALIASES.STRONGHOLD_VIEW_ALIAS,
         'tooltip': tooltip,
         'icon': emblem,
         'enabled': strongholdEnabled
     }
Ejemplo n.º 6
0
 def setClanDossier(self, clanDossier):
     super(ClanProfileSummaryView, self).setClanDossier(clanDossier)
     self._showWaiting()
     clanInfo = yield clanDossier.requestClanInfo()
     if not clanInfo.isValid():
         self._dummyMustBeShown = True
         self._updateDummy()
         self._hideWaiting()
         return
     ratings = yield clanDossier.requestClanRatings()
     globalMapStats = yield clanDossier.requestGlobalMapStats()
     if self.isDisposed():
         return
     self._updateClanInfo(clanInfo)
     ratingStrBuilder = text_styles.builder(delimiter='\n')
     ratingStrBuilder.addStyledText(
         text_styles.promoTitle,
         formatField(getter=ratings.getEfficiency,
                     formatter=backport.getIntegralFormat))
     ratingStrBuilder.addStyledText(text_styles.stats,
                                    CLANS.CLANPROFILE_SUMMARYVIEW_TOTALRAGE)
     motto = clanInfo.getMotto()
     if motto:
         description = text_styles.main(motto)
     else:
         description = text_styles.standard(
             CLANS.CLANPROFILE_SUMMARYVIEW_DEFAULTCLANDESCR)
     hasGlobalMap = globalMapStats.hasGlobalMap(
     ) and self._isGlobalMapEnabled
     self.as_setDataS({
         'totalRating': ratingStrBuilder.render(),
         'totalRatingTooltip':
         CLANS.CLANPROFILE_SUMMARYVIEW_TOOLTIP_TOTALRATING,
         'clanDescription': description,
         'isShowFortBtn': True,
         'isShowClanNavBtn': hasGlobalMap,
         'isShowUrlString': not hasGlobalMap,
         'isDetailLinkEnabled': self._isGlobalMapEnabled
     })
     self.as_updateGeneralBlockS(
         self.__makeGeneralBlock(clanInfo, syncUserInfo=True))
     self.as_updateGlobalMapBlockS(
         self.__makeGlobalMapBlock(globalMapStats, ratings))
     self.__updateStatus()
     if isStrongholdsEnabled():
         self.__strongholdStatsVOReceiver = StrongholdDataReceiver(
             clanDossier, self.__updateStrongholdBlock)
         self.__strongholdStatsVOReceiver.updateStrongholdStatistics()
     else:
         self._hideWaiting()
 def setClanDossier(self, clanDossier):
     if not isStrongholdsEnabled():
         self._dummyMustBeShown = True
         self._updateDummy()
         self._hideWaiting()
         yield lambda callback: callback(None)
         return
     super(ClanProfileStrongholdsView, self).setClanDossier(clanDossier)
     self._showWaiting()
     url = getStrongholdClanCardUrl(clanDossier.getDbID())
     self.__browserId = yield self.browserCtrl.load(url=url, useBrowserWindow=False, showBrowserCallback=self.__showBrowser, browserSize=self.__size)
     browser = self.browserCtrl.getBrowser(self.__browserId)
     if browser:
         browser.ignoreKeyEvents = True
     self._hideWaiting()
Ejemplo n.º 8
0
 def _update(self, state):
     self._isSelected = state.isInUnit(PREBATTLE_TYPE.EXTERNAL)
     if isStrongholdsEnabled() or self._isSelected:
         self._isDisabled = state.hasLockedState
     else:
         self._isDisabled = True
Ejemplo n.º 9
0
 def canKeepMode(self):
     if not isStrongholdsEnabled():
         return False
     return super(StrongholdEntity, self).canKeepMode()