/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Game Detection * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // Determine the version of GTA3 public void DetermineGameVersionIII() { p = Process.GetProcessesByName("gta3"); if (p.Length != 0) { if (ReadValue(p[0].Handle, 0x5C1E70, false, true) == 1407551829) // 1.0 { major = 1; minor = 0; region = regionTypes.GTA; gameStatus = statuses.Running; address_radio = 0x8F3967; } else if (ReadValue(p[0].Handle, 0x5C2130, false, true) == 1407551829) // 1.1 { major = 1; minor = 1; region = regionTypes.GTA; gameStatus = statuses.Running; address_radio = 0x8F3A1B; } else if (ReadValue(p[0].Handle, 0x5C6FD0, false, true) == 1407551829) // 1.1 Steam { major = 1; minor = 1; region = regionTypes.Steam; gameStatus = statuses.Running; address_radio = 0x903B5C;; } else { gameStatus = statuses.Unrecognized; } } else { gameStatus = statuses.Shutdown; } }
void setRowStatus(statuses s, DataGridViewRow r, string m) { r.HeaderCell.Value = m; switch (s) { case statuses.SUCCESS: r.HeaderCell.Style.BackColor = Color.LightGreen; break; case statuses.ERROR: r.HeaderCell.Style.BackColor = Color.Pink; break; case statuses.WRONG: r.HeaderCell.Style.BackColor = Color.Red; break; case statuses.WARNING: r.HeaderCell.Style.BackColor = Color.Yellow; break; case statuses.NEUTRAL: r.HeaderCell.Style.BackColor = SystemColors.Control; break; default: throw new Exception("Unknown option: " + s); } }
void Update() { //Calls patrol function Patrol(); //Sets overal alert status depending on if the AI can hear/see the player if (soundAlertStatus == statuses.alert || sightAlertStatus == statuses.alert) { overallStatus = statuses.alert; } else if (soundAlertStatus == statuses.suspicious || sightAlertStatus == statuses.suspicious) { overallStatus = statuses.suspicious; } else if (soundAlertStatus == statuses.patrolling || sightAlertStatus == statuses.patrolling) { overallStatus = statuses.patrolling; } //If health is 0 or less then call dead function if (health <= 0 && !dead) { Dead(); } AIPosition = transform.position; AIPosition.y = AIPosition.y + 1; //Sets health bar healthBarPercent = (health / healthStart) * 0.2542284f; healthBar.localScale = new Vector3(healthBarPercent, healthBar.localScale.y, healthBar.localScale.z); }
// This function checks whether winamp is actually playing. To prevent crash if winamp has just been booted but hasn't started music yet. private int checkMP3ActiveStatus() { int playerActive = 0; if (playerStatus == statuses.Running) { try { playerActive = ReadValue(q[0].Handle, address_running, musicP == musicPlayers.Foobar, false); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException F"); playerStatus = statuses.Shutdown; return(0); } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException F"); playerStatus = statuses.Shutdown; return(0); } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException F"); playerStatus = statuses.Shutdown; return(0); } return(playerActive); } else { return(0); } }
public BaseCopybook() { _image = null; //_image_basewidth = 0; //_image_baseheight = 0; _imagestatus = statuses.norm; }
// Determine the version of GTAVC public void DetermineGameVersionVC() { p = Process.GetProcessesByName("gta-vc"); if (p.Length != 0) { if (ReadValue(p[0].Handle, 0x667BF0, false, true) == 1407551829) // 1.0 { major = 1; minor = 0; region = regionTypes.GTA; gameStatus = statuses.Running; address_radio = 0x9839C0; } else if (ReadValue(p[0].Handle, 0x667C40, false, true) == 1407551829) // 1.1 { major = 1; minor = 1; region = regionTypes.GTA; gameStatus = statuses.Running; address_radio = 0x9839C0; gameStatus = statuses.Unconfirmed; } else if (ReadValue(p[0].Handle, 0xA402ED, false, true) == 1448235347) // 1.1 Steam { major = 1; minor = 1; region = regionTypes.Steam; gameStatus = statuses.Running; address_radio = 0x9829C8; } else if (ReadValue(p[0].Handle, 0xACD0A2, false, true) == 1793887061) // 1.1 JP { major = 1; minor = 1; region = regionTypes.Japan; gameStatus = statuses.Running; address_radio = 0x9809D0; } else { gameStatus = statuses.Unrecognized; } } else { gameStatus = statuses.Shutdown; } }
public Tile_Data() { neighbours = new int[4]; for (int i = 0; i < neighbours.Length; i++) { neighbours[i] = -999; status = statuses.clear; } }
void SetSoundAlert(statuses status) { //Check inputed function switch (status) { //If status was alert set the AI audio alert status to alert and make sure that no audio is false. case statuses.alert: soundAlertStatus = status; noAudioCheck = false; break; //Check if the AI is already alert. If not check how long they have been in the the hearable distance for. If more than the check timer then audio status is alert case statuses.suspicious: if (soundAlertStatus == statuses.alert) { soundAlertStatus = statuses.alert; } else { soundAlertStatus = status; } if (!suspiciousAudioCheck) { suspiciousAudioCheck = true; suspiciousAudioTimerEnd = suspiciousTimer + Time.time; } else if (suspiciousAudioCheck && Time.time > suspiciousAudioTimerEnd) { soundAlertStatus = statuses.alert; } noAudioCheck = false; lastKnownPos = player.transform.position; break; //If player is no making noise then audio check back to patrolling case statuses.patrolling: if (!noAudioCheck) { noAudioCheck = true; noAudioTimerEnd = noAudioTimer + Time.time; } else if (soundAlertStatus == statuses.alert && noAudioCheck && Time.time < noAudioTimerEnd) { soundAlertStatus = statuses.alert; } else { soundAlertStatus = status; } suspiciousAudioCheck = false; break; } }
//status update private void updateStatusBtn_Click(object sender, RoutedEventArgs e) { statuses status = (statusesGrid.SelectedItem as statuses); statuses thisStatus = _db.getStatusInfo(status.id).Single(); thisStatus.name = status.name; _db.SaveChanges(); statusesGrid.ItemsSource = _db.statuses.ToList(); MessageBox.Show("Зміни успішно збережено"); }
private void AddStatusBtn_Click(object sender, RoutedEventArgs e) { statuses newItem = new statuses() { name = statusTextBox.Text }; db.statuses.Add(newItem); db.SaveChanges(); this.Hide(); }
private void buttonSend_Click(object sender, EventArgs e) { textOutput.Text = ""; List <Parameter> parameters = new List <Parameter>(); OauthKey oauthKey = new OauthKey(); oauthKey.customKey = appKey; oauthKey.customSecret = appSecret; oauthKey.tokenKey = accessKey; oauthKey.tokenSecret = accessSecret; bool getMethod = comboMethod.SelectedIndex == 0 ? true : false; /*http请求参数的name域数组*/ List <string> arryName = new List <string>(); /*http请求参数的value域数组*/ List <string> arryValue = new List <string>(); listViewHeader.GetColumnItem(1, arryName); listViewHeader.GetColumnItem(2, arryValue); /*将从listview拿到的value进行utf8编码,后加入请求参数列表*/ string ret; UTF8Encoding utf8 = new UTF8Encoding(); if (0 == comboMethod.SelectedIndex) { statuses st = new statuses(oauthKey, "json"); ret = st.home_timeline(Convert.ToInt32(arryValue[0]), Convert.ToInt32(arryValue[1]), Convert.ToInt32(arryValue[2])); } else { t twit = new t(oauthKey, "json"); ret = twit.add_pic(utf8.GetString(utf8.GetBytes(arryValue[0])), utf8.GetString(utf8.GetBytes(arryValue[1])), utf8.GetString(utf8.GetBytes(arryValue[2])), utf8.GetString(utf8.GetBytes(arryValue[3])), utf8.GetString(utf8.GetBytes(arryValue[4])) ); // ret = twit.add_pic("xxxx","127.0.0.1","","","E:\abc.jpg"); } textOutput.Text = ret; }
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Music Player Detection * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ // Determine the version of Winamp public void DeterminePlayerVersionWinamp() { q = Process.GetProcessesByName("winamp"); if (q.Length != 0) { playerStatus = statuses.Running; address_volume = 0x07AA9D9C; address_running = 0x4BF3EC; } else { playerStatus = statuses.Shutdown; } }
// Determine the version of Foobar public void DeterminePlayerVersionFoobar() { q = Process.GetProcessesByName("foobar2000"); if (q.Length != 0) { playerStatus = statuses.Running; address_base = q[0].MainModule.BaseAddress.ToInt32(); address_volume = address_base + 0x18C438; address_running = address_base + 0x18B1F0; foobarExecutableLocation = q[0].MainModule.FileName; } else { playerStatus = statuses.Shutdown; } }
// Determine the version of GTASA public void DetermineGameVersionSA() { p = Process.GetProcessesByName("gta-sa"); if (p.Length == 0) { p = Process.GetProcessesByName("gta_sa"); } if (p.Length != 0) { if (ReadValue(p[0].Handle, 0x82457C, false, true) == 38079) // 1.0 US { major = 1; minor = 0; region = regionTypes.US; gameStatus = statuses.Running; address_radio = 0x008CB760; } else if (ReadValue(p[0].Handle, 0x8245BC, false, true) == 38079) // 1.0 EU { major = 1; minor = 0; region = regionTypes.Europe; gameStatus = statuses.Running; address_radio = 0x008CB760; } else if (ReadValue(p[0].Handle, 0x8252FC, false, true) == 38079) // 1.1 US { major = 1; minor = 1; region = regionTypes.US; gameStatus = statuses.Running; address_radio = 0x008CCFE8; gameStatus = statuses.Unconfirmed; } else if (ReadValue(p[0].Handle, 0x82533C, false, true) == 38079) // 1.1 EU { major = 1; minor = 1; region = regionTypes.Europe; gameStatus = statuses.Running; address_radio = 0x008CCFE8; gameStatus = statuses.Unconfirmed; } else if (ReadValue(p[0].Handle, 0x85EC4A, false, true) == 38079) // 3.0 Steam { major = 3; minor = 0; region = regionTypes.Steam; gameStatus = statuses.Running; address_radio = 0x0093AB68; } else { gameStatus = statuses.Unrecognized; } } else { gameStatus = statuses.Shutdown; } }
// volume slider is used for checking if radio is on or off (winamp didn't want to let me take control of its mute button) public int checkMP3PlayerStatus() { int volumeLevel = -1; if (playerStatus == statuses.Running) { try { volumeLevel = ReadValue(q[0].Handle, address_volume, musicP == musicPlayers.Foobar, false); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException E"); playerStatus = statuses.Shutdown; return(-1); } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException E"); playerStatus = statuses.Shutdown; return(-1); } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException E"); playerStatus = statuses.Shutdown; return(-1); } // If it returns 255, make sure it isn't glitching, which winamp likes to do if it hasn't been turned on yet if (volumeLevel == 255) { int activity; activity = checkMP3ActiveStatus(); return(volumeLevel * activity); } return(volumeLevel); } else { return(-1); } }
public void ChangeStatus(statuses NewStatus) { if (this.species.resistance == NewStatus) return; this.status = NewStatus; if (NewStatus == statuses.Poison) this.statusTimer = 6; else this.statusTimer = 12; string message = ""; if (this != Program.entities[0]) { message = String.Concat(this.name, " is now "); } switch (NewStatus) { case statuses.Charmed: { message = String.Concat(message, "Charmed!"); break; } case statuses.Poison: { message = String.Concat(message, "Poisoned!"); break; } case statuses.Paralyzed: { message = String.Concat(message, "Paralyzed!"); break; } } if (NewStatus == statuses.Normal) { if (this != Program.entities[0]) message = String.Concat(this.name, " seems revived!"); else message = String.Concat("You feel revived!"); } Program.Report(message); }
// This isn't actually going to detect anything public void DeterminePlayerVersionOther() { playerStatus = statuses.Running; }
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Radio Status Detection * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ public void CheckRadioStatusIII() { if (playerStatus != statuses.Running) { return; } if (actionToTake == actions.Pause) { if (gameStatus == statuses.Running || gameStatus == statuses.Unconfirmed) { #region try catch radiostatus try { radioStatus = ReadValue(p[0].Handle, address_radio, false, false); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException A"); gameStatus = statuses.Shutdown; return; } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException A"); gameStatus = statuses.Shutdown; return; } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException A"); gameStatus = statuses.Shutdown; return; } #endregion #region pause and unpause condition clauses if (radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 10 && radioPlayDuringEmergency == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 197 && radioPlayDuringPauseMenu == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } if (radioStatus >= 13 && radioStatus <= 14 && radioPlayDuringAnnouncement == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 197 && radioPlayDuringPauseMenu == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus == 10 && radioPlayDuringEmergency == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus >= 13 && radioStatus <= 14 && radioPlayDuringAnnouncement == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus > 10 && radioStatus != 197 && radioStatus != 13 && radioStatus != 14 && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } #endregion } } else if (actionToTake == actions.Volume) { // Unless the radio is currently changing, allow user to change volume #region maxvolume changer if (gameStatus != statuses.Running && gameStatus != statuses.Unconfirmed) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio == true) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus == 10 && radioPlayDuringEmergency == true) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus == 197 && radioPlayDuringPauseMenu == true) { maxVolume = checkMP3PlayerStatus(); } #endregion prevRadioStatus = radioStatus; if (gameStatus == statuses.Running || gameStatus == statuses.Unconfirmed) { #region try catch radiostatus try { radioStatus = ReadValue(p[0].Handle, address_radio, false, false); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException B"); gameStatus = statuses.Shutdown; return; } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException B"); gameStatus = statuses.Shutdown; return; } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException B"); gameStatus = statuses.Shutdown; return; } #endregion volumeStatus = checkMP3PlayerStatus(); RadioChangerVolume(radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio || radioStatus == 10 && radioPlayDuringEmergency == true || radioStatus >= 13 && radioStatus <= 14 && radioPlayDuringAnnouncement == true || radioStatus == 197 && radioPlayDuringPauseMenu == true ); } } }
public void CheckRadioStatusVC() { if (playerStatus != statuses.Running) { return; } if (actionToTake == actions.Pause) { if (gameStatus == statuses.Running || gameStatus == statuses.Unconfirmed) { try { radioStatus = ReadValue(p[0].Handle, address_radio, false, true); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException C"); gameStatus = statuses.Shutdown; return; } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException C"); gameStatus = statuses.Shutdown; return; } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException C"); gameStatus = statuses.Shutdown; return; } if (radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } if (radioStatus >= 25 && radioStatus <= 26 && radioPlayDuringAnnouncement == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 23 && radioPlayDuringEmergency == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 1225 && radioPlayDuringPauseMenu == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 24 && radioPlayDuringKaufman == true && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 1225 && radioPlayDuringPauseMenu == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus >= 25 && radioStatus <= 26 && radioPlayDuringAnnouncement == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus == 23 && radioPlayDuringEmergency == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus == 24 && radioPlayDuringKaufman == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio == false && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } else if (radioStatus > 9 && radioStatus < 23 && isPaused == false || radioStatus > 26 && radioStatus != 1225 && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } } } else if (actionToTake == actions.Volume) { // Unless the radio is currently changing, allow user to change volume if (gameStatus != statuses.Running && gameStatus != statuses.Unconfirmed) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio == true) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus >= 25 && radioStatus <= 26 && radioPlayDuringAnnouncement == true) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus == 23 && radioPlayDuringEmergency == true) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus == 24 && radioPlayDuringKaufman == true) { maxVolume = checkMP3PlayerStatus(); } else if (maxVolumeWriteable && radioStatus == 1225 && radioPlayDuringPauseMenu == true) { maxVolume = checkMP3PlayerStatus(); } prevRadioStatus = radioStatus; if (gameStatus == statuses.Running || gameStatus == statuses.Unconfirmed) { try { radioStatus = ReadValue(p[0].Handle, address_radio, false, true); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException D"); gameStatus = statuses.Shutdown; return; } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException D"); gameStatus = statuses.Shutdown; return; } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException D"); gameStatus = statuses.Shutdown; return; } volumeStatus = checkMP3PlayerStatus(); RadioChangerVolume(radioStatus >= 0 && radioStatus <= 9 && radioPlayDuringRadio || radioStatus == 23 && radioPlayDuringEmergency == true || radioStatus == 24 && radioPlayDuringKaufman == true || radioStatus >= 25 && radioStatus <= 26 && radioPlayDuringAnnouncement == true || radioStatus == 1225 && radioPlayDuringPauseMenu == true ); } } }
public void CheckRadioStatusSA() { if (playerStatus != statuses.Running) { return; } if (actionToTake == actions.Pause) { if (gameStatus == statuses.Running || gameStatus == statuses.Unconfirmed) { try { radioStatus = ReadValue(p[0].Handle, address_radio, false, true); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException H"); gameStatus = statuses.Shutdown; return; } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException H"); gameStatus = statuses.Shutdown; return; } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException H"); gameStatus = statuses.Shutdown; return; } if (radioStatus == 2 && isPaused == true) { isPaused = false; RadioChangerPause(isPaused); } else if (radioStatus == 7 && isPaused == false) { isPaused = true; RadioChangerPause(isPaused); } } } else if (actionToTake == actions.Volume) { // Unless the radio is currently changing, allow user to change volume if (maxVolumeWriteable == true && radioStatus == 2 || gameStatus != statuses.Running && gameStatus != statuses.Unconfirmed) { maxVolume = checkMP3PlayerStatus(); } prevRadioStatus = radioStatus; if (gameStatus == statuses.Running || gameStatus == statuses.Unconfirmed) { try { radioStatus = ReadValue(p[0].Handle, address_radio, false, true); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException J"); gameStatus = statuses.Shutdown; return; } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException J"); gameStatus = statuses.Shutdown; return; } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException J"); gameStatus = statuses.Shutdown; return; } volumeStatus = checkMP3PlayerStatus(); RadioChangerVolume(radioStatus == 2); } } // e216: else if for muting added else if (actionToTake == actions.Mute) { if (gameStatus == statuses.Running || gameStatus == statuses.Unconfirmed) { try { radioStatus = ReadValue(p[0].Handle, address_radio, false, true); } catch (InvalidOperationException) { Debug.WriteLine("InvalidOperationException H"); gameStatus = statuses.Shutdown; return; } catch (NullReferenceException) { Debug.WriteLine("NullReferenceException H"); gameStatus = statuses.Shutdown; return; } catch (IndexOutOfRangeException) { Debug.WriteLine("IndexOutOfRangeException H"); gameStatus = statuses.Shutdown; return; } if (radioStatus == 2 && isMuted == true) { isMuted = false; RadioChangerMute(isMuted); } else if (radioStatus == 7 && isMuted == false) { isMuted = true; RadioChangerMute(isMuted); } } } }
// Change Radio based on Volume slider void RadioChangerVolume(bool radioOn) { radioActive = radioOn; if (radioOn && volumeStatus < maxVolume) { maxVolumeWriteable = false; if (Control.ModifierKeys == Keys.Shift || Control.ModifierKeys == Keys.Alt || Control.ModifierKeys == Keys.Control) { if (!ignoreMods) { return; } } if (volumeStatus == prevVolumeStatus) { failSafeAttempts += 1; if (failSafeAttempts > 100000) { playerStatus = statuses.Error; return; } } // radio should be on but volume is too low keybd_event(0xAF, 0, 1, IntPtr.Zero); if (quickVolume) { keybd_event(0xAF, 0, 1, IntPtr.Zero); keybd_event(0xAF, 0, 1, IntPtr.Zero); } keybd_event(0xAF, 0, 2, IntPtr.Zero); prevVolumeStatus = volumeStatus; volumeStatus = checkMP3PlayerStatus(); } else if (!radioOn && volumeStatus > 0) { if (Control.ModifierKeys == Keys.Shift || Control.ModifierKeys == Keys.Alt || Control.ModifierKeys == Keys.Control) { if (!ignoreMods) { return; } } // radio should be off but volume isn't 0 if (volumeStatus == prevVolumeStatus) { failSafeAttempts += 1; if (failSafeAttempts > 100000) { playerStatus = statuses.Error; return; } } keybd_event(0xAE, 0, 1, IntPtr.Zero); keybd_event(0xAE, 0, 1, IntPtr.Zero); keybd_event(0xAE, 0, 1, IntPtr.Zero); if (quickVolume) { keybd_event(0xAE, 0, 1, IntPtr.Zero); keybd_event(0xAE, 0, 1, IntPtr.Zero); keybd_event(0xAE, 0, 1, IntPtr.Zero); keybd_event(0xAE, 0, 1, IntPtr.Zero); keybd_event(0xAE, 0, 1, IntPtr.Zero); keybd_event(0xAE, 0, 1, IntPtr.Zero); } keybd_event(0xAE, 0, 2, IntPtr.Zero); prevVolumeStatus = volumeStatus; volumeStatus = checkMP3PlayerStatus(); } else if (maxVolumeWriteable == false) { maxVolumeWriteable = true; failSafeAttempts = 0; } }
void SetSightAlert(statuses status) { //Check inputed function switch (status) { //If status was alert set the AI alert status to alert and make sure that loseSight isn't true case statuses.alert: sightAlertStatus = status; loseSightCheck = false; point.SetBool("Alert", true); point.SetBool("Suspicious", false); break; //If suspicious then check if already alert. If not check how long they have been in the viewcone for. If more than the check timer then become alert case statuses.suspicious: if (sightAlertStatus == statuses.alert) { sightAlertStatus = statuses.alert; } else { sightAlertStatus = status; point.SetBool("Alert", false); point.SetBool("Suspicious", true); } if (!suspiciousCheck) { suspiciousCheck = true; suspiciousTimerEnd = suspiciousTimer + Time.time; } else if (suspiciousCheck && Time.time > suspiciousTimerEnd) { sightAlertStatus = statuses.alert; } lastKnownPos = player.transform.position; loseSightCheck = false; break; //If player is no longer in a viewcone check how long they have not been seen for. If more than lose sight time then set back to partrolling case statuses.patrolling: if (!loseSightCheck) { loseSightCheck = true; loseSightTimerEnd = loseSightTimer + Time.time; } else if (sightAlertStatus == statuses.alert && loseSightCheck && Time.time < loseSightTimerEnd) { sightAlertStatus = statuses.alert; } else { sightAlertStatus = status; point.SetBool("Alert", false); point.SetBool("Suspicious", false); } suspiciousCheck = false; break; } }
public virtual void Loop() { if (status != statuses.Normal) { if (status == statuses.Poison) { this.health = this.health - 10; if (this.health <= 0) { Program.Report(String.Concat(name, " died!")); this.die("Poison"); } } if (statusTimer == 0) { statuses OldStatus = this.status; this.status = statuses.Normal; if (this == Program.entities[0]) { string message = "No longer "; switch (OldStatus) { case statuses.Charmed: { message = String.Concat(message, "charmed!"); break; } case statuses.Poison: { message = String.Concat(message, "poisoned!"); break; } case statuses.Paralyzed: { message = String.Concat(message, "paralyzed!"); break; } } Program.Report(message); } } else statusTimer = statusTimer - 1; } foreach (LearnedSpell u in this.spells) u.Loop(); }