def _makeAccountsData(self, accounts): result = [] isPlayerSpeaking = self.bwProto.voipController.isPlayerSpeaking getUser = self.usersStorage.getUser getColors = g_settings.getColorScheme('rosters').getColors accounts = sorted(accounts, cmp=prb_items.getPlayersComparator()) for account in accounts: vContourIcon = '' vShortName = '' vLevel = '' vType = '' user = getUser(account.dbID) if user is not None: key = user.getGuiType() else: key = USER_GUI_TYPE.OTHER if account.isVehicleSpecified(): vehicle = account.getVehicle() vContourIcon = vehicle.iconContour vShortName = vehicle.shortUserName vLevel = int2roman(vehicle.level) vType = vehicle.type result.append({ 'accID': account.accID, 'dbID': account.dbID, 'userName': account.name, 'clanAbbrev': account.clanAbbrev, 'region': self.lobbyContext.getRegionCode(account.dbID), 'fullName': account.getFullName(), 'igrType': account.igrType, 'time': account.time, 'isCreator': account.isCreator, 'state': account.state, 'icon': vContourIcon, 'vShortName': vShortName, 'vLevel': vLevel, 'vType': vType, 'tags': list(user.getTags()) if user else [], 'isPlayerSpeaking': isPlayerSpeaking(account.dbID), 'colors': getColors(key) }) return result
def __makeAccountsData(self, accounts): result = [] isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking accounts = sorted(accounts, cmp=getPlayersComparator()) getUser = self.usersStorage.getUser for account in accounts: vContourIcon = '' vShortName = '' vLevel = '' dbID = account.dbID user = getUser(dbID) if account.isVehicleSpecified(): vehicle = account.getVehicle() vContourIcon = vehicle.iconContour vShortName = vehicle.shortUserName vLevel = int2roman(vehicle.level) result.append({'accID': account.accID, 'dbID': account.dbID, 'userName': account.name, 'fullName': account.getFullName(), 'himself': account.isCurrentPlayer(), 'stateString': formatters.getPlayerStateString(account.state), 'icon': vContourIcon, 'vShortName': vShortName, 'vLevel': vLevel, 'chatRoster': user.getRoster() if user else 0, 'isPlayerSpeaking': bool(isPlayerSpeaking(account.dbID)), 'clanAbbrev': account.clanAbbrev, 'region': g_lobbyContext.getRegionCode(account.dbID), 'igrType': account.igrType}) return result
def __makeAccountsData(self, accounts, label = None): listData = [] isPlayerSpeaking = self.bwProto.voipController.isPlayerSpeaking accounts = sorted(accounts, cmp=getPlayersComparator()) getUser = self.usersStorage.getUser for account in accounts: vContourIcon = '' vShortName = '' vLevel = '' dbID = account.dbID user = getUser(dbID) if account.isVehicleSpecified(): vehicle = account.getVehicle() vContourIcon = vehicle.iconContour vShortName = vehicle.shortUserName vLevel = int2roman(vehicle.level) listData.append({'accID': account.accID, 'dbID': account.dbID, 'userName': account.name, 'fullName': account.getFullName(), 'stateString': formatters.getPlayerStateString(account.state), 'icon': vContourIcon, 'vShortName': vShortName, 'vLevel': vLevel, 'tags': list(user.getTags()) if user else [], 'isPlayerSpeaking': bool(isPlayerSpeaking(account.dbID)), 'clanAbbrev': account.clanAbbrev, 'region': g_lobbyContext.getRegionCode(account.dbID), 'igrType': account.igrType}) if label is not None: label = text_styles.main(i18n.makeString(label, total=text_styles.stats(str(len(listData))))) result = {'listData': listData, 'teamLabel': label} return result
def __makeAccountsDataForLane(self, accounts, lane, label=None): listData = [] isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking accounts = sorted(accounts, cmp=getPlayersComparator()) getUser = self.usersStorage.getUser lanecounter = [0, 0, 0] for account in accounts: lanecounter[account.group - 1] += 1 if lane >= 0 and lane == account.group: vContourIcon = '' vShortName = '' vLevel = '' dbID = account.dbID user = getUser(dbID) if account.isVehicleSpecified(): vehicle = account.getVehicle() vContourIcon = vehicle.iconContour vShortName = vehicle.shortUserName vLevel = int2roman(vehicle.level) listData.append({ 'accID': account.accID, 'dbID': account.dbID, 'userName': account.name, 'fullName': account.getFullName(), 'stateString': formatters.getPlayerStateString(account.state), 'icon': vContourIcon, 'vShortName': vShortName, 'vLevel': vLevel, 'tags': list(user.getTags()) if user else [], 'isPlayerSpeaking': bool(isPlayerSpeaking(account.dbID)), 'clanAbbrev': account.clanAbbrev, 'region': self.lobbyContext.getRegionCode(account.dbID), 'igrType': account.igrType }) if label is not None: label = text_styles.main( i18n.makeString(label, lane1=str(lanecounter[0]), lane2=str(lanecounter[1]), lane3=str(lanecounter[2]))) result = {'listData': listData, 'teamLabel': label, 'lane': lane} return result
def _makeAccountsData(self, accounts, playerComparatorType=PREBATTLE_PLAYERS_COMPARATORS.REGULAR): result = [] isPlayerSpeaking = self.bwProto.voipController.isPlayerSpeaking getUser = self.usersStorage.getUser getColors = g_settings.getColorScheme('rosters').getColors accounts = sorted(accounts, cmp=prb_items.getPlayersComparator(playerComparatorType)) for account in accounts: vContourIcon = '' vShortName = '' vLevel = '' vType = '' moduleName = '' badgeVisibility = False user = getUser(account.dbID) if user is not None: key = user.getGuiType() else: key = USER_GUI_TYPE.OTHER if account.isVehicleSpecified(): vehicle = account.getVehicle() badgeVisibility = account.getEnhancementVisibility() if badgeVisibility: moduleName = MODULE_NAME_SEPARATOR.join([ self.__craftmacineConrtoller.getModuleName(module) for module in account.getEnhancementModules() ]) vContourIcon = vehicle.iconContour vShortName = vehicle.shortUserName vLevel = int2roman(vehicle.level) vType = vehicle.type result.append({'accID': account.accID, 'dbID': account.dbID, 'userName': account.name, 'clanAbbrev': account.clanAbbrev, 'region': self.lobbyContext.getRegionCode(account.dbID), 'fullName': account.getFullName(), 'igrType': account.igrType, 'time': account.time, 'isCreator': account.isCreator, 'state': account.state, 'icon': vContourIcon, 'vShortName': vShortName, 'isCurrentPayer': account.isCurrentPlayer(), 'vLevel': vLevel, 'vType': vType, 'tags': list(user.getTags()) if user else [], 'isPlayerSpeaking': isPlayerSpeaking(account.dbID), 'colors': getColors(key), 'isExperimentalModule': bool(badgeVisibility), 'experimentalModuleName': moduleName, 'hasPermissions': False}) return result
def _getSlotsIterator(self, accounts): for (slotIdx, account,) in enumerate(sorted(accounts, cmp=prb_items.getPlayersComparator())): state = unit_items.SlotState(False, False) player = unit_items.PlayerUnitInfo.fromPrbInfo(account, slotIdx=slotIdx) vehicleUnitData = None if account.isVehicleSpecified(): vehiclePrbItem = account.getVehicle() vehicleUnitData = {'vehLevel': vehiclePrbItem.level, 'inNationIdx': vehiclePrbItem.innationID, 'nationIdx': vehiclePrbItem.nationID, 'vehInvID': vehiclePrbItem.invID, 'vehTypeCompDescr': vehiclePrbItem.intCD, 'vehClassIdx': constants.VEHICLE_CLASS_INDICES.get(vehiclePrbItem.type)} yield unit_items.SlotInfo(slotIdx, state, player, vehicleUnitData) for freeSlotIdx in range(len(accounts), self.SLOTS_COUNT): yield unit_items.SlotInfo(freeSlotIdx, unit_items.SlotState(False, True), None, None)
def _makeAccountsData(self, accounts): result = [] isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking getUser = self.usersStorage.getUser getColors = g_settings.getColorScheme('rosters').getColors accounts = sorted(accounts, cmp=prb_items.getPlayersComparator()) for account in accounts: vContourIcon = '' vShortName = '' vLevel = '' vType = '' user = getUser(account.dbID) if user is not None: key = user.getGuiType() else: key = USER_GUI_TYPE.OTHER if account.isVehicleSpecified(): vehicle = account.getVehicle() vContourIcon = vehicle.iconContour vShortName = vehicle.shortUserName vLevel = int2roman(vehicle.level) vType = vehicle.type result.append({'accID': account.accID, 'dbID': account.dbID, 'userName': account.name, 'clanAbbrev': account.clanAbbrev, 'region': g_lobbyContext.getRegionCode(account.dbID), 'fullName': account.getFullName(), 'igrType': account.igrType, 'time': account.time, 'himself': account.isCurrentPlayer(), 'isCreator': account.isCreator, 'state': account.state, 'icon': vContourIcon, 'vShortName': vShortName, 'vLevel': vLevel, 'vType': vType, 'chatRoster': user.getRoster() if user else 0, 'isPlayerSpeaking': isPlayerSpeaking(account.dbID), 'colors': getColors(key)}) return result
def __makeAccountsData(self, accounts, label=None): listData = [] isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking accounts = sorted(accounts, cmp=getPlayersComparator()) getUser = self.usersStorage.getUser for account in accounts: vContourIcon = "" vShortName = "" vLevel = "" dbID = account.dbID user = getUser(dbID) if account.isVehicleSpecified(): vehicle = account.getVehicle() vContourIcon = vehicle.iconContour vShortName = vehicle.shortUserName vLevel = int2roman(vehicle.level) listData.append( { "accID": account.accID, "dbID": account.dbID, "userName": account.name, "fullName": account.getFullName(), "stateString": formatters.getPlayerStateString(account.state), "icon": vContourIcon, "vShortName": vShortName, "vLevel": vLevel, "tags": list(user.getTags()) if user else [], "isPlayerSpeaking": bool(isPlayerSpeaking(account.dbID)), "clanAbbrev": account.clanAbbrev, "region": g_lobbyContext.getRegionCode(account.dbID), "igrType": account.igrType, } ) if label is not None: label = text_styles.main(i18n.makeString(label, total=text_styles.stats(str(len(listData))))) result = {"listData": listData, "teamLabel": label} return result