def refreshNationalVoice(self): player = BigWorld.player() if self is not player.getVehicleAttached(): return else: crewGroup = 0 arena = getattr(player, 'arena', None) if arena is not None: crewGroup = arena.vehicles[self.id]['crewGroup'] vehicleTypeID = self.typeDescriptor.type.id nationID, _ = vehicleTypeID LOG_DEBUG("Refreshing current vehicle's national voices", nationID) groupID, isFemaleCrewCommander, isPremium = unpackCrewParams( crewGroup) if nationID == nations.INDICES['sweden'] and hasTagInTankmenGroup( nationID, groupID, isPremium, sabaton_crew.SABATON_VEH_NAME): SoundGroups.g_instance.setSwitch(CREW_GENDER_SWITCHES.GROUP, CREW_GENDER_SWITCHES.MALE) SoundGroups.g_instance.soundModes.setMode('sabaton') return if vehicleTypeID in _VALKYRIE_SOUND_MODES and self.id == player.playerVehicleID: SoundGroups.g_instance.soundModes.setMode( _VALKYRIE_SOUND_MODES[vehicleTypeID]) return genderSwitch = CREW_GENDER_SWITCHES.DEFAULT if SoundGroups.g_instance.soundModes.currentNationalPreset[1]: if isFemaleCrewCommander: genderSwitch = CREW_GENDER_SWITCHES.FEMALE nation = nations.NAMES[nationID] SoundGroups.g_instance.soundModes.setCurrentNation( nation, genderSwitch) return
def _isCrewCompleted(nationID, isPremium, tankmenGroups, tag): requiredCrew = tankmen.getTankmenWithTag(nationID, isPremium, tag) actualCrew = [ tankmen.unpackCrewParams(tGroup)[0] for tGroup in tankmenGroups ] return set(actualCrew) <= requiredCrew if len(actualCrew) <= len( requiredCrew) else requiredCrew < set(actualCrew)
def setSpecialVoice(crewGroup, vehicleType, isPlayerVehicle): groupID, isFemaleCrewCommander, isPremium = tankmen.unpackCrewParams( crewGroup) nationID, _ = vehicleType.id if _setSpecialVoiceByTankmen(nationID, groupID, isPremium): return if vehicleType.name in _VALKYRIE_SOUND_MODES and isPlayerVehicle: SoundGroups.g_instance.soundModes.setMode( _VALKYRIE_SOUND_MODES[vehicleType.name]) return genderSwitch = CREW_GENDER_SWITCHES.DEFAULT if SoundGroups.g_instance.soundModes.currentNationalPreset[1]: if isFemaleCrewCommander: genderSwitch = CREW_GENDER_SWITCHES.FEMALE nation = nations.NAMES[nationID] SoundGroups.g_instance.soundModes.setCurrentNation(nation, genderSwitch)
def __setVoiceoverByVehicleOrTankman(self, vehiclePublicInfo, isPlayerVehicle): vehicleType = VehicleDescr(vehiclePublicInfo.compDescr).type if self.__setSpecialVoiceByVehicle(vehicleType.name, isPlayerVehicle): return else: groupID, isFemale, isPremium = tankmen.unpackCrewParams(vehiclePublicInfo.crewGroup) nationID, _ = vehicleType.id if self.__setSpecialVoiceByTankmen(nationID, groupID, isPremium): return preset = SoundGroups.g_instance.soundModes.currentNationalPreset isNationalPreset = preset[1] if preset is not None else False if isNationalPreset: commanderSkinID = vehiclePublicInfo.commanderSkinID if self.__setSpecialVoiceByCommanderSkinID(isFemale, commanderSkinID): return genderSwitch = CREW_GENDER_SWITCHES.FEMALE if isFemale and isNationalPreset else CREW_GENDER_SWITCHES.DEFAULT SoundGroups.g_instance.soundModes.setCurrentNation(nations.NAMES[nationID], genderSwitch) return
def __setVoiceoverByVehicleOrTankman(self, vehiclePublicInfo, isPlayerVehicle): vehicleType = VehicleDescr(vehiclePublicInfo.compDescr).type if self.__setSpecialVoiceByVehicle(vehicleType.name, isPlayerVehicle): return else: nationID, _ = vehicleType.id isFemale = False crewGroups = vehiclePublicInfo.crewGroups if crewGroups: groupID, isFemale, isPremium = tankmen.unpackCrewParams(crewGroups[0]) if self.__setSpecialVoiceByTankmen(nationID, groupID, isPremium, crewGroups): return else: _logger.error('There is not information about vehicle commander to extract correct sound mode') preset = SoundGroups.g_instance.soundModes.currentNationalPreset isNationalPreset = preset[1] if preset is not None else False if isNationalPreset: commanderSkinID = vehiclePublicInfo.commanderSkinID if self.__setSpecialVoiceByCommanderSkinID(isFemale, commanderSkinID): return genderSwitch = CREW_GENDER_SWITCHES.FEMALE if isFemale and isNationalPreset else CREW_GENDER_SWITCHES.DEFAULT SoundGroups.g_instance.soundModes.setCurrentNation(nations.NAMES[nationID], genderSwitch) return