public void Scan() { try { // Always scan these values. PlayerID.Scan(); Username.Scan(); // Always calculate the spawnset in menu or lobby. // Otherwise you can first normally load a spawnset to set the hash, exit and load an empty spawnset in the menu/lobby, then during playing the empty spawnset change it back to the same original spawnset and upload a cheated score. if (Time.Value == 0 && Time.ValuePrevious == 0) { SpawnsetHash = CalculateCurrentSurvivalHash(); } // Stop scanning if it is a replay. IsReplay.Scan(); if (IsReplay.Value) { return; } IsAlive.Scan(); Time.Scan(); Kills.Scan(); Gems.Scan(); ShotsFired.Scan(); ShotsHit.Scan(); if (IsAlive.Value) { // Enemy count might increase on death, so only scan while player is alive. EnemiesAlive.Scan(); // TODO: Clean up byte[] bytes = Memory.Read(Process.MainModule.BaseAddress + 0x001F8084, 4, out _); int ptr = AddressUtils.ToDec(AddressUtils.MakeAddress(bytes)); bytes = Memory.Read(new IntPtr(ptr), 4, out _); ptr = AddressUtils.ToDec(AddressUtils.MakeAddress(bytes)); bytes = Memory.Read(new IntPtr(ptr) + 0x218, 4, out _); LevelGems = BitConverter.ToInt32(bytes, 0); bytes = Memory.Read(new IntPtr(ptr) + 0x224, 4, out _); Homing = BitConverter.ToInt32(bytes, 0); HomingLog.Add(Homing); if (HomingLog.Count > 5) { HomingLog.Remove(HomingLog[0]); } if (LevelUpTimes[0] == 0 && LevelGems >= 10 && LevelGems < 70) { LevelUpTimes[0] = Time.Value; } if (LevelUpTimes[1] == 0 && LevelGems == 70) { LevelUpTimes[1] = Time.Value; } if (LevelUpTimes[2] == 0 && LevelGems == 71) { LevelUpTimes[2] = Time.Value; } } else { // Only scan death type when dead. DeathType.Scan(); } if (string.IsNullOrEmpty(SpawnsetHash)) { SpawnsetHash = CalculateCurrentSurvivalHash(); } } catch (Exception ex) { Logging.Log.Error("Scan failed", ex); } }