Пример #1
0
 private string GetCurrentSplit(LogicManager logic, SplitterSettings settings)
 {
     if (logic.CurrentSplit >= settings.Autosplits.Count)
     {
         return("N/A");
     }
     return(settings.Autosplits[logic.CurrentSplit].ToString());
 }
Пример #2
0
        public void Update(LogicManager logic, SplitterSettings settings)
        {
            if (!EnableLogging)
            {
                return;
            }

            lock (LogEntries) {
                DateTime  date           = DateTime.Now;
                bool      isDead         = logic.Memory.Dead();
                GameState gameState      = logic.Memory.GameState();
                bool      isLoading      = logic.Memory.IsLoadingGame(gameState);
                bool      dontCheckValue = isDead || isLoading || gameState != GameState.Game;
                foreach (LogObject key in Enum.GetValues(typeof(LogObject)))
                {
                    string previous = currentValues[key];
                    string current  = null;

                    switch (key)
                    {
                    case LogObject.CurrentSplit: current = $"{logic.CurrentSplit} ({GetCurrentSplit(logic, settings)})"; break;

                    case LogObject.Pointers: current = logic.Memory.GamePointers(); break;

                    case LogObject.Keystones: current = dontCheckValue ? previous : logic.Memory.Keystones().ToString(); break;

                    case LogObject.Ore: current = dontCheckValue ? previous : logic.Memory.Ore().ToString(); break;

                    case LogObject.MapCompletion: current = dontCheckValue ? previous : logic.Memory.MapCompletion().ToString("0.000"); break;

                    case LogObject.Abilities: if (!dontCheckValue)
                        {
                            CheckAbilities(logic);
                        }
                        break;

                    case LogObject.Shards: if (!dontCheckValue)
                        {
                            CheckShards(logic);
                        }
                        break;

                    case LogObject.Area: current = dontCheckValue ? previous : logic.Memory.PlayerArea().ToString(); break;

                    case LogObject.Dead: current = isDead.ToString(); break;

                    case LogObject.GameState: current = gameState.ToString(); break;

                    case LogObject.TitleScreen: current = logic.Memory.TitleScreen().ToString(); break;

                    case LogObject.LoadingGame: current = isLoading.ToString(); break;

                    case LogObject.Scene: string scene = logic.Memory.CurrentScene(); current = string.IsNullOrEmpty(scene) ? previous : scene; break;

                    case LogObject.UberState: if (!dontCheckValue)
                        {
                            CheckUberStates(logic);
                        }
                        break;

                    case LogObject.Patches: current = logic.Memory.Patches(); break;

                    case LogObject.Stats: current = dontCheckValue ? previous : logic.Memory.PlayerStats().ToString(); break;

                    case LogObject.Version: current = MemoryManager.Version.ToString(); break;
                        //case LogObject.Position: Vector2 point = logic.Memory.Position(); current = $"{point.X:0}, {point.Y:0}"; break;
                    }

                    if (previous != current)
                    {
                        AddEntryUnlocked(new ValueLogEntry(date, key, previous, current));
                        currentValues[key] = current;
                    }
                }
            }
        }