Esempio n. 1
0
 private static void RandomizeSoundActions(List <FileInfo> files, string outPath)
 {
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundAttack.IsMatch(f.Name)), outPath);       // ATK
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundBattle.IsMatch(f.Name)), outPath);       // BAT
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundLockAttempt.IsMatch(f.Name)), outPath);  // BLOCK
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundCriticalHit.IsMatch(f.Name)), outPath);  // CRIT
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundDead.IsMatch(f.Name)), outPath);         // DEAD
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundMineFound.IsMatch(f.Name)), outPath);    // DMIN
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundLockFailure.IsMatch(f.Name)), outPath);  // FLOCK
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundHit.IsMatch(f.Name)), outPath);          // HIT
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundMineSet.IsMatch(f.Name)), outPath);      // LMIN
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundLowHealth.IsMatch(f.Name)), outPath);    // LOW
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundMedicine.IsMatch(f.Name)), outPath);     // MED
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundPoison.IsMatch(f.Name)), outPath);       // POIS
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundSoloOff.IsMatch(f.Name)), outPath);      // RPRTY
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundSelect.IsMatch(f.Name)), outPath);       // SLCT
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundLockSuccess.IsMatch(f.Name)), outPath);  // SLOCK
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundSoloOn.IsMatch(f.Name)), outPath);       // SPRTY
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundSearch.IsMatch(f.Name)), outPath);       // SRCH
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundStealth.IsMatch(f.Name)), outPath);      // STLH
     Randomize.RandomizeFiles(files.Where(f => SuffixSoundIneffective.IsMatch(f.Name)), outPath);  // TIA
 }
Esempio n. 2
0
        private static void RandomizeSoundActions(List <FileInfo> files, string outPath)
        {
            var actionList = files.Where(f => SuffixSoundAttack.IsMatch(f.Name)).ToList();
            var randList   = Randomize.RandomizeFiles(actionList, outPath); // ATK

            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundBattle.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // BAT
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundLockAttempt.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // BLOCK
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundCriticalHit.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // CRIT
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundDead.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // DEAD
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundMineFound.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // DMIN
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundLockFailure.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // FLOCK
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundHit.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // HIT
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundMineSet.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // LMIN
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundLowHealth.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // LOW
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundMedicine.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // MED
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundPoison.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // POIS
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundSoloOff.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // RPRTY
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundSelect.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // SLCT
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundLockSuccess.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // SLOCK
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundSoloOn.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // SPRTY
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundSearch.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // SRCH
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundStealth.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // STLH
            AddToSoundLookup(actionList, randList);

            actionList = files.Where(f => SuffixSoundIneffective.IsMatch(f.Name)).ToList();
            randList   = Randomize.RandomizeFiles(actionList, outPath);     // TIA
            AddToSoundLookup(actionList, randList);
        }
