def selectTask(self, questID): quest = events_helpers.getPotapovQuestsCache().getQuests()[questID] if quest.needToGetReward(): result = yield events_helpers.getPotapovQuestAward(quest) else: result = yield events_helpers.getPotapovQuestsSelectProcessor()(quest, events_helpers.getPotapovQuestsCache()).request() if result and len(result.userMsg): SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
def selectTask(self, questID): quest = events_helpers.getPotapovQuestsCache().getQuests()[questID] if quest.needToGetReward(): result = yield events_helpers.getPotapovQuestAward(quest) else: result = yield events_helpers.getPotapovQuestsSelectProcessor()( quest, events_helpers.getPotapovQuestsCache()).request() if result and len(result.userMsg): SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
def __setData(self): tabID = self.__questsType awards = [] cache = events_helpers.getPotapovQuestsCache(tabID) for tile in cache.getTiles().itervalues(): extraAward = self.__packFemaleTankmanAward() basicAward = self.__packBasicAward(tile) userName = tile.getUserName() awards.append({ 'title': text_styles.highTitle( _ms(QUESTS.SEASONAWARDSWINDOW_TILEAWARDSTITLE, name=userName)), 'background': RES_ICONS.MAPS_ICONS_QUESTS_AWARDS_BACKGROUND, 'basicAward': basicAward, 'extraAward': extraAward }) self.as_setDataS({ 'windowTitle': _ms(QUESTS.SEASONAWARDSWINDOW_TITLE), 'visibleTabs': self._contentTabs.isVisible(), 'awards': awards })
def __makeQuestDetailsInfo(self, questID): quest = events_helpers.getPotapovQuestsCache().getQuests()[questID] questInfoData = events_helpers.getEventInfoData(quest) self._navInfo.selectPotapovQuest(self.__tile.getID(), questID) vehMinLevel, vehClasses = quest.getVehMinLevel(), quest.getVehicleClasses() if vehMinLevel > 1: reqsHeader = text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS)) if quest.getQuestBranch() == PQ_BRANCH.REGULAR: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_TEXT, level=int2roman(vehMinLevel), vehType=', '.join([ Vehicle.getTypeShortUserName(vc) for vc in vehClasses ])) elif vehMinLevel < 10: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_MORE8LVL) else: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_ONLY10LVL) else: reqsHeader = reqs = '' condition = makeHtmlString('html_templates:lobby/quests/potapov', 'questDetails', ctx={'mainCondHeader': text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)), 'mainCond': quest.getUserMainCondition(), 'addCondHeader': text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)), 'addCond': quest.getUserAddCondition(), 'requirementsHeader': reqsHeader, 'requirements': reqs, 'adviseHeader': text_styles.middleTitle(_ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)), 'advise': quest.getUserAdvice(), 'descr': quest.getUserDescription()}) if not quest.isUnlocked(): btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, enabled=False, descr=text_styles.error(icons.notAvailableRed() + ' ' + _ms(self._lockedMessageStrKey))) elif quest.needToGetReward(): btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD)) elif quest.isInProgress(): btnInfo = _makeRefuseBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS)) elif quest.isFullCompleted(): btnInfo = _makeNoBtn(text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE))) elif quest.isMainCompleted(): btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT, text_styles.success(icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE))) else: btnInfo = _makeSelectBtn(QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE)) mainAwards, addAwards = questInfoData._getBonuses(events_helpers.getPotapovQuestsCache().getQuests().values()) result = {'taskID': questID, 'headerText': text_styles.highTitle(quest.getUserName()), 'conditionsText': condition, 'mainAwards': mainAwards, 'addAwards': addAwards} result.update(btnInfo._asdict()) return result
def __init__(self): super(_QuestsTileChainsView, self).__init__() self._navInfo = caches.getNavInfo() self.__proxy = None self.__tile = events_helpers.getPotapovQuestsCache().getTiles()[self._navInfo.selectedPQ.tileID] self._tasksProgressLinkage = None self._tooltipType = None self._showVehicleFilter = True self._lockedMessageStrKey = None return
def __init__(self): super(_QuestsTileChainsView, self).__init__() self._navInfo = caches.getNavInfo() self.__proxy = None self.__tile = events_helpers.getPotapovQuestsCache().getTiles()[ self._navInfo.selectedPQ.tileID] self._tasksProgressLinkage = None self._tooltipType = None self._showVehicleFilter = True self._lockedMessageStrKey = None return
def __setData(self): tabID = self.__questsType awards = [] cache = events_helpers.getPotapovQuestsCache(tabID) for tile in cache.getTiles().itervalues(): extraAward = self.__packFemaleTankmanAward() basicAward = self.__packBasicAward(tile) userName = tile.getUserName() awards.append({'title': text_styles.highTitle(_ms(QUESTS.SEASONAWARDSWINDOW_TILEAWARDSTITLE, name=userName)), 'background': RES_ICONS.MAPS_ICONS_QUESTS_AWARDS_BACKGROUND, 'basicAward': basicAward, 'extraAward': extraAward}) self.as_setDataS({'windowTitle': _ms(QUESTS.SEASONAWARDSWINDOW_TITLE), 'awards': awards})
def __makeQuestDetailsInfo(self, questID): quest = events_helpers.getPotapovQuestsCache().getQuests()[questID] questInfoData = events_helpers.getEventInfoData(quest) self._navInfo.selectPotapovQuest(self.__tile.getID(), questID) vehMinLevel, vehClasses = quest.getVehMinLevel( ), quest.getVehicleClasses() if vehMinLevel > 1: reqsHeader = text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS)) if quest.getQuestBranch() == PQ_BRANCH.REGULAR: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_TEXT, level=int2roman(vehMinLevel), vehType=', '.join([ Vehicle.getTypeShortUserName(vc) for vc in vehClasses ])) elif vehMinLevel < 10: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_MORE8LVL) else: reqs = _ms(QUESTS.QUESTTASKDETAILSVIEW_REQUIREMENTS_ONLY10LVL) else: reqsHeader = reqs = '' condition = makeHtmlString( 'html_templates:lobby/quests/potapov', 'questDetails', ctx={ 'mainCondHeader': text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_MAINCONDITIONS)), 'mainCond': quest.getUserMainCondition(), 'addCondHeader': text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_ADDITIONALCONDITIONS)), 'addCond': quest.getUserAddCondition(), 'requirementsHeader': reqsHeader, 'requirements': reqs, 'adviseHeader': text_styles.middleTitle( _ms(QUESTS.QUESTTASKDETAILSVIEW_DESCRIPTION)), 'advise': quest.getUserAdvice(), 'descr': quest.getUserDescription() }) if not quest.isUnlocked(): btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, enabled=False, descr=text_styles.error(icons.notAvailableRed() + ' ' + _ms(self._lockedMessageStrKey))) elif quest.needToGetReward(): btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_TAKEAWARD, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_RECEIVETHEAWARD, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_TAKEAWARD)) elif quest.isInProgress(): btnInfo = _makeRefuseBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_CANCEL, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_ABORT, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_INPROGRESS)) elif quest.isFullCompleted(): btnInfo = _makeNoBtn( text_styles.success(icons.checkmark() + _ms( QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_EXCELLENTDONE)) ) elif quest.isMainCompleted(): btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_REPEAT, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_REPEAT, text_styles.success( icons.checkmark() + _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_DONE))) else: btnInfo = _makeSelectBtn( QUESTS.QUESTTASKDETAILSVIEW_BTNLABEL_BEGIN, TOOLTIPS.PRIVATEQUESTS_ACTIONPANNEL_PERFORM, _ms(QUESTS.QUESTTASKDETAILSVIEW_TASKDESCRIPTION_AVAILABLE)) mainAwards, addAwards = questInfoData._getBonuses( events_helpers.getPotapovQuestsCache().getQuests().values()) result = { 'taskID': questID, 'headerText': text_styles.highTitle(quest.getUserName()), 'conditionsText': condition, 'mainAwards': mainAwards, 'addAwards': addAwards } result.update(btnInfo._asdict()) return result
def refuseTask(self, questID): result = yield events_helpers.getPotapovQuestsRefuseProcessor()( events_helpers.getPotapovQuestsCache().getQuests()[questID], events_helpers.getPotapovQuestsCache()).request() if len(result.userMsg): SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
def buildItem(self, tileID): return events_helpers.getPotapovQuestsCache().getTiles().get(tileID)
def refuseTask(self, questID): result = yield events_helpers.getPotapovQuestsRefuseProcessor()(events_helpers.getPotapovQuestsCache().getQuests()[questID], events_helpers.getPotapovQuestsCache()).request() if len(result.userMsg): SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
def _getQuestsCache(): return events_helpers.getPotapovQuestsCache()