override protected void triggerInternal(GameStateData previousGameState, GameStateData currentGameState) { Boolean checkPushToGain = currentGameState.SessionData.SessionRunningTime - currentGameState.SessionData.GameTimeAtLastPositionFrontChange < minTimeToBeInThisPosition; Boolean checkPushToHold = currentGameState.SessionData.SessionRunningTime - currentGameState.SessionData.GameTimeAtLastPositionBehindChange < minTimeToBeInThisPosition; if (currentGameState.SessionData.SessionType == SessionType.Race && !currentGameState.PitData.InPitlane) { if ((checkPushToGain || checkPushToHold) && !playedNearEndTimePush && currentGameState.SessionData.SessionNumberOfLaps <= 0 && currentGameState.SessionData.SessionTimeRemaining < 4 * 60 && currentGameState.SessionData.SessionTimeRemaining > 2 * 60) { // estimate the number of remaining laps - be optimistic... int numLapsLeft = (int)Math.Ceiling((double)currentGameState.SessionData.SessionTimeRemaining / (double)currentGameState.SessionData.PlayerLapTimeSessionBest); if (currentGameState.carClass.carClassEnum == CarData.CarClassEnum.DTM_2015) { numLapsLeft = numLapsLeft + 1; } playedNearEndTimePush = checkGaps(currentGameState, numLapsLeft, checkPushToGain, checkPushToHold); } else if ((checkPushToGain || checkPushToHold) && !playedNearEndLapsPush && currentGameState.SessionData.SessionNumberOfLaps > 0 && currentGameState.SessionData.SessionNumberOfLaps - currentGameState.SessionData.CompletedLaps <= 4) { playedNearEndLapsPush = checkGaps(currentGameState, currentGameState.SessionData.SessionNumberOfLaps - currentGameState.SessionData.CompletedLaps, checkPushToGain, checkPushToHold); } } if (currentGameState.PitData.IsAtPitExit && currentGameState.PositionAndMotionData.CarSpeed > 5) { // we've just been handed control back after a pitstop if (isOpponentApproachingPitExit(currentGameState)) { // we've exited into clean air audioPlayer.playMessage(new QueuedMessage(folderTrafficBehindExitingPits, 0, this)); } else { audioPlayer.playMessage(new QueuedMessage(folderPushExitingPits, 0, this)); } // now try and report the current brake and tyre temp status try { if (brakeTempWarningOnPitExit) { ((TyreMonitor)CrewChief.getEvent("TyreMonitor")).reportBrakeTempStatus(false, false); } if (tyreTempWarningOnPitExit) { ((TyreMonitor)CrewChief.getEvent("TyreMonitor")).reportCurrentTyreTempStatus(false); } } catch (Exception e) { Console.WriteLine("Failed to report brake temp status on pit exit"); } } }
override protected void triggerInternal(GameStateData previousGameState, GameStateData currentGameState) { if (GameStateData.onManualFormationLap) { return; } if (currentGameState.SessionData.IsNewLap && currentGameState.PositionAndMotionData.CarSpeed > maxSpeedWhenCrossingLine) { maxSpeedWhenCrossingLine = currentGameState.PositionAndMotionData.CarSpeed; // the distance at which we check if there's a car exiting the pits will be speed dependent. // The faster we are over the line, the more notice we'll need. * 3 is a number I pulled out of my arse, // it may be shit. distanceBeforeStartLineToWarnOfPitExit = maxSpeedWhenCrossingLine * 3; } Boolean checkPushToGain = currentGameState.SessionData.SessionRunningTime - currentGameState.SessionData.GameTimeAtLastPositionFrontChange < minTimeToBeInThisPosition; Boolean checkPushToHold = currentGameState.SessionData.SessionRunningTime - currentGameState.SessionData.GameTimeAtLastPositionBehindChange < minTimeToBeInThisPosition; if (currentGameState.SessionData.SessionType == SessionType.Race && !currentGameState.PitData.InPitlane) { if ((checkPushToGain || checkPushToHold) && !playedNearEndTimePush && currentGameState.SessionData.SessionHasFixedTime && currentGameState.SessionData.SessionTimeRemaining < 4 * 60 && currentGameState.SessionData.SessionTimeRemaining > 2 * 60) { // estimate the number of remaining laps - be optimistic... int numLapsLeft = (int)Math.Ceiling((double)currentGameState.SessionData.SessionTimeRemaining / (double)currentGameState.SessionData.PlayerLapTimeSessionBest); if (currentGameState.SessionData.HasExtraLap) { numLapsLeft = numLapsLeft + 1; } playedNearEndTimePush = checkGaps(currentGameState, numLapsLeft, checkPushToGain, checkPushToHold); } else if ((checkPushToGain || checkPushToHold) && !playedNearEndLapsPush && !currentGameState.SessionData.SessionHasFixedTime && ((currentGameState.SessionData.SessionLapsRemaining <= 4 && currentGameState.SessionData.TrackDefinition.trackLengthClass <= TrackData.TrackLengthClass.MEDIUM) || (currentGameState.SessionData.SessionLapsRemaining <= 2 && currentGameState.SessionData.TrackDefinition.trackLengthClass <= TrackData.TrackLengthClass.LONG) || (currentGameState.SessionData.SessionLapsRemaining == 1 && currentGameState.SessionData.TrackDefinition.trackLengthClass <= TrackData.TrackLengthClass.VERY_LONG))) { playedNearEndLapsPush = checkGaps(currentGameState, currentGameState.SessionData.SessionLapsRemaining, checkPushToGain, checkPushToHold); } } if (currentGameState.PitData.IsAtPitExit && currentGameState.PositionAndMotionData.CarSpeed > 5) { // we've just been handed control back after a pitstop if (currentGameState.SessionData.SessionRunningTime > 30 && isOpponentApproachingPitExit(currentGameState)) { // we've exited into clean air audioPlayer.playMessageImmediately(new QueuedMessage(folderTrafficBehindExitingPits, 3, abstractEvent: this, type: SoundType.IMPORTANT_MESSAGE, priority: 0)); } else { audioPlayer.playMessageImmediately(new QueuedMessage(folderPushExitingPits, 3, abstractEvent: this, type: SoundType.IMPORTANT_MESSAGE, priority: 0)); } // now try and report the current brake and tyre temp status try { if (brakeTempWarningOnPitExit) { ((TyreMonitor)CrewChief.getEvent("TyreMonitor")).reportBrakeTempStatus(false, false); } if (tyreTempWarningOnPitExit) { ((TyreMonitor)CrewChief.getEvent("TyreMonitor")).reportCurrentTyreTempStatus(false); } } catch (Exception) { Console.WriteLine("Failed to report brake temp status on pit exit"); } if (!playedQualExitMessage && currentGameState.SessionData.SessionType == SessionType.Qualify) { playedQualExitMessage = true; if (currentGameState.SessionData.SessionNumberOfLaps > 0) { // special case for iracing - AFAIK no other games have number-of-laps in qual sessions audioPlayer.playMessageImmediately(new QueuedMessage("qual_pit_exit", 5, messageFragments: MessageContents(folderQualExitIntro, currentGameState.SessionData.SessionNumberOfLaps, folderQualExitOutroLaps), abstractEvent: this, type: SoundType.IMPORTANT_MESSAGE, priority: 0)); } else if (currentGameState.SessionData.SessionHasFixedTime) { int minutesLeft = (int)Math.Floor(currentGameState.SessionData.SessionTimeRemaining / 60f); if (minutesLeft > 1) { audioPlayer.playMessageImmediately(new QueuedMessage("qual_pit_exit", 5, messageFragments: MessageContents(folderQualExitIntro, minutesLeft, folderQualExitOutroMinutes), abstractEvent: this, type: SoundType.IMPORTANT_MESSAGE, priority: 0)); } } } } if (previousGameState != null && currentGameState.SessionData.SectorNumber == 3 && currentGameState.PositionAndMotionData.CarSpeed > 5 && !currentGameState.PitData.InPitlane && isApproachingStartLine(currentGameState.SessionData.TrackDefinition, previousGameState.PositionAndMotionData.DistanceRoundTrack, currentGameState.PositionAndMotionData.DistanceRoundTrack) && isOpponentLeavingPits(currentGameState)) { audioPlayer.playMessageImmediately(new QueuedMessage(folderOpponentExitingPits, 2, abstractEvent: this, type: SoundType.IMPORTANT_MESSAGE, priority: 0)); } }
public void execute(String recognitionResult, Boolean supressConfirmationMessage) { // blocking... Boolean isR3e = CrewChief.gameDefinition == GameDefinition.raceRoom; int multiplePressCountFromVoiceCommand = 0; if (macro.integerVariableVoiceTrigger != null && macro.integerVariableVoiceTrigger.Length > 0) { multiplePressCountFromVoiceCommand = macro.extractInt(recognitionResult, macro.startPhrase, macro.endPhrase); } foreach (CommandSet commandSet in macro.commandSets) { // only execute for the requested game - is this check sensible? if (CrewChief.gameDefinition.gameEnum.ToString().Equals(commandSet.gameDefinition) && assignmentsByGame.ContainsKey(commandSet.gameDefinition)) { Boolean isValid = checkValidAndPlayConfirmation(commandSet, supressConfirmationMessage); if (isValid) { ThreadManager.UnregisterTemporaryThread(executableCommandMacroThread); executableCommandMacroThread = new Thread(() => { // only allow macros to excute one at a time lock (ExecutableCommandMacro.mutex) { IntPtr currentForgroundWindow = GetForegroundWindow(); bool hasChangedForgroundWindow = BringGameWindowToFront(CrewChief.gameDefinition.processName, CrewChief.gameDefinition.alternativeProcessNames, currentForgroundWindow); foreach (ActionItem actionItem in commandSet.getActionItems()) { if (MacroManager.stopped) { break; } if (MacroManager.WAIT_IDENTIFIER.Equals(actionItem.extendedType)) { Thread.Sleep(actionItem.extendedTypeNumericParam); } else { int count; if (MacroManager.MULTIPLE_PRESS_IDENTIFIER.Equals(actionItem.extendedType)) { if (actionItem.extendedTypeTextParam != null) { if (MacroManager.MULTIPLE_PRESS_FROM_VOICE_TRIGGER_IDENTIFIER.Equals(actionItem.extendedTypeTextParam)) { count = multiplePressCountFromVoiceCommand; } else { count = CrewChief.getEvent(actionItem.extendedTypeTextParam).resolveMacroKeyPressCount(macro.name); } // hack for R3E: fuel menu needs 3 presses to get it from the start to 0 if (isR3e && macro.name.Contains("fuel")) { count = count + 3; } } else { count = actionItem.extendedTypeNumericParam; } } else { count = 1; } sendKeys(count, actionItem, commandSet.keyPressTime, commandSet.waitBetweenEachCommand); } } if (hasChangedForgroundWindow) { SetForegroundWindow(currentForgroundWindow); } } }); executableCommandMacroThread.Name = "CommandMacro.executableCommandMacroThread"; ThreadManager.RegisterTemporaryThread(executableCommandMacroThread); executableCommandMacroThread.Start(); } break; } } }
override protected void triggerInternal(GameStateData previousGameState, GameStateData currentGameState) { if (CrewChief.gameDefinition.gameEnum != GameEnum.IRACING) { return; } lastColdFLPressure = (int)currentGameState.TyreData.FrontLeftPressure; lastColdFRPressure = (int)currentGameState.TyreData.FrontRightPressure; lastColdRLPressure = (int)currentGameState.TyreData.RearLeftPressure; lastColdRRPressure = (int)currentGameState.TyreData.RearRightPressure; maxIncidentCount = currentGameState.SessionData.MaxIncidentCount; incidentsCount = currentGameState.SessionData.CurrentIncidentCount; hasLimitedIncidents = currentGameState.SessionData.HasLimitedIncidents; licenseLevel = currentGameState.SessionData.LicenseLevel; iRating = currentGameState.SessionData.iRating; strenghtOfField = currentGameState.SessionData.StrengthOfField; fuelCapacity = currentGameState.FuelData.FuelCapacity; currentFuel = currentGameState.FuelData.FuelLeft; if (autoFuelToEnd) { if (previousGameState != null && !previousGameState.PitData.InPitlane && currentGameState.PitData.InPitlane && currentGameState.SessionData.SessionType == SessionType.Race && currentGameState.SessionData.SessionRunningTime > 15 && !previousGameState.PitData.IsInGarage && !currentGameState.PitData.JumpedToPits) { Fuel fuelEvent = (Fuel)CrewChief.getEvent("Fuel"); float litresNeeded = fuelEvent.getLitresToEndOfRace(true); if (litresNeeded == float.MaxValue) { audioPlayer.playMessage(new QueuedMessage(AudioPlayer.folderNoData, 0)); } else if (litresNeeded <= 0) { audioPlayer.playMessage(new QueuedMessage(Fuel.folderPlentyOfFuel, 0)); } else if (litresNeeded > 0) { int roundedLitresNeeded = (int)Math.Ceiling(litresNeeded); AddFuel(roundedLitresNeeded); Console.WriteLine("Auto refuel to the end of the race, adding " + roundedLitresNeeded + " liters of fuel"); if (roundedLitresNeeded > fuelCapacity - currentFuel) { // if we have a known fuel capacity and this is less than the calculated amount of fuel we need, warn about it. audioPlayer.playMessage(new QueuedMessage(Fuel.folderWillNeedToStopAgain, 0, secondsDelay: 4, abstractEvent: this)); } else { audioPlayer.playMessage(new QueuedMessage(AudioPlayer.folderFuelToEnd, 0)); } } } } /* * if (hasLimitedIncidents) * { * //play < 5 incident left warning. * if (incidentsCount >= maxIncidentCount - 5 && !playedIncidentsWarning) * { * playedIncidentsWarning = true; * audioPlayer.playMessageImmediately(new QueuedMessage("Incidents/limit", MessageContents(folderYouHave, incidentsCount, folderincidentPoints, * Pause(200), folderincidentPointslimit, maxIncidentCount), 0)); * * } * else if (incidentsCount >= maxIncidentCount - 1 && !playedLastIncidentsLeftWarning) * { * playedLastIncidentsLeftWarning = true; * //play 1 incident left warning. * } * } */ }
public override void respond(String voiceMessage) { if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_ADD)) { int amount = 0; foreach (KeyValuePair <String[], int> entry in SpeechRecogniser.numberToNumber) { foreach (String numberStr in entry.Key) { if (voiceMessage.Contains(" " + numberStr + " ")) { amount = entry.Value; break; } } } if (amount == 0) { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderDidntUnderstand, 0)); return; } if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.LITERS)) { AddFuel(amount); audioPlayer.playMessageImmediately(new QueuedMessage("iracing_add_fuel", 0, messageFragments: MessageContents(AudioPlayer.folderAcknowlegeOK, amount, amount == 1 ? Fuel.folderLitre : Fuel.folderLitres))); } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.GALLONS)) { AddFuel(convertGallonsToLitres(amount)); audioPlayer.playMessageImmediately(new QueuedMessage("iracing_add_fuel", 0, messageFragments: MessageContents(AudioPlayer.folderAcknowlegeOK, amount, amount == 1 ? Fuel.folderGallon : Fuel.folderGallons))); } else { Console.WriteLine("Got fuel request with no unit, assuming " + (Fuel.fuelReportsInGallon ? " gallons" : "litres")); if (!Fuel.fuelReportsInGallon) { AddFuel(amount); audioPlayer.playMessageImmediately(new QueuedMessage("iracing_add_fuel", 0, messageFragments: MessageContents(AudioPlayer.folderAcknowlegeOK, amount, amount == 1 ? Fuel.folderLitre : Fuel.folderLitres))); } else { AddFuel(convertGallonsToLitres(amount)); audioPlayer.playMessageImmediately(new QueuedMessage("iracing_add_fuel", 0, messageFragments: MessageContents(AudioPlayer.folderAcknowlegeOK, amount, amount == 1 ? Fuel.folderGallon : Fuel.folderGallons))); } } return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_FUEL_TO_THE_END)) { Fuel fuelEvent = (Fuel)CrewChief.getEvent("Fuel"); float litresNeeded = fuelEvent.getLitresToEndOfRace(true); if (litresNeeded == float.MaxValue) { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderNoData, 0)); } else if (litresNeeded <= 0) { audioPlayer.playMessageImmediately(new QueuedMessage(Fuel.folderPlentyOfFuel, 0)); } else if (litresNeeded > 0) { int roundedLitresNeeded = (int)Math.Ceiling(litresNeeded); AddFuel(roundedLitresNeeded); if (roundedLitresNeeded > fuelCapacity - currentFuel) { // if we have a known fuel capacity and this is less than the calculated amount of fuel we need, warn about it. audioPlayer.playMessage(new QueuedMessage(Fuel.folderWillNeedToStopAgain, 0, secondsDelay: 4, abstractEvent: this)); } else { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderFuelToEnd, 0)); } return; } } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_TEAROFF)) { Tearoff(); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_FAST_REPAIR)) { FastRepair(); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CLEAR_ALL)) { ClearAll(); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CLEAR_TYRES)) { ClearTires(); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CLEAR_WIND_SCREEN)) { ClearTearoff(); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CLEAR_FAST_REPAIR)) { ClearFastRepair(); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CLEAR_FUEL)) { ClearFuel(); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_TYRE_PRESSURE) || SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_FRONT_LEFT_TYRE_PRESSURE) || SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_FRONT_RIGHT_TYRE_PRESSURE) || SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_REAR_LEFT_TYRE_PRESSURE) || SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_REAR_RIGHT_TYRE_PRESSURE)) { int amount = 0; foreach (KeyValuePair <String[], int> entry in SpeechRecogniser.numberToNumber) { foreach (String numberStr in entry.Key) { if (voiceMessage.Contains(" " + numberStr)) { amount = entry.Value; break; } } } if (amount == 0) { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderDidntUnderstand, 0)); return; } else { if (pressureUnit == PressureUnit.PSI) { amount = convertPSItoKPA(amount); } if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_TYRE_PRESSURE)) { ChangeTire(PitCommandModeTypes.LF, amount); ChangeTire(PitCommandModeTypes.RF, amount); ChangeTire(PitCommandModeTypes.LR, amount); ChangeTire(PitCommandModeTypes.RR, amount); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_FRONT_LEFT_TYRE_PRESSURE)) { ChangeTire(PitCommandModeTypes.LF, amount); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_FRONT_RIGHT_TYRE_PRESSURE)) { ChangeTire(PitCommandModeTypes.RF, amount); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_REAR_LEFT_TYRE_PRESSURE)) { ChangeTire(PitCommandModeTypes.LR, amount); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_REAR_RIGHT_TYRE_PRESSURE)) { ChangeTire(PitCommandModeTypes.RR, amount); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } } } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_ALL_TYRES)) { ChangeTire(PitCommandModeTypes.LF, lastColdFLPressure); ChangeTire(PitCommandModeTypes.RF, lastColdFRPressure); ChangeTire(PitCommandModeTypes.LR, lastColdRLPressure); ChangeTire(PitCommandModeTypes.RR, lastColdRRPressure); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_FRONT_LEFT_TYRE)) { ChangeTire(PitCommandModeTypes.LF, lastColdFLPressure); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_FRONT_RIGHT_TYRE)) { ChangeTire(PitCommandModeTypes.RF, lastColdFRPressure); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_REAR_LEFT_TYRE)) { ChangeTire(PitCommandModeTypes.LR, lastColdRLPressure); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_REAR_RIGHT_TYRE)) { ChangeTire(PitCommandModeTypes.RR, lastColdRRPressure); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_LEFT_SIDE_TYRES)) { ClearTires(); ChangeTire(PitCommandModeTypes.LF, lastColdFLPressure); ChangeTire(PitCommandModeTypes.LR, lastColdRLPressure); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.PIT_STOP_CHANGE_RIGHT_SIDE_TYRES)) { ClearTires(); ChangeTire(PitCommandModeTypes.RF, lastColdFRPressure); ChangeTire(PitCommandModeTypes.RR, lastColdRRPressure); audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderAcknowlegeOK, 0)); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.HOW_MANY_INCIDENT_POINTS)) { audioPlayer.playMessageImmediately(new QueuedMessage("Incidents/incidents", 0, messageFragments: MessageContents(folderYouHave, incidentsCount, folderincidents))); return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.WHATS_THE_INCIDENT_LIMIT)) { if (hasLimitedIncidents) { audioPlayer.playMessageImmediately(new QueuedMessage("Incidents/limit", 0, messageFragments: MessageContents(folderincidentlimit, maxIncidentCount))); } else { audioPlayer.playMessageImmediately(new QueuedMessage("Incidents/limit", 0, messageFragments: MessageContents(folderUnlimited))); } return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.WHATS_MY_IRATING)) { if (iRating != -1) { audioPlayer.playMessageImmediately(new QueuedMessage("license/irating", 0, messageFragments: MessageContents(iRating))); return; } else { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderNoData, 0)); return; } } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.WHATS_MY_LICENSE_CLASS)) { if (licenseLevel.Item2 == -1) { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderNoData, 0)); return; } if (licenseLevel.Item2 != -1) { Tuple <int, int> wholeandfractional = Utilities.WholeAndFractionalPart(licenseLevel.Item2, 2); List <MessageFragment> messageFragments = new List <MessageFragment>(); if (licenseLevel.Item1.ToLower() == "a") { messageFragments.Add(MessageFragment.Text(folderLicenseA)); } else if (licenseLevel.Item1.ToLower() == "b") { messageFragments.Add(MessageFragment.Text(folderLicenseB)); } else if (licenseLevel.Item1.ToLower() == "c") { messageFragments.Add(MessageFragment.Text(folderLicenseC)); } else if (licenseLevel.Item1.ToLower() == "d") { messageFragments.Add(MessageFragment.Text(folderLicenseD)); } else if (licenseLevel.Item1.ToLower() == "r") { messageFragments.Add(MessageFragment.Text(folderLicenseR)); } else if (licenseLevel.Item1.ToLower() == "wc") { messageFragments.Add(MessageFragment.Text(folderLicensePro)); } else { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderNoData, 0)); return; } messageFragments.AddRange(MessageContents(wholeandfractional.Item1, NumberReader.folderPoint, wholeandfractional.Item2)); QueuedMessage licenceLevelMessage = new QueuedMessage("License/license", 0, messageFragments: messageFragments); audioPlayer.playDelayedImmediateMessage(licenceLevelMessage); } return; } else if (SpeechRecogniser.ResultContains(voiceMessage, SpeechRecogniser.WHATS_THE_SOF)) { if (strenghtOfField != -1) { audioPlayer.playMessageImmediately(new QueuedMessage("license/irating", 0, messageFragments: MessageContents(strenghtOfField))); return; } else { audioPlayer.playMessageImmediately(new QueuedMessage(AudioPlayer.folderNoData, 0)); return; } } }