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 = tankmen.unpackCrewParams(crewGroup) if nationID == nations.INDICES['sweden'] and tankmen.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 nationID == nations.INDICES['italy'] and tankmen.hasTagInTankmenGroup(nationID, groupID, isPremium, _GIANLUIGI_BUFFON_VEH_NAME): SoundGroups.g_instance.setSwitch(CREW_GENDER_SWITCHES.GROUP, CREW_GENDER_SWITCHES.MALE) SoundGroups.g_instance.soundModes.setMode('buffon') 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 __setSpecialVoiceByTankmen(self, nationID, groupID, isPremium): for tag, params in self.__voiceoverByTankman.iteritems(): if tankmen.hasTagInTankmenGroup(nationID, groupID, isPremium, tag): self.__setSpecialVoice(params) return True return False
def __setSpecialVoiceByTankmen(self, nationID, groupID, isPremium, crewGroups): specialVoiceParams = None for tag in self.__voiceoverSpecialModes: if tankmen.hasTagInTankmenGroup(nationID, groupID, isPremium, tag): specialVoiceParams = self.__getSpecialModeForCrew(tag, nationID, isPremium, crewGroups) if specialVoiceParams is not None: break else: for tag, params in self.__voiceoverByTankman.iteritems(): if tankmen.hasTagInTankmenGroup(nationID, groupID, isPremium, tag): specialVoiceParams = params break if specialVoiceParams is not None: self.__setSpecialVoice(specialVoiceParams) return True return False
def _setSpecialVoiceByTankmen(nationID, groupID, isPremium): for specialVoice in _SPECIAL_VOICES: if tankmen.hasTagInTankmenGroup(nationID, groupID, isPremium, specialVoice.tag): SoundGroups.g_instance.setSwitch(CREW_GENDER_SWITCHES.GROUP, specialVoice.genderSwitch) SoundGroups.g_instance.soundModes.setMode(specialVoice.name) return True return False
def isSabatonCrew(tankmanDescr): return tankmen.hasTagInTankmenGroup(tankmanDescr.nationID, tankmanDescr.gid, tankmanDescr.isPremium, SPECIAL_CREW_TAG.SABATON)
def isOffspringCrew(tankmanDescr): return tankmen.hasTagInTankmenGroup(tankmanDescr.nationID, tankmanDescr.gid, tankmanDescr.isPremium, SPECIAL_CREW_TAG.OFFSPRING)
def __hasTagInTankmenGroup(self, nationID, group, tag): return tankmen.hasTagInTankmenGroup(nationID, group.groupID, self._isPremium, tag)
def _isOffspringCrew(tankman): return tankmen.hasTagInTankmenGroup(tankman.nationID, tankman.gId, tankman.isPremium, SPECIAL_CREW_TAG.OFFSPRING)
def _isSabatonCrew(tankman): return tankmen.hasTagInTankmenGroup(tankman.nationID, tankman.gId, tankman.isPremium, SPECIAL_CREW_TAG.SABATON)
def _hasTagInTankmenGroup(tankmanDescr, tag): return tankmen.hasTagInTankmenGroup(tankmanDescr.nationID, tankmanDescr.gid, tankmanDescr.isPremium, tag)
def isSabatonCrew(tankmanDescr): return tankmen.hasTagInTankmenGroup(tankmanDescr.nationID, tankmanDescr.gid, tankmanDescr.isPremium, SABATON_VEH_NAME)