Example #1
0
        private void BuildSavedGameList()
        {
            foreach (Transform child in contentPane)
            {
                Destroy(child.gameObject);
            }

            allSavedGames = SavedGame.GetAllSavedGames();

            foreach (BriefSavedGame sg in allSavedGames)
            {
                GameObject visualGameSlot = Instantiate(pVisualGameSlot, contentPane);
                visualGameSlot.GetComponent <VisualGameSlot>().SetData(sg, gameSlotGroup);
            }
        }
Example #2
0
        public string AnalyzeCommand(string command)
        {
            command = command.ToLower();
            if (command.StartsWith("/loadedgame"))
            {
                return("Filepath of the current game: " + SavedGame.FilePath);
            }
            if (command.StartsWith("/gamename"))
            {
                return("Game name: " + SavedGame.Name);
            }
            if (command.StartsWith("/gamecharacter"))
            {
                return("Character: " + SavedGame.Name);
            }
            if (command.StartsWith("/currentmap"))
            {
                return("Current map: " + SavedGame.CurrentWorld);
            }
            if (command.StartsWith("/currentarea"))
            {
                return("Current area: " + SavedGame.CurrentArea);
            }
            if (command.StartsWith("/currentdistance"))
            {
                return("Current distance: " + SavedGame.CurrentDistance);
            }
            if (command.StartsWith("/totalsteps"))
            {
                return("Steps: " + SavedGame.Steps);
            }
            if (command.StartsWith("/stepstonextevent"))
            {
                return("Steps until the next event: " + SavedGame.StepsToNextEvent);
            }
            if (command.StartsWith("/playerexperience"))
            {
                return("Player experience: " + SavedGame.PlayerExperience);
            }
            if (command.StartsWith("/playerspiritpower"))
            {
                return("Player spirit power: " + SavedGame.SpiritPower);
            }
            if (command.StartsWith("/totalwins"))
            {
                return("Total wins: " + SavedGame.TotalWins);
            }
            if (command.StartsWith("/isInputLocked"))
            {
                return("Input Locked: " + gm.IsInputLocked);
            }
            if (command.StartsWith("/getdigimonlevel"))
            {
                string[] args = command.Split(' ');
                if (args.Length == 2)
                {
                    if (Database.GetDigimon(args[1]) == null)
                    {
                        return("Digimon not found.");
                    }
                    return("Digimon " + args[1] + " level: " + SavedGame.GetDigimonLevel(args[1]));
                }
                return("Invalid parameters. Expected (string)digimonName");
            }
            if (command.StartsWith("/isareacompleted"))
            {
                string[] args = command.Split(' ');
                if (args.Length == 3)
                {
                    try {
                        return($"Area + {args[1]}, {args[2]} completed: {SavedGame.CompletedAreas[int.Parse(args[1])][int.Parse(args[2])]}");
                    }
                    catch {
                        return("Invalid parameter.");
                    }
                }
                return("Invalid parameters. Expected (int)map, (int)area");
            }
            //Reports
            if (command.StartsWith("/generatereport"))
            {
                string[] args = command.Split(' ');
                if (args.Length == 2)
                {
                    if (args[1] == "expgain")
                    {
                        string filePath = GenerateLevelEmulation();
                        return($"Report created in {filePath}");
                    }
                    else
                    {
                        return("Unknown report.");
                    }
                }
                return("Invalid parameters. Expected (string)report.");
            }
            if (command.StartsWith("/emulateattacks"))
            {
                string[] args = command.Split(' ');
                if (args.Length == 1)
                {
                    return(GenerateAttackEmulation());
                }
                else if (args.Length == 2)
                {
                    return(GenerateAttackEmulationForDigimon(args[1]));
                }
            }
            if (command.StartsWith("/printallbosses"))
            {
                string filePath = PrintAllBossesToFile();
                return($"Report created in {filePath}");
            }
            if (command.StartsWith("/cheatsused"))
            {
                return($"Cheats used this game: {SavedGame.CheatsUsed}");
            }
            if (command.StartsWith("/getcurrentdistance"))
            {
                return(SavedGame.CurrentDistance.ToString());
            }
            if (command.StartsWith("/getdistanceforarea"))
            {
                string[] args = command.Split(' ');
                if (args.Length == 3)
                {
                    try {
                        string result = Database.Worlds[int.Parse(args[1])].areas[int.Parse(args[2])].distance.ToString();
                        return(result);
                    }
                    catch {
                    }
                }
                return("Invalid parameters. Expected (int)map, (int)area");
            }
            if (command.StartsWith("/checkabilitysprites"))
            {
                CheckDigimonAbilities();
                return("");
            }
            //===============================================================//
            //====== COMMANDS THAT WON'T WORK BEFORE /letmecheatplease ======//
            //===============================================================//
            if (command.StartsWith("/letmecheatplease"))
            {
                EnableCheats();
                return("Cheat commands are now enabled.");
            }
            //These commands modify the data of the game and will trigger "CheatsUsed".
            if (!consoleActivated)
            {
                return("Invalid command.");
            }

            if (command.StartsWith("/cancelbattle"))
            {
                gm.DisableLeaverBuster();
                return("LeaverBuster disabled for this battle if you close the application now.");
            }
            if (command.StartsWith("/setspiritpower"))
            {
                SavedGame.CheatsUsed = true;
                string[] args = command.Split(' ');
                if (args.Length == 2)
                {
                    try {
                        SavedGame.SpiritPower = int.Parse(args[1]);
                        return("Current spirit power: " + SavedGame.SpiritPower);
                    }
                    catch {
                        return("Invalid number.");
                    }
                }
                return("Invalid parameters. Expected (int)amount");
            }
            if (command.StartsWith("/setdigimonlevel"))
            {
                SavedGame.CheatsUsed = true;
                string[] args = command.Split(' ');
                if (args.Length == 3)
                {
                    if (Database.GetDigimon(args[1]) == null)
                    {
                        return("Digimon not found.");
                    }
                    if (args[2].StartsWith("max"))
                    {
                        int maxLevel = Database.GetDigimon(args[1]).MaxExtraLevel + 1;
                        SavedGame.SetDigimonLevel(args[1], maxLevel);
                        return($"Digimon {args[1]} level set to: {maxLevel}");
                    }
                    else
                    {
                        try {
                            SavedGame.SetDigimonLevel(args[1], int.Parse(args[2]));
                            return("Digimon " + args[1] + " level set to: " + SavedGame.GetDigimonLevel(args[1]));
                        }
                        catch {
                            return("Invalid number.");
                        }
                    }
                }
                return("Invalid parameters. Expected (string)digimonName, (int)level / (string)\"max\".");
            }
            if (command.StartsWith("/unlockalldigimon"))
            {
                SavedGame.CheatsUsed = true;
                UnlockAllDigimon();
                return("All Digimon have been unlocked.");
            }
            if (command.StartsWith("/lockalldigimon"))
            {
                SavedGame.CheatsUsed = true;
                LockAllDigimon();
                return("All Digimon have been locked.");
            }
            if (command.StartsWith("/setdigimoncodeunlocked"))
            {
                SavedGame.CheatsUsed = true;
                string[] args = command.Split(' ');
                if (args.Length == 3)
                {
                    if (Database.GetDigimon(args[1]) == null)
                    {
                        return("Digimon not found.");
                    }
                    if (args[2].ToLower() == "true")
                    {
                        SavedGame.SetDigicodeUnlocked(args[1], true);
                        return("Code for " + args[1] + " unlocked set to: true.");
                    }
                    else if (args[2].ToLower() == "false")
                    {
                        SavedGame.SetDigicodeUnlocked(args[1], false);
                        return("Code for " + args[1] + " unlocked set to: false.");
                    }
                    else
                    {
                        return("Invalid value. Value can only be 'true' or 'false'");
                    }
                }
                return("Invalid parameters. Expected (string)digimonName, (true/false)unlocked.");
            }
            if (command.StartsWith("/setplayerexperience"))
            {
                SavedGame.CheatsUsed = true;
                string[] args = command.Split(' ');
                if (args.Length == 2)
                {
                    try {
                        SavedGame.PlayerExperience = int.Parse(args[1]);
                        return($"Player experience set to {args[1]}");
                    }
                    catch {
                        return("Invalid number.");
                    }
                }
                return("Invalid parameters. Expected (int)experience.");
            }
            if (command.StartsWith("/setcurrentdistance"))
            {
                string[] args = command.Split(' ');
                if (args.Length == 2)
                {
                    try {
                        SavedGame.CurrentDistance = int.Parse(args[1]);
                        return($"Current distance set to {int.Parse(args[1])}");
                    }
                    catch {
                    }
                }
                return("Invalid parameters. Expected (int)distance");
            }
            if (command.StartsWith("/setstepstonextevent"))
            {
                string[] args = command.Split(' ');
                if (args.Length == 2)
                {
                    try {
                        SavedGame.StepsToNextEvent = int.Parse(args[1]);
                        return($"Steps to next event: {int.Parse(args[1])}");
                    }
                    catch {
                    }
                }
                return("Invalid parameters. Expected (int)steps");
            }
            if (command.StartsWith("/empowerenergy"))
            {
                if (gm.logicMgr.loadedApp is Apps.Battle b)
                {
                    b.CheatEnergy();
                    return("Energy empowered.");
                }
                else
                {
                    return("Player is not in a battle!");
                }
            }

            return("Invalid command.");
        }