private uint CalculateRating1(Stats p_Stats) { var s_Rating1 = 0.0; // Frisk Failed var s_FriskFailed = p_Stats.m_FriskFailed >= 34 ? 33 : p_Stats.m_FriskFailed; s_Rating1 += m_Multipliers[s_FriskFailed] * 6.0; // Covers Blown var s_CoverBlown = p_Stats.m_CoverBlown >= 34 ? 33 : p_Stats.m_CoverBlown; s_Rating1 += m_Multipliers[s_CoverBlown] * 6.0; // Bodies Found int s_BodiesFound; if (Difficulty <= 1) s_BodiesFound = p_Stats.m_BodiesFound >= 34 ? 33 : p_Stats.m_BodiesFound; else s_BodiesFound = (p_Stats.m_BodiesFound + p_Stats.m_TargetBodiesFound) >= 34 ? 33 : (p_Stats.m_BodiesFound + p_Stats.m_TargetBodiesFound); s_Rating1 += m_Multipliers[s_BodiesFound] * 6.0; // Unconscious Bodies Found var s_UnconsciousBodiesFound = p_Stats.m_UnconsciousBodiesFound >= 34 ? 33 : p_Stats.m_UnconsciousBodiesFound; s_Rating1 += m_Multipliers[s_UnconsciousBodiesFound] * 6.0; // Witnesses var s_Witnesses = p_Stats.m_Witnesses >= 34 ? 33 : p_Stats.m_Witnesses; s_Rating1 += m_Multipliers[s_Witnesses] * 8.0; // Caught on Camera var s_CameraCaught = p_Stats.m_CameraCaught >= 34 ? 33 : p_Stats.m_CameraCaught; s_Rating1 += m_Multipliers[s_CameraCaught] * 10.0; // Items Left if (Difficulty == 3) { if (p_Stats.m_CustomWeaponsLeftOnLevel > 0) s_Rating1 += 5.0; if (p_Stats.m_SuitLeftOnLevel) s_Rating1 += 5.0; } // Max Rating is 100 s_Rating1 = s_Rating1 > 100.0 ? 100.0 : s_Rating1; return (uint) Math.Ceiling((Math.Round(s_Rating1) / 100.0) * 6.0); }
private void ProcessStats(Stats p_Stats) { CurrentStats = p_Stats; // Get difficulty. try { var s_DifficultyPtrData = m_Engine.Reader.Read(m_Engine.Reader.Process.MainModule.BaseAddress + 0x41F83C, 4); if (s_DifficultyPtrData != null) { var s_UnknownPtr = BitConverter.ToUInt32(s_DifficultyPtrData, 0); var s_Difficulty = m_Engine.Reader.Read(s_UnknownPtr + 0x6664, 1); if (s_Difficulty != null) Difficulty = s_Difficulty[0]; } } catch (Exception) { } // Update UI difficulty. m_Engine.Control.SetDifficulty(Difficulty); // Calculate rating. var s_Rating0 = CalculateRating0(p_Stats); var s_Rating1 = CalculateRating1(p_Stats); // Update UI rating. m_Engine.Control.SetRatingPerfect((s_Rating0 + s_Rating1) == 0); m_Engine.Control.SetRating(m_Ratings[s_Rating0 + "x" + s_Rating1]); // Update UI stats. var s_BodiesFound = p_Stats.m_BodiesFound + p_Stats.m_UnconsciousBodiesFound; if (Difficulty > 1) s_BodiesFound += p_Stats.m_TargetBodiesFound; m_Engine.Control.SetBodiesFound(s_BodiesFound); m_Engine.Control.SetCameraCaught(p_Stats.m_CameraCaught); m_Engine.Control.SetEnemiesKilled(p_Stats.m_EnemiesKilled); m_Engine.Control.SetEnemiesWounded(p_Stats.m_EnemiesWounded); m_Engine.Control.SetPolicemenKilled(p_Stats.m_PoliceMenKilled); m_Engine.Control.SetPolicemenWounded(p_Stats.m_PoliceMenWounded); m_Engine.Control.SetInnocentsKilled(p_Stats.m_InnocentsKilled); m_Engine.Control.SetInnocentsWounded(p_Stats.m_InnocentsWounded); m_Engine.Control.SetWitnesses(p_Stats.m_Witnesses); m_Engine.Control.SetFriskFailed(p_Stats.m_FriskFailed); m_Engine.Control.SetCoversBlown(p_Stats.m_CoverBlown); if (Difficulty == 3) m_Engine.Control.SetItemsLeft(p_Stats.m_CustomWeaponsLeftOnLevel, p_Stats.m_SuitLeftOnLevel); else m_Engine.Control.SetItemsLeft(0, false); }
private uint CalculateRating0(Stats p_Stats) { var s_Rating0 = 0.0; // Innocents Killed var s_InnocentsKilled = p_Stats.m_InnocentsKilled >= 34 ? 33 : p_Stats.m_InnocentsKilled; s_Rating0 += m_Multipliers[s_InnocentsKilled] * 12.0; // Innocents Wounded var s_InnocentsWounded = p_Stats.m_InnocentsWounded >= 34 ? 33 : p_Stats.m_InnocentsWounded; s_Rating0 += m_Multipliers[s_InnocentsWounded] * 6.0; // Enemies Killed var s_EnemiesKilled = p_Stats.m_EnemiesKilled >= 34 ? 33 : p_Stats.m_EnemiesKilled; s_Rating0 += m_Multipliers[s_EnemiesKilled] * 6.0; // Enemies Wounded var s_EnemiesWounded = p_Stats.m_EnemiesWounded >= 34 ? 33 : p_Stats.m_EnemiesWounded; s_Rating0 += m_Multipliers[s_EnemiesWounded] * 3.0; // Policemen Killed var s_PoliceMenKilled = p_Stats.m_PoliceMenKilled >= 34 ? 33 : p_Stats.m_PoliceMenKilled; s_Rating0 += m_Multipliers[s_PoliceMenKilled] * 9.0; // Policemen Wounded var s_PoliceMenWounded = p_Stats.m_PoliceMenWounded >= 34 ? 33 : p_Stats.m_PoliceMenWounded; s_Rating0 += m_Multipliers[s_PoliceMenWounded] * 5.0; // Max Rating is 100 s_Rating0 = s_Rating0 > 100.0 ? 100.0 : s_Rating0; return (uint) Math.Ceiling((Math.Round(s_Rating0) / 100.0) * 6.0); }