Пример #1
0
 public static void Update()
 {
     try {
         var gs = InterOp.get_game_state();
         if (gs == GameState.TitleScreen)
         {
             UberStateController.SkipListeners = true;
             if (TitleScreenCallback != null)
             {
                 OnTitleScreen();
             }
         }
         else if (gs == GameState.Game)
         {
             UberStateController.SkipListeners = false;
             UberStateController.Update();
             if (InputUnlockCallback != null && InterOp.player_can_move())
             {
                 OnInputUnlock();
             }
             SeedController.UpdateGoal();
             TrackFileController.Update();
         }
         AHK.Tick();
         BonusItemController.Update();
         DiscordController.Update();
         Client.Update();
     } catch (Exception e) {
         Log($"Update error: {e.Message}\n{e.StackTrace}");
     }
 }
Пример #2
0
        public static void Update()
        {
            try {
                RVAFinder.Update();
                if (!Memory.IsHooked)
                {
                    Memory.HookProcess();
                }

                if (Memory.GameState == GameState.TitleScreen)
                {
                    if (TitleScreenCallback != null)
                    {
                        OnTitleScreen();
                    }
                    UberStateController.SkipListenersNextUpdate = true;
                }
                else if (Memory.GameState == GameState.Game)
                {
                    UberStateController.Update();
                    if (InputUnlockCallback != null && InterOp.player_can_move())
                    {
                        OnInputUnlock();
                    }
                    SeedController.UpdateGoal();
                    TrackFileController.Update();
                }
                AHK.Tick();
            } catch (Exception e) {
                Log($"Update error: {e.Message}\n{e.StackTrace}");
            }
        }
Пример #3
0
            public void Load(int backup = -1)
            {
                string targetFile = fullName(backup);
                var    copyFrom   = new SaveData(-1);

                if (File.Exists(targetFile))
                {
                    using (var sr = new StreamReader(targetFile))
                        using (JsonReader reader = new JsonTextReader(sr)) {
                            var serializer = new JsonSerializer {
                                DefaultValueHandling = DefaultValueHandling.Populate
                            };
                            copyFrom = serializer.Deserialize <SaveData>(reader);
                        }
                }
                TreesActivated = new HashSet <AbilityType>(copyFrom.TreesActivated);
                OpherSold      = new HashSet <AbilityType>(copyFrom.OpherSold);
                OpherUpgraded  = new Dictionary <AbilityType, int>(copyFrom.OpherUpgraded);
                TwillenSold    = new HashSet <ShardType>(copyFrom.TwillenSold);
                WorldEvents    = new HashSet <QuestEventType>(copyFrom.WorldEvents);
                SkillsFound    = new HashSet <AbilityType>(copyFrom?.SkillsFound ?? new HashSet <AbilityType>());
                FoundCount     = copyFrom.FoundCount;
                KSBought       = copyFrom.KSBought;
                TrackFileController.Write();
            }
Пример #4
0
 public static void SetEvent(QuestEventType ev, bool setTo = true)
 {
     if (setTo)
     {
         Data.WorldEvents.Add(ev);
     }
     else
     {
         Data.WorldEvents.Remove(ev);
     }
     TrackFileController.Write();
 }
Пример #5
0
            public void Save(int backup = -1)
            {
                string targetFile = fullName(backup);

                if (File.Exists(targetFile))
                {
                    File.Delete(targetFile);
                }

                using (var sw = new StreamWriter(targetFile))
                    using (JsonWriter writer = new JsonTextWriter(sw)) {
                        var serializer = new JsonSerializer();
                        serializer.Serialize(writer, this);
                    }
                TrackFileController.Write();
            }
Пример #6
0
        public static void SetAbility(AbilityType ability, bool setTo = true)
        {
            if (setTo)
            {
                Data.SkillsFound.Add(ability);
            }
            else
            {
                Data.SkillsFound.Remove(ability);
            }

            InterOp.set_ability(ability, setTo);
            if (ability.Equip().HasValue)
            {
                InterOp.set_equipment(ability.Equip().Value, setTo);
            }

            TrackFileController.Write();
        }