Ejemplo n.º 1
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");
            }
        }
Ejemplo n.º 2
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);
                }
            }
        }