def update(self, serverSettingsDiff): self.__serverSettings = updateDict(self.__serverSettings, serverSettingsDiff) if 'clanProfile' in serverSettingsDiff: self.__updateClanProfile(serverSettingsDiff) if 'spgRedesignFeatures' in self.__serverSettings: self.__spgRedesignFeatures = makeTupleByDict( _SpgRedesignFeatures, self.__serverSettings['spgRedesignFeatures']) if 'ranked_config' in serverSettingsDiff: self.__updateRanked(serverSettingsDiff) if 'hallOfFame' in serverSettingsDiff: self.__bwHallOfFame = makeTupleByDict( _BwHallOfFame, serverSettingsDiff['hallOfFame']) if 'wgcg' in serverSettingsDiff: self.__updateWgcg(serverSettingsDiff) if 'epic_config' in serverSettingsDiff: self.__updateEpic(serverSettingsDiff) if 'telecom_config' in serverSettingsDiff: self.__telecomConfig = _TelecomConfig( self.__serverSettings['telecom_config']) if 'disabledPMOperations' in serverSettingsDiff: self.__serverSettings['disabledPMOperations'] = serverSettingsDiff[ 'disabledPMOperations'] if 'ingameShop' in serverSettingsDiff: self.__updateIngameShop(serverSettingsDiff) if 'disabledPersonalMissions' in serverSettingsDiff: self.__serverSettings[ 'disabledPersonalMissions'] = serverSettingsDiff[ 'disabledPersonalMissions'] self.onServerSettingsChange(serverSettingsDiff)
def __init__(self, serverSettings): self.onServerSettingsChange = Event() self.__serverSettings = serverSettings if serverSettings else {} if 'roaming' in self.__serverSettings: roamingSettings = self.__serverSettings['roaming'] self.__roamingSettings = RoamingSettings( roamingSettings[0], roamingSettings[1], [_ServerInfo(*s) for s in roamingSettings[2]]) else: self.__roamingSettings = RoamingSettings.defaults() if 'file_server' in self.__serverSettings: self.__fileServerSettings = _FileServerSettings( self.__serverSettings['file_server']) else: self.__fileServerSettings = _FileServerSettings.defaults() if 'regional_settings' in self.__serverSettings: self.__regionalSettings = makeTupleByDict( _RegionalSettings, self.__serverSettings['regional_settings']) else: self.__regionalSettings = _RegionalSettings.defaults() try: self.__eSportCurrentSeason = makeTupleByDict( _ESportCurrentSeason, self.__serverSettings) except TypeError: self.__eSportCurrentSeason = _ESportCurrentSeason.defaults() if 'clanProfile' in self.__serverSettings: self.__updateClanProfile(self.__serverSettings) else: self.__clanProfile = _ClanProfile.defaults()
def update(self, serverSettingsDiff): self.__serverSettings = updateDict(self.__serverSettings, serverSettingsDiff) if 'clanProfile' in serverSettingsDiff: self.__updateClanProfile(serverSettingsDiff) if 'spgRedesignFeatures' in self.__serverSettings: self.__spgRedesignFeatures = makeTupleByDict( _SpgRedesignFeatures, self.__serverSettings['spgRedesignFeatures']) if 'ranked_config' in serverSettingsDiff: self.__updateRanked(serverSettingsDiff) if 'hallOfFame' in serverSettingsDiff: self.__bwHallOfFame = makeTupleByDict( _BwHallOfFame, serverSettingsDiff['hallOfFame']) if 'wgcg' in serverSettingsDiff: self.__updateWgcg(serverSettingsDiff) if 'wgm_offline_emergency_config' in serverSettingsDiff: self.__wgmOfflineEmergencyConfig = makeTupleByDict( _WGMoneyOfflineEmergencyConfig, serverSettingsDiff['wgm_offline_emergency_config']) if 'epic_config' in serverSettingsDiff: self.__updateEpic(serverSettingsDiff) if 'telecom_config' in serverSettingsDiff: self.__telecomConfig = _TelecomConfig( self.__serverSettings['telecom_config']) self.onServerSettingsChange(serverSettingsDiff)
def __init__(self, serverSettings): self.onServerSettingsChange = Event() self.__serverSettings = serverSettings if serverSettings else {} if 'roaming' in self.__serverSettings: roamingSettings = self.__serverSettings['roaming'] self.__roamingSettings = RoamingSettings(roamingSettings[0], roamingSettings[1], [ _ServerInfo(*s) for s in roamingSettings[2] ]) else: self.__roamingSettings = RoamingSettings.defaults() if 'file_server' in self.__serverSettings: self.__fileServerSettings = _FileServerSettings(self.__serverSettings['file_server']) else: self.__fileServerSettings = _FileServerSettings.defaults() if 'regional_settings' in self.__serverSettings: self.__regionalSettings = makeTupleByDict(_RegionalSettings, self.__serverSettings['regional_settings']) else: self.__regionalSettings = _RegionalSettings.defaults() try: self.__eSportCurrentSeason = makeTupleByDict(_ESportCurrentSeason, self.__serverSettings) except TypeError: self.__eSportCurrentSeason = _ESportCurrentSeason.defaults() if 'clanProfile' in self.__serverSettings: self.__updateClanProfile(self.__serverSettings) else: self.__clanProfile = _ClanProfile.defaults()
def __init__(self, results, dp): super(ClubResults, self).__init__(results, dp) personal = results['personal'].values()[0] self._ownClub = makeTupleByDict(_ClubInfo, personal['club']) self._enemyClub = makeTupleByDict(_ClubInfo, personal['enemyClub']) self.__teamInfoCBs = {} for clubDbID in (self._ownClub.clubDBID, self._enemyClub.clubDBID): self.startClubListening(clubDbID)
def update(self, serverSettingsDiff): self.__serverSettings = updateDict(self.__serverSettings, serverSettingsDiff) if 'clanProfile' in serverSettingsDiff: self.__updateClanProfile(serverSettingsDiff) if 'spgRedesignFeatures' in self.__serverSettings: self.__spgRedesignFeatures = makeTupleByDict( _SpgRedesignFeatures, self.__serverSettings['spgRedesignFeatures']) if 'ranked_config' in serverSettingsDiff: self.__updateRanked(serverSettingsDiff) if 'hallOfFame' in serverSettingsDiff: self.__bwHallOfFame = makeTupleByDict( _BwHallOfFame, serverSettingsDiff['hallOfFame']) self.onServerSettingsChange(serverSettingsDiff)
def getDataObj(self, incomeData): incomeData = incomeData or [] result = {} for data in incomeData: result[data['account_id']] = makeTupleByDict(items.AccountClanRatingsData, data) return result
def updateState(self): params = {} if self.__gasAttackMgr.state == GasAttackState.PREPARE: params['state'] = GAS_ATTACK_STATE.PREPEARING params['prevState'] = self.__state.state params['center'] = self.__gasAttackMgr.settings.position params['timeLeft'] = self.__getTimeLeft() elif self.__gasAttackMgr.state in (GasAttackState.ATTACK, GasAttackState.DONE): centerDistance = self.__getCenterDistance() currentRadius = self.__getCurrentRadius() cloudDistance = self.__getCloudDistance(currentRadius) safeZoneDistance = self.__getSafeZoneDistance() if not BigWorld.player().isVehicleAlive: state = GAS_ATTACK_STATE.DEAD elif safeZoneDistance == 0: state = GAS_ATTACK_STATE.INSIDE_SAFE_ZONE elif cloudDistance == 0: state = GAS_ATTACK_STATE.INSIDE_CLOUD elif cloudDistance <= _WARNING_DISTANCE: state = GAS_ATTACK_STATE.NEAR_CLOUD else: state = GAS_ATTACK_STATE.NEAR_SAFE params['state'] = state params['prevState'] = self.__state.state params['center'] = self.__gasAttackMgr.settings.position params['timeLeft'] = self.__getTimeLeft() params['currentRadius'] = currentRadius params['safeZoneRadius'] = self.__gasAttackMgr.settings.endRadius params['centerDistance'] = centerDistance params['safeZoneDistance'] = safeZoneDistance params['gasCloudDistance'] = cloudDistance self.__state = makeTupleByDict(_GasAttackState, params)
def getExtra(self): if self._extras is None: return elif self._prebattleTypeID in _EXTRA_BY_PRB_TYPE: return makeTupleByDict(_EXTRA_BY_PRB_TYPE[self._prebattleTypeID], self._extras) else: return
def getDataObj(self, incomeData): incomeData = incomeData or [] return dict( map( lambda v: (v['front_name'], makeTupleByDict(items.GlobalMapFrontInfoData, v)), incomeData))
def getDataObj(self, state, incomeData=None): resultData = self.getDefDataObj(state) if incomeData is not None and isinstance(incomeData, dict): resultData['outCount'] = incomeData.get('outcoming', resultData['outCount']) resultData['executionTime'] = incomeData.get( 'execution_time', resultData['executionTime']) return makeTupleByDict(SendGiftResponse, resultData)
def getBuildings(self): result = [] for b in self.buildings: try: result.append(makeTupleByDict(self._Building, b)) except: LOG_WARNING('There is error while collecting Buildings list', self.buildings) return result
def getTankmenData(self): result = [] if self._value is not None: for tankmanData in self._value: if type(tankmanData) is str: result.append(self._makeTmanInfoByDescr(tankmen.TankmanDescr(compactDescr=tankmanData))) else: result.append(makeTupleByDict(self._TankmanInfoRecord, tankmanData)) return result
def getBuildings(self): result = [] for b in self.buildings: try: result.append(makeTupleByDict(Building, b)) except: LOG_WARNING('There is error while collecting Buildings list', self.buildings) return result
def __init__(self, serverSettings): self.__serverSettings = serverSettings if serverSettings else {} if "roaming" in self.__serverSettings: roamingSettings = self.__serverSettings["roaming"] self.__roamingSettings = RoamingSettings( roamingSettings[0], roamingSettings[1], [_ServerInfo(*s) for s in roamingSettings[2]] ) else: self.__roamingSettings = RoamingSettings.defaults() if "file_server" in self.__serverSettings: self.__fileServerSettings = _FileServerSettings(self.__serverSettings["file_server"]) else: self.__fileServerSettings = _FileServerSettings.defaults() if "regional_settings" in self.__serverSettings: self.__regionalSettings = makeTupleByDict(_RegionalSettings, self.__serverSettings["regional_settings"]) else: self.__regionalSettings = _RegionalSettings.defaults() try: self.__eSportCurrentSeason = makeTupleByDict(_ESportCurrentSeason, self.__serverSettings) except TypeError: self.__eSportCurrentSeason = _ESportCurrentSeason.defaults()
def __init__(self, serverSettings): self.onServerSettingsChange = Event() self.__serverSettings = copy.deepcopy( serverSettings) if serverSettings else {} if 'roaming' in self.__serverSettings: roamingSettings = self.__serverSettings['roaming'] self.__roamingSettings = RoamingSettings( roamingSettings[0], roamingSettings[1], [_ServerInfo(*s) for s in roamingSettings[2]]) else: self.__roamingSettings = RoamingSettings.defaults() if 'file_server' in self.__serverSettings: self.__fileServerSettings = _FileServerSettings( self.__serverSettings['file_server']) else: self.__fileServerSettings = _FileServerSettings.defaults() if 'regional_settings' in self.__serverSettings: self.__regionalSettings = makeTupleByDict( _RegionalSettings, self.__serverSettings['regional_settings']) else: self.__regionalSettings = _RegionalSettings.defaults() try: self.__eSportCurrentSeason = makeTupleByDict( _ESportCurrentSeason, self.__serverSettings) except TypeError: self.__eSportCurrentSeason = _ESportCurrentSeason.defaults() if 'clanProfile' in self.__serverSettings: self.__updateClanProfile(self.__serverSettings) else: self.__clanProfile = _ClanProfile.defaults() if 'spgRedesignFeatures' in self.__serverSettings: self.__spgRedesignFeatures = makeTupleByDict( _SpgRedesignFeatures, self.__serverSettings['spgRedesignFeatures']) else: self.__spgRedesignFeatures = _SpgRedesignFeatures.defaults() if 'strongholdSettings' in self.__serverSettings: settings = self.__serverSettings['strongholdSettings'] self.__strongholdSettings = _StrongholdSettings( settings.get('wgshHostUrl', '')) else: self.__strongholdSettings = _StrongholdSettings.defaults() if 'rankedBattles' in self.__serverSettings: self.__bwRankedBattles = makeTupleByDict( _BwRankedBattles, self.__serverSettings['rankedBattles']) else: self.__bwRankedBattles = _BwRankedBattles() if 'hallOfFame' in self.__serverSettings: self.__bwHallOfFame = makeTupleByDict( _BwHallOfFame, self.__serverSettings['hallOfFame']) else: self.__bwHallOfFame = _BwHallOfFame() if 'ranked_config' in self.__serverSettings: self.__rankedBattlesSettings = makeTupleByDict( _RankedBattlesConfig, self.__serverSettings['ranked_config']) else: self.__rankedBattlesSettings = _RankedBattlesConfig()
def __getInvalidBySettings(self, settingsDiff, existingIDs): prevSettings = self.__postProgressionSettings currentSettings = self.__postProgressionSettings = makeTupleByDict( VehiclePostProgressionConfig, settingsDiff) enabledChange = currentSettings.isEnabled != prevSettings.isEnabled enabledFeaturesChange = currentSettings.enabledFeatures != prevSettings.enabledFeatures return set( existingIDs) if enabledChange or enabledFeaturesChange else set( currentSettings.forbiddenVehicles - prevSettings.forbiddenVehicles | currentSettings.enabledRentedVehicles - prevSettings.enabledRentedVehicles | prevSettings.forbiddenVehicles - currentSettings.forbiddenVehicles | prevSettings.enabledRentedVehicles - currentSettings.enabledRentedVehicles)
def format(self, message, *args): messageData = message.data if not messageData or not isinstance(messageData, dict): _logger.error('GiftSystemMessagesProxy received unsupported message data=%s', messageData) return [] else: eventID = messageData.get('eventID', GiftEventID.UNKNOWN) eventHub = self.__giftSystemCtrl.getEventHub(eventID) if eventHub is not None: try: eventHub.processMessage(makeTupleByDict(IncomeSysMessage, messageData)) except TypeError: _logger.exception('GiftSystemMessagesProxy received message with incomplete data for IncomeSysMessage') else: _logger.warning('GiftSystemMessagesProxy received message for non-existent eventID=%s', eventID) return []
def _packEventWebState(eventData): if eventData is None or not isinstance(eventData, dict): return else: try: result = { 'sendLimit': eventData['send_limit'], 'expireTime': eventData['expiration_time'], 'expireDelta': eventData['expiration_delta'], 'executionTime': eventData['execution_time'], 'state': eventData['state'] } result = makeTupleByDict(GiftsWebState, result) except (KeyError, TypeError): _logger.exception( 'Can not _packEventWebState because of invalid eventData') result = None return result
def getDataObj(self, incomeData): data = super(_BaseSearchClanContext, self).getDataObj(incomeData) return [ makeTupleByDict(items.ClanSearchData, item) for item in data ]
def getDataObj(self, incomeData): if incomeData is not None and len(incomeData) > 0: return makeTupleByDict(items.ClanExtInfoData, incomeData[0]) else: return items.ClanExtInfoData()
def getFalloutConfig(self, queueType): arenaBonusType = QUEUE_TYPE_TO_ARENA_BONUS_TYPE.get(queueType, ARENA_BONUS_TYPE.UNKNOWN) return makeTupleByDict(FalloutConfig, self.__getFallout().get(arenaBonusType, {}))
def getDataObj(self, incomeData): incomeData = incomeData or {} return makeTupleByDict(items.ClanGlobalMapStatsData, incomeData)
def getDataObj(self, incomeData): incomeData = incomeData or [] return map(lambda v: makeTupleByDict(items.AccountClanData, v), incomeData)
def getDataObj(self, incomeData): incomeData = incomeData or {} return makeTupleByDict(items.ClanFavouriteAttrs, incomeData)
def getDataObj(self, incomeData): incomeData = incomeData or [] return [ makeTupleByDict(items.ClanADInviteData, item) for item in incomeData ]
def getDataObj(self, incomeData): if incomeData: return makeTupleByDict(items.AccountClanData, incomeData.pop()) return self.getDefDataObj()
def getDataObj(self, incomeData): return makeTupleByDict(items.AccountClanData, incomeData.pop()) if incomeData else self.getDefDataObj()
def getDataObj(self, incomeData): incomeData = incomeData or {} return makeTupleByDict(items.ClanStrongholdInfoData, incomeData)
def getBuildings(self): result = {} for b in self.buildings: result[b['type']] = makeTupleByDict(self._Building, b) return result
def getDataObj(self, incomeData): incomeData = incomeData or {} return makeTupleByDict(items.ClanStrongholdStatisticsData, incomeData)
def getFalloutConfig(self, battleType): return makeTupleByDict(FalloutConfig, self.__getFallout().get(battleType, {}))
def getDataObj(self, incomeData): incomeData = incomeData or [] return dict(((v['front_name'], makeTupleByDict(items.GlobalMapFrontInfoData, v)) for v in incomeData))
def getDataObj(self, incomeData): incomeData = incomeData or {} return makeTupleByDict(items.StrongholdStatisticsData, incomeData)
def getDataObj(self, incomeData): data = super(AccountApplicationsCtx, self).getDataObj(incomeData) return [ makeTupleByDict(items.ClanInviteData, item) for item in data ]
def getDataObj(self, incomeData): incomeData = incomeData or [] return [ makeTupleByDict(items.AccountClanData, v) for v in incomeData ]
def getDataObj(self, incomeData): incomeData = incomeData or [] return [ makeTupleByDict(items.ClanProvinceData, v) for v in incomeData ]
def getDataObj(self, incomeData): incomeData = incomeData or [] return dict(map(lambda v: (v['front_name'], makeTupleByDict(items.GlobalMapFrontInfoData, v)), incomeData))
def getDataObj(self, incomeData): data = incomeData or [] return [ makeTupleByDict(items.ClanExtInfoData, item) for item in data ]
def getDataObj(self, incomeData): incomeData = incomeData or [] return map(lambda v: makeTupleByDict(items.ClanMemberData, v), incomeData)
def getDataObj(self, incomeData): return makeTupleByDict(items.ClanExtInfoData, incomeData[0]) if incomeData else items.ClanExtInfoData()
def getDataObj(self, incomeData): incomeData = incomeData or {} return makeTupleByDict(items.ClanADInviteData, incomeData)
def getDataObj(self, incomeData): data = incomeData or [] return [ makeTupleByDict(items.ClanCreateInviteData, item) for item in data ]
def __init__(self, results, dp): self._dp = weakref.proxy(dp) self._common = makeTupleByDict(stats.CommonInfo, results['common']) self._personal = makeTupleByDict(stats.PersonalInfo, results['personal'].values()[0])