Esempio n. 3
0
        public static void sound_rando(KPaths paths)
        {
            // Prepare lists for new randomization.
            MusicLookupTable.Clear();
            SoundLookupTable.Clear();

            // Get file collections
            List <FileInfo> maxMusic   = new List <FileInfo>();
            List <FileInfo> maxSound   = new List <FileInfo>();
            List <FileInfo> musicFiles = new List <FileInfo>();
            List <FileInfo> soundFiles = new List <FileInfo>();

            if (Directory.Exists(paths.music_backup))
            {
                musicFiles = paths.FilesInMusicBackup.ToList();
            }
            if (Directory.Exists(paths.sounds_backup))
            {
                soundFiles = paths.FilesInSoundsBackup.ToList();
            }

            // Area Music
            List <FileInfo> areaMusic = new List <FileInfo>();

            foreach (var prefix in PrefixListAreaMusic)
            {
                areaMusic.AddRange(musicFiles.Where(f => f.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)));
            }

            if (Properties.Settings.Default.RemoveDmcaMusic)
            {
                areaMusic.RemoveAll(f => DmcaAreaMusic.Contains(f.Name));   // Remove DMCA music from the area list.
            }

            switch (Properties.Settings.Default.RandomizeAreaMusic)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(areaMusic);
                break;

            case RandomizationLevel.Type:
                var randList = Randomize.RandomizeFiles(areaMusic, paths.music);
                AddToMusicLookup(areaMusic, randList);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Ambient Noise
            List <FileInfo> ambientNoiseMusic = new List <FileInfo>();

            foreach (var prefix in PrefixListNoise)
            {
                ambientNoiseMusic.AddRange(musicFiles.Where(f => f.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)));
            }

            List <FileInfo> ambientNoiseSound = new List <FileInfo>();

            foreach (var prefix in PrefixListNoise)
            {
                ambientNoiseSound.AddRange(soundFiles.Where(f => f.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)));
            }

            switch (Properties.Settings.Default.RandomizeAmbientNoise)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(ambientNoiseMusic);
                maxSound.AddRange(ambientNoiseSound);
                break;

            case RandomizationLevel.Type:
                var randList = Randomize.RandomizeFiles(ambientNoiseMusic, paths.music);
                AddToMusicLookup(ambientNoiseMusic, randList);

                randList = Randomize.RandomizeFiles(ambientNoiseSound, paths.sounds);
                AddToSoundLookup(ambientNoiseSound, randList);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Battle Music
            List <FileInfo> battleMusic    = new List <FileInfo>(musicFiles.Where(f => RegexBattleMusic.IsMatch(f.Name)));
            List <FileInfo> battleMusicEnd = new List <FileInfo>(soundFiles.Where(f => RegexBattleMusic.IsMatch(f.Name)));

            switch (Properties.Settings.Default.RandomizeBattleMusic)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(battleMusic);
                maxSound.AddRange(battleMusicEnd);
                break;

            case RandomizationLevel.Type:
                var randList = Randomize.RandomizeFiles(battleMusic, paths.music);
                AddToMusicLookup(battleMusic, randList);

                randList = Randomize.RandomizeFiles(battleMusicEnd, paths.sounds);
                AddToSoundLookup(battleMusicEnd, randList);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Cutscene Noise
            List <FileInfo> cutsceneNoise = new List <FileInfo>(musicFiles.Where(f => RegexCutscene.IsMatch(f.Name)));

            cutsceneNoise.RemoveAll(f => f.Name.StartsWith("57.")); // Remove specific exception

            switch (Properties.Settings.Default.RandomizeCutsceneNoise)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(cutsceneNoise);
                break;

            case RandomizationLevel.Type:
                var randList = Randomize.RandomizeFiles(cutsceneNoise, paths.music);
                AddToMusicLookup(cutsceneNoise, randList);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Check if NPC and Party Sounds are combined
            List <FileInfo> npcSounds   = new List <FileInfo>(soundFiles.Where(f => RegexNPCSound.IsMatch(f.Name)));
            List <FileInfo> partySounds = new List <FileInfo>(soundFiles.Where(f => RegexPartySound.IsMatch(f.Name)));

            //if (MixNpcAndPartySounds) // Functionality Disabled
            //{
            //    npcSounds.AddRange(partySounds);
            //}
            //else
            {
                // Party Sounds (if not mixing)
                switch (Properties.Settings.Default.RandomizePartySounds)
                {
                case RandomizationLevel.Max:
                    maxSound.AddRange(partySounds);
                    break;

                case RandomizationLevel.Type:
                    var randList = Randomize.RandomizeFiles(partySounds, paths.sounds);
                    AddToSoundLookup(partySounds, randList);
                    break;

                case RandomizationLevel.Subtype:
                    RandomizeSoundActions(partySounds, paths.sounds);
                    break;

                case RandomizationLevel.None:
                default:
                    break;
                }
            }

            //// NPC Sounds (or both if mixing) // Functionality Disabled
            //switch (RandomizeNpcSounds)
            //{
            //    case RandomizationLevel.Max:
            //        maxSound.AddRange(npcSounds);
            //        break;
            //    case RandomizationLevel.Type:
            //        Randomize.RandomizeFiles(npcSounds, SoundsPath);
            //        break;
            //    case RandomizationLevel.Subtype:
            //        RandomizeSoundActions(npcSounds, SoundsPath);
            //        break;
            //    case RandomizationLevel.None:
            //    default:
            //        break;
            //}

            // Max Randomizations
            if (maxMusic.Any())
            {
                var randList = Randomize.RandomizeFiles(maxMusic, paths.music);
                AddToMusicLookup(maxMusic, randList);
            }
            if (maxSound.Any())
            {
                var randList = Randomize.RandomizeFiles(maxSound, paths.sounds);
                AddToSoundLookup(maxSound, randList);
            }

            // Overwrite DMCA music with alternatives
            if (Properties.Settings.Default.RemoveDmcaMusic)
            {
                var orig = new List <FileInfo>();
                var rand = new List <FileInfo>();
                foreach (var fi in musicFiles.Where(f => DmcaAreaMusic.Contains(f.Name)))
                {
                    var replacement = areaMusic[Randomize.Rng.Next(areaMusic.Count)];
                    File.Copy(replacement.FullName, Path.Combine(paths.music, fi.Name), true);

                    orig.Add(fi);
                    rand.Add(replacement);
                }
                AddToMusicLookup(orig, rand);
            }
        }
