def start(self, clanCache): if self.isStarted(): LOG_WARNING('Fort provider already is ready') return else: self.__initial |= FORT_PROVIDER_INITIAL_FLAGS.STARTED self.__clan = weakref.proxy(clanCache) self.__listeners = _ClientFortListeners() self.__keeper = FortSubscriptionKeeper() self.__keeper.onAutoUnsubscribed += self.__onAutoUnsubscribed fortMgr = getClientFortMgr() if fortMgr: fortMgr.onFortResponseReceived += self.__onFortResponseReceived fortMgr.onFortUpdateReceived += self.__onFortUpdateReceived fortMgr.onFortStateChanged += self.__onFortStateChanged else: LOG_ERROR('Fort manager is not found') g_lobbyContext.getServerSettings().onServerSettingsChange += self.__onServerSettingChanged g_playerEvents.onCenterIsLongDisconnected += self.__onCenterIsLongDisconnected self.__controller = controls.createInitial() self.__controller.init(self.__clan, self.__listeners) states.create(self) if not g_lobbyContext.getServerSettings().isFortsEnabled() and self.__cachedState is not None: if self.__cachedState.getStateID() not in (CLIENT_FORT_STATE.UNSUBSCRIBED, CLIENT_FORT_STATE.DISABLED): SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF, type=SystemMessages.SM_TYPE.Warning) showFortDisabledDialog() return
def sendPassword(self, value): pwdRange = xrange(CHANNEL_PWD_MIN_LENGTH, CHANNEL_PWD_MAX_LENGTH + 1) if value is None or len(unicode_from_utf8(value)[0]) not in pwdRange: SystemMessages.pushI18nMessage(MESSENGER.DIALOGS_CREATECHANNEL_ERRORS_INVALIDPASSWORD_MESSAGE, CHANNEL_PWD_MIN_LENGTH, CHANNEL_PWD_MAX_LENGTH, type=SystemMessages.SM_TYPE.Error) else: self.proto.channels.joinToChannel(self._channel.getID(), password=value) self.destroy()
def onSearchComplete(self, result): if not len(result): SystemMessages.pushI18nMessage( MESSENGER.CLIENT_INFORMATION_EMPTYSEARCHRESULT_MESSAGE, type=SystemMessages.SM_TYPE.Warning ) self.buildList(result) self.refresh()
def leave(self, ctx, callback=None): if ctx.getRequestType() != _RQ_TYPE.LEAVE: LOG_ERROR("Invalid context to leave prebattle/unit", ctx) if callback is not None: callback(False) return elif self.__requestCtx.isProcessing(): LOG_ERROR("Request is processing", self.__requestCtx) if callback is not None: callback(False) return else: ctrlType = ctx.getCtrlType() formation = self.__collection.getItem(ctx.getCtrlType()) if formation is not None: if formation.hasLockedState(): entityType = formation.getEntityType() SystemMessages.pushI18nMessage( messages.getLeaveDisabledMessage(ctrlType, entityType), type=SystemMessages.SM_TYPE.Warning ) if callback is not None: callback(False) return LOG_DEBUG("Request to leave formation", ctx) self.__requestCtx = ctx formation.leave(ctx, callback=callback) else: LOG_ERROR("Functional not found", ctx) if callback is not None: callback(False) return
def leave(self, ctx, callback = None): if ctx.getRequestType() is not REQUEST_TYPE.LEAVE: LOG_ERROR('Invalid context to leave prebattle/unit', ctx) if callback: callback(False) return elif self.__requestCtx.isProcessing(): LOG_ERROR('Request is processing', self.__requestCtx) if callback: callback(False) return else: ctrlType = ctx.getCtrlType() formation = self.__collection.getItem(ctx.getCtrlType()) if formation is not None: if formation.hasLockedState(): if ctrlType == CTRL_ENTITY_TYPE.PREQUEUE: entityType = formation.getQueueType() else: entityType = formation.getPrbType() SystemMessages.pushI18nMessage('#system_messages:{0}'.format(rally_dialog_meta.makeI18nKey(ctrlType, entityType, 'leaveDisabled')), type=SystemMessages.SM_TYPE.Warning) if callback: callback(False) return LOG_DEBUG('Request to leave formation', ctx) self.__requestCtx = ctx formation.leave(ctx, callback=callback) else: LOG_ERROR('Functional not found', ctx) if callback: callback(False) return
def request4Buy(self, itemCD): itemCD = int(itemCD) if getTypeOfCompactDescr(itemCD) == GUI_ITEM_TYPE.VEHICLE: self.buyVehicle(itemCD) else: if RequestState.inProcess('buyAndInstall'): SystemMessages.pushI18nMessage('#system_messages:shop/item/buy_and_equip_in_processing', type=SystemMessages.SM_TYPE.Warning) self.buyAndInstallItem(itemCD, 'buyAndInstall')
def showI18nMessage(self, key, *args, **kwargs): guiType = None if 'msgType' in kwargs: guiType = SystemMessages.SM_TYPE.lookup(kwargs['msgType']) if guiType is None: guiType = SystemMessages.SM_TYPE.Information kwargs['type'] = guiType SystemMessages.pushI18nMessage(key, *args, **kwargs)
def __onServerSettingChanged(self, diff): if 'isFortsEnabled' in diff: if diff['isFortsEnabled']: SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDON, priority=NotificationPriorityLevel.MEDIUM) else: SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF, type=SystemMessages.SM_TYPE.Warning) g_eventBus.handleEvent(events.FortEvent(events.FortEvent.SHOW_DISABLED_POPUP), scope=EVENT_BUS_SCOPE.FORT) self.resetState()
def __handleCreateOrJoinFortBattle(self, peripheryID, battleID, slotIndex = -1): if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndCreateOrJoinFortBattle(peripheryID, battleID, slotIndex) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToCreateOrJoinFortBattle(battleID, slotIndex)
def _showSecurityMessage(self, responseData): securityWarningType = responseData.get('security_msg') if securityWarningType is not None: securityLink = '' if not GUI_SETTINGS.isEmpty('securitySettingsURL'): securityLink = makeHtmlString('html_templates:lobby/system_messages', 'link', {'text': _ms(SYSTEM_MESSAGES.SECURITYMESSAGE_CHANGE_SETINGS), 'linkType': 'securityLink'}) SystemMessages.pushI18nMessage('#system_messages:securityMessage/%s' % securityWarningType, type=SystemMessages.SM_TYPE.Warning, link=securityLink) return
def showI18nMessage(self, key, *args, **kwargs): guiType = None if "msgType" in kwargs: guiType = SystemMessages.SM_TYPE.lookup(kwargs["msgType"]) if guiType is None: guiType = SystemMessages.SM_TYPE.Information kwargs["type"] = guiType SystemMessages.pushI18nMessage(key, *args, **kwargs) return
def __buyTankman(self, nationID, vehTypeID, role, studyType, callback): recruiter = TankmanRecruit(int(nationID), int(vehTypeID), role, int(studyType)) success, msg, msgType, tmanInvID = yield recruiter.request() tankman = None if len(msg): SystemMessages.pushI18nMessage(msg, type=msgType) if success: tankman = g_itemsCache.items.getTankman(tmanInvID) callback(tankman)
def showSecurityMessage(self): if self.__securityMsgType is not None: securityLink = '' if not GUI_SETTINGS.isEmpty('securitySettingsURL'): linkText = makeString(SYSTEM_MESSAGES.SECURITYMESSAGE_CHANGE_SETINGS) securityLink = makeHtmlString('html_templates:lobby/system_messages', 'link', {'text': linkText, 'linkType': 'securityLink'}) SystemMessages.pushI18nMessage('#system_messages:securityMessage/%s' % self.__securityMsgType, type=SystemMessages.SM_TYPE.Warning, link=securityLink) self.__securityMsgType = None
def onJoinRally(self, rallyId, slotIndex, peripheryID): ctx = JoinUnitCtx(rallyId, PREBATTLE_TYPE.SORTIE, slotIndex, waitingID='prebattle/join') if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): self.__requestToReloginAndJoinSortie(peripheryID, ctx) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: self.__requestToJoinSortie(ctx)
def __afterImageReload(self, challenge): Waiting.hide('reloadCaptcha') if challenge is not None: self.__challenge = challenge self.__setCaptchaImageSource() else: SystemMessages.pushI18nMessage('#captcha:error-codes/image-internal-error', type=SystemMessages.SM_TYPE.Error) self.controller.tryBattlesTillCaptchaReset() self._close(False)
def __onServerSettingChanged(self, diff): if 'isFortsEnabled' in diff: if diff['isFortsEnabled']: SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDON, priority=NotificationPriorityLevel.MEDIUM) else: SystemMessages.pushI18nMessage(I18N_SM.FORTIFICATION_NOTIFICATION_TURNEDOFF, type=SystemMessages.SM_TYPE.Warning) if self.__state.getStateID() != CLIENT_FORT_STATE.UNSUBSCRIBED: showFortDisabledDialog() self.resetState()
def transportRequest(self, size): if not self.getBuildDescr(False).isInCooldown(): result = yield self.fortProvider.sendRequest(TransportationCtx(self.getServerBuildId(), self.getServerBuildId(False), size, waitingID='fort/transport')) if result: fromBuild = self.fortCtrl.getFort().getBuilding(self.getServerBuildId()) toBuild = self.fortCtrl.getFort().getBuilding(self.getServerBuildId(False)) SystemMessages.g_instance.pushI18nMessage(SYSTEM_MESSAGES.FORTIFICATION_TRANSPORT, toBuilding=toBuild.userName, fromBuilding=fromBuild.userName, res=BigWorld.wg_getIntegralFormat(size), type=SystemMessages.SM_TYPE.Warning) else: SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.FORTIFICATION_ERRORS_EVENT_COOLDOWN, type=SystemMessages.SM_TYPE.Error) self.__changeStateAndDestroy()
def _selectQuest(self, questID): quests = g_eventsCache.getEvents() if questID in quests: quest = quests.get(questID) if self._isAvailableQuestForTab(quest): info = events_helpers.getEventDetails(quest, quests) self.as_setSelectedQuestS(questID) self.as_updateQuestInfoS(info) else: SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.QUESTS_NOQUESTSWITHGIVENID)
def showMessage(scopeMsg, msg, item, msgType = SystemMessages.SM_TYPE.Error, **kwargs): kwargs['userString'] = item.userName kwargs['type'] = msgType if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE: entity = 'vehicle' else: entity = 'item' kwargs['typeString'] = item.userType key = scopeMsg.format(entity, msg) SystemMessages.pushI18nMessage(key, **kwargs)
def _showInviteSentMessage(self, accountsToInvite): getUser = self.usersStorage.getUser for dbID in accountsToInvite: user = getUser(dbID) if user is not None: SystemMessages.pushI18nMessage('#system_messages:prebattle/invites/sendInvite/name', type=SystemMessages.SM_TYPE.Information, name=user.getFullName()) else: SystemMessages.pushI18nMessage('#system_messages:prebattle/invites/sendInvite', type=SystemMessages.SM_TYPE.Information) return
def requestToJoin(self, battleID): currentBattleID = getBattleID() if currentBattleID == battleID: fort_events.showFortBattleRoomWindow() else: battle = self.fortCtrl.getFort().getBattle(battleID) if battle is not None: fort_helpers.tryToConnectFortBattle(battleID, battle.getPeripheryID()) else: SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.FORTIFICATION_ERRORS_BATTLE_DOES_NOT_EXIST, type=SystemMessages.SM_TYPE.Error) return
def showSentInviteMessage(user = None): """ This method adds the invite(in squad) message to system channel. @param user: user info """ if user is not None: if user is not None: SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.PREBATTLE_INVITES_SENDINVITE_NAME, type=SystemMessages.SM_TYPE.Information, name=user.getFullName()) else: SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.PREBATTLE_INVITES_SENDINVITE, type=SystemMessages.SM_TYPE.Information) return
def onCreateRally(self): if not BigWorld.player().isLongDisconnectedFromCenter: self.__clearCache() sortiesAvailable, severAvailable = self.fortProvider.getController().getSortiesCurfewCtrl().getStatus() if not severAvailable: g_eventDispatcher.showSwitchPeripheryWindow(ctx=SwitchPeripheryFortCtx()) elif sortiesAvailable: self.fireEvent(events.LoadViewEvent(FORTIFICATION_ALIASES.FORT_CHOICE_DIVISION_WINDOW), scope=EVENT_BUS_SCOPE.LOBBY) else: LOG_ERROR('Sorties is not Available at this moment') else: SystemMessages.pushI18nMessage('#system_messages:fortification/errors/CENTER_NOT_AVAILABLE', type=SystemMessages.SM_TYPE.Error)
def tryToConnectFortBattle(battleID, peripheryID): from gui.prb_control.dispatcher import g_prbLoader yield lambda callback: callback(None) if g_lobbyContext.isAnotherPeriphery(peripheryID): if g_lobbyContext.isPeripheryAvailable(peripheryID): result = yield DialogsInterface.showDialog(UnitConfirmDialogMeta(PREBATTLE_TYPE.FORT_BATTLE, 'changePeriphery', messageCtx={'host': g_lobbyContext.getPeripheryName(peripheryID)})) if result: g_prbLoader.getPeripheriesHandler().join(peripheryID, CreateOrJoinFortBattleCtx(battleID, waitingID='fort/fortBattle/createOrJoin')) else: SystemMessages.pushI18nMessage('#system_messages:periphery/errors/isNotAvailable', type=SystemMessages.SM_TYPE.Error) else: yield g_prbLoader.getDispatcher().join(CreateOrJoinFortBattleCtx(battleID, waitingID='fort/fortBattle/createOrJoin'))
def __afterImageCreate(self, challenge): if challenge is not None: self.__challenge = challenge self.__setCaptchaImageSource() if self.__meta.hasError(): self.as_setErrorMessageS(self.__meta.getErrorText()) else: SystemMessages.pushI18nMessage('#captcha:error-codes/image-internal-error', type=SystemMessages.SM_TYPE.Error) self.controller.tryBattlesTillCaptchaReset() self._close(False) Waiting.hide('requestCaptcha') return
def _selectQuest(self, questID): motiveQuests = g_eventsCache.getMotiveQuests(filterFunc=self._filterFunc) if questID in motiveQuests or self.__questsDescriptor is not None and self.__questsDescriptor.getChapter(questID) is not None: return self.as_setSelectedQuestS(questID) else: if questID in g_eventsCache.getMotiveQuests(filterFunc=lambda q: q.isCompleted()): sortedQuests = sorted(motiveQuests.values(), key=lambda q: q.getPriority()) nextQuest = findFirst(None, sortedQuests) if nextQuest: return self.as_setSelectedQuestS(nextQuest.getID()) SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.QUESTS_NOQUESTSWITHGIVENID) return
def doAction(self, action = None, dispatcher = None): result = False if not g_currentVehicle.isLocked() and not g_currentVehicle.isBroken(): if action is not None: actionName = action.actionName if actionName in self.CREATE_PRB_BY_ACTION: from gui.prb_control.functional import createPrbEntry entry = createPrbEntry(self.CREATE_PRB_BY_ACTION[actionName]) result = entry.doAction(action, dispatcher) else: result = True SystemMessages.pushI18nMessage(MENU.HANGAR_VEHICLE_LOCKED, type=SystemMessages.SM_TYPE.Error) return result
def _validateJoinOp(self, ctx): if self.__requestCtx.isProcessing(): LOG_ERROR('Request is processing', self.__requestCtx) return False for func in self.__collection.getIterator(): if func.isPlayerJoined(ctx): LOG_DEBUG('Player already joined', ctx) func.showGUI() return False if func.hasLockedState(): SystemMessages.pushI18nMessage('#system_messages:prebattle/hasLockedState', type=SystemMessages.SM_TYPE.Warning) return False return True
def showSecurityMessage(self): if self.__securityMsgType is not None: securityLink = "" if not GUI_SETTINGS.isEmpty("securitySettingsURL"): linkText = makeString(SYSTEM_MESSAGES.SECURITYMESSAGE_CHANGE_SETINGS) securityLink = makeHtmlString( "html_templates:lobby/system_messages", "link", {"text": linkText, "linkType": "securityLink"} ) SystemMessages.pushI18nMessage( "#system_messages:securityMessage/%s" % self.__securityMsgType, type=SystemMessages.SM_TYPE.Warning, link=securityLink, ) self.__securityMsgType = None return
def applyGraphicsPresets(self, presetIndex, customSettings): newPresetKey = self.__presetsKeys[presetIndex] newPreset = {} if newPresetKey == self.CUSTOM_PRESET_KEY: newPreset = customSettings elif newPresetKey != self.selectedPresetKey: newPreset = self.__presets[newPresetKey] else: newPreset = self.__presets[self.selectedPresetKey] for key in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS_PRESETS_EXCLUDE: if customSettings.has_key(key): newPreset[key] = customSettings[key] notSetOptions = [] LOG_DEBUG("Setting preset: %s" % newPresetKey) for key in GraphicsPresets.GRAPHICS_QUALITY_SETTINGS: value = newPreset.get(key, None) if value is None: LOG_ERROR("No value for setting: %s" % key) continue try: while not self.settingIsSupported(key, value) and value < 5: value = value + 1 LOG_DEBUG("set setting %s = %d" % (key, value)) BigWorld.setGraphicsSetting(key, value) if key == "TEXTURE_QUALITY": if g_critMemHandler.originTexQuality != -1: g_critMemHandler.originTexQuality = value if key == "FLORA_QUALITY": if g_critMemHandler.originFloraQuality != -1: g_critMemHandler.originFloraQuality = value if key == "TERRAIN_QUALITY": if g_critMemHandler.originTerrainQuality != -1: g_critMemHandler.originTerrainQuality = value except: notSetOptions.append(i18n.makeString("#settings:%s" % key)) LOG_ERROR("selectGraphicsOptions: unable to set value '%s' for option '%s'" % (value, key)) if notSetOptions: if newPresetKey == self.CUSTOM_PRESET_KEY: SystemMessages.pushI18nMessage( "#system_messages:graficsOptionsFail", ", ".join(notSetOptions), type=SystemMessages.SM_TYPE.Error ) else: SystemMessages.pushI18nMessage("#system_messages:graficsPresetFail", type=SystemMessages.SM_TYPE.Error) self.__currentSetings = None self.checkCurrentPreset()
def __requestForMoneyObtain(self): equipmentBlock = self.viewModel.equipmentBlock isTradeIn = self.__tradeOffVehicle is not None and not self.__isRentVisible isWithSlot = equipmentBlock.slot.getIsSelected() isWithAmmo = equipmentBlock.ammo.getIsSelected() if self.__isWithoutCommander: crewType = self.__CREW_NOT_SELECTED_IDX else: crewType = self.__selectedCardIdx result = None if isTradeIn: confirmationType = 'tradeInConfirmation' addition = '' operations = [] if self.__tradeOffVehicle.hasCrew: operations.append('crew') if self.__tradeOffVehicle.hasShells: operations.append('shells') if self.__tradeOffVehicle.hasEquipments: operations.append('equipments') if self.__tradeOffVehicle.hasOptionalDevices: operations.append('optionalDevices') if operations: operationsStr = [ i18n.makeString('#dialogs:%s/message/%s' % (confirmationType, o)) for o in operations ] addition = i18n.makeString('#dialogs:%s/message/addition' % confirmationType, operations=', '.join(operationsStr)) ctx = { 'vehName': neutral(self.__tradeOffVehicle.userName), 'addition': addition } self.__tradeinInProgress = True result = yield showI18nConfirmDialog( confirmationType, meta=I18nConfirmDialogMeta(confirmationType, ctx, ctx), focusedID=DIALOG_BUTTON_ID.SUBMIT) if not result: return result = yield VehicleTradeInProcessor(self.__vehicle, self.__tradeOffVehicle, isWithSlot, isWithAmmo, crewType).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) self.__tradeinInProgress = False if not result.success: self.__onWindowClose() return if isWithSlot: result = yield VehicleSlotBuyer(showConfirm=False, showWarning=False).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if not result.success: return if not isTradeIn: self.__purchaseInProgress = True emtySlotAvailable = self.itemsCache.items.inventory.getFreeSlots( self.__stats.vehicleSlots) > 0 if self.__isBuying(): if self.__vehicle.isRestoreAvailable(): result = yield self.getRestoreVehicleProcessor( crewType).request() else: result = yield self.__getObtainVehicleProcessor( crewType).request() if not emtySlotAvailable and not isWithSlot: self.__playSlotAnimation() else: result = yield VehicleRenter(self.__vehicle, self.__selectedRentTerm, isWithAmmo, crewType).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) self.__purchaseInProgress = False self.__onItemCacheSyncCompleted() if result and result.success: self.__successOperation = True if self.__isRenting() or self.bootcamp.isInBootcamp(): self.__onWindowClose() else: self.__showCongratulations() return
def exchange(self, gold): result = yield GoldToCreditsExchanger(gold).request() if result and result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) self.onWindowClose()
def buyAndEquipOutfit(self, outfit, season, vehicle=None): result = yield OutfitApplier(vehicle or g_currentVehicle.item, outfit, season).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def __activateBoosterRequest(self, booster): result = yield BoosterActivator(booster).request() if len(result.userMsg): SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def addTankmanSkill(self, invengoryID, skillName): tankman = self.__getTankmanByInvID(int(invengoryID)) processor = TankmanAddSkill(tankman, skillName) result = yield processor.request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def buyAndEquipStyle(self, style, vehicle=None): result = yield StyleApplier(vehicle or g_currentVehicle.item, style).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def doAction(self): if RequestState.inProcess('install'): SystemMessages.pushI18nMessage( '#system_messages:inventory/item/equip_in_processing', type=SystemMessages.SM_TYPE.Warning) self.installItem(self._itemCD, self._rootCD, 'install')
def showError(self, value): SystemMessages.pushI18nMessage(value, type=SystemMessages.SM_TYPE.Error)
def __equipTankman(self, tankman, vehicle, slot, callback): result = yield TankmanEquip(tankman, vehicle, slot).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) callback(result.success)
def _processResult(self, result, _): if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result.success: self.destroy()
def __buyAndEquipTankman(self, vehicle, slot, studyType, callback): result = yield TankmanRecruitAndEquip(vehicle, slot, studyType).request() if len(result.userMsg): SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) callback(result.success)
def submit(self, count, currency): result = yield BoosterBuyer(self.__booster, count, currency).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def __onPrebattleInvitesStatus(dbID, name, status): if status != PREBATTLE_INVITE_STATUS.OK: statusName = PREBATTLE_INVITE_STATUS_NAMES[status] SystemMessages.pushI18nMessage(backport.text(R.strings.system_messages.invite.status.dyn(statusName)()), name=name, type=SystemMessages.SM_TYPE.Warning)
def doAction(self): if RequestState.inProcess('buyAndInstall'): SystemMessages.pushI18nMessage( '#system_messages:shop/item/buy_and_equip_in_processing', type=SystemMessages.SM_TYPE.Warning) self.buyAndInstallItem(self._itemCD, self._rootCD, 'buyAndInstall')
def buySlots(): result = yield VehicleSlotBuyer().request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def processReturnCrew(self, print_message = True): if not g_currentVehicle.isInHangar() or g_currentVehicle.isInBattle() or g_currentVehicle.isLocked() or g_currentVehicle.isCrewFull(): return result = yield TankmanReturn(g_currentVehicle.item).request() if len(result.userMsg) and print_message: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def funcWithMessage(self, *args, **kwargs): if self.isEnabled() and self.isAvailable(): return func(self, *args, **kwargs) SystemMessages.pushI18nMessage( '#system_messages:vehicleCompare/disabled', type=SM_TYPE.Error)
def _successHandler(self, code, ctx=None): messageType = MESSENGER.SERVICECHANNELMESSAGES_SYSMSG_CUSTOMIZATIONS_SELL SystemMessages.pushI18nMessage(messageType, type=SM_TYPE.Selling, **self._getMsgCtx()) return makeSuccess(auxData=ctx)
def funcWithMessage(self, *args, **kwargs): if not self.isLocked: return func(self, *args, **kwargs) SystemMessages.pushI18nMessage( '#system_messages:vehicleCompare/disabled', type=SM_TYPE.Error)
def sellItem(self, item, count, vehicle=None): result = yield CustomizationsSeller(vehicle, item, count).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def __showInviteMessage(cls, user): if user: SystemMessages.pushI18nMessage('#system_messages:prebattle/invites/sendInvite/name', type=SystemMessages.SM_TYPE.Information, name=user.getFullName()) else: SystemMessages.pushI18nMessage('#system_messages:prebattle/invites/sendInvite', type=SystemMessages.SM_TYPE.Information)
def submit(self, item, count, currency): result = yield ModuleBuyer(item, count, currency).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def __processReturnCrew(self): result = yield TankmanReturn(g_currentVehicle.item).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def __requestForMoneyObtain(self, data): isTradeIn = data.tradeOff != -1 result = None if isTradeIn: tradeOffVehicle = self.itemsCache.items.getItemByCD( int(data.tradeOff)) confirmationType = 'tradeInConfirmation' addition = '' operations = [] if tradeOffVehicle.hasCrew: operations.append('crew') if tradeOffVehicle.hasShells: operations.append('shells') if tradeOffVehicle.hasConsumables: operations.append('equipments') if tradeOffVehicle.hasOptionalDevices: operations.append('optionalDevices') if operations: operationsStr = [ i18n.makeString('#dialogs:%s/message/%s' % (confirmationType, o)) for o in operations ] addition = i18n.makeString('#dialogs:%s/message/addition' % confirmationType, operations=', '.join(operationsStr)) ctx = { 'vehName': neutral(tradeOffVehicle.userName), 'addition': addition } result = yield showI18nConfirmDialog( confirmationType, meta=I18nConfirmDialogMeta(confirmationType, ctx, ctx), focusedID=DIALOG_BUTTON_ID.SUBMIT) if not result: return tradeOffVehicle = self.itemsCache.items.getItemByCD( int(data.tradeOff)) result = yield VehicleTradeInProcessor(self.vehicle, tradeOffVehicle, data.buySlot, data.buyAmmo, data.crewType).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if not result.success: self.onWindowClose() return if data.buySlot: result = yield VehicleSlotBuyer(showConfirm=False, showWarning=False).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if not result.success: return if not isTradeIn: if data.rentId != -1: result = yield VehicleRenter(self.vehicle, data.rentId, data.buyAmmo, data.crewType).request() else: result = yield self._getObtainVehicleProcessor( self.vehicle, data).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result and result.success: self.onWindowClose() return
def unloadCrew(): result = yield TankmanUnload(g_currentVehicle.item).request() if result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def __repair(self): vehicle = g_currentVehicle.item result = yield VehicleRepairer(vehicle).request() if result and result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)
def processMsg(result): if result and result.userMsg: SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType) if result and result.auxData: for m in result.auxData: SystemMessages.pushI18nMessage(m.userMsg, type=m.sysMsgType)
def _successHandler(self, code, ctx=None): currency = self.item.buyPrices.itemPrice.price.getCurrency(byWeight=True) messageType = MESSENGER.SERVICECHANNELMESSAGES_SYSMSG_CUSTOMIZATIONS_BUY sysMsgType = CURRENCY_TO_SM_TYPE.get(currency, SM_TYPE.PurchaseForGold) SystemMessages.pushI18nMessage(messageType, type=sysMsgType, **self._getMsgCtx()) return makeSuccess(auxData=ctx)
def __onServerSettingChanged(self, diff): if 'isCustomizationEnabled' in diff and not diff.get('isCustomizationEnabled', True): SystemMessages.pushI18nMessage(SYSTEM_MESSAGES.CUSTOMIZATION_UNAVAILABLE, type=SystemMessages.SM_TYPE.Warning) self.__onConfirmCloseWindow(proceed=True)
def unloadTankman(self): tankman = g_itemsCache.items.getTankman(self._tankmanID) result = yield TankmanUnload(g_currentVehicle.item, tankman.vehicleSlotIdx).request() if len(result.userMsg): SystemMessages.pushI18nMessage(result.userMsg, type=result.sysMsgType)