private void SmartCorrupt_Click(object sender, RoutedEventArgs e)
 {
     foreach (var file in Directory.GetFiles(RSettings.ToolsInDirectory, "*.lvl", SearchOption.TopDirectoryOnly))
     {
         var    level    = LevelManip.Load(file);
         string filename = Path.GetFileName(file);
         LevelCorruptors.SmartCorruptActive(ref level);
         LevelCorruptors.SmartCorruptOverlay(ref level);
         string savepath = RSettings.ToolsOutDirectory + filename;
         LevelManip.Save(level, savepath);
     }
     MessageBox.Show($"Successfully Corrupted Levels", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
 }
        private void ColorLevelsAndDecorateMachine_Click(object sender, RoutedEventArgs e)
        {
            //var level1 = LevelManip.Load("C:\\Users\\Noah\\Documents\\GitHub\\TEiN-Randomizer\\EndModLoader\\bin\\Debug\\tools\\input\\_BGTILES.lvl");
            //CSV.LevelToCSV(ref level1, RSettings.ToolsOutDirectory + "level.csv");
            //CSV.RotateCSV("oldmap.csv");

            foreach (var file in Directory.GetFiles(RSettings.ToolsInDirectory, "*.lvl", SearchOption.TopDirectoryOnly))
            {
                var    level    = LevelManip.Load(file);
                string filename = Path.GetFileName(file);

                LevelCorruptors.ReplaceColorTiles(ref level);
                AutoDecorator.DecorateMachine(ref level);

                string savepath = RSettings.ToolsOutDirectory + filename;
                LevelManip.Save(level, savepath);
            }

            MessageBox.Show($"Successfully De-Colored Levels", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Esempio n. 3
0
        static void TileMaps()
        {
            string[] baseLevels = { "1-1", "1-1x", "v-connect", "v-start", "v-end" };
            var      npclevel   = LevelManip.Load($"data/tilemaps/The End is Nigh/v-npc.lvl");

            foreach (var level in baseLevels)
            {
                //File.Copy($"data/vtilemaps/The End is Nigh/{level}.lvl", saveDir + $"tilemaps/{level}.lvl", true);
                var levelFile = LevelManip.Load($"data/tilemaps/The End is Nigh/{level}.lvl");

                if (settings.MirrorMode)
                {
                    LevelManip.FlipLevelH(ref levelFile);
                }

                LevelManip.Save(levelFile, saveDir + $"tilemaps/{level}.lvl");
            }

            for (int j = 0; j < settings.NumAreas; j++)
            {
                for (int i = 0; i < settings.NumLevels; i++)
                {
                    var level     = ChosenLevels[j][i];
                    var levelFile = LevelManip.Load($"data/tilemaps/{level.Folder}/{level.Name}.lvl");

                    if (/*level.CanReverse && RNG.CoinFlip() ||*/ settings.MirrorMode)
                    {
                        LevelManip.FlipLevelH(ref levelFile);
                    }

                    if (settings.DoCorruptions)
                    {
                        level.TSNeed += LevelCorruptors.CorruptLevel(ref levelFile);
                    }

                    LevelManip.Save(levelFile, saveDir + $"tilemaps/v{j + 1}-{i + 1}.lvl");
                }
                LevelManip.Save(npclevel, saveDir + $"tilemaps/v-npc{j + 1}.lvl");
            }
        }
Esempio n. 4
0
        public static void RandomizeMod(MainWindow mw)
        {
            //ShadersList = mw.ShadersList;

            saveDir = settings.GameDirectory;

            PrepModFolders();

            // level corruptions
            string dir = $"{saveDir}tilemaps";

            if (Directory.Exists(dir))
            {
                string[] paths = Directory.GetFiles(dir);
                foreach (var file in paths)
                {
                    LevelFile level = LevelManip.Load(file);
                    //if(settings.MirrorMode)
                    //{
                    //    LevelManip.FlipLevelH(ref level);
                    //    FlipCSV(saveDir + "data/map.csv");
                    //}
                    if (settings.DoCorruptions)
                    {
                        LevelCorruptors.CorruptLevel(ref level);
                    }
                    LevelManip.Save(level, file);
                }
            }

            // data folder
            dir = $"{saveDir}data";
            if (Directory.Exists(dir))
            {
                // tilesets.txt
                var file = $"{dir}/tilesets.txt";
                if (File.Exists(file))
                {
                    string[] text = File.ReadAllLines(file);
                    for (int i = 0; i < text.Length; i++)
                    {
                        if (text[i].Contains("palette"))
                        {
                            text[i] = TilesetManip.GetPalette();
                        }
                        if (text[i].Contains("tile_graphics"))
                        {
                            text[i] = TilesetManip.GetTile();
                        }
                        if (text[i].Contains("overlay_graphics"))
                        {
                            text[i] = TilesetManip.GetOverlay();
                        }
                        if (text[i].Contains("global_particle"))
                        {
                            var split = text[i].Trim().Split(Convert.ToChar(" "));
                            text[i] = split[0] + " " + ParticleGenerator.GetParticle(settings);
                        }
                    }
                    File.Delete(file);
                    File.WriteAllLines(file, text);
                }
            }
        }