Esempio n. 4
0
        public static void sound_rando(KPaths paths)
        {
            var musicFiles = paths.FilesInMusicBackup;
            var soundFiles = paths.FilesInSoundsBackup;

            // Get file collections
            List <FileInfo> maxMusic = new List <FileInfo>();
            List <FileInfo> maxSound = new List <FileInfo>();

            // Area Music
            List <FileInfo> areaMusic = new List <FileInfo>();

            foreach (var prefix in PrefixListAreaMusic)
            {
                areaMusic.AddRange(musicFiles.Where(f => f.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)));
            }

            switch ((RandomizationLevel)Properties.Settings.Default.RandomizeAreaMusic)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(areaMusic);
                break;

            case RandomizationLevel.Type:
                Randomize.RandomizeFiles(areaMusic, paths.music);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Ambient Noise
            List <FileInfo> ambientNoiseMusic = new List <FileInfo>();

            foreach (var prefix in PrefixListNoise)
            {
                ambientNoiseMusic.AddRange(musicFiles.Where(f => f.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)));
            }

            List <FileInfo> ambientNoiseSound = new List <FileInfo>();

            foreach (var prefix in PrefixListNoise)
            {
                ambientNoiseSound.AddRange(soundFiles.Where(f => f.Name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)));
            }

            switch ((RandomizationLevel)Properties.Settings.Default.RandomizeAmbientNoise)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(ambientNoiseMusic);
                maxSound.AddRange(ambientNoiseSound);
                break;

            case RandomizationLevel.Type:
                Randomize.RandomizeFiles(ambientNoiseMusic, paths.music);
                Randomize.RandomizeFiles(ambientNoiseSound, paths.sounds);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Battle Music
            List <FileInfo> battleMusic    = new List <FileInfo>(musicFiles.Where(f => RegexBattleMusic.IsMatch(f.Name)));
            List <FileInfo> battleMusicEnd = new List <FileInfo>(soundFiles.Where(f => RegexBattleMusic.IsMatch(f.Name)));

            switch ((RandomizationLevel)Properties.Settings.Default.RandomizeBattleMusic)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(battleMusic);
                maxSound.AddRange(battleMusicEnd);
                break;

            case RandomizationLevel.Type:
                Randomize.RandomizeFiles(battleMusic, paths.music);
                Randomize.RandomizeFiles(battleMusicEnd, paths.sounds);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Cutscene Noise
            List <FileInfo> cutsceneNoise = new List <FileInfo>(musicFiles.Where(f => RegexCutscene.IsMatch(f.Name)));

            cutsceneNoise.RemoveAll(f => f.Name.StartsWith("57.")); // Remove specific exception

            switch ((RandomizationLevel)Properties.Settings.Default.RandomizeCutsceneNoise)
            {
            case RandomizationLevel.Max:
                maxMusic.AddRange(cutsceneNoise);
                break;

            case RandomizationLevel.Type:
                Randomize.RandomizeFiles(cutsceneNoise, paths.music);
                break;

            case RandomizationLevel.Subtype:
            case RandomizationLevel.None:
            default:
                break;
            }

            // Check if NPC and Party Sounds are combined
            List <FileInfo> npcSounds   = new List <FileInfo>(soundFiles.Where(f => RegexNPCSound.IsMatch(f.Name)));
            List <FileInfo> partySounds = new List <FileInfo>(soundFiles.Where(f => RegexPartySound.IsMatch(f.Name)));

            //if (MixNpcAndPartySounds) // Functionality Disabled
            //{
            //    npcSounds.AddRange(partySounds);
            //}
            //else
            {
                // Party Sounds (if not mixing)
                switch ((RandomizationLevel)Properties.Settings.Default.RandomizePartySounds)
                {
                case RandomizationLevel.Max:
                    maxSound.AddRange(partySounds);
                    break;

                case RandomizationLevel.Type:
                    Randomize.RandomizeFiles(partySounds, paths.sounds);
                    break;

                case RandomizationLevel.Subtype:
                    RandomizeSoundActions(partySounds, paths.sounds);
                    break;

                case RandomizationLevel.None:
                default:
                    break;
                }
            }

            //// NPC Sounds (or both if mixing) // Functionality Disabled
            //switch (RandomizeNpcSounds)
            //{
            //    case RandomizationLevel.Max:
            //        maxSound.AddRange(npcSounds);
            //        break;
            //    case RandomizationLevel.Type:
            //        Randomize.RandomizeFiles(npcSounds, SoundsPath);
            //        break;
            //    case RandomizationLevel.Subtype:
            //        RandomizeSoundActions(npcSounds, SoundsPath);
            //        break;
            //    case RandomizationLevel.None:
            //    default:
            //        break;
            //}

            // Max Randomizations
            if (maxMusic.Any())
            {
                Randomize.RandomizeFiles(maxMusic, paths.music);
            }
            if (maxSound.Any())
            {
                Randomize.RandomizeFiles(maxSound, paths.sounds);
            }
